@sema-agent/core 7.69.1 → 7.70.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 +2477 -0
- package/dist/agents/agent-definition.d.ts +18 -0
- package/dist/agents/agent-definition.js +10 -0
- package/dist/agents/agent-transcript-tool.d.ts +2 -1
- package/dist/agents/agent-transcript-tool.js +2 -0
- package/dist/agents/cascade.d.ts +10 -0
- package/dist/agents/cascade.js +33 -5
- package/dist/agents/cc-peer-directory.d.ts +1 -1
- package/dist/agents/cc-peer-directory.js +2 -1
- package/dist/agents/child-model-seat.d.ts +1 -1
- package/dist/agents/composition-allowance.d.ts +63 -19
- package/dist/agents/composition-allowance.js +62 -45
- package/dist/agents/composition-placement.d.ts +22 -4
- package/dist/agents/composition-placement.js +10 -1
- package/dist/agents/cross-session-envelope.d.ts +4 -5
- package/dist/agents/cross-session-envelope.js +4 -5
- package/dist/agents/inherited-tool-pool.js +1 -2
- package/dist/agents/list-agents-tool.js +2 -1
- package/dist/agents/parked-resume-drive.d.ts +38 -0
- package/dist/agents/parked-resume-drive.js +57 -0
- package/dist/agents/peer-admission.js +4 -3
- package/dist/agents/peer-held-queue.d.ts +4 -2
- package/dist/agents/peer-held-queue.js +2 -1
- package/dist/agents/peer-session-drain.d.ts +2 -0
- package/dist/agents/peer-session-drain.js +49 -29
- package/dist/agents/repair-loop.js +15 -11
- package/dist/agents/retain-ledger.d.ts +71 -18
- package/dist/agents/retain-ledger.js +45 -13
- package/dist/agents/roster-store.d.ts +11 -3
- package/dist/agents/roster-store.js +6 -2
- package/dist/agents/send-message-tool.d.ts +2 -1
- package/dist/agents/send-message-tool.js +10 -7
- package/dist/agents/subagent.d.ts +24 -7
- package/dist/agents/subagent.js +256 -144
- package/dist/agents/tool-filter.js +1 -1
- package/dist/agents/verify.d.ts +4 -1
- package/dist/agents/verify.js +22 -16
- package/dist/agents/yield-adoption.js +2 -1
- package/dist/bench/metrics.js +2 -2
- package/dist/brain/anthropic.d.ts +2 -1
- package/dist/brain/anthropic.js +3 -3
- package/dist/brain/circuit-breaker.js +1 -1
- package/dist/brain/model-lane.d.ts +2 -1
- package/dist/brain/model-lane.js +22 -9
- package/dist/brain/open-responses.d.ts +77 -1
- package/dist/brain/open-responses.js +1 -1
- package/dist/brain/openai.d.ts +2 -1
- package/dist/brain/openai.js +3 -3
- package/dist/brain/reasoning.d.ts +8 -1
- package/dist/brain/reasoning.js +3 -0
- package/dist/brain/reference-model-traits.d.ts +13 -12
- package/dist/brain/reference-model-traits.js +11 -10
- package/dist/brain/request-route.d.ts +1 -1
- package/dist/brain/request-route.js +2 -2
- package/dist/brain/route-adjudicator.d.ts +72 -2
- package/dist/brain/route-adjudicator.js +210 -69
- package/dist/brain/route-conformance.js +35 -0
- package/dist/brain/routing.js +2 -2
- package/dist/brain/spend-meter.d.ts +56 -0
- package/dist/brain/spend-meter.js +263 -0
- package/dist/brain/stream-shared.d.ts +1 -1
- package/dist/brain/stream-shared.js +3 -1
- package/dist/core/a2a-bound-grant.d.ts +110 -0
- package/dist/core/a2a-bound-grant.js +83 -0
- package/dist/core/a2a-task-state.d.ts +153 -51
- package/dist/core/a2a-task-state.js +85 -45
- package/dist/core/a2a.d.ts +62 -14
- package/dist/core/a2a.js +298 -57
- package/dist/core/agent-config-dir.d.ts +53 -6
- package/dist/core/agent-config-dir.js +59 -6
- package/dist/core/agent-definition.d.ts +1 -1
- package/dist/core/agent-state.d.ts +10 -1
- package/dist/core/agent-state.js +11 -4
- package/dist/core/allow-entry.d.ts +80 -42
- package/dist/core/allow-entry.js +119 -61
- package/dist/core/allow-rule-shadow.d.ts +25 -3
- package/dist/core/allow-rule-shadow.js +7 -0
- package/dist/core/approval-object.js +2 -2
- package/dist/core/artifact-host.d.ts +109 -6
- package/dist/core/artifact-host.js +68 -0
- package/dist/core/ask-headline.d.ts +10 -9
- package/dist/core/ask-headline.js +9 -3
- package/dist/core/ask-origin.d.ts +88 -28
- package/dist/core/ask-origin.js +73 -43
- package/dist/core/ask-question.d.ts +76 -38
- package/dist/core/ask-question.js +151 -22
- package/dist/core/ask-unresolvable-notice.d.ts +66 -10
- package/dist/core/ask-unresolvable-notice.js +38 -14
- package/dist/core/auto-compaction.d.ts +3 -49
- package/dist/core/auto-compaction.js +3 -8
- package/dist/core/auto-mode-directive.d.ts +17 -5
- package/dist/core/auto-mode-directive.js +12 -3
- package/dist/core/auto-mode.d.ts +34 -5
- package/dist/core/auto-mode.js +43 -5
- package/dist/core/background-agent-store.d.ts +100 -11
- package/dist/core/background-agent-store.js +64 -6
- package/dist/core/background-shell.d.ts +9 -0
- package/dist/core/background-shell.js +10 -0
- package/dist/core/caller-text.d.ts +2 -2
- package/dist/core/caller-tool-name.d.ts +6 -0
- package/dist/core/caller-tool-name.js +2 -1
- package/dist/core/checkpoint-features.d.ts +38 -422
- package/dist/core/checkpoint-features.js +44 -0
- package/dist/core/checkpoint-queries.d.ts +14 -3
- package/dist/core/checkpoint-queries.js +9 -4
- package/dist/core/checkpoint-requirements.d.ts +69 -2
- package/dist/core/checkpoint-requirements.js +12 -2
- package/dist/core/checkpoint-row-verdict.d.ts +70 -17
- package/dist/core/checkpoint-row-verdict.js +75 -29
- package/dist/core/checkpoint-store.d.ts +75 -69
- package/dist/core/checkpoint-store.js +24 -22
- package/dist/core/classifier-unavailable-arm.d.ts +6 -1
- package/dist/core/classifier-unavailable-arm.js +8 -5
- package/dist/core/config-refusal-codes.d.ts +7 -5
- package/dist/core/config-refusal-codes.js +7 -2
- package/dist/core/config-refusal-input.d.ts +46 -0
- package/dist/core/config-refusal-input.js +62 -0
- package/dist/core/context-edit.d.ts +18 -1
- package/dist/core/context-edit.js +13 -2
- package/dist/core/context-guard.d.ts +60 -13
- package/dist/core/context-guard.js +77 -35
- package/dist/core/context-settings.d.ts +2 -1
- package/dist/core/context-settings.js +10 -6
- package/dist/core/corrupt-session-form.d.ts +97 -0
- package/dist/core/corrupt-session-form.js +54 -0
- package/dist/core/cross-boundary-taint.d.ts +3 -3
- package/dist/core/data-root.d.ts +32 -0
- package/dist/core/data-root.js +86 -0
- package/dist/core/decision-receipt.d.ts +2 -0
- package/dist/core/decision-receipt.js +3 -2
- package/dist/core/declaration-words.d.ts +37 -0
- package/dist/core/declaration-words.js +21 -0
- package/dist/core/delegation-frames.d.ts +76 -35
- package/dist/core/delegation-frames.js +21 -1
- package/dist/core/durable-sync.d.ts +9 -0
- package/dist/core/durable-sync.js +37 -0
- package/dist/core/engine-capabilities.d.ts +110 -3
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +259 -139
- package/dist/core/engine-notice.js +13 -19
- package/dist/core/engine-version.js +1 -1
- package/dist/core/entries-not-applied.d.ts +22 -0
- package/dist/core/entries-not-applied.js +26 -0
- package/dist/core/exec-gate.d.ts +8 -1
- package/dist/core/exec-gate.js +24 -9
- package/dist/core/exec-outcome.d.ts +102 -0
- package/dist/core/exec-outcome.js +79 -0
- package/dist/core/existing-target.d.ts +45 -0
- package/dist/core/existing-target.js +54 -8
- package/dist/core/fast-tier-door.d.ts +2 -2
- package/dist/core/fast-tier-door.js +3 -3
- package/dist/core/file-history-store.d.ts +138 -19
- package/dist/core/file-history-store.js +124 -33
- package/dist/core/gate-fold.js +8 -1
- package/dist/core/gate-lanes.js +65 -38
- package/dist/core/gate-outcome.d.ts +3 -1
- package/dist/core/gate-outcome.js +7 -1
- package/dist/core/git-worktree-env.d.ts +25 -5
- package/dist/core/git-worktree-env.js +38 -13
- package/dist/core/governance-codes.d.ts +179 -40
- package/dist/core/governance-codes.js +450 -43
- package/dist/core/hands-band.d.ts +1 -1
- package/dist/core/hooks.d.ts +75 -13
- package/dist/core/hooks.js +4 -0
- package/dist/core/host-floor.d.ts +1 -1
- package/dist/core/host-floor.js +1 -1
- package/dist/core/identity-rekey.d.ts +2 -1
- package/dist/core/identity-rekey.js +5 -5
- package/dist/core/image-admission.d.ts +2 -2
- package/dist/core/image-admission.js +1 -1
- package/dist/core/isolation-scope.d.ts +42 -17
- package/dist/core/isolation-scope.js +12 -4
- package/dist/core/leg-identity.d.ts +17 -2
- package/dist/core/leg-identity.js +6 -1
- package/dist/core/locked-config.d.ts +86 -16
- package/dist/core/locked-config.js +100 -34
- package/dist/core/mailbox-store.d.ts +4 -0
- package/dist/core/mailbox-store.js +7 -0
- package/dist/core/mcp-failure.d.ts +13 -4
- package/dist/core/mcp-failure.js +10 -0
- package/dist/core/mcp-injection-drop.d.ts +30 -13
- package/dist/core/mcp-injection-drop.js +25 -7
- package/dist/core/mcp-leg-wait.d.ts +88 -0
- package/dist/core/mcp-leg-wait.js +100 -0
- package/dist/core/mcp-name-judge.js +1 -2
- package/dist/core/mcp-probe.d.ts +30 -1
- package/dist/core/mcp-probe.js +5 -3
- package/dist/core/mcp-read-bound.d.ts +51 -0
- package/dist/core/mcp-read-bound.js +49 -0
- package/dist/core/mcp-server-link.js +4 -3
- package/dist/core/mcp-server-spec.d.ts +97 -26
- package/dist/core/mcp-server-spec.js +51 -19
- package/dist/core/mcp-server-unavailable-notice.d.ts +15 -6
- package/dist/core/mcp-server-unavailable-notice.js +12 -11
- package/dist/core/mcp-stderr-lines.d.ts +69 -0
- package/dist/core/mcp-stderr-lines.js +333 -0
- package/dist/core/mcp.d.ts +32 -9
- package/dist/core/mcp.js +187 -44
- package/dist/core/member-outcome.d.ts +281 -0
- package/dist/core/member-outcome.js +293 -0
- package/dist/core/memory-engine/consolidation.js +3 -3
- package/dist/core/memory-engine/content-origin.js +5 -4
- package/dist/core/memory-engine/control-objects.js +6 -4
- package/dist/core/memory-engine/distiller.js +2 -2
- package/dist/core/memory-engine/dual-root.d.ts +12 -5
- package/dist/core/memory-engine/dual-root.js +13 -7
- package/dist/core/memory-engine/engine.d.ts +27 -31
- package/dist/core/memory-engine/engine.js +103 -61
- package/dist/core/memory-engine/file-backend.d.ts +16 -3
- package/dist/core/memory-engine/file-backend.js +15 -20
- package/dist/core/memory-engine/index-copies.d.ts +8 -6
- package/dist/core/memory-engine/index-copies.js +2 -1
- package/dist/core/memory-engine/index.d.ts +3 -2
- package/dist/core/memory-engine/index.js +3 -2
- package/dist/core/memory-engine/layout.d.ts +166 -23
- package/dist/core/memory-engine/layout.js +235 -40
- package/dist/core/memory-engine/memory-backend-contract.js +20 -20
- package/dist/core/memory-engine/memory-deployment.d.ts +29 -16
- package/dist/core/memory-engine/memory-deployment.js +30 -20
- package/dist/core/memory-engine/mount-failed-notice.d.ts +64 -0
- package/dist/core/memory-engine/mount-failed-notice.js +50 -2
- package/dist/core/memory-engine/projection-ledger.d.ts +48 -0
- package/dist/core/memory-engine/projection-ledger.js +130 -0
- package/dist/core/memory-engine/scope-contract.js +2 -2
- package/dist/core/memory-engine/sync-client.js +1 -2
- package/dist/core/memory-engine/types.d.ts +10 -4
- package/dist/core/memory.js +3 -5
- package/dist/core/mode-policy.d.ts +82 -16
- package/dist/core/mode-policy.js +63 -29
- package/dist/core/model-seat.d.ts +13 -1
- package/dist/core/mods/classic-events.d.ts +13 -1
- package/dist/core/mods/dollar.js +2 -1
- package/dist/core/mods/extension-call.d.ts +3 -0
- package/dist/core/mods/extension-call.js +3 -0
- package/dist/core/mods/kernel/dispatch.d.ts +4 -0
- package/dist/core/mods/kernel/dispatch.js +3 -3
- package/dist/core/mods/kernel/events.d.ts +11 -3
- package/dist/core/mods/kernel/events.js +4 -4
- package/dist/core/mods/message-display.d.ts +6 -3
- package/dist/core/mods/message-display.js +13 -5
- package/dist/core/mods/stations.d.ts +8 -1
- package/dist/core/mods/stations.js +5 -3
- package/dist/core/mods/teammate-stations.d.ts +75 -0
- package/dist/core/mods/teammate-stations.js +108 -0
- package/dist/core/mounted-mcp.js +1 -2
- package/dist/core/namespaced-rule-name.d.ts +1 -1
- package/dist/core/namespaced-rule-name.js +1 -1
- package/dist/core/notice-fact.d.ts +28 -0
- package/dist/core/notice-fact.js +25 -0
- package/dist/core/owner-identity.d.ts +8 -3
- package/dist/core/owner-identity.js +6 -3
- package/dist/core/parent-spec-seat.d.ts +16 -6
- package/dist/core/parent-spec-seat.js +28 -6
- package/dist/core/park-resumability.d.ts +10 -5
- package/dist/core/park-resumability.js +3 -0
- package/dist/core/park-selfcheck.js +2 -1
- package/dist/core/peer-seat.d.ts +1 -2
- package/dist/core/permission-rule-consent.d.ts +50 -1
- package/dist/core/permission-rule-consent.js +121 -14
- package/dist/core/permission-rule-model.d.ts +135 -39
- package/dist/core/permission-rule-model.js +151 -24
- package/dist/core/permission-rule-org.d.ts +13 -0
- package/dist/core/permission-rule-org.js +8 -0
- package/dist/core/permission-rule-provider.d.ts +107 -7
- package/dist/core/permission-rule-provider.js +434 -29
- package/dist/core/permission-rule-session.js +3 -1
- package/dist/core/permission-rule-store.d.ts +19 -2
- package/dist/core/permission-rule-store.js +29 -10
- package/dist/core/permission-rule-sync.js +5 -2
- package/dist/core/permission-rules.js +8 -3
- package/dist/core/persisted-rule-arms.d.ts +10 -4
- package/dist/core/persisted-rule-arms.js +16 -11
- package/dist/core/persisted-rule-buckets.d.ts +66 -0
- package/dist/core/persisted-rule-buckets.js +57 -0
- package/dist/core/plan-review-facts.d.ts +33 -0
- package/dist/core/plan-review-facts.js +25 -0
- package/dist/core/prefix-declaration.d.ts +50 -0
- package/dist/core/prefix-declaration.js +13 -0
- package/dist/core/present-plan-tool.d.ts +13 -3
- package/dist/core/present-plan-tool.js +14 -3
- package/dist/core/pricing.d.ts +5 -1
- package/dist/core/pricing.js +8 -5
- package/dist/core/principal-name.d.ts +55 -5
- package/dist/core/principal-name.js +57 -16
- package/dist/core/process-identity.d.ts +11 -7
- package/dist/core/process-identity.js +26 -36
- package/dist/core/process-table.d.ts +67 -0
- package/dist/core/process-table.js +177 -0
- package/dist/core/protocol-http-auth.d.ts +75 -12
- package/dist/core/protocol-http-auth.js +223 -26
- package/dist/core/protocol-revocation.d.ts +29 -10
- package/dist/core/protocol-revocation.js +9 -5
- package/dist/core/read-only-shell.d.ts +1 -1
- package/dist/core/read-only-shell.js +1 -1
- package/dist/core/read-root-grant-screen.d.ts +17 -6
- package/dist/core/read-root-grant-screen.js +15 -5
- package/dist/core/reminder-mint.d.ts +6 -0
- package/dist/core/reminder-mint.js +13 -0
- package/dist/core/remote-env.d.ts +111 -3
- package/dist/core/remote-env.js +20 -0
- package/dist/core/request-copy-projection.js +97 -18
- package/dist/core/resource-limit-reasons.d.ts +52 -0
- package/dist/core/resource-limit-reasons.js +6 -0
- package/dist/core/resume-at-refusal.d.ts +10 -6
- package/dist/core/resume-at-refusal.js +2 -2
- package/dist/core/resume-config-judge.d.ts +3 -2
- package/dist/core/resume-config-judge.js +2 -1
- package/dist/core/resume-startup-cause.d.ts +18 -4
- package/dist/core/resume-startup-cause.js +30 -6
- package/dist/core/retention.d.ts +12 -2
- package/dist/core/retention.js +6 -1
- package/dist/core/retired-keys.d.ts +5 -0
- package/dist/core/retired-keys.js +12 -0
- package/dist/core/rewind-conversation.d.ts +54 -0
- package/dist/core/rewind-conversation.js +1 -0
- package/dist/core/roles.d.ts +61 -3
- package/dist/core/roles.js +81 -28
- package/dist/core/rule-lane-reads.d.ts +2 -1
- package/dist/core/rule-lane-reads.js +54 -29
- package/dist/core/rule-offer-read.js +5 -2
- package/dist/core/rule-owner.d.ts +6 -1
- package/dist/core/rule-owner.js +8 -2
- package/dist/core/rule-store-fault.d.ts +4 -2
- package/dist/core/rule-store-fault.js +4 -1
- package/dist/core/runner/advertised-writable-dirs.d.ts +17 -0
- package/dist/core/runner/advertised-writable-dirs.js +15 -9
- package/dist/core/runner/announce-once-ledger.js +12 -11
- package/dist/core/runner/assemble-result.d.ts +15 -6
- package/dist/core/runner/assemble-result.js +12 -5
- package/dist/core/runner/auto-strip-notice.d.ts +1 -1
- package/dist/core/runner/branch-window.d.ts +25 -2
- package/dist/core/runner/branch-window.js +47 -11
- package/dist/core/runner/chain-refusal-throw.d.ts +19 -0
- package/dist/core/runner/chain-refusal-throw.js +30 -0
- package/dist/core/runner/changes-git.d.ts +21 -0
- package/dist/core/runner/changes-git.js +291 -0
- package/dist/core/runner/changes-history.d.ts +80 -0
- package/dist/core/runner/changes-history.js +351 -0
- package/dist/core/runner/checkpoint-scope.d.ts +16 -8
- package/dist/core/runner/checkpoint-scope.js +6 -4
- package/dist/core/runner/child-tree.d.ts +31 -20
- package/dist/core/runner/child-tree.js +24 -9
- package/dist/core/runner/classifier-ladder.d.ts +4 -2
- package/dist/core/runner/classifier-ladder.js +14 -12
- package/dist/core/runner/clock-and-limits.d.ts +0 -3
- package/dist/core/runner/clock-and-limits.js +1 -2
- package/dist/core/runner/compact-session.js +19 -50
- package/dist/core/runner/compaction-restate.js +2 -1
- package/dist/core/runner/constraint-layers.d.ts +101 -0
- package/dist/core/runner/constraint-layers.js +96 -0
- package/dist/core/runner/construction-doors.js +2 -0
- package/dist/core/runner/content-ask-bindings.d.ts +3 -3
- package/dist/core/runner/continuation-gate.d.ts +8 -4
- package/dist/core/runner/continuation-gate.js +2 -0
- package/dist/core/runner/continues-from.d.ts +7 -0
- package/dist/core/runner/continues-from.js +9 -0
- package/dist/core/runner/contracts.d.ts +144 -44
- package/dist/core/runner/decide-continuation.d.ts +2 -2
- package/dist/core/runner/denial-limit-arms.js +3 -4
- package/dist/core/runner/earlier-grammar-notice.js +5 -3
- package/dist/core/runner/env-capability-census.js +2 -1
- package/dist/core/runner/file-history-restore.d.ts +35 -9
- package/dist/core/runner/file-history-restore.js +36 -9
- package/dist/core/runner/finish-reason-seat.js +13 -4
- package/dist/core/runner/gate-exit.d.ts +8 -0
- package/dist/core/runner/gate-exit.js +36 -11
- package/dist/core/runner/halt-attribution.js +1 -1
- package/dist/core/runner/initial-run-state.d.ts +1 -1
- package/dist/core/runner/initial-run-state.js +2 -2
- package/dist/core/runner/left-as-is-seat.js +1 -1
- package/dist/core/runner/mcp-redial.d.ts +15 -4
- package/dist/core/runner/mcp-redial.js +53 -6
- package/dist/core/runner/memory-capture-optout.d.ts +7 -11
- package/dist/core/runner/memory-capture-optout.js +7 -4
- package/dist/core/runner/memory-phase-refusals.d.ts +19 -0
- package/dist/core/runner/memory-phase-refusals.js +18 -0
- package/dist/core/runner/messages-omitted-seat.d.ts +24 -1
- package/dist/core/runner/messages-omitted-seat.js +30 -9
- package/dist/core/runner/model-fallback-seat.d.ts +18 -5
- package/dist/core/runner/model-fallback-seat.js +29 -24
- package/dist/core/runner/model-lane-seat.d.ts +23 -1
- package/dist/core/runner/model-lane-seat.js +20 -2
- package/dist/core/runner/nested-memory-lane.d.ts +64 -57
- package/dist/core/runner/nested-memory-lane.js +310 -110
- package/dist/core/runner/park-commit.d.ts +26 -5
- package/dist/core/runner/park-commit.js +19 -8
- package/dist/core/runner/permission-rule-lanes.d.ts +5 -0
- package/dist/core/runner/permission-rule-lanes.js +44 -11
- package/dist/core/runner/person-path-rows.d.ts +124 -21
- package/dist/core/runner/person-path-rows.js +179 -20
- package/dist/core/runner/prefix-ledger.d.ts +57 -3
- package/dist/core/runner/prefix-ledger.js +98 -8
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +2 -1
- package/dist/core/runner/prepare-acquire-reconcile.js +13 -65
- package/dist/core/runner/prepare-advisor.js +2 -1
- package/dist/core/runner/prepare-artifact.d.ts +4 -1
- package/dist/core/runner/prepare-artifact.js +3 -3
- package/dist/core/runner/prepare-ask-lane.d.ts +4 -0
- package/dist/core/runner/prepare-ask-lane.js +7 -5
- package/dist/core/runner/prepare-boundary-parks.js +9 -3
- package/dist/core/runner/prepare-caps-and-workflow.js +37 -25
- package/dist/core/runner/prepare-config-doors.d.ts +13 -14
- package/dist/core/runner/prepare-config-doors.js +121 -122
- package/dist/core/runner/prepare-context-lane.d.ts +32 -11
- package/dist/core/runner/prepare-context-lane.js +77 -48
- package/dist/core/runner/prepare-defer-classify.d.ts +12 -0
- package/dist/core/runner/prepare-defer-classify.js +29 -7
- package/dist/core/runner/prepare-delegation-surface.d.ts +2 -0
- package/dist/core/runner/prepare-delegation-surface.js +8 -4
- package/dist/core/runner/prepare-execution-env.d.ts +3 -0
- package/dist/core/runner/prepare-execution-env.js +10 -5
- package/dist/core/runner/prepare-file-history.js +4 -1
- package/dist/core/runner/prepare-gate-stations.d.ts +10 -0
- package/dist/core/runner/prepare-gate-stations.js +15 -6
- package/dist/core/runner/prepare-hands-readface.d.ts +28 -7
- package/dist/core/runner/prepare-hands-readface.js +83 -23
- package/dist/core/runner/prepare-inherited-gate.d.ts +20 -11
- package/dist/core/runner/prepare-inherited-gate.js +27 -16
- package/dist/core/runner/prepare-memory-engine-session.js +4 -2
- package/dist/core/runner/prepare-memory.d.ts +8 -1
- package/dist/core/runner/prepare-memory.js +37 -33
- package/dist/core/runner/prepare-offload-wrappers.d.ts +7 -7
- package/dist/core/runner/prepare-offload-wrappers.js +26 -17
- package/dist/core/runner/prepare-park-ask.d.ts +8 -11
- package/dist/core/runner/prepare-park-ask.js +11 -8
- package/dist/core/runner/prepare-policy-chain.d.ts +24 -1
- package/dist/core/runner/prepare-policy-chain.js +53 -28
- package/dist/core/runner/prepare-project-context.d.ts +4 -0
- package/dist/core/runner/prepare-project-context.js +9 -8
- package/dist/core/runner/prepare-prompt-assembly.js +2 -2
- package/dist/core/runner/prepare-protocol-tools.d.ts +2 -2
- package/dist/core/runner/prepare-protocol-tools.js +44 -24
- package/dist/core/runner/prepare-question-face.d.ts +4 -9
- package/dist/core/runner/prepare-question-face.js +8 -3
- package/dist/core/runner/prepare-suspend-saga.d.ts +7 -1
- package/dist/core/runner/prepare-suspend-saga.js +10 -4
- package/dist/core/runner/prepare-task.d.ts +2 -2
- package/dist/core/runner/prepare-task.js +141 -57
- package/dist/core/runner/prepare-tool-disclosure-mount.js +10 -5
- package/dist/core/runner/prepare-turn-wiring.d.ts +3 -1
- package/dist/core/runner/prepare-turn-wiring.js +10 -8
- package/dist/core/runner/prepare-wiring-manifest.d.ts +6 -19
- package/dist/core/runner/prepare-wiring-manifest.js +17 -35
- package/dist/core/runner/prepare-workspace-restore.d.ts +4 -11
- package/dist/core/runner/prepare-workspace-restore.js +1 -14
- package/dist/core/runner/read-root-grant.d.ts +48 -13
- package/dist/core/runner/read-root-grant.js +53 -19
- package/dist/core/runner/read-session-changes.d.ts +9 -0
- package/dist/core/runner/read-session-changes.js +192 -0
- package/dist/core/runner/remote-env-retry.d.ts +4 -4
- package/dist/core/runner/resume-admission.d.ts +11 -7
- package/dist/core/runner/resume-admission.js +25 -15
- package/dist/core/runner/resume-apply.js +2 -1
- package/dist/core/runner/resume-checkpoint-screen.d.ts +7 -2
- package/dist/core/runner/resume-checkpoint-screen.js +32 -17
- package/dist/core/runner/resume-internals-and-config.d.ts +3 -0
- package/dist/core/runner/resume-internals-and-config.js +10 -7
- package/dist/core/runner/resume-policy-outcome.d.ts +4 -3
- package/dist/core/runner/resume-policy-outcome.js +2 -2
- package/dist/core/runner/retired-name-policy.d.ts +15 -0
- package/dist/core/runner/retired-name-policy.js +37 -0
- package/dist/core/runner/retired-runner-deps.js +3 -1
- package/dist/core/runner/rewind-conversation.d.ts +10 -0
- package/dist/core/runner/rewind-conversation.js +100 -0
- package/dist/core/runner/rewind-files.js +37 -20
- package/dist/core/runner/rewind-target.d.ts +28 -0
- package/dist/core/runner/rewind-target.js +58 -0
- package/dist/core/runner/role-resolution-table.d.ts +3 -16
- package/dist/core/runner/role-resolution-table.js +1 -3
- package/dist/core/runner/role-seat-defaulted.d.ts +14 -5
- package/dist/core/runner/role-seat-defaulted.js +17 -13
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +8 -6
- package/dist/core/runner/rule-store-unreadable-notice.js +6 -4
- package/dist/core/runner/run-compaction-machinery.js +2 -2
- package/dist/core/runner/run-harness-handlers.js +43 -11
- package/dist/core/runner/run-identity-wiring.d.ts +2 -0
- package/dist/core/runner/run-identity-wiring.js +3 -2
- package/dist/core/runner/run-leg.js +19 -28
- package/dist/core/runner/run-notification-lane.js +2 -2
- package/dist/core/runner/run-settle-and-teardown.js +32 -17
- package/dist/core/runner/run-stop-and-final-verify.js +66 -69
- package/dist/core/runner/run-telemetry-and-budget-seats.js +14 -8
- package/dist/core/runner/run-turn-boundary.js +3 -6
- package/dist/core/runner/runtask.d.ts +22 -16
- package/dist/core/runner/runtask.js +18 -8
- package/dist/core/runner/sandbox-network-seat.js +1 -1
- package/dist/core/runner/seat-model-doors.d.ts +6 -5
- package/dist/core/runner/seat-model-doors.js +4 -3
- package/dist/core/runner/session-file-state-replay.d.ts +47 -8
- package/dist/core/runner/session-file-state-replay.js +97 -11
- package/dist/core/runner/session-files-open.d.ts +64 -0
- package/dist/core/runner/session-files-open.js +33 -0
- package/dist/core/runner/session-read-file-states.d.ts +37 -41
- package/dist/core/runner/session-read-file-states.js +14 -6
- package/dist/core/runner/session-rule-policy.d.ts +5 -0
- package/dist/core/runner/session-rule-policy.js +16 -9
- package/dist/core/runner/session-verb-doors.d.ts +41 -4
- package/dist/core/runner/session-verb-doors.js +66 -11
- package/dist/core/runner/shared-read-classifier.d.ts +14 -3
- package/dist/core/runner/shared-read-classifier.js +14 -6
- package/dist/core/runner/shell-env-withheld.d.ts +4 -2
- package/dist/core/runner/shell-env-withheld.js +3 -2
- package/dist/core/runner/side-call-account.d.ts +47 -5
- package/dist/core/runner/side-call-account.js +37 -3
- package/dist/core/runner/skipped-rules-notice.d.ts +5 -5
- package/dist/core/runner/skipped-rules-notice.js +3 -3
- package/dist/core/runner/stream-settle-backstop.js +5 -4
- package/dist/core/runner/sub-agent-deny-lists.d.ts +26 -7
- package/dist/core/runner/sub-agent-deny-lists.js +23 -15
- package/dist/core/runner/task-start-doors.d.ts +7 -3
- package/dist/core/runner/task-start-doors.js +72 -31
- package/dist/core/runner/terminal-account.js +14 -8
- package/dist/core/runner/terminal-projection.d.ts +3 -2
- package/dist/core/runner/terminal-projection.js +2 -2
- package/dist/core/runner/tool-defer-gate.d.ts +1 -1
- package/dist/core/runner/tool-end-body.d.ts +8 -1
- package/dist/core/runner/tool-end-body.js +4 -3
- package/dist/core/runner/tool-face-overlay.js +6 -4
- package/dist/core/runner/tool-result-media-seat.d.ts +2 -1
- package/dist/core/runner/tool-table-view.js +1 -1
- package/dist/core/runner/trim-stretch.d.ts +43 -0
- package/dist/core/runner/trim-stretch.js +34 -0
- package/dist/core/runner/turn-attachments.js +7 -2
- package/dist/core/runner/unreadable-person-rows.d.ts +39 -0
- package/dist/core/runner/unreadable-person-rows.js +20 -0
- package/dist/core/runner/verdict-refusal.d.ts +22 -7
- package/dist/core/runner/verdict-refusal.js +35 -3
- package/dist/core/runner/workspace-sync.d.ts +49 -0
- package/dist/core/runner/workspace-sync.js +170 -0
- package/dist/core/runner-deps.d.ts +57 -32
- package/dist/core/scheduler.d.ts +34 -14
- package/dist/core/secret-env.d.ts +168 -18
- package/dist/core/secret-env.js +291 -56
- package/dist/core/sensitive-path-policy.js +3 -2
- package/dist/core/session-changes.d.ts +260 -0
- package/dist/core/session-changes.js +40 -0
- package/dist/core/session-checkout.d.ts +87 -3
- package/dist/core/session-checkout.js +134 -6
- package/dist/core/session-log-transfer.js +13 -7
- package/dist/core/session-policy-store.d.ts +40 -12
- package/dist/core/session-policy-store.js +51 -25
- package/dist/core/session-store.d.ts +23 -10
- package/dist/core/session-store.js +40 -13
- package/dist/core/session.d.ts +56 -9
- package/dist/core/session.js +8 -1
- package/dist/core/shell-read-silence.d.ts +3 -3
- package/dist/core/shell-read-silence.js +3 -1
- package/dist/core/shell-run-candidates.d.ts +23 -6
- package/dist/core/shell-run-candidates.js +34 -11
- package/dist/core/skill-grant.d.ts +11 -6
- package/dist/core/skill-grant.js +23 -15
- package/dist/core/spend-account.d.ts +232 -0
- package/dist/core/spend-account.js +286 -0
- package/dist/core/store-contracts/background-agent-store-contract.js +85 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +6 -2
- package/dist/core/store-contracts/checkpoint-store-contract.js +60 -6
- package/dist/core/store-contracts/file-history-store-contract.js +4 -4
- package/dist/core/store-contracts/mailbox-store-contract.d.ts +2 -1
- package/dist/core/store-contracts/mailbox-store-contract.js +22 -11
- package/dist/core/store-contracts/peer-directory-contract.js +8 -0
- package/dist/core/store-contracts/permission-rule-sync-contract.js +3 -3
- package/dist/core/store-contracts/session-deletion-cascade-contract.js +23 -4
- package/dist/core/store-contracts/session-policy-store-contract.js +9 -0
- package/dist/core/store-contracts/session-repo-contract.js +38 -1
- package/dist/core/store-contracts/session-store-contract.d.ts +21 -2
- package/dist/core/store-contracts/session-store-contract.js +369 -5
- package/dist/core/store-contracts/tool-result-store-contract.js +8 -7
- package/dist/core/store-contracts/workflow-journal-store-contract.js +33 -0
- package/dist/core/task-event.d.ts +57 -53
- package/dist/core/task-limits.d.ts +15 -8
- package/dist/core/task-notification.d.ts +17 -12
- package/dist/core/task-notification.js +20 -9
- package/dist/core/task-registry-agent.d.ts +35 -30
- package/dist/core/task-registry-agent.js +102 -32
- package/dist/core/task-registry-monitor.js +2 -1
- package/dist/core/task-registry-shared.d.ts +83 -16
- package/dist/core/task-registry-shared.js +26 -7
- package/dist/core/task-registry-workflow.d.ts +9 -1
- package/dist/core/task-registry-workflow.js +11 -3
- package/dist/core/task-registry.d.ts +26 -27
- package/dist/core/task-registry.js +42 -12
- package/dist/core/task-result.d.ts +145 -35
- package/dist/core/task-spec-members.d.ts +21 -3
- package/dist/core/task-spec-members.js +11 -2
- package/dist/core/task-spec.d.ts +42 -45
- package/dist/core/task-start-judge.js +10 -3
- package/dist/core/task-stream.d.ts +2 -1
- package/dist/core/terminal-cause.d.ts +30 -2
- package/dist/core/tool-catalog-entries.js +1 -1
- package/dist/core/tool-errors.js +1 -0
- package/dist/core/tool-face-reader.d.ts +3 -2
- package/dist/core/tool-gate-phase.d.ts +16 -0
- package/dist/core/tool-gate-phase.js +1 -0
- package/dist/core/tool-mount-plan.d.ts +7 -0
- package/dist/core/tool-mount-plan.js +25 -1
- package/dist/core/tool-mount-static.js +3 -2
- package/dist/core/tool-name-aliases.d.ts +81 -106
- package/dist/core/tool-name-aliases.js +60 -155
- package/dist/core/tool-name-readings.d.ts +2 -0
- package/dist/core/tool-name-readings.js +9 -1
- package/dist/core/tool-policy.d.ts +165 -60
- package/dist/core/tool-policy.js +105 -69
- package/dist/core/tool-registry.d.ts +2 -0
- package/dist/core/tool-registry.js +3 -0
- package/dist/core/tool-result-bytes.d.ts +27 -3
- package/dist/core/tool-result-bytes.js +53 -0
- package/dist/core/tool-result-store.d.ts +11 -4
- package/dist/core/tool-result-store.js +6 -2
- package/dist/core/tool-roster.d.ts +33 -22
- package/dist/core/tool-roster.js +28 -18
- package/dist/core/tool-spec-members.d.ts +12 -0
- package/dist/core/tool-spec-members.js +31 -0
- package/dist/core/tool-spec.d.ts +41 -28
- package/dist/core/trace.d.ts +21 -64
- package/dist/core/trace.js +2 -3
- package/dist/core/types.d.ts +7 -7
- package/dist/core/types.js +2 -2
- package/dist/core/unavailable-landing.d.ts +72 -0
- package/dist/core/unavailable-landing.js +18 -0
- package/dist/core/untrusted-egress.d.ts +27 -5
- package/dist/core/untrusted-egress.js +30 -8
- package/dist/core/usage-window-store.d.ts +11 -1
- package/dist/core/usage-window-store.js +5 -0
- package/dist/core/user-attachment.d.ts +74 -48
- package/dist/core/user-attachment.js +137 -69
- package/dist/core/user-row-origin.d.ts +10 -0
- package/dist/core/user-row-origin.js +6 -0
- package/dist/core/wiring-manifest.d.ts +94 -24
- package/dist/core/wiring-manifest.js +65 -13
- package/dist/core/workflow-journal-store.d.ts +16 -7
- package/dist/core/workflow-journal-store.js +34 -6
- package/dist/core/workflow-run-store-contract.js +102 -0
- package/dist/core/workflow-run-store.d.ts +95 -4
- package/dist/core/workflow-run-store.js +74 -11
- package/dist/engine/compaction/compaction.d.ts +15 -3
- package/dist/engine/compaction/compaction.js +29 -10
- package/dist/engine/execution-env/kill-tree.js +44 -49
- package/dist/engine/execution-env/node-execution-env.d.ts +3 -1
- package/dist/engine/execution-env/node-execution-env.js +18 -11
- package/dist/engine/harness/agent-harness.d.ts +13 -0
- package/dist/engine/harness/agent-harness.js +16 -1
- package/dist/engine/harness/types.d.ts +100 -30
- package/dist/engine/harness/types.js +36 -4
- package/dist/engine/llm/rejected-images.js +1 -1
- package/dist/engine/llm/types.d.ts +22 -2
- package/dist/engine/llm/types.js +5 -2
- package/dist/engine/loop/agent-loop.js +43 -11
- package/dist/engine/loop/types.d.ts +11 -0
- package/dist/engine/session/import-validate.d.ts +9 -0
- package/dist/engine/session/import-validate.js +50 -9
- package/dist/engine/session/memory-repo.d.ts +5 -1
- package/dist/engine/session/memory-repo.js +8 -3
- package/dist/engine/session/parent-chain-guard.js +1 -1
- package/dist/engine/session/path-to-root.js +1 -1
- package/dist/engine/session/repo-utils.d.ts +19 -12
- package/dist/engine/session/repo-utils.js +12 -7
- package/dist/engine/session/session.d.ts +30 -10
- package/dist/engine/session/session.js +52 -20
- package/dist/engine/session/storage-base.js +2 -2
- package/dist/fixtures/index.d.ts +3 -1
- package/dist/fixtures/index.js +3 -0
- package/dist/host-env.d.ts +17 -0
- package/dist/host-env.js +1 -0
- package/dist/index.d.ts +83 -41
- package/dist/index.js +64 -30
- package/dist/internal/harness-types.d.ts +1 -1
- package/dist/internal/harness.d.ts +5 -3
- package/dist/internal/harness.js +4 -3
- package/dist/internal/llm.d.ts +1 -1
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +40 -12
- package/dist/orchestration/run-workflow-tool.js +205 -102
- package/dist/orchestration/workflow-catalog.d.ts +254 -0
- package/dist/orchestration/workflow-catalog.js +702 -0
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-meta.d.ts +11 -1
- package/dist/orchestration/workflow-meta.js +48 -0
- package/dist/orchestration/workflow-observe.d.ts +8 -10
- package/dist/orchestration/workflow-observe.js +6 -1
- package/dist/orchestration/workflow-park-adoption.d.ts +71 -33
- package/dist/orchestration/workflow-park-adoption.js +153 -40
- package/dist/orchestration/workflow-requirements.d.ts +51 -0
- package/dist/orchestration/workflow-requirements.js +54 -0
- package/dist/orchestration/workflow-script-runner.d.ts +18 -0
- package/dist/orchestration/workflow-script-store.d.ts +19 -64
- package/dist/orchestration/workflow-script-store.js +1 -24
- package/dist/orchestration/workflow-types.d.ts +173 -41
- package/dist/orchestration/workflow-types.js +22 -4
- package/dist/orchestration/workflow.d.ts +56 -42
- package/dist/orchestration/workflow.js +654 -139
- package/dist/prompt-assembly/catalog/core-behavior.js +6 -2
- package/dist/prompt-assembly/catalog/engine.d.ts +36 -0
- package/dist/prompt-assembly/catalog/engine.js +4 -0
- package/dist/prompt-assembly/catalog/events.d.ts +16 -0
- package/dist/prompt-assembly/catalog/events.js +2 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +4 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/events.js +2 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/mechanism.js +2 -2
- package/dist/prompt-assembly/catalog/mechanism.js +2 -2
- package/dist/prompt-assembly/catalog/schema.d.ts +5 -2
- package/dist/prompt-assembly/catalog/schema.js +1 -0
- package/dist/prompt-assembly/epoch.d.ts +26 -0
- package/dist/prompt-assembly/epoch.js +29 -0
- package/dist/prompt-assembly/event-registry.js +2 -0
- package/dist/prompt-assembly/tool-catalog.d.ts +1 -1
- package/dist/prompt-assembly/turn-snapshot.d.ts +1 -1
- package/dist/prompts/default.d.ts +2 -2
- package/dist/shell/lex.d.ts +10 -7
- package/dist/shell/lex.js +56 -6
- package/dist/stores/file/adoption/adopt.d.ts +12 -0
- package/dist/stores/file/adoption/adopt.js +78 -31
- package/dist/stores/file/adoption/marker.d.ts +48 -26
- package/dist/stores/file/adoption/marker.js +24 -11
- package/dist/stores/file/background-agent-store.d.ts +5 -0
- package/dist/stores/file/background-agent-store.js +26 -5
- package/dist/stores/file/data-root-declaration.js +2 -1
- package/dist/stores/file/descriptor-seat.d.ts +100 -0
- package/dist/stores/file/descriptor-seat.js +150 -0
- package/dist/stores/file/file-history-store.js +2 -1
- package/dist/stores/file/fs-atomic.d.ts +126 -78
- package/dist/stores/file/fs-atomic.js +313 -253
- package/dist/stores/file/index.d.ts +10 -1
- package/dist/stores/file/index.js +28 -16
- package/dist/stores/file/ledger-damage.js +6 -10
- package/dist/stores/file/lock-reading.d.ts +158 -0
- package/dist/stores/file/lock-reading.js +252 -0
- package/dist/stores/file/mailbox-store.d.ts +8 -5
- package/dist/stores/file/mailbox-store.js +23 -14
- package/dist/stores/file/permission-rule-adopt.js +11 -11
- package/dist/stores/file/permission-rule-store.d.ts +14 -3
- package/dist/stores/file/permission-rule-store.js +33 -37
- package/dist/stores/file/process-anchor.d.ts +85 -0
- package/dist/stores/file/process-anchor.js +392 -0
- package/dist/stores/file/session-policy-store.d.ts +18 -2
- package/dist/stores/file/session-policy-store.js +71 -5
- package/dist/stores/file/session-store.d.ts +19 -1
- package/dist/stores/file/session-store.js +51 -19
- package/dist/stores/file/shared-ledger.d.ts +3 -3
- package/dist/stores/file/task-list-store.js +1 -1
- package/dist/stores/file/tool-result-store.js +2 -1
- package/dist/stores/file/usage-window-store.js +1 -1
- package/dist/stores/file/workflow-journal-store.d.ts +5 -2
- package/dist/stores/file/workflow-journal-store.js +12 -25
- package/dist/stores/file/workflow-run-store.d.ts +5 -0
- package/dist/stores/file/workflow-run-store.js +19 -12
- package/dist/tools/artifact/artifact-text.d.ts +29 -11
- package/dist/tools/artifact/artifact-text.js +13 -6
- package/dist/tools/artifact/artifact-tool.d.ts +35 -5
- package/dist/tools/artifact/artifact-tool.js +240 -45
- package/dist/tools/artifact/conformance.d.ts +27 -5
- package/dist/tools/artifact/conformance.js +420 -45
- package/dist/tools/artifact/local-stub.d.ts +2 -2
- package/dist/tools/artifact/local-stub.js +29 -26
- package/dist/tools/fs/bash-failure-output.d.ts +64 -0
- package/dist/tools/fs/bash-failure-output.js +40 -0
- package/dist/tools/fs/bash-program-position.d.ts +7 -3
- package/dist/tools/fs/bash-program-position.js +9 -6
- package/dist/tools/fs/bash-readonly-classifier.d.ts +4 -3
- package/dist/tools/fs/bound-open.d.ts +9 -8
- package/dist/tools/fs/bound-open.js +6 -4
- package/dist/tools/fs/dead-cwd.d.ts +8 -0
- package/dist/tools/fs/dead-cwd.js +7 -7
- package/dist/tools/fs/file-read-check.d.ts +8 -6
- package/dist/tools/fs/file-read-check.js +8 -4
- package/dist/tools/fs/file-write-check.d.ts +14 -0
- package/dist/tools/fs/file-write-check.js +35 -0
- package/dist/tools/fs/find-actions.d.ts +186 -0
- package/dist/tools/fs/find-actions.js +538 -0
- package/dist/tools/fs/fs-bash.d.ts +6 -3
- package/dist/tools/fs/fs-bash.js +67 -60
- package/dist/tools/fs/fs-pdf.js +16 -5
- package/dist/tools/fs/fs-read.js +5 -3
- package/dist/tools/fs/fs-shared.d.ts +67 -3
- package/dist/tools/fs/fs-shared.js +70 -34
- package/dist/tools/fs/fs-write.d.ts +23 -3
- package/dist/tools/fs/fs-write.js +137 -33
- package/dist/tools/fs/index.d.ts +15 -2
- package/dist/tools/fs/index.js +8 -4
- package/dist/tools/fs/program-read-model.d.ts +17 -1
- package/dist/tools/fs/program-read-model.js +7 -2
- package/dist/tools/fs/program-read-model.rows.js +5 -1
- package/dist/tools/fs/read-deny-home.js +12 -5
- package/dist/tools/fs/read-floor.d.ts +16 -0
- package/dist/tools/fs/read-floor.js +10 -5
- package/dist/tools/fs/removal-targets.d.ts +22 -4
- package/dist/tools/fs/removal-targets.js +116 -6
- package/dist/tools/fs/safety.d.ts +2 -0
- package/dist/tools/fs/safety.js +9 -2
- package/dist/tools/fs/shell-read-bindings.d.ts +56 -7
- package/dist/tools/fs/shell-read-bindings.js +175 -26
- package/dist/tools/fs/shell-read-check.d.ts +11 -2
- package/dist/tools/fs/shell-read-check.js +31 -5
- package/dist/tools/fs/shell-read-command-environment.d.ts +56 -0
- package/dist/tools/fs/shell-read-command-environment.js +75 -0
- package/dist/tools/fs/shell-read-establish.js +62 -16
- package/dist/tools/fs/shell-read-judge.d.ts +52 -7
- package/dist/tools/fs/shell-read-judge.js +63 -21
- package/dist/tools/fs/shell-read-lost-walk.d.ts +19 -0
- package/dist/tools/fs/shell-read-lost-walk.js +35 -0
- package/dist/tools/fs/shell-read-plan.d.ts +4 -0
- package/dist/tools/fs/shell-read-plan.js +47 -13
- package/dist/tools/fs/shell-read-sourced.d.ts +4 -3
- package/dist/tools/fs/shell-read-sourced.js +28 -3
- package/dist/tools/fs/shell-read-start.d.ts +7 -0
- package/dist/tools/fs/shell-read-word.js +1 -0
- package/dist/tools/fs/shell-read-workdir.d.ts +9 -11
- package/dist/tools/fs/shell-read-workdir.js +20 -26
- package/dist/tools/fs/shell-read-write-targets.d.ts +13 -5
- package/dist/tools/fs/shell-read-write-targets.js +51 -9
- package/dist/tools/monitor.d.ts +2 -1
- package/dist/tools/monitor.js +2 -0
- package/dist/tools/scheduler-tools.d.ts +7 -4
- package/dist/tools/scheduler-tools.js +60 -20
- package/dist/tools/task-list.d.ts +11 -1
- package/dist/tools/task-list.js +187 -134
- package/dist/tools/todo.d.ts +1 -1
- package/dist/tools/worktree.js +10 -9
- package/package.json +6 -2
- package/test/export-surface.snapshot.json +592 -22
- package/wire-changes/core-stores-sql@7.68.7.json +39 -0
- package/wire-changes/core-stores-sql@7.70.0.json +414 -0
- package/wire-changes/core@7.68.7.json +140 -0
- package/wire-changes/core@7.70.0.json +14689 -0
- package/wire-changes/mods-kernel@7.68.7.json +39 -0
- package/wire-changes/mods-kernel@7.70.0.json +75 -0
- package/wire-changes/primitives@7.68.7.json +39 -0
- package/wire-changes/primitives@7.70.0.json +807 -0
- package/wire-changes/wiki-gate@7.68.7.json +39 -0
- package/wire-changes/wiki-gate@7.70.0.json +40 -0
- package/dist/core/cache-break-detector.d.ts +0 -98
- package/dist/core/cache-break-detector.js +0 -146
- package/dist/core/compaction-retired-members.d.ts +0 -12
- package/dist/core/compaction-retired-members.js +0 -22
- package/dist/core/loopback-host.d.ts +0 -18
- package/dist/core/loopback-host.js +0 -40
- package/dist/core/protocol-naming.d.ts +0 -95
- package/dist/core/protocol-naming.js +0 -70
- package/dist/core/protocol-table.d.ts +0 -88
- package/dist/core/protocol-table.js +0 -47
|
@@ -242,7 +242,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
242
242
|
assert.strictEqual(repDiff.conflicts.length, 1);
|
|
243
243
|
assert.strictEqual(repDiff.conflicts[0].id, "id-guard-01");
|
|
244
244
|
assert.match(repDiff.conflicts[0].reason, /add_guard_absent_conflict/);
|
|
245
|
-
assert.strictEqual(repDiff.conflicts[0].currentRev, v1.rev, "the current rev
|
|
245
|
+
assert.strictEqual(repDiff.conflicts[0].currentRev, v1.rev, "the conflict reports the current rev (the caller uses it to reconcile the versions)");
|
|
246
246
|
assert.strictEqual((await b.getByIds(["id-guard-01"]))[0].body.replace(/\s+$/, ""), "first", "the existing content must NOT be overwritten");
|
|
247
247
|
const fresh = entry("id-guard-02", "s1", "fresh", "brand new");
|
|
248
248
|
const repFresh = await b.applyPatches([{ op: "add", id: fresh.id, entry: fresh, guard: "absent" }]);
|
|
@@ -316,7 +316,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
316
316
|
assert.strictEqual(after.frontmatter.trust, "untrusted");
|
|
317
317
|
assert.strictEqual(after.rev, next.rev, "provenance participates in the rev (computeEntryRev closure)");
|
|
318
318
|
});
|
|
319
|
-
defer("
|
|
319
|
+
defer("origin marker round-trips; strip/rewrite refused across update, re-add, guard add and same-batch delete+re-add; committed tombstone is the legal exit", async () => {
|
|
320
320
|
const b = await hooks.make();
|
|
321
321
|
const origin = { taint: "external", cause: "observed", at: 1700000000500 };
|
|
322
322
|
const base = {
|
|
@@ -381,7 +381,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
381
381
|
assert.deepStrictEqual(rep7.conflicts, []);
|
|
382
382
|
assert.deepStrictEqual((await b2.getByIds([m0.id]))[0]?.frontmatter.origin, origin, "the conforming update carries the marker forward verbatim");
|
|
383
383
|
});
|
|
384
|
-
defer("
|
|
384
|
+
defer("an AMBIGUOUS origin representation (disagreeing carriers) is refused on add and update; agreeing multi-carrier shapes stay legal", async () => {
|
|
385
385
|
const b = await hooks.make();
|
|
386
386
|
const typed = { taint: "external", cause: "observed", at: 1700000000500 };
|
|
387
387
|
const mk = (id, extra) => {
|
|
@@ -456,7 +456,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
456
456
|
const hits = await b.search("same words", ["s1"]);
|
|
457
457
|
assert.deepStrictEqual(hits.map((h) => h.id), ["id-tie-a-01", "id-tie-b-01"]);
|
|
458
458
|
});
|
|
459
|
-
defer("
|
|
459
|
+
defer("headers carry the exposure fact on BOTH faces (listHeaders + search), typed and extra-form marker alike; unmarked entries carry none", async () => {
|
|
460
460
|
const b = await hooks.make();
|
|
461
461
|
const marked = entry("id-exp-typed-01", "s1", "marked-typed", "same words here");
|
|
462
462
|
marked.frontmatter.origin = { taint: "external", cause: "observed", at: 1700000000600 };
|
|
@@ -479,7 +479,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
479
479
|
assert.strictEqual(hits.find((h) => h.id === marked.id)?.exposure, "external", "search hits carry the same fact");
|
|
480
480
|
assert.strictEqual(hits.find((h) => h.id === clean.id)?.exposure, undefined);
|
|
481
481
|
});
|
|
482
|
-
defer("
|
|
482
|
+
defer("search exposureBands orders unmarked-first BEFORE truncation (the limit-boundary clean entry is served, never starved); absent flag keeps the single-band contract order", async () => {
|
|
483
483
|
const b = await hooks.make();
|
|
484
484
|
const mk = (id, slug, marked) => {
|
|
485
485
|
const e = entry(id, "s1", slug, "same words here");
|
|
@@ -499,7 +499,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
499
499
|
const flat = await b.search("same words", ["s1"], { limit: 3 });
|
|
500
500
|
assert.deepStrictEqual(flat.map((h) => h.id), ["id-band-a-01", "id-band-b-01", "id-band-c-01"]);
|
|
501
501
|
});
|
|
502
|
-
defer("
|
|
502
|
+
defer("hold protocol (update form): mid-hold writes apply plainly (backend is hold-unaware); the release replay at the capture anchor is a reported conflict carrying currentRev; a clean release applies and the snapshot face answers its committed triple", async () => {
|
|
503
503
|
const b = await hooks.make();
|
|
504
504
|
const e1v0 = entry("id-hold-upd1", "s1", "held-clean", "committed v0");
|
|
505
505
|
assert.deepStrictEqual((await b.applyPatches([{ op: "add", id: e1v0.id, entry: e1v0 }])).conflicts, []);
|
|
@@ -537,7 +537,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
537
537
|
assert.strictEqual(rep2.conflicts[0]?.currentRev, mid.rev, "the conflict names the winner — the dispose('conflict') evidence");
|
|
538
538
|
assert.strictEqual((await b.getByIds([e2v0.id]))[0]?.body.replace(/\s+$/, ""), "mid-hold edit by another writer", "the winner's content survives");
|
|
539
539
|
});
|
|
540
|
-
defer("
|
|
540
|
+
defer("hold protocol (add form): a guard-absent release applies onto a free id; the crash retry re-applies idempotently (one row, original slug); a concurrent claim answers the guarded conflict with currentRev and survives", async () => {
|
|
541
541
|
const b = await hooks.make();
|
|
542
542
|
const rel = entry("id-hold-add1", "s1", "held-note", "instruction body");
|
|
543
543
|
assert.deepStrictEqual((await b.applyPatches([{ op: "add", id: rel.id, entry: rel, guard: "absent" }])).conflicts, []);
|
|
@@ -555,7 +555,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
555
555
|
assert.strictEqual(rep3.conflicts[0]?.currentRev, claimed.rev, "currentRev distinguishes 'claimed by another writer' from the idempotent retry");
|
|
556
556
|
assert.strictEqual((await b.getByIds([claimed.id]))[0]?.body.replace(/\s+$/, ""), "the claimant's content", "the claimant survives");
|
|
557
557
|
});
|
|
558
|
-
defer("
|
|
558
|
+
defer("the whitewash judgment precedes CAS — an origin/trust strip with a STALE baseRev still answers the malformed refusal, never the rev-mismatch conflict", async () => {
|
|
559
559
|
const b = await hooks.make();
|
|
560
560
|
const origin = { taint: "external", cause: "observed", at: 1700000000900 };
|
|
561
561
|
const m0 = { id: "id-prec-0001", scope: "s1", slug: "prec-marked", frontmatter: { name: "prec", origin }, body: "b0", rev: "" };
|
|
@@ -592,7 +592,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
592
592
|
e.frontmatter.distilled.carrierRev = e.rev;
|
|
593
593
|
return e;
|
|
594
594
|
};
|
|
595
|
-
defer("
|
|
595
|
+
defer("distilled round-trips deep-equal (typed block, superseded rows); rev is conditional — no-block entries keep their historical rev, carrierRev never participates", async () => {
|
|
596
596
|
const b = await hooks.make();
|
|
597
597
|
const inputs = [
|
|
598
598
|
{ id: "id-input-0001", rev: "aaaaaaaaaaaaaaaa", superseded: true },
|
|
@@ -612,7 +612,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
612
612
|
await b.applyPatches([{ op: "add", id: plainRow.id, entry: plainRow }]);
|
|
613
613
|
assert.strictEqual((await b.getByIds([plainRow.id]))[0]?.rev, plainRow.rev);
|
|
614
614
|
});
|
|
615
|
-
defer("
|
|
615
|
+
defer("distilled immutability across update strip/member rewrite, plain re-add, guard add and same-batch delete+re-add ⇒ /malformed patch refused/; committed tombstone is the legal exit", async () => {
|
|
616
616
|
const b = await hooks.make();
|
|
617
617
|
const p = distilledEntry("id-prod-00002", "s1", "prod-immutable", "product body", [{ id: "id-input-0003", rev: "cccccccccccccccc", superseded: true }]);
|
|
618
618
|
await b.applyPatches([{ op: "add", id: p.id, entry: p, guard: "absent" }]);
|
|
@@ -647,7 +647,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
647
647
|
assert.deepStrictEqual(rep2.conflicts, []);
|
|
648
648
|
assert.strictEqual((await b.getByIds([p.id]))[0]?.frontmatter.distilled, undefined);
|
|
649
649
|
});
|
|
650
|
-
defer("
|
|
650
|
+
defer("distilled PRECEDENCE — a distilled strip riding a STALE baseRev still answers the malformed refusal, never the rev-mismatch conflict", async () => {
|
|
651
651
|
const b = await hooks.make();
|
|
652
652
|
const p = distilledEntry("id-prod-00003", "s1", "prod-precedence", "v1", [{ id: "id-input-0004", rev: "dddddddddddddddd", superseded: true }]);
|
|
653
653
|
await b.applyPatches([{ op: "add", id: p.id, entry: p, guard: "absent" }]);
|
|
@@ -662,7 +662,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
662
662
|
assert.match(rep.conflicts[0]?.reason ?? "", /malformed patch refused/);
|
|
663
663
|
assert.doesNotMatch(rep.conflicts[0]?.reason ?? "", /rev mismatch/);
|
|
664
664
|
});
|
|
665
|
-
defer("
|
|
665
|
+
defer("the distilled fact rides BOTH header faces (listHeaders + search) as carrierRev + the superseded-row projection; block-free entries carry none on either face", async () => {
|
|
666
666
|
const b = await hooks.make();
|
|
667
667
|
const p = distilledEntry("id-prod-00004", "s1", "prod-header", "searchable distilled kumquat", [
|
|
668
668
|
{ id: "id-input-0005", rev: "eeeeeeeeeeeeeeee", superseded: true },
|
|
@@ -682,7 +682,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
682
682
|
assert.deepStrictEqual(psh?.distilled, { carrierRev: p.rev, supersedes: [{ id: "id-input-0005", rev: "eeeeeeeeeeeeeeee" }] }, "search reports the same committed fact");
|
|
683
683
|
assert.strictEqual(hits.find((h) => h.id === plain.id)?.distilled, undefined);
|
|
684
684
|
});
|
|
685
|
-
defer("
|
|
685
|
+
defer("the plan-replay add spelling — a guard-absent re-add of the identical product is idempotent (one row, no overwrite, no conflict); a different-rev occupant answers add_guard_absent_conflict with currentRev", async () => {
|
|
686
686
|
const b = await hooks.make();
|
|
687
687
|
const p = distilledEntry("id-prod-00005", "s1", "prod-replay", "replayed product", [{ id: "id-input-0007", rev: "abababababababab", superseded: true }]);
|
|
688
688
|
await b.applyPatches([{ op: "add", id: p.id, entry: p, guard: "absent" }]);
|
|
@@ -701,7 +701,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
701
701
|
assert.strictEqual(conflicted.conflicts[0]?.currentRev, foreign.rev);
|
|
702
702
|
assert.strictEqual((await b.getByIds([p.id]))[0]?.body.replace(/\s+$/, ""), "foreign occupant", "the occupant survives");
|
|
703
703
|
});
|
|
704
|
-
defer("
|
|
704
|
+
defer("the directed-arm judgment face — after an update-replay conflict, the reported currentRev and the committed read both answer the planned post-state's rev (already-applied is judgeable), and the judgment read is side-effect-free", async () => {
|
|
705
705
|
const b = await hooks.make();
|
|
706
706
|
const v1 = entry("id-directed-01", "s1", "directed", "v1");
|
|
707
707
|
await b.applyPatches([{ op: "add", id: v1.id, entry: v1 }]);
|
|
@@ -727,7 +727,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
727
727
|
assert.strictEqual(await b.getConsolidationCursor("s1"), "c-2");
|
|
728
728
|
assert.strictEqual(await b.getConsolidationCursor("s2"), "c-other");
|
|
729
729
|
});
|
|
730
|
-
defer("
|
|
730
|
+
defer("optional audit faces: committed snapshot / scope enumeration / custody (absent ⇒ reported)", async () => {
|
|
731
731
|
const b = await hooks.make();
|
|
732
732
|
const seats = [
|
|
733
733
|
["committedSnapshotOf", b.committedSnapshotOf],
|
|
@@ -792,7 +792,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
792
792
|
hooks.onOptionalMember?.({ member: "custodyOf", status: "verified" });
|
|
793
793
|
}
|
|
794
794
|
});
|
|
795
|
-
defer("
|
|
795
|
+
defer("optional erasure face: evidenced delete / replay pinning / selector-swap refusal (absent ⇒ reported)", async () => {
|
|
796
796
|
const b = await hooks.make();
|
|
797
797
|
const seat = b.eraseWithEvidence;
|
|
798
798
|
assert.ok(seat === undefined || typeof seat === "function", "eraseWithEvidence must be undefined (absent) or a function — a non-function occupant is a defect, not absence");
|
|
@@ -822,7 +822,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
822
822
|
await assert.rejects(async () => erase.call(b, { requestId: "req-contract-1", select: { ids: ["id-other-7777"] } }), (err) => err.code === "memory.erasure_selector_mismatch", "a reused requestId with a different selector refuses loudly");
|
|
823
823
|
hooks.onOptionalMember?.({ member: "eraseWithEvidence", status: "verified" });
|
|
824
824
|
});
|
|
825
|
-
defer("
|
|
825
|
+
defer("optional erasure authorization seat: post-resolution judgment, whole-request refusal, replay bound to its set (undeclared ⇒ reported)", async () => {
|
|
826
826
|
const b = await hooks.make();
|
|
827
827
|
const seat = b.eraseWithEvidence;
|
|
828
828
|
const declared = b.judgesErasureScopes;
|
|
@@ -853,7 +853,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
853
853
|
assert.deepStrictEqual((await b.getByIds([theirs.id])).map((e) => e.id), [theirs.id], "the other scope's entry survives every call");
|
|
854
854
|
hooks.onOptionalMember?.({ member: "judgesErasureScopes", status: "verified" });
|
|
855
855
|
});
|
|
856
|
-
defer("
|
|
856
|
+
defer("optional export/import faces: export composite / governance slice / custody carriage (absent ⇒ reported)", async () => {
|
|
857
857
|
const b = await hooks.make();
|
|
858
858
|
const seats = [
|
|
859
859
|
["exportSnapshotOf", b.exportSnapshotOf],
|
|
@@ -913,7 +913,7 @@ export async function memoryBackendContract(hooks) {
|
|
|
913
913
|
else {
|
|
914
914
|
defer("cross-instance CAS: MISSING makeSibling (the baseRev moat axis was not exercised)", async () => {
|
|
915
915
|
throw new Error("memoryBackendContract: no `makeSibling` hook and no `skipCrossInstanceCas` reason — " +
|
|
916
|
-
"provide `makeSibling` (required for authoritative-backend certification
|
|
916
|
+
"provide `makeSibling` (required for authoritative-backend certification), " +
|
|
917
917
|
"or declare `skipCrossInstanceCas: \"<why this store has no shared-storage second instance>\"` for a loud skip.");
|
|
918
918
|
});
|
|
919
919
|
}
|
|
@@ -1296,7 +1296,7 @@ export async function memoryGovernanceStoreContract(hooks) {
|
|
|
1296
1296
|
assert.deepStrictEqual(report.adopted.map((r) => `${r.record}:${r.outcome}`).sort(), ["doc:holds:written", "hold/cap.md:written", "pollution/s1.json:converged"]);
|
|
1297
1297
|
assert.deepStrictEqual(await s.readDoc("holds"), { v: 1, owner: "replica", n: 1 });
|
|
1298
1298
|
assert.ok(same(await s.getObject("hold", "cap.md"), enc("captured")));
|
|
1299
|
-
assert.deepStrictEqual(replicaControlPlaneStrays(replica), { docs: [], objects: {} }, "the engine's readers read these records in the store: the replica's copies are removed
|
|
1299
|
+
assert.deepStrictEqual(replicaControlPlaneStrays(replica), { docs: [], objects: {} }, "the engine's readers read these records in the store: the replica's copies are removed");
|
|
1300
1300
|
assert.deepStrictEqual(readControlPlaneAdoptionReceipt(replica).map((r) => r.record).sort(), ["doc:holds", "hold/cap.md", "pollution/s1.json"]);
|
|
1301
1301
|
});
|
|
1302
1302
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MemoryEngine, type SessionMemoryStatus } from "./engine.js";
|
|
2
|
-
import { type MemoryPartitionIncidentSink, type SessionCaptureRecordStore } from "./layout.js";
|
|
2
|
+
import { type MemoryPartitionIncidentSink, type SessionCaptureRecordStore, type SessionIdentityRead } from "./layout.js";
|
|
3
3
|
import { type EraseMemoryEntriesInput, type MemoryErasureAttestation } from "./file-backend.js";
|
|
4
4
|
import type { MemoryBackend } from "./types.js";
|
|
5
5
|
/** The directory (under the engine root) whose transaction lock serializes a deployment's erasures — the
|
|
@@ -74,21 +74,27 @@ export interface MemoryDeployment {
|
|
|
74
74
|
* `scopes.json.lock.stale-*` · `txn.lock.stale-*`; memory directory top level, files `.casefold-probe-*`. A
|
|
75
75
|
* directory that cannot be read, for any reason but absence (a link that leads nowhere, at it or above it, is no
|
|
76
76
|
* absence), counts as holding one, and so does an anchor, a scope registry, a registry journal or a store identity that
|
|
77
|
-
* stands there damaged (a link, no regular file, unreadable, not JSON or out of shape).
|
|
77
|
+
* stands there damaged (a link, no regular file, unreadable, not JSON or out of shape). It stays in the set, too, while this
|
|
78
|
+
* process saw it hold a record and its control plane no longer holds its root anchor or its account (moved away, unmounted:
|
|
79
|
+
* `memory.store_absent`). Opening, reading (an export that
|
|
78
80
|
* mints the store's identity included) and a refused request add no store — so does the session status read with a host
|
|
79
|
-
* capture carrier, which opens the personal store and leaves its anchor and empty directories
|
|
81
|
+
* capture carrier, which opens the personal store and leaves its anchor and empty directories, unless the deployment's own
|
|
82
|
+
* store is expected and absent (then nothing is opened or made) — and every deployment
|
|
80
83
|
* object over one engine root answers the same. A store in the set that cannot be
|
|
81
|
-
* opened — the damaged anchor, scope registry, registry journal or store identity that put it there is one such cause
|
|
82
|
-
* open read the same fault — is not a store of the list: the call throws `ControlPlaneCorruptError
|
|
83
|
-
* that names its errno, the original as its `cause`), and
|
|
84
|
-
* `optOutSource: "fault"`.
|
|
84
|
+
* opened — the damaged anchor, scope registry, registry journal or store identity that put it there is one such cause, its absence
|
|
85
|
+
* another: the census and the open read the same fault — is not a store of the list: the call throws (`ControlPlaneCorruptError`; a
|
|
86
|
+
* bare system error is carried by one that names its errno, the original as its `cause`; an absent one, `memory.store_absent`), and
|
|
87
|
+
* the session status answers that plane `optOutSource: "fault"`.
|
|
85
88
|
*/
|
|
86
89
|
stores(): readonly MemoryDeploymentStore[];
|
|
87
90
|
/**
|
|
88
91
|
* Erase across the deployment — the input and the receipt of `MemoryEngine.eraseMemoryEntries`, judged as one
|
|
89
92
|
* request in the whole deployment. The deployment's erasures run one at a time (a transaction lock under the
|
|
90
93
|
* engine root, renewed while the stores execute; a lock found lost before a store executes or after the last
|
|
91
|
-
* one throws `ControlPlaneCorruptError`, facet `lock-ownership`, instead of a receipt
|
|
94
|
+
* one throws `ControlPlaneCorruptError`, facet `lock-ownership`, instead of a receipt; a deployment's own File store that is
|
|
95
|
+
* expected and absent refuses `memory.store_absent` before that lock is taken — nothing erased, nothing made — and so does the
|
|
96
|
+
* personal store when the request reaches it, or when the engine root itself is gone; a personal store the request does not reach,
|
|
97
|
+
* under a root that stands, is not asked); under it the stores
|
|
92
98
|
* are read once, and the reach, the judgment and the executions read that one census. The stores a request
|
|
93
99
|
* reaches:
|
|
94
100
|
* - a `{ scope }` selector ⇒ the store carrying that scope (opened if it does not exist yet);
|
|
@@ -97,7 +103,8 @@ export interface MemoryDeployment {
|
|
|
97
103
|
* deleted or recorded — one request is judged in one store's lock;
|
|
98
104
|
* - an `{ ids }` or `{ sessionId }` selector without a grant ⇒ every store of the deployment (each resolves
|
|
99
105
|
* its own share).
|
|
100
|
-
* Before any store executes, every store is asked for an anchor of the same requestId
|
|
106
|
+
* Before any store executes, every store is asked for an anchor of the same requestId (all but a personal store this process saw that
|
|
107
|
+
* is gone and the request does not reach: it cannot be opened, and the request erases nothing there): one recorded under a
|
|
101
108
|
* different authorization set refuses (`config.memory_erasure_scope`); one with a different selector, or in a
|
|
102
109
|
* store this request does not reach, refuses `memory.erasure_selector_mismatch` — nothing is deleted or
|
|
103
110
|
* recorded. A store holding this request's own anchor replays it. The reached stores then execute in store
|
|
@@ -109,16 +116,22 @@ export interface MemoryDeployment {
|
|
|
109
116
|
* erased, and what follows is that store's own sentence about itself — so "nothing was deleted" in it is never read
|
|
110
117
|
* as the request's. A refusal in the first store executed nothing and says only its own sentence.
|
|
111
118
|
*
|
|
112
|
-
* @contract memory.erasure.request_per_deployment — an erasure requestId names one request
|
|
113
|
-
* deployment: its record is the anchor of the store that executed it, every store
|
|
114
|
-
* before any store executes, and a requestId first executed with another selector or in a store the request
|
|
115
|
-
*
|
|
116
|
-
*
|
|
119
|
+
* @contract memory.erasure.request_per_deployment — an erasure requestId names one request across the stores of the
|
|
120
|
+
* deployment that can be opened: its record is the anchor of the store that executed it, every store that can be opened is read
|
|
121
|
+
* for that anchor before any store executes, and a requestId first executed with another selector or in a store the request does
|
|
122
|
+
* not reach is refused `memory.erasure_selector_mismatch` with nothing deleted. A personal store this process saw hold content
|
|
123
|
+
* that is gone cannot be read: a request that reaches it is refused `memory.store_absent`; one that does not is judged by the
|
|
124
|
+
* stores that can be opened, so while it is gone a requestId it executed can execute again in another store under another
|
|
125
|
+
* selector — and once it is back, a replay of that requestId with either selector is refused `memory.erasure_selector_mismatch`
|
|
126
|
+
* (its two records do not converge; a new requestId runs). An erasure that bypasses this face (a store's own engine) is judged
|
|
127
|
+
* by that store alone.
|
|
117
128
|
*/
|
|
118
129
|
eraseMemoryEntries(input: EraseMemoryEntriesInput): Promise<MemoryErasureAttestation>;
|
|
119
130
|
/** A session's memory status across every store of the deployment ({@link DeploymentSessionMemoryStatus}).
|
|
120
|
-
* Never throws — an unreadable source is an absent key, as on one store.
|
|
121
|
-
|
|
131
|
+
* Never throws — an unreadable source is an absent key, as on one store. `identity` names the occupant of the id the status
|
|
132
|
+
* is read for, as a capture record carrier's `read` takes it, and every store reads under it (`MemoryEngine.sessionMemoryStatus`);
|
|
133
|
+
* absent ⇒ every record binds by id — a recycled id then answers the earlier occupant's records too. */
|
|
134
|
+
sessionMemoryStatus(sessionId: string, identity?: SessionIdentityRead): Promise<DeploymentSessionMemoryStatus>;
|
|
122
135
|
}
|
|
123
136
|
/**
|
|
124
137
|
* Fold the stores' answers for one session into the session's status — the deployment-wide reading's ONE law
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
1
2
|
import { join } from "node:path";
|
|
2
3
|
import { MemoryEngine } from "./engine.js";
|
|
3
|
-
import { derivePersonalControlDir, derivePersonalMemoryDir,
|
|
4
|
-
import { acquireStoreTxnLock, assertRootNotSensitive, assertStoreTxnLockOwnership, ControlPlaneCorruptError, renewStoreTxnLock, resolveMemoryEngineRoot, storeHoldsRecord, storeOpenArtifactFault, TXN_LOCK_STALE_MS } from "./layout.js";
|
|
4
|
+
import { derivePersonalControlDir, derivePersonalMemoryDir, judgeMemoryStoreSeat, memoryPlaneStore, memoryScopePlaneOf, mergeErasureAttestations, refuseAbsentPlaneStores, refuseMemoryStoreInput } from "./dual-root.js";
|
|
5
|
+
import { acquireStoreTxnLock, assertRootNotSensitive, assertStoreTxnLockOwnership, controlPlanePinOf, ControlPlaneCorruptError, directoryPinOf, refuseAbsentStore, renewStoreTxnLock, resolveMemoryEngineRoot, storeAbsence, storeHoldsRecord, storeOpenArtifactFault, TXN_LOCK_STALE_MS } from "./layout.js";
|
|
5
6
|
import { captureErasureInput, erasureRequestInvalid, erasureSelectHash } from "./file-backend.js";
|
|
6
7
|
import { canonicalExpectedScopes } from "./export-bundle.js";
|
|
7
8
|
import { isEngineCodeShape, thrownLabel, thrownText } from "../thrown-value.js";
|
|
@@ -40,18 +41,14 @@ export function foldSessionMemoryStatuses(statuses) {
|
|
|
40
41
|
export function createMemoryDeployment(input) {
|
|
41
42
|
judgeMemoryStoreSeat(FACE, input);
|
|
42
43
|
const { backend, scopeContract, onIncident, memoryCaptureRecordStore } = input;
|
|
43
|
-
|
|
44
|
-
const root = store.controlPlaneRoot;
|
|
45
|
-
return typeof root === "string" && root !== "" ? root : undefined;
|
|
46
|
-
};
|
|
47
|
-
if (controlOf(backend) === undefined) {
|
|
44
|
+
if (controlPlanePinOf(backend) === undefined) {
|
|
48
45
|
refuseMemoryStoreInput(FACE, "the backend publishes no control plane (controlPlaneRoot) — a session's memory facts then live in per-project control planes no deployment-wide reading can name", backend);
|
|
49
46
|
}
|
|
50
47
|
const engineRoot = resolveMemoryEngineRoot(input.memoryEngineDir);
|
|
51
48
|
assertRootNotSensitive("engine_root", engineRoot);
|
|
52
49
|
const pinned = directoryPinOf(backend) !== undefined;
|
|
53
50
|
const seatOf = (plane, store) => {
|
|
54
|
-
const controlDir =
|
|
51
|
+
const controlDir = controlPlanePinOf(store);
|
|
55
52
|
const engine = new MemoryEngine({
|
|
56
53
|
backend: store,
|
|
57
54
|
memoryDir: directoryPinOf(store) ?? engineRoot,
|
|
@@ -67,6 +64,7 @@ export function createMemoryDeployment(input) {
|
|
|
67
64
|
const fault = storeOpenArtifactFault(derivePersonalMemoryDir(engineRoot), derivePersonalControlDir(engineRoot));
|
|
68
65
|
if (fault !== undefined)
|
|
69
66
|
throw fault;
|
|
67
|
+
refuseAbsentStore(derivePersonalMemoryDir(engineRoot), derivePersonalControlDir(engineRoot));
|
|
70
68
|
if (personal !== undefined)
|
|
71
69
|
return personal;
|
|
72
70
|
personal = seatOf("personal", memoryPlaneStore("personal", backend, engineRoot, onIncident));
|
|
@@ -76,23 +74,24 @@ export function createMemoryDeployment(input) {
|
|
|
76
74
|
}
|
|
77
75
|
return personal;
|
|
78
76
|
};
|
|
79
|
-
const hasPersonalStore = () => pinned && storeHoldsRecord(derivePersonalMemoryDir(engineRoot), derivePersonalControlDir(engineRoot));
|
|
77
|
+
const hasPersonalStore = () => pinned && (storeHoldsRecord(derivePersonalMemoryDir(engineRoot), derivePersonalControlDir(engineRoot)) || storeAbsence(derivePersonalControlDir(engineRoot)) !== undefined);
|
|
80
78
|
const stores = () => (hasPersonalStore() ? [project, personalStore()] : [project]);
|
|
81
|
-
const storeOfPlane = (plane) => (plane === "personal" && pinned ? personalStore() : project);
|
|
82
79
|
const planeOf = (scope) => memoryScopePlaneOf(FACE, scope, scopeContract);
|
|
83
|
-
const
|
|
80
|
+
const planesOf = (req, personalInSet) => {
|
|
81
|
+
const seat = (scope) => (pinned ? planeOf(scope) : "project");
|
|
84
82
|
const select = req.select;
|
|
85
83
|
if ("scope" in select)
|
|
86
|
-
return [
|
|
84
|
+
return [seat(select.scope)];
|
|
87
85
|
if (req.expectedScopes !== undefined) {
|
|
88
|
-
const seats = new Set(canonicalExpectedScopes(req.expectedScopes).map(
|
|
86
|
+
const seats = new Set(canonicalExpectedScopes(req.expectedScopes).map(seat));
|
|
89
87
|
if (seats.size > 1) {
|
|
90
88
|
throw coded("eraseMemoryEntries: the request's expectedScopes name scopes kept in two of this deployment's memory stores, and one request is judged in one store's lock — send one request per store (nothing was deleted, nothing was recorded; no scope is reported)", "config.memory_erasure_scope");
|
|
91
89
|
}
|
|
92
|
-
return [[...seats][0] ?? project];
|
|
90
|
+
return [[...seats][0] ?? "project"];
|
|
93
91
|
}
|
|
94
|
-
return [
|
|
92
|
+
return personalInSet ? ["project", "personal"] : ["project"];
|
|
95
93
|
};
|
|
94
|
+
const reachOf = (req, personalInSet) => planesOf(req, personalInSet).map((plane) => (plane === "personal" ? personalStore() : project));
|
|
96
95
|
return {
|
|
97
96
|
stores: () => stores(),
|
|
98
97
|
async eraseMemoryEntries(raw) {
|
|
@@ -100,6 +99,7 @@ export function createMemoryDeployment(input) {
|
|
|
100
99
|
const bad = erasureRequestInvalid(req);
|
|
101
100
|
if (bad !== undefined)
|
|
102
101
|
throw coded(`eraseMemoryEntries: ${bad}`, "config.memory_erasure_request");
|
|
102
|
+
refuseAbsentPlaneStores(backend, engineRoot, planesOf(req, hasPersonalStore()).includes("personal") || !existsSync(engineRoot));
|
|
103
103
|
const lockDir = join(engineRoot, MEMORY_DEPLOYMENT_ERASURE_LOCK_DIR);
|
|
104
104
|
const lock = await acquireStoreTxnLock(lockDir, { now: Date.now });
|
|
105
105
|
let lost;
|
|
@@ -125,8 +125,9 @@ export function createMemoryDeployment(input) {
|
|
|
125
125
|
throw new ControlPlaneCorruptError(`eraseMemoryEntries: the deployment's erasure lock was lost ${when} (the holder stalled past its stale line and another erasure took it) — the stores this request executed keep their anchors; a replay of the same requestId converges them`, { cause: lost, facet: "lock-ownership" });
|
|
126
126
|
};
|
|
127
127
|
try {
|
|
128
|
-
const
|
|
129
|
-
const reach = reachOf(req,
|
|
128
|
+
const personalInSet = hasPersonalStore();
|
|
129
|
+
const reach = reachOf(req, personalInSet);
|
|
130
|
+
const all = personalInSet && storeAbsence(derivePersonalControlDir(engineRoot)) === undefined ? [project, personalStore()] : [project];
|
|
130
131
|
const grant = req.expectedScopes !== undefined ? canonicalExpectedScopes(req.expectedScopes) : undefined;
|
|
131
132
|
const selectHash = erasureSelectHash(req.select);
|
|
132
133
|
for (const store of new Set([...all, ...reach])) {
|
|
@@ -166,8 +167,17 @@ export function createMemoryDeployment(input) {
|
|
|
166
167
|
lock.release();
|
|
167
168
|
}
|
|
168
169
|
},
|
|
169
|
-
async sessionMemoryStatus(sessionId) {
|
|
170
|
-
|
|
170
|
+
async sessionMemoryStatus(sessionId, given) {
|
|
171
|
+
let incarnation;
|
|
172
|
+
let onSeparated;
|
|
173
|
+
try {
|
|
174
|
+
incarnation = given?.incarnation;
|
|
175
|
+
onSeparated = given?.onSeparated?.bind(given);
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
}
|
|
179
|
+
const identity = given === undefined ? undefined : { ...(incarnation !== undefined ? { incarnation } : {}), ...(onSeparated !== undefined ? { onSeparated } : {}) };
|
|
180
|
+
const rows = [{ plane: "project", ...(await project.engine.sessionMemoryStatusRead(sessionId, identity)) }];
|
|
171
181
|
const inSet = hasPersonalStore();
|
|
172
182
|
if (inSet || (pinned && memoryCaptureRecordStore !== undefined)) {
|
|
173
183
|
let seat;
|
|
@@ -177,7 +187,7 @@ export function createMemoryDeployment(input) {
|
|
|
177
187
|
catch {
|
|
178
188
|
seat = undefined;
|
|
179
189
|
}
|
|
180
|
-
const read = seat !== undefined ? await seat.engine.sessionMemoryStatusRead(sessionId) : { status: { optOutSource: "fault" }, writeHome: { state: "unreadable" } };
|
|
190
|
+
const read = seat !== undefined ? await seat.engine.sessionMemoryStatusRead(sessionId, identity) : { status: { optOutSource: "fault" }, writeHome: { state: "unreadable" } };
|
|
181
191
|
if (inSet || read.status.optOutSource !== undefined)
|
|
182
192
|
rows.push({ plane: "personal", ...read });
|
|
183
193
|
}
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
* `scopes` is what the task asked to mount — every read scope and the write scope when it is a further one (the whole span failed, not
|
|
11
11
|
* one scope's mount), `cause` the closed set below, and `outsideReason` exactly when `cause` is `memory.target_outside_store` (which case
|
|
12
12
|
* of it the refusal named) — never the thrown text and never a path (a store-form refusal's `detail.path` stays on the operator's lane).
|
|
13
|
+
*
|
|
14
|
+
* The same causes, and the same words, say why a capture opt-out could not be recorded (`memory.capture_optout_unpersisted`): its cause
|
|
15
|
+
* set is this one plus the record store's own failure, and the retry word each cause carries is derived here, once.
|
|
13
16
|
*/
|
|
14
17
|
import type { EngineNotice } from "../types.js";
|
|
15
18
|
import { type StoreFormRefusalCode, type StoreFormRefusalReading, type TargetOutsideStoreReason } from "./layout.js";
|
|
@@ -33,4 +36,65 @@ export declare function memoryMountFailedNotice(input: {
|
|
|
33
36
|
sessionId: string;
|
|
34
37
|
scopes: readonly string[];
|
|
35
38
|
} & MemoryMountFailedReading): EngineNotice;
|
|
39
|
+
/** What a retry of the refused request can expect. `until_fixed`: until someone changes something, the same request fails the same way —
|
|
40
|
+
* said only when the engine can tell. `transient`: the same request may succeed — said whenever the engine cannot tell it will fail
|
|
41
|
+
* ("may", not "will"). */
|
|
42
|
+
export type CaptureOptOutUnpersistedRetry = "transient" | "until_fixed";
|
|
43
|
+
/** Why a capture opt-out could not be recorded (`memory.capture_optout_unpersisted`'s `detail.cause` — this table's keys), and the retry word
|
|
44
|
+
* each cause carries, derived here and nowhere else (a consumer that only asks "retry or not" reads `detail.retry` and keeps no table).
|
|
45
|
+
* `record_unpersisted`: the record store did not durably land the record (or the in-flight guard before it failed); every other cause is
|
|
46
|
+
* why the memory phase failed before the record was made — a mount failure's cause ({@link MemoryMountFailedCause}), read by its one
|
|
47
|
+
* reader. The store-form family is `until_fixed` — the layout the engine was handed is not the one it needs, and the same request is
|
|
48
|
+
* refused until it is; `record_unpersisted` and `unclassified` are `transient` — a record store briefly unavailable heals, a read-only
|
|
49
|
+
* volume does not, and the engine cannot tell which. `satisfies` over the mount causes and the record's own: a cause added to the mount
|
|
50
|
+
* failures without its word here is a tsc error. */
|
|
51
|
+
export declare const CAPTURE_OPTOUT_UNPERSISTED_RETRY: Readonly<{
|
|
52
|
+
readonly record_unpersisted: "transient";
|
|
53
|
+
readonly "memory.target_outside_store": "until_fixed";
|
|
54
|
+
readonly "memory.scope_home_not_directory": "until_fixed";
|
|
55
|
+
readonly "memory.control_plane_links_unsupported": "until_fixed";
|
|
56
|
+
readonly "memory.control_plane_strays": "until_fixed";
|
|
57
|
+
readonly "memory.store_root_sensitive": "until_fixed";
|
|
58
|
+
readonly "memory.control_plane_split": "until_fixed";
|
|
59
|
+
readonly "memory.store_absent": "until_fixed";
|
|
60
|
+
readonly unclassified: "transient";
|
|
61
|
+
}>;
|
|
62
|
+
export type CaptureOptOutUnpersistedCause = keyof typeof CAPTURE_OPTOUT_UNPERSISTED_RETRY;
|
|
63
|
+
/** Why one opt-out could not be recorded: the record store's own failure, or a mount failure's reading (its case too, for the code with cases). */
|
|
64
|
+
export type CaptureOptOutUnpersistedReading = {
|
|
65
|
+
readonly cause: "record_unpersisted";
|
|
66
|
+
} | MemoryMountFailedReading;
|
|
67
|
+
/** Why a mark answered `"unpersisted"`, read off the store it was made in: that store expected at `controlDir` and absent
|
|
68
|
+
* ({@link storeAbsence}) ⇒ {@link STORE_ABSENT}; else the record store did not land the record. Both ingresses' marks read it. */
|
|
69
|
+
export declare function captureMarkUnpersistedReadingOf(controlDir: string): CaptureOptOutUnpersistedReading;
|
|
70
|
+
/** The two clauses every receipt of a refused opt-out says — why the record did not land, and what a retry can expect (the cause's
|
|
71
|
+
* retry word, then how it is restored) — written once for the notice and for the error the run or the verb is refused with. A reading
|
|
72
|
+
* whose cause is not one of {@link CAPTURE_OPTOUT_UNPERSISTED_RETRY}'s keys (an untyped caller's `{ sessionId, ingress }` without one),
|
|
73
|
+
* or that names the code with cases without one of its cases, is a `TypeError`: why the opt-out was not recorded is never said as
|
|
74
|
+
* `undefined`, nor its retry word guessed. */
|
|
75
|
+
export declare function captureOptOutUnpersistedWords(reading: CaptureOptOutUnpersistedReading): {
|
|
76
|
+
readonly why: string;
|
|
77
|
+
readonly retry: string;
|
|
78
|
+
};
|
|
79
|
+
/** The `detail` members a refused opt-out carries beside its session — the notice's and the error's alike: the cause, the retry word derived
|
|
80
|
+
* from it, and exactly for `memory.target_outside_store` which case. */
|
|
81
|
+
export declare function captureOptOutUnpersistedDetail(reading: CaptureOptOutUnpersistedReading): {
|
|
82
|
+
cause: CaptureOptOutUnpersistedCause;
|
|
83
|
+
retry: CaptureOptOutUnpersistedRetry;
|
|
84
|
+
outsideReason?: TargetOutsideStoreReason;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* design/383 §2.8 — the opt-out that could NOT be honored (`memory.capture_optout_unpersisted`, audience `user`; dedup unit: once per
|
|
88
|
+
* ATTEMPT — nothing latches between attempts: `deliverEngineNotice` does not dedup and a mark answering `"unpersisted"` is not recorded
|
|
89
|
+
* in-process). Minted ONLY beside the typed throw carrying the same code, never beside a success. The declaration ingress refuses the
|
|
90
|
+
* RUN — a declared opt-out, or a spawning session's floor, whose record was not made: its mark answered `"unpersisted"`, or the memory
|
|
91
|
+
* phase failed before the mark; the host FLIP VERB's throw rejects only the verb promise, so the run continues with capture still ON.
|
|
92
|
+
* The message is written per ingress for that reason ("nothing was captured" is false on the flip arm, where the run goes on capturing),
|
|
93
|
+
* and `ingress` rides `detail` so a consumer branches without parsing prose; without it the text says only what is true on both faces.
|
|
94
|
+
* Why it was not recorded and what a retry can expect ride `detail` too ({@link captureOptOutUnpersistedDetail}) and are said in words.
|
|
95
|
+
*/
|
|
96
|
+
export declare function memoryCaptureOptOutUnpersistedNotice(input: {
|
|
97
|
+
sessionId: string;
|
|
98
|
+
ingress?: "declaration" | "flip-verb";
|
|
99
|
+
} & CaptureOptOutUnpersistedReading): EngineNotice;
|
|
36
100
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { storeFormRefusalReadingOf } from "./layout.js";
|
|
1
|
+
import { STORE_ABSENT, storeAbsence, storeFormRefusalReadingOf } from "./layout.js";
|
|
2
2
|
const OPERATOR_TAIL = "Whoever runs this deployment can do this (the service log names the exact step); the next run mounts it again.";
|
|
3
3
|
const OUTSIDE = {
|
|
4
4
|
act_outside: {
|
|
@@ -28,6 +28,7 @@ const CLAUSE = {
|
|
|
28
28
|
"memory.control_plane_strays": "memory records from an earlier setup are still kept beside the current ones, and nothing reads them",
|
|
29
29
|
"memory.store_root_sensitive": "the memory store is configured inside a directory the engine's write guard protects (a credential or access-control directory)",
|
|
30
30
|
"memory.control_plane_split": "since the memory store's location was moved, what is kept beside it stands in two places that disagree",
|
|
31
|
+
"memory.store_absent": "the memory store this deployment had is no longer where it was set up (its folder was moved away, or the disk it lives on is not mounted)",
|
|
31
32
|
unclassified: "the memory store could not be opened",
|
|
32
33
|
};
|
|
33
34
|
const RESTORE = {
|
|
@@ -36,6 +37,7 @@ const RESTORE = {
|
|
|
36
37
|
"memory.control_plane_strays": "merge the memory records the earlier setup left beside the current ones",
|
|
37
38
|
"memory.store_root_sensitive": "point the memory store at a directory outside the protected one",
|
|
38
39
|
"memory.control_plane_split": "keep one of the two copies of each record the service log names and remove the other",
|
|
40
|
+
"memory.store_absent": "put the memory folder back where it was, or mount its disk (it opens again as it was); to start over with empty memory on purpose instead, start the service again — unless the service is set up to require this memory, which then has to be set up again as a new, empty memory",
|
|
39
41
|
unclassified: "check the service log for why the memory store could not be opened",
|
|
40
42
|
};
|
|
41
43
|
export function memoryMountFailedReadingOf(thrown) {
|
|
@@ -44,8 +46,11 @@ export function memoryMountFailedReadingOf(thrown) {
|
|
|
44
46
|
return { cause: "unclassified" };
|
|
45
47
|
return "outsideReason" in refusal ? { cause: refusal.code, outsideReason: refusal.outsideReason } : { cause: refusal.code };
|
|
46
48
|
}
|
|
49
|
+
function mountFailedWordsOf(reading) {
|
|
50
|
+
return "outsideReason" in reading ? OUTSIDE[reading.outsideReason] : { clause: CLAUSE[reading.cause], restore: RESTORE[reading.cause], tail: OPERATOR_TAIL };
|
|
51
|
+
}
|
|
47
52
|
export function memoryMountFailedNotice(input) {
|
|
48
|
-
const words =
|
|
53
|
+
const words = mountFailedWordsOf(input);
|
|
49
54
|
return {
|
|
50
55
|
code: "memory.mount_failed",
|
|
51
56
|
message: `Memory did not mount for this session: ${words.clause}. The task runs without it — stored memory is not available to the assistant, ` +
|
|
@@ -53,3 +58,46 @@ export function memoryMountFailedNotice(input) {
|
|
|
53
58
|
detail: { sessionId: input.sessionId, scopes: [...input.scopes], cause: input.cause, ...("outsideReason" in input ? { outsideReason: input.outsideReason } : {}) },
|
|
54
59
|
};
|
|
55
60
|
}
|
|
61
|
+
export const CAPTURE_OPTOUT_UNPERSISTED_RETRY = Object.freeze({
|
|
62
|
+
record_unpersisted: "transient",
|
|
63
|
+
"memory.target_outside_store": "until_fixed",
|
|
64
|
+
"memory.scope_home_not_directory": "until_fixed",
|
|
65
|
+
"memory.control_plane_links_unsupported": "until_fixed",
|
|
66
|
+
"memory.control_plane_strays": "until_fixed",
|
|
67
|
+
"memory.store_root_sensitive": "until_fixed",
|
|
68
|
+
"memory.control_plane_split": "until_fixed",
|
|
69
|
+
"memory.store_absent": "until_fixed",
|
|
70
|
+
unclassified: "transient",
|
|
71
|
+
});
|
|
72
|
+
export function captureMarkUnpersistedReadingOf(controlDir) {
|
|
73
|
+
return storeAbsence(controlDir) !== undefined ? { cause: STORE_ABSENT } : { cause: "record_unpersisted" };
|
|
74
|
+
}
|
|
75
|
+
const RECORD_UNPERSISTED = { clause: "the record store did not accept the write", restore: "repair the control plane (or the capture record store)" };
|
|
76
|
+
export function captureOptOutUnpersistedWords(reading) {
|
|
77
|
+
const own = (table, key) => typeof key === "string" && Object.prototype.hasOwnProperty.call(table, key);
|
|
78
|
+
const cause = reading.cause;
|
|
79
|
+
const withCases = own(CAPTURE_OPTOUT_UNPERSISTED_RETRY, cause) && cause !== "record_unpersisted" && !own(CLAUSE, cause);
|
|
80
|
+
if (!own(CAPTURE_OPTOUT_UNPERSISTED_RETRY, cause) || (withCases && !own(OUTSIDE, reading.outsideReason))) {
|
|
81
|
+
throw new TypeError(`memory.capture_optout_unpersisted: the reading's cause must be one of ${Object.keys(CAPTURE_OPTOUT_UNPERSISTED_RETRY).join(", ")} — the code with cases with one of ${Object.keys(OUTSIDE).join(", ")} (got ${typeof cause === "string" ? JSON.stringify(cause) : cause === undefined ? "no cause" : typeof cause})`);
|
|
82
|
+
}
|
|
83
|
+
const words = reading.cause === "record_unpersisted" ? RECORD_UNPERSISTED : mountFailedWordsOf(reading);
|
|
84
|
+
const why = reading.cause === "record_unpersisted" ? words.clause : `memory did not mount: ${words.clause}`;
|
|
85
|
+
return { why, retry: CAPTURE_OPTOUT_UNPERSISTED_RETRY[reading.cause] === "until_fixed" ? `a retry fails the same way until this is fixed: ${words.restore}` : `a retry may succeed; if it keeps failing, ${words.restore}` };
|
|
86
|
+
}
|
|
87
|
+
export function captureOptOutUnpersistedDetail(reading) {
|
|
88
|
+
return { cause: reading.cause, retry: CAPTURE_OPTOUT_UNPERSISTED_RETRY[reading.cause], ...("outsideReason" in reading ? { outsideReason: reading.outsideReason } : {}) };
|
|
89
|
+
}
|
|
90
|
+
export function memoryCaptureOptOutUnpersistedNotice(input) {
|
|
91
|
+
const { why, retry } = captureOptOutUnpersistedWords(input);
|
|
92
|
+
const shared = `The memory capture opt-out for this session could not be durably recorded (${why}), so it was NOT honored: no record was made and this session's memory capture is not off.`;
|
|
93
|
+
const consequence = input.ingress === "declaration"
|
|
94
|
+
? ` The session is REFUSED rather than run under an opt-out that would silently stop holding at the next resume — nothing ran, and nothing was captured; ${retry}.`
|
|
95
|
+
: input.ingress === "flip-verb"
|
|
96
|
+
? ` Only the opt-out REQUEST was rejected: this run continues and its memory capture is still ON, so it goes on capturing; ${retry} — or stop the run if the session must not be captured.`
|
|
97
|
+
: ` What a retry can expect: ${retry}.`;
|
|
98
|
+
return {
|
|
99
|
+
code: "memory.capture_optout_unpersisted",
|
|
100
|
+
message: `${shared}${consequence}`,
|
|
101
|
+
detail: { sessionId: input.sessionId, ...(input.ingress !== undefined ? { ingress: input.ingress } : {}), ...captureOptOutUnpersistedDetail(input) },
|
|
102
|
+
};
|
|
103
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type ProjectionLedgerRow } from "./layout.js";
|
|
2
|
+
import type { MemoryEntry, MemoryEntryHeader } from "./types.js";
|
|
3
|
+
/** What one mount did with the recorded seats of the scopes it mounted. */
|
|
4
|
+
export interface ProjectionRetirement {
|
|
5
|
+
/** Rows this mount is done with: each leaves the ledger by its identity. */
|
|
6
|
+
readonly judged: ProjectionLedgerRow[];
|
|
7
|
+
/** Files left as found because their content changed after the engine placed it, the entry's id still on them (a change the store has not taken). */
|
|
8
|
+
readonly changed: ProjectionLedgerRow[];
|
|
9
|
+
/** Files left as found because another note now stands at the seat — one with no id or with another entry's id — and nothing of the placed copy is left in it. */
|
|
10
|
+
readonly replaced: ProjectionLedgerRow[];
|
|
11
|
+
/** Files that were to be removed and were not: their rows stay for the next mount. */
|
|
12
|
+
readonly failed: Array<{
|
|
13
|
+
readonly row: ProjectionLedgerRow;
|
|
14
|
+
readonly why: string;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Judge every row of a mounted scope whose seat this mount projects no entry onto. `homes` maps each mounted scope to its home
|
|
19
|
+
* directory; `entries` are the entries this mount read (the projection pass writes each one's seat but a repo-ingested one's)
|
|
20
|
+
* and `headers` the store's listing they were read from — a seat the listing names but the entry read did not answer (an entry
|
|
21
|
+
* removed between the two reads) is not retired on this mount. `beforeRemove` is the caller's store-boundary check, run before a
|
|
22
|
+
* seat is moved (it throws to refuse, and the refusal is the caller's). A seat is removed by moving it aside and judging the
|
|
23
|
+
* moved bytes again: bytes a writer put there meanwhile go back without replacing anything.
|
|
24
|
+
*/
|
|
25
|
+
export declare function retireGoneProjections(rows: readonly ProjectionLedgerRow[], mount: {
|
|
26
|
+
readonly homes: ReadonlyMap<string, string>;
|
|
27
|
+
readonly entries: readonly Pick<MemoryEntry, "id" | "scope" | "slug" | "frontmatter">[];
|
|
28
|
+
readonly headers: readonly Pick<MemoryEntryHeader, "id" | "scope" | "slug">[];
|
|
29
|
+
readonly beforeRemove: (path: string) => void;
|
|
30
|
+
readonly now: () => number;
|
|
31
|
+
}): ProjectionRetirement;
|
|
32
|
+
/** What a mount says about the files it left: one line per file, by scope — the seat only, never content. The announcement
|
|
33
|
+
* renderer keeps an item to the inline label bound (160 characters), so the quoted seat is held to its room and what a person
|
|
34
|
+
* acts on comes before a cause (a seat name cut past that bound would take the rest of the line with it). Three arms, each
|
|
35
|
+
* saying what is true of it: a copy changed here (it may be saved back unless the file goes), something else standing at the
|
|
36
|
+
* seat (nothing is asked of the person), a copy that could not be removed. */
|
|
37
|
+
export declare function retirementNotices(r: ProjectionRetirement): Map<string | undefined, string[]>;
|
|
38
|
+
/** The one wording of a ledger fault: unreadable at a mount (nothing removed — the notice is said before the record is written, so
|
|
39
|
+
* it claims no rebuild), replaced by a harvest (said only once a write replaced it), or not written. The cause comes last (see
|
|
40
|
+
* {@link retirementNotices}). */
|
|
41
|
+
export declare function ledgerFaultNotice(fault: "read" | "rebuilt" | "write", why?: string): string;
|
|
42
|
+
/** The harvest half: the rows for the candidate seats (under `scope`'s `home`) whose file now holds exactly the content the store
|
|
43
|
+
* took — it parses to the candidate's `id` with its `rev`. A candidate whose file reads otherwise is not recorded. */
|
|
44
|
+
export declare function projectionsHeldAt(candidates: Iterable<{
|
|
45
|
+
readonly path: string;
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly rev: string;
|
|
48
|
+
}>, scope: string, home: string): ProjectionLedgerRow[];
|