Skip to content

Commit 24173bb

Browse files
committed
Improvements
1 parent 64efeaa commit 24173bb

File tree

2 files changed

+36
-4
lines changed
  • apps/sim
    • app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call
    • stores/panel/copilot

2 files changed

+36
-4
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/tool-call/tool-call.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1426,7 +1426,9 @@ function RunSkipButtons({
14261426
setButtonsHidden(true)
14271427
try {
14281428
// Add to auto-allowed list - this also executes all pending integration tools of this type
1429+
console.log('[RunSkipButtons] Always Allow clicked for tool:', toolCall.name)
14291430
await addAutoAllowedTool(toolCall.name)
1431+
console.log('[RunSkipButtons] addAutoAllowedTool completed for:', toolCall.name)
14301432
// For client tools with interrupts (not integration tools), we still need to call handleRun
14311433
// since executeIntegrationTool only works for server-side tools
14321434
if (!isIntegrationTool(toolCall.name)) {
@@ -1526,7 +1528,11 @@ export function ToolCall({
15261528
toolCall.name === 'user_memory' ||
15271529
toolCall.name === 'edit_respond' ||
15281530
toolCall.name === 'debug_respond' ||
1529-
toolCall.name === 'plan_respond'
1531+
toolCall.name === 'plan_respond' ||
1532+
toolCall.name === 'research_respond' ||
1533+
toolCall.name === 'info_respond' ||
1534+
toolCall.name === 'deploy_respond' ||
1535+
toolCall.name === 'superagent_respond'
15301536
)
15311537
return null
15321538

apps/sim/stores/panel/copilot/store.ts

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,6 +2116,24 @@ const subAgentSSEHandlers: Record<string, SSEHandler> = {
21162116
})
21172117
})
21182118
}
2119+
} else {
2120+
// Check if this is an integration tool (server-side) that should be auto-executed
2121+
const isIntegrationTool = !CLASS_TOOL_METADATA[name]
2122+
if (isIntegrationTool && isSubAgentAutoAllowed) {
2123+
logger.info('[SubAgent] Auto-executing integration tool (auto-allowed)', {
2124+
id,
2125+
name,
2126+
})
2127+
// Execute integration tool via the store method
2128+
const { executeIntegrationTool } = get()
2129+
executeIntegrationTool(id).catch((err) => {
2130+
logger.error('[SubAgent] Integration tool auto-execution failed', {
2131+
id,
2132+
name,
2133+
error: err?.message || err,
2134+
})
2135+
})
2136+
}
21192137
}
21202138
}
21212139
} catch (e: any) {
@@ -3923,11 +3941,16 @@ export const useCopilotStore = create<CopilotStore>()(
39233941

39243942
loadAutoAllowedTools: async () => {
39253943
try {
3944+
logger.info('[AutoAllowedTools] Loading from API...')
39263945
const res = await fetch('/api/copilot/auto-allowed-tools')
3946+
logger.info('[AutoAllowedTools] Load response', { status: res.status, ok: res.ok })
39273947
if (res.ok) {
39283948
const data = await res.json()
3929-
set({ autoAllowedTools: data.autoAllowedTools || [] })
3930-
logger.info('[AutoAllowedTools] Loaded', { tools: data.autoAllowedTools })
3949+
const tools = data.autoAllowedTools || []
3950+
set({ autoAllowedTools: tools })
3951+
logger.info('[AutoAllowedTools] Loaded successfully', { count: tools.length, tools })
3952+
} else {
3953+
logger.warn('[AutoAllowedTools] Load failed with status', { status: res.status })
39313954
}
39323955
} catch (err) {
39333956
logger.error('[AutoAllowedTools] Failed to load', { error: err })
@@ -3936,15 +3959,18 @@ export const useCopilotStore = create<CopilotStore>()(
39363959

39373960
addAutoAllowedTool: async (toolId: string) => {
39383961
try {
3962+
logger.info('[AutoAllowedTools] Adding tool...', { toolId })
39393963
const res = await fetch('/api/copilot/auto-allowed-tools', {
39403964
method: 'POST',
39413965
headers: { 'Content-Type': 'application/json' },
39423966
body: JSON.stringify({ toolId }),
39433967
})
3968+
logger.info('[AutoAllowedTools] API response', { toolId, status: res.status, ok: res.ok })
39443969
if (res.ok) {
39453970
const data = await res.json()
3971+
logger.info('[AutoAllowedTools] API returned', { toolId, tools: data.autoAllowedTools })
39463972
set({ autoAllowedTools: data.autoAllowedTools || [] })
3947-
logger.info('[AutoAllowedTools] Added tool', { toolId })
3973+
logger.info('[AutoAllowedTools] Added tool to store', { toolId })
39483974

39493975
// Auto-execute all pending tools of the same type
39503976
const { toolCallsById, executeIntegrationTool } = get()

0 commit comments

Comments
 (0)