fix(acp): enable filesystem tools in demo

This commit is contained in:
tn.shen
2026-07-02 12:55:01 +08:00
parent 6c88b380ea
commit b06f1bb60d
3 changed files with 49 additions and 18 deletions

View File

@@ -6,7 +6,7 @@ The DeepSeek Harness coding agent exposed as an **Agent Client Protocol (ACP)**
pnpm run demo:acp # needs DEEPSEEK_API_KEY (repo-root .env or env) pnpm run demo:acp # needs DEEPSEEK_API_KEY (repo-root .env or env)
``` ```
This example is just a leaf `cordis.yml`: it loads the [`@deepseek-ai/dsh-acp-agent`](../../packages/ui/acp-agent) app (which bundles the [`@deepseek-ai/dsh-agent-core`](../../packages/core/agent-core) spine, JSONL session persistence, and the `@deepseek-ai/dsh-acp` bridge — with **no pre-created agents**, since ACP `session/new` creates them on demand), the swappable DeepSeek and bash backends, and the optional model-facing `subagent`/`subagent_fork`/`todo_write` tool entries. The app package bakes in the no-stdout-logger cluster, so a leaf has no logger entry to get wrong by default — keeping stdout pure for JSON-RPC. This example is just a leaf `cordis.yml`: it loads the [`@deepseek-ai/dsh-acp-agent`](../../packages/ui/acp-agent) app (which bundles the [`@deepseek-ai/dsh-agent-core`](../../packages/core/agent-core) spine, JSONL session persistence, and the `@deepseek-ai/dsh-acp` bridge — with **no pre-created agents**, since ACP `session/new` creates them on demand), the swappable DeepSeek, bash, and filesystem backends, and the model-facing `read`/`write`/`edit`/`subagent`/`subagent_fork`/`todo_write` tool entries. The app package bakes in the no-stdout-logger cluster, so a leaf has no logger entry to get wrong by default — keeping stdout pure for JSON-RPC.
## stdout is the protocol ## stdout is the protocol
@@ -28,7 +28,7 @@ Add to your Zed `settings.json` under `agent_servers`:
} }
``` ```
The editor sets each session's `cwd` to the project it opens; the agent's bash tools run there (see the per-session `cwd` note in `packages/ui/acp`), so launch the server from the harness repo with `pnpm --dir …` and let ACP carry the workspace path per session. The editor sets each session's `cwd` to the project it opens; the agent's bash tools run there (see the per-session `cwd` note in `packages/ui/acp`). The filesystem tools in this demo use the local filesystem backend and resolve relative paths from the server launch directory, so launch the server from the harness repo with `pnpm --dir …` when using `read`/`write`/`edit` against this checkout.
## Snapshot tests (record-once / replay-deterministic) ## Snapshot tests (record-once / replay-deterministic)

View File

@@ -18,7 +18,7 @@
# Local bash executor for agent-core's tool-bash schema. # Local bash executor for agent-core's tool-bash schema.
# FIXME(config-comments): keep this executor note from implying bash is the # FIXME(config-comments): keep this executor note from implying bash is the
# whole tool set; subagent and todo_write are loaded below. # whole tool set; filesystem, subagent, and todo_write are loaded below.
- id: bash - id: bash
name: '@deepseek-ai/dsh-bash-local' name: '@deepseek-ai/dsh-bash-local'
config: config:
@@ -33,12 +33,13 @@
systemPrompt: | systemPrompt: |
You are a coding assistant driven over the Agent Client Protocol. You are a coding assistant driven over the Agent Client Protocol.
Your tools are bash (plus bash_output/bash_kill for background tasks) Your tools are read/write/edit for file operations, bash (plus
and subagent. Do ALL file operations through bash: read with bash_output/bash_kill for background tasks), and subagent. Use read to
cat/sed/head, search with grep, write with heredocs (cat <<'EOF' > inspect UTF-8 text files, write to create or replace files, and edit for
file), edit with sed or a rewrite. Each bash call runs in a fresh targeted literal replacements. Use bash for shell commands, tests,
shell — pass workdir instead of cd. Check the [exit code: N] marker; searches, and operations that are not ordinary file reads or edits. Each
verify your work. Keep answers brief and factual. bash call runs in a fresh shell — pass workdir instead of cd. Check the
[exit code: N] marker; verify your work. Keep answers brief and factual.
Use the subagent tool to delegate a focused, self-contained subtask to Use the subagent tool to delegate a focused, self-contained subtask to
a fresh child agent (it works in its own context and returns only its a fresh child agent (it works in its own context and returns only its
@@ -85,3 +86,16 @@
# replayed todo_write tool call resolves to a real tool during snapshot replay. # replayed todo_write tool call resolves to a real tool during snapshot replay.
- id: tool-todo - id: tool-todo
name: '@deepseek-ai/dsh-tool-todo' name: '@deepseek-ai/dsh-tool-todo'
# Filesystem capability stack — identical to cordis.yml's wiring, so replayed
# read/write/edit tool calls resolve to the real tools during snapshot replay.
- id: fs-local
name: '@deepseek-ai/dsh-fs-local'
config:
cwd: !!js process.cwd()
- id: fs-policy
name: '@deepseek-ai/dsh-fs-policy'
- id: tool-fs
name: '@deepseek-ai/dsh-tool-fs'

View File

@@ -1,8 +1,9 @@
# The acp-agent plugin tree: the ACP server. Also the snapshot RECORD config # The acp-agent plugin tree: the ACP server. Also the snapshot RECORD config
# (the dsh-acp-agent bin selects it for DSH_SNAPSHOT=record): a real llm-deepseek # (the dsh-acp-agent bin selects it for DSH_SNAPSHOT=record): a real llm-deepseek
# run whose persisted log the snapshot harness harvests. The swappable DeepSeek # run whose persisted log the snapshot harness harvests. The swappable DeepSeek
# adapter and local bash executor, the ACP server app (@deepseek-ai/dsh-acp-agent), # adapter, local bash/filesystem executors, the ACP server app
# and the optional model-facing subagent/todo tools loaded below. # (@deepseek-ai/dsh-acp-agent), and the optional model-facing fs/subagent/todo
# tools loaded below.
# #
# CRITICAL: this tree loads NO stdout logger and NO hmr — stdout is reserved for # CRITICAL: this tree loads NO stdout logger and NO hmr — stdout is reserved for
# the ACP JSON-RPC protocol (see packages/ui/acp). That guarantee is now a # the ACP JSON-RPC protocol (see packages/ui/acp). That guarantee is now a
@@ -24,7 +25,7 @@
# Local bash executor for agent-core's tool-bash schema. # Local bash executor for agent-core's tool-bash schema.
# FIXME(config-comments): keep this executor note from implying bash is the # FIXME(config-comments): keep this executor note from implying bash is the
# whole tool set; subagent and todo_write are loaded below. # whole tool set; filesystem, subagent, and todo_write are loaded below.
- id: bash - id: bash
name: '@deepseek-ai/dsh-bash-local' name: '@deepseek-ai/dsh-bash-local'
config: config:
@@ -41,12 +42,13 @@
systemPrompt: | systemPrompt: |
You are a coding assistant driven over the Agent Client Protocol. You are a coding assistant driven over the Agent Client Protocol.
Your tools are bash (plus bash_output/bash_kill for background tasks) Your tools are read/write/edit for file operations, bash (plus
and subagent. Do ALL file operations through bash: read with bash_output/bash_kill for background tasks), and subagent. Use read to
cat/sed/head, search with grep, write with heredocs (cat <<'EOF' > inspect UTF-8 text files, write to create or replace files, and edit for
file), edit with sed or a rewrite. Each bash call runs in a fresh targeted literal replacements. Use bash for shell commands, tests,
shell — pass workdir instead of cd. Check the [exit code: N] marker; searches, and operations that are not ordinary file reads or edits. Each
verify your work. Keep answers brief and factual. bash call runs in a fresh shell — pass workdir instead of cd. Check the
[exit code: N] marker; verify your work. Keep answers brief and factual.
Use the subagent tool to delegate a focused, self-contained subtask to Use the subagent tool to delegate a focused, self-contained subtask to
a fresh child agent (it works in its own context and returns only its a fresh child agent (it works in its own context and returns only its
@@ -95,3 +97,18 @@
# session log (todo/write), surfaced to the ACP client as a `plan` update. # session log (todo/write), surfaced to the ACP client as a `plan` update.
- id: tool-todo - id: tool-todo
name: '@deepseek-ai/dsh-tool-todo' name: '@deepseek-ai/dsh-tool-todo'
# Filesystem capability stack: local provider, read-before-write/edit policy
# gate, then the model-facing read/write/edit tools. Relative filesystem paths
# resolve from the server launch cwd; the documented Zed setup launches this
# demo from the harness checkout with `pnpm --dir`.
- id: fs-local
name: '@deepseek-ai/dsh-fs-local'
config:
cwd: !!js process.cwd()
- id: fs-policy
name: '@deepseek-ai/dsh-fs-policy'
- id: tool-fs
name: '@deepseek-ai/dsh-tool-fs'