mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
Model-facing tool-call budgets were tangled into each capability's schema (bash timeoutMs, web_fetch timeout_ms) with no shared home. Add a tools/execute around-dispatch waterfall to dsh-tools whose base next() is the dispatch-with-normalization thunk, and a new @deepseek-ai/dsh-timeout-policy plugin (packages/timeout/) that arms a per-tool deadline on exec.signal and returns a structured TOOL_TIMEOUT when it wins. Migrate web_fetch (drop the model-facing timeout_ms) and web_search onto it; the fetch provider keeps its timeout only as a resource backstop for direct callers. bash and hook command execution keep BASH_TIMEOUT unchanged. Named the plugin timeout-policy (not the RFC's tool-timeout) so it does not trip the gen-tool-catalog packages/*/tool-* completeness guard, and replace exec.signal by in-place mutation before next() since cordis waterfall next() ignores passed arguments. RFC moved to implemented/ recording both deviations.
43 lines
2.3 KiB
Markdown
43 lines
2.3 KiB
Markdown
<!-- Generated by scripts/gen-doc-graphs.ts - do not edit by hand.
|
|
Run `pnpm run gen-doc-graphs` to regenerate. -->
|
|
|
|
# Tool Execution Pipeline
|
|
|
|
This graph shows where policy, hooks, sandboxing, filesystem guards, result rewriting, and UI rendering fit without changing the loop. The key extension points are the `tools/pre-execute`, `tools/execute`, and `tools/post-execute` waterfalls.
|
|
|
|
```mermaid
|
|
flowchart TD
|
|
model["Assistant message contains tool-call block"]
|
|
toolCall["Session event: <code>tool/call</code><br/>logged before execution"]
|
|
presentCall["UI pending card<br/>presentCall(args)"]
|
|
pre["<code>tools/pre-execute</code> waterfall<br/>hooks, permission, sandbox"]
|
|
denied["deny or ask<br/>tool body skipped"]
|
|
around["<code>tools/execute</code> waterfall<br/>timeout, retry, metrics (around dispatch)"]
|
|
toolBody["Registered tool execute() body"]
|
|
fsGate["<code>fs/write-intent</code> or <code>fs/edit-intent</code><br/>tool-fs mutations only"]
|
|
owned["Tool-owned session events<br/><code>todo/write</code>, <code>fs/observed</code>, <code>hook/invoked</code>, <code>hook/result</code>"]
|
|
post["<code>tools/post-execute</code> waterfall<br/>accept, block, replace, add context"]
|
|
context["Buffered additionalContext<br/>context/message after all tool results"]
|
|
toolResult["Session event: <code>tool/result</code><br/>single model-facing outcome"]
|
|
presentResult["UI completed card<br/>presentResult(args, result)"]
|
|
model --> toolCall
|
|
toolCall --> presentCall
|
|
toolCall --> pre
|
|
pre -->|allow| around
|
|
around --> toolBody
|
|
pre -->|deny or ask| denied
|
|
denied --> post
|
|
toolBody --> fsGate
|
|
fsGate --> toolBody
|
|
toolBody --> owned
|
|
toolBody --> around
|
|
around --> post
|
|
post --> context
|
|
post --> toolResult
|
|
toolResult --> presentResult
|
|
```
|
|
|
|
Filesystem read-before-edit checks live below `tool-fs` on the `fs/*` event gate; hook bridges and future permission prompts live on the generic pre/post tool waterfalls; and around-dispatch concerns like the tool-call timeout policy (`@deepseek-ai/dsh-timeout-policy`) wrap core dispatch on `tools/execute`. That split lets the same hooks observe bash, fs, web, todo, and subagent calls without coupling those tools to one policy service.
|
|
|
|
Maintenance mode: curated Mermaid flow; exact tool schemas and event signatures live in generated catalogs.
|