@sema-agent/core 7.63.0 → 7.65.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 +725 -0
- package/dist/agents/cc-peer-directory.js +1 -0
- package/dist/agents/cc-peer-wire.d.ts +4 -0
- package/dist/agents/cc-peer-wire.js +1 -0
- package/dist/agents/cc-uds-peer-channel.js +5 -0
- package/dist/agents/cross-session-judge.d.ts +3 -1
- package/dist/agents/cross-session-judge.js +4 -1
- package/dist/agents/peer-directory.d.ts +8 -0
- package/dist/agents/peer-directory.js +4 -0
- package/dist/agents/peer-held-queue.d.ts +9 -3
- package/dist/agents/peer-held-queue.js +12 -9
- package/dist/agents/peer-idle.d.ts +20 -1
- package/dist/agents/peer-idle.js +23 -12
- package/dist/agents/peer-notice-route.d.ts +16 -5
- package/dist/agents/peer-notice-route.js +11 -9
- package/dist/agents/peer-notices.d.ts +25 -8
- package/dist/agents/peer-notices.js +6 -1
- package/dist/agents/peer-session-drain.d.ts +32 -6
- package/dist/agents/peer-session-drain.js +100 -26
- package/dist/agents/send-message-tool.d.ts +7 -0
- package/dist/agents/send-message-tool.js +18 -6
- package/dist/agents/subagent.js +25 -5
- package/dist/core/allow-entry.d.ts +4 -0
- package/dist/core/ask-origin.d.ts +1 -1
- package/dist/core/ask-origin.js +2 -2
- package/dist/core/ask-unresolvable-notice.d.ts +13 -4
- package/dist/core/ask-unresolvable-notice.js +10 -3
- package/dist/core/auto-compaction.d.ts +7 -5
- package/dist/core/auto-promote.d.ts +3 -2
- package/dist/core/background-agent-store.d.ts +14 -0
- package/dist/core/background-agent-store.js +3 -0
- package/dist/core/checkpoint-queries.d.ts +9 -6
- package/dist/core/checkpoint-queries.js +8 -3
- package/dist/core/checkpoint-store.d.ts +7 -4
- package/dist/core/context-settings.d.ts +39 -9
- package/dist/core/context-settings.js +32 -10
- package/dist/core/engine-attestation.d.ts +26 -6
- package/dist/core/engine-attestation.js +5 -1
- package/dist/core/engine-notice.d.ts +37 -2
- package/dist/core/engine-notice.js +3 -1
- package/dist/core/extension-requester.d.ts +9 -0
- package/dist/core/extension-requester.js +7 -0
- package/dist/core/file-history-store.d.ts +30 -2
- package/dist/core/file-history-store.js +48 -9
- package/dist/core/fs-write-gate-policy.js +1 -1
- package/dist/core/gate-fold.js +5 -1
- package/dist/core/gate-lanes.js +2 -0
- package/dist/core/gate-outcome.d.ts +39 -2
- package/dist/core/gate-outcome.js +20 -1
- package/dist/core/governance-codes.d.ts +8 -4
- package/dist/core/governance-codes.js +8 -3
- package/dist/core/leg-identity.d.ts +35 -1
- package/dist/core/leg-identity.js +10 -0
- package/dist/core/mailbox-store.d.ts +39 -4
- package/dist/core/mailbox-store.js +14 -2
- package/dist/core/memory-engine/consolidation.d.ts +13 -6
- package/dist/core/memory-engine/consolidation.js +26 -0
- package/dist/core/memory-engine/control-objects.d.ts +58 -0
- package/dist/core/memory-engine/control-objects.js +273 -0
- package/dist/core/memory-engine/control-plane-adoption.d.ts +51 -0
- package/dist/core/memory-engine/control-plane-adoption.js +161 -0
- package/dist/core/memory-engine/delegation-settlement.d.ts +73 -40
- package/dist/core/memory-engine/delegation-settlement.js +271 -107
- package/dist/core/memory-engine/dual-root.d.ts +3 -2
- package/dist/core/memory-engine/dual-root.js +7 -3
- package/dist/core/memory-engine/engine.d.ts +54 -33
- package/dist/core/memory-engine/engine.js +150 -157
- package/dist/core/memory-engine/file-backend.d.ts +58 -76
- package/dist/core/memory-engine/file-backend.js +111 -268
- package/dist/core/memory-engine/index.d.ts +3 -2
- package/dist/core/memory-engine/index.js +2 -1
- package/dist/core/memory-engine/layout.d.ts +135 -50
- package/dist/core/memory-engine/layout.js +214 -89
- package/dist/core/memory-engine/memory-age.d.ts +12 -0
- package/dist/core/memory-engine/memory-age.js +17 -0
- package/dist/core/memory-engine/memory-backend-contract.d.ts +10 -3
- package/dist/core/memory-engine/memory-backend-contract.js +159 -2
- package/dist/core/memory-engine/memory-deployment.d.ts +12 -4
- package/dist/core/memory-engine/memory-deployment.js +31 -6
- package/dist/core/memory-engine/origin-clearance.d.ts +12 -3
- package/dist/core/memory-engine/origin-clearance.js +64 -9
- package/dist/core/memory-engine/session-write-home.d.ts +34 -1
- package/dist/core/memory-engine/session-write-home.js +37 -10
- package/dist/core/memory-engine/tools.d.ts +2 -2
- package/dist/core/memory-engine/tools.js +7 -7
- package/dist/core/memory-engine/types.d.ts +55 -12
- package/dist/core/memory-engine/types.js +2 -1
- package/dist/core/memory-vector.d.ts +6 -14
- package/dist/core/memory.d.ts +0 -462
- package/dist/core/memory.js +0 -333
- package/dist/core/mode-policy.js +3 -3
- package/dist/core/mods/agent-stations.d.ts +18 -0
- package/dist/core/mods/agent-stations.js +8 -6
- package/dist/core/mods/extension-call.d.ts +4 -0
- package/dist/core/mods/extension-call.js +8 -0
- package/dist/core/mods/tool-call.js +3 -4
- package/dist/core/parent-spec-seat.d.ts +2 -2
- package/dist/core/peer-channel.d.ts +5 -0
- package/dist/core/permission-rule-consent.d.ts +64 -22
- package/dist/core/permission-rule-consent.js +106 -58
- package/dist/core/permission-rule-store.d.ts +56 -21
- package/dist/core/permission-rule-store.js +2 -0
- package/dist/core/refusal-echo.d.ts +20 -0
- package/dist/core/refusal-echo.js +33 -0
- package/dist/core/retention.d.ts +175 -10
- package/dist/core/retention.js +44 -0
- package/dist/core/retired-keys.d.ts +5 -0
- package/dist/core/retired-keys.js +3 -0
- package/dist/core/rule-offer-read.d.ts +0 -4
- package/dist/core/rule-offer-read.js +2 -18
- package/dist/core/runner/classifier-ladder.d.ts +10 -2
- package/dist/core/runner/classifier-ladder.js +4 -2
- package/dist/core/runner/compact-session.js +10 -7
- package/dist/core/runner/compaction-call-options.d.ts +7 -7
- package/dist/core/runner/compaction-call-options.js +3 -2
- package/dist/core/runner/contracts.d.ts +28 -9
- package/dist/core/runner/delegation-owner.d.ts +2 -3
- package/dist/core/runner/delegation-owner.js +2 -1
- package/dist/core/runner/gate-exit.d.ts +6 -0
- package/dist/core/runner/gate-exit.js +11 -2
- package/dist/core/runner/memory-consolidation-driver.d.ts +4 -2
- package/dist/core/runner/memory-consolidation-driver.js +8 -5
- package/dist/core/runner/prepare-ask-lane.js +3 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +3 -1
- package/dist/core/runner/prepare-caps-and-workflow.js +2 -2
- package/dist/core/runner/prepare-config-doors.js +4 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
- package/dist/core/runner/prepare-delegation-surface.js +2 -2
- package/dist/core/runner/prepare-gate-stations.d.ts +8 -0
- package/dist/core/runner/prepare-gate-stations.js +15 -7
- package/dist/core/runner/prepare-hands-readface.js +1 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +3 -1
- package/dist/core/runner/prepare-inherited-gate.js +4 -2
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.d.ts +4 -0
- package/dist/core/runner/prepare-memory.js +22 -28
- package/dist/core/runner/prepare-policy-chain.js +18 -10
- package/dist/core/runner/prepare-prompt-inputs.js +1 -1
- package/dist/core/runner/prepare-task.d.ts +5 -1
- package/dist/core/runner/prepare-task.js +16 -11
- package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
- package/dist/core/runner/prepare-wiring-manifest.js +3 -2
- package/dist/core/runner/resume-admission.d.ts +2 -2
- package/dist/core/runner/resume-admission.js +2 -23
- package/dist/core/runner/role-resolution-table.d.ts +98 -0
- package/dist/core/runner/role-resolution-table.js +62 -0
- package/dist/core/runner/run-compaction-machinery.js +2 -2
- package/dist/core/runner/run-identity-wiring.js +12 -9
- package/dist/core/runner/run-leg.js +8 -4
- package/dist/core/runner/run-notification-lane.js +23 -23
- package/dist/core/runner/run-recovery-lanes.js +3 -3
- package/dist/core/runner/run-terminal-adoption.js +1 -1
- package/dist/core/runner/run-turn-boundary.js +14 -15
- package/dist/core/runner/runtask.js +1 -1
- package/dist/core/runner/sub-agent-deny-lists.d.ts +19 -0
- package/dist/core/runner/sub-agent-deny-lists.js +25 -0
- package/dist/core/runner/tool-occurrence.d.ts +4 -2
- package/dist/core/runner/tool-occurrence.js +2 -2
- package/dist/core/runner-deps.d.ts +1 -1
- package/dist/core/secret-env.d.ts +2 -2
- package/dist/core/secret-env.js +6 -20
- package/dist/core/session-checkout.d.ts +63 -3
- package/dist/core/session-checkout.js +152 -58
- package/dist/core/session-store.d.ts +6 -6
- package/dist/core/session-store.js +3 -3
- package/dist/core/shell-read-silence.js +8 -0
- package/dist/core/store-contracts/background-agent-store-contract.js +13 -0
- package/dist/core/store-contracts/peer-directory-contract.js +8 -1
- package/dist/core/task-event.d.ts +9 -5
- package/dist/core/task-notification.d.ts +137 -31
- package/dist/core/task-notification.js +198 -100
- package/dist/core/task-registry-agent.d.ts +11 -0
- package/dist/core/task-registry-agent.js +12 -3
- package/dist/core/task-registry-shared.d.ts +11 -0
- package/dist/core/task-registry.d.ts +18 -0
- package/dist/core/task-registry.js +27 -8
- package/dist/core/task-spec.d.ts +7 -2
- package/dist/core/tool-errors.d.ts +17 -9
- package/dist/core/tool-errors.js +1 -1
- package/dist/core/tool-policy.d.ts +18 -1
- package/dist/core/tool-policy.js +16 -7
- package/dist/core/tool-result-store.d.ts +20 -0
- package/dist/core/tool-spec.d.ts +10 -6
- package/dist/core/trace.d.ts +3 -2
- package/dist/core/workflow-journal-store.d.ts +11 -0
- package/dist/core/workflow-journal-store.js +7 -0
- package/dist/core/workflow-run-store.d.ts +9 -0
- package/dist/core/workflow-run-store.js +6 -0
- package/dist/core/write-protect.d.ts +16 -0
- package/dist/core/write-protect.js +10 -0
- package/dist/engine/compaction/compaction.d.ts +2 -1
- package/dist/engine/harness/types.d.ts +1 -0
- package/dist/engine/session/repo-utils.d.ts +14 -4
- package/dist/engine/session/repo-utils.js +5 -4
- package/dist/engine/session/session.d.ts +7 -1
- package/dist/engine/session/session.js +5 -2
- package/dist/index.d.ts +13 -11
- package/dist/index.js +13 -11
- package/dist/orchestration/run-workflow-tool.d.ts +4 -0
- package/dist/orchestration/run-workflow-tool.js +7 -0
- package/dist/orchestration/workflow-types.d.ts +2 -1
- package/dist/orchestration/workflow.d.ts +3 -0
- package/dist/orchestration/workflow.js +2 -1
- package/dist/prompts/default.d.ts +1 -2
- package/dist/scenarios/full-body.d.ts +1 -1
- package/dist/stores/file/adoption/adopt.d.ts +1 -1
- package/dist/stores/file/checkpoint-store.d.ts +6 -0
- package/dist/stores/file/checkpoint-store.js +4 -1
- package/dist/stores/file/file-history-store.d.ts +13 -0
- package/dist/stores/file/file-history-store.js +75 -13
- package/dist/stores/file/index.d.ts +12 -16
- package/dist/stores/file/index.js +7 -25
- package/dist/stores/file/permission-rule-store.d.ts +34 -0
- package/dist/stores/file/permission-rule-store.js +104 -9
- package/dist/stores/file/session-store.js +1 -1
- package/dist/stores/file/tool-result-store.d.ts +14 -0
- package/dist/stores/file/tool-result-store.js +39 -2
- package/dist/stores/file/workflow-journal-store.d.ts +4 -0
- package/dist/stores/file/workflow-journal-store.js +17 -0
- package/dist/stores/file/workflow-run-store.d.ts +3 -0
- package/dist/stores/file/workflow-run-store.js +15 -0
- package/dist/tools/fs/read-deny.d.ts +15 -2
- package/dist/tools/fs/read-deny.js +10 -2
- package/dist/tools/fs/shell-read-check.d.ts +8 -2
- package/dist/tools/fs/shell-read-check.js +7 -7
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +71 -73
- package/wire-changes/core-stores-sql@7.64.0.json +30 -0
- package/wire-changes/core-stores-sql@7.65.0.json +30 -0
- package/wire-changes/core@7.64.0.json +2653 -0
- package/wire-changes/core@7.65.0.json +1650 -0
- package/wire-changes/mods-kernel@7.64.0.json +30 -0
- package/wire-changes/mods-kernel@7.65.0.json +30 -0
- package/wire-changes/primitives@7.64.0.json +30 -0
- package/wire-changes/primitives@7.65.0.json +337 -0
- package/dist/core/memory-recall.d.ts +0 -208
- package/dist/core/memory-recall.js +0 -136
- package/dist/stores/file/memory-store.d.ts +0 -124
- package/dist/stores/file/memory-store.js +0 -353
|
@@ -6,6 +6,7 @@ import { derivePersonalControlDir, derivePersonalMemoryDir, directoryPinOf, memo
|
|
|
6
6
|
import { memoryProjectScopeAbsentNotice, normalizeMemorySpec } from "../memory.js";
|
|
7
7
|
import { deriveSupersededSet, fileGovernanceStore } from "../memory-engine/consolidation.js";
|
|
8
8
|
import { shadowNamesOf } from "../memory-engine/shadowing.js";
|
|
9
|
+
import { mintSystemReminder } from "../reminder-mint.js";
|
|
9
10
|
import { MEMORY_ANNOUNCEMENT_CAPTURE_OPTOUT_CODA, MEMORY_ANNOUNCEMENT_READONLY_CODA, MEMORY_CAPTURE_OPTOUT_NOTICE, MEMORY_PREFERENCE_DISCIPLINE, MEMORY_READONLY_NOTICE, MemoryEngine, entryFileHeadCarriesOrigin, memoryCaptureOptedOutNotice, memoryCaptureOptOutUnpersistedNotice, memoryConsolidationRecommendedNotice, memoryHarvestConflictNotice, memoryHarvestQuarantinedNotice, memoryHarvestRefusedNotice, memoryHoldNotices, memoryRecallDisciplineSegment, memoryRestoreWithheldNotice, memorySessionPollutedNotice, memoryUnavailableNotice, pollutionContainmentCounts, } from "../memory-engine/engine.js";
|
|
10
11
|
import { adjudicateCaptureOptOut, captureOptOutDeniedError, captureOptOutUnpersistedError } from "./memory-capture-optout.js";
|
|
11
12
|
import { readSessionCaptureOptOut } from "../memory-engine/layout.js";
|
|
@@ -206,7 +207,7 @@ export async function prepareMemory(input) {
|
|
|
206
207
|
}
|
|
207
208
|
if (samePlane.fault)
|
|
208
209
|
anyFault = true;
|
|
209
|
-
if (ancestorDir !== undefined && ancestorDir !== eng.
|
|
210
|
+
if (ancestorDir !== undefined && ancestorDir !== eng.controlPlaneRoot) {
|
|
210
211
|
try {
|
|
211
212
|
const crossPlane = deps.memoryCaptureRecordStore !== undefined ? await deps.memoryCaptureRecordStore({ controlDir: ancestorDir }).read(ancestorId) : readSessionCaptureOptOut(ancestorDir, ancestorId);
|
|
212
213
|
if (crossPlane !== undefined) {
|
|
@@ -276,8 +277,8 @@ export async function prepareMemory(input) {
|
|
|
276
277
|
...planeScopes(planes.personal, planes.writePlane === "personal" ? memorySpec.writeScope : null),
|
|
277
278
|
]
|
|
278
279
|
: planeScopes(memorySpec.scopes, memorySpec.writeScope)).map((scope) => ({ scope, origin: originOf(scope) }));
|
|
279
|
-
const pollutedOpts = (engine) => {
|
|
280
|
-
const rec = engine.sessionPollution(sessionId);
|
|
280
|
+
const pollutedOpts = async (engine) => {
|
|
281
|
+
const rec = await engine.sessionPollution(sessionId);
|
|
281
282
|
return rec !== undefined ? { polluted: { reason: rec.reason, ...(rec.cause !== undefined ? { cause: rec.cause } : {}) } } : {};
|
|
282
283
|
};
|
|
283
284
|
let writeEngine;
|
|
@@ -311,7 +312,7 @@ export async function prepareMemory(input) {
|
|
|
311
312
|
for (const [ancestorId, ancestorDir] of ancestors) {
|
|
312
313
|
const samePlane = await writeEngine.sessionCaptureOptOutOrFault(ancestorId);
|
|
313
314
|
let crossPlane;
|
|
314
|
-
if (ancestorDir !== undefined && ancestorDir !== writeEngine.
|
|
315
|
+
if (ancestorDir !== undefined && ancestorDir !== writeEngine.controlPlaneRoot) {
|
|
315
316
|
try {
|
|
316
317
|
crossPlane = deps.memoryCaptureRecordStore !== undefined ? await deps.memoryCaptureRecordStore({ controlDir: ancestorDir }).read(ancestorId) : readSessionCaptureOptOut(ancestorDir, ancestorId);
|
|
317
318
|
}
|
|
@@ -420,7 +421,7 @@ export async function prepareMemory(input) {
|
|
|
420
421
|
harvestBoth = async (phase) => {
|
|
421
422
|
const writeFirst = writeIsPersonal ? [personalEngine, personalHandle] : [projectEngine, projectHandle];
|
|
422
423
|
const readOther = writeIsPersonal ? [projectEngine, projectHandle] : [personalEngine, personalHandle];
|
|
423
|
-
const writeReport = await writeFirst[0].harvest(writeFirst[1], { ...pollutedOpts(writeFirst[0]), sessionId, ...(await admitNothingOptsNow()), phase });
|
|
424
|
+
const writeReport = await writeFirst[0].harvest(writeFirst[1], { ...(await pollutedOpts(writeFirst[0])), sessionId, ...(await admitNothingOptsNow()), phase });
|
|
424
425
|
let readReport;
|
|
425
426
|
let readFailure;
|
|
426
427
|
try {
|
|
@@ -446,7 +447,7 @@ export async function prepareMemory(input) {
|
|
|
446
447
|
writeEngine = personalEngine;
|
|
447
448
|
writeHandle = handle;
|
|
448
449
|
injectFn = () => personalEngine.inject(handle, { writeToolMounted: writeChannelOpen, reminderMark: input.reminderMark });
|
|
449
|
-
harvestBoth = async (phase) => personalEngine.harvest(handle, { ...pollutedOpts(personalEngine), sessionId, ...(await admitNothingOptsNow()), phase });
|
|
450
|
+
harvestBoth = async (phase) => personalEngine.harvest(handle, { ...(await pollutedOpts(personalEngine)), sessionId, ...(await admitNothingOptsNow()), phase });
|
|
450
451
|
toolPlanes = [
|
|
451
452
|
{
|
|
452
453
|
backend: retrievalBackend(personal.backend, adoptionRestricted || captureOptedOut || captureIndeterminate || memorySpec.writeScope === null),
|
|
@@ -476,7 +477,7 @@ export async function prepareMemory(input) {
|
|
|
476
477
|
writeEngine = engine;
|
|
477
478
|
writeHandle = handle;
|
|
478
479
|
injectFn = () => engine.inject(handle, { writeToolMounted: writeChannelOpen, reminderMark: input.reminderMark });
|
|
479
|
-
harvestBoth = async (phase) => engine.harvest(handle, { ...pollutedOpts(engine), sessionId, ...(await admitNothingOptsNow()), phase });
|
|
480
|
+
harvestBoth = async (phase) => engine.harvest(handle, { ...(await pollutedOpts(engine)), sessionId, ...(await admitNothingOptsNow()), phase });
|
|
480
481
|
toolPlanes = [
|
|
481
482
|
{
|
|
482
483
|
backend: retrievalBackend(backend, adoptionRestricted || captureOptedOut || captureIndeterminate || memorySpec.writeScope === null),
|
|
@@ -497,7 +498,7 @@ export async function prepareMemory(input) {
|
|
|
497
498
|
}
|
|
498
499
|
const foreignUnderRoot = [];
|
|
499
500
|
if (input.writeToolsMounted && writeHandle.writeScope !== null && input.advertisedWritableDirs !== undefined) {
|
|
500
|
-
const controlPlane = canonicalize(writeEngine.
|
|
501
|
+
const controlPlane = canonicalize(writeEngine.controlPlaneRoot);
|
|
501
502
|
if (isContainedIn(writableRootOf(writeHandle), controlPlane))
|
|
502
503
|
foreignUnderRoot.push(`the engine's control plane ${controlPlane}`);
|
|
503
504
|
}
|
|
@@ -545,13 +546,13 @@ export async function prepareMemory(input) {
|
|
|
545
546
|
return writeEngine.gateWrite(writeHandle, w.key, w.content);
|
|
546
547
|
};
|
|
547
548
|
let pollutionAnnounced = false;
|
|
548
|
-
const announceHarvestContainment = (report) => {
|
|
549
|
+
const announceHarvestContainment = async (report) => {
|
|
549
550
|
const { count, moved, escalated } = pollutionContainmentCounts(report);
|
|
550
551
|
const indexOnly = input.memoryProvenance !== "off" && count === 0 && report.containment?.indexRolledBack === true;
|
|
551
552
|
if (count > 0 || indexOnly) {
|
|
552
553
|
let reason;
|
|
553
554
|
try {
|
|
554
|
-
reason = writeEngine.sessionPollution(sessionId)?.reason;
|
|
555
|
+
reason = (await writeEngine.sessionPollution(sessionId))?.reason;
|
|
555
556
|
}
|
|
556
557
|
catch {
|
|
557
558
|
}
|
|
@@ -579,7 +580,7 @@ export async function prepareMemory(input) {
|
|
|
579
580
|
const named = report.reportId !== undefined ? `${report.incident.kind}, report ${report.reportId}` : report.incident.kind;
|
|
580
581
|
deps.onError?.(new Error(`memory harvest refused (${named}): ${report.incident.detail}`), { phase: "memory", sessionId });
|
|
581
582
|
}
|
|
582
|
-
announceHarvestContainment(report);
|
|
583
|
+
await announceHarvestContainment(report);
|
|
583
584
|
try {
|
|
584
585
|
deps.onMemoryHarvestReport?.(report, { sessionId, phase });
|
|
585
586
|
}
|
|
@@ -697,7 +698,7 @@ export async function prepareMemory(input) {
|
|
|
697
698
|
execIsExternalContent: memorySpec.execIsExternalContent === true,
|
|
698
699
|
},
|
|
699
700
|
...(input.memoryProvenance !== "off"
|
|
700
|
-
? { settlement: { governance: writeEngine.governance,
|
|
701
|
+
? { settlement: { governance: writeEngine.governance, sessionId, provenance: "carry" } }
|
|
701
702
|
: {}),
|
|
702
703
|
...(input.memoryProvenance !== "off"
|
|
703
704
|
? {
|
|
@@ -772,36 +773,28 @@ export async function prepareMemory(input) {
|
|
|
772
773
|
let memoryBlock;
|
|
773
774
|
let seedFiles;
|
|
774
775
|
let recallDisciplineSegment;
|
|
776
|
+
let noticesFrame;
|
|
775
777
|
if (memoryEngineSession) {
|
|
776
778
|
const injection = await memoryEngineSession.inject();
|
|
777
779
|
let blockBody = injection.block;
|
|
778
780
|
if (captureOptedOut) {
|
|
779
|
-
blockBody = [MEMORY_CAPTURE_OPTOUT_NOTICE, injection.index
|
|
781
|
+
blockBody = [MEMORY_CAPTURE_OPTOUT_NOTICE, injection.index].filter((s) => Boolean(s && s.trim())).join("\n\n");
|
|
780
782
|
}
|
|
781
783
|
else if (captureIndeterminate && facts.rosterCanPersist) {
|
|
782
|
-
blockBody = [memoryUnavailableNotice({ what: "capture-record-unreadable", notesReadable: true }), injection.index
|
|
784
|
+
blockBody = [memoryUnavailableNotice({ what: "capture-record-unreadable", notesReadable: true }), injection.index].filter((s) => Boolean(s && s.trim())).join("\n\n");
|
|
783
785
|
}
|
|
784
786
|
else if (!facts.rosterCanPersist && injection.instruction === "" && injection.readOnlyNotice === undefined) {
|
|
785
787
|
blockBody = blockBody.trim() ? `${MEMORY_READONLY_NOTICE}\n\n${blockBody}` : MEMORY_READONLY_NOTICE;
|
|
786
788
|
}
|
|
787
789
|
else if (!facts.rosterCanPersist && injection.instruction !== "") {
|
|
788
|
-
blockBody = [MEMORY_READONLY_NOTICE, injection.index
|
|
790
|
+
blockBody = [MEMORY_READONLY_NOTICE, injection.index].filter((s) => Boolean(s && s.trim())).join("\n\n");
|
|
789
791
|
}
|
|
790
792
|
else if (input.memoryPersistenceDeclared === true && injection.readOnlyNotice !== undefined) {
|
|
791
|
-
blockBody = [injection.index
|
|
793
|
+
blockBody = [injection.index].filter((s) => Boolean(s && s.trim())).join("\n\n");
|
|
792
794
|
}
|
|
793
|
-
if (
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
!blockBody.trimEnd().endsWith(MEMORY_ANNOUNCEMENT_READONLY_CODA)) {
|
|
797
|
-
blockBody = `${blockBody}\n\n${MEMORY_ANNOUNCEMENT_READONLY_CODA}`;
|
|
798
|
-
}
|
|
799
|
-
if (captureOptedOut &&
|
|
800
|
-
facts.rosterCanPersist &&
|
|
801
|
-
(injection.announceBlock?.trim() ?? "") !== "" &&
|
|
802
|
-
blockBody.includes(injection.announceBlock) &&
|
|
803
|
-
!blockBody.trimEnd().endsWith(MEMORY_ANNOUNCEMENT_CAPTURE_OPTOUT_CODA)) {
|
|
804
|
-
blockBody = `${blockBody}\n\n${MEMORY_ANNOUNCEMENT_CAPTURE_OPTOUT_CODA}`;
|
|
795
|
+
if ((injection.announceBlock?.trim() ?? "") !== "") {
|
|
796
|
+
const coda = !facts.rosterCanPersist ? MEMORY_ANNOUNCEMENT_READONLY_CODA : captureOptedOut ? MEMORY_ANNOUNCEMENT_CAPTURE_OPTOUT_CODA : undefined;
|
|
797
|
+
noticesFrame = coda === undefined ? injection.announceBlock : `${injection.announceBlock}\n${mintSystemReminder(coda, input.reminderMark)}`;
|
|
805
798
|
}
|
|
806
799
|
if (blockBody.trim())
|
|
807
800
|
memoryBlock = blockBody;
|
|
@@ -822,6 +815,7 @@ export async function prepareMemory(input) {
|
|
|
822
815
|
memoryBlock,
|
|
823
816
|
...(recallDisciplineSegment !== undefined ? { recallDisciplineSegment } : {}),
|
|
824
817
|
...(seedFiles !== undefined ? { seedFiles } : {}),
|
|
818
|
+
...(noticesFrame !== undefined ? { noticesFrame } : {}),
|
|
825
819
|
};
|
|
826
820
|
};
|
|
827
821
|
if (effectiveMemoryScopes === undefined) {
|
|
@@ -10,7 +10,7 @@ import { isCoveringRuleName, ruleNameCovers } from "../namespaced-rule-name.js";
|
|
|
10
10
|
import { isIsolated } from "../remote-env.js";
|
|
11
11
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
12
12
|
import { earlierGrammarNotice } from "../session-policy-store.js";
|
|
13
|
-
import { attest, attestationOf, checkToolPolicyProjection, combinePolicies, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, durableParkOptInDeclared, isLiveApproverSeat, mergeAttestation, refuseOutOfContractDecision,
|
|
13
|
+
import { attest, attestationOf, checkToolPolicyProjection, combinePolicies, createTranscriptIntegrityPolicy, createUnverifiableDeletePolicy, durableParkOptInDeclared, isLiveApproverSeat, mergeAttestation, refuseOutOfContractDecision, resolveAskFor, toolPolicyNameSets, withAttestation, wrapToolPolicy } from "../tool-policy.js";
|
|
14
14
|
import { judgeRuleToolName, mountedToolNames, nearMissSpellingOf } from "../tool-name-aliases.js";
|
|
15
15
|
import { approvalCardMemberOf } from "../tool-roster.js";
|
|
16
16
|
import { NAMESPACED_NAME_SHAPES } from "../protocol-table.js";
|
|
@@ -18,7 +18,7 @@ import { emitTrace } from "../trace.js";
|
|
|
18
18
|
import { skillGrantBindingMembers } from "../skill-grant.js";
|
|
19
19
|
import { withArgsBinding } from "../skill-grant-binding.js";
|
|
20
20
|
import { SKILL_TOOL_NAME } from "./synthetic-tools.js";
|
|
21
|
-
import { delegationPoolReading, policyNameRefusal, POLICY_NAME_REFUSAL_CODE } from "./sub-agent-deny-lists.js";
|
|
21
|
+
import { delegationPoolReading, policyNameRefusal, POLICY_NAME_REFUSAL_CODE, retiredToolNameNotice } from "./sub-agent-deny-lists.js";
|
|
22
22
|
import { valveLeaves } from "../../agents/tool-filter.js";
|
|
23
23
|
import { autoStrippedRule, cardDisclosureOf, classifiesAllShell, rootFacingToolNames } from "../allow-entry.js";
|
|
24
24
|
import { arbitrateByMode, askClassMembersOf, askFaceOf, askMandateMember, INHERITED_STATION_FACTS } from "../ask-origin.js";
|
|
@@ -48,6 +48,7 @@ export async function preparePolicyChain(input) {
|
|
|
48
48
|
const policy = lockedPreflight.toolPolicy;
|
|
49
49
|
const auditPolicyNames = (auditee, layer = "caller_policy") => {
|
|
50
50
|
const refused = [];
|
|
51
|
+
const retiredLeftOut = [];
|
|
51
52
|
const nameGroups = toolPolicyNameSets(auditee);
|
|
52
53
|
if (nameGroups.length > 0) {
|
|
53
54
|
const known = mountedToolNames(tools);
|
|
@@ -61,8 +62,9 @@ export async function preparePolicyChain(input) {
|
|
|
61
62
|
for (const [kind, list] of [["deny", g.deny], ["ask", g.ask], ["allow", g.allow]]) {
|
|
62
63
|
for (const n of list ?? []) {
|
|
63
64
|
const verdict = judgeRuleToolName(n, known, kind);
|
|
64
|
-
const
|
|
65
|
-
const
|
|
65
|
+
const asksTwin = verdict.kind === "current" || (verdict.kind === "retired" && verdict.currentName === undefined && kind !== "allow");
|
|
66
|
+
const twin = asksTwin && layer !== "ancestor_session_rules" ? nearMissSpellingOf(n, rootFacing) : undefined;
|
|
67
|
+
const stale = twin !== undefined ? { kind: "case_twin", twin, carrier: known.has(twin) || callerNames.has(twin) ? "run" : pool.names.has(twin) ? "pool" : "catalog" } : verdict.kind !== "current" ? verdict : undefined;
|
|
66
68
|
if (stale?.kind === "retired" && kind === "allow") {
|
|
67
69
|
unmatched.add(`"${n}" (allow — a retired tool name: ${stale.guidance})`);
|
|
68
70
|
continue;
|
|
@@ -71,6 +73,10 @@ export async function preparePolicyChain(input) {
|
|
|
71
73
|
unmatched.add(`"${n}" (allow — ${stale.guidance}${stale.currentName !== undefined ? ` Write "${stale.currentName}".` : ""})`);
|
|
72
74
|
continue;
|
|
73
75
|
}
|
|
76
|
+
if (stale?.kind === "retired" && stale.currentName === undefined && kind !== "allow") {
|
|
77
|
+
retiredLeftOut.push({ field: kind, entry: n, layer, guidance: stale.guidance });
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
74
80
|
if (stale !== undefined) {
|
|
75
81
|
const entry = `tool policy ${kind}-list entry "${n}"`;
|
|
76
82
|
let message;
|
|
@@ -105,6 +111,8 @@ export async function preparePolicyChain(input) {
|
|
|
105
111
|
}
|
|
106
112
|
if (refused[0] !== undefined)
|
|
107
113
|
throw policyNameRefusal(refused[0], refused.slice(1));
|
|
114
|
+
if (retiredLeftOut.length > 0)
|
|
115
|
+
deliverEngineNotice(deps.onNotice, retiredToolNameNotice(layer, retiredLeftOut, sessionId));
|
|
108
116
|
const dedupeKey = [...unmatched].sort().join("|");
|
|
109
117
|
const advised = advisedPolicyNames.get(deps) ?? new Set();
|
|
110
118
|
if (unmatched.size > 0 && !advised.has(dedupeKey)) {
|
|
@@ -400,7 +408,7 @@ export async function preparePolicyChain(input) {
|
|
|
400
408
|
if (editArbitrated !== undefined && !outletReleased) {
|
|
401
409
|
return onApproval(editArbitrated.action === "allow" ? { action: "allow", updatedInput: editArgs, decisionReason: "mode" } : editArbitrated);
|
|
402
410
|
}
|
|
403
|
-
const { resolved: rr, judged: settled } = await resolveInheritedAsk(judged, (j) =>
|
|
411
|
+
const { resolved: rr, judged: settled } = await resolveInheritedAsk(judged, (j) => resolveAskFor({
|
|
404
412
|
toolName: creq.toolName,
|
|
405
413
|
toolCallId: creq.toolCallId,
|
|
406
414
|
args: editArgs,
|
|
@@ -414,7 +422,7 @@ export async function preparePolicyChain(input) {
|
|
|
414
422
|
...askMandateMember(ancestorFacts(j.ask)),
|
|
415
423
|
...inheritedAskCarry(j, isLiveApproverSeat(onAskOf), ancestorTracker),
|
|
416
424
|
ruleEvidence: inheritedAskEvidence,
|
|
417
|
-
}, onAskOf, csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError })), ancestorTracker, creq, inheritedStationFacts(creq));
|
|
425
|
+
}, onAskOf, csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), j.ask), ancestorTracker, creq, inheritedStationFacts(creq));
|
|
418
426
|
void settleReadRootGrant(rr.readRootGrant, undefined, { toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice });
|
|
419
427
|
settleDenialLimitFallback({ fallback: settled.fallback, mintedHere: settled.mintedHere, tracker: ancestorTracker, resolved: rr, headless: headlessDenyAtRecheck, stop: stopForDenialLimit, toolName: creq.toolName, toolCallId: creq.toolCallId });
|
|
420
428
|
if (rr.action !== "allow")
|
|
@@ -456,7 +464,7 @@ export async function preparePolicyChain(input) {
|
|
|
456
464
|
if (arbitrated !== undefined)
|
|
457
465
|
return settledAs(arbitrated);
|
|
458
466
|
const askT0 = now();
|
|
459
|
-
const { resolved, judged: settled } = await resolveInheritedAsk(judged, (j) =>
|
|
467
|
+
const { resolved, judged: settled } = await resolveInheritedAsk(judged, (j) => resolveAskFor({
|
|
460
468
|
toolName: creq.toolName,
|
|
461
469
|
toolCallId: creq.toolCallId,
|
|
462
470
|
args: presentedArgs,
|
|
@@ -470,7 +478,7 @@ export async function preparePolicyChain(input) {
|
|
|
470
478
|
...askMandateMember(ancestorFacts(j.ask.action === "ask" ? j.ask : undefined)),
|
|
471
479
|
...inheritedAskCarry(j, isLiveApproverSeat(pc.onAsk), pc.autoMode?.denialTracking),
|
|
472
480
|
ruleEvidence: inheritedAskEvidence,
|
|
473
|
-
}, pc.onAsk, csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError })), pc.autoMode?.denialTracking, creq, inheritedStationFacts(creq));
|
|
481
|
+
}, pc.onAsk, csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), j.ask), pc.autoMode?.denialTracking, creq, inheritedStationFacts(creq));
|
|
474
482
|
void settleReadRootGrant(resolved.readRootGrant, undefined, { toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice });
|
|
475
483
|
const askWaitMs = Math.max(0, now() - askT0);
|
|
476
484
|
if (resolved.action === "deny" && resolved.approverUnavailable === true) {
|
|
@@ -539,7 +547,7 @@ export async function preparePolicyChain(input) {
|
|
|
539
547
|
return arbitrated;
|
|
540
548
|
const presentedArgs = creq.args;
|
|
541
549
|
const askT0 = now();
|
|
542
|
-
const { resolved, judged: settled } = await resolveInheritedAsk(judged, (j) =>
|
|
550
|
+
const { resolved, judged: settled } = await resolveInheritedAsk(judged, (j) => resolveAskFor({
|
|
543
551
|
toolName: creq.toolName,
|
|
544
552
|
toolCallId: creq.toolCallId,
|
|
545
553
|
args: presentedArgs,
|
|
@@ -553,7 +561,7 @@ export async function preparePolicyChain(input) {
|
|
|
553
561
|
...askMandateMember(ancestorFacts(j.ask.action === "ask" ? j.ask : undefined)),
|
|
554
562
|
...inheritedAskCarry(j, isLiveApproverSeat(pc.onAsk), pc.autoMode?.denialTracking),
|
|
555
563
|
ruleEvidence: inheritedAskEvidence,
|
|
556
|
-
}, pc.onAsk, csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError })), pc.autoMode?.denialTracking, creq, inheritedStationFacts(creq));
|
|
564
|
+
}, pc.onAsk, csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), j.ask), pc.autoMode?.denialTracking, creq, inheritedStationFacts(creq));
|
|
557
565
|
void settleReadRootGrant(resolved.readRootGrant, undefined, { toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice });
|
|
558
566
|
const askWaitMs = Math.max(0, now() - askT0);
|
|
559
567
|
if (resolved.action === "deny" && resolved.approverUnavailable === true) {
|
|
@@ -28,7 +28,7 @@ export async function preparePromptInputs(input) {
|
|
|
28
28
|
goalEnabled: internals?.goalMode === true,
|
|
29
29
|
awarenessEnabled: thinking !== undefined && ULTRA_REASONING_TIERS.has(thinking),
|
|
30
30
|
worktreeIsolated: internals?.isolation === "worktree" && ownedEnv !== undefined,
|
|
31
|
-
withinTaskCompactionEnabled: compactionEnabled(spec.compaction
|
|
31
|
+
withinTaskCompactionEnabled: compactionEnabled("autoCompact", spec.compaction, input.contextOverlay) && (spec.compaction?.withinTask ?? true),
|
|
32
32
|
isSubagent: delegation.isNonForkChild,
|
|
33
33
|
};
|
|
34
34
|
const sugar = requestBodySugar({ spec, resolvedRole, ...(input.taskRole !== undefined ? { taskRole: input.taskRole } : {}), ...(internals !== undefined ? { internals } : {}) });
|
|
@@ -8,6 +8,7 @@ export { DEFAULT_IRREVERSIBLE_SCOPE, checkpointScopeOf, placementValueOrAbsent }
|
|
|
8
8
|
export { mcpManifestEntries } from "./prepare-wiring-manifest.js";
|
|
9
9
|
export { __resetMaterializeEnvAnnouncements } from "./prepare-tool-disclosure-mount.js";
|
|
10
10
|
export { fileHistoryFilesystemIdentity, resolveFileHistoryScope } from "./prepare-file-history.js";
|
|
11
|
+
import { type NoticeDestinationJudge } from "../task-notification.js";
|
|
11
12
|
import type { RunnerSelfSeat } from "./contracts.js";
|
|
12
13
|
import type { Prepared, PrepareResume, PrepareTaskFn, RunInternals } from "./contracts.js";
|
|
13
14
|
export type { FileHistoryBoundarySeat, InheritedGate, Prepared, PreparedMicroCompact, PrepareResume, ResolvedWorkspace, RunInternals, UsageGovernance } from "./contracts.js";
|
|
@@ -118,7 +119,10 @@ runIdSink?: {
|
|
|
118
119
|
/** The Runner's lock on this leg's session, handed only when the spec named none: taken the moment the store mints the id. */
|
|
119
120
|
holdSessionLock?: (sessionId: string) => Promise<void>,
|
|
120
121
|
/** This leg's view of the Runner's session write ledger (`session-write-ledger.ts`): the acquired storage writes through it. */
|
|
121
|
-
legWrites?: LegWrites
|
|
122
|
+
legWrites?: LegWrites,
|
|
123
|
+
/** The Runner's judge of where this leg's user-face notices go when they are routed to its tree's root (its in-process
|
|
124
|
+
* notification store's): absent when prepareTask runs outside a Runner, and then every notice is delivered. */
|
|
125
|
+
noticeDestinations?: NoticeDestinationJudge): Promise<Prepared>;
|
|
122
126
|
/** The entry IS the contract the notification lane's seat names ({@link PrepareTaskFn}, contracts.ts):
|
|
123
127
|
* a signature change reds HERE, at the declaration, as `false` failing the `true` bound. IDENTITY, not assignability:
|
|
124
128
|
* the parameter tuple (arity, optionality, each type) and the return type must be the SAME type in both directions —
|
|
@@ -92,6 +92,7 @@ import { declaredHostLocalPaths, isDeclaredSandboxOffHost, pathsAreHostLocal, ta
|
|
|
92
92
|
import { settleTeardownLeg } from "./teardown-bounded.js";
|
|
93
93
|
import { defaultTaskRegistry } from "../task-registry.js";
|
|
94
94
|
import { announcePeerLaneMount, judgeSessionBoxDrain } from "../../agents/peer-session-drain.js";
|
|
95
|
+
import { sessionAddressOf } from "../task-notification.js";
|
|
95
96
|
import { createFrameSettlement } from "../frame-settlement.js";
|
|
96
97
|
import { createSchedulerTools } from "../../tools/scheduler-tools.js";
|
|
97
98
|
import { selfOrchestrationFailClosedReason } from "../../orchestration/workflow-script-runner.js";
|
|
@@ -125,7 +126,7 @@ import { asThrownError, thrownText } from "../thrown-value.js";
|
|
|
125
126
|
import { createAttachmentDelivery, refuseUserAttachmentPathsWithoutWorkspace, screenUserAttachments } from "../user-attachment.js";
|
|
126
127
|
import { screenReadDenySeat } from "../read-face-seats.js";
|
|
127
128
|
import { admitLegMods, legFacadeSeats } from "../mods/stations.js";
|
|
128
|
-
import { agentIdOf, legTaskIdOf, mintAskSourceIdentity } from "../leg-identity.js";
|
|
129
|
+
import { agentIdOf, legTaskIdOf, mintAskSourceIdentity, noticeAddressOf } from "../leg-identity.js";
|
|
129
130
|
import { frozenSkillScopesOf } from "../mods/spec-seats.js";
|
|
130
131
|
function warnCompactionWindowHazard(tracer, spec, model, compModel, hostTaskId, overlay) {
|
|
131
132
|
if (compModel === undefined)
|
|
@@ -303,7 +304,7 @@ function refuseRegistryScopeMismatch(spec, internals) {
|
|
|
303
304
|
function validateInputFaultNotice(onError, sessionId) {
|
|
304
305
|
return ({ toolName, toolCallId, error }) => onError?.(new Error(`tool input pre-validation (validateInput) threw for ${toolName} (call ${toolCallId}) — read as no verdict; the call proceeded to the gate: ${thrownText(error)}`), { phase: "hook", sessionId });
|
|
305
306
|
}
|
|
306
|
-
export async function prepareTask(request, deps, sessions, resume, internals, runnerSelf, runIdSink, holdSessionLock, legWrites) {
|
|
307
|
+
export async function prepareTask(request, deps, sessions, resume, internals, runnerSelf, runIdSink, holdSessionLock, legWrites, noticeDestinations) {
|
|
307
308
|
const runId = uuidv7();
|
|
308
309
|
if (runIdSink !== undefined)
|
|
309
310
|
runIdSink.runId = runId;
|
|
@@ -367,6 +368,7 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
367
368
|
internals = restoreRowTaskId(internals, resume?.seed.rowTaskId);
|
|
368
369
|
const hostTaskId = legTaskIdOf(spec, internals, sessionId);
|
|
369
370
|
const askSource = mintAskSourceIdentity({ principal: spec.principal, sessionId, taskId: hostTaskId, isDelegatedChild: delegation.isDelegatedChild, internals });
|
|
371
|
+
const noticeRoute = noticeAddressOf(askSource, internals);
|
|
370
372
|
announceRoleSeatsDefaulted({ spec, deps, onceLedger, rootLeg: !delegation.isDelegatedChild, sessionId, runId });
|
|
371
373
|
const placementRootResolved = (internals = restorePlacementRoot(internals, resume?.seed.placementRootSessionId))?.placementRoot ?? internals?.rootSessionId ?? sessionId;
|
|
372
374
|
const compositionLegResolved = compositionLegRecord(internals?.compositionLeg ?? resume?.seed.compositionLeg);
|
|
@@ -376,8 +378,7 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
376
378
|
const checkpointScope = checkpointScopeOf(spec, internals?.checkpointScope || resume?.seed.legScope);
|
|
377
379
|
internals?.peerSelfRef?.addAxis("s", sessionId);
|
|
378
380
|
internals?.peerSelfRef?.addAxis("t", hostTaskId);
|
|
379
|
-
const peerLaneActive = announcePeerLaneMount(deps, { sessionId, runId });
|
|
380
|
-
const sessionBox = judgeSessionBoxDrain(deps, { sessionId, scope: taskScope, isDelegatedChild: delegation.isDelegatedChild });
|
|
381
|
+
const peerLaneActive = announcePeerLaneMount(deps, { sessionId, runId, sessions });
|
|
381
382
|
const peerLaneRefs = {};
|
|
382
383
|
const frameSettlement = createFrameSettlement();
|
|
383
384
|
const peerSendMessageBuiltIn = runnerSelf !== undefined && valveLeaves(spec, toolFaceSnapshot.selector)({ name: SEND_MESSAGE_TOOL_NAME }) && !(spec.tools ?? []).some((t) => t.name === SEND_MESSAGE_TOOL_NAME);
|
|
@@ -490,13 +491,14 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
490
491
|
const legContextOverlay = () => runnerSelf?.contextOverlayOf?.(harnessRef.current?.getModelRef() ?? resolvedRole.modelRef);
|
|
491
492
|
let resolvedReadFace;
|
|
492
493
|
let resolvedWriteFace;
|
|
494
|
+
let sessionIncarnation;
|
|
493
495
|
let readDenyAdditionsNormalized = [];
|
|
494
496
|
let handsLessResolvedFace;
|
|
495
497
|
let handsLessResolvedWriteFace;
|
|
496
498
|
const mcpPool = installedPreflight.mcp?.length ? { pool: internals?.mcpPool ?? new McpConnectionPool(), owned: internals?.mcpPool === undefined } : undefined;
|
|
497
499
|
const mcpHostSeats = internals?.mcpHostSeats;
|
|
498
500
|
const mountedMcpNow = mcpPool !== undefined ? () => mountedMcpOf({ declared: installedPreflight.mcp, roster: roster.tools, aggregateNames: new Set(mcp.tools.filter((t) => t.mcpRemoteName === undefined).map((t) => t.name)), pool: mcpPool.pool, ...(mcpHostSeats !== undefined ? { hostSeats: mcpHostSeats } : {}) }) : undefined;
|
|
499
|
-
const { liveInheritedGate, seedInheritedGate, inheritedAncestorRules, inheritedShellGate, inheritedParentConstraints, permissionMode, commitModeSeats, endModeCeiling, inheritedAdmittedOrgScopes, priorOwnOrgVerdict, orgGovernedProvenance, effectiveShellGate, ownSessionRulesRef, ancestorSessionRulesRef, ancestorRulesNow, memoryAdmittedOrgScopesRef, ownOrgVerdictRef, runClampSource, faceCheckpointSection, writeFaceCheckpointSection, skillGrantCheckpointSection, frozenOnAsk, hookEnvSource, frozenOnQuestion, parentSpecSeat, provenanceForChildrenRef, delegationSettlementRef, inheritedGateForChildren, carrierReadFace, carrierWriteFace, fullShellReachable, gateStopRef, stopForDenialLimit, enrichSpecToolCtx } = prepareInheritedGate({ spec, deps, delegationOwner, askSeat: doors.askSeat, hostFloor: doors.hostFloor, crossBoundaryTree, internals, resume, sessions, sessionId, runId, hostTaskId, taskRootFinal, delegationCwd, ownTarget, executionEnv, ownedEnv, lockedPreflight: installedPreflight, pathRuleAnchors: { chainTop, onLeg: onLeg.chained }, checkpointSeat, checkpointScope, toolFaceSnapshot, mountsCallerTool, ...(mountedMcpNow !== undefined ? { mountedMcp: mountedMcpNow } : {}), promptLean, resolvedInteractionPosture, permissionModeSeat, handsEnabled, reportUsage, harnessRef, skillGrants, requestAllowedTools: allowedToolTables.request, forwardEvent, subagentRetain, taskArtifacts, worktreeIsolation, requestReview, requestStopAfterTurn, enterPlanMode, reminderMark, reminderDisclosureCounts, fileHistoryEnabled, historyScope, historyRoot, historyFs, abortRun: () => { abortController.abort(); void harness.abort(); }, runtimeCaps: () => runtimeCaps, modBus: legMods.standing, ownModChain, autoModeDecider: () => autoModeDeciderRef.current, autoModeDenialTracking: () => autoModeDenialTrackingRef.current, autoModeArming: () => autoModeArmingRef.current, agentForkDenial: () => agentForkDenial, agentStations: () => agentStationsRef.current, sendStation: () => sendStationRef.current, observersActive: () => observersActive, resolvedReadFace: () => resolvedReadFace, resolvedWriteFace: () => resolvedWriteFace, readDenyAdditionsNormalized: () => readDenyAdditionsNormalized, handsLessResolvedFace: () => handsLessResolvedFace, handsLessResolvedWriteFace: () => handsLessResolvedWriteFace, centerAdoption: () => centerAdoptionRef.current, memoryEngineSession: () => memoryEngineSession });
|
|
501
|
+
const { liveInheritedGate, seedInheritedGate, inheritedAncestorRules, inheritedShellGate, inheritedParentConstraints, permissionMode, commitModeSeats, endModeCeiling, inheritedAdmittedOrgScopes, priorOwnOrgVerdict, orgGovernedProvenance, effectiveShellGate, ownSessionRulesRef, ancestorSessionRulesRef, ancestorRulesNow, memoryAdmittedOrgScopesRef, ownOrgVerdictRef, runClampSource, faceCheckpointSection, writeFaceCheckpointSection, skillGrantCheckpointSection, frozenOnAsk, hookEnvSource, frozenOnQuestion, parentSpecSeat, provenanceForChildrenRef, delegationSettlementRef, inheritedGateForChildren, carrierReadFace, carrierWriteFace, fullShellReachable, gateStopRef, stopForDenialLimit, enrichSpecToolCtx } = prepareInheritedGate({ spec, deps, delegationOwner, askSeat: doors.askSeat, hostFloor: doors.hostFloor, crossBoundaryTree, internals, resume, sessions, sessionId, runId, hostTaskId, taskRootFinal, delegationCwd, ownTarget, executionEnv, ownedEnv, lockedPreflight: installedPreflight, pathRuleAnchors: { chainTop, onLeg: onLeg.chained }, checkpointSeat, checkpointScope, toolFaceSnapshot, mountsCallerTool, ...(mountedMcpNow !== undefined ? { mountedMcp: mountedMcpNow } : {}), promptLean, resolvedInteractionPosture, permissionModeSeat, handsEnabled, reportUsage, harnessRef, skillGrants, requestAllowedTools: allowedToolTables.request, forwardEvent, subagentRetain, taskArtifacts, worktreeIsolation, requestReview, requestStopAfterTurn, enterPlanMode, reminderMark, reminderDisclosureCounts, fileHistoryEnabled, historyScope, historyRoot, historyFs, abortRun: () => { abortController.abort(); void harness.abort(); }, runtimeCaps: () => runtimeCaps, modBus: legMods.standing, ownModChain, autoModeDecider: () => autoModeDeciderRef.current, autoModeDenialTracking: () => autoModeDenialTrackingRef.current, autoModeArming: () => autoModeArmingRef.current, agentForkDenial: () => agentForkDenial, agentStations: () => agentStationsRef.current, sendStation: () => sendStationRef.current, observersActive: () => observersActive, resolvedReadFace: () => resolvedReadFace, resolvedWriteFace: () => resolvedWriteFace, readDenyAdditionsNormalized: () => readDenyAdditionsNormalized, handsLessResolvedFace: () => handsLessResolvedFace, handsLessResolvedWriteFace: () => handsLessResolvedWriteFace, centerAdoption: () => centerAdoptionRef.current, memoryEngineSession: () => memoryEngineSession, sessionIncarnation: () => sessionIncarnation });
|
|
500
502
|
bindPermissionModeSeat(permissionMode);
|
|
501
503
|
const personRowNotices = { onUnread: ruleStoreUnreadableNotice(deps.onNotice, { sessionId, runId }), onRowsDropped: ruleRowsDroppedNotice(deps.onNotice, { sessionId, runId }) };
|
|
502
504
|
const readerOf = (signals) => personPathRowsOfTask({ deps, notices: personRowNotices, principal: spec.principal, ids: { sessionId, runId, taskId: hostTaskId }, root: taskRootFinal, rootCanonical: taskRootCanonical, leads: headLeads, chainTop, occurrences: toolOccurrences, signals });
|
|
@@ -514,7 +516,7 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
514
516
|
const legExemptRoots = Object.freeze(dataRootSpellings(deps.memoryEngineDir));
|
|
515
517
|
const legWriteGuard = { exemptRoots: legExemptRoots, rows: toolPolicyWriteGuardRows([installedToolPolicy, ...(inheritedParentConstraints ?? []).map((c) => c.policy)]), checkout };
|
|
516
518
|
const sideCallBookRef = {};
|
|
517
|
-
const { roster, blockedRef, runtimeCaps, runtimeCapsFaulted, complianceDenies, complianceDegraded, agentForkDenial, observersActive, autoModeArmReason, autoModeDeciderRef, autoModeDenialTrackingRef, autoModeArmingRef, armAutoMode, selfOrchestrationActive, workflowToolsActive, workflowSizeGuideline } = await prepareCapsAndWorkflow({ spec, deps, delegationOwner, askSeat: doors.askSeat, internals, crossBoundaryTree, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, delegationCwd, ownTarget, model, thinking, lockedPreflight, checkpointSeat, toolEffects, toolFaceSnapshot, promptLean, resolvedInteractionPosture, harnessRef, parentSpecSeat, runClampSource, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, taskArtifacts, requestReview, ...(spec.planFile !== undefined ? { planFileSource: { path: spec.planFile, shown: planFileShown(spec.planFile), read: (signal) => advertisedWritableDirs?.readPlanFile(signal) ?? Promise.resolve({ ok: false, reason: "this run admitted no plan file" }) } } : {}), enterPlanMode, permissionMode, readDenyEntries: () => personRows.tablesReady().then(() => ({ entries: readDenyMatcher?.entries ?? [], ruleRows: pathTables?.ruleRows() ?? effectivePathDenyRules })), peerLaneActive, peerSendMessageBuiltIn, runnerSelf, memoryEngineSession: () => memoryEngineSession, centerAdoption: () => centerAdoptionRef.current, agentStations: () => agentStationsRef.current, delegated: delegation.isDelegatedChild, sideCallBookRef });
|
|
519
|
+
const { roster, blockedRef, runtimeCaps, runtimeCapsFaulted, complianceDenies, complianceDegraded, agentForkDenial, observersActive, autoModeArmReason, autoModeDeciderRef, autoModeDenialTrackingRef, autoModeArmingRef, armAutoMode, selfOrchestrationActive, workflowToolsActive, workflowSizeGuideline } = await prepareCapsAndWorkflow({ spec, deps, delegationOwner, askSeat: doors.askSeat, internals, crossBoundaryTree, session, sessionId, runId, hostTaskId, taskScope, taskRootFinal, delegationCwd, ownTarget, model, thinking, lockedPreflight, checkpointSeat, toolEffects, toolFaceSnapshot, promptLean, resolvedInteractionPosture, harnessRef, parentSpecSeat, runClampSource, forwardEvent, inheritedGateForChildren, enrichSpecToolCtx, maybeOffload, taskArtifacts, requestReview, ...(spec.planFile !== undefined ? { planFileSource: { path: spec.planFile, shown: planFileShown(spec.planFile), read: (signal) => advertisedWritableDirs?.readPlanFile(signal) ?? Promise.resolve({ ok: false, reason: "this run admitted no plan file" }) } } : {}), enterPlanMode, permissionMode, readDenyEntries: () => personRows.tablesReady().then(() => ({ entries: readDenyMatcher?.entries ?? [], ruleRows: pathTables?.ruleRows() ?? effectivePathDenyRules })), peerLaneActive, peerSendMessageBuiltIn, runnerSelf, memoryEngineSession: () => memoryEngineSession, sessionIncarnation: () => sessionIncarnation, centerAdoption: () => centerAdoptionRef.current, agentStations: () => agentStationsRef.current, delegated: delegation.isDelegatedChild, sideCallBookRef });
|
|
518
520
|
const tools = roster.tools;
|
|
519
521
|
const crossBoundary = await prepareCrossBoundaryLane({ token: crossBoundaryTree, posture: doors.crossBoundaryPosture, externalContentTargetActive, env: executionEnv, session, resumeLeg: resume !== undefined, sessionId, runId, hostTaskId, deps });
|
|
520
522
|
const sessionProject = await resolveSessionProject(projectMarkerFsOf(executionEnv), taskRootCanonical, spec.projectId);
|
|
@@ -608,6 +610,9 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
608
610
|
return { fault: true };
|
|
609
611
|
}
|
|
610
612
|
})();
|
|
613
|
+
sessionIncarnation = captureLineage.own;
|
|
614
|
+
const sessionAddress = sessionAddressOf({ sessionId, ...(captureLineage.own !== undefined ? { sessionIncarnation: captureLineage.own } : {}), ...(captureLineage.fault ? { sessionIncarnationUnread: true } : {}) });
|
|
615
|
+
const sessionBox = judgeSessionBoxDrain(deps, { sessionId, scope: taskScope, isDelegatedChild: delegation.isDelegatedChild, ...(sessionAddress.unread === true ? { unread: true } : {}), sessions });
|
|
611
616
|
const { memoryEngineSession, memoryTools, memoryWriteGate, composeInjection: composeMemoryInjection, admittedOrgScopes: memoryAdmittedOrgScopes, ownOrgVerdict: memoryOwnOrgVerdict, effectiveMemoryScopes: memoryEffectiveScopes, } = await prepareMemory({
|
|
612
617
|
spec,
|
|
613
618
|
deps,
|
|
@@ -675,7 +680,7 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
675
680
|
handsLessResolvedWriteFace = handsReadFace.handsLessResolvedWriteFace;
|
|
676
681
|
shellGatedTools = handsReadFace.shellGatedTools;
|
|
677
682
|
await armAutoMode();
|
|
678
|
-
const { worktreeSessionRef } = prepareDelegationSurface({ spec, deps, internals, resume, sessionId, hostTaskId, taskScope, taskRootFinal, taskRootCanonical, executionEnv, runnerSelf, backgroundTaskToolsActive, shellReadAdmission, runReadFloor: runFloor, workflowToolsActive, peerLaneActive, peerSendMessageBuiltIn, peerLaneRefs, sessionBox, roster, toolEffects, axisExplicitNegatives, envHandToolNames, toolFaceSnapshot, firstPartyOffload, offloadStore, taskArtifacts, subagentRetain, enrichSpecToolCtx, checkpointSeat, handsCwdRef, wsSnapshot, rebaseWsPath, rebaseRestoredPath, workspaceStateSettle, worktreeSeat });
|
|
683
|
+
const { worktreeSessionRef } = prepareDelegationSurface({ spec, deps, internals, resume, sessionId, sessionAddress, hostTaskId, taskScope, taskRootFinal, taskRootCanonical, executionEnv, runnerSelf, backgroundTaskToolsActive, shellReadAdmission, runReadFloor: runFloor, workflowToolsActive, peerLaneActive, peerSendMessageBuiltIn, peerLaneRefs, sessionBox, roster, toolEffects, axisExplicitNegatives, envHandToolNames, toolFaceSnapshot, firstPartyOffload, offloadStore, taskArtifacts, subagentRetain, enrichSpecToolCtx, checkpointSeat, handsCwdRef, wsSnapshot, rebaseWsPath, rebaseRestoredPath, workspaceStateSettle, worktreeSeat });
|
|
679
684
|
const { liveQuestionFace, contentAskBindings, contentAskRoutable, lateStrandedAnswers, discloseStrandedAnswers, settleContentAskBindings, durableQuestionFace, questionToolMounted, mountedQuestionTool } = prepareQuestionFace({ frozenOnQuestion, spec, askSource, deps, checkpointStore, runtimeCaps, resolvedInteractionPosture, resume, sessionId, roster, toolFaceSnapshot, inheritedUnavailableAsks: () => inheritedUnavailableAsks });
|
|
680
685
|
if (spec.handsReadOnly !== true) {
|
|
681
686
|
const sessionScope = sessionId ?? spec.principal ?? spec.taskId ?? "default";
|
|
@@ -710,7 +715,7 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
710
715
|
}
|
|
711
716
|
}
|
|
712
717
|
const rosterCanPersist = rosterCanPersistMemory(tools.filter(valveLeaves(spec, toolFaceSnapshot.selector)), { effects: toolEffects, handsOffHost: handsEnabled && !pathsAreHostLocal(executionEnv) }, spec.memoryPersistenceCapable);
|
|
713
|
-
const { memoryBlock: memoryBlockFromEngine, recallDisciplineSegment: memoryRecallSegment, seedFiles: memorySeedFiles } = await composeMemoryInjection({ rosterCanPersist, isSubagent: delegation.isNonForkChild });
|
|
718
|
+
const { memoryBlock: memoryBlockFromEngine, recallDisciplineSegment: memoryRecallSegment, seedFiles: memorySeedFiles, noticesFrame: memoryNoticesFrame } = await composeMemoryInjection({ rosterCanPersist, isSubagent: delegation.isNonForkChild });
|
|
714
719
|
if (memorySeedFiles?.length && seedContextFiles) {
|
|
715
720
|
try {
|
|
716
721
|
await seedContextFiles(memorySeedFiles);
|
|
@@ -846,7 +851,7 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
846
851
|
}
|
|
847
852
|
const { basePolicyForResumeEdit, denyNarrowingPolicy, skillGrantLane, allowEntryLanes, policyLayers, effectivePolicy, inheritedUnavailableAsks, inheritedAskGrants, riskAxesOf, ruleOffersOf, grantBindingOf, permissionRuleLane, ruleLaneFacts, permissionRuleOrgLane, storedRuleWholeToolRefusals, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, foldAskClasses, ancestorSandboxAdmissions, ancestorArbitrations, inheritedInstallations } = await preparePolicyChain({ hostFloor: doors.hostFloor, spec, deps, sessionId, runId, hostTaskId, taskRootFinal, additionalRootsCanonical, writeLocation, executionEnv, lockedPreflight: installedPreflight, pathRuleAnchors: { leg: legAnchors, chainTop }, headLeads, tools, harnessTools, selector: toolFaceSnapshot.selector, toolEffects, egressTools, irreversibilityTier, axisExplicitNegatives, shellGatedTools, toolMarkSources, envHandToolNames, handsCwdRef, readDenyMatcher, personRows, questionToolMounted, runtimeCaps, inheritedAncestorRules, ancestorSessionRulesRef, inheritedParentConstraints, seedInheritedGate, skillGrants, skillSpecs, allowedToolTables, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, modBus: legMods.bus, ownModChain, autoModeDecider: () => autoModeDeciderRef.current, readFace: () => resolvedReadFace, permissionMode, toolRosterDeltas: rosterSeat, stopForDenialLimit, askSource, abortController, now, ownSessionRulesRef });
|
|
848
853
|
toolTableViewRef.current = createToolTableView({ policy: effectivePolicy, stored: { wholeToolRefusals: storedRuleWholeToolRefusals }, roster: rosterSeat, fpRef, turnSnapshotRef });
|
|
849
|
-
const { onAsk, preToolContexts, blockedToolCalls, batchHaltRef, blockedTracked, suspendTargetGap, durableSuspendInfraReady, resourceSuspendEligible, usageGovernance, durableApproval, wiringManifest, writeProtection, parkLaneArmed, gateMachineryActive, hookIdentity, hookEnvFace, sessionBoxBound } = prepareWiringManifest({ spec, deps, askSeat: doors.askSeat, hostFloorPosture: doors.hostFloor?.posture, crossBoundaryStationEngaged: crossBoundary.stationEngaged, internals, resume, sessionId, runId, hostTaskId, taskScope, modBus: legMods.bus, standingModBus: legMods.standing, policyLayers, effectivePolicy, handsEnabled, taskRootFinal, legWriteGuard: advertisedWritableDirs?.planFile !== undefined ? { ...legWriteGuard, exemptFiles: [advertisedWritableDirs.planFile] } : legWriteGuard, mcp, irreversibleTools, egressTools, shellReadStationArmed: handsReadFace.shellReadStationArmed, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, permissionMode, lockedPreflight, peerLaneRefs, frameSettlement, receiveSeat, harness, pausedRef, liveInheritedGate, delegation, toolRoster, readDenyBuiltinTiersActive: handsReadFace.readDenyBuiltinTiersActive, lspManagerWired, lspDiagnosticsLive: lspDiagnostics !== undefined, fileHistoryFact, projectMemoryFact, sessionRulesChildrenReadLive: ownSessionRulesRef.current !== undefined, sessionBox, checkpointScope, memoryPollution: () => memoryEngineSession?.pollution, advisorFact: advisor.manifest, runOrigin: doors.runOrigin });
|
|
854
|
+
const { onAsk, preToolContexts, blockedToolCalls, batchHaltRef, blockedTracked, suspendTargetGap, durableSuspendInfraReady, resourceSuspendEligible, usageGovernance, durableApproval, wiringManifest, writeProtection, parkLaneArmed, gateMachineryActive, hookIdentity, hookEnvFace, sessionBoxBound } = prepareWiringManifest({ spec, deps, askSeat: doors.askSeat, hostFloorPosture: doors.hostFloor?.posture, crossBoundaryStationEngaged: crossBoundary.stationEngaged, internals, resume, sessionId, runId, hostTaskId, taskScope, modBus: legMods.bus, standingModBus: legMods.standing, policyLayers, effectivePolicy, handsEnabled, taskRootFinal, legWriteGuard: advertisedWritableDirs?.planFile !== undefined ? { ...legWriteGuard, exemptFiles: [advertisedWritableDirs.planFile] } : legWriteGuard, mcp, irreversibleTools, egressTools, shellReadStationArmed: handsReadFace.shellReadStationArmed, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, permissionMode, lockedPreflight, peerLaneRefs, frameSettlement, receiveSeat, harness, pausedRef, liveInheritedGate, delegation, toolRoster, readDenyBuiltinTiersActive: handsReadFace.readDenyBuiltinTiersActive, lspManagerWired, lspDiagnosticsLive: lspDiagnostics !== undefined, fileHistoryFact, projectMemoryFact, sessionRulesChildrenReadLive: ownSessionRulesRef.current !== undefined, sessionBox, sessionAddress, checkpointScope, memoryPollution: () => memoryEngineSession?.pollution, advisorFact: advisor.manifest, runOrigin: doors.runOrigin });
|
|
850
855
|
agentStationsRef.current = createAgentStations({ bus: legMods.bus, identity: hookIdentity, permissionMode: () => permissionMode.observed });
|
|
851
856
|
sendStationRef.current = createSessionSendStation({ bus: legMods.bus, identity: hookIdentity });
|
|
852
857
|
toolCallStationRef.current = createToolCallStation({ bus: legMods.bus, occurrences: toolOccurrences, blockedToolCalls, identity: hookIdentity, reminderMark, requestMeta: mcpRequestMeta, frameSettlement });
|
|
@@ -869,14 +874,14 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
869
874
|
const { suspendForResource, suspendForPlatformLimit, suspendForReview } = prepareBoundaryParks({ saga, spec, checkpointStore, checkpointScope, abortController, harness, session, sessions, sessionId, askSource, deps, priorLedger, maxSlices, maxSuspends, resourceTotal, priorSuspendCount, suspendChainBase, humanReviewRef, liveSpendRef, now, pausedRef, remoteEnvFailures, resourceSuspendEligible, durableSuspendInfraReady, suspendTargetGap });
|
|
870
875
|
const { parkAsk } = prepareParkAsk({ askLane, saga, spec, deps, sessionId, askSource, checkpointStore, checkpointScope, toolRosterDeltas: rosterSeat, parkLaneArmed, contentAskRoutable, liveQuestionFace, mountedQuestionTool, contentAskBindings, lateStrandedAnswers, discloseStrandedAnswers, onAsk, runtimeCaps, inheritedUnavailableAsks, basePolicyForResumeEdit, budgetSnapshot, handsCwdRef, handsRoot: attachmentRootCanonical, stampCallTarget, shellReadLandings, advertisedWritableDirs, exemptRoots: legExemptRoots, offloadStore, suspendTargetGap, session, sessions, suspendChainBase, maxSuspends, remoteEnvFailures, shellGatedTools, irreversibilityTier, toolMarkSources, effectiveShellGate, durableApproval, priorLedger, liveSpendRef, resourceTotal, ruleOffersOf, grantBindingOf, now, humanReviewRef, abortController, harness, pausedRef });
|
|
871
876
|
const seatInputsFor = skillGateWiring({ tools, skillToolName: SKILL_TOOL_NAME, seatOf: skillSeatOf, mode: () => permissionMode.current, lane: skillGrantLane, onAllowed: (info) => emitTrace(deps.tracer, () => ({ kind: "permission.skill_allowed", version: 1, taskId: hostTaskId, ...info, entries: [...info.entries], ts: Date.now() })), allowEntries: { deploymentAllows: { ...allowEntryLanes.deployment, onAllowed: (info) => emitTrace(deps.tracer, () => ({ kind: "permission.allowed_tools_allowed", version: 1, taskId: hostTaskId, source: "deployment", ...info, entries: [...info.entries], ts: Date.now() })) }, requestAllows: { ...allowEntryLanes.request, onAllowed: (info) => emitTrace(deps.tracer, () => ({ kind: "permission.allowed_tools_allowed", version: 1, taskId: hostTaskId, source: "request", ...info, entries: [...info.entries], ts: Date.now() })) } } });
|
|
872
|
-
const { approvedCallScreen } = prepareGateStations({ askLane, parkAsk, tools, toolRosterDeltas: rosterSeat, crossBoundaryCheck: crossBoundary.seat({ tools, roster: rosterSeat }), deps, toolCallGateArmedRef, effectivePolicy, modBus: legMods.bus, inheritedInstallations, egressTools, irreversibleTools, spec, complianceDenies, harness, blockedToolCalls, inheritedAskGrants, inheritedUnavailableAsks, foldAskClasses, ancestorSandboxAdmissions, preToolContexts, toolOccurrences, batchHaltRef, blockedTracked, hookIdentity, reminderMark, hostTaskId, sessionId, handsCwdRef, stampCallTarget, readDenyInForce: (toolCallId) => ({ tiers: handsReadFace.readDenyBuiltinTiersActive, rows: [...readDenyAdditionsNormalized.map((e) => e.pattern), ...(pathTables?.forCall(toolCallId).ruleRows ?? handsReadFaceInput.denyRuleRows).filter((r) => r.faces.includes("read")).map((r) => r.rule)] }), hookEnvFace, writeProtectionCheck, shellReadCheck, readFace: () => resolvedReadFace, irreversibilityTier, reversibilityProbes, abortController, shellGatedTools, autoModeDecider: autoModeDeciderRef, autoModeDenialTracking: autoModeDenialTrackingRef, askRoute: { ...wiringManifest.ask, effective: askSeatEffective(wiringManifest) }, permissionMode, toolMarkSources, ...(deps.a2a?.isolatePeers === true ? { a2aIsolatePeers: true } : {}), ancestorArbitrations, runId, stopForDenialLimit, permissionRuleLane, seatInputsFor, permissionRuleOrgLane, questionToolMounted, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, delegation, frameSettlement });
|
|
877
|
+
const { approvedCallScreen } = prepareGateStations({ askLane, parkAsk, tools, toolRosterDeltas: rosterSeat, crossBoundaryCheck: crossBoundary.seat({ tools, roster: rosterSeat }), deps, toolCallGateArmedRef, effectivePolicy, modBus: legMods.bus, inheritedInstallations, egressTools, irreversibleTools, spec, complianceDenies, harness, blockedToolCalls, inheritedAskGrants, inheritedUnavailableAsks, foldAskClasses, ancestorSandboxAdmissions, preToolContexts, toolOccurrences, batchHaltRef, blockedTracked, hookIdentity, reminderMark, hostTaskId, sessionId, noticeRoute, noticeDestinations, handsCwdRef, stampCallTarget, readDenyInForce: (toolCallId) => ({ tiers: handsReadFace.readDenyBuiltinTiersActive, rows: [...readDenyAdditionsNormalized.map((e) => e.pattern), ...(pathTables?.forCall(toolCallId).ruleRows ?? handsReadFaceInput.denyRuleRows).filter((r) => r.faces.includes("read")).map((r) => r.rule)] }), hookEnvFace, writeProtectionCheck, shellReadCheck, readFace: () => resolvedReadFace, irreversibilityTier, reversibilityProbes, abortController, shellGatedTools, autoModeDecider: autoModeDeciderRef, autoModeDenialTracking: autoModeDenialTrackingRef, askRoute: { ...wiringManifest.ask, effective: askSeatEffective(wiringManifest) }, permissionMode, toolMarkSources, ...(deps.a2a?.isolatePeers === true ? { a2aIsolatePeers: true } : {}), ancestorArbitrations, runId, stopForDenialLimit, permissionRuleLane, seatInputsFor, permissionRuleOrgLane, questionToolMounted, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, delegation, frameSettlement });
|
|
873
878
|
const postureFrameRef = { report: (err) => deps.onError?.(err, { phase: "degraded", sessionId }) };
|
|
874
879
|
const frameReceipts = { pending: [], listingSnapshotOwed: false };
|
|
875
880
|
const { microCompact, charsPerToken } = prepareContextLane({ model, deps, announced: { announcedListingsRef, frameReceipts }, sessionId, runId, hostTaskId, offloadStore, toolRosterDeltas: rosterSeat, microCompactKnob, harness, batchHaltRef, gitStatusRef, postureFrameRef, requestLossyRef, trimPressureRef, contextOverlay: legContextOverlay, ...(readFileStateForCheckpoint !== undefined ? { readFileState: readFileStateForCheckpoint } : {}) });
|
|
876
881
|
const preparedHolder = {};
|
|
877
882
|
const { cacheBreakDetector, cacheFingerprint, promptOverheadTokens, compactionRestore, normalizeAttachmentPath, isDedupStubResult, recentlyReadFiles, onCompactionApplied, detectExternalChanges, syntheticReadVerdict, consolidationWriteJudge, listBackgroundTasks, taskReadHandleOf, centerCompactionCandidate, effectiveReadFaceObserved, effectiveWriteFaceObserved, effectiveReadDenyObserved } = prepareTurnWiring({ deps, systemPromptSeat, harnessTools, fpRef, model, promptIdentityDigest: promptManifest.identity.artifact, systemBlocks, thinking, spec, sessionId, turnSnapshotRef, promptManifest, charsPerToken, handsEnabled, executionEnv, attachmentRootCanonical, readRoots, modelFileReader: modelFileReaderSeat.current, reminderMark, reminderDisclosureCounts, resolvedReadFace, handsCwdRef, readFileStateForCheckpoint, denyNarrowingPolicy, skillGrants: skillGrantLane, callerPolicy: installedToolPolicy, inheritedPolicies: (inheritedParentConstraints ?? []).flatMap((c) => (c.policy !== undefined ? [c.policy] : [])), persistedRuleLane: permissionRuleLane, ruleLaneFacts, personRowsBeyondRun, orgRuleLane: permissionRuleOrgLane, stampCallTarget, abortController, hostTaskId, taskScope, buildAssembleInputs, identityFor, adoptsCandidates, centerAdoptionRef, harnessRef, carrierReadFace, carrierWriteFace, readDenyAdditionsNormalized, preparedHolder });
|
|
878
883
|
await onceLedger.settle(session, announcedListingsRef);
|
|
879
|
-
const buildPrepared = () => ({ harness, session, sessionId, taskId: hostTaskId, runId, crossBoundary, ...(doors.hostFloor !== undefined ? { hostFloor: doors.hostFloor } : {}), registryAccess: { owner: hostTaskId, scope: taskScope }, reminderMark, reminderDisclosureCounts, fullShellReachable, approvalPosture: { get mode() { return permissionMode.current; }, askEffective: askSeatEffective(wiringManifest) }, ...(outputStyleFrame !== undefined ? { outputStyleFrame } : {}), permissionMode, editedFilesSnapshot, taskRootPath: taskRootFinal, model, thinking, compModel: effectiveCompModel, mcp, ...(mcpRedial !== undefined ? { mcpRedial } : {}), ...(a2a.tools.length > 0 ? { a2a } : {}), blockedRef, outputRef, abortController, conflictRef, blockedToolCalls, toolOccurrences, batchHaltRef, nestedStats, ...(rewindNotes.length > 0 ? { rewindNotes } : {}), ...(fileHistoryBoundary !== undefined ? { fileHistoryBoundary } : {}), ...(effectiveReadFaceObserved !== undefined ? { effectiveReadFace: effectiveReadFaceObserved, effectiveWriteFace: effectiveWriteFaceObserved } : {}), ...(effectiveReadDenyObserved !== undefined ? { effectiveReadDenyPatterns: effectiveReadDenyObserved } : {}), effectiveMemoryScopes: memoryEffectiveScopes, ...(placementValueOrAbsent(placementRootResolved) !== undefined ? { placementRoot: placementRootResolved } : {}), cwdRef: handsCwdRef, ...(attachmentRootCanonical !== undefined ? { handsRoot: attachmentRootCanonical } : {}), ...(stampCallTarget !== undefined ? { stampCallTarget } : {}), toolProgressRef, ...(advertisedWritableDirs !== undefined ? { advertisedWritableDirs } : {}), exemptRoots: legExemptRoots, ...(worktreeSessionRef !== undefined ? { worktreeSessionRef } : {}), workspaceFrame: createWorkspaceFrameSeat({ root: taskRootCanonical, ...(handsCwdRef !== undefined ? { cwdRef: handsCwdRef } : {}), ...(worktreeSessionRef !== undefined ? { worktreeSessionRef } : {}), ...(() => { const s = sessionFrameOf(sessionCheckout.record); return s !== undefined ? { session: s } : {}; })(), ...(sessionProject.project !== undefined ? { project: sessionProject.project } : {}), remote: workspaceRemote }), ...(workspaceStateSettle !== undefined ? { workspaceStateSettle } : {}), ...(sealReadStateSeat !== undefined ? { sealReadStateSeat } : {}), denyNarrowingPolicy, skillGrants: skillGrantLane, skillSpecs, ...(permissionRuleLane !== undefined ? { persistedRuleLane: permissionRuleLane } : {}), ...(basePolicyForResumeEdit !== undefined ? { basePolicyForResumeEdit } : {}), consolidationWriteJudge, ...(permissionRuleOrgLane !== undefined ? { permissionRuleOrg: permissionRuleOrgLane } : {}), releaseSignal, endModeCeiling, settleContentAskBindings, cacheBreakDetector, cacheFingerprint, wiringManifest, promptManifest, promptIdentity, activeTools, ...(deferred.size > 0 ? { deferredToolNames: deferred } : {}), toolMaterializeStatic, deferDirectCall, ...(staticFaceForRef.current !== undefined ? { staticFaceFor: staticFaceForRef.current } : {}), ownedEnv, pausedRef, undeliveredContinuationRef, suspendProgressRef, remoteEnvFailures, reviewRequestRef, suspendLoopRef, suspendForResource, ...(suspendForPlatformLimit !== undefined ? { suspendForPlatformLimit } : {}), ...(envLifetimeSuspendAt !== undefined ? { envLifetimeSuspendAt } : {}), ...(usageGovernance !== undefined ? { usageGovernance } : {}), callIssuedAtRef, workCutRef, loopTerminalRef, brainCallGuardrailRef, gateStopRef, stopForDenialLimit, suspendForReview, ...(readFileStateForCheckpoint !== undefined ? { readFileState: readFileStateForCheckpoint } : {}), resourceLedger: priorLedger, liveSpendRef, humanReviewRef, now, tools, toolRoster, toolRosterDeltas: rosterSeat, structuredProjector, toolEffects, wakeRecovered, promptOverheadTokens, lastBrainContext, lastSentRequest: () => lastBrainContextRef.current, ...(advisor.instruction !== undefined ? { advisorInstruction: advisor.instruction } : {}), ...(compactionRestore !== undefined ? { compactionRestore } : {}), recentlyReadFiles, normalizeAttachmentPath, isDedupStubResult, ...(onCompactionApplied ? { onCompactionApplied } : {}), compactionReuseRef, trimPressureRef, microCompact, ...(memoryEngineSession ? { memoryEngineSession } : {}), ...(subagentRetain ? { subagentRetain } : {}), ...(lspDiagnostics && nudgeLspOnEdit && withheldDiagnosticsOf ? { lspDiagnostics: { registry: lspDiagnostics, nudge: nudgeLspOnEdit, runIdent: lspRunIdent, withheldOf: withheldDiagnosticsOf } } : {}), stopRequestedRef, announcedSnapshotRecovered: onceLedger.recovered, ...(dateChange ? { dateChange } : {}), ...(instructionSources ? { instructionSources } : {}), ...(projectInstructionContent !== undefined ? { projectInstructionContent } : {}), ...(workflowSizeGuideline ? { workflowSizeGuideline } : {}), ...(detectExternalChanges ? { detectExternalChanges } : {}), ...(toolsDeltaRef ? { toolsDeltaRef } : {}), ...(mcpUnavailable ? { mcpUnavailable } : {}), ...(agentListing ? { agentListing } : {}), ...(skillsListing ? { skillsListing } : {}), announcedListingsRef, frameReceipts, frameSettlement, ...(userAttachmentsSeat !== undefined ? { userAttachments: userAttachmentsSeat } : {}), attachmentDelivery: createAttachmentDelivery(), imageUnprocessed, ...(modelFileReaderSeat.current !== undefined ? { modelFileReader: modelFileReaderSeat.current } : {}), syntheticReadVerdict, ...(peerLaneRefs.boundaryRound !== undefined ? { peerBoundaryRound: peerLaneRefs.boundaryRound } : {}), gitStatusRef, postureFrameRef, listBackgroundTasks, taskReadHandleOf, hookIdentity, modBus: legMods.bus, admitRows: rowSeat.admitRows, receiveSeat, turnOpenRedelivery: {}, compactStation, sessionMeasure, sideCallBookRef, ...(sessionBoxBound !== undefined ? { sessionBox: sessionBoxBound } : {}), ...(turnSnapshotRef.current !== undefined ? { turnSnapshot: turnSnapshotRef.current } : {}), ...(centerCompactionCandidate !== undefined ? { centerCompactionCandidate } : {}), ...(shellReadCheck !== undefined ? { shellReadCheck } : {}), ...(shellReadLandings !== undefined ? { shellReadLandings } : {}), ...(toolDisclosureSeat !== undefined ? { toolDisclosure: toolDisclosureSeat } : {}), ...(approvedCallScreen !== undefined ? { approvedCallScreen } : {}), ...(toolCallStationRef.current !== undefined ? { toolCallStation: toolCallStationRef.current } : {}) });
|
|
884
|
+
const buildPrepared = () => ({ harness, session, sessionId, ...(captureLineage.own !== undefined ? { sessionIncarnation: captureLineage.own } : {}), ...(captureLineage.fault ? { sessionIncarnationUnread: true } : {}), taskId: hostTaskId, runId, crossBoundary, ...(doors.hostFloor !== undefined ? { hostFloor: doors.hostFloor } : {}), registryAccess: { owner: hostTaskId, scope: taskScope }, reminderMark, reminderDisclosureCounts, fullShellReachable, approvalPosture: { get mode() { return permissionMode.current; }, askEffective: askSeatEffective(wiringManifest) }, ...(outputStyleFrame !== undefined ? { outputStyleFrame } : {}), permissionMode, editedFilesSnapshot, taskRootPath: taskRootFinal, model, thinking, compModel: effectiveCompModel, mcp, ...(mcpRedial !== undefined ? { mcpRedial } : {}), ...(a2a.tools.length > 0 ? { a2a } : {}), blockedRef, outputRef, abortController, conflictRef, blockedToolCalls, toolOccurrences, batchHaltRef, nestedStats, ...(rewindNotes.length > 0 ? { rewindNotes } : {}), ...(fileHistoryBoundary !== undefined ? { fileHistoryBoundary } : {}), ...(effectiveReadFaceObserved !== undefined ? { effectiveReadFace: effectiveReadFaceObserved, effectiveWriteFace: effectiveWriteFaceObserved } : {}), ...(effectiveReadDenyObserved !== undefined ? { effectiveReadDenyPatterns: effectiveReadDenyObserved } : {}), effectiveMemoryScopes: memoryEffectiveScopes, ...(placementValueOrAbsent(placementRootResolved) !== undefined ? { placementRoot: placementRootResolved } : {}), cwdRef: handsCwdRef, ...(attachmentRootCanonical !== undefined ? { handsRoot: attachmentRootCanonical } : {}), ...(stampCallTarget !== undefined ? { stampCallTarget } : {}), toolProgressRef, ...(advertisedWritableDirs !== undefined ? { advertisedWritableDirs } : {}), exemptRoots: legExemptRoots, ...(worktreeSessionRef !== undefined ? { worktreeSessionRef } : {}), workspaceFrame: createWorkspaceFrameSeat({ root: taskRootCanonical, ...(handsCwdRef !== undefined ? { cwdRef: handsCwdRef } : {}), ...(worktreeSessionRef !== undefined ? { worktreeSessionRef } : {}), ...(() => { const s = sessionFrameOf(sessionCheckout.record); return s !== undefined ? { session: s } : {}; })(), ...(sessionProject.project !== undefined ? { project: sessionProject.project } : {}), remote: workspaceRemote }), ...(workspaceStateSettle !== undefined ? { workspaceStateSettle } : {}), ...(sealReadStateSeat !== undefined ? { sealReadStateSeat } : {}), denyNarrowingPolicy, skillGrants: skillGrantLane, skillSpecs, ...(permissionRuleLane !== undefined ? { persistedRuleLane: permissionRuleLane } : {}), ...(basePolicyForResumeEdit !== undefined ? { basePolicyForResumeEdit } : {}), consolidationWriteJudge, ...(permissionRuleOrgLane !== undefined ? { permissionRuleOrg: permissionRuleOrgLane } : {}), releaseSignal, endModeCeiling, settleContentAskBindings, cacheBreakDetector, cacheFingerprint, wiringManifest, promptManifest, promptIdentity, activeTools, ...(deferred.size > 0 ? { deferredToolNames: deferred } : {}), toolMaterializeStatic, deferDirectCall, ...(staticFaceForRef.current !== undefined ? { staticFaceFor: staticFaceForRef.current } : {}), ownedEnv, pausedRef, undeliveredContinuationRef, suspendProgressRef, remoteEnvFailures, reviewRequestRef, suspendLoopRef, suspendForResource, ...(suspendForPlatformLimit !== undefined ? { suspendForPlatformLimit } : {}), ...(envLifetimeSuspendAt !== undefined ? { envLifetimeSuspendAt } : {}), ...(usageGovernance !== undefined ? { usageGovernance } : {}), callIssuedAtRef, workCutRef, loopTerminalRef, brainCallGuardrailRef, gateStopRef, stopForDenialLimit, suspendForReview, ...(readFileStateForCheckpoint !== undefined ? { readFileState: readFileStateForCheckpoint } : {}), resourceLedger: priorLedger, liveSpendRef, humanReviewRef, now, tools, toolRoster, toolRosterDeltas: rosterSeat, structuredProjector, toolEffects, wakeRecovered, promptOverheadTokens, lastBrainContext, lastSentRequest: () => lastBrainContextRef.current, ...(advisor.instruction !== undefined ? { advisorInstruction: advisor.instruction } : {}), ...(memoryNoticesFrame !== undefined ? { memoryNoticesFrame } : {}), ...(compactionRestore !== undefined ? { compactionRestore } : {}), recentlyReadFiles, normalizeAttachmentPath, isDedupStubResult, ...(onCompactionApplied ? { onCompactionApplied } : {}), compactionReuseRef, trimPressureRef, microCompact, ...(memoryEngineSession ? { memoryEngineSession } : {}), ...(subagentRetain ? { subagentRetain } : {}), ...(lspDiagnostics && nudgeLspOnEdit && withheldDiagnosticsOf ? { lspDiagnostics: { registry: lspDiagnostics, nudge: nudgeLspOnEdit, runIdent: lspRunIdent, withheldOf: withheldDiagnosticsOf } } : {}), stopRequestedRef, announcedSnapshotRecovered: onceLedger.recovered, ...(dateChange ? { dateChange } : {}), ...(instructionSources ? { instructionSources } : {}), ...(projectInstructionContent !== undefined ? { projectInstructionContent } : {}), ...(workflowSizeGuideline ? { workflowSizeGuideline } : {}), ...(detectExternalChanges ? { detectExternalChanges } : {}), ...(toolsDeltaRef ? { toolsDeltaRef } : {}), ...(mcpUnavailable ? { mcpUnavailable } : {}), ...(agentListing ? { agentListing } : {}), ...(skillsListing ? { skillsListing } : {}), announcedListingsRef, frameReceipts, frameSettlement, ...(userAttachmentsSeat !== undefined ? { userAttachments: userAttachmentsSeat } : {}), attachmentDelivery: createAttachmentDelivery(), imageUnprocessed, ...(modelFileReaderSeat.current !== undefined ? { modelFileReader: modelFileReaderSeat.current } : {}), syntheticReadVerdict, ...(peerLaneRefs.boundaryRound !== undefined ? { peerBoundaryRound: peerLaneRefs.boundaryRound } : {}), gitStatusRef, postureFrameRef, listBackgroundTasks, taskReadHandleOf, hookIdentity, modBus: legMods.bus, admitRows: rowSeat.admitRows, receiveSeat, turnOpenRedelivery: {}, compactStation, sessionMeasure, sideCallBookRef, ...(sessionBoxBound !== undefined ? { sessionBox: sessionBoxBound } : {}), ...(turnSnapshotRef.current !== undefined ? { turnSnapshot: turnSnapshotRef.current } : {}), ...(centerCompactionCandidate !== undefined ? { centerCompactionCandidate } : {}), ...(shellReadCheck !== undefined ? { shellReadCheck } : {}), ...(shellReadLandings !== undefined ? { shellReadLandings } : {}), ...(toolDisclosureSeat !== undefined ? { toolDisclosure: toolDisclosureSeat } : {}), ...(approvedCallScreen !== undefined ? { approvedCallScreen } : {}), ...(toolCallStationRef.current !== undefined ? { toolCallStation: toolCallStationRef.current } : {}) });
|
|
880
885
|
refuseLateRosterChanges(callerRoster.roster);
|
|
881
886
|
rollback.commit();
|
|
882
887
|
commitModeSeats(abortController.signal);
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import type { AgentHarness, ExecutionEnv } from "../../internal/harness.js";
|
|
20
20
|
import { type PeerLaneRefs } from "../../agents/peer-session-drain.js";
|
|
21
|
-
import type { SessionBoxBinding } from "../task-notification.js";
|
|
21
|
+
import type { SessionAddress, SessionBoxBinding } from "../task-notification.js";
|
|
22
22
|
import type { OnQuestion } from "../ask-question.js";
|
|
23
23
|
import type { CheckpointStore } from "../checkpoint-store.js";
|
|
24
24
|
import { type HookEnvCapabilities, type HookInvocationIdentity } from "../hooks.js";
|
|
@@ -152,6 +152,8 @@ export interface PrepareWiringManifestInput {
|
|
|
152
152
|
receiveSeat: import("../task-notification.js").FrameReceiver;
|
|
153
153
|
/** borrowed-readonly — the session-box drain's mount verdict (prepare-task's one judgment): present ⇒ this leg drains its own box. */
|
|
154
154
|
sessionBox: SessionBoxBinding | undefined;
|
|
155
|
+
/** borrowed-readonly — the leg's own session address (`sessionAddressOf`): the box is drained for it. */
|
|
156
|
+
sessionAddress: SessionAddress;
|
|
155
157
|
/** borrowed-readonly, read late — the memory session's one-way pollution face (absent with no memory session). The drain marks
|
|
156
158
|
* it when it INJECTS a letter from another principal (the injection path; the tool path is accounted by `ReadInbox`'s class). */
|
|
157
159
|
memoryPollution?: () => Pick<NonNullable<Prepared["memoryEngineSession"]>["pollution"], "markPolluted"> | undefined;
|
|
@@ -120,7 +120,7 @@ function announceDurableGateUnavailable(args) {
|
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
export function prepareWiringManifest(input) {
|
|
123
|
-
const { spec, deps, internals, resume, sessionId, runId, hostTaskId, taskScope, modBus, standingModBus, checkpointScope, policyLayers, effectivePolicy, handsEnabled, taskRootFinal, legWriteGuard, mcp, irreversibleTools, egressTools, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, permissionMode, lockedPreflight, peerLaneRefs, frameSettlement, receiveSeat, sessionBox, harness, pausedRef, askSeat, liveInheritedGate, delegation, toolRoster, readDenyBuiltinTiersActive, lspManagerWired, shellReadStationArmed, crossBoundaryStationEngaged, lspDiagnosticsLive, fileHistoryFact, projectMemoryFact, sessionRulesChildrenReadLive, memoryPollution, advisorFact, hostFloorPosture, runOrigin } = input;
|
|
123
|
+
const { spec, deps, internals, resume, sessionId, runId, hostTaskId, taskScope, modBus, standingModBus, checkpointScope, policyLayers, effectivePolicy, handsEnabled, taskRootFinal, legWriteGuard, mcp, irreversibleTools, egressTools, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, permissionMode, lockedPreflight, peerLaneRefs, frameSettlement, receiveSeat, sessionBox, sessionAddress, harness, pausedRef, askSeat, liveInheritedGate, delegation, toolRoster, readDenyBuiltinTiersActive, lspManagerWired, shellReadStationArmed, crossBoundaryStationEngaged, lspDiagnosticsLive, fileHistoryFact, projectMemoryFact, sessionRulesChildrenReadLive, memoryPollution, advisorFact, hostFloorPosture, runOrigin } = input;
|
|
124
124
|
const onAsk = askSeat.value;
|
|
125
125
|
const handWriteTools = toolRoster.entries.filter((e) => e.mountedBy === "hands" && (e.effect === "write" || e.effect === "idempotent")).map((e) => e.name);
|
|
126
126
|
const hasEffectAwareGate = policyLayers.length > 0 || chainJudges(standingModBus);
|
|
@@ -246,7 +246,8 @@ export function prepareWiringManifest(input) {
|
|
|
246
246
|
if (sessionBoxBound !== undefined && internals?.onTaskNotification !== undefined) {
|
|
247
247
|
bindPeerLaneDrain(harness, {
|
|
248
248
|
deps,
|
|
249
|
-
|
|
249
|
+
address: sessionAddress,
|
|
250
|
+
sessions,
|
|
250
251
|
runId,
|
|
251
252
|
scope: taskScope,
|
|
252
253
|
inject: internals.onTaskNotification,
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* The resume ladder's ADMISSION rung (E1) and the wake's shaping (E2), verbatim from
|
|
3
3
|
* `Runner.resumeStream`: the outcome container's domain, the one-read snapshots of the caller's config and
|
|
4
4
|
* the trusted internals bag, the store resolution, the row read and its terminal-status confirm, the row's own verdict,
|
|
5
|
-
* the same-process parent-constraint re-supply, then the wake pre-ladder (gate purity,
|
|
6
|
-
*
|
|
5
|
+
* the same-process parent-constraint re-supply, then the wake pre-ladder (gate purity, the message's persist-time validation)
|
|
6
|
+
* and the one read of the outcome discriminant and the signal slot.
|
|
7
7
|
*
|
|
8
8
|
* Async (two store reads); every refusal throws a typed `CheckpointError` pre-CAS. It ends by handing what it
|
|
9
9
|
* admitted to the rung after it (`next`) in its LAST continuation — no suspension point between the
|
|
@@ -7,13 +7,12 @@ import { runExpiredDuty } from "./expire-settle.js";
|
|
|
7
7
|
import { describeSuppliedValue } from "./decide-continuation.js";
|
|
8
8
|
import { detachSkillLists } from "../skill-grant.js";
|
|
9
9
|
import { readCallerSpec } from "../task-spec-members.js";
|
|
10
|
-
import {
|
|
10
|
+
import { PAUSE_REGISTRY } from "../pause-registry.js";
|
|
11
11
|
const DECIDE_ENTRY_BY_RESUME_GATE = {
|
|
12
12
|
policy_ask: "a `policy_ask` outcome (decision allow/deny bound to the pending tool call)",
|
|
13
13
|
dry_run_review: "a `dry_run_review` outcome (decision approve/reject)",
|
|
14
14
|
plan_review: "a `plan_review` outcome (decision approve/edit/reject)",
|
|
15
15
|
resource_limit: 'a `resource_limit` outcome (decision "continue")',
|
|
16
|
-
task_done: undefined,
|
|
17
16
|
};
|
|
18
17
|
export async function resumeAdmission(input) {
|
|
19
18
|
const { token, outcome, taskConfig, runner, sessions, parentConstraintRegistry, suspendedEnvReaps } = input;
|
|
@@ -71,29 +70,9 @@ export async function resumeAdmission(input) {
|
|
|
71
70
|
if (outcomeGate === "wake") {
|
|
72
71
|
suppliedMessage = outcome.message;
|
|
73
72
|
const gk = cp.gate.kind;
|
|
74
|
-
const decideEntry = isGateKind(gk) ? DECIDE_ENTRY_BY_RESUME_GATE[PAUSE_REGISTRY[gk].resume] : undefined;
|
|
75
73
|
if (gk !== "task_done") {
|
|
76
74
|
throw new CheckpointError("wake.gate_pending", `cannot wake: this checkpoint awaits a pending gate decision (gate "${gk}") — wake is not a decision ` +
|
|
77
|
-
`channel; resume it with ${
|
|
78
|
-
}
|
|
79
|
-
const pa = cp.pendingAction;
|
|
80
|
-
switch (pa.kind) {
|
|
81
|
-
case "task_done":
|
|
82
|
-
break;
|
|
83
|
-
case "tool_approval":
|
|
84
|
-
case "resource_limit":
|
|
85
|
-
case "review":
|
|
86
|
-
case "plan_review": {
|
|
87
|
-
throw new CheckpointError("wake.gate_pending", `cannot wake: this checkpoint still carries a pending gate-typed action (pendingAction "${pa.kind}" ` +
|
|
88
|
-
`on a "${gk}" gate — inconsistent row) — wake is not a decision channel; resolve it through its ` +
|
|
89
|
-
`own decide entry instead`);
|
|
90
|
-
}
|
|
91
|
-
default: {
|
|
92
|
-
const _exhaustive = pa;
|
|
93
|
-
void _exhaustive;
|
|
94
|
-
throw new CheckpointError("wake.gate_pending", `cannot wake: this checkpoint carries an unrecognized pendingAction kind "${pa.kind}" ` +
|
|
95
|
-
`(newer-version row?) — fail-closed: wake only serves a pure park (pendingAction "task_done")`);
|
|
96
|
-
}
|
|
75
|
+
`channel; resume it with ${DECIDE_ENTRY_BY_RESUME_GATE[PAUSE_REGISTRY[gk].resume]} instead`);
|
|
97
76
|
}
|
|
98
77
|
if (suppliedMessage !== undefined) {
|
|
99
78
|
wakeMessage = validatePendingSteer(suppliedMessage);
|