mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-23 22:08:09 -05:00
Compare commits
5 Commits
fix/copilo
...
feat/creds
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
932aef3c1b | ||
|
|
aed0766207 | ||
|
|
4f09d07383 | ||
|
|
3bb85f2218 | ||
|
|
1e89d147ed |
@@ -1425,7 +1425,10 @@ function RunSkipButtons({
|
||||
setIsProcessing(true)
|
||||
setButtonsHidden(true)
|
||||
try {
|
||||
// Add to auto-allowed list - this also executes all pending integration tools of this type
|
||||
await addAutoAllowedTool(toolCall.name)
|
||||
// For client tools with interrupts (not integration tools), we still need to call handleRun
|
||||
// since executeIntegrationTool only works for server-side tools
|
||||
if (!isIntegrationTool(toolCall.name)) {
|
||||
await handleRun(toolCall, setToolCallState, onStateChange, editedParams)
|
||||
}
|
||||
@@ -1523,11 +1526,7 @@ export function ToolCall({
|
||||
toolCall.name === 'user_memory' ||
|
||||
toolCall.name === 'edit_respond' ||
|
||||
toolCall.name === 'debug_respond' ||
|
||||
toolCall.name === 'plan_respond' ||
|
||||
toolCall.name === 'research_respond' ||
|
||||
toolCall.name === 'info_respond' ||
|
||||
toolCall.name === 'deploy_respond' ||
|
||||
toolCall.name === 'superagent_respond'
|
||||
toolCall.name === 'plan_respond'
|
||||
)
|
||||
return null
|
||||
|
||||
|
||||
@@ -209,20 +209,9 @@ export interface SlashCommand {
|
||||
export const TOP_LEVEL_COMMANDS: readonly SlashCommand[] = [
|
||||
{ id: 'fast', label: 'Fast' },
|
||||
{ id: 'research', label: 'Research' },
|
||||
{ id: 'actions', label: 'Actions' },
|
||||
{ id: 'superagent', label: 'Actions' },
|
||||
] as const
|
||||
|
||||
/**
|
||||
* Maps UI command IDs to API command IDs.
|
||||
* Some commands have different IDs for display vs API (e.g., "actions" -> "superagent")
|
||||
*/
|
||||
export function getApiCommandId(uiCommandId: string): string {
|
||||
const commandMapping: Record<string, string> = {
|
||||
actions: 'superagent',
|
||||
}
|
||||
return commandMapping[uiCommandId] || uiCommandId
|
||||
}
|
||||
|
||||
export const WEB_COMMANDS: readonly SlashCommand[] = [
|
||||
{ id: 'search', label: 'Search' },
|
||||
{ id: 'read', label: 'Read' },
|
||||
|
||||
@@ -2116,24 +2116,6 @@ const subAgentSSEHandlers: Record<string, SSEHandler> = {
|
||||
})
|
||||
})
|
||||
}
|
||||
} else {
|
||||
// Check if this is an integration tool (server-side) that should be auto-executed
|
||||
const isIntegrationTool = !CLASS_TOOL_METADATA[name]
|
||||
if (isIntegrationTool && isSubAgentAutoAllowed) {
|
||||
logger.info('[SubAgent] Auto-executing integration tool (auto-allowed)', {
|
||||
id,
|
||||
name,
|
||||
})
|
||||
// Execute integration tool via the store method
|
||||
const { executeIntegrationTool } = get()
|
||||
executeIntegrationTool(id).catch((err) => {
|
||||
logger.error('[SubAgent] Integration tool auto-execution failed', {
|
||||
id,
|
||||
name,
|
||||
error: err?.message || err,
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: any) {
|
||||
@@ -2815,14 +2797,9 @@ export const useCopilotStore = create<CopilotStore>()(
|
||||
mode === 'ask' ? 'ask' : mode === 'plan' ? 'plan' : 'agent'
|
||||
|
||||
// Extract slash commands from contexts (lowercase) and filter them out from contexts
|
||||
// Map UI command IDs to API command IDs (e.g., "actions" -> "superagent")
|
||||
const uiToApiCommandMap: Record<string, string> = { actions: 'superagent' }
|
||||
const commands = contexts
|
||||
?.filter((c) => c.kind === 'slash_command' && 'command' in c)
|
||||
.map((c) => {
|
||||
const uiCommand = (c as any).command.toLowerCase()
|
||||
return uiToApiCommandMap[uiCommand] || uiCommand
|
||||
}) as string[] | undefined
|
||||
.map((c) => (c as any).command.toLowerCase()) as string[] | undefined
|
||||
const filteredContexts = contexts?.filter((c) => c.kind !== 'slash_command')
|
||||
|
||||
const result = await sendStreamingMessage({
|
||||
@@ -3946,16 +3923,11 @@ export const useCopilotStore = create<CopilotStore>()(
|
||||
|
||||
loadAutoAllowedTools: async () => {
|
||||
try {
|
||||
logger.info('[AutoAllowedTools] Loading from API...')
|
||||
const res = await fetch('/api/copilot/auto-allowed-tools')
|
||||
logger.info('[AutoAllowedTools] Load response', { status: res.status, ok: res.ok })
|
||||
if (res.ok) {
|
||||
const data = await res.json()
|
||||
const tools = data.autoAllowedTools || []
|
||||
set({ autoAllowedTools: tools })
|
||||
logger.info('[AutoAllowedTools] Loaded successfully', { count: tools.length, tools })
|
||||
} else {
|
||||
logger.warn('[AutoAllowedTools] Load failed with status', { status: res.status })
|
||||
set({ autoAllowedTools: data.autoAllowedTools || [] })
|
||||
logger.info('[AutoAllowedTools] Loaded', { tools: data.autoAllowedTools })
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error('[AutoAllowedTools] Failed to load', { error: err })
|
||||
@@ -3964,18 +3936,15 @@ export const useCopilotStore = create<CopilotStore>()(
|
||||
|
||||
addAutoAllowedTool: async (toolId: string) => {
|
||||
try {
|
||||
logger.info('[AutoAllowedTools] Adding tool...', { toolId })
|
||||
const res = await fetch('/api/copilot/auto-allowed-tools', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ toolId }),
|
||||
})
|
||||
logger.info('[AutoAllowedTools] API response', { toolId, status: res.status, ok: res.ok })
|
||||
if (res.ok) {
|
||||
const data = await res.json()
|
||||
logger.info('[AutoAllowedTools] API returned', { toolId, tools: data.autoAllowedTools })
|
||||
set({ autoAllowedTools: data.autoAllowedTools || [] })
|
||||
logger.info('[AutoAllowedTools] Added tool to store', { toolId })
|
||||
logger.info('[AutoAllowedTools] Added tool', { toolId })
|
||||
|
||||
// Auto-execute all pending tools of the same type
|
||||
const { toolCallsById, executeIntegrationTool } = get()
|
||||
|
||||
Reference in New Issue
Block a user