* feat(agent): add AgentID to SessionState for sub-agent tool routing
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(agent): route sub-agent tool calls through parent callback + MCPs with AgentID
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(agent): add AgentDefinition type and WithAgentDefinitions option
* feat(agent): apply agent definition (prompt/tools/limits) on spawn
* feat(clients): add temperature support to OpenAI client
* feat(agent): per-agent model+temperature via WithAgentLLMFactory
* feat(agent): per-agent injection channel and AgentManager.Inject
* feat(agent): add unified send_agent_message resume/inject tool
* feat(agent): detachable foreground spawns + AgentManager.Detach
Register every foreground sub-agent and run it in a goroutine so an
embedder can promote it to the background. spawn_agent now selects on
agent.done (completed -> return result like the old synchronous path),
agent.detach (promoted -> return the ID immediately, goroutine keeps
running), or ctx.Done. Extract the shared goroutine body into runAgent
and add derefFragment so foreground and background share lifecycle
bookkeeping. Stamp withAgentIDStamp(agentID) with the real registry ID
on BOTH foreground and background registered agents so sub-agent tool
calls carry the correct AgentID. Add AgentState.detach and
AgentManager.Detach (errors on unknown / non-detachable agent;
non-blocking send).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* feat(agent): add WithAgentSpawnCallback and AgentState.Type for running-agent signal
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(agent): cover definitions, AgentID approval, and spawn callback in Sub-Agent Spawning suite
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>