@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { delegationOwnerUnbound } from "./delegation-owner.js";
|
|
1
|
+
import { DELEGATION_OWNER_MISMATCH, delegationOwnerUnbound, forkedRowNotOurs } from "./delegation-owner.js";
|
|
2
2
|
import { forkGovernanceDenial, resolveDelegationEntryCaps } from "../../agents/subagent.js";
|
|
3
3
|
import { isLiveQuestionFace } from "../ask-question.js";
|
|
4
4
|
import { parentSpecSeatOf } from "../parent-spec-seat.js";
|
|
@@ -10,6 +10,7 @@ import { inheritedRuleKeyOf } from "../session-policy-store.js";
|
|
|
10
10
|
import { rowFollowsFloor } from "./session-rule-policy.js";
|
|
11
11
|
import { declaresSubagentPlacement } from "../session.js";
|
|
12
12
|
import { durableMandateSourceOf, effectiveDurableApprovalOf } from "../tool-policy.js";
|
|
13
|
+
import { engineLaneLegOf } from "../park-resumability.js";
|
|
13
14
|
import { askSeamFormOf, reachSetsAside, wiringLegKindOf } from "../wiring-manifest.js";
|
|
14
15
|
import { chainAnchorRecords } from "./child-tree.js";
|
|
15
16
|
import { defaultTaskRegistry } from "../task-registry.js";
|
|
@@ -27,6 +28,7 @@ import { reviewRequestFor } from "../present-plan-tool.js";
|
|
|
27
28
|
import { bindRevivedLegClassifier, chainRootLeg, legConstraintLayers } from "./constraint-layers.js";
|
|
28
29
|
export function prepareInheritedGate(input) {
|
|
29
30
|
const { spec, deps, askSeat, internals, resume, sessions, sessionId, runId, hostTaskId, taskRootFinal, delegationCwd, executionEnv, ownedEnv, lockedPreflight, pathRuleAnchors, toolFaceSnapshot, mountsCallerTool, promptLean, resolvedInteractionPosture, permissionModeSeat, spendSeat, harnessRef, skillGrants, forwardEvent, subagentRetain, taskArtifacts, worktreeIsolation, requestReview, requestStopAfterTurn, enterPlanMode, reminderMark, reminderDisclosureCounts, fileHistoryEnabled, historyScope, historyRoot, historyFs, abortRun } = input;
|
|
31
|
+
const sharedArtifactReadsCell = resume === undefined && engineLaneLegOf(internals) && internals?.inheritedGate?.sharedArtifactReads !== undefined ? { current: internals.inheritedGate.sharedArtifactReads } : {};
|
|
30
32
|
const liveInheritedGate = internals?.inheritedGate;
|
|
31
33
|
const seedInheritedGate = resume?.seed.inheritedGate;
|
|
32
34
|
const inheritedRuleBuckets = joinRuleBuckets(readRuleBuckets(liveInheritedGate?.persistedRuleBuckets, "chain"), readRuleBuckets(seedInheritedGate?.persistedRuleBuckets, "checkpoint"));
|
|
@@ -180,6 +182,7 @@ export function prepareInheritedGate(input) {
|
|
|
180
182
|
...(childRuleBuckets !== undefined ? { persistedRuleBuckets: childRuleBuckets } : {}),
|
|
181
183
|
admittedOrgScopes: memoryAdmittedOrgScopesRef.current,
|
|
182
184
|
...(orgGovernedProvenance ? { orgAdmissionGoverned: true } : {}),
|
|
185
|
+
...(sharedArtifactReadsCell.current !== undefined ? { sharedArtifactReads: sharedArtifactReadsCell.current } : {}),
|
|
183
186
|
};
|
|
184
187
|
};
|
|
185
188
|
const carrierReadFace = () => input.resolvedReadFace() ?? input.handsLessResolvedFace();
|
|
@@ -288,9 +291,13 @@ export function prepareInheritedGate(input) {
|
|
|
288
291
|
const tree = await input.delegationOwner.read();
|
|
289
292
|
if (!tree.bound)
|
|
290
293
|
throw delegationOwnerUnbound(tree.reason);
|
|
294
|
+
const source = { sessionId, occupant: input.sessionIncarnation() ?? null };
|
|
291
295
|
const forked = (await sessions.fork(sessionId, tree.owner, forkOpts !== undefined && declaresSubagentPlacement(sessions) ? forkOpts : undefined)) ?? null;
|
|
292
296
|
if (forked === null)
|
|
293
297
|
return null;
|
|
298
|
+
const notOurs = await forkedRowNotOurs(sessions, forked, source);
|
|
299
|
+
if (notOurs !== undefined)
|
|
300
|
+
throw Object.assign(new Error(notOurs), { code: DELEGATION_OWNER_MISMATCH });
|
|
294
301
|
return {
|
|
295
302
|
sessionId: forked,
|
|
296
303
|
release: async () => {
|
|
@@ -319,5 +326,5 @@ export function prepareInheritedGate(input) {
|
|
|
319
326
|
...(spec.enablePlanMode === true ? { enterPlanMode } : {}),
|
|
320
327
|
};
|
|
321
328
|
};
|
|
322
|
-
return { liveInheritedGate, seedInheritedGate, inheritedAncestorRules, inheritedShellGate, inheritedParentConstraints, permissionMode, commitModeSeats, endModeCeiling, inheritedAdmittedOrgScopes, inheritedRuleBuckets, priorOwnOrgVerdict, orgGovernedProvenance, effectiveShellGate, ownSessionRulesRef, ancestorSessionRulesRef, ancestorRulesNow, memoryAdmittedOrgScopesRef, ownOrgVerdictRef, runClampSource, faceCheckpointSection, writeFaceCheckpointSection, skillGrantCheckpointSection, frozenOnAsk, hookEnvSource, frozenOnQuestion, parentSpecSeat, provenanceForChildrenRef, delegationSettlementRef, inheritedGateForChildren, carrierReadFace, carrierWriteFace, fullShellReachable, gateStopRef, stopForDenialLimit, enrichSpecToolCtx };
|
|
329
|
+
return { sharedArtifactReadsCell, liveInheritedGate, seedInheritedGate, inheritedAncestorRules, inheritedShellGate, inheritedParentConstraints, permissionMode, commitModeSeats, endModeCeiling, inheritedAdmittedOrgScopes, inheritedRuleBuckets, priorOwnOrgVerdict, orgGovernedProvenance, effectiveShellGate, ownSessionRulesRef, ancestorSessionRulesRef, ancestorRulesNow, memoryAdmittedOrgScopesRef, ownOrgVerdictRef, runClampSource, faceCheckpointSection, writeFaceCheckpointSection, skillGrantCheckpointSection, frozenOnAsk, hookEnvSource, frozenOnQuestion, parentSpecSeat, provenanceForChildrenRef, delegationSettlementRef, inheritedGateForChildren, carrierReadFace, carrierWriteFace, fullShellReachable, gateStopRef, stopForDenialLimit, enrichSpecToolCtx };
|
|
323
330
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type LegAdoption } from "../../agents/yield-adoption.js";
|
|
2
|
-
import { type WorkflowContinuationGate, type WorkflowParkAdopter } from "../../orchestration/workflow-park-adoption.js";
|
|
2
|
+
import { type WorkflowContinuationGate, type WorkflowParkAdopter, type WorkflowParkDecisionNoticeCode } from "../../orchestration/workflow-park-adoption.js";
|
|
3
3
|
import type { ToolExecuteContext } from "../types.js";
|
|
4
4
|
import type { EngineText } from "../../prompt-assembly/engine-text.js";
|
|
5
5
|
import type { PrepareResume, RunInternals } from "./contracts.js";
|
|
@@ -22,7 +22,7 @@ export interface PrepareLegAdoptionInput {
|
|
|
22
22
|
readonly gate: WorkflowContinuationGate | undefined;
|
|
23
23
|
/** borrowed-readonly — the leg's user-face notice delivery (its address and admission applied by the caller). */
|
|
24
24
|
readonly deliver: (notice: {
|
|
25
|
-
code:
|
|
25
|
+
code: WorkflowParkDecisionNoticeCode;
|
|
26
26
|
message: string;
|
|
27
27
|
detail: Record<string, unknown>;
|
|
28
28
|
}) => void;
|
|
@@ -25,9 +25,11 @@ import { cardTargetFor } from "../existing-target.js";
|
|
|
25
25
|
import { seatOf } from "../tool-name-readings.js";
|
|
26
26
|
import { isolationScopeRecordOf } from "../isolation-scope.js";
|
|
27
27
|
class ParkRefusal extends Error {
|
|
28
|
+
gap;
|
|
28
29
|
constructor(message, options) {
|
|
29
|
-
super(message, options);
|
|
30
|
+
super(message, options !== undefined && "cause" in options ? { cause: options.cause } : undefined);
|
|
30
31
|
this.name = "ParkRefusal";
|
|
32
|
+
this.gap = options?.gap;
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
const wordlessDemand = (toolName) => {
|
|
@@ -194,9 +196,9 @@ export function prepareParkAsk(input) {
|
|
|
194
196
|
}
|
|
195
197
|
const rowRealApproval = realApproval ?? (storedShapeFacts?.requiresRealApproval === true ? { origin: carry?.origin ?? wordlessDemand(req.toolName) } : undefined);
|
|
196
198
|
if (offloadStore && isVolatileOffloadStore(offloadStore) && !offloadStore.isEmpty()) {
|
|
197
|
-
throw new ParkRefusal("durable suspend requires a durable toolResultStore (the
|
|
198
|
-
"
|
|
199
|
-
"RunnerDeps.toolResultStore or
|
|
199
|
+
throw new ParkRefusal("durable suspend requires a durable toolResultStore (the in-memory tool-result store holds offloaded results — " +
|
|
200
|
+
"an oversized tool result, or the text a request-level clear set aside — that are lost across a cross-replica resume); " +
|
|
201
|
+
"inject RunnerDeps.toolResultStore, or turn tool-result offload off (toolResultThresholdChars: 0).", { gap: "volatile_tool_results" });
|
|
200
202
|
}
|
|
201
203
|
if (suspendTargetGap !== undefined) {
|
|
202
204
|
throw new ParkRefusal(perTaskEnvParkRefusal(suspendTargetGap));
|
|
@@ -363,6 +365,7 @@ export function prepareParkAsk(input) {
|
|
|
363
365
|
parkFailed: err instanceof ParkRefusal
|
|
364
366
|
? err.message
|
|
365
367
|
: "the durable approval park could not be prepared (the deployment's error face carries the exception)",
|
|
368
|
+
...(err instanceof ParkRefusal && err.gap !== undefined ? { parkFailedReason: err.gap } : {}),
|
|
366
369
|
};
|
|
367
370
|
try {
|
|
368
371
|
deps.onError?.(err, { phase: "config", sessionId });
|
|
@@ -382,7 +385,7 @@ export function prepareParkAsk(input) {
|
|
|
382
385
|
}
|
|
383
386
|
return { parkFailed: committed.reason };
|
|
384
387
|
}
|
|
385
|
-
publishCommittedSuspend({ pausedRef }, token, gate, cp.scope, remoteHandle, cp);
|
|
388
|
+
publishCommittedSuspend({ pausedRef }, token, gate, cp.scope, remoteHandle, cp, committed.writes);
|
|
386
389
|
try {
|
|
387
390
|
await sessions.pin?.(sessionId);
|
|
388
391
|
}
|
|
@@ -50,6 +50,8 @@ import type { ApprovalWordsSeat } from "../approval-words.js";
|
|
|
50
50
|
import type { EngineText } from "../../prompt-assembly/engine-text.js";
|
|
51
51
|
import { type InheritedAskGrant } from "./inherited-ask-grants.js";
|
|
52
52
|
import { createRuleOffersOf, type PermissionRuleLanes } from "./permission-rule-lanes.js";
|
|
53
|
+
import { createCallGrantDoorOf } from "./session-call-grant-station.js";
|
|
54
|
+
import { type CallBindingSeat } from "../session-call-grant.js";
|
|
53
55
|
import type { ToolCallLike } from "../tool-registry.js";
|
|
54
56
|
import { type HostFloor } from "../host-floor.js";
|
|
55
57
|
import { type CommandSandboxPlan } from "../command-sandbox.js";
|
|
@@ -289,6 +291,9 @@ export interface PreparePolicyChainResult {
|
|
|
289
291
|
};
|
|
290
292
|
/** owned — the ONE rule-offer factory for all five ask-mint sites. */
|
|
291
293
|
ruleOffersOf: ReturnType<typeof createRuleOffersOf>;
|
|
294
|
+
/** owned — the session call grant's door (over {@link ruleOffersOf}'s ladder) and the reading seat the lane judges grants with. */
|
|
295
|
+
callGrantDoorOf: ReturnType<typeof createCallGrantDoorOf>;
|
|
296
|
+
callBindingSeat: () => CallBindingSeat;
|
|
292
297
|
/** owned — the ONE Skill-card binding factory for the same five sites: a call to the engine's `Skill` tool carries the skill and
|
|
293
298
|
* its two lists (`boundGrants`) and their hash (`boundGrantDigest`) on the live ask, an ancestor's and the parked row alike. */
|
|
294
299
|
grantBindingOf: GrantBindingOf;
|
|
@@ -40,6 +40,8 @@ import { settleReadRootGrant } from "./read-root-grant.js";
|
|
|
40
40
|
import { frozenApproverRoute } from "../wiring-manifest.js";
|
|
41
41
|
import { askGrantShapeOf } from "./inherited-ask-grants.js";
|
|
42
42
|
import { createPermissionRuleLanes, inheritedAskRuleEvidence, createRuleOffersOf } from "./permission-rule-lanes.js";
|
|
43
|
+
import { createCallGrantDoorOf, settleUnofferedSessionCallGrant } from "./session-call-grant-station.js";
|
|
44
|
+
import { callGrantAdmits } from "../session-call-grant.js";
|
|
43
45
|
import { createLiveSessionRules, createSessionRulePolicy } from "./session-rule-policy.js";
|
|
44
46
|
import { policyThrowLine, reportPolicyThrow } from "./policy-throw.js";
|
|
45
47
|
import { heldBy, heldValues, seatOf, wireOf } from "../tool-name-readings.js";
|
|
@@ -245,7 +247,7 @@ export async function preparePolicyChain(input) {
|
|
|
245
247
|
const mandatedCallFloats = (station, creq, mark) => resolveCheckpointStore(spec, deps) !== undefined && durableParkOptInDeclared({ forceDurableGate: runtimeCaps?.forceDurableGate === true, durableApprovalDeclared: spec.durableApproval !== undefined, approvalParkNotResumable }) && markInheritedUnavailable(station, creq, mark);
|
|
246
248
|
const mandateUnreconstructibleDeny = (creq) => attest({
|
|
247
249
|
action: "deny",
|
|
248
|
-
message: notResumableSays !== undefined ? notResumableRefusal(`inherited parent policy requires durable approval for "${creq.toolName}"`, notResumableSays
|
|
250
|
+
message: notResumableSays !== undefined ? notResumableRefusal(`inherited parent policy requires durable approval for "${creq.toolName}"`, notResumableSays) : `inherited parent policy requires durable approval for "${creq.toolName}" — the parent's durable ask cannot be reconstructed in a delegated child; denied fail-closed (tighten-only)`,
|
|
249
251
|
}, creq, { unresolvableCause: "mandate_unreconstructible" });
|
|
250
252
|
const markerChannelFullDeny = (creq) => attest({ action: "deny", message: `no approver is reachable for the inherited approval of "${creq.toolName}" and the marker channel is at capacity — denied fail-closed` }, creq, { unresolvableCause: "approver_unavailable" });
|
|
251
253
|
const inheritedAskGrants = new Map();
|
|
@@ -380,7 +382,9 @@ export async function preparePolicyChain(input) {
|
|
|
380
382
|
onDisclosure: (message) => emitTrace(deps.tracer, () => ({ kind: "permission.rule_store_unreadable", version: 1, taskId: hostTaskId, message, ts: Date.now() })),
|
|
381
383
|
stripsAllow: (rule, req) => autoStripReasonOfRow(rule, req, permissionMode.current, listFacts.classifyAllShell),
|
|
382
384
|
};
|
|
383
|
-
const
|
|
385
|
+
const callBindingSeat = () => ({ env: executionEnv, cwd: handsCwdRef?.current ?? taskRootFinal, roots: [taskRootFinal, ...additionalRootsCanonical] });
|
|
386
|
+
const callGrantAdmitsHere = (binding, command, signal) => callGrantAdmits(binding, command, callBindingSeat(), signal);
|
|
387
|
+
const laneOver = { provider: deps.permissionRuleStore, localOwnerDeclared: deps.localOwnerRules === true, principal: spec.principal, ancestorRuleBuckets: inheritedRuleBuckets, ...ruleLaneFacts, rows: personRows, callGrantAdmits: callGrantAdmitsHere };
|
|
384
388
|
const { personal: permissionRuleLane, org: permissionRuleOrgLane, wholeToolRefusals: storedRuleWholeToolRefusals } = createPermissionRuleLanes(laneOver);
|
|
385
389
|
const { personal: permissionRuleGateLane } = createPermissionRuleLanes({ ...laneOver, onAutoStripped: (rule, reason, req) => autoStripNotice({ entry: rule.rule, source: ruleSourceOf(rule.scope), reason }, req) });
|
|
386
390
|
const ruleOffersOf = createRuleOffersOf({
|
|
@@ -396,6 +400,7 @@ export async function preparePolicyChain(input) {
|
|
|
396
400
|
deniesDirectoryRead: readDenyMatcher !== undefined ? (d) => readDenyMatcher.matchPath(d) !== null : undefined,
|
|
397
401
|
...(deps.permissionRuleStore?.a2aPeers !== undefined ? { a2aPeers: deps.permissionRuleStore.a2aPeers } : {}),
|
|
398
402
|
});
|
|
403
|
+
const callGrantDoorOf = createCallGrantDoorOf(ruleOffersOf);
|
|
399
404
|
const readBoundaryRefusalOf = readBoundaryRefusalOver({ judge: readBlockJudge, cwd: () => handsCwdRef?.current, signal: abortController.signal });
|
|
400
405
|
const recheckApprovedEdit = async (pol, onAskOf, creq, edit, approved, csignal, ancestorAutoMode) => {
|
|
401
406
|
const ancestorDecider = ancestorAutoMode?.decider;
|
|
@@ -452,7 +457,7 @@ export async function preparePolicyChain(input) {
|
|
|
452
457
|
return onApproval(editArbitrated.action === "allow" ? { action: "allow", updatedInput: editArgs, decisionReason: "mode" } : editArbitrated);
|
|
453
458
|
}
|
|
454
459
|
const editTarget = await unreadCardTarget(creq.toolName, editArgs);
|
|
455
|
-
const { resolved: rr, judged: settled } = await resolveInheritedAsk(judged, (j, checkpointId) => resolveAskFor({
|
|
460
|
+
const { resolved: rr, judged: settled, presentedAs } = await resolveInheritedAsk(judged, (j, checkpointId) => resolveAskFor({
|
|
456
461
|
toolName: creq.toolName,
|
|
457
462
|
toolCallId: creq.toolCallId,
|
|
458
463
|
checkpointId,
|
|
@@ -471,7 +476,9 @@ export async function preparePolicyChain(input) {
|
|
|
471
476
|
...inheritedAskCarry(j, isAnsweringSeat(onAskOf), ancestorTracker),
|
|
472
477
|
ruleEvidence: inheritedAskEvidence,
|
|
473
478
|
}, heldApprover(onAskOf), csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), j.ask, approverDefectAnnouncer({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice }), approvalWords, engineText, "close"), ancestorTracker, creq, inheritedStationFacts(creq, editArgs));
|
|
474
|
-
|
|
479
|
+
const settleAt = { toolName: creq.toolName, toolCallId: creq.toolCallId, checkpointId: presentedAs, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice };
|
|
480
|
+
void settleReadRootGrant(rr.readRootGrant, undefined, settleAt);
|
|
481
|
+
settleUnofferedSessionCallGrant(rr.sessionCallGrant, settleAt);
|
|
475
482
|
settleDenialLimitFallback({ fallback: settled.fallback, mintedHere: settled.mintedHere, tracker: ancestorTracker, resolved: rr, headless: headlessDenyAtRecheck, stop: stopForDenialLimit, toolName: creq.toolName, toolCallId: creq.toolCallId });
|
|
476
483
|
if (rr.action !== "allow")
|
|
477
484
|
return rr;
|
|
@@ -535,7 +542,9 @@ export async function preparePolicyChain(input) {
|
|
|
535
542
|
...inheritedAskCarry(j, isAnsweringSeat(pc.onAsk), pc.autoMode?.denialTracking),
|
|
536
543
|
ruleEvidence: inheritedAskEvidence,
|
|
537
544
|
}, heldApprover(pc.onAsk), csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), j.ask, approverDefectAnnouncer({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice }), approvalWords, engineText, inheritedLandingOf(creq)), pc.autoMode?.denialTracking, creq, inheritedStationFacts(creq, presentedArgs));
|
|
538
|
-
|
|
545
|
+
const settleAt = { toolName: creq.toolName, toolCallId: creq.toolCallId, checkpointId: presentedAs, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice };
|
|
546
|
+
void settleReadRootGrant(resolved.readRootGrant, undefined, settleAt);
|
|
547
|
+
settleUnofferedSessionCallGrant(resolved.sessionCallGrant, settleAt);
|
|
539
548
|
const askWaitMs = Math.max(0, now() - askT0);
|
|
540
549
|
if (resolved.action === "deny" && resolved.approverUnavailable === true) {
|
|
541
550
|
const floated = floatedInheritedAsk(settled, creq);
|
|
@@ -630,7 +639,9 @@ export async function preparePolicyChain(input) {
|
|
|
630
639
|
...inheritedAskCarry(j, isAnsweringSeat(pc.onAsk), pc.autoMode?.denialTracking),
|
|
631
640
|
ruleEvidence: inheritedAskEvidence,
|
|
632
641
|
}, heldApprover(pc.onAsk), csignal ?? abortController.signal, lateAskSettlementObserver({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), j.ask, approverDefectAnnouncer({ toolName: creq.toolName, toolCallId: creq.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice }), approvalWords, engineText, inheritedLandingOf(creq)), pc.autoMode?.denialTracking, creq, inheritedStationFacts(creq, presentedArgs));
|
|
633
|
-
|
|
642
|
+
const settleAt = { toolName: creq.toolName, toolCallId: creq.toolCallId, checkpointId: presentedAs, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice };
|
|
643
|
+
void settleReadRootGrant(resolved.readRootGrant, undefined, settleAt);
|
|
644
|
+
settleUnofferedSessionCallGrant(resolved.sessionCallGrant, settleAt);
|
|
634
645
|
const askWaitMs = Math.max(0, now() - askT0);
|
|
635
646
|
if (resolved.action === "deny" && resolved.approverUnavailable === true) {
|
|
636
647
|
const floated = floatedInheritedAsk(settled, creq);
|
|
@@ -739,7 +750,7 @@ export async function preparePolicyChain(input) {
|
|
|
739
750
|
return decision;
|
|
740
751
|
})
|
|
741
752
|
: foldedPolicy;
|
|
742
|
-
return { basePolicyForResumeEdit, denyNarrowingPolicy, skillGrantLane, sessionRulesUnread: { own: () => lastReadUnread.own, ancestor: (position) => lastReadUnread.ancestors.get(position) === true }, allowEntryLanes, policyLayers, effectivePolicy, inheritedUnavailableAsks, deferredAskIdentities, inheritedAskGrants, riskAxesOf, ruleOffersOf, grantBindingOf, permissionRuleLane, permissionRuleGateLane, ruleLaneFacts, permissionRuleOrgLane, storedRuleWholeToolRefusals, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, foldAskClasses, ancestorSandboxAdmissions, ancestorArbitrations, inheritedInstallations: installationsOnLeg, hostPoliciesUnderView: { caller: callerPolicy, inherited: (inheritedParentConstraints ?? []).flatMap((c) => (c.policy === undefined ? [] : [c.policy === policy && callerPolicy !== undefined ? callerPolicy : hostPolicyUnderView(c.policy)])) } };
|
|
753
|
+
return { basePolicyForResumeEdit, denyNarrowingPolicy, skillGrantLane, sessionRulesUnread: { own: () => lastReadUnread.own, ancestor: (position) => lastReadUnread.ancestors.get(position) === true }, allowEntryLanes, policyLayers, effectivePolicy, inheritedUnavailableAsks, deferredAskIdentities, inheritedAskGrants, riskAxesOf, ruleOffersOf, callGrantDoorOf, callBindingSeat, grantBindingOf, permissionRuleLane, permissionRuleGateLane, ruleLaneFacts, permissionRuleOrgLane, storedRuleWholeToolRefusals, sandboxAdmissionArmed, sandboxBoundaryCapable, emitSandboxAdmitted, foldAskClasses, ancestorSandboxAdmissions, ancestorArbitrations, inheritedInstallations: installationsOnLeg, hostPoliciesUnderView: { caller: callerPolicy, inherited: (inheritedParentConstraints ?? []).flatMap((c) => (c.policy === undefined ? [] : [c.policy === policy && callerPolicy !== undefined ? callerPolicy : hostPolicyUnderView(c.policy)])) } };
|
|
743
754
|
}
|
|
744
755
|
const advisedPolicyNames = new WeakMap();
|
|
745
756
|
const ADVISED_KEYS_CAP = 64;
|
|
@@ -59,6 +59,9 @@ export interface PreparePromptAssemblyInput {
|
|
|
59
59
|
envFacts: EnvironmentFacts;
|
|
60
60
|
/** borrowed-readonly — the run's effective prompt traits (a selector value of the assembly). */
|
|
61
61
|
promptTraits: ReadonlySet<PromptTraitName>;
|
|
62
|
+
/** borrowed-readonly — the session's shell-first judgment (session-prompt-seats.ts `shellFirstSessionOf`): the `shellFirstSession` fact,
|
|
63
|
+
* the same value the tool cards were mounted with. */
|
|
64
|
+
shellFirstSession: boolean;
|
|
62
65
|
/** borrowed-readonly — the leg announces a non-empty skills listing (`Prepared.skillsListing` with entries): exactly when the
|
|
63
66
|
* engine's own Skill tool is mounted, never for a caller tool that only shares the name. The `skillToolMounted` fact. */
|
|
64
67
|
skillsAnnounced: boolean;
|
|
@@ -11,7 +11,7 @@ import { describeCatalog } from "../../prompt-assembly/explain.js";
|
|
|
11
11
|
import { engineTextFor } from "../../prompt-assembly/engine-text.js";
|
|
12
12
|
import { selectorRecordOf, selectorsOf } from "../../prompt-assembly/select.js";
|
|
13
13
|
import { auditToolCollisions, projectToolManifest } from "../../prompt-assembly/tool-catalog.js";
|
|
14
|
-
import { buildEnvironmentContext } from "../../prompts/default.js";
|
|
14
|
+
import { buildEnvironmentContext, envFactsForFace } from "../../prompts/default.js";
|
|
15
15
|
import { raisePromptCompose } from "../mods/stations.js";
|
|
16
16
|
import { protocolOf } from "@sema-agent/primitives";
|
|
17
17
|
import { thrownText } from "../thrown-value.js";
|
|
@@ -35,7 +35,7 @@ function taskLayerOf(task, sessionId) {
|
|
|
35
35
|
}));
|
|
36
36
|
}
|
|
37
37
|
export async function preparePromptAssembly(input) {
|
|
38
|
-
const { session, deps, internals, resume, sugar, host, binding, locale, modBus, featureFlags, deferred, toolFace, mcpInstructionsBlock, memoryBlock, envFacts, promptTraits, skillsAnnounced, tools, model, sessionId, onceLedger } = input;
|
|
38
|
+
const { session, deps, internals, resume, sugar, host, binding, locale, modBus, featureFlags, deferred, toolFace, mcpInstructionsBlock, memoryBlock, envFacts, promptTraits, shellFirstSession, skillsAnnounced, tools, model, sessionId, onceLedger } = input;
|
|
39
39
|
const topLevel = internals?.parentTaskId === undefined && internals?.parentSessionId === undefined && internals?.parentCenterArtifactDigest === undefined;
|
|
40
40
|
const stored = await session.getPromptEpoch();
|
|
41
41
|
const promptHashSalt = await resolvePromptHashSalt(session, (error, step) => onceLedger.onError(new Error(`prompt digests: the session's hash salt could not be ${step === "read" ? "read" : "stored"} (${thrownText(error)}) — this leg's prompt.assembled hashes, turn-snapshot digests and request heads compare within this leg only (hashScope "leg")`), { phase: "config", sessionId }));
|
|
@@ -93,6 +93,7 @@ export async function preparePromptAssembly(input) {
|
|
|
93
93
|
orchestrationEnabled,
|
|
94
94
|
orchestrationDeferred: orchestrationEnabled && deferred.has("Workflow"),
|
|
95
95
|
skillToolMounted: skillsAnnounced,
|
|
96
|
+
shellFirstSession,
|
|
96
97
|
toolFace,
|
|
97
98
|
};
|
|
98
99
|
const selectors = selectorsOf(facts, host, binding, promptTraits, locale);
|
|
@@ -120,7 +121,7 @@ export async function preparePromptAssembly(input) {
|
|
|
120
121
|
...(envFacts.cwd !== undefined ? { workspaceFolder: envFacts.cwd } : {}),
|
|
121
122
|
mcpInstructionsBlock,
|
|
122
123
|
memoryBlock,
|
|
123
|
-
buildEnvBlock: (date) => buildEnvironmentContext({ ...envFacts, date }, engineTextFor(selectors.locale)) || undefined,
|
|
124
|
+
buildEnvBlock: (date) => buildEnvironmentContext({ ...envFactsForFace(envFacts, selectors.facts.actingToolsAbsent), date }, engineTextFor(selectors.locale)) || undefined,
|
|
124
125
|
date: envFacts.date,
|
|
125
126
|
onWarn: (message, phase) => deps.onError?.(new Error(message), { phase, sessionId }),
|
|
126
127
|
});
|
|
@@ -106,7 +106,7 @@ export interface PrepareSuspendSagaInput {
|
|
|
106
106
|
nestedStats: Prepared["nestedStats"];
|
|
107
107
|
/** borrowed-readonly — the trusted spawn-side channel (the driver's binding, the row id already restored into it):
|
|
108
108
|
* `repairBundle` (the live bundle), `delegationProvenance` (the aggregate copied onto the row) and `rowTaskId` (stamped). */
|
|
109
|
-
internals: Pick<RunInternals, "repairBundle" | "delegationProvenance" | "rowTaskId"> | undefined;
|
|
109
|
+
internals: Pick<RunInternals, "repairBundle" | "delegationProvenance" | "rowTaskId" | "holder" | "isDelegatedChild" | "observerLeg"> | undefined;
|
|
110
110
|
/** borrowed-readonly — the ToolSearch activation set (`Prepared.activeTools`); copied onto the row at mint time. */
|
|
111
111
|
activeTools: Prepared["activeTools"];
|
|
112
112
|
/** borrowed-readonly — the structured-output seat; `value`/`set` are copied onto the row at mint time. */
|
|
@@ -204,6 +204,9 @@ export interface PrepareSuspendSagaInput {
|
|
|
204
204
|
memoryEngineSession: Prepared["memoryEngineSession"];
|
|
205
205
|
/** borrowed-mutable — the loop-cap latch (`Prepared.suspendLoopRef`). Writer here: `hit = true` when the cap trips. */
|
|
206
206
|
suspendLoopRef: Prepared["suspendLoopRef"];
|
|
207
|
+
/** borrowed-mutable — the leg's write-boundary latch (`Prepared.writeRefusal`). Writer here: a put, or the record before it, refused for
|
|
208
|
+
* the run's grant latches `holder.superseded` through the latch's one writer, which stops the leg. */
|
|
209
|
+
writeRefusal: Prepared["writeRefusal"];
|
|
207
210
|
/** borrowed-readonly — the per-task owned env when a factory minted one, or undefined (the capability split). Never
|
|
208
211
|
* destroyed here. */
|
|
209
212
|
ownedEnv: ExecutionEnv | undefined;
|
|
@@ -7,6 +7,9 @@ import { constraintChainDigest, constraintChainEntryOfLayer } from "../tool-poli
|
|
|
7
7
|
import { persistedToolNameList } from "../../agents/tool-filter.js";
|
|
8
8
|
import { raceSettlementAgainstSignal } from "./abort-race.js";
|
|
9
9
|
import { compositionLegRecord, placementValueOrAbsent } from "./checkpoint-scope.js";
|
|
10
|
+
import { writeHolderOf } from "../park-resumability.js";
|
|
11
|
+
import { holderSupersededError, isHolderSuperseded } from "../grant-holder.js";
|
|
12
|
+
import { latchWriteRefusal } from "./branch-writeback.js";
|
|
10
13
|
import { serializeAnnouncedListings } from "./announce-once-ledger.js";
|
|
11
14
|
import { workflowMemberOf } from "../leg-identity.js";
|
|
12
15
|
import { remoteEnvFailureNote, restoreWorkspaceWithRetry } from "./remote-env-retry.js";
|
|
@@ -84,9 +87,11 @@ function stampPlacementRootSessionId(placementRootResolved) {
|
|
|
84
87
|
return placementValueOrAbsent(placementRootResolved);
|
|
85
88
|
}
|
|
86
89
|
export function prepareSuspendSaga(input) {
|
|
87
|
-
const { commandSandboxRequirement, callerPlaces, gateMachineryActive, abortController, harness, checkpointStore, deps, sessionId, hostTaskId, taskScope, liveSpendRef, resume, nestedStats, internals, activeTools, outputRef, readFileStateForCheckpoint, faceCheckpointSection, writeFaceCheckpointSection, readBlock, skillGrantCheckpointSection, skillScopesCheckpointSection, reminderMark, handsCwdRef, handsRoot, handsHome, worktreeSessionRef, undeliveredContinuationRef, inheritedParentConstraints, seedInheritedGate, ancestorRulesNow, inheritedShellGate, permissionMode, inheritedAdmittedOrgScopes, inheritedPathRuleAnchors, inheritedPathRuleInstallations, inheritedRuleBuckets, ownOrgVerdictRef, orgGovernedProvenance, announcedListingsRef, gitStatusRef, askSource, placementRootResolved, compositionLegResolved, checkpointScope, runOrigin, toolCeiling, toolListsJudged, ownToolLists, externalContentTargetActive, crossBoundary, remoteEnvFailures, memoryEngineSession, suspendLoopRef, ownedEnv, workspaceSync } = input;
|
|
90
|
+
const { commandSandboxRequirement, callerPlaces, gateMachineryActive, abortController, harness, checkpointStore, deps, sessionId, hostTaskId, taskScope, liveSpendRef, resume, nestedStats, internals, activeTools, outputRef, readFileStateForCheckpoint, faceCheckpointSection, writeFaceCheckpointSection, readBlock, skillGrantCheckpointSection, skillScopesCheckpointSection, reminderMark, handsCwdRef, handsRoot, handsHome, worktreeSessionRef, undeliveredContinuationRef, inheritedParentConstraints, seedInheritedGate, ancestorRulesNow, inheritedShellGate, permissionMode, inheritedAdmittedOrgScopes, inheritedPathRuleAnchors, inheritedPathRuleInstallations, inheritedRuleBuckets, ownOrgVerdictRef, orgGovernedProvenance, announcedListingsRef, gitStatusRef, askSource, placementRootResolved, compositionLegResolved, checkpointScope, runOrigin, toolCeiling, toolListsJudged, ownToolLists, externalContentTargetActive, crossBoundary, remoteEnvFailures, memoryEngineSession, suspendLoopRef, writeRefusal, ownedEnv, workspaceSync } = input;
|
|
88
91
|
if (!gateMachineryActive)
|
|
89
92
|
return { saga: undefined };
|
|
93
|
+
const putHolder = writeHolderOf(internals);
|
|
94
|
+
const parkWrites = (store) => ({ store, ...(putHolder !== undefined ? { holder: putHolder } : {}) });
|
|
90
95
|
const taskAccess = { owner: hostTaskId, scope: taskScope, sessionId, ...callOccupant(undefined, { occupant: input.legOccupant }) };
|
|
91
96
|
const inFlightSpendMicroUsd = () => {
|
|
92
97
|
const own = liveSpendRef.get?.().costMicroUsd ?? 0;
|
|
@@ -211,6 +216,12 @@ export function prepareSuspendSaga(input) {
|
|
|
211
216
|
if (memoryEngineSession)
|
|
212
217
|
await memoryEngineSession.harvest("checkpoint");
|
|
213
218
|
const recordUnwritten = await crossBoundary.owe(cp.leafId, () => defaultTaskRegistry.owedDeliveries(taskAccess)).then((entryId) => void (entryId !== undefined && (cp = { ...cp, leafId: entryId })), (err) => ({ err }));
|
|
219
|
+
const superseded = async () => {
|
|
220
|
+
latchWriteRefusal(writeRefusal, holderSupersededError("put"));
|
|
221
|
+
if (remoteEnv !== undefined && remoteHandle?.snapshotId !== undefined)
|
|
222
|
+
await compensatePausedVM(remoteEnv, remoteHandle.snapshotId);
|
|
223
|
+
return { tag: "superseded", reason: "the checkpoint was not written: the store refused it because the run's grant is no longer current (another leg holds the run, or the run has ended)" };
|
|
224
|
+
};
|
|
214
225
|
if (cutSignal?.aborted) {
|
|
215
226
|
if (remoteEnv !== undefined && remoteHandle?.snapshotId !== undefined) {
|
|
216
227
|
const back = await compensatePausedVM(remoteEnv, remoteHandle.snapshotId);
|
|
@@ -282,12 +293,15 @@ export function prepareSuspendSaga(input) {
|
|
|
282
293
|
if (recordUnwritten !== undefined)
|
|
283
294
|
throw new Error(`the checkpoint row was not written: the session's cross-boundary record it points at could not be written first (${thrownText(recordUnwritten.err)})`);
|
|
284
295
|
putAttempted = true;
|
|
285
|
-
await checkpointStore.put(token, stamped);
|
|
296
|
+
await (putHolder !== undefined ? checkpointStore.put(token, stamped, { holder: putHolder }) : checkpointStore.put(token, stamped));
|
|
286
297
|
announceCommittedScreeningPark();
|
|
287
|
-
return settled({ tag: "committed" });
|
|
298
|
+
return settled({ tag: "committed", writes: parkWrites(checkpointStore) });
|
|
288
299
|
}
|
|
289
300
|
catch (putErr) {
|
|
301
|
+
const refusedForGrant = putAttempted && isHolderSuperseded(putErr);
|
|
290
302
|
deps.onError?.(putErr, { phase: "config", sessionId });
|
|
303
|
+
if (refusedForGrant)
|
|
304
|
+
return settled(await superseded());
|
|
291
305
|
if (!putAttempted)
|
|
292
306
|
return settled(await compensateNotWritten(recordUnwritten !== undefined ? `the session's cross-boundary record could not be written before its approval could be parked (${thrownText(recordUnwritten.err)}) — on a governed tree a row is not put without its record` : "the approval checkpoint was not written (a check before the write refused it — the row's own requirement judge; the deployment's error face carries why)"));
|
|
293
307
|
const confirmed = await confirmPutOutcome(putErr);
|
|
@@ -302,7 +316,7 @@ export function prepareSuspendSaga(input) {
|
|
|
302
316
|
catch {
|
|
303
317
|
}
|
|
304
318
|
announceCommittedScreeningPark();
|
|
305
|
-
return settled({ tag: "committed" });
|
|
319
|
+
return settled({ tag: "committed", writes: parkWrites(checkpointStore) });
|
|
306
320
|
}
|
|
307
321
|
if (confirmed === "unknown") {
|
|
308
322
|
const unknownReason = "the approval checkpoint's state cannot be established (the store rejected the write and then could not be read back; a committed-but-unacknowledged row may exist) — the run is stopped rather than continued past an approval whose durable record is unknown";
|
|
@@ -322,7 +336,7 @@ export function prepareSuspendSaga(input) {
|
|
|
322
336
|
return settled(await compensateNotWritten("the approval checkpoint could not be persisted (the store rejected the write; the deployment's error face carries the store's own message)"));
|
|
323
337
|
}
|
|
324
338
|
finally {
|
|
325
|
-
capture.settle(outcome?.tag === "committed" ? "committed" : outcome?.tag === "absent" ? "absent" : "indeterminate");
|
|
339
|
+
capture.settle(outcome?.tag === "committed" ? "committed" : outcome?.tag === "absent" ? "absent" : outcome?.tag === "superseded" ? "superseded" : "indeterminate");
|
|
326
340
|
}
|
|
327
341
|
};
|
|
328
342
|
const suspendLoopCapHit = (count, cap, detail) => {
|
|
@@ -11,7 +11,7 @@ export { __resetMaterializeEnvAnnouncements } from "./prepare-tool-disclosure-mo
|
|
|
11
11
|
export { fileHistoryFilesystemIdentity, resolveFileHistoryScope } from "./prepare-file-history.js";
|
|
12
12
|
import { type NoticeDestinationJudge } from "../task-notification.js";
|
|
13
13
|
import type { RunnerSelfSeat } from "./contracts.js";
|
|
14
|
-
import type { Prepared, PrepareResume, PrepareTaskFn, RunInternals } from "./contracts.js";
|
|
14
|
+
import type { Prepared, PrepareResume, PrepareTaskFn, RunInternals, TaskIdRef } from "./contracts.js";
|
|
15
15
|
export type { FileHistoryBoundarySeat, InheritedGate, Prepared, PreparedMicroCompact, PrepareResume, ResolvedWorkspace, RunInternals, UsageGovernance } from "./contracts.js";
|
|
16
16
|
import type { ExecutionEnv } from "../../internal/harness.js";
|
|
17
17
|
import type { PromptSubmitRef } from "../input-author.js";
|
|
@@ -85,10 +85,7 @@ runnerSelf?: RunnerSelfSeat,
|
|
|
85
85
|
/** Carrier for the id minted below, so a prepare that THROWS still lets its caller name the
|
|
86
86
|
* run (prepare emits run-scoped notices of its own; each needs a terminal that names it). Same seat
|
|
87
87
|
* shape the Runner uses for the generated taskId/sessionId. */
|
|
88
|
-
runIdSink?:
|
|
89
|
-
runId?: string;
|
|
90
|
-
rowVerified?: boolean;
|
|
91
|
-
},
|
|
88
|
+
runIdSink?: Pick<TaskIdRef, "runId" | "rowVerified" | "rewind" | "legEnvForRow">,
|
|
92
89
|
/** The Runner's lock on this leg's session, handed only when the spec named none: taken the moment the store mints the id. */
|
|
93
90
|
holdSessionLock?: (sessionId: string) => Promise<void>,
|
|
94
91
|
/** This leg's view of the Runner's session write ledger (`session-write-ledger.ts`): the acquired storage writes through it. */
|