dsh-baton-mcp 0.6.0-next.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,11 +15,11 @@ Claude Code and Codex each hand a task to DeepSeek Harness, and its subagents bu
15
15
  https://github.com/user-attachments/assets/72e2fdff-275e-48bc-8e5a-39ffb025a0a8
16
16
 
17
17
  <p align="center">
18
- <img src="./assets/readme/features.svg" width="100%" alt="Create workspaces and sessions, continue a session, run live in the Harness UI labelled with the sender, get woken when it is done, no extra API key, macOS and Windows with zero dependencies">
18
+ <img src="./assets/readme/features.svg" width="100%" alt="Create workspaces and sessions, continue a session, run live in the Harness UI labelled with the sender, Claude Code and Codex woken when a run ends, no extra API key and any Harness model, macOS and Windows with zero dependencies">
19
19
  </p>
20
20
 
21
21
  <p align="center">
22
- <img src="./assets/readme/flow.gif" width="100%" alt="Typical flow: create a workspace, send the task, wait in the background, follow up in the same session">
22
+ <img src="./assets/readme/flow.gif" width="100%" alt="Typical flow: create a workspace, send the task, wait without polling (Claude Code and Codex are woken when the run ends), follow up in the same session">
23
23
  </p>
24
24
 
25
25
  ## See it run
@@ -41,7 +41,7 @@ Codex and Claude take turns in the same Harness session, and every message is la
41
41
  ## Quick start
42
42
 
43
43
  <p align="center">
44
- <img src="./assets/readme/install.svg" width="100%" alt="Step 1: in Harness open Plugins, Add plugin, enter dsh-baton-host, Install, Enable now; it registers dsh-baton for Claude Code and Codex. Step 2: in a new chat, ask for dsh_list_workspaces">
44
+ <img src="./assets/readme/install.svg" width="100%" alt="Step 1: in Harness open Plugins, Add plugin, enter dsh-baton-host, Install, Enable now; it registers dsh-baton for Claude Code and Codex. Step 2, Codex only, once: Settings, Hooks, trust dsh-baton: waiting for the Harness run. Step 3: in a new chat, ask for dsh_list_workspaces">
45
45
  </p>
46
46
 
47
47
  Requires DeepSeek Harness ≥ 0.2.1-rc.2 (signed in) and Claude Code or Codex. Nothing else: no Node.js, no terminal. The steps are the same on macOS and Windows.
@@ -50,7 +50,9 @@ Requires DeepSeek Harness ≥ 0.2.1-rc.2 (signed in) and Claude Code or Codex. N
50
50
 
51
51
  Switched on, the plugin registers dsh-baton for Claude Code and Codex, for every folder, and Harness says so.
52
52
 
53
- **2. Check:** in a **new** Claude Code or Codex conversation, ask it to call `dsh_list_workspaces`. It lists your Harness workspaces.
53
+ **2. Codex only, once:** Codex **Settings → Hooks** → **Trust** **dsh-baton: waiting for the Harness run**. Codex is then woken when a run ends instead of checking every 270 s. You trust it once: updates and Harness restarts do not ask again. Skip it and Codex waits with `dsh_wait` as before; the first hand-over reminds you.
54
+
55
+ **3. Check:** in a **new** Claude Code or Codex conversation, ask it to call `dsh_list_workspaces`. It lists your Harness workspaces.
54
56
 
55
57
  That is all. If Harness says it could not register, run `npx -y dsh-baton-mcp setup` in a terminal (this needs Node.js ≥ 22.15); it does the same registration. Updating, removing and Windows details are [further down](#install-details).
56
58
 
@@ -66,36 +68,66 @@ That is all. If Harness says it could not register, run `npx -y dsh-baton-mcp se
66
68
 
67
69
  **How each client waits** (nothing to configure):
68
70
  - **Claude Code** waits for a run in the background (the `wait_command` that `dsh_send` returns) and is woken once, when the run ends.
69
- - **Codex** waits inside `dsh_wait`, up to 270 s per call, just under its 300 s tool timeout. An unfinished wait returns only the state, so Codex calls again without summarising. Codex gets no `wait_command`: its terminal cannot wake it, so it would poll.
71
+ - **Codex** with the dsh-baton Stop hook trusted (from 0.6.1): after `dsh_send` it ends its turn; the hook waits for the run outside the model and, when the run ends or asks something, continues the same conversation with the result. One model request per run instead of one every 270 s.
72
+ - **Codex** without the hook waits inside `dsh_wait`, up to 270 s per call, just under its 300 s tool timeout. An unfinished wait returns only the state, so Codex calls again without summarising. Codex gets no `wait_command`: its terminal cannot wake it, so it would poll.
70
73
  - Codex asks you to approve MCP tool calls: approve the `dsh-baton` tools. For unattended `codex exec` runs, add `--approve-for-me`.
71
74
 
72
- **How a hand-over is checked** (from 0.6.0): the client sends the task with `checks`, the project's own test commands such as `npm test`. dsh-baton notes the folder's files before the run, and when the run ends it lists the files created, changed and deleted and runs the checks itself; this `evidence` comes from dsh-baton, not from the DeepSeek reply. The message also asks Harness to have a read-only sub-agent check the work against every requirement and end with a table (requirement, met, file:line). The client accepts from the evidence and that table, sends anything not met back in one message, and reads code only for rows not met. A new session starts in the folder the conversation works in unless `cwd` names another one.
75
+ **Pick a model** (from 0.6.1): just say which one, for example "hand it to DeepSeek, V4 Pro". `dsh_send` passes it as `model` (and `reasoning_effort`), matched against the models Harness lists, so a model Harness adds later works as soon as it shows up. It applies to that session only; Harness's default model stays as it was. `dsh_list_models` shows what is available.
76
+
77
+ **How a hand-over is checked** (from 0.6.0)
78
+
79
+ You don't have to take DeepSeek's word for it. Before the run, dsh-baton notes what is in the folder. When the run ends it shows exactly which files were created, changed or deleted, and runs your project's own tests itself (`npm test`, or whatever the client passes as `checks`). A second, read-only DeepSeek agent then goes through the request point by point and ends with a table: requirement, met or not, and where (file:line). Claude or GPT reads just that, sends anything missing back in one message, and opens code only where a row says "not met". Unless `cwd` names another folder, the new Harness session starts in the folder you're already working in.
80
+
81
+ <p align="center">
82
+ <img src="./docs/benchmarks/token-usage-2026-10/charts/evidence-chain.svg" width="100%" alt="Evidence chain of one real hand-over: the user asks, Codex writes the spec and checks, dsh-baton snapshots the folder, DeepSeek Harness writes 11 files, dsh-baton lists the changed files and runs npm test itself, Codex sends one fix back on its own, dsh-baton checks again, Codex accepts, and the benchmark's own test passes 13 of 13">
83
+ </p>
73
84
 
74
85
  ## Token usage
75
86
 
76
- Measured on 2026-10-25/26 with plain-language requests (what a user would type, plus "hand it to DeepSeek Harness"), the same model in both arms, three runs per cell, and every run checked by the same hidden acceptance test. Cost per task at list price; DeepSeek at its peak price, the most conservative case:
87
+ **In short: hand over the big, long jobs.** A feature that spans many files, a large refactor, a whole small app: that is where it saves the most. Claude Code's own bill drops by 65–81%, and Codex gets 2 to 5 times as many tasks out of a ChatGPT Plus 5-hour window (5 times on a medium task with GPT-6 Astra).
77
88
 
78
- | Task | Claude Code alone | Claude Code → 0.6.0 | Codex alone | Codex → 0.6.0 |
79
- |---|---|---|---|---|
80
- | Medium: CLI, modules, tests | $1.07 | $0.37 client, $0.55 with DeepSeek | $0.17 | $0.09 client, $0.29 with DeepSeek |
81
- | Large: web app, API, tests | $2.13 | $0.41 client, $0.70 with DeepSeek | $0.41 | $0.10 client, $0.41 with DeepSeek |
89
+ **The honest part:** for small tasks, Codex on GPT-6.1 Sol is cheap enough that doing it alone costs less in total than handing it over, and at medium size it comes out about even. The hand-over pays off when you want Claude or GPT to plan and review, a cheaper model to do the typing, and you'd rather not keep hitting the 5-hour limit.
90
+
91
+ **Who this is for:** most of us pay for Claude or ChatGPT with a plan (Plus, Pro, Max 5x…), while DeepSeek is pay-as-you-go from a balance you top up, so every hand-over is money spent outside your plan. If your plan's limits already cover how you work, you don't need this: keep it simple and keep the money. If you're like me and keep running long, messy jobs with round after round of changes, and keep hitting the limit, a little DeepSeek spend gets you a lot more out of the plan you already pay for.
92
+
93
+ <p align="center">
94
+ <img src="./docs/benchmarks/token-usage-2026-10/charts/natural-combined.svg" width="100%" alt="Cost per task, working alone vs handed over (0.6.0; the large Astra task with 0.6.1): Claude Code (Opus 5.5) and Codex (GPT-6.1 Sol, GPT-6 Astra), each on its own scale">
95
+ </p>
82
96
 
83
- - **Claude Code** spends 65–81% less, and still about half or less once DeepSeek is added.
84
- - **Codex** (gpt-6.1-sol, high) spends half to three quarters less of its own model, so a ChatGPT Plus 5-hour window lasts more than twice as long: 0.8% instead of 1.9% per medium task, 1.0% instead of 4.3% per large one. Sol is cheap, so with DeepSeek added a medium task costs more in total than doing it in Codex, and a large one about the same; the saving is in the subscription quota. With a pricier model the total drops too.
85
- - All 12 runs of 0.6.0 passed the acceptance test the first time.
97
+ Cost per task at list price, DeepSeek V4.1 Flash 1017 at its peak price:
86
98
 
87
- The [full report](./docs/benchmarks/token-usage-2026-10.md) has the method, every run, the earlier builds that were compared, raw data and scripts.
99
+ | Client · model | Task | Alone | Handed over, client only | Handed over, with DeepSeek |
100
+ |---|---|---|---|---|
101
+ | Claude Code · Opus 5.5 high | Small | $1.07 | $0.37 (−65%) | $0.55 (−49%) |
102
+ | Claude Code · Opus 5.5 high | Medium | $2.13 | $0.41 (−81%) | $0.70 (−67%) |
103
+ | Codex · GPT-6.1 Sol high | Small | $0.17 | $0.09 (−49%) | $0.29 (+73%) |
104
+ | Codex · GPT-6.1 Sol high | Medium | $0.41 | $0.10 (−75%) | $0.41 (−2%) |
105
+ | Codex · GPT-6 Astra high | Small | $0.79 | $0.56 (−29%) | $0.75 (−6%) |
106
+ | Codex · GPT-6 Astra high | Medium | $2.27 | $0.48 (−79%) | $0.78 (−65%) |
88
107
 
89
108
  <p align="center">
90
- <img src="./docs/benchmarks/token-usage-2026-10/charts/natural-total-claude-release.svg" width="100%" alt="Claude Code cost per task: alone vs handed over, with and without the DeepSeek share">
91
- <img src="./docs/benchmarks/token-usage-2026-10/charts/natural-total-codex-release.svg" width="100%" alt="Codex cost per task: alone vs handed over, with and without the DeepSeek share">
92
- <img src="./docs/benchmarks/token-usage-2026-10/charts/natural-codex-quota-release.svg" width="100%" alt="Codex Plus 5-hour window used per task">
109
+ <img src="./docs/benchmarks/token-usage-2026-10/charts/natural-quota-combined.svg" width="80%" alt="Share of the ChatGPT Plus 5-hour window per task in Codex, working alone vs handed over with 0.6.0: GPT-6.1 Sol and GPT-6 Astra">
93
110
  </p>
94
111
 
112
+ Share of the ChatGPT Plus 5-hour window per task: Sol small 1.9% → 0.8%, Sol medium 4.3% → 1.0%, Astra small 7% → 3.5%, Astra medium 22% → 4%.
113
+
114
+ <details>
115
+ <summary>What was tested, and how</summary>
116
+
117
+ - **Two tasks, asked the way a user would.** The small one takes Claude Code or Codex about 7–8 minutes on its own; the medium one is a small app with a server and a page. Long jobs beyond that were not measured. The requests are in Chinese, linked as written:
118
+ - Small: a command-line task manager in Node, no dependencies, split into modules, with tests. [Request](docs/benchmarks/token-usage-2026-10/natural/medium.md) · [acceptance check](docs/benchmarks/token-usage-2026-10/checks/natural-medium.mjs)
119
+ - Medium: a task manager web app, Node server plus page, REST API, stats, tests and a README. [Request](docs/benchmarks/token-usage-2026-10/natural/large.md) · [acceptance check](docs/benchmarks/token-usage-2026-10/checks/natural-large.mjs)
120
+ - **The only difference** in the hand-over runs is one line added at the end: 交给 DeepSeek Harness 去做。 ("Hand it to DeepSeek Harness.")
121
+ - Same model and effort in both arms, three runs per cell (Astra: one run each, two for the small hand-over), and every run judged by the same acceptance check, which the model never sees. All 12 hand-over runs passed it the first time.
122
+ - Prices are list prices. DeepSeek is counted at its peak price, the most conservative case; the real DeepSeek bill came to about 58% of that.
123
+ - Every run, the raw data and the scripts: [run log](docs/benchmarks/token-usage-2026-10/LOG.md) and [full report](docs/benchmarks/token-usage-2026-10.md).
124
+
125
+ </details>
126
+
95
127
  ## Tools
96
128
 
97
129
  <p align="center">
98
- <img src="./assets/readme/tools.svg" width="100%" alt="Workspaces: list, create, rename. Sessions: list, read, activity, rename. Runs: send, status, wait, cancel, list runs">
130
+ <img src="./assets/readme/tools.svg" width="100%" alt="Ten tools in the tool list: list workspaces, list sessions, read session, list models, send, status, wait, answer, cancel, call. Six less used tools are reached through dsh_call: create and rename workspace, session activity, rename session, update queued, list runs">
99
131
  </p>
100
132
 
101
133
  <p align="center">
@@ -108,19 +140,20 @@ The [full report](./docs/benchmarks/token-usage-2026-10.md) has the method, ever
108
140
  | Tool | What it does |
109
141
  |---|---|
110
142
  | `dsh_list_workspaces` | Workspaces in the Harness sidebar |
111
- | `dsh_create_workspace` | Register a folder as a workspace (creates the folder if missing); returns the existing one if already registered |
112
- | `dsh_list_sessions` | Sessions newest first, with title, folder and running state; filter by folder or text. Archived sessions are left out |
143
+ | `dsh_create_workspace` | Through `dsh_call`. Register a folder as a workspace (creates the folder if missing); returns the existing one if already registered |
144
+ | `dsh_list_sessions` | Sessions newest first, with title, folder, running state and `model` (what its next request uses); filter by folder or text. Archived sessions are left out |
145
+ | `dsh_list_models` | The models Harness can run (provider, id, name, reasoning efforts) and its default model |
113
146
  | `dsh_read_session` | Recent prompts and replies of one session (with tool names); `archived: true` for an archived session |
114
- | `dsh_send` | Send a message: `session_id` continues that session; otherwise a new one starts in `cwd` or `workspace_id`, or, with neither, in the folder the conversation works in (a `cwd` that is not a workspace yet is registered first; a `cwd` outside the conversation's folder is allowed and noted in `folder_note`). `checks`: test commands dsh-baton runs itself when the run ends (see How a hand-over is checked). Returns a `run_id` at once. In Harness the message is marked "Sent by Claude / ChatGPT from another chat". An archived session is refused: unarchive it in Harness, or start a new session. To a busy session, `mode` `followup` queues the message after the current turn and `steer` adds it to the running turn; left out, it does what Harness's own setting says (Settings → sending while busy: queue or steer), and `followup` when that cannot be read. `mode_source` says which applied |
115
- | `dsh_status` | Run progress: state, recent text and tool calls, final reply; `waiting_on` when the turn is over but sub-agents or jobs still run; `human_interjections` when someone typed in the Harness UI mid-run; state `interrupted` for a run cut short by a Harness restart |
116
- | `dsh_wait` | Wait for the run to end; a finished run carries `evidence` (files changed, check results) when the message was sent with `checks` (or until it stops to ask a person, see `dsh_answer`): up to 270 s per call for Codex, 50 s for other clients. Still going: returns `timed_out` with just the state; call it again. Clients that can wait in the background use `dsh_send`'s `wait_command` instead. `dsh_status` is a one-off look, not a way to wait |
147
+ | `dsh_send` | Send a message: `session_id` continues that session; otherwise a new one starts in `cwd` or `workspace_id`, or, with neither, in the folder the conversation works in (a `cwd` that is not a workspace yet is registered first; a `cwd` outside the conversation's folder is allowed and noted in `folder_note`). `checks`: test commands dsh-baton runs itself when the run ends (see How a hand-over is checked). Returns a `run_id` at once. In Harness the message is marked "Sent by Claude / ChatGPT from another chat". An archived session is refused: unarchive it in Harness, or start a new session. To a busy session, `mode` `followup` queues the message after the current turn and `steer` adds it to the running turn; left out, it does what Harness's own setting says (Settings → sending while busy: queue or steer), and `followup` when that cannot be read. `mode_source` says which applied. `model` only when the user names one ("DeepSeek-V4 Pro", "v4-pro"; `reasoning_effort` likewise): it is matched against Harness's own model list, ignoring case, spaces, hyphens and a leading DeepSeek, so a model Harness adds later (V4.1 Pro) works as soon as Harness lists it; a name that matches nothing or several fails the send, before anything is created, with the list (`provider/model` picks one). It is set on that session before the message goes in, and Harness's default model is put back as it was (Harness saves a session's pick as the default too). Left out, a continued session keeps its own model and a new one uses Harness's default. The reply says which in `model` and `model_source` |
148
+ | `dsh_status` | Run progress: state, recent text and tool calls, final reply; `waiting_on` when the turn is over but sub-agents or jobs still run; `human_interjections` when someone typed in the Harness UI mid-run; state `interrupted` for a run cut short by a Harness restart; `model` the run was sent with |
149
+ | `dsh_wait` | Codex with the Stop hook trusted does not need it. Wait for the run to end; a finished run carries `evidence` (files changed, check results) when the message was sent with `checks` (or until it stops to ask a person, see `dsh_answer`): up to 270 s per call for Codex, 50 s for other clients. Still going: returns `timed_out` with just the state; call it again. Clients that can wait in the background use `dsh_send`'s `wait_command` instead. `dsh_status` is a one-off look, not a way to wait |
117
150
  | `dsh_answer` | Answer the questions a run stopped to ask (Harness's ask_user_question): per question, an option number or label, free text, or skip; one at a time or all at once. `dsh_wait` and `wait_command` return as soon as a run asks, with the questions (`needs_input`, `question`; the option Harness's model would pick is in `harness_suggested`, apart from the labels). The assistant answers by its own judgment only when you told it to decide, and then passes `reason` and tells you what it chose and why; otherwise it brings you the questions, starting with its own recommendation and reason. You can also answer in the Harness window: whoever answers first wins |
118
- | `dsh_session_activity` | What a session is doing now: running turn, sub-agents (any depth), background jobs; `archived: true` for an archived session |
119
- | `dsh_update_queued` | Change a message still waiting in the queue of a busy session, by its `run_id`: `edit` its text, `remove` it, or `steer` it into the running turn now. Once it has reached the conversation it can no longer be changed |
151
+ | `dsh_session_activity` | Through `dsh_call`. What a session is doing now: running turn, sub-agents (any depth), background jobs; `archived: true` for an archived session |
152
+ | `dsh_update_queued` | Through `dsh_call`. Change a message still waiting in the queue of a busy session, by its `run_id`: `edit` its text, `remove` it, or `steer` it into the running turn now. Once it has reached the conversation it can no longer be changed |
120
153
  | `dsh_cancel` | Stop everything a session is doing, by `run_id` or `session_id`: turn, sub-agents, jobs. Harness also drops the messages waiting in its queue; their runs end as `cancelled` |
121
- | `dsh_rename_session` | Rename a session |
122
- | `dsh_rename_workspace` | Rename a workspace (sidebar title only; the folder is not moved) |
123
- | `dsh_list_runs` | Recent runs, optionally of one session |
154
+ | `dsh_rename_session` | Through `dsh_call`. Rename a session |
155
+ | `dsh_rename_workspace` | Through `dsh_call`. Rename a workspace (sidebar title only; the folder is not moved) |
156
+ | `dsh_list_runs` | Through `dsh_call`. Recent runs, optionally of one session |
124
157
  | `dsh_call` | Calls any `dsh_*` tool by name: the less used tools (create and rename workspace, rename session, session activity, update queued, list runs) are not in the tool list from 0.6.0 on, to keep every request short, and are reached this way; also for a conversation whose tool list predates an update. An unknown name lists the tools |
125
158
 
126
159
  </details>
@@ -150,6 +183,7 @@ dsh-baton rename-workspace ~/code/new-app "New name"
150
183
  | `DSH_BATON_HOME` | `~/.dsh-baton` | Socket and headless run records |
151
184
  | `DSH_BATON_SOCKET` | `$DSH_BATON_HOME/host.sock` | Plugin socket path (must match on both sides); on Windows mapped to a per-user named pipe |
152
185
  | `DSH_BATON_WAIT_S` | `270` for Codex, else `50` | How long one `dsh_wait` call waits; set it only if you raised the client's tool timeout, and keep it below that |
186
+ | `DSH_BATON_CODEX_HOOK` | `1` | `0` (set for Harness) stops the plugin adding the Codex Stop hook |
153
187
  | `DSH_BIN` | the `dsh` inside the macOS app, else `PATH` | Harness CLI for headless mode |
154
188
  | `DSH_HOME` | `~/.dsh` | Harness data folder (headless session reads) |
155
189
  | `DSH_BATON_ACCOUNT` | `1` | `0` uses the API-key route in headless mode |
@@ -164,13 +198,18 @@ When the plugin is unreachable, the MCP server falls back to Harness's `dsh head
164
198
 
165
199
  ## Install details
166
200
 
201
+ <details>
202
+ <summary>What the plugin does, updating, removing, upgrading from dsh-bridge, installing from source, Windows</summary>
203
+
167
204
  **What the plugin does when switched on.** It copies the MCP server to `~/.dsh-baton/app`, a folder that stays put, and writes the MCP entry into `~/.claude.json` and `~/.codex/config.toml` directly, keeping a `*.bak-dsh-baton` backup of each. It starts the server with your own Node.js ≥ 22.15 when it finds one on `PATH`; without one, with Harness's own runtime (the Harness app in Node mode, `ELECTRON_RUN_AS_NODE=1`), so nothing else has to be installed. Either way it works with only the desktop apps installed, when `claude` / `codex` are not on your `PATH`. It runs again on each Harness start: an entry that is already right, or a working one that starts another copy of dsh-baton, is left alone. In Harness, the source switches to the npm registry ("Official npm registry", 「npm 官方源」) by itself once you type the package name, and no restart is needed. To turn the registration off, set `DSH_BATON_AUTO_REGISTER=0` for Harness.
168
205
 
169
- **Updates need no restart.** When a newer version lands in `~/.dsh-baton/app` (a plugin update, `setup`, or a copy by hand), conversations already open in Claude Code and Codex use it from their next `dsh_*` call: the server checks the folder before each call, starts the new version, and says once in that call's result that it was updated. A `dsh_wait` that is already running finishes on the old version first. If the new version cannot start, the old one keeps working and the result says why. A tool added in the new version shows up in Claude Code at once (the server tells the client its tool list changed); Codex keeps the tool list a conversation started with, so it does not show a new tool until the next conversation; from 0.5.9 on it can still use one at once through `dsh_call`, which the update note points to, and the tools it already has run the new code right away. This works from the version after 0.5.8 on; a server started from 0.5.8 or earlier needs one last restart (or `/mcp` reconnect) to pick it up.
206
+ **The Codex Stop hook.** The plugin adds one `[[hooks.Stop]]` block, marked `# dsh-baton`, to `~/.codex/config.toml`; Codex shows it as **dsh-baton: waiting for the Harness run** and runs it only once you trust it (dsh-baton never trusts it for you). The block only names a small script, `~/.dsh-baton/bin/codex-stop-hook` (`codex-stop-hook.cmd` on Windows), and everything that can move, Node.js and the server, lives in that script. So the block itself never changes: updates, same-version refreshes and Harness restarts leave it as it is, and your trust stays. If the block is ever rewritten, dsh-baton drops the old trust record, and Codex asks you to trust it again. Windows uses a `.cmd` because Codex runs hooks through `PowerShell -Command`, which cannot start a quoted program path. Not added when the server runs on Harness's own runtime. `dsh-baton setup --codex-hook` adds it by hand, `setup --remove` takes it out, `DSH_BATON_CODEX_HOOK=0` for Harness stops the plugin adding it.
207
+
208
+ **Updates need no restart.** When a newer version lands in `~/.dsh-baton/app` (a plugin update, `setup`, or a copy by hand), or the same version with changed files, conversations already open in Claude Code and Codex use it from their next `dsh_*` call: the server checks the folder before each call, starts the new version, and says once in that call's result that it was updated. A `dsh_wait` that is already running finishes on the old version first. If the new version cannot start, the old one keeps working and the result says why. A tool added in the new version shows up in Claude Code at once (the server tells the client its tool list changed); Codex keeps the tool list a conversation started with, so it does not show a new tool until the next conversation; from 0.5.9 on it can still use one at once through `dsh_call`, which the update note points to, and the tools it already has run the new code right away. This works from the version after 0.5.8 on; a server started from 0.5.8 or earlier needs one last restart (or `/mcp` reconnect) to pick it up.
170
209
 
171
210
  **`npx -y dsh-baton-mcp setup`** does the same registration from a terminal: for a plugin that could not register, or when you come from an MCP directory. With the plugin already registered it changes nothing, then points you to the plugin if it is missing.
172
211
 
173
- **Updating.** Harness has an update button only for its official plugins, so: Plugins → dsh-baton-host → **Uninstall**, then **Add plugin** → `dsh-baton-host`. For a while after a release, Harness installs the previous version instead (pnpm's `minimumReleaseAge` holds back versions published very recently, and the install dialog says so); to get the new one at once, type the version: `dsh-baton-host@0.5.0`. Switched on again, the plugin brings the MCP server to the same version; new conversations use it. If the two are ever out of step, the first tool call that notices it says so.
212
+ **Updating.** Harness has an update button only for its official plugins, so: Plugins → dsh-baton-host → **Uninstall**, then **Add plugin** → `dsh-baton-host`. For a while after a release, Harness installs the previous version instead (pnpm's `minimumReleaseAge` holds back versions published very recently, and the install dialog says so); to get the new one at once, type the version: `dsh-baton-host@0.6.1`. A pre-release must always be added by its exact version, such as `dsh-baton-host@0.6.0-next.0`: Harness resolves `@next` to a broken placeholder. Plain `dsh-baton-host` gets the latest release. Switched on again, the plugin brings the MCP server to the same version; new conversations use it. If the two are ever out of step, the first tool call that notices it says so, naming the older side and the newer side's exact version to install.
174
213
 
175
214
  **Removing.** Harness → Plugins → dsh-baton-host → **Uninstall**, then `npx -y dsh-baton-mcp setup --remove`. The plugin cannot tell an uninstall from Harness quitting, so it leaves the MCP entries to that command, which also deletes `~/.dsh-baton/app`; run records stay in `~/.dsh-baton` until you delete it.
176
215
 
@@ -200,6 +239,8 @@ codex mcp add dsh-baton -- "$(command -v node)" "$PWD/dsh-baton/src/server.mjs"
200
239
 
201
240
  </details>
202
241
 
242
+ </details>
243
+
203
244
  ## Security and limits
204
245
 
205
246
  <p align="center">
@@ -207,7 +248,7 @@ codex mcp add dsh-baton -- "$(command -v node)" "$PWD/dsh-baton/src/server.mjs"
207
248
  </p>
208
249
 
209
250
  <p align="center">
210
- <img src="./assets/readme/limits.svg" width="100%" alt="Good to know: a message typed in the UI mid-run is flagged on the run as a human interjection, run records survive a Harness restart (cut-short runs show interrupted), Claude Code is woken once when a run ends and Codex waits up to 270 s per call">
251
+ <img src="./assets/readme/limits.svg" width="100%" alt="Good to know: a message typed in the UI mid-run is flagged on the run as a human interjection, run records survive a Harness restart (cut-short runs show interrupted), Claude Code and Codex are woken once when a run ends">
211
252
  </p>
212
253
 
213
254
  Any process running as your OS user can drive Harness through the socket, the same as running `dsh` directly. dsh-baton relies on Harness 0.2.1-series internal service APIs, so a major Harness update may need a follow-up release.
package/README.zh-CN.md CHANGED
@@ -15,11 +15,11 @@ Claude Code 和 Codex 各派一个任务给 DeepSeek Harness,它的子代理
15
15
  https://github.com/user-attachments/assets/ed931637-acb3-4c16-8c52-72298ea90485
16
16
 
17
17
  <p align="center">
18
- <img src="./assets/readme/zh/features.svg" width="100%" alt="新建工作区和对话、续接指定对话、界面实时可见并标明发送方、完成即唤醒、不用另配 key、macOS 和 Windows 零依赖">
18
+ <img src="./assets/readme/zh/features.svg" width="100%" alt="新建工作区和对话、续接指定对话、界面实时可见并标明发送方、Claude Code 和 Codex 在运行结束时被唤醒、不用另配 key 且可选 Harness 里的任意模型、macOS 和 Windows 零依赖">
19
19
  </p>
20
20
 
21
21
  <p align="center">
22
- <img src="./assets/readme/zh/flow.gif" width="100%" alt="典型流程:新建工作区、派发任务、后台等待、在同一个对话里续接追问">
22
+ <img src="./assets/readme/zh/flow.gif" width="100%" alt="典型流程:新建工作区、派发任务、不轮询地等待(Claude Code 和 Codex 在运行结束时被唤醒)、在同一个对话里续接追问">
23
23
  </p>
24
24
 
25
25
  ## 实际演示
@@ -41,7 +41,7 @@ Codex 和 Claude 轮流往同一个 Harness 对话发消息,每条都标明是
41
41
  ## 快速上手
42
42
 
43
43
  <p align="center">
44
- <img src="./assets/readme/zh/install.svg" width="100%" alt="第一步:Harness → 插件 → 添加插件 → 输入 dsh-baton-host → 安装 → 立即启用,它会为 Claude Code 和 Codex 注册 dsh-baton。第二步:新开对话,让它调用 dsh_list_workspaces">
44
+ <img src="./assets/readme/zh/install.svg" width="100%" alt="第一步:Harness → 插件 → 添加插件 → 输入 dsh-baton-host → 安装 → 立即启用,它会为 Claude Code 和 Codex 注册 dsh-baton。第二步(仅 Codex,一次):设置 → 钩子 → 信任 dsh-baton: waiting for the Harness run。第三步:新开对话,让它调用 dsh_list_workspaces">
45
45
  </p>
46
46
 
47
47
  需要:DeepSeek Harness ≥ 0.2.1-rc.2 并已登录;装了 Claude Code 或 Codex。别的都不用装,不用 Node.js,也不用开终端。macOS 和 Windows 步骤完全相同。
@@ -50,7 +50,9 @@ Codex 和 Claude 轮流往同一个 Harness 对话发消息,每条都标明是
50
50
 
51
51
  插件启用后会为 Claude Code 和 Codex 注册 dsh-baton(对所有文件夹生效),Harness 里会弹出提示。
52
52
 
53
- **2. 检查:**在 Claude Code 或 Codex 里**新开**一个对话,让它调用 `dsh_list_workspaces`,会列出你的 Harness 工作区。
53
+ **2. 仅 Codex,只需一次**:Codex **设置 → 钩子(Hooks)** → **信任** **dsh-baton: waiting for the Harness run**。之后 Codex 在任务跑完时会被自动唤醒,不用再每 270 秒查一次。只需信任一次:以后升级、热更新、重启 Harness 都不用再信任。不信任也能用,Codex 会照旧用 `dsh_wait` 等,第一次交接时会提醒你。
54
+
55
+ **3. 检查**:在 Claude Code 或 Codex 里**新开**一个对话,让它调用 `dsh_list_workspaces`,会列出你的 Harness 工作区。
54
56
 
55
57
  就这些。如果 Harness 提示没能注册,在终端运行 `npx -y dsh-baton-mcp setup`(这需要 Node.js ≥ 22.15),它做的是同样的注册。更新、卸载和 Windows 说明在[后面](#安装细节)。
56
58
 
@@ -66,36 +68,66 @@ Codex 和 Claude 轮流往同一个 Harness 对话发消息,每条都标明是
66
68
 
67
69
  **各客户端怎么等待**(不需要配置):
68
70
  - **Claude Code** 在后台等待任务(`dsh_send` 返回的 `wait_command`),任务结束时只被唤醒一次。
69
- - **Codex** 在 `dsh_wait` 里等待,每次最多 270 秒,刚好低于它 300 秒的工具超时。没做完时只返回状态,Codex 会直接再调用,不会去总结进度。Codex 不会收到 `wait_command`:它的终端无法在命令结束时唤醒它,只能轮询。
71
+ - **Codex**(0.6.1 起)信任了 dsh-baton 的 Stop 钩子后:`dsh_send` 之后直接结束这一轮;钩子在模型之外等任务,任务结束或停下来提问时,带着结果继续同一个对话。每个任务只唤醒模型一次,而不是每 270 秒一次。
72
+ - **Codex** 没有钩子时在 `dsh_wait` 里等待,每次最多 270 秒,刚好低于它 300 秒的工具超时。没做完时只返回状态,Codex 会直接再调用,不会去总结进度。Codex 不会收到 `wait_command`:它的终端无法在命令结束时唤醒它,只能轮询。
70
73
  - Codex 调用 MCP 工具时会请你批准,批准 `dsh-baton` 的工具即可;无人值守的 `codex exec` 加上 `--approve-for-me`。
71
74
 
72
- **转交之后怎么验收**(0.6.0 起):客户端发任务时附上 `checks`,也就是项目自己的测试命令,比如 `npm test`。dsh-baton 在运行前记下文件夹里的文件,运行结束后自己列出新建、修改、删除了哪些文件,并自己跑一遍这些命令;这份 `evidence`(证据)来自 dsh-baton,不是 DeepSeek 的自述。消息末尾还会请 Harness 派一个只读子智能体,对照每条需求复查,最后附一张表(需求、是否满足、依据在哪个文件第几行)。客户端凭证据和这张表验收,没满足的一次性发回去修,只对没满足的行看代码。新开对话默认建在当前对话所在的文件夹,除非用 `cwd` 指定别的文件夹。
75
+ **指定模型**(0.6.1 起):直接说用哪个就行,比如「交给 DeepSeek,用 V4 Pro」。`dsh_send` 会把它作为 `model`(以及 `reasoning_effort`)传过去,按 Harness 自己的模型列表匹配,所以 Harness 以后新加的模型一出现就能用。只对这个对话生效,Harness 的默认模型保持不变。`dsh_list_models` 可以看有哪些模型。
76
+
77
+ **转交之后怎么验收**(0.6.0 起)
78
+
79
+ 不用光听 DeepSeek 自己说做完了。运行前,dsh-baton 先记下文件夹里有什么;运行结束后,它会列出到底新建、修改、删除了哪些文件,并亲自跑一遍项目自己的测试(`npm test`,或者客户端在 `checks` 里给的命令)。接着,另一个只读的 DeepSeek 子智能体会对照需求逐条检查,最后给一张表:哪条需求、做到没有、依据在哪个文件第几行。Claude 或 GPT 只看这些,没做到的一次性发回去改,只有表里写着「没做到」的地方才去翻代码。不用 `cwd` 指定的话,新对话就开在你当前工作的文件夹里。
80
+
81
+ <p align="center">
82
+ <img src="./docs/benchmarks/token-usage-2026-10/charts/evidence-chain.zh.svg" width="100%" alt="一次真实转交的证据链:用户提需求,Codex 写规格和验收命令,dsh-baton 给文件夹拍快照,DeepSeek Harness 写出 11 个文件,dsh-baton 自己列出改动并跑 npm test,Codex 主动打回一处,dsh-baton 再次验收,Codex 通过,基准测试自己的验收 13/13 通过">
83
+ </p>
73
84
 
74
85
  ## Token 用量实测
75
86
 
76
- 2026-10-25/26 实测:用户用大白话提需求(末尾加一句「交给 DeepSeek Harness 去做」),两边用同一个模型,每格跑 3 次,每次都用同一套隐藏的验收脚本检查。下表是每个任务的平均花费,按标价计;DeepSeek 按高峰价,是最保守的算法:
87
+ **一句话:大活、长活交给它**。一次性做一个跨很多文件的功能、一次大重构、一整个小应用,这种时候最省:Claude Code 自己的花费少 65–81%,Codex 在 ChatGPT Plus 一个 5 小时额度里能多做 2 到 5 倍的任务(GPT-6 Astra 做中号任务时是 5 倍)。
77
88
 
78
- | 任务 | Claude Code 自己做 | Claude Code → 0.6.0 | Codex 自己做 | Codex → 0.6.0 |
79
- |---|---|---|---|---|
80
- | 中号:命令行工具、分模块、测试 | $1.07 | 主 Agent $0.37,含 DeepSeek $0.55 | $0.17 | 主 Agent $0.09,含 DeepSeek $0.29 |
81
- | 大号:网页应用、接口、测试 | $2.13 | 主 Agent $0.41,含 DeepSeek $0.70 | $0.41 | 主 Agent $0.10,含 DeepSeek $0.41 |
89
+ **说实话**:小任务,Codex 用 GPT-6.1 Sol 自己做,总价反而比转交更便宜;中号任务两者基本持平。转交值得的场景是:你想让 Claude 或 GPT 负责规划和把关,让更便宜的模型去动手写,又不想老是撞上 5 小时额度上限。
90
+
91
+ **适合谁**:大多数人用 Claude 或 ChatGPT 走的是订阅套餐(Plus、Pro、Max 5x 之类),而 DeepSeek 是充值后按用量扣费,所以每次转交都是套餐之外多花的钱。如果你的套餐额度本来就够用,就不用折腾这套流程,省一点是一点。如果你像我一样,经常跑又长又杂、要反复修改的大任务,老是撞上额度上限,那花一点 DeepSeek 的钱,就能让你已经付费的套餐多干很多活。
92
+
93
+ <p align="center">
94
+ <img src="./docs/benchmarks/token-usage-2026-10/charts/natural-combined.zh.svg" width="100%" alt="每个任务的花费,自己做与转交(0.6.0;Astra 大号任务为 0.6.1):Claude Code(Opus 5.5)和 Codex(GPT-6.1 Sol、GPT-6 Astra),各用自己的刻度">
95
+ </p>
82
96
 
83
- - **Claude Code** 自己的花费少 65–81%,加上 DeepSeek 后总价也只有自己做的一半左右甚至更少。
84
- - **Codex**(gpt-6.1-sol,high)自己模型的花费少一半到四分之三,ChatGPT Plus 的 5 小时额度能多撑一倍以上:中号任务从 1.9% 降到 0.8%,大号从 4.3% 降到 1.0%。Sol 本身很便宜,加上 DeepSeek 后,中号的总价比 Codex 自己做还贵,大号基本持平;省下的是订阅额度。主模型越贵,总价也越省。
85
- - 0.6.0 的 12 次运行全部一次通过验收。
97
+ 每个任务的花费,按标价计,DeepSeek V4.1 Flash 1017 按高峰价:
86
98
 
87
- [完整报告](./docs/benchmarks/token-usage-2026-10.md)里有方法、每一次运行、对比过的其他版本、原始数据和脚本。
99
+ | 客户端 · 模型 | 任务 | 自己做 | 转交,只算客户端 | 转交,含 DeepSeek |
100
+ |---|---|---|---|---|
101
+ | Claude Code · Opus 5.5 high | 小号 | $1.07 | $0.37(−65%) | $0.55(−49%) |
102
+ | Claude Code · Opus 5.5 high | 中号 | $2.13 | $0.41(−81%) | $0.70(−67%) |
103
+ | Codex · GPT-6.1 Sol high | 小号 | $0.17 | $0.09(−49%) | $0.29(+73%) |
104
+ | Codex · GPT-6.1 Sol high | 中号 | $0.41 | $0.10(−75%) | $0.41(−2%) |
105
+ | Codex · GPT-6 Astra high | 小号 | $0.79 | $0.56(−29%) | $0.75(−6%) |
106
+ | Codex · GPT-6 Astra high | 中号 | $2.27 | $0.48(−79%) | $0.78(−65%) |
88
107
 
89
108
  <p align="center">
90
- <img src="./docs/benchmarks/token-usage-2026-10/charts/natural-total-claude-release.zh.svg" width="100%" alt="Claude Code 每个任务的花费:自己做与转交,含与不含 DeepSeek">
91
- <img src="./docs/benchmarks/token-usage-2026-10/charts/natural-total-codex-release.zh.svg" width="100%" alt="Codex 每个任务的花费:自己做与转交,含与不含 DeepSeek">
92
- <img src="./docs/benchmarks/token-usage-2026-10/charts/natural-codex-quota-release.zh.svg" width="100%" alt="Codex Plus 每个任务占用的 5 小时额度">
109
+ <img src="./docs/benchmarks/token-usage-2026-10/charts/natural-quota-combined.zh.svg" width="80%" alt="Codex 每个任务占 ChatGPT Plus 5 小时额度,自己做与用 0.6.0 转交:GPT-6.1 Sol 和 GPT-6 Astra">
93
110
  </p>
94
111
 
112
+ 每个任务占 ChatGPT Plus 5 小时额度:Sol 小号 1.9% → 0.8%,Sol 中号 4.3% → 1.0%,Astra 小号 7% → 3.5%,Astra 中号 22% → 4%。
113
+
114
+ <details>
115
+ <summary>测了什么、怎么测的</summary>
116
+
117
+ - **两个任务,用普通用户的口吻提**。小号任务 Claude Code 或 Codex 自己做大约 7–8 分钟;中号任务是一个带服务器和页面的小应用。比这更长的大活没有测。原文如下,可以直接点开看:
118
+ - 小号:用 Node 写一个命令行任务管理工具,零依赖,分模块,带测试。[需求原文](docs/benchmarks/token-usage-2026-10/natural/medium.md) · [验收脚本](docs/benchmarks/token-usage-2026-10/checks/natural-medium.mjs)
119
+ - 中号:一个任务管理网页应用,Node 服务器加前端页面,REST 接口、统计、测试和 README。[需求原文](docs/benchmarks/token-usage-2026-10/natural/large.md) · [验收脚本](docs/benchmarks/token-usage-2026-10/checks/natural-large.mjs)
120
+ - **转交组唯一的区别**,是在需求末尾多一句:交给 DeepSeek Harness 去做。
121
+ - 两组用同一个模型、同样的推理强度,每格跑 3 次(Astra 各 1 次,小号转交跑了 2 次);每次都用同一套验收脚本检查,模型看不到这个脚本。转交组 12 次全部一次通过。
122
+ - 价格按标价算。DeepSeek 按高峰价,是最保守的算法;实际 DeepSeek 账单大约是这个数的 58%。
123
+ - 每一次运行、原始数据和脚本:[运行日志](docs/benchmarks/token-usage-2026-10/LOG.md)、[完整报告](docs/benchmarks/token-usage-2026-10.md)。
124
+
125
+ </details>
126
+
95
127
  ## 工具
96
128
 
97
129
  <p align="center">
98
- <img src="./assets/readme/zh/tools.svg" width="100%" alt="工作区:列出、新建、改名。对话:列出、读取、当前活动、改名。运行:发送、状态、等待、取消、列出最近运行">
130
+ <img src="./assets/readme/zh/tools.svg" width="100%" alt="工具列表里有 10 个:列出工作区、列出对话、读取对话、列出模型、发送、状态、等待、回答、取消、dsh_call。另外 6 个不常用的经 dsh_call 调用:新建和改名工作区、对话动态、给对话改名、修改排队消息、列出运行">
99
131
  </p>
100
132
 
101
133
  <p align="center">
@@ -108,19 +140,20 @@ Codex 和 Claude 轮流往同一个 Harness 对话发消息,每条都标明是
108
140
  | 工具 | 作用 |
109
141
  |---|---|
110
142
  | `dsh_list_workspaces` | 列出 Harness 侧边栏里的工作区 |
111
- | `dsh_create_workspace` | 把一个文件夹登记为工作区(文件夹不存在会先创建);已登记的直接返回原来那个 |
112
- | `dsh_list_sessions` | 列出对话(最新在前),带标题、目录、是否在跑;可按目录或关键字过滤。已归档的对话不会列出 |
143
+ | `dsh_create_workspace` | 经 `dsh_call` 调用。把一个文件夹登记为工作区(文件夹不存在会先创建);已登记的直接返回原来那个 |
144
+ | `dsh_list_sessions` | 列出对话(最新在前),带标题、目录、是否在跑和 `model`(下一次请求用的模型);可按目录或关键字过滤。已归档的对话不会列出 |
145
+ | `dsh_list_models` | 列出 Harness 能用的模型(provider、id、名称、推理强度)和它的默认模型 |
113
146
  | `dsh_read_session` | 读某个对话最近的消息和回复(含用到的工具名);已归档的对话会带 `archived: true` |
114
- | `dsh_send` | 发消息。带 `session_id` 续接那个对话;否则新开对话,建在 `cwd` 或 `workspace_id` 指定的位置,都不带时建在当前对话所在的文件夹(`cwd` 还不是工作区时会先登记;指定的 `cwd` 在当前对话文件夹之外也可以,结果里的 `folder_note` 会提醒)。`checks`:运行结束后 dsh-baton 自己跑的测试命令(见「转交之后怎么验收」)。立即返回 `run_id`。Harness 里这条消息会标注「由 Claude / ChatGPT 从另一个聊天发送」。已归档的对话会被拒绝:先在 Harness 里取消归档,或新开对话。对话正忙时,`mode` 为 `followup` 会排在当前回合之后,`steer` 会插进正在跑的回合;不传时跟随 Harness 自己的设置(设置 → 繁忙时的发送行为:排队发送或插话发送),读不到设置时按 `followup`。返回里的 `mode_source` 说明用的是哪种 |
115
- | `dsh_status` | 查看运行进度:状态、最近的文字和工具调用、最终回复;回合结束但子智能体/后台任务还在跑时给出 `waiting_on`;中途有人在 Harness 界面里发消息时给出 `human_interjections`;被 Harness 重启打断的任务状态为 `interrupted` |
116
- | `dsh_wait` | 等运行结束;发消息时带了 `checks` 的,结束后会附上 `evidence`(改了哪些文件、测试结果)(或者等到它停下来问人,见 `dsh_answer`):Codex 每次最多等 270 秒,其他客户端 50 秒。没做完会带 `timed_out`,只返回状态,再调用一次即可。能在后台等待的客户端改用 `dsh_send` 返回的 `wait_command`。`dsh_status` 只用来看一眼,不用来等待 |
147
+ | `dsh_send` | 发消息。带 `session_id` 续接那个对话;否则新开对话,建在 `cwd` 或 `workspace_id` 指定的位置,都不带时建在当前对话所在的文件夹(`cwd` 还不是工作区时会先登记;指定的 `cwd` 在当前对话文件夹之外也可以,结果里的 `folder_note` 会提醒)。`checks`:运行结束后 dsh-baton 自己跑的测试命令(见「转交之后怎么验收」)。立即返回 `run_id`。Harness 里这条消息会标注「由 Claude / ChatGPT 从另一个聊天发送」。已归档的对话会被拒绝:先在 Harness 里取消归档,或新开对话。对话正忙时,`mode` 为 `followup` 会排在当前回合之后,`steer` 会插进正在跑的回合;不传时跟随 Harness 自己的设置(设置 → 繁忙时的发送行为:排队发送或插话发送),读不到设置时按 `followup`。返回里的 `mode_source` 说明用的是哪种。`model` 只在用户点名模型时传(如“DeepSeek-V4 Pro”“v4-pro”;`reasoning_effort` 同理):按 Harness 自己的模型列表匹配,不分大小写,忽略空格、连字符和开头的 DeepSeek,所以 Harness 以后上线的模型(如 V4.1 Pro)一出现在列表里就能用;匹配不到或匹配到多个时,发送直接失败、什么都不创建,并列出可用模型(用 `provider/model` 指定其一)。模型在消息发出前设到该对话上,Harness 的默认模型会恢复原样(Harness 会把对话里选的模型同时存成默认)。不传时,续接的对话沿用它自己的模型,新对话用 Harness 默认模型。返回值的 `model` 和 `model_source` 写明用的是哪个 |
148
+ | `dsh_status` | 查看运行进度:状态、最近的文字和工具调用、最终回复;回合结束但子智能体/后台任务还在跑时给出 `waiting_on`;中途有人在 Harness 界面里发消息时给出 `human_interjections`;被 Harness 重启打断的任务状态为 `interrupted`;以及这次运行发送时用的 `model` |
149
+ | `dsh_wait` | 信任了 Stop 钩子的 Codex 用不到它。等运行结束;发消息时带了 `checks` 的,结束后会附上 `evidence`(改了哪些文件、测试结果)(或者等到它停下来问人,见 `dsh_answer`):Codex 每次最多等 270 秒,其他客户端 50 秒。没做完会带 `timed_out`,只返回状态,再调用一次即可。能在后台等待的客户端改用 `dsh_send` 返回的 `wait_command`。`dsh_status` 只用来看一眼,不用来等待 |
117
150
  | `dsh_answer` | 回答运行中途提出的问题(Harness 的 ask_user_question):每道题可以填选项编号或选项文字、自由填写,或者跳过;可以逐题回答,也可以一次答完。运行一提问,`dsh_wait` 和 `wait_command` 就会立刻返回,并带上题目(`needs_input`、`question`;Harness 那边模型推荐的选项单独放在 `harness_suggested` 里,不再写在选项文字中)。只有你说过让它自己决定时,助手才会按自己的判断回答,这时它会带上 `reason`,并告诉你选了什么、为什么;否则它会把题目转给你,开头先写它自己的建议和理由。你也可以直接在 Harness 窗口里回答,谁先答就算谁的 |
118
- | `dsh_session_activity` | 对话此刻在做什么:正在跑的回合、子智能体(任意层级)、后台任务;已归档的对话会带 `archived: true` |
119
- | `dsh_update_queued` | 按 `run_id` 修改还在忙碌对话队列里等待的消息:`edit` 改文字,`remove` 撤回,`steer` 立刻插进正在跑的回合。消息一旦进入对话就改不了了 |
151
+ | `dsh_session_activity` | 经 `dsh_call` 调用。对话此刻在做什么:正在跑的回合、子智能体(任意层级)、后台任务;已归档的对话会带 `archived: true` |
152
+ | `dsh_update_queued` | 经 `dsh_call` 调用。按 `run_id` 修改还在忙碌对话队列里等待的消息:`edit` 改文字,`remove` 撤回,`steer` 立刻插进正在跑的回合。消息一旦进入对话就改不了了 |
120
153
  | `dsh_cancel` | 按 `run_id` 或 `session_id` 停掉整个对话的工作:当前回合、子智能体、后台任务。Harness 会同时清掉队列里等待的消息,这些运行记为 `cancelled` |
121
- | `dsh_rename_session` | 给对话改名 |
122
- | `dsh_rename_workspace` | 给工作区改名(只改侧边栏标题,不动文件夹) |
123
- | `dsh_list_runs` | 列出最近的运行,可按会话筛选 |
154
+ | `dsh_rename_session` | 经 `dsh_call` 调用。给对话改名 |
155
+ | `dsh_rename_workspace` | 经 `dsh_call` 调用。给工作区改名(只改侧边栏标题,不动文件夹) |
156
+ | `dsh_list_runs` | 经 `dsh_call` 调用。列出最近的运行,可按会话筛选 |
124
157
  | `dsh_call` | 按名字调用任意 `dsh_*` 工具:0.6.0 起,不常用的工具(新建和重命名工作区、重命名对话、对话动态、修改排队消息、运行列表)不再出现在工具列表里,好让每次请求更短,改由这里调用;对话的工具列表还是更新前的旧版时也用它。名字不存在时会列出所有可用工具 |
125
158
 
126
159
  </details>
@@ -152,6 +185,7 @@ dsh-baton rename-workspace ~/code/new-app 新名字
152
185
  | `DSH_BATON_HOME` | `~/.dsh-baton` | 套接字和 headless 运行记录的位置 |
153
186
  | `DSH_BATON_SOCKET` | `$DSH_BATON_HOME/host.sock` | 插件套接字路径(插件和 MCP 两边要一致);Windows 上映射为按用户区分的命名管道,见 [WINDOWS.md](WINDOWS.md) |
154
187
  | `DSH_BATON_WAIT_S` | Codex 为 `270`,其他为 `50` | 一次 `dsh_wait` 等多久;只有调大了客户端的工具超时才需要设,并且要小于那个超时 |
188
+ | `DSH_BATON_CODEX_HOOK` | `1` | 给 Harness 设为 `0`,插件就不再添加 Codex 的 Stop 钩子 |
155
189
  | `DSH_BIN` | macOS 应用内的 `dsh`,否则查 `PATH` | headless 模式用的 Harness 命令行 |
156
190
  | `DSH_HOME` | `~/.dsh` | Harness 数据目录(headless 模式读取对话用) |
157
191
  | `DSH_BATON_ACCOUNT` | `1` | headless 模式下设为 `0` 则改用 API key 路线 |
@@ -166,21 +200,26 @@ dsh-baton rename-workspace ~/code/new-app 新名字
166
200
 
167
201
  ## 安装细节
168
202
 
169
- **插件启用时做了什么。**它把 MCP 服务器复制到 `~/.dsh-baton/app` 这个固定的文件夹,再直接把 MCP 注册写进 `~/.claude.json` 和 `~/.codex/config.toml`,各留一份 `*.bak-dsh-baton` 备份。电脑上有 Node.js ≥ 22.15(在 `PATH` 里能找到)就用它启动服务器;没有的话,就用 Harness 自带的运行环境(Harness 应用本身以 Node 模式运行,`ELECTRON_RUN_AS_NODE=1`),不用另外安装任何东西。两种情况下,只装了桌面应用、`claude` / `codex` 不在 `PATH` 里也能用。每次 Harness 启动都会再检查一遍:已经正确的注册、或者指向另一份可用 dsh-baton 的注册,都不会改动。在 Harness 里输入包名后,安装源会自动切到「npm 官方源」(英文界面是 "Official npm registry"),不用另外选择,也不用重启。不想让插件自动注册,给 Harness 设置 `DSH_BATON_AUTO_REGISTER=0`。
203
+ <details>
204
+ <summary>插件做了什么、更新、卸载、从 dsh-bridge 升级、从源码安装、Windows</summary>
205
+
206
+ **插件启用时做了什么**。它把 MCP 服务器复制到 `~/.dsh-baton/app` 这个固定的文件夹,再直接把 MCP 注册写进 `~/.claude.json` 和 `~/.codex/config.toml`,各留一份 `*.bak-dsh-baton` 备份。电脑上有 Node.js ≥ 22.15(在 `PATH` 里能找到)就用它启动服务器;没有的话,就用 Harness 自带的运行环境(Harness 应用本身以 Node 模式运行,`ELECTRON_RUN_AS_NODE=1`),不用另外安装任何东西。两种情况下,只装了桌面应用、`claude` / `codex` 不在 `PATH` 里也能用。每次 Harness 启动都会再检查一遍:已经正确的注册、或者指向另一份可用 dsh-baton 的注册,都不会改动。在 Harness 里输入包名后,安装源会自动切到「npm 官方源」(英文界面是 "Official npm registry"),不用另外选择,也不用重启。不想让插件自动注册,给 Harness 设置 `DSH_BATON_AUTO_REGISTER=0`。
207
+
208
+ **Codex 的 Stop 钩子**。插件会在 `~/.codex/config.toml` 里加一段带 `# dsh-baton` 标记的 `[[hooks.Stop]]`,Codex 里显示为 **dsh-baton: waiting for the Harness run**,你信任之后才会运行(dsh-baton 不会替你信任)。这一段只写了一个小脚本的路径 `~/.dsh-baton/bin/codex-stop-hook`(Windows 上是 `codex-stop-hook.cmd`),Node.js 和服务器这些会变的路径都放在脚本里。所以这一段本身永远不变:升级、同版本刷新、重启 Harness 都不会动它,信任一直有效。万一这一段被改写,dsh-baton 会清掉旧的信任记录,Codex 会请你重新信任。Windows 上用 `.cmd`,是因为 Codex 通过 `PowerShell -Command` 运行钩子,启动不了带引号的程序路径。服务器用 Harness 自带运行环境时不加这个钩子。手动添加用 `dsh-baton setup --codex-hook`,`setup --remove` 会删掉它,给 Harness 设置 `DSH_BATON_CODEX_HOOK=0` 则插件不再添加。
170
209
 
171
- **更新不用重启。**新版本装进 `~/.dsh-baton/app` 后(插件更新、`setup` 或手动复制),Claude Code 和 Codex 里已经开着的对话,下一次调用 `dsh_*` 工具时就会用上:服务器每次调用前检查这个文件夹,启动新版本,并在这次调用的结果里提示一次已经更新。正在进行的 `dsh_wait` 会先在旧版本里跑完。新版本启动失败时,旧版本继续工作,结果里会说明原因。新版本新增的工具,Claude Code 里马上就能用(服务器会通知客户端工具列表变了);Codex 一直用对话开始时的工具列表,新工具要到下一个新对话才会显示;从 0.5.9 起,旧对话里也能通过 `dsh_call` 马上用上新功能(更新提示里会写明),已有的工具也会立刻用上新代码。这个功能从 0.5.8 之后的版本开始有效;由 0.5.8 或更早版本启动的服务器,还需要最后重启一次(或在 `/mcp` 里重新连接)。
210
+ **更新不用重启**。新版本装进 `~/.dsh-baton/app` 后(插件更新、`setup` 或手动复制),或者同一版本但文件有改动时,Claude Code 和 Codex 里已经开着的对话,下一次调用 `dsh_*` 工具时就会用上:服务器每次调用前检查这个文件夹,启动新版本,并在这次调用的结果里提示一次已经更新。正在进行的 `dsh_wait` 会先在旧版本里跑完。新版本启动失败时,旧版本继续工作,结果里会说明原因。新版本新增的工具,Claude Code 里马上就能用(服务器会通知客户端工具列表变了);Codex 一直用对话开始时的工具列表,新工具要到下一个新对话才会显示;从 0.5.9 起,旧对话里也能通过 `dsh_call` 马上用上新功能(更新提示里会写明),已有的工具也会立刻用上新代码。这个功能从 0.5.8 之后的版本开始有效;由 0.5.8 或更早版本启动的服务器,还需要最后重启一次(或在 `/mcp` 里重新连接)。
172
211
 
173
212
  **`npx -y dsh-baton-mcp setup`** 在终端里做同样的注册:用于插件没能注册的情况,或者从 MCP 目录过来的用户。插件已经注册过时它什么都不改;插件没装的话,它会提示去添加。
174
213
 
175
- **更新。**Harness 只给官方插件提供"更新"按钮,所以要:插件 → dsh-baton-host → **卸载**,再**添加插件** → `dsh-baton-host`。新版本刚发布的一段时间里,Harness 会装上一个版本(pnpm 的 `minimumReleaseAge` 会暂缓刚发布的版本,安装弹窗里会说明);想马上用新版,输入带版本号的名字:`dsh-baton-host@0.5.0`。重新启用后,插件会把 MCP 服务器也更新到同一版本,新开的对话就会用上。万一两边版本对不上,第一次发现不一致的工具调用会提示。
214
+ **更新**。Harness 只给官方插件提供"更新"按钮,所以要:插件 → dsh-baton-host → **卸载**,再**添加插件** → `dsh-baton-host`。新版本刚发布的一段时间里,Harness 会装上一个版本(pnpm 的 `minimumReleaseAge` 会暂缓刚发布的版本,安装弹窗里会说明);想马上用新版,输入带版本号的名字:`dsh-baton-host@0.6.1`。预发布版必须写确切版本号添加,比如 `dsh-baton-host@0.6.0-next.0`:Harness 会把 `@next` 解析成一个坏掉的占位包。只输入 `dsh-baton-host` 装的是最新正式版。重新启用后,插件会把 MCP 服务器也更新到同一版本,新开的对话就会用上。万一两边版本对不上,第一次发现不一致的工具调用会提示,并写明哪一边旧、另一边的确切版本号。
176
215
 
177
- **卸载。**Harness → 插件 → dsh-baton-host → **卸载**,再运行 `npx -y dsh-baton-mcp setup --remove`。插件分不清"被卸载"和"Harness 退出",所以 MCP 注册交给这条命令删,它也会删掉 `~/.dsh-baton/app`;运行记录留在 `~/.dsh-baton`,不需要的话自己删掉。
216
+ **卸载**。Harness → 插件 → dsh-baton-host → **卸载**,再运行 `npx -y dsh-baton-mcp setup --remove`。插件分不清"被卸载"和"Harness 退出",所以 MCP 注册交给这条命令删,它也会删掉 `~/.dsh-baton/app`;运行记录留在 `~/.dsh-baton`,不需要的话自己删掉。
178
217
 
179
- **从 dsh-bridge 升级。**在 Harness 里先卸载 `dsh-bridge-host`,再添加 `dsh-baton-host`;启用后它会替换掉旧的 `dsh-bridge` MCP 注册。`DSH_BRIDGE_*` 环境变量和已有的 `~/.dsh-bridge` 文件夹暂时继续可用。工具前缀变成 `mcp__dsh-baton__…`,权限白名单里写了旧前缀的要改一下。0.4 之前通过粘贴 `~/.dsh-baton/app/host` 装的插件仍然能用,但不会跟着 npm 更新:卸载它,再按包名添加 `dsh-baton-host`。
218
+ **从 dsh-bridge 升级**。在 Harness 里先卸载 `dsh-bridge-host`,再添加 `dsh-baton-host`;启用后它会替换掉旧的 `dsh-bridge` MCP 注册。`DSH_BRIDGE_*` 环境变量和已有的 `~/.dsh-bridge` 文件夹暂时继续可用。工具前缀变成 `mcp__dsh-baton__…`,权限白名单里写了旧前缀的要改一下。0.4 之前通过粘贴 `~/.dsh-baton/app/host` 装的插件仍然能用,但不会跟着 npm 更新:卸载它,再按包名添加 `dsh-baton-host`。
180
219
 
181
220
  **从源码安装**(想跟进 `main` 或改代码):`git clone https://github.com/JialaoLiu/dsh-baton.git`,然后在 Harness 里从克隆目录的 `host` 文件夹添加插件(添加插件 → 粘贴路径)。启用后注册的就是克隆目录本身,改动在发布前就能跑起来;更新用 `git pull`。在终端里运行 `node dsh-baton/src/cli.mjs setup` 也能注册克隆目录。
182
221
 
183
- **Windows。**步骤相同;[WINDOWS.md](WINDOWS.md) 说明了不同之处(用命名管道代替套接字文件),以及插件页装不上或卸不掉时的修法。
222
+ **Windows**。步骤相同;[WINDOWS.md](WINDOWS.md) 说明了不同之处(用命名管道代替套接字文件),以及插件页装不上或卸不掉时的修法。
184
223
 
185
224
  <details>
186
225
  <summary>手动注册与 Claude 桌面应用</summary>
@@ -202,6 +241,8 @@ codex mcp add dsh-baton -- "$(command -v node)" "$PWD/dsh-baton/src/server.mjs"
202
241
 
203
242
  </details>
204
243
 
244
+ </details>
245
+
205
246
  ## 安全与限制
206
247
 
207
248
  <p align="center">
@@ -209,7 +250,7 @@ codex mcp add dsh-baton -- "$(command -v node)" "$PWD/dsh-baton/src/server.mjs"
209
250
  </p>
210
251
 
211
252
  <p align="center">
212
- <img src="./assets/readme/zh/limits.svg" width="100%" alt="使用须知:任务进行中在界面里发的话会作为人工插话记到任务上;任务记录在 Harness 重启后还在,被打断的标为 interrupted;Claude Code 结束时唤醒一次,Codex 每次最多等 270 秒">
253
+ <img src="./assets/readme/zh/limits.svg" width="100%" alt="使用须知:任务进行中在界面里发的话会作为人工插话记到任务上;任务记录在 Harness 重启后还在,被打断的标为 interrupted;Claude Code 和 Codex 都只在运行结束时被唤醒一次">
213
254
  </p>
214
255
 
215
256
  任何能以你的身份运行程序的进程都能通过这个套接字驱动 Harness,这和直接运行 `dsh` 的权限一样。本项目依赖 Harness 0.2.1 系列的内部服务接口,Harness 大版本更新后可能需要跟进。
@@ -54,6 +54,8 @@ window.__ModuleLoader__.load({
54
54
  notInstalled: '未安装',
55
55
  notRegistered: '未注册',
56
56
  and: '和',
57
+ hookTitle: 'Codex 还差一步',
58
+ hookText: '打开 Codex → Settings → Hooks,信任 Stop 钩子“dsh-baton: waiting for the Harness run”。信任后,Codex 等 DeepSeek 时不再消耗额度。',
57
59
  }
58
60
  const en = {
59
61
  sentFrom: 'Sent by {name} from another chat',
@@ -74,6 +76,8 @@ window.__ModuleLoader__.load({
74
76
  notInstalled: 'not installed',
75
77
  notRegistered: 'not registered',
76
78
  and: 'and',
79
+ hookTitle: 'One more step for Codex',
80
+ hookText: 'Open Codex → Settings → Hooks and trust the Stop hook “dsh-baton: waiting for the Harness run”. Once trusted, Codex no longer uses your quota while it waits for DeepSeek.',
77
81
  }
78
82
 
79
83
  // --- Plugins page ------------------------------------------------------------
@@ -94,7 +98,12 @@ window.__ModuleLoader__.load({
94
98
  if (res.ok) next = (await res.json()).registration
95
99
  } catch { /* not served yet */ }
96
100
  if (stopped) return
97
- if (next && next.state !== 'pending') return setReg(next)
101
+ if (next && next.state !== 'pending') {
102
+ setReg(next)
103
+ // Waiting for the user to trust the Codex hook: look again, so the note goes once they do.
104
+ if (untrusted(next)) setTimeout(poll, 4000)
105
+ return
106
+ }
98
107
  if (++tries >= 30) return setReg({ state: 'unknown' })
99
108
  setTimeout(poll, 700)
100
109
  }
@@ -104,6 +113,30 @@ window.__ModuleLoader__.load({
104
113
  return reg
105
114
  }
106
115
 
116
+ const untrusted = (reg) => Boolean(reg?.codexHook?.installed && !reg.codexHook.trusted)
117
+
118
+ // Codex runs dsh-baton's Stop hook only once the user trusts it in Codex; until then
119
+ // Codex spends model requests while it waits. Shown until they do, in Harness's accent.
120
+ function TrustNote({ reg, t }) {
121
+ if (!untrusted(reg)) return null
122
+ const accent = 'var(--dsw-alias-state-business-primary)'
123
+ return h('div', {
124
+ role: 'note', 'data-dsh-baton-trust': '',
125
+ style: {
126
+ display: 'flex', gap: 10, alignItems: 'flex-start', marginTop: 8, padding: '10px 12px', borderRadius: 8,
127
+ background: `color-mix(in srgb, ${accent} 7%, transparent)`,
128
+ border: `1px solid color-mix(in srgb, ${accent} 22%, transparent)`,
129
+ color: 'var(--dsw-alias-label-secondary)', fontSize: 13, lineHeight: '20px', textAlign: 'start',
130
+ },
131
+ },
132
+ h('svg', { width: 16, height: 16, viewBox: '0 0 16 16', fill: 'none', 'aria-hidden': true, style: { flex: 'none', marginTop: 2, color: accent } },
133
+ h('path', { d: 'M8 1.75 2.75 3.9v3.6c0 3.1 2.2 5.6 5.25 6.75 3.05-1.15 5.25-3.65 5.25-6.75V3.9z', stroke: 'currentColor', strokeWidth: 1.3, strokeLinejoin: 'round' }),
134
+ h('path', { d: 'm5.6 8.1 1.7 1.7 3.2-3.4', stroke: 'currentColor', strokeWidth: 1.3, strokeLinecap: 'round', strokeLinejoin: 'round' })),
135
+ h('div', null,
136
+ h('div', { style: { color: 'var(--dsw-alias-label-primary)', fontWeight: 600 } }, t('hookTitle')),
137
+ h('div', null, t('hookText'))))
138
+ }
139
+
107
140
  // What to tell the user: [title or null, text]. null while the host is still working.
108
141
  function describe(reg, t) {
109
142
  if (!reg || reg.state === 'pending') return [null, t('pending')]
@@ -122,16 +155,18 @@ window.__ModuleLoader__.load({
122
155
  // Shown once, right after "Enable now".
123
156
  function wrapActivation(t) {
124
157
  return function DshBatonActivation({ onDismiss }) {
125
- const [title, text] = describe(useRegistration(), t)
158
+ const reg = useRegistration()
159
+ const [title, text] = describe(reg, t)
126
160
  if (ui?.Modal && ui?.Button) {
127
161
  return h(ui.Modal, {
128
162
  open: true, title: title ?? t('readyTitle'), closeLabel: t('ok'), onClose: onDismiss,
129
163
  footer: h(ui.Button, { variant: 'primary', 'data-modal-autofocus': true, onClick: onDismiss }, t('ok')),
130
- }, h('p', null, text))
164
+ }, h('p', null, text), h(TrustNote, { reg, t }))
131
165
  }
132
166
  return h('div', { role: 'status', style: { margin: '12px 0', padding: 12, borderRadius: 8, border: '1px solid var(--dsw-alias-border-l3)', color: 'var(--dsw-alias-label-primary)' } },
133
167
  title ? h('strong', null, title) : null,
134
168
  h('p', { style: { margin: '6px 0' } }, text),
169
+ h(TrustNote, { reg, t }),
135
170
  h('button', { type: 'button', onClick: onDismiss }, t('ok')))
136
171
  }
137
172
  }
@@ -147,7 +182,8 @@ window.__ModuleLoader__.load({
147
182
  return h('div', { style: { display: 'flex', flexDirection: 'column', gap: 4, color: 'var(--dsw-alias-label-secondary)' } },
148
183
  h('strong', { style: { color: 'var(--dsw-alias-label-primary)' } }, t('status')),
149
184
  rows.length ? h('span', null, rows.join(' · ')) : null,
150
- h('span', null, text))
185
+ h('span', null, text),
186
+ h(TrustNote, { reg, t }))
151
187
  }
152
188
  }
153
189