@sema-agent/core 7.70.0 → 7.71.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 +728 -0
- package/dist/agents/agent-transcript-tool.js +43 -19
- package/dist/agents/inherited-tool-pool.d.ts +5 -1
- package/dist/agents/inherited-tool-pool.js +6 -0
- package/dist/agents/retain-ledger.js +2 -0
- package/dist/agents/send-message-tool.d.ts +12 -1
- package/dist/agents/send-message-tool.js +47 -9
- package/dist/agents/subagent.js +31 -10
- package/dist/agents/tool-filter.js +1 -2
- package/dist/agents/verify.js +13 -2
- package/dist/agents/yield-adoption.js +11 -1
- package/dist/brain/claude-model-id.d.ts +11 -0
- package/dist/brain/claude-model-id.js +3 -1
- package/dist/config/catalog.js +10 -1
- package/dist/config/defaults.d.ts +3 -0
- package/dist/config/defaults.js +1 -0
- package/dist/core/allow-entry.js +1 -2
- package/dist/core/ask-origin.d.ts +55 -21
- package/dist/core/ask-origin.js +19 -11
- package/dist/core/ask-question.d.ts +4 -7
- package/dist/core/ask-question.js +2 -4
- package/dist/core/ask-unresolvable-notice.d.ts +17 -3
- package/dist/core/ask-unresolvable-notice.js +18 -4
- package/dist/core/attachment-source.d.ts +1 -1
- package/dist/core/attachment-source.js +2 -0
- package/dist/core/auto-compaction.d.ts +14 -4
- package/dist/core/auto-compaction.js +3 -2
- package/dist/core/auto-strip.js +2 -0
- package/dist/core/caller-text.d.ts +2 -33
- package/dist/core/caller-text.js +2 -23
- package/dist/core/caller-tool-name.js +1 -2
- package/dist/core/canonical-json.d.ts +9 -0
- package/dist/core/canonical-json.js +6 -0
- package/dist/core/checkpoint-features.d.ts +43 -80
- package/dist/core/checkpoint-features.js +10 -20
- package/dist/core/checkpoint-generation.d.ts +89 -19
- package/dist/core/checkpoint-generation.js +89 -14
- package/dist/core/checkpoint-queries.d.ts +95 -15
- package/dist/core/checkpoint-queries.js +108 -7
- package/dist/core/checkpoint-rekey.d.ts +2 -1
- package/dist/core/checkpoint-rekey.js +2 -2
- package/dist/core/checkpoint-requirements.d.ts +7 -6
- package/dist/core/checkpoint-requirements.js +2 -5
- package/dist/core/checkpoint-row-verdict.d.ts +3 -4
- package/dist/core/checkpoint-row-verdict.js +20 -41
- package/dist/core/checkpoint-store.d.ts +65 -41
- package/dist/core/checkpoint-store.js +28 -14
- package/dist/core/command-sandbox.d.ts +5 -3
- package/dist/core/command-sandbox.js +17 -9
- package/dist/core/config-refusal-codes.d.ts +1 -1
- package/dist/core/config-refusal-codes.js +1 -0
- package/dist/core/declaration-words.d.ts +2 -1
- package/dist/core/declaration-words.js +13 -2
- package/dist/core/effective-path-target.d.ts +23 -0
- package/dist/core/effective-path-target.js +15 -1
- package/dist/core/engine-attestation.d.ts +5 -1
- package/dist/core/engine-attestation.js +1 -0
- package/dist/core/engine-capabilities.d.ts +14 -9
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +62 -32
- package/dist/core/engine-version.js +1 -1
- package/dist/core/entries-not-applied.d.ts +1 -1
- package/dist/core/entries-not-applied.js +1 -0
- package/dist/core/file-history-store.d.ts +95 -11
- package/dist/core/file-history-store.js +117 -19
- package/dist/core/gate-fold.js +13 -7
- package/dist/core/gate-lanes.js +9 -9
- package/dist/core/governance-codes.d.ts +56 -7
- package/dist/core/governance-codes.js +105 -7
- package/dist/core/grant-holder.d.ts +53 -0
- package/dist/core/grant-holder.js +80 -0
- package/dist/core/hooks.d.ts +7 -3
- package/dist/core/hooks.js +2 -2
- package/dist/core/locked-config.d.ts +7 -1
- package/dist/core/locked-config.js +9 -2
- package/dist/core/mcp-call-meta.d.ts +52 -7
- package/dist/core/mcp-call-meta.js +21 -2
- package/dist/core/mcp-host-read.d.ts +1 -1
- package/dist/core/mcp-server-spec.d.ts +18 -0
- package/dist/core/mcp-server-spec.js +1 -0
- package/dist/core/mcp.js +2 -2
- package/dist/core/member-outcome.d.ts +22 -1
- package/dist/core/member-outcome.js +18 -6
- package/dist/core/memory-engine/delegation-settlement.js +5 -5
- package/dist/core/memory-engine/engine.js +19 -19
- package/dist/core/memory-engine/file-backend.d.ts +7 -2
- package/dist/core/memory-engine/file-backend.js +14 -12
- package/dist/core/memory-engine/frontmatter.js +1 -1
- package/dist/core/memory-engine/index.d.ts +1 -0
- package/dist/core/memory-engine/index.js +1 -0
- package/dist/core/memory-engine/layout.d.ts +34 -9
- package/dist/core/memory-engine/layout.js +36 -19
- package/dist/core/memory-engine/memory-deployment.js +8 -8
- package/dist/core/memory-engine/mount-failed-notice.d.ts +8 -5
- package/dist/core/memory-engine/mount-failed-notice.js +5 -2
- package/dist/core/mode-policy.d.ts +5 -0
- package/dist/core/mode-policy.js +6 -0
- package/dist/core/mods/host.d.ts +2 -1
- package/dist/core/mods/host.js +7 -6
- package/dist/core/mods/kernel/index.d.ts +1 -1
- package/dist/core/mods/kernel/index.js +1 -1
- package/dist/core/mods/kernel/registration.d.ts +5 -2
- package/dist/core/mods/kernel/registration.js +19 -3
- package/dist/core/mods/package.d.ts +12 -1
- package/dist/core/mods/package.js +36 -9
- package/dist/core/mods/stations.d.ts +7 -1
- package/dist/core/mods/stations.js +17 -3
- package/dist/core/mods/teammate-stations.d.ts +4 -1
- package/dist/core/mods/teammate-stations.js +1 -1
- package/dist/core/native-signal.d.ts +13 -0
- package/dist/core/native-signal.js +18 -0
- package/dist/core/park-resumability.d.ts +16 -14
- package/dist/core/park-resumability.js +9 -4
- package/dist/core/path-rule-binding.js +1 -1
- package/dist/core/permission-rule-model.d.ts +11 -5
- package/dist/core/permission-rule-model.js +5 -3
- package/dist/core/permission-rule-org.js +1 -1
- package/dist/core/permission-rule-provider.d.ts +5 -1
- package/dist/core/permission-rule-provider.js +6 -1
- package/dist/core/permission-rule-session.d.ts +35 -5
- package/dist/core/permission-rule-session.js +32 -1
- package/dist/core/permission-rule-store.d.ts +5 -1
- package/dist/core/permission-rule-store.js +28 -5
- package/dist/core/permission-rules.d.ts +2 -2
- package/dist/core/permission-rules.js +2 -3
- package/dist/core/principal-name.d.ts +12 -0
- package/dist/core/principal-name.js +6 -2
- package/dist/core/read-root-grant-screen.d.ts +7 -6
- package/dist/core/read-root-grant-screen.js +7 -8
- package/dist/core/remote-env.d.ts +42 -8
- package/dist/core/resume-config-judge.js +1 -1
- package/dist/core/resume-startup-cause.d.ts +19 -4
- package/dist/core/resume-startup-cause.js +25 -6
- package/dist/core/rewind-conversation.d.ts +4 -0
- package/dist/core/rewrite-rejudge.d.ts +9 -1
- package/dist/core/rewrite-rejudge.js +11 -1
- package/dist/core/rule-offer-read.js +3 -2
- package/dist/core/runner/assemble-result.d.ts +21 -11
- package/dist/core/runner/assemble-result.js +24 -4
- package/dist/core/runner/boundary-reminders.d.ts +104 -0
- package/dist/core/runner/boundary-reminders.js +108 -0
- package/dist/core/runner/branch-writeback.d.ts +21 -7
- package/dist/core/runner/branch-writeback.js +44 -6
- package/dist/core/runner/command-sandbox-frame.js +2 -1
- package/dist/core/runner/compact-session.js +11 -4
- package/dist/core/runner/constraint-layers.d.ts +24 -5
- package/dist/core/runner/constraint-layers.js +21 -2
- package/dist/core/runner/continuation-gate.js +3 -1
- package/dist/core/runner/contracts.d.ts +83 -13
- package/dist/core/runner/cross-boundary-lane.js +2 -1
- package/dist/core/runner/delegation-owner.d.ts +246 -45
- package/dist/core/runner/delegation-owner.js +237 -63
- package/dist/core/runner/expire-settle.d.ts +17 -0
- package/dist/core/runner/expire-settle.js +8 -2
- package/dist/core/runner/file-history-request.d.ts +4 -3
- package/dist/core/runner/file-history-request.js +4 -1
- package/dist/core/runner/file-history-restore.d.ts +11 -3
- package/dist/core/runner/file-history-restore.js +11 -3
- package/dist/core/runner/gate-exit.d.ts +22 -1
- package/dist/core/runner/gate-exit.js +12 -14
- package/dist/core/runner/nested-memory-content.js +1 -1
- package/dist/core/runner/nested-memory-lane.d.ts +10 -2
- package/dist/core/runner/nested-memory-lane.js +29 -8
- package/dist/core/runner/own-model-money-door.d.ts +13 -0
- package/dist/core/runner/own-model-money-door.js +17 -0
- package/dist/core/runner/park-commit.d.ts +4 -2
- package/dist/core/runner/park-commit.js +2 -1
- package/dist/core/runner/permission-rule-lanes.d.ts +4 -0
- package/dist/core/runner/permission-rule-lanes.js +7 -0
- package/dist/core/runner/person-path-rows.js +1 -1
- package/dist/core/runner/placement-fence.d.ts +8 -2
- package/dist/core/runner/placement-fence.js +8 -3
- package/dist/core/runner/policy-throw.d.ts +3 -2
- package/dist/core/runner/policy-throw.js +2 -2
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +23 -14
- package/dist/core/runner/prepare-acquire-reconcile.js +33 -15
- package/dist/core/runner/prepare-artifact.d.ts +14 -1
- package/dist/core/runner/prepare-artifact.js +7 -2
- package/dist/core/runner/prepare-ask-lane.d.ts +8 -0
- package/dist/core/runner/prepare-ask-lane.js +14 -5
- package/dist/core/runner/prepare-boundary-parks.js +5 -4
- package/dist/core/runner/prepare-config-doors.d.ts +9 -4
- package/dist/core/runner/prepare-config-doors.js +25 -8
- package/dist/core/runner/prepare-defer-classify.d.ts +8 -4
- package/dist/core/runner/prepare-defer-classify.js +6 -6
- package/dist/core/runner/prepare-execution-env.d.ts +4 -1
- package/dist/core/runner/prepare-execution-env.js +8 -3
- package/dist/core/runner/prepare-file-history.d.ts +26 -0
- package/dist/core/runner/prepare-file-history.js +15 -1
- package/dist/core/runner/prepare-inherited-gate.d.ts +8 -3
- package/dist/core/runner/prepare-inherited-gate.js +9 -2
- package/dist/core/runner/prepare-leg-adoption.d.ts +2 -2
- package/dist/core/runner/prepare-park-ask.js +8 -5
- package/dist/core/runner/prepare-policy-chain.d.ts +5 -0
- package/dist/core/runner/prepare-policy-chain.js +18 -7
- package/dist/core/runner/prepare-prompt-assembly.d.ts +3 -0
- package/dist/core/runner/prepare-prompt-assembly.js +4 -3
- package/dist/core/runner/prepare-suspend-saga.d.ts +4 -1
- package/dist/core/runner/prepare-suspend-saga.js +19 -5
- package/dist/core/runner/prepare-task.d.ts +2 -5
- package/dist/core/runner/prepare-task.js +71 -26
- package/dist/core/runner/prepare-turn-wiring.js +7 -5
- package/dist/core/runner/prepare-workspace-restore.js +59 -28
- package/dist/core/runner/read-root-grant.d.ts +1 -0
- package/dist/core/runner/read-root-grant.js +1 -2
- package/dist/core/runner/resume-admission.d.ts +3 -0
- package/dist/core/runner/resume-admission.js +6 -4
- package/dist/core/runner/resume-apply.js +7 -5
- package/dist/core/runner/resume-claim.d.ts +2 -2
- package/dist/core/runner/resume-claim.js +4 -4
- package/dist/core/runner/resume-policy-outcome.d.ts +1 -1
- package/dist/core/runner/resume-policy-outcome.js +6 -4
- package/dist/core/runner/resume-preflight.d.ts +3 -0
- package/dist/core/runner/resume-preflight.js +10 -3
- package/dist/core/runner/rewind-conversation.js +11 -4
- package/dist/core/runner/rewind-files.js +29 -14
- package/dist/core/runner/rewind-outcome.d.ts +27 -0
- package/dist/core/runner/rewind-outcome.js +14 -0
- package/dist/core/runner/run-attachment-seats.js +2 -1
- package/dist/core/runner/run-clock-and-content.js +2 -0
- package/dist/core/runner/run-identity-wiring.js +2 -0
- package/dist/core/runner/run-leg.js +11 -1
- package/dist/core/runner/run-notification-lane.d.ts +3 -0
- package/dist/core/runner/run-notification-lane.js +2 -2
- package/dist/core/runner/run-settle-and-teardown.d.ts +4 -2
- package/dist/core/runner/run-settle-and-teardown.js +52 -40
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -0
- package/dist/core/runner/run-stop-and-final-verify.js +5 -4
- package/dist/core/runner/run-terminal-adoption.d.ts +1 -1
- package/dist/core/runner/run-terminal-adoption.js +3 -3
- package/dist/core/runner/run-turn-boundary.js +7 -0
- package/dist/core/runner/runtask.d.ts +7 -4
- package/dist/core/runner/runtask.js +18 -9
- package/dist/core/runner/session-call-grant-station.d.ts +64 -0
- package/dist/core/runner/session-call-grant-station.js +119 -0
- package/dist/core/runner/session-file-state-replay.js +2 -2
- package/dist/core/runner/session-prompt-seats.d.ts +95 -0
- package/dist/core/runner/session-prompt-seats.js +62 -0
- package/dist/core/runner/session-rule-policy.js +1 -1
- package/dist/core/runner/session-write-ledger.d.ts +8 -0
- package/dist/core/runner/session-write-ledger.js +16 -0
- package/dist/core/runner/side-call-account.js +5 -1
- package/dist/core/runner/stop-tail-notice.d.ts +7 -0
- package/dist/core/runner/stop-tail-notice.js +23 -8
- package/dist/core/runner/stream-reap.js +4 -2
- package/dist/core/runner/stream-settle-backstop.d.ts +1 -1
- package/dist/core/runner/stream-settle-backstop.js +17 -18
- package/dist/core/runner/terminal-account.js +17 -8
- package/dist/core/runner/terminal-projection.d.ts +3 -2
- package/dist/core/runner/terminal-projection.js +1 -1
- package/dist/core/runner/tool-turn-repair-seat.d.ts +2 -2
- package/dist/core/runner/tool-turn-repair-seat.js +12 -7
- package/dist/core/runner/turn-attachments.d.ts +22 -1
- package/dist/core/runner/turn-attachments.js +20 -3
- package/dist/core/runner-deps.d.ts +6 -2
- package/dist/core/secret-env.d.ts +26 -6
- package/dist/core/secret-env.js +6 -6
- package/dist/core/session-call-grant-screen.d.ts +58 -0
- package/dist/core/session-call-grant-screen.js +18 -0
- package/dist/core/session-call-grant.d.ts +93 -0
- package/dist/core/session-call-grant.js +524 -0
- package/dist/core/session-checkout.d.ts +3 -0
- package/dist/core/session-checkout.js +8 -3
- package/dist/core/session-policy-store.d.ts +14 -0
- package/dist/core/session-policy-store.js +16 -2
- package/dist/core/session-store.d.ts +18 -1
- package/dist/core/session-store.js +20 -4
- package/dist/core/session.d.ts +36 -4
- package/dist/core/shared-artifact-reads.d.ts +93 -0
- package/dist/core/shared-artifact-reads.js +94 -0
- package/dist/core/skill-grant.js +1 -1
- package/dist/core/skills-directory.d.ts +9 -45
- package/dist/core/skills-directory.js +9 -722
- package/dist/core/spend-account.js +3 -0
- package/dist/core/store-contracts/checkpoint-store-contract.d.ts +22 -4
- package/dist/core/store-contracts/checkpoint-store-contract.js +363 -29
- package/dist/core/store-contracts/file-history-store-contract.d.ts +11 -3
- package/dist/core/store-contracts/file-history-store-contract.js +62 -2
- package/dist/core/store-contracts/grant-fixture.d.ts +52 -0
- package/dist/core/store-contracts/grant-fixture.js +84 -0
- package/dist/core/store-contracts/session-repo-contract.js +18 -0
- package/dist/core/store-contracts/session-store-contract.d.ts +15 -1
- package/dist/core/store-contracts/session-store-contract.js +211 -2
- package/dist/core/store-contracts/workflow-journal-store-contract.js +47 -8
- package/dist/core/suspend-lane-reasons.d.ts +13 -0
- package/dist/core/suspend-lane-reasons.js +5 -0
- package/dist/core/synthetic-read-verdict.d.ts +5 -3
- package/dist/core/synthetic-read-verdict.js +1 -1
- package/dist/core/task-limits.d.ts +15 -0
- package/dist/core/task-notification.d.ts +33 -7
- package/dist/core/task-notification.js +34 -9
- package/dist/core/task-registry-agent.d.ts +1 -1
- package/dist/core/task-registry-agent.js +18 -7
- package/dist/core/task-registry-shared.d.ts +29 -4
- package/dist/core/task-registry-shared.js +7 -0
- package/dist/core/task-registry.d.ts +21 -1
- package/dist/core/task-registry.js +36 -9
- package/dist/core/task-result.d.ts +55 -1
- package/dist/core/task-spec.d.ts +17 -3
- package/dist/core/terminal-cause.d.ts +68 -5
- package/dist/core/tool-catalog-entries.js +1 -1
- package/dist/core/tool-check-reading.js +2 -1
- package/dist/core/tool-errors.js +1 -0
- package/dist/core/tool-list-grammar.d.ts +0 -47
- package/dist/core/tool-list-grammar.js +1 -75
- package/dist/core/tool-model-gate.d.ts +7 -11
- package/dist/core/tool-model-gate.js +5 -8
- package/dist/core/tool-name-aliases.js +2 -3
- package/dist/core/tool-name-readings.d.ts +4 -0
- package/dist/core/tool-name-readings.js +1 -0
- package/dist/core/tool-policy.d.ts +46 -4
- package/dist/core/tool-policy.js +47 -18
- package/dist/core/tool-result-store.d.ts +0 -24
- package/dist/core/tool-result-store.js +1 -36
- package/dist/core/tool-spec.d.ts +8 -4
- package/dist/core/untrusted-egress.js +2 -2
- package/dist/core/untrusted-text.d.ts +8 -0
- package/dist/core/untrusted-text.js +14 -0
- package/dist/core/user-attachment.d.ts +16 -1
- package/dist/core/user-attachment.js +42 -18
- package/dist/core/wiring-manifest.d.ts +4 -9
- package/dist/core/wiring-manifest.js +1 -1
- package/dist/core/workflow-journal-store.d.ts +55 -8
- package/dist/core/workflow-journal-store.js +34 -10
- package/dist/core/workflow-run-store-contract.js +56 -1
- package/dist/core/workflow-run-store.d.ts +43 -19
- package/dist/core/workflow-run-store.js +17 -2
- package/dist/engine/execution-env/node-execution-env.d.ts +3 -0
- package/dist/engine/execution-env/node-execution-env.js +4 -0
- package/dist/engine/harness/agent-harness.d.ts +10 -5
- package/dist/engine/harness/agent-harness.js +12 -4
- package/dist/engine/harness/types.d.ts +18 -0
- package/dist/engine/llm/tool-turns.d.ts +1 -1
- package/dist/engine/llm/types.d.ts +5 -4
- package/dist/engine/session/memory-repo.d.ts +15 -3
- package/dist/engine/session/memory-repo.js +21 -3
- package/dist/engine/session/memory-storage.d.ts +5 -0
- package/dist/engine/session/memory-storage.js +8 -3
- package/dist/engine/session/repo-utils.d.ts +9 -0
- package/dist/engine/session/repo-utils.js +14 -0
- package/dist/engine/session/storage-base.d.ts +20 -7
- package/dist/engine/session/storage-base.js +13 -1
- package/dist/index.d.ts +37 -19
- package/dist/index.js +30 -15
- package/dist/internal/harness.d.ts +1 -1
- package/dist/internal/harness.js +1 -1
- package/dist/orchestration/run-workflow-tool.d.ts +13 -1
- package/dist/orchestration/run-workflow-tool.js +101 -32
- package/dist/orchestration/workflow-park-adoption.d.ts +309 -92
- package/dist/orchestration/workflow-park-adoption.js +588 -323
- package/dist/orchestration/workflow-tree-id.d.ts +66 -0
- package/dist/orchestration/workflow-tree-id.js +66 -0
- package/dist/orchestration/workflow-types.d.ts +90 -11
- package/dist/orchestration/workflow-types.js +10 -1
- package/dist/orchestration/workflow.d.ts +30 -4
- package/dist/orchestration/workflow.js +424 -114
- package/dist/prompt-assembly/catalog/constitution.js +5 -1
- package/dist/prompt-assembly/catalog/core-behavior.d.ts +3 -4
- package/dist/prompt-assembly/catalog/core-behavior.js +61 -22
- package/dist/prompt-assembly/catalog/environment.js +2 -2
- 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 +72 -44
- package/dist/prompt-assembly/catalog/locales/zh-Hans/environment.js +2 -2
- package/dist/prompt-assembly/catalog/locales/zh-Hans/events.js +2 -0
- package/dist/prompt-assembly/catalog/schema.d.ts +5 -1
- package/dist/prompt-assembly/catalog/schema.js +2 -0
- package/dist/prompt-assembly/catalog/sections.js +3 -14
- package/dist/prompt-assembly/event-registry.js +2 -0
- package/dist/prompt-assembly/select.js +1 -0
- package/dist/prompt-assembly/tool-catalog.d.ts +10 -7
- package/dist/prompt-assembly/tool-catalog.js +21 -7
- package/dist/prompt-assembly/types.d.ts +3 -0
- package/dist/prompts/default.d.ts +4 -1
- package/dist/prompts/default.js +6 -0
- package/dist/stores/file/checkpoint-store.d.ts +11 -10
- package/dist/stores/file/checkpoint-store.js +36 -10
- package/dist/stores/file/file-history-store.d.ts +6 -0
- package/dist/stores/file/file-history-store.js +21 -4
- package/dist/stores/file/fs-atomic.d.ts +1 -1
- package/dist/stores/file/index.d.ts +14 -4
- package/dist/stores/file/index.js +21 -5
- package/dist/stores/file/process-anchor.d.ts +9 -1
- package/dist/stores/file/session-policy-store.js +2 -17
- package/dist/stores/file/session-store.d.ts +27 -0
- package/dist/stores/file/session-store.js +81 -9
- package/dist/stores/file/workflow-journal-store.d.ts +14 -4
- package/dist/stores/file/workflow-journal-store.js +32 -24
- package/dist/stores/file/workflow-run-store.d.ts +15 -4
- package/dist/stores/file/workflow-run-store.js +76 -0
- package/dist/tools/artifact/artifact-tool.d.ts +10 -3
- package/dist/tools/artifact/artifact-tool.js +16 -1
- package/dist/tools/fs/bash-program-position.d.ts +10 -4
- package/dist/tools/fs/bash-program-position.js +11 -8
- package/dist/tools/fs/bash-readonly-classifier.d.ts +3 -1
- package/dist/tools/fs/bash-readonly-classifier.js +9 -2
- package/dist/tools/fs/find-actions.d.ts +30 -16
- package/dist/tools/fs/find-actions.js +272 -19
- package/dist/tools/fs/fs-bash.js +8 -5
- package/dist/tools/fs/fs-shared.d.ts +0 -29
- package/dist/tools/fs/fs-shared.js +0 -5
- package/dist/tools/fs/fs-write.js +2 -1
- package/dist/tools/fs/read-deny.d.ts +6 -1
- package/dist/tools/fs/read-deny.js +6 -1
- package/dist/tools/fs/read-floor.d.ts +6 -0
- package/dist/tools/fs/read-floor.js +5 -1
- package/dist/tools/fs/removal-actions.d.ts +43 -0
- package/dist/tools/fs/removal-actions.js +25 -0
- package/dist/tools/fs/removal-targets.d.ts +2 -21
- package/dist/tools/fs/removal-targets.js +2 -3
- package/dist/tools/fs/safety.d.ts +37 -1
- package/dist/tools/fs/safety.js +52 -0
- package/dist/tools/fs/shell-climb.d.ts +46 -0
- package/dist/tools/fs/shell-climb.js +79 -0
- package/dist/tools/fs/shell-read-check.js +47 -19
- package/dist/tools/fs/shell-read-establish.js +36 -22
- package/dist/tools/fs/shell-read-judge.d.ts +10 -2
- package/dist/tools/fs/shell-read-judge.js +4 -4
- package/dist/tools/fs/shell-read-plan.d.ts +3 -0
- package/dist/tools/fs/shell-read-plan.js +1 -1
- package/dist/tools/fs/shell-read-workdir.js +3 -2
- package/dist/tools/fs/shell-read-write-targets.d.ts +4 -3
- package/dist/tools/fs/shell-read-write-targets.js +3 -0
- package/package.json +2 -2
- package/test/export-surface.snapshot.json +169 -15
- package/wire-changes/core-stores-sql@7.71.0.json +40 -0
- package/wire-changes/core@7.71.0.json +5827 -0
- package/wire-changes/mods-kernel@7.71.0.json +52 -0
- package/wire-changes/primitives@7.71.0.json +473 -0
- package/wire-changes/wiki-gate@7.71.0.json +40 -0
- package/dist/core/frontmatter-fence.d.ts +0 -10
- package/dist/core/frontmatter-fence.js +0 -6
- package/dist/core/permission-rule-syntax.d.ts +0 -46
- package/dist/core/permission-rule-syntax.js +0 -52
|
@@ -18,11 +18,12 @@
|
|
|
18
18
|
* are still told at the resume.
|
|
19
19
|
*
|
|
20
20
|
* ORDER (one law: the specific before the general): a newer row is refused as newer before any segment of it is read (the
|
|
21
|
-
* version ceiling, then a reader word this worker lacks); then a row
|
|
21
|
+
* version ceiling, then a reader word this worker lacks); then a pending row that records its action's outcome; then a row below
|
|
22
|
+
* the format, as a retired seat (the floor: no arm reads such a row); then a row whose members do not read as every reader reads them — its
|
|
22
23
|
* pause, its state, its stamps (a row with no segment for the arms below to read is damaged, whatever its version; the one table
|
|
23
24
|
* of those shapes is the listing faces' too); then the seats and the axis a release retired (each names what
|
|
24
25
|
* to do about it); then the reader-requirement list and the row digest — a row changed in storage (`requirements_damaged`), else an
|
|
25
|
-
* earlier release's intact row (`reading_changed
|
|
26
|
+
* earlier release's intact row (`reading_changed`), told
|
|
26
27
|
* only when nothing more specific is; then the recorded mode words, the sections by their shapes, the
|
|
27
28
|
* frozen chain's tool names, the recorded run origin, and the parent-constraint record's own integrity. The first refusal
|
|
28
29
|
* is the verdict.
|
|
@@ -83,9 +84,7 @@ export declare const ROW_REFUSAL_SENTENCES: Readonly<{
|
|
|
83
84
|
readonly "checkpoint.invalid_outcome|requirements_damaged": "This engine cannot resume this checkpoint: its content does not read the way it was recorded when it was parked — it was changed or lost in storage. The checkpoint stays pending and nothing was consumed. Expire it, then start the task again.";
|
|
84
85
|
readonly "checkpoint.invalid_outcome|execution_recorded": "This engine cannot resume this checkpoint: it reads pending, yet it records what became of the action it was decided for — the decision was lost in storage after the action was taken up, so the action may already have run, or been refused. The checkpoint stays pending. Check what the row records (`executionOutcome`) and whether the action already took effect — running it again may repeat it. Expire it, then start the task again.";
|
|
85
86
|
readonly "checkpoint.invalid_outcome|real_approval_damaged": "This engine cannot resume this checkpoint: its real-approval mark is missing or malformed (a corruption or downgrade guard). The checkpoint stays pending. Expire it, then start the task again.";
|
|
86
|
-
readonly "checkpoint.invalid_outcome|real_approval_forged": "This engine cannot resume this checkpoint: it carries a real-approval mark no release of its row format ever wrote (a corruption or forgery guard). The checkpoint stays pending. Expire it, then start the task again.";
|
|
87
87
|
readonly "checkpoint.invalid_outcome|read_face_damaged": "This engine cannot resume this checkpoint: its read-face section is missing or malformed (a corruption or downgrade guard). The checkpoint stays pending. Expire it, then start the task again.";
|
|
88
|
-
readonly "checkpoint.invalid_outcome|read_face_forged": "This engine cannot resume this checkpoint: it carries a read-face section no release of its row format ever wrote (a corruption or forgery guard). The checkpoint stays pending. Expire it, then start the task again.";
|
|
89
88
|
readonly "checkpoint.invalid_outcome|write_face_damaged": "This engine cannot resume this checkpoint: its write-face section is malformed (a corruption guard). The checkpoint stays pending. Expire it, then start the task again.";
|
|
90
89
|
readonly "checkpoint.invalid_outcome|skill_grants_damaged": "This engine cannot resume this checkpoint: its skill-grant section does not read as grant rows under this engine — damaged, or written by an earlier release whose entries this release reads differently. The checkpoint stays pending. Expire it and run the work again.";
|
|
91
90
|
readonly "checkpoint.invalid_outcome|skill_scopes_damaged": "This engine cannot resume this checkpoint: its skill-scope section does not read as a list of named skills (a damaged section). The checkpoint stays pending. Expire it and run the work again.";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CheckpointError, checkpointVersionOf, MAX_SUPPORTED_CHECKPOINT_VERSION } from "./checkpoint-features.js";
|
|
2
2
|
import { judgeCheckpointRequirements } from "./checkpoint-requirements.js";
|
|
3
3
|
import { isAskOrigin, isPermissionMode } from "./ask-origin.js";
|
|
4
4
|
import { validatePath } from "./effective-path-target.js";
|
|
@@ -11,7 +11,7 @@ import { screenRecordedRunOrigin } from "./run-origin.js";
|
|
|
11
11
|
import { refusePersistedToolNames } from "./runner/sub-agent-deny-lists.js";
|
|
12
12
|
import { boundedThrownName } from "./thrown-value.js";
|
|
13
13
|
import { memberPresent } from "./own-property-receipt.js";
|
|
14
|
-
import { CHECKPOINT_ROW_DAMAGED_SENTENCE, rowMemberProblem } from "./checkpoint-queries.js";
|
|
14
|
+
import { CHECKPOINT_ROW_DAMAGED_SENTENCE, checkpointRowUnreadable, rowMemberProblem } from "./checkpoint-queries.js";
|
|
15
15
|
import { SYNC_CHILD_BLOCK_MEMBERS } from "./leg-identity.js";
|
|
16
16
|
import { checkpointExecutionRecorded } from "./checkpoint-execution-record.js";
|
|
17
17
|
import { readStoredPrincipal, recordedPrincipalNameOf } from "./principal-name.js";
|
|
@@ -38,9 +38,7 @@ export const ROW_REFUSAL_SENTENCES = Object.freeze({
|
|
|
38
38
|
"checkpoint.invalid_outcome|requirements_damaged": CHECKPOINT_ROW_DAMAGED_SENTENCE,
|
|
39
39
|
"checkpoint.invalid_outcome|execution_recorded": "This engine cannot resume this checkpoint: it reads pending, yet it records what became of the action it was decided for — the decision was lost in storage after the action was taken up, so the action may already have run, or been refused. The checkpoint stays pending. Check what the row records (`executionOutcome`) and whether the action already took effect — running it again may repeat it. Expire it, then start the task again.",
|
|
40
40
|
"checkpoint.invalid_outcome|real_approval_damaged": "This engine cannot resume this checkpoint: its real-approval mark is missing or malformed (a corruption or downgrade guard). The checkpoint stays pending. Expire it, then start the task again.",
|
|
41
|
-
"checkpoint.invalid_outcome|real_approval_forged": "This engine cannot resume this checkpoint: it carries a real-approval mark no release of its row format ever wrote (a corruption or forgery guard). The checkpoint stays pending. Expire it, then start the task again.",
|
|
42
41
|
"checkpoint.invalid_outcome|read_face_damaged": "This engine cannot resume this checkpoint: its read-face section is missing or malformed (a corruption or downgrade guard). The checkpoint stays pending. Expire it, then start the task again.",
|
|
43
|
-
"checkpoint.invalid_outcome|read_face_forged": "This engine cannot resume this checkpoint: it carries a read-face section no release of its row format ever wrote (a corruption or forgery guard). The checkpoint stays pending. Expire it, then start the task again.",
|
|
44
42
|
"checkpoint.invalid_outcome|write_face_damaged": "This engine cannot resume this checkpoint: its write-face section is malformed (a corruption guard). The checkpoint stays pending. Expire it, then start the task again.",
|
|
45
43
|
"checkpoint.invalid_outcome|skill_grants_damaged": "This engine cannot resume this checkpoint: its skill-grant section does not read as grant rows under this engine — damaged, or written by an earlier release whose entries this release reads differently. The checkpoint stays pending. Expire it and run the work again.",
|
|
46
44
|
"checkpoint.invalid_outcome|skill_scopes_damaged": "This engine cannot resume this checkpoint: its skill-scope section does not read as a list of named skills (a damaged section). The checkpoint stays pending. Expire it and run the work again.",
|
|
@@ -60,9 +58,7 @@ export const ROW_REFUSAL_TERMINAL = Object.freeze({
|
|
|
60
58
|
"checkpoint.invalid_outcome|requirements_damaged": true,
|
|
61
59
|
"checkpoint.invalid_outcome|execution_recorded": true,
|
|
62
60
|
"checkpoint.invalid_outcome|real_approval_damaged": true,
|
|
63
|
-
"checkpoint.invalid_outcome|real_approval_forged": true,
|
|
64
61
|
"checkpoint.invalid_outcome|read_face_damaged": true,
|
|
65
|
-
"checkpoint.invalid_outcome|read_face_forged": true,
|
|
66
62
|
"checkpoint.invalid_outcome|write_face_damaged": true,
|
|
67
63
|
"checkpoint.invalid_outcome|skill_grants_damaged": false,
|
|
68
64
|
"checkpoint.invalid_outcome|skill_scopes_damaged": false,
|
|
@@ -139,11 +135,9 @@ function recordedWordRefusal(screen) {
|
|
|
139
135
|
throw e;
|
|
140
136
|
}
|
|
141
137
|
}
|
|
142
|
-
function
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
return false;
|
|
146
|
-
return checkpointVersionOf(cp) < CHECKPOINT_FEATURES.requirements.version;
|
|
138
|
+
function belowFormatRefusal(recorded) {
|
|
139
|
+
const format = recorded === undefined || recorded === null ? "unrecorded (read as v0)" : typeof recorded === "number" ? `v${recorded}` : `${/^[aeiou]/.test(typeof recorded) ? "an" : "a"} ${typeof recorded} that reads below v${MAX_SUPPORTED_CHECKPOINT_VERSION}`;
|
|
140
|
+
return new CheckpointError("checkpoint.unsupported_version", `this checkpoint's row format is ${format}, below the one this engine reads (v${MAX_SUPPORTED_CHECKPOINT_VERSION}): an engine release of 7.48.x or earlier parked it, and this release reads no row of an earlier format — expire it and run the work again; nothing was consumed`, { reason: "seat_retired" });
|
|
147
141
|
}
|
|
148
142
|
function recordedIdentityRefusal(cp) {
|
|
149
143
|
const members = [["principal", cp.principal], ["isolationScope", cp.isolationScope]];
|
|
@@ -162,15 +156,18 @@ function recordedIdentityRefusal(cp) {
|
|
|
162
156
|
return undefined;
|
|
163
157
|
}
|
|
164
158
|
function rowRefusalOf(cp) {
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
159
|
+
const recorded = cp.version;
|
|
160
|
+
const version = checkpointVersionOf({ version: recorded });
|
|
161
|
+
if (version > MAX_SUPPORTED_CHECKPOINT_VERSION) {
|
|
162
|
+
return new CheckpointError("checkpoint.unsupported_version", `checkpoint requires reader capabilities this worker lacks (row format v${version}; this worker reads up to v${MAX_SUPPORTED_CHECKPOINT_VERSION}) — resume it on a worker at or above the version that parked it`, { reason: "version_newer" });
|
|
168
163
|
}
|
|
169
|
-
const requirements = judgeCheckpointRequirements(cp);
|
|
170
|
-
if (requirements
|
|
164
|
+
const requirements = version < MAX_SUPPORTED_CHECKPOINT_VERSION ? undefined : judgeCheckpointRequirements(cp);
|
|
165
|
+
if (requirements?.kind === "lacking")
|
|
171
166
|
return new CheckpointError("checkpoint.unsupported_version", `checkpoint requires reader capabilities this worker lacks (${requirements.words.join(", ")}) — resume it on a worker at or above the version that parked it`, { reason: "version_newer", requires: requirements.words });
|
|
172
167
|
if (cp.status === "pending" && checkpointExecutionRecorded(cp))
|
|
173
168
|
return new CheckpointError("checkpoint.invalid_outcome", "this checkpoint reads pending yet already records what became of its decided action (`executionOutcome`) — the decision before it was lost in storage, and its action is not run a second time", { reason: "execution_recorded" });
|
|
169
|
+
if (requirements === undefined)
|
|
170
|
+
return belowFormatRefusal(recorded);
|
|
174
171
|
const shape = rowMemberProblem(cp);
|
|
175
172
|
if (shape !== undefined)
|
|
176
173
|
return new CheckpointError("checkpoint.invalid_outcome", `this checkpoint's \`${shape.member}\` does not read as every reader of a row reads it (${shape.problem}) — a damaged row`, { reason: "requirements_damaged" });
|
|
@@ -192,8 +189,6 @@ function rowRefusalOf(cp) {
|
|
|
192
189
|
return new CheckpointError("checkpoint.invalid_outcome", `this checkpoint's reader-requirement list does not match the row (${requirements.why})`, { reason: "requirements_damaged" });
|
|
193
190
|
if (requirements.kind === "earlier")
|
|
194
191
|
return readingChanged(`this checkpoint reads as an earlier engine release wrote it, and this release reads a member the decision binds differently (${requirements.why})`);
|
|
195
|
-
if (bindingPredatesTool(cp))
|
|
196
|
-
return readingChanged("the pending approval's bound hash predates tool binding: an earlier engine release digested the call's arguments alone, and this release binds the tool's name with them, so no decision is matched to this row here");
|
|
197
192
|
const identity = recordedIdentityRefusal(cp);
|
|
198
193
|
if (identity !== undefined)
|
|
199
194
|
return identity;
|
|
@@ -203,17 +198,8 @@ function rowRefusalOf(cp) {
|
|
|
203
198
|
const gateBit = cp.gate.kind === "irreversible_ask" ? cp.gate.realApproval : undefined;
|
|
204
199
|
const bitWellFormed = gateBit !== undefined && typeof gateBit === "object" && isAskOrigin(gateBit.origin);
|
|
205
200
|
const faceSaysGoverned = (cp.state.readFace?.realApproval) === true;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
: checkpointVersionOf(cp) < realApprovalRow.version
|
|
209
|
-
? gateBit !== undefined
|
|
210
|
-
: faceSaysGoverned
|
|
211
|
-
? !bitWellFormed
|
|
212
|
-
: gateBit !== undefined && !bitWellFormed;
|
|
213
|
-
if (bitViolation) {
|
|
214
|
-
return new CheckpointError("checkpoint.invalid_outcome", checkpointVersionOf(cp) >= realApprovalRow.version
|
|
215
|
-
? `a v${checkpointVersionOf(cp)} checkpoint's realApproval gate bit must be well-formed (origin a member of the closed ask-origin set)${checkpointVersionOf(cp) === realApprovalRow.version ? " and present on an irreversible_ask gate" : ""} — this row's is not; refusing to resume a damaged real-approval row (corruption / downgrade guard), the checkpoint stays pending`
|
|
216
|
-
: `a v${checkpointVersionOf(cp)} checkpoint carries a realApproval gate bit no release of that version ever minted — refusing to honor a fabricated origin (corruption / forgery guard), the checkpoint stays pending`, { reason: checkpointVersionOf(cp) >= realApprovalRow.version ? "real_approval_damaged" : "real_approval_forged" });
|
|
201
|
+
if (faceSaysGoverned ? !bitWellFormed : gateBit !== undefined && !bitWellFormed) {
|
|
202
|
+
return new CheckpointError("checkpoint.invalid_outcome", `a v${version} checkpoint's realApproval gate bit must be well-formed (origin a member of the closed ask-origin set) — this row's is not; refusing to resume a damaged real-approval row (corruption / downgrade guard), the checkpoint stays pending`, { reason: "real_approval_damaged" });
|
|
217
203
|
}
|
|
218
204
|
const faceSectionRaw = cp.state.readFace;
|
|
219
205
|
const faceCandidate = faceSectionRaw !== undefined && typeof faceSectionRaw === "object" && faceSectionRaw !== null
|
|
@@ -224,11 +210,8 @@ function rowRefusalOf(cp) {
|
|
|
224
210
|
(faceCandidate.realApproval === undefined || faceCandidate.realApproval === true) &&
|
|
225
211
|
(faceCandidate.denyEntries === undefined ||
|
|
226
212
|
(Array.isArray(faceCandidate.denyEntries) && faceCandidate.denyEntries.every((e) => persistedReadDenyEntryProblem(e) === null)));
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return new CheckpointError("checkpoint.invalid_outcome", checkpointVersionOf(cp) >= faceRow.version
|
|
230
|
-
? `a v${checkpointVersionOf(cp)} checkpoint must carry a well-formed read-face section (state.readFace) — this row's is missing or malformed; refusing to resume a damaged read-face row (corruption / downgrade guard), the checkpoint stays pending`
|
|
231
|
-
: `a v${checkpointVersionOf(cp)} checkpoint carries a read-face section no release of that version ever minted — refusing to honor a fabricated read-face state (corruption / forgery guard), the checkpoint stays pending`, { reason: checkpointVersionOf(cp) >= faceRow.version ? "read_face_damaged" : "read_face_forged" });
|
|
213
|
+
if (faceSectionRaw !== undefined && !faceWellFormed) {
|
|
214
|
+
return new CheckpointError("checkpoint.invalid_outcome", `a v${version} checkpoint must carry a well-formed read-face section (state.readFace) — this row's is missing or malformed; refusing to resume a damaged read-face row (corruption / downgrade guard), the checkpoint stays pending`, { reason: "read_face_damaged" });
|
|
232
215
|
}
|
|
233
216
|
const writeFaceSectionRaw = cp.state.writeFace;
|
|
234
217
|
if (writeFaceSectionRaw !== undefined) {
|
|
@@ -257,8 +240,8 @@ function rowRefusalOf(cp) {
|
|
|
257
240
|
return runOrigin;
|
|
258
241
|
const gate = cp.state.inheritedGate;
|
|
259
242
|
if (gate?.requiresParentConstraint === true) {
|
|
260
|
-
if (
|
|
261
|
-
return new CheckpointError("checkpoint.invalid_outcome", `a v${
|
|
243
|
+
if (gate.constraintChain === undefined || gate.constraintDigest === undefined) {
|
|
244
|
+
return new CheckpointError("checkpoint.invalid_outcome", `a v${version} checkpoint that requires parent constraints must carry BOTH the frozen constraintChain and its constraintDigest (they are minted in one write with the version stamp) — this row carries neither or only one; refusing to fall back to the count-only contract on a damaged row (corruption / downgrade guard), the checkpoint stays pending`, { reason: "constraint_chain_missing" });
|
|
262
245
|
}
|
|
263
246
|
const expectedDigest = gate.constraintDigest;
|
|
264
247
|
const reading = expectedDigest === undefined || gate.constraintChain === undefined ? undefined : constraintChainDigestReading(gate.constraintChain, expectedDigest);
|
|
@@ -309,11 +292,7 @@ function readRowTotal(cp) {
|
|
|
309
292
|
}
|
|
310
293
|
catch (e) {
|
|
311
294
|
const name = boundedThrownName(e);
|
|
312
|
-
|
|
313
|
-
return {
|
|
314
|
-
verdict: UNREADABLE_ROW_VERDICT,
|
|
315
|
-
refusal: new CheckpointError("checkpoint.invalid_outcome", `${sentence} Diagnostic: the row could not be read (${name} thrown while judging it)`, { reason: "requirements_damaged", thrownName: name }),
|
|
316
|
-
};
|
|
295
|
+
return { verdict: UNREADABLE_ROW_VERDICT, refusal: checkpointRowUnreadable(`the row could not be read (${name} thrown while judging it)`, "pending", name) };
|
|
317
296
|
}
|
|
318
297
|
}
|
|
319
298
|
export function judgeCheckpointRow(cp) {
|
|
@@ -2,7 +2,7 @@ import { CheckpointError, type CheckpointConfigRefusalCode, type CheckpointError
|
|
|
2
2
|
import { type CallRiskAxes } from "./ask-origin.js";
|
|
3
3
|
import type { GateOutcome, HostDecisionFacts } from "./gate-outcome.js";
|
|
4
4
|
import { type ExecutionOutcomeRecordWord } from "./checkpoint-execution-record.js";
|
|
5
|
-
import { type HolderJudge } from "./checkpoint-generation.js";
|
|
5
|
+
import { type HolderJudge, type StoreHolderFence } from "./checkpoint-generation.js";
|
|
6
6
|
import { type CheckpointPause } from "./pause-registry.js";
|
|
7
7
|
import { type CheckpointDeleteGuard, type CheckpointOverdueCursor, type CheckpointOverdueQuery, type CheckpointPage, type CheckpointRowRead, type CheckpointSessionCursor, type CheckpointSessionQuery } from "./checkpoint-queries.js";
|
|
8
8
|
import type { SystemInjectionPriority } from "./task-notification.js";
|
|
@@ -19,7 +19,7 @@ import { type RetentionDeclaration } from "./retention.js";
|
|
|
19
19
|
import { MAX_PENDING_STEER_CHARS } from "./input-author.js";
|
|
20
20
|
import { type IdentityRekeyInput, type IdentityRekeyPlan, type RekeyDone } from "./identity-rekey.js";
|
|
21
21
|
export { MAX_PENDING_STEER_CHARS };
|
|
22
|
-
export {
|
|
22
|
+
export { CHECKPOINT_CONFIG_REFUSAL_CODES, CHECKPOINT_ERROR_CODES, CHECKPOINT_FEATURES, CheckpointError, checkpointVersionOf, encodeAtFidelity, isCheckpointConfigRefusalCode, isCheckpointErrorCode, isPlainRecord, MAX_SUPPORTED_CHECKPOINT_VERSION, normalizeProbeCause, safeDataValue, SPAWN_RESUME_REFUSAL_CODES, type CheckpointConfigRefusalCode, type CheckpointErrorCode, type CheckpointErrorField, type CheckpointErrorReason, type CheckpointFeature, type CheckpointFeatureRow, type SpawnResumeRefusalCode, } from "./checkpoint-features.js";
|
|
23
23
|
/**
|
|
24
24
|
* design/45 — the **durable-checkpoint** primitive: cross-process / resumable `suspend`/`resume`.
|
|
25
25
|
*
|
|
@@ -400,8 +400,8 @@ export declare function buildRiskDescriptor(input: {
|
|
|
400
400
|
* to DIE at the park: the mint keyed the gate kind on the static tool marks only, so an org-governed
|
|
401
401
|
* ask on an unmarked tool minted a plain `{kind:"human"}` — the one kind a network budget resolver may
|
|
402
402
|
* auto-approve — and the org's "only judgment clears this" demand was silently budgetable after the
|
|
403
|
-
* durability boundary. Present ⇒ the mint escalates to `irreversible_ask` (non-budgetable) and
|
|
404
|
-
*
|
|
403
|
+
* durability boundary. Present ⇒ the mint escalates to `irreversible_ask` (non-budgetable) and the row lists the
|
|
404
|
+
* `realApproval` reader-requirement word. `origin` additionally records WHY, for the resume belts:
|
|
405
405
|
* · `"org_rule"` — an org ASK rule fired (governance was READABLE at mint). Resume keeps the strict
|
|
406
406
|
* posture: org unavailable at resume still refuses (newly-blind ⇒ fail-closed).
|
|
407
407
|
* · `"org_unavailable"` — governance could NOT be read at mint and the gate's own message promised
|
|
@@ -1044,8 +1044,8 @@ export interface CheckpointState {
|
|
|
1044
1044
|
* (NOT part of Prepared — §15.2 net-add #8). Without it a resumed `edit_file` is rejected "not read". */
|
|
1045
1045
|
readFileState?: Array<[string, ReadEntry]>;
|
|
1046
1046
|
/**
|
|
1047
|
-
* design/199 — the READ-face containment state at suspend (
|
|
1048
|
-
*
|
|
1047
|
+
* design/199 — the READ-face containment state at suspend (reader-requirement word
|
|
1048
|
+
* `face`): the RESOLVED face plus the NORMALIZED deny-set ADDITIONS in
|
|
1049
1049
|
* force (deployment ∪ task layers; the built-in table is engine code under the RESUMING deployment's
|
|
1050
1050
|
* own tier selection — empty unless it made one — never frozen here). Written ONLY when the posture
|
|
1051
1051
|
* is non-default (face "open", or additions present) — an absent section IS the default posture and
|
|
@@ -1253,8 +1253,8 @@ export interface CheckpointState {
|
|
|
1253
1253
|
* revoked grant refuses the resume), but a policy widened mid-session cannot widen THIS
|
|
1254
1254
|
* session's mount or the chain its children inherit. Present (possibly EMPTY — an adjudicated
|
|
1255
1255
|
* empty verdict is not "org-less") iff the suspend leg adjudicated an org plane; absent on
|
|
1256
|
-
* older checkpoints / org-less tasks. Checkpoints carrying this state
|
|
1257
|
-
*
|
|
1256
|
+
* older checkpoints / org-less tasks. Checkpoints carrying this state list the `orgAdmission`
|
|
1257
|
+
* reader-requirement word. */
|
|
1258
1258
|
ownAdmittedOrgScopes?: readonly string[];
|
|
1259
1259
|
/** The WRITE half of the session freeze: the org write grant this session held at suspend —
|
|
1260
1260
|
* `null` = the org write face was read-only (a resume must not gain write authority the
|
|
@@ -1303,9 +1303,9 @@ export interface CheckpointState {
|
|
|
1303
1303
|
* matches the digest but behaves differently cannot un-deny what the suspend froze. Present iff
|
|
1304
1304
|
* `requiresParentConstraint` on new mints; absent on PRE-F-012 checkpoints (⇒ no frozen deny data —
|
|
1305
1305
|
* the count-only contract governs, and an EDIT resume is refused for want of a validatable chain).
|
|
1306
|
-
*
|
|
1307
|
-
*
|
|
1308
|
-
*
|
|
1306
|
+
* Chain and digest are one write, so on a row that requires parent constraints the pair is REQUIRED — its
|
|
1307
|
+
* absence is a damaged row and the resume ladder refuses it pre-CAS rather than falling back to the
|
|
1308
|
+
* count-only contract. */
|
|
1309
1309
|
constraintChain?: ReadonlyArray<import("./tool-policy.js").ConstraintChainEntry>;
|
|
1310
1310
|
/**
|
|
1311
1311
|
* F-012 L1 — the content digest over `constraintChain` ({@link import("./tool-policy.js").constraintChainDigest}):
|
|
@@ -1313,8 +1313,8 @@ export interface CheckpointState {
|
|
|
1313
1313
|
* content. The resume pre-CAS ladder recomputes the digest over the RE-SUPPLIED chain's
|
|
1314
1314
|
* projections and rejects a mismatch (`resume.parent_constraint_mismatch`) — replacing the
|
|
1315
1315
|
* count-only shape check with a content contract (a same-length chain of different frozen deny
|
|
1316
|
-
* data no longer passes). Present iff `constraintChain` is — and on a
|
|
1317
|
-
* (see {@link constraintChain}: the pair
|
|
1316
|
+
* data no longer passes). Present iff `constraintChain` is — and on a row that requires parent
|
|
1317
|
+
* constraints both are required (see {@link constraintChain}: the pair is minted together). */
|
|
1318
1318
|
constraintDigest?: string;
|
|
1319
1319
|
};
|
|
1320
1320
|
/**
|
|
@@ -1655,7 +1655,7 @@ export interface ResolveExpectation {
|
|
|
1655
1655
|
* never judges, stores or prints it). Every member of this object is a precondition the store evaluates in the SAME atomic step
|
|
1656
1656
|
* as the flip: the CAS wins only if the grant `holder` names is still the deployment's current one at that instant (no claim
|
|
1657
1657
|
* transfer may commit between the judgement and the flip). Judged only by a store that declares {@link CheckpointStore.fence}
|
|
1658
|
-
* `holder`; any other store LOSES a CAS that carries one (never ignores it — `checkpointHolderMatches`). A miss is an ordinary
|
|
1658
|
+
* `{ holder: "writes" }`; any other store LOSES a CAS that carries one (never ignores it — `checkpointHolderMatches`). A miss is an ordinary
|
|
1659
1659
|
* loss: the row is untouched, so it reads `pending` at the generation the caller validated.
|
|
1660
1660
|
*/
|
|
1661
1661
|
holder?: string;
|
|
@@ -1668,9 +1668,19 @@ export type TerminalClaimIntent = {
|
|
|
1668
1668
|
kind: "resolve";
|
|
1669
1669
|
outcome: ResumeOutcome;
|
|
1670
1670
|
expect?: ResolveExpectation;
|
|
1671
|
-
}
|
|
1671
|
+
}
|
|
1672
|
+
/** `expect.holder`: the expire arm's grant holder, the same precondition as {@link CheckpointStore.expire}'s `opts.holder` — a holder
|
|
1673
|
+
* that is not current loses, the loss reading the row as it is (`pending` at its generation). */
|
|
1674
|
+
| {
|
|
1672
1675
|
kind: "expire";
|
|
1676
|
+
expect?: Pick<ResolveExpectation, "holder">;
|
|
1673
1677
|
};
|
|
1678
|
+
/** The options of a checkpoint write that has no row expectation of its own (`put`, `setPendingSteer`, `expire`). */
|
|
1679
|
+
export interface CheckpointWriteOptions {
|
|
1680
|
+
/** The run's grant holder (`RunInternals.holder`, verbatim — the engine never reads it), judged by a store declaring
|
|
1681
|
+
* `fence = { holder: "writes" }` in the write's own atomic step ({@link CheckpointStore.fence}); absent ⇒ nothing to judge. */
|
|
1682
|
+
readonly holder?: string;
|
|
1683
|
+
}
|
|
1674
1684
|
/** design/384 slice 2 / S-25-R1 — the single-round-trip answer: EITHER the claim won, OR it lost and
|
|
1675
1685
|
* the SAME atomic operation reports what the row is now. `current` reuses the row's own vocabulary
|
|
1676
1686
|
* (status / rev / resolvedOutcome) — no new value domain. `status:"pending"` on a loss is one of the
|
|
@@ -1734,10 +1744,9 @@ export interface CheckpointRow {
|
|
|
1734
1744
|
* the other half of the root anchor's address. Part of the block; absent when the root run recorded none. */
|
|
1735
1745
|
rootSessionIncarnation?: string;
|
|
1736
1746
|
/**
|
|
1737
|
-
* Schema version of this checkpoint (design/49 v1.5), FROZEN at the
|
|
1738
|
-
* stamps 10 beside {@link requires}, and a segment added later adds a word there, never a number here. A
|
|
1739
|
-
*
|
|
1740
|
-
* rejects `> MAX_SUPPORTED_CHECKPOINT_VERSION` pre-CAS. Read via {@link checkpointVersionOf}.
|
|
1747
|
+
* Schema version of this checkpoint (design/49 v1.5), FROZEN at the row format, 10: every live mint
|
|
1748
|
+
* stamps 10 beside {@link requires}, and a segment added later adds a word there, never a number here. A row
|
|
1749
|
+
* below it (absent ⇒ `0`) is refused pre-CAS as a retired seat, a row above it as newer. Read via {@link checkpointVersionOf}.
|
|
1741
1750
|
*/
|
|
1742
1751
|
version?: number;
|
|
1743
1752
|
/** The reader-requirement words of a v10 row: what a resuming worker must know to resume it right, derived from
|
|
@@ -1958,6 +1967,8 @@ export interface CheckpointIndexFacts {
|
|
|
1958
1967
|
readonly token: CheckpointToken;
|
|
1959
1968
|
readonly scope: string;
|
|
1960
1969
|
readonly sessionId: string;
|
|
1970
|
+
/** `checkpointRunSessionOf` of the row (`null` = no run: never matched) — the column `CheckpointSessionQuery.axis: "run"` reads. */
|
|
1971
|
+
readonly runSessionId: string | null;
|
|
1961
1972
|
/** {@link checkpointVersionOf}. */
|
|
1962
1973
|
readonly version: number;
|
|
1963
1974
|
readonly gateKind: CheckpointGate["kind"];
|
|
@@ -2432,18 +2443,24 @@ export interface CheckpointStore {
|
|
|
2432
2443
|
*/
|
|
2433
2444
|
readonly fidelity?: StoreFidelity;
|
|
2434
2445
|
/**
|
|
2435
|
-
* The
|
|
2436
|
-
*
|
|
2437
|
-
*
|
|
2438
|
-
*
|
|
2439
|
-
*
|
|
2446
|
+
* The GRANT-HOLDER declaration ({@link StoreHolderFence}, the one shape the session store declares too): `holder: "writes"` = this
|
|
2447
|
+
* store judges the holder of every write it is handed that carries one — `put` / `setPendingSteer` / `expire` (`opts.holder`),
|
|
2448
|
+
* `resolve` (`expect.holder`) and both arms of {@link claimTerminal} (`expect.holder`) — in that write's own atomic step, by the
|
|
2449
|
+
* deployment's one judge ({@link HolderJudge}). Same "declaration, never duck-typing" posture as the optional axes above
|
|
2450
|
+
* ({@link durability}, {@link fidelity}): ABSENT reads as "judges no holder", and a run handed a holder over such a store is refused at
|
|
2451
|
+
* its store seat (`config.invalid_checkpoint_store`) — a holder the store would ignore would fence nothing while the deployment
|
|
2452
|
+
* believed it fenced. The retired `{ holder: true }` (a promise about `resolve` alone) and every other form are refused at the seat
|
|
2453
|
+
* ({@link readStoreFence}). A wrapper store forwards this member and the holder of every verb it forwards; a wrapper that drops
|
|
2454
|
+
* either fences nothing — the store contract kit binds the COMPOSED store to catch exactly that.
|
|
2440
2455
|
*/
|
|
2441
|
-
readonly fence?:
|
|
2442
|
-
readonly holder: true;
|
|
2443
|
-
};
|
|
2456
|
+
readonly fence?: StoreHolderFence;
|
|
2444
2457
|
/** Create-once. Throws {@link CheckpointError} `already_exists` on a token collision (never a silent
|
|
2445
|
-
* overwrite — a reused token would clobber a live suspension).
|
|
2446
|
-
|
|
2458
|
+
* overwrite — a reused token would clobber a live suspension).
|
|
2459
|
+
* `opts.holder` (the run's grant holder, verbatim): judged first, in the same atomic step as the create — a holder the store's judge
|
|
2460
|
+
* does not hold current throws `holder.superseded` ({@link holderSupersededError}) with nothing written; no holder ⇒ as before. */
|
|
2461
|
+
put(token: CheckpointToken, cp: Checkpoint, opts?: CheckpointWriteOptions): Promise<void>;
|
|
2462
|
+
/** The row filed under `token` as stored, or `null` when none is; a held value that is no row throws `storedCheckpointRowRefusal`'s
|
|
2463
|
+
* refusal, bytes that do not decode `checkpointRowUnreadable`'s (both: checkpoint-queries.ts); every other row is answered as stored. */
|
|
2447
2464
|
get(token: CheckpointToken): Promise<Checkpoint | null>;
|
|
2448
2465
|
/**
|
|
2449
2466
|
* Atomic CAS: `UPDATE … SET status='resolved' WHERE token=? AND scope=? AND status='pending'`.
|
|
@@ -2564,8 +2581,12 @@ export interface CheckpointStore {
|
|
|
2564
2581
|
* persisted model-facing field on this row; rejected rather than truncated because cutting an
|
|
2565
2582
|
* instruction can invert it). NOT an approval channel: this only writes the parked queue, never
|
|
2566
2583
|
* touches status / the resolve path / any decision (§3 inv #4).
|
|
2584
|
+
*
|
|
2585
|
+
* `opts.holder` (a leg's own steer, carried verbatim): judged first, in the same atomic step as the append, before the row is
|
|
2586
|
+
* looked at — a holder the store's judge does not hold current throws `holder.superseded` ({@link holderSupersededError}), the queue
|
|
2587
|
+
* unchanged; no holder ⇒ as before (a person's steer onto a parked card carries none).
|
|
2567
2588
|
*/
|
|
2568
|
-
setPendingSteer(token: CheckpointToken, scope: string, steer: PendingSteerInput): Promise<boolean>;
|
|
2589
|
+
setPendingSteer(token: CheckpointToken, scope: string, steer: PendingSteerInput, opts?: CheckpointWriteOptions): Promise<boolean>;
|
|
2569
2590
|
/**
|
|
2570
2591
|
* CAS-expire a **single** `pending` checkpoint by token: `UPDATE … SET status='expired' WHERE token=?
|
|
2571
2592
|
* AND scope=? AND status='pending'`. Returns the CAS winner (`true` = was pending → now expired; `false`
|
|
@@ -2577,8 +2598,12 @@ export interface CheckpointStore {
|
|
|
2577
2598
|
* goes through `resolve`); the paused env is destroyed only once the row is `expired` (this call won, or a loser
|
|
2578
2599
|
* reads it so), so the same checkpoint is **never both reaped and resumed**. `scope` is in the WHERE for multi-tenant isolation, like
|
|
2579
2600
|
* `resolve`/`reap`.
|
|
2601
|
+
*
|
|
2602
|
+
* `opts.holder` (an expire a run issues in its own name, carried verbatim): one more precondition of the same CAS — a holder the
|
|
2603
|
+
* store's judge does not hold current LOSES (`false`, the row untouched; never a throw, so a caller reading the row still sees that it
|
|
2604
|
+
* was expired by someone else when it was). No holder ⇒ as before (a host's reaper, cancel and cleanup carry none).
|
|
2580
2605
|
*/
|
|
2581
|
-
expire(token: CheckpointToken, scope: string): Promise<boolean>;
|
|
2606
|
+
expire(token: CheckpointToken, scope: string, opts?: CheckpointWriteOptions): Promise<boolean>;
|
|
2582
2607
|
/**
|
|
2583
2608
|
* design/384 slice 2 / S-25-R1 — the ATOMIC terminal claim: "win the terminal race" and "read the
|
|
2584
2609
|
* truth on a loss" as ONE store operation. OPTIONAL, probed by presence (the `listByScope`
|
|
@@ -2692,11 +2717,11 @@ export interface CheckpointStore {
|
|
|
2692
2717
|
* **OPTIONAL** (unlike the required {@link listByScope}); the in-memory and file first-party impls provide it.
|
|
2693
2718
|
*/
|
|
2694
2719
|
listScopes?(): Promise<string[]>;
|
|
2695
|
-
/** The PENDING rows of every scope past their deadline, one facet per call ({@link CheckpointOverdueQuery}; read by
|
|
2720
|
+
/** The PENDING rows of every scope past their deadline (or age backstop), one facet per call ({@link CheckpointOverdueQuery}; read by
|
|
2696
2721
|
* `readCheckpointOverdueQuery`, keyset-paged, bounded). OPTIONAL, probed by presence; both first-party stores provide it. */
|
|
2697
2722
|
listOverdue?(query: CheckpointOverdueQuery): Promise<CheckpointPage<CheckpointSummary, CheckpointOverdueCursor>>;
|
|
2698
2723
|
/** The rows of ONE session in any status ({@link CheckpointSessionQuery}; read by `readCheckpointSessionQuery`, keyset-paged,
|
|
2699
|
-
* bounded; a damaged row of the session answers `unreadable`, never skipped — a row with no string session id belongs to no session and is left out, disclosed; the file replay drops a row with a non-string token, scope or status, disclosed there). OPTIONAL, probed by presence; both first-party stores provide it. */
|
|
2724
|
+
* bounded; a damaged row of the session answers `unreadable`, never skipped — a row with no string session id belongs to no session and is left out, disclosed; the file replay drops a row with a non-string token, scope or status, disclosed there). The query's `axis` says which session of a row it names: its own, or its run's (`checkpointRunSessionOf`). OPTIONAL, probed by presence; both first-party stores provide it. A store that offers it and cannot answer the run axis refuses `axis: "run"` (`config.invalid_argument`) — it never answers the row-session page in its place. */
|
|
2700
2725
|
listBySession?(query: CheckpointSessionQuery): Promise<CheckpointPage<CheckpointRowRead, CheckpointSessionCursor>>;
|
|
2701
2726
|
/** Delete the checkpoint rows of one session that exist when the call starts, in any status, when the guard admits it
|
|
2702
2727
|
* ({@link CheckpointDeleteGuard}); answers the count. Present exactly when the store can judge the guard (a session head read). */
|
|
@@ -2866,10 +2891,9 @@ export declare class InMemoryCheckpointStore implements CheckpointStore {
|
|
|
2866
2891
|
/** Honest declaration on the fidelity axis: `put`/`get` are `structuredClone`, so a row keeps the
|
|
2867
2892
|
* whole structured-clone domain — a `Date` filed here is a `Date` when it comes back. */
|
|
2868
2893
|
readonly fidelity: "structured-clone";
|
|
2869
|
-
/**
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
};
|
|
2894
|
+
/** `{ holder: "writes" }`, declared exactly when the store was built with a `holderIsCurrent` judge ({@link CheckpointStore.fence}):
|
|
2895
|
+
* the judge is then asked on every write that carries a holder. */
|
|
2896
|
+
readonly fence?: StoreHolderFence;
|
|
2873
2897
|
private cps;
|
|
2874
2898
|
/** The listing's memo of each stored row object's verdict: a `put` stores a new object, so a replaced row is judged again. */
|
|
2875
2899
|
private readonly rowVerdicts;
|
|
@@ -2890,7 +2914,7 @@ export declare class InMemoryCheckpointStore implements CheckpointStore {
|
|
|
2890
2914
|
holderIsCurrent?: HolderJudge;
|
|
2891
2915
|
retention?: RetentionDeclaration;
|
|
2892
2916
|
});
|
|
2893
|
-
put(token: CheckpointToken, cp: Checkpoint): Promise<void>;
|
|
2917
|
+
put(token: CheckpointToken, cp: Checkpoint, opts?: CheckpointWriteOptions): Promise<void>;
|
|
2894
2918
|
get(token: CheckpointToken): Promise<Checkpoint | null>;
|
|
2895
2919
|
/** The loser's single-round-trip reading (claim law 1): what the row IS, in its own vocabulary —
|
|
2896
2920
|
* or `absent` for a missing row AND a wrong-scope row alike (the isolation rule: cross-scope truth
|
|
@@ -2912,7 +2936,7 @@ export declare class InMemoryCheckpointStore implements CheckpointStore {
|
|
|
2912
2936
|
protected claimResolveCore(token: CheckpointToken, scope: string, outcome: ResumeOutcome, expect?: ResolveExpectation): TerminalClaimOutcome;
|
|
2913
2937
|
/** The one protected write core for the terminal-expire claim — `expire` and
|
|
2914
2938
|
* `claimTerminal({kind:"expire"})` both run exactly this (claim law 2, same as the resolve core). */
|
|
2915
|
-
protected claimExpireCore(token: CheckpointToken, scope: string): TerminalClaimOutcome;
|
|
2939
|
+
protected claimExpireCore(token: CheckpointToken, scope: string, holder?: string): TerminalClaimOutcome;
|
|
2916
2940
|
resolve(token: CheckpointToken, scope: string, outcome: ResumeOutcome, expect?: ResolveExpectation): Promise<boolean>;
|
|
2917
2941
|
/** design/384 slice 2 — the atomic terminal claim (the interface JSDoc is the law's single
|
|
2918
2942
|
* normative statement). Implemented OVER the same protected cores `resolve`/`expire` run, which is
|
|
@@ -2942,8 +2966,8 @@ export declare class InMemoryCheckpointStore implements CheckpointStore {
|
|
|
2942
2966
|
claimTerminal(token: CheckpointToken, scope: string, intent: TerminalClaimIntent): Promise<TerminalClaimOutcome>;
|
|
2943
2967
|
recordExecutionOutcome(token: CheckpointToken, scope: string, gate: GateOutcome): Promise<ExecutionOutcomeRecordWord>;
|
|
2944
2968
|
reopen(token: CheckpointToken, scope: string, reason: ReopenReason, expect?: Pick<ResolveExpectation, "rev">): Promise<boolean>;
|
|
2945
|
-
setPendingSteer(token: CheckpointToken, scope: string, steer: PendingSteerInput): Promise<boolean>;
|
|
2946
|
-
expire(token: CheckpointToken, scope: string): Promise<boolean>;
|
|
2969
|
+
setPendingSteer(token: CheckpointToken, scope: string, steer: PendingSteerInput, opts?: CheckpointWriteOptions): Promise<boolean>;
|
|
2970
|
+
expire(token: CheckpointToken, scope: string, opts?: CheckpointWriteOptions): Promise<boolean>;
|
|
2947
2971
|
reap(scope: string, cutoff: number): Promise<number>;
|
|
2948
2972
|
listByScope(scope: string): Promise<CheckpointSummary[]>;
|
|
2949
2973
|
listScopes(): Promise<string[]>;
|
|
@@ -16,9 +16,10 @@ import { isRunOrigin, RUN_ORIGINS } from "./run-origin.js";
|
|
|
16
16
|
import { describeRejectedValue } from "./tool-search-setting.js";
|
|
17
17
|
import { readBoundBinding } from "./skill-grant-binding.js";
|
|
18
18
|
import { checkpointExecutionRecorded, executionRecordDisposition, ExecutionOutcomeConflictError, } from "./checkpoint-execution-record.js";
|
|
19
|
-
import { checkpointHolderMatches, checkpointOccMatches, checkpointRevOf } from "./checkpoint-generation.js";
|
|
19
|
+
import { checkpointHolderMatches, checkpointOccMatches, checkpointRevOf, holderJudgedCurrent, readHolderJudge } from "./checkpoint-generation.js";
|
|
20
|
+
import { holderSupersededError } from "./grant-holder.js";
|
|
20
21
|
import { isGateKind, parkedApprovalCardOf } from "./pause-registry.js";
|
|
21
|
-
import { checkpointDeadlineColumn, checkpointDeadlinePassed, deleteSessionRowsAtStart, ownerSessionRowsDelete, unreadableSessionRowsDelete, readCheckpointOverdueQuery, readCheckpointSessionQuery, rowMemberProblem, selectOverduePage, selectSessionPage } from "./checkpoint-queries.js";
|
|
22
|
+
import { checkpointDeadlineColumn, checkpointDeadlinePassed, checkpointRunSessionOf, storedCheckpointRowRefusal, deleteSessionRowsAtStart, ownerSessionRowsDelete, unreadableSessionRowsDelete, readCheckpointOverdueQuery, readCheckpointSessionQuery, rowMemberProblem, selectOverduePage, selectSessionPage } from "./checkpoint-queries.js";
|
|
22
23
|
import { renderUntrustedCommandText, stripFormatCharacters } from "./permission-rule-model.js";
|
|
23
24
|
import { egressText } from "./untrusted-egress.js";
|
|
24
25
|
import { steerReplayRefusal } from "./steer-replay.js";
|
|
@@ -29,7 +30,7 @@ import { isBlankInput, MAX_PENDING_STEER_CHARS, STEERING_CONTROL_CHARS_RE, steer
|
|
|
29
30
|
import { oneStepRekeyAnswerOf, readIdentityRekeyInput } from "./identity-rekey.js";
|
|
30
31
|
import { rekeyCheckpointRow } from "./checkpoint-rekey.js";
|
|
31
32
|
export { MAX_PENDING_STEER_CHARS };
|
|
32
|
-
export {
|
|
33
|
+
export { CHECKPOINT_CONFIG_REFUSAL_CODES, CHECKPOINT_ERROR_CODES, CHECKPOINT_FEATURES, CheckpointError, checkpointVersionOf, encodeAtFidelity, isCheckpointConfigRefusalCode, isCheckpointErrorCode, isPlainRecord, MAX_SUPPORTED_CHECKPOINT_VERSION, normalizeProbeCause, safeDataValue, SPAWN_RESUME_REFUSAL_CODES, } from "./checkpoint-features.js";
|
|
33
34
|
export function mintCheckpointToken() {
|
|
34
35
|
return randomBytes(16).toString("hex");
|
|
35
36
|
}
|
|
@@ -226,12 +227,14 @@ export function checkpointIndexFacts(cp) {
|
|
|
226
227
|
const refused = indexTreeRefusal("gate", gate) ?? indexTreeRefusal("pendingAction", pending);
|
|
227
228
|
if (refused !== undefined)
|
|
228
229
|
throw refused;
|
|
230
|
+
const runSessionId = checkpointRunSessionOf(cp) ?? null;
|
|
229
231
|
const card = parkedApprovalCardOf(gate);
|
|
230
232
|
const tool = pending.kind === "tool_approval" ? pending : undefined;
|
|
231
233
|
return {
|
|
232
234
|
token: cp.token,
|
|
233
235
|
scope: cp.scope,
|
|
234
236
|
sessionId: cp.sessionId,
|
|
237
|
+
runSessionId,
|
|
235
238
|
version: checkpointVersionOf(cp),
|
|
236
239
|
gateKind: gate.kind,
|
|
237
240
|
approvalCard: card.kind === "card" ? card.card : card.kind === "unknown_word" && typeof card.word === "string" ? card.word : null,
|
|
@@ -673,9 +676,9 @@ export class InMemoryCheckpointStore {
|
|
|
673
676
|
const opts = receiveOptions(options, "InMemoryCheckpointStore", IN_MEMORY_CHECKPOINT_STORE_OPTION_KEYS);
|
|
674
677
|
this.retention = readRetentionDeclaration("InMemoryCheckpointStore.retention", opts.retention);
|
|
675
678
|
this.disclose = opts.disclose;
|
|
676
|
-
this.holderIsCurrent = opts.holderIsCurrent;
|
|
677
|
-
if (
|
|
678
|
-
this.fence = Object.freeze({ holder:
|
|
679
|
+
this.holderIsCurrent = readHolderJudge("InMemoryCheckpointStore.holderIsCurrent", opts.holderIsCurrent);
|
|
680
|
+
if (this.holderIsCurrent !== undefined)
|
|
681
|
+
this.fence = Object.freeze({ holder: "writes" });
|
|
679
682
|
const headOf = opts.sessionHeadOf;
|
|
680
683
|
if (headOf !== undefined) {
|
|
681
684
|
const remove = (token, row) => this.cps.get(token) === row && this.cps.delete(token);
|
|
@@ -683,15 +686,21 @@ export class InMemoryCheckpointStore {
|
|
|
683
686
|
this.deleteUnreadableSessionCheckpoints = async (sessionId) => deleteSessionRowsAtStart(this.cps, unreadableSessionRowsDelete(sessionId, headOf), remove);
|
|
684
687
|
}
|
|
685
688
|
}
|
|
686
|
-
async put(token, cp) {
|
|
689
|
+
async put(token, cp, opts) {
|
|
690
|
+
if (!holderJudgedCurrent(opts?.holder, this.holderIsCurrent, "checkpoint"))
|
|
691
|
+
throw holderSupersededError("put");
|
|
687
692
|
if (this.cps.has(token)) {
|
|
688
693
|
throw new CheckpointError("checkpoint.already_exists", `checkpoint token already exists`);
|
|
689
694
|
}
|
|
690
695
|
this.cps.set(token, structuredClone(cp));
|
|
691
696
|
}
|
|
692
697
|
async get(token) {
|
|
693
|
-
|
|
694
|
-
|
|
698
|
+
if (!this.cps.has(token))
|
|
699
|
+
return null;
|
|
700
|
+
const cp = this.cps.get(token), refused = storedCheckpointRowRefusal(token, cp);
|
|
701
|
+
if (refused !== undefined)
|
|
702
|
+
throw refused;
|
|
703
|
+
return structuredClone(cp);
|
|
695
704
|
}
|
|
696
705
|
claimLossFrom(cp, scope) {
|
|
697
706
|
if (cp === undefined || cp.scope !== scope)
|
|
@@ -725,11 +734,14 @@ export class InMemoryCheckpointStore {
|
|
|
725
734
|
delete cp.reopenReason;
|
|
726
735
|
return { claimed: true };
|
|
727
736
|
}
|
|
728
|
-
claimExpireCore(token, scope) {
|
|
737
|
+
claimExpireCore(token, scope, holder) {
|
|
729
738
|
const cp = this.cps.get(token);
|
|
730
739
|
if (!checkpointRowMatches(cp, scope, "pending")) {
|
|
731
740
|
return this.claimLossFrom(cp, scope);
|
|
732
741
|
}
|
|
742
|
+
if (!holderJudgedCurrent(holder, this.holderIsCurrent, "checkpoint")) {
|
|
743
|
+
return this.claimLossFrom(cp, scope);
|
|
744
|
+
}
|
|
733
745
|
cp.status = "expired";
|
|
734
746
|
return { claimed: true };
|
|
735
747
|
}
|
|
@@ -754,7 +766,7 @@ export class InMemoryCheckpointStore {
|
|
|
754
766
|
this.fault = null;
|
|
755
767
|
throw new Error(`injected fault: ${name} before commit`);
|
|
756
768
|
}
|
|
757
|
-
const out = intent.kind === "resolve" ? this.claimResolveCore(token, scope, intent.outcome, intent.expect) : this.claimExpireCore(token, scope);
|
|
769
|
+
const out = intent.kind === "resolve" ? this.claimResolveCore(token, scope, intent.outcome, intent.expect) : this.claimExpireCore(token, scope, intent.expect?.holder);
|
|
758
770
|
if (out.claimed && (this.fault === "claim-after-commit" || (intent.kind === "resolve" && this.fault === "resolve-after-commit"))) {
|
|
759
771
|
const name = this.fault === "claim-after-commit" ? "claim" : "resolve";
|
|
760
772
|
this.fault = null;
|
|
@@ -784,8 +796,10 @@ export class InMemoryCheckpointStore {
|
|
|
784
796
|
cp.reopenReason = reason;
|
|
785
797
|
return true;
|
|
786
798
|
}
|
|
787
|
-
async setPendingSteer(token, scope, steer) {
|
|
799
|
+
async setPendingSteer(token, scope, steer, opts) {
|
|
788
800
|
const clean = validatePendingSteer(steer);
|
|
801
|
+
if (!holderJudgedCurrent(opts?.holder, this.holderIsCurrent, "checkpoint"))
|
|
802
|
+
throw holderSupersededError("setPendingSteer");
|
|
789
803
|
const cp = this.cps.get(token);
|
|
790
804
|
if (!checkpointRowMatches(cp, scope, "pending")) {
|
|
791
805
|
return false;
|
|
@@ -793,11 +807,11 @@ export class InMemoryCheckpointStore {
|
|
|
793
807
|
cp.state.pendingSteerQueue = appendPendingSteer(cp.state, clean);
|
|
794
808
|
return true;
|
|
795
809
|
}
|
|
796
|
-
async expire(token, scope) {
|
|
810
|
+
async expire(token, scope, opts) {
|
|
797
811
|
if (!checkpointRowMatches(this.cps.get(token), scope, "pending")) {
|
|
798
812
|
return false;
|
|
799
813
|
}
|
|
800
|
-
return this.claimExpireCore(token, scope).claimed;
|
|
814
|
+
return this.claimExpireCore(token, scope, opts?.holder).claimed;
|
|
801
815
|
}
|
|
802
816
|
async reap(scope, cutoff) {
|
|
803
817
|
let n = 0;
|
|
@@ -404,9 +404,11 @@ export declare function sandboxResultNote(start: CommandSandboxStart, command: s
|
|
|
404
404
|
* `failIfUnavailable`, `strictAllowlist`) is on when either is; a loosening one (`autoAllowBashIfSandboxed`,
|
|
405
405
|
* `allowUnsandboxedCommands`, the weakening switches) only when both are; the lists of what is denied join; the lists of
|
|
406
406
|
* what is allowed keep only the entries both write, as written; `ignoreViolations` keeps the patterns both write, each with the
|
|
407
|
-
* paths both write; a credential
|
|
408
|
-
*
|
|
409
|
-
*
|
|
407
|
+
* paths both write; in a credential list the child states, a credential named more than once (by both, or twice in the parent's
|
|
408
|
+
* list) is one entry with the stricter mode (`deny` over `mask`) and the stricter no-match word (`error` over `deny` over `warn`),
|
|
409
|
+
* its other members the parent's (for a name the parent's list repeats, its later entry's); a signing word (`sigv4.streaming` / `presigned` /
|
|
410
|
+
* `sigv4a`) is `deny` when either writes `deny`; the mechanism's settings (`httpProxyPort`, `socksProxyPort`, `tlsTerminate`,
|
|
411
|
+
* `ripgrep`, `bwrapPath`, `socatPath`, `awsPairs`) are the parent's, whatever the child states. The child's requirement is judged
|
|
410
412
|
* first ({@link receiveTaskSandbox}): one that cannot be read refuses the spawn, never merges in part.
|
|
411
413
|
*/
|
|
412
414
|
export declare function mergeChildSandbox(parent: TaskSandboxSettings | undefined, childValue: unknown): TaskSandboxSettings | undefined;
|