diff --git a/apps/sim/app/api/copilot/chat/route.ts b/apps/sim/app/api/copilot/chat/route.ts index 57e6575d6ce..305280b8f0c 100644 --- a/apps/sim/app/api/copilot/chat/route.ts +++ b/apps/sim/app/api/copilot/chat/route.ts @@ -302,6 +302,7 @@ export async function POST(req: NextRequest) { goRoute: '/api/copilot', autoExecuteTools: true, interactive: true, + promptForToolApproval: true, }, }) @@ -315,6 +316,7 @@ export async function POST(req: NextRequest) { goRoute: '/api/copilot', autoExecuteTools: true, interactive: true, + promptForToolApproval: true, }) const responseData = { diff --git a/apps/sim/app/api/mothership/chat/route.ts b/apps/sim/app/api/mothership/chat/route.ts index 8cd9d40cc4c..eee1f4c2e0c 100644 --- a/apps/sim/app/api/mothership/chat/route.ts +++ b/apps/sim/app/api/mothership/chat/route.ts @@ -262,6 +262,7 @@ export async function POST(req: NextRequest) { goRoute: '/api/mothership', autoExecuteTools: true, interactive: true, + promptForToolApproval: false, onComplete: async (result: OrchestratorResult) => { if (!actualChatId) return diff --git a/apps/sim/lib/copilot/orchestrator/sse/handlers/handlers.ts b/apps/sim/lib/copilot/orchestrator/sse/handlers/handlers.ts index 04c779c08b9..fcd63272245 100644 --- a/apps/sim/lib/copilot/orchestrator/sse/handlers/handlers.ts +++ b/apps/sim/lib/copilot/orchestrator/sse/handlers/handlers.ts @@ -320,7 +320,7 @@ export const sseHandlers: Record = { return } - if (requiresConfirmation) { + if (requiresConfirmation && options.promptForToolApproval) { const decision = await waitForToolDecision( toolCallId, options.timeout || STREAM_TIMEOUT_MS, @@ -569,7 +569,7 @@ export const subAgentHandlers: Record = { return } - if (requiresConfirmation) { + if (requiresConfirmation && options.promptForToolApproval) { const decision = await waitForToolDecision( toolCallId, options.timeout || STREAM_TIMEOUT_MS, diff --git a/apps/sim/lib/copilot/orchestrator/types.ts b/apps/sim/lib/copilot/orchestrator/types.ts index 4f912dc4989..130666c81e6 100644 --- a/apps/sim/lib/copilot/orchestrator/types.ts +++ b/apps/sim/lib/copilot/orchestrator/types.ts @@ -139,6 +139,13 @@ export interface OrchestratorOptions { onError?: (error: Error) => void | Promise abortSignal?: AbortSignal interactive?: boolean + /** + * When true, tools with `requiresConfirmation` will block until the client + * explicitly approves or rejects. When false (e.g. Mothership chat), those + * tools are auto-executed without waiting for user approval. + * Defaults to false. + */ + promptForToolApproval?: boolean } export interface OrchestratorResult {