dsh-taskbridge 0.0.0-stage → 1.3.2

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.
Files changed (75) hide show
  1. package/CHANGELOG.md +763 -0
  2. package/LICENSE +21 -0
  3. package/README.md +622 -3
  4. package/bin/dsh-delegate-codex-agent.js +115 -0
  5. package/bin/dsh-delegate-control.d.ts +90 -0
  6. package/bin/dsh-delegate-control.js +450 -0
  7. package/bin/dsh-delegate-mcp.d.ts +121 -0
  8. package/bin/dsh-delegate-mcp.js +273 -0
  9. package/codex/dsh-taskbridge.toml +247 -0
  10. package/cordis.patch.yml +6 -0
  11. package/docs/INTRODUCTION.md +15 -0
  12. package/docs/INTRODUCTION.zh.md +34 -0
  13. package/docs/auth-contract.md +138 -0
  14. package/docs/claude-code.md +31 -0
  15. package/docs/codex-integration.md +937 -0
  16. package/docs/contracts-stage-b.md +443 -0
  17. package/docs/conversation-placement.md +304 -0
  18. package/docs/plugin-market.md +30 -0
  19. package/docs/redaction-contract.md +127 -0
  20. package/docs/runtime-compatibility.md +223 -0
  21. package/docs/silent-wait.md +191 -0
  22. package/docs/taskbridge-upgrade.md +28 -0
  23. package/docs/taskdispatch-upgrade.md +25 -0
  24. package/docs/worker-permissions.md +347 -0
  25. package/docs/workspace-contract.md +538 -0
  26. package/icon.svg +1 -0
  27. package/lib/client.d.ts +118 -0
  28. package/lib/client.js +3232 -0
  29. package/locale/en.json +7 -0
  30. package/locale/zh.json +7 -0
  31. package/package.json +138 -4
  32. package/src/auth/fence.js +361 -0
  33. package/src/auth/grants.js +789 -0
  34. package/src/client/api.js +2322 -0
  35. package/src/client/index.jsx +2333 -0
  36. package/src/client/styles.js +251 -0
  37. package/src/codex/installer.js +3299 -0
  38. package/src/codex/seam.js +429 -0
  39. package/src/codex/toml.js +784 -0
  40. package/src/config/defaults.js +164 -0
  41. package/src/config/redact.js +184 -0
  42. package/src/config/settings.js +629 -0
  43. package/src/config/store.js +186 -0
  44. package/src/config/validate.js +763 -0
  45. package/src/credentials/seam.js +202 -0
  46. package/src/http/execution-plane.js +456 -0
  47. package/src/http/respond.js +175 -0
  48. package/src/http/user-plane.js +1122 -0
  49. package/src/index.d.ts +332 -0
  50. package/src/index.js +657 -0
  51. package/src/jobs/activity.js +1008 -0
  52. package/src/jobs/engine.js +3614 -0
  53. package/src/jobs/history.js +1467 -0
  54. package/src/jobs/title.js +17 -0
  55. package/src/mcp/server.js +1821 -0
  56. package/src/mcp/wait.js +536 -0
  57. package/src/model/connectivity.js +371 -0
  58. package/src/model/discovery.js +582 -0
  59. package/src/model/native-catalog.js +68 -0
  60. package/src/model/openai-adapter.js +671 -0
  61. package/src/model/probe.js +264 -0
  62. package/src/model/providers.js +756 -0
  63. package/src/model/routing.js +321 -0
  64. package/src/review/preset.js +868 -0
  65. package/src/review/prompts.js +126 -0
  66. package/src/review/reviewer.js +933 -0
  67. package/src/runtime/agent-runner.js +1740 -0
  68. package/src/runtime/endpoint-discovery.js +118 -0
  69. package/src/runtime/permissions.js +1429 -0
  70. package/src/runtime/sandbox.js +358 -0
  71. package/src/runtime/session-placement.js +1121 -0
  72. package/src/workspace/audit.js +775 -0
  73. package/src/workspace/locks.js +167 -0
  74. package/src/workspace/preflight.js +424 -0
  75. package/src/workspace/worktrees.js +613 -0
@@ -0,0 +1,223 @@
1
+ # Runtime compatibility
2
+
3
+ This document states which DSH runtimes this plugin build (`1.3.2`, package
4
+ `dsh-taskbridge-1.3.2.tgz`) may be loaded into, what changed in the newest one, and what
5
+ has and has not been verified on it. It is a compatibility note, not an acceptance
6
+ report; the package is distributed through npm and the GitHub Release. See the
7
+ [1.3.2 release notes](releases/1.3.2.zh.md) for upgrade details and the
8
+ [1.3.1 release report](releases/1.3.1.zh.md) for historical distribution verification.
9
+
10
+ `1.1.0` added silent waiting: the global `monitoring` thresholds (self-check and attention
11
+ intervals), bounded activity metadata on every task view, the authenticated monitoring
12
+ settings route and its Chinese controls, the task panel's bounded auto-refresh, the Codex
13
+ companion's submit → `delegate_wait` rules, and the managed MCP entry's owned
14
+ `tool_timeout_sec`.
15
+
16
+ `1.2.0` is a correction release on top of that behaviour, with no runtime-API change: an
17
+ interrupted OBSERVATION is no longer reported as an ended execution, a new independent
18
+ local control binary (`dsh-delegate-control status|cancel <taskId>`) talks to the same
19
+ loopback plane, and plugin startup now upgrades an ALREADY INSTALLED managed
20
+ `mcp_servers.dsh-delegate` entry that is merely stale. The supported runtime range below
21
+ and the execution implementation are carried over unchanged from `1.0.0`; the DSH `0.2.2`
22
+ compatibility described here was introduced by `0.1.12` and is historical fact for this
23
+ build.
24
+
25
+ **Historical 1.2.0 acceptance boundary, not a live installation inventory:** during
26
+ that release's checks, the operator's Desktop profile was on `1.1.0` and `1.2.0` had
27
+ not been installed into it. The complete
28
+ Desktop upgrade/restart acceptance and the actual token-saving ratio have not been
29
+ measured in the current 1.3.2 publication either. MCP/CLI acceptance evidence belongs
30
+ in the Release notes and is not pre-filled here. An older production profile must
31
+ be upgraded to this build, and the
32
+ Codex companion refreshed from the settings page (or by the startup check, which now also
33
+ upgrades the installed MCP entry) and Codex reloaded before the new wait rules and the
34
+ managed `tool_timeout_sec` take effect. No unit-test count and no mock constitutes an
35
+ acceptance run.
36
+
37
+ ## 1. Supported versions
38
+
39
+ `engines.dsh` and every `@deepseek-ai/dsh-*` peer range are the **same exact union**,
40
+ and nothing else is admitted:
41
+
42
+ ```
43
+ 0.2.0-rc.2 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.2-rc.1
44
+ ```
45
+
46
+ | DSH runtime | Status in this build | Evidence |
47
+ | --- | --- | --- |
48
+ | `0.2.0-rc.2` | Supported; development and automated-test runtime | The repository's own test suite and native development cohort run on it. |
49
+ | `0.2.1-rc.2` | Supported; accepted in an **isolated** profile | Prior acceptance run in a temporary `DSH_HOME`; not the operator's production profile. |
50
+ | `0.2.1-rc.3` | Supported; previous host runtime | Declared by the previous host build. This build was **not** independently native-boot verified on `0.2.1-rc.3` during this task, so no full-profile check is claimed for it. |
51
+ | `0.2.2-rc.1` | Supported; the newest runtime this build adds | Native sources audited (`.cache/compat-022-20261107/reference-022`); native base+web bootstrap verified in isolated fixtures (`.cache/native022-host-*`). |
52
+
53
+ Additional rules:
54
+
55
+ - **DSH checks these ranges with prereleases included.** `@deepseek-ai/dsh-*` peer
56
+ ranges are matched with `semver` plus `includePrerelease`, so an exact prerelease
57
+ string is required; a caret or tilde would admit builds that were never exercised.
58
+ - **No version was dropped.** Every release admitted before this one is still admitted,
59
+ and the automated tests assert that the manifest, both lockfiles and the table above
60
+ agree with each other.
61
+ - **Any other DSH version is unverified.** Do not assume it works; the loader will
62
+ refuse a plugin whose peer range does not match.
63
+ - **Older *plugin* builds are refused by the native gate.** The gate is checked against
64
+ the plugin's declared ranges, so an older build (`0.1.11` and anything before it) that
65
+ does not declare `0.2.2-rc.1` is *skipped* by a `0.2.2-rc.1` host
66
+ (`skippedBundles` / a denied row) rather than loaded with unknown behaviour. Getting
67
+ this build's behaviour on `0.2.2-rc.1` requires upgrading the plugin, not relaxing the
68
+ gate.
69
+ - **Node.js `>= 24`** is required (`engines.node`), matching the DSH runtimes above.
70
+
71
+ ## 2. What DSH 0.2.2 changes
72
+
73
+ Two native changes matter to this plugin. Both are described here as *what the runtime
74
+ provides*; the runtime-facing implementation lives in `src/runtime/` and is reviewed
75
+ separately from this note.
76
+
77
+ ### 2.1 Durable agent model selection
78
+
79
+ DSH `0.2.2` gives each agent an explicit model-selection surface
80
+ (`@deepseek-ai/dsh-agent`, `lib/types/model-selection.js`):
81
+
82
+ | Member | Behaviour |
83
+ | --- | --- |
84
+ | `agent.model.select({ provider, model, reasoningEffort? })` | Appends a durable `model/selection` Session event. An unchanged selection is a no-op, so a repeated run does not grow the thread. |
85
+ | `agent.model.current()` | Returns the recorded selection (`pending ?? lastUsed` from the `modelSelection` projection, `stateVersion: 3`), falling back to the agent's own `options` until one is recorded, and `undefined` when neither states a route. |
86
+
87
+ The selection is *recorded state*, not a request argument. The agent loop fixes the
88
+ step's route from `agent.model.current()` before step preparation and then rejects an
89
+ `agent/request` that proposes a different provider, model or reasoning effort:
90
+
91
+ ```
92
+ use agent.model.select() before step preparation
93
+ ```
94
+
95
+ Two consequences the plugin has to respect:
96
+
97
+ - **Selection must be recorded before the prompt drives a step**, and the value that
98
+ ends up in use is the one the runtime *records* — not the one the caller passed. A
99
+ run that cannot read the recorded selection back cannot claim which route executed.
100
+ - **`reasoningEffort` is independently optional.** Omitting it means "adapter
101
+ default", which is a distinct value from any concrete effort, so a selection that
102
+ omits it must not be reported as a concrete effort.
103
+
104
+ ### 2.2 Asynchronous native policy initialization
105
+
106
+ The two services this plugin's worker contract depends on are initialized
107
+ asynchronously in `0.2.2`:
108
+
109
+ - `ctx.sandboxPolicy` registers its `sandbox/mode` Session projection during service
110
+ initialization and only then answers `resolve({ session })`;
111
+ - `ctx.approval` registers its `approval/policy` projection and only then answers
112
+ `effectivePolicy(session)` / `decide(request, session)`.
113
+
114
+ A plugin that reads either service during *activation* therefore observes a service
115
+ that exists but is not yet able to answer. The contract is unchanged in kind — the
116
+ policy is still written and then read back through the native services — but the
117
+ read-back is per run, and a run whose services cannot answer is a fail-closed refusal
118
+ rather than a silent pass.
119
+
120
+ ## 3. How the plugin adapts
121
+
122
+ The plugin supports both runtime generations from one build. It does **not** branch on
123
+ a version string; it branches on the **capabilities it can observe on the live agent and
124
+ services**, so a feature is used only when it is actually present.
125
+
126
+ | Capability | Modern (`0.2.2-rc.1`) path | Legacy (`0.2.0`–`0.2.1`) path |
127
+ | --- | --- | --- |
128
+ | Model selection | `agent.model.select(...)` before the prompt, then `agent.model.current()` read back and compared with the requested provider/model/effort. | `installModelSelection(agentCtx, ref)` applies the selection through the agent context on **every** run, including a resumed agent — it is not a creation option that is captured once at agent creation. That generation has no native model readback, so the plugin reports the route it requested and labels it as requested, not read back. |
129
+ | Policy read-back | `ctx.sandboxPolicy.resolve({ session })` and `ctx.approval.effectivePolicy(session)`, read per run after the services finish initializing. | The same two services, read the same way; the projection registration ordering differs, so the read is what proves the fold happened. |
130
+ | Per-call permission answerer | `ctx.on('approval/request', …)` on the run's own Agent scope, answered from the bridge; `ApprovalService.decide()` dispatches that waterfall after the session policy check. | The same waterfall and the same name; the legacy service reads the policy from the log instead of a projection, which does not change what the listener receives. |
131
+ | Missing capability | Fail closed: the worker run does not start. | Fail closed: identical refusal. |
132
+
133
+ Rules that hold in **both** paths:
134
+
135
+ - The policy is written once per run (including `continueFromTaskId` follow-ups) and
136
+ then read back. A missing service, a refused read, or a read-back that disagrees with
137
+ what was written is `RUN_SANDBOX_POLICY_UNAVAILABLE`, raised **before** the prompt.
138
+ - A model selection whose read-back cannot be obtained is a strict failure **before the
139
+ prompt**, not a run under an unstated route. The plugin never reports a route it did
140
+ not read back as "verified", and never claims a concrete reasoning effort for a
141
+ selection that omitted one.
142
+ - The **modern model-selection adapter applies to the optional reviewer as well**: the
143
+ review agent picks its own provider, model and effort through the same durable
144
+ selection surface. What is worker-only is the **sandbox policy and the per-call
145
+ permission bridge** — the reviewer is read-only, gets no bridge, and the worker's
146
+ `workspace-write` / `never`/`ask` contract is not applied to it.
147
+ "The policy and the bridge do not apply to review" is a statement about permissions,
148
+ not about model selection.
149
+ - The approval stance is `ask` **only** for a run whose armed bridge is bound to the
150
+ Agent it drives; every other run keeps `never`. Both stances are read back through
151
+ `ctx.approval.effectivePolicy(session)` on both runtime generations, so an `ask`
152
+ nobody services is never installed.
153
+
154
+ ## 4. What *was* verified on `0.2.2-rc.1`, and what is not claimed
155
+
156
+ **Verified natively (host-run fixtures, not the production Desktop profile).** The full
157
+ `0.2.2-rc.1` base + web + delegate profile loads with no skipped bundles; a real stdio MCP
158
+ `initialize` returns that build's version with six tools and discovers the endpoint; `delegate_status`
159
+ works and an `OFF` submit is refused with `DELEGATION_DISABLED`; the real native
160
+ Workspace/Session controllers, Agent and AgentModel were used; the runner selected and
161
+ read back its route and effort before prompt delivery, a follow-up reused the native
162
+ session and changed both, and a deliberately wrong readback was refused before the prompt;
163
+ the native create/setup runner path also passed; the policy read back `workspace-write` /
164
+ `never`, and an escalation inside a valid turn was rejected in under a millisecond. Prompt
165
+ delivery was intercepted inside the disposable fixture, so these checks establish the
166
+ **contract**, not a delegated execution.
167
+
168
+ Earlier `SessionSeq` / `surfaceOp` failures recorded in intermediate runs were **test-driver
169
+ mistakes**: the synthetic event driver omitted native event sequence and surface metadata.
170
+ They were fixed in the driver with no product code change and are **not open product bugs**.
171
+
172
+ What remains genuinely unverified:
173
+
174
+ - **No real provider call.** No model turn was executed anywhere in these checks; prompt
175
+ delivery was intercepted at the fixture boundary.
176
+ - **No actual sandbox command.** The policy was written and read back through the native
177
+ services, but no worker command was run under it — the temp-directory and
178
+ piped-stdio caveats below are properties of the native layer, not behaviours this task
179
+ exercised end to end.
180
+ - **No production DSH Desktop installation of this build.** The operator's formally
181
+ installed Desktop profile is still on `1.1.0`; installing `1.2.0` there and running a
182
+ real delegated turn on that upgraded profile has **not** been done. Nothing in this
183
+ repository establishes it, and no end-to-end acceptance of the upgraded Desktop profile
184
+ is claimed.
185
+ - **`0.2.1-rc.3` was not re-validated here.** It stays declared as supported, but this
186
+ task contains no independent native full-profile boot on that version.
187
+ - **Windows temporary-directory caveat.** DSH's own Windows sandbox layer admits the
188
+ platform temporary directory (`GetTempPathW`) in some configurations, and its ACL
189
+ helper keeps its locks under that same directory. That is a property of the native
190
+ platform, **not** a write permission this plugin grants, and it is not a statement
191
+ that a worker may write arbitrary temp paths. A temp parent inside the workspace is
192
+ refused by the native layer itself.
193
+ - **Piped-stdio child processes are refused in this repository's confined Windows
194
+ sandbox.** A check that spawns a Node child and captures its piped output hits
195
+ `EPERM` there. That is a boundary of that confinement, not a failure of the
196
+ compatibility work, and a skipped harness check is reported as skipped.
197
+
198
+ ## 5. Upgrading from an older plugin build
199
+
200
+ 1. Download `dsh-taskbridge-1.3.2.tgz` from the GitHub Release, or build the package locally (`npm pack`).
201
+ 2. Install it the way your surface requires: the Desktop **Plugins manager** for a
202
+ Desktop profile (npm/CLI operations on that profile are refused), or
203
+ `dsh plugin --profile <name> add ./dsh-taskbridge-1.3.2.tgz` for a CLI profile you
204
+ start yourself.
205
+ 3. The settings, the switch value and the task history are preserved
206
+ (`$DSH_HOME/data/dsh-delegate`); nothing is migrated destructively.
207
+ 4. If the Codex companion was installed, no action is needed: a `0.1.11` — or `0.1.10` —
208
+ agent file whose bytes still match a published template is refreshed automatically on
209
+ startup, or explicitly from the Codex panel. A file you edited is left untouched.
210
+ 5. To roll back, re-install the older `.tgz`. The data directory is not deleted, but an
211
+ older plugin build will be skipped by a `0.2.2-rc.1` host's native gate (section 1),
212
+ so rolling back the plugin means staying on an older DSH as well.
213
+
214
+ ## 6. Where this is enforced
215
+
216
+ | Claim | Enforced by |
217
+ | --- | --- |
218
+ | The exact runtime union in `engines.dsh` and every `@deepseek-ai/dsh-*` peer | `tests/package.test.js` ("the manifest keeps its identity…", "peer constraints declare exactly the verified DSH runtimes") |
219
+ | Both lockfiles' root metadata match `package.json` | `tests/package.test.js` ("the lockfile pins the same dependency set…") |
220
+ | This table matches the manifest, in both directions | `tests/package.test.js` ("the supported-version table is the one the manifest admits") |
221
+ | A published `0.1.11` or `0.1.10` agent is refreshed, an edited one is not | `tests/codex-integration.test.js` |
222
+
223
+
@@ -0,0 +1,191 @@
1
+ # 静默等待与集中审查(Silent waiting and concentrated host review)
2
+
3
+ 本页说明 DSH Delegate `1.1.0` 引入、并由 `1.2.0` 修正的行为:一个正常推进的任务**不再**让
4
+ 派工方(Codex)一遍遍醒来读结果;只有当出现真正需要判断的事情时,派工方才被打扰。
5
+
6
+ `1.2.0` 的修正集中在三处,读本页时请一并参照:等待被中断不等于执行被中断(第 4.1 节)、
7
+ 串行宿主下的独立控制通道(第 4.2 节)、已安装 Codex 集成的自动升级(第 8 节)。
8
+
9
+ 这不是"让 Codex 不花 token"的承诺。插件无法控制 Codex 自己的上下文、思考或工具调用
10
+ 开销,也不做省 token 的估算。这里只描述**任务状态的报告方式**改变了什么。
11
+
12
+ ---
13
+
14
+ ## 1. 默认间隔
15
+
16
+ | 设置 | 默认 | 范围 | 含义 |
17
+ | --- | --- | --- | --- |
18
+ | `monitoring.selfCheckSeconds` | 300 秒(5 分钟) | 30–3600 秒,整数 | 任务完全安静这么久之后,插件在本机做**一次**只读自检 |
19
+ | `monitoring.attentionSeconds` | 600 秒(10 分钟) | 31–7200 秒,整数,且必须大于自检间隔 | 仍然安静这么久之后,才把这件事报告给派工方 |
20
+
21
+ 保存在设置文档里的单位是**整秒**。设置页用"分钟"呈现,二者是同一个值
22
+ (5 分钟 = 300 秒)。一个不是整分钟的值(例如 90 秒)在页面上显示为 1.5 分钟,
23
+ 不会被悄悄圆成别的设置。
24
+
25
+ 这两个值都只能全局设置:项目覆盖和单任务覆盖都**不能**改动它们。
26
+
27
+ ## 2. 核心规则:安静 ≠ 失败
28
+
29
+ - 任务安静、某个测试跑得久、某个工具调用耗时很长,**都不会**让插件判定失败、
30
+ 取消任务或重启任务。
31
+ - 真正推进(模型输出、推理、工具调用、工具结果)会**重置**静默计时,属于内部事实,
32
+ 不会叫醒派工方。
33
+ - 只有"确实没有进展"**并且**超过提醒间隔之后,才会报告 `attention`。
34
+ - 提醒只是提问,不是判决。派工方默认应当继续等待同一个任务,除非有**具体**的错误。
35
+
36
+ 连接心跳、结果轮询、页面刷新这类噪声**不会**重置静默计时;否则一个真的卡住的执行器
37
+ 会永远看起来"很活跃"。
38
+
39
+ ## 3. 5 分钟自检做了什么、没做什么
40
+
41
+ 达到 `selfCheckSeconds` 时,插件对**自己已经持有的**任务记录做一次只读检查:
42
+
43
+ - 任务是否还活着、执行器是否已经结束;
44
+ - 当前阶段;
45
+ - 是否有一次工具调用在等待授权决定;
46
+ - 当前正在运行哪个工具、已经运行多久。
47
+
48
+ 它**不会**:
49
+
50
+ - 调用任何大模型(不消耗 token);
51
+ - 读取或分析整个代码差异、也不会读工作区文件内容;
52
+ - 改变任务状态、延长或缩短任务的时限;
53
+ - 重启、取消或重新提交任务。
54
+
55
+ 自检的结论会显示在任务详情里("无进展诊断"),例如"执行器健在,这段时间没有新输出"、
56
+ "某个工具调用仍在运行"、"正在等待本次调用授权决定"。
57
+
58
+ ## 4. 一次等待只返回一个结论
59
+
60
+ 派工方通过 `delegate_wait` 等待同一个任务。一次调用的默认截止是 **3600 秒(60 分钟)**,
61
+ 内部由若干次**各自不超过 25 秒**的有界观察组成(执行面自己的上限也是 25 秒);正常的
62
+ 任务在内部大约每 25 秒完成一次观察,安静的 20 分钟就是 48 次观察、47 次心跳,而派工方
63
+ **只收到 1 个答案**。答案里是一个原因:
64
+
65
+ | 原因 | 含义 | 派工方该做什么 |
66
+ | --- | --- | --- |
67
+ | `heartbeat` | 没什么要报告的(内部心跳) | 正常情况下看不到;看到了就继续等待同一任务 |
68
+ | `attention` | 超过提醒间隔没有进展 | 读诊断,**默认继续等待**;不要在只是安静时取消或判失败 |
69
+ | `permission` | 有一次工具调用在等授权决定 | 审查这一次调用的完整操作,然后决定一次,再继续等待同一任务 |
70
+ | `ready` | 执行结束,等待宿主审查 | 读**一次**完整证据,自己审查;这不等于已接受 |
71
+ | `failed` / `cancelled` | 运行没有产出 | 读一次记录的原因后报告 |
72
+ | `interrupted` | **任务记录本身**已中断(例如进程重启留下),不会继续 | 读一次记录后报告;不要继续盲等同一任务 |
73
+ | `wait-limit` | 本轮等待预算用完,任务仍在运行 | 立刻继续等待同一任务 |
74
+
75
+ `attention` 提醒有冷却:同一次静默里,第一次到达提醒间隔时报告一次;之后要再经过一个
76
+ 提醒间隔才会再报一次。真实推进会让计时重新开始。
77
+
78
+ ### 4.1 等待被中断 ≠ 执行被中断
79
+
80
+ 引擎会在**观察者自己的这次请求结束**时报告 `interrupted`(调用方取消、连接断开、引擎在
81
+ 重建时释放了等待者)。这时任务仍在运行。所以:
82
+
83
+ - `state` 是 `pending`/`running` 且 `endedAt` 为 `null` 时,这次中断只代表本次观察结束:
84
+ 答案立刻返回 `reason: "interrupted"`、`terminal: false`、真实任务状态,指令要求继续等同一
85
+ `taskId`。一次调用**不会**在内部重发观察:被释放的观察者会让每次观察都立刻返回
86
+ `interrupted`,重发就成了请求风暴。
87
+ - 只有任务记录本身是 `state: "interrupted"`(重启历史)才是不可恢复的终态:
88
+ `terminal: true`,并且指令明确要求停止盲等、读 `delegate_result`。
89
+ - 中断同时带着真实结局时按结局返回:`awaiting-host-review` → `ready`,`failed` → `failed`,
90
+ `cancelled` → `cancelled`,所以已完成的运行照样进审查。
91
+ - 状态缺失或未知(本构建不认识的状态字符串)时不做断言:`terminal: false`,指令要求先核对;
92
+ 既不宣称"已停止",也不宣称"仍在运行"。
93
+ - `metrics.interruptedObservations` 单独计数,不和心跳混在一起。
94
+
95
+ 任务记录页把真实的 `interrupted` 历史显示为「已中断(进程重启后不会继续执行)」,不会显示
96
+ 成"仍在运行"。
97
+
98
+ ## 4.2 串行宿主:独立控制通道
99
+
100
+ 插件自己的 stdio MCP 服务器本来就**支持并发**:一个长等待在飞时,status、cancel 照样能被
101
+ 回答。瓶颈在外层宿主——一次只转发一个工具调用的客户端会让整条连接被等待占住。
102
+
103
+ 插件**不承诺**改变宿主的调度器,也不把长等待退化成轮询。可用的是独立本地控制程序:
104
+
105
+ ```bash
106
+ node bin/dsh-delegate-control.js status <taskId> # 紧凑 JSON 状态(observe + 最小有界观察)
107
+ node bin/dsh-delegate-control.js cancel <taskId> # 只停止这一个任务
108
+ ```
109
+
110
+ - 与 MCP 服务器使用**同一个** `createExecutionClient` 与端点发现,调用现有 loopback 执行面;
111
+ 不新增权限、开关、配置接口,也没有常驻后台进程。
112
+ - 只有这两个动作:没有提交、设置、总开关、批量取消或默认放行。
113
+ - `status` 请求的是**最小有界观察**(`waitMs: 1`,引擎与监控都保留的最小正数),不是
114
+ `waitMs: 0`。`0` 在这两处都被理解成"调用方没指定上界",会被替换成 25 秒的默认长等待,
115
+ 反而让一次状态查询超出这条命令自己的预算。它仍然只回答**当前状态**:已结束的任务和待授权
116
+ 请求在任何定时器启动前就返回,仍在运行的任务只观察一个切片;永远不读完整结果、diff 或对话。
117
+ - **整次命令只有一份总预算**:默认 **10 秒**,`DSH_DELEGATE_CONTROL_TIMEOUT_MS` 只能把它**调小**
118
+ (填更大的值会被夹回 10 秒;缺省或不可用的 `timeoutMs` 也按 10 秒算)。这份预算通过调用方的
119
+ `AbortSignal` 生效,同时**对本次调用禁用观察重试**——否则 1 秒/2 秒/5 秒的退避会超出预算,
120
+ 或者在命令已经回答之后还留着请求在跑。没有 `Promise.race`,也不留后台请求或进程。
121
+ - 任何断线、超时都变成有界 JSON + 非零退出码(预算耗尽是 `CONTROL_TIMEOUT`),没有堆栈、没有秘密;
122
+ 退出码 `0` 有答案、`1` 被拒绝或超时、`2` 用法错误。
123
+ - 普通等待**不会周期性跑 status**:这个通道只在操作者或用例显式调用时才发起请求。
124
+ - 等待监听断开只释放观察,**取消永远是显式 `cancel`**。
125
+ - 工具目录补上了准确的 MCP `annotations`(例如 `readOnlyHint`),便于支持并发的客户端识别
126
+ 长等待是只读调用。注解不是修复,串行客户端照样忽略它。
127
+
128
+ ## 5. 等待授权不是卡住
129
+
130
+ 任务等待一次工具调用的授权决定时,仍然是 `running`,阶段是 `awaiting-permission`。
131
+ 它保留工作区锁和并发名额,并且:
132
+
133
+ - 这一段等待**不计入**执行超时(有单独的、固定的请求截止时间);
134
+ - 不会被报告成"长时间没进展";
135
+ - 授权决定只对**那一次调用**有效,不构成常规权限,也不会被后续调用复用。
136
+
137
+ ## 6. 集中审查:什么时候读证据
138
+
139
+ 插件不会把对话内容、推理过程或工具输出塞进状态报告。派工方在**执行结束之后**
140
+ 读一次完整证据(`delegate_result`),然后自己审查:
141
+
142
+ - 执行完成 ≠ 被接受。插件永远不自行验收;`selfApproved` 恒为 `false`,
143
+ `hostAcceptance` 由宿主自己记录。
144
+ - 大改动只挑相关的文件各看一次,不要反复重读同一份证据。
145
+
146
+ ## 7. 续接(跟进任务)
147
+
148
+ 同一个任务的修改、纠正或重试,用 `continueFromTaskId` 提交,并继续使用**同一个**
149
+ 已授权的源工作区路径。这样跟进任务会续接同一条 DSH 对话、落在同一棵工作树里。
150
+ 不相关的任务不要复用 id,也不要为了"保持上下文"而续接。
151
+
152
+ ## 8. 已有用户如何升级
153
+
154
+ 1. 在 DSH 的插件设置页打开 **Codex 集成**;
155
+ 2. 点 **安装 / 更新 Codex 集成**(按钮会把这个插件发布的旧版本文件更新到当前版本);
156
+ 3. 让 Codex 重新载入:新开会话或重启 Codex。
157
+
158
+ `1.2.0` 起,**入口脚本路径未变的已安装托管条目不再需要手工点按钮**:插件启动自检会检查已安装的
159
+ `mcp_servers.dsh-delegate` 条目,只要它带托管标记、command 是本包的 Node 命令、`args[0]`
160
+ **正好是本安装的** `dsh-delegate-mcp.js`,而且**已经过期**(缺少 `tool_timeout_sec`),就在原地补齐。
161
+ 入口脚本路径已经指向插件旧目录的条目,启动自检只会报告 `conflict`,不会替操作者改路径:请点
162
+ **安装 / 更新 Codex 集成** 或 **修复**,显式动作才会在证明该旧路径是同一包的**真实安装**
163
+ (真实目录 + `package.json` 的 `name` 与 `bin["dsh-delegate-mcp"]` 映射都对得上)之后采纳它。
164
+
165
+ 更新会为托管 MCP 条目补上 `tool_timeout_sec = 3660`。客户端可能不认这个字段,或用自己的默认
166
+ 工具超时提前结束等待(Codex 的历史默认是一分钟);3660 秒只是把托管条目请求的允许时长设为
167
+ 默认 3600 秒等待加一分钟余量,**不能**解除客户端自身的限制。这个字段只写在
168
+ **本插件自己的** `[mcp_servers.dsh-delegate]` 条目上:
169
+
170
+ - 旧版本写的、带托管标记的条目会被就地补齐,文件里其它内容原样保留;
171
+ - 没有托管标记的同名条目视为**你自己写的**,不会被改写、覆盖或删除;
172
+ - 值不是整数的条目同样视为别人的定义;
173
+ - 你自己编辑过的子智能体文件会被报告为"不属于已知版本",插件不会改动它;
174
+ - 启动自检**不会创建**条目:没安装就什么都不写;
175
+ - `$CODEX_HOME` 或 `agents/` 是链接(含 Windows junction)时一律拒绝,连条目状态都不再
176
+ 穿过链接去读;
177
+ - 写前重新读取并重新判定,期间发生变化(漂移)就拒绝,不覆盖。
178
+
179
+ ## 9. 已知限制
180
+
181
+ - 插件的监控只在**有人观察**时运行:没有派工方在等待时,它不启动定时器,也不消耗任何东西。
182
+ - 提醒阈值是安全网,不是进度条。插件**不**计算完成百分比,也**不**猜测还剩多久。
183
+ - 一次 `delegate_wait` 的默认等待是 3600 秒(上限也是 3600 秒),每次内部观察最多 25 秒;
184
+ 前者由工具本身约束,与 `tool_timeout_sec` 的关系是:后者必须比前者略大,才能让一整轮
185
+ 等待跑完。
186
+ - 等待被中断不等于执行被中断;`interrupted` / `wait-limit` 的 `terminal` 与 `state` 字段是
187
+ 判断依据,不要只看原因名字。
188
+ - 串行宿主下没有通用的“并发”承诺:插件传输支持并发,独立控制程序只提供 `status` 与
189
+ `cancel` 两个动作,也不能改变宿主的调度方式。
190
+ - 设置页的自动刷新只在"任务记录"标签页可见、且存在进行中的任务时运行;
191
+ 终端状态的任务不会触发刷新。
@@ -0,0 +1,28 @@
1
+ # 从 DSH Delegate/TaskDispatch 升级到 DSH TaskBridge
2
+
3
+ **1.3.1 起统一使用 DSH TaskBridge,包名为 `dsh-taskbridge`,GitHub 仓库为 `ranranyya/dsh-taskbridge`。** 1.3.0 的旧包名 `dsh-taskdispatch` 只在 GitHub 发布;npm 因其与已有包名过于相似而拒绝注册。此前的 `dsh-delegate` 同样不要与 npm 上他人的包混淆。
4
+
5
+ ## 升级步骤
6
+
7
+ 1. 等待当前任务结束,关闭旧插件的本机调用开关。
8
+ 2. 在 DSH 插件管理中停用并卸载本项目旧 `dsh-delegate` 或 `dsh-taskdispatch` 包。**保留 `<DSH_HOME>/data/dsh-delegate` 数据目录**;DSH 若提供删除数据选项,不要勾选。新旧包不能同时启用。
9
+ 3. 在“添加插件”中输入 **`dsh-taskbridge@1.3.2`**。中国大陆镜像未同步时改选 npm 官方源。也可安装本项目 Release 的 `dsh-taskbridge-1.3.2.tgz`,或添加本项目固定 Git 提交的自定义索引。不要手动修改 Desktop 保留的 profile。
10
+ 4. 打开 **DSH TaskBridge** 配置页,核对 API、模型、思考强度和总开关。数据目录与旧版相同;安装前关闭旧开关,避免恢复之前保存的开启状态。
11
+ 5. 在 Codex 集成中点击“安装 / 更新 TaskBridge 智能体”,更新智能体及 MCP,然后重新加载 Codex。未修改的旧 `dsh-delegate.toml` 会迁移为 `dsh-taskbridge.toml`;修改过的文件保留。只需修复 MCP 时可使用“仅修复 MCP 配置”。启动自检不会接管其他安装目录。
12
+ 6. 若添加过旧索引,改用 `https://ranranyya.github.io/dsh-taskbridge/index.json`。
13
+
14
+ ## 保持兼容的技术标识
15
+
16
+ - 数据与端点:`<DSH_HOME>/data/dsh-delegate`、`runtime-endpoint.json`。
17
+ - 环境变量:`DSH_DELEGATE_*`。
18
+ - MCP 工具:`delegate_status`、`delegate_preflight`、`delegate_submit`、`delegate_wait`、`delegate_result`、`delegate_cancel`、`delegate_permission_decide`。
19
+ - Codex MCP 条目:`mcp_servers.dsh-delegate`。智能体文件从 1.3.2 起改为 `agents/dsh-taskbridge.toml`,对外名称为 `dsh-taskbridge`。
20
+ - MCP/控制程序:`bin/dsh-delegate-mcp.js`、`bin/dsh-delegate-control.js`。
21
+
22
+ 保留的内部名称不会让安装指向其他 npm 项目。仍存在的旧包入口须证明真实文件、bin 映射及本项目仓库来源。1.3.2 的显式安装/修复也接受本插件目录旁已卸载的 `node_modules/dsh-delegate` 或 `dsh-taskdispatch` 标准入口,前提是原 MCP 配置带托管标记且结构符合插件规则。其他路径、自定义包装器和用户编辑过的智能体文件保留;启动自检不会接管搬家路径。
23
+
24
+ ## 版本差异
25
+
26
+ 1.2.0 完成静默等待中断语义、独立控制通道和既有 Codex 集成升级修复。1.3.0 增加中英文介绍、图标、更名兼容和自定义插件索引。1.3.1 统一为 TaskBridge 并增加 npm 安装渠道。1.3.2 将 Codex 智能体同步更名、新工作区按任务内容命名,并修复旧包卸载后的 MCP 路径迁移;不改变模型选择、等待、审批或审查流程。从 TaskBridge 1.3.1 升到 1.3.2 是同包小版本更新。
27
+
28
+ 更名是包身份迁移,不能称为对旧包的普通原地更新。隔离配置目录中的迁移测试不等于已经在真实 Desktop 完成卸载、安装和重启验收。
@@ -0,0 +1,25 @@
1
+ # 从 DSH Delegate 升级到 DSH TaskDispatch
2
+
3
+ > 这是 1.3.0 的历史说明。当前项目已统一为 **DSH TaskBridge**,请阅读 [1.3.1 升级说明](taskbridge-upgrade.md)。本文件保留旧链接兼容,不作为当前安装指南。
4
+
5
+ 1.3.0 的展示名为 **DSH TaskDispatch**,包名为 **dsh-taskdispatch**。旧包 `dsh-delegate` 与 npm 上他人的同名占位包不是同一个项目。当前发布信息以本仓库和正式 Release 为准。
6
+
7
+ ## 升级步骤
8
+
9
+ 1. 等待当前任务结束,关闭旧插件的本机调用开关,并备份希望保留的配置。
10
+ 2. 在 DSH 插件管理中停用并卸载本项目的旧 `dsh-delegate` 包。**保留 `<DSH_HOME>/data/dsh-delegate` 数据目录**;本项目没有提供删除该目录的迁移脚本。DSH 自身若提供“删除数据”选项,不要勾选。不要同时启用两个包。
11
+ 3. 从本项目 Release 安装 `dsh-taskdispatch-1.3.0.tgz`,或使用文档列出的固定 Git 提交索引安装。不要对 Desktop 保留的 profile 手动执行 npm/pnpm。
12
+ 4. 打开新插件配置页。设置、历史、运行端点路径仍使用原数据目录;检查 API、模型与思考强度后,按需要开启本机调用开关。旧数据若保存了开启状态,插件会恢复该值,安装前应先完成第 1 步。
13
+ 5. 在 Codex 集成中显式点击“安装 / 更新 Codex 集成”或“仅修复 MCP 配置”,把旧包入口迁移到新安装目录,再让 Codex 重新加载。启动自检不会擅自接管其他安装目录。
14
+
15
+ ## 保持兼容的技术标识
16
+
17
+ - 数据与端点:`<DSH_HOME>/data/dsh-delegate`、`runtime-endpoint.json`。
18
+ - 环境变量:`DSH_DELEGATE_*`。
19
+ - MCP 工具:`delegate_status`、`delegate_preflight`、`delegate_submit`、`delegate_wait`、`delegate_result`、`delegate_cancel`、`delegate_permission_decide`。
20
+ - Codex 文件和条目:`agents/dsh-delegate.toml`、`mcp_servers.dsh-delegate`。
21
+ - MCP/控制程序:`bin/dsh-delegate-mcp.js`、`bin/dsh-delegate-control.js`。
22
+
23
+ 保留这些名称是为了兼容,不会让安装源改指向别人的 npm 包。显式采纳旧入口需要真实的包目录、文件和正确 bin 映射,以及本项目新旧 GitHub 仓库来源;无法证明身份的旧入口、自定义包装器和用户编辑过的智能体文件都会被保留并报告冲突。
24
+
25
+ 更名属于包身份迁移,不能描述为对旧包的普通原地更新。迁移检查在隔离的临时配置目录进行;不能据此声称真实 Desktop 卸载、安装、重启已全部验收。