dsh-taskbridge 1.6.0 → 1.7.0

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 (66) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/README.md +41 -41
  3. package/THIRD_PARTY_NOTICES.txt +23 -0
  4. package/codex/dsh-taskbridge.toml +140 -71
  5. package/docs/INTRODUCTION.md +44 -22
  6. package/docs/INTRODUCTION.zh.md +32 -26
  7. package/docs/codex-integration.md +90 -10
  8. package/docs/contracts-stage-b.md +4 -4
  9. package/docs/conversation-placement.md +25 -7
  10. package/docs/plugin-market.md +1 -1
  11. package/docs/releases/1.7.0.zh.md +11 -0
  12. package/docs/runtime-compatibility.md +4 -11
  13. package/docs/silent-wait.md +69 -31
  14. package/docs/taskbridge-upgrade.md +1 -1
  15. package/docs/worker-permissions.md +4 -14
  16. package/docs/workspace-grouping.md +126 -0
  17. package/lib/client.d.ts +365 -3
  18. package/lib/client.js +260 -5
  19. package/locale/en.json +1 -1
  20. package/locale/zh.json +1 -1
  21. package/package.json +7 -19
  22. package/src/client/api.js +550 -90
  23. package/src/client/index.jsx +699 -307
  24. package/src/client/sidebar.jsx +6 -5
  25. package/src/client/styles.js +251 -0
  26. package/src/client/task-cleanup.js +304 -0
  27. package/src/client/task-records-table.jsx +217 -0
  28. package/src/client/task-view.js +226 -10
  29. package/src/client/workspace-groups.js +482 -0
  30. package/src/client/workspaces-browser.jsx +770 -0
  31. package/src/codex/agent-ownership.js +270 -0
  32. package/src/codex/installer.js +525 -35
  33. package/src/codex/seam.js +5 -0
  34. package/src/config/defaults.js +63 -17
  35. package/src/config/settings.js +60 -62
  36. package/src/config/validate.js +126 -71
  37. package/src/http/respond.js +8 -0
  38. package/src/http/user-plane.js +197 -2
  39. package/src/index.js +50 -42
  40. package/src/jobs/activity.js +968 -78
  41. package/src/jobs/engine.js +784 -230
  42. package/src/jobs/history.js +188 -12
  43. package/src/jobs/plan-store.js +5 -0
  44. package/src/jobs/record-cleanup.js +196 -0
  45. package/src/jobs/task-tree.js +5 -3
  46. package/src/jobs/title.js +129 -12
  47. package/src/mcp/server.js +16 -8
  48. package/src/mcp/wait.js +64 -5
  49. package/src/runtime/agent-runner.js +53 -15
  50. package/src/runtime/worker-prompt.js +53 -0
  51. package/src/workspace/locks.js +288 -167
  52. package/docs/releases/1.4.0-token-benchmark.zh.md +0 -40
  53. package/docs/releases/1.4.0.zh.md +0 -54
  54. package/docs/releases/1.4.1.zh.md +0 -59
  55. package/docs/releases/1.4.2.zh.md +0 -23
  56. package/docs/releases/1.5.0-token-benchmark.zh.md +0 -73
  57. package/docs/releases/1.5.0.zh.md +0 -51
  58. package/docs/releases/1.5.1.zh.md +0 -70
  59. package/docs/releases/1.5.2.zh.md +0 -30
  60. package/docs/releases/1.5.3-test.1.zh.md +0 -28
  61. package/docs/releases/1.5.3-test.2.zh.md +0 -24
  62. package/docs/releases/1.5.3.zh.md +0 -33
  63. package/docs/releases/1.5.4.zh.md +0 -25
  64. package/src/review/preset.js +0 -868
  65. package/src/review/prompts.js +0 -145
  66. package/src/review/reviewer.js +0 -933
@@ -1,167 +1,288 @@
1
- // Workspace coordination: mutual exclusion per workspace and an audit trail of
2
- // what a job actually changed on disk.
3
- //
4
- // Two guarantees, both enforced here rather than trusted from the agent:
5
- // 1. At most one job mutates a given workspace at a time. The lock is
6
- // in-process, nonce-fenced and lease-bounded, so a stuck job cannot hold it
7
- // forever and a stale release cannot free another job's lock.
8
- // 2. What a job changed is measured by reading git state before and after, not
9
- // by believing the agent's own summary.
10
-
11
- import { randomUUID } from 'node:crypto';
12
- import { realpath } from 'node:fs/promises';
13
- import { resolve, sep } from 'node:path';
14
-
15
- /** Lock refusal codes. */
16
- export const LOCK_CODES = Object.freeze({
17
- busy: 'WORKSPACE_BUSY',
18
- invalid: 'WORKSPACE_INVALID',
19
- });
20
-
21
- /** An operation refused because the workspace is unavailable for it. */
22
- export class WorkspaceError extends Error {
23
- /**
24
- * @param {string} code - stable machine code.
25
- * @param {string} message - human-readable explanation.
26
- * @param {object} [details] - bounded details.
27
- */
28
- constructor(code, message, details = {}) {
29
- super(message);
30
- this.name = 'WorkspaceError';
31
- this.code = code;
32
- this.details = details;
33
- }
34
- }
35
-
36
- /**
37
- * Resolve a workspace path to its real absolute path.
38
- *
39
- * Refuses rather than guesses: a path that does not resolve is a refusal, and
40
- * the resolved value is what later boundary checks compare against so a symlink
41
- * cannot be used to escape the workspace.
42
- * @param {string} candidate - absolute workspace path.
43
- * @returns {Promise<string>} resolved real path.
44
- */
45
- export async function resolveWorkspacePath(candidate) {
46
- if (typeof candidate !== 'string' || candidate.trim() === '') {
47
- throw new WorkspaceError(LOCK_CODES.invalid, 'a workspace path is required', {});
48
- }
49
- const absolute = candidate.trim();
50
- if (!(absolute.startsWith('/') || /^[A-Za-z]:[\\/]/.test(absolute) || absolute.startsWith('\\\\'))) {
51
- throw new WorkspaceError(LOCK_CODES.invalid, 'workspace path must be absolute', {});
52
- }
53
- try {
54
- return await realpath(resolve(absolute));
55
- } catch (error) {
56
- throw new WorkspaceError(LOCK_CODES.invalid, 'workspace path could not be resolved', {
57
- cause: error?.code ?? null,
58
- });
59
- }
60
- }
61
-
62
- /**
63
- * Whether `target` is inside `root`. Case-folded on Windows where paths are
64
- * compared case-insensitively.
65
- * @param {string} root - resolved workspace root.
66
- * @param {string} target - resolved candidate path.
67
- * @returns {boolean} true when contained (or equal).
68
- */
69
- export function isInside(root, target) {
70
- const normalize = (value) => (process.platform === 'win32' ? value.toLowerCase() : value);
71
- const base = normalize(root).replace(/[\\/]+$/, '');
72
- const candidate = normalize(target);
73
- if (candidate === base) return true;
74
- const withSep = base.endsWith(sep) ? base : `${base}${sep}`;
75
- return candidate.startsWith(withSep);
76
- }
77
-
78
- /**
79
- * In-process workspace lock registry.
80
- *
81
- * The lock is not a file: two DSH processes would still be able to race. That
82
- * limitation is documented in docs/native-integration-audit.md rather than
83
- * papered over with a lockfile that looks stronger than it is.
84
- */
85
- export class WorkspaceLocks {
86
- /**
87
- * @param {object} [options] - `now` clock override and `maxHoldMs` lease.
88
- */
89
- constructor(options = {}) {
90
- this.now = options.now ?? (() => Date.now());
91
- this.maxHoldMs = options.maxHoldMs ?? 150 * 60 * 1000;
92
- /** @type {Map<string, object>} */
93
- this.held = new Map();
94
- }
95
-
96
- /**
97
- * Acquire the lock for a workspace without waiting.
98
- * @param {string} workspacePath - resolved absolute workspace path.
99
- * @param {object} input - `taskId` and optional `sessionId` for diagnostics.
100
- * @returns {object} the lease, including its nonce.
101
- */
102
- acquire(workspacePath, input = {}) {
103
- const key = lockKey(workspacePath);
104
- const existing = this.held.get(key);
105
- if (existing !== undefined && this.now() < existing.expiresAt) {
106
- throw new WorkspaceError(LOCK_CODES.busy, 'another job is already running in this workspace', {
107
- taskId: existing.taskId,
108
- since: existing.acquiredAt,
109
- });
110
- }
111
- const lease = {
112
- nonce: randomUUID(),
113
- workspacePath,
114
- taskId: typeof input.taskId === 'string' ? input.taskId : null,
115
- acquiredAt: this.now(),
116
- expiresAt: this.now() + this.maxHoldMs,
117
- };
118
- this.held.set(key, lease);
119
- return { ...lease };
120
- }
121
-
122
- /**
123
- * Release a lease. A release with the wrong nonce is a no-op, so one job can
124
- * never release another job's lock.
125
- * @param {string} workspacePath - locked workspace.
126
- * @param {string} nonce - lease nonce returned by {@link acquire}.
127
- * @returns {boolean} true when this call actually released the lock.
128
- */
129
- release(workspacePath, nonce) {
130
- const key = lockKey(workspacePath);
131
- const existing = this.held.get(key);
132
- if (existing === undefined || existing.nonce !== nonce) return false;
133
- this.held.delete(key);
134
- return true;
135
- }
136
-
137
- /**
138
- * Whether a workspace is currently locked by a live lease.
139
- * @param {string} workspacePath - workspace to test.
140
- * @returns {boolean} true when locked.
141
- */
142
- isLocked(workspacePath) {
143
- const existing = this.held.get(lockKey(workspacePath));
144
- if (existing === undefined) return false;
145
- if (this.now() >= existing.expiresAt) {
146
- this.held.delete(lockKey(workspacePath));
147
- return false;
148
- }
149
- return true;
150
- }
151
-
152
- /**
153
- * Drop every lease. Used on dispose: a shutdown must not leave a workspace
154
- * unacquirable in the next process.
155
- * @returns {number} number of leases dropped.
156
- */
157
- releaseAll() {
158
- const count = this.held.size;
159
- this.held.clear();
160
- return count;
161
- }
162
- }
163
-
164
- function lockKey(workspacePath) {
165
- const normalized = String(workspacePath).replace(/[\\/]+$/, '');
166
- return process.platform === 'win32' ? normalized.toLowerCase() : normalized;
167
- }
1
+ // Workspace coordination: mutual exclusion per workspace and an audit trail of
2
+ // what a job actually changed on disk.
3
+ //
4
+ // Two guarantees, both enforced here rather than trusted from the agent:
5
+ // 1. At most one job mutates a given workspace at a time. The lock is
6
+ // in-process, nonce-fenced and lease-bounded, so a stuck job cannot hold it
7
+ // forever and a stale release cannot free another job's lock.
8
+ // An exception to "at most one": a *shared* preparation hold may be taken by
9
+ // any number of jobs at once, while any exclusive hold on the same path
10
+ // refuses it and is refused by it. That is what lets two isolated runs of one
11
+ // source directory prepare their Git trees one at a time without the whole
12
+ // run having to be serialised (see {@link WorkspaceLocks#acquire}).
13
+ // 2. What a job changed is measured by reading git state before and after, not
14
+ // by believing the agent's own summary.
15
+
16
+ import { randomUUID } from 'node:crypto';
17
+ import { realpath } from 'node:fs/promises';
18
+ import { resolve, sep } from 'node:path';
19
+
20
+ /** Lock refusal codes. */
21
+ export const LOCK_CODES = Object.freeze({
22
+ busy: 'WORKSPACE_BUSY',
23
+ invalid: 'WORKSPACE_INVALID',
24
+ });
25
+
26
+ /** An operation refused because the workspace is unavailable for it. */
27
+ export class WorkspaceError extends Error {
28
+ /**
29
+ * @param {string} code - stable machine code.
30
+ * @param {string} message - human-readable explanation.
31
+ * @param {object} [details] - bounded details.
32
+ */
33
+ constructor(code, message, details = {}) {
34
+ super(message);
35
+ this.name = 'WorkspaceError';
36
+ this.code = code;
37
+ this.details = details;
38
+ }
39
+ }
40
+
41
+ /**
42
+ * Resolve a workspace path to its real absolute path.
43
+ *
44
+ * Refuses rather than guesses: a path that does not resolve is a refusal, and
45
+ * the resolved value is what later boundary checks compare against so a symlink
46
+ * cannot be used to escape the workspace.
47
+ * @param {string} candidate - absolute workspace path.
48
+ * @returns {Promise<string>} resolved real path.
49
+ */
50
+ export async function resolveWorkspacePath(candidate) {
51
+ if (typeof candidate !== 'string' || candidate.trim() === '') {
52
+ throw new WorkspaceError(LOCK_CODES.invalid, 'a workspace path is required', {});
53
+ }
54
+ const absolute = candidate.trim();
55
+ if (!(absolute.startsWith('/') || /^[A-Za-z]:[\\/]/.test(absolute) || absolute.startsWith('\\\\'))) {
56
+ throw new WorkspaceError(LOCK_CODES.invalid, 'workspace path must be absolute', {});
57
+ }
58
+ try {
59
+ return await realpath(resolve(absolute));
60
+ } catch (error) {
61
+ throw new WorkspaceError(LOCK_CODES.invalid, 'workspace path could not be resolved', {
62
+ cause: error?.code ?? null,
63
+ });
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Whether `target` is inside `root`. Case-folded on Windows where paths are
69
+ * compared case-insensitively.
70
+ * @param {string} root - resolved workspace root.
71
+ * @param {string} target - resolved candidate path.
72
+ * @returns {boolean} true when contained (or equal).
73
+ */
74
+ export function isInside(root, target) {
75
+ const normalize = (value) => (process.platform === 'win32' ? value.toLowerCase() : value);
76
+ const base = normalize(root).replace(/[\\/]+$/, '');
77
+ const candidate = normalize(target);
78
+ if (candidate === base) return true;
79
+ const withSep = base.endsWith(sep) ? base : `${base}${sep}`;
80
+ return candidate.startsWith(withSep);
81
+ }
82
+
83
+ /** The two lease modes {@link WorkspaceLocks} keeps. */
84
+ export const LOCK_MODES = Object.freeze({
85
+ // The whole path belongs to one job for as long as the lease lives.
86
+ exclusive: 'exclusive',
87
+ // A short, SHARED hold for work done on behalf of a run but not inside its own
88
+ // workspace: creating a Git worktree, reading the pinned commit, removing a
89
+ // half-created tree. Several runs of one source may prepare at once; a run that
90
+ // actually writes to the source holds it exclusively and excludes them.
91
+ preparation: 'preparation',
92
+ });
93
+
94
+ /**
95
+ * In-process workspace lock registry.
96
+ *
97
+ * The lock is not a file: two DSH processes would still be able to race. That
98
+ * limitation is documented in docs/native-integration-audit.md rather than
99
+ * papered over with a lockfile that looks stronger than it is.
100
+ *
101
+ * Leases are kept per path as a set, each lease carrying its own mode, so one
102
+ * path can be held exclusively by one job while another job only prepared it:
103
+ *
104
+ * - **exclusive** (the default) — nothing else may hold the path, in any mode.
105
+ * - **preparation** — several preparations may share the path, and none of them
106
+ * excludes the others; an exclusive lease refuses them and is refused by
107
+ * them.
108
+ *
109
+ * Why the second mode exists: two isolated runs of the SAME source repository are
110
+ * separate checkouts, but the Git worktree-creation step touches the source's
111
+ * administrative area and reads its status. Holding the source exclusively for
112
+ * the whole run therefore refused the second isolated job with
113
+ * `WORKSPACE_BUSY` even though the two runs never write to one file in common.
114
+ * The preparation hold keeps that step serialised without serialising the runs.
115
+ *
116
+ * The mode belongs to the LEASE, not to the path, so a task can hold a
117
+ * preparation lease, release it, and later hold the same path exclusively — and a
118
+ * release names the nonce it holds, so it can never free a sibling's lease.
119
+ */
120
+ export class WorkspaceLocks {
121
+ /**
122
+ * @param {object} [options] - `now` clock override and `maxHoldMs` lease.
123
+ */
124
+ constructor(options = {}) {
125
+ this.now = options.now ?? (() => Date.now());
126
+ this.maxHoldMs = options.maxHoldMs ?? 150 * 60 * 1000;
127
+ /** @type {Map<string, Map<string, object>>} path key -> own leases by nonce. */
128
+ this.held = new Map();
129
+ }
130
+
131
+ /**
132
+ * Acquire a lease for a workspace without waiting.
133
+ *
134
+ * Synchronous, and the decision and the claim happen in one step: a refusal and
135
+ * a claim can never both observe the same free path. Ordering among waiting
136
+ * callers (the engine's preparation queue) is the caller's business; waiting
137
+ * here would make one hung caller able to block the registry.
138
+ * @param {string} workspacePath - resolved absolute workspace path.
139
+ * @param {object} [input] - `taskId` for diagnostics, `mode`:
140
+ * {@link LOCK_MODES.exclusive} (default) or {@link LOCK_MODES.preparation}, and
141
+ * `explicitRelease: true` for a lease that is returned ONLY by
142
+ * {@link release} — see {@link LOCK_MODES.exclusive} usage in the engine.
143
+ * @returns {object} the lease, including its nonce and mode.
144
+ */
145
+ acquire(workspacePath, input = {}) {
146
+ const key = lockKey(workspacePath);
147
+ this.sweepKey(key);
148
+ const mode = normalizeMode(input.mode);
149
+ const explicit = input.explicitRelease === true;
150
+ const existing = this.held.get(key);
151
+ const live = existing === undefined ? [] : [...existing.values()];
152
+ const blocker = live.find((lease) => lease.mode === LOCK_MODES.exclusive || mode === LOCK_MODES.exclusive);
153
+ if (blocker !== undefined) {
154
+ const shared = live.filter((lease) => lease.mode === LOCK_MODES.preparation).length;
155
+ throw new WorkspaceError(
156
+ LOCK_CODES.busy,
157
+ blocker.mode === LOCK_MODES.exclusive && mode === LOCK_MODES.preparation
158
+ ? 'another job is running in this workspace, so it cannot be prepared for another run'
159
+ : 'another job is already running in this workspace',
160
+ {
161
+ taskId: blocker.taskId,
162
+ since: blocker.acquiredAt,
163
+ // Which lease refused, and in which mode: a caller can tell "one run holds
164
+ // the directory" from "another run is only preparing it".
165
+ mode: blocker.mode,
166
+ requestedMode: mode,
167
+ preparations: shared,
168
+ },
169
+ );
170
+ }
171
+ const lease = {
172
+ nonce: randomUUID(),
173
+ workspacePath,
174
+ mode,
175
+ taskId: typeof input.taskId === 'string' ? input.taskId : null,
176
+ acquiredAt: this.now(),
177
+ // An explicitly released lease has NO expiry: it belongs to an execution that
178
+ // can legitimately run for hours (a delegated run normally has no total time
179
+ // limit), and expiring it would hand the directory to a second writer while the
180
+ // first one is still working. Such a lease is returned by {@link release} and by
181
+ // nothing else; {@link releaseAll} on dispose covers the teardown case.
182
+ expiresAt: explicit ? Infinity : this.now() + this.maxHoldMs,
183
+ explicitRelease: explicit,
184
+ };
185
+ if (existing === undefined) this.held.set(key, new Map([[lease.nonce, lease]]));
186
+ else existing.set(lease.nonce, lease);
187
+ return { ...lease };
188
+ }
189
+
190
+ /**
191
+ * Release a lease. A release with the wrong nonce is a no-op, so one job can
192
+ * never release another job's lock — including a sibling's shared preparation
193
+ * lease on the same path.
194
+ * @param {string} workspacePath - locked workspace.
195
+ * @param {string} nonce - lease nonce returned by {@link acquire}.
196
+ * @returns {boolean} true when this call actually released the lock.
197
+ */
198
+ release(workspacePath, nonce) {
199
+ const key = lockKey(workspacePath);
200
+ const existing = this.held.get(key);
201
+ if (existing === undefined) return false;
202
+ const released = existing.delete(nonce);
203
+ if (existing.size === 0) this.held.delete(key);
204
+ return released;
205
+ }
206
+
207
+ /**
208
+ * Whether a workspace is currently locked by a live lease.
209
+ * @param {string} workspacePath - workspace to test.
210
+ * @param {object} [options] - `mode` narrows the question to leases of that mode.
211
+ * @returns {boolean} true when locked.
212
+ */
213
+ isLocked(workspacePath, options = {}) {
214
+ const key = lockKey(workspacePath);
215
+ this.sweepKey(key);
216
+ const live = this.held.get(key);
217
+ if (live === undefined) return false;
218
+ const mode = typeof options.mode === 'string' ? normalizeMode(options.mode) : null;
219
+ for (const lease of live.values()) {
220
+ if (mode === null || lease.mode === mode) return true;
221
+ }
222
+ return false;
223
+ }
224
+
225
+ /**
226
+ * Describe the live leases on one path, for diagnostics and tests. Names and
227
+ * modes only: no content, no actor identity.
228
+ * @param {string} workspacePath - workspace to describe.
229
+ * @returns {object[]} live leases, oldest first.
230
+ */
231
+ describe(workspacePath) {
232
+ const key = lockKey(workspacePath);
233
+ this.sweepKey(key);
234
+ const live = this.held.get(key);
235
+ if (live === undefined) return [];
236
+ return [...live.values()]
237
+ .sort((a, b) => a.acquiredAt - b.acquiredAt)
238
+ .map((lease) => ({ mode: lease.mode, taskId: lease.taskId, acquiredAt: lease.acquiredAt }));
239
+ }
240
+
241
+ /**
242
+ * Drop every lease. Used on dispose: a shutdown must not leave a workspace
243
+ * unacquirable in the next process.
244
+ * @returns {number} number of leases dropped.
245
+ */
246
+ releaseAll() {
247
+ let count = 0;
248
+ for (const live of this.held.values()) count += live.size;
249
+ this.held.clear();
250
+ return count;
251
+ }
252
+
253
+ /**
254
+ * Drop live leases whose bound expired, so an abandoned preparation cannot keep
255
+ * a source directory unacquirable for the rest of the process's life.
256
+ *
257
+ * A lease acquired with `explicitRelease: true` has no bound and is never swept
258
+ * here: it belongs to a run that is still working, and expiring it would let a
259
+ * second job into a directory the first one is writing to.
260
+ * @param {string} key - normalized path key.
261
+ * @returns {void}
262
+ */
263
+ sweepKey(key) {
264
+ const live = this.held.get(key);
265
+ if (live === undefined) return;
266
+ const now = this.now();
267
+ for (const [nonce, lease] of live) {
268
+ if (lease.explicitRelease === true) continue;
269
+ if (now >= lease.expiresAt) live.delete(nonce);
270
+ }
271
+ if (live.size === 0) this.held.delete(key);
272
+ }
273
+ }
274
+
275
+ /**
276
+ * Normalize a requested lease mode. Anything unrecognized is the exclusive mode:
277
+ * an unknown value must never be read as the weaker guarantee.
278
+ * @param {unknown} mode - requested mode.
279
+ * @returns {string} one of {@link LOCK_MODES}.
280
+ */
281
+ function normalizeMode(mode) {
282
+ return mode === LOCK_MODES.preparation ? LOCK_MODES.preparation : LOCK_MODES.exclusive;
283
+ }
284
+
285
+ function lockKey(workspacePath) {
286
+ const normalized = String(workspacePath).replace(/[\\/]+$/, '');
287
+ return process.platform === 'win32' ? normalized.toLowerCase() : normalized;
288
+ }
@@ -1,40 +0,0 @@
1
- # 1.4.0 等待阶段 token 对照报告
2
-
3
- 测量日期:2026-11-13。目的:验证外层短续等改成长等待后,当前 Codex 等待流程是否减少模型响应及其伴随 token。报告与发布结论由指挥端 Codex 撰写。
4
-
5
- ## 方法
6
-
7
- 两组在同一聊天中顺序运行,模型均为 `gpt-6.1-sol`。两组运行同一个 `scripts/verify-silent-wait.mjs --duration-seconds 45 --activity-seconds 5`,使用生产 `TaskMonitor` 与 `waitForTask`、真实墙钟和当前外层工具通道。执行活动由程序每 5 秒模拟,不调用 DSH 提供方模型,不改变安装设置。
8
-
9
- - 短续等组:外层选择短 yield,返回仍运行的单元后,由 GPT 两次续接同一单元。
10
- - 长等待组:外层允许等待 120 秒,程序保持同一次调用直到约 45 秒的任务交付。
11
- - 只统计发出实验等待或续等工具调用的 GPT 响应;前期规划、程序审查、报告撰写及最终交付审查不混入本表。
12
- - 从本机 `token_usage_record` 读取单次 `usage`,按 `response_id` 去重;不累加累计 `thread_token_usage`,缓存输入是输入的子集,推理 token 不重复加到总量。
13
-
14
- ## 实测结果
15
-
16
- | 项目 | 短续等组 | 长等待组 | 减少比例 |
17
- |---|---:|---:|---:|
18
- | 等待程序实际时长 | 44,165 ms | 44,175 ms | 同时长对照 |
19
- | GPT 响应数 | 3 | 1 | 66.67% |
20
- | 外层中途交回 | 2 | 0 | 100% |
21
- | 输入 token | 507,408 | 169,443 | 66.61% |
22
- | 其中缓存输入 | 506,651 | 169,320 | 66.58% |
23
- | 非缓存输入 | 757 | 123 | 83.75% |
24
- | 输出 token | 477 | 291 | 38.99% |
25
- | 输入+输出 | 507,885 | 169,734 | **66.58%** |
26
- | 序列化工具返回字节 | 530 | 394 | 25.66% |
27
-
28
- 两组等待程序均以 `ready` 返回,检查通过,均只产生一个任务业务结局。短续等组额外两次模型响应来自外层交回后的续接,不来自执行任务的需要判断事件。
29
-
30
- ## 如何理解
31
-
32
- 这次样本说明:当前客户端把正常执行包在一次长等待内,确实能省去中间续等的模型回合。本次减少主要来自不重复携带整段上下文;输入大部分已命中缓存,因此 **66.58% 不是费用或额度扣减比例**。
33
-
34
- 本实验只有每组一次,顺序固定,后组上下文会略增长,没有置信区间,也没有控制冷缓存差异。它验证等待机制,不能推出所有任务或完整开发成本固定减少同样百分比,更不能把 45 秒结果直接外推成 20 分钟实测费用。
35
-
36
- 过去骑砍任务的内容、上下文和执行结果不一致;它们用于定位短等待和重复读取问题,不作为本版因果节省率。本次将短时 token 对照与先前 20 分钟零中途唤醒的等待验收分开记录。
37
-
38
- ## 复核
39
-
40
- 本轮本地证据包含 `1.4.0-token-wait-benchmark.json`、`measure_wait_tokens.py` 及两份等待探针日志;保留逐响应用量和工具调用定位,不复制完整对话、执行者思考或凭据。正式 Release 提供脱敏的汇总 JSON 与探针日志;核算方式是 `(短组总量 - 长组总量) / 短组总量`。
@@ -1,54 +0,0 @@
1
- # DSH TaskBridge 1.4.0 更新说明
2
-
3
- 让 Claude Code 或 Codex 指挥 DSH 工作,在 DSH 插件中选择 API、执行模型和思考强度。1.4.0 重点改进静默等待、重复失败提醒和交付审查状态。
4
-
5
- ## 执行期间由程序观察,指挥端按需介入
6
-
7
- - 正常派工后使用 `delegate_wait({ taskId })`,省略短 `waitSeconds`。程序在内部持续观察,不把每次心跳交给 GPT,也不反复搬运中间对话和代码差异。
8
- - Codex 集成规则明确要求使用客户端支持的长等待;外层提前交回仍在运行的执行单元时,续接同一个单元,不重新派工、不另开等待、不把等待中断当作任务失败。
9
- - 原有无活动监控保持默认 5/10 分钟:连续无新活动 5 分钟由程序自检,10 分钟才交给指挥端判断;真实输出、思考流和工具事件重新计时,连接心跳及页面刷新不重置计时。
10
- - 权限申请、交付、失败、取消和中断及时返回。正常执行期间集中等待,交付后集中审查;修改意见通过 `continueFromTaskId` 续接原任务对话和执行工作区。
11
- - 修正执行阶段显示:实际执行尚未开始时不提前显示执行中;失败后不保留执行阶段,晚到事件不覆盖审批或终态。
12
-
13
- ## 新增重复失败提醒
14
-
15
- 高级设置增加“重复失败提醒(次)”,默认 3 次,可设 0 关闭,允许 0–20 的整数。同一工具、同一操作连续出现相同的结构化失败时提醒指挥端一次;成功或失败身份变化后重新计数。
16
-
17
- 提醒沿用紧凑的 `attention` 返回,不自动取消、换模型、重派或延长时限。权限请求和执行结局优先。普通输出出现 error 字样、长时间思考、运行长测试或没有文件改动,不会被当作重复工具失败。任务详情和历史保留有界提醒,不记录原始参数、错误正文或思考内容。
18
-
19
- ## 宿主审查结论写回任务记录
20
-
21
- 新增 `delegate_review`,由指挥端读取结果、检查改动和验证证据后,明确记录“审查通过”或“需要修正”,任务页同步显示。执行者交付本身仍然不等于通过审查。
22
-
23
- 审查记录只针对一个已交付任务,不授予工具权限,不修改模型、开关或隔离方式,也不会合并工作树。需要修正时续接原任务;已有决定保留在原记录中。底层执行状态继续兼容旧客户端,旧历史记录不批量补写虚构的通过结论。
24
-
25
- ## Codex 集成和配置兼容
26
-
27
- - 更新包内 `dsh-taskbridge` 智能体规则,支持识别未修改的已发布 1.3.2 模板,在插件加载时刷新已有托管集成。
28
- - 新安装仍由设置页“安装/更新 TaskBridge 智能体”按钮创建智能体与 MCP;更新后必要时重新加载 Codex,让客户端读取新规则和工具目录。
29
- - 用户自行修改过的智能体文件保留,并显示需要处理的状态;无需删除整个 Codex 配置目录。
30
- - 旧设置缺少重复失败字段时采用默认值;表单空值、越界和小数给出明确校验。修复监控设置保存和旧历史字段的兼容问题。
31
-
32
- ## 安装与更新
33
-
34
- 在 DSH 插件管理中更新 `dsh-taskbridge`,或添加 `dsh-taskbridge@1.4.0`,也可使用本 Release 的 `dsh-taskbridge-1.4.0.tgz`。区域镜像尚未同步时改选 npm 官方源。
35
-
36
- 同包更新后确认插件加载成功,在 Codex 集成页查看智能体及 MCP 状态;旧客户端可能需要重新加载。首次安装点击集成安装按钮;有冲突时使用插件提示的安装/修复操作。从旧包名迁移仍按现有迁移指南处理,不同时启用新旧插件。
37
-
38
- ## 等待阶段 token 实测
39
-
40
- 在同一聊天、同一 `gpt-6.1-sol` 模型中,对同一个生产等待程序各运行约 45 秒:短外层等待产生 3 次 GPT 响应,长等待产生 1 次。按实际逐响应用量记录,输入加输出从 507,885 降至 169,734 token,**这次等待样本减少 66.58%**;其中非缓存输入从 757 降至 123。
41
-
42
- 这是单轮、短时、先短后长的等待通道对照,执行活动由程序模拟。它不是整个开发任务、真实模型执行或账单的节省比例,不能宣传成所有任务固定节省 66.58%。完整口径见[测量报告](1.4.0-token-benchmark.zh.md)。此前真实墙钟 20 分 2 秒的正常活动模拟等待,已验证中途零 GPT 续等;真实 DSH 任务也独立验证了多分钟等待及权限申请返回。
43
-
44
- ## 发布前验证
45
-
46
- - 最终全量回归:**1,222 项通过,0 失败、0 跳过**;客户端构建及构建一致性检查通过。
47
- - 宿主审查专项覆盖 20 项,包括通过/要求修正、落盘和重载、重复请求、并发写入、持久化失败回滚、关闭派工开关后的结论记录,以及界面标签一致性。
48
- - 包内实测补齐了审查路由的中间转发映射,并新增真实转发客户端的路由与载荷回归,避免只测工具和服务端而遗漏中间连接。
49
- - 安装包另做隔离安装、真实 stdio 握手和 8 个工具目录检查;临时 Codex 目录验证 1.3.2 托管规则升级、等待超时配置与自定义智能体保留。审查闭环使用安装包实现、真实本机 HTTP 与历史文件,原生执行服务和 Git 证据使用测试夹具,不调用提供方模型。
50
- - 正式 Desktop 配置不由本次测试修改。用户在插件管理中更新并重新加载 Codex 后,才会在实际使用环境启用新的工具和规则。
51
-
52
- ## 边界
53
-
54
- 插件不控制所有客户端的工具时限,单次 MCP 等待最多 60 分钟;客户端提前返回或达到等待上限时,仍需续接同一任务。重复失败检测不代替交付质量审查。本版没有新增 CLI 执行通道、Claude Code 一键安装或普遍适用的原生 `@` 能力。
@@ -1,59 +0,0 @@
1
- # DSH TaskBridge 1.4.1 更新说明
2
-
3
- 发布日期:2026 年 11 月 14 日。安装标识:`dsh-taskbridge@1.4.1`。
4
-
5
- 让 Claude Code 或 Codex 指挥 DSH 工作,在 DSH 插件中配置 API、执行模型和思考强度。1.4.1 针对 1.4.0 审查报告中的 R1—R5,补齐执行结束后的审查闭环。
6
-
7
- ## 重启后继续读取和补审
8
-
9
- 已结束任务保留原 ID。DSH/插件重启后,原指挥端仍可通过结果、等待与审查工具读取已保存记录;完成但尚未审查的任务可直接补审,再次重启仍保留结论。
10
-
11
- 历史记录是可审查的证据,不会恢复成执行任务,也不会恢复旧权限申请。失败、取消或中断保持真实结局。其他身份与未知 ID 得到一致的拒绝;关闭派工开关后,已有结果读取和审查仍可进行。
12
-
13
- 历史缺少的输出、差异或关联证据会明确标记。是否足以验收由指挥端判断;插件不会因为历史记录存在便自动通过。
14
-
15
- ## 保存确认后才显示审查结论
16
-
17
- 审查结论分为保存中、保存未确认、已保存及确定失败。请求等待超过默认 5 秒,仅表示底层写入尚未确认,不能当作确定失败,也不能提前说审查已记录。
18
-
19
- 晚到的成功或失败会同步到后续读取和页面。相同审查并发提交共享一次写入,已有结论与冲突请求明确区分;确定失败可重试。任务收尾快照不能覆盖已经保存的审查结论,其他任务的历史写入也不应丢失。
20
-
21
- ## 8000 字符审查意见完整保存
22
-
23
- 统一按 **Unicode 码点** 统计,最多 8000,覆盖中文、英文、换行和 emoji。输入仍去除首尾空白并脱敏,合法正文不会再被通用短标签裁到 256 字符;超过限制在写入前拒绝。存储容量不足时明确报告,不能删掉审查正文来宣称保存成功。
24
-
25
- 以前已被旧版截掉的部分,升级无法自动恢复;需要原对话或报告作为补证。
26
-
27
- ## 页面和工具各按用途返回内容
28
-
29
- - 可见页面在有运行中、待审或保存中记录时每 5 秒刷新;隐藏暂停、恢复立即读取,结论确认后停止。待审不被当作正在执行,也不增加取消入口。刷新失败保留原记录并提示异常。
30
- - 列表只展示最多 200 码点预览,详情可展开和复制全文。剪贴板不可用、同步拒绝或异步失败时准确提示。
31
- - `delegate_wait` 继续简短返回状态,不重复附带长审查正文。
32
- - 旧 `delegate_result({ taskId })` 继续可用。返回大小受限时,备注明确带 `noteOmitted: true` 和 `noteChars`,不会把截短正文冒充全文。
33
- - 需要全文时使用 `delegate_result({ taskId, reviewNoteOffset: 0 })`。默认每页 2000 码点,可用 `reviewNoteLimit` 调整到 1—2000;按 `nextOffset` 续读,到 `complete: true` 结束。分页只读取备注,不重复搬运执行输出和差异。
34
-
35
- ## Codex 集成与升级
36
-
37
- 受管理的原版 1.4.0 模板支持 LF/CRLF 精确识别和升级;用户改过的文件保留。新规则强调集中审查、写回确认、按需取全文以及通过 `continueFromTaskId` 续接原任务。
38
-
39
- 首次安装仍使用插件设置页集成按钮。正式更新后,客户端可能需要重新加载规则和工具目录。历史数据目录、MCP 技术名称和 API/模型选择方式保持兼容。
40
-
41
- ## 安装与升级
42
-
43
- 在 DSH 插件管理中更新 `dsh-taskbridge`,或在添加插件时输入 `dsh-taskbridge@1.4.1`。区域镜像未同步时选择 npm 官方源;也可使用本 Release 的 `dsh-taskbridge-1.4.1.tgz` 和 SHA256 校验文件。订阅本项目自定义索引的用户,可在索引部署完成后刷新发现页面获取版本。
44
-
45
- 升级后按需重新加载 Codex,使客户端重新读取受管理规则和 MCP 工具目录。不要同时启用旧名称的插件副本;既有数据目录和模型设置保持兼容。
46
-
47
- ## 验证结果与边界
48
-
49
- 完整自动回归 **1283 项通过**;同步开发仓库后,包内容、历史补审和页面刷新驱动的针对性验证 **48 项通过**。客户端构建及一致性检查、`git diff --check` 通过。
50
-
51
- 隔离安装包使用实际 stdio MCP 子进程与本机 HTTP 接口,完成原任务 ID 读取、重启后补审、再次重启读回;8000 码点备注经 4 页完整重组。普通等待回复不带备注正文,该次通道验收为 1566 字节。
52
-
53
- 自动回归覆盖真实历史写盘、超时后成功/失败、同任务并发、其他任务同时保存、收尾重叠、码点边界,以及刷新 hook 与实际 store、剪贴板和临时 Codex 配置迁移。
54
-
55
- 自动测试使用包内真实模块和临时目录,模型/会话由夹具提供;发布不代替用户正式 Desktop 升级、页面点击验收、真实提供方任务验收或真实客户端长等待验收。
56
-
57
- 本版没有重新测量账单或整任务 token,不给出新的节省百分比;仅验证长备注不会使普通等待回复按正文长度膨胀。1.4.0 的短样本测量保留其原有适用边界。
58
-
59
- 本版不包含后续规划的外层静默等待优化、审批后直接恢复等待和减少不必要提权申请。这些问题另行实施与验收。