Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/sim/app/api/copilot/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ export async function POST(req: NextRequest) {
goRoute: '/api/copilot',
autoExecuteTools: true,
interactive: true,
promptForToolApproval: true,
},
})

Expand All @@ -315,6 +316,7 @@ export async function POST(req: NextRequest) {
goRoute: '/api/copilot',
autoExecuteTools: true,
interactive: true,
promptForToolApproval: true,
})

const responseData = {
Expand Down
1 change: 1 addition & 0 deletions apps/sim/app/api/mothership/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions apps/sim/lib/copilot/orchestrator/sse/handlers/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ export const sseHandlers: Record<string, SSEHandler> = {
return
}

if (requiresConfirmation) {
if (requiresConfirmation && options.promptForToolApproval) {
const decision = await waitForToolDecision(
toolCallId,
options.timeout || STREAM_TIMEOUT_MS,
Expand Down Expand Up @@ -569,7 +569,7 @@ export const subAgentHandlers: Record<string, SSEHandler> = {
return
}

if (requiresConfirmation) {
if (requiresConfirmation && options.promptForToolApproval) {
const decision = await waitForToolDecision(
toolCallId,
options.timeout || STREAM_TIMEOUT_MS,
Expand Down
7 changes: 7 additions & 0 deletions apps/sim/lib/copilot/orchestrator/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ export interface OrchestratorOptions {
onError?: (error: Error) => void | Promise<void>
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 {
Expand Down
Loading