@sema-agent/core 7.71.1 → 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 +500 -0
- package/dist/agents/cross-session-ref.d.ts +2 -2
- package/dist/agents/cross-session-ref.js +7 -2
- package/dist/agents/inherited-tool-pool.d.ts +30 -2
- package/dist/agents/inherited-tool-pool.js +53 -7
- 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 +7 -2
- 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 +47 -12
- package/dist/agents/verify.js +23 -7
- 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/a2a.d.ts +24 -3
- package/dist/core/a2a.js +27 -8
- package/dist/core/actions-digest.d.ts +43 -0
- package/dist/core/actions-digest.js +22 -0
- package/dist/core/agent-state.d.ts +28 -7
- package/dist/core/agent-state.js +19 -6
- package/dist/core/allow-entry.js +3 -3
- package/dist/core/approval-object.d.ts +7 -3
- package/dist/core/approval-object.js +30 -9
- package/dist/core/auto-mode.d.ts +7 -9
- package/dist/core/auto-mode.js +114 -8
- package/dist/core/checkpoint-features.d.ts +16 -5
- package/dist/core/checkpoint-features.js +35 -6
- 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.d.ts +1 -1
- package/dist/core/checkpoint-row-verdict.js +10 -4
- 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/effective-path-target.d.ts +19 -0
- package/dist/core/effective-path-target.js +95 -38
- package/dist/core/engine-capabilities.d.ts +5 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +34 -23
- 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/file-history-store.d.ts +15 -4
- package/dist/core/file-history-store.js +53 -23
- package/dist/core/gate-fold.js +3 -1
- package/dist/core/governance-codes.d.ts +10 -1
- package/dist/core/governance-codes.js +17 -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/judged-read.d.ts +57 -0
- package/dist/core/judged-read.js +1 -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-host-seat.d.ts +5 -0
- package/dist/core/mcp-host-seat.js +7 -1
- 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/mcp.js +3 -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/index.d.ts +1 -1
- package/dist/core/memory-engine/index.js +1 -1
- package/dist/core/memory-engine/layout.js +6 -4
- 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 +69 -11
- package/dist/core/memory-engine/scope-contract.js +99 -34
- 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/mounted-mcp.d.ts +7 -2
- package/dist/core/mounted-mcp.js +10 -1
- package/dist/core/own-property-receipt.js +11 -4
- package/dist/core/param-rule-reach.d.ts +8 -3
- package/dist/core/param-rule-reach.js +9 -1
- package/dist/core/parent-spec-seat.d.ts +13 -1
- package/dist/core/parent-spec-seat.js +18 -0
- package/dist/core/peer-registration.d.ts +52 -0
- package/dist/core/peer-registration.js +37 -0
- package/dist/core/peer-seat.d.ts +3 -1
- 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 +34 -6
- 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/chain-mismatch.d.ts +32 -0
- package/dist/core/runner/chain-mismatch.js +29 -0
- package/dist/core/runner/changes-history.d.ts +1 -0
- package/dist/core/runner/changes-history.js +2 -2
- 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 +22 -3
- package/dist/core/runner/delegation-owner.d.ts +30 -0
- package/dist/core/runner/delegation-owner.js +20 -4
- package/dist/core/runner/file-history-restore.d.ts +3 -1
- package/dist/core/runner/file-history-restore.js +9 -6
- package/dist/core/runner/finish-reason-seat.js +4 -2
- package/dist/core/runner/leg-frame.js +3 -0
- package/dist/core/runner/loaded-skills.d.ts +2 -0
- package/dist/core/runner/loaded-skills.js +10 -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 +23 -20
- package/dist/core/runner/person-path-rows.js +82 -18
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +4 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +105 -90
- 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-file-history.js +1 -1
- package/dist/core/runner/prepare-hands-readface.d.ts +10 -2
- package/dist/core/runner/prepare-hands-readface.js +36 -22
- package/dist/core/runner/prepare-inherited-gate.d.ts +8 -5
- package/dist/core/runner/prepare-inherited-gate.js +14 -6
- package/dist/core/runner/prepare-memory-engine-session.d.ts +2 -2
- package/dist/core/runner/prepare-memory-engine-session.js +2 -2
- package/dist/core/runner/prepare-memory.js +3 -15
- package/dist/core/runner/prepare-project-context.d.ts +1 -1
- package/dist/core/runner/prepare-project-context.js +3 -7
- package/dist/core/runner/prepare-protocol-tools.d.ts +5 -0
- package/dist/core/runner/prepare-protocol-tools.js +2 -2
- 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 +50 -37
- 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 +5 -1
- package/dist/core/runner/prepare-wiring-manifest.js +8 -4
- package/dist/core/runner/read-session-changes.js +1 -1
- package/dist/core/runner/resume-apply.js +11 -5
- package/dist/core/runner/resume-checkpoint-screen.d.ts +8 -7
- package/dist/core/runner/resume-checkpoint-screen.js +7 -6
- 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/rewind-files.js +3 -2
- 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 +9 -2
- 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 +10 -1
- package/dist/core/runner/terminal-account.js +23 -3
- package/dist/core/runner/tool-face-overlay.d.ts +2 -11
- package/dist/core/runner/tool-face-overlay.js +39 -0
- package/dist/core/runner/trim-stretch.js +7 -2
- package/dist/core/runner/unreadable-person-rows.d.ts +2 -1
- package/dist/core/runner-deps.d.ts +13 -10
- package/dist/core/scheduler.d.ts +47 -7
- package/dist/core/scheduler.js +19 -7
- package/dist/core/secret-env.d.ts +60 -37
- package/dist/core/secret-env.js +45 -48
- package/dist/core/sensitive-path-policy.js +14 -7
- 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/shell-read-silence.js +1 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +17 -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 +11 -3
- package/dist/core/task-notification.d.ts +97 -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 +57 -23
- package/dist/core/tool-catalog-entries.js +4 -0
- package/dist/core/tool-face-reader.js +1 -1
- package/dist/core/tool-face.d.ts +7 -0
- package/dist/core/tool-face.js +1 -0
- package/dist/core/tool-mount-facts.d.ts +5 -3
- package/dist/core/tool-mount-facts.js +4 -3
- package/dist/core/tool-mount-plan.d.ts +7 -3
- package/dist/core/tool-mount-plan.js +11 -5
- package/dist/core/tool-mount-static.d.ts +2 -2
- package/dist/core/tool-mount-static.js +28 -14
- package/dist/core/tool-registry.d.ts +33 -1
- package/dist/core/tool-registry.js +33 -0
- package/dist/core/tool-result-store.d.ts +19 -2
- package/dist/core/tool-result-store.js +51 -2
- package/dist/core/tool-roster.d.ts +16 -0
- package/dist/core/tool-roster.js +6 -0
- package/dist/core/tool-spec.d.ts +13 -4
- package/dist/core/tools.d.ts +6 -0
- package/dist/core/tools.js +1 -1
- package/dist/core/user-attachment.d.ts +5 -1
- package/dist/core/user-attachment.js +14 -7
- package/dist/core/wiring-manifest.d.ts +89 -29
- package/dist/core/wiring-manifest.js +44 -4
- 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/messages.d.ts +1 -1
- package/dist/engine/harness/messages.js +2 -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/loop/types.d.ts +2 -0
- 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 +35 -5
- package/dist/index.d.ts +27 -12
- package/dist/index.js +20 -8
- 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 -54
- package/dist/prompts/manager-recipe.d.ts +18 -0
- package/dist/prompts/manager-recipe.js +24 -0
- package/dist/stores/file/adoption/marker.d.ts +2 -27
- package/dist/stores/file/adoption/marker.js +12 -0
- package/dist/stores/file/index.d.ts +1 -1
- package/dist/stores/file/index.js +1 -1
- 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/artifact/artifact-tool.js +11 -6
- package/dist/tools/fs/file-read-check.d.ts +45 -11
- package/dist/tools/fs/file-read-check.js +200 -57
- 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/judged-reads.d.ts +51 -0
- package/dist/tools/fs/judged-reads.js +68 -0
- 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 +12 -1
- package/dist/tools/fs/safety.js +16 -3
- package/dist/tools/fs/shell-read-check.d.ts +25 -5
- package/dist/tools/fs/shell-read-check.js +100 -15
- package/dist/tools/fs/shell-read-establish.d.ts +9 -0
- package/dist/tools/fs/shell-read-establish.js +34 -14
- 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/dist/tools/scheduler-store-move.d.ts +74 -0
- package/dist/tools/scheduler-store-move.js +103 -0
- package/dist/tools/scheduler-tools.d.ts +43 -29
- package/dist/tools/scheduler-tools.js +161 -118
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +173 -3
- package/wire-changes/answers/core-stores-sql@7.72.0.json +12 -0
- package/wire-changes/answers/core-stores-sql@7.73.0.json +28 -0
- package/wire-changes/answers/core@7.72.0.json +84 -0
- package/wire-changes/answers/core@7.73.0.json +216 -0
- package/wire-changes/answers/mods-kernel@7.72.0.json +7 -0
- package/wire-changes/answers/mods-kernel@7.73.0.json +7 -0
- package/wire-changes/answers/primitives@7.72.0.json +6 -0
- package/wire-changes/answers/primitives@7.73.0.json +12 -0
- package/wire-changes/answers/wiki-gate@7.72.0.json +7 -0
- package/wire-changes/answers/wiki-gate@7.73.0.json +7 -0
- package/wire-changes/core-stores-sql@7.72.0.json +215 -0
- package/wire-changes/core-stores-sql@7.73.0.json +326 -0
- package/wire-changes/core@7.72.0.json +2426 -0
- package/wire-changes/core@7.73.0.json +6480 -0
- package/wire-changes/mods-kernel@7.72.0.json +147 -0
- package/wire-changes/mods-kernel@7.73.0.json +147 -0
- package/wire-changes/primitives@7.72.0.json +143 -0
- package/wire-changes/primitives@7.73.0.json +227 -0
- package/wire-changes/wiki-gate@7.72.0.json +145 -0
- package/wire-changes/wiki-gate@7.73.0.json +145 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { CompositionLeg, RunInternals } from "./contracts.js";
|
|
2
|
+
import type { CheckpointState } from "../checkpoint-store.js";
|
|
2
3
|
/**
|
|
3
4
|
* The SINGLE derivation of a durable-suspend checkpoint's scope — the LEG's scope, computed once per prepare and
|
|
4
5
|
* read by every mint lane of that leg (approval park, resource and `plan_review` parks, the forceDurableGate
|
|
@@ -86,6 +87,15 @@ export declare function compositionLegRecord(leg: CompositionLeg | undefined): C
|
|
|
86
87
|
export declare function workSessionOfLeg(leg: CompositionLeg | undefined): string | undefined;
|
|
87
88
|
/** Whether two composition-leg records name the same leg of the same composition for the same host session. */
|
|
88
89
|
export declare function sameCompositionLeg(a: CompositionLeg, b: CompositionLeg): boolean;
|
|
89
|
-
/** The
|
|
90
|
-
*
|
|
91
|
-
|
|
90
|
+
/** The identity a resumed leg runs as, read off the parked row it resumes: the registry row it ran as ({@link RunInternals.rowTaskId}),
|
|
91
|
+
* its spawning task ({@link RunInternals.parentTaskId}), its tree's root address — id, box scope and occupant (one anchor: taken
|
|
92
|
+
* whole or not at all) — and its explicit spawn name ({@link RunInternals.explicitAgentName}), each the live seat when the resuming call hands one,
|
|
93
|
+
* else the row's record (`CheckpointState.rowTaskId` / `legIdentity`) — folded into internals once, so the resume screen and every
|
|
94
|
+
* reader of the resumed leg (its prepare's mints, its stations, the throw backstop) read one value. A row that records none leaves
|
|
95
|
+
* the internals as handed. */
|
|
96
|
+
export declare function restoreRowIdentity(internals: RunInternals | undefined, state: Pick<CheckpointState, "rowTaskId" | "legIdentity"> | undefined): RunInternals | undefined;
|
|
97
|
+
/** The task id a resumed leg's host declared: the resume config's, else the one the parked row records its host declared
|
|
98
|
+
* (`CheckpointState.legIdentity.declaredTaskId`) — so a resume that names none runs as the task that parked, never as its session. */
|
|
99
|
+
export declare function resumedDeclaredTaskId(config: {
|
|
100
|
+
readonly taskId?: string | undefined;
|
|
101
|
+
}, state: Pick<CheckpointState, "legIdentity">): string | undefined;
|
|
@@ -49,8 +49,16 @@ export function workSessionOfLeg(leg) {
|
|
|
49
49
|
export function sameCompositionLeg(a, b) {
|
|
50
50
|
return a.entry === b.entry && a.leg === b.leg && a.hostSessionId === b.hostSessionId;
|
|
51
51
|
}
|
|
52
|
-
export function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
export function restoreRowIdentity(internals, state) {
|
|
53
|
+
const row = state?.legIdentity;
|
|
54
|
+
const restored = {
|
|
55
|
+
...(internals?.rowTaskId === undefined && state?.rowTaskId !== undefined ? { rowTaskId: state.rowTaskId } : {}),
|
|
56
|
+
...(internals?.parentTaskId === undefined && row?.parentTaskId !== undefined ? { parentTaskId: row.parentTaskId } : {}),
|
|
57
|
+
...(internals?.rootSessionId === undefined && row?.rootSessionId !== undefined && row.rootSessionScope !== undefined ? { rootSessionId: row.rootSessionId, rootSessionScope: row.rootSessionScope, ...(row.rootSessionIncarnation !== undefined ? { rootSessionIncarnation: row.rootSessionIncarnation } : {}) } : {}),
|
|
58
|
+
...(internals?.explicitAgentName === undefined && row?.spawnName !== undefined ? { explicitAgentName: row.spawnName } : {}),
|
|
59
|
+
};
|
|
60
|
+
return Object.keys(restored).length === 0 ? internals : { ...(internals ?? {}), ...restored };
|
|
61
|
+
}
|
|
62
|
+
export function resumedDeclaredTaskId(config, state) {
|
|
63
|
+
return config.taskId ?? state.legIdentity?.declaredTaskId;
|
|
56
64
|
}
|
|
@@ -5,6 +5,7 @@ import { receiptRefusal, receiveOwnProperties, refuseProxy } from "../own-proper
|
|
|
5
5
|
import { assertNoRetiredRunnerDeps } from "./retired-runner-deps.js";
|
|
6
6
|
import { copyReadDenySeat, READ_DENY_DEPLOYMENT_SEATS } from "../read-face-seats.js";
|
|
7
7
|
import { receiveHostFloor } from "../host-floor.js";
|
|
8
|
+
import { receiveHostInstance } from "../host-instance.js";
|
|
8
9
|
import { holdOwnCredentialValues } from "../secret-env.js";
|
|
9
10
|
import { receivePeerSeat } from "../peer-seat.js";
|
|
10
11
|
import { receiveProtocolRevocations } from "../protocol-revocation.js";
|
|
@@ -12,6 +13,7 @@ import { receiveModelFallbackPolicy } from "../model-fallbacks.js";
|
|
|
12
13
|
import { receiveCacheRetention } from "./model-lane-seat.js";
|
|
13
14
|
import { assertJournalStoreGivesClaimsBack } from "../workflow-journal-store.js";
|
|
14
15
|
import { screenPermissionModeWhenUnset } from "../mode-policy.js";
|
|
16
|
+
import { receiveAutoModeFace } from "../auto-mode.js";
|
|
15
17
|
export function retainRunnerDeps(deps) {
|
|
16
18
|
const words = { subject: "RunnerDeps", unit: "seat", moment: "at new Runner" };
|
|
17
19
|
refuseProxy(deps, words);
|
|
@@ -26,6 +28,8 @@ export function retainRunnerDeps(deps) {
|
|
|
26
28
|
}
|
|
27
29
|
if (Object.hasOwn(retained, "hostFloor"))
|
|
28
30
|
Object.defineProperty(retained, "hostFloor", { value: receiveHostFloor(Reflect.get(retained, "hostFloor")), enumerable: true, writable: true, configurable: true });
|
|
31
|
+
if (Object.hasOwn(retained, "host"))
|
|
32
|
+
Object.defineProperty(retained, "host", { value: receiveHostInstance(Reflect.get(retained, "host"), "RunnerDeps.host"), enumerable: true, writable: true, configurable: true });
|
|
29
33
|
if (Object.hasOwn(retained, "peerSeat"))
|
|
30
34
|
Object.defineProperty(retained, "peerSeat", { value: receivePeerSeat(Reflect.get(retained, "peerSeat"), "RunnerDeps.peerSeat"), enumerable: true, writable: true, configurable: true });
|
|
31
35
|
if (Object.hasOwn(retained, "protocolRevocations"))
|
|
@@ -34,6 +38,8 @@ export function retainRunnerDeps(deps) {
|
|
|
34
38
|
Object.defineProperty(retained, "modelFallback", { value: receiveModelFallbackPolicy(Reflect.get(retained, "modelFallback"), "RunnerDeps.modelFallback"), enumerable: true, writable: true, configurable: true });
|
|
35
39
|
receiveCacheRetention(retained.cacheRetention, "RunnerDeps.cacheRetention");
|
|
36
40
|
screenPermissionModeWhenUnset(retained.permissionModeWhenUnset);
|
|
41
|
+
if (Object.hasOwn(retained, "autoMode"))
|
|
42
|
+
Object.defineProperty(retained, "autoMode", { value: receiveAutoModeFace(Reflect.get(retained, "autoMode"), "RunnerDeps.autoMode"), enumerable: true, writable: true, configurable: true });
|
|
37
43
|
const honorsReadChanges = retained.executionEnvFactoryHonorsReadChanges;
|
|
38
44
|
if (honorsReadChanges !== undefined && typeof honorsReadChanges !== "boolean") {
|
|
39
45
|
const e = new Error(`RunnerDeps.executionEnvFactoryHonorsReadChanges must be a boolean when given, got ${typeof honorsReadChanges} — refused at new Runner rather than read as false`);
|
|
@@ -28,6 +28,12 @@ export interface WriteFaceSeat {
|
|
|
28
28
|
readonly inForce: () => ContainmentFace;
|
|
29
29
|
readonly fenced: boolean;
|
|
30
30
|
}
|
|
31
|
+
/** The two faces the children of a leg that narrowed only its own hands (`TaskSpec.ownHandsReadOnly`) are handed — resolved
|
|
32
|
+
* without that narrowing (`prepare-hands-readface.ts` `carriedFacesOf`). */
|
|
33
|
+
export interface CarriedFaces {
|
|
34
|
+
readonly read: ContainmentFace;
|
|
35
|
+
readonly write: WriteFaceSeat;
|
|
36
|
+
}
|
|
31
37
|
import type { MaterializedA2a } from "../a2a.js";
|
|
32
38
|
import type { CompactionForkContext, RapidRefillState } from "../auto-compaction.js";
|
|
33
39
|
import type { AutoModeArmingRecipe } from "../auto-mode-arming.js";
|
|
@@ -373,6 +379,8 @@ export interface Prepared {
|
|
|
373
379
|
* prepare emits run-scoped disclosures of its own and each must have a terminal that names it.
|
|
374
380
|
*/
|
|
375
381
|
runId: string;
|
|
382
|
+
/** Wall-clock epoch ms minted once beside {@link runId} at prepare entry; every leg-start reader (`manifest.leg.instance.startedAt`, `task_started.startedAt`, `task.start.ts`) reads this value. */
|
|
383
|
+
legStartedAt: number;
|
|
376
384
|
/** The deployment's host floor as the config doors compiled it (absent ⇒ none declared) — the task images' guard reads it. */
|
|
377
385
|
hostFloor?: import("../host-floor.js").HostFloor;
|
|
378
386
|
/** The (owner, scope) key this run's registry-facing tools register rows under — ({@link taskId}, mount domain), minted once at prepare; the teardown sweeps read it and never re-derive it. */
|
|
@@ -380,6 +388,9 @@ export interface Prepared {
|
|
|
380
388
|
readonly owner: string;
|
|
381
389
|
readonly scope: string;
|
|
382
390
|
};
|
|
391
|
+
/** The run's member ledger book (`TaskSpec.runLedger`), present only on a run that declares one: the report tool delivers
|
|
392
|
+
* through it, and the settle reads the final ledger off it onto the result. */
|
|
393
|
+
runLedgerBook?: import("../run-ledger.js").RunLedgerBook;
|
|
383
394
|
/** The session's reminder provenance mark this run mints under (adopted
|
|
384
395
|
* through the prepare adoption ladder: checkpoint seed → trusted fork channel → session entry →
|
|
385
396
|
* fresh mint). Every engine-authored `<system-reminder>` open tag in the run carries it, and the
|
|
@@ -631,6 +642,7 @@ export interface Prepared {
|
|
|
631
642
|
* on THIS leg — a deny row found now vetoes, an operator's edit is judged on the `rejudge` seat. */
|
|
632
643
|
shellReadCheck?: import("../../tools/fs/shell-read-check.js").ShellReadCheck;
|
|
633
644
|
shellReadLandings?: import("../../tools/fs/shell-read-check.js").ShellReadLandings;
|
|
645
|
+
declaredReadKeys?: (toolCallId: string, call: Pick<import("../tool-registry.js").ToolCallLike, "face">) => readonly string[] | "unjudged" | undefined;
|
|
634
646
|
crossBoundary?: {
|
|
635
647
|
readonly check: import("../cross-boundary-taint.js").CrossBoundaryCheck | undefined;
|
|
636
648
|
settle(owed: import("../cross-boundary-taint.js").OwedDeliveries, boundMs?: number): Promise<void>;
|
|
@@ -1545,7 +1557,7 @@ export interface PreparedMicroCompact {
|
|
|
1545
1557
|
};
|
|
1546
1558
|
/** The run's ONE offload persist (write-once, idempotent): the frontier pass, the blocking-point arm and the MC-R arm all clear
|
|
1547
1559
|
* through it, so they compose identical markers. Absent when no offload store is configured. */
|
|
1548
|
-
offloadPersist?: (
|
|
1560
|
+
offloadPersist?: import("../tool-result-store.js").OffloadPersist;
|
|
1549
1561
|
}
|
|
1550
1562
|
/**
|
|
1551
1563
|
* Resume inputs threaded into {@link prepareTask} to continue a suspended task. The Runner
|
|
@@ -1930,6 +1942,9 @@ export interface RunInternals {
|
|
|
1930
1942
|
* a root run it starts (`runTask(spec, { toolCeiling })`): the task-start doors judge it as a host-written workflow ceiling is judged (another spelling of a tool the run carries refuses: `config.tool_face_control`, `near_miss`); its rows record it. Trusted, never a TaskSpec field.
|
|
1931
1943
|
*/
|
|
1932
1944
|
toolCeiling?: readonly import("../tool-face.js").ToolSelectorLayer[];
|
|
1945
|
+
/** The run's member ledger book (`TaskSpec.runLedger`) — always the run's own lane's (its notification lane mints it and hears the
|
|
1946
|
+
* run's frames into it); undefined on a run without a ledger. Trusted, never a TaskSpec field, never handed to a child. */
|
|
1947
|
+
runLedgerBook?: import("../run-ledger.js").RunLedgerBook | undefined;
|
|
1933
1948
|
/** Set by the delegation lane when the spawning run's prepare judged this leg's own tool lists (its spec's `allowTools` /
|
|
1934
1949
|
* `excludeTools` — a definition's or the delegation tool's) against a pool it could list: their digest (`toolListsDigest`), the
|
|
1935
1950
|
* evidence bound to exactly those lists. A prepare whose own lists digest to it does not judge them again, and its rows record it
|
|
@@ -2167,6 +2182,9 @@ export interface RunInternals {
|
|
|
2167
2182
|
* mirroring `insideFork`.
|
|
2168
2183
|
*/
|
|
2169
2184
|
isDelegatedChild?: boolean;
|
|
2185
|
+
/** The project seat its spawner (or waker) hands the leg, a DEFAULT: its id only when the leg declares none and has no marker, its texts only
|
|
2186
|
+
* when the leg's verdict is its id (`resolveSessionProject`); screened and copied at the call's internals door (a refused one ends the leg). Trusted internals. */
|
|
2187
|
+
parentProject?: import("../project-seat.js").ProjectSeat;
|
|
2170
2188
|
/** Who wrote this leg's objective ({@link import("../input-author.js").InputAuthor}), stated by the seat that mints it; absent = the public
|
|
2171
2189
|
* entry's caller, `operator`. Only the operator's objective passes `classic.UserPromptSubmit`; a non-member reads `unknown`, is screened and
|
|
2172
2190
|
* reported once (`onError`, `"config"`). Never inherited — each seat says its own. TRUSTED run-scoped channel (NOT a {@link TaskSpec} field). */
|
|
@@ -3412,8 +3430,9 @@ export interface RunnerSelfSeat {
|
|
|
3412
3430
|
emitTaskOutcome(outcome: TaskOutcome): void;
|
|
3413
3431
|
/** Announce a fact of a composition's own (the verification gate's `verify.verifier_is_implementer`) on `RunnerDeps.onNotice`, live-read,
|
|
3414
3432
|
* through the one delivery form every notice leaves by (`deliverEngineNotice`: the same-principal text pass, the session lift, a
|
|
3415
|
-
* throwing sink contained). Absent on a hand-built seat ⇒ the composition cannot say it, and says nothing; the Runner always has it.
|
|
3416
|
-
|
|
3433
|
+
* throwing sink contained). Absent on a hand-built seat ⇒ the composition cannot say it, and says nothing; the Runner always has it. With
|
|
3434
|
+
* a leg's `route` (`noticeAddressOf`) the Runner delivers under that route's admission (`legNoticeAdmission`, its own destination judge). */
|
|
3435
|
+
emitNotice?(notice: import("../engine-notice.js").EngineNotice, route?: import("../leg-identity.js").NoticeRoute): void;
|
|
3417
3436
|
/** A hold, on the peer seat THIS runner's legs ask, of the references `declared` names — taken by a keeper of declarations outside a
|
|
3418
3437
|
* leg (which they are: peer-seat.ts's module note), released by it once (peer-seat.ts `holdPeerDeclarations`). */
|
|
3419
3438
|
holdDeclarations(declared: import("../peer-seat.js").PeerDeclarations): import("../peer-seat.js").PeerDeclarationHold;
|
|
@@ -136,6 +136,10 @@ export interface JudgedRow {
|
|
|
136
136
|
readonly occupant?: () => Promise<string | undefined>;
|
|
137
137
|
readonly minted?: boolean;
|
|
138
138
|
readonly runsOn?: true;
|
|
139
|
+
/** `false`: the claimant's judgement taken without its write — a preview of the leg that would run on the row. Everything the claim
|
|
140
|
+
* needs is judged (a store with no conditional owner write refuses as it refuses the leg); a row that records no owner answers open
|
|
141
|
+
* and unclaimed, and nothing is recorded on it. */
|
|
142
|
+
readonly writes?: false;
|
|
139
143
|
}
|
|
140
144
|
/** The one refusal of a claim on a store that has no conditional owner write ({@link SessionStore.recordOwner}) — the whole of what a tree
|
|
141
145
|
* with an owner meets on a row that records none there; one sentence, one place. */
|
|
@@ -188,6 +192,10 @@ export declare function readJudgedRow<T>(sessions: Pick<SessionStore, "headOf" |
|
|
|
188
192
|
open: true;
|
|
189
193
|
}>;
|
|
190
194
|
}>;
|
|
195
|
+
/** The refusal of a read whose row is not the one judged ({@link readStandsAsJudged}). */
|
|
196
|
+
export declare function rowNotTheOneJudged(): Extract<RowAdmission, {
|
|
197
|
+
kind: "not_ours";
|
|
198
|
+
}>;
|
|
191
199
|
/** {@link judgeRowForTree} for an entry that reads its CALLER's seat off the tool call (SendMessage, AgentTranscript, an extension's
|
|
192
200
|
* transcript read): the seat's reading, bounded and ended by the call's stop. A caller that holds no seat — a tool driven with no run around
|
|
193
201
|
* it, an operator's continuation — is an anonymous tree's ({@link delegationOwnerOf}): it opens only rows that record no owner. What a
|
|
@@ -295,6 +303,28 @@ export declare function judgeLegRow(sessions: Pick<SessionStore, "headOf" | "rec
|
|
|
295
303
|
}>;
|
|
296
304
|
};
|
|
297
305
|
}, leg: JudgedLeg, report?: (err: Error, sessionId: string) => void): Promise<void>;
|
|
306
|
+
/** A leg's refusal of a row its judgement did not open: the store fault's own code ({@link RowStoreFaultCode}) for a store that could not
|
|
307
|
+
* judge it, `delegation.owner_mismatch` for a row that is not the tree's (the row named, no owner). Thrown by the leg's prepare
|
|
308
|
+
* ({@link judgeLegRow}) and answered by a preview of that leg alike. */
|
|
309
|
+
export declare function legRowRefusal(sessionId: string, verdict: Exclude<RowAdmission, {
|
|
310
|
+
open: true;
|
|
311
|
+
}>): Error & {
|
|
312
|
+
code: string;
|
|
313
|
+
};
|
|
314
|
+
/** What a leg's row is judged by ({@link JudgedLeg}), read off its spec, its internals and its tree's owner (`undefined` = the leg holds
|
|
315
|
+
* no seat: nothing is judged). The one reading of a leg's prepare and of a preview of that leg. */
|
|
316
|
+
export declare function judgedLegOf(spec: {
|
|
317
|
+
readonly sessionId?: string;
|
|
318
|
+
readonly requireExistingSession?: boolean;
|
|
319
|
+
readonly signal?: AbortSignal;
|
|
320
|
+
}, internals: {
|
|
321
|
+
readonly sessionIdMintedBySpawner?: boolean;
|
|
322
|
+
} | undefined, treeOwner: {
|
|
323
|
+
readonly owner: string | null;
|
|
324
|
+
} | undefined): JudgedLeg | undefined;
|
|
325
|
+
/** Whether a read of a row stands for the head a judgement read (`judged`; `null` = judged not there): the head after the read records
|
|
326
|
+
* the same owner on the same occupant. A row judged not there stands for no read. */
|
|
327
|
+
export declare function readStandsAsJudged(judged: SessionHead | null, now: SessionHead | undefined): boolean;
|
|
298
328
|
/** What a delegated leg's row is judged by in prepare: the tree owner its seat bound (`owner`; `null` = anonymous), whether the engine
|
|
299
329
|
* minted the id for this leg's create-capable acquire (`minted` — no author named it: the store's mint, or the spawning lane's,
|
|
300
330
|
* `RunInternals.sessionIdMintedBySpawner`), and the leg's own stop (`signal`, its spec's). */
|
|
@@ -135,6 +135,8 @@ export async function judgeRowForTree(sessions, row, tree, signal) {
|
|
|
135
135
|
const recordOwner = sessions.recordOwner;
|
|
136
136
|
if (typeof recordOwner !== "function")
|
|
137
137
|
return claimUnavailable();
|
|
138
|
+
if (row.writes === false)
|
|
139
|
+
return { open: true, claimed: false, head };
|
|
138
140
|
let answered;
|
|
139
141
|
try {
|
|
140
142
|
answered = await boundedOwnerRead(() => Promise.resolve().then(() => recordOwner.call(sessions, sessionId, owner, { row: { owner: null, ...(head.incarnation !== undefined ? { incarnation: head.incarnation } : {}) } })), signal, "delegation owner claim");
|
|
@@ -167,10 +169,13 @@ export async function readJudgedRow(sessions, sessionId, verdict, read, signal)
|
|
|
167
169
|
throw runAbortedError();
|
|
168
170
|
return { refused: storeFault("storage", `the row could not be read back after the read (${ownerReadEnd(err) === "unanswered" ? "the session store did not answer in time" : "the session store's read failed"})`, err) };
|
|
169
171
|
}
|
|
170
|
-
if (
|
|
172
|
+
if (readStandsAsJudged(judged, now))
|
|
171
173
|
return { read: value };
|
|
172
174
|
await forgetHeld(sessions, sessionId);
|
|
173
|
-
return { refused:
|
|
175
|
+
return { refused: rowNotTheOneJudged() };
|
|
176
|
+
}
|
|
177
|
+
export function rowNotTheOneJudged() {
|
|
178
|
+
return { open: false, kind: "not_ours", why: "the row is not the one judged — it changed hands, was laid down again, or was not there when it was judged" };
|
|
174
179
|
}
|
|
175
180
|
export async function judgeRowForSeat(sessions, row, seat, signal) {
|
|
176
181
|
return judgeRowForTree(sessions, row, await delegationOwnerOf(seat, signal), signal);
|
|
@@ -268,9 +273,20 @@ export async function judgeLegRow(sessions, held, leg, report) {
|
|
|
268
273
|
if (verdict.open)
|
|
269
274
|
return;
|
|
270
275
|
await forgetHeld(sessions, held.sessionId, report);
|
|
276
|
+
throw legRowRefusal(held.sessionId, verdict);
|
|
277
|
+
}
|
|
278
|
+
export function legRowRefusal(sessionId, verdict) {
|
|
271
279
|
if (verdict.kind === "store")
|
|
272
|
-
|
|
273
|
-
|
|
280
|
+
return rowStoreFaultError(sessionId, verdict);
|
|
281
|
+
return Object.assign(new Error(`the session row ${sessionId} does not record this delegation tree's owner: ${verdict.why}`), { code: DELEGATION_OWNER_MISMATCH });
|
|
282
|
+
}
|
|
283
|
+
export function judgedLegOf(spec, internals, treeOwner) {
|
|
284
|
+
if (treeOwner === undefined)
|
|
285
|
+
return undefined;
|
|
286
|
+
return { owner: treeOwner.owner, minted: spec.requireExistingSession !== true && (spec.sessionId === undefined || internals?.sessionIdMintedBySpawner === true), ...(spec.signal !== undefined ? { signal: spec.signal } : {}) };
|
|
287
|
+
}
|
|
288
|
+
export function readStandsAsJudged(judged, now) {
|
|
289
|
+
return judged !== null && now !== undefined && (now.owner ?? null) === (judged.owner ?? null) && sameOccupant(now.incarnation, judged.incarnation);
|
|
274
290
|
}
|
|
275
291
|
function forgetHeld(sessions, sessionId, report) {
|
|
276
292
|
return settleTeardownLeg(() => Promise.resolve(sessions.forget ? sessions.forget(sessionId) : undefined).catch(() => undefined), "forget (acquire-reconcile owner judgement leg)", report && ((e) => report(e, sessionId)));
|
|
@@ -47,6 +47,8 @@ export declare function settleFileHistoryRestore(input: {
|
|
|
47
47
|
/** Refuse before any file moves when the restore would refuse or fail one ({@link planFileHistoryRestore}) — a caller that does
|
|
48
48
|
* not accept a partial restore; a caller that reads the ledger itself leaves it off. */
|
|
49
49
|
wholeOrNothing: boolean;
|
|
50
|
+
/** Handed to the store's restore as it is: the store's restore input (`forkedSession` there) says what the fact is and what it changes. */
|
|
51
|
+
forkedSession?: boolean;
|
|
50
52
|
/** The rewind's record of whether the tree moved ({@link RewindOutcome.moved}): written here once the restore asked the env what
|
|
51
53
|
* it asked — whatever the restore then answers, or if it throws; untouched when the restore is refused before it runs. */
|
|
52
54
|
outcome?: Pick<RewindOutcome, "moved">;
|
|
@@ -108,7 +110,7 @@ export declare function refuseFailedPlan(planned: FileHistoryRestoreResult, targ
|
|
|
108
110
|
* half on the env it is handed restores such a history). The sentence names the frozen files ({@link listFrozenFileHistoryEntries}'s
|
|
109
111
|
* same set) and the way on. A plan with no such write returns.
|
|
110
112
|
*/
|
|
111
|
-
export declare function refuseUnheldPlan(plan: Pick<FileHistoryRestorePlan, "restore" | "unheld">, target: string, sessionId: string, ask: BoundaryAsk): void;
|
|
113
|
+
export declare function refuseUnheldPlan(plan: Pick<FileHistoryRestorePlan, "restore" | "unheld" | "unplacedForFork">, target: string, sessionId: string, ask: BoundaryAsk): void;
|
|
112
114
|
/** What {@link refuseTargetOutsideOwnLog} reads of the session: an entry by id. */
|
|
113
115
|
export interface OwnLogReader {
|
|
114
116
|
getEntry(id: string): Promise<unknown>;
|
|
@@ -3,7 +3,7 @@ import { planFileHistoryRestore, restoreMovedOf, restoreOptionsAt, witnessEnvOf,
|
|
|
3
3
|
import { isGovernanceRetryClass } from "../governance-codes.js";
|
|
4
4
|
export async function settleFileHistoryRestore(input) {
|
|
5
5
|
const { store, sessionId, scope, target, env, root } = input;
|
|
6
|
-
const plan = await planFileHistoryRestore(store, { scope, entryId: target, env, root, ...(input.signal !== undefined ? { signal: input.signal } : {}), ...(input.options !== undefined ? { options: input.options } : {}) });
|
|
6
|
+
const plan = await planFileHistoryRestore(store, { scope, entryId: target, env, root, ...(input.signal !== undefined ? { signal: input.signal } : {}), ...(input.options !== undefined ? { options: input.options } : {}), ...(input.forkedSession === true ? { forkedSession: true } : {}) });
|
|
7
7
|
refuseUnheldPlan(plan, target, sessionId, input.before ? "before" : "restore");
|
|
8
8
|
if (input.wholeOrNothing) {
|
|
9
9
|
const planned = plan.restore;
|
|
@@ -12,7 +12,7 @@ export async function settleFileHistoryRestore(input) {
|
|
|
12
12
|
throw restoreFailedError({ ...planned, filesChanged: [], identicalSkipped: [] }, `rewind-files: restore to entry "${target}" was refused before any file moved — the restore would be PARTIAL. Nothing was written or deleted; the plan: ${fileHistoryRestoreLedgerLine(planned, true)}. Repeating the same rewind plans the same; a rewind that restores the rest and answers this ledger is Runner.rewindFiles, and a run spec that accepts a partial restore (acceptPartialRestore) does the same where its host offers that member.`, RUN_STOPPED_RESTORE);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
const witness = witnessEnvOf(env, plan.holds, plan.states);
|
|
15
|
+
const witness = witnessEnvOf(env, plan.holds, plan.states, input.forkedSession === true ? root : undefined);
|
|
16
16
|
let answered;
|
|
17
17
|
try {
|
|
18
18
|
answered = await store.restore(scope, target, witness.env, root, input.signal, restoreOptionsAt(input.options, root));
|
|
@@ -59,10 +59,13 @@ export function refuseFailedPlan(planned, target, sessionId, ask) {
|
|
|
59
59
|
}
|
|
60
60
|
export function refuseUnheldPlan(plan, target, sessionId, ask) {
|
|
61
61
|
const keys = plan.unheld;
|
|
62
|
-
if (keys === undefined)
|
|
63
|
-
return;
|
|
64
62
|
const what = ask === "preview" ? `nothing was previewed for entry "${target}"` : `this rewind to entry "${target}" was not done at all: nothing was written or deleted`;
|
|
65
|
-
|
|
63
|
+
if (keys !== undefined) {
|
|
64
|
+
throw restoreFailedError({ ...plan.restore, filesChanged: [], identicalSkipped: [] }, `rewind-files: session "${sessionId}" has ${keys.length} file(s) an earlier version recorded through a link (${keys.join(", ")}), which this engine no longer writes through a link under any key; this deployment's file-history store did not hand the restore of its files to the engine's shared restore step (applyFileRestoreViaEnv, called on the env the store is handed), so which file each of its writes would land on cannot be read, and none of them can be kept off those files — ${what}. Repeating it answers the same until the store restores through that step; listFrozenFileHistoryEntries lists these files.`, RUN_STOPPED_RESTORE);
|
|
65
|
+
}
|
|
66
|
+
if (plan.unplacedForFork) {
|
|
67
|
+
throw restoreFailedError({ ...plan.restore, filesChanged: [], identicalSkipped: [] }, `rewind-files: session "${sessionId}" was forked from another, and a fork's rewind leaves every file outside its root as it is; this deployment's file-history store did not hand the restore of its files to the engine's shared restore step (applyFileRestoreViaEnv, called on the env the store is handed), so which file each of its writes would land on cannot be read, and none of them can be kept inside its root — ${what}. Repeating it answers the same until the store restores through that step.`, RUN_STOPPED_RESTORE);
|
|
68
|
+
}
|
|
66
69
|
}
|
|
67
70
|
function noBoundaryFor(target, sessionId, ask) {
|
|
68
71
|
return ask === "before" ? beforeWithoutBoundaryRefusal(target, sessionId) : noBoundaryRefusal(target, sessionId, ask === "preview");
|
|
@@ -92,7 +95,7 @@ const LEFT_AS_IS_WORDS = {
|
|
|
92
95
|
},
|
|
93
96
|
recorded_outside_root: {
|
|
94
97
|
ledger: "recorded outside this root",
|
|
95
|
-
why: "
|
|
98
|
+
why: "this file lies in a directory outside the root this rewind works in (either its version was recorded under another root, or this session was forked from another — a forked session's rewind leaves every file outside its root untouched), so this rewind writes or deletes it neither there nor here; for an unforked session, a rewind handed the root it was recorded under restores it, and for a forked session, rewind in the source session or restore it by hand",
|
|
96
99
|
beforehand: "a preview (Runner.rewindFiles with dryRun) lists such files before a rewind",
|
|
97
100
|
},
|
|
98
101
|
};
|
|
@@ -26,12 +26,14 @@ export function createFinishReasonSeat(onNotice, ids) {
|
|
|
26
26
|
const dropped = readMember(late, "contentDropped");
|
|
27
27
|
const valid = (statement === "ending" || statement === "error" || statement === "content") && typeof lateWord === "string" && typeof frames === "number";
|
|
28
28
|
if (valid && typeof dropped === "string") {
|
|
29
|
+
const ending = statement === "ending" ? lateWord : undefined;
|
|
29
30
|
if (once(`dropped\u0000${dropped}`)) {
|
|
30
31
|
deliverEngineNotice(onNotice, {
|
|
31
32
|
code: "route.stream_content_dropped",
|
|
32
|
-
message: `After the provider had already ended a response, its stream sent more of the model's output (first: ${dropped} content
|
|
33
|
+
message: `After the provider had already ended a response, its stream sent more of the model's output (first: ${dropped} content` +
|
|
34
|
+
`${ending !== undefined ? ` alongside the ending "${ending}"` : ""}; ${frames} frame${frames === 1 ? "" : "s"} after the end in all). ` +
|
|
33
35
|
`The first ending stands and that output was not added to the turn — the answer above may be missing what the model sent after it.`,
|
|
34
|
-
detail: { word: dropped, frames, sessionId: ids.sessionId, runId: ids.runId },
|
|
36
|
+
detail: { word: dropped, ...(ending !== undefined ? { ending } : {}), frames, sessionId: ids.sessionId, runId: ids.runId },
|
|
35
37
|
});
|
|
36
38
|
}
|
|
37
39
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { retiredKeyOf, retiredKeyRefusal } from "../retired-keys.js";
|
|
2
2
|
import { boundedThrownName } from "../thrown-value.js";
|
|
3
|
+
import { captureProjectSeat } from "../project-seat.js";
|
|
3
4
|
export const DRAINED_LEG_FRAME_TYPES = Object.freeze(["status", "wiring_manifest", "message_committed", "workspace_changed"]);
|
|
4
5
|
export const LEG_LABEL_KINDS = Object.freeze(["impl", "verifier", "fix", "rung"]);
|
|
5
6
|
const drained = new WeakSet();
|
|
@@ -50,6 +51,8 @@ export function admitLegFrameSeat(internals, entry) {
|
|
|
50
51
|
throw retiredKeyRefusal(hit, "RunInternals");
|
|
51
52
|
}
|
|
52
53
|
const read = readLegInternals(internals, entry);
|
|
54
|
+
if (read.parentProject !== undefined)
|
|
55
|
+
read.parentProject = captureProjectSeat(read.parentProject, "RunInternals.parentProject");
|
|
53
56
|
const seat = read.onLegFrame;
|
|
54
57
|
if (seat === undefined) {
|
|
55
58
|
refuseHiddenLegFrameSeat(internals, entry);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { skillLoadReading } from "./skill-base-dir.js";
|
|
2
|
+
import { SKILL_CONTENT_MAX_CHARS, normalizeSkills } from "./synthetic-tools.js";
|
|
3
|
+
export function loadedSkills(skills, onRejected) {
|
|
4
|
+
return normalizeSkills(skills).filter((s) => {
|
|
5
|
+
const { loads, delivered } = skillLoadReading(s, SKILL_CONTENT_MAX_CHARS);
|
|
6
|
+
if (!loads)
|
|
7
|
+
onRejected?.(s, delivered);
|
|
8
|
+
return loads;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -8,6 +8,7 @@ import type { ReminderDisclosureCounts } from "../reminder-disclosure.js";
|
|
|
8
8
|
import type { TaskSpec } from "../task-spec.js";
|
|
9
9
|
import type { EngineNotice, RunnerDeps, TaskEvent, TaskEventIdentity } from "../types.js";
|
|
10
10
|
import type { WiringManifest } from "../wiring-manifest.js";
|
|
11
|
+
import type { WiringInstructions } from "../instruction-preview.js";
|
|
11
12
|
import type { Prepared } from "./contracts.js";
|
|
12
13
|
/** At most this many names in `files` (and in `alternate.files`). */
|
|
13
14
|
export declare const NESTED_MEMORY_MAX_NAMES = 8;
|
|
@@ -144,13 +145,28 @@ interface LaneHands {
|
|
|
144
145
|
readonly root: string;
|
|
145
146
|
readonly additionalRoots?: ReadonlyArray<DeclaredRoot>;
|
|
146
147
|
}
|
|
148
|
+
/** What the lane reads of the leg it serves: the model it sizes frames for, the transcript's host texts, the leg's ids, its once-told
|
|
149
|
+
* record and identity. A prepared leg is one; a preview of a leg builds one with nothing behind it to write to. */
|
|
150
|
+
export interface InstructionLaneLeg {
|
|
151
|
+
readonly harness: {
|
|
152
|
+
getModel(): ReturnType<Prepared["harness"]["getModel"]>;
|
|
153
|
+
};
|
|
154
|
+
readonly session: {
|
|
155
|
+
buildContext(): ReturnType<Prepared["session"]["buildContext"]>;
|
|
156
|
+
};
|
|
157
|
+
readonly sessionId: string;
|
|
158
|
+
readonly runId: string;
|
|
159
|
+
readonly announcedListingsRef: Prepared["announcedListingsRef"];
|
|
160
|
+
readonly frameReceipts: Pick<Prepared["frameReceipts"], "listingSnapshotOwed">;
|
|
161
|
+
readonly hookIdentity: Pick<Prepared["hookIdentity"], "taskId" | "isDelegatedChild">;
|
|
162
|
+
}
|
|
147
163
|
interface LaneSeatCommon {
|
|
148
164
|
readonly declaration: ScreenedNestedMemory;
|
|
149
165
|
readonly signal: AbortSignal;
|
|
150
166
|
readonly mark: string | undefined;
|
|
151
167
|
readonly counts: ReminderDisclosureCounts | undefined;
|
|
152
168
|
readonly deps: Pick<RunnerDeps, "onNotice" | "onError">;
|
|
153
|
-
readonly leg: () =>
|
|
169
|
+
readonly leg: () => InstructionLaneLeg | undefined;
|
|
154
170
|
/** The file tools the run's roster mounts, read at each mint — what a frame's sentence (a cut file's way to the rest) may send the
|
|
155
171
|
* model to; absent outside a Runner: every one taken as mounted. */
|
|
156
172
|
readonly fileTools?: () => FrameFileTools;
|
|
@@ -213,15 +229,16 @@ export interface NestedMemoryLane {
|
|
|
213
229
|
* out. The load's per-request size cap is not applied (it can only take frames away). Empty once that load is taken. */
|
|
214
230
|
owedAhead(triggers: readonly string[]): readonly MintedAttachmentFrame[];
|
|
215
231
|
/** Each root's members the conversation holds (a read-state entry) or a load has on its way, relative to that root,
|
|
216
|
-
* `/`-separated
|
|
217
|
-
*
|
|
218
|
-
|
|
219
|
-
selected(): NonNullable<WiringManifest["instructions"]> | undefined;
|
|
232
|
+
* `/`-separated, plus first-load `@`-included and withheld entries (present iff non-empty); `undefined` on a lane with no
|
|
233
|
+
* hands unless host-text withholds occurred. */
|
|
234
|
+
selected(): WiringInstructions | undefined;
|
|
220
235
|
/** Is this key a member of the declared family — at a root's own level, or at any level — read off the declaration
|
|
221
236
|
* and the path alone (a member's name, or a markdown file under a rules directory), whoever wrote its entry? */
|
|
222
237
|
isMember(key: string, at: "root" | "any"): boolean;
|
|
223
238
|
}
|
|
224
239
|
export declare function createNestedMemoryLane(seat: NestedMemoryLaneSeat): NestedMemoryLane;
|
|
240
|
+
/** One first-load reading over a seated lane — shared by `primeInstructionLane` (manifest) and `Runner.previewInstructions`. */
|
|
241
|
+
export declare function primeInstructionReading(lane: NestedMemoryLane, report: (e: Error) => void): Promise<WiringInstructions | undefined>;
|
|
225
242
|
/** The leg's first load, before its manifest goes out, and the manifest's `instructions` member it answers
|
|
226
243
|
* ({@link WiringManifest.instructions}). A load that throws leaves the leg's first request to load (the operator hears
|
|
227
244
|
* why); the manifest then says what the read state holds. */
|