@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
|
@@ -12,17 +12,22 @@
|
|
|
12
12
|
*
|
|
13
13
|
* ## The contract (design/382 §8-Q6, settled here)
|
|
14
14
|
*
|
|
15
|
-
*
|
|
15
|
+
* Two verbs every partition has, and a third a partition may have:
|
|
16
16
|
* · `read(sessionId)` — the live rows of ONE session, session-scoped, that session's only.
|
|
17
17
|
* · `apply(sessionId, add)` — land one redeemed authorization. Idempotent BY DOT (the redemption
|
|
18
18
|
* replay contract: `alreadyRedeemed` marks the dot as RECORDED, not the overlay as LANDED, so a
|
|
19
19
|
* replay must RE-APPLY, and this verb is what makes re-applying safe); refuses `session_ended`
|
|
20
20
|
* once the session's lifetime epoch is sealed — a late in-flight write after termination must not
|
|
21
21
|
* revive an authorization for a session that no longer exists.
|
|
22
|
+
* · `revoke(sessionId, target)` — the person takes one row of THEIR session back before the session ends:
|
|
23
|
+
* the row of that identity (behavior, rule text) is gone with every add it carried, and a dot it carried
|
|
24
|
+
* never lands again in this session — a replayed redemption of it is an acknowledged write and an absent
|
|
25
|
+
* rule, exactly as a tombstoned dot is in the durable partition. Revoking is the tightening direction, so
|
|
26
|
+
* it takes no approval; it refuses `session_ended` like `apply` (there is nothing left to take back).
|
|
22
27
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
28
|
+
* Termination is still the HOST's act on its own implementation (see
|
|
29
|
+
* {@link InMemorySessionRulePartition.endSession}), not an engine verb: `revoke` takes ONE row back,
|
|
30
|
+
* ending the session takes all of them and seals the session.
|
|
26
31
|
*
|
|
27
32
|
* ## Lifecycle and durability
|
|
28
33
|
*
|
|
@@ -60,6 +65,19 @@ export type SessionRuleApplyResult = {
|
|
|
60
65
|
} | {
|
|
61
66
|
refused: "session_ended";
|
|
62
67
|
};
|
|
68
|
+
/** The identity of one session row a revocation names: its behavior and its canonical rule text (the scope is the verb's
|
|
69
|
+
* `sessionId`). Behavior is part of it because one text may stand as an allow and as a deny in one session. */
|
|
70
|
+
export interface SessionRuleTarget {
|
|
71
|
+
behavior: RuleBehavior;
|
|
72
|
+
rule: string;
|
|
73
|
+
}
|
|
74
|
+
/** What one revocation answered: how many rows of that identity were taken back (0 — there was none, a repeated revoke
|
|
75
|
+
* included; 1 — it is gone), or the epoch fence: the session already ended and holds nothing to take back. */
|
|
76
|
+
export type SessionRuleRevokeResult = {
|
|
77
|
+
revoked: number;
|
|
78
|
+
} | {
|
|
79
|
+
refused: "session_ended";
|
|
80
|
+
};
|
|
63
81
|
/**
|
|
64
82
|
* The session partition a deployment hands to `createPermissionRuleStoreProvider({ session })`. See the
|
|
65
83
|
* module doc for the contract; {@link InMemorySessionRulePartition} is the reference implementation and
|
|
@@ -70,8 +88,16 @@ export type SessionRuleApplyResult = {
|
|
|
70
88
|
export interface SessionRulePartition {
|
|
71
89
|
/** The live session-scoped rows of ONE session. An ended (or never-written) session reads as `[]`. */
|
|
72
90
|
read(sessionId: string): Promise<readonly PersistedRule[]>;
|
|
73
|
-
/** Land one redeemed authorization — idempotent by dot, refused once the session ended.
|
|
91
|
+
/** Land one redeemed authorization — idempotent by dot, refused once the session ended. A dot this session revoked
|
|
92
|
+
* lands nothing and answers `landed` (an acknowledged write of a removed rule; the redemption's read-back says it is gone). */
|
|
74
93
|
apply(sessionId: string, add: SessionRuleAdd): Promise<SessionRuleApplyResult>;
|
|
94
|
+
/** Take one row of the session back (every add of that identity), refused once the session ended. Its dots never land
|
|
95
|
+
* again in this session, and a restore of rows minted before the revocation into the SAME partition instance does not bring them
|
|
96
|
+
* back (the revocation is remembered in that instance's memory only: a snapshot cut before it and restored into another
|
|
97
|
+
* partition — another process, after a restart — brings the row back, so cut the snapshot again after a revocation). OPTIONAL: a partition
|
|
98
|
+
* without it serves and lands rows as before, its rows cannot be taken back before the session ends (a session-scope
|
|
99
|
+
* removal says so), and the engine offers no grant whose promise is that it can be ("allow this call for the session"). */
|
|
100
|
+
revoke?(sessionId: string, target: SessionRuleTarget): Promise<SessionRuleRevokeResult>;
|
|
75
101
|
}
|
|
76
102
|
/**
|
|
77
103
|
* The reference overlay — in-memory, per-process, the semantics every host implementation must keep:
|
|
@@ -99,6 +125,9 @@ export declare class InMemorySessionRulePartition implements SessionRulePartitio
|
|
|
99
125
|
* `landed:true`, and a consent nobody withdrew stops existing. Bumped by every landing, restore and
|
|
100
126
|
* termination; read across `restoreSession`'s snapshot. */
|
|
101
127
|
private readonly epochs;
|
|
128
|
+
/** The dots each live session revoked (`actor#counter`): never landed again by `apply`, dropped from what `restoreSession`
|
|
129
|
+
* installs. Gone with the session at `endSession` (the seal answers everything after it). */
|
|
130
|
+
private readonly revokedDots;
|
|
102
131
|
private bumpEpoch;
|
|
103
132
|
read(sessionId: string): Promise<readonly PersistedRule[]>;
|
|
104
133
|
apply(sessionId: string, add: SessionRuleAdd): Promise<SessionRuleApplyResult>;
|
|
@@ -109,6 +138,7 @@ export declare class InMemorySessionRulePartition implements SessionRulePartitio
|
|
|
109
138
|
* rule set for a session that is already gone. Idempotent; a never-seen id seals to the same place.
|
|
110
139
|
*/
|
|
111
140
|
endSession(sessionId: string): void;
|
|
141
|
+
revoke(sessionId: string, target: SessionRuleTarget): Promise<SessionRuleRevokeResult>;
|
|
112
142
|
/** The park half of the checkpoint carriage: this session's rows, serializable as-is. */
|
|
113
143
|
snapshotSession(sessionId: string): Promise<readonly PersistedRule[]>;
|
|
114
144
|
/**
|
|
@@ -14,6 +14,7 @@ export class InMemorySessionRulePartition {
|
|
|
14
14
|
rows = new Map();
|
|
15
15
|
sealed = new Set();
|
|
16
16
|
epochs = new Map();
|
|
17
|
+
revokedDots = new Map();
|
|
17
18
|
bumpEpoch(sessionId) {
|
|
18
19
|
this.epochs.set(sessionId, (this.epochs.get(sessionId) ?? 0) + 1);
|
|
19
20
|
}
|
|
@@ -37,6 +38,8 @@ export class InMemorySessionRulePartition {
|
|
|
37
38
|
if ("reject" in normalizePersistedRule(projected)) {
|
|
38
39
|
throw new Error("SessionRulePartition.apply was handed a row whose text/metadata do not survive the canonical re-projection — a row the engine cannot re-project can never adjudicate, and would refuse its own restore");
|
|
39
40
|
}
|
|
41
|
+
if (this.revokedDots.get(sessionId)?.has(`${add.add.dot.actor}#${add.add.dot.counter}`) === true)
|
|
42
|
+
return { landed: true };
|
|
40
43
|
const rows = this.rows.get(sessionId) ?? [];
|
|
41
44
|
if (!this.rows.has(sessionId))
|
|
42
45
|
this.rows.set(sessionId, rows);
|
|
@@ -62,7 +65,30 @@ export class InMemorySessionRulePartition {
|
|
|
62
65
|
endSession(sessionId) {
|
|
63
66
|
this.sealed.add(sessionId);
|
|
64
67
|
this.rows.delete(sessionId);
|
|
68
|
+
this.revokedDots.delete(sessionId);
|
|
69
|
+
this.bumpEpoch(sessionId);
|
|
70
|
+
}
|
|
71
|
+
async revoke(sessionId, target) {
|
|
72
|
+
if (this.sealed.has(sessionId))
|
|
73
|
+
return { refused: "session_ended" };
|
|
74
|
+
const t = structuredClone(target);
|
|
75
|
+
if (this.sealed.has(sessionId))
|
|
76
|
+
return { refused: "session_ended" };
|
|
77
|
+
const behavior = readRowBehavior(t?.behavior);
|
|
78
|
+
if (behavior === undefined || t?.behavior === undefined || typeof t?.rule !== "string" || t.rule === "") {
|
|
79
|
+
throw new Error("SessionRulePartition.revoke was handed a target that names no row (a behavior of deny/ask/allow and a rule text) — refusing rather than answering a revocation of nothing");
|
|
80
|
+
}
|
|
81
|
+
const rows = this.rows.get(sessionId) ?? [];
|
|
82
|
+
const at = rows.findIndex((r) => r.behavior === behavior && r.rule === t.rule);
|
|
83
|
+
if (at < 0)
|
|
84
|
+
return { revoked: 0 };
|
|
85
|
+
const [gone] = rows.splice(at, 1);
|
|
86
|
+
const revoked = this.revokedDots.get(sessionId) ?? new Set();
|
|
87
|
+
for (const a of gone.adds)
|
|
88
|
+
revoked.add(`${a.dot.actor}#${a.dot.counter}`);
|
|
89
|
+
this.revokedDots.set(sessionId, revoked);
|
|
65
90
|
this.bumpEpoch(sessionId);
|
|
91
|
+
return { revoked: 1 };
|
|
66
92
|
}
|
|
67
93
|
async snapshotSession(sessionId) {
|
|
68
94
|
return this.read(sessionId);
|
|
@@ -136,7 +162,12 @@ export class InMemorySessionRulePartition {
|
|
|
136
162
|
else
|
|
137
163
|
carried.push({ ...structuredClone(held), adds: structuredClone(adds) });
|
|
138
164
|
}
|
|
139
|
-
this.
|
|
165
|
+
const revoked = this.revokedDots.get(sessionId);
|
|
166
|
+
const restored = revoked === undefined ? rows : rows.flatMap((r) => {
|
|
167
|
+
const adds = r.adds.filter((a) => !revoked.has(`${a.dot.actor}#${a.dot.counter}`));
|
|
168
|
+
return adds.length === 0 ? [] : [{ ...r, adds }];
|
|
169
|
+
});
|
|
170
|
+
this.rows.set(sessionId, [...restored, ...carried]);
|
|
140
171
|
this.bumpEpoch(sessionId);
|
|
141
172
|
}
|
|
142
173
|
}
|
|
@@ -776,7 +776,11 @@ export declare function removePersistedRule(opts: {
|
|
|
776
776
|
/** Whose bucket. A bare string stays the principal shorthand (unchanged callers); the structural
|
|
777
777
|
* {@link RuleOwner} form adds the local-owner bucket (downstream request, 2026-08-10 — design/182 §4.5's
|
|
778
778
|
* `forLocalOwner()` face existed, but removal could not name it, so a local-owner rule was
|
|
779
|
-
* unrevokable through this entry). Same observed-remove/add-wins/stillLive semantics either way.
|
|
779
|
+
* unrevokable through this entry). Same observed-remove/add-wins/stillLive semantics either way.
|
|
780
|
+
* NOT consulted for a session scope: a session row is bounded by its session id and records no owner, so a session-scope
|
|
781
|
+
* removal (through `revokeSessionRule`) does not compare this argument with anyone, and
|
|
782
|
+
* `effective({ sessionId })` reads a session's rows for any principal. A host that shares one provider with a session partition
|
|
783
|
+
* among several principals owes the guarantee that a session id belongs to its caller. */
|
|
780
784
|
principal: string | RuleOwner;
|
|
781
785
|
provider: import("./permission-rule-provider.js").PermissionRuleStoreProvider;
|
|
782
786
|
}): Promise<RemoveResult>;
|
|
@@ -2,6 +2,7 @@ import { randomBytes } from "node:crypto";
|
|
|
2
2
|
import { canonicalize, textContentHashOf } from "./canonical-json.js";
|
|
3
3
|
import { escapeForDisclosure, isRuleBehavior, isRuleLive, parseRuleText } from "./permission-rule-model.js";
|
|
4
4
|
import { readRuleOwner } from "./rule-owner.js";
|
|
5
|
+
import { callGrantRowFault } from "./session-call-grant.js";
|
|
5
6
|
import { PRINCIPAL_NAME_SPELLING } from "./principal-name.js";
|
|
6
7
|
import { thrownText } from "./thrown-value.js";
|
|
7
8
|
import { validatePath } from "./effective-path-target.js";
|
|
@@ -226,6 +227,10 @@ export function joinFrontiers(a, b) {
|
|
|
226
227
|
export function normalizePersistedRule(r) {
|
|
227
228
|
if (!isRuleBehavior(r.behavior))
|
|
228
229
|
return { reject: "invalid_rule_text" };
|
|
230
|
+
if (r.match === "call") {
|
|
231
|
+
const fault = callGrantRowFault(r);
|
|
232
|
+
return fault === undefined ? { rule: r } : { reject: fault };
|
|
233
|
+
}
|
|
229
234
|
const parsed = parseRuleText(r.rule, r.behavior);
|
|
230
235
|
if ("reject" in parsed)
|
|
231
236
|
return { reject: "invalid_rule_text" };
|
|
@@ -574,11 +579,29 @@ export async function removePersistedRule(opts) {
|
|
|
574
579
|
return { status: "failed", error: `removePersistedRule: ${NO_TARGET_OWNER} — refusing to remove from a bucket nobody can name`, committed: "no" };
|
|
575
580
|
const provider = opts.provider;
|
|
576
581
|
if (scope?.kind === "session") {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
error: "
|
|
580
|
-
|
|
581
|
-
|
|
582
|
+
const sessionId = scope.sessionId;
|
|
583
|
+
if (!isValidConsentScope(scope))
|
|
584
|
+
return { status: "failed", error: "removePersistedRule: a session scope names a session by a non-empty id — refusing to remove from a session nobody can name", committed: "no" };
|
|
585
|
+
const revoke = provider.revokeSessionRule;
|
|
586
|
+
if (revoke === undefined) {
|
|
587
|
+
const why = provider.partitions.session
|
|
588
|
+
? "this deployment's session rule partition implements no revoke(sessionId, target) — its rows end only with their session"
|
|
589
|
+
: "this deployment configured no session rule partition (createPermissionRuleStoreProvider({ session })) — there is no session row to remove";
|
|
590
|
+
return { status: "failed", error: `unsupported.session_scope_store: ${why}`, committed: "no" };
|
|
591
|
+
}
|
|
592
|
+
let answered;
|
|
593
|
+
try {
|
|
594
|
+
answered = await revoke(sessionId, { behavior, rule });
|
|
595
|
+
}
|
|
596
|
+
catch (err) {
|
|
597
|
+
return { status: "failed", error: `the session rule partition's revoke threw: ${errText(err)}`, committed: "unknown" };
|
|
598
|
+
}
|
|
599
|
+
const a = answered !== null && typeof answered === "object" ? answered : {};
|
|
600
|
+
if (a.refused === "session_ended" && a.revoked === undefined)
|
|
601
|
+
return { status: "no-op", rev: 0, stillLive: "no" };
|
|
602
|
+
if (typeof a.revoked === "number" && a.refused === undefined)
|
|
603
|
+
return a.revoked > 0 ? { status: "removed", rev: 0, stillLive: "no" } : { status: "no-op", rev: 0, stillLive: "no" };
|
|
604
|
+
return { status: "failed", error: "the session rule partition answered the revoke with neither of its two arms (revoked / refused) — whether the row is gone is unknown; reconcile by reading the session's rules", committed: "unknown" };
|
|
582
605
|
}
|
|
583
606
|
if (owner.kind === "local-owner" && provider.forLocalOwner === undefined) {
|
|
584
607
|
return { status: "failed", error: "this provider has no local-owner bucket (forLocalOwner is not implemented) — a local-owner rule cannot be removed through it", committed: "no" };
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
* 「以为挡住了」比没挡更危险。`primaryFieldGeneric:"allow-lexical"` 显式解锁。
|
|
72
72
|
*/
|
|
73
73
|
import { type NamedToolPolicy, type ToolPolicy } from "./tool-policy.js";
|
|
74
|
-
import { parsePermissionRule, type ParsedPermissionRule } from "
|
|
74
|
+
import { formatPermissionRule, parsePermissionRule, type ParsedPermissionRule } from "@sema-agent/primitives";
|
|
75
75
|
import { type PathRuleBases } from "./permission-rule-model.js";
|
|
76
76
|
import type { RuleSource } from "./permission-rule-provider.js";
|
|
77
|
-
export { parsePermissionRule, type ParsedPermissionRule };
|
|
77
|
+
export { parsePermissionRule, formatPermissionRule, type ParsedPermissionRule };
|
|
78
78
|
export interface PermissionRule {
|
|
79
79
|
/** CC 语法:`"Tool"` 或 `"Tool(param:pattern)"`。`Tool()`/`Tool(*)` 归一为裸规则;括号可 `\(`/`\)` 转义。 */
|
|
80
80
|
rule: string;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { attest } from "./tool-policy.js";
|
|
2
|
-
import { MCP_NAMESPACE } from "@sema-agent/primitives";
|
|
2
|
+
import { MCP_NAMESPACE, formatPermissionRule, indexOfUnescaped, lastIndexOfUnescaped, parsePermissionRule, ruleSpellingOf } from "@sema-agent/primitives";
|
|
3
3
|
import { catalogRuleFaceOf, isShellFaceToolName, pathTargetOf } from "./tool-registry.js";
|
|
4
4
|
import { HOST_UNREADABLE_SENTENCE, callHostTargetOf } from "./host-target.js";
|
|
5
|
-
import { indexOfUnescaped, lastIndexOfUnescaped, parsePermissionRule, ruleSpellingOf } from "./permission-rule-syntax.js";
|
|
6
5
|
import { callPathFaceOf, canonicalNameValue, COMMAND_RULE_TOOL, domainRuleAdmits, ruleWordsOf, mountedOnlyArgumentOf, mountedValueArmOf, NAME_RULE_FACES, nameRuleReach, nameRuleSubjectOf, nameValueAbsentReason, nameValuesUnreadReason, parseRuleText, PATH_RULE_BASE_LABEL, PATH_RULE_FACES, programRunReachOf, ruleLaneOf, unusableDeclaredBase, ruleShapeOf, shellRuleParamOf, ruleContentOf } from "./permission-rule-model.js";
|
|
7
6
|
import { callTargetReadingOf, callTargetViewsOf } from "./effective-path-target.js";
|
|
8
7
|
import { DEFAULT_MAX_SCALAR_VALUE_CHARS, paramRuleReaches } from "./param-rule-reach.js";
|
|
@@ -10,7 +9,7 @@ import { bindPathRules, judgeRuleRows, policyAnchors, rowsWhereTheyLead } from "
|
|
|
10
9
|
import { ruleDenialSentence } from "./rule-denial-sentence.js";
|
|
11
10
|
import { deliverEngineNotice } from "./engine-notice.js";
|
|
12
11
|
import { heldValues } from "./tool-name-readings.js";
|
|
13
|
-
export { parsePermissionRule };
|
|
12
|
+
export { parsePermissionRule, formatPermissionRule };
|
|
14
13
|
function describeBehavior(v) {
|
|
15
14
|
switch (typeof v) {
|
|
16
15
|
case "undefined": return "undefined";
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Does a string START or END with white space — the very reading the name rule's last clause (`edge_whitespace` of {@link judgePrincipalName}) takes
|
|
3
|
+
* and the clause the refusal sentence is made of, over the same set (ECMAScript's `\s`: the characters `String#trim` takes off). `starts` — its
|
|
4
|
+
* first character is white space; `ends` — its last is (a string of white space only does both; the empty string neither). Only the EDGES are read:
|
|
5
|
+
* white space inside a string is not asked, and nothing else of the name rule (visible content, length, characters, well-formedness) is. For a
|
|
6
|
+
* reader whose input is wider than a principal name — a stored name an earlier release wrote, a filter target, a key that may carry a reserved
|
|
7
|
+
* prefix — and that must still agree with the name rule on what an edge of white space is, instead of keeping a second definition of it.
|
|
8
|
+
*/
|
|
9
|
+
export declare function whiteSpaceAtEdgesOf(raw: string): {
|
|
10
|
+
readonly starts: boolean;
|
|
11
|
+
readonly ends: boolean;
|
|
12
|
+
};
|
|
1
13
|
/** The longest name any face keeps, in UTF-16 units (what `String#length` counts; an astral character is two): the principal's name rule
|
|
2
14
|
* and the box's name spelling (a receipt id, a lease owner, a decision move's holder) read this one number. It only ever widens, and a
|
|
3
15
|
* widening is announced one release before the release that makes it — a host sizes its columns by it and by {@link PRINCIPAL_NAME_MAX_BYTES}. */
|
|
@@ -4,6 +4,9 @@ const NOT_VISIBLE = new RegExp(`[${WHITE_SPACE}\\p{Cf}]+`, "gu");
|
|
|
4
4
|
const ONLY_WHITE_SPACE = new RegExp(`^${WHITE_SPACE}*$`, "u");
|
|
5
5
|
const STARTS_WHITE = new RegExp(`^${WHITE_SPACE}`, "u");
|
|
6
6
|
const ENDS_WHITE = new RegExp(`${WHITE_SPACE}$`, "u");
|
|
7
|
+
export function whiteSpaceAtEdgesOf(raw) {
|
|
8
|
+
return { starts: STARTS_WHITE.test(raw), ends: ENDS_WHITE.test(raw) };
|
|
9
|
+
}
|
|
7
10
|
const UNPAIRED_SURROGATE = /\p{Cs}/u;
|
|
8
11
|
export const PRINCIPAL_NAME_MAX_CHARS = 256;
|
|
9
12
|
export const PRINCIPAL_NAME_MAX_BYTES = 3 * PRINCIPAL_NAME_MAX_CHARS;
|
|
@@ -15,7 +18,7 @@ const FAULT_OF = {
|
|
|
15
18
|
refused_character: () => "a string holding a control, separator or format character",
|
|
16
19
|
ill_formed: () => "a string holding an unpaired surrogate",
|
|
17
20
|
edge_whitespace: (raw) => {
|
|
18
|
-
const
|
|
21
|
+
const { starts, ends } = whiteSpaceAtEdgesOf(String(raw));
|
|
19
22
|
return `a string that ${starts && ends ? "starts and ends" : starts ? "starts" : "ends"} with white space`;
|
|
20
23
|
},
|
|
21
24
|
};
|
|
@@ -31,7 +34,8 @@ export function judgePrincipalName(raw) {
|
|
|
31
34
|
return refusal("refused_character", raw);
|
|
32
35
|
if (UNPAIRED_SURROGATE.test(raw))
|
|
33
36
|
return refusal("ill_formed", raw);
|
|
34
|
-
|
|
37
|
+
const edges = whiteSpaceAtEdgesOf(raw);
|
|
38
|
+
if (edges.starts || edges.ends)
|
|
35
39
|
return refusal("edge_whitespace", raw);
|
|
36
40
|
return { ok: true, name: raw };
|
|
37
41
|
}
|
|
@@ -12,8 +12,8 @@ export type ReadRootGrantLasts = (typeof READ_ROOT_GRANT_LASTS)[number];
|
|
|
12
12
|
/** `granted` ⇔ an `allow` whose grant is byte-equal to the request's `readRootCandidate.dir` (the candidate rides
|
|
13
13
|
* back whole, `covers` and `lasts` included), with `lasts` the duration the answer can take: `"session"` only when the
|
|
14
14
|
* answer asked for it, the card offered it, and a person answered — else `"run"`, and `narrowed` says why a
|
|
15
|
-
* `"session"` answer became `"run"`. Otherwise `rejected` with ONE reason, the card's `offered`
|
|
16
|
-
* and the `requested` grant when it was a string (verbatim host text — a notice bounds it). */
|
|
15
|
+
* `"session"` answer became `"run"`. Otherwise `rejected` with ONE reason (a choice that did not take), the card's `offered`
|
|
16
|
+
* dir when it had one, and the `requested` grant when it was a string (verbatim host text — a notice bounds it). */
|
|
17
17
|
export type ReadRootGrantScreen = {
|
|
18
18
|
readonly verdict: "granted";
|
|
19
19
|
readonly candidate: ReadRootGrantCandidate;
|
|
@@ -21,13 +21,14 @@ export type ReadRootGrantScreen = {
|
|
|
21
21
|
readonly narrowed?: "not_offered" | "not_a_person";
|
|
22
22
|
} | {
|
|
23
23
|
readonly verdict: "rejected";
|
|
24
|
-
readonly reason: "
|
|
24
|
+
readonly reason: "not_a_string" | "lasts_invalid" | "no_candidate" | "mismatch";
|
|
25
25
|
readonly offered?: string;
|
|
26
26
|
readonly requested?: string;
|
|
27
27
|
};
|
|
28
|
-
/** Screen
|
|
29
|
-
*
|
|
30
|
-
|
|
28
|
+
/** Screen an ALLOW's two grant members, each read once by the caller (a grant rides an approval: a refusal carries no grant
|
|
29
|
+
* screen, and nothing is announced for it); `{}` when the answer carried neither. `byPerson`: a person answered (not a
|
|
30
|
+
* deployment's policy) — the only party whose yes may become a standing session rule. */
|
|
31
|
+
export declare function readRootGrantSeat(grant: unknown, lasts: unknown, candidate: ReadRootGrantCandidate | undefined, byPerson: boolean): {
|
|
31
32
|
readRootGrant?: ReadRootGrantScreen;
|
|
32
33
|
};
|
|
33
34
|
/** An engine-owned copy of a card's offer (one read per member), taken before an approver can touch the object. */
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
export const READ_ROOT_GRANT_LASTS = Object.freeze(["session", "run"]);
|
|
2
2
|
const isLasts = (v) => READ_ROOT_GRANT_LASTS.some((w) => w === v);
|
|
3
|
-
export function readRootGrantSeat(grant, lasts, candidate,
|
|
3
|
+
export function readRootGrantSeat(grant, lasts, candidate, byPerson) {
|
|
4
4
|
if (grant === undefined && lasts === undefined)
|
|
5
5
|
return {};
|
|
6
6
|
const offered = candidate !== undefined ? { offered: candidate.dir } : {};
|
|
7
7
|
const requested = typeof grant === "string" ? { requested: grant } : {};
|
|
8
|
-
const reason =
|
|
9
|
-
: grant
|
|
10
|
-
:
|
|
11
|
-
:
|
|
12
|
-
:
|
|
13
|
-
:
|
|
14
|
-
: undefined;
|
|
8
|
+
const reason = grant === undefined ? "lasts_invalid"
|
|
9
|
+
: typeof grant !== "string" ? "not_a_string"
|
|
10
|
+
: lasts !== undefined && !isLasts(lasts) ? "lasts_invalid"
|
|
11
|
+
: candidate === undefined ? "no_candidate"
|
|
12
|
+
: grant !== candidate.dir ? "mismatch"
|
|
13
|
+
: undefined;
|
|
15
14
|
if (reason !== undefined)
|
|
16
15
|
return { readRootGrant: { verdict: "rejected", reason, ...offered, ...requested } };
|
|
17
16
|
const narrowed = lasts !== "session" ? undefined : candidate.lasts !== "session" ? "not_offered" : !byPerson ? "not_a_person" : undefined;
|
|
@@ -72,9 +72,10 @@ export declare const WORKSPACE_HANDLE_MEMBERS: ReadonlyArray<keyof WorkspaceHand
|
|
|
72
72
|
* structured-clone step to fail on an exotic value. Each member is read the way the engine's own handle comparison reads it.
|
|
73
73
|
*
|
|
74
74
|
* ONE copy per live handle: a second call for the same object answers the copy the first call made (the members are read
|
|
75
|
-
* once), so every place the engine hands a checkpointed handle to the outside — the resume preflight's facts
|
|
76
|
-
*
|
|
77
|
-
*
|
|
75
|
+
* once), so every place the engine hands a checkpointed handle to the outside — the resume preflight's facts, the env
|
|
76
|
+
* factory's {@link ExecutionEnvFactoryContext.priorHandle} and the restore's {@link VmLifecycleOptions.priorHandle} —
|
|
77
|
+
* delivers the same object, not three renderings of one fact; the row judge reads the handle through this copy too, and
|
|
78
|
+
* the factory's {@link ExecutionEnvFactoryContext.placementTarget} is folded from it ({@link placementTargetOf}).
|
|
78
79
|
*/
|
|
79
80
|
export declare function frozenHandleCopy(handle: WorkspaceHandle): Readonly<WorkspaceHandle>;
|
|
80
81
|
/**
|
|
@@ -207,9 +208,9 @@ export interface VmLifecycleOptions {
|
|
|
207
208
|
* as the legacy current-config behavior).
|
|
208
209
|
*
|
|
209
210
|
* A frozen copy holding exactly the declared members ({@link WORKSPACE_HANDLE_MEMBERS}) the checkpoint row carries
|
|
210
|
-
* as strings ({@link frozenHandleCopy}: the SAME object the resume preflight's facts
|
|
211
|
-
*
|
|
212
|
-
*
|
|
211
|
+
* as strings ({@link frozenHandleCopy}: the SAME object the resume preflight's facts and the env factory's
|
|
212
|
+
* {@link ExecutionEnvFactoryContext.priorHandle} carry, for the same row) — not the stored row's own object: writing to
|
|
213
|
+
* it throws, and a decoration on the stored handle is absent.
|
|
213
214
|
*/
|
|
214
215
|
priorHandle?: Readonly<WorkspaceHandle>;
|
|
215
216
|
}
|
|
@@ -547,7 +548,9 @@ export interface RemoteExecutionEnv extends ExecutionEnv {
|
|
|
547
548
|
* Tear down the workspace and release provider resources. Best-effort; must never throw (like `cleanup`).
|
|
548
549
|
* **Must be idempotent** — safe to call more than once (the second call is a no-op). The Runner calls it
|
|
549
550
|
* once on task end, and `prepareTask` calls it on a prepare-time throw; a remote impl may also be reaped,
|
|
550
|
-
* so a defensive double-call must not error or double-bill.
|
|
551
|
+
* so a defensive double-call must not error or double-bill. One leg is not torn down: a leg handed
|
|
552
|
+
* {@link ExecutionEnvFactoryContext.priorHandle} that ends before its approved action starts, while its
|
|
553
|
+
* checkpoint row is pending again (or cannot be proven otherwise) — see that member.
|
|
551
554
|
*
|
|
552
555
|
* contract note: on a NON-isolated env (no `capabilities.isolation` — host lane, SSH host),
|
|
553
556
|
* destroy() is workspace/object-level cleanup and must NOT reap still-running background processes —
|
|
@@ -713,6 +716,36 @@ export interface ExecutionEnvFactoryContext {
|
|
|
713
716
|
* alone.
|
|
714
717
|
*/
|
|
715
718
|
placementTarget?: PlacementTarget;
|
|
719
|
+
/**
|
|
720
|
+
* The workspace THIS leg must go back to. Present exactly on a leg that resumes a checkpoint row which recorded one
|
|
721
|
+
* (`CheckpointState.workspaceHandle` — a park-only row and a snapshot row alike), as that handle's one frozen copy
|
|
722
|
+
* ({@link frozenHandleCopy}: the SAME object the resume preflight's facts and the restore's
|
|
723
|
+
* {@link VmLifecycleOptions.priorHandle} carry): exactly the declared members the row carries as strings — `sandboxId`,
|
|
724
|
+
* `provider`, `mountPath`, and `snapshotId` / `sessionToken` / `restoreMode` / `deviceId` when recorded; writing to it
|
|
725
|
+
* throws. Only the row this leg itself resumes: no leg it spawns, wakes or hands work to inherits it.
|
|
726
|
+
*
|
|
727
|
+
* Present ⇒ the factory **MUST** go back to that workspace — a park-only row (`restoreMode: "park_only"`, no
|
|
728
|
+
* `snapshotId`): attach to it where it persists (the same container / directory / device, at its `mountPath`); a
|
|
729
|
+
* snapshot row: mint an env whose `resumeVM` restores into it — or **THROW** its own refusal (an `env.` code ends the leg
|
|
730
|
+
* as an environment failure, and the row returns to pending). It **MUST NOT** mint a fresh workspace in its place: the
|
|
731
|
+
* engine does not compare `sandboxId` (an adapter that reconnects may mint a new one per connection), so a fresh
|
|
732
|
+
* workspace at the same `mountPath` is not caught. On which target to mint is still {@link placementTarget}'s answer
|
|
733
|
+
* alone (folded from this same copy: a member the row states wins), never this member's.
|
|
734
|
+
*
|
|
735
|
+
* ABSENT (not an `undefined` value) ⇒ no workspace was recorded for this leg — a first leg, a delegated child, a
|
|
736
|
+
* retained agent woken from its in-process snapshot (no checkpoint row), a later leg of a composition, a resume of a row
|
|
737
|
+
* that recorded none, a purpose other than `"run"` — and the factory mints as usual. A parked agent revived through its
|
|
738
|
+
* checkpoint row, a workflow's parked child driven on, a resume in this process or another: each resumes a row, so each
|
|
739
|
+
* carries its own row's handle.
|
|
740
|
+
*
|
|
741
|
+
* The env minted for this member belongs to that row until the leg's approved action starts. A leg that ends before then
|
|
742
|
+
* leaves the env as the row's outcome says: the row pending again, or its state unprovable ⇒ the engine drops its reference
|
|
743
|
+
* and does NOT call `destroy()` (the workspace is what the row's retry goes back to; the adapter reclaims an env no retry
|
|
744
|
+
* comes for); the row not coming back ⇒ `destroy()`, as on every other leg's end. Destroyed at the refusal itself, whatever
|
|
745
|
+
* the row: an env whose own report disproves the recorded workspace (another `provider`; another `deviceId` where the row
|
|
746
|
+
* recorded one; on a park-only row, a root the env resolves to another directory) and one whose `postResumeInit` failed.
|
|
747
|
+
*/
|
|
748
|
+
priorHandle?: Readonly<WorkspaceHandle>;
|
|
716
749
|
}
|
|
717
750
|
/**
|
|
718
751
|
* A **trusted control-plane** factory that mints a per-task {@link ExecutionEnv} (design/48 §5 answers core
|
|
@@ -722,7 +755,8 @@ export interface ExecutionEnvFactoryContext {
|
|
|
722
755
|
*
|
|
723
756
|
* The remote model is "one container per task", so the factory is invoked once per task. The Runner owns the
|
|
724
757
|
* lifetime of a factory-produced env: if it implements {@link RemoteExecutionEnv.destroy} (see {@link hasDestroy}),
|
|
725
|
-
* the Runner calls it when the task ends
|
|
758
|
+
* the Runner calls it when the task ends — save on a resume leg that ends before its approved action while its row comes
|
|
759
|
+
* back ({@link ExecutionEnvFactoryContext.priorHandle}).
|
|
726
760
|
*/
|
|
727
761
|
export type ExecutionEnvFactory = (ctx: ExecutionEnvFactoryContext) => ExecutionEnv | Promise<ExecutionEnv>;
|
|
728
762
|
/** True when `env` exposes a lifecycle {@link RemoteExecutionEnv.destroy} the Runner should call on task end. */
|
|
@@ -62,7 +62,7 @@ export function resumeConfigVerdictOf(question, seats) {
|
|
|
62
62
|
const supplied = readResumeConfig(question.taskConfig);
|
|
63
63
|
const internals = snapshotResumeInternals(bag);
|
|
64
64
|
resolveResumeStore(supplied, seats.deps);
|
|
65
|
-
const config = refuseResumeDoors(supplied, seats.deps, seats.sessions, internals);
|
|
65
|
+
const config = refuseResumeDoors(supplied, seats.deps, seats.sessions, internals, row.resourceLedger);
|
|
66
66
|
refuseRecordedAndMountedToolNames(row, internals, config.tools);
|
|
67
67
|
refuseRetiredInheritedConstraints(internals);
|
|
68
68
|
refuseScopesOffInheritedIsolationScope(row.isolationScope || undefined, config.isolationScope || undefined, config);
|
|
@@ -22,7 +22,11 @@
|
|
|
22
22
|
* installation record): a retry under the same configuration fails the same way;
|
|
23
23
|
* · `decision_rejected` — the supplied decision does not fit the checkpoint (another gate's answer, an
|
|
24
24
|
* unsafe payload, an input the constraints refuse): correct the decision and resubmit. A refusal of the row itself
|
|
25
|
-
* (`checkpoint.invalid_outcome` carrying a `reason`) is not this: no decision cures it, and no cause names it
|
|
25
|
+
* (`checkpoint.invalid_outcome` carrying a `reason`) is not this: no decision cures it, and no cause names it;
|
|
26
|
+
* · `superseded` — the run's grant stopped being current after the resume's claim won (`holder.superseded`): the row is not this
|
|
27
|
+
* run's any more. This run does not resume it again, ask for a fresh decision, or expire it: it is the run's current holder's,
|
|
28
|
+
* whatever state it is in now (a row put back to pending is replayed by that holder). This is the one cause where "can resuming
|
|
29
|
+
* again cure it" is not this run's question, so {@link resumeAgainMayCure} has no answer for it.
|
|
26
30
|
*/
|
|
27
31
|
import type { AssertAllKeysHandled } from "./ask-origin.js";
|
|
28
32
|
import { type CorruptSessionForm } from "../internal/harness.js";
|
|
@@ -51,7 +55,7 @@ import type { TerminalFailureDetail, UnstartedRowOutcome } from "./terminal-caus
|
|
|
51
55
|
*/
|
|
52
56
|
export declare const REOPEN_REASONS: readonly ["env_failed", "tool_unavailable", "constraint_rejected", "config_refused"];
|
|
53
57
|
export type ReopenReason = (typeof REOPEN_REASONS)[number];
|
|
54
|
-
export declare const RESUME_STARTUP_CAUSES: readonly ["environment", "session_gone", "transcript_corrupt", "tool_unavailable", "configuration", "decision_rejected"];
|
|
58
|
+
export declare const RESUME_STARTUP_CAUSES: readonly ["environment", "session_gone", "transcript_corrupt", "tool_unavailable", "configuration", "decision_rejected", "superseded"];
|
|
55
59
|
export type ResumeStartupCause = (typeof RESUME_STARTUP_CAUSES)[number];
|
|
56
60
|
/** The cause a resume failure's code names; `undefined` when the code is absent or the table does not
|
|
57
61
|
* name it. Every `config.*` code is a configuration door's refusal; every `env.*` code is the execution environment's
|
|
@@ -88,6 +92,7 @@ declare const REOPEN_REASON_OF_CAUSE: {
|
|
|
88
92
|
readonly tool_unavailable: "tool_unavailable";
|
|
89
93
|
readonly configuration: "config_refused";
|
|
90
94
|
readonly decision_rejected: "constraint_rejected";
|
|
95
|
+
readonly superseded: "env_failed";
|
|
91
96
|
};
|
|
92
97
|
export type ReopenReasonTableCoversEveryCause = AssertAllKeysHandled<Exclude<ResumeStartupCause, keyof typeof REOPEN_REASON_OF_CAUSE>>;
|
|
93
98
|
/**
|
|
@@ -96,8 +101,9 @@ export type ReopenReasonTableCoversEveryCause = AssertAllKeysHandled<Exclude<Res
|
|
|
96
101
|
* decision is untouched, and the retry replays it.
|
|
97
102
|
*/
|
|
98
103
|
export declare function reopenReasonOf(cause: ResumeStartupCause | undefined): ReopenReason;
|
|
99
|
-
/** {@link RESUME_AGAIN_MAY_CURE}'s answer for `cause`; a cause not known (`undefined`) answers as the `env_failed` reopen it takes:
|
|
100
|
-
|
|
104
|
+
/** {@link RESUME_AGAIN_MAY_CURE}'s answer for `cause`; a cause not known (`undefined`) answers as the `env_failed` reopen it takes:
|
|
105
|
+
* yes. `undefined` for a cause whose row is not this run's (`superseded`): no answer, and no host move follows from one. */
|
|
106
|
+
export declare function resumeAgainMayCure(cause: ResumeStartupCause | undefined): boolean | undefined;
|
|
101
107
|
/** What a resume leg's failure says of itself, as the reopened sentence reads it: its cause, the transcript's form when the failure
|
|
102
108
|
* states one, and the session store the transcript is in (whose doors the way out of that form names). */
|
|
103
109
|
export interface UnstartedFailure {
|
|
@@ -143,6 +149,15 @@ export type UnstartedRow = {
|
|
|
143
149
|
* Every exit calls it; none re-reads the outcome another way.
|
|
144
150
|
*/
|
|
145
151
|
export declare function compensateUnstarted(reopen: (reason: ReopenReason) => Promise<"reopened" | "declined">, reason: ReopenReason, claimedRowPending: () => Promise<boolean>): Promise<UnstartedRow>;
|
|
152
|
+
/**
|
|
153
|
+
* THE one reading of what a claimed row's outcome leaves in place — the four things a retry of the row needs: the session's pin, the
|
|
154
|
+
* parked constraint entry, this process's record of the parked env, and the env a leg sent back to the row's workspace was minted.
|
|
155
|
+
* `true` when the row came back (`reopened`) or may have (`unknown` — destroying on state that cannot be proven is the refusal): all
|
|
156
|
+
* four stay. `false` when it did not (`declined`) or no compensation was asked (`undefined`: the action started, a negative decision
|
|
157
|
+
* was delivered, the leg completed or paused): each exit releases them as it always did. Both exits — the thrown one and the
|
|
158
|
+
* returned one — read this, over the answer their own compensation got.
|
|
159
|
+
*/
|
|
160
|
+
export declare function rowKeepsWhatItsRetryNeeds(row: UnstartedRowOutcome | undefined): boolean;
|
|
146
161
|
/**
|
|
147
162
|
* The row read {@link compensateUnstarted} asks after a reopen that threw, bound to the row the leg claimed: `true` only when the row
|
|
148
163
|
* reads `pending` at a generation past the one the claim won at (`claimed` is the row as the resume read it, before its claim) — the
|
|
@@ -3,7 +3,7 @@ import { corruptSessionWayOutSentence, isCorruptSessionForm } from "../internal/
|
|
|
3
3
|
import { parkNounOf } from "./park-noun.js";
|
|
4
4
|
import { egressThrownText } from "./untrusted-egress.js";
|
|
5
5
|
export const REOPEN_REASONS = Object.freeze(["env_failed", "tool_unavailable", "constraint_rejected", "config_refused"]);
|
|
6
|
-
export const RESUME_STARTUP_CAUSES = Object.freeze(["environment", "session_gone", "transcript_corrupt", "tool_unavailable", "configuration", "decision_rejected"]);
|
|
6
|
+
export const RESUME_STARTUP_CAUSES = Object.freeze(["environment", "session_gone", "transcript_corrupt", "tool_unavailable", "configuration", "decision_rejected", "superseded"]);
|
|
7
7
|
const CAUSE_OF_CODE = new Map([
|
|
8
8
|
["resume.env_failed", "environment"],
|
|
9
9
|
["checkpoint.resume_aborted", "environment"],
|
|
@@ -22,6 +22,8 @@ const CAUSE_OF_CODE = new Map([
|
|
|
22
22
|
["checkpoint.invalid_outcome", "decision_rejected"],
|
|
23
23
|
["resume.constraint_rejected", "decision_rejected"],
|
|
24
24
|
["resume.constraint_unprojectable", "decision_rejected"],
|
|
25
|
+
["holder.superseded", "superseded"],
|
|
26
|
+
["holder.malformed", "configuration"],
|
|
25
27
|
]);
|
|
26
28
|
export function resumeStartupCauseOf(code, refusal) {
|
|
27
29
|
if (code === undefined)
|
|
@@ -49,6 +51,7 @@ const REOPEN_REASON_OF_CAUSE = {
|
|
|
49
51
|
tool_unavailable: "tool_unavailable",
|
|
50
52
|
configuration: "config_refused",
|
|
51
53
|
decision_rejected: "constraint_rejected",
|
|
54
|
+
superseded: "env_failed",
|
|
52
55
|
};
|
|
53
56
|
export function reopenReasonOf(cause) {
|
|
54
57
|
return cause === undefined ? "env_failed" : REOPEN_REASON_OF_CAUSE[cause];
|
|
@@ -60,6 +63,7 @@ const RESUME_AGAIN_MAY_CURE = {
|
|
|
60
63
|
tool_unavailable: false,
|
|
61
64
|
configuration: false,
|
|
62
65
|
decision_rejected: false,
|
|
66
|
+
superseded: undefined,
|
|
63
67
|
};
|
|
64
68
|
export function resumeAgainMayCure(cause) {
|
|
65
69
|
return cause === undefined ? true : RESUME_AGAIN_MAY_CURE[cause];
|
|
@@ -77,6 +81,9 @@ export async function compensateUnstarted(reopen, reason, claimedRowPending) {
|
|
|
77
81
|
return landed ? { kind: "reopened", reason } : { kind: "unknown", thrown };
|
|
78
82
|
}
|
|
79
83
|
}
|
|
84
|
+
export function rowKeepsWhatItsRetryNeeds(row) {
|
|
85
|
+
return row === "reopened" || row === "unknown";
|
|
86
|
+
}
|
|
80
87
|
export function claimedRowPendingOf(store, token, claimed) {
|
|
81
88
|
const claimedRev = checkpointRevOf(claimed);
|
|
82
89
|
return async () => {
|
|
@@ -86,21 +93,33 @@ export function claimedRowPendingOf(store, token, claimed) {
|
|
|
86
93
|
}
|
|
87
94
|
export function unstartedRowSentence(row, parked, failure) {
|
|
88
95
|
const noun = parkNounOf(parked);
|
|
96
|
+
const fact = unstartedRowFact(row, noun);
|
|
97
|
+
if (failure !== undefined && failure.cause !== undefined && resumeAgainMayCure(failure.cause) === undefined)
|
|
98
|
+
return `${fact}. This run's grant is no longer current, so the next step on it is not this run's (no second resume, no fresh ${noun.grant}, no expire): where it stands now is for the run's current holder`;
|
|
99
|
+
switch (row.kind) {
|
|
100
|
+
case "reopened":
|
|
101
|
+
return reopenedUnstartedSentence(fact, row.reason, noun, failure);
|
|
102
|
+
case "declined":
|
|
103
|
+
return `${fact}. Check where it stands now before deciding anything: if it is waiting again, ${noun.again}; if it is gone or already used, carrying on needs a fresh ${noun.grant}`;
|
|
104
|
+
case "unknown":
|
|
105
|
+
return `${fact}. Check where it stands before deciding anything, and do not ask for a fresh ${noun.grant} until that is known: the old one may still be usable`;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function unstartedRowFact(row, noun) {
|
|
89
109
|
switch (row.kind) {
|
|
90
110
|
case "reopened":
|
|
91
|
-
return
|
|
111
|
+
return `${noun.started} never started, so the checkpoint was REOPENED (pending)`;
|
|
92
112
|
case "declined":
|
|
93
|
-
return `${noun.started} never started, and ${noun.waiting} could not be put back to waiting: it is no longer the one this resume took (it is gone, has expired, was already used, or is waiting again)
|
|
113
|
+
return `${noun.started} never started, and ${noun.waiting} could not be put back to waiting: it is no longer the one this resume took (it is gone, has expired, was already used, or is waiting again)`;
|
|
94
114
|
case "unknown":
|
|
95
|
-
return `${noun.started} never started, and putting ${noun.waiting} back to waiting failed partway (${egressThrownText("same-principal", row.thrown)}), so it is not known whether it is waiting now
|
|
115
|
+
return `${noun.started} never started, and putting ${noun.waiting} back to waiting failed partway (${egressThrownText("same-principal", row.thrown)}), so it is not known whether it is waiting now`;
|
|
96
116
|
}
|
|
97
117
|
}
|
|
98
118
|
const UNCURED_RETRY_SENTENCE = {
|
|
99
119
|
session_gone: (lead, noun) => `${lead}: the transcript it resumes on is gone, so resuming it again fails the same way until the transcript is restored — restore it and then ${noun.again}, or give up the parked step (expire the checkpoint)`,
|
|
100
120
|
transcript_corrupt: (lead, _noun, failure) => `${lead}: the transcript it resumes on is damaged, so resuming it again fails the same way until that is dealt with — ${failure.form !== undefined ? corruptSessionWayOutSentence(failure.form, failure.sessions ?? {}) : "restore the transcript, or remove it and give up the parked step (expire the checkpoint)"}`,
|
|
101
121
|
};
|
|
102
|
-
function reopenedUnstartedSentence(reason, noun, failure) {
|
|
103
|
-
const lead = `${noun.started} never started, so the checkpoint was REOPENED (pending)`;
|
|
122
|
+
function reopenedUnstartedSentence(lead, reason, noun, failure) {
|
|
104
123
|
const cause = failure?.cause;
|
|
105
124
|
if (cause !== undefined && Object.hasOwn(UNCURED_RETRY_SENTENCE, cause))
|
|
106
125
|
return UNCURED_RETRY_SENTENCE[cause](lead, noun, failure);
|
|
@@ -39,6 +39,10 @@ export interface RewindConversationRequest {
|
|
|
39
39
|
* read by the same one resolver — absent falls through to the deployment's `RunnerDeps.checkpointStore`, `"disabled"` says the session
|
|
40
40
|
* has no store. The parked-session check asks the store this names. */
|
|
41
41
|
checkpointStore?: TaskSpec["checkpointStore"];
|
|
42
|
+
/** The grant the host's verb acts under — the member `CompactSessionRequest.holder` states, met by the same door (refused here as
|
|
43
|
+
* `rewind.invalid_spec`, nothing rewound). The `leaf` entry the rewind writes carries it; a grant the store does not hold current
|
|
44
|
+
* refuses that write: `holder.superseded`, nothing written — do not retry. */
|
|
45
|
+
holder?: string;
|
|
42
46
|
}
|
|
43
47
|
/** `Runner.rewindConversation`'s answer. A refusal is a thrown `Error` carrying a `code` — a preview's the same code the rewind would
|
|
44
48
|
* throw, at the same door. */
|