From 80ce5960c479fe35ab72c822e3b67799d7e1491e Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Sat, 23 May 2026 04:18:54 +0900 Subject: feat: web_search + youtube_transcribe tools, shell interrupt backgrounding, fixes - Add web_search tool (Firecrawl POST to /v1/search with query, limit, lang, country, scrapeOptions) - Add youtube_transcribe tool (GET to transcriber service, handles completed/queued/failed statuses) - Both tools registered for parent agents (always) and child agents (permission-gated) - Added to summon enum, TOOL_DESCRIPTIONS, and core exports - Shell interrupt: run_shell now races against user queue interrupt - When interrupted, command continues in background with run_shell_ job ID - BackgroundShellStore holds running processes, auto-cleans 10min after completion - retrieve tool extended to handle both agent IDs and shell job IDs - Tool error detection: results starting with 'Error:' now marked isError in UI - Fix TS error: cast unavailMatch[1] regex capture group to string - Docker: network_mode host for Tailscale/LAN access to external services - Bun.serve idleTimeout set to 60s (was default 10s) - KeyUsage: clearer message when OpenCode usage data unavailable - Firecrawl: only send scrapeOptions when scrape=true (avoid 400 on instances without scrape support) --- packages/core/src/agent/agent.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'packages/core/src/agent') diff --git a/packages/core/src/agent/agent.ts b/packages/core/src/agent/agent.ts index b4c0eec..64a602b 100644 --- a/packages/core/src/agent/agent.ts +++ b/packages/core/src/agent/agent.ts @@ -196,11 +196,12 @@ export class Agent { }); const rawResult = await execPromise; + const resultStr = typeof rawResult === "string" ? rawResult : JSON.stringify(rawResult); return { toolCallId: tc.id, toolName: tc.name, - result: typeof rawResult === "string" ? rawResult : JSON.stringify(rawResult), - isError: false, + result: resultStr, + isError: resultStr.startsWith("Error:"), }; } catch (err) { return { @@ -326,7 +327,7 @@ export class Agent { // Model tried to call an unavailable tool. // Add a synthetic tool call + error result for the bad tool. - const badToolName = unavailMatch[1]; + const badToolName = unavailMatch[1] as string; const fakeId = `unavail_${crypto.randomUUID().slice(0, 8)}`; const availableTools = Object.keys(aiTools).join(", "); const errorResult = `Tool "${badToolName}" is not available. Available tools: ${availableTools}. Please use only available tools.`; -- cgit v1.2.3