dsh-acp — a complete ACP server for DeepSeek Harness
Drive DeepSeek Harness from any Agent Client Protocol client — and actually see what it did.
Why this exists
DeepSeek Harness ships an ACP server of its own, @deepseek-ai/dsh-acp. Its source
states its scope plainly:
Emit only committed assistant text. Raw chunks, reasoning, tools, plans, titles, and retry markers are presentation or trace data and stay off the automation wire.
That is the right decision for the job it was built for — it is an automation bridge, and its README says so. It is the wrong decision for a person watching a conversation. Driven through it, a fifteen-minute run that loaded two skills, wrote an 822-line file, built a virtualenv and ran a browser test arrives as two paragraphs of prose. No tool calls. No reasoning. No token counts, so no context-usage indicator.
This adapter makes the opposite choice. Same harness, same session, everything on the wire.
Upstream has moved since that paragraph was written. From DeepSeek Harness
0.1.2-alpha.1 (commit 511181684c, 2026-08-22) its own server streams
reasoning, tool calls and usage_update, and takes model and reasoning effort
as configOptions; its README still says it is "built for automation… rather
than the DSH user interface", and its Known Limitations still refuse the verbs
a person needs. Measured against v0.1.2-rc.1:
@deepseek-ai/dsh-acp (rc.1) |
this | |
|---|---|---|
| Assistant text | ✅ committed messages | ✅ streamed |
| Reasoning | ✅ agent_thought_chunk |
✅ agent_thought_chunk |
| Tool calls | ✅ generic lifecycle | ✅ tool_call / tool_call_update, with output and a sentence per rc.1 tool |
Plans (todo_write) |
— | ✅ plan |
| Token usage | ✅ usage_update only |
✅ usage_update + PromptResponse.usage (turn totals, cache reads and writes) |
| Context composition | — | ✅ system / tools / messages, from the harness's own meter |
| Model / effort | ✅ session/set_config_option |
✅ ACP configOptions |
| Sandbox mode | — | ✅ ACP configOptions (mode) |
MCP servers on session/new |
✅ stdio + HTTP | — refused, out loud (see below) |
| Image prompts | ✅ with an attachment store | — |
| Conversation list | ✅ session/list (stored, paged) |
✅ live and stored, with the harness's own titles |
| Reopen a conversation | ✅ session/resume |
✅ session/resume — on the model it was having |
| …and see what it said | — session/load refused |
✅ session/load replays the whole log |
| What another agent wrote | — | ✅ send_message relays and settlement notices, attributed |
| Permission prompts | ✅ allow / reject | ✅ allow / reject |
What counts as a conversation
The harness writes a session header and a sandbox/mode the moment an agent is
composed — before anyone types. A session opened and abandoned therefore
persists anyway, and arrives in session/list as an untitled row nobody
started, one per app launch.
A stored session is listed only once something in it was a person speaking:
at least one user/message whose source is user. Tool results are user-role
messages in the harness's model, so the source decides rather than the role —
counting those would make every abandoned session that happened to run a tool
look like a conversation.
A row is hidden only when its log was read and found silent. A log this harness refuses to parse, or one past the fold budget, is listed: a row nothing has inspected is not a row anything can judge, and hiding a real conversation is far worse than showing an abandoned one.
Node 24.0–24.11.1 and an older harness
If the harness fails to boot and the stack trace names the plugin tree rather than your composition, check your Node version before anything else.
@deepseek-ai/cordis-plugin-loader classified Node's internal ESM loader by
major version — >= 24 meant "v2" — but v2 only landed in 24.12.0. Every
loader in 24.0–24.11.1 was therefore mistagged, and resolveSync was called
with reversed parameters, which breaks the plugin tree before any of this
adapter's code runs. It is fixed in loader 1.0.3, which ships with
DeepSeek Harness 0.1.2-alpha.2 and later.
Nothing in this adapter can work around it — the failure happens while the harness composes itself. Either upgrade the harness, or run Node 24.12+ or Node 22. This adapter prints a note pointing here when a boot fails inside that window.
engines deliberately still allows the range: the adapter itself is fine
there, and so is a harness new enough to carry the fixed loader. Excluding it
outright would refuse installs that work.
A note for anyone upgrading from 0.4.0 or earlier
Conversations recorded before 0.4.1 cannot be reopened, and it is this
adapter's fault. The harness validates every message event when a log is read
back — assertMessageEventShape requires a non-empty string id — and this
adapter minted user messages without one. Nothing complains when the message is
written; the failure appears only when something tries to read the conversation
back, reported as session event at seq N lacks an identified message.
The dynamic import() meant to borrow the harness's own message factory never
resolved either, because ESM import() does not consult NODE_PATH — which is
exactly how a plugin like this one is given the harness's packages. So the
fallback was never a fallback; it was the only path. Fixed in 0.4.1, which
mints the same crypto.randomUUID() id the harness does, and now says out loud
when it is using its own factory.
Reopening a conversation
ACP separates two verbs that sound alike, and the difference decides whether a client can draw anything:
session/resumeputs an agent back on a stored session and explicitly does not replay history.session/loadreplays it.
@deepseek-ai/dsh-acp implements resume and lists session/load under its
refused surfaces, which is coherent for an automation bridge that keeps no
transcript. For a client a person is looking at, it means reopening a
conversation gives a live agent above an empty pane.
This adapter implements both. Replay is a fold, not a second mapper: the store
keeps the same SessionEvent log the live feed carries, so the events go back
through the same projection and come out as the updates the client would have
received the first time — user turns, reasoning, tool calls with their results,
plans and titles included.
Both capabilities are declared from what is actually mounted. A composition
without @deepseek-ai/dsh-session-persistence gets loadSession: false and no
resume, and lists only what is live — rather than a promise this adapter
cannot keep.
Token usage follows ACP's Session Context Size and Cost RFD, including its rule that cached tokens still occupy the context window.
Install
npm install @harnessdesk/dsh-acp
You need a DeepSeek Harness installation alongside it — a global @deepseek-ai/dsh,
or a checkout. The adapter finds it from the working directory, from the directory of
the composition you point it at, or from its own package, in that order.
Use
Mount the plugin in a harness composition, alongside an agent spine:
- id: spine
name: '@deepseek-ai/dsh-agent-spine-demo'
config:
provider: deepseek-official
model: deepseek-flash
- id: acp
name: '@harnessdesk/dsh-acp'
config:
provider: deepseek-official
model: deepseek-v4-pro
models: [deepseek-flash, deepseek-v4-pro]
New sessions use DeepSeek's current deepseek-flash route, displayed as
DeepSeek V4.1 Flash, beside DeepSeek V4 Pro. The legacy
deepseek-v4-flash identifier remains readable in historical session logs but
is not advertised as a new-session choice.
Official ACP compatibility
DeepSeek's own @deepseek-ai/dsh-acp remains the automation-only reference
surface; HarnessDesk continues to use this adapter for renderer-facing
sessions. The opt-in probe checks only the official bridge's initialize and
session/new automation boundary, without prompting a model or requiring an
API call. Run it against an initialized official acp profile:
DSH_OFFICIAL_BIN=/path/to/deepseek-harness/apps/cli/lib/bin.js \
DSH_OFFICIAL_CWD=/path/to/deepseek-harness \
DSH_OFFICIAL_ARGS='["--profile","acp"]' \
npm run test:official
The default npm test suite skips this probe unless DSH_OFFICIAL_BIN is
provided, so unit tests remain credential-free and deterministic.
Then point a client at the binary:
harnessdesk-dsh-acp --config ./cordis.yml
Stdout carries JSON-RPC frames and nothing else, so the composition must not mount a stdout logger — the harness's own ACP compositions omit one for the same reason.
In Zed
{
"agent_servers": {
"DeepSeek Harness": {
"command": "harnessdesk-dsh-acp",
"args": ["--config", "/path/to/cordis.yml"]
}
}
}
In HarnessDesk
Add an entry to ~/.harnessdesk/agents.json:
{
"id": "dsh",
"name": "DeepSeek Harness",
"brand": "deepseek",
"command": "harnessdesk-dsh-acp",
"args": ["--config", "/path/to/cordis.yml"]
}
Configuration
| key | meaning |
|---|---|
provider |
provider route for created agents, e.g. deepseek-official |
model |
model for created agents, e.g. deepseek-flash |
models |
models to offer in the picker; fewer than two offers none |
efforts |
reasoning levels to offer; defaults to off, low, high, max |
Design
Three rules, each of which exists because of a specific failure:
The mapper is pure. SessionProjection takes harness events and returns ACP
updates, with no I/O and no harness imports, so the whole vocabulary is testable in
milliseconds against events recorded from a real session log rather than events
invented by the author.
The harness is typed structurally, not imported. Its packages move on
independent version lines — dsh-session at 0.0.1-rc.1 while dsh-agent is at
0.1.0-rc.6 — so an adapter that pinned them would need a release every time any one
of them moved. What we actually depend on is the session-event vocabulary, which the
harness itself treats as a compatibility surface. Nothing is vendored: the adapter is
a few hundred lines beside your harness, not a copy of it.
Unknown events are ignored, never fatal. The harness's vocabulary grows. An adapter that threw on a new event type would break on an upgrade it could have survived.
Token accounting
Two details that are easy to get wrong, and wrong in ways that look plausible:
Context fill is the latest request, not the sum of every step. The harness sends the whole conversation on each step, so summing steps reports a session far larger than the model ever saw.
ACP's inputTokens is the whole input; the harness's is the part that missed cache.
Passing the harness's number through unchanged makes a 12,574-token prompt render as
157 tokens. The adapter converts, so cachedReadTokens stays a share of inputTokens
and "% cached" means the same thing here as for every other agent.
Context composition
A composition that mounts @deepseek-ai/dsh-token-meter and
@deepseek-ai/dsh-session-projection gets two things nothing on the event stream
can supply.
Occupancy that survives compaction. The meter's contextPressure projection
reports what the next request would cost — a provider-anchored sample repriced for
everything the conversation has gained or lost since. Compaction reports no usage of
its own, so an indicator built from assistant/chunk alone stays stale until the next
request happens to run; this one drops the moment the conversation is compacted. The
adapter prefers it and falls back to the per-request sum when no meter is mounted.
What the prompt is made of. The contextBreakdown projection prices the system
prompt, the tool schemas and the conversation separately, and the adapter carries all
three on usage_update._meta.harnessdesk.contextBreakdown, beside the occupancy they
explain:
{
"sessionUpdate": "usage_update",
"used": 43574, "size": 1000000,
"_meta": { "harnessdesk": { "contextBreakdown": {
"approximate": true,
"source": "DeepSeek Harness token meter",
"segments": [
{ "id": "system", "label": "System prompt", "tokens": 44 },
{ "id": "tools", "label": "Tool schemas", "tokens": 771, "count": 3 },
{ "id": "messages", "label": "Messages", "tokens": 325 }
]
} } }
}
approximate is not decoration. The segments come from the meter's fixed density
estimate while used is anchored to what the provider actually charged, so the two
are in different units of truth and the segments will not sum to used. The harness
says so itself, and this adapter passes the warning along rather than dropping it. No
total is sent, and none should be inferred by subtraction — render these as shares of
a composition, never as slices of the ring.
Only count, the number of tool schemas in the request envelope, is exact; it is read
off request/header, which the adapter otherwise leaves alone. Pricing that envelope
here would mean shipping a tokenizer and guessing at DeepSeek's, when the harness
already prices it with the estimator it prices everything else with.
Everything in this section is optional. ctx.inject(['sessionProjections'], …) never
runs in a composition without the registry, and a client that ignores _meta still
gets the ring.
Status
Working and tested end to end against a real harness — most recently
v0.1.2-rc.1, built from source and driven over stdio: streaming, reasoning,
tool calls with output, plans, usage, permission prompts, the three session
controls, a conversation list carrying the harness's own session titles,
session/load with replay, and session/set_config_option for model, effort
and sandbox mode. rc.1's removals — Session.events, the SQLite persistence
backend, APIProxy — touch nothing this adapter injects.
A reopened conversation continues on the route its own log last recorded
(request/header's call config, or a later model/selection), never on the
deployment's default: the stored session header carries no provider or model,
so the log is the only place the answer lives. The pickers show that route.
Since rc.1 a child reports back over send_message instead of the one-way
report tool, and the runtime writes its own one-line account when a child
settles. Both arrive in the parent's log as user-role messages whose source is
agent-message or subagent-settled; this adapter sends them as
user_message_chunk marked _meta.harnessdesk.notice: true with a from
naming the sender, so a client draws them as notices on the turn rather than
as the person's words — and neither counts as the person speaking for the
conversation list.
A listed conversation only has a name if the composition generates one. The title service and its provider are separate plugins, and mounting them is what turns a row from a truncated first prompt into "Maximum landing score breakdown":
- id: session-title
name: '@deepseek-ai/dsh-session-title'
config: { fallbackMaxWords: 5, fallbackMaxBytes: 40, maxTitleBytes: 80 }
- id: session-title-llm
name: '@deepseek-ai/dsh-session-title-first-prompt-llm'
config:
targetWords: 5
targetCjkCharacters: 10
maxInputBytes: 4096
maxOutputTokens: 64
timeoutMs: 60000
provider: deepseek-official
model: deepseek-flash
The service alone gives a word-count fallback title; the provider names the
conversation with a cheap route instead. Without either, session/list still answers
with a cwd and a preview, and title is null.
Not implemented yet:
-
MCP server pass-through — refused, out loud. The harness does host MCP servers, through
@deepseek-ai/dsh-mcp-client, but it connects them at composition time: one plugin instance per server incordis.yml. Nothing on the ACP wire can add one to a harness that is already composed, and this adapter will not edit somebody's composition on their behalf. So a non-emptymcpServersonsession/newis refused with an error naming the parameter.It is worth being explicit about why that is better than the alternative. Until 0.3.0 this adapter accepted the parameter and ignored it, which left the client believing its tools had reached the model. They had not, and the only symptom was an agent that said it could not do something it had been told it could. A refusal naming
mcpServersis the one answer a client can act on: it retries without the server and reports which tools are missing.
Running it on DeepSeek Harness 0.1.2-rc.1
rc.1 removed packages/examples, and with it the dsh-agent-spine-demo the
older compositions mounted. The short route now is the shipped acp profile
with an overlay — profile/harnessdesk.patch.yml
— that switches the harness's own server off and puts this one on the stdio:
ln -s "$(pwd)" "$DSH_HOME/profiles/acp/node_modules/@harnessdesk/dsh-acp"
NODE_PATH="$DSH_HOME/profiles/node_modules" dsh --profile acp --patch profile/harnessdesk.patch.yml
NODE_PATH matters: the adapter reaches the harness's own packages for the
model-selection coupling through it, and without it the model and reasoning
pickers are honestly withheld. The base bundle mounts everything else this
adapter reads — persistence, titles, the token meter, the session
projections.
Development
npm install
npm run verify # typecheck, test, build
License
MIT.
