Files
deepseek-harness/examples/plan-acp-agent
kingwl 88db403d9f Merge branch 'worktree-session-modes-rfc' (master: sandbox stack #169, skills #109, prompt snapshots #254)
The stack rebases onto a moved master through its base branch. Beyond
mechanical unions (both branches' demo scripts, example rows, service
roles, tool lists, acp deps, doc budgets — each side fit alone, the
union needs the higher ceilings), three semantic reconciliations:

- The ACP bridge now carries BOTH per-session surfaces: the sandbox
  stack's config options + approval answerer and this branch's session
  modes; session/new and session/load advertise modes AND configOptions
  side by side.
- The feature matrix supersedes the sandbox stance per the RFC's
  second-lander rule: session/set_mode and current_mode_update flip to
  shipped-by-dsh-mode, config-option rows stay as #169 wrote them, and
  §6 records both landed features under the picker-to-modes /
  knobs-to-config-options division.
- The snapshot pin grammar (#254: one header snapshot + declared deltas
  + a Markdown prompt golden) gains a symmetric declaration for what a
  delta cannot express: expectedHeaderSnapshots — a plan-mode flip
  resorts the canonical tool list, so its widening lands as a second
  full snapshot, now its own Markdown section. The pin-less-class and
  model-turn-only-pin amendments carry over; new fixtures cover the
  extended writer paths, and the plan-acp-agent scenarios re-recorded
  under the merged composition (the app now bundles the skill tool)
  with the suite's refresh mode wired through.
2026-07-12 20:08:09 +08:00
..

plan-acp-agent

The coding agent as an ACP server with session modes composed — the live composition of the plan-mode RFC.

What it demonstrates

session/new advertises the mode picker (default / plan); the editor's session/set_mode switches the session, applied at the next turn boundary. The default mode carries the full composition — bash, read/write/edit, todo_write, ask_user_question — while plan mode narrows it to the read-only allowlist (read, todo_write, ask_user_question, exit_plan_mode here — this tree loads no web tools) plus the plan-mode guidance section; every call outside the allowlist is denied at tools/pre-execute with a reason that steers it back to planning, and a blocking decision goes to the user through ask_user_question. The model leaves by presenting its plan through exit_plan_mode: the plan markdown renders as the tool's call card, the review question arrives as an elicitation form (approve / keep planning, free text welcome), and a keep-planning answer returns the feedback to the model verbatim.

Run

pnpm run demo:plan-acp   # needs DEEPSEEK_API_KEY (repo-root .env works)

Drive it from Zed or any ACP client; the mode picker appears on the session. Switching back to default (or an approved exit_plan_mode) restores the full toolset on the next step.

Tests

pnpm run test:snapshot replays three scenarios keyless. modes-advertise (authored): the modes advertisement on session/new, both session/set_mode round-trips with their optimistic current_mode_update, and the loud rejection of an unknown mode id, as committed wire bytes. plan-mode (recorded, the header pin): the full arc — setMode(plan), the plan-shaped initial header, the plan presented via exit_plan_mode, a scripted elicitation approve, the boundary-flushed mode/set back and the widened fallback header, then a real edit under the restored toolset. plan-mode-reject (recorded): the keep-planning branch, whose corrective isError carries the reviewer's free-text feedback verbatim and leaves the session in plan mode. The gate's deny texts stay pinned at the unit tier (packages/mode/mode/tests).