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,145 +0,0 @@
1
- // Prompt construction for delegated work and independent review.
2
- //
3
- // Prompt text is a contract, not decoration. It states what the worker must do,
4
- // what it must not do, and — critically — what it cannot do on its own: the
5
- // worker cannot approve its own work, and the reviewer cannot change the
6
- // workspace. Both prompts also carry an explicit evidence boundary so neither
7
- // party believes it may widen its own scope.
8
-
9
- /** Placeholder substituted for withheld patch content. */
10
- export const REDACTED_PLACEHOLDER = '[content withheld: sensitive path]';
11
-
12
- /** Bounds on interpolated evidence inside a prompt. */
13
- const EVIDENCE_LIMITS = Object.freeze({
14
- fileList: 200,
15
- patchChars: 24_000,
16
- });
17
-
18
- /**
19
- * Build the delegation prompt for one task.
20
- * @param {object} input - `taskId`, `prompt`, `workspacePath`, `isolation`, `diff`, `baseline`.
21
- * @returns {string} assembled prompt.
22
- */
23
- export function buildWorkerPrompt(input) {
24
- const lines = [];
25
- lines.push('You are a delegated implementation worker. Your work will be reviewed by the host and by an independent reviewer.');
26
- lines.push('');
27
- lines.push(`Task id: ${input.taskId}`);
28
- if (typeof input.workspacePath === 'string' && input.workspacePath !== '') {
29
- lines.push(`Workspace: ${input.workspacePath}`);
30
- }
31
- lines.push(`Isolation: ${input.isolation ?? 'shared'}`);
32
- lines.push('');
33
- lines.push('## Task');
34
- lines.push(String(input.prompt ?? '').trim());
35
- lines.push('');
36
- lines.push('## Working rules');
37
- lines.push('- You may modify files only inside the workspace above.');
38
- lines.push('- Do not commit, push, tag, or rewrite git history.');
39
- lines.push('- Do not read or print credentials, tokens, or .env contents.');
40
- lines.push('- Do not install packages from the network unless the task explicitly requires it.');
41
- lines.push('- Report what you changed and what you could not do. Do not claim checks you did not run.');
42
- lines.push('');
43
- lines.push('## Checks and extra permissions');
44
- lines.push('- Read ordinary files and logs with the normal file tools and the ordinary workspace permission. '
45
- + 'Do not ask for elevated access merely to read a log, and do not use a sandbox escape as a substitute for '
46
- + 'a file tool.');
47
- lines.push('- Run tests under the ordinary permission first. If a test fails for a CONCRETE environment reason '
48
- + '(a missing module, a denied pipe, an absent binary), keep that error text and report it rather than retrying '
49
- + 'the same command with more access.');
50
- lines.push('- Ask for extra permission only for the one complete, bounded command that genuinely needs it, and say '
51
- + 'which error it resolves. A permission granted for one call never covers a later call, and it never widens '
52
- + 'the sandbox permanently.');
53
- lines.push('- Run one combined test command, save its FULL stdout/stderr, its real exit code and a short summary '
54
- + '(for example into `.cache/`), and read that saved log afterwards with the file tools. Do not re-run a test '
55
- + 'merely to change a filter, a `Select-String` pattern or a `Select-Object -First N`: read the log instead.');
56
- lines.push('- A missing dependency is a fact to verify, not a reason to re-run the suite: check whether the module '
57
- + 'exists before concluding the test failed, and never use extra permission to paper over a module-not-found '
58
- + 'error.');
59
- lines.push('- Fix a failing test before running the suite again. Report the tests you actually ran, their exit '
60
- + 'codes and their counts; if the worktree cannot provide a dependency, say so plainly instead of retrying.');
61
- lines.push('');
62
- lines.push('## Completion');
63
- lines.push('When the task is complete, reply with a short summary, the files you changed, and any checks you actually ran with their results.');
64
- lines.push('You cannot approve your own work; the host decides acceptance.');
65
- if (input.baseline !== undefined && input.baseline !== null) {
66
- lines.push('');
67
- lines.push(`## Starting state: ${input.baseline.dirtyBaseline === true ? 'the workspace already had uncommitted changes' : 'the workspace was clean'}`);
68
- }
69
- return lines.join('\n');
70
- }
71
-
72
- /**
73
- * Build the independent review prompt.
74
- *
75
- * The reviewer is asked for a machine-readable verdict line and is told
76
- * explicitly that it must not modify anything and cannot approve on the host's
77
- * behalf.
78
- * @param {object} input - `taskId`, `taskPrompt`, `workerSummary`, `evidence`.
79
- * @returns {string} assembled prompt.
80
- */
81
- export function buildReviewPrompt(input) {
82
- const lines = [];
83
- lines.push('You are an independent reviewer. You did not perform this work.');
84
- lines.push('');
85
- lines.push(`Task id: ${input.taskId}`);
86
- lines.push('');
87
- lines.push('## The task that was delegated');
88
- lines.push(String(input.taskPrompt ?? '').trim());
89
- lines.push('');
90
- lines.push('## The worker\'s report');
91
- lines.push(String(input.workerSummary ?? '(no summary produced)').trim());
92
- lines.push('');
93
- lines.push('## Measured changes');
94
- lines.push(renderEvidence(input.evidence));
95
- lines.push('');
96
- lines.push('## Your constraints');
97
- lines.push('- You are read-only. Any attempt to modify the workspace will be denied by the harness.');
98
- lines.push('- You cannot approve work on behalf of the host. Your verdict is evidence, not acceptance.');
99
- lines.push('- Judge only what the evidence above shows; if it is insufficient, say so.');
100
- lines.push('');
101
- lines.push('## Required output');
102
- lines.push('End your reply with exactly these two lines:');
103
- lines.push('VERDICT: approve (or) VERDICT: changes-requested');
104
- lines.push('REASON: one sentence');
105
- return lines.join('\n');
106
- }
107
-
108
- /**
109
- * Render measured change evidence into prompt-safe text.
110
- * @param {object | null} evidence - value returned by the workspace audit.
111
- * @returns {string} bounded evidence block.
112
- */
113
- export function renderEvidence(evidence) {
114
- if (evidence === null || evidence === undefined) return 'No change evidence was captured.';
115
- const lines = [];
116
- if (evidence.dirtyBaseline === true) {
117
- lines.push(`Note: the workspace had ${evidence.preexistingChanges ?? 'some'} pre-existing change(s) before this task ran.`);
118
- }
119
- const files = Array.isArray(evidence.files) ? evidence.files.slice(0, EVIDENCE_LIMITS.fileList) : [];
120
- if (files.length === 0) {
121
- lines.push('No files changed.');
122
- } else {
123
- lines.push(`Changed files (${evidence.fileCount ?? files.length}${evidence.truncatedFiles ? ', list truncated' : ''}):`);
124
- for (const file of files) {
125
- lines.push(` ${file.status} ${file.path}${file.sensitive === true ? ' [sensitive: content withheld]' : ''}`);
126
- }
127
- }
128
- if (Array.isArray(evidence.sensitivePaths) && evidence.sensitivePaths.length > 0) {
129
- lines.push('');
130
- lines.push('Sensitive paths were touched. Their content is withheld from this evidence:');
131
- for (const path of evidence.sensitivePaths.slice(0, EVIDENCE_LIMITS.fileList)) lines.push(` ${path}`);
132
- }
133
- lines.push('');
134
- lines.push('Diff:');
135
- const patch = typeof evidence.patchText === 'string' ? evidence.patchText : '';
136
- if (patch === '') {
137
- lines.push('(no textual diff captured)');
138
- } else {
139
- lines.push(patch.slice(0, EVIDENCE_LIMITS.patchChars));
140
- if (patch.length > EVIDENCE_LIMITS.patchChars || evidence.patchTruncated === true) {
141
- lines.push(`(diff truncated for review at ${EVIDENCE_LIMITS.patchChars} characters)`);
142
- }
143
- }
144
- return lines.join('\n');
145
- }