feat(llm): emit dynamic tool updates and project them per route

Log tool changes as developer messages independently of model capability,
fold committed headers and updates into Session.toolHistory(), and let the
LLM runtime construct deferred and retained declarations for routes that
declare a toolUpdate mode. DeepSeek serializes updates as system-role
tool_addition/tool_removal blocks with defer_loading and the tool-changes
beta header. An unchanged restored tool continues the series and is
re-offered through its recorded blocks instead of rewriting declarations.

Replace the obsolete rejection tests with wire assertions and add coverage
for the session fold, loop emission, route projection, config validation,
and the beta header. Chat and Trajectory changes land separately.
This commit is contained in:
Yixiang Tu authored and Tianyi Cui committed 2026-09-23 22:39:26 +08:00
1 parent e7def469e1
commit bc8c0dbf40
57 files changed
+946 -85

No files matched your search

@@ -153,6 +153,7 @@ export async function summarizeWithLlm(
provider: target.provider,
model: target.model,
messages,
toolHistory: agent.session.toolHistory(),
...input.tools === undefined ? {} : { tools: [...input.tools] },
maxTokens: config.maxTokens,
sessionId: agent.session.id,