@sema-agent/core 7.70.0 → 7.71.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +740 -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 +21 -7
- 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 +69 -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 +39 -21
- package/dist/index.js +32 -17
- 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 +173 -15
- package/wire-changes/core-stores-sql@7.71.0.json +40 -0
- package/wire-changes/core-stores-sql@7.71.1.json +40 -0
- package/wire-changes/core@7.71.0.json +5827 -0
- package/wire-changes/core@7.71.1.json +118 -0
- package/wire-changes/mods-kernel@7.71.0.json +52 -0
- package/wire-changes/mods-kernel@7.71.1.json +40 -0
- package/wire-changes/primitives@7.71.0.json +473 -0
- package/wire-changes/primitives@7.71.1.json +40 -0
- package/wire-changes/wiki-gate@7.71.0.json +40 -0
- package/wire-changes/wiki-gate@7.71.1.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
|
@@ -24,9 +24,11 @@ import { modelLaneBrainOf } from "./model-lane-seat.js";
|
|
|
24
24
|
import { legPrefixObservers, observingBrain } from "./prefix-ledger.js";
|
|
25
25
|
import { storedPromptHashSalt } from "./session-hash-salt.js";
|
|
26
26
|
import { projectRequestCopies } from "../request-copy-projection.js";
|
|
27
|
+
import { assertStoreJudgesHolder } from "../checkpoint-generation.js";
|
|
28
|
+
import { stampHolder } from "./session-write-ledger.js";
|
|
27
29
|
import { acquireExistingSession, claimIdleSession, readOccupantExpectation, readPlainRequest, refuseParkedSession, shownValue } from "./session-verb-doors.js";
|
|
28
30
|
const VERB = "Runner.compactSession";
|
|
29
|
-
const REQUEST_KEYS = new Set(["sessionId", "model", "instructions", "compaction", "getApiKeyAndHeaders", "checkpointStore", "signal", "expect", ...Object.keys(RETIRED_COMPACT_SESSION_KEYS)]);
|
|
31
|
+
const REQUEST_KEYS = new Set(["sessionId", "model", "instructions", "compaction", "getApiKeyAndHeaders", "checkpointStore", "signal", "expect", "holder", ...Object.keys(RETIRED_COMPACT_SESSION_KEYS)]);
|
|
30
32
|
const SETTINGS_KEYS = new Set(["manualCompact", "reserveTokens", "keepRecentTokens", "instructions", ...Object.keys(RETIRED_COMPACTION_SEAT_KEYS)]);
|
|
31
33
|
export async function compactIdleSession(seats, request) {
|
|
32
34
|
const req = withSeatTaken(screenCompactSessionRequest(request), seats.liveModels);
|
|
@@ -34,6 +36,7 @@ export async function compactIdleSession(seats, request) {
|
|
|
34
36
|
const tellFastTier = fastTierNoticeTo(deps.onError, req.sessionId);
|
|
35
37
|
const resolved = resolveRunModel({ model: req.model }, deps, "compactSession.model", tellFastTier);
|
|
36
38
|
const store = resolveCheckpointStore(req.checkpointStore !== undefined ? { checkpointStore: req.checkpointStore } : {}, deps);
|
|
39
|
+
assertStoreJudgesHolder("session", "RunnerDeps.sessionStore", seats.sessions, req.holder, "host");
|
|
37
40
|
if (req.signal?.aborted === true)
|
|
38
41
|
return { outcome: "mooted", events: [] };
|
|
39
42
|
const release = await claimIdleSession(seats, req.sessionId, () => sessionBusyRefusal(req.sessionId));
|
|
@@ -42,7 +45,8 @@ export async function compactIdleSession(seats, request) {
|
|
|
42
45
|
const acquired = await acquireExistingSession(seats.sessions, req.sessionId, VERB, "nothing was compacted", req.expect);
|
|
43
46
|
await refuseParkedSession(store, req.sessionId, req.checkpointStore !== undefined ? "the request's" : "the deployment's", PARKED);
|
|
44
47
|
legMods = await admitLegMods({ listed: listLegModSeats({ spec: {}, deps }), deps, sessionId: req.sessionId });
|
|
45
|
-
|
|
48
|
+
const storage = acquired.session.getStorage();
|
|
49
|
+
return await compactOnSession(req, deps, new StoredSession(pinnedToLeaf(req.holder !== undefined ? stampHolder(storage, req.holder) : storage)), resolved, legMods, acquired.session);
|
|
46
50
|
}
|
|
47
51
|
finally {
|
|
48
52
|
legMods?.end();
|
|
@@ -210,7 +214,7 @@ function asError(err) {
|
|
|
210
214
|
}
|
|
211
215
|
function screenCompactSessionRequest(request) {
|
|
212
216
|
const bad = (what) => {
|
|
213
|
-
const e = new Error(`${VERB}: ${what} — nothing was compacted. The request is { sessionId, model, instructions?, compaction?, getApiKeyAndHeaders?, checkpointStore?, signal?, expect? }.`);
|
|
217
|
+
const e = new Error(`${VERB}: ${what} — nothing was compacted. The request is { sessionId, model, instructions?, compaction?, getApiKeyAndHeaders?, checkpointStore?, signal?, expect?, holder? }.`);
|
|
214
218
|
e.code = "compact.invalid_request";
|
|
215
219
|
throw e;
|
|
216
220
|
};
|
|
@@ -218,7 +222,7 @@ function screenCompactSessionRequest(request) {
|
|
|
218
222
|
const retired = retiredKeyOf(read, RETIRED_COMPACT_SESSION_KEYS);
|
|
219
223
|
if (retired !== undefined)
|
|
220
224
|
return bad(retiredKeyRefusal(retired, "compactSession").message);
|
|
221
|
-
const { sessionId, model, instructions, compaction, getApiKeyAndHeaders, checkpointStore, signal, expect } = read;
|
|
225
|
+
const { sessionId, model, instructions, compaction, getApiKeyAndHeaders, checkpointStore, signal, expect, holder } = read;
|
|
222
226
|
if (typeof sessionId !== "string" || sessionId === "")
|
|
223
227
|
return bad(`sessionId must be a non-empty string, got ${shownValue(sessionId)}`);
|
|
224
228
|
if (model === undefined)
|
|
@@ -229,9 +233,12 @@ function screenCompactSessionRequest(request) {
|
|
|
229
233
|
return bad(`getApiKeyAndHeaders must be a function when given, got ${shownValue(getApiKeyAndHeaders)}`);
|
|
230
234
|
if (signal !== undefined && !(signal instanceof AbortSignal))
|
|
231
235
|
return bad(`signal must be an AbortSignal when given, got ${shownValue(signal)}`);
|
|
236
|
+
if (holder !== undefined && (typeof holder !== "string" || holder === ""))
|
|
237
|
+
return bad(`holder must be a non-empty string when given (the grant the verb acts under), got ${holder === "" ? "an empty string" : `a ${holder === null ? "null" : typeof holder}`}`);
|
|
232
238
|
return {
|
|
233
239
|
sessionId,
|
|
234
240
|
model: model,
|
|
241
|
+
holder,
|
|
235
242
|
instructions,
|
|
236
243
|
compaction: compaction === undefined ? undefined : screenSettings(compaction, bad),
|
|
237
244
|
getApiKeyAndHeaders: getApiKeyAndHeaders,
|
|
@@ -6,8 +6,16 @@
|
|
|
6
6
|
* layer's chain entry and the entry's digest binds it.
|
|
7
7
|
*
|
|
8
8
|
* WHERE A RESUMED LEG'S CHAIN COMES FROM — one function, {@link revivalParentConstraints}: a chain the caller handed live (a
|
|
9
|
-
* trusted caller in this process — the workflow continuation hands its host leg's
|
|
10
|
-
* the token when
|
|
9
|
+
* trusted caller in this process — the workflow continuation hands its host leg's, a drive from a leg's context that leg's), else the
|
|
10
|
+
* live chain this runner registered for the token when the leg parked on it (its spawn's chain, or the one an earlier revival on this
|
|
11
|
+
* runner ran under), else the chain REBUILT layer by layer from the row's record and this runner's own inputs. A handed chain is taken
|
|
12
|
+
* as handed (it is its giver's chain now).
|
|
13
|
+
* THE ROOT TASK'S OWN LAYER (a `taskPolicy` layer stamped `rootLeg`) is the root task's policy the host hands for this revival
|
|
14
|
+
* (`parkedResume.rootPolicy` → `RunInternals.rootPolicy`) on the live chain as on a rebuilt one — one reading of the root task's
|
|
15
|
+
* policy, whichever runner the revival lands on; the live chain keeps that layer's regime (its approver, its mandates, its
|
|
16
|
+
* classifier) and every other layer as registered. A live chain resumed with no root policy handed keeps the root layer as
|
|
17
|
+
* registered (at the agent's last park on this runner), and says so (`permission.revival_root_policy_unrestated`; a rebuild without
|
|
18
|
+
* one is refused, below). The rebuild:
|
|
11
19
|
* · `installation` = `admitModChain(RunnerDeps.mods, the seat's mods)` — the seat's mods as they land on the revived leg's spec;
|
|
12
20
|
* · `deploymentPolicy` = this runner's `RunnerDeps.toolPolicy`;
|
|
13
21
|
* · `taskPolicy` = the root task's own policy the host handed (`parkedResume.rootPolicy` → `RunInternals.rootPolicy`), for a
|
|
@@ -29,7 +37,7 @@ import { type LegModBus } from "../mods/stations.js";
|
|
|
29
37
|
import { type Checkpoint, type CheckpointToken } from "../checkpoint-store.js";
|
|
30
38
|
import type { ToolPolicy } from "../tool-policy.js";
|
|
31
39
|
import type { AutoModeDecider } from "../auto-mode.js";
|
|
32
|
-
import type { PermissionMode, RunnerDeps, TaskSpec } from "../types.js";
|
|
40
|
+
import type { EngineNotice, PermissionMode, RunnerDeps, TaskSpec } from "../types.js";
|
|
33
41
|
import type { InheritedGate } from "./contracts.js";
|
|
34
42
|
type Chain = NonNullable<InheritedGate["parentConstraints"]>;
|
|
35
43
|
type Layer = Chain[number];
|
|
@@ -89,13 +97,24 @@ export interface RevivalChainInput {
|
|
|
89
97
|
readonly leg: Pick<TaskSpec, "mods" | "onAsk" | "approvalReach">;
|
|
90
98
|
/** The root task's own caller policy the host handed (`RunInternals.rootPolicy`). */
|
|
91
99
|
readonly rootPolicy: ToolPolicy | undefined;
|
|
100
|
+
/** Told when the live chain is taken with its root task layer as registered (no root policy handed for a chain that has one).
|
|
101
|
+
* The callback only records a flag; the resume ladder mints the notice ({@link revivalRootPolicyUnrestatedNotice}) and delivers it
|
|
102
|
+
* when the resume's claim is won (`runtask.ts`). */
|
|
103
|
+
readonly onRootLayerUnrestated: () => void;
|
|
92
104
|
}
|
|
93
105
|
/**
|
|
94
|
-
* THE chain a resumed leg runs under (see the module header): handed live ⇒ that; registered live ⇒ that
|
|
95
|
-
* `undefined` when the row requires no parent constraint and nothing was handed or
|
|
106
|
+
* THE chain a resumed leg runs under (see the module header): handed live ⇒ that; registered live ⇒ that, its root task layer the
|
|
107
|
+
* root policy handed now; recorded ⇒ rebuilt. `undefined` when the row requires no parent constraint and nothing was handed or
|
|
108
|
+
* registered. Throws pre-claim:
|
|
96
109
|
* `resume.parent_constraint_unrebuildable` (a layer whose input this resume or this runner lacks), or `reading_changed` (a chain an
|
|
97
110
|
* earlier release recorded without kinds that this runner cannot read, below). Only a rebuild is asynchronous (its mods admission):
|
|
98
111
|
* a handed or a live chain is returned on the calling tick, so the resume's next rung starts in the same continuation.
|
|
99
112
|
*/
|
|
100
113
|
export declare function revivalParentConstraints(input: RevivalChainInput): InheritedGate["parentConstraints"] | undefined | Promise<Chain>;
|
|
114
|
+
/** The account of a resume on the runner that holds the parked agent's chain live, handed no root task policy for a chain that
|
|
115
|
+
* carries the root task's own layer (`permission.revival_root_policy_unrestated`): the resume takes that layer as this runner
|
|
116
|
+
* registered it when the agent last parked here (its spawn, or an earlier revival here) — on another runner the same resume is
|
|
117
|
+
* refused for it (`resume.parent_constraint_unrebuildable`, field `rootPolicy`). The choice only records a flag; the resume ladder
|
|
118
|
+
* mints this notice and delivers it once the claim is won (`runtask.ts`). */
|
|
119
|
+
export declare function revivalRootPolicyUnrestatedNotice(sessionId: string): EngineNotice;
|
|
101
120
|
export {};
|
|
@@ -28,12 +28,31 @@ export function revivalParentConstraints(input) {
|
|
|
28
28
|
return input.handed;
|
|
29
29
|
const live = input.registry.get(input.token);
|
|
30
30
|
if (live !== undefined)
|
|
31
|
-
return live;
|
|
31
|
+
return liveChainNow(live, input);
|
|
32
32
|
const record = input.record;
|
|
33
33
|
if (record?.requiresParentConstraint !== true)
|
|
34
34
|
return input.handed;
|
|
35
35
|
return rebuiltParentConstraints(input, record);
|
|
36
36
|
}
|
|
37
|
+
const isRootTaskLayer = (layer) => layer.kind === "taskPolicy" && layer.rootLeg === true;
|
|
38
|
+
const isRootTaskPolicy = (layer) => layer.policy !== undefined && isRootTaskLayer(layer);
|
|
39
|
+
function liveChainNow(live, input) {
|
|
40
|
+
if (!live.some(isRootTaskPolicy))
|
|
41
|
+
return live;
|
|
42
|
+
const now = input.rootPolicy;
|
|
43
|
+
if (now === undefined) {
|
|
44
|
+
input.onRootLayerUnrestated();
|
|
45
|
+
return live;
|
|
46
|
+
}
|
|
47
|
+
return live.map((layer) => (layer.policy !== undefined && isRootTaskPolicy(layer) ? { ...layer, policy: now } : layer));
|
|
48
|
+
}
|
|
49
|
+
export function revivalRootPolicyUnrestatedNotice(sessionId) {
|
|
50
|
+
return {
|
|
51
|
+
code: "permission.revival_root_policy_unrestated",
|
|
52
|
+
message: "a parked agent resumed on the runner that holds its inherited chain was handed no root task policy (`rootPolicy`), so the chain it runs under keeps the root task's layer as this runner registered it when the agent last parked here — a rule the root task gained since is not in it, and one it dropped since still holds; hand the root task's policy as it is now to resume under it (on another runner the same resume is refused for the missing policy)",
|
|
53
|
+
detail: { sessionId },
|
|
54
|
+
};
|
|
55
|
+
}
|
|
37
56
|
async function rebuiltParentConstraints(input, record) {
|
|
38
57
|
const recorded = record.constraintChain;
|
|
39
58
|
if (recorded === undefined || recorded.length === 0)
|
|
@@ -61,7 +80,7 @@ async function rebuiltParentConstraints(input, record) {
|
|
|
61
80
|
else
|
|
62
81
|
gaps.push({ position, kind: entry.kind, lacks: "a handler that judges a tool call on this runner's `RunnerDeps.mods` or the seat's mods", field: "deps", supplied: true });
|
|
63
82
|
}
|
|
64
|
-
else if (entry.kind === "taskPolicy" && !
|
|
83
|
+
else if (entry.kind === "taskPolicy" && !isRootTaskLayer(entry)) {
|
|
65
84
|
gaps.push({ position, kind: entry.kind, lacks: "the task policy a delegated leg declared for itself (not the root task's: no input of a resume names it, and the root task's policy does not stand in for it)", field: "inheritedGate", supplied: false });
|
|
66
85
|
}
|
|
67
86
|
else if (entry.kind === "taskPolicy" || entry.kind === "deploymentPolicy") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isHumanRefusal } from "../gate-outcome.js";
|
|
2
2
|
import { attest } from "../engine-attestation.js";
|
|
3
|
-
import { exactBoundInputHashOf } from "../canonical-json.js";
|
|
3
|
+
import { editOfAnswer, exactBoundInputHashOf } from "../canonical-json.js";
|
|
4
4
|
export function continuationGateOf(input) {
|
|
5
5
|
return {
|
|
6
6
|
judge: async (call, answer) => {
|
|
@@ -34,6 +34,8 @@ export function continuationGateOf(input) {
|
|
|
34
34
|
input.continuationCalls.delete(call.toolCallId);
|
|
35
35
|
}
|
|
36
36
|
const block = result !== null && typeof result === "object" && result.block === true;
|
|
37
|
+
if (!block && editOfAnswer(call.toolName, exactBoundInputHashOf(call.toolName, call.input), result?.updatedInput) !== undefined)
|
|
38
|
+
return { kind: "call_changed" };
|
|
37
39
|
if (!block)
|
|
38
40
|
return { kind: "allow" };
|
|
39
41
|
if (unanswerable)
|
|
@@ -72,6 +72,7 @@ import type { SideCallBook } from "./side-call-account.js";
|
|
|
72
72
|
import type { ModelFallbackSeat } from "./model-fallback-seat.js";
|
|
73
73
|
import type { DrainedLegFrame, LegAt } from "./leg-frame.js";
|
|
74
74
|
import type { cacheFamilyOf } from "./usage-accounting.js";
|
|
75
|
+
import type { RewindOutcome } from "./rewind-outcome.js";
|
|
75
76
|
/** The frozen task-start copies of the caller's tool-face control arrays (the config-doors phase reads them through
|
|
76
77
|
* `readToolFaceLists`, synchronously, before the first await); the driver compiles the selector from them ({@link ToolFaceSnapshot}). */
|
|
77
78
|
export type { ToolFaceLists } from "../tool-face-lists.js";
|
|
@@ -204,6 +205,14 @@ export interface CommittedPause {
|
|
|
204
205
|
cause: import("../types.js").PausedCause;
|
|
205
206
|
scope: string;
|
|
206
207
|
gatedCallId?: string;
|
|
208
|
+
/** The store the park's row was put into and the grant holder that put carried: every later write the run makes on this park (the
|
|
209
|
+
* parked-input migration, the stream's reap) reads them here, never a store or a holder of its own. */
|
|
210
|
+
writes: ParkWrites;
|
|
211
|
+
}
|
|
212
|
+
/** The pair a park's own writes carry: the store its row lives in, and the leg's write holder (`writeHolderOf`; absent ⇒ none). */
|
|
213
|
+
export interface ParkWrites {
|
|
214
|
+
readonly store: import("../checkpoint-store.js").CheckpointStore;
|
|
215
|
+
readonly holder?: string;
|
|
207
216
|
}
|
|
208
217
|
/** The session's date anchor as prepare read it off the branch. The system-prefix date is frozen per
|
|
209
218
|
* SEGMENT — from session start, or from the latest landed compaction, to the next one. */
|
|
@@ -315,6 +324,17 @@ export type StopForDenialLimit = (info: {
|
|
|
315
324
|
}) => void;
|
|
316
325
|
/** The gate's seat inputs for one call (the static seat or the `Skill` tool's per-call reader, the run's skill and allow-list rows). */
|
|
317
326
|
export type GateSeatInputsFor = (calledName: string, wireName: string) => import("../mode-policy.js").PermissionSeatInputs & SkillGateSeats & import("../allow-entry.js").AllowEntryGateSeats;
|
|
327
|
+
/**
|
|
328
|
+
* The leg's ONE write-boundary latch: the word the store refused one of the leg's session writes with, read where the result is
|
|
329
|
+
* assembled — `conflict` (another writer moved the leaf: the caller may evict and retry) or `holder.superseded` (the run's grant is no
|
|
330
|
+
* longer current: stop, never retry). `holder.superseded` outranks `conflict` and is never replaced (`latchWriteRefusal`,
|
|
331
|
+
* branch-writeback.ts). `stop` is the leg's stop, bound once the leg can be stopped: the latch calls it the moment it reads
|
|
332
|
+
* `holder.superseded`, so a lane that swallows a write failure (a turn-boundary compaction) does not send the model another request.
|
|
333
|
+
*/
|
|
334
|
+
export interface WriteRefusal {
|
|
335
|
+
word: "conflict" | "holder.superseded" | undefined;
|
|
336
|
+
stop?: () => void;
|
|
337
|
+
}
|
|
318
338
|
export interface Prepared {
|
|
319
339
|
harness: AgentHarness;
|
|
320
340
|
/** The CONCRETE built-in session (engine-internal: prepare constructs/acquires `StoredSession` itself,
|
|
@@ -378,6 +398,15 @@ export interface Prepared {
|
|
|
378
398
|
approvalPosture: import("../auto-mode-directive.js").ApprovalPostureFacts;
|
|
379
399
|
/** The output-style frame body, rendered once at prepare from the screened `TaskSpec.outputStyle` (absent = no seat). */
|
|
380
400
|
outputStyleFrame?: string;
|
|
401
|
+
/** The run-time reminders (boundary-reminders.ts): their lane as prepare resolved it (the run's traits, the task's switches, a
|
|
402
|
+
* top-level leg), the leg's handle on its session tree's elapsed-time clock (session-prompt-seats.ts), and how it opened (`LegOpening`). */
|
|
403
|
+
runTimeReminders: {
|
|
404
|
+
readonly lane: import("./boundary-reminders.js").RunTimeReminderLane;
|
|
405
|
+
readonly elapsedClock: import("./session-prompt-seats.js").ElapsedTimeClock;
|
|
406
|
+
readonly opening: {
|
|
407
|
+
current?: import("./boundary-reminders.js").LegOpening;
|
|
408
|
+
};
|
|
409
|
+
};
|
|
381
410
|
/** The leg's live permission-mode seat: the effective mode every mode consumer reads, the steer verb writes. */
|
|
382
411
|
permissionMode: PermissionModeController;
|
|
383
412
|
/** The ISOLATION-AWARE working-tree root for this task (a worktree's cwd when `isolation: "worktree"`, else
|
|
@@ -407,10 +436,9 @@ export interface Prepared {
|
|
|
407
436
|
/** Fires when the task aborts (timeout / max turns / end). Passed to `ToolPolicy.check` so a
|
|
408
437
|
* pending human-approval gate is released instead of hanging past the deadline (F4). */
|
|
409
438
|
abortController: AbortController;
|
|
410
|
-
/**
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
};
|
|
439
|
+
/** The leg's write-boundary latch: the word a refused session write said during the run (`conflict` → `errorCode = "conflict"`;
|
|
440
|
+
* `holder.superseded` → the leg stopped on that tick, `errorCode = "holder.superseded"`). */
|
|
441
|
+
writeRefusal: WriteRefusal;
|
|
414
442
|
/** Tool-call ids the gate blocked (policy/hook/plan-mode deny) or suspended —
|
|
415
443
|
* populated only while a consumer is wired (per-tool post hooks or postToolBatch). The runner's
|
|
416
444
|
* batch collector DELETES on match (its tool_execution_end is the only end-event a blocked call
|
|
@@ -464,6 +492,10 @@ export interface Prepared {
|
|
|
464
492
|
/** Prepare-time rewind disclosures (conversation-only branch / no snapshot backend / no file
|
|
465
493
|
* env), echoed verbatim onto `TaskResult.rewindNotes`. Present only when there is something to say. */
|
|
466
494
|
rewindNotes?: NonNullable<TaskResult["rewindNotes"]>;
|
|
495
|
+
/** The leg's record of what its rewind did (`./rewind-outcome.ts`: whether the tree moved, where the conversation's leaf stands,
|
|
496
|
+
* the restore it accepted) — `terminal.rewind` and `TaskResult.fileRestore` on every terminal assembly reads. Absent on a leg that
|
|
497
|
+
* asks for no rewind. The same object the backstop carrier names ({@link TaskIdRef.rewind}). */
|
|
498
|
+
rewindOutcome?: RewindOutcome;
|
|
467
499
|
/** The run's edited-file ledger read face — what its OWN hands landed, as `TaskResult.editedFiles`
|
|
468
500
|
* (undefined when nothing landed: the key is absent, never an empty array). A LIVE reader rather
|
|
469
501
|
* than a snapshot, so the throw-path backstop terminal reports the same ledger the ordinary
|
|
@@ -484,6 +516,15 @@ export interface Prepared {
|
|
|
484
516
|
/** The normalized deny ADDITIONS in force (deployment ∪ task ∪ checkpoint seed; built-ins excluded), echoed on
|
|
485
517
|
* `TaskResult.effectiveReadDenyPatterns`. Present iff non-empty; a defensive copy (the working array stays the engine's). */
|
|
486
518
|
effectiveReadDenyPatterns?: readonly import("../../tools/fs/read-deny.js").NormalizedReadDenyEntry[];
|
|
519
|
+
/** owned (value) — the leg's one resolution of `TaskSpec.blockReadsOutsideRoots` (the hands phase's answer, a resumed row's
|
|
520
|
+
* record included), echoed on `TaskResult.effectiveBlockReadsOutsideRoots`. Present (`true`) iff it is on. */
|
|
521
|
+
effectiveBlockReadsOutsideRoots?: true;
|
|
522
|
+
/** owned (value) — the command sandbox requirement the leg runs under (`TaskSpec.sandbox` as judged, a resumed row's recorded
|
|
523
|
+
* requirement as its floor — the value the leg's rows record), echoed on `TaskResult.effectiveSandbox`. Present iff one stands. */
|
|
524
|
+
effectiveSandbox?: import("../command-sandbox.js").TaskSandboxSettings;
|
|
525
|
+
/** owned (value) — the leg's external-content-target fold (the environment's declaration ∨ a resumed row's record ∨ the later-leg
|
|
526
|
+
* seat a composition hands), echoed on `TaskResult.effectiveExternalContentTarget`. Present (`true`) iff on. */
|
|
527
|
+
effectiveExternalContentTarget?: true;
|
|
487
528
|
/** The leg's declared places; their carried parts are echoed on `TaskResult.effectiveAgent{Config,Home}Dirs`. */ callerPlaces?: import("./leg-caller-places.js").LegCallerPlaces;
|
|
488
529
|
/** The memory-visibility observation prepareMemory minted (echoed on
|
|
489
530
|
* `TaskResult.effectiveMemoryScopes`). Always present on a completed prepare (the memory-less
|
|
@@ -1665,6 +1706,9 @@ export interface InheritedGate extends InheritedAutoModeFace {
|
|
|
1665
1706
|
* had a governance surface (their opaque posture is untouched). Serializable; persists on checkpoints.
|
|
1666
1707
|
*/
|
|
1667
1708
|
orgAdmissionGoverned?: true;
|
|
1709
|
+
/** The chain's one reading of the `sharedArtifactReads` setting (in-process; never on a checkpoint): a leg an engine lane bears takes
|
|
1710
|
+
* it instead of reading the seat again, so a run has one reading; a root leg ignores it, and every wake hands none (`wakeGate`). */
|
|
1711
|
+
sharedArtifactReads?: import("../shared-artifact-reads.js").ResolvedSharedArtifactReads;
|
|
1668
1712
|
/**
|
|
1669
1713
|
* The chain's TOP leg's root and environment home (data half, serializable; persists on the checkpoint's data half):
|
|
1670
1714
|
* the anchors of the person's global and session path rows and of every `~/` row on this chain — a child judges them
|
|
@@ -1976,8 +2020,8 @@ export interface RunInternals {
|
|
|
1976
2020
|
/**
|
|
1977
2021
|
* The own caller policy (`TaskSpec.toolPolicy`, as its resume input holds it now) of the chain's FIRST leg — the leg that inherits
|
|
1978
2022
|
* no chain; a cascade rung is such a leg — not the session root task's; handed by a host that drives a parked delegated leg back
|
|
1979
|
-
* (`parkedResume.rootPolicy`).
|
|
1980
|
-
*
|
|
2023
|
+
* (`parkedResume.rootPolicy`). That leg's layer (`taskPolicy`, `rootLeg`) on a live chain (its regime kept) and on a rebuilt one alike
|
|
2024
|
+
* (`constraint-layers.ts`); none handed ⇒ a live chain keeps it as registered (`permission.revival_root_policy_unrestated`), a rebuild refuses. A policy is asked with the facts of the call it judges (the calling leg's
|
|
1981
2025
|
* `cwd`, roots, target and budget), never with the session it was born in. Neither an opaque policy nor the leg a layer came from
|
|
1982
2026
|
* can be told apart (KL-5107-f): hand that leg's own, never a substitute.
|
|
1983
2027
|
*/
|
|
@@ -2003,6 +2047,12 @@ export interface RunInternals {
|
|
|
2003
2047
|
/** The run TREE's cross-boundary token — the tree's ONE state is reached from it by the engine alone: the spawning leg hands its
|
|
2004
2048
|
* own down (the delegation and workflow lanes), so a bit any leg sets is read by every other at its next judgment; a root leg mints one. */
|
|
2005
2049
|
crossBoundaryTree?: import("../cross-boundary-taint.js").CrossBoundaryTreeToken;
|
|
2050
|
+
/** The external-content-target fold's later-leg seat: `true` ⇒ this leg treats what its environment produces as content from outside
|
|
2051
|
+
* the deployment's trust boundary, whatever the environment declares — a join beside the environment's declaration and a resumed
|
|
2052
|
+
* row's record, never a downgrade. A composition hands it to the legs it runs after a leg whose result carries
|
|
2053
|
+
* `TaskResult.effectiveExternalContentTarget` (the verify gate's verifier and fix legs). Read `=== true`, as the other flags of
|
|
2054
|
+
* this trusted seat are. */
|
|
2055
|
+
externalContentTarget?: true;
|
|
2006
2056
|
/**
|
|
2007
2057
|
* The SESSION-scoped org-admission freeze for a SAME-SESSION continuation
|
|
2008
2058
|
* that is NOT a checkpoint resume: a retained background child revived through the in-process resume
|
|
@@ -2078,9 +2128,13 @@ export interface RunInternals {
|
|
|
2078
2128
|
outcome: ResumeOutcome;
|
|
2079
2129
|
inheritedGate?: InheritedGate;
|
|
2080
2130
|
}>;
|
|
2081
|
-
/** The deployment's credential for the claim this run acts under (an opaque grant id
|
|
2082
|
-
* A resume handed one carries it into its CAS as `expect.holder
|
|
2083
|
-
*
|
|
2131
|
+
/** The deployment's credential for the claim this run acts under (an opaque grant id — `encodeGrantHolder`; a TRUSTED channel like
|
|
2132
|
+
* the decisions above). A resume handed one carries it into its CAS as `expect.holder`, and so does every Workflow drive this run
|
|
2133
|
+
* makes. On a leg the host started, every session write the leg makes carries it too (`SessionWriteOptions.holder`); a leg an engine
|
|
2134
|
+
* lane started (a delegated child, a workflow member, an observer) stamps none, even when a drive handed it one for its CAS. A grant
|
|
2135
|
+
* the store does not hold current is `holder.superseded`: nothing written or applied, the leg stops — do not retry it. Every store
|
|
2136
|
+
* seat the run writes must declare `fence = { holder: "writes" }` (`config.invalid_checkpoint_store` / `config.invalid_session_store`
|
|
2137
|
+
* at the door otherwise). Never inherited by children. */
|
|
2084
2138
|
holder?: string;
|
|
2085
2139
|
/**
|
|
2086
2140
|
* Set ONLY by the Agent tool's fork route (`Agent(subagent_type:"fork")`, a core caller) on the
|
|
@@ -2492,6 +2546,8 @@ export interface RunInternals {
|
|
|
2492
2546
|
* cooldown. Always set by the Runner's own prepare call; absent on a standalone prepareTask, which keeps them for its leg only.
|
|
2493
2547
|
*/
|
|
2494
2548
|
sessionFastModeSeats?: import("./fast-mode-seat.js").SessionFastModeSeats;
|
|
2549
|
+
/** The Runner's per-session prompt facts (session-prompt-seats.ts), by tree root as {@link sessionFastModeSeats}; same posture. */
|
|
2550
|
+
sessionPromptSeats?: import("./session-prompt-seats.js").SessionPromptSeats;
|
|
2495
2551
|
/** Trusted system-injection sink (`Runner.runLocked` wires it to the live TaskStream queue plus the current harness lanes; never a public TaskSpec field),
|
|
2496
2552
|
* ADDRESSED TO THE SESSION rather than to this run: a producer wired here (a background shell, a watch, a delegation settle) keeps the closure long after the
|
|
2497
2553
|
* run that mounted it ended, and its frame is then routed to whatever run the SESSION has live — at that run's next turn boundary, the seat a steer lands on;
|
|
@@ -2785,6 +2841,10 @@ export type BoundarySuspendOutcome = {
|
|
|
2785
2841
|
/** How the put-commit + put-failure saga ended (see `commitSuspendSaga` inside the phase for each arm's meaning). */
|
|
2786
2842
|
export type SuspendSagaOutcome = {
|
|
2787
2843
|
tag: "committed";
|
|
2844
|
+
writes: ParkWrites;
|
|
2845
|
+
} | {
|
|
2846
|
+
tag: "superseded";
|
|
2847
|
+
reason: string;
|
|
2788
2848
|
} | {
|
|
2789
2849
|
tag: "cut";
|
|
2790
2850
|
} | {
|
|
@@ -3175,6 +3235,8 @@ export interface SuspendReap {
|
|
|
3175
3235
|
token: CheckpointToken;
|
|
3176
3236
|
scope: string;
|
|
3177
3237
|
store: CheckpointStore;
|
|
3238
|
+
/** The grant holder the park's put carried ({@link ParkWrites}): the reap's expire is issued in the run's name with it. */
|
|
3239
|
+
holder?: string;
|
|
3178
3240
|
/** The suspended task's session — for onError correlation only (the `token` is a capability and must
|
|
3179
3241
|
* NEVER be logged, checkpoint-store.ts §6). */
|
|
3180
3242
|
sessionId: string;
|
|
@@ -3371,10 +3433,7 @@ export interface RunnerSelfSeat {
|
|
|
3371
3433
|
* on the floor because a lane may not name the orchestrator (docs/LAYERING.json: layer 4 sits above the lanes). Positional,
|
|
3372
3434
|
* exactly as the entry is declared — the seat carries the orchestrator's function itself, not a lane Input.
|
|
3373
3435
|
*/
|
|
3374
|
-
export type PrepareTaskFn = (spec: TaskSpec, deps: RunnerDeps, sessions: SessionStore, resume?: PrepareResume, internals?: RunInternals, runnerSelf?: RunnerSelfSeat, runIdSink?:
|
|
3375
|
-
runId?: string;
|
|
3376
|
-
rowVerified?: boolean;
|
|
3377
|
-
}, holdSessionLock?: (sessionId: string) => Promise<void>, legWrites?: LegWrites, noticeDestinations?: import("../task-notification.js").NoticeDestinationJudge, promptSubmitRef?: import("../input-author.js").PromptSubmitRef, runEnd?: import("./end-of-run.js").RunEnd) => Promise<Prepared>;
|
|
3436
|
+
export type PrepareTaskFn = (spec: TaskSpec, deps: RunnerDeps, sessions: SessionStore, resume?: PrepareResume, internals?: RunInternals, runnerSelf?: RunnerSelfSeat, runIdSink?: Pick<TaskIdRef, "runId" | "rowVerified" | "rewind" | "legEnvForRow">, holdSessionLock?: (sessionId: string) => Promise<void>, legWrites?: LegWrites, noticeDestinations?: import("../task-notification.js").NoticeDestinationJudge, promptSubmitRef?: import("../input-author.js").PromptSubmitRef, runEnd?: import("./end-of-run.js").RunEnd) => Promise<Prepared>;
|
|
3378
3437
|
/** One leg's view of the Runner's session write ledger — `session-write-ledger.ts` states `startAt`, `issue`, `close` and what the close reads. */
|
|
3379
3438
|
export interface LegWrites {
|
|
3380
3439
|
startAt(leaf: string | null): void;
|
|
@@ -3427,6 +3486,8 @@ export interface LiveHandle {
|
|
|
3427
3486
|
/** The run body's backstop CARRIER: the effective ids and the post-prepare
|
|
3428
3487
|
* observations the run body publishes as they are minted, so the stream layer's failure backstop names the
|
|
3429
3488
|
* same run, session and observations the frames the run body already emitted did. */
|
|
3489
|
+
/** What the one assembly of a result's posture seats reads (`resultPostureSeats`): the prepared leg's own resolutions. */
|
|
3490
|
+
export type PostureSeatsSource = Pick<Prepared, "effectiveReadFace" | "effectiveWriteFace" | "effectiveReadDenyPatterns" | "callerPlaces" | "effectiveBlockReadsOutsideRoots" | "effectiveSandbox" | "effectiveExternalContentTarget">;
|
|
3430
3491
|
export interface TaskIdRef {
|
|
3431
3492
|
current?: string;
|
|
3432
3493
|
sessionId?: string;
|
|
@@ -3439,12 +3500,21 @@ export interface TaskIdRef {
|
|
|
3439
3500
|
readFloorUnkept?: {
|
|
3440
3501
|
readonly current: boolean;
|
|
3441
3502
|
};
|
|
3503
|
+
/** The prepared leg's postures, published with the observations above: the backstop's posture seats, by the one assembly. */
|
|
3504
|
+
posture?: PostureSeatsSource;
|
|
3442
3505
|
/** `false` from the moment a leg holding an owner seat starts until its row's owner is verified ({@link RunInternals.onSessionVerified}): a result minted meanwhile names no session (`""`). */
|
|
3443
3506
|
rowVerified?: boolean;
|
|
3444
3507
|
/** Whether the leg's prompt message was committed: `{ committed: false }` from the carrier's creation, replaced at the prompt
|
|
3445
3508
|
* receipt by the commit's reading (`intakeOfCommit`; `undefined` when the store handed back no usable entry id). */
|
|
3446
3509
|
intake?: TaskResult["intake"];
|
|
3447
3510
|
writesAtClose?: ReturnType<LegWrites["close"]>;
|
|
3511
|
+
/** The env a resume leg sent back to its row's workspace was minted, when the leg's prepare refused it and its restore seat did not
|
|
3512
|
+
* disprove that the env stands there: handed here instead of to the rollback, so the backstop keeps it (the row came back, or may
|
|
3513
|
+
* have) or destroys it (the row did not), by the one answer of the compensation (`rowKeepsWhatItsRetryNeeds`, resume-startup-cause.ts). */
|
|
3514
|
+
legEnvForRow?: ExecutionEnv;
|
|
3515
|
+
/** The leg's record of what its rewind did (`./rewind-outcome.ts`), published at prepare's first statements on a leg that asks for
|
|
3516
|
+
* one — the backstop's `terminal.rewind` and `fileRestore` (the same object {@link Prepared.rewindOutcome} names). */
|
|
3517
|
+
rewind?: RewindOutcome;
|
|
3448
3518
|
}
|
|
3449
3519
|
/** The manual `/compact` request seat: the `requested` flag, the parked waiters (each with its
|
|
3450
3520
|
* caller's cancel signal and per-call instructions) and the run body's mooted-frame channel. Whether a new request may
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { targetIsExternal } from "../remote-env.js";
|
|
2
|
+
import { isHolderSuperseded } from "../grant-holder.js";
|
|
2
3
|
import { BOUNDARY_LEGS, CROSS_BOUNDARY_RECORD_TYPE, CROSS_BOUNDARY_TAINT_BITS, STRICTEST_CROSS_BOUNDARY_TREE, crossBoundaryObligation, crossBoundaryPostureUndeclaredNotice, crossBoundaryRecordUnwrittenNotice, crossBoundaryRecordData, crossBoundaryTreeCovers, crossBoundaryTreeGoverned, joinCrossBoundaryTree, readCrossBoundaryRecord, } from "../cross-boundary-taint.js";
|
|
3
4
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
4
5
|
import { personAnswered } from "../real-approval.js";
|
|
@@ -137,7 +138,7 @@ export async function prepareCrossBoundaryLane(input) {
|
|
|
137
138
|
}
|
|
138
139
|
catch (err) {
|
|
139
140
|
const governed = crossBoundaryTreeGoverned(ref.current);
|
|
140
|
-
if (governed && (phase === "exit" || phase === "suspend"))
|
|
141
|
+
if ((governed || isHolderSuperseded(err)) && (phase === "exit" || phase === "suspend"))
|
|
141
142
|
throw err;
|
|
142
143
|
unwritten(phase, state, err);
|
|
143
144
|
if (!governed)
|