@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
|
@@ -58,5 +58,8 @@ export interface ResumeAdmissionResult {
|
|
|
58
58
|
* it cannot rebuild, a row it reads differently) — returned by the checkpoint screen's chain rung and thrown by the ladder after
|
|
59
59
|
* the decision's own bindings and the run's identity, so a decision bound to another card or of another gate is refused for that. */
|
|
60
60
|
chainRefusal: CheckpointError | undefined;
|
|
61
|
+
/** The chain is the live one with its root task layer as registered (no root policy handed): the ladder tells
|
|
62
|
+
* `permission.revival_root_policy_unrestated` once the claim is won — never on an attempt a later rung refuses. */
|
|
63
|
+
rootLayerUnrestated: boolean;
|
|
61
64
|
}
|
|
62
65
|
export declare function resumeAdmission<R>(input: ResumeAdmissionInput<R>): Promise<R>;
|
|
@@ -54,7 +54,7 @@ export async function resumeAdmission(input) {
|
|
|
54
54
|
const outcomeGate = outcome.gate;
|
|
55
55
|
const resumeSignal = config.signal;
|
|
56
56
|
let suppliedMessage;
|
|
57
|
-
config = refuseResumeDoors(config, runner.deps, sessions, internals);
|
|
57
|
+
config = refuseResumeDoors(config, runner.deps, sessions, internals, cp.resourceLedger);
|
|
58
58
|
const parkedSteers = readPendingSteerQueue(cp.state);
|
|
59
59
|
if (outcomeGate === "wake") {
|
|
60
60
|
suppliedMessage = outcome.message;
|
|
@@ -76,13 +76,15 @@ export async function resumeAdmission(input) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
const handed = internals?.inheritedGate?.parentConstraints;
|
|
79
|
-
const rootPolicy = internals?.rootPolicy;
|
|
79
|
+
const rootPolicy = internals?.rootPolicy ?? undefined;
|
|
80
80
|
const record = cp.state.inheritedGate;
|
|
81
81
|
let parentConstraints;
|
|
82
82
|
let chainRefusal = rowRefusal?.refusal;
|
|
83
|
+
let rootLayerUnrestated = false;
|
|
83
84
|
if (chainRefusal === undefined) {
|
|
84
85
|
try {
|
|
85
|
-
const
|
|
86
|
+
const onRootLayerUnrestated = () => void (rootLayerUnrestated = true);
|
|
87
|
+
const picked = revivalParentConstraints({ token, record, handed, registry: parentConstraintRegistry, deps: runner.deps, leg: config, rootPolicy, onRootLayerUnrestated });
|
|
86
88
|
parentConstraints = picked instanceof Promise ? await picked : picked;
|
|
87
89
|
}
|
|
88
90
|
catch (e) {
|
|
@@ -91,5 +93,5 @@ export async function resumeAdmission(input) {
|
|
|
91
93
|
}
|
|
92
94
|
if (parentConstraints !== undefined && parentConstraints !== internals?.inheritedGate?.parentConstraints)
|
|
93
95
|
internals = { ...(internals ?? {}), inheritedGate: { ...(internals?.inheritedGate ?? {}), parentConstraints } };
|
|
94
|
-
return await input.next({ config, internals, store, cp, outcomeGate, resumeSignal, wakeMessage, chainRefusal });
|
|
96
|
+
return await input.next({ config, internals, store, cp, outcomeGate, resumeSignal, wakeMessage, chainRefusal, rootLayerUnrestated });
|
|
95
97
|
}
|
|
@@ -7,7 +7,7 @@ import { admitLegMods, listLegModSeats, classicEventBase, failedHandlerClause, p
|
|
|
7
7
|
import { inputSourceOf } from "../steer-replay.js";
|
|
8
8
|
import { legTaskIdOf } from "../leg-identity.js";
|
|
9
9
|
import { restoreRowTaskId } from "./checkpoint-scope.js";
|
|
10
|
-
import { callFactsSeat, checkToolPolicyProjection, policyCannotAnswer, refuseOutOfContractDecision } from "../tool-policy.js";
|
|
10
|
+
import { bindableArgsOf, callFactsSeat, checkToolPolicyProjection, policyCannotAnswer, refuseOutOfContractDecision } from "../tool-policy.js";
|
|
11
11
|
import { editRecheckUnanswered } from "../real-approval.js";
|
|
12
12
|
import { requestGrantBinding } from "../skill-grant-binding.js";
|
|
13
13
|
import { skillGrantBindingMembers } from "../skill-grant.js";
|
|
@@ -16,6 +16,7 @@ import { readCallTarget } from "../effective-path-target.js";
|
|
|
16
16
|
import { foreignLine } from "../protocol-http-auth.js";
|
|
17
17
|
import { describeSuppliedValue, mintDecideRecord } from "./decide-continuation.js";
|
|
18
18
|
import { editRewrittenSentence, readRejudge } from "../rewrite-rejudge.js";
|
|
19
|
+
import { editOfAnswer, exactBoundInputHashOf } from "../canonical-json.js";
|
|
19
20
|
import { orgVerdictBeforeClaim } from "./permission-rule-lanes.js";
|
|
20
21
|
import { chainCannotJudge } from "./call-hook-stations.js";
|
|
21
22
|
import { thrownText } from "../thrown-value.js";
|
|
@@ -100,8 +101,9 @@ async function applyRungs(input, admitted) {
|
|
|
100
101
|
});
|
|
101
102
|
};
|
|
102
103
|
const servedSkills = plainPolicyOutcome?.decision === "allow" && cp.pendingAction.kind === "tool_approval" ? skillsThatLoad(normalizeSkills(config.skills)) : [];
|
|
104
|
+
const decidedEdit = plainPolicyOutcome !== undefined && cp.pendingAction.kind === "tool_approval" ? ((name, edit) => (edit === undefined ? undefined : ((owned) => (owned.ok ? owned.value : edit))(bindableArgsOf(name, edit))))(cp.pendingAction.toolName, editOfAnswer(cp.pendingAction.toolName, exactBoundInputHashOf(cp.pendingAction.toolName, cp.pendingAction.args), plainPolicyOutcome.updatedInput)) : undefined;
|
|
103
105
|
if (plainPolicyOutcome?.decision === "allow" && cp.pendingAction.kind === "tool_approval") {
|
|
104
|
-
const claimed = judgeApprovalObject(cp.pendingAction, { args:
|
|
106
|
+
const claimed = judgeApprovalObject(cp.pendingAction, { args: decidedEdit ?? cp.pendingAction.args, skills: servedSkills, skillToolName: SKILL_TOOL_NAME }, "claim");
|
|
105
107
|
if (claimed !== "match" && claimed.member === "tool")
|
|
106
108
|
throw new CheckpointError("checkpoint.unsupported_version", claimed.message, { reason: "tool_identity_missing" });
|
|
107
109
|
if (claimed !== "match")
|
|
@@ -109,9 +111,9 @@ async function applyRungs(input, admitted) {
|
|
|
109
111
|
}
|
|
110
112
|
if (plainPolicyOutcome !== undefined &&
|
|
111
113
|
plainPolicyOutcome.decision === "allow" &&
|
|
112
|
-
|
|
114
|
+
decidedEdit !== undefined &&
|
|
113
115
|
cp.pendingAction.kind === "tool_approval") {
|
|
114
|
-
const editedArgs =
|
|
116
|
+
const editedArgs = decidedEdit;
|
|
115
117
|
const editBudget = {
|
|
116
118
|
resourceRemainingMicroUsd: remainingBudgetMicroUsd(cp.resourceLedger),
|
|
117
119
|
resourceSpentMicroUsd: cp.resourceLedger?.spentMicroUsd ?? 0,
|
|
@@ -181,7 +183,7 @@ async function applyRungs(input, admitted) {
|
|
|
181
183
|
}
|
|
182
184
|
const orgProvider = runner.deps.permissionRuleStore;
|
|
183
185
|
if (plainPolicyOutcome?.decision === "allow" && plainPolicyOutcome.hostDecision.decidedBy !== "person" && orgProvider?.partitions.org === true && cp.pendingAction.kind === "tool_approval") {
|
|
184
|
-
const call = { toolName: cp.pendingAction.toolName, args:
|
|
186
|
+
const call = { toolName: cp.pendingAction.toolName, args: decidedEdit !== undefined ? decidedEdit : cp.pendingAction.args, toolCallId: cp.pendingAction.toolCallId };
|
|
185
187
|
const orgNow = await raceEditAbort(orgVerdictBeforeClaim({ provider: orgProvider, principal: config.principal || cp.principal || undefined, localOwnerDeclared: runner.deps.localOwnerRules === true, sessionId: cp.sessionId, signal: editSignal }, call));
|
|
186
188
|
if (policyCannotAnswer(orgNow, plainPolicyOutcome.hostDecision.decidedBy)) {
|
|
187
189
|
const rule = orgNow.status === "available" ? orgNow.verdict?.rule : undefined;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* The resume ladder's CLAIM rung (E10), verbatim from `Runner.resumeStream`: the atomic
|
|
3
3
|
* CAS (`claimTerminal` when the store provides it — one round trip carrying the loser's truth — else the
|
|
4
4
|
* two-step `resolve` + diagnostic read), the same-Runner claim mark around it, and the loss classification
|
|
5
|
-
* (`reopened_concurrently` for a live row whose rev moved, `
|
|
6
|
-
* lost, `already_resolved` for a consumed one, with the dead parked-constraint entry evicted). Winning is the SOLE trigger to execute.
|
|
5
|
+
* (`reopened_concurrently` for a live row whose rev moved, `holder.superseded` — `holderSupersededError`, not a `CheckpointError` — for the
|
|
6
|
+
* validated row a carried claim holder lost, `already_resolved` for a consumed one, with the dead parked-constraint entry evicted). Winning is the SOLE trigger to execute.
|
|
7
7
|
*
|
|
8
8
|
* Async (the CAS). It ends by handing off to the driver's post-claim rung (`next`) in its LAST continuation
|
|
9
9
|
* — the post-consume hook fires on the tick the win was read — and returns what that rung returns.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CheckpointError } from "../checkpoint-store.js";
|
|
2
2
|
import { checkpointRevOf } from "../checkpoint-generation.js";
|
|
3
|
-
import { runExpiredDuty } from "./expire-settle.js";
|
|
3
|
+
import { lostToHolder, runExpiredDuty } from "./expire-settle.js";
|
|
4
|
+
import { holderSupersededError } from "../grant-holder.js";
|
|
4
5
|
export async function resumeClaim(input) {
|
|
5
6
|
const { token, cp, store, outcomeForStore, holder, locallyClaimedTokens, parentConstraintRegistry, suspendedEnvReaps, onDestroyError } = input;
|
|
6
7
|
const expect = { rev: checkpointRevOf(cp), ...(holder !== undefined ? { holder } : {}) };
|
|
@@ -29,9 +30,8 @@ export async function resumeClaim(input) {
|
|
|
29
30
|
loss = row ? { status: row.status, rev: checkpointRevOf(row), sameRow: row.scope === cp.scope } : { status: "absent", rev: undefined, sameRow: false };
|
|
30
31
|
}
|
|
31
32
|
if (loss.status === "pending") {
|
|
32
|
-
if (holder
|
|
33
|
-
throw
|
|
34
|
-
}
|
|
33
|
+
if (lostToHolder(holder, loss, expect.rev))
|
|
34
|
+
throw holderSupersededError("resume claim (nothing was applied and the checkpoint is unchanged by this resume; the current holder delivers)");
|
|
35
35
|
throw new CheckpointError("checkpoint.reopened_concurrently", "checkpoint changed concurrently (its revision advanced via a resolve/reopen cycle since this resume validated) — not executed; re-resume against the current state");
|
|
36
36
|
}
|
|
37
37
|
if (loss.status === "expired")
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* `Runner.resumeStream`: on a human / irreversible_ask row every deployment-supplied field of the
|
|
4
4
|
* `policy_ask` decide is read exactly once into a plain twin (answer and updatedInput by the one capture, in their
|
|
5
5
|
* JSON form, the decision word, the refused keys, the host's decision facts and attribution, the deny note),
|
|
6
|
-
* then the decision-action binding (boundCallId, boundInputHash
|
|
6
|
+
* then the decision-action binding (boundCallId, boundInputHash), the env_failed replay guard and
|
|
7
7
|
* the content-ask answer binding. Synchronous; every refusal throws pre-CAS.
|
|
8
8
|
*/
|
|
9
9
|
import { type QuestionResponse } from "../ask-question.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { classifyQuestionOutcome, isLiveQuestionFace } from "../ask-question.js";
|
|
2
|
-
import { capturedJsonOf } from "../canonical-json.js";
|
|
2
|
+
import { capturedJsonOf, editOfAnswer, exactBoundInputHashOf } from "../canonical-json.js";
|
|
3
3
|
import { bindingRefusalOf } from "../tool-policy.js";
|
|
4
|
-
import {
|
|
4
|
+
import { CheckpointError, checkpointVersionOf, winnerFromOutcome } from "../checkpoint-store.js";
|
|
5
5
|
import { isGateKind, resumeGateMatches } from "../pause-registry.js";
|
|
6
6
|
import { sanitizeUntrustedText, sentinelTagRefusal } from "../untrusted-text.js";
|
|
7
7
|
import { assertOutcomeText, captureHostDecision, describeSuppliedValue, pendingContentAskCallId, refuseSuppliedKeys, sameWinner, SUPPLIED_RECORD_KEY } from "./decide-continuation.js";
|
|
@@ -73,7 +73,7 @@ export function resumePolicyOutcome(input) {
|
|
|
73
73
|
throw new CheckpointError("checkpoint.invalid_outcome", "resume boundInputHash does not match the checkpoint's pending tool call input — refusing to apply the decision: have the decider review the input the pending card holds and send their decision for it with the card's boundInputHash", { field: "boundInputHash" });
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
else
|
|
76
|
+
else {
|
|
77
77
|
throw new CheckpointError("checkpoint.invalid_outcome", `resume of a binding-version (v${checkpointVersionOf(cp)}) checkpoint whose pending tool call has no persisted boundInputHash — refusing to resume an unbound binding-version checkpoint (corruption / downgrade guard)`, { reason: "bound_input_hash_missing" });
|
|
78
78
|
}
|
|
79
79
|
if (cp.reopenReason === "env_failed") {
|
|
@@ -88,7 +88,9 @@ export function resumePolicyOutcome(input) {
|
|
|
88
88
|
const reading = classifyQuestionOutcome(w.answer);
|
|
89
89
|
return reading.shape === "answered" ? { ...w, answer: reading.answer } : w;
|
|
90
90
|
})();
|
|
91
|
-
|
|
91
|
+
const shown = cp.pendingAction.kind === "tool_approval" ? exactBoundInputHashOf(cp.pendingAction.toolName, cp.pendingAction.args) : undefined;
|
|
92
|
+
const asRead = (w) => (w.decision !== "allow" || cp.pendingAction.kind !== "tool_approval" || editOfAnswer(cp.pendingAction.toolName, shown, w.updatedInput) !== undefined ? w : ((plain) => (Reflect.deleteProperty(plain, "updatedInput"), plain))({ ...w }));
|
|
93
|
+
if (incoming === undefined || !sameWinner(asRead(incoming), asRead(persistedWinner))) {
|
|
92
94
|
throw new CheckpointError("checkpoint.reopen_revote", `this checkpoint was reopened after an env-restore failure (env_failed) — a re-resume is a system retry of the already-approved action, not a re-vote; the supplied decision must replay the persisted winner (boundCallId "${cp.resolvedOutcome.boundCallId}", decision "${cp.resolvedOutcome.decision}"), refusing a different decision`);
|
|
93
95
|
}
|
|
94
96
|
}
|
|
@@ -23,6 +23,9 @@ export interface ResumePreflightInput<R> {
|
|
|
23
23
|
recheckGovernanceWindow: (() => Promise<void>) | undefined;
|
|
24
24
|
/** borrowed-readonly — the store the row lives in (the terminal arm's expire and its loss re-read). */
|
|
25
25
|
store: CheckpointStore;
|
|
26
|
+
/** borrowed-readonly — the deployment's claim holder the resume acts under (`RunInternals.holder`, the value the claim's CAS carries):
|
|
27
|
+
* the terminal arm's expire is issued in the resume's name with it. */
|
|
28
|
+
holder?: string | undefined;
|
|
26
29
|
/** borrowed-readonly — the Runner's deployment deps, read LIVE through the Runner (reads `resumePreflight`, `resumePreflightTimeoutMs`, `onError` (after the seat's await too) and is the seat's owner); the one home of why it is a
|
|
27
30
|
* seat and not a captured object is {@link RunnerDepsSeat}. */
|
|
28
31
|
runner: RunnerDepsSeat;
|
|
@@ -4,7 +4,9 @@ import { MAX_TIMER_MS } from "../mods/kernel/index.js";
|
|
|
4
4
|
import { frozenHandleCopy } from "../remote-env.js";
|
|
5
5
|
import { foreignLine } from "../protocol-http-auth.js";
|
|
6
6
|
import { describeSuppliedValue } from "./decide-continuation.js";
|
|
7
|
-
import { expireRowWithDuty } from "./expire-settle.js";
|
|
7
|
+
import { expireRowWithDuty, lostToHolder, runExpiredDuty } from "./expire-settle.js";
|
|
8
|
+
import { checkpointRevOf } from "../checkpoint-generation.js";
|
|
9
|
+
import { holderSupersededError } from "../grant-holder.js";
|
|
8
10
|
import { asThrownError } from "../thrown-value.js";
|
|
9
11
|
async function boundedPreflight(timeoutMs, signal, call) {
|
|
10
12
|
const controller = new AbortController();
|
|
@@ -42,7 +44,7 @@ async function boundedPreflight(timeoutMs, signal, call) {
|
|
|
42
44
|
}
|
|
43
45
|
const RESUME_PREFLIGHT_DEFAULT_TIMEOUT_MS = 10_000;
|
|
44
46
|
export async function resumePreflight(input) {
|
|
45
|
-
const { token, cp, resumeSignal, recheckGovernanceWindow, store, runner, locallyClaimedTokens, parentConstraintRegistry, suspendedEnvReaps } = input;
|
|
47
|
+
const { token, cp, resumeSignal, recheckGovernanceWindow, store, holder, runner, locallyClaimedTokens, parentConstraintRegistry, suspendedEnvReaps } = input;
|
|
46
48
|
if (runner.deps.resumePreflight !== undefined) {
|
|
47
49
|
const preflight = runner.deps.resumePreflight;
|
|
48
50
|
const rawDeadline = runner.deps.resumePreflightTimeoutMs;
|
|
@@ -99,7 +101,7 @@ export async function resumePreflight(input) {
|
|
|
99
101
|
const said = readableMessage !== undefined ? `: ${foreignLine(readableMessage)}` : " (no readable verdict — fail-closed)";
|
|
100
102
|
if (disposition === "terminal" && readableMessage !== undefined) {
|
|
101
103
|
const settled = await expireRowWithDuty({
|
|
102
|
-
token, scope: cp.scope, store, locallyClaimedTokens, parentConstraintRegistry, suspendedEnvReaps,
|
|
104
|
+
token, scope: cp.scope, store, holder, locallyClaimedTokens, parentConstraintRegistry, suspendedEnvReaps,
|
|
103
105
|
destroyLabel: "terminal-preflight env destroy",
|
|
104
106
|
onDestroyError: (envErr, sessionId) => {
|
|
105
107
|
try {
|
|
@@ -111,6 +113,11 @@ export async function resumePreflight(input) {
|
|
|
111
113
|
});
|
|
112
114
|
if (!settled) {
|
|
113
115
|
const live = await store.get(token);
|
|
116
|
+
if (lostToHolder(holder, { status: live?.status ?? "absent", rev: live ? checkpointRevOf(live) : undefined, sameRow: live?.scope === cp.scope }, checkpointRevOf(cp))) {
|
|
117
|
+
throw holderSupersededError("resume preflight's terminal settle (nothing was settled by this refusal; the checkpoint is unchanged and stays pending for the current holder)");
|
|
118
|
+
}
|
|
119
|
+
if (live?.status === "expired")
|
|
120
|
+
await runExpiredDuty({ token, parentConstraintRegistry, suspendedEnvReaps, destroyLabel: "terminal-preflight env destroy", onDestroyError: (envErr) => runner.deps.onError?.(envErr, { phase: "config", sessionId: cp.sessionId }) });
|
|
114
121
|
if (live?.status === "pending") {
|
|
115
122
|
throw new CheckpointError("resume.preflight_rejected", `the deployment's resumePreflight ruled this resume PERMANENTLY blocked${said}, but the row moved under this refusal (a concurrent resolve/reopen cycle) — nothing was settled here; the row is pending again, re-resume against the current state (the preflight screens every attempt)`, { settler: "nobody" });
|
|
116
123
|
}
|
|
@@ -4,9 +4,11 @@ import { userRowSourceOf } from "../user-row-origin.js";
|
|
|
4
4
|
import { indexOnBranch, refuseBranchOutsideWindow } from "./branch-window.js";
|
|
5
5
|
import { refuseOpenToolCallAt } from "./continues-from.js";
|
|
6
6
|
import { judgeRewindTarget } from "./rewind-target.js";
|
|
7
|
+
import { assertStoreJudgesHolder } from "../checkpoint-generation.js";
|
|
8
|
+
import { stampHolder } from "./session-write-ledger.js";
|
|
7
9
|
import { acquireExistingSession, claimIdleSession, readOccupantExpectation, readPlainRequest, refuseParkedSession, shownValue } from "./session-verb-doors.js";
|
|
8
10
|
const VERB = "Runner.rewindConversation";
|
|
9
|
-
const REQUEST_KEYS = new Set(["sessionId", "to", "dryRun", "lastSeenInput", "expect", "checkpointStore"]);
|
|
11
|
+
const REQUEST_KEYS = new Set(["sessionId", "to", "dryRun", "lastSeenInput", "expect", "checkpointStore", "holder"]);
|
|
10
12
|
const PARKED = {
|
|
11
13
|
verb: VERB,
|
|
12
14
|
code: "rewind.session_parked",
|
|
@@ -15,11 +17,13 @@ const PARKED = {
|
|
|
15
17
|
export async function rewindSessionConversation(seats, request) {
|
|
16
18
|
const req = screenRequest(request);
|
|
17
19
|
const store = resolveCheckpointStore(req.checkpointStore !== undefined ? { checkpointStore: req.checkpointStore } : {}, seats.deps);
|
|
20
|
+
assertStoreJudgesHolder("session", "RunnerDeps.sessionStore", seats.sessions, req.holder, "host");
|
|
18
21
|
const release = await claimIdleSession(seats, req.sessionId, () => sessionBusyRefusal(req.to, `a task is running or queued on session "${req.sessionId}" in this Runner, or a write one of its tasks issued has not settled`));
|
|
19
22
|
try {
|
|
20
23
|
const acquired = await acquireExistingSession(seats.sessions, req.sessionId, VERB, "nothing was rewound", req.expect);
|
|
21
24
|
await refuseParkedSession(store, req.sessionId, req.checkpointStore !== undefined ? "the request's" : "the deployment's", PARKED);
|
|
22
|
-
const
|
|
25
|
+
const raw = acquired.session.getStorage();
|
|
26
|
+
const storage = req.holder !== undefined ? stampHolder(raw, req.holder) : raw;
|
|
23
27
|
const { landing } = await judgeRewindTarget(storage, req.to, "before", req.sessionId, VERB);
|
|
24
28
|
const leaf = await storage.getLeafId();
|
|
25
29
|
const answer = { dryRun: req.dryRun, leafId: landing, previousLeafId: leaf };
|
|
@@ -71,11 +75,11 @@ function refuseUnseenLaterTurn(branch, seen, req) {
|
|
|
71
75
|
}
|
|
72
76
|
function screenRequest(request) {
|
|
73
77
|
const bad = (what) => {
|
|
74
|
-
const e = new Error(`${VERB}: ${what} — nothing was rewound. The request is { sessionId, to, dryRun?, lastSeenInput?, expect?, checkpointStore? }.`);
|
|
78
|
+
const e = new Error(`${VERB}: ${what} — nothing was rewound. The request is { sessionId, to, dryRun?, lastSeenInput?, expect?, checkpointStore?, holder? }.`);
|
|
75
79
|
e.code = "rewind.invalid_spec";
|
|
76
80
|
throw e;
|
|
77
81
|
};
|
|
78
|
-
const { sessionId, to, dryRun, lastSeenInput, expect, checkpointStore } = readPlainRequest(request, REQUEST_KEYS, bad);
|
|
82
|
+
const { sessionId, to, dryRun, lastSeenInput, expect, checkpointStore, holder } = readPlainRequest(request, REQUEST_KEYS, bad);
|
|
79
83
|
if (typeof sessionId !== "string" || sessionId === "")
|
|
80
84
|
return bad(`sessionId must be a non-empty string, got ${shownValue(sessionId)}`);
|
|
81
85
|
if (typeof to !== "string" || to === "")
|
|
@@ -84,7 +88,10 @@ function screenRequest(request) {
|
|
|
84
88
|
return bad(`dryRun must be a boolean when given, got ${shownValue(dryRun)}`);
|
|
85
89
|
if (lastSeenInput !== undefined && (typeof lastSeenInput !== "string" || lastSeenInput === ""))
|
|
86
90
|
return bad(`lastSeenInput must be a non-empty entry id when given, got ${shownValue(lastSeenInput)}`);
|
|
91
|
+
if (holder !== undefined && (typeof holder !== "string" || holder === ""))
|
|
92
|
+
return bad(`holder must be a non-empty string when given (the grant the verb acts under), got ${holder === "" ? "an empty string" : `a ${holder === null ? "null" : typeof holder}`}`);
|
|
87
93
|
return {
|
|
94
|
+
holder,
|
|
88
95
|
sessionId,
|
|
89
96
|
to,
|
|
90
97
|
dryRun: dryRun === true,
|
|
@@ -8,15 +8,17 @@ import { noBoundaryRefusal, refuseFailedPlan, refuseUnheldPlan, settleFileHistor
|
|
|
8
8
|
import { adoptForkedFileHistory, unaddressedRewindRefusal } from "./prepare-file-history.js";
|
|
9
9
|
import { openSessionFiles } from "./session-files-open.js";
|
|
10
10
|
import { createRollbackStack } from "./rollback-stack.js";
|
|
11
|
+
import { assertStoreJudgesHolder } from "../checkpoint-generation.js";
|
|
11
12
|
import { acquireExistingSession, claimIdleSession, readOccupantExpectation, readPlainRequest, shownValue } from "./session-verb-doors.js";
|
|
12
13
|
import { settleTeardownLeg } from "./teardown-bounded.js";
|
|
13
14
|
import { settleBound } from "./continues-from.js";
|
|
14
15
|
import { syncAtRewindEnd } from "./workspace-sync.js";
|
|
15
16
|
import { recordedRootOf } from "../session-checkout.js";
|
|
16
17
|
import { canonicalOrSelf } from "./child-tree.js";
|
|
17
|
-
const REQUEST_KEYS = new Set(["sessionId", "to", "dryRun", "signal", "expect", "unplacedHistoryRecordedUnder", "cwd"]);
|
|
18
|
+
const REQUEST_KEYS = new Set(["sessionId", "to", "dryRun", "signal", "expect", "unplacedHistoryRecordedUnder", "cwd", "holder"]);
|
|
18
19
|
export async function rewindSessionFiles(seats, request) {
|
|
19
20
|
const req = screenRewindFilesRequest(request);
|
|
21
|
+
assertStoreJudgesHolder("session", "RunnerDeps.sessionStore", seats.sessions, req.holder, "host");
|
|
20
22
|
const { deps } = seats;
|
|
21
23
|
const { wiredSeat, fileHistoryStore, captureStore } = resolveDeploymentFileHistory(deps);
|
|
22
24
|
if (fileHistoryStore === undefined)
|
|
@@ -43,18 +45,15 @@ export async function rewindSessionFiles(seats, request) {
|
|
|
43
45
|
throw err;
|
|
44
46
|
}
|
|
45
47
|
rollback.commit();
|
|
46
|
-
|
|
47
|
-
const readStates = {
|
|
48
|
-
noteRestored: (sessionId, absPaths) => {
|
|
49
|
-
if (absPaths.length > 0)
|
|
50
|
-
moved = true;
|
|
51
|
-
seats.readStates.noteRestored(sessionId, absPaths);
|
|
52
|
-
},
|
|
53
|
-
};
|
|
48
|
+
const outcome = { moved: "none" };
|
|
54
49
|
try {
|
|
55
|
-
return await rewindOnEnv(req, envPhase.executionEnv, envPhase.handsEnabled, envPhase.taskRootInitial, { store: fileHistoryStore, captureStore, session: session.session, seats, readStates });
|
|
50
|
+
return await rewindOnEnv(req, envPhase.executionEnv, envPhase.handsEnabled, envPhase.taskRootInitial, { store: fileHistoryStore, captureStore, session: session.session, seats, readStates: seats.readStates, outcome });
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
throw withVerbSettlement(err, outcome);
|
|
56
54
|
}
|
|
57
55
|
finally {
|
|
56
|
+
const moved = outcome.moved !== "none";
|
|
58
57
|
const owned = envPhase.ownedEnvSeat.current;
|
|
59
58
|
const destroying = owned !== undefined && hasDestroy(owned);
|
|
60
59
|
const bound = settleBound();
|
|
@@ -95,16 +94,30 @@ async function rewindOnEnv(req, env, handsEnabled, baseRoot, ctx) {
|
|
|
95
94
|
refuseFailedPlan(plan.restore, req.to, req.sessionId, "preview");
|
|
96
95
|
return { dryRun: true, preview: plan.diffStats };
|
|
97
96
|
}
|
|
98
|
-
const restore = await settleFileHistoryRestore({ store: ctx.store, sessionId: req.sessionId, scope: historyScope, target: req.to, before: false, env, root: historyRoot, signal: req.signal, readStates: ctx.readStates, options: req.restoreOptions, wholeOrNothing: false });
|
|
97
|
+
const restore = await settleFileHistoryRestore({ store: ctx.store, sessionId: req.sessionId, scope: historyScope, target: req.to, before: false, env, root: historyRoot, signal: req.signal, readStates: ctx.readStates, options: req.restoreOptions, wholeOrNothing: false, outcome: ctx.outcome });
|
|
99
98
|
return { dryRun: false, restore };
|
|
100
99
|
}
|
|
100
|
+
function withVerbSettlement(err, outcome) {
|
|
101
|
+
if (readMember(err, "code") !== "rewind.restore_failed")
|
|
102
|
+
return err;
|
|
103
|
+
const detail = readMember(err, "detail");
|
|
104
|
+
if (detail === null || typeof detail !== "object")
|
|
105
|
+
return err;
|
|
106
|
+
try {
|
|
107
|
+
if (Object.isExtensible(detail))
|
|
108
|
+
detail.rewind = { moved: outcome.moved, branch: "untouched" };
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
}
|
|
112
|
+
return err;
|
|
113
|
+
}
|
|
101
114
|
function screenRewindFilesRequest(request) {
|
|
102
115
|
const bad = (what) => {
|
|
103
|
-
const e = new Error(`Runner.rewindFiles: ${what} — nothing was rewound. The request is { sessionId, to, dryRun?, signal?, expect?, unplacedHistoryRecordedUnder?, cwd? }.`);
|
|
116
|
+
const e = new Error(`Runner.rewindFiles: ${what} — nothing was rewound. The request is { sessionId, to, dryRun?, signal?, expect?, unplacedHistoryRecordedUnder?, cwd?, holder? }.`);
|
|
104
117
|
e.code = "rewind.invalid_spec";
|
|
105
118
|
throw e;
|
|
106
119
|
};
|
|
107
|
-
const { sessionId, to, dryRun, signal, expect, unplacedHistoryRecordedUnder, cwd } = readPlainRequest(request, REQUEST_KEYS, bad);
|
|
120
|
+
const { sessionId, to, dryRun, signal, expect, unplacedHistoryRecordedUnder, cwd, holder } = readPlainRequest(request, REQUEST_KEYS, bad);
|
|
108
121
|
if (typeof sessionId !== "string" || sessionId === "")
|
|
109
122
|
return bad(`sessionId must be a non-empty string, got ${shownValue(sessionId)}`);
|
|
110
123
|
if (typeof to !== "string" || to === "")
|
|
@@ -115,7 +128,9 @@ function screenRewindFilesRequest(request) {
|
|
|
115
128
|
return bad(`signal must be an AbortSignal when given, got ${shownValue(signal)}`);
|
|
116
129
|
if (cwd !== undefined && !isAbsoluteHostPath(cwd))
|
|
117
130
|
return bad(`cwd must be an absolute host path when given (posix "/…", a Windows drive "C:\\…" or UNC "\\\\server\\share\\…"; no ".." segment, no NUL, at most ${ABSOLUTE_HOST_PATH_MAX} characters), got ${shownValue(cwd)}`);
|
|
118
|
-
|
|
131
|
+
if (holder !== undefined && (typeof holder !== "string" || holder === ""))
|
|
132
|
+
return bad(`holder must be a non-empty string when given (the grant the verb acts under), got ${holder === "" ? "an empty string" : `a ${holder === null ? "null" : typeof holder}`}`);
|
|
133
|
+
return { sessionId, to, dryRun: dryRun === true, signal, expect: readOccupantExpectation(expect, bad), restoreOptions: readRestoreOptions(unplacedHistoryRecordedUnder, true, "Runner.rewindFiles"), cwd, holder };
|
|
119
134
|
}
|
|
120
135
|
function sessionBusyRefusal(sessionId, target) {
|
|
121
136
|
const e = new Error(`Runner.rewindFiles: a task is running or queued on session "${sessionId}" in this Runner, or a write one of its tasks issued has not settled — rewinding its files to entry "${target}" now would move them under that work, so nothing was rewound; retry once it has ended and its writes have settled`);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The leg's ONE record of what its rewind did — the files (`moved`, and the accepted restore's own ledger) and the conversation's
|
|
3
|
+
* leaf (`branch`) — minted where each happens and read by the two exits that mint a result: the run's assembly (`assemble-result.ts`)
|
|
4
|
+
* and the settle backstop of a leg whose prepare threw (`stream-settle-backstop.ts`). Each writer states the fact it is the one to
|
|
5
|
+
* know: the restore (`settleFileHistoryRestore`, off the witness of what it asked of the env), the acquire that branched
|
|
6
|
+
* (`prepare-acquire-reconcile.ts`), the cleanup that puts the branch back (`writeBranchBack`), the file-history phase that accepted
|
|
7
|
+
* the restore. Nothing re-derives a fact from a sentence or a code.
|
|
8
|
+
*/
|
|
9
|
+
import type { RewindBranch, RewindMoved, TaskRewindSettlement } from "../terminal-cause.js";
|
|
10
|
+
import type { TaskResult, TaskSpec } from "../types.js";
|
|
11
|
+
/** The record ({@link rewindOutcomeOf} mints it; the writers above fill it). `branch: undefined` = not known (see
|
|
12
|
+
* {@link TaskRewindSettlement.branch}). `restore` = the restore the leg accepted (complete, or partial under `acceptPartialRestore`). */
|
|
13
|
+
export interface RewindOutcome {
|
|
14
|
+
moved: RewindMoved;
|
|
15
|
+
branch: RewindBranch | undefined;
|
|
16
|
+
restore?: NonNullable<TaskResult["fileRestore"]>;
|
|
17
|
+
}
|
|
18
|
+
/** The record for a leg whose request asks for a rewind (`resumeAt`, `rewindFilesTo` or `restoreFiles` stated) — nothing moved yet,
|
|
19
|
+
* the leaf where the request found it; `undefined` for any other leg (it states no `rewind`). Read off the members as stated, before
|
|
20
|
+
* any of them is judged: a request whose rewind is then refused still asked for one. */
|
|
21
|
+
export declare function rewindOutcomeOf(spec: Pick<TaskSpec, "resumeAt" | "rewindFilesTo" | "restoreFiles">): RewindOutcome | undefined;
|
|
22
|
+
/** The settlement a failed terminal states ({@link TaskRewindSettlement}): a copy of the record as it stands (`branch` left out when
|
|
23
|
+
* not known). */
|
|
24
|
+
export declare function rewindSettlementOf(outcome: RewindOutcome): TaskRewindSettlement;
|
|
25
|
+
/** A result's two rewind members off the leg's record: `terminal.rewind` on a terminal that did not do the work (`failed`, `blocked`),
|
|
26
|
+
* `fileRestore` on any terminal whose leg accepted its restore. The one reading both result exits apply. */
|
|
27
|
+
export declare function withRewindOutcome(result: TaskResult, outcome: RewindOutcome | undefined): TaskResult;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function rewindOutcomeOf(spec) {
|
|
2
|
+
if (spec.resumeAt === undefined && spec.rewindFilesTo === undefined && spec.restoreFiles === undefined)
|
|
3
|
+
return undefined;
|
|
4
|
+
return { moved: "none", branch: "untouched" };
|
|
5
|
+
}
|
|
6
|
+
export function rewindSettlementOf(outcome) {
|
|
7
|
+
return { moved: outcome.moved, ...(outcome.branch !== undefined ? { branch: outcome.branch } : {}) };
|
|
8
|
+
}
|
|
9
|
+
export function withRewindOutcome(result, outcome) {
|
|
10
|
+
if (outcome === undefined)
|
|
11
|
+
return result;
|
|
12
|
+
const terminal = result.terminal.kind === "failed" || result.terminal.kind === "blocked" ? { ...result.terminal, rewind: rewindSettlementOf(outcome) } : result.terminal;
|
|
13
|
+
return { ...result, terminal, ...(outcome.restore !== undefined ? { fileRestore: outcome.restore } : {}) };
|
|
14
|
+
}
|
|
@@ -17,7 +17,8 @@ export async function runAttachmentSeats(input) {
|
|
|
17
17
|
rs.attach.skillsListingOn = rs.attach.attachmentsCfg?.skillsListing !== false && eventDefaultOn("skills_listing");
|
|
18
18
|
const listingsLive = (rs.attach.agentListingOn && prepared.agentListing !== undefined) || (rs.attach.skillsListingOn && prepared.skillsListing !== undefined);
|
|
19
19
|
const backgroundTasksLive = (rs.attach.attachmentsCfg?.backgroundTasks ?? eventDefaultOn("background_tasks")) === true;
|
|
20
|
-
|
|
20
|
+
const runTimeRemindersLive = prepared.runTimeReminders.lane.silentTurn !== "off" || prepared.runTimeReminders.lane.elapsedTime;
|
|
21
|
+
rs.attach.attachState = rs.attach.attachmentsCfg !== undefined || listingsLive || backgroundTasksLive || runTimeRemindersLive || prepared.outputStyleFrame !== undefined ? createAttachmentState() : undefined;
|
|
21
22
|
rs.attach.dateState = prepared.dateChange !== undefined ? { announcedDate: prepared.dateChange.anchor?.current?.announcedDate ?? prepared.dateChange.legDate } : undefined;
|
|
22
23
|
rs.attach.sizeGuidelineState =
|
|
23
24
|
prepared.workflowSizeGuideline !== undefined
|
|
@@ -22,6 +22,8 @@ export function runClockAndContent(input) {
|
|
|
22
22
|
if (role !== "user" && userRow !== undefined)
|
|
23
23
|
throw new TypeError(`a ${role} row has no user-row source`);
|
|
24
24
|
const source = userRow === undefined ? undefined : judgeUserRowSource(userRow);
|
|
25
|
+
if (source?.origin === "human_input")
|
|
26
|
+
prepared.runTimeReminders.elapsedClock.committed(source.inputId);
|
|
25
27
|
if (role === "toolResult" && toolCallId !== undefined)
|
|
26
28
|
startedToolCallIds.delete(toolCallId);
|
|
27
29
|
offerLegFrame({
|
|
@@ -24,6 +24,8 @@ export function runIdentityWiring(input) {
|
|
|
24
24
|
taskIdRef.editedFiles = prepared.editedFilesSnapshot;
|
|
25
25
|
if (taskIdRef)
|
|
26
26
|
taskIdRef.readFloorUnkept = prepared.readFloorUnkept;
|
|
27
|
+
if (taskIdRef)
|
|
28
|
+
taskIdRef.posture = prepared;
|
|
27
29
|
const runSourceTaskId = prepared.taskId;
|
|
28
30
|
const parentToolCallId = internals?.parentToolCallId;
|
|
29
31
|
const ident = () => parentToolCallId !== undefined ? { eventId: uuidv7(), parentToolCallId, sourceTaskId: runSourceTaskId } : { eventId: uuidv7() };
|
|
@@ -46,6 +46,7 @@ import { languageFrameText, registerLanguageReceipt } from "./language-frame.js"
|
|
|
46
46
|
import { registerSandboxFrameReceipt, sandboxFrameText } from "./command-sandbox-frame.js";
|
|
47
47
|
import { resumeContinuation } from "./decide-continuation.js";
|
|
48
48
|
import { sameBytes } from "../rewrite-rejudge.js";
|
|
49
|
+
import { editOfAnswer, exactBoundInputHashOf } from "../canonical-json.js";
|
|
49
50
|
import { approvalWordsOf, owedApprovalWords, withApprovalWords } from "./approval-feedback.js";
|
|
50
51
|
import { chainCannotJudge } from "./call-hook-stations.js";
|
|
51
52
|
import { settleExecutionRecord } from "./execution-record.js";
|
|
@@ -224,6 +225,7 @@ export async function runLeg(input) {
|
|
|
224
225
|
...(resume.wakeMessage !== undefined ? [{ entry: resume.wakeMessage, source: "wake" }] : []),
|
|
225
226
|
];
|
|
226
227
|
const appliedEvents = [];
|
|
228
|
+
let personSpoke = false;
|
|
227
229
|
const withheldSteerIds = new Set();
|
|
228
230
|
const answeredInputs = [];
|
|
229
231
|
for (const { entry: steer, source } of resumeFrames) {
|
|
@@ -310,6 +312,8 @@ export async function runLeg(input) {
|
|
|
310
312
|
continuation += "\n\n" + personSteerFrame(delivered.text, steer.actor, steer.trusted, prepared.reminderMark, named);
|
|
311
313
|
if (steer.trusted)
|
|
312
314
|
engineSegments.push({ start, end: continuation.length });
|
|
315
|
+
if (named !== "system")
|
|
316
|
+
personSpoke = true;
|
|
313
317
|
appliedEvents.push(() => ({
|
|
314
318
|
...buildAppliedHumanInputEvent({ carrier: source, source: named, sessionSeq: nextHumanInputSeq(prepared.harness), inputId: steer.inputId, actor: steer.actor, principal: spec.principal, runOrigin: steer.runOrigin, rewrittenBy: delivered.rewrittenBy }),
|
|
315
319
|
...ident(),
|
|
@@ -365,6 +369,7 @@ export async function runLeg(input) {
|
|
|
365
369
|
if (prepared.turnOpenRedelivery.current !== undefined)
|
|
366
370
|
await prepared.turnOpenRedelivery.current;
|
|
367
371
|
const resumeNotice = changedResume !== undefined && changedResumeBlock !== undefined ? changedFilesNoticeIn(continuation, changedResumeBlock, changedResume) : undefined;
|
|
372
|
+
prepared.runTimeReminders.opening.current = { byPerson: appliedEvents.length > 0, at: Date.now() };
|
|
368
373
|
final = await withBrainSinks(() => prepared.harness.prompt(continuation, {
|
|
369
374
|
engineSegments,
|
|
370
375
|
...(resumeNotice !== undefined ? { changedFilesNotices: [resumeNotice] } : {}),
|
|
@@ -375,6 +380,8 @@ export async function runLeg(input) {
|
|
|
375
380
|
...(appliedEvents.length > 0 ? { input: usableInputId(resume.wakeMessage?.inputId) !== undefined ? { inputId: resume.wakeMessage.inputId } : {} } : {}),
|
|
376
381
|
onCommitted: (entryId) => {
|
|
377
382
|
recordIntake(entryId);
|
|
383
|
+
if (personSpoke)
|
|
384
|
+
prepared.runTimeReminders.elapsedClock.restart();
|
|
378
385
|
if (resume !== undefined)
|
|
379
386
|
resume.decisionDelivered = true;
|
|
380
387
|
prepared.undeliveredContinuationRef.current = { parkedSteers: [], orphanTasks: [] };
|
|
@@ -540,6 +547,8 @@ export async function runLeg(input) {
|
|
|
540
547
|
if (postureText !== undefined)
|
|
541
548
|
effectiveObjective = `${postureText}\n${effectiveObjective}`;
|
|
542
549
|
const objectiveInputId = uuidv7();
|
|
550
|
+
if (!wakeLeg && countsAsOperator(author))
|
|
551
|
+
prepared.runTimeReminders.elapsedClock.admit(objectiveInputId);
|
|
543
552
|
const enginePrefixChars = effectiveObjective.length - projectedObjective.length;
|
|
544
553
|
const standingGit = gitLegDelivered === undefined ? protectedGitFrameOf(prepared.gitStatusRef) : undefined;
|
|
545
554
|
const objectiveGit = gitLegDelivered ?? (standingGit !== undefined ? { wrapped: standingGit.protectedText, standalone: false, ...(standingGit.substitute !== undefined ? { substitute: standingGit.substitute } : {}) } : undefined);
|
|
@@ -615,6 +624,7 @@ export async function runLeg(input) {
|
|
|
615
624
|
});
|
|
616
625
|
if (prepared.turnOpenRedelivery.current !== undefined)
|
|
617
626
|
await prepared.turnOpenRedelivery.current;
|
|
627
|
+
prepared.runTimeReminders.opening.current = { byPerson: !wakeLeg, at: Date.now() };
|
|
618
628
|
const firstNotice = changedFirst === undefined ? undefined : changedFilesNoticeIn(effectiveObjective, mintSystemReminder(sanitizeUntrustedText(changedFirst.body, attachmentEnvelopeTags("changed_files")), prepared.reminderMark), changedFirst);
|
|
619
629
|
final = await withBrainSinks(() => wakeLeg
|
|
620
630
|
?
|
|
@@ -725,7 +735,7 @@ async function resolvePendingCall(runner, prepared, resume, emit, emitCommitted,
|
|
|
725
735
|
if (decidedGate === undefined) {
|
|
726
736
|
throw new CheckpointError("checkpoint.invalid_outcome", "pending action reached the resolver with no settlement record on its decision (gateOutcome) — refusing to execute or settle a decision that carries no record");
|
|
727
737
|
}
|
|
728
|
-
const humanRewrite = isEngineQuestionFace(parkedRowLiveFace(prepared.toolRosterDeltas.current, pendingAction)) ? undefined : outcome.updatedInput;
|
|
738
|
+
const humanRewrite = isEngineQuestionFace(parkedRowLiveFace(prepared.toolRosterDeltas.current, pendingAction)) ? undefined : editOfAnswer(pendingAction.toolName, exactBoundInputHashOf(pendingAction.toolName, pendingAction.args), outcome.updatedInput);
|
|
729
739
|
const reading = liveTool === undefined ? undefined : ownedReading((a) => readToolCallArguments(liveTool, { type: "toolCall", id: pendingAction.toolCallId, name: pendingAction.toolName, arguments: {} }, a));
|
|
730
740
|
const beltFace = () => { const f = parkedRowLiveFace(prepared.toolRosterDeltas.current, pendingAction); if (f !== undefined && reading !== undefined)
|
|
731
741
|
stampArgsReading(f, reading); return f; };
|
|
@@ -6,6 +6,7 @@ import type { RunnerDeps, TaskEvent, TaskSpec } from "../types.js";
|
|
|
6
6
|
import type { SessionReadFileStates } from "./session-read-file-states.js";
|
|
7
7
|
import type { SessionModeSeats } from "./session-mode-seats.js";
|
|
8
8
|
import type { SessionFastModeSeats } from "./fast-mode-seat.js";
|
|
9
|
+
import type { SessionPromptSeats } from "./session-prompt-seats.js";
|
|
9
10
|
import type { SessionMcpPools } from "../mcp-connection-pool.js";
|
|
10
11
|
import type { NotificationLaneBindings, Prepared, PrepareTaskFn, ResumeRun, RunInternals, RunnerDepsSeat, RunnerSelfSeat, TaskIdRef } from "./contracts.js";
|
|
11
12
|
export interface RunNotificationLaneInput<R> {
|
|
@@ -42,6 +43,8 @@ export interface RunNotificationLaneInput<R> {
|
|
|
42
43
|
sessionModeSeats: SessionModeSeats;
|
|
43
44
|
/** borrowed-mutable — the Runner's per-session fast-mode facts, ALWAYS this Runner's (as the seats above). */
|
|
44
45
|
sessionFastModeSeats: SessionFastModeSeats;
|
|
46
|
+
/** borrowed-mutable — the Runner's per-session prompt seats (the elapsed-time clock), ALWAYS this Runner's (as the seats above). */
|
|
47
|
+
sessionPromptSeats: SessionPromptSeats;
|
|
45
48
|
/** borrowed-mutable — the MCP pools of the process's session trees (the one table every Runner reads), ALWAYS (as the two above). */
|
|
46
49
|
sessionMcpPools: SessionMcpPools;
|
|
47
50
|
/** borrowed-mutable — the Runner's per-session parked-notification store: the torn-down lane and the escalation pend here. */
|
|
@@ -15,7 +15,7 @@ export function runNotificationLane(input) {
|
|
|
15
15
|
return obligations.run(() => runNotificationLaneAs(input, obligations));
|
|
16
16
|
}
|
|
17
17
|
async function runNotificationLaneAs(input, obligations) {
|
|
18
|
-
const { spec, queue, resume, internals, taskIdRef, holdSessionLock, legWrites, runEnd, promptSubmitRef, runner, self, sessions, sessionReadStates, sessionModeSeats, sessionFastModeSeats, sessionMcpPools, pendingSessionNotifications, prepareTask, next } = input;
|
|
18
|
+
const { spec, queue, resume, internals, taskIdRef, holdSessionLock, legWrites, runEnd, promptSubmitRef, runner, self, sessions, sessionReadStates, sessionModeSeats, sessionFastModeSeats, sessionPromptSeats, sessionMcpPools, pendingSessionNotifications, prepareTask, next } = input;
|
|
19
19
|
const prepareResume = resume
|
|
20
20
|
? {
|
|
21
21
|
leafId: resume.cp.leafId,
|
|
@@ -160,7 +160,7 @@ async function runNotificationLaneAs(input, obligations) {
|
|
|
160
160
|
peerInboundChainRef,
|
|
161
161
|
detachHub,
|
|
162
162
|
sessionReadStates,
|
|
163
|
-
sessionModeSeats, sessionFastModeSeats, sessionMcpPools,
|
|
163
|
+
sessionModeSeats, sessionFastModeSeats, sessionPromptSeats, sessionMcpPools,
|
|
164
164
|
onTaskNotification: laneSink,
|
|
165
165
|
}, self, taskIdRef, holdSessionLock, legWrites, (destination, delivery) => pendingSessionNotifications.discardsStaleNotice(destination, delivery), promptSubmitRef, runEnd);
|
|
166
166
|
settlementSeat = prepared.frameSettlement;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AssistantMessage } from "../../internal/llm.js";
|
|
2
2
|
import type { ResolvedReasoning } from "../../brain/reasoning.js";
|
|
3
|
+
import type { UnstartedRowOutcome } from "../terminal-cause.js";
|
|
3
4
|
import type { PushQueue } from "../push-queue.js";
|
|
4
5
|
import type { SessionStore } from "../session.js";
|
|
5
6
|
import { type CompactOutcome, type DelegationLifecycleEvent, type OwedUserInputAccount, type TaskEvent, type TaskResult, type TaskSpec } from "../types.js";
|
|
@@ -78,8 +79,9 @@ export interface RunSettleAndTeardownInput {
|
|
|
78
79
|
};
|
|
79
80
|
/** borrowed-readonly — the adoption lane's unsettled undrained-input account, closed below (after the reopen). */
|
|
80
81
|
owedUserInput: OwedUserInputAccount;
|
|
81
|
-
/** borrowed-readonly — the stream's result setter: the assembled TaskResult is published through it exactly once
|
|
82
|
-
|
|
82
|
+
/** borrowed-readonly — the stream's result setter: the assembled TaskResult is published through it exactly once, beside the
|
|
83
|
+
* answer of this exit's compensation (`undefined` when it asked none) — the Runner's two registries read what it leaves in place. */
|
|
84
|
+
setResult: (r: TaskResult, row: UnstartedRowOutcome | undefined) => void;
|
|
83
85
|
/** borrowed-readonly — the stream's suggestions seat: the fire-and-forget suggestion pass's promise is handed to it. */
|
|
84
86
|
onSuggestions: (p: Promise<string[]>) => void;
|
|
85
87
|
/** borrowed-readonly — the stream's reap-stash for a committed pause (what `destroy()` reaps when the run SUSPENDED). */
|