@sema-agent/core 7.72.0 → 7.73.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 +319 -0
- package/dist/agents/inherited-tool-pool.d.ts +26 -1
- package/dist/agents/inherited-tool-pool.js +46 -2
- package/dist/agents/parked-resume-drive.d.ts +10 -0
- package/dist/agents/parked-resume-drive.js +9 -0
- package/dist/agents/retain-ledger.d.ts +3 -0
- package/dist/agents/send-message-tool.js +1 -0
- package/dist/agents/send-user-message-tool.d.ts +12 -0
- package/dist/agents/send-user-message-tool.js +67 -0
- package/dist/agents/subagent-steps.d.ts +9 -0
- package/dist/agents/subagent-steps.js +38 -0
- package/dist/agents/subagent.d.ts +2 -0
- package/dist/agents/subagent.js +43 -12
- package/dist/agents/verify.js +23 -8
- package/dist/agents/yield-adoption.js +3 -1
- package/dist/brain/anthropic.js +14 -9
- package/dist/brain/open-responses.js +4 -5
- package/dist/brain/openai.js +30 -23
- package/dist/brain/stream-engine.js +159 -151
- package/dist/core/actions-digest.d.ts +43 -0
- package/dist/core/actions-digest.js +22 -0
- package/dist/core/allow-entry.js +3 -3
- package/dist/core/auto-mode.d.ts +7 -9
- package/dist/core/auto-mode.js +114 -8
- package/dist/core/checkpoint-features.d.ts +3 -2
- package/dist/core/checkpoint-features.js +1 -1
- package/dist/core/checkpoint-rekey.d.ts +1 -1
- package/dist/core/checkpoint-rekey.js +6 -1
- package/dist/core/checkpoint-requirements.d.ts +23 -3
- package/dist/core/checkpoint-requirements.js +5 -1
- package/dist/core/checkpoint-row-verdict.js +7 -1
- package/dist/core/checkpoint-store.d.ts +24 -2
- package/dist/core/checkpoint-store.js +1 -0
- package/dist/core/child-clamp-seats.d.ts +15 -0
- package/dist/core/child-clamp-seats.js +15 -0
- package/dist/core/delegation-frames.d.ts +1 -0
- package/dist/core/delegation-frames.js +1 -1
- package/dist/core/engine-capabilities.d.ts +5 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +30 -22
- package/dist/core/engine-version.js +1 -1
- package/dist/core/entries-not-applied.d.ts +19 -7
- package/dist/core/entries-not-applied.js +33 -1
- package/dist/core/governance-codes.d.ts +7 -1
- package/dist/core/governance-codes.js +13 -5
- package/dist/core/hooks.d.ts +3 -0
- package/dist/core/hooks.js +1 -0
- package/dist/core/host-instance.d.ts +23 -0
- package/dist/core/host-instance.js +69 -0
- package/dist/core/instruction-preview.d.ts +63 -0
- package/dist/core/instruction-preview.js +406 -0
- package/dist/core/leg-budget.d.ts +26 -0
- package/dist/core/leg-budget.js +9 -0
- package/dist/core/leg-identity.d.ts +51 -1
- package/dist/core/leg-identity.js +45 -2
- package/dist/core/manager-launch-check.d.ts +48 -0
- package/dist/core/manager-launch-check.js +64 -0
- package/dist/core/mcp-call-meta.d.ts +2 -2
- package/dist/core/mcp-injection-drop.d.ts +20 -10
- package/dist/core/mcp-injection-drop.js +9 -3
- package/dist/core/mcp-server-spec.d.ts +2 -1
- package/dist/core/member-outcome.d.ts +3 -2
- package/dist/core/member-outcome.js +1 -1
- package/dist/core/memory-engine/deletion-record.d.ts +46 -0
- package/dist/core/memory-engine/deletion-record.js +96 -0
- package/dist/core/memory-engine/engine.js +24 -16
- package/dist/core/memory-engine/file-backend.js +7 -5
- package/dist/core/memory-engine/projection-ledger.d.ts +1 -1
- package/dist/core/memory-engine/projection-ledger.js +1 -1
- package/dist/core/memory-engine/scope-contract.d.ts +18 -13
- package/dist/core/memory-engine/scope-contract.js +18 -18
- package/dist/core/memory-engine/sync-client.js +26 -6
- package/dist/core/memory-engine/sync.d.ts +20 -2
- package/dist/core/memory-engine/sync.js +18 -17
- package/dist/core/mode-policy.d.ts +21 -6
- package/dist/core/mode-policy.js +15 -6
- package/dist/core/own-property-receipt.js +11 -4
- package/dist/core/parent-spec-seat.d.ts +13 -11
- package/dist/core/parent-spec-seat.js +13 -9
- package/dist/core/peer-seat.js +3 -3
- package/dist/core/peer-task-store.d.ts +365 -0
- package/dist/core/peer-task-store.js +682 -0
- package/dist/core/permission-rule-consent.js +6 -11
- package/dist/core/permission-rule-model.d.ts +27 -0
- package/dist/core/permission-rule-model.js +33 -5
- package/dist/core/permission-rule-provider.d.ts +35 -33
- package/dist/core/permission-rule-provider.js +38 -295
- package/dist/core/permission-rule-store.d.ts +181 -8
- package/dist/core/permission-rule-store.js +420 -17
- package/dist/core/permission-rule-sync.js +15 -1
- package/dist/core/project-seat.d.ts +55 -0
- package/dist/core/project-seat.js +96 -0
- package/dist/core/protocol-http-auth.d.ts +3 -2
- package/dist/core/protocol-http-auth.js +26 -18
- package/dist/core/remote-env.d.ts +4 -4
- package/dist/core/retired-keys.js +1 -0
- package/dist/core/rule-offer-read.d.ts +1 -1
- package/dist/core/rule-offer-read.js +32 -4
- package/dist/core/run-ledger-seat.d.ts +66 -0
- package/dist/core/run-ledger-seat.js +70 -0
- package/dist/core/run-ledger.d.ts +332 -0
- package/dist/core/run-ledger.js +550 -0
- package/dist/core/runner/checkpoint-scope.d.ts +13 -3
- package/dist/core/runner/checkpoint-scope.js +12 -4
- package/dist/core/runner/construction-doors.js +6 -0
- package/dist/core/runner/contracts.d.ts +21 -5
- package/dist/core/runner/delegation-owner.d.ts +30 -0
- package/dist/core/runner/delegation-owner.js +20 -4
- package/dist/core/runner/finish-reason-seat.js +4 -2
- package/dist/core/runner/leg-frame.js +3 -0
- package/dist/core/runner/nested-memory-lane.d.ts +22 -5
- package/dist/core/runner/nested-memory-lane.js +91 -30
- package/dist/core/runner/person-path-rows.d.ts +21 -16
- package/dist/core/runner/person-path-rows.js +80 -15
- package/dist/core/runner/prepare-caps-and-workflow.js +98 -88
- package/dist/core/runner/prepare-config-doors.d.ts +1 -0
- package/dist/core/runner/prepare-config-doors.js +5 -3
- package/dist/core/runner/prepare-context-lane.js +1 -0
- package/dist/core/runner/prepare-delegation-surface.d.ts +3 -0
- package/dist/core/runner/prepare-delegation-surface.js +6 -0
- package/dist/core/runner/prepare-execution-env.d.ts +3 -3
- package/dist/core/runner/prepare-hands-readface.d.ts +5 -2
- package/dist/core/runner/prepare-hands-readface.js +12 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +6 -3
- package/dist/core/runner/prepare-inherited-gate.js +13 -5
- package/dist/core/runner/prepare-run-refs.d.ts +1 -1
- package/dist/core/runner/prepare-run-refs.js +3 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +6 -2
- package/dist/core/runner/prepare-suspend-saga.js +4 -2
- package/dist/core/runner/prepare-task.js +36 -27
- package/dist/core/runner/prepare-turn-wiring.d.ts +4 -3
- package/dist/core/runner/prepare-turn-wiring.js +2 -1
- package/dist/core/runner/prepare-wiring-manifest.d.ts +3 -1
- package/dist/core/runner/prepare-wiring-manifest.js +5 -2
- package/dist/core/runner/resume-apply.js +11 -5
- package/dist/core/runner/resume-review-outcome.d.ts +3 -0
- package/dist/core/runner/resume-review-outcome.js +24 -1
- package/dist/core/runner/run-harness-handlers.js +3 -0
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +3 -0
- package/dist/core/runner/run-notification-lane.js +20 -1
- package/dist/core/runner/run-settle-and-teardown.js +21 -12
- package/dist/core/runner/run-stop-and-final-verify.js +6 -0
- package/dist/core/runner/run-telemetry-and-budget-seats.js +1 -1
- package/dist/core/runner/runtask.d.ts +6 -2
- package/dist/core/runner/runtask.js +21 -9
- package/dist/core/runner/shell-env-withheld.d.ts +3 -2
- package/dist/core/runner/shell-env-withheld.js +1 -2
- package/dist/core/runner/stop-tail-notice.d.ts +10 -2
- package/dist/core/runner/stop-tail-notice.js +9 -2
- package/dist/core/runner/stream-settle-backstop.d.ts +1 -0
- package/dist/core/runner/stream-settle-backstop.js +1 -0
- package/dist/core/runner/task-start-doors.js +6 -3
- package/dist/core/runner/terminal-account.d.ts +6 -1
- package/dist/core/runner/terminal-account.js +16 -1
- package/dist/core/runner/unreadable-person-rows.d.ts +2 -1
- package/dist/core/runner-deps.d.ts +13 -10
- package/dist/core/secret-env.d.ts +53 -37
- package/dist/core/secret-env.js +44 -47
- package/dist/core/session-checkout.d.ts +3 -0
- package/dist/core/session-checkout.js +1 -0
- package/dist/core/session-store.d.ts +12 -6
- package/dist/core/session-store.js +26 -6
- package/dist/core/session.d.ts +31 -8
- package/dist/core/store-contracts/checkpoint-store-contract.js +10 -0
- package/dist/core/store-contracts/peer-task-store-contract.d.ts +21 -0
- package/dist/core/store-contracts/peer-task-store-contract.js +516 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +15 -2
- package/dist/core/store-contracts/session-store-contract.js +87 -3
- package/dist/core/store-contracts/workflow-journal-store-contract.d.ts +19 -1
- package/dist/core/store-contracts/workflow-journal-store-contract.js +89 -1
- package/dist/core/task-event.d.ts +10 -3
- package/dist/core/task-notification.d.ts +96 -10
- package/dist/core/task-notification.js +129 -5
- package/dist/core/task-registry-shared.d.ts +12 -1
- package/dist/core/task-registry-shared.js +3 -1
- package/dist/core/task-registry-workflow.d.ts +1 -1
- package/dist/core/task-registry-workflow.js +9 -1
- package/dist/core/task-registry.d.ts +39 -2
- package/dist/core/task-registry.js +76 -12
- package/dist/core/task-result.d.ts +13 -0
- package/dist/core/task-spec-members.d.ts +3 -1
- package/dist/core/task-spec-members.js +11 -3
- package/dist/core/task-spec.d.ts +48 -22
- package/dist/core/tool-catalog-entries.js +2 -0
- package/dist/core/tool-mount-facts.d.ts +1 -1
- package/dist/core/tool-mount-facts.js +1 -0
- package/dist/core/tool-mount-plan.d.ts +3 -1
- package/dist/core/tool-mount-plan.js +6 -0
- package/dist/core/tool-mount-static.d.ts +1 -1
- package/dist/core/tool-mount-static.js +4 -2
- package/dist/core/tool-result-store.d.ts +19 -2
- package/dist/core/tool-result-store.js +51 -2
- package/dist/core/tool-spec.d.ts +9 -2
- package/dist/core/user-attachment.d.ts +5 -1
- package/dist/core/user-attachment.js +14 -7
- package/dist/core/wiring-manifest.d.ts +26 -20
- package/dist/core/wiring-manifest.js +7 -3
- package/dist/core/workflow-journal-store.d.ts +53 -10
- package/dist/core/workflow-journal-store.js +27 -4
- package/dist/core/workflow-run-store-contract.js +16 -0
- package/dist/core/workflow-run-store.d.ts +9 -7
- package/dist/core/workflow-run-store.js +4 -1
- package/dist/engine/execution-env/node-execution-env.js +3 -1
- package/dist/engine/harness/types.d.ts +24 -1
- package/dist/engine/harness/types.js +10 -0
- package/dist/engine/llm/types.d.ts +5 -7
- package/dist/engine/lsp/node-lsp-manager.js +2 -1
- package/dist/engine/session/import-validate.js +6 -1
- package/dist/engine/session/session.d.ts +15 -2
- package/dist/engine/session/session.js +34 -4
- package/dist/index.d.ts +18 -7
- package/dist/index.js +13 -4
- package/dist/orchestration/run-workflow-tool.js +40 -32
- package/dist/orchestration/workflow-park-adoption.d.ts +51 -12
- package/dist/orchestration/workflow-park-adoption.js +47 -12
- package/dist/orchestration/workflow-stop.d.ts +128 -0
- package/dist/orchestration/workflow-stop.js +156 -0
- package/dist/orchestration/workflow.d.ts +30 -6
- package/dist/orchestration/workflow.js +117 -55
- package/dist/prompts/manager-recipe.d.ts +18 -0
- package/dist/prompts/manager-recipe.js +24 -0
- package/dist/stores/file/permission-rule-store.d.ts +3 -1
- package/dist/stores/file/permission-rule-store.js +0 -1
- package/dist/stores/file/workflow-journal-store.d.ts +16 -3
- package/dist/stores/file/workflow-journal-store.js +93 -5
- package/dist/stores/file/workflow-run-store.d.ts +1 -1
- package/dist/tools/fs/file-write-check.js +9 -3
- package/dist/tools/fs/index.d.ts +8 -7
- package/dist/tools/fs/index.js +4 -4
- package/dist/tools/fs/read-deny-home.d.ts +1 -1
- package/dist/tools/fs/read-deny-home.js +5 -5
- package/dist/tools/fs/read-deny.d.ts +33 -8
- package/dist/tools/fs/read-deny.js +114 -25
- package/dist/tools/fs/safety.d.ts +4 -1
- package/dist/tools/fs/safety.js +4 -2
- package/dist/tools/fs/shell-read-check.d.ts +9 -2
- package/dist/tools/fs/shell-read-check.js +96 -14
- package/dist/tools/fs/shell-read-establish.d.ts +9 -0
- package/dist/tools/fs/shell-read-establish.js +21 -11
- package/dist/tools/fs/shell-read-judge.d.ts +13 -1
- package/dist/tools/fs/shell-read-judge.js +26 -7
- package/dist/tools/fs/shell-read-plan.d.ts +5 -0
- package/dist/tools/fs/shell-read-write-targets.js +17 -9
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +131 -1
- package/wire-changes/answers/core-stores-sql@7.73.0.json +28 -0
- package/wire-changes/answers/core@7.73.0.json +216 -0
- package/wire-changes/answers/mods-kernel@7.73.0.json +7 -0
- package/wire-changes/answers/primitives@7.73.0.json +12 -0
- package/wire-changes/answers/wiki-gate@7.73.0.json +7 -0
- package/wire-changes/core-stores-sql@7.73.0.json +326 -0
- package/wire-changes/core@7.73.0.json +6480 -0
- package/wire-changes/mods-kernel@7.73.0.json +147 -0
- package/wire-changes/primitives@7.73.0.json +227 -0
- package/wire-changes/wiki-gate@7.73.0.json +145 -0
|
@@ -52,7 +52,7 @@ import type { PathRuleBases } from "../permission-rule-model.js";
|
|
|
52
52
|
import type { PermissionMode, RunnerDeps, RuntimeCaps, ShellGateDoctrine, TaskEvent, TaskSpec, ToolExecuteContext, ToolSpec } from "../types.js";
|
|
53
53
|
import { PermissionModeController } from "../mode-policy.js";
|
|
54
54
|
import { type SkillGrantTable } from "../skill-grant.js";
|
|
55
|
-
import type { InheritedGate, Prepared, PrepareResume, RunInternals, StopForDenialLimit, ToolFaceSnapshot, WriteFaceSeat } from "./contracts.js";
|
|
55
|
+
import type { CarriedFaces, InheritedGate, Prepared, PrepareResume, RunInternals, StopForDenialLimit, ToolFaceSnapshot, WriteFaceSeat } from "./contracts.js";
|
|
56
56
|
import type { RosterSpec } from "./caller-roster.js";
|
|
57
57
|
import type { DelegationSettlementSeat } from "../tool-spec.js";
|
|
58
58
|
import type { ToolMountFacts } from "../tool-mount-facts.js";
|
|
@@ -62,7 +62,7 @@ export interface PrepareInheritedGateInput {
|
|
|
62
62
|
* / `oneShot` / `clientContext` / `principal` / `additionalDirectories` / `additionalReadDirectories` / `envFacts` /
|
|
63
63
|
* `memoryPersistenceCapable` / `getApiKeyAndHeaders` / `backgroundScope` / `enablePlanMode` (the ctx enrichment's
|
|
64
64
|
* trusted seats). Never mutated. */
|
|
65
|
-
spec: Pick<RosterSpec, "durableApproval"> & Pick<TaskSpec, "shellGate" | "onQuestion" | "handsReadOnly" | "interactiveTools" | "oneShot" | "clientContext" | "principal" | "isolationScope" | "additionalDirectories" | "additionalReadDirectories" | "envFacts" | "memoryPersistenceCapable" | "getApiKeyAndHeaders" | "backgroundScope" | "enablePlanMode">;
|
|
65
|
+
spec: Pick<RosterSpec, "durableApproval"> & Pick<TaskSpec, "shellGate" | "onQuestion" | "handsReadOnly" | "ownHandsReadOnly" | "interactiveTools" | "oneShot" | "clientContext" | "principal" | "isolationScope" | "additionalDirectories" | "additionalReadDirectories" | "envFacts" | "memoryPersistenceCapable" | "getApiKeyAndHeaders" | "backgroundScope" | "enablePlanMode">;
|
|
66
66
|
/** borrowed-readonly — the seat this run hands its children (`checkpointSeatOf`, minted once by the driver after the config doors): the ctx's `checkpointStoreForChildren`, absent when the run has no seat. */
|
|
67
67
|
checkpointSeat: import("../checkpoint-seat.js").CheckpointSeat | undefined;
|
|
68
68
|
/** borrowed-readonly — the command sandbox requirement this run runs under (a resumed leg's: the parked one as a floor under the
|
|
@@ -96,7 +96,7 @@ export interface PrepareInheritedGateInput {
|
|
|
96
96
|
/** borrowed-readonly — the trusted spawn-side channel: `inheritedGate` (the LIVE half of the chain fold), `ownOrgAdmissionRef`
|
|
97
97
|
* (the same-session continuation's freeze), `delegationProvenance` (the F-012 stamp), and the identity / peer / notification
|
|
98
98
|
* seats the ctx enrichment forwards. Never mutated. */
|
|
99
|
-
internals: Pick<RunInternals, "inheritedGate" | "isDelegatedChild" | "observerLeg" | "sessionModeSeats" | "ownOrgAdmissionRef" | "delegationProvenance" | "memoryCaptureAncestors" | "parentTaskId" | "parentSessionId" | "rootSessionId" | "rootSessionIncarnation" | "rootSessionScope" | "placementRoot" | "explicitAgentName" | "peerSelfRef" | "peerInboundChainRef" | "onTaskNotification" | "onSubagentSpawn" | "onSubtreeActivity" | "insideFork" | "questionFaceStripped"> | undefined;
|
|
99
|
+
internals: Pick<RunInternals, "inheritedGate" | "isDelegatedChild" | "observerLeg" | "sessionModeSeats" | "ownOrgAdmissionRef" | "delegationProvenance" | "memoryCaptureAncestors" | "parentTaskId" | "parentSessionId" | "rootSessionId" | "rootSessionIncarnation" | "rootSessionScope" | "placementRoot" | "explicitAgentName" | "peerSelfRef" | "peerInboundChainRef" | "onTaskNotification" | "onSubagentSpawn" | "onSubtreeActivity" | "insideFork" | "questionFaceStripped" | "runLedgerBook"> | undefined;
|
|
100
100
|
/** borrowed-readonly — the resume leg, or undefined on a fresh one: `seed.inheritedGate` is the CHECKPOINT half of the chain
|
|
101
101
|
* fold (the trust floor the live half may only tighten), `seed.readFace` the hands-less re-park's carried section. */
|
|
102
102
|
resume: Pick<PrepareResume, "seed" | "outcome"> | undefined;
|
|
@@ -236,6 +236,9 @@ export interface PrepareInheritedGateInput {
|
|
|
236
236
|
handsLessResolvedFace: () => ContainmentFace | undefined;
|
|
237
237
|
/** borrowed-readonly — LATE-BOUND: the hands-less legs' resolved WRITE face (same second source, write seat). */
|
|
238
238
|
handsLessResolvedWriteFace: () => WriteFaceSeat | undefined;
|
|
239
|
+
/** borrowed-readonly — LATE-BOUND: a leg that narrowed only its own hands (`TaskSpec.ownHandsReadOnly`): the faces its children
|
|
240
|
+
* are handed, resolved without that narrowing; undefined on every other leg (its children take its own faces). */
|
|
241
|
+
carriedFaces: () => CarriedFaces | undefined;
|
|
239
242
|
/** borrowed-readonly — LATE-BOUND: the leg's resolved `blockReadsOutsideRoots` (the hands phase's one answer, on either
|
|
240
243
|
* branch: the declaration, or the resumed row's record of it) — what the children's clamp takes, never the spec's word. */
|
|
241
244
|
readBlock: () => boolean;
|
|
@@ -5,7 +5,7 @@ import { parentSpecSeatOf } from "../parent-spec-seat.js";
|
|
|
5
5
|
import { legIdentityOf } from "../isolation-scope.js";
|
|
6
6
|
import { rootAnchorOf } from "../leg-identity.js";
|
|
7
7
|
import { chainJudges, sameInstallation } from "../mods/stations.js";
|
|
8
|
-
import { childClampSeats, clampSourceOf } from "../child-clamp-seats.js";
|
|
8
|
+
import { childClampSeats, clampSourceOf, handsReadOnlyCarried } from "../child-clamp-seats.js";
|
|
9
9
|
import { inheritedRuleKeyOf } from "../session-policy-store.js";
|
|
10
10
|
import { rowFollowsFloor } from "./session-rule-policy.js";
|
|
11
11
|
import { declaresSubagentPlacement } from "../session.js";
|
|
@@ -16,7 +16,7 @@ import { chainAnchorRecords } from "./child-tree.js";
|
|
|
16
16
|
import { defaultTaskRegistry } from "../task-registry.js";
|
|
17
17
|
import { joinRuleBuckets, persistedRuleBucketsOf, readRuleBuckets } from "../persisted-rule-buckets.js";
|
|
18
18
|
import { deliverEngineNotice } from "../types.js";
|
|
19
|
-
import { PermissionModeController, autoModeFaceOf, modeRequestAfterResume } from "../mode-policy.js";
|
|
19
|
+
import { PermissionModeController, autoModeFaceOf, modeRequestAfterResume, withheldApprovalMode } from "../mode-policy.js";
|
|
20
20
|
import { SessionModeSeats } from "./session-mode-seats.js";
|
|
21
21
|
import { recordedModeSeed } from "../checkpoint-row-verdict.js";
|
|
22
22
|
import { frozenSkillGrants } from "../skill-grant.js";
|
|
@@ -73,8 +73,14 @@ export function prepareInheritedGate(input) {
|
|
|
73
73
|
deliverEngineNotice(deps.onNotice, { code: "config.permission_mode_unavailable", message: `${message} (a child leg, ${sessionId})`, detail: { requested: folded, effective: receipt.effective, by: receipt.foldedBy, sessionId: parentSeat.sessionId, childSessionId: sessionId, runId } });
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
const
|
|
76
|
+
const parentModeUnknown = input.delegated && ceiling === undefined ? true : undefined;
|
|
77
|
+
const withheldMode = withheldApprovalMode(permissionModeSeat, modeSeed, resume?.outcome, parentModeUnknown);
|
|
78
|
+
const permissionMode = new PermissionModeController(modeRequestAfterResume(permissionModeSeat, modeSeed, resume?.outcome, parentModeUnknown), ceiling, { onFold: announceModeFold, ...(modeSeed.prePlanMode !== undefined ? { prePlanMode: modeSeed.prePlanMode } : {}), ...(wiringLegKindOf(resume !== undefined, internals) === "root" && deps.permissionModeWhenUnset !== undefined ? { whenUnset: deps.permissionModeWhenUnset } : {}) });
|
|
77
79
|
permissionMode.announceStart();
|
|
80
|
+
if (withheldMode !== undefined) {
|
|
81
|
+
const message = `permission mode "${withheldMode}" the approval named is not taken on this leg (its parent's mode was not handed to this resume, so the ceiling a widening is held to is unknown) — it runs under "${permissionMode.current}"`;
|
|
82
|
+
deliverEngineNotice(deps.onNotice, { code: "config.permission_mode_unavailable", message, detail: { requested: withheldMode, effective: permissionMode.current, by: "inherited_ceiling", sessionId, runId } });
|
|
83
|
+
}
|
|
78
84
|
const { ceiling: legModeCeiling, commit: commitLegModeCeiling, end: endModeCeiling } = (internals?.sessionModeSeats ?? new SessionModeSeats()).legCeiling(sessionId, permissionMode);
|
|
79
85
|
const commitModeSeats = (legSignal) => {
|
|
80
86
|
commitLegModeCeiling();
|
|
@@ -189,8 +195,9 @@ export function prepareInheritedGate(input) {
|
|
|
189
195
|
const carrierWriteFace = () => (input.resolvedWriteFace() ?? input.handsLessResolvedWriteFace())?.inForce();
|
|
190
196
|
const runClampSource = () => ({
|
|
191
197
|
...clampSourceOf(spec, "clamp"),
|
|
192
|
-
|
|
193
|
-
|
|
198
|
+
handsReadOnly: handsReadOnlyCarried(spec),
|
|
199
|
+
readFace: input.carriedFaces()?.read ?? carrierReadFace(),
|
|
200
|
+
writeFace: input.carriedFaces()?.write.inForce() ?? carrierWriteFace(),
|
|
194
201
|
blockReadsOutsideRoots: input.readBlock() ? true : undefined,
|
|
195
202
|
readDenyPatterns: input.readDenyAdditionsNormalized(),
|
|
196
203
|
agentConfigDirs: input.callerPlaces.configRoots.carried, agentHomeDirs: input.callerPlaces.homes.carried,
|
|
@@ -226,6 +233,7 @@ export function prepareInheritedGate(input) {
|
|
|
226
233
|
...(leg.isolationScope !== undefined ? { isolationScope: leg.isolationScope } : {}),
|
|
227
234
|
...(frozenOnAsk !== undefined ? { onAsk: frozenOnAsk } : {}),
|
|
228
235
|
...childClampSeats(runClampSource()),
|
|
236
|
+
...(internals?.runLedgerBook !== undefined ? { runLedgerBook: internals.runLedgerBook } : {}),
|
|
229
237
|
...(frozenOnQuestion !== undefined ? { onQuestion: frozenOnQuestion } : {}),
|
|
230
238
|
oneShot: spec.oneShot,
|
|
231
239
|
mountsCallerTool,
|
|
@@ -32,7 +32,7 @@ export interface PrepareRunRefsInput {
|
|
|
32
32
|
/** borrowed-readonly — the REBOUND spec. Read: `forwardSubagentEvents` (widens the forwarding filter),
|
|
33
33
|
* `retainSubagentSessions` (the ledger opt-in and its config), `handsReadOnly` (a read-only run mints no
|
|
34
34
|
* worktree helper). Never mutated. */
|
|
35
|
-
spec: Pick<TaskSpec, "forwardSubagentEvents" | "retainSubagentSessions" | "handsReadOnly">;
|
|
35
|
+
spec: Pick<TaskSpec, "forwardSubagentEvents" | "retainSubagentSessions" | "handsReadOnly" | "ownHandsReadOnly">;
|
|
36
36
|
/** borrowed-readonly — the trusted spawn-side channel; only `onForwardEvent` (the deployment's display
|
|
37
37
|
* sink) is read, to decide whether a forwarding wrapper exists at all, and `forwardScope` (the run's
|
|
38
38
|
* forwarding containment, read by the door). The OBJECT is what the wrapper hands the door rather than
|
|
@@ -6,6 +6,7 @@ import { createEditedFilesLedger } from "./edited-files-ledger.js";
|
|
|
6
6
|
import { createToolOccurrenceTable } from "./tool-occurrence.js";
|
|
7
7
|
import { createHookProgressLane, createHookScreenSeat } from "./hook-progress-lane.js";
|
|
8
8
|
import { reviewRefusalSentence } from "../park-resumability.js";
|
|
9
|
+
import { handsReadOnlyCarried } from "../child-clamp-seats.js";
|
|
9
10
|
export function forwardsSubagentEvents(spec) {
|
|
10
11
|
return spec.forwardSubagentEvents === true;
|
|
11
12
|
}
|
|
@@ -27,7 +28,7 @@ export function prepareRunRefs(input) {
|
|
|
27
28
|
if (e.type === "task_progress" || e.type === "task_started")
|
|
28
29
|
forwardSafely(internals, e);
|
|
29
30
|
else if (spec.forwardSubagentEvents === true &&
|
|
30
|
-
(e.type === "text_delta" || e.type === "text_end" || e.type === "reasoning_delta" || e.type === "tool_start" || e.type === "tool_progress" || e.type === "hook_progress" || e.type === "tool_end")) {
|
|
31
|
+
(e.type === "text_delta" || e.type === "text_end" || e.type === "reasoning_delta" || e.type === "reasoning_end" || e.type === "tool_start" || e.type === "tool_progress" || e.type === "hook_progress" || e.type === "tool_end")) {
|
|
31
32
|
forwardSafely(internals, e);
|
|
32
33
|
}
|
|
33
34
|
}
|
|
@@ -56,6 +57,6 @@ export function prepareRunRefs(input) {
|
|
|
56
57
|
await permissionModeSeat.steer("plan");
|
|
57
58
|
};
|
|
58
59
|
const subagentRetain = spec.retainSubagentSessions ? new SubagentRetainLedger(spec.retainSubagentSessions) : undefined;
|
|
59
|
-
const worktreeIsolation = spec
|
|
60
|
+
const worktreeIsolation = handsReadOnlyCarried(spec) !== true ? createSubagentWorktreeHelper(executionEnv, taskRootFinal, () => readFloor(undefined)) : undefined;
|
|
60
61
|
return { noteFileEdited, editedFilesSnapshot, harnessRef, toolProgressRef, toolOccurrences, hookScreens, hookProgress, skillGrants, forwardEvent, reviewRequestRef, requestReview, stopRequestedRef, requestStopAfterTurn, bindPermissionModeSeat, enterPlanMode, subagentRetain, worktreeIsolation };
|
|
61
62
|
}
|
|
@@ -105,8 +105,11 @@ export interface PrepareSuspendSagaInput {
|
|
|
105
105
|
* onto the row. */
|
|
106
106
|
nestedStats: Prepared["nestedStats"];
|
|
107
107
|
/** borrowed-readonly — the trusted spawn-side channel (the driver's binding, the row id already restored into it):
|
|
108
|
-
* `repairBundle` (the live bundle), `delegationProvenance` (the aggregate copied onto the row)
|
|
109
|
-
|
|
108
|
+
* `repairBundle` (the live bundle), `delegationProvenance` (the aggregate copied onto the row), `rowTaskId` (stamped) and the
|
|
109
|
+
* identity the row's `legIdentity` records (`parentTaskId`, the root pair, `explicitAgentName`). */
|
|
110
|
+
internals: Pick<RunInternals, "repairBundle" | "delegationProvenance" | "rowTaskId" | "holder" | "isDelegatedChild" | "observerLeg" | "parentTaskId" | "rootSessionId" | "rootSessionIncarnation" | "rootSessionScope" | "explicitAgentName"> | undefined;
|
|
111
|
+
/** borrowed-readonly — the task id the leg's host declared (`spec.taskId`, after a member ledger's rebind): the row's `legIdentity.declaredTaskId`. */
|
|
112
|
+
declaredTaskId: string | undefined;
|
|
110
113
|
/** borrowed-readonly — the ToolSearch activation set (`Prepared.activeTools`); copied onto the row at mint time. */
|
|
111
114
|
activeTools: Prepared["activeTools"];
|
|
112
115
|
/** borrowed-readonly — the structured-output seat; `value`/`set` are copied onto the row at mint time. */
|
|
@@ -123,6 +126,7 @@ export interface PrepareSuspendSagaInput {
|
|
|
123
126
|
readBlock: boolean;
|
|
124
127
|
/** borrowed-readonly — the inherited-gate phase's SKILL-GRANT section builder (the row's `skillGrants`). */
|
|
125
128
|
skillGrantCheckpointSection: () => SerializedCheckpointState["skillGrants"];
|
|
129
|
+
/** borrowed-readonly — the leg's member ledger book: the row's `runLedger`. */ runLedgerBook: import("../run-ledger.js").RunLedgerBook | undefined;
|
|
126
130
|
/** borrowed-readonly — the leg's skill scopes (the mods admission's record): the row's `skillScopes`, read at the park. */
|
|
127
131
|
skillScopesCheckpointSection: () => SerializedCheckpointState["skillScopes"];
|
|
128
132
|
/** borrowed-readonly — the leg's reminder provenance mark (travels with the row). */
|
|
@@ -11,7 +11,7 @@ import { writeHolderOf } from "../park-resumability.js";
|
|
|
11
11
|
import { holderSupersededError, isHolderSuperseded } from "../grant-holder.js";
|
|
12
12
|
import { latchWriteRefusal } from "./branch-writeback.js";
|
|
13
13
|
import { serializeAnnouncedListings } from "./announce-once-ledger.js";
|
|
14
|
-
import { workflowMemberOf } from "../leg-identity.js";
|
|
14
|
+
import { legIdentityRecordOf, workflowMemberOf } from "../leg-identity.js";
|
|
15
15
|
import { remoteEnvFailureNote, restoreWorkspaceWithRetry } from "./remote-env-retry.js";
|
|
16
16
|
import { thrownText } from "../thrown-value.js";
|
|
17
17
|
const PARK_COMPENSATION_TIMEOUT_MS = 30_000;
|
|
@@ -87,7 +87,7 @@ function stampPlacementRootSessionId(placementRootResolved) {
|
|
|
87
87
|
return placementValueOrAbsent(placementRootResolved);
|
|
88
88
|
}
|
|
89
89
|
export function prepareSuspendSaga(input) {
|
|
90
|
-
const { commandSandboxRequirement, callerPlaces, gateMachineryActive, abortController, harness, checkpointStore, deps, sessionId, hostTaskId, taskScope, liveSpendRef, resume, nestedStats, internals, activeTools, outputRef, readFileStateForCheckpoint, faceCheckpointSection, writeFaceCheckpointSection, readBlock, skillGrantCheckpointSection, skillScopesCheckpointSection, reminderMark, handsCwdRef, handsRoot, handsHome, worktreeSessionRef, undeliveredContinuationRef, inheritedParentConstraints, seedInheritedGate, ancestorRulesNow, inheritedShellGate, permissionMode, inheritedAdmittedOrgScopes, inheritedPathRuleAnchors, inheritedPathRuleInstallations, inheritedRuleBuckets, ownOrgVerdictRef, orgGovernedProvenance, announcedListingsRef, gitStatusRef, askSource, placementRootResolved, compositionLegResolved, checkpointScope, runOrigin, toolCeiling, toolListsJudged, ownToolLists, externalContentTargetActive, crossBoundary, remoteEnvFailures, memoryEngineSession, suspendLoopRef, writeRefusal, ownedEnv, workspaceSync } = input;
|
|
90
|
+
const { commandSandboxRequirement, callerPlaces, gateMachineryActive, abortController, harness, checkpointStore, deps, sessionId, hostTaskId, taskScope, liveSpendRef, resume, nestedStats, internals, activeTools, outputRef, readFileStateForCheckpoint, faceCheckpointSection, writeFaceCheckpointSection, readBlock, skillGrantCheckpointSection, skillScopesCheckpointSection, runLedgerBook, reminderMark, handsCwdRef, handsRoot, handsHome, worktreeSessionRef, undeliveredContinuationRef, inheritedParentConstraints, seedInheritedGate, ancestorRulesNow, inheritedShellGate, permissionMode, inheritedAdmittedOrgScopes, inheritedPathRuleAnchors, inheritedPathRuleInstallations, inheritedRuleBuckets, ownOrgVerdictRef, orgGovernedProvenance, announcedListingsRef, gitStatusRef, askSource, placementRootResolved, compositionLegResolved, checkpointScope, runOrigin, toolCeiling, toolListsJudged, ownToolLists, externalContentTargetActive, crossBoundary, remoteEnvFailures, memoryEngineSession, suspendLoopRef, writeRefusal, ownedEnv, workspaceSync } = input;
|
|
91
91
|
if (!gateMachineryActive)
|
|
92
92
|
return { saga: undefined };
|
|
93
93
|
const putHolder = writeHolderOf(internals);
|
|
@@ -197,6 +197,8 @@ export function prepareSuspendSaga(input) {
|
|
|
197
197
|
toolListsJudged,
|
|
198
198
|
ownToolLists: ownToolLists !== undefined ? { toolName: ownToolLists.toolName, ...(ownToolLists.definition !== undefined ? { definition: ownToolLists.definition } : {}), lists: ownToolLists.lists } : undefined,
|
|
199
199
|
commandSandbox: commandSandboxRequirement, ...callerPlaces.recorded(),
|
|
200
|
+
runLedger: runLedgerBook?.parkSection(),
|
|
201
|
+
legIdentity: legIdentityRecordOf(input.declaredTaskId, internals),
|
|
200
202
|
crossBoundaryRecorded: crossBoundary.recorded() ? true : undefined,
|
|
201
203
|
});
|
|
202
204
|
const compensatePausedVM = (remoteEnv, snapshotId) => compensateUnparkedPause(remoteEnv, snapshotId, {
|
|
@@ -25,7 +25,7 @@ import { ruleStoreUnreadableNotice } from "./rule-store-unreadable-notice.js";
|
|
|
25
25
|
import { STALL_FIRST_BYTE_MS, STALL_FIRST_TOKEN_MS, STALL_IDLE_MS, withBrainCallGuardrail } from "../../brain/timeout.js";
|
|
26
26
|
import { createFastModeLeg, SessionFastModeSeats } from "./fast-mode-seat.js";
|
|
27
27
|
import { preparePromptSeats } from "./session-prompt-seats.js";
|
|
28
|
-
import { bindParentSpecSeatFastMode,
|
|
28
|
+
import { bindParentSpecSeatFastMode, bindParentSpecSeatProject } from "../parent-spec-seat.js";
|
|
29
29
|
import { rootSessionAddressKeyOf, rootSessionAddressOf, treeRootAddressOf } from "../../agents/root-session-lane.js";
|
|
30
30
|
import { OFFLOAD_TOOL_NAME } from "../tool-result-store.js";
|
|
31
31
|
import { saveToolResultReach } from "../tool-result-bytes.js";
|
|
@@ -38,7 +38,7 @@ import { compileOutputSchema } from "./strict-output-schema.js";
|
|
|
38
38
|
import { MEMORY_ENGINE_TOOL_NAMES } from "../memory-engine/tools.js";
|
|
39
39
|
import { foldAdmissionFreeze } from "../memory-admission.js";
|
|
40
40
|
import { chainAnchorRecords, chainPolicyOnLeg, chainTopAnchors, deploymentCanRerootChild } from "./child-tree.js";
|
|
41
|
-
import { delegatedTreeOwner, judgedOwnerSeat, ownRowDelegationOwner } from "./delegation-owner.js";
|
|
41
|
+
import { delegatedTreeOwner, judgedLegOf, judgedOwnerSeat, ownRowDelegationOwner } from "./delegation-owner.js";
|
|
42
42
|
import { prepareMemory } from "./prepare-memory.js";
|
|
43
43
|
import { prepareMemoryEngineSession } from "./prepare-memory-engine-session.js";
|
|
44
44
|
import { cardsFollowModel, prepareDeferClassify } from "./prepare-defer-classify.js";
|
|
@@ -91,7 +91,7 @@ import { prepareParkAsk } from "./prepare-park-ask.js";
|
|
|
91
91
|
import { prepareGateStations } from "./prepare-gate-stations.js";
|
|
92
92
|
export { batchContextAt } from "./prepare-park-ask.js";
|
|
93
93
|
export { compensateUnparkedPause } from "./prepare-suspend-saga.js";
|
|
94
|
-
import { checkpointScopeOf, compositionLegRecord, placementValueOrAbsent,
|
|
94
|
+
import { checkpointScopeOf, compositionLegRecord, placementValueOrAbsent, workSessionOfLeg } from "./checkpoint-scope.js";
|
|
95
95
|
import { ANONYMOUS_SCOPE, identityMembersOf, scopeKeyOf } from "../isolation-scope.js";
|
|
96
96
|
export { checkpointScopeOf, placementValueOrAbsent } from "./checkpoint-scope.js";
|
|
97
97
|
export { mcpManifestEntries } from "../wiring-manifest.js";
|
|
@@ -115,10 +115,12 @@ import { createFrameSettlement } from "../frame-settlement.js";
|
|
|
115
115
|
import { announceSchedulerStoreUnmoved, createSchedulerTools } from "../../tools/scheduler-tools.js";
|
|
116
116
|
import { readSchedulerDeclaration } from "../scheduler.js";
|
|
117
117
|
import { selfOrchestrationFailClosedReason } from "../../orchestration/workflow-script-runner.js";
|
|
118
|
+
import { runLedgerBookFor, withRunLedgerTask } from "../run-ledger.js";
|
|
119
|
+
import { managerLaunchCheck, managerLaunchCheckSentence, managerLaunchFactsOf, managerLaunchNarrowedNotice } from "../manager-launch-check.js";
|
|
118
120
|
import { valveLeaves, valveLeavesPeer } from "../../agents/tool-filter.js";
|
|
119
121
|
import { backgroundAgentsFact, envMountFacts, legSeatMountFacts, seatMountFacts, specMountFacts } from "../tool-mount-facts.js";
|
|
120
122
|
import { judgeRunToolLists } from "./sub-agent-deny-lists.js";
|
|
121
|
-
import {
|
|
123
|
+
import { legBudgetSnapshot, resourceTotalOf } from "../leg-budget.js";
|
|
122
124
|
import { checkpointStoreOfSeat } from "../checkpoint-seat.js";
|
|
123
125
|
import { readLegExecutionEnv } from "../tool-mount-static.js";
|
|
124
126
|
import { handsWriteHalfMounts, pdfModelCapabilitiesOf } from "../../tools/fs/index.js";
|
|
@@ -147,7 +149,8 @@ import { createWorkspaceFrameSeat } from "../workspace-snapshot.js";
|
|
|
147
149
|
import { ensureStand, forkHasOwnTree, openSessionCheckout, openStandingCheckout, readLegCheckout, readStandingCheckout, recordedRootOf, sessionFrameOf, withEffectiveDirectories } from "../session-checkout.js";
|
|
148
150
|
import { createCardProjector } from "./tool-output-projection.js";
|
|
149
151
|
import { imageUnprocessedSeat, toolResultMediaRefusedSeat } from "./tool-result-media-seat.js";
|
|
150
|
-
import { asThrownError, readMember, thrownText } from "../thrown-value.js";
|
|
152
|
+
import { asThrownError, codedRefusal, readMember, thrownText } from "../thrown-value.js";
|
|
153
|
+
import { handedProjectSeat } from "../project-seat.js";
|
|
151
154
|
import { createAttachmentDelivery, refuseUserAttachmentPathsWithoutWorkspace } from "../user-attachment.js";
|
|
152
155
|
import { screenReadDenySeat } from "../read-face-seats.js";
|
|
153
156
|
import { admitLegMods, legEventsOf, legFacadeSeats, listLegModSeats } from "../mods/stations.js";
|
|
@@ -305,6 +308,7 @@ function validateInputFaultNotice(onError, sessionId) {
|
|
|
305
308
|
}
|
|
306
309
|
export async function prepareTask(request, deps, sessions, resume, internals, runnerSelf, runIdSink, holdSessionLock, legWrites, noticeDestinations, promptSubmitRef, runEnd) {
|
|
307
310
|
const runId = uuidv7();
|
|
311
|
+
const legStartedAt = Date.now();
|
|
308
312
|
if (runIdSink !== undefined)
|
|
309
313
|
runIdSink.runId = runId;
|
|
310
314
|
const rewindOutcome = runIdSink?.rewind ?? rewindOutcomeOf(request);
|
|
@@ -314,6 +318,8 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
314
318
|
const { callerRoster, mountsCallerTool, permissionModeSeat, doors, checkpointStore, checkpointSeat, outputStyleSeat, languageDeclared, allowedTools, userAttachmentsSeat } = start;
|
|
315
319
|
let spec = start.spec;
|
|
316
320
|
deps = start.deps;
|
|
321
|
+
const runLedgerBookOfLeg = internals?.runLedgerBook ?? runLedgerBookFor(spec, resume !== undefined ? { section: resume.seed.runLedger } : undefined, internals?.rowTaskId);
|
|
322
|
+
spec = withRunLedgerTask(spec, runLedgerBookOfLeg);
|
|
317
323
|
try {
|
|
318
324
|
internals?.reportAdmittedIdentity?.(identityMembersOf(spec));
|
|
319
325
|
}
|
|
@@ -333,7 +339,7 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
333
339
|
const { ownToolLists, delegation, approvalParkNotResumable, notResumableSays, toolLegs, toolCeiling, toolListsJudged, toolFaceSnapshot, toolCeilingRead, fileHistoryRequest, retiredNames } = start;
|
|
334
340
|
const ownerSeat = judgedOwnerSeat(internals);
|
|
335
341
|
const treeOwner = ownerSeat === undefined ? undefined : await delegatedTreeOwner(ownerSeat, spec.signal);
|
|
336
|
-
const judgedLeg =
|
|
342
|
+
const judgedLeg = judgedLegOf(spec, internals, treeOwner);
|
|
337
343
|
let told = false;
|
|
338
344
|
const verified = (id) => { if (told)
|
|
339
345
|
return; told = true; if (runIdSink !== undefined)
|
|
@@ -350,7 +356,6 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
350
356
|
const delegationOwner = internals?.delegationOwner ?? ownRowDelegationOwner(sessions, sessionId, async () => (await session.getMetadata()).incarnation, declaredRoot);
|
|
351
357
|
await holdSessionLock?.(sessionId);
|
|
352
358
|
const onceLedger = await loadAnnounceOnceLedger(session, resume?.seed.announcedListings, deps.onError);
|
|
353
|
-
internals = restoreRowTaskId(internals, resume?.seed.rowTaskId);
|
|
354
359
|
const hostTaskId = legTaskIdOf(spec, internals, sessionId);
|
|
355
360
|
const askSource = mintAskSourceIdentity({ principal: spec.principal, sessionId, taskId: hostTaskId, isDelegatedChild: delegation.isDelegatedChild, internals, recordedFromSubagent: resume?.seed.fromSubagent === true, ...(typeof resume?.seed.sourceAgentName === "string" ? { recordedSourceAgentName: resume.seed.sourceAgentName } : {}), ...(resume?.seed.workflowMember !== undefined ? { recordedWorkflowMember: resume.seed.workflowMember } : {}) });
|
|
356
361
|
const legNotice = mintLegNotice(askSource, internals, noticeDestinations, onceLedger.told);
|
|
@@ -557,11 +562,12 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
557
562
|
let readDenyAdditionsNormalized = [];
|
|
558
563
|
let handsLessResolvedFace;
|
|
559
564
|
let handsLessResolvedWriteFace;
|
|
565
|
+
let carriedFaces;
|
|
560
566
|
let legReadBlock = false;
|
|
561
567
|
const pausedRef = {};
|
|
562
568
|
const mcpHostSeats = internals?.mcpHostSeats;
|
|
563
569
|
const mountedMcpNow = () => mountedMcpOf({ declared: installedPreflight.mcp, roster: roster.tools, aggregateNames: new Set(mcp.tools.filter((t) => t.mcpRemoteName === undefined).map((t) => t.name)), ...(mcpHostSeats !== undefined ? { hostSeats: mcpHostSeats } : {}) });
|
|
564
|
-
const { sharedArtifactReadsCell, liveInheritedGate, seedInheritedGate, inheritedAncestorRules, inheritedShellGate, inheritedParentConstraints, permissionMode, commitModeSeats, endModeCeiling, inheritedAdmittedOrgScopes, inheritedRuleBuckets, 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, commandSandboxRequirement, callerPlaces, delegationOwner, delegated: delegation.isDelegatedChild, askSeat: doors.askSeat, hostFloor: doors.hostFloor, crossBoundaryTree, internals, resume, sessions, sessionId, runId, hostTaskId, taskRootFinal, delegationCwd, givenNoWorkspace, ownTarget, executionEnv, ownedEnv, lockedPreflight: installedPreflight, pathRuleAnchors: { chainTop, onLeg: onLeg.chained, siteOf: onLeg.siteOf }, checkpointSeat, checkpointScope, taskScope, pausedRef, toolFaceSnapshot, mountsCallerTool, mountedMcp: mountedMcpNow, promptLean, resolvedInteractionPosture, permissionModeSeat, mountFacts, spendSeat: spend, 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, approvalParkNotResumable, hostApprovalParksNotResumable: doors.hostApprovalParksNotResumable, modBus: legMods.standing, ownModChain, autoModeDecider: () => autoModeDeciderRef.current, legNotice, autoModeDenialTracking: () => autoModeDenialTrackingRef.current, autoModeArming: () => autoModeArmingRef.current, agentForkDenial: () => agentForkDenial, agentStations: () => agentStationsRef.current, sendStation: () => sendStationRef.current, taskStations: () => taskStationsRef.current, continuationReach, observersActive: () => observersActive, resolvedReadFace: () => resolvedReadFace, resolvedWriteFace: () => resolvedWriteFace, readDenyAdditionsNormalized: () => readDenyAdditionsNormalized, handsLessResolvedFace: () => handsLessResolvedFace, handsLessResolvedWriteFace: () => handsLessResolvedWriteFace, readBlock: () => legReadBlock, centerAdoption: () => centerAdoptionRef.current, memoryEngineSession: () => memoryEngineSession, sessionIncarnation: () => sessionIncarnation });
|
|
570
|
+
const { sharedArtifactReadsCell, liveInheritedGate, seedInheritedGate, inheritedAncestorRules, inheritedShellGate, inheritedParentConstraints, permissionMode, commitModeSeats, endModeCeiling, inheritedAdmittedOrgScopes, inheritedRuleBuckets, 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, commandSandboxRequirement, callerPlaces, delegationOwner, delegated: delegation.isDelegatedChild, askSeat: doors.askSeat, hostFloor: doors.hostFloor, crossBoundaryTree, internals, resume, sessions, sessionId, runId, hostTaskId, taskRootFinal, delegationCwd, givenNoWorkspace, ownTarget, executionEnv, ownedEnv, lockedPreflight: installedPreflight, pathRuleAnchors: { chainTop, onLeg: onLeg.chained, siteOf: onLeg.siteOf }, checkpointSeat, checkpointScope, taskScope, pausedRef, toolFaceSnapshot, mountsCallerTool, mountedMcp: mountedMcpNow, promptLean, resolvedInteractionPosture, permissionModeSeat, mountFacts, spendSeat: spend, 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, approvalParkNotResumable, hostApprovalParksNotResumable: doors.hostApprovalParksNotResumable, modBus: legMods.standing, ownModChain, autoModeDecider: () => autoModeDeciderRef.current, legNotice, autoModeDenialTracking: () => autoModeDenialTrackingRef.current, autoModeArming: () => autoModeArmingRef.current, agentForkDenial: () => agentForkDenial, agentStations: () => agentStationsRef.current, sendStation: () => sendStationRef.current, taskStations: () => taskStationsRef.current, continuationReach, observersActive: () => observersActive, resolvedReadFace: () => resolvedReadFace, resolvedWriteFace: () => resolvedWriteFace, readDenyAdditionsNormalized: () => readDenyAdditionsNormalized, handsLessResolvedFace: () => handsLessResolvedFace, handsLessResolvedWriteFace: () => handsLessResolvedWriteFace, carriedFaces: () => carriedFaces, readBlock: () => legReadBlock, centerAdoption: () => centerAdoptionRef.current, memoryEngineSession: () => memoryEngineSession, sessionIncarnation: () => sessionIncarnation });
|
|
565
571
|
bindPermissionModeSeat(permissionMode);
|
|
566
572
|
const personRowNotices = { onUnread: ruleStoreUnreadableNotice(deps.onNotice, { sessionId, runId }, onceLedger, permissionMode), onRowsDropped: ruleRowsDroppedNotice(deps.onNotice, { sessionId, runId }) };
|
|
567
573
|
const sessionRulesRead = { unread: { own: () => true, ancestor: () => true } };
|
|
@@ -591,8 +597,11 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
591
597
|
const forcedGateNotResumable = runtimeCaps?.forceDurableGate === true && notResumableSays;
|
|
592
598
|
const legNotResumable = notResumableSays !== undefined ? { source: notResumableSays, mandated: forcedGateNotResumable !== false && forcedGateNotResumable !== undefined } : undefined;
|
|
593
599
|
const crossBoundary = await prepareCrossBoundaryLane({ token: crossBoundaryTree, posture: doors.crossBoundaryPosture, externalContentTargetActive, env: executionEnv, session, resumeLeg: resume !== undefined, sessionId, runId, hostTaskId, noticeRoute: legNotice.route, deps });
|
|
594
|
-
const
|
|
595
|
-
|
|
600
|
+
const handed = handedProjectSeat(internals?.parentProject);
|
|
601
|
+
if (!handed.ok)
|
|
602
|
+
throw codedRefusal(handed.code, handed.message);
|
|
603
|
+
const sessionProject = await resolveSessionProject(projectMarkerFsOf(executionEnv), taskRootCanonical, spec.project, handed.seat);
|
|
604
|
+
bindParentSpecSeatProject(parentSpecSeat, sessionProject.seat);
|
|
596
605
|
if (sessionProject.markerFault !== undefined)
|
|
597
606
|
deps.onError?.(sessionProject.markerFault, { phase: "config", sessionId });
|
|
598
607
|
const undeliveredContinuationRef = { current: { parkedSteers: [], orphanTasks: [] } };
|
|
@@ -615,19 +624,8 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
615
624
|
const maxSuspends = spec.maxSuspends ?? deps.maxSuspends ?? DEFAULT_MAX_SUSPENDS;
|
|
616
625
|
const maxSlices = spec.resourceSuspend?.maxSlices;
|
|
617
626
|
const priorLedger = resume?.priorLedger;
|
|
618
|
-
const resourceTotal = spec
|
|
619
|
-
|
|
620
|
-
totalBudgetMicroUsd: spec.resourceSuspend.totalBudgetUsd !== undefined ? Math.round(spec.resourceSuspend.totalBudgetUsd * 1e6) : undefined,
|
|
621
|
-
totalTokens: spec.resourceSuspend.totalTokens,
|
|
622
|
-
}
|
|
623
|
-
: undefined;
|
|
624
|
-
const budgetSnapshot = {
|
|
625
|
-
resourceRemainingMicroUsd: priorLedger
|
|
626
|
-
? remainingBudgetMicroUsd(priorLedger)
|
|
627
|
-
: resourceTotal?.totalBudgetMicroUsd,
|
|
628
|
-
resourceSpentMicroUsd: priorLedger?.spentMicroUsd ?? 0,
|
|
629
|
-
suspendCount: priorSuspendCount,
|
|
630
|
-
};
|
|
627
|
+
const resourceTotal = resourceTotalOf(spec);
|
|
628
|
+
const budgetSnapshot = legBudgetSnapshot(resourceTotal, resume);
|
|
631
629
|
const outputRef = {};
|
|
632
630
|
if (resume?.seed.outputRef) {
|
|
633
631
|
outputRef.value = resume.seed.outputRef.value;
|
|
@@ -758,10 +756,13 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
758
756
|
readDenyAdditionsNormalized = handsReadFace.readDenyAdditionsNormalized;
|
|
759
757
|
handsLessResolvedFace = handsReadFace.handsLessResolvedFace;
|
|
760
758
|
handsLessResolvedWriteFace = handsReadFace.handsLessResolvedWriteFace;
|
|
759
|
+
carriedFaces = handsReadFace.carriedFaces;
|
|
761
760
|
legReadBlock = handsReadFace.readBlock;
|
|
762
761
|
shellGatedTools = handsReadFace.shellGatedTools;
|
|
763
762
|
await armAutoMode();
|
|
764
|
-
const
|
|
763
|
+
const runLedgerBookNow = runLedgerBookOfLeg;
|
|
764
|
+
const runLedgerSeats = runLedgerBookNow === undefined ? undefined : { book: runLedgerBookNow, record: async (ledger) => void (await session.appendRunLedger?.(ledger)) };
|
|
765
|
+
const { worktreeSessionRef, sendMessageTier } = prepareDelegationSurface({ runLedger: runLedgerSeats, spec, deps, internals, resume, sessionId, sessionAddress, legOccupant, hostTaskId, taskScope, taskRootFinal, taskRootCanonical, executionEnv, runnerSelf, shellReadAdmission, runReadFloor: runFloor, ...(commandSandboxStart !== undefined ? { commandSandbox: commandSandboxStart } : {}), peerLaneActive, peerLaneRefs, sessionBox, roster, toolEffects, axisExplicitNegatives, toolFaceSnapshot, firstPartyOffload, offloadStore, toolResultBytes, taskArtifacts, subagentRetain, continuationReach, enrichSpecToolCtx, checkpointSeat, handsCwdRef, wsSnapshot, rebaseWsPath, rebaseRestoredPath, workspaceStateSettle, worktreeSeat });
|
|
765
766
|
const { liveQuestionFace, contentAskBindings, contentAskRoutable, strandLateAnswer, settleContentAskBindings, durableQuestionFace, questionToolMounted, mountedQuestionTool } = prepareQuestionFace({ frozenOnQuestion, spec, askSource, deps, checkpointStore, runtimeCaps, approvalParkNotResumable, resolvedInteractionPosture, resume, sessionId, roster, inheritedUnavailableAsks: () => inheritedUnavailableAsks });
|
|
766
767
|
announceSchedulerStoreUnmoved(schedulerReading, deps.onNotice);
|
|
767
768
|
if (roster.mounts.holds("cron-list")) {
|
|
@@ -832,6 +833,14 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
832
833
|
const rosterFacts = { effects: toolEffects, egress: egressTools, irreversibilityTier, reversibilityProbes, deferred, trustedTools: new Set(spec.memory?.trustedTools ?? []) };
|
|
833
834
|
const toolRoster = roster.snapshot(rosterFacts);
|
|
834
835
|
rosterSeat.arm(toolRoster, () => roster.snapshot(rosterFacts));
|
|
836
|
+
if (runLedgerSeats !== undefined) {
|
|
837
|
+
const launch = managerLaunchCheck(managerLaunchFactsOf({ names: new Set(toolRoster.entries.map((e) => e.name)), backgroundAgents: roster.mounts.factOf("leg.backgroundAgents"), completionLane: internals?.onTaskNotification !== undefined, approver: frozenOnAsk !== undefined, parkStore: checkpointStore !== undefined, oneShot: spec.oneShot === true }));
|
|
838
|
+
runLedgerSeats.book.setLaunch(launch);
|
|
839
|
+
if (launch.verdict === "refused")
|
|
840
|
+
throw Object.assign(new Error(managerLaunchCheckSentence(launch)), { code: "config.invalid_argument", detail: { reason: "run_ledger_unready", launch } });
|
|
841
|
+
if (launch.verdict === "narrowed")
|
|
842
|
+
deliverEngineNotice(deps.onNotice, managerLaunchNarrowedNotice(launch, { ...legNotice.route.address, runId }), legNotice.admission);
|
|
843
|
+
}
|
|
835
844
|
const structuredProjector = createCardProjector({
|
|
836
845
|
declaredCards: toolRoster.entries.flatMap((e) => e.renderHints?.resultCards ?? []),
|
|
837
846
|
onUndeclared: (type) => deliverEngineNotice(deps.onNotice, { code: "config.tool_card_undeclared", message: `a tool minted a \`details.type\` card ${JSON.stringify(type)} its definition never declared — dropped from tool_end.structured (declare it on the definition's catalog row or the caller's renderHints.resultCards)`, detail: { type, sessionId, runId } }),
|
|
@@ -975,7 +984,7 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
975
984
|
const { basePolicyForResumeEdit, denyNarrowingPolicy, skillGrantLane, sessionRulesUnread, allowEntryLanes, policyLayers, effectivePolicy, inheritedUnavailableAsks, deferredAskIdentities, inheritedAskGrants, riskAxesOf, ruleOffersOf, callGrantDoorOf, callBindingSeat, grantBindingOf, permissionRuleLane, permissionRuleGateLane, ruleLaneFacts, permissionRuleOrgLane, storedRuleWholeToolRefusals, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, foldAskClasses, ancestorSandboxAdmissions, ancestorArbitrations, inheritedInstallations, hostPoliciesUnderView } = await preparePolicyChain({ retiredNames, commandSandboxSideOf: commandSandboxSideFor, destinationOf: destinationFor, sandboxPlanOf, hostFloor: doors.hostFloor, spec, deps, sessionId, runId, hostTaskId, approvalWords, engineText, 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, readBlockJudge: handsReadFace.readBlockJudge, personRows, questionToolMounted, runtimeCaps, approvalParkNotResumable, notResumableSays, forcedGateNotResumable, inheritedAncestorRules, ancestorSessionRulesRef, inheritedParentConstraints, inheritedRuleBuckets, seedInheritedGate, skillGrants, skillSpecs, allowedToolTables, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, modBus: legMods.bus, ownModChain, autoModeDecider: () => autoModeDeciderRef.current, whileHeld: toolOccurrences.whileHeld, readFace: () => resolvedReadFace, permissionMode, autoStripNotice, toolRosterDeltas: rosterSeat, stopForDenialLimit, askSource, parkRouteOf: (toolCallId) => ({ parkRoute: callParkRoute(legParkClosureSeat.built && !legParkClosureSeat.continuationCalls.has(toolCallId), legMods.bus, toolCallId), suspendTargetGap: legParkClosureSeat.suspendTargetGap }), abortController, now, ownSessionRulesRef, announced: { announcedListingsRef, frameReceipts } });
|
|
976
985
|
sessionRulesRead.unread = sessionRulesUnread;
|
|
977
986
|
toolTableViewRef.current = createToolTableView({ policy: effectivePolicy, stored: { wholeToolRefusals: storedRuleWholeToolRefusals }, roster: rosterSeat, verdicts: verdictLedger.verdicts, turnSnapshotRef });
|
|
978
|
-
const { onAsk, preToolContexts, blockedToolCalls, batchHaltRef, blockedTracked, suspendTargetGap, durableSuspendInfraReady, suspendLaneGap, resourceSuspendEligible, usageGovernance, durableApproval, wiringManifest, askSeatWord, writeProtection, parkLaneArmed, gateMachineryActive, hookIdentity, hookEnvFace, sessionBoxBound } = prepareWiringManifest({ spec, deps, callerPlaces, askSeat: doors.askSeat, hostFloorPosture: doors.hostFloor?.posture, sessionProject, crossBoundaryStationEngaged: crossBoundary.stationEngaged, internals, resume, sessionId, runId, hostTaskId, taskScope, modBus: legMods.bus, standingModBus: legMods.standing, policyLayers, effectivePolicy, handsEnabled, skippedFactory, taskRootFinal, legWriteGuard: advertisedWritableDirs?.planFile !== undefined ? { ...legWriteGuard, exemptFiles: [advertisedWritableDirs.planFile] } : legWriteGuard, mcp, a2a, irreversibleTools, egressTools, shellReadStationArmed: handsReadFace.shellReadStationArmed, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, permissionMode, fastMode: fastModeLeg, lockedPreflight, peerLaneRefs, frameSettlement, receiveSeat, harness, pausedRef, liveInheritedGate, delegation, approvalParkNotResumable, forcedGateNotResumable, toolRoster, toolPlan, readDenyBuiltinTiersActive: handsReadFace.readDenyBuiltinTiersActive, readFloorUnkept: handsReadFace.readFloorUnkept.current, lspManagerWired, lspDiagnosticsLive: lspDiagnostics !== undefined, fileHistoryFact, projectMemoryFact, sessionRulesChildrenReadLive: ownSessionRulesRef.current !== undefined, sessionBox, sessionAddress, runEnd, checkpointScope, memoryPollution: () => memoryEngineSession?.pollution, advisorFact: advisor.manifest, runOrigin: doors.runOrigin, commandSandboxFact: commandSandboxRun.state === "unavailable" ? { state: "unavailable", reason: commandSandboxRun.reason } : { state: commandSandboxRun.state } });
|
|
987
|
+
const { onAsk, preToolContexts, blockedToolCalls, batchHaltRef, blockedTracked, suspendTargetGap, durableSuspendInfraReady, suspendLaneGap, resourceSuspendEligible, usageGovernance, durableApproval, wiringManifest, askSeatWord, writeProtection, parkLaneArmed, gateMachineryActive, hookIdentity, hookEnvFace, sessionBoxBound } = prepareWiringManifest({ spec, deps, callerPlaces, askSeat: doors.askSeat, hostFloorPosture: doors.hostFloor?.posture, sessionProject, crossBoundaryStationEngaged: crossBoundary.stationEngaged, internals, resume, sessionId, runId, legStartedAt, hostTaskId, taskScope, modBus: legMods.bus, standingModBus: legMods.standing, policyLayers, effectivePolicy, handsEnabled, skippedFactory, taskRootFinal, legWriteGuard: advertisedWritableDirs?.planFile !== undefined ? { ...legWriteGuard, exemptFiles: [advertisedWritableDirs.planFile] } : legWriteGuard, mcp, a2a, irreversibleTools, egressTools, shellReadStationArmed: handsReadFace.shellReadStationArmed, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, permissionMode, fastMode: fastModeLeg, lockedPreflight, peerLaneRefs, frameSettlement, receiveSeat, harness, pausedRef, liveInheritedGate, delegation, approvalParkNotResumable, forcedGateNotResumable, toolRoster, toolPlan, readDenyBuiltinTiersActive: handsReadFace.readDenyBuiltinTiersActive, readFloorUnkept: handsReadFace.readFloorUnkept.current, lspManagerWired, lspDiagnosticsLive: lspDiagnostics !== undefined, fileHistoryFact, projectMemoryFact, sessionRulesChildrenReadLive: ownSessionRulesRef.current !== undefined, sessionBox, sessionAddress, runEnd, checkpointScope, memoryPollution: () => memoryEngineSession?.pollution, advisorFact: advisor.manifest, runOrigin: doors.runOrigin, commandSandboxFact: commandSandboxRun.state === "unavailable" ? { state: "unavailable", reason: commandSandboxRun.reason } : { state: commandSandboxRun.state } });
|
|
979
988
|
refuseDisplayWithoutSentences(legMods.bus, legEventsOf(hookIdentity));
|
|
980
989
|
agentStationsRef.current = createAgentStations({ bus: legMods.bus, identity: hookIdentity, permissionMode: () => permissionMode.observed });
|
|
981
990
|
sendStationRef.current = createSessionSendStation({ bus: legMods.bus, identity: hookIdentity });
|
|
@@ -1002,7 +1011,7 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
1002
1011
|
const { askLane } = prepareAskLane({ commandSandboxSideOf: commandSandboxSideFor, destinationOf: destinationFor, gateMachineryActive, abortController, effectivePolicy, budgetSnapshot, handsCwdRef, handsRoot: attachmentRootCanonical, stampCallTarget, advertisedWritableDirs, exemptRoots: legExemptRoots, tools, inheritedUnavailableAsks, deferredAskIdentities, inheritedAskGrants, onAsk, humanReviewRef, now, ruleOffersOf, grantBindingOf, askSource, riskAxesOf, autoModeDenialTracking: autoModeDenialTrackingRef, hostTaskId, deps, sessionId, runId, modBus: legMods.bus, notifyOwnHookCrash, grantReadRoot: handsReadFace.grantReadRoot, approvalWords, toolRosterDeltas: rosterSeat, existingTargetSeat, forcedGateNotResumable, engineText, ...(sessionCallGrants !== undefined ? { sessionCallGrants } : {}) });
|
|
1003
1012
|
const inheritedAnchorRecords = chainAnchorRecords(chainTop, inheritedParentConstraints ?? [], onLeg.siteOf);
|
|
1004
1013
|
const workspaceSync = legWorkspaceSync({ env: ownedEnv ?? deps.executionEnv, sessionId, runId, onNotice: deps.onNotice, remoteEnvFailures, runSignal: abortController.signal });
|
|
1005
|
-
const { saga } = prepareSuspendSaga({ legOccupant, commandSandboxRequirement, callerPlaces, gateMachineryActive, crossBoundary, abortController, harness, checkpointStore, deps, sessionId, hostTaskId, taskScope, liveSpendRef, resume, nestedStats, internals, activeTools, outputRef, readFileStateForCheckpoint, faceCheckpointSection, writeFaceCheckpointSection, readBlock: handsReadFace.readBlock, skillGrantCheckpointSection, skillScopesCheckpointSection: () => legMods.skillScopes.frozen(), reminderMark, handsCwdRef, handsRoot: attachmentRootCanonical, handsHome: attachmentRootCanonical !== undefined ? legAnchors.home : undefined, worktreeSessionRef, undeliveredContinuationRef, inheritedParentConstraints, seedInheritedGate, ancestorRulesNow, inheritedShellGate, permissionMode, inheritedAdmittedOrgScopes, inheritedPathRuleAnchors: chainTop !== legAnchors ? inheritedAnchorRecords.pathRuleAnchors : undefined, inheritedPathRuleInstallations: inheritedAnchorRecords.pathRuleInstallations, inheritedRuleBuckets, ownOrgVerdictRef, orgGovernedProvenance, announcedListingsRef, gitStatusRef, askSource, placementRootResolved, compositionLegResolved, checkpointScope, runOrigin: doors.runOrigin, toolCeiling: toolCeilingRead, toolListsJudged, ownToolLists, externalContentTargetActive, remoteEnvFailures, memoryEngineSession, suspendLoopRef, writeRefusal, ownedEnv, workspaceSync });
|
|
1014
|
+
const { saga } = prepareSuspendSaga({ legOccupant, commandSandboxRequirement, callerPlaces, gateMachineryActive, crossBoundary, abortController, harness, checkpointStore, deps, sessionId, hostTaskId, declaredTaskId: spec.taskId, taskScope, liveSpendRef, resume, nestedStats, internals, activeTools, outputRef, readFileStateForCheckpoint, faceCheckpointSection, writeFaceCheckpointSection, readBlock: handsReadFace.readBlock, skillGrantCheckpointSection, skillScopesCheckpointSection: () => legMods.skillScopes.frozen(), runLedgerBook: runLedgerSeats?.book, reminderMark, handsCwdRef, handsRoot: attachmentRootCanonical, handsHome: attachmentRootCanonical !== undefined ? legAnchors.home : undefined, worktreeSessionRef, undeliveredContinuationRef, inheritedParentConstraints, seedInheritedGate, ancestorRulesNow, inheritedShellGate, permissionMode, inheritedAdmittedOrgScopes, inheritedPathRuleAnchors: chainTop !== legAnchors ? inheritedAnchorRecords.pathRuleAnchors : undefined, inheritedPathRuleInstallations: inheritedAnchorRecords.pathRuleInstallations, inheritedRuleBuckets, ownOrgVerdictRef, orgGovernedProvenance, announcedListingsRef, gitStatusRef, askSource, placementRootResolved, compositionLegResolved, checkpointScope, runOrigin: doors.runOrigin, toolCeiling: toolCeilingRead, toolListsJudged, ownToolLists, externalContentTargetActive, remoteEnvFailures, memoryEngineSession, suspendLoopRef, writeRefusal, ownedEnv, workspaceSync });
|
|
1006
1015
|
const { suspendForResource, suspendForPlatformLimit, suspendForReview } = prepareBoundaryParks({ saga, spec, checkpointStore, checkpointScope, approvalParkNotResumable, abortController, harness, session, sessions, sessionId, askSource, deps, priorLedger, maxSlices, maxSuspends, resourceTotal, priorSuspendCount, suspendChainBase, humanReviewRef, liveSpendRef, now, pausedRef, remoteEnvFailures, resourceSuspendEligible, durableSuspendInfraReady, suspendTargetGap });
|
|
1007
1016
|
const { parkAsk } = prepareParkAsk({ commandSandboxSideOf: commandSandboxSideFor, destinationOf: destinationFor, askLane, saga, spec, deps, sessionId, askSource, checkpointStore, checkpointScope, toolRosterDeltas: rosterSeat, existingTargetSeat, parkLaneArmed, contentAskRoutable, liveQuestionFace, mountedQuestionTool, contentAskBindings, strandLateAnswer, onAsk, runtimeCaps, inheritedUnavailableAsks, deferredAskIdentities, 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, riskAxesOf, grantBindingOf, now, humanReviewRef, abortController, harness, pausedRef, engineText });
|
|
1008
1017
|
legParkClosureSeat.built = parkAsk?.suspendAsk !== undefined;
|
|
@@ -1036,7 +1045,7 @@ export async function prepareTask(request, deps, sessions, resume, internals, ru
|
|
|
1036
1045
|
...(commandSandboxRequirement !== undefined ? { effectiveSandbox: commandSandboxRequirement } : {}),
|
|
1037
1046
|
...(externalContentTargetActive ? { effectiveExternalContentTarget: true } : {}),
|
|
1038
1047
|
};
|
|
1039
|
-
const buildPrepared = () => ({ harness, session, sessionId, ...(rewindOutcome !== undefined ? { rewindOutcome } : {}), ...(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, seededCopies, reminderDisclosureCounts, fullShellReachable, approvalPosture: { get mode() { return permissionMode.current; }, askEffective: askSeatWord }, ...(outputStyleSeat !== undefined ? { outputStyleFrame: renderOutputStyle(outputStyleSeat, engineText) } : {}), runTimeReminders, permissionMode, editedFilesSnapshot, taskRootPath: taskRootFinal, model, thinking, fastMode: fastModeLeg, mcp, ...(mcpRedial !== undefined ? { mcpRedial } : {}), ...(a2a.tools.length > 0 ? { a2a } : {}), blockedRef, outputRef, abortController, writeRefusal, blockedToolCalls, toolOccurrences, hookScreens, hookProgress, batchHaltRef, nestedStats, spend, laneDeps: deps, ...(rewindNotes.length > 0 ? { rewindNotes } : {}), ...(fileHistoryBoundary !== undefined ? { fileHistoryBoundary } : {}), ...(effectiveReadFaceObserved !== undefined ? { effectiveReadFace: effectiveReadFaceObserved, effectiveWriteFace: effectiveWriteFaceObserved } : {}), ...(effectiveReadDenyObserved !== undefined ? { effectiveReadDenyPatterns: effectiveReadDenyObserved } : {}), ...legPostureSeats, callerPlaces, effectiveMemoryScopes: memoryEffectiveScopes, readFloorUnkept: handsReadFace.readFloorUnkept, ...(placementValueOrAbsent(placementRootResolved) !== undefined ? { placementRoot: placementRootResolved } : {}), cwdRef: handsCwdRef, ...(attachmentRootCanonical !== undefined ? { handsRoot: attachmentRootCanonical } : {}), ...(stampCallTarget !== undefined ? { stampCallTarget } : {}), toolProgressRef, turnAbortRef, ...(advertisedWritableDirs !== undefined ? { advertisedWritableDirs } : {}), exemptRoots: legExemptRoots, ...(worktreeSessionRef !== undefined ? { worktreeSessionRef } : {}), workspaceFrame: createWorkspaceFrameSeat(givenNoWorkspace ? undefined : { root: taskRootCanonical, ...(handsCwdRef !== undefined ? { cwdRef: handsCwdRef } : {}), ...(worktreeSessionRef !== undefined ? { worktreeSessionRef } : {}), ...sessionFrameOf(sessionCheckout.record), ...(sessionCheckout.directories !== undefined ? { directories: sessionCheckout.directories } : {}), ...(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, prefixChanges: legPrefix.changes, endPrefixLeg: () => endPrefixLeg(legPrefix.ledger, prefixLeg.number, limitApproachRef, session), observeSideRequest: legPrefix.observeSide, prefixAnchor, wiringManifest, promptManifest, promptIdentity, activeTools, ...(deferred.size > 0 ? { deferredToolNames: deferred } : {}), toolMaterializeStatic, deferDirectCall, ...(staticFaceForRef.current !== undefined ? { staticFaceFor: staticFaceForRef.current } : {}), ownedEnv, ...(workspaceSync !== undefined ? { workspaceSync } : {}), pausedRef, undeliveredContinuationRef, suspendProgressRef, remoteEnvFailures, refusedAsks, verdictLedger, reviewRequestRef, suspendLoopRef, suspendForResource, ...(suspendForPlatformLimit !== undefined ? { suspendForPlatformLimit } : {}), ...(suspendLaneGap !== undefined ? { suspendLaneGap } : {}), ...(envLifetimeSuspendAt !== undefined ? { envLifetimeSuspendAt } : {}), ...(usageGovernance !== undefined ? { usageGovernance } : {}), callIssuedAtRef, workCutRef, loopTerminalRef, loopReasksRef, 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 } : {}), ...(languageSeat !== undefined ? { languageSeat } : {}), ...(sandboxFrameSeat !== undefined ? { sandboxFrameSeat } : {}), ...(memoryNoticesFrame !== undefined ? { memoryNoticesFrame } : {}), ...(compactionRestore !== undefined ? { compactionRestore } : {}), recentlyReadFiles, normalizeAttachmentPath, ...(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 } : {}), ...(workflowSizeGuideline ? { workflowSizeGuideline } : {}), ...(detectExternalChanges ? { detectExternalChanges } : {}), ...(nestedMemory !== undefined ? { nestedMemory } : {}), ...(toolsDeltaRef ? { toolsDeltaRef } : {}), ...(mcpUnavailable ? { mcpUnavailable } : {}), ...(agentListing ? { agentListing } : {}), ...(skillsListing ? { skillsListing } : {}), announcedListingsRef, frameReceipts, engineText, frameSettlement, ...(userAttachmentsSeat !== undefined ? { userAttachments: userAttachmentsSeat } : {}), attachmentDelivery: createAttachmentDelivery(), imageUnprocessed, ...(modelFileReaderSeat.current !== undefined ? { modelFileReader: modelFileReaderSeat.current } : {}), syntheticReadVerdict, ...(peerLaneRefs.boundaryRound !== undefined ? { peerBoundaryRound: peerLaneRefs.boundaryRound } : {}), gitStatusRef, postureFrameRef, requestCoreRef, limitApproachRef, listBackgroundTasks, taskReadHandleOf, hookIdentity, legNotice, modBus: legMods.bus, endModLife: legMods.end, 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 } : {}), commandSandboxPlanOf: sandboxPlanOf, ...(toolDisclosureSeat !== undefined ? { toolDisclosure: toolDisclosureSeat } : {}), ...(approvedCallScreen !== undefined ? { approvedCallScreen } : {}), ...(toolCallStationRef.current !== undefined ? { toolCallStation: toolCallStationRef.current } : {}), legAdoption, declaredReadKeys: (id, call) => (declaredReadSlotOf(call) === undefined ? undefined : (judgedReadsSeat.current?.(id)?.map((t) => t.key) ?? "unjudged")) });
|
|
1048
|
+
const buildPrepared = () => ({ harness, session, sessionId, ...(rewindOutcome !== undefined ? { rewindOutcome } : {}), ...(captureLineage.own !== undefined ? { sessionIncarnation: captureLineage.own } : {}), ...(captureLineage.fault ? { sessionIncarnationUnread: true } : {}), taskId: hostTaskId, runId, legStartedAt, crossBoundary, ...(doors.hostFloor !== undefined ? { hostFloor: doors.hostFloor } : {}), registryAccess: { owner: hostTaskId, scope: taskScope }, ...(runLedgerSeats !== undefined ? { runLedgerBook: runLedgerSeats.book } : {}), reminderMark, seededCopies, reminderDisclosureCounts, fullShellReachable, approvalPosture: { get mode() { return permissionMode.current; }, askEffective: askSeatWord }, ...(outputStyleSeat !== undefined ? { outputStyleFrame: renderOutputStyle(outputStyleSeat, engineText) } : {}), runTimeReminders, permissionMode, editedFilesSnapshot, taskRootPath: taskRootFinal, model, thinking, fastMode: fastModeLeg, mcp, ...(mcpRedial !== undefined ? { mcpRedial } : {}), ...(a2a.tools.length > 0 ? { a2a } : {}), blockedRef, outputRef, abortController, writeRefusal, blockedToolCalls, toolOccurrences, hookScreens, hookProgress, batchHaltRef, nestedStats, spend, laneDeps: deps, ...(rewindNotes.length > 0 ? { rewindNotes } : {}), ...(fileHistoryBoundary !== undefined ? { fileHistoryBoundary } : {}), ...(effectiveReadFaceObserved !== undefined ? { effectiveReadFace: effectiveReadFaceObserved, effectiveWriteFace: effectiveWriteFaceObserved } : {}), ...(effectiveReadDenyObserved !== undefined ? { effectiveReadDenyPatterns: effectiveReadDenyObserved } : {}), ...legPostureSeats, callerPlaces, effectiveMemoryScopes: memoryEffectiveScopes, readFloorUnkept: handsReadFace.readFloorUnkept, ...(placementValueOrAbsent(placementRootResolved) !== undefined ? { placementRoot: placementRootResolved } : {}), cwdRef: handsCwdRef, ...(attachmentRootCanonical !== undefined ? { handsRoot: attachmentRootCanonical } : {}), ...(stampCallTarget !== undefined ? { stampCallTarget } : {}), toolProgressRef, turnAbortRef, ...(advertisedWritableDirs !== undefined ? { advertisedWritableDirs } : {}), exemptRoots: legExemptRoots, ...(worktreeSessionRef !== undefined ? { worktreeSessionRef } : {}), workspaceFrame: createWorkspaceFrameSeat(givenNoWorkspace ? undefined : { root: taskRootCanonical, ...(handsCwdRef !== undefined ? { cwdRef: handsCwdRef } : {}), ...(worktreeSessionRef !== undefined ? { worktreeSessionRef } : {}), ...sessionFrameOf(sessionCheckout.record), ...(sessionCheckout.directories !== undefined ? { directories: sessionCheckout.directories } : {}), ...(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, prefixChanges: legPrefix.changes, endPrefixLeg: () => endPrefixLeg(legPrefix.ledger, prefixLeg.number, limitApproachRef, session), observeSideRequest: legPrefix.observeSide, prefixAnchor, wiringManifest, promptManifest, promptIdentity, activeTools, ...(deferred.size > 0 ? { deferredToolNames: deferred } : {}), toolMaterializeStatic, deferDirectCall, ...(staticFaceForRef.current !== undefined ? { staticFaceFor: staticFaceForRef.current } : {}), ownedEnv, ...(workspaceSync !== undefined ? { workspaceSync } : {}), pausedRef, undeliveredContinuationRef, suspendProgressRef, remoteEnvFailures, refusedAsks, verdictLedger, reviewRequestRef, suspendLoopRef, suspendForResource, ...(suspendForPlatformLimit !== undefined ? { suspendForPlatformLimit } : {}), ...(suspendLaneGap !== undefined ? { suspendLaneGap } : {}), ...(envLifetimeSuspendAt !== undefined ? { envLifetimeSuspendAt } : {}), ...(usageGovernance !== undefined ? { usageGovernance } : {}), callIssuedAtRef, workCutRef, loopTerminalRef, loopReasksRef, 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 } : {}), ...(languageSeat !== undefined ? { languageSeat } : {}), ...(sandboxFrameSeat !== undefined ? { sandboxFrameSeat } : {}), ...(memoryNoticesFrame !== undefined ? { memoryNoticesFrame } : {}), ...(compactionRestore !== undefined ? { compactionRestore } : {}), recentlyReadFiles, normalizeAttachmentPath, ...(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 } : {}), ...(workflowSizeGuideline ? { workflowSizeGuideline } : {}), ...(detectExternalChanges ? { detectExternalChanges } : {}), ...(nestedMemory !== undefined ? { nestedMemory } : {}), ...(toolsDeltaRef ? { toolsDeltaRef } : {}), ...(mcpUnavailable ? { mcpUnavailable } : {}), ...(agentListing ? { agentListing } : {}), ...(skillsListing ? { skillsListing } : {}), announcedListingsRef, frameReceipts, engineText, frameSettlement, ...(userAttachmentsSeat !== undefined ? { userAttachments: userAttachmentsSeat } : {}), attachmentDelivery: createAttachmentDelivery(), imageUnprocessed, ...(modelFileReaderSeat.current !== undefined ? { modelFileReader: modelFileReaderSeat.current } : {}), syntheticReadVerdict, ...(peerLaneRefs.boundaryRound !== undefined ? { peerBoundaryRound: peerLaneRefs.boundaryRound } : {}), gitStatusRef, postureFrameRef, requestCoreRef, limitApproachRef, listBackgroundTasks, taskReadHandleOf, hookIdentity, legNotice, modBus: legMods.bus, endModLife: legMods.end, 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 } : {}), commandSandboxPlanOf: sandboxPlanOf, ...(toolDisclosureSeat !== undefined ? { toolDisclosure: toolDisclosureSeat } : {}), ...(approvedCallScreen !== undefined ? { approvedCallScreen } : {}), ...(toolCallStationRef.current !== undefined ? { toolCallStation: toolCallStationRef.current } : {}), legAdoption, declaredReadKeys: (id, call) => (declaredReadSlotOf(call) === undefined ? undefined : (judgedReadsSeat.current?.(id)?.map((t) => t.key) ?? "unjudged")) });
|
|
1040
1049
|
refuseLateRosterChanges(callerRoster.roster);
|
|
1041
1050
|
rollback.commit();
|
|
1042
1051
|
prefixLeg.number = await legPrefix.ledger.openLeg(() => session.getBranch(), (id) => session.getBranch(id));
|
|
@@ -16,7 +16,9 @@ import { type ContainmentFace } from "../../tools/fs/index.js";
|
|
|
16
16
|
import type { ReadRootsSeat } from "./person-path-rows.js";
|
|
17
17
|
import { type ReadFileState } from "../../tools/fs/safety.js";
|
|
18
18
|
import type { DateAnchorRead, MemoryTailSnapshot, Prepared } from "./contracts.js";
|
|
19
|
-
import { type DeclaredRoot, type ScreenedNestedMemory } from "./nested-memory-lane.js";
|
|
19
|
+
import { type DeclaredRoot, type NestedMemoryLane, type NestedMemoryLaneSeat, type ScreenedNestedMemory } from "./nested-memory-lane.js";
|
|
20
|
+
/** Single construction site for the instruction-file lane (live legs and `Runner.previewInstructions`). */
|
|
21
|
+
export declare const seatInstructionLane: (seat: NestedMemoryLaneSeat) => NestedMemoryLane;
|
|
20
22
|
import type { ModelFileReader } from "../../tools/fs/fs-read.js";
|
|
21
23
|
import type { ReminderDisclosureCounts } from "../reminder-disclosure.js";
|
|
22
24
|
export interface PrepareTurnWiringInput {
|
|
@@ -155,8 +157,7 @@ export interface PrepareTurnWiringInput {
|
|
|
155
157
|
/** owned — the instruction-file family as the config door read it (its one reading); absent ⇒ no lane. */
|
|
156
158
|
nestedDeclaration: ScreenedNestedMemory | undefined;
|
|
157
159
|
/** borrowed-readonly — the additional working directories the spec declared, as the hands resolved them (the lane's further roots under the family's opt-in). */
|
|
158
|
-
declaredAdditionalRoots: readonly DeclaredRoot[];
|
|
159
|
-
/** borrowed-readonly — the leg's budget snapshot the live gate stamps on every request (the card's probe carries it too). */
|
|
160
|
+
declaredAdditionalRoots: readonly DeclaredRoot[]; /** borrowed-readonly — the leg's budget snapshot the live gate stamps on every request (the card's probe carries it too). */
|
|
160
161
|
budgetSnapshot: NonNullable<ToolCallRequest["budget"]>;
|
|
161
162
|
}
|
|
162
163
|
export interface PrepareTurnWiringResult {
|
|
@@ -17,6 +17,7 @@ import { headSegmentsChanged } from "./conversation-segment.js";
|
|
|
17
17
|
import { CHANGED_FILES_MTIME_EPS_MS } from "./turn-attachments.js";
|
|
18
18
|
import { frameFileToolsOf, isInstructionLaneEntry, readCompactionRestore } from "../user-attachment.js";
|
|
19
19
|
import { createNestedMemoryLane } from "./nested-memory-lane.js";
|
|
20
|
+
export const seatInstructionLane = (seat) => createNestedMemoryLane(seat);
|
|
20
21
|
export function declaringCallPolicy(turnSnapshotRef, stream) {
|
|
21
22
|
return (model, context, options) => {
|
|
22
23
|
turnSnapshotRef.current?.refreshRequestPolicy({ thinkingLevel: options?.reasoning ?? null, maxTokens: options?.maxTokens ?? model.maxTokens ?? null, fastSpeed: options?.fastMode?.requested === true && fastModeUnavailableFor(model) === undefined });
|
|
@@ -99,7 +100,7 @@ export function prepareTurnWiring(input) {
|
|
|
99
100
|
const laneHands = handsEnabled && modelFileReader !== undefined && readFileStateForCheckpoint !== undefined && attachmentRootCanonical !== undefined ? { env: executionEnv, reader: modelFileReader, judge: servedReadVerdict, readFace: rosterReadFace, state: readFileStateForCheckpoint, root: attachmentRootCanonical, additionalRoots: input.declaredAdditionalRoots } : undefined;
|
|
100
101
|
const rosterFileTools = () => frameFileToolsOf(preparedHolder.current?.toolRoster);
|
|
101
102
|
const laneCommon = nestedDeclaration === undefined ? undefined : { declaration: nestedDeclaration, signal: abortController.signal, mark: reminderMark, counts: reminderDisclosureCounts, deps, leg: () => preparedHolder.current, fileTools: rosterFileTools };
|
|
102
|
-
const nestedMemory = laneCommon === undefined ? undefined :
|
|
103
|
+
const nestedMemory = laneCommon === undefined ? undefined : seatInstructionLane(laneHands !== undefined ? { ...laneCommon, ...laneHands } : laneCommon);
|
|
103
104
|
const announceRestoreSkip = (path, reason) => {
|
|
104
105
|
deps.onError?.(new Error(`compaction restore did not deliver ${path}: ${reason}`), { phase: "degraded", sessionId, classification: "attachment-read" });
|
|
105
106
|
};
|
|
@@ -54,13 +54,15 @@ export interface PrepareWiringManifestInput {
|
|
|
54
54
|
deps: RunnerDeps;
|
|
55
55
|
/** borrowed-readonly — the trusted spawn-side channel: `questionFaceStripped`, `isDelegatedChild`, `onTaskNotification`,
|
|
56
56
|
* `peerSelfRef`, `explicitAgentName`, `principalInboxAssistant` (the drain + the identity), `insideFork` / `agentName` / `spawnAgentType` / `parentToolCallId` (the identity). */
|
|
57
|
-
internals: Pick<RunInternals, "questionFaceStripped" | "isDelegatedChild" | "observerLeg" | "onTaskNotification" | "peerSelfRef" | "explicitAgentName" | "principalInboxAssistant" | "spawnAgentType" | "insideFork" | "agentName" | "parentToolCallId"> | undefined;
|
|
57
|
+
internals: Pick<RunInternals, "questionFaceStripped" | "isDelegatedChild" | "observerLeg" | "onTaskNotification" | "peerSelfRef" | "explicitAgentName" | "principalInboxAssistant" | "spawnAgentType" | "insideFork" | "agentName" | "parentToolCallId" | "rootSessionId"> | undefined;
|
|
58
58
|
/** borrowed-readonly — the resume leg, or undefined (the manifest's leg derivation reads presence only). */
|
|
59
59
|
resume: Pick<PrepareResume, "seed"> | undefined;
|
|
60
60
|
/** borrowed-readonly — the acquired session id. */
|
|
61
61
|
sessionId: string;
|
|
62
62
|
/** borrowed-readonly — the run's invocation id. */
|
|
63
63
|
runId: string;
|
|
64
|
+
/** borrowed-readonly — epoch ms minted once beside {@link runId} at prepare entry; stamped on `manifest.leg.instance.startedAt`. */
|
|
65
|
+
legStartedAt: number;
|
|
64
66
|
/** borrowed-readonly — the per-task identity (the hook identity's taskId). */
|
|
65
67
|
hostTaskId: string;
|
|
66
68
|
/** borrowed-readonly — the registry scope the peer drain binds under. */
|
|
@@ -2,6 +2,7 @@ import { bindPeerLaneDrain, peerDrainLanesOf } from "../../agents/peer-session-d
|
|
|
2
2
|
import { teamRoleOf } from "../../agents/team-role.js";
|
|
3
3
|
import { resolveCheckpointStore } from "../checkpoint-store.js";
|
|
4
4
|
import { createHookEnvCapabilities, mintHookInvocationIdentity } from "../hooks.js";
|
|
5
|
+
import { hookRootSessionIdOf } from "../leg-identity.js";
|
|
5
6
|
import { chainJudges } from "../mods/stations.js";
|
|
6
7
|
import { MOD_EVENTS_HANDING_ENV } from "../mods/kernel/events.js";
|
|
7
8
|
import { suspendTargetGapRowOf } from "../remote-env.js";
|
|
@@ -139,7 +140,7 @@ export function durableSuspendInfraGaps(facts) {
|
|
|
139
140
|
return gaps;
|
|
140
141
|
}
|
|
141
142
|
export function prepareWiringManifest(input) {
|
|
142
|
-
const { spec, deps, internals, resume, sessionId, runId, hostTaskId, taskScope, modBus, standingModBus, checkpointScope, policyLayers, effectivePolicy, handsEnabled, skippedFactory, taskRootFinal, legWriteGuard, mcp, a2a, irreversibleTools, egressTools, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, permissionMode, fastMode, lockedPreflight, peerLaneRefs, frameSettlement, receiveSeat, sessionBox, sessionAddress, runEnd, harness, pausedRef, askSeat, liveInheritedGate, delegation, approvalParkNotResumable, forcedGateNotResumable, toolRoster, toolPlan, readDenyBuiltinTiersActive, readFloorUnkept, lspManagerWired, shellReadStationArmed, crossBoundaryStationEngaged, lspDiagnosticsLive, fileHistoryFact, projectMemoryFact, sessionRulesChildrenReadLive, memoryPollution, advisorFact, hostFloorPosture, sessionProject, runOrigin, commandSandboxFact, callerPlaces } = input;
|
|
143
|
+
const { spec, deps, internals, resume, sessionId, runId, legStartedAt, hostTaskId, taskScope, modBus, standingModBus, checkpointScope, policyLayers, effectivePolicy, handsEnabled, skippedFactory, taskRootFinal, legWriteGuard, mcp, a2a, irreversibleTools, egressTools, toolEffects, ownedEnv, executionEnv, offloadStore, onceLedger, usageWindows, envLifetimeSuspendAt, runtimeCaps, resolvedInteractionPosture, durableQuestionFace, liveQuestionFace, checkpointStore, sessions, modelGateManifest, autoModeArmReason, permissionMode, fastMode, lockedPreflight, peerLaneRefs, frameSettlement, receiveSeat, sessionBox, sessionAddress, runEnd, harness, pausedRef, askSeat, liveInheritedGate, delegation, approvalParkNotResumable, forcedGateNotResumable, toolRoster, toolPlan, readDenyBuiltinTiersActive, readFloorUnkept, lspManagerWired, shellReadStationArmed, crossBoundaryStationEngaged, lspDiagnosticsLive, fileHistoryFact, projectMemoryFact, sessionRulesChildrenReadLive, memoryPollution, advisorFact, hostFloorPosture, sessionProject, runOrigin, commandSandboxFact, callerPlaces } = input;
|
|
143
144
|
const onAsk = askSeat.value;
|
|
144
145
|
const handWriteTools = toolRoster.entries.filter((e) => e.mountedBy === "hands" && (e.effect === "write" || e.effect === "idempotent")).map((e) => e.name);
|
|
145
146
|
const hasEffectAwareGate = policyLayers.length > 0 || chainJudges(standingModBus);
|
|
@@ -212,7 +213,7 @@ export function prepareWiringManifest(input) {
|
|
|
212
213
|
const wiringQuestionStripped = internals?.questionFaceStripped === true;
|
|
213
214
|
const wiringFacts = {
|
|
214
215
|
half: "effective",
|
|
215
|
-
leg: wiringLegKindOf(resume !== undefined, internals), ...(runOrigin !== undefined ? { runOrigin } : {}),
|
|
216
|
+
leg: wiringLegKindOf(resume !== undefined, internals), legInstance: { runId, startedAt: legStartedAt }, ...(runOrigin !== undefined ? { runOrigin } : {}), ...(deps.host !== undefined ? { host: deps.host } : {}),
|
|
216
217
|
teamRole: teamRoleOf({ isDelegatedChild: delegation.isDelegatedChild, ...(internals?.explicitAgentName !== undefined ? { spawnName: internals.explicitAgentName } : {}) }),
|
|
217
218
|
...(spec.peerPresence !== undefined ? { peerPresence: spec.peerPresence } : {}),
|
|
218
219
|
askForm: askSeat.form,
|
|
@@ -307,8 +308,10 @@ export function prepareWiringManifest(input) {
|
|
|
307
308
|
spec.enablePlanMode === true ||
|
|
308
309
|
commandSandboxFact.state === "armed";
|
|
309
310
|
announceDurableGateUnavailable({ onNotice: deps.onNotice, mandate: durableMandateSourceOf({ forceDurableGate: runtimeCaps?.forceDurableGate === true, durableApprovalDeclared: spec.durableApproval !== undefined, onAsk }), storeWired: checkpointStore !== undefined, taskStoreDisabled: spec.checkpointStore === "disabled", notResumable: forcedGateNotResumable, liveApprover: isAnsweringSeat(onAsk), seatForm: askSeat.form, declaredNone: askSeat.reach === "none", liveQuestionFace: liveQuestionFace !== undefined, parentConstraints: liveInheritedGate?.parentConstraints, sessionId, runId, principal: spec.principal });
|
|
311
|
+
const rootSessionId = hookRootSessionIdOf(internals, sessionId, delegation.isDelegatedChild);
|
|
310
312
|
const hookIdentity = mintHookInvocationIdentity({
|
|
311
313
|
sessionId,
|
|
314
|
+
...(rootSessionId !== undefined ? { rootSessionId } : {}),
|
|
312
315
|
taskId: hostTaskId,
|
|
313
316
|
legKind: wiringManifest.leg.kind,
|
|
314
317
|
isDelegatedChild: delegation.isDelegatedChild,
|
|
@@ -5,8 +5,9 @@ import { chainPolicyOnLeg, chainTopAnchors } from "./child-tree.js";
|
|
|
5
5
|
import { mintHookInvocationIdentity } from "../hooks.js";
|
|
6
6
|
import { admitLegMods, listLegModSeats, classicEventBase, failedHandlerClause, promptScreenHasHandlers, screenUserPrompt } from "../mods/stations.js";
|
|
7
7
|
import { inputSourceOf } from "../steer-replay.js";
|
|
8
|
-
import { legTaskIdOf } from "../leg-identity.js";
|
|
9
|
-
import {
|
|
8
|
+
import { hookRootSessionIdOf, legTaskIdOf } from "../leg-identity.js";
|
|
9
|
+
import { restoreRowIdentity, resumedDeclaredTaskId } from "./checkpoint-scope.js";
|
|
10
|
+
import { runLedgerIdentityOf } from "../run-ledger.js";
|
|
10
11
|
import { bindableArgsOf, callFactsSeat, checkToolPolicyProjection, policyCannotAnswer, refuseOutOfContractDecision } from "../tool-policy.js";
|
|
11
12
|
import { editRecheckUnanswered } from "../real-approval.js";
|
|
12
13
|
import { requestGrantBinding } from "../skill-grant-binding.js";
|
|
@@ -36,8 +37,10 @@ export async function resumeApply(input) {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
async function applyRungs(input, admitted) {
|
|
39
|
-
const { cp, config,
|
|
40
|
+
const { cp, config, outcomeGate, wakeMessage, resumeSignal, recheckGovernanceWindow, plainReviewOutcome, plainParkOutcome, runner, effectiveDelegationFacts } = input;
|
|
41
|
+
const internals = restoreRowIdentity(input.internals, cp.state);
|
|
40
42
|
let plainPolicyOutcome = input.plainPolicyOutcome;
|
|
43
|
+
const ledgerTask = runLedgerIdentityOf(config, { section: cp.state.runLedger }, undefined);
|
|
41
44
|
let wakeHookContext;
|
|
42
45
|
let wakeDelivered = wakeMessage;
|
|
43
46
|
let wakeRewrittenBy;
|
|
@@ -49,11 +52,14 @@ async function applyRungs(input, admitted) {
|
|
|
49
52
|
}
|
|
50
53
|
if (legMods !== undefined && promptScreenHasHandlers(legMods.bus)) {
|
|
51
54
|
const screenedMessage = wakeMessage;
|
|
55
|
+
const isDelegatedChild = effectiveDelegationFacts(internals, cp.state.isDelegatedChild).isDelegatedChild;
|
|
56
|
+
const rootSessionId = hookRootSessionIdOf(internals, cp.sessionId, isDelegatedChild);
|
|
52
57
|
const identity = mintHookInvocationIdentity({
|
|
53
58
|
sessionId: cp.sessionId,
|
|
54
|
-
|
|
59
|
+
...(rootSessionId !== undefined ? { rootSessionId } : {}),
|
|
60
|
+
taskId: legTaskIdOf(ledgerTask !== undefined && "taskId" in ledgerTask ? { taskId: ledgerTask.taskId } : { taskId: resumedDeclaredTaskId(config, cp.state) }, internals, cp.sessionId),
|
|
55
61
|
legKind: "resume",
|
|
56
|
-
isDelegatedChild
|
|
62
|
+
isDelegatedChild,
|
|
57
63
|
...(internals?.insideFork === true ? { insideFork: true } : {}),
|
|
58
64
|
...(internals?.agentName !== undefined ? { agentName: internals.agentName } : {}),
|
|
59
65
|
...(internals?.explicitAgentName !== undefined ? { spawnName: internals.explicitAgentName } : {}),
|