Files
deepseek-harness/docs/module-graph.md
Tianyi Cui f393043b03 Add the ACP subagent backend: out-of-process delegation (PR3)
The first OUT-OF-PROCESS subagent backend, proving the seam generalizes past the
in-process backends. @deepseek-ai/dsh-subagent-acp runs each child agent in a
spawned subprocess, driven over the Agent Client Protocol as the CLIENT — the
direction-inverted twin of the dsh-acp server bridge. Point the configured
command at the acp-agent example and the harness talks to its own process.

- Fresh process per run: start spawns, runs one ACP session (initialize →
  newSession → prompt), dispose kills the subprocess and awaits its exit.
- Minimal client stub: advertises no fs/terminal; accumulates agent_message_chunk
  text as the result output; auto-answers session/request_permission by a
  configured policy (reject default / allow). No start-time capabilities (an
  out-of-process child can't enforce the parent's depth/tool-filter); ignores
  request.parent; injects only `subagents`.
- StopReason mapping (end_turn→completed, cancelled→aborted, …); result resolves
  error/aborted on a child failure, never rejects (seam contract).
- Security: credential-shaped ambient env vars are scrubbed; the child's own key
  is forwarded only via explicit config.env. A spawn-level error (ENOENT) is
  captured and raced against the ACP drive so a bad command settles error rather
  than crashing the parent.

Testing designed at every tier: keyless integration drives a scripted mock ACP
server subprocess (cancellation incl. the pre-newSession race and a
torn-pipe-after-cancel, permission auto-answer, non-message updates, spawn
failure, HMR, export shape) at 100% coverage; a with-key e2e drives the REAL
acp-agent example process (PONG + real file write, verified on disk) — the
harness driving itself. Snapshot coverage of an ACP child is deferred as
TODO(acp-subagent-replay) (each child is its own process with its own replay).

Stayed on @agentclientprotocol/sdk 0.25.1: the proposed 0.28.x bump only
deprecates the stable ClientSideConnection/AgentSideConnection API this layer
uses (33 sites incl. the server bridge), turning no-deprecated red across code
this PR shouldn't rewrite — that fluent-API migration is its own follow-up. The
backend needs nothing 0.28.x adds.

This completes the subagent seam stack (PR1 interface → PR2 in-process → PR2.5
snapshot infra → PR3 ACP); the seam RFC moves to implemented/, amended.
2026-06-22 10:47:02 +08:00

3.8 KiB

Module dependency graph

Inter-package dependencies among the @deepseek-ai/dsh-* harness packages, derived from each package's peerDependencies (the canonical runtime-dependency signal). An edge a --> b means package a depends on package b. Names have the @deepseek-ai/dsh- prefix stripped.

graph TD
  bash --> brand
  llm --> brand
  bash-local --> bash
  llm-deepseek --> llm
  llm-pi-ai --> llm
  session --> brand
  session --> llm
  system-prompt --> llm
  agent --> brand
  agent --> llm
  agent --> session
  llm-replay --> llm
  llm-replay --> session
  session-persistence --> session
  invariants --> agent
  invariants --> llm
  invariants --> session
  session-persistence-jsonl --> session
  session-persistence-jsonl --> session-persistence
  session-persistence-sqlite --> session
  session-persistence-sqlite --> session-persistence
  tools --> agent
  tools --> llm
  tools --> system-prompt
  ui-stdio --> agent
  ui-stdio --> llm
  ui-stdio --> session
  acp --> agent
  acp --> llm
  acp --> session
  acp --> session-persistence
  acp --> tools
  agent-loop --> agent
  agent-loop --> llm
  agent-loop --> session
  agent-loop --> session-persistence
  agent-loop --> system-prompt
  agent-loop --> tools
  subagent --> agent
  subagent --> llm
  subagent --> tools
  tool-bash --> agent
  tool-bash --> bash
  tool-bash --> llm
  tool-bash --> tools
  agent-core --> agent
  agent-core --> agent-loop
  agent-core --> invariants
  agent-core --> llm
  agent-core --> session
  agent-core --> system-prompt
  agent-core --> tool-bash
  agent-core --> tools
  subagent-acp --> agent
  subagent-acp --> llm
  subagent-acp --> subagent
  subagent-mock --> agent
  subagent-mock --> llm
  subagent-mock --> subagent
  subagent-spawn --> agent
  subagent-spawn --> llm
  subagent-spawn --> session
  subagent-spawn --> subagent
  tool-subagent --> agent
  tool-subagent --> llm
  tool-subagent --> subagent
  tool-subagent --> tools
  acp-agent --> acp
  acp-agent --> agent-core
  acp-agent --> session-persistence-jsonl
  stdio-agent --> agent
  stdio-agent --> agent-core
  stdio-agent --> session
  stdio-agent --> session-persistence-jsonl
  stdio-agent --> ui-stdio
  subagent-fork --> agent
  subagent-fork --> session
  subagent-fork --> subagent
  subagent-fork --> subagent-spawn
Package Depends on
brand
bash brand
llm brand
bash-local bash
llm-deepseek llm
llm-pi-ai llm
session brand, llm
system-prompt llm
agent brand, llm, session
llm-replay llm, session
session-persistence session
invariants agent, llm, session
session-persistence-jsonl session, session-persistence
session-persistence-sqlite session, session-persistence
tools agent, llm, system-prompt
ui-stdio agent, llm, session
acp agent, llm, session, session-persistence, tools
agent-loop agent, llm, session, session-persistence, system-prompt, tools
subagent agent, llm, tools
tool-bash agent, bash, llm, tools
agent-core agent, agent-loop, invariants, llm, session, system-prompt, tool-bash, tools
subagent-acp agent, llm, subagent
subagent-mock agent, llm, subagent
subagent-spawn agent, llm, session, subagent
tool-subagent agent, llm, subagent, tools
acp-agent acp, agent-core, session-persistence-jsonl
stdio-agent agent, agent-core, session, session-persistence-jsonl, ui-stdio
subagent-fork agent, session, subagent, subagent-spawn