dsh-taskbridge 0.0.0-stage → 1.3.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/CHANGELOG.md +754 -0
- package/LICENSE +21 -0
- package/README.md +624 -3
- package/bin/dsh-delegate-codex-agent.js +115 -0
- package/bin/dsh-delegate-control.d.ts +90 -0
- package/bin/dsh-delegate-control.js +450 -0
- package/bin/dsh-delegate-mcp.d.ts +121 -0
- package/bin/dsh-delegate-mcp.js +273 -0
- package/codex/dsh-delegate.toml +245 -0
- package/cordis.patch.yml +6 -0
- package/docs/INTRODUCTION.md +15 -0
- package/docs/INTRODUCTION.zh.md +32 -0
- package/docs/auth-contract.md +138 -0
- package/docs/claude-code.md +31 -0
- package/docs/codex-integration.md +922 -0
- package/docs/contracts-stage-b.md +443 -0
- package/docs/conversation-placement.md +293 -0
- package/docs/plugin-market.md +30 -0
- package/docs/redaction-contract.md +127 -0
- package/docs/runtime-compatibility.md +220 -0
- package/docs/silent-wait.md +191 -0
- package/docs/taskbridge-upgrade.md +28 -0
- package/docs/taskdispatch-upgrade.md +25 -0
- package/docs/worker-permissions.md +347 -0
- package/docs/workspace-contract.md +538 -0
- package/icon.svg +1 -0
- package/lib/client.d.ts +118 -0
- package/lib/client.js +3232 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +135 -4
- package/src/auth/fence.js +361 -0
- package/src/auth/grants.js +789 -0
- package/src/client/api.js +2322 -0
- package/src/client/index.jsx +2333 -0
- package/src/client/styles.js +251 -0
- package/src/codex/installer.js +3260 -0
- package/src/codex/seam.js +429 -0
- package/src/codex/toml.js +784 -0
- package/src/config/defaults.js +164 -0
- package/src/config/redact.js +184 -0
- package/src/config/settings.js +629 -0
- package/src/config/store.js +186 -0
- package/src/config/validate.js +763 -0
- package/src/credentials/seam.js +202 -0
- package/src/http/execution-plane.js +454 -0
- package/src/http/respond.js +175 -0
- package/src/http/user-plane.js +1122 -0
- package/src/index.d.ts +332 -0
- package/src/index.js +657 -0
- package/src/jobs/activity.js +1008 -0
- package/src/jobs/engine.js +3609 -0
- package/src/jobs/history.js +1467 -0
- package/src/mcp/server.js +1820 -0
- package/src/mcp/wait.js +536 -0
- package/src/model/connectivity.js +371 -0
- package/src/model/discovery.js +582 -0
- package/src/model/native-catalog.js +68 -0
- package/src/model/openai-adapter.js +671 -0
- package/src/model/probe.js +264 -0
- package/src/model/providers.js +756 -0
- package/src/model/routing.js +321 -0
- package/src/review/preset.js +868 -0
- package/src/review/prompts.js +126 -0
- package/src/review/reviewer.js +933 -0
- package/src/runtime/agent-runner.js +1738 -0
- package/src/runtime/endpoint-discovery.js +118 -0
- package/src/runtime/permissions.js +1429 -0
- package/src/runtime/sandbox.js +358 -0
- package/src/runtime/session-placement.js +1103 -0
- package/src/workspace/audit.js +775 -0
- package/src/workspace/locks.js +167 -0
- package/src/workspace/preflight.js +424 -0
- package/src/workspace/worktrees.js +613 -0
|
@@ -0,0 +1,126 @@
|
|
|
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('## Completion');
|
|
44
|
+
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.');
|
|
45
|
+
lines.push('You cannot approve your own work; the host decides acceptance.');
|
|
46
|
+
if (input.baseline !== undefined && input.baseline !== null) {
|
|
47
|
+
lines.push('');
|
|
48
|
+
lines.push(`## Starting state: ${input.baseline.dirtyBaseline === true ? 'the workspace already had uncommitted changes' : 'the workspace was clean'}`);
|
|
49
|
+
}
|
|
50
|
+
return lines.join('\n');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Build the independent review prompt.
|
|
55
|
+
*
|
|
56
|
+
* The reviewer is asked for a machine-readable verdict line and is told
|
|
57
|
+
* explicitly that it must not modify anything and cannot approve on the host's
|
|
58
|
+
* behalf.
|
|
59
|
+
* @param {object} input - `taskId`, `taskPrompt`, `workerSummary`, `evidence`.
|
|
60
|
+
* @returns {string} assembled prompt.
|
|
61
|
+
*/
|
|
62
|
+
export function buildReviewPrompt(input) {
|
|
63
|
+
const lines = [];
|
|
64
|
+
lines.push('You are an independent reviewer. You did not perform this work.');
|
|
65
|
+
lines.push('');
|
|
66
|
+
lines.push(`Task id: ${input.taskId}`);
|
|
67
|
+
lines.push('');
|
|
68
|
+
lines.push('## The task that was delegated');
|
|
69
|
+
lines.push(String(input.taskPrompt ?? '').trim());
|
|
70
|
+
lines.push('');
|
|
71
|
+
lines.push('## The worker\'s report');
|
|
72
|
+
lines.push(String(input.workerSummary ?? '(no summary produced)').trim());
|
|
73
|
+
lines.push('');
|
|
74
|
+
lines.push('## Measured changes');
|
|
75
|
+
lines.push(renderEvidence(input.evidence));
|
|
76
|
+
lines.push('');
|
|
77
|
+
lines.push('## Your constraints');
|
|
78
|
+
lines.push('- You are read-only. Any attempt to modify the workspace will be denied by the harness.');
|
|
79
|
+
lines.push('- You cannot approve work on behalf of the host. Your verdict is evidence, not acceptance.');
|
|
80
|
+
lines.push('- Judge only what the evidence above shows; if it is insufficient, say so.');
|
|
81
|
+
lines.push('');
|
|
82
|
+
lines.push('## Required output');
|
|
83
|
+
lines.push('End your reply with exactly these two lines:');
|
|
84
|
+
lines.push('VERDICT: approve (or) VERDICT: changes-requested');
|
|
85
|
+
lines.push('REASON: one sentence');
|
|
86
|
+
return lines.join('\n');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Render measured change evidence into prompt-safe text.
|
|
91
|
+
* @param {object | null} evidence - value returned by the workspace audit.
|
|
92
|
+
* @returns {string} bounded evidence block.
|
|
93
|
+
*/
|
|
94
|
+
export function renderEvidence(evidence) {
|
|
95
|
+
if (evidence === null || evidence === undefined) return 'No change evidence was captured.';
|
|
96
|
+
const lines = [];
|
|
97
|
+
if (evidence.dirtyBaseline === true) {
|
|
98
|
+
lines.push(`Note: the workspace had ${evidence.preexistingChanges ?? 'some'} pre-existing change(s) before this task ran.`);
|
|
99
|
+
}
|
|
100
|
+
const files = Array.isArray(evidence.files) ? evidence.files.slice(0, EVIDENCE_LIMITS.fileList) : [];
|
|
101
|
+
if (files.length === 0) {
|
|
102
|
+
lines.push('No files changed.');
|
|
103
|
+
} else {
|
|
104
|
+
lines.push(`Changed files (${evidence.fileCount ?? files.length}${evidence.truncatedFiles ? ', list truncated' : ''}):`);
|
|
105
|
+
for (const file of files) {
|
|
106
|
+
lines.push(` ${file.status} ${file.path}${file.sensitive === true ? ' [sensitive: content withheld]' : ''}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (Array.isArray(evidence.sensitivePaths) && evidence.sensitivePaths.length > 0) {
|
|
110
|
+
lines.push('');
|
|
111
|
+
lines.push('Sensitive paths were touched. Their content is withheld from this evidence:');
|
|
112
|
+
for (const path of evidence.sensitivePaths.slice(0, EVIDENCE_LIMITS.fileList)) lines.push(` ${path}`);
|
|
113
|
+
}
|
|
114
|
+
lines.push('');
|
|
115
|
+
lines.push('Diff:');
|
|
116
|
+
const patch = typeof evidence.patchText === 'string' ? evidence.patchText : '';
|
|
117
|
+
if (patch === '') {
|
|
118
|
+
lines.push('(no textual diff captured)');
|
|
119
|
+
} else {
|
|
120
|
+
lines.push(patch.slice(0, EVIDENCE_LIMITS.patchChars));
|
|
121
|
+
if (patch.length > EVIDENCE_LIMITS.patchChars || evidence.patchTruncated === true) {
|
|
122
|
+
lines.push(`(diff truncated for review at ${EVIDENCE_LIMITS.patchChars} characters)`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return lines.join('\n');
|
|
126
|
+
}
|