feat: store tool restrictions in session-tools-store at prompt-send sites
Call setSessionTools(sessionID, tools) before every prompt dispatch so the tools object is captured and available for later retrieval when background tasks complete.
This commit is contained in:
@@ -3,6 +3,7 @@ import { isPlanFamily } from "./constants"
|
||||
import { promptWithModelSuggestionRetry } from "../../shared/model-suggestion-retry"
|
||||
import { formatDetailedError } from "./error-formatting"
|
||||
import { getAgentToolRestrictions } from "../../shared/agent-tool-restrictions"
|
||||
import { setSessionTools } from "../../shared/session-tools-store"
|
||||
|
||||
export async function sendSyncPrompt(
|
||||
client: OpencodeClient,
|
||||
@@ -18,17 +19,19 @@ export async function sendSyncPrompt(
|
||||
): Promise<string | null> {
|
||||
try {
|
||||
const allowTask = isPlanFamily(input.agentToUse)
|
||||
const tools = {
|
||||
task: allowTask,
|
||||
call_omo_agent: true,
|
||||
question: false,
|
||||
...getAgentToolRestrictions(input.agentToUse),
|
||||
}
|
||||
setSessionTools(input.sessionID, tools)
|
||||
await promptWithModelSuggestionRetry(client, {
|
||||
path: { id: input.sessionID },
|
||||
body: {
|
||||
agent: input.agentToUse,
|
||||
system: input.systemContent,
|
||||
tools: {
|
||||
task: allowTask,
|
||||
call_omo_agent: true,
|
||||
question: false,
|
||||
...getAgentToolRestrictions(input.agentToUse),
|
||||
},
|
||||
tools,
|
||||
parts: [{ type: "text", text: input.args.prompt }],
|
||||
...(input.categoryModel ? { model: { providerID: input.categoryModel.providerID, modelID: input.categoryModel.modelID } } : {}),
|
||||
...(input.categoryModel?.variant ? { variant: input.categoryModel.variant } : {}),
|
||||
|
||||
Reference in New Issue
Block a user