@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
|
@@ -22,12 +22,25 @@ import type { ContainmentFace } from "../../tools/fs/index.js";
|
|
|
22
22
|
import type { PlacedReadDenyMatcher } from "../../tools/fs/read-deny-home.js";
|
|
23
23
|
import type { ArtifactStoreRef } from "./read-root-grant.js";
|
|
24
24
|
import type { ReadRootsSeat } from "./person-path-rows.js";
|
|
25
|
+
import { type ResolvedSharedArtifactReads } from "../shared-artifact-reads.js";
|
|
25
26
|
import { type AutoModeDecider, type AutoModeDenialTracker } from "../auto-mode.js";
|
|
26
27
|
import type { Prepared } from "./contracts.js";
|
|
27
28
|
import type { ToolOccurrenceTable } from "./tool-occurrence.js";
|
|
29
|
+
import type { LegNotice } from "../leg-identity.js";
|
|
28
30
|
export interface PrepareArtifactInput {
|
|
29
31
|
/** borrowed-readonly — the deployment's hosting seat and the notice sink the refusal arm announces on. */
|
|
30
|
-
deps: Pick<RunnerDeps, "artifactHost" | "onNotice" | "tracer">;
|
|
32
|
+
deps: Pick<RunnerDeps, "artifactHost" | "onNotice" | "tracer" | "sharedArtifactReads">;
|
|
33
|
+
/** borrowed-readonly — the once-per-session dedupe the `sharedArtifactReads` account rides, and the leg's notice seat it is addressed
|
|
34
|
+
* and admitted by (`Prepared.legNotice`; said by whichever leg read the seat — a root leg or a woken one). */
|
|
35
|
+
announce: {
|
|
36
|
+
readonly oncePerSession: (digest: string, deliver: () => void) => void;
|
|
37
|
+
readonly legNotice: Pick<LegNotice, "route" | "admission">;
|
|
38
|
+
};
|
|
39
|
+
/** borrowed-mutable — the run's one reading of the setting (`PrepareInheritedGateResult.sharedArtifactReadsCell`): a born child's is
|
|
40
|
+
* its parent's and is used as it is; otherwise this phase reads the seat once and writes it here, for this leg's children. */
|
|
41
|
+
sharedReads: {
|
|
42
|
+
current?: ResolvedSharedArtifactReads;
|
|
43
|
+
};
|
|
31
44
|
/** borrowed-readonly — the engine-minted run id: the host's `onMount` key and every call context's `runId`. */
|
|
32
45
|
runId: string;
|
|
33
46
|
/** borrowed-readonly — the host task id, the call context's audit attribution. */
|
|
@@ -9,12 +9,13 @@ import { physicalPathOfExisting } from "../physical-path.js";
|
|
|
9
9
|
import { resolveKey, rootAdmittingArtifactStore, violationDetails, violationText } from "../../tools/fs/safety.js";
|
|
10
10
|
import { readObjectAt, readWithin, sameKeyAgain } from "../../tools/fs/bound-open.js";
|
|
11
11
|
import { assembleArtifactTool } from "../../tools/artifact/artifact-tool.js";
|
|
12
|
+
import { announceSharedArtifactReads, resolveSharedArtifactReads, sharedArtifactReadsLayersOf } from "../shared-artifact-reads.js";
|
|
12
13
|
import { heldWhileClassifying } from "../auto-mode.js";
|
|
13
14
|
import { sharedReadClassifier } from "./shared-read-classifier.js";
|
|
14
15
|
import { frozenApproverRoute } from "../wiring-manifest.js";
|
|
15
16
|
import { thrownText } from "../thrown-value.js";
|
|
16
17
|
export function prepareArtifact(input) {
|
|
17
|
-
const { deps, runId, taskId, sessionId, agentName, binding, onAsk: approver, toolOccurrences, permissionMode, autoMode, executionEnv, rootCanonical, additionalRootsCanonical, outsideReadRemedy, readDenyMatcher, resolvedReadFace, handsCwdRef, roster, firstPartyOffload, artifactStoreRef } = input;
|
|
18
|
+
const { deps, announce, runId, taskId, sessionId, agentName, binding, onAsk: approver, toolOccurrences, permissionMode, autoMode, executionEnv, rootCanonical, additionalRootsCanonical, outsideReadRemedy, readDenyMatcher, resolvedReadFace, handsCwdRef, roster, firstPartyOffload, artifactStoreRef } = input;
|
|
18
19
|
const host = deps.artifactHost;
|
|
19
20
|
if (host === undefined)
|
|
20
21
|
return { artifactPlane: undefined };
|
|
@@ -81,10 +82,14 @@ export function prepareArtifact(input) {
|
|
|
81
82
|
mode: () => permissionMode.current,
|
|
82
83
|
route: frozenApproverRoute(onAsk),
|
|
83
84
|
});
|
|
84
|
-
const
|
|
85
|
+
const inherited = input.sharedReads.current;
|
|
86
|
+
const sharedReads = inherited ?? (input.sharedReads.current = resolveSharedArtifactReads(sharedArtifactReadsLayersOf(deps.sharedArtifactReads)));
|
|
87
|
+
const artifactSpec = assembleArtifactTool({ host, runId, taskId, sessionId, ...(agentName !== undefined ? { agentName } : {}), binding, readLocalFile, ...(onAsk !== undefined ? { onAsk } : {}), permissionMode: () => permissionMode.current, classifySharedRead, sharedReads }, verdict.capabilities, deps.onNotice);
|
|
85
88
|
roster.mounts.know({ "artifact.verdict": true });
|
|
86
89
|
if (roster.mounts.judge("artifact")) {
|
|
87
90
|
roster.mount(firstPartyOffload(defineTool(artifactSpec)), { source: "builtin", mountedBy: "optional" });
|
|
91
|
+
if (inherited === undefined)
|
|
92
|
+
announceSharedArtifactReads(sharedReads, { ...(deps.onNotice !== undefined ? { onNotice: deps.onNotice } : {}), oncePerSession: announce.oncePerSession, legNotice: announce.legNotice, runId });
|
|
88
93
|
}
|
|
89
94
|
return { artifactPlane: verdict.capabilities.plane };
|
|
90
95
|
}
|
|
@@ -18,6 +18,7 @@ import { type GrantReadRoot } from "./read-root-grant.js";
|
|
|
18
18
|
import type { ApprovalWordsSeat } from "../approval-words.js";
|
|
19
19
|
import type { EngineText } from "../../prompt-assembly/engine-text.js";
|
|
20
20
|
import type { createRuleOffersOf } from "./permission-rule-lanes.js";
|
|
21
|
+
import { type createCallGrantDoorOf, type SessionCallGrantStation } from "./session-call-grant-station.js";
|
|
21
22
|
export interface PrepareAskLaneInput {
|
|
22
23
|
/** borrowed-readonly — the wiring-manifest phase's ONE activation predicate; false ⇒ this phase builds nothing and
|
|
23
24
|
* returns an absent lane. */
|
|
@@ -122,6 +123,13 @@ export interface PrepareAskLaneInput {
|
|
|
122
123
|
forcedGateNotResumable: ApprovalParkNotResumable | false | undefined;
|
|
123
124
|
/** borrowed-readonly — the run's engine text reading (its locale): the card's headline is minted in it. */
|
|
124
125
|
engineText: EngineText;
|
|
126
|
+
/** borrowed-readonly — the session call grant's door (the rule offers' own ladder) and the run's station, or undefined (no rule
|
|
127
|
+
* store, no session partition, a hands-less leg): the card's "allow this call for the rest of the session" is minted and
|
|
128
|
+
* settled here and only here. */
|
|
129
|
+
sessionCallGrants?: {
|
|
130
|
+
readonly door: ReturnType<typeof createCallGrantDoorOf>;
|
|
131
|
+
readonly station: SessionCallGrantStation;
|
|
132
|
+
};
|
|
125
133
|
}
|
|
126
134
|
export interface PrepareAskLaneResult {
|
|
127
135
|
/** owned — the lane, or undefined exactly when `gateMachineryActive` is false (then the suspend saga, the boundary
|
|
@@ -19,6 +19,7 @@ import { approverDefectAnnouncer } from "./approver-defect-announcer.js";
|
|
|
19
19
|
import { consumeInheritedAskGrant } from "./inherited-ask-grants.js";
|
|
20
20
|
import { requesterOf } from "../mods/extension-call.js";
|
|
21
21
|
import { settleReadRootGrant } from "./read-root-grant.js";
|
|
22
|
+
import { settleUnofferedSessionCallGrant } from "./session-call-grant-station.js";
|
|
22
23
|
function createDenyObserverNotifier(bus, signal) {
|
|
23
24
|
if (bus === undefined || !bus.hasHandlers("classic.PermissionDenied"))
|
|
24
25
|
return undefined;
|
|
@@ -45,7 +46,7 @@ function resolveApprovalPreview(tools, toolName, args) {
|
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
export function prepareAskLane(input) {
|
|
48
|
-
const { destinationOf, gateMachineryActive, abortController, effectivePolicy, budgetSnapshot, handsCwdRef, handsRoot, stampCallTarget, advertisedWritableDirs, exemptRoots, tools, inheritedUnavailableAsks, deferredAskIdentities, inheritedAskGrants, onAsk, humanReviewRef, now, ruleOffersOf, grantBindingOf, askSource, riskAxesOf, commandSandboxSideOf, autoModeDenialTracking, hostTaskId, deps, sessionId, runId, grantReadRoot, approvalWords, modBus, notifyOwnHookCrash, toolRosterDeltas, existingTargetSeat, forcedGateNotResumable, engineText } = input;
|
|
49
|
+
const { destinationOf, gateMachineryActive, abortController, effectivePolicy, budgetSnapshot, handsCwdRef, handsRoot, stampCallTarget, advertisedWritableDirs, exemptRoots, tools, inheritedUnavailableAsks, deferredAskIdentities, inheritedAskGrants, onAsk, humanReviewRef, now, ruleOffersOf, grantBindingOf, askSource, riskAxesOf, commandSandboxSideOf, autoModeDenialTracking, hostTaskId, deps, sessionId, runId, grantReadRoot, approvalWords, modBus, notifyOwnHookCrash, toolRosterDeltas, existingTargetSeat, forcedGateNotResumable, engineText, sessionCallGrants } = input;
|
|
49
50
|
if (!gateMachineryActive)
|
|
50
51
|
return { askLane: undefined };
|
|
51
52
|
const composedCallSignal = (callSignal) => composeCallSignal(abortController.signal, callSignal);
|
|
@@ -84,7 +85,7 @@ export function prepareAskLane(input) {
|
|
|
84
85
|
: attest(intercepted, req, { settlement, inputDigest: exactBoundInputHashOf(req.toolName, req.args) });
|
|
85
86
|
}
|
|
86
87
|
if (forcedGateNotResumable) {
|
|
87
|
-
const message = notResumableRefusal(`approval for "${req.toolName}" is mandated to wait durably for this principal (forceDurableGate)`, forcedGateNotResumable
|
|
88
|
+
const message = notResumableRefusal(`approval for "${req.toolName}" is mandated to wait durably for this principal (forceDurableGate)`, forcedGateNotResumable);
|
|
88
89
|
const members = { settlement: { kind: "no_approver", who: { party: "none" }, when: now() }, unresolvableCause: "mandate_unreconstructible", inputDigest: exactBoundInputHashOf(req.toolName, req.args) };
|
|
89
90
|
const asked = decision.action === "ask" ? { ...(decision.origin !== undefined ? { origin: decision.origin } : {}), ...(decision.classes !== undefined ? { classes: decision.classes } : {}) } : {};
|
|
90
91
|
return attest({ action: "deny", message, decisionReason: "mode" }, req, { ...members, ...asked });
|
|
@@ -92,7 +93,10 @@ export function prepareAskLane(input) {
|
|
|
92
93
|
const grantReuse = consumeInheritedAskGrant(inheritedAskGrants, onAsk, humanReviewRef, decision, req);
|
|
93
94
|
if (grantReuse !== undefined)
|
|
94
95
|
return grantReuse;
|
|
95
|
-
const
|
|
96
|
+
const personSeesCard = readsCardTarget(onAsk, decision.action === "ask" ? gateAskClassPair(decision).classes : undefined);
|
|
97
|
+
const existingTarget = await cardTargetFor(existingTargetSeat, toolRosterDeltas.current, req, req.args, personSeesCard, composedCallSignal(callSignal));
|
|
98
|
+
const offerFacts = decision.action === "ask" ? withFoldedOf(decision, attestationOf(decision, req)) : undefined;
|
|
99
|
+
const callGrant = sessionCallGrants !== undefined && personSeesCard && sessionCallGrants.door(req, req.args, offerFacts) ? await sessionCallGrants.station.mint(req.args?.command, composedCallSignal(callSignal)) : undefined;
|
|
96
100
|
const t0 = now();
|
|
97
101
|
const checkpointId = mintCheckpointId();
|
|
98
102
|
const resolved = await resolveAskFor({
|
|
@@ -105,7 +109,8 @@ export function prepareAskLane(input) {
|
|
|
105
109
|
return { ...(p.preview !== undefined ? { preview: p.preview } : {}), ...(p.withheld !== undefined ? { previewWithheld: p.withheld } : {}) };
|
|
106
110
|
})(),
|
|
107
111
|
...existingTarget,
|
|
108
|
-
...ruleOffersOf(req, req.args,
|
|
112
|
+
...ruleOffersOf(req, req.args, offerFacts),
|
|
113
|
+
...(callGrant !== undefined ? { sessionCallGrant: callGrant.offer } : {}),
|
|
109
114
|
...grantBindingOf(req, req.args),
|
|
110
115
|
...cardDisclosureOf(decision, askFallbackMessage(req.toolName)),
|
|
111
116
|
...askSource,
|
|
@@ -124,9 +129,13 @@ export function prepareAskLane(input) {
|
|
|
124
129
|
}, onAsk, composedCallSignal(callSignal), lateAskSettlementObserver({ toolName: req.toolName, toolCallId: req.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, onError: deps.onError }), decision, approverDefectAnnouncer({ toolName: req.toolName, toolCallId: req.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice }), approvalWords, engineText, req.ifUnavailable);
|
|
125
130
|
const waitMs = Math.max(0, now() - t0);
|
|
126
131
|
const cardHash = resolved.readRootGrant?.verdict === "granted" && resolved.readRootGrant.lasts === "session" ? exactBoundInputHashOf(req.toolName, req.args) : undefined;
|
|
127
|
-
const granting = settleReadRootGrant(resolved.readRootGrant, grantReadRoot, { toolName: req.toolName, toolCallId: req.toolCallId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, signal: composedCallSignal(callSignal), ...(cardHash !== undefined ? { boundInputHash: cardHash } : {}) });
|
|
132
|
+
const granting = settleReadRootGrant(resolved.readRootGrant, grantReadRoot, { toolName: req.toolName, toolCallId: req.toolCallId, checkpointId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, signal: composedCallSignal(callSignal), ...(cardHash !== undefined ? { boundInputHash: cardHash } : {}) });
|
|
128
133
|
if (granting !== undefined)
|
|
129
134
|
await granting;
|
|
135
|
+
const callAt = { toolName: req.toolName, toolCallId: req.toolCallId, checkpointId, sessionId, runId, taskId: hostTaskId, onNotice: deps.onNotice, signal: composedCallSignal(callSignal) };
|
|
136
|
+
const keeping = sessionCallGrants !== undefined ? sessionCallGrants.station.settle(resolved.sessionCallGrant, callGrant, callAt) : settleUnofferedSessionCallGrant(resolved.sessionCallGrant, callAt);
|
|
137
|
+
if (keeping !== undefined)
|
|
138
|
+
await keeping;
|
|
130
139
|
const deferred = deferredAskOf(resolved, req, checkpointId);
|
|
131
140
|
if (deferred !== undefined)
|
|
132
141
|
deferredAskIdentities.set(req.toolCallId, deferred);
|
|
@@ -70,11 +70,11 @@ export function prepareBoundaryParks(input) {
|
|
|
70
70
|
...isolationScopeRecordOf(spec),
|
|
71
71
|
};
|
|
72
72
|
const saga = await commitSuspendSaga(token, cp, suspendableEnv, remoteHandle);
|
|
73
|
-
if (saga.tag === "unknown" || saga.tag === "compensation_failed")
|
|
73
|
+
if (saga.tag === "unknown" || saga.tag === "compensation_failed" || saga.tag === "superseded")
|
|
74
74
|
return { tag: "fatal", reason: saga.reason };
|
|
75
75
|
if (saga.tag !== "committed")
|
|
76
76
|
return { tag: "not_written", reason: saga.tag === "absent" && saga.reason !== undefined ? saga.reason : "the checkpoint was not written" };
|
|
77
|
-
publishCommittedSuspend({ pausedRef }, token, gate, scope, remoteHandle, cp);
|
|
77
|
+
publishCommittedSuspend({ pausedRef }, token, gate, scope, remoteHandle, cp, saga.writes);
|
|
78
78
|
try {
|
|
79
79
|
await sessions.pin?.(sessionId);
|
|
80
80
|
}
|
|
@@ -161,9 +161,10 @@ export function prepareBoundaryParks(input) {
|
|
|
161
161
|
...isolationScopeRecordOf(spec),
|
|
162
162
|
...(spec.durableApproval !== undefined ? { durableApproval: { ...spec.durableApproval } } : {}),
|
|
163
163
|
};
|
|
164
|
-
|
|
164
|
+
const committed = await commitSuspendSaga(token, cp, suspendableEnv, remoteHandle);
|
|
165
|
+
if (committed.tag !== "committed")
|
|
165
166
|
return false;
|
|
166
|
-
publishCommittedSuspend({ pausedRef }, token, gate, scope, remoteHandle, cp);
|
|
167
|
+
publishCommittedSuspend({ pausedRef }, token, gate, scope, remoteHandle, cp, committed.writes);
|
|
167
168
|
try {
|
|
168
169
|
await sessions.pin?.(sessionId);
|
|
169
170
|
}
|
|
@@ -4,6 +4,7 @@ import type { ThinkingLevel } from "../../internal/harness.js";
|
|
|
4
4
|
import { type MicroCompactMachine } from "../context-edit.js";
|
|
5
5
|
import { type CrossBoundaryPosture } from "../cross-boundary-taint.js";
|
|
6
6
|
import { type HostFloor } from "../host-floor.js";
|
|
7
|
+
import { type ResourceLedger } from "../checkpoint-store.js";
|
|
7
8
|
import { runOriginOfLeg, type RunOrigin } from "../run-origin.js";
|
|
8
9
|
import { type FastTierTell } from "../fast-tier-door.js";
|
|
9
10
|
import { type LockedPreflight, type ReceivedPeerDeclarations } from "../locked-config.js";
|
|
@@ -87,8 +88,9 @@ export declare function assertDurableApprovalDeclaration(declared: unknown): voi
|
|
|
87
88
|
export declare function resolveTaskLimits(limits: TaskLimits | undefined): TaskLimits | undefined;
|
|
88
89
|
/**
|
|
89
90
|
* Validate the members of `TaskSpec.attachments` that refuse a value they cannot read at the same door, and return the
|
|
90
|
-
* config unchanged. Today that is
|
|
91
|
-
* (read by
|
|
91
|
+
* config unchanged. Today that is the mode-valued `totalTokensReminderMode` and the boolean switches `mcpUnavailable`,
|
|
92
|
+
* `silentTurnReminder` and `elapsedTimeReminder` (each read by the one switch reader, `attachmentSwitchOn`, which the leg asks
|
|
93
|
+
* as well).
|
|
92
94
|
*
|
|
93
95
|
* WHY A DOOR AT ALL (坏值响亮度律): a knob whose bad value silently folds to the default is a knob the
|
|
94
96
|
* deployment believes is armed. `totalTokensReminderMode: "padded_countdown"` (underscore) or
|
|
@@ -298,7 +300,7 @@ export declare function configValueDoors(input: {
|
|
|
298
300
|
deps: RunnerDeps;
|
|
299
301
|
resumeLeg: boolean;
|
|
300
302
|
sessions: SessionStore;
|
|
301
|
-
|
|
303
|
+
leg?: HolderDoorLeg | undefined;
|
|
302
304
|
resumedRow?: Parameters<typeof runOriginOfLeg>[1];
|
|
303
305
|
receivedPeers?: ReceivedPeerDeclarations;
|
|
304
306
|
parentInteractionPosture?: RunInternals["parentInteractionPosture"];
|
|
@@ -319,6 +321,9 @@ export declare function configValueDoors(input: {
|
|
|
319
321
|
* corrected resume redeems the same token. A throw that is none of prepare's codes leaves as it was thrown. Returns the config the
|
|
320
322
|
* leg is handed: the caller's, its MCP servers and A2A peers the lock layer's judged copies of the lists THIS resume handed (read once, dialed as judged; the row records none).
|
|
321
323
|
*/
|
|
322
|
-
|
|
324
|
+
/** What the holder doors read off the leg's internals (the ones it was started with, never a row's seed): its grant, and whether an
|
|
325
|
+
* engine lane started it. */
|
|
326
|
+
type HolderDoorLeg = Pick<RunInternals, "holder" | "isDelegatedChild" | "observerLeg">;
|
|
327
|
+
export declare function refuseResumeDoors<C extends ValueDoorSpec & Pick<TaskSpec, "userAttachments">>(config: C, deps: RunnerDeps, sessions: SessionStore, internals?: Pick<RunInternals, "holder" | "parentInteractionPosture" | "isDelegatedChild" | "observerLeg">, priorLedger?: ResourceLedger): C;
|
|
323
328
|
export declare function prepareConfigDoors(input: PrepareConfigDoorsInput): PrepareConfigDoorsResult;
|
|
324
329
|
export {};
|
|
@@ -7,8 +7,10 @@ import { CROSS_BOUNDARY_POSTURES } from "../cross-boundary-taint.js";
|
|
|
7
7
|
import { compileHostFloor } from "../host-floor.js";
|
|
8
8
|
import { assertNoRetiredRunnerDeps } from "./retired-runner-deps.js";
|
|
9
9
|
import { resolveCheckpointStore } from "../checkpoint-store.js";
|
|
10
|
+
import { refuseUncountedOwnModel } from "./own-model-money-door.js";
|
|
10
11
|
import { runOriginOfLeg, screenRecordedRunOrigin } from "../run-origin.js";
|
|
11
|
-
import {
|
|
12
|
+
import { assertHolderValue, assertStoreJudgesHolder } from "../checkpoint-generation.js";
|
|
13
|
+
import { engineLaneLegOf, writeHolderOf } from "../park-resumability.js";
|
|
12
14
|
import { asResumeConfigRefusal, refusePermissionModeDoors } from "../mode-policy.js";
|
|
13
15
|
import { screenOutputStyle } from "../output-style.js";
|
|
14
16
|
import { screenLanguageSeat } from "./language-frame.js";
|
|
@@ -38,7 +40,7 @@ import { effectiveTraitsOf, readModelPromptTraits, resolveHost, resolvePromptLea
|
|
|
38
40
|
import { assertNoRetiredKeys, RETIRED_MODEL_KEYS } from "../retired-keys.js";
|
|
39
41
|
import { resolvePromptBinding } from "../../prompt-assembly/overlay.js";
|
|
40
42
|
import { assertPeerPresenceValue } from "../../agents/peer-directory.js";
|
|
41
|
-
import { mcpUnavailableOn, TOTAL_TOKENS_REMINDER_MODES } from "./turn-attachments.js";
|
|
43
|
+
import { attachmentSwitchOn, mcpUnavailableOn, TOTAL_TOKENS_REMINDER_MODES } from "./turn-attachments.js";
|
|
42
44
|
import { rosterFaceOf } from "./caller-roster.js";
|
|
43
45
|
import { assertToolBoundaryLegs, entryDelegates, rosterMountsDelegation } from "../tool-roster.js";
|
|
44
46
|
import { copyBackDeclarations } from "../tool-spec-members.js";
|
|
@@ -54,13 +56,15 @@ const TASK_LIMIT_KEYS = optionKeys()({
|
|
|
54
56
|
maxCostUsd: 0,
|
|
55
57
|
maxTurns: 0,
|
|
56
58
|
maxWalltimeMs: 0,
|
|
59
|
+
oneShotWaitCeilingMs: 0,
|
|
57
60
|
maxOutputTokens: 0,
|
|
58
61
|
approachNotice: 0,
|
|
59
62
|
budgetStreamCancel: 0,
|
|
60
63
|
degrade: 0,
|
|
61
64
|
brainCallGuardrailMs: 0,
|
|
62
65
|
});
|
|
63
|
-
const NUMERIC_TASK_LIMIT_KEYS = ["maxTokens", "maxCostUsd", "maxTurns", "maxWalltimeMs", "maxOutputTokens"];
|
|
66
|
+
const NUMERIC_TASK_LIMIT_KEYS = ["maxTokens", "maxCostUsd", "maxTurns", "maxWalltimeMs", "oneShotWaitCeilingMs", "maxOutputTokens"];
|
|
67
|
+
const TIMER_MAX_MS = 2_147_483_647;
|
|
64
68
|
const RETIRED_TASK_LIMIT_KEYS = {
|
|
65
69
|
timeoutSec: "maxWalltimeMs (milliseconds, not seconds)",
|
|
66
70
|
deadlineNudge: "approachNotice",
|
|
@@ -132,6 +136,10 @@ export function resolveTaskLimits(limits) {
|
|
|
132
136
|
for (const key of NUMERIC_TASK_LIMIT_KEYS) {
|
|
133
137
|
assertFiniteNonNegativeWhenPresent(raw[key], `limits.${key}`, "config.limit_invalid", "an unevaluable ceiling is not a ceiling, and folding it to a default would run the task under a limit nobody chose.");
|
|
134
138
|
}
|
|
139
|
+
const ceiling = raw.oneShotWaitCeilingMs;
|
|
140
|
+
if (ceiling !== undefined && ceiling > TIMER_MAX_MS) {
|
|
141
|
+
throw limitConfigError("config.limit_invalid", `TaskSpec.limits.oneShotWaitCeilingMs must be at most ${TIMER_MAX_MS} ms (got ${ceiling}) — a timer cannot hold a longer wait; write 0 to wait as long as the run's walltime allows.`);
|
|
142
|
+
}
|
|
135
143
|
const notice = raw.approachNotice;
|
|
136
144
|
if (notice !== undefined && notice !== false) {
|
|
137
145
|
if (typeof notice !== "object" || notice === null || Array.isArray(notice)) {
|
|
@@ -154,6 +162,8 @@ export function resolveAttachmentsConfig(attachments) {
|
|
|
154
162
|
if (attachments === null || (typeof attachments !== "object" && typeof attachments !== "function"))
|
|
155
163
|
return attachments;
|
|
156
164
|
mcpUnavailableOn(attachments);
|
|
165
|
+
attachmentSwitchOn(attachments, "silentTurnReminder", "silent_turn_reminder");
|
|
166
|
+
attachmentSwitchOn(attachments, "elapsedTimeReminder", "elapsed_time_reminder");
|
|
157
167
|
const mode = attachments.totalTokensReminderMode;
|
|
158
168
|
if (mode !== undefined) {
|
|
159
169
|
const legal = TOTAL_TOKENS_REMINDER_MODES;
|
|
@@ -239,7 +249,9 @@ function agentsWithoutDelegationMount() {
|
|
|
239
249
|
return e;
|
|
240
250
|
}
|
|
241
251
|
export function configValueDoors(input) {
|
|
242
|
-
const { spec, resumeLeg, sessions
|
|
252
|
+
const { spec, resumeLeg, sessions } = input;
|
|
253
|
+
const holder = input.leg?.holder;
|
|
254
|
+
const startedBy = holderSeatStarterOf(input.leg);
|
|
243
255
|
let deps = input.deps;
|
|
244
256
|
enterConfigDoor("deps", () => assertNoRetiredRunnerDeps(deps));
|
|
245
257
|
enterConfigDoor("taskConfig", () => assertPrincipalValue(spec.principal));
|
|
@@ -372,7 +384,8 @@ export function configValueDoors(input) {
|
|
|
372
384
|
const brainCallGuardrailMs = enterConfigDoor(guardrail.input, () => resolveBrainCallGuardrailMs(guardrail.value));
|
|
373
385
|
const checkpointStore = enterConfigDoor(checkpointStoreSeat(spec), () => resolveCheckpointStore(spec, deps));
|
|
374
386
|
enterConfigDoor("deps", () => assertHolderValue(holder));
|
|
375
|
-
enterConfigDoor(checkpointStoreSeat(spec), () =>
|
|
387
|
+
enterConfigDoor(checkpointStoreSeat(spec), () => assertStoreJudgesHolder("checkpoint", checkpointStoreSeat(spec) === "taskConfig" ? "TaskSpec.checkpointStore" : "RunnerDeps.checkpointStore", checkpointStore, holder, startedBy));
|
|
388
|
+
enterConfigDoor("deps", () => assertStoreJudgesHolder("session", "RunnerDeps.sessionStore", sessions, writeHolderOf(input.leg), startedBy));
|
|
376
389
|
const taskStore = checkpointStoreSeat(spec) === "taskConfig" ? checkpointStore : undefined;
|
|
377
390
|
const retention = { policy: deps.retentionPolicy, locked: lockedPreflight.lockedKeys.has("retentionPolicy") };
|
|
378
391
|
enterConfigDoor("deps", () => assertRetentionWords({
|
|
@@ -389,7 +402,10 @@ export function configValueDoors(input) {
|
|
|
389
402
|
enterConfigDoor("taskConfig", () => screenModelRole(spec.modelRole));
|
|
390
403
|
return { toolFaceLists, promptHost, promptBinding, promptLocale, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin, nestedMemory, deploymentRoles, taskRoles, resolvedInteractionPosture, interactionPostureInput };
|
|
391
404
|
}
|
|
392
|
-
|
|
405
|
+
function holderSeatStarterOf(internals) {
|
|
406
|
+
return engineLaneLegOf(internals) ? "engine" : "host";
|
|
407
|
+
}
|
|
408
|
+
export function refuseResumeDoors(config, deps, sessions, internals, priorLedger) {
|
|
393
409
|
asResumeConfigRefusal("taskConfig", () => {
|
|
394
410
|
refusePermissionModeDoors(config);
|
|
395
411
|
screenOutputStyle(config.outputStyle);
|
|
@@ -403,7 +419,8 @@ export function refuseResumeDoors(config, deps, sessions, internals) {
|
|
|
403
419
|
if (Array.isArray(agents) && !types.isProxy(agents) && agents.length > 0 && rosterMountsDelegation(config.tools) === false)
|
|
404
420
|
throw agentsWithoutDelegationMount();
|
|
405
421
|
});
|
|
406
|
-
const { lockedPreflight, skills } = asResumeConfigRefusal("taskConfig", () => configValueDoors({ spec: config, deps, resumeLeg: true, sessions,
|
|
422
|
+
const { lockedPreflight, skills, deploymentRoles, taskRoles } = asResumeConfigRefusal("taskConfig", () => configValueDoors({ spec: config, deps, resumeLeg: true, sessions, leg: internals, parentInteractionPosture: internals?.parentInteractionPosture, resumedRow: { recorded: undefined } }));
|
|
423
|
+
asResumeConfigRefusal("taskConfig", () => refuseUncountedOwnModel(config, deploymentRoles !== undefined ? { ...deps, roles: deploymentRoles } : deps, taskRoles, priorLedger));
|
|
407
424
|
return { ...config, ...(config.mcp !== undefined ? { mcp: lockedPreflight.mcp ?? [] } : {}), ...(config.a2a !== undefined ? { a2a: lockedPreflight.a2a ?? [] } : {}), skills };
|
|
408
425
|
}
|
|
409
426
|
export function prepareConfigDoors(input) {
|
|
@@ -421,7 +438,7 @@ export function prepareConfigDoors(input) {
|
|
|
421
438
|
}
|
|
422
439
|
};
|
|
423
440
|
const tellFastTier = input.refusalSink !== undefined ? fastTierNoticeTo(input.refusalSink, callerSpec.sessionId ?? "(pre-session)") : undefined;
|
|
424
|
-
const { toolFaceLists, promptHost, promptBinding, promptLocale, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin, nestedMemory, deploymentRoles, taskRoles, resolvedInteractionPosture, interactionPostureInput } = configValueDoors({ spec: callerSpec, deps: input.deps, resumeLeg: resume !== undefined, sessions,
|
|
441
|
+
const { toolFaceLists, promptHost, promptBinding, promptLocale, promptLean, lockedPreflight, skillListingSeats, skills, projectMemory, microCompactKnob, memoryDelegationEvidence, memoryProvenance, memoryCapturePolicy, usageWindows, brainCallGuardrailMs, crossBoundaryPosture, advisorTool, hostFloor, runOrigin, nestedMemory, deploymentRoles, taskRoles, resolvedInteractionPosture, interactionPostureInput } = configValueDoors({ spec: callerSpec, deps: input.deps, resumeLeg: resume !== undefined, sessions, leg: internals, parentInteractionPosture: internals?.parentInteractionPosture, discloseInteractionPosture: discloseInteractionPostureRefusal, ...(tellFastTier !== undefined ? { tellFastTier } : {}), receivedPeers: input.receipt, ...(resume !== undefined ? { resumedRow: { recorded: screenRecordedRunOrigin(resume.seed.runOrigin), ...(resume.opening !== undefined ? { opening: resume.opening } : {}) } } : {}) });
|
|
425
442
|
const doorRead = (value) => ({ value, enumerable: value !== undefined, writable: false, configurable: false });
|
|
426
443
|
const deps = deploymentRoles !== undefined ? { ...input.deps, roles: deploymentRoles } : input.deps;
|
|
427
444
|
const declaredDurableApproval = callerSpec.durableApproval;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Model } from "../../internal/llm.js";
|
|
2
2
|
import type { AgentHarnessEvent } from "../../internal/harness.js";
|
|
3
3
|
import type { PromptTraitName } from "../../prompt-assembly/catalog/schema.js";
|
|
4
|
+
import { type ToolCardFacts } from "../../prompt-assembly/tool-catalog.js";
|
|
4
5
|
import type { MaterializedA2a } from "../a2a.js";
|
|
5
6
|
import type { MaterializedMcp } from "../mcp.js";
|
|
6
7
|
import type { RunnerDeps, TaskSpec } from "../types.js";
|
|
@@ -23,6 +24,8 @@ export interface PrepareDeferClassifyInput {
|
|
|
23
24
|
toolFaceSnapshot: Pick<ToolFaceSnapshot, "selector" | "defer" | "alwaysLoad">;
|
|
24
25
|
/** borrowed-readonly — the run's effective prompt traits (each tool's description variants are chosen on them). */
|
|
25
26
|
promptTraits: ReadonlySet<PromptTraitName>;
|
|
27
|
+
/** borrowed-readonly — the run's card facts (each tool's description variants are chosen on them too; `shellFirstSession`). */
|
|
28
|
+
cardFacts: ToolCardFacts;
|
|
26
29
|
/** borrowed-readonly — the resolved model (the deferral gate's threshold reads its context window). */
|
|
27
30
|
model: Model;
|
|
28
31
|
/** borrowed-readonly — the materialized MCP roster; only `tools` is read (protocol names; `mcpAlwaysLoad` self-declarations lose to an operator defer). */
|
|
@@ -65,15 +68,16 @@ export interface PrepareDeferClassifyResult {
|
|
|
65
68
|
* late retraction (the roster's last removal), before the assembly that composes on it. */
|
|
66
69
|
toolFace: ToolFaceClass;
|
|
67
70
|
}
|
|
68
|
-
/** Each roster tool's description variant mounted over `traits` — at prepare by the run's traits, and
|
|
69
|
-
* switches model by that model's
|
|
70
|
-
|
|
71
|
+
/** Each roster tool's description variant mounted over `traits` and the run's card facts — at prepare by the run's traits, and
|
|
72
|
+
* again when the harness switches model by that model's (the facts are the run's, a model switch does not move them) — in place
|
|
73
|
+
* through the builder (a face whose text does not move is kept). Whether any moved. */
|
|
74
|
+
export declare function mountCardVariants(roster: RosterBuilder, traits: ReadonlySet<PromptTraitName>, facts: ToolCardFacts): boolean;
|
|
71
75
|
/** The cards follow the model the harness requests with, as the read-first waiver does: a switch (`model_select`) mounts each
|
|
72
76
|
* card's variant again over the new model's traits and hands the harness the new faces; a model whose traits do not read keeps
|
|
73
77
|
* the cards it had (the waiver then holds it to read-first, the safe side). */
|
|
74
78
|
export declare function cardsFollowModel(harness: {
|
|
75
79
|
subscribe(listener: (event: AgentHarnessEvent) => Promise<void> | void): unknown;
|
|
76
|
-
}, roster: RosterBuilder, traitsOf: (model: Model) => ReadonlySet<PromptTraitName>, rebuild: {
|
|
80
|
+
}, roster: RosterBuilder, traitsOf: (model: Model) => ReadonlySet<PromptTraitName>, facts: ToolCardFacts, rebuild: {
|
|
77
81
|
current?: () => Promise<void>;
|
|
78
82
|
}): void;
|
|
79
83
|
/** The M11 phase body — prepareTask's tool-face fold + deferred classification, verbatim (module header). */
|
|
@@ -16,11 +16,11 @@ function explicitlyDeferredMemoryTrio(mounted, roster, callerDeferNames) {
|
|
|
16
16
|
function memoryGroupRetractionSet(builtinDeferPairNames, engineTrioInPlay) {
|
|
17
17
|
return new Set([...builtinDeferPairNames, ...(engineTrioInPlay ? MEMORY_ENGINE_TOOL_NAMES : [])]);
|
|
18
18
|
}
|
|
19
|
-
export function mountCardVariants(roster, traits) {
|
|
19
|
+
export function mountCardVariants(roster, traits, facts) {
|
|
20
20
|
let moved = false;
|
|
21
21
|
for (let i = 0; i < roster.tools.length; i++) {
|
|
22
22
|
const t = roster.tools[i];
|
|
23
|
-
const face = mountDescriptionVariant(t, traits);
|
|
23
|
+
const face = mountDescriptionVariant(t, traits, facts);
|
|
24
24
|
if (face === t)
|
|
25
25
|
continue;
|
|
26
26
|
roster.replaceAt(i, face);
|
|
@@ -29,13 +29,13 @@ export function mountCardVariants(roster, traits) {
|
|
|
29
29
|
}
|
|
30
30
|
return moved;
|
|
31
31
|
}
|
|
32
|
-
export function cardsFollowModel(harness, roster, traitsOf, rebuild) {
|
|
32
|
+
export function cardsFollowModel(harness, roster, traitsOf, facts, rebuild) {
|
|
33
33
|
harness.subscribe(async (event) => {
|
|
34
34
|
if (event.type !== "model_select")
|
|
35
35
|
return;
|
|
36
36
|
let moved = false;
|
|
37
37
|
try {
|
|
38
|
-
moved = mountCardVariants(roster, traitsOf(event.model));
|
|
38
|
+
moved = mountCardVariants(roster, traitsOf(event.model), facts);
|
|
39
39
|
}
|
|
40
40
|
catch {
|
|
41
41
|
}
|
|
@@ -44,12 +44,12 @@ export function cardsFollowModel(harness, roster, traitsOf, rebuild) {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
export function prepareDeferClassify(input) {
|
|
47
|
-
const { spec, deps, roster, toolFaceSnapshot, promptTraits, model, mcp, a2a, sharedMemoryPairMounted, memoryEnginePairMounted, memoryRecallSegment, onceLedger, sessionId } = input;
|
|
47
|
+
const { spec, deps, roster, toolFaceSnapshot, promptTraits, cardFacts, model, mcp, a2a, sharedMemoryPairMounted, memoryEnginePairMounted, memoryRecallSegment, onceLedger, sessionId } = input;
|
|
48
48
|
const tools = roster.tools;
|
|
49
49
|
let memoryBlock = input.memoryBlock;
|
|
50
50
|
const leaves = valveLeaves(toolFaceSnapshot.selector);
|
|
51
51
|
roster.unmountWhere((t) => !leaves(t));
|
|
52
|
-
mountCardVariants(roster, promptTraits);
|
|
52
|
+
mountCardVariants(roster, promptTraits, cardFacts);
|
|
53
53
|
const protocolToolNames = [...mcp.tools, ...a2a.tools].filter((t) => protocolOf(t.name) !== undefined).map((t) => t.name);
|
|
54
54
|
const mcpAlwaysLoadNames = mcp.tools
|
|
55
55
|
.filter((t) => t.mcpAlwaysLoad === true && !(toolFaceSnapshot.defer ?? []).includes(t.name))
|
|
@@ -24,7 +24,7 @@ export interface PrepareExecutionEnvInput {
|
|
|
24
24
|
/** borrowed-readonly — the trusted spawn-side requests: the explicit cwd (a contract), the isolation
|
|
25
25
|
* request and the parent's cwd (both threaded to the factory ctx). */
|
|
26
26
|
internals: Pick<RunInternals, "requestedCwd" | "isolation" | "parentCwd" | "callerRoot" | "worktreeOffered" | "placementTarget"> | undefined;
|
|
27
|
-
/** borrowed-readonly — the resume leg: read to refuse an explicit cwd a checkpoint restore would overrule, and for the
|
|
27
|
+
/** borrowed-readonly — the resume leg: read to refuse an explicit cwd a checkpoint restore would overrule, and for the workspace its row recorded — read once, as the row handle's frozen copy: the fence's first member source and the factory's `priorHandle`. */
|
|
28
28
|
resume: Pick<PrepareResume, "workspaceHandle"> | undefined;
|
|
29
29
|
/** borrowed-readonly — the run tree's placement fixed point, resolved ONCE by the driver; the factory
|
|
30
30
|
* door refuses an empty value loudly before the factory is asked. */
|
|
@@ -41,6 +41,9 @@ export interface PrepareExecutionEnvInput {
|
|
|
41
41
|
* environment (`ToolMountPlan.executionEnv.state === "unneeded"`); the fold below is unchanged, so a static env still
|
|
42
42
|
* stands and the stub answers otherwise. A caller that always needs one (the rewind verb) passes `true`. */
|
|
43
43
|
startsEnv: boolean;
|
|
44
|
+
/** borrowed-readonly — present on a resume leg sent back to its row's workspace (the row recorded one): a refusal here hands the
|
|
45
|
+
* minted env to the leg's exit through it instead of destroying it (the exit keeps or destroys it by what became of the row). */
|
|
46
|
+
toRowExit?: (env: ExecutionEnv) => void;
|
|
44
47
|
}
|
|
45
48
|
export interface PrepareExecutionEnvResult {
|
|
46
49
|
/** borrowed-readonly — the run's resolved env: the minted one, else the static one, else the no-I/O stub. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StubExecutionEnv } from "../stub-env.js";
|
|
2
|
-
import { hasDestroy } from "../remote-env.js";
|
|
2
|
+
import { frozenHandleCopy, hasDestroy } from "../remote-env.js";
|
|
3
3
|
import { mintPlacementFence } from "./placement-fence.js";
|
|
4
4
|
import { announceMalformedCapabilities } from "./env-capability-census.js";
|
|
5
5
|
import { callerTreeMissed, canonicalOrSelf, childPlacementOnLeg, deploymentCanRerootChild, factoryIgnoredHint, worktreeNotHonored } from "./child-tree.js";
|
|
@@ -52,7 +52,8 @@ export async function prepareExecutionEnv(input) {
|
|
|
52
52
|
}
|
|
53
53
|
let placementFence;
|
|
54
54
|
try {
|
|
55
|
-
|
|
55
|
+
const prior = resume?.workspaceHandle !== undefined ? frozenHandleCopy(resume.workspaceHandle) : undefined;
|
|
56
|
+
placementFence = mintPlacementFence(prior, internals?.placementTarget);
|
|
56
57
|
ownedEnv = ask === "ask" && deps.executionEnvFactory
|
|
57
58
|
? await enterConfigDoor("deps", () => deps.executionEnvFactory({
|
|
58
59
|
sessionId, placementRootSessionId: placementRootResolved,
|
|
@@ -62,6 +63,7 @@ export async function prepareExecutionEnv(input) {
|
|
|
62
63
|
...(internals?.parentCwd ? { parentCwd: internals.parentCwd } : {}),
|
|
63
64
|
...(internals?.requestedCwd !== undefined ? { requestedCwd: internals.requestedCwd } : {}),
|
|
64
65
|
...(placementFence !== undefined ? { placementTarget: placementFence } : {}),
|
|
66
|
+
...(prior !== undefined ? { priorHandle: prior } : {}),
|
|
65
67
|
}))
|
|
66
68
|
: undefined;
|
|
67
69
|
if (ownedEnv !== undefined)
|
|
@@ -115,7 +117,10 @@ export async function prepareExecutionEnv(input) {
|
|
|
115
117
|
const placement = internals?.callerRoot === undefined ? undefined : await childPlacementOnLeg(executionEnv, { ...internals, callerRoot: internals.callerRoot }, taskRootInitial);
|
|
116
118
|
const refuseChild = async (leg, refusal) => {
|
|
117
119
|
await settleTeardownLeg(() => forgetOnThrow(), `forgetOnThrow (${leg} leg)`, (err) => deps.onError?.(err, { phase: "config", sessionId }));
|
|
118
|
-
|
|
120
|
+
if (ownedEnv !== undefined && ownedEnv !== deps.executionEnv && input.toRowExit !== undefined)
|
|
121
|
+
input.toRowExit(ownedEnv);
|
|
122
|
+
else
|
|
123
|
+
await settleTeardownLeg(() => (ownedEnv && ownedEnv !== deps.executionEnv && hasDestroy(ownedEnv) ? ownedEnv.destroy() : undefined), `ownedEnv.destroy (${leg} leg)`, (err) => deps.onError?.(err, { phase: "config", sessionId }));
|
|
119
124
|
ownedEnvSeat.current = undefined;
|
|
120
125
|
throw refusal;
|
|
121
126
|
};
|
|
@@ -28,7 +28,30 @@ import type { FileHistoryBoundarySeat, RunInternals } from "./contracts.js";
|
|
|
28
28
|
import type { FileHistoryRequest } from "./file-history-request.js";
|
|
29
29
|
import { type OwnLogReader } from "./file-history-restore.js";
|
|
30
30
|
import { tellLeftAsIs } from "./left-as-is-seat.js";
|
|
31
|
+
import type { RewindOutcome } from "./rewind-outcome.js";
|
|
31
32
|
import type { SessionRootRead } from "../session-checkout.js";
|
|
33
|
+
/**
|
|
34
|
+
* Whether a leg can change a file through a tool it mounts — read off its valve before its roster is assembled: an engine tool whose
|
|
35
|
+
* catalog effect is a write (the file tools, the shell, a delegation or a workflow that runs other legs — the catalog's one statement,
|
|
36
|
+
* an undeclared effect read as a write), any caller tool, or a protocol peer (MCP, A2A) the valve leaves. A leg that answers no has
|
|
37
|
+
* nothing its file history could record, so where its session's checkout cannot be resolved it runs and records nothing (the
|
|
38
|
+
* session checkout's `writes`) rather than being refused for a history it would never write.
|
|
39
|
+
*/
|
|
40
|
+
export declare function legMayWriteFiles(input: {
|
|
41
|
+
leaves: (tool: {
|
|
42
|
+
name: string;
|
|
43
|
+
}) => boolean;
|
|
44
|
+
leavesPeer: (prefix: string) => boolean;
|
|
45
|
+
callerTools: readonly {
|
|
46
|
+
name: string;
|
|
47
|
+
}[] | undefined;
|
|
48
|
+
mcp: readonly {
|
|
49
|
+
name: string;
|
|
50
|
+
}[] | undefined;
|
|
51
|
+
a2a: readonly {
|
|
52
|
+
name: string;
|
|
53
|
+
}[] | undefined;
|
|
54
|
+
}): boolean;
|
|
32
55
|
export interface PrepareFileHistoryInput {
|
|
33
56
|
/** borrowed-readonly — the deployment seats this phase reads: the first-touch failure policy, the history
|
|
34
57
|
* store and its capture switch (all validated HERE, once), the incident sink, the notice seat (the person's half of a
|
|
@@ -66,6 +89,9 @@ export interface PrepareFileHistoryInput {
|
|
|
66
89
|
* with `spec.signal` for the restore. */
|
|
67
90
|
abortController: AbortController;
|
|
68
91
|
/** borrowed-readonly — the session's once-per-session record, for the restore's telling of the files it left as they are. */ onceLedger: Parameters<typeof tellLeftAsIs>[0]["onceLedger"];
|
|
92
|
+
/** borrowed-mutable — the leg's record of what its rewind did ({@link RewindOutcome}; absent on a leg that asks for none): the restore
|
|
93
|
+
* writes whether the tree moved, and this phase the restore it accepted. */
|
|
94
|
+
rewindOutcome?: RewindOutcome;
|
|
69
95
|
}
|
|
70
96
|
/** The acquired session's row cells, read once (`getMetadata`): its own occupant (`own`), its fork lineage (`origin`, and the occupant
|
|
71
97
|
* of it the fork was cut from, `originIncarnation`), or `fault` when the read threw. */
|
|
@@ -7,6 +7,18 @@ import { boundaryUnrecordedNotice, fileHistoryRestoreLedgerLine, refuseRestoreOn
|
|
|
7
7
|
import { tellLeftAsIs } from "./left-as-is-seat.js";
|
|
8
8
|
import { deliverEngineNotice } from "../engine-notice.js";
|
|
9
9
|
import { canonicalOrSelf } from "./child-tree.js";
|
|
10
|
+
import { describeToolCatalog } from "../tool-registry.js";
|
|
11
|
+
import { A2A_NAMESPACE, mintNamespacePrefix } from "@sema-agent/primitives";
|
|
12
|
+
import { mcpServerReached } from "../mounted-mcp.js";
|
|
13
|
+
export function legMayWriteFiles(input) {
|
|
14
|
+
for (const entry of describeToolCatalog())
|
|
15
|
+
if ((entry.face.effect ?? "write") === "write" && input.leaves({ name: entry.name }))
|
|
16
|
+
return true;
|
|
17
|
+
if ((input.callerTools ?? []).some((tool) => input.leaves(tool)))
|
|
18
|
+
return true;
|
|
19
|
+
const mcpReached = mcpServerReached(input.leaves, input.leavesPeer);
|
|
20
|
+
return (input.mcp ?? []).some((s) => mcpReached(s.name)) || (input.a2a ?? []).some((p) => input.leavesPeer(mintNamespacePrefix(A2A_NAMESPACE, p.name)));
|
|
21
|
+
}
|
|
10
22
|
export async function prepareFileHistory(input) {
|
|
11
23
|
const { deps, spec, request, internals, executionEnv, sessionRoot, forkSourceRoot, handsEnabled, sessionId, session, forkWithOwnTree, row, abortController, onceLedger } = input;
|
|
12
24
|
const rewindNotes = [];
|
|
@@ -70,7 +82,7 @@ export async function prepareFileHistory(input) {
|
|
|
70
82
|
throw own.refused ?? unaddressedRewindRefusal(sessionId, rewindTarget);
|
|
71
83
|
await refuseTargetOutsideOwnLog(session, sessionId, rewindTarget, rewindBefore ? "before" : "restore");
|
|
72
84
|
refuseRestoreOnForkWithOwnTree(forkWithOwnTree, sessionId, rewindTarget, rewindBefore ? "before" : "restore");
|
|
73
|
-
const restored = await settleFileHistoryRestore({ store: fileHistoryStore, sessionId, scope: own.scope, target: rewindTarget, before: rewindBefore, env: executionEnv, root: historyRoot, signal: restoreSignal, readStates: internals?.sessionReadStates, options: request.restoreOptions, wholeOrNothing: spec.acceptPartialRestore !== true });
|
|
85
|
+
const restored = await settleFileHistoryRestore({ store: fileHistoryStore, sessionId, scope: own.scope, target: rewindTarget, before: rewindBefore, env: executionEnv, root: historyRoot, signal: restoreSignal, readStates: internals?.sessionReadStates, options: request.restoreOptions, wholeOrNothing: spec.acceptPartialRestore !== true, ...(input.rewindOutcome !== undefined ? { outcome: input.rewindOutcome } : {}) });
|
|
74
86
|
tellLeftAsIs({ restored, target: rewindTarget, scope: own.scope, sessionId, rewindNotes, onceLedger, onNotice: deps.onNotice });
|
|
75
87
|
const outsideRoot = restoreOutsideRootNote(restored, rewindTarget);
|
|
76
88
|
if (outsideRoot !== undefined)
|
|
@@ -86,6 +98,8 @@ export async function prepareFileHistory(input) {
|
|
|
86
98
|
throw restoreFailedError(restored, `rewind-files: restore to entry "${rewindTarget}" was PARTIAL after its plan passed — a write failed or the files changed between the plan and the restore, so the tree is now partly restored (the files written or deleted are named in the ledger): ${fileHistoryRestoreLedgerLine(restored)}. The task did not run on it (a run spec that accepts a partial restore, acceptPartialRestore, runs on a partly restored tree and discloses it, where its host offers that member). Do not send it again on its own: a person decides whether to — a repeat restores the rest and writes over any file changed since (files already restored are skipped by content).`, RUN_STOPPED_RESTORE);
|
|
87
99
|
}
|
|
88
100
|
}
|
|
101
|
+
if (input.rewindOutcome !== undefined)
|
|
102
|
+
input.rewindOutcome.restore = restored;
|
|
89
103
|
}
|
|
90
104
|
const trackFileEdit = fileHistoryEnabled
|
|
91
105
|
? async (req) => {
|
|
@@ -46,7 +46,7 @@ import { type SessionPermissionRules } from "../session-policy-store.js";
|
|
|
46
46
|
import { type SessionStore } from "../session.js";
|
|
47
47
|
import type { PlacementTarget } from "../remote-env.js";
|
|
48
48
|
import { type OnAsk } from "../tool-policy.js";
|
|
49
|
-
import type
|
|
49
|
+
import { type ApprovalParkNotResumable } from "../park-resumability.js";
|
|
50
50
|
import { type ChainPolicyOnLeg } from "./child-tree.js";
|
|
51
51
|
import type { PathRuleBases } from "../permission-rule-model.js";
|
|
52
52
|
import type { PermissionMode, RunnerDeps, RuntimeCaps, ShellGateDoctrine, TaskEvent, TaskSpec, ToolExecuteContext, ToolSpec } from "../types.js";
|
|
@@ -101,8 +101,9 @@ export interface PrepareInheritedGateInput {
|
|
|
101
101
|
* fold (the trust floor the live half may only tighten), `seed.readFace` the hands-less re-park's carried section. */
|
|
102
102
|
resume: Pick<PrepareResume, "seed" | "outcome"> | undefined;
|
|
103
103
|
/** borrowed-readonly — the session store's fork face: `fork` / `release` are bound into the ctx's `hostSessionFork` (present
|
|
104
|
-
* only when the store can fork); `placements` decides whether a fork placement is handed on
|
|
105
|
-
|
|
104
|
+
* only when the store can fork); `placements` decides whether a fork placement is handed on; `acquire` reads the forked row back,
|
|
105
|
+
* before anything runs on it, to judge that it is a copy of this run's session. */
|
|
106
|
+
sessions: Pick<SessionStore, "fork" | "release" | "placements" | "acquire" | "forget">;
|
|
106
107
|
/** borrowed-readonly — the acquired session id (the crash lane's context, the ctx seat, the ancestor chain's own row). */
|
|
107
108
|
sessionId: string;
|
|
108
109
|
/** borrowed-readonly — the run's invocation id (the stop seat's notice names it). */
|
|
@@ -249,6 +250,10 @@ export interface PrepareInheritedGateInput {
|
|
|
249
250
|
sessionIncarnation: () => string | undefined;
|
|
250
251
|
}
|
|
251
252
|
export interface PrepareInheritedGateResult {
|
|
253
|
+
/** owned — the run's one reading of `sharedArtifactReads`: a born child's from its parent, else written once by the Artifact phase; children's chains carry it. */
|
|
254
|
+
sharedArtifactReadsCell: {
|
|
255
|
+
current?: InheritedGate["sharedArtifactReads"];
|
|
256
|
+
};
|
|
252
257
|
/** owned — the LIVE half of the inherited chain as supplied (`internals.inheritedGate`); the durable-gate notice reads it. */
|
|
253
258
|
liveInheritedGate: RunInternals["inheritedGate"];
|
|
254
259
|
/** owned — the CHECKPOINT half (`resume.seed.inheritedGate`); the suspend serializer re-reads its frozen chain. */
|