feat(chat-workflow): port task + ask_user_question composite tools (PR 7)
Summary
Completes the open-agents tool surface — the agent now has all 11 tools.
`ask_user_question` — client-side tool
Schema mirrors open-agents verbatim. No server `execute`: streamText halts after emitting the tool-call because there's no result to feed back; the chat UI renders the question component, collects answers, submits them in the next workflow request's messages. No WDK pause/resume hook needed — natural workflow boundary handles the pause.
`task` — subagent delegation
Slim port of open-agents' multi-type `SUBAGENT_REGISTRY` → one generic subagent. Runs sub-`streamText` with a curated tool set matching open-agents' `executor`: `read, write, edit, grep, glob, bash`.
Recursion guard (matches open-agents): subagent tool set explicitly excludes `task`, `ask_user_question`, `skill`, `todo_write`, `web_fetch`. Open-agents' three subagent types (executor, explorer, design) all curate their own minimal tool sets and never include `task` — subagents are leaves of the agent tree.
Wire-up
- `AgentContext` gains `modelId?: string` so the subagent uses the same model as its parent.
- Handler populates `modelId` in context from `chat.model_id` or platform default.
- `buildAgentTools` registers both new tools unconditionally; `skill` stays conditional on non-empty catalog.
Quirk to note
api's AI SDK (`6.0.0-beta.122`) calls `toModelOutput(output)` directly, not `toModelOutput({ output })` as open-agents' newer `6.0.165` does. `askUserQuestionTool` uses the direct signature.
Verification
- 9 askUserQuestion tests + 6 taskTool tests + updated buildAgentTools = 20 new tests; suite 3075/3075 pass
- Lint clean
- Production build succeeds
- E2E preview verification running
🤖 Generated with Claude Code
Summary by cubic
Adds task and ask_user_question, completing the 11‑tool surface. Subagents now inherit the parent model via a durable context, and task uses a non‑empty prompt to avoid NoOutputGeneratedError.
-
New Features
ask_user_question(client-side): schema mirrors open-agents; no serverexecute; UI gathers answers next turn;toModelOutputformats answers or declines.task: runs a subagent with onlyread,write,edit,grep,glob,bash; excludestask,ask_user_question,skill,todo_write,web_fetch; 30‑step cap; returns a concise summary; passes a non‑empty prompt.buildAgentToolsnow registerstaskandask_user_questionby default;skillstays conditional.
-
Refactors
- Aligned
AgentContextwith open‑agents: addsmodel: LanguageModeland optionalsubagentModel; introducedDurableAgentContextfor workflow inputs;runAgentStepconstructsgateway(modelId)and attaches it toexperimental_context. - Added
getMainModelandgetSubagentModel; the subagent now defaults to the parentmodel(override viasubagentModel), replacing the previous hardcoded model. - Extracted
buildSubagentToolsfor the subagent’s executor tool set.
- Aligned
Summary by CodeRabbit
- New Features
- Agents can now pause execution and ask users questions through the chat interface, with support for structured multi-choice responses
- Agents can delegate focused work to subagents for specialized task execution
- Expanded agent toolset from 9 to 11 available tools, enabling more sophisticated interactions