@sema-agent/core 7.69.0 → 7.69.1
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 +583 -0
- package/dist/agents/repair-loop.js +6 -14
- package/dist/agents/subagent.js +2 -1
- package/dist/agents/verify.d.ts +1 -1
- package/dist/agents/verify.js +7 -1
- package/dist/brain/reasoning-request.d.ts +7 -0
- package/dist/brain/reasoning-request.js +6 -0
- package/dist/core/agent-config-dir.d.ts +39 -3
- package/dist/core/agent-config-dir.js +67 -11
- package/dist/core/allow-entry.d.ts +5 -5
- package/dist/core/allow-entry.js +12 -6
- package/dist/core/ask-headline.d.ts +2 -2
- package/dist/core/ask-origin.d.ts +31 -31
- package/dist/core/ask-origin.js +20 -13
- package/dist/core/attachment-source.d.ts +1 -1
- package/dist/core/attachment-source.js +1 -0
- package/dist/core/auto-compaction.d.ts +44 -62
- package/dist/core/auto-compaction.js +44 -103
- package/dist/core/cache-break-detector.d.ts +23 -11
- package/dist/core/cache-break-detector.js +11 -5
- package/dist/core/checkpoint-features.d.ts +1 -1
- package/dist/core/checkpoint-features.js +1 -1
- package/dist/core/checkpoint-requirements.d.ts +19 -1
- package/dist/core/checkpoint-requirements.js +6 -0
- package/dist/core/checkpoint-row-verdict.js +3 -0
- package/dist/core/checkpoint-store.d.ts +13 -2
- package/dist/core/child-clamp-seats.d.ts +30 -3
- package/dist/core/child-clamp-seats.js +24 -0
- package/dist/core/compaction-retired-members.d.ts +12 -0
- package/dist/core/compaction-retired-members.js +22 -0
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +2 -0
- package/dist/core/context-edit.d.ts +32 -17
- package/dist/core/context-edit.js +28 -0
- package/dist/core/cron.d.ts +68 -0
- package/dist/core/cron.js +259 -0
- package/dist/core/engine-attestation.d.ts +16 -0
- package/dist/core/engine-attestation.js +2 -0
- package/dist/core/engine-capabilities.d.ts +14 -1
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +18 -7
- package/dist/core/engine-version.js +1 -1
- package/dist/core/gate-outcome.d.ts +29 -2
- package/dist/core/gate-outcome.js +6 -0
- package/dist/core/git-read-only.d.ts +10 -0
- package/dist/core/git-read-only.js +1 -0
- package/dist/core/git-worktree-env.js +9 -8
- package/dist/core/governance-codes.d.ts +9 -2
- package/dist/core/governance-codes.js +9 -0
- package/dist/core/locked-config.js +7 -3
- package/dist/core/lsp.d.ts +3 -0
- package/dist/core/lsp.js +3 -2
- package/dist/core/memory-engine/engine.d.ts +48 -12
- package/dist/core/memory-engine/engine.js +108 -46
- package/dist/core/memory-engine/file-backend.d.ts +2 -1
- package/dist/core/memory-engine/index-copies.d.ts +47 -0
- package/dist/core/memory-engine/index-copies.js +88 -0
- package/dist/core/memory-engine/layout.d.ts +20 -3
- package/dist/core/memory-engine/layout.js +39 -3
- package/dist/core/memory-engine/origin-clearance.d.ts +9 -7
- package/dist/core/memory-engine/origin-clearance.js +2 -4
- package/dist/core/memory-engine/types.d.ts +16 -3
- package/dist/core/mode-policy.d.ts +7 -1
- package/dist/core/mode-policy.js +9 -0
- package/dist/core/mods/session-compact.js +3 -3
- package/dist/core/mods/stations.d.ts +2 -0
- package/dist/core/mods/stations.js +2 -1
- package/dist/core/path-guard-rows.d.ts +8 -3
- package/dist/core/path-guard-rows.js +18 -5
- package/dist/core/peer-seat.d.ts +3 -0
- package/dist/core/peer-seat.js +3 -0
- package/dist/core/permission-rule-model.js +3 -2
- package/dist/core/process-identity.d.ts +11 -3
- package/dist/core/process-identity.js +26 -16
- package/dist/core/runner/assemble-result.d.ts +5 -0
- package/dist/core/runner/assemble-result.js +1 -1
- package/dist/core/runner/cleared-results-record.d.ts +33 -0
- package/dist/core/runner/cleared-results-record.js +56 -0
- package/dist/core/runner/compact-session.js +14 -9
- package/dist/core/runner/compaction-knobs.d.ts +1 -1
- package/dist/core/runner/continuation-gate.js +2 -1
- package/dist/core/runner/continues-from.d.ts +1 -1
- package/dist/core/runner/continues-from.js +1 -1
- package/dist/core/runner/contracts.d.ts +83 -31
- package/dist/core/runner/conversation-segment.d.ts +19 -12
- package/dist/core/runner/conversation-segment.js +27 -7
- package/dist/core/runner/derived-route-fallback.d.ts +2 -12
- package/dist/core/runner/derived-route-fallback.js +0 -6
- package/dist/core/runner/gate-exit.d.ts +2 -1
- package/dist/core/runner/gate-exit.js +4 -2
- package/dist/core/runner/git-status-frame.d.ts +2 -2
- package/dist/core/runner/git-status-frame.js +2 -1
- package/dist/core/runner/initial-run-state.js +1 -1
- package/dist/core/runner/leg-caller-places.d.ts +39 -0
- package/dist/core/runner/leg-caller-places.js +23 -0
- package/dist/core/runner/leg-frame.d.ts +8 -2
- package/dist/core/runner/leg-receipt.d.ts +29 -2
- package/dist/core/runner/leg-receipt.js +37 -6
- package/dist/core/runner/media-removed-seat.d.ts +10 -6
- package/dist/core/runner/media-removed-seat.js +6 -3
- package/dist/core/runner/messages-omitted-seat.d.ts +2 -1
- package/dist/core/runner/messages-omitted-seat.js +15 -5
- package/dist/core/runner/person-path-rows.d.ts +25 -7
- package/dist/core/runner/person-path-rows.js +16 -2
- package/dist/core/runner/prefix-ledger.d.ts +120 -0
- package/dist/core/runner/prefix-ledger.js +176 -0
- package/dist/core/runner/prepare-advisor.d.ts +2 -0
- package/dist/core/runner/prepare-advisor.js +2 -1
- package/dist/core/runner/prepare-artifact.d.ts +3 -0
- package/dist/core/runner/prepare-artifact.js +2 -2
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +2 -0
- package/dist/core/runner/prepare-caps-and-workflow.js +4 -3
- package/dist/core/runner/prepare-config-doors.d.ts +9 -8
- package/dist/core/runner/prepare-config-doors.js +15 -12
- package/dist/core/runner/prepare-context-lane.d.ts +25 -6
- package/dist/core/runner/prepare-context-lane.js +82 -27
- package/dist/core/runner/prepare-gate-stations.d.ts +1 -2
- package/dist/core/runner/prepare-gate-stations.js +2 -4
- package/dist/core/runner/prepare-hands-readface.d.ts +18 -5
- package/dist/core/runner/prepare-hands-readface.js +41 -22
- package/dist/core/runner/prepare-inherited-gate.d.ts +5 -0
- package/dist/core/runner/prepare-inherited-gate.js +2 -0
- package/dist/core/runner/prepare-memory.d.ts +10 -2
- package/dist/core/runner/prepare-memory.js +51 -5
- package/dist/core/runner/prepare-policy-chain.d.ts +3 -0
- package/dist/core/runner/prepare-policy-chain.js +13 -2
- package/dist/core/runner/prepare-prompt-assembly.d.ts +12 -4
- package/dist/core/runner/prepare-prompt-assembly.js +10 -4
- package/dist/core/runner/prepare-prompt-inputs.d.ts +3 -7
- package/dist/core/runner/prepare-prompt-inputs.js +6 -7
- package/dist/core/runner/prepare-safety-scan.js +7 -0
- package/dist/core/runner/prepare-suspend-saga.d.ts +4 -0
- package/dist/core/runner/prepare-suspend-saga.js +3 -2
- package/dist/core/runner/prepare-task.js +59 -53
- package/dist/core/runner/prepare-tool-disclosure-mount.d.ts +5 -11
- package/dist/core/runner/prepare-tool-disclosure-mount.js +7 -8
- package/dist/core/runner/prepare-turn-wiring.d.ts +16 -25
- package/dist/core/runner/prepare-turn-wiring.js +8 -18
- package/dist/core/runner/prepare-wiring-manifest.d.ts +1 -0
- package/dist/core/runner/prepare-wiring-manifest.js +3 -2
- package/dist/core/runner/prompt-suggestions.d.ts +3 -1
- package/dist/core/runner/prompt-suggestions.js +1 -1
- package/dist/core/runner/read-block-judge.d.ts +47 -0
- package/dist/core/runner/read-block-judge.js +33 -0
- package/dist/core/runner/role-resolution-table.d.ts +15 -10
- package/dist/core/runner/role-resolution-table.js +4 -5
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +7 -4
- package/dist/core/runner/rule-store-unreadable-notice.js +4 -3
- package/dist/core/runner/run-compaction-machinery.d.ts +0 -10
- package/dist/core/runner/run-compaction-machinery.js +3 -39
- package/dist/core/runner/run-harness-handlers.js +4 -17
- package/dist/core/runner/run-identity-wiring.js +4 -1
- package/dist/core/runner/run-leg.js +11 -1
- package/dist/core/runner/run-recovery-lanes.d.ts +0 -4
- package/dist/core/runner/run-recovery-lanes.js +34 -18
- package/dist/core/runner/run-settle-and-teardown.d.ts +1 -3
- package/dist/core/runner/run-settle-and-teardown.js +14 -22
- package/dist/core/runner/run-telemetry-and-budget-seats.js +0 -1
- package/dist/core/runner/run-terminal-adoption.d.ts +11 -30
- package/dist/core/runner/run-terminal-adoption.js +5 -88
- package/dist/core/runner/run-tool-mount-facts.js +1 -5
- package/dist/core/runner/run-turn-boundary.js +56 -26
- package/dist/core/runner/runtask.js +7 -7
- package/dist/core/runner/session-hash-salt.d.ts +18 -0
- package/dist/core/runner/session-hash-salt.js +36 -0
- package/dist/core/runner/shell-env-withheld.d.ts +8 -5
- package/dist/core/runner/shell-env-withheld.js +3 -3
- package/dist/core/runner/side-call-account.d.ts +9 -1
- package/dist/core/runner/side-call-account.js +15 -4
- package/dist/core/runner/skill-mention.d.ts +12 -0
- package/dist/core/runner/skill-mention.js +50 -0
- package/dist/core/runner/stream-settle-backstop.js +1 -0
- package/dist/core/runner/synthetic-tools.js +2 -2
- package/dist/core/runner/tool-table-view.d.ts +5 -9
- package/dist/core/runner/tool-table-view.js +23 -21
- package/dist/core/runner/write-protection-station.d.ts +5 -2
- package/dist/core/runner/write-protection-station.js +1 -1
- package/dist/core/runner-deps.d.ts +25 -27
- package/dist/core/scheduler.d.ts +13 -3
- package/dist/core/scheduler.js +0 -12
- package/dist/core/secret-env.d.ts +47 -11
- package/dist/core/secret-env.js +65 -4
- package/dist/core/sensitive-path-policy.js +4 -0
- package/dist/core/session-checkout.js +10 -9
- package/dist/core/shell-read-silence.d.ts +2 -1
- package/dist/core/shell-run-candidates.d.ts +1 -1
- package/dist/core/shell-run-candidates.js +11 -3
- package/dist/core/task-event.d.ts +32 -10
- package/dist/core/task-intake.d.ts +5 -3
- package/dist/core/task-intake.js +6 -2
- package/dist/core/task-result.d.ts +39 -0
- package/dist/core/task-spec-members.d.ts +3 -0
- package/dist/core/task-spec-members.js +2 -2
- package/dist/core/task-spec.d.ts +37 -20
- package/dist/core/tool-policy.d.ts +30 -18
- package/dist/core/tool-policy.js +44 -32
- package/dist/core/tool-roster.d.ts +21 -7
- package/dist/core/tool-roster.js +34 -6
- package/dist/core/tool-spec-members.js +1 -1
- package/dist/core/tool-spec.d.ts +27 -0
- package/dist/core/tools.js +1 -0
- package/dist/core/trace.d.ts +42 -19
- package/dist/core/unc-spelling.d.ts +31 -0
- package/dist/core/unc-spelling.js +51 -0
- package/dist/core/wiring-manifest.d.ts +30 -3
- package/dist/core/wiring-manifest.js +10 -0
- package/dist/core/workflow-run-store-contract.js +22 -0
- package/dist/core/workflow-run-store.d.ts +17 -13
- package/dist/core/workflow-run-store.js +1 -1
- package/dist/core/write-protect.d.ts +4 -0
- package/dist/core/write-protect.js +17 -15
- package/dist/engine/compaction/compaction.d.ts +48 -98
- package/dist/engine/compaction/compaction.js +136 -216
- package/dist/engine/compaction/utils.d.ts +2 -11
- package/dist/engine/compaction/utils.js +4 -13
- package/dist/engine/execution-env/node-execution-env.js +17 -6
- package/dist/engine/harness/agent-harness.d.ts +19 -5
- package/dist/engine/harness/agent-harness.js +18 -7
- package/dist/engine/harness/types.d.ts +5 -7
- package/dist/engine/loop/agent-loop.d.ts +14 -1
- package/dist/engine/loop/agent-loop.js +31 -11
- package/dist/engine/loop/types.d.ts +8 -2
- package/dist/index.d.ts +9 -6
- package/dist/index.js +8 -6
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +1 -1
- package/dist/internal/harness.js +1 -1
- package/dist/orchestration/run-spec.js +7 -2
- package/dist/orchestration/run-workflow-tool.js +5 -3
- package/dist/orchestration/workflow-park-adoption.d.ts +66 -8
- package/dist/orchestration/workflow-park-adoption.js +195 -45
- package/dist/orchestration/workflow-types.d.ts +20 -0
- package/dist/orchestration/workflow-types.js +1 -0
- package/dist/orchestration/workflow.d.ts +3 -2
- package/dist/orchestration/workflow.js +10 -4
- package/dist/prompt-assembly/catalog/core-behavior.js +6 -0
- package/dist/prompt-assembly/catalog/events.d.ts +8 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +6 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/mechanism.js +1 -0
- package/dist/prompt-assembly/catalog/mechanism.d.ts +8 -0
- package/dist/prompt-assembly/catalog/mechanism.js +1 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +1 -1
- package/dist/prompt-assembly/catalog/schema.js +1 -0
- package/dist/prompt-assembly/catalog/sections.js +8 -0
- package/dist/prompt-assembly/event-registry.js +1 -0
- package/dist/prompt-assembly/select.js +1 -0
- package/dist/prompt-assembly/turn-snapshot.d.ts +14 -27
- package/dist/prompt-assembly/turn-snapshot.js +6 -18
- package/dist/prompt-assembly/types.d.ts +3 -0
- package/dist/prompts/default.d.ts +9 -0
- package/dist/prompts/default.js +4 -0
- package/dist/shell/lex.d.ts +75 -11
- package/dist/shell/lex.js +340 -76
- package/dist/tools/fs/bash-program-position.js +2 -6
- package/dist/tools/fs/bash-readonly-classifier.d.ts +18 -3
- package/dist/tools/fs/bash-readonly-classifier.js +19 -9
- package/dist/tools/fs/containment-face.d.ts +12 -3
- package/dist/tools/fs/containment-face.js +16 -7
- package/dist/tools/fs/file-read-check.d.ts +26 -1
- package/dist/tools/fs/file-read-check.js +20 -2
- package/dist/tools/fs/fs-bash.js +4 -4
- package/dist/tools/fs/fs-read.d.ts +3 -0
- package/dist/tools/fs/fs-read.js +2 -2
- package/dist/tools/fs/fs-search-tools.d.ts +2 -2
- package/dist/tools/fs/fs-search-tools.js +4 -4
- package/dist/tools/fs/index.js +5 -3
- package/dist/tools/fs/pdf.js +12 -4
- package/dist/tools/fs/read-deny-home.d.ts +13 -2
- package/dist/tools/fs/read-deny-home.js +26 -22
- package/dist/tools/fs/read-deny.js +15 -6
- package/dist/tools/fs/removal-targets.d.ts +33 -17
- package/dist/tools/fs/removal-targets.js +160 -61
- package/dist/tools/fs/repo-map.d.ts +1 -1
- package/dist/tools/fs/repo-map.js +2 -2
- package/dist/tools/fs/safety.d.ts +28 -5
- package/dist/tools/fs/safety.js +72 -8
- package/dist/tools/fs/shell-read-bindings.d.ts +8 -2
- package/dist/tools/fs/shell-read-bindings.js +25 -6
- package/dist/tools/fs/shell-read-check.d.ts +3 -0
- package/dist/tools/fs/shell-read-check.js +22 -4
- package/dist/tools/fs/shell-read-establish.js +73 -43
- package/dist/tools/fs/shell-read-judge.d.ts +32 -14
- package/dist/tools/fs/shell-read-judge.js +13 -5
- package/dist/tools/fs/shell-read-object-path.d.ts +5 -1
- package/dist/tools/fs/shell-read-object-path.js +17 -4
- package/dist/tools/fs/shell-read-plan.d.ts +8 -2
- package/dist/tools/fs/shell-read-plan.js +36 -22
- package/dist/tools/fs/shell-read-sourced.js +12 -4
- package/dist/tools/fs/shell-read-start.d.ts +4 -2
- package/dist/tools/fs/shell-read-start.js +3 -3
- package/dist/tools/fs/shell-read-workdir.d.ts +14 -6
- package/dist/tools/fs/shell-read-workdir.js +35 -17
- package/dist/tools/scheduler-tools.d.ts +7 -17
- package/dist/tools/scheduler-tools.js +9 -85
- package/dist/tools/worktree.js +5 -4
- package/package.json +3 -2
- package/test/export-surface.snapshot.json +47 -1
- package/wire-changes/core-stores-sql@7.68.6.json +39 -0
- package/wire-changes/core-stores-sql@7.69.1.json +39 -0
- package/wire-changes/core@7.68.6.json +125 -0
- package/wire-changes/core@7.69.1.json +2561 -0
- package/wire-changes/mods-kernel@7.68.6.json +39 -0
- package/wire-changes/mods-kernel@7.69.1.json +39 -0
- package/wire-changes/primitives@7.68.6.json +39 -0
- package/wire-changes/primitives@7.69.1.json +39 -0
- package/wire-changes/wiki-gate@7.68.6.json +39 -0
- package/wire-changes/wiki-gate@7.69.1.json +39 -0
- package/dist/core/runner/prompt-hash-salt.d.ts +0 -1
- package/dist/core/runner/prompt-hash-salt.js +0 -2
|
@@ -33,6 +33,9 @@ export interface PrepareHandsReadFaceInput {
|
|
|
33
33
|
/** borrowed-readonly — the run's command sandbox seat (`command-sandbox.ts`), handed to the band's shell faces; absent when
|
|
34
34
|
* the run requires no sandbox. */
|
|
35
35
|
commandSandbox?: CommandSandboxSeat;
|
|
36
|
+
/** borrowed-readonly — the leg's declared places (`leg-caller-places.ts`, minted once by the driver): the configuration roots
|
|
37
|
+
* and the caller's homes the run's read deny table is placed at. */
|
|
38
|
+
callerPlaces: import("./leg-caller-places.js").LegCallerPlaces;
|
|
36
39
|
/** borrowed-readonly (the ownership-ref PROTOCOL stays with the driver — D-8 案① posture, same
|
|
37
40
|
* as B-4): the effective env (`ownedEnv ?? deps.executionEnv ?? stub`). This phase drives it
|
|
38
41
|
* (canonicalPath/joinPath/writeFileExclusive probe/instanceof screens) and closes tool bands
|
|
@@ -104,12 +107,12 @@ export interface PrepareHandsReadFaceInput {
|
|
|
104
107
|
/** borrowed-readonly — the task-spec seats this phase reads, as a Pick over the SAME spec object
|
|
105
108
|
* (R-4). `tools` feeds only the band shadow check; `envFacts` only the advertised scratchpad; `planFile` only the
|
|
106
109
|
* advertised session plan file; `retainBackgroundProcesses` only the band's retain lane (Bash's lifetime sentence + row stamp). */
|
|
107
|
-
spec: Pick<TaskSpec, "additionalDirectories" | "additionalReadDirectories" | "envFacts" | "planFile" | "handsReadOnly" | "readDenyPatterns" | "readFace" | "writeFace" | "oneShot" | "resumeAt" | "retainBackgroundProcesses" | "sessionId" | "tools">;
|
|
110
|
+
spec: Pick<TaskSpec, "additionalDirectories" | "additionalReadDirectories" | "envFacts" | "planFile" | "handsReadOnly" | "blockReadsOutsideRoots" | "readDenyPatterns" | "readFace" | "writeFace" | "oneShot" | "resumeAt" | "retainBackgroundProcesses" | "sessionId" | "tools">;
|
|
108
111
|
/** borrowed-readonly — the deployment seats this phase reads, as a Pick over the SAME deps
|
|
109
112
|
* object (R-4: `deps.onError?.()` keeps its receiver; a new deps read must widen this Pick).
|
|
110
113
|
* `readDenyBuiltinTiers`/`readDenyBuiltinExclude` are SNAPSHOTTED before the first await that
|
|
111
114
|
* precedes the toolkit compile (the caller retains these arrays by reference). */
|
|
112
|
-
deps: Pick<RunnerDeps, "onError" | "onNotice" | "tracer" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "readDenyFloorRequired" | "
|
|
115
|
+
deps: Pick<RunnerDeps, "onError" | "onNotice" | "tracer" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "readDenyFloorRequired" | "readFace" | "writeFace" | "permissionRuleStore" | "hands" | "imageProcessor">;
|
|
113
116
|
/** borrowed-readonly — the trusted spawn-side seats the band forwards: the finished-command
|
|
114
117
|
* notification lane, the mid-flight detach hub, and the Runner's per-session
|
|
115
118
|
* read-state seats and their restore channel (absent on a standalone prepare ⇒ the transcript-replay rung
|
|
@@ -251,6 +254,12 @@ export interface PrepareHandsReadFaceResult {
|
|
|
251
254
|
shellReadLandings: ShellReadLandings | undefined;
|
|
252
255
|
/** owned — the file read station's admission (`FileReadStation.admitted`) the band's read tools got, for the read tools mounted later (LSP). */
|
|
253
256
|
readAdmission: ((toolCallId: string | undefined, canonicalKey: string) => boolean) | undefined;
|
|
257
|
+
/** owned (value) — the leg's one resolution of `TaskSpec.blockReadsOutsideRoots` (`readBlockOf`, both branches); every reader takes it. */
|
|
258
|
+
readBlock: boolean;
|
|
259
|
+
/** owned — the file read station on the run's newest tables where {@link readBlock} mounts it as a refusal (`onNewestRead`). */
|
|
260
|
+
readBlockJudge: ShellReadCheck | undefined;
|
|
261
|
+
/** owned — the remedy this leg's read faces name when they refuse outside their roots (`readBlockLeg`); the driver hands it on. */
|
|
262
|
+
outsideReadRemedy: string | undefined;
|
|
254
263
|
/** write-back (D-3 hold) — the run's RESOLVED read face where hands mount; undefined ⇔ no hands
|
|
255
264
|
* (the hands-less value lives in `handsLessResolvedFace`). The driver assigns this onto its
|
|
256
265
|
* outer `let` for the call-time closures (ctx enrichment / checkpoint mint / envFacts). */
|
|
@@ -272,9 +281,13 @@ export interface PrepareHandsReadFaceResult {
|
|
|
272
281
|
/** owned — the built-in deny TIERS this leg MATERIALLY activated, off the same snapshot the compile
|
|
273
282
|
* judged with; empty ⇒ none. Relayed to the wiring manifest, never re-derived from `deps` there. */
|
|
274
283
|
readDenyBuiltinTiersActive: readonly string[];
|
|
275
|
-
/** owned — the byte floor's
|
|
276
|
-
*
|
|
277
|
-
|
|
284
|
+
/** owned — the byte floor's latch over EVERY table this leg compiles (`judgeReadFloorKept`): the prepare's first one and each
|
|
285
|
+
* one the person's rows bring later. `current` turns `true` once any of them holds rows on an environment that does not keep
|
|
286
|
+
* the floor, and never back. Read, never re-derived: by the wiring manifest when it is derived (`readDenyFloor`, the leg's
|
|
287
|
+
* wiring as it started) and by the result when it is assembled (`TaskResult.readDenyFloor`, the leg's record over its life). */
|
|
288
|
+
readFloorUnkept: {
|
|
289
|
+
readonly current: boolean;
|
|
290
|
+
};
|
|
278
291
|
/** write-back (D-3 hold) — the hands-LESS legs' resolved face (the read posture is a
|
|
279
292
|
* property of the RUN, not the mount). Driver assigns onto its outer `let`. */
|
|
280
293
|
handsLessResolvedFace: ContainmentFace | undefined;
|
|
@@ -4,11 +4,12 @@ import { bashReversibilityProbe, activeReadDenyBuiltinTiers, readDenyBuiltinConf
|
|
|
4
4
|
import { resolveKey, rootAdmittingArtifactStore, sha256 } from "../../tools/fs/safety.js";
|
|
5
5
|
import { thrownText } from "../thrown-value.js";
|
|
6
6
|
import { carryReadFace } from "../../tools/fs/read-deny-home.js";
|
|
7
|
-
import { EMPTY_READ_ROOTS, afterCallTables, denySeatsOf, onPinnedRead, pathTablesCompile, readRootsOver } from "./person-path-rows.js";
|
|
7
|
+
import { EMPTY_READ_ROOTS, afterCallTables, denySeatsOf, onNewestRead, onPinnedRead, pathTablesCompile, readRootsOver } from "./person-path-rows.js";
|
|
8
8
|
import { createShellOverflowSpoolFence } from "../../tools/fs/fs-shared.js";
|
|
9
9
|
import { createShellReadStation } from "../../tools/fs/shell-read-check.js";
|
|
10
10
|
import { judgeReadFloorKept, readFloorSeat } from "../../tools/fs/read-floor.js";
|
|
11
|
-
import { createFileReadStation } from "../../tools/fs/file-read-check.js";
|
|
11
|
+
import { createFileReadStation, outsideReadDisposition } from "../../tools/fs/file-read-check.js";
|
|
12
|
+
import { readBlockLeg, readBlockOf } from "./read-block-judge.js";
|
|
12
13
|
import { isShellFaceToolName, readTargetToolNames } from "../tool-registry.js";
|
|
13
14
|
import { normalizeFileText } from "../../tools/fs/encoding.js";
|
|
14
15
|
import { wholeFileRecordsFromTranscript } from "./session-file-state-replay.js";
|
|
@@ -22,24 +23,24 @@ import { unionAddOnly } from "../child-clamp-seats.js";
|
|
|
22
23
|
import { assertStringArraySeat, screenReadDenySeat } from "../read-face-seats.js";
|
|
23
24
|
import { modePolicyOf } from "../mode-policy.js";
|
|
24
25
|
import { valveLeaves } from "../../agents/tool-filter.js";
|
|
25
|
-
const faceClampAnnouncedSinks = { read: new WeakSet(), write: new WeakSet() };
|
|
26
|
-
const faceClampConsoleAnnounced = { read: false, write: false };
|
|
27
|
-
function announceDeploymentFaceClamp(kind, sink) {
|
|
26
|
+
const faceClampAnnouncedSinks = { read_only_mount: { read: new WeakSet(), write: new WeakSet() }, read_block: { read: new WeakSet(), write: new WeakSet() } };
|
|
27
|
+
const faceClampConsoleAnnounced = { read_only_mount: { read: false, write: false }, read_block: { read: false, write: false } };
|
|
28
|
+
function announceDeploymentFaceClamp(kind, cause, sink) {
|
|
28
29
|
if (typeof sink === "function") {
|
|
29
|
-
if (faceClampAnnouncedSinks[kind].has(sink))
|
|
30
|
+
if (faceClampAnnouncedSinks[cause][kind].has(sink))
|
|
30
31
|
return;
|
|
31
|
-
faceClampAnnouncedSinks[kind].add(sink);
|
|
32
|
+
faceClampAnnouncedSinks[cause][kind].add(sink);
|
|
32
33
|
}
|
|
33
34
|
else {
|
|
34
|
-
if (faceClampConsoleAnnounced[kind])
|
|
35
|
+
if (faceClampConsoleAnnounced[cause][kind])
|
|
35
36
|
return;
|
|
36
|
-
faceClampConsoleAnnounced[kind] = true;
|
|
37
|
+
faceClampConsoleAnnounced[cause][kind] = true;
|
|
37
38
|
}
|
|
38
|
-
deliverEngineNotice(sink, deploymentFaceClampNotice(kind));
|
|
39
|
+
deliverEngineNotice(sink, deploymentFaceClampNotice(kind, cause));
|
|
39
40
|
}
|
|
40
41
|
export function __resetReadFaceClampAnnouncement() {
|
|
41
|
-
faceClampConsoleAnnounced.
|
|
42
|
-
faceClampConsoleAnnounced.
|
|
42
|
+
faceClampConsoleAnnounced.read_only_mount = { read: false, write: false };
|
|
43
|
+
faceClampConsoleAnnounced.read_block = { read: false, write: false };
|
|
43
44
|
}
|
|
44
45
|
function writeFaceReader(input, onDeploymentClamp) {
|
|
45
46
|
const { spec, deps, resume, fullShellReachable, permissionMode } = input;
|
|
@@ -50,9 +51,11 @@ function writeFaceReader(input, onDeploymentClamp) {
|
|
|
50
51
|
const faceUnder = (modeFace) => resolveContainmentFace({ ...seats, specFace: folded(spec.writeFace), depsFace: folded(deps.writeFace), ...(modeFace !== undefined ? { modeFace } : {}) });
|
|
51
52
|
return { inForce: () => faceUnder(modePolicyOf(permissionMode.current).writeFace), fenced: faceUnder("open") === "roots" };
|
|
52
53
|
}
|
|
54
|
+
const FLOOR_NEVER_UNKEPT = Object.freeze({ current: false });
|
|
53
55
|
export function resolveHandsLessReadFace(input) {
|
|
54
56
|
const { resume, fullShellReachable, spec, deps } = input;
|
|
55
57
|
assertStringArraySeat(deps.readDenyPatterns, "RunnerDeps.readDenyPatterns", "compiler-owned");
|
|
58
|
+
const readBlock = readBlockOf(input);
|
|
56
59
|
let handsLessResolvedFace;
|
|
57
60
|
let handsLessResolvedWriteFace;
|
|
58
61
|
let readDenyAdditionsNormalized = [];
|
|
@@ -63,6 +66,7 @@ export function resolveHandsLessReadFace(input) {
|
|
|
63
66
|
specFace: spec.readFace,
|
|
64
67
|
depsFace: deps.readFace,
|
|
65
68
|
readOnlyMount: spec.handsReadOnly === true,
|
|
69
|
+
readBlock,
|
|
66
70
|
orgGoverned: deps.permissionRuleStore?.partitions.org === true,
|
|
67
71
|
fullShellReachable,
|
|
68
72
|
});
|
|
@@ -90,11 +94,14 @@ export function resolveHandsLessReadFace(input) {
|
|
|
90
94
|
runReadFloor: undefined,
|
|
91
95
|
shellReadLandings: undefined,
|
|
92
96
|
readAdmission: undefined,
|
|
97
|
+
readBlock,
|
|
98
|
+
readBlockJudge: undefined,
|
|
99
|
+
outsideReadRemedy: undefined,
|
|
93
100
|
resolvedReadFace: undefined,
|
|
94
101
|
resolvedWriteFace: undefined,
|
|
95
102
|
readDenyAdditionsNormalized,
|
|
96
103
|
readDenyBuiltinTiersActive,
|
|
97
|
-
readFloorUnkept:
|
|
104
|
+
readFloorUnkept: FLOOR_NEVER_UNKEPT,
|
|
98
105
|
handsLessResolvedFace,
|
|
99
106
|
handsLessResolvedWriteFace,
|
|
100
107
|
additionalRootsCanonical: [],
|
|
@@ -115,6 +122,8 @@ export async function prepareHandsMount(input) {
|
|
|
115
122
|
const { handsEnabled, executionEnv, taskRootCanonical, rebaseRestoredPath, resume, session, sessionId, hostTaskId, taskScope, fullShellReachable, effectiveShellGate, toolFaceSnapshot, model, spec, deps, internals, memoryWriteGate, advertisedWritableDirs, firstPartyOffload, roster, egressTools, irreversibilityTier, irreversibleTools, reversibilityProbes } = input;
|
|
116
123
|
assertStringArraySeat(spec.additionalDirectories, "TaskSpec.additionalDirectories", "strings");
|
|
117
124
|
assertStringArraySeat(spec.additionalReadDirectories, "TaskSpec.additionalReadDirectories", "strings");
|
|
125
|
+
const readBlock = readBlockOf(input);
|
|
126
|
+
const { outsideReadRemedy, grantsReadRootMidRun, personDirectories } = readBlockLeg(readBlock);
|
|
118
127
|
assertStringArraySeat(deps.readDenyPatterns, "RunnerDeps.readDenyPatterns", "compiler-owned");
|
|
119
128
|
let readFileStateForCheckpoint;
|
|
120
129
|
let sealReadStateSeat;
|
|
@@ -129,11 +138,12 @@ export async function prepareHandsMount(input) {
|
|
|
129
138
|
let runReadFloor;
|
|
130
139
|
let shellReadTools = new Set();
|
|
131
140
|
let fileReadStation;
|
|
141
|
+
let readBlockJudge;
|
|
132
142
|
let resolvedReadFace;
|
|
133
143
|
let resolvedWriteFace;
|
|
134
144
|
let readDenyAdditionsNormalized = [];
|
|
135
145
|
let readDenyBuiltinTiersActive = [];
|
|
136
|
-
|
|
146
|
+
const readFloorUnkept = { current: false };
|
|
137
147
|
let handsLessResolvedFace;
|
|
138
148
|
const handsLessResolvedWriteFace = undefined;
|
|
139
149
|
const shellGatedTools = new Set();
|
|
@@ -186,7 +196,7 @@ export async function prepareHandsMount(input) {
|
|
|
186
196
|
}
|
|
187
197
|
for (const a of [additionalRootsCanonical, additionalReadRootsCanonical])
|
|
188
198
|
a.splice(0, a.length, ...new Set(a));
|
|
189
|
-
grantReadRoot = readRootGrantOver({ env: executionEnv, writeRoots: additionalRootsCanonical, readRoots: additionalReadRootsCanonical, artifactStore: artifactStoreRef });
|
|
199
|
+
grantReadRoot = !grantsReadRootMidRun ? undefined : readRootGrantOver({ env: executionEnv, writeRoots: additionalRootsCanonical, readRoots: additionalReadRootsCanonical, artifactStore: artifactStoreRef });
|
|
190
200
|
const readFileState = new Map(entriesCarriedAcrossLegs(resume?.seed.readFileState ?? []).map(([k, v]) => [rebaseRestoredPath(k), v]));
|
|
191
201
|
readFileStateForCheckpoint = readFileState;
|
|
192
202
|
seedContextFiles = async (files) => {
|
|
@@ -221,17 +231,17 @@ export async function prepareHandsMount(input) {
|
|
|
221
231
|
const canonicalize = async (dirs) => { const out = []; for (const d of dirs)
|
|
222
232
|
await canonicalizeExtraDirs([d], "persistedReadRule", out).catch((err) => deps.onError?.(new Error(`persistedReadRule entry skipped (its lookup threw): ${d}: ${thrownText(err)}`), { phase: "config", sessionId })); return out; };
|
|
223
233
|
const floorRequired = screenReadDenySeat("readDenyFloorRequired", deps.readDenyFloorRequired) === true;
|
|
224
|
-
const compileRunTables = pathTablesCompile({ env: executionEnv, additions: readDenyAdditions, builtin: readDenyBuiltinCfg, legRows: input.denyRuleRows, leads: input.headLeads,
|
|
234
|
+
const compileRunTables = pathTablesCompile({ env: executionEnv, additions: readDenyAdditions, builtin: readDenyBuiltinCfg, legRows: input.denyRuleRows, leads: input.headLeads, configRoots: input.callerPlaces.configRoots.dirs, callerHomes: input.callerPlaces.homes.dirs, canonicalize });
|
|
225
235
|
const judgedRunTables = async (person) => {
|
|
226
236
|
const compiled = await compileRunTables(person);
|
|
227
237
|
if (judgeReadFloorKept({ env: executionEnv, table: compiled.readDeny, floor: readFloorSeat(compiled.readDeny)?.(undefined), required: floorRequired, onNotice: deps.onNotice, attribution: { sessionId, runId: input.runId }, told: input.told }))
|
|
228
|
-
readFloorUnkept = true;
|
|
238
|
+
readFloorUnkept.current = true;
|
|
229
239
|
return compiled;
|
|
230
240
|
};
|
|
231
241
|
const tables = (pathTables = await input.personRows.attachTables(judgedRunTables));
|
|
232
242
|
readDenyMatcher = tables.readDeny;
|
|
233
243
|
runReadFloor = readFloorSeat(tables.readDeny);
|
|
234
|
-
readRoots = readRootsOver({ own: () => [...(input.writeLocation() === rootCanonical ? [] : [input.writeLocation()]), ...additionalRootsCanonical, ...additionalReadRootsCanonical], tables, ready: input.personRows.tablesReady, store: () => artifactStoreRef.current,
|
|
244
|
+
readRoots = readRootsOver({ own: () => [...(input.writeLocation() === rootCanonical ? [] : [input.writeLocation()]), ...additionalRootsCanonical, ...additionalReadRootsCanonical], tables, ready: input.personRows.tablesReady, store: () => artifactStoreRef.current, personDirectories,
|
|
235
245
|
onHeld: (entry, store) => emitTrace(deps.tracer, () => ({ kind: "config.additional_directory_skipped", version: 1, taskId: hostTaskId, entry, field: "persistedReadRule", reason: `admits_artifact_store: the local artifact store ${store} lies inside it or it inside the store — the Artifact tool's ledger and stored files stay outside every root the file tools reach`, ts: Date.now() })) });
|
|
236
246
|
readDenyBuiltinTiersActive = activeReadDenyBuiltinTiers(readDenyBuiltinCfg);
|
|
237
247
|
readDenyAdditionsNormalized = compileReadDeny(readDenyAdditions, "readDenyPatterns", { tiers: [] }).entries;
|
|
@@ -240,14 +250,15 @@ export async function prepareHandsMount(input) {
|
|
|
240
250
|
specFace: spec.readFace,
|
|
241
251
|
depsFace: deps.readFace,
|
|
242
252
|
readOnlyMount: handsReadOnly,
|
|
253
|
+
readBlock,
|
|
243
254
|
orgGoverned: deps.permissionRuleStore?.partitions.org === true,
|
|
244
255
|
fullShellReachable,
|
|
245
|
-
onDeploymentClamp: () => announceDeploymentFaceClamp("read", deps.onNotice),
|
|
256
|
+
onDeploymentClamp: (cause) => announceDeploymentFaceClamp("read", cause, deps.onNotice),
|
|
246
257
|
});
|
|
247
258
|
if (resume !== undefined && (seedReadFaceSection === undefined || seedReadFaceSection.face === "roots"))
|
|
248
259
|
liveReadFace = "roots";
|
|
249
260
|
resolvedReadFace = liveReadFace;
|
|
250
|
-
resolvedWriteFace = writeFaceReader(input, () => announceDeploymentFaceClamp("write", deps.onNotice));
|
|
261
|
+
resolvedWriteFace = writeFaceReader(input, (cause) => announceDeploymentFaceClamp("write", cause, deps.onNotice));
|
|
251
262
|
const sessionSeats = input.internals?.sessionReadStates;
|
|
252
263
|
const seatLeafId = await readSeatLeaf(session);
|
|
253
264
|
const judgeKey = async (path) => {
|
|
@@ -325,11 +336,14 @@ export async function prepareHandsMount(input) {
|
|
|
325
336
|
boundaryOf: (_tool, _cwd, toolCallId) => readonlyBoundary(toolCallId) ?? shellReadBoundary(toolCallId), rootsCanonical: true,
|
|
326
337
|
homeViews: tables.readDeny.homeViews,
|
|
327
338
|
onAdmissionRefused: (toolCallId, echoed) => void input.toolOccurrences.refuse(toolCallId, "read_boundary", echoed !== undefined ? { echoed } : undefined),
|
|
339
|
+
...(!grantsReadRootMidRun ? { offersReadRootGrant: false } : {}),
|
|
328
340
|
});
|
|
329
341
|
}
|
|
330
|
-
|
|
342
|
+
const outsideReads = outsideReadDisposition({ readOnlyMount: handsReadOnly, readBlock });
|
|
343
|
+
if (outsideReads !== "tool_fence") {
|
|
331
344
|
const bgOutputExempt = backgroundOutputReadExemption(defaultTaskRegistry, { taskOwner: hostTaskId, taskScope, ...(sessionId !== undefined ? { sessionId } : {}) }, executionEnv);
|
|
332
345
|
fileReadStation = createFileReadStation({
|
|
346
|
+
outsideReads,
|
|
333
347
|
env: executionEnv,
|
|
334
348
|
rootCanonical,
|
|
335
349
|
roots: readRoots,
|
|
@@ -340,12 +354,14 @@ export async function prepareHandsMount(input) {
|
|
|
340
354
|
excluded: (key) => artifactStoreRef.current !== undefined && rootAdmittingArtifactStore(artifactStoreRef.current, [key]) !== undefined,
|
|
341
355
|
exempt: (key) => bgOutputExempt?.(key) === true,
|
|
342
356
|
});
|
|
357
|
+
if (outsideReads === "refusal")
|
|
358
|
+
readBlockJudge = onNewestRead(input.personRows, fileReadStation);
|
|
343
359
|
}
|
|
344
360
|
const valveLeft = valveLeaves(toolFaceSnapshot.selector);
|
|
345
361
|
const band = createHandsToolkit(executionEnv, readFileState, rootCanonical, {
|
|
346
362
|
...(additionalRootsCanonical.length > 0 ? { additionalRoots: additionalRootsCanonical } : {}),
|
|
347
363
|
writeRoot: input.writeLocation,
|
|
348
|
-
readDenyHomes: carryReadFace([], { readDeny: tables.readDeny, writeDeny: tables.writeDeny, readRoots }),
|
|
364
|
+
readDenyHomes: carryReadFace([], { readDeny: tables.readDeny, writeDeny: tables.writeDeny, readRoots, ...(outsideReadRemedy !== undefined ? { outsideReadRemedy } : {}) }),
|
|
349
365
|
readFace: liveReadFace,
|
|
350
366
|
writeFaceLive: resolvedWriteFace.inForce,
|
|
351
367
|
reminderMark: input.reminderMark,
|
|
@@ -451,6 +467,9 @@ export async function prepareHandsMount(input) {
|
|
|
451
467
|
runReadFloor,
|
|
452
468
|
shellReadLandings: shellReadStation?.landings,
|
|
453
469
|
readAdmission: fileReadStation?.admitted,
|
|
470
|
+
readBlock,
|
|
471
|
+
readBlockJudge,
|
|
472
|
+
outsideReadRemedy,
|
|
454
473
|
resolvedReadFace,
|
|
455
474
|
resolvedWriteFace,
|
|
456
475
|
handsLessResolvedWriteFace,
|
|
@@ -67,6 +67,8 @@ export interface PrepareInheritedGateInput {
|
|
|
67
67
|
/** borrowed-readonly — the command sandbox requirement this run runs under (a resumed leg's: the parked one as a floor under the
|
|
68
68
|
* stated one): the floor the children's seat carries, so a child never runs looser than the leg that spawns it. */
|
|
69
69
|
commandSandboxRequirement: import("../command-sandbox.js").TaskSandboxSettings | undefined;
|
|
70
|
+
/** borrowed-readonly — the leg's declared places (the driver's one mint): the children's clamp source carries the part a task layer declared. */
|
|
71
|
+
callerPlaces: import("./leg-caller-places.js").LegCallerPlaces;
|
|
70
72
|
/** borrowed-readonly — this leg's checkpoint scope (the driver's one `checkpointScopeOf` derivation): the ctx's `checkpointScopeForChildren`, which every delegation lane copies into its children's internals. */
|
|
71
73
|
checkpointScope: string;
|
|
72
74
|
/** borrowed-readonly — the leg's registry scope (`taskScope`): the scope its own session box mounts in, which a root leg hands
|
|
@@ -226,6 +228,9 @@ export interface PrepareInheritedGateInput {
|
|
|
226
228
|
handsLessResolvedFace: () => ContainmentFace | undefined;
|
|
227
229
|
/** borrowed-readonly — LATE-BOUND: the hands-less legs' resolved WRITE face (same second source, write seat). */
|
|
228
230
|
handsLessResolvedWriteFace: () => WriteFaceSeat | undefined;
|
|
231
|
+
/** borrowed-readonly — LATE-BOUND: the leg's resolved `blockReadsOutsideRoots` (the hands phase's one answer, on either
|
|
232
|
+
* branch: the declaration, or the resumed row's record of it) — what the children's clamp takes, never the spec's word. */
|
|
233
|
+
readBlock: () => boolean;
|
|
229
234
|
/** borrowed-readonly — LATE-BOUND: the adopted center artifact (ctx `centerArtifactDigest` / `centerSourceRevision`). */
|
|
230
235
|
centerAdoption: () => {
|
|
231
236
|
artifact: PromptArtifact;
|
|
@@ -179,7 +179,9 @@ export function prepareInheritedGate(input) {
|
|
|
179
179
|
...clampSourceOf(spec, "clamp"),
|
|
180
180
|
readFace: carrierReadFace(),
|
|
181
181
|
writeFace: carrierWriteFace(),
|
|
182
|
+
blockReadsOutsideRoots: input.readBlock() ? true : undefined,
|
|
182
183
|
readDenyPatterns: input.readDenyAdditionsNormalized(),
|
|
184
|
+
agentConfigDirs: input.callerPlaces.configRoots.carried, agentHomeDirs: input.callerPlaces.homes.carried,
|
|
183
185
|
approvalReach: askSeat.reach,
|
|
184
186
|
durableApproval: input.hostApprovalParksNotResumable ? false : undefined,
|
|
185
187
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BeforeWriteHook, EffectiveMemoryScopes, RunnerDeps, TaskSpec, ToolSpec } from "../types.js";
|
|
2
2
|
import { type CaptureEntitlementInput, type MemoryCapturePosture } from "./memory-capture-optout.js";
|
|
3
3
|
import { type SessionProjectVerdict } from "../memory-engine/scope-contract.js";
|
|
4
|
-
import type { Prepared } from "./contracts.js";
|
|
4
|
+
import type { DateAnchorRead, MemoryTailSnapshot, Prepared } from "./contracts.js";
|
|
5
5
|
import type { AdvertisedWritableDirs } from "./advertised-writable-dirs.js";
|
|
6
6
|
export interface PrepareMemoryInput {
|
|
7
7
|
/** borrowed-readonly — the REBOUND spec. Read: `memory` (the scope declaration this phase
|
|
@@ -206,6 +206,11 @@ export interface MemoryInjectionComposition {
|
|
|
206
206
|
* session-scope coda in its own reminder when one is owed): an EVENT, so it never enters `memoryBlock` (the cached
|
|
207
207
|
* prefix) — the leg's first request carries it once, ahead of the user's message. Absent when nothing was drained. */
|
|
208
208
|
noticesFrame?: string;
|
|
209
|
+
/** The name of the store content this leg read live when it is not the one the segment's anchor names — what the settle
|
|
210
|
+
* lane anchors (`Prepared.prefixAnchor.memory`). Absent when the band was served from the process's copy or the live
|
|
211
|
+
* read is the content the anchor names, when the branch was unreadable, when the store state could not be read,
|
|
212
|
+
* when the index is over the cap, and when no memory session mounted. */
|
|
213
|
+
memoryTailOwed?: MemoryTailSnapshot;
|
|
209
214
|
}
|
|
210
215
|
export interface PrepareMemoryResult {
|
|
211
216
|
memoryEngineSession: Prepared["memoryEngineSession"];
|
|
@@ -220,12 +225,15 @@ export interface PrepareMemoryResult {
|
|
|
220
225
|
* so a hands-phase refusal cannot consume announcements a later prepare should deliver, and it takes the
|
|
221
226
|
* roster-wide persistence verdict the driver can only read off the MOUNTED roster (`rosterCanPersist`: the
|
|
222
227
|
* `memoryPersistenceCapable` declaration when set, else the store-path inference over the assembled tools) and
|
|
223
|
-
* `isSubagent` (a non-fork delegated child — no user conversation, no not-mounted notice)
|
|
228
|
+
* `isSubagent` (a non-fork delegated child — no user conversation, no not-mounted notice), and `anchor` — the
|
|
229
|
+
* session's epoch anchor as prepare read it (undefined ⇔ the branch was unreadable): the band's store content comes
|
|
230
|
+
* from its memory half when that was read under this mount. Call once per prepare;
|
|
224
231
|
* async because the drain goes through the engine's governance store.
|
|
225
232
|
*/
|
|
226
233
|
composeInjection: (facts: {
|
|
227
234
|
rosterCanPersist: boolean;
|
|
228
235
|
isSubagent: boolean;
|
|
236
|
+
anchor: DateAnchorRead | undefined;
|
|
229
237
|
}) => Promise<MemoryInjectionComposition>;
|
|
230
238
|
/**
|
|
231
239
|
* The FROZEN org-admission verdict of this prepare: every org scope the task actually mounts
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { isAbsolute, resolve, sep } from "node:path";
|
|
2
3
|
import { deliverEngineNotice } from "../types.js";
|
|
3
4
|
import { admitMemoryScopes } from "../memory-admission.js";
|
|
@@ -14,11 +15,23 @@ import { sessionIncarnationResolver } from "../memory-engine/session-incarnation
|
|
|
14
15
|
import { createMemoryEngineTools } from "../memory-engine/tools.js";
|
|
15
16
|
import { assertScopeContractPlacement, parseScopeKey } from "../memory-engine/scope-contract.js";
|
|
16
17
|
import { writableRootOf } from "../memory-engine/types.js";
|
|
18
|
+
import { MEMORY_TAIL_MAX_CHARS } from "./conversation-segment.js";
|
|
19
|
+
import { indexCopyOf, keepIndexCopy } from "../memory-engine/index-copies.js";
|
|
17
20
|
import { asThrownError, thrownText } from "../thrown-value.js";
|
|
18
21
|
function heldCapturePlane(engine, backend) {
|
|
19
22
|
const carrier = backend.governance;
|
|
20
23
|
return { engine, fileCarried: carrier === undefined || governanceStoreIsFileOver(carrier, engine.controlPlaneRoot) };
|
|
21
24
|
}
|
|
25
|
+
function memoryTailKeyOf(planes) {
|
|
26
|
+
const parts = [];
|
|
27
|
+
for (const [plane, h] of planes) {
|
|
28
|
+
const state = h.storeState;
|
|
29
|
+
if (state === undefined || state === "unreadable")
|
|
30
|
+
return undefined;
|
|
31
|
+
parts.push([plane, h.memoryDir, h.scopes, h.writeScope, h.indexOnDiskUntrusted === true, h.adoptionRestricted === true, state.challenged, state.erasures]);
|
|
32
|
+
}
|
|
33
|
+
return createHash("sha256").update(JSON.stringify(parts), "utf8").digest("hex").slice(0, 16);
|
|
34
|
+
}
|
|
22
35
|
async function readAncestorCaptureOptOut(ancestorDir, ancestorId, held, hostStore) {
|
|
23
36
|
const plane = held.find((p) => resolve(p.engine.controlPlaneRoot) === resolve(ancestorDir));
|
|
24
37
|
if (plane !== undefined) {
|
|
@@ -104,6 +117,7 @@ export async function prepareMemory(input) {
|
|
|
104
117
|
let memoryTools;
|
|
105
118
|
let writeChannelOpen = false;
|
|
106
119
|
let memoryMarkedEntriesServed = false;
|
|
120
|
+
let memoryTailPlanes;
|
|
107
121
|
let effectiveMemoryScopes;
|
|
108
122
|
const originOf = (scope) => scopeOriginsSnapshot !== undefined
|
|
109
123
|
? scopeOriginsSnapshot[scope] === "deployment"
|
|
@@ -419,7 +433,12 @@ export async function prepareMemory(input) {
|
|
|
419
433
|
writeHandle = writeIsPersonal ? personalHandle : projectHandle;
|
|
420
434
|
readOnlyEngine = writeIsPersonal ? projectEngine : personalEngine;
|
|
421
435
|
readOnlyHandle = writeIsPersonal ? projectHandle : personalHandle;
|
|
422
|
-
injectFn = async () =>
|
|
436
|
+
injectFn = async (frozen) => {
|
|
437
|
+
const project = await projectEngine.inject(projectHandle, { writeToolMounted: writeChannelOpen, reminderMark: input.reminderMark, ...(frozen?.project !== undefined ? { frozenIndex: frozen.project } : {}) });
|
|
438
|
+
const personal = await personalEngine.inject(personalHandle, { writeToolMounted: writeChannelOpen, reminderMark: input.reminderMark, ...(frozen?.personal !== undefined ? { frozenIndex: frozen.personal } : {}) });
|
|
439
|
+
return { injection: mergeInjections(project, personal), served: { project: project.indexText ?? "", personal: personal.indexText ?? "" } };
|
|
440
|
+
};
|
|
441
|
+
memoryTailPlanes = [["project", projectHandle], ["personal", personalHandle]];
|
|
423
442
|
toolPlanes = [
|
|
424
443
|
{
|
|
425
444
|
backend: retrievalBackend(backend, adoptionRestricted || captureOptedOut || captureIndeterminate || p.writePlane !== "project"),
|
|
@@ -467,7 +486,11 @@ export async function prepareMemory(input) {
|
|
|
467
486
|
memoryMarkedEntriesServed = handle.markedEntriesPresent === true;
|
|
468
487
|
writeEngine = personalEngine;
|
|
469
488
|
writeHandle = handle;
|
|
470
|
-
injectFn = () =>
|
|
489
|
+
injectFn = async (frozen) => {
|
|
490
|
+
const injection = await personalEngine.inject(handle, { writeToolMounted: writeChannelOpen, reminderMark: input.reminderMark, ...(frozen?.personal !== undefined ? { frozenIndex: frozen.personal } : {}) });
|
|
491
|
+
return { injection, served: { personal: injection.indexText ?? "" } };
|
|
492
|
+
};
|
|
493
|
+
memoryTailPlanes = [["personal", handle]];
|
|
471
494
|
harvestBoth = async (phase) => personalEngine.harvest(handle, { ...(await pollutedOpts(personalEngine)), sessionId, ...(await admitNothingOptsNow()), phase });
|
|
472
495
|
toolPlanes = [
|
|
473
496
|
{
|
|
@@ -498,7 +521,11 @@ export async function prepareMemory(input) {
|
|
|
498
521
|
memoryMarkedEntriesServed = handle.markedEntriesPresent === true;
|
|
499
522
|
writeEngine = engine;
|
|
500
523
|
writeHandle = handle;
|
|
501
|
-
injectFn = () =>
|
|
524
|
+
injectFn = async (frozen) => {
|
|
525
|
+
const injection = await engine.inject(handle, { writeToolMounted: writeChannelOpen, reminderMark: input.reminderMark, ...(frozen?.project !== undefined ? { frozenIndex: frozen.project } : {}) });
|
|
526
|
+
return { injection, served: { project: injection.indexText ?? "" } };
|
|
527
|
+
};
|
|
528
|
+
memoryTailPlanes = [["project", handle]];
|
|
502
529
|
harvestBoth = async (phase) => engine.harvest(handle, { ...(await pollutedOpts(engine)), sessionId, ...(await admitNothingOptsNow()), phase });
|
|
503
530
|
toolPlanes = [
|
|
504
531
|
{
|
|
@@ -813,8 +840,26 @@ export async function prepareMemory(input) {
|
|
|
813
840
|
let seedFiles;
|
|
814
841
|
let recallDisciplineSegment;
|
|
815
842
|
let noticesFrame;
|
|
843
|
+
let memoryTailOwed;
|
|
816
844
|
if (memoryEngineSession) {
|
|
817
|
-
const
|
|
845
|
+
const tailKey = memoryTailPlanes !== undefined ? memoryTailKeyOf(memoryTailPlanes) : undefined;
|
|
846
|
+
const anchored = tailKey !== undefined && facts.anchor?.memory?.mount === tailKey ? facts.anchor.memory : undefined;
|
|
847
|
+
const frozen = anchored !== undefined ? indexCopyOf(anchored.mount, anchored.digest) : undefined;
|
|
848
|
+
const rebuilt = memoryTailPlanes !== undefined ? Object.fromEntries(memoryTailPlanes.map(([plane, h]) => [plane, h.indexText])) : undefined;
|
|
849
|
+
const { injection, served } = await memoryEngineSession.inject(frozen?.planes ?? rebuilt);
|
|
850
|
+
const markedServed = frozen?.marked ?? memoryMarkedEntriesServed;
|
|
851
|
+
if (memoryTailPlanes !== undefined && tailKey === undefined)
|
|
852
|
+
deps.onError?.(new Error("the memory store's state (the entries it withholds, the erasures it ran) could not be read, or its erasure count read lower than this process read it before (the account removed or rolled back: restart the process); the memory band is read live on every leg until it can, so a write to the store moves the prompt prefix on the next leg"), { phase: "memory", sessionId });
|
|
853
|
+
if (frozen === undefined && facts.anchor !== undefined && tailKey !== undefined) {
|
|
854
|
+
const chars = Object.values(served).reduce((n, text) => n + (text?.length ?? 0), 0);
|
|
855
|
+
if (chars <= MEMORY_TAIL_MAX_CHARS) {
|
|
856
|
+
const digest = keepIndexCopy(tailKey, { planes: served, marked: markedServed }, memoryTailPlanes.map(([, h]) => h));
|
|
857
|
+
if (anchored?.digest !== digest)
|
|
858
|
+
memoryTailOwed = { mount: tailKey, digest };
|
|
859
|
+
}
|
|
860
|
+
else
|
|
861
|
+
deps.onError?.(new Error(`the memory index is ${chars} characters, over the ${MEMORY_TAIL_MAX_CHARS} a conversation segment freezes; it is read live on every leg, so a write to it moves the prompt prefix on the next leg`), { phase: "memory", sessionId });
|
|
862
|
+
}
|
|
818
863
|
let blockBody = injection.block;
|
|
819
864
|
if (captureOptedOut) {
|
|
820
865
|
blockBody = [MEMORY_CAPTURE_OPTOUT_NOTICE, injection.index].filter((s) => Boolean(s && s.trim())).join("\n\n");
|
|
@@ -838,7 +883,7 @@ export async function prepareMemory(input) {
|
|
|
838
883
|
if (blockBody.trim())
|
|
839
884
|
memoryBlock = blockBody;
|
|
840
885
|
if (memoryTools !== undefined) {
|
|
841
|
-
recallDisciplineSegment = memoryRecallDisciplineSegment(input.memoryProvenance, { markedEntriesServed:
|
|
886
|
+
recallDisciplineSegment = memoryRecallDisciplineSegment(input.memoryProvenance, { markedEntriesServed: markedServed });
|
|
842
887
|
memoryBlock = memoryBlock !== undefined ? `${memoryBlock}\n\n${recallDisciplineSegment}` : recallDisciplineSegment;
|
|
843
888
|
}
|
|
844
889
|
if (memoryEngineSession.handle.writeScope !== null && writeChannelOpen && facts.rosterCanPersist && !captureOptedOut && !captureIndeterminate) {
|
|
@@ -859,6 +904,7 @@ export async function prepareMemory(input) {
|
|
|
859
904
|
...(recallDisciplineSegment !== undefined ? { recallDisciplineSegment } : {}),
|
|
860
905
|
...(seedFiles !== undefined ? { seedFiles } : {}),
|
|
861
906
|
...(noticesFrame !== undefined ? { noticesFrame } : {}),
|
|
907
|
+
...(memoryTailOwed !== undefined ? { memoryTailOwed } : {}),
|
|
862
908
|
};
|
|
863
909
|
};
|
|
864
910
|
if (effectiveMemoryScopes === undefined) {
|
|
@@ -134,6 +134,9 @@ export interface PreparePolicyChainInput {
|
|
|
134
134
|
handsCwdRef: CwdRef | undefined;
|
|
135
135
|
/** borrowed-readonly — the compiled read-deny judge, or undefined (the offer factory's directory negative control). */
|
|
136
136
|
readDenyMatcher: ReadDenyMatcher | undefined;
|
|
137
|
+
/** borrowed-readonly — the file read station a leg that refuses reads outside its directories mounts as a refusal, on the run's
|
|
138
|
+
* newest tables; absent elsewhere. Judged ahead of every inherited question about a call (`readBoundaryRefusalOver`). */
|
|
139
|
+
readBlockJudge: import("../../tools/fs/shell-read-check.js").ShellReadCheck | undefined;
|
|
137
140
|
/** borrowed-readonly — the run's one reader of the person's rules (`person-path-rows.ts`): the lanes take each call's
|
|
138
141
|
* pinned read from it. */
|
|
139
142
|
personRows: import("./person-path-rows.js").PersonPathRows;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { argsAsTheToolReads, withArgsReading } from "../effective-path-target.js";
|
|
2
|
+
import { readBoundaryRefusalOver } from "./read-block-judge.js";
|
|
2
3
|
import { outletAsk, readRejudge, rewriteChasedSentence, sameBytes } from "../rewrite-rejudge.js";
|
|
3
4
|
import { policyAskClassOf } from "../ask-class.js";
|
|
4
5
|
import { ASK_USER_QUESTION_TOOL_NAME, isEngineQuestionFace } from "../ask-question.js";
|
|
@@ -43,7 +44,7 @@ import { heldBy, heldValues, seatOf, wireOf } from "../tool-name-readings.js";
|
|
|
43
44
|
import { hostFloorPolicy } from "../host-floor.js";
|
|
44
45
|
import { leavesByEscape } from "../command-sandbox.js";
|
|
45
46
|
export async function preparePolicyChain(input) {
|
|
46
|
-
const { spec, deps, sessionId, runId, hostTaskId, approvalWords, engineText, taskRootFinal, additionalRootsCanonical, writeLocation, executionEnv, lockedPreflight, pathRuleAnchors, headLeads, tools, harnessTools, selector, toolEffects, egressTools, irreversibilityTier, axisExplicitNegatives, shellGatedTools, toolMarkSources, envHandToolNames, handsCwdRef, readDenyMatcher, personRows, questionToolMounted, runtimeCaps, approvalParkNotResumable, notResumableSays, forcedGateNotResumable, inheritedAncestorRules, ancestorSessionRulesRef, inheritedParentConstraints, seedInheritedGate, skillGrants, skillSpecs, allowedToolTables, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, modBus, ownModChain, autoModeDecider, whileHeld, readFace, permissionMode, autoStripNotice, toolRosterDeltas, stopForDenialLimit, askSource, abortController, now, ownSessionRulesRef, hostFloor, commandSandboxSideOf, sandboxPlanOf } = input;
|
|
47
|
+
const { spec, deps, sessionId, runId, hostTaskId, approvalWords, engineText, taskRootFinal, additionalRootsCanonical, writeLocation, executionEnv, lockedPreflight, pathRuleAnchors, headLeads, tools, harnessTools, selector, toolEffects, egressTools, irreversibilityTier, axisExplicitNegatives, shellGatedTools, toolMarkSources, envHandToolNames, handsCwdRef, readDenyMatcher, readBlockJudge, personRows, questionToolMounted, runtimeCaps, approvalParkNotResumable, notResumableSays, forcedGateNotResumable, inheritedAncestorRules, ancestorSessionRulesRef, inheritedParentConstraints, seedInheritedGate, skillGrants, skillSpecs, allowedToolTables, frozenOnAsk, hookEnvSource, notifyOwnHookCrash, modBus, ownModChain, autoModeDecider, whileHeld, readFace, permissionMode, autoStripNotice, toolRosterDeltas, stopForDenialLimit, askSource, abortController, now, ownSessionRulesRef, hostFloor, commandSandboxSideOf, sandboxPlanOf } = input;
|
|
47
48
|
const ancestorArbitrations = new Map();
|
|
48
49
|
const judgeHeld = (opts) => judgeInheritedClassifier({ ...opts, autoMode: opts.autoMode === undefined ? undefined : { ...opts.autoMode, decider: heldWhileClassifying(opts.autoMode.decider, (toolCallId, judge) => whileHeld(toolCallId, "classifier", judge)) } });
|
|
49
50
|
const heldApprover = (onAsk) => wrapApprover(onAsk, (inner) => (req, signal) => whileHeld(req.toolCallId, "approval", () => inner(req, signal)));
|
|
@@ -375,6 +376,7 @@ export async function preparePolicyChain(input) {
|
|
|
375
376
|
cwdRef: handsCwdRef,
|
|
376
377
|
deniesDirectoryRead: readDenyMatcher !== undefined ? (d) => readDenyMatcher.matchPath(d) !== null : undefined,
|
|
377
378
|
});
|
|
379
|
+
const readBoundaryRefusalOf = readBoundaryRefusalOver({ judge: readBlockJudge, cwd: () => handsCwdRef?.current, signal: abortController.signal });
|
|
378
380
|
const recheckApprovedEdit = async (pol, onAskOf, creq, edit, approved, csignal, ancestorAutoMode) => {
|
|
379
381
|
const ancestorDecider = ancestorAutoMode?.decider;
|
|
380
382
|
const ancestorTracker = ancestorAutoMode?.denialTracking;
|
|
@@ -411,6 +413,9 @@ export async function preparePolicyChain(input) {
|
|
|
411
413
|
else if (re.action === "allow") {
|
|
412
414
|
return onApproval(withAttestation({ action: "allow", updatedInput: editArgs, decisionReason: "mode" }, re.attestation));
|
|
413
415
|
}
|
|
416
|
+
const readRefused = await readBoundaryRefusalOf(creq, editArgs, csignal);
|
|
417
|
+
if (readRefused !== undefined)
|
|
418
|
+
return vetoed(readRefused);
|
|
414
419
|
const judged = await judgeHeld({ liveMode: () => permissionMode.current, autoMode: read.kind === "rewritten" ? undefined : ancestorAutoMode, ask: re, req: withArgsBinding(creq, editArgs), signal: csignal ?? abortController.signal, subject: "the approved edit", allowRewrite: editArgs, facts: inheritedStationFacts(creq, editArgs), unavailableSeat: classifierUnavailableSeat({ station: "ancestor", ...(ancestorDecider?.timeoutMs !== undefined ? { budgetMs: ancestorDecider.timeoutMs } : {}), route: frozenApproverRoute(onAskOf), onNotice: deps.onNotice, sessionId, runId }) });
|
|
415
420
|
if (judged.kind === "allow") {
|
|
416
421
|
return onApproval(judged.result);
|
|
@@ -457,6 +462,10 @@ export async function preparePolicyChain(input) {
|
|
|
457
462
|
};
|
|
458
463
|
const settleInstallationAsk = async (pc, decision, creq, csignal) => {
|
|
459
464
|
const settledAs = (result) => ({ kind: "settled", result });
|
|
465
|
+
const presentedArgs = decision.updatedInput !== undefined ? argsAsTheToolReads(creq, decision.updatedInput) : creq.args;
|
|
466
|
+
const readRefused = await readBoundaryRefusalOf(creq, presentedArgs, csignal);
|
|
467
|
+
if (readRefused !== undefined)
|
|
468
|
+
return settledAs(readRefused);
|
|
460
469
|
if (isDelegatedQuestion(creq)) {
|
|
461
470
|
if (pc.contentMandate !== true || markInheritedUnavailable(pc, creq, stationMarkOf(decision, creq)))
|
|
462
471
|
return settledAs(decision);
|
|
@@ -471,7 +480,6 @@ export async function preparePolicyChain(input) {
|
|
|
471
480
|
return settledAs(decision);
|
|
472
481
|
return settledAs(mandateUnreconstructibleDeny(creq));
|
|
473
482
|
}
|
|
474
|
-
const presentedArgs = decision.updatedInput !== undefined ? argsAsTheToolReads(creq, decision.updatedInput) : creq.args;
|
|
475
483
|
const judged = await judgeHeld({ liveMode: () => permissionMode.current, autoMode: pc.autoMode, ask: decision, req: withArgsBinding(creq, presentedArgs), signal: csignal ?? abortController.signal, subject: "this call", allowRewrite: decision.updatedInput, facts: inheritedStationFacts(creq, presentedArgs), unavailableSeat: classifierUnavailableSeat({ station: "ancestor", ...(pc.autoMode?.decider.timeoutMs !== undefined ? { budgetMs: pc.autoMode.decider.timeoutMs } : {}), route: frozenApproverRoute(pc.onAsk), onNotice: deps.onNotice, sessionId, runId }) });
|
|
476
484
|
if (judged.kind === "allow")
|
|
477
485
|
return settledAs(judged.result);
|
|
@@ -547,6 +555,9 @@ export async function preparePolicyChain(input) {
|
|
|
547
555
|
return first;
|
|
548
556
|
if (first.action === "allow")
|
|
549
557
|
return { action: "allow" };
|
|
558
|
+
const readRefused = await readBoundaryRefusalOf(creq, creq.args, csignal);
|
|
559
|
+
if (readRefused !== undefined)
|
|
560
|
+
return readRefused;
|
|
550
561
|
if (isDelegatedQuestion(creq)) {
|
|
551
562
|
if (pc.contentMandate !== true || markInheritedUnavailable(pc, creq, stationMarkOf(first, creq, creq.args)))
|
|
552
563
|
return first;
|
|
@@ -11,11 +11,13 @@ import { type LegModBus } from "../mods/stations.js";
|
|
|
11
11
|
import { type StoredSession } from "../session.js";
|
|
12
12
|
import type { RunnerDeps } from "../types.js";
|
|
13
13
|
import type { AnnounceOnceSink, Prepared, PrepareResume, PromptFeatureFlags, RunInternals } from "./contracts.js";
|
|
14
|
+
import { type PromptHashSalt } from "./session-hash-salt.js";
|
|
14
15
|
export interface PreparePromptAssemblyInput {
|
|
15
16
|
/** borrowed-mutable — the acquired session. Read: `getPromptEpoch` (the stored record), `getBranch` (the freshness
|
|
16
17
|
* discriminator on the record-less arms). Writer here: `appendPromptEpoch`, the ONE record write of this leg (only
|
|
17
|
-
* when the run's identity differs from the stored record's)
|
|
18
|
-
|
|
18
|
+
* when the run's identity differs from the stored record's) and, before the assembly, `appendCustomEntry` — the session's
|
|
19
|
+
* hash salt when the session holds none yet (`./session-hash-salt.ts`). The acquire phase and the run loop write it elsewhere. */
|
|
20
|
+
session: Pick<StoredSession, "getPromptEpoch" | "getBranch" | "appendPromptEpoch" | "appendCustomEntry">;
|
|
19
21
|
/** borrowed-readonly — the deployment seats: `promptSource` (the center artifact source, its candidate and its
|
|
20
22
|
* tri-state), `onError` (the assembly's warn channel). Receiver preserved. */
|
|
21
23
|
deps: Pick<RunnerDeps, "promptSource" | "onError">;
|
|
@@ -57,6 +59,9 @@ export interface PreparePromptAssemblyInput {
|
|
|
57
59
|
envFacts: EnvironmentFacts;
|
|
58
60
|
/** borrowed-readonly — the run's effective prompt traits (a selector value of the assembly). */
|
|
59
61
|
promptTraits: ReadonlySet<PromptTraitName>;
|
|
62
|
+
/** borrowed-readonly — the leg announces a non-empty skills listing (`Prepared.skillsListing` with entries): exactly when the
|
|
63
|
+
* engine's own Skill tool is mounted, never for a caller tool that only shares the name. The `skillToolMounted` fact. */
|
|
64
|
+
skillsAnnounced: boolean;
|
|
60
65
|
/** borrowed-readonly — the run's ONE tool roster, read only: the assembly receives DETACHED copies, the audit and the
|
|
61
66
|
* manifest read it in place. Never mutated here. */
|
|
62
67
|
tools: readonly AgentTool[];
|
|
@@ -81,8 +86,8 @@ export interface PreparePromptAssemblyResult {
|
|
|
81
86
|
* layout groups). */
|
|
82
87
|
systemBlocks: AssembledPrompt["systemBlocks"];
|
|
83
88
|
/** borrowed-mutable — the composition manifest (`Prepared.promptManifest`). Writers after this phase: the tool-disclosure
|
|
84
|
-
* phase writes `toolDisclosure` (when deferred tools exist
|
|
85
|
-
* once the final wire tool list exists. */
|
|
89
|
+
* phase writes `toolDisclosure` and appends the search tool's row to `tools` (when deferred tools exist — the tool is built
|
|
90
|
+
* there, after this projection); the turn-wiring phase backfills `snapshot` and `lowering` once the final wire tool list exists. */
|
|
86
91
|
promptManifest: Prepared["promptManifest"];
|
|
87
92
|
/** owned — the run's identity inputs and the pinned center layer's provenance (`Prepared.promptIdentity`; the
|
|
88
93
|
* compaction-boundary candidate replaces it after a committed center change). */
|
|
@@ -108,6 +113,9 @@ export interface PreparePromptAssemblyResult {
|
|
|
108
113
|
* unsalted, because the anchor compares across processes, and written only into the session's own store —
|
|
109
114
|
* never onto a trace (the trace's block hashes are the salted ones). */
|
|
110
115
|
prefixHeadBlocks: Readonly<Record<string, string>>;
|
|
116
|
+
/** owned — the session's hash salt and how far digests under it compare: the manifest's salted digests here, the turn
|
|
117
|
+
* snapshot's prompt digests and each request's head (the session's prefix ledger) are taken under it. Never on a trace. */
|
|
118
|
+
promptHashSalt: PromptHashSalt;
|
|
111
119
|
}
|
|
112
120
|
/** The M13 phase body — prepareTask's prompt-assembly stretch (see the module header). */
|
|
113
121
|
export declare function preparePromptAssembly(input: PreparePromptAssemblyInput): Promise<PreparePromptAssemblyResult>;
|