dsh-taskbridge 1.8.0 → 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 +32 -0
- package/README.md +246 -231
- package/antigravity/agents/dsh-taskbridge.md +17 -14
- package/antigravity/skills/dsh-taskbridge/SKILL.md +40 -27
- 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 -119
- 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/conversation-placement.md +7 -6
- package/docs/releases/1.8.0.zh.md +16 -16
- package/docs/releases/1.8.1.zh.md +24 -0
- 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 +74 -3
- package/lib/client.js +7 -7
- package/locale/en.json +7 -7
- package/locale/zh.json +7 -7
- package/package.json +11 -4
- package/src/antigravity/installer.js +1099 -1046
- package/src/antigravity/seam.js +142 -142
- package/src/client/api.js +258 -16
- package/src/client/index.jsx +130 -26
- package/src/client/task-cleanup.js +130 -5
- package/src/codex/agent-ownership.js +72 -12
- package/src/codex/installer.js +691 -268
- package/src/config/defaults.js +11 -15
- package/src/http/execution-plane.js +17 -0
- package/src/http/user-plane.js +17 -1
- package/src/index.d.ts +9 -1
- package/src/index.js +86 -64
- package/src/jobs/engine.js +279 -5
- package/src/jobs/history.js +18 -2
- package/src/jobs/plan-store.js +83 -0
- package/src/jobs/record-cleanup.js +714 -195
- package/src/mcp/server.js +271 -38
- package/src/mcp/wait.js +34 -15
- package/src/runtime/agent-runner.js +1 -0
- package/src/runtime/permissions.js +18 -0
- package/src/runtime/session-placement.js +36 -1
- package/src/runtime/worker-prompt.js +14 -9
- package/src/workspace/worktrees.js +155 -1
- package/codex/dsh-taskbridge.toml +0 -170
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,
|
|
@@ -473,9 +520,12 @@ export const TOOLS = Object.freeze([
|
|
|
473
520
|
title: 'Wait for a task to need you',
|
|
474
521
|
description: 'Follow ONE task this connection submitted and return as soon as it needs the host. '
|
|
475
522
|
+ 'A single call blocks for up to waitSeconds (default 3600) and returns a COMPACT answer: '
|
|
476
|
-
+ '`reason` is `permission` (a per-call request is pending), `
|
|
477
|
-
+ '
|
|
478
|
-
+ '
|
|
523
|
+
+ '`reason` is `permission` (a per-call request is pending), `question` (the worker asked a native '
|
|
524
|
+
+ 'question that needs `delegate_question_answer`), `attention` (a progress check because nothing new was '
|
|
525
|
+
+ 'returned to the host for the operator-configured delivery interval in DSH settings — 40 minutes by '
|
|
526
|
+
+ 'default; internal worker activity does not reset this clock and it does NOT imply the run is stuck — '
|
|
527
|
+
+ 'or a `repeated-tool-failure` reminder), `ready` (the run ended and is awaiting host review), `failed`, '
|
|
528
|
+
+ '`cancelled` or `interrupted`. '
|
|
479
529
|
+ 'An `attention` answer may instead carry a `failure` block (kind `repeated-tool-failure`, with '
|
|
480
530
|
+ 'a stable `eventId`, toolName/failureCode/consecutive): the worker repeated the SAME operation and failed the same way '
|
|
481
531
|
+ 'several times in a row. It is a question for the host, and it is REDELIVERED until you acknowledge it with '
|
|
@@ -596,9 +646,9 @@ export const TOOLS = Object.freeze([
|
|
|
596
646
|
+ 'in delegate_result as `permission.pending` (state stays `running`, phase `awaiting-permission`). '
|
|
597
647
|
+ 'Read `permission.pending.arguments`/`argumentKeys` for the exact operation and `permission.pending.reason` '
|
|
598
648
|
+ 'for the asker\u2019s claim — the claim is not the operation. Answer `allow-once` to let THAT ONE call '
|
|
599
|
-
+ 'proceed, or `reject` to keep it denied
|
|
649
|
+
+ 'proceed, or `reject` to keep it denied. Every later escalation requires a separate decision. '
|
|
600
650
|
+ 'This cannot grant an account, a workspace or a standing policy, cannot change settings, credentials, '
|
|
601
|
-
+ '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. '
|
|
602
652
|
+ '`allow-once` REQUIRES the pending request\u2019s `fingerprint` and is refused when `permission.pending.'
|
|
603
653
|
+ 'completeness` is not `complete` (the operation was shortened by a bound, so an allow cannot be granted '
|
|
604
654
|
+ 'on it). `reject` needs neither and is therefore always available. '
|
|
@@ -642,6 +692,12 @@ export const TOOLS = Object.freeze([
|
|
|
642
692
|
+ 'the exact operation it grants, and an allow that omits it is refused. Optional for `reject` (a '
|
|
643
693
|
+ 'refusal is safe without it); when supplied, a request whose operation no longer matches is refused.',
|
|
644
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
|
+
},
|
|
645
701
|
waitAfterDecision: {
|
|
646
702
|
type: 'boolean',
|
|
647
703
|
description: 'OPTIONAL, default false: the historical behaviour — decide only, and the answer is the '
|
|
@@ -817,6 +873,10 @@ export const TOOLS = Object.freeze([
|
|
|
817
873
|
+ 'note WITH the same summary is an idempotent no-op, and a different summary \u2014 or adding one to an '
|
|
818
874
|
+ 'already recorded review \u2014 is refused like any other different conclusion.',
|
|
819
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
|
+
},
|
|
820
880
|
},
|
|
821
881
|
required: ['taskId', 'decision', 'note'],
|
|
822
882
|
additionalProperties: false,
|
|
@@ -1036,6 +1096,8 @@ function canonicalizeToolDescription(tool, key, field) {
|
|
|
1036
1096
|
* {@link validateArgs} — and never reintroduced anywhere else.
|
|
1037
1097
|
*/
|
|
1038
1098
|
export const MCP_ONLY_ARGUMENTS = Object.freeze({
|
|
1099
|
+
delegate_submit: Object.freeze(['autoPreflight', 'allowShared', 'wait', 'waitSeconds']),
|
|
1100
|
+
delegate_result: Object.freeze(['includeDiff']),
|
|
1039
1101
|
delegate_permission_decide: Object.freeze(['waitAfterDecision']),
|
|
1040
1102
|
delegate_question_answer: Object.freeze(['waitAfterAnswer']),
|
|
1041
1103
|
});
|
|
@@ -1235,6 +1297,17 @@ function validateArgs(tool, args) {
|
|
|
1235
1297
|
throw new McpError('MCP_ARGUMENT_ENUM', `${tool.name}.${key} must be one of ${declared.enum.join(', ')}`);
|
|
1236
1298
|
}
|
|
1237
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
|
+
}
|
|
1238
1311
|
if (tool.name === 'delegate_result') {
|
|
1239
1312
|
if (out.reviewNoteLimit !== undefined && out.reviewNoteOffset === undefined) {
|
|
1240
1313
|
throw new McpError('MCP_ARGUMENT_REQUIRED', 'delegate_result.reviewNoteLimit requires reviewNoteOffset');
|
|
@@ -1401,19 +1474,16 @@ function compactJson(value) {
|
|
|
1401
1474
|
}
|
|
1402
1475
|
|
|
1403
1476
|
/**
|
|
1404
|
-
* Whether a projected value fits the tool-text bound
|
|
1477
|
+
* Whether a projected value fits the tool-text bound when serialized compactly.
|
|
1405
1478
|
*
|
|
1406
|
-
*
|
|
1407
|
-
*
|
|
1408
|
-
*
|
|
1409
|
-
* push past {@link MAX_TOOL_TEXT_CHARS}.
|
|
1479
|
+
* Compact JSON (no indentation whitespace) is what {@link boundedJson} publishes to MCP
|
|
1480
|
+
* clients so wait, permission, and result turns avoid wasting commander context tokens
|
|
1481
|
+
* on formatting spaces.
|
|
1410
1482
|
* @param {unknown} value - projected JSON value.
|
|
1411
1483
|
* @returns {boolean} true when the value fits.
|
|
1412
1484
|
*/
|
|
1413
1485
|
function fitsBound(value) {
|
|
1414
|
-
|
|
1415
|
-
if (compact.length > MAX_TOOL_TEXT_CHARS) return false;
|
|
1416
|
-
return JSON.stringify(value, null, 2).length <= MAX_TOOL_TEXT_CHARS;
|
|
1486
|
+
return compactJson(value).length <= MAX_TOOL_TEXT_CHARS;
|
|
1417
1487
|
}
|
|
1418
1488
|
|
|
1419
1489
|
/**
|
|
@@ -2300,7 +2370,7 @@ function boundedJson(value) {
|
|
|
2300
2370
|
} catch {
|
|
2301
2371
|
return refuseResult('MCP_RESULT_UNSERIALIZABLE', 'the delegated call answered with a value that could not be serialized');
|
|
2302
2372
|
}
|
|
2303
|
-
if (fitsBound(value)) return { text: JSON.stringify(redactDeepStrings(value)
|
|
2373
|
+
if (fitsBound(value)) return { text: JSON.stringify(redactDeepStrings(value)), isError: false };
|
|
2304
2374
|
|
|
2305
2375
|
const stages = [
|
|
2306
2376
|
{ executionText: TRUNCATED_FIELD_CAPS.executionTextChars, reviewText: TRUNCATED_FIELD_CAPS.reviewTextChars, lists: 50, permissionEvidence: 8 },
|
|
@@ -2343,7 +2413,7 @@ function boundedJson(value) {
|
|
|
2343
2413
|
projected.questionAnswerable = isQuestionAnswerable(projected.question);
|
|
2344
2414
|
projected.grantsAccess = false;
|
|
2345
2415
|
}
|
|
2346
|
-
return JSON.stringify(redactDeepStrings(projected)
|
|
2416
|
+
return JSON.stringify(redactDeepStrings(projected));
|
|
2347
2417
|
};
|
|
2348
2418
|
for (const stage of stages) {
|
|
2349
2419
|
const text = apply(stage);
|
|
@@ -2493,8 +2563,6 @@ function rescueQuestion(value, fullTextChars) {
|
|
|
2493
2563
|
payload.failureAck = questionRescueAck;
|
|
2494
2564
|
}
|
|
2495
2565
|
const redacted = redactDeepStrings(payload);
|
|
2496
|
-
const pretty = JSON.stringify(redacted, null, 2);
|
|
2497
|
-
if (pretty.length <= MAX_TOOL_TEXT_CHARS) return { text: pretty, isError: false };
|
|
2498
2566
|
const compact = JSON.stringify(redacted);
|
|
2499
2567
|
if (compact.length <= MAX_TOOL_TEXT_CHARS) return { text: compact, isError: false };
|
|
2500
2568
|
}
|
|
@@ -2613,7 +2681,7 @@ function permissionRescue(value, fullTextChars) {
|
|
|
2613
2681
|
permissionDecidable: false,
|
|
2614
2682
|
truncation: truncationBlock(records, fullTextChars, entries),
|
|
2615
2683
|
});
|
|
2616
|
-
return JSON.stringify(redactDeepStrings(payload)
|
|
2684
|
+
return JSON.stringify(redactDeepStrings(payload));
|
|
2617
2685
|
}
|
|
2618
2686
|
if (entries.length === 0) {
|
|
2619
2687
|
// A RECEIPT-ONLY rescue: no live request survived to publish, but the decision must
|
|
@@ -2627,7 +2695,7 @@ function permissionRescue(value, fullTextChars) {
|
|
|
2627
2695
|
actionable: true,
|
|
2628
2696
|
truncation: truncationBlock(records, fullTextChars, entries),
|
|
2629
2697
|
});
|
|
2630
|
-
return JSON.stringify(redactDeepStrings(payload)
|
|
2698
|
+
return JSON.stringify(redactDeepStrings(payload));
|
|
2631
2699
|
}
|
|
2632
2700
|
const tasks = entries.map((entry) => {
|
|
2633
2701
|
const pending = render(entry);
|
|
@@ -2643,7 +2711,7 @@ function permissionRescue(value, fullTextChars) {
|
|
|
2643
2711
|
const payload = withReceipt(entries.length === 1 && entries[0].path === 'task'
|
|
2644
2712
|
? { ok: value.ok, task: tasks[0], truncation: truncationBlock(records, fullTextChars, entries) }
|
|
2645
2713
|
: { ok: value.ok, tasks, truncation: truncationBlock(records, fullTextChars, entries) });
|
|
2646
|
-
return JSON.stringify(redactDeepStrings(payload)
|
|
2714
|
+
return JSON.stringify(redactDeepStrings(payload));
|
|
2647
2715
|
};
|
|
2648
2716
|
}
|
|
2649
2717
|
|
|
@@ -2702,13 +2770,13 @@ function refuseResult(code, message, extra = {}) {
|
|
|
2702
2770
|
ok: false,
|
|
2703
2771
|
error: { code, message, ...extra },
|
|
2704
2772
|
truncation: { truncated: true, fullResultIncluded: false },
|
|
2705
|
-
})
|
|
2773
|
+
}));
|
|
2706
2774
|
if (text.length <= MAX_TOOL_TEXT_CHARS) return { text, isError: true };
|
|
2707
2775
|
// The refusal itself is larger than the bound, which only happens if the bound
|
|
2708
2776
|
// is configured absurdly small. This minimal form is still valid JSON and still
|
|
2709
2777
|
// says the answer was refused rather than delivered.
|
|
2710
2778
|
return {
|
|
2711
|
-
text: JSON.stringify({ ok: false, error: { code, truncated: true }, truncation: { truncated: true, fullResultIncluded: false } }
|
|
2779
|
+
text: JSON.stringify({ ok: false, error: { code, truncated: true }, truncation: { truncated: true, fullResultIncluded: false } }),
|
|
2712
2780
|
isError: true,
|
|
2713
2781
|
};
|
|
2714
2782
|
}
|
|
@@ -2841,6 +2909,25 @@ export function createMcpServer(options) {
|
|
|
2841
2909
|
let result;
|
|
2842
2910
|
if (name === 'delegate_wait') {
|
|
2843
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
|
+
}
|
|
2844
2931
|
} else if (name === 'delegate_permission_decide') {
|
|
2845
2932
|
result = await decidePermissionAnswer(payload, context);
|
|
2846
2933
|
} else if (name === 'delegate_question_answer') {
|
|
@@ -2848,6 +2935,23 @@ export function createMcpServer(options) {
|
|
|
2848
2935
|
} else if (name === 'delegate_metrics') {
|
|
2849
2936
|
// A census of THIS process: no plane route, no task identity, nothing to change.
|
|
2850
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
|
+
}
|
|
2851
2955
|
} else {
|
|
2852
2956
|
result = await callExecution(route, payload);
|
|
2853
2957
|
}
|
|
@@ -2903,6 +3007,126 @@ export function createMcpServer(options) {
|
|
|
2903
3007
|
}
|
|
2904
3008
|
}
|
|
2905
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
|
+
|
|
2906
3130
|
/**
|
|
2907
3131
|
* One `delegate_wait` call: a bounded loop of internal observations.
|
|
2908
3132
|
*
|
|
@@ -3346,11 +3570,14 @@ export function createMcpServer(options) {
|
|
|
3346
3570
|
+ 'the parent\u2019s recorded execution checkout and DSH Session internally, so it passes the parent\u2019s original '
|
|
3347
3571
|
+ 'source path again and never substitutes an internal execution location for it. A parent that '
|
|
3348
3572
|
+ 'is unknown, still running, removed or belongs to another source repository is refused '
|
|
3349
|
-
+ '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 '
|
|
3350
3576
|
+ 'pauses that call and reports it as `permission.pending` in delegate_result; while it waits the '
|
|
3351
|
-
+ 'task stays `running` with phase `awaiting-permission`. Answer
|
|
3352
|
-
+ 'delegate_permission_decide (`allow-once` or `reject`). That decision
|
|
3353
|
-
+ '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 '
|
|
3354
3581
|
+ '`waitAfterDecision: true`: the decision and the following wait then happen in ONE call, and the '
|
|
3355
3582
|
+ 'answer is the same compact shape delegate_wait returns plus `decisionReceipt`. Deciding and then '
|
|
3356
3583
|
+ 'waiting is what resumes the task; a client without the flag decides first and then calls '
|
|
@@ -3362,8 +3589,9 @@ export function createMcpServer(options) {
|
|
|
3362
3589
|
+ 'When an APPLIED decision\'s follow-up wait fails or is cancelled, the call still succeeds with that '
|
|
3363
3590
|
+ 'receipt, `reason: null` and a `waitError` block: only the waiting ended, the execution was not '
|
|
3364
3591
|
+ 'stopped, and the decision must not be resent. To follow a task without polling, use '
|
|
3365
|
-
+ 'delegate_wait({ taskId }): one call blocks until the task needs you (permission,
|
|
3366
|
-
+ 'cancelled, interrupted) or until its own one-hour deadline, in which
|
|
3592
|
+
+ 'delegate_wait({ taskId }): one call blocks until the task needs you (permission, question, '
|
|
3593
|
+
+ 'attention, ready, failed, cancelled, interrupted) or until its own one-hour deadline, in which '
|
|
3594
|
+
+ 'case it answers reason '
|
|
3367
3595
|
+ '`wait-limit` with `actionable: false` and you call it again with the same taskId instead of '
|
|
3368
3596
|
+ 'reviewing or resubmitting anything. Omit waitSeconds for normal waiting: the default already '
|
|
3369
3597
|
+ 'covers an hour, it cannot be raised above 3600, and a shorter value is only for a one-off '
|
|
@@ -3379,9 +3607,13 @@ export function createMcpServer(options) {
|
|
|
3379
3607
|
+ 'time limit is an OUTER limit: the observation did not end and the worker did not stop, so continue '
|
|
3380
3608
|
+ 'the SAME exec cell and ask for the longest yield the host supports (roughly 1200000 ms when a '
|
|
3381
3609
|
+ 'yield/pragmas parameter exists, not a minute) instead of re-issuing every second. (c) `attention` '
|
|
3382
|
-
+ 'is
|
|
3383
|
-
+ '
|
|
3384
|
-
+ '
|
|
3610
|
+
+ 'is either a run progress check (nothing new was delivered back to the host for the operator-configured '
|
|
3611
|
+
+ 'delivery interval in DSH settings — 40 minutes by default; internal worker activity, heartbeats, '
|
|
3612
|
+
+ 'permission/question waits and the local self-check do not reset it, and it does NOT imply the run is '
|
|
3613
|
+
+ 'stuck) or a `repeated-tool-failure` reminder while the task still runs. (d) There is NO default total '
|
|
3614
|
+
+ 'execution timeout: an execution timeout (`JOB_TIMEOUT`, reported as a terminal state) only applies when '
|
|
3615
|
+
+ 'an explicit cap is supplied via `overrides.timeoutSeconds` — it is not `wait-limit`, not `attention` '
|
|
3616
|
+
+ 'and not a client-side event. A real '
|
|
3385
3617
|
+ 'failure is worth one de-duplicated reminder; an ordinary single failing test inside the worker is '
|
|
3386
3618
|
+ 'the worker\'s job to fix and is not a host event. '
|
|
3387
3619
|
+ '`interrupted` never means the execution stopped by itself: this call returns it at once '
|
|
@@ -3404,7 +3636,8 @@ export function createMcpServer(options) {
|
|
|
3404
3636
|
+ 'PROGRAM, not the host model: the host\'s own turns, token usage and cost are reported as '
|
|
3405
3637
|
+ '`not-integrated` because this process cannot observe them. '
|
|
3406
3638
|
+ 'When a task reaches `ready`/`awaiting-host-review`, finish YOUR review and record it with '
|
|
3407
|
-
+ 'delegate_review ({ taskId, decision: "accepted" | "changes-requested", note }):
|
|
3639
|
+
+ 'delegate_review ({ taskId, decision: "accepted" | "changes-requested", note, completionSummary? }): '
|
|
3640
|
+
+ 'that call is the '
|
|
3408
3641
|
+ 'only thing that records host acceptance, and until it is made the task stays unreviewed. '
|
|
3409
3642
|
+ 'Completion is never acceptance on its own, and a review cannot approve permissions, change '
|
|
3410
3643
|
+ 'settings or models, merge the diff or create work. The first decision is final for that task; '
|
package/src/mcp/wait.js
CHANGED
|
@@ -166,6 +166,15 @@ const SETTLED_STATE_REASONS = Object.freeze({
|
|
|
166
166
|
interrupted: 'interrupted',
|
|
167
167
|
});
|
|
168
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Fields dropped from `compactTask` during an interactive pause (`permission` / `question`).
|
|
171
|
+
* The host only needs the task identity and live pending request/question to decide and continue;
|
|
172
|
+
* repeating static routing, monitoring history, and empty review persistence on every approval
|
|
173
|
+
* turn wastes commander context tokens. All of them remain present on `attention`, terminal
|
|
174
|
+
* returns, and `delegate_result`.
|
|
175
|
+
*/
|
|
176
|
+
const INTERACTIVE_PAUSE_DROP = new Set(['route', 'hostAcceptance']);
|
|
177
|
+
|
|
169
178
|
/**
|
|
170
179
|
* Compact one observation's task view into what a wait answer carries.
|
|
171
180
|
*
|
|
@@ -173,12 +182,16 @@ const SETTLED_STATE_REASONS = Object.freeze({
|
|
|
173
182
|
* answer small and keeps a diff from reaching a host through the one tool that is
|
|
174
183
|
* supposed to be cheap.
|
|
175
184
|
* @param {object | null | undefined} task - observation `task`.
|
|
185
|
+
* @param {{ interactivePause?: boolean }} [options] - `interactivePause`: omit bulky monitoring
|
|
186
|
+
* and static routing fields on live `permission` / `question` turns.
|
|
176
187
|
* @returns {object} the compact task.
|
|
177
188
|
*/
|
|
178
|
-
export function compactTask(task) {
|
|
189
|
+
export function compactTask(task, options = {}) {
|
|
179
190
|
if (task === null || typeof task !== 'object' || Array.isArray(task)) return {};
|
|
191
|
+
const interactivePause = options?.interactivePause === true;
|
|
180
192
|
const out = {};
|
|
181
193
|
for (const key of TASK_FIELDS) {
|
|
194
|
+
if (interactivePause && INTERACTIVE_PAUSE_DROP.has(key)) continue;
|
|
182
195
|
if (task[key] !== undefined) out[key] = task[key];
|
|
183
196
|
}
|
|
184
197
|
// A wait NEVER carries the review note body: the conclusion's state, time and length are
|
|
@@ -203,15 +216,17 @@ export function compactTask(task) {
|
|
|
203
216
|
: {}),
|
|
204
217
|
};
|
|
205
218
|
}
|
|
206
|
-
if (
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
219
|
+
if (!interactivePause) {
|
|
220
|
+
if (task.reviewPersistence !== undefined) out.reviewPersistence = task.reviewPersistence;
|
|
221
|
+
// Activity and self-check are small, bounded summaries the engine produced for
|
|
222
|
+
// exactly this purpose; they are carried whole rather than re-projected here — EXCEPT
|
|
223
|
+
// the fields a wait must never carry whatever depth they arrive at. An engine (or a
|
|
224
|
+
// fixture) that nested a diff or execution prose inside `activity` would otherwise put
|
|
225
|
+
// evidence on the one answer that is supposed to be cheap, so evidence keys are
|
|
226
|
+
// dropped at any depth.
|
|
227
|
+
if (task.activity !== undefined) out.activity = stripEvidenceFields(task.activity);
|
|
228
|
+
if (task.selfCheck !== undefined) out.selfCheck = stripEvidenceFields(task.selfCheck);
|
|
229
|
+
}
|
|
215
230
|
return out;
|
|
216
231
|
}
|
|
217
232
|
|
|
@@ -310,9 +325,11 @@ function instructionFor(reason, facts = {}) {
|
|
|
310
325
|
+ 'a real drift from the goal. Nothing was cancelled, restarted, resubmitted or re-queued, and this '
|
|
311
326
|
+ 'interval will not be reported again.';
|
|
312
327
|
}
|
|
313
|
-
return 'Nothing has been
|
|
314
|
-
+ '
|
|
315
|
-
+ '
|
|
328
|
+
return 'Nothing new has been returned to the host for the operator-configured delivery interval in DSH '
|
|
329
|
+
+ 'settings (40 minutes by default; internal worker activity does not reset this clock) while the task '
|
|
330
|
+
+ 'is still running. This is a progress check, not a verdict that the run is stuck: inspect the current '
|
|
331
|
+
+ 'activity and elapsed state, and keep waiting on the same taskId unless you find a concrete error or '
|
|
332
|
+
+ 'drift from the goal.';
|
|
316
333
|
case 'ready':
|
|
317
334
|
return 'The run ended and is awaiting host review. Read delegate_result for the diff and evidence; '
|
|
318
335
|
+ 'completion is not host acceptance.';
|
|
@@ -736,14 +753,16 @@ export async function waitForTask(options) {
|
|
|
736
753
|
* @returns {object} compact answer.
|
|
737
754
|
*/
|
|
738
755
|
function answer(reason, observation, facts = {}) {
|
|
739
|
-
const task = compactTask(observation?.task
|
|
756
|
+
const task = compactTask(observation?.task, {
|
|
757
|
+
interactivePause: reason === 'permission' || reason === 'question',
|
|
758
|
+
});
|
|
740
759
|
// A resolved interruption carries the state and terminal flag its resolution decided;
|
|
741
760
|
// every other answer derives them from the reason and the published task.
|
|
742
761
|
const state = facts.resolved === true
|
|
743
762
|
? (facts.resolvedState ?? null)
|
|
744
763
|
: resolvedTaskState(task, reason);
|
|
745
764
|
// The repeated-failure diagnostic, when THAT is what the reminder was about. It is
|
|
746
|
-
// what lets a host tell
|
|
765
|
+
// what lets a host tell the run progress check from "kept failing the same call",
|
|
747
766
|
// which need different decisions. Only the bounded fields the engine produced travel.
|
|
748
767
|
const failure = reason === 'attention' && observation?.failure !== null
|
|
749
768
|
&& typeof observation?.failure === 'object'
|
|
@@ -552,6 +552,7 @@ async function resolvePlacement(deps, request) {
|
|
|
552
552
|
taskId: request?.taskId,
|
|
553
553
|
connectionId: request?.connectionId,
|
|
554
554
|
sourcePath: request?.sourcePath,
|
|
555
|
+
isolation: request?.isolation,
|
|
555
556
|
presetId: request?.placementPresetId,
|
|
556
557
|
});
|
|
557
558
|
return placement;
|
|
@@ -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
|
}
|