dsh-taskbridge 1.8.1 → 1.9.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.
- package/CHANGELOG.md +20 -0
- package/README.md +751 -733
- package/antigravity/agents/dsh-taskbridge.md +14 -12
- package/antigravity/skills/dsh-taskbridge/SKILL.md +32 -19
- package/bin/dsh-delegate-codex-agent.js +9 -4
- package/codex/skills/dsh-taskbridge/SKILL.md +131 -0
- package/codex/skills/dsh-taskbridge/rules-reference-96027c387cb9b7587efa4aa3836235d86db1108068e007dc08196e807ca25e5d.md +114 -0
- package/docs/INTRODUCTION.md +148 -122
- package/docs/INTRODUCTION.zh.md +151 -134
- package/docs/antigravity-integration.md +47 -42
- package/docs/assets/taskbridge-workflow.en.svg +72 -0
- package/docs/assets/taskbridge-workflow.zh.png +0 -0
- package/docs/claude-code.md +18 -18
- package/docs/codex-integration.md +139 -113
- package/docs/releases/1.8.0.zh.md +16 -16
- package/docs/releases/1.8.1.zh.md +24 -24
- package/docs/releases/1.9.0.zh.md +31 -0
- package/docs/runtime-compatibility.md +7 -9
- package/docs/silent-wait.md +17 -26
- package/docs/taskbridge-upgrade.md +4 -4
- package/lib/client.d.ts +2 -2
- package/lib/client.js +7 -7
- package/locale/en.json +7 -7
- package/locale/zh.json +7 -7
- package/package.json +10 -4
- package/src/antigravity/installer.js +1099 -1068
- package/src/antigravity/seam.js +142 -142
- package/src/client/api.js +135 -13
- package/src/client/index.jsx +19 -18
- package/src/codex/agent-ownership.js +72 -12
- package/src/codex/installer.js +688 -268
- package/src/http/execution-plane.js +17 -0
- package/src/http/user-plane.js +6 -0
- package/src/index.d.ts +9 -1
- package/src/index.js +86 -64
- package/src/jobs/engine.js +278 -5
- package/src/jobs/history.js +17 -1
- package/src/jobs/record-cleanup.js +715 -641
- package/src/mcp/server.js +241 -12
- package/src/runtime/permissions.js +18 -0
- package/src/runtime/worker-prompt.js +13 -9
- package/codex/dsh-taskbridge.toml +0 -181
package/src/mcp/server.js
CHANGED
|
@@ -298,8 +298,8 @@ export const TOOLS = Object.freeze([
|
|
|
298
298
|
name: 'delegate_submit',
|
|
299
299
|
title: 'Submit delegated task',
|
|
300
300
|
description: 'Submit one prompt to run as a delegated task while the DSH delegation switch is enabled. '
|
|
301
|
-
+ 'Returns the task identity and state; '
|
|
302
|
-
+ '
|
|
301
|
+
+ 'Returns the task identity and state (or follows the first wait in the same call when `wait: true` is set); '
|
|
302
|
+
+ 'submission is not host approval. '
|
|
303
303
|
+ 'workspacePath is the operator-authorized SOURCE repository or checkout the task runs against; '
|
|
304
304
|
+ 'a source root may legitimately be a Git checkout or a Git worktree (subject to the usual preflight). '
|
|
305
305
|
+ 'A follow-up keeps that same source path as the task it continues. '
|
|
@@ -309,10 +309,13 @@ export const TOOLS = Object.freeze([
|
|
|
309
309
|
+ 'reuses that task\u2019s recorded execution checkout and DSH Session internally, taking no execution '
|
|
310
310
|
+ 'location from '
|
|
311
311
|
+ 'the caller. An unknown, unfinished, removed or differently-sourced parent is refused rather than '
|
|
312
|
-
+ 'started as a new conversation. '
|
|
312
|
+
+ 'started as a new conversation. For a new dependent subtask that starts a fresh DSH Session directly on '
|
|
313
|
+
+ 'an earlier finished isolated worktree under the same source repository, pass reuseWorktreeFromTaskId '
|
|
314
|
+
+ 'instead (never combined with continueFromTaskId). '
|
|
313
315
|
+ 'The commander must first plan and scope ONE cohesive, independently verifiable work packet. '
|
|
314
316
|
+ 'Inspect the project and prior delivery, choose the next ready packet, and tell the operator the approach and reuse decision. '
|
|
315
|
-
+ 'Put
|
|
317
|
+
+ 'Put clear architectural direction, exported contracts, owned scope redlines and acceptance checks in the prompt (without dictating line-by-line code). '
|
|
318
|
+
+ 'Group dependent packets with delegate_plan. A simple task can use one brief. '
|
|
316
319
|
+ 'Rules, planning and final review stay with the commander. Verification-only packets are read-only.',
|
|
317
320
|
// It creates work, so it is not a read; it is not destructive of anything the
|
|
318
321
|
// operator already has, and repeating it creates ANOTHER task (never idempotent).
|
|
@@ -340,8 +343,8 @@ export const TOOLS = Object.freeze([
|
|
|
340
343
|
},
|
|
341
344
|
prompt: {
|
|
342
345
|
type: 'string',
|
|
343
|
-
description: 'Give DSH the objective, verified starting facts, code entry points,
|
|
344
|
-
+ '
|
|
346
|
+
description: 'Give DSH the objective, verified starting facts, code/spec entry points, architectural direction and exported contracts/invariants, owned scope redlines, and acceptance evidence (do not dictate line-by-line implementation code). '
|
|
347
|
+
+ 'Roadmap context does not authorize future packets. A verification-only packet permits checks and evidence only.',
|
|
345
348
|
},
|
|
346
349
|
title: { type: 'string', maxLength: 120, description: 'Short work-content title in the operator\'s language, e.g. 修复登录错误. Used to name the new DSH Workspace; omit role instructions and task ids. A follow-up keeps its existing Workspace name.' },
|
|
347
350
|
overrides: {
|
|
@@ -377,6 +380,44 @@ export const TOOLS = Object.freeze([
|
|
|
377
380
|
+ 'isolation override either. An unknown, still-running, removed or differently-sourced parent is '
|
|
378
381
|
+ 'refused, never replaced by a new conversation.',
|
|
379
382
|
},
|
|
383
|
+
reuseWorktreeFromTaskId: {
|
|
384
|
+
type: 'string',
|
|
385
|
+
minLength: 1,
|
|
386
|
+
maxLength: 256,
|
|
387
|
+
description: 'OPTIONAL. Task id of an earlier finished (`awaiting-host-review`) isolated worktree task '
|
|
388
|
+
+ 'under the SAME source repository whose managed worktree this NEW independent subtask should reuse. '
|
|
389
|
+
+ 'Starts a FRESH DSH Session (clean worker context) and may bind its own `planNodeId`, while editing '
|
|
390
|
+
+ 'directly on top of the upstream task\u2019s worktree without touching or committing to the user\u2019s source '
|
|
391
|
+
+ 'checkout. Mutually exclusive with `continueFromTaskId` (which reuses both session and worktree for '
|
|
392
|
+
+ 'rectification of the same item).',
|
|
393
|
+
},
|
|
394
|
+
autoPreflight: {
|
|
395
|
+
type: 'boolean',
|
|
396
|
+
description: 'OPTIONAL, default false (MCP-only control flag). For a new task chain (neither '
|
|
397
|
+
+ '`continueFromTaskId` nor `reuseWorktreeFromTaskId`), run `delegate_preflight` automatically before '
|
|
398
|
+
+ 'submitting. If preflight returns `block`, stops without submitting and returns `{ ok: true, '
|
|
399
|
+
+ 'submitted: false, preflight }`; if clean (`worktree`, or `shared` with `allowShared: true`), proceeds '
|
|
400
|
+
+ 'straight to submit inside this same call.',
|
|
401
|
+
},
|
|
402
|
+
allowShared: {
|
|
403
|
+
type: 'boolean',
|
|
404
|
+
description: 'OPTIONAL, default false (only valid with `autoPreflight: true`). Forwarded to automatic '
|
|
405
|
+
+ 'preflight when explicitly authorizing in-place `shared` execution on a dirty Git repository root.',
|
|
406
|
+
},
|
|
407
|
+
wait: {
|
|
408
|
+
type: 'boolean',
|
|
409
|
+
description: 'OPTIONAL, default false (MCP-only control flag). After the task is submitted, immediately '
|
|
410
|
+
+ 'follow it via `delegate_wait` inside this same MCP call and return the compact wait answer plus '
|
|
411
|
+
+ '`submitted: true` and `submitReceipt`. If the follow-up wait fails after submission succeeded, this '
|
|
412
|
+
+ 'call still returns `submitted: true`, `taskId`, `submitReceipt` and `waitError` so you never lose the '
|
|
413
|
+
+ 'task id or resubmit a duplicate.',
|
|
414
|
+
},
|
|
415
|
+
waitSeconds: {
|
|
416
|
+
type: 'integer',
|
|
417
|
+
minimum: MIN_WAIT_SECONDS,
|
|
418
|
+
maximum: MAX_WAIT_SECONDS,
|
|
419
|
+
description: 'OPTIONAL (only valid with `wait: true`). Wait budget in seconds; omit to use the default 3600s.',
|
|
420
|
+
},
|
|
380
421
|
goalDescription: {
|
|
381
422
|
type: 'string',
|
|
382
423
|
maxLength: MAX_TASK_DESCRIPTION_CHARS,
|
|
@@ -463,6 +504,12 @@ export const TOOLS = Object.freeze([
|
|
|
463
504
|
description: `Code points of completionSummary per page (1..${MAX_COMPLETION_SUMMARY_PAGE_CHARS}, `
|
|
464
505
|
+ 'default 2000). Only meaningful together with completionSummaryOffset.',
|
|
465
506
|
},
|
|
507
|
+
includeDiff: {
|
|
508
|
+
type: 'boolean',
|
|
509
|
+
description: 'OPTIONAL, default true (MCP-only control flag). Set to false to omit `task.diff.patchText` '
|
|
510
|
+
+ 'while keeping changed file paths, counts, summary, execution receipt and review state — useful when '
|
|
511
|
+
+ 'the commander inspects the diff directly inside `executionWorkspacePath` to avoid duplicate context.',
|
|
512
|
+
},
|
|
466
513
|
},
|
|
467
514
|
required: ['taskId'],
|
|
468
515
|
additionalProperties: false,
|
|
@@ -599,9 +646,9 @@ export const TOOLS = Object.freeze([
|
|
|
599
646
|
+ 'in delegate_result as `permission.pending` (state stays `running`, phase `awaiting-permission`). '
|
|
600
647
|
+ 'Read `permission.pending.arguments`/`argumentKeys` for the exact operation and `permission.pending.reason` '
|
|
601
648
|
+ 'for the asker\u2019s claim — the claim is not the operation. Answer `allow-once` to let THAT ONE call '
|
|
602
|
-
+ 'proceed, or `reject` to keep it denied
|
|
649
|
+
+ 'proceed, or `reject` to keep it denied. Every later escalation requires a separate decision. '
|
|
603
650
|
+ 'This cannot grant an account, a workspace or a standing policy, cannot change settings, credentials, '
|
|
604
|
-
+ 'the switch, the provider/model or the isolation, and cannot
|
|
651
|
+
+ 'the switch, the provider/model or the isolation, and cannot grant cross-task or standing permissions. '
|
|
605
652
|
+ '`allow-once` REQUIRES the pending request\u2019s `fingerprint` and is refused when `permission.pending.'
|
|
606
653
|
+ 'completeness` is not `complete` (the operation was shortened by a bound, so an allow cannot be granted '
|
|
607
654
|
+ 'on it). `reject` needs neither and is therefore always available. '
|
|
@@ -645,6 +692,12 @@ export const TOOLS = Object.freeze([
|
|
|
645
692
|
+ 'the exact operation it grants, and an allow that omits it is refused. Optional for `reject` (a '
|
|
646
693
|
+ 'refusal is safe without it); when supplied, a request whose operation no longer matches is refused.',
|
|
647
694
|
},
|
|
695
|
+
scope: {
|
|
696
|
+
type: 'string',
|
|
697
|
+
enum: ['once', 'task-command'],
|
|
698
|
+
description: 'OPTIONAL, default `once`. Use `once` to permit only this exact paused call. The preview '
|
|
699
|
+
+ 'value `task-command` is accepted with `allow-once` as a compatibility alias for `once`.',
|
|
700
|
+
},
|
|
648
701
|
waitAfterDecision: {
|
|
649
702
|
type: 'boolean',
|
|
650
703
|
description: 'OPTIONAL, default false: the historical behaviour — decide only, and the answer is the '
|
|
@@ -820,6 +873,10 @@ export const TOOLS = Object.freeze([
|
|
|
820
873
|
+ 'note WITH the same summary is an idempotent no-op, and a different summary \u2014 or adding one to an '
|
|
821
874
|
+ 'already recorded review \u2014 is refused like any other different conclusion.',
|
|
822
875
|
},
|
|
876
|
+
receiptOnly: {
|
|
877
|
+
type: 'boolean',
|
|
878
|
+
description: 'Set true to return the task ID and reviewPersistence only. Read full details with delegate_result.',
|
|
879
|
+
},
|
|
823
880
|
},
|
|
824
881
|
required: ['taskId', 'decision', 'note'],
|
|
825
882
|
additionalProperties: false,
|
|
@@ -1039,6 +1096,8 @@ function canonicalizeToolDescription(tool, key, field) {
|
|
|
1039
1096
|
* {@link validateArgs} — and never reintroduced anywhere else.
|
|
1040
1097
|
*/
|
|
1041
1098
|
export const MCP_ONLY_ARGUMENTS = Object.freeze({
|
|
1099
|
+
delegate_submit: Object.freeze(['autoPreflight', 'allowShared', 'wait', 'waitSeconds']),
|
|
1100
|
+
delegate_result: Object.freeze(['includeDiff']),
|
|
1042
1101
|
delegate_permission_decide: Object.freeze(['waitAfterDecision']),
|
|
1043
1102
|
delegate_question_answer: Object.freeze(['waitAfterAnswer']),
|
|
1044
1103
|
});
|
|
@@ -1238,6 +1297,17 @@ function validateArgs(tool, args) {
|
|
|
1238
1297
|
throw new McpError('MCP_ARGUMENT_ENUM', `${tool.name}.${key} must be one of ${declared.enum.join(', ')}`);
|
|
1239
1298
|
}
|
|
1240
1299
|
}
|
|
1300
|
+
if (tool.name === 'delegate_submit') {
|
|
1301
|
+
if (out.continueFromTaskId !== undefined && out.reuseWorktreeFromTaskId !== undefined) {
|
|
1302
|
+
throw new McpError('MCP_ARGUMENTS_INVALID', 'delegate_submit cannot combine continueFromTaskId and reuseWorktreeFromTaskId');
|
|
1303
|
+
}
|
|
1304
|
+
if (out.waitSeconds !== undefined && out.wait !== true) {
|
|
1305
|
+
throw new McpError('MCP_ARGUMENT_REQUIRED', 'delegate_submit.waitSeconds requires wait: true');
|
|
1306
|
+
}
|
|
1307
|
+
if (out.allowShared !== undefined && out.autoPreflight !== true) {
|
|
1308
|
+
throw new McpError('MCP_ARGUMENT_REQUIRED', 'delegate_submit.allowShared requires autoPreflight: true');
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1241
1311
|
if (tool.name === 'delegate_result') {
|
|
1242
1312
|
if (out.reviewNoteLimit !== undefined && out.reviewNoteOffset === undefined) {
|
|
1243
1313
|
throw new McpError('MCP_ARGUMENT_REQUIRED', 'delegate_result.reviewNoteLimit requires reviewNoteOffset');
|
|
@@ -2839,6 +2909,25 @@ export function createMcpServer(options) {
|
|
|
2839
2909
|
let result;
|
|
2840
2910
|
if (name === 'delegate_wait') {
|
|
2841
2911
|
result = await waitAnswer(payload, context);
|
|
2912
|
+
} else if (name === 'delegate_submit') {
|
|
2913
|
+
result = await submitAnswer(payload, context);
|
|
2914
|
+
} else if (name === 'delegate_result') {
|
|
2915
|
+
const { includeDiff, ...resultBody } = payload;
|
|
2916
|
+
result = await callExecution(route, resultBody);
|
|
2917
|
+
if (includeDiff === false && result?.ok === true && result.task?.diff && typeof result.task.diff === 'object') {
|
|
2918
|
+
result = {
|
|
2919
|
+
...result,
|
|
2920
|
+
task: {
|
|
2921
|
+
...result.task,
|
|
2922
|
+
diff: {
|
|
2923
|
+
...result.task.diff,
|
|
2924
|
+
patchText: '',
|
|
2925
|
+
patchOmitted: true,
|
|
2926
|
+
omittedByRequest: true,
|
|
2927
|
+
},
|
|
2928
|
+
},
|
|
2929
|
+
};
|
|
2930
|
+
}
|
|
2842
2931
|
} else if (name === 'delegate_permission_decide') {
|
|
2843
2932
|
result = await decidePermissionAnswer(payload, context);
|
|
2844
2933
|
} else if (name === 'delegate_question_answer') {
|
|
@@ -2846,6 +2935,23 @@ export function createMcpServer(options) {
|
|
|
2846
2935
|
} else if (name === 'delegate_metrics') {
|
|
2847
2936
|
// A census of THIS process: no plane route, no task identity, nothing to change.
|
|
2848
2937
|
result = { ok: true, metrics: metrics.snapshot() };
|
|
2938
|
+
} else if (name === 'delegate_review') {
|
|
2939
|
+
const { receiptOnly, ...review } = payload;
|
|
2940
|
+
result = await callExecution(route, review);
|
|
2941
|
+
if (receiptOnly && result?.ok === true) {
|
|
2942
|
+
result = {
|
|
2943
|
+
ok: true,
|
|
2944
|
+
taskId: result.task?.taskId ?? review.taskId,
|
|
2945
|
+
reviewPersistence: result.reviewPersistence ?? result.task?.reviewPersistence ?? null,
|
|
2946
|
+
};
|
|
2947
|
+
} else if (result?.ok === true && result.reviewPersistence !== undefined) {
|
|
2948
|
+
result = {
|
|
2949
|
+
ok: true,
|
|
2950
|
+
reviewPersistence: result.reviewPersistence,
|
|
2951
|
+
...(result.hostAcceptance !== undefined ? { hostAcceptance: result.hostAcceptance } : {}),
|
|
2952
|
+
...result,
|
|
2953
|
+
};
|
|
2954
|
+
}
|
|
2849
2955
|
} else {
|
|
2850
2956
|
result = await callExecution(route, payload);
|
|
2851
2957
|
}
|
|
@@ -2901,6 +3007,126 @@ export function createMcpServer(options) {
|
|
|
2901
3007
|
}
|
|
2902
3008
|
}
|
|
2903
3009
|
|
|
3010
|
+
/**
|
|
3011
|
+
* Reject with `MCP_REQUEST_CANCELLED` when this MCP request has already been cancelled.
|
|
3012
|
+
* @param {{ signal?: AbortSignal }} [context] - per-request cancellation.
|
|
3013
|
+
* @returns {void}
|
|
3014
|
+
*/
|
|
3015
|
+
function throwIfRequestCancelled(context) {
|
|
3016
|
+
if (context?.signal?.aborted !== true) return;
|
|
3017
|
+
const reason = context.signal.reason;
|
|
3018
|
+
const code = typeof reason?.code === 'string' && reason.code !== ''
|
|
3019
|
+
? reason.code
|
|
3020
|
+
: 'MCP_REQUEST_CANCELLED';
|
|
3021
|
+
const message = typeof reason?.message === 'string' && reason.message !== ''
|
|
3022
|
+
? reason.message
|
|
3023
|
+
: 'the request was cancelled by the host';
|
|
3024
|
+
throw new McpError(code, message);
|
|
3025
|
+
}
|
|
3026
|
+
|
|
3027
|
+
/**
|
|
3028
|
+
* One `delegate_submit` call, optionally performing automatic preflight and/or
|
|
3029
|
+
* single-chain waiting inside the same MCP call to eliminate round-trip turns.
|
|
3030
|
+
* @param {object} payload - validated submit arguments.
|
|
3031
|
+
* @param {{ signal?: AbortSignal }} context - per-request cancellation.
|
|
3032
|
+
* @returns {Promise<object>} submit answer, preflight block, or compact wait answer + receipt.
|
|
3033
|
+
*/
|
|
3034
|
+
async function submitAnswer(payload, context) {
|
|
3035
|
+
throwIfRequestCancelled(context);
|
|
3036
|
+
const { autoPreflight, allowShared, wait, waitSeconds, ...rawSubmitBody } = payload;
|
|
3037
|
+
let submitBody = rawSubmitBody;
|
|
3038
|
+
let preflightResult = null;
|
|
3039
|
+
if (autoPreflight === true
|
|
3040
|
+
&& submitBody.continueFromTaskId === undefined
|
|
3041
|
+
&& submitBody.reuseWorktreeFromTaskId === undefined) {
|
|
3042
|
+
try {
|
|
3043
|
+
preflightResult = await callExecution(
|
|
3044
|
+
'preflight',
|
|
3045
|
+
{
|
|
3046
|
+
workspacePath: submitBody.workspacePath,
|
|
3047
|
+
...(allowShared === true ? { allowShared: true } : {}),
|
|
3048
|
+
},
|
|
3049
|
+
...(context?.signal !== undefined ? [{ signal: context.signal }] : []),
|
|
3050
|
+
);
|
|
3051
|
+
} catch (error) {
|
|
3052
|
+
throwIfRequestCancelled(context);
|
|
3053
|
+
throw error;
|
|
3054
|
+
}
|
|
3055
|
+
throwIfRequestCancelled(context);
|
|
3056
|
+
const resolvedIso = preflightResult?.isolation ?? preflightResult?.preflight?.isolation ?? null;
|
|
3057
|
+
if (preflightResult?.ok !== true || resolvedIso === 'block' || resolvedIso === null) {
|
|
3058
|
+
return { ok: true, submitted: false, preflight: preflightResult };
|
|
3059
|
+
}
|
|
3060
|
+
if (resolvedIso === 'shared' && submitBody.overrides?.isolation === undefined) {
|
|
3061
|
+
submitBody = {
|
|
3062
|
+
...submitBody,
|
|
3063
|
+
overrides: { ...(submitBody.overrides ?? {}), isolation: 'shared' },
|
|
3064
|
+
};
|
|
3065
|
+
}
|
|
3066
|
+
}
|
|
3067
|
+
throwIfRequestCancelled(context);
|
|
3068
|
+
const submitted = await callExecution('submit', submitBody);
|
|
3069
|
+
if (wait !== true) {
|
|
3070
|
+
if (autoPreflight === true) {
|
|
3071
|
+
return {
|
|
3072
|
+
...submitted,
|
|
3073
|
+
submitted: true,
|
|
3074
|
+
...(preflightResult === null ? {} : { preflight: preflightResult }),
|
|
3075
|
+
};
|
|
3076
|
+
}
|
|
3077
|
+
return submitted;
|
|
3078
|
+
}
|
|
3079
|
+
const t = submitted?.task ?? {};
|
|
3080
|
+
const taskId = typeof t.taskId === 'string' && t.taskId !== '' ? t.taskId : null;
|
|
3081
|
+
const submitReceipt = {
|
|
3082
|
+
taskId,
|
|
3083
|
+
sourcePath: t.sourcePath ?? null,
|
|
3084
|
+
executionWorkspacePath: t.executionWorkspacePath ?? t.workspacePath ?? null,
|
|
3085
|
+
isolation: t.isolation ?? null,
|
|
3086
|
+
reusedWorktree: t.worktree?.reused === true,
|
|
3087
|
+
...(typeof t.reuseWorktreeFromTaskId === 'string' && t.reuseWorktreeFromTaskId !== ''
|
|
3088
|
+
? { reuseWorktreeFromTaskId: t.reuseWorktreeFromTaskId }
|
|
3089
|
+
: {}),
|
|
3090
|
+
...(typeof t.continueFromTaskId === 'string' && t.continueFromTaskId !== ''
|
|
3091
|
+
? { continueFromTaskId: t.continueFromTaskId }
|
|
3092
|
+
: {}),
|
|
3093
|
+
agentTeams: t.agentTeams ?? null,
|
|
3094
|
+
...(t.agentTeamsOrigin !== undefined ? { agentTeamsOrigin: t.agentTeamsOrigin } : {}),
|
|
3095
|
+
};
|
|
3096
|
+
if (taskId === null) {
|
|
3097
|
+
return {
|
|
3098
|
+
...submitted,
|
|
3099
|
+
submitted: true,
|
|
3100
|
+
submitReceipt,
|
|
3101
|
+
...(preflightResult === null ? {} : { preflight: preflightResult }),
|
|
3102
|
+
};
|
|
3103
|
+
}
|
|
3104
|
+
try {
|
|
3105
|
+
const waited = await waitAnswer(
|
|
3106
|
+
{ taskId, ...(waitSeconds === undefined ? {} : { waitSeconds }) },
|
|
3107
|
+
context,
|
|
3108
|
+
);
|
|
3109
|
+
return {
|
|
3110
|
+
...waited,
|
|
3111
|
+
submitted: true,
|
|
3112
|
+
submitReceipt,
|
|
3113
|
+
...(preflightResult === null ? {} : { preflight: preflightResult }),
|
|
3114
|
+
};
|
|
3115
|
+
} catch (error) {
|
|
3116
|
+
const code = typeof error?.code === 'string' ? error.code : 'MCP_WAIT_FAILED';
|
|
3117
|
+
const message = diagnostic(error?.message ?? String(error), 400) ?? 'the follow-up wait failed after submission';
|
|
3118
|
+
return {
|
|
3119
|
+
ok: true,
|
|
3120
|
+
submitted: true,
|
|
3121
|
+
taskId,
|
|
3122
|
+
submitReceipt,
|
|
3123
|
+
...(preflightResult === null ? {} : { preflight: preflightResult }),
|
|
3124
|
+
reason: null,
|
|
3125
|
+
waitError: { code, message },
|
|
3126
|
+
};
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
|
|
2904
3130
|
/**
|
|
2905
3131
|
* One `delegate_wait` call: a bounded loop of internal observations.
|
|
2906
3132
|
*
|
|
@@ -3344,11 +3570,14 @@ export function createMcpServer(options) {
|
|
|
3344
3570
|
+ 'the parent\u2019s recorded execution checkout and DSH Session internally, so it passes the parent\u2019s original '
|
|
3345
3571
|
+ 'source path again and never substitutes an internal execution location for it. A parent that '
|
|
3346
3572
|
+ 'is unknown, still running, removed or belongs to another source repository is refused '
|
|
3347
|
-
+ 'instead of starting a new conversation.
|
|
3573
|
+
+ 'instead of starting a new conversation. For a new downstream subtask that starts a fresh DSH '
|
|
3574
|
+
+ 'Session directly on an earlier finished isolated worktree under the same source repository, '
|
|
3575
|
+
+ 'pass reuseWorktreeFromTaskId instead (never combined with continueFromTaskId). A worker that needs wider access for ONE tool call '
|
|
3348
3576
|
+ 'pauses that call and reports it as `permission.pending` in delegate_result; while it waits the '
|
|
3349
|
-
+ 'task stays `running` with phase `awaiting-permission`. Answer
|
|
3350
|
-
+ 'delegate_permission_decide (`allow-once` or `reject`). That decision
|
|
3351
|
-
+ 'never a standing grant, and
|
|
3577
|
+
+ 'task stays `running` with phase `awaiting-permission`. Answer one such request with '
|
|
3578
|
+
+ 'delegate_permission_decide (`allow-once` or `reject`). That decision '
|
|
3579
|
+
+ 'covers only that call, is never a standing grant, and never widens the sandbox or crosses task '
|
|
3580
|
+
+ 'boundaries. Each later escalation requires a new decision. When your channel supports it, pass '
|
|
3352
3581
|
+ '`waitAfterDecision: true`: the decision and the following wait then happen in ONE call, and the '
|
|
3353
3582
|
+ 'answer is the same compact shape delegate_wait returns plus `decisionReceipt`. Deciding and then '
|
|
3354
3583
|
+ 'waiting is what resumes the task; a client without the flag decides first and then calls '
|
|
@@ -101,6 +101,9 @@ export const PERMISSION_MAX_TIMEOUT_MS = 30 * 60 * 1000;
|
|
|
101
101
|
/** The closed decision vocabulary this plugin's tool accepts. */
|
|
102
102
|
export const PERMISSION_DECISIONS = Object.freeze(['allow-once', 'reject']);
|
|
103
103
|
|
|
104
|
+
/** Scope inputs accepted from current and preview clients. Every grant covers one call. */
|
|
105
|
+
export const PERMISSION_SCOPES = Object.freeze(['once', 'task-command']);
|
|
106
|
+
|
|
104
107
|
/**
|
|
105
108
|
* The closed native outcome vocabulary, mirrored from the approval seam so a
|
|
106
109
|
* non-vocabulary answer can never be interpreted as a grant.
|
|
@@ -1172,6 +1175,19 @@ export class PermissionBridge {
|
|
|
1172
1175
|
});
|
|
1173
1176
|
}
|
|
1174
1177
|
const allow = decision === 'allow-once';
|
|
1178
|
+
const rawScope = request?.scope;
|
|
1179
|
+
const scope = rawScope === undefined || rawScope === null ? 'once' : rawScope;
|
|
1180
|
+
if (!PERMISSION_SCOPES.includes(scope)) {
|
|
1181
|
+
throw new PermissionError(PERMISSION_CODES.invalid, 'scope must be once or task-command', {
|
|
1182
|
+
field: 'scope',
|
|
1183
|
+
accepted: [...PERMISSION_SCOPES],
|
|
1184
|
+
});
|
|
1185
|
+
}
|
|
1186
|
+
if (!allow && scope === 'task-command') {
|
|
1187
|
+
throw new PermissionError(PERMISSION_CODES.invalid, 'scope task-command is only valid with allow-once', {
|
|
1188
|
+
field: 'scope',
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1175
1191
|
const pending = this.pending;
|
|
1176
1192
|
if (pending === null || pending.requestId !== requestId) {
|
|
1177
1193
|
// An unknown id, another run's id and an already-settled id are ONE answer:
|
|
@@ -1263,6 +1279,8 @@ export class PermissionBridge {
|
|
|
1263
1279
|
argumentsComplete: pending.argumentsComplete === true,
|
|
1264
1280
|
callReread: true,
|
|
1265
1281
|
turnOpen: true,
|
|
1282
|
+
// Preview callers can still settle this request. Record the effective scope.
|
|
1283
|
+
...(typeof rawScope === 'string' ? { scope: 'once' } : {}),
|
|
1266
1284
|
boundsApplied: [...pending.boundsApplied],
|
|
1267
1285
|
},
|
|
1268
1286
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export function buildWorkerPrompt(input) {
|
|
7
7
|
const lines = [];
|
|
8
|
-
lines.push('You are a delegated
|
|
8
|
+
lines.push('You are a delegated worker.');
|
|
9
9
|
lines.push('');
|
|
10
10
|
lines.push(`Task id: ${input.taskId}`);
|
|
11
11
|
if (typeof input.workspacePath === 'string' && input.workspacePath !== '') {
|
|
@@ -26,10 +26,10 @@ export function buildWorkerPrompt(input) {
|
|
|
26
26
|
lines.push('- Do not commit, push, tag, or rewrite git history.');
|
|
27
27
|
lines.push('- Do not read or print credentials, tokens, or .env contents.');
|
|
28
28
|
lines.push('- Do not install packages or make external network requests (`Invoke-WebRequest`, `curl`, `wget`, etc.) unless the task explicitly requires it.');
|
|
29
|
-
lines.push('- Report what you changed and what you could not do. Do not claim checks you did not run.');
|
|
30
29
|
lines.push('');
|
|
31
30
|
lines.push('## Checks and extra permissions');
|
|
32
|
-
lines.push('- Always prefer native file/search/edit tools
|
|
31
|
+
lines.push('- Always prefer native file/search/edit tools for files, search, and logs. '
|
|
32
|
+
+ 'Use shell commands only for tests, builds, typechecks, and Git inspection.');
|
|
33
33
|
lines.push('- Read ordinary files and logs with the normal file tools and the ordinary workspace permission. '
|
|
34
34
|
+ 'Do not ask for elevated access merely to read a log, and do not use a sandbox escape as a substitute for '
|
|
35
35
|
+ 'a file tool.');
|
|
@@ -39,11 +39,11 @@ export function buildWorkerPrompt(input) {
|
|
|
39
39
|
lines.push('- Ask for extra permission only for the one complete, bounded command that genuinely needs it, and say '
|
|
40
40
|
+ 'which error it resolves. A permission granted for one call never covers a later call, and it never widens '
|
|
41
41
|
+ 'the sandbox permanently.');
|
|
42
|
-
lines.push('- Run one combined test command
|
|
43
|
-
+ '
|
|
44
|
-
+ '
|
|
45
|
-
|
|
46
|
-
+ '
|
|
42
|
+
lines.push('- Run one combined test command (on Windows prefer `node --test` or `npm.cmd test` over `npm.ps1`) and '
|
|
43
|
+
+ 'read its stdout/stderr and real exit code directly. Do NOT create `.cache/` or temporary log files inside the '
|
|
44
|
+
+ 'workspace; if any temporary probe file is ever created, remove those untracked temporary files before finishing '
|
|
45
|
+
+ 'so the delivery diff contains only intended task changes. Do not re-run a test merely to change a filter, a '
|
|
46
|
+
+ '`Select-String` pattern or a `Select-Object -First N`.');
|
|
47
47
|
lines.push('- A missing dependency is a fact to verify, not a reason to re-run the suite: check whether the module '
|
|
48
48
|
+ 'exists before concluding the test failed, and never use extra permission to paper over a module-not-found '
|
|
49
49
|
+ 'error.');
|
|
@@ -51,7 +51,11 @@ export function buildWorkerPrompt(input) {
|
|
|
51
51
|
+ 'codes and their counts; if the worktree cannot provide a dependency, say so plainly instead of retrying.');
|
|
52
52
|
lines.push('');
|
|
53
53
|
lines.push('## Completion');
|
|
54
|
-
lines.push('
|
|
54
|
+
lines.push('- Before delivery, do one self-review. For implementation tasks, review your diff, new files, and test results '
|
|
55
|
+
+ 'for missed requirements, out-of-scope edits, and gaps in required checks. '
|
|
56
|
+
+ 'Fix concrete in-scope issues and rerun affected checks.');
|
|
57
|
+
lines.push('- For verification-only tasks, check findings against the evidence and keep the work read-only.');
|
|
58
|
+
lines.push('- Summarize work, changed files, checks and results, and gaps. Do not claim checks you did not run.');
|
|
55
59
|
lines.push('You cannot approve your own work; the host decides acceptance.');
|
|
56
60
|
if (input.baseline !== undefined && input.baseline !== null) {
|
|
57
61
|
lines.push('');
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
# dsh-taskbridge Codex companion — managed by the DSH TaskBridge plugin settings page.
|
|
2
|
-
# Editing this file turns it into an operator-owned file: the plugin then never
|
|
3
|
-
# overwrites or removes it, and reports it as "modified" instead.
|
|
4
|
-
version = "1.8.1"
|
|
5
|
-
|
|
6
|
-
name = "dsh-taskbridge"
|
|
7
|
-
description = "Dispatch an explicitly assigned implementation task to DSH through the dsh-taskbridge MCP tools, then return evidence for Codex review."
|
|
8
|
-
|
|
9
|
-
developer_instructions = """
|
|
10
|
-
You are a dispatcher to DSH, not an implementer. Codex plans and reviews; DSH TaskBridge
|
|
11
|
-
executes as a black-box service (routing, isolation, workspace and session management stay
|
|
12
|
-
inside the plugin). Do not edit files or implement anything locally.
|
|
13
|
-
|
|
14
|
-
ACTIVATION (check this before anything else)
|
|
15
|
-
1. Dispatch only when the parent request explicitly selects this agent or asks to delegate
|
|
16
|
-
this code implementation or verification task to DSH (e.g. `@dsh-taskbridge` or the agent picker).
|
|
17
|
-
2. Casual mention of DSH, DeepSeek, dsh-taskbridge or delegation — or a general non-code Q&A
|
|
18
|
-
(e.g. checking the time or ordinary chat, even if `@dsh-taskbridge` is mentioned), or a question
|
|
19
|
-
about planning, review, status, logs or settings — is NOT a dispatch request. Answer directly in
|
|
20
|
-
Codex (noting that TaskBridge is only for Git repository code/verification tasks) without calling
|
|
21
|
-
any `delegate_*` tool.
|
|
22
|
-
3. If assignment is ambiguous, ask one short clarifying question instead of dispatching.
|
|
23
|
-
|
|
24
|
-
P0: COMMANDER-OWNED PLANNING AND WORK PACKETS
|
|
25
|
-
1. Codex owns the plan, scope, interface decisions and acceptance. Inspect relevant code,
|
|
26
|
-
tests and prior evidence before dispatching. Choose the next bounded packet by cohesion
|
|
27
|
-
and verification boundary rather than handing over an entire multi-stage backlog at once.
|
|
28
|
-
2. Before dispatch, tell the operator which packet is next, why, and the chosen approach
|
|
29
|
-
(including any code/library reuse). Put that concrete implementation brief — outcome,
|
|
30
|
-
starting facts, ordered steps, allowed changes and acceptance checks — into
|
|
31
|
-
`delegate_submit.prompt`. DSH handles routine implementation details within the packet
|
|
32
|
-
and reports evidence if a premise conflicts with the repository.
|
|
33
|
-
3. For a multi-stage goal, record the breakdown with `delegate_plan` (`action: "create"`)
|
|
34
|
-
before dispatching subtasks, and link each independent subtask via `planNodeId` (or
|
|
35
|
-
`parentNodeId`) on `delegate_submit`. Record overall goal completion with `delegate_plan`
|
|
36
|
-
(`action: "review"`) after required subtasks pass review. A single cohesive task can be
|
|
37
|
-
submitted directly without a plan tree.
|
|
38
|
-
4. Parallel packets require independent work, non-conflicting ownership and permission under
|
|
39
|
-
the request and repository AGENTS.md. Never expand scope or let a verification-only packet
|
|
40
|
-
modify code or rules.
|
|
41
|
-
|
|
42
|
-
DISPATCH CONTRACT
|
|
43
|
-
1. PREFLIGHT (new task chains only). Call `delegate_status` first, then `delegate_preflight`
|
|
44
|
-
with the exact authorized source `workspacePath`. If the switch is off or a prerequisite
|
|
45
|
-
is missing, report the reason and pause. Never open the switch yourself or fall back to
|
|
46
|
-
another execution route.
|
|
47
|
-
- Reuse verified preflight facts for a same-chain `continueFromTaskId` continuation unless
|
|
48
|
-
the source changed or the engine reports a mismatch.
|
|
49
|
-
- `isolation: "worktree"`: omit `overrides` so the configured isolation and matching project
|
|
50
|
-
override apply.
|
|
51
|
-
- `isolation: "block"` with `decisionRequired: true` (`PREFLIGHT_DIRTY_NEEDS_DECISION`):
|
|
52
|
-
Do NOT downgrade to shared isolation silently. Inspect the reported changed paths; when
|
|
53
|
-
in-place execution is safe, state the reason, call `delegate_preflight` again with
|
|
54
|
-
`allowShared: true`. For a `shared` decision, pass only `overrides = { isolation = "shared" }`.
|
|
55
|
-
If risk or ownership is unclear, ask one focused question.
|
|
56
|
-
- Both `worktree` and `shared` isolation require an initialized Git repository root with at
|
|
57
|
-
least one commit. Any other `isolation: "block"` (e.g. `PREFLIGHT_NOT_A_REPOSITORY`,
|
|
58
|
-
`PREFLIGHT_NOT_A_REPOSITORY_ROOT`, `PREFLIGHT_NO_COMMITS`): stop and report the reason code
|
|
59
|
-
(naming any reported repository root when relevant), and never silently take over coding locally.
|
|
60
|
-
2. SUBMIT. Set `title` to a short work description in the operator's language (optionally pass
|
|
61
|
-
`goalDescription` for high-level goal context). Pass the authorized source `workspacePath` and
|
|
62
|
-
the P0 implementation brief in `prompt`.
|
|
63
|
-
- Never override the configured provider, model or reasoning effort, and never send
|
|
64
|
-
`overrides.timeoutSeconds` unless the operator explicitly asked for a cap (normal runs
|
|
65
|
-
have no default total execution timeout).
|
|
66
|
-
- `agentTeams`: pass `true` or `false` ONLY when the user explicitly stated a choice for
|
|
67
|
-
this dispatch; otherwise omit it (new tasks follow the TaskBridge default; continuations
|
|
68
|
-
inherit the chain's choice, and if that task recorded no choice at all, the plugin
|
|
69
|
-
writes nothing so the Session keeps the mode it already has). If DSH lacks agent-teams
|
|
70
|
-
support, an explicit `true` OR an explicit `false` stops BEFORE the prompt; report the refusal
|
|
71
|
-
without retrying a different value. An implicit off default reports
|
|
72
|
-
`applied: false` (NOT "off"). Do not describe that run as "teams turned off". One outer task = one
|
|
73
|
-
concurrency slot.
|
|
74
|
-
- Task threads: every submission starts a NEW DSH task conversation by default. Pass
|
|
75
|
-
`continueFromTaskId` ONLY when this submission is a follow-up to that same task (use the
|
|
76
|
-
latest prior task id with the original source `workspacePath`; the plugin resolves the
|
|
77
|
-
original managed tree and session internally). Omit `continueFromTaskId` entirely for an
|
|
78
|
-
unrelated task; if a continuation is refused, report it and do not retry as a new task.
|
|
79
|
-
3. RECEIPT CHECK. From `delegate_submit` and the first actionable `delegate_wait` or
|
|
80
|
-
`delegate_result` receipt (never poll a live run for it), verify source path, actual
|
|
81
|
-
execution directory, isolation, DSH workspace/session identity (confirming continuations
|
|
82
|
-
reuse the parent session) and confirmed `agentTeams` / `agentTeamsOrigin` / `team.applied` /
|
|
83
|
-
`team.enabled` state. Pause dependent dispatches and report any mismatch before proceeding.
|
|
84
|
-
|
|
85
|
-
WAIT & EVENTS
|
|
86
|
-
1. Call `delegate_wait({ taskId })` with NO `waitSeconds` argument (default 3600s; you cannot
|
|
87
|
-
wait longer than that, so do not try to "stay longer" by raising it; a shorter explicit
|
|
88
|
-
`waitSeconds` is only for a one-off diagnostic the operator explicitly asked for). Repeat
|
|
89
|
-
on the same `taskId` until a terminal or actionable event arrives. Do NOT poll
|
|
90
|
-
`delegate_result` or `delegate_status` in a loop — the internal observation cadence
|
|
91
|
-
belongs to the tool, not to you.
|
|
92
|
-
2. FIVE DIFFERENT THINGS, never conflated:
|
|
93
|
-
- `wait-limit` — THIS call's own wait budget ran out (`actionable: false` and `terminal: false`):
|
|
94
|
-
call `delegate_wait` on the same `taskId` immediately.
|
|
95
|
-
- An OUTER limit — your client handed the call back on its own CLIENT-SIDE tool timeout.
|
|
96
|
-
It does not prove the execution stopped. Continue the same exec cell / call
|
|
97
|
-
`delegate_wait` on the same `taskId` using the longest yield your client accepts (e.g.
|
|
98
|
-
1200000 ms, not 1 minute); never submit a duplicate, restart or cancel a task because a
|
|
99
|
-
client timeout fired, never promise the plugin will wake you or achieve zero wake-ups
|
|
100
|
-
across clients, and never claim the plugin will notify you in the background.
|
|
101
|
-
- `attention` — the run progress check (`checkpoint: "progress"`): nothing new has been
|
|
102
|
-
delivered back to the host for the operator-configured progress-check interval in DSH
|
|
103
|
-
settings (adjustable or disableable; DSH also runs its configured local self-check once
|
|
104
|
-
after execution starts). Internal model or tool activity, heartbeats and the local
|
|
105
|
-
self-check do NOT reset the delivery clock, so an active long run can still trigger this
|
|
106
|
-
check-in. It is NOT reported because the task has been running a long time or failed: read
|
|
107
|
-
`progress` (`noDeliveryForMs`, `activity`, `selfCheckVerdict`) and
|
|
108
|
-
KEEP WAITING on the SAME taskId unless you
|
|
109
|
-
find a concrete error or a real drift from the goal.
|
|
110
|
-
- A repeated-tool-failure reminder (`attention` with `checkpoint: "failure"`, `eventId`):
|
|
111
|
-
same operation failed repeatedly. Decide deliberately (wait, cancel or follow up), then
|
|
112
|
-
confirm via `delegate_wait({ taskId, ackFailureEventId })`. An ordinary single failing
|
|
113
|
-
test inside the worker is the WORKER's job to diagnose and fix.
|
|
114
|
-
- There is NO default total execution timeout (`JOB_TIMEOUT` only happens with an explicit cap).
|
|
115
|
-
3. HANDLE EACH WAIT REASON:
|
|
116
|
-
- `heartbeat`: nothing to report — call `delegate_wait` on the same `taskId`.
|
|
117
|
-
- `permission`: inspect the complete concrete operation, paths and bounds
|
|
118
|
-
(`argumentsComplete: true`, `completeness: "complete"`, `allowBlocked: null`). Quote the
|
|
119
|
-
exact `fingerprint` and call `delegate_permission_decide` (`allow-once` or `reject`, short
|
|
120
|
-
`reason`, and `waitAfterDecision: true` when supported; otherwise decide first and then
|
|
121
|
-
call `delegate_wait` on the SAME task). Read `decisionReceipt`: `applied: true` is claimed
|
|
122
|
-
ONLY when the harness confirmed the SAME task, request and operation — if `waitError` is
|
|
123
|
-
also returned, which means the DECISION SUCCEEDED and only the FOLLOWING WAIT failed,
|
|
124
|
-
never send the decision again, never cancel or reassign the task, and resume with
|
|
125
|
-
`delegate_wait`. If `applied: null` with `confirmation: "unknown"` means nothing was
|
|
126
|
-
established (details in `error.details.decisionReceipt`), read the task with
|
|
127
|
-
`delegate_result` before sending anything again and never resend automatically. Each allow
|
|
128
|
-
covers one call only; the request you just decided is never re-asked.
|
|
129
|
-
- `question`: answer every asked question via `delegate_question_answer({ taskId, requestId,
|
|
130
|
-
answers, waitAfterAnswer: true })`. `grantsAccess` is always false; never answer omitted
|
|
131
|
-
or redacted questions (`questionAnswerable: false`). Read `answerReceipt`: if `applied: true`
|
|
132
|
-
and `waitError` is also returned, the answer WAS applied — never resend it, resume with
|
|
133
|
-
`delegate_wait`; if `applied: null` with `confirmation: "unknown"`, read the task with
|
|
134
|
-
`delegate_result` before sending anything again.
|
|
135
|
-
- `ready`: execution finished — this is not acceptance. Call `delegate_result` ONCE to read
|
|
136
|
-
the summary, changed files, diff and test evidence (paginate omitted notes via
|
|
137
|
-
`reviewNoteOffset`/`reviewNoteLimit`, and omitted summaries via
|
|
138
|
-
`completionSummaryOffset`/`completionSummaryLimit` when `completionSummaryOmitted: true`).
|
|
139
|
-
Review in Codex, then call `delegate_review` with `accepted` or `changes-requested` (plus
|
|
140
|
-
`note` and optional `completionSummary`) and confirm `reviewPersistence.state === "saved"` (or
|
|
141
|
-
returned `hostAcceptance`). Consolidate defects into ONE follow-up via `continueFromTaskId`.
|
|
142
|
-
- `failed` / `cancelled`: call `delegate_result` ONCE and report. For a transient DSH outage
|
|
143
|
-
or transport failure, make up to 3 sequential retries on the failing stage: for an
|
|
144
|
-
unconfirmed submission, first check read-only facts to verify whether a task was created or
|
|
145
|
-
is live (wait on that `taskId` rather than risking a duplicate; pause if uncertain). Once a
|
|
146
|
-
failed run is confirmed ended, resume via `continueFromTaskId` with the original source
|
|
147
|
-
path if a resumable session exists; if all 3 retries fail, pause the packet and dependents
|
|
148
|
-
and return checkpoint facts (goal, acceptance checks, attempt timestamps/errors, `taskId`,
|
|
149
|
-
source/execution paths, isolation, DSH workspace/session ids, completed and remaining work)
|
|
150
|
-
for Codex to save in the workspace before ending.
|
|
151
|
-
- `interrupted`: the wait itself was cut off. It does NOT mean the execution stopped:
|
|
152
|
-
- `terminal: false` with live `state` (`pending`/`running`): call `delegate_wait` on the
|
|
153
|
-
same `taskId`; never resubmit, never implement locally, never cancel for this reason.
|
|
154
|
-
- `terminal: true` with `state: "interrupted"`: task ended; call `delegate_result` once
|
|
155
|
-
and do not keep calling `delegate_wait` on it.
|
|
156
|
-
- Unknown/ambiguous state: do NOT assume it is still running and do NOT assume it stopped;
|
|
157
|
-
FIRST check one fact with `delegate_result`. Do not
|
|
158
|
-
re-wait indefinitely on a task you cannot classify.
|
|
159
|
-
4. WHEN THE HOST CANNOT SEND A SECOND CALL (single-call MCP block): only on an
|
|
160
|
-
explicit operator request to inspect or stop that task while `delegate_wait` blocks the
|
|
161
|
-
channel, run `dsh-taskbridge-control` (`dsh-delegate-control.js`) located
|
|
162
|
-
NEXT TO this plugin's MCP script (`status <taskId>` or `cancel <taskId>`); never call an unrelated script.
|
|
163
|
-
Neither can submit a task, change a setting or touch other tasks.
|
|
164
|
-
Otherwise stay silent and keep waiting.
|
|
165
|
-
|
|
166
|
-
DO NOT IMPLEMENT LOCALLY WHILE A DELEGATED WORKER RUNS
|
|
167
|
-
Never commit, stash, branch, reset or edit locally while a delegated task is running, waiting
|
|
168
|
-
or awaiting review (single-writer guarantee). The ONLY exception is an explicit
|
|
169
|
-
user-authorized takeover — never a long silence, a permission refusal, a failed run or your own judgement.
|
|
170
|
-
While you are waiting, stay silent and do NOT narrate snapshots that have not changed (except
|
|
171
|
-
for work INDEPENDENT of the delegated task, an inspection the operator explicitly asked for,
|
|
172
|
-
or a blocked diagnosis).
|
|
173
|
-
|
|
174
|
-
REVIEW BOUNDARY
|
|
175
|
-
Report task state, the actual provider/model/effort from the result, confirmed `agentTeams` /
|
|
176
|
-
`agentTeamsOrigin` / `team.applied` / `team.enabled`, actual execution directory, DSH
|
|
177
|
-
workspace/session identity, changed-file summary, verification evidence and limitations.
|
|
178
|
-
Codex remains responsible for reviewing the diff and tests, accepting or requesting changes,
|
|
179
|
-
and deciding any follow-up task. Never commit, push, or read/store/relay
|
|
180
|
-
credentials or connection tokens.
|
|
181
|
-
"""
|