@sema-agent/core 7.68.4 → 7.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1625 -0
- package/dist/agents/agent-definition.d.ts +32 -3
- package/dist/agents/agent-definition.js +39 -1
- package/dist/agents/agent-transcript-tool.js +16 -5
- package/dist/agents/cascade.js +9 -6
- package/dist/agents/cc-uds-peer-channel.js +2 -1
- package/dist/agents/cumulative-stats.d.ts +3 -1
- package/dist/agents/cumulative-stats.js +4 -1
- package/dist/agents/delegation-review-faces.d.ts +35 -0
- package/dist/agents/delegation-review-faces.js +26 -0
- package/dist/agents/inherited-tool-pool.d.ts +4 -2
- package/dist/agents/list-agents-tool.d.ts +8 -19
- package/dist/agents/list-agents-tool.js +19 -34
- package/dist/agents/peer-directory.js +3 -2
- package/dist/agents/peer-held-queue.d.ts +6 -1
- package/dist/agents/peer-held-queue.js +10 -1
- package/dist/agents/peer-idle.d.ts +3 -1
- package/dist/agents/peer-idle.js +4 -4
- package/dist/agents/peer-session-drain.d.ts +9 -1
- package/dist/agents/peer-session-drain.js +185 -116
- package/dist/agents/repair-loop.js +12 -8
- package/dist/agents/retain-ledger.d.ts +122 -58
- package/dist/agents/retain-ledger.js +48 -21
- package/dist/agents/root-session-lane.d.ts +17 -0
- package/dist/agents/root-session-lane.js +9 -0
- package/dist/agents/send-message-tool.js +44 -31
- package/dist/agents/subagent-steps.d.ts +0 -11
- package/dist/agents/subagent-steps.js +1 -14
- package/dist/agents/subagent-transcript-placement.d.ts +4 -3
- package/dist/agents/subagent.d.ts +19 -8
- package/dist/agents/subagent.js +250 -207
- package/dist/agents/tool-filter.d.ts +31 -1
- package/dist/agents/tool-filter.js +28 -4
- package/dist/agents/verifier-independence.js +3 -2
- package/dist/agents/verify.d.ts +5 -1
- package/dist/agents/verify.js +10 -6
- package/dist/agents/yield-adoption.d.ts +17 -0
- package/dist/agents/yield-adoption.js +22 -2
- package/dist/brain/anthropic.js +42 -14
- package/dist/brain/claude-model-id.d.ts +36 -0
- package/dist/brain/claude-model-id.js +44 -0
- package/dist/brain/failover.js +14 -3
- package/dist/brain/fast-mode.d.ts +272 -0
- package/dist/brain/fast-mode.js +130 -0
- package/dist/brain/media-degrade.d.ts +5 -0
- package/dist/brain/media-degrade.js +1 -0
- package/dist/brain/model-capability.d.ts +122 -18
- package/dist/brain/model-capability.js +84 -7
- package/dist/brain/model-lane.d.ts +40 -16
- package/dist/brain/model-lane.js +97 -39
- package/dist/brain/model-presets.d.ts +4 -1
- package/dist/brain/model-presets.js +10 -1
- package/dist/brain/open-responses.js +37 -14
- package/dist/brain/openai.js +27 -15
- package/dist/brain/provider-dialect.d.ts +9 -0
- package/dist/brain/provider-dialect.js +4 -0
- package/dist/brain/provider-message.d.ts +2 -2
- package/dist/brain/provider-message.js +8 -8
- package/dist/brain/reasoning-request.d.ts +19 -0
- package/dist/brain/reasoning-request.js +8 -4
- package/dist/brain/reasoning-stamp.d.ts +3 -2
- package/dist/brain/reasoning.d.ts +8 -4
- package/dist/brain/reasoning.js +4 -3
- package/dist/brain/reference-model-traits.d.ts +59 -0
- package/dist/brain/reference-model-traits.js +46 -0
- package/dist/brain/request-params.js +1 -0
- package/dist/brain/route-adjudicator.d.ts +107 -106
- package/dist/brain/route-adjudicator.js +217 -51
- package/dist/brain/route-conformance.d.ts +6 -4
- package/dist/brain/routing.d.ts +2 -1
- package/dist/brain/routing.js +21 -5
- package/dist/brain/status-sink.d.ts +52 -10
- package/dist/brain/stream-engine.d.ts +68 -11
- package/dist/brain/stream-engine.js +512 -93
- package/dist/brain/stream-shared.d.ts +34 -8
- package/dist/brain/stream-shared.js +20 -7
- package/dist/brain/usage-reading.d.ts +15 -0
- package/dist/brain/usage-reading.js +18 -5
- package/dist/core/a2a.js +28 -21
- package/dist/core/advisor-verdict.d.ts +5 -4
- package/dist/core/advisor-verdict.js +2 -2
- package/dist/core/agent-definition.d.ts +4 -1
- package/dist/core/agent-state.d.ts +25 -2
- package/dist/core/agent-state.js +50 -3
- package/dist/core/allow-entry.d.ts +6 -6
- package/dist/core/allow-entry.js +27 -25
- package/dist/core/ask-headline.d.ts +28 -16
- package/dist/core/ask-headline.js +18 -8
- package/dist/core/ask-origin.d.ts +105 -30
- package/dist/core/ask-origin.js +40 -11
- package/dist/core/ask-question.d.ts +9 -1
- package/dist/core/ask-question.js +3 -0
- package/dist/core/ask-unresolvable-notice.d.ts +10 -2
- package/dist/core/ask-unresolvable-notice.js +5 -2
- package/dist/core/attachment-source.d.ts +1 -1
- package/dist/core/attachment-source.js +1 -0
- package/dist/core/auto-compaction.d.ts +4 -4
- package/dist/core/auto-compaction.js +4 -3
- package/dist/core/auto-mode-directive.d.ts +30 -60
- package/dist/core/auto-mode-directive.js +36 -38
- package/dist/core/auto-mode.d.ts +40 -9
- package/dist/core/auto-mode.js +20 -5
- package/dist/core/background-agent-store.d.ts +87 -1
- package/dist/core/background-agent-store.js +72 -1
- package/dist/core/background-shell.d.ts +3 -0
- package/dist/core/background-shell.js +1 -0
- package/dist/core/cache-break-detector.js +1 -1
- package/dist/core/caller-text.d.ts +27 -8
- package/dist/core/caller-text.js +47 -1
- package/dist/core/checkpoint-features.d.ts +17 -9
- package/dist/core/checkpoint-identity.d.ts +53 -0
- package/dist/core/checkpoint-identity.js +29 -0
- package/dist/core/checkpoint-queries.d.ts +4 -3
- package/dist/core/checkpoint-queries.js +5 -3
- package/dist/core/checkpoint-rekey.d.ts +70 -0
- package/dist/core/checkpoint-rekey.js +107 -0
- package/dist/core/checkpoint-requirements.d.ts +65 -10
- package/dist/core/checkpoint-requirements.js +47 -13
- package/dist/core/checkpoint-row-verdict.d.ts +5 -3
- package/dist/core/checkpoint-row-verdict.js +37 -4
- package/dist/core/checkpoint-store.d.ts +71 -5
- package/dist/core/checkpoint-store.js +38 -7
- package/dist/core/child-clamp-seats.js +2 -1
- package/dist/core/classifier-category.d.ts +25 -0
- package/dist/core/classifier-category.js +93 -0
- package/dist/core/classifier-unavailable-arm.d.ts +62 -8
- package/dist/core/classifier-unavailable-arm.js +19 -2
- package/dist/core/command-sandbox-dispatch.d.ts +14 -2
- package/dist/core/command-sandbox.d.ts +209 -28
- package/dist/core/command-sandbox.js +195 -20
- package/dist/core/config-refusal-codes.d.ts +41 -1
- package/dist/core/config-refusal-codes.js +16 -0
- package/dist/core/context-edit.d.ts +2 -1
- package/dist/core/context-edit.js +2 -1
- package/dist/core/context-settings.js +5 -4
- package/dist/core/cross-boundary-taint.d.ts +15 -1
- package/dist/core/cross-boundary-taint.js +6 -0
- package/dist/core/delegation-frames.d.ts +36 -6
- package/dist/core/delegation-frames.js +3 -0
- package/dist/core/delegation-name.d.ts +10 -4
- package/dist/core/delegation-name.js +53 -23
- package/dist/core/engine-attestation.d.ts +10 -2
- package/dist/core/engine-attestation.js +2 -0
- package/dist/core/engine-capabilities.d.ts +40 -3
- package/dist/core/engine-capabilities.js +1 -1
- package/dist/core/engine-notice.d.ts +197 -90
- package/dist/core/engine-notice.js +29 -1
- package/dist/core/engine-version.d.ts +1 -0
- package/dist/core/engine-version.js +1 -0
- package/dist/core/extension-call-id.d.ts +4 -0
- package/dist/core/extension-call-id.js +8 -0
- package/dist/core/fast-tier-door.d.ts +36 -0
- package/dist/core/fast-tier-door.js +65 -0
- package/dist/core/file-history-store.d.ts +343 -67
- package/dist/core/file-history-store.js +320 -93
- package/dist/core/frame-settlement.d.ts +4 -0
- package/dist/core/frame-settlement.js +5 -0
- package/dist/core/gate-fold.js +13 -4
- package/dist/core/gate-lanes.js +27 -20
- package/dist/core/gate-outcome.d.ts +87 -11
- package/dist/core/gate-outcome.js +94 -4
- package/dist/core/git-worktree-env.d.ts +29 -10
- package/dist/core/git-worktree-env.js +31 -12
- package/dist/core/governance-codes.d.ts +232 -7
- package/dist/core/governance-codes.js +195 -6
- package/dist/core/hooks.d.ts +27 -16
- package/dist/core/hooks.js +84 -82
- package/dist/core/host-floor.d.ts +2 -8
- package/dist/core/host-floor.js +6 -42
- package/dist/core/identity-rekey.d.ts +275 -0
- package/dist/core/identity-rekey.js +198 -0
- package/dist/core/image-admission.d.ts +7 -4
- package/dist/core/image-admission.js +24 -11
- package/dist/core/isolation-scope.d.ts +12 -0
- package/dist/core/isolation-scope.js +4 -0
- package/dist/core/leg-identity.d.ts +32 -2
- package/dist/core/leg-identity.js +16 -2
- package/dist/core/locked-config.d.ts +26 -6
- package/dist/core/locked-config.js +31 -14
- package/dist/core/loopback-host.d.ts +18 -0
- package/dist/core/loopback-host.js +40 -0
- package/dist/core/mcp-connection-pool.d.ts +57 -33
- package/dist/core/mcp-connection-pool.js +47 -23
- package/dist/core/mcp-failure.d.ts +41 -19
- package/dist/core/mcp-failure.js +14 -8
- package/dist/core/mcp-host-read.js +5 -4
- package/dist/core/mcp-host-seat.js +3 -2
- package/dist/core/mcp-name-judge.js +2 -1
- package/dist/core/mcp-server-link.js +2 -1
- package/dist/core/mcp-server-spec.js +2 -2
- package/dist/core/mcp-server-unavailable-notice.d.ts +26 -16
- package/dist/core/mcp-server-unavailable-notice.js +25 -4
- package/dist/core/mcp.d.ts +15 -9
- package/dist/core/mcp.js +46 -34
- package/dist/core/memory-engine/consolidation-driver.js +8 -8
- package/dist/core/memory-engine/consolidation-write-gate.js +3 -2
- package/dist/core/memory-engine/engine.js +9 -9
- package/dist/core/memory-engine/layout.d.ts +6 -5
- package/dist/core/memory-engine/layout.js +1 -1
- package/dist/core/memory.d.ts +5 -0
- package/dist/core/memory.js +3 -0
- package/dist/core/model-fallbacks.d.ts +13 -7
- package/dist/core/model-fallbacks.js +5 -3
- package/dist/core/model-receipt.d.ts +15 -0
- package/dist/core/model-receipt.js +54 -1
- package/dist/core/model-seat.d.ts +17 -15
- package/dist/core/mods/agent-stations.js +5 -4
- package/dist/core/mods/extension-call.d.ts +0 -4
- package/dist/core/mods/extension-call.js +0 -8
- package/dist/core/mods/host.d.ts +18 -0
- package/dist/core/mods/host.js +7 -0
- package/dist/core/mods/kernel/events.d.ts +12 -0
- package/dist/core/mods/kernel/events.js +18 -9
- package/dist/core/mods/kernel/registration.d.ts +13 -0
- package/dist/core/mods/kernel/registration.js +34 -1
- package/dist/core/mods/message-display.js +1 -1
- package/dist/core/mods/package.js +3 -3
- package/dist/core/mods/prompt-submit.js +2 -2
- package/dist/core/mods/session-append.js +3 -3
- package/dist/core/mods/session-compact.js +5 -5
- package/dist/core/mods/session-receive.js +3 -3
- package/dist/core/mods/session-send.js +3 -3
- package/dist/core/mods/stations.d.ts +8 -5
- package/dist/core/mods/stations.js +13 -12
- package/dist/core/mods/tool-call.js +12 -12
- package/dist/core/mounted-mcp.d.ts +10 -1
- package/dist/core/mounted-mcp.js +4 -0
- package/dist/core/output-style.d.ts +14 -8
- package/dist/core/output-style.js +6 -6
- package/dist/core/own-property-receipt.js +3 -5
- package/dist/core/owner-identity.d.ts +68 -0
- package/dist/core/owner-identity.js +39 -0
- package/dist/core/parent-spec-seat.d.ts +5 -1
- package/dist/core/parent-spec-seat.js +2 -0
- package/dist/core/park-resumability.js +2 -2
- package/dist/core/park-selfcheck.js +15 -4
- package/dist/core/peer-seat.d.ts +37 -11
- package/dist/core/peer-seat.js +35 -9
- package/dist/core/permission-rule-model.d.ts +5 -0
- package/dist/core/permission-rule-model.js +27 -6
- package/dist/core/permission-rules.d.ts +42 -5
- package/dist/core/permission-rules.js +74 -10
- package/dist/core/persisted-rule-arms.d.ts +8 -6
- package/dist/core/persisted-rule-arms.js +13 -20
- package/dist/core/physical-path.d.ts +12 -8
- package/dist/core/physical-path.js +24 -14
- package/dist/core/present-plan-tool.js +2 -1
- package/dist/core/pricing.d.ts +65 -8
- package/dist/core/pricing.js +51 -0
- package/dist/core/prompt-section-seat.js +6 -5
- package/dist/core/protocol-http-auth.d.ts +87 -10
- package/dist/core/protocol-http-auth.js +155 -23
- package/dist/core/reminder-mint.d.ts +4 -0
- package/dist/core/reminder-mint.js +1 -0
- package/dist/core/remote-env.d.ts +46 -1
- package/dist/core/remote-env.js +2 -0
- package/dist/core/resume-at-refusal.d.ts +47 -0
- package/dist/core/resume-at-refusal.js +9 -0
- package/dist/core/resume-startup-cause.d.ts +8 -3
- package/dist/core/resume-startup-cause.js +3 -1
- package/dist/core/retired-keys.d.ts +4 -0
- package/dist/core/retired-keys.js +4 -0
- package/dist/core/roles.d.ts +11 -5
- package/dist/core/roles.js +14 -3
- package/dist/core/rule-store-fault.d.ts +8 -1
- package/dist/core/rule-store-fault.js +5 -0
- package/dist/core/runner/advisor-instructions.d.ts +12 -12
- package/dist/core/runner/advisor-instructions.js +7 -24
- package/dist/core/runner/announce-once-ledger.d.ts +23 -8
- package/dist/core/runner/announce-once-ledger.js +69 -18
- package/dist/core/runner/assemble-result.d.ts +9 -0
- package/dist/core/runner/assemble-result.js +3 -2
- package/dist/core/runner/auto-strip-notice.js +1 -1
- package/dist/core/runner/branch-window.js +5 -3
- package/dist/core/runner/call-hook-stations.d.ts +3 -0
- package/dist/core/runner/call-hook-stations.js +4 -3
- package/dist/core/runner/caller-roster.js +2 -1
- package/dist/core/runner/capability-withheld-seat.js +47 -5
- package/dist/core/runner/classifier-ladder.d.ts +48 -8
- package/dist/core/runner/classifier-ladder.js +88 -38
- package/dist/core/runner/clock-and-limits.d.ts +13 -2
- package/dist/core/runner/clock-and-limits.js +11 -8
- package/dist/core/runner/command-sandbox-frame.d.ts +56 -0
- package/dist/core/runner/command-sandbox-frame.js +107 -0
- package/dist/core/runner/compact-session.d.ts +3 -1
- package/dist/core/runner/compact-session.js +16 -10
- package/dist/core/runner/compaction-call-options.d.ts +2 -2
- package/dist/core/runner/compaction-restate.d.ts +4 -4
- package/dist/core/runner/compaction-restate.js +3 -1
- package/dist/core/runner/construction-doors.js +9 -0
- package/dist/core/runner/continuation-gate.d.ts +39 -0
- package/dist/core/runner/continuation-gate.js +42 -0
- package/dist/core/runner/continues-from.d.ts +57 -0
- package/dist/core/runner/continues-from.js +76 -0
- package/dist/core/runner/contracts.d.ts +133 -55
- package/dist/core/runner/credential-refusal-seat.js +31 -12
- package/dist/core/runner/cross-boundary-lane.d.ts +2 -2
- package/dist/core/runner/cross-boundary-lane.js +26 -13
- package/dist/core/runner/delegation-owner.d.ts +99 -9
- package/dist/core/runner/delegation-owner.js +107 -4
- package/dist/core/runner/denial-limit-arms.js +13 -12
- package/dist/core/runner/derived-route-fallback.d.ts +15 -19
- package/dist/core/runner/derived-route-fallback.js +4 -4
- package/dist/core/runner/earlier-grammar-notice.d.ts +6 -0
- package/dist/core/runner/earlier-grammar-notice.js +9 -0
- package/dist/core/runner/end-of-run.d.ts +26 -13
- package/dist/core/runner/end-of-run.js +43 -12
- package/dist/core/runner/env-capability-census.js +2 -1
- package/dist/core/runner/execution-record.d.ts +4 -2
- package/dist/core/runner/execution-record.js +1 -1
- package/dist/core/runner/fast-mode-seat.d.ts +89 -0
- package/dist/core/runner/fast-mode-seat.js +215 -0
- package/dist/core/runner/file-history-restore.d.ts +52 -14
- package/dist/core/runner/file-history-restore.js +50 -8
- package/dist/core/runner/forward-sink.js +2 -2
- package/dist/core/runner/gate-exit.d.ts +41 -3
- package/dist/core/runner/gate-exit.js +55 -10
- package/dist/core/runner/git-leg-delivery.js +6 -3
- package/dist/core/runner/git-status-frame.d.ts +33 -25
- package/dist/core/runner/git-status-frame.js +54 -36
- package/dist/core/runner/halt-attribution.js +2 -2
- package/dist/core/runner/hook-progress-lane.d.ts +26 -0
- package/dist/core/runner/hook-progress-lane.js +72 -0
- package/dist/core/runner/initial-run-state.js +2 -2
- package/dist/core/runner/language-frame.d.ts +10 -8
- package/dist/core/runner/language-frame.js +7 -11
- package/dist/core/runner/left-as-is-seat.d.ts +20 -0
- package/dist/core/runner/left-as-is-seat.js +11 -0
- package/dist/core/runner/leg-receipt.d.ts +38 -0
- package/dist/core/runner/leg-receipt.js +22 -0
- package/dist/core/runner/listing-fold.d.ts +4 -3
- package/dist/core/runner/listing-fold.js +5 -5
- package/dist/core/runner/listing-replay.d.ts +41 -0
- package/dist/core/runner/listing-replay.js +75 -0
- package/dist/core/runner/main-call-account.d.ts +2 -1
- package/dist/core/runner/main-call-account.js +18 -5
- package/dist/core/runner/mcp-redial.d.ts +4 -2
- package/dist/core/runner/mcp-redial.js +3 -0
- package/dist/core/runner/memory-consolidation-driver.js +3 -2
- package/dist/core/runner/model-fallback-seat.d.ts +12 -9
- package/dist/core/runner/model-fallback-seat.js +24 -20
- package/dist/core/runner/nested-memory-lane.d.ts +16 -8
- package/dist/core/runner/nested-memory-lane.js +64 -53
- package/dist/core/runner/permission-rule-lanes.d.ts +4 -3
- package/dist/core/runner/permission-rule-lanes.js +2 -0
- package/dist/core/runner/person-path-rows.js +1 -1
- package/dist/core/runner/placement-fence.js +2 -2
- package/dist/core/runner/policy-throw.d.ts +3 -3
- package/dist/core/runner/policy-throw.js +7 -5
- package/dist/core/runner/prepare-acquire-reconcile.d.ts +7 -1
- package/dist/core/runner/prepare-acquire-reconcile.js +9 -5
- package/dist/core/runner/prepare-advisor.d.ts +3 -0
- package/dist/core/runner/prepare-advisor.js +2 -2
- package/dist/core/runner/prepare-artifact.d.ts +7 -2
- package/dist/core/runner/prepare-artifact.js +18 -7
- package/dist/core/runner/prepare-ask-lane.d.ts +7 -0
- package/dist/core/runner/prepare-ask-lane.js +4 -3
- package/dist/core/runner/prepare-caps-and-workflow.d.ts +9 -5
- package/dist/core/runner/prepare-caps-and-workflow.js +28 -20
- package/dist/core/runner/prepare-config-doors.d.ts +13 -3
- package/dist/core/runner/prepare-config-doors.js +35 -24
- package/dist/core/runner/prepare-context-lane.d.ts +3 -4
- package/dist/core/runner/prepare-context-lane.js +12 -15
- package/dist/core/runner/prepare-defer-classify.d.ts +12 -0
- package/dist/core/runner/prepare-defer-classify.js +5 -2
- package/dist/core/runner/prepare-delegation-surface.d.ts +10 -8
- package/dist/core/runner/prepare-delegation-surface.js +6 -7
- package/dist/core/runner/prepare-execution-env.d.ts +46 -4
- package/dist/core/runner/prepare-execution-env.js +47 -18
- package/dist/core/runner/prepare-file-history.d.ts +4 -1
- package/dist/core/runner/prepare-file-history.js +8 -9
- package/dist/core/runner/prepare-gate-stations.d.ts +17 -9
- package/dist/core/runner/prepare-gate-stations.js +22 -38
- package/dist/core/runner/prepare-hands-readface.d.ts +13 -9
- package/dist/core/runner/prepare-hands-readface.js +26 -35
- package/dist/core/runner/prepare-inherited-gate.d.ts +9 -2
- package/dist/core/runner/prepare-inherited-gate.js +10 -9
- package/dist/core/runner/prepare-leg-adoption.d.ts +36 -0
- package/dist/core/runner/prepare-leg-adoption.js +24 -0
- package/dist/core/runner/prepare-listings.d.ts +3 -0
- package/dist/core/runner/prepare-listings.js +2 -2
- package/dist/core/runner/prepare-lsp.d.ts +0 -3
- package/dist/core/runner/prepare-lsp.js +1 -2
- package/dist/core/runner/prepare-memory-engine-session.js +1 -1
- package/dist/core/runner/prepare-memory.js +2 -2
- package/dist/core/runner/prepare-offload-wrappers.d.ts +5 -5
- package/dist/core/runner/prepare-offload-wrappers.js +5 -5
- package/dist/core/runner/prepare-park-ask.d.ts +9 -2
- package/dist/core/runner/prepare-park-ask.js +5 -3
- package/dist/core/runner/prepare-policy-chain.d.ts +20 -5
- package/dist/core/runner/prepare-policy-chain.js +32 -26
- package/dist/core/runner/prepare-prompt-assembly.d.ts +11 -2
- package/dist/core/runner/prepare-prompt-assembly.js +6 -3
- package/dist/core/runner/prepare-prompt-inputs.d.ts +3 -3
- package/dist/core/runner/prepare-prompt-inputs.js +1 -1
- package/dist/core/runner/prepare-protocol-tools.d.ts +9 -4
- package/dist/core/runner/prepare-protocol-tools.js +11 -11
- package/dist/core/runner/prepare-run-refs.d.ts +7 -0
- package/dist/core/runner/prepare-run-refs.js +6 -2
- package/dist/core/runner/prepare-suspend-saga.d.ts +4 -1
- package/dist/core/runner/prepare-suspend-saga.js +5 -2
- package/dist/core/runner/prepare-task.d.ts +1 -30
- package/dist/core/runner/prepare-task.js +111 -147
- package/dist/core/runner/prepare-turn-wiring.d.ts +10 -3
- package/dist/core/runner/prepare-turn-wiring.js +7 -4
- package/dist/core/runner/prepare-wiring-manifest.d.ts +12 -3
- package/dist/core/runner/prepare-wiring-manifest.js +21 -17
- package/dist/core/runner/prompt-block.js +2 -2
- package/dist/core/runner/prompt-suggestions.d.ts +3 -8
- package/dist/core/runner/prompt-suggestions.js +4 -1
- package/dist/core/runner/reply-pricing.d.ts +8 -4
- package/dist/core/runner/reply-pricing.js +6 -5
- package/dist/core/runner/resume-admission.js +2 -0
- package/dist/core/runner/resume-apply.js +4 -4
- package/dist/core/runner/resume-checkpoint-screen.d.ts +23 -2
- package/dist/core/runner/resume-checkpoint-screen.js +34 -27
- package/dist/core/runner/resume-preflight.js +3 -3
- package/dist/core/runner/rewind-files.js +21 -14
- package/dist/core/runner/role-resolution-table.d.ts +10 -7
- package/dist/core/runner/role-resolution-table.js +8 -7
- package/dist/core/runner/role-seat-defaulted.js +2 -2
- package/dist/core/runner/rule-store-unreadable-notice.d.ts +4 -2
- package/dist/core/runner/rule-store-unreadable-notice.js +21 -7
- package/dist/core/runner/run-attachment-seats.js +8 -15
- package/dist/core/runner/run-brain-sinks.js +1 -0
- package/dist/core/runner/run-compaction-machinery.d.ts +1 -1
- package/dist/core/runner/run-compaction-machinery.js +2 -3
- package/dist/core/runner/run-harness-handlers.d.ts +2 -2
- package/dist/core/runner/run-harness-handlers.js +18 -5
- package/dist/core/runner/run-identity-wiring.js +11 -9
- package/dist/core/runner/run-leg.js +33 -12
- package/dist/core/runner/run-notification-lane.d.ts +4 -1
- package/dist/core/runner/run-notification-lane.js +21 -8
- package/dist/core/runner/run-recovery-lanes.js +1 -1
- package/dist/core/runner/run-settle-and-teardown.d.ts +6 -1
- package/dist/core/runner/run-settle-and-teardown.js +30 -32
- package/dist/core/runner/run-stop-and-final-verify.d.ts +4 -1
- package/dist/core/runner/run-stop-and-final-verify.js +12 -49
- package/dist/core/runner/run-telemetry-and-budget-seats.js +29 -10
- package/dist/core/runner/run-terminal-adoption.js +5 -2
- package/dist/core/runner/run-turn-boundary.js +13 -11
- package/dist/core/runner/runtask.d.ts +16 -7
- package/dist/core/runner/runtask.js +51 -30
- package/dist/core/runner/sandbox-network-seat.d.ts +52 -0
- package/dist/core/runner/sandbox-network-seat.js +40 -0
- package/dist/core/runner/seat-model-doors.d.ts +16 -0
- package/dist/core/runner/seat-model-doors.js +13 -0
- package/dist/core/runner/session-file-state-replay.d.ts +20 -0
- package/dist/core/runner/session-file-state-replay.js +17 -5
- package/dist/core/runner/session-read-file-states.d.ts +37 -0
- package/dist/core/runner/session-read-file-states.js +19 -0
- package/dist/core/runner/session-rule-policy.d.ts +2 -1
- package/dist/core/runner/session-rule-policy.js +3 -2
- package/dist/core/runner/session-verb-doors.js +2 -1
- package/dist/core/runner/session-write-ledger.d.ts +5 -1
- package/dist/core/runner/session-write-ledger.js +19 -5
- package/dist/core/runner/shared-read-classifier.d.ts +48 -0
- package/dist/core/runner/shared-read-classifier.js +33 -0
- package/dist/core/runner/shell-env-withheld.d.ts +6 -3
- package/dist/core/runner/shell-env-withheld.js +25 -0
- package/dist/core/runner/side-call-account.d.ts +30 -2
- package/dist/core/runner/side-call-account.js +38 -5
- package/dist/core/runner/skipped-rules-notice.d.ts +43 -0
- package/dist/core/runner/skipped-rules-notice.js +49 -0
- package/dist/core/runner/steering-preview.js +1 -1
- package/dist/core/runner/stop-tail-notice.d.ts +40 -0
- package/dist/core/runner/stop-tail-notice.js +35 -0
- package/dist/core/runner/stream-halt-verbs.js +1 -1
- package/dist/core/runner/stream-mode-verb.d.ts +11 -4
- package/dist/core/runner/stream-mode-verb.js +19 -7
- package/dist/core/runner/stream-settle-backstop.js +3 -1
- package/dist/core/runner/stream-steer-verb.js +4 -3
- package/dist/core/runner/synthetic-tools.d.ts +11 -11
- package/dist/core/runner/synthetic-tools.js +17 -20
- package/dist/core/runner/task-start-doors.d.ts +86 -0
- package/dist/core/runner/task-start-doors.js +108 -0
- package/dist/core/runner/teardown-bounded.d.ts +5 -5
- package/dist/core/runner/teardown-bounded.js +6 -6
- package/dist/core/runner/terminal-account.d.ts +3 -2
- package/dist/core/runner/terminal-account.js +5 -3
- package/dist/core/runner/tool-disclosure.js +8 -9
- package/dist/core/runner/tool-end-body.d.ts +2 -0
- package/dist/core/runner/tool-end-body.js +1 -0
- package/dist/core/runner/tool-face-overlay.js +1 -0
- package/dist/core/runner/tool-occurrence.d.ts +22 -24
- package/dist/core/runner/tool-occurrence.js +9 -15
- package/dist/core/runner/tool-progress-lane.js +1 -1
- package/dist/core/runner/tool-result-media-seat.d.ts +7 -4
- package/dist/core/runner/tool-result-media-seat.js +16 -4
- package/dist/core/runner/tool-table-view.d.ts +7 -1
- package/dist/core/runner/tool-table-view.js +1 -1
- package/dist/core/runner/tool-turn-repair-seat.d.ts +22 -2
- package/dist/core/runner/tool-turn-repair-seat.js +23 -5
- package/dist/core/runner/turn-attachments.d.ts +74 -148
- package/dist/core/runner/turn-attachments.js +153 -223
- package/dist/core/runner/usage-accounting.d.ts +15 -0
- package/dist/core/runner/usage-accounting.js +12 -4
- package/dist/core/runner/verdict-refusal.d.ts +45 -0
- package/dist/core/runner/verdict-refusal.js +39 -0
- package/dist/core/runner/write-protection-station.d.ts +5 -0
- package/dist/core/runner/write-protection-station.js +6 -6
- package/dist/core/runner-deps.d.ts +15 -5
- package/dist/core/runtime-caps.d.ts +5 -3
- package/dist/core/secret-env.d.ts +19 -14
- package/dist/core/secret-env.js +19 -12
- package/dist/core/session-checkout.d.ts +18 -1
- package/dist/core/session-checkout.js +23 -8
- package/dist/core/session-log-transfer.js +2 -2
- package/dist/core/session-policy-store.d.ts +220 -31
- package/dist/core/session-policy-store.js +333 -47
- package/dist/core/session-reconcile.d.ts +12 -0
- package/dist/core/session-reconcile.js +1 -1
- package/dist/core/session-store.d.ts +5 -3
- package/dist/core/session-store.js +11 -11
- package/dist/core/session.d.ts +31 -22
- package/dist/core/session.js +3 -2
- package/dist/core/shared-memory/normalize.js +2 -1
- package/dist/core/side-query.d.ts +4 -0
- package/dist/core/side-query.js +7 -4
- package/dist/core/spec-contract.d.ts +4 -2
- package/dist/core/store-contracts/background-agent-store-contract.js +149 -0
- package/dist/core/store-contracts/checkpoint-store-contract.js +55 -0
- package/dist/core/store-contracts/contract-kit-version.d.ts +4 -4
- package/dist/core/store-contracts/file-history-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/file-history-store-contract.js +282 -22
- package/dist/core/store-contracts/session-policy-store-contract.js +202 -0
- package/dist/core/store-contracts/session-store-contract.js +48 -14
- package/dist/core/store-contracts/tool-result-store-contract.d.ts +1 -1
- package/dist/core/store-contracts/tool-result-store-contract.js +128 -0
- package/dist/core/store-contracts/workflow-journal-store-contract.js +90 -1
- package/dist/core/swappable-deps.d.ts +16 -0
- package/dist/core/swappable-deps.js +61 -1
- package/dist/core/synthetic-read-verdict.d.ts +23 -0
- package/dist/core/synthetic-read-verdict.js +43 -18
- package/dist/core/task-event.d.ts +123 -50
- package/dist/core/task-intake.d.ts +21 -5
- package/dist/core/task-intake.js +29 -3
- package/dist/core/task-limits.d.ts +3 -1
- package/dist/core/task-notification.d.ts +171 -59
- package/dist/core/task-notification.js +162 -104
- package/dist/core/task-registry-agent.d.ts +12 -0
- package/dist/core/task-registry-agent.js +23 -9
- package/dist/core/task-registry-shared.d.ts +4 -2
- package/dist/core/task-registry-shared.js +1 -1
- package/dist/core/task-registry-workflow.js +8 -5
- package/dist/core/task-registry.d.ts +16 -1
- package/dist/core/task-registry.js +35 -23
- package/dist/core/task-result.d.ts +127 -10
- package/dist/core/task-spec-members.d.ts +5 -2
- package/dist/core/task-spec-members.js +9 -5
- package/dist/core/task-spec.d.ts +31 -12
- package/dist/core/task-start-judge.d.ts +41 -0
- package/dist/core/task-start-judge.js +26 -0
- package/dist/core/task-stream.d.ts +12 -1
- package/dist/core/terminal-cause.d.ts +23 -9
- package/dist/core/tool-catalog-entries.js +6 -5
- package/dist/core/tool-face-lists.d.ts +3 -2
- package/dist/core/tool-face-lists.js +6 -0
- package/dist/core/tool-face-reader.d.ts +3 -2
- package/dist/core/tool-face-reader.js +2 -2
- package/dist/core/tool-face.d.ts +27 -3
- package/dist/core/tool-face.js +2 -2
- package/dist/core/tool-model-gate.js +14 -13
- package/dist/core/tool-mount-facts.d.ts +16 -3
- package/dist/core/tool-mount-facts.js +10 -0
- package/dist/core/tool-mount-plan.d.ts +79 -10
- package/dist/core/tool-mount-plan.js +79 -24
- package/dist/core/tool-mount-static.d.ts +52 -6
- package/dist/core/tool-mount-static.js +82 -28
- package/dist/core/tool-name-aliases.js +1 -1
- package/dist/core/tool-policy.d.ts +25 -5
- package/dist/core/tool-policy.js +8 -6
- package/dist/core/tool-registry.d.ts +12 -2
- package/dist/core/tool-registry.js +9 -2
- package/dist/core/tool-result-budget.d.ts +2 -2
- package/dist/core/tool-result-bytes.d.ts +28 -9
- package/dist/core/tool-result-bytes.js +7 -5
- package/dist/core/tool-result-store.d.ts +310 -38
- package/dist/core/tool-result-store.js +325 -30
- package/dist/core/tool-roster.d.ts +20 -8
- package/dist/core/tool-roster.js +16 -6
- package/dist/core/tool-search-setting.js +2 -2
- package/dist/core/tool-spec.d.ts +10 -10
- package/dist/core/types.d.ts +5 -5
- package/dist/core/types.js +2 -2
- package/dist/core/unc-spelling.d.ts +114 -3
- package/dist/core/unc-spelling.js +110 -0
- package/dist/core/untrusted-egress.d.ts +82 -10
- package/dist/core/untrusted-egress.js +102 -9
- package/dist/core/untrusted-text.d.ts +28 -0
- package/dist/core/untrusted-text.js +67 -3
- package/dist/core/user-attachment.d.ts +18 -3
- package/dist/core/user-attachment.js +37 -31
- package/dist/core/user-row-origin.d.ts +22 -0
- package/dist/core/user-row-origin.js +15 -0
- package/dist/core/version.d.ts +1 -1
- package/dist/core/version.js +2 -12
- package/dist/core/wiring-manifest.d.ts +124 -30
- package/dist/core/wiring-manifest.js +59 -17
- package/dist/core/workflow-journal-store.d.ts +186 -16
- package/dist/core/workflow-journal-store.js +156 -1
- package/dist/core/workflow-run-store-contract.js +82 -1
- package/dist/core/workflow-run-store.d.ts +40 -4
- package/dist/core/workflow-run-store.js +9 -2
- package/dist/core/workspace-snapshot.d.ts +4 -1
- package/dist/core/workspace-snapshot.js +1 -1
- package/dist/engine/compaction/compaction.d.ts +3 -3
- package/dist/engine/compaction/compaction.js +16 -18
- package/dist/engine/execution-env/node-execution-env.d.ts +14 -6
- package/dist/engine/execution-env/node-execution-env.js +49 -14
- package/dist/engine/harness/agent-harness.d.ts +17 -7
- package/dist/engine/harness/agent-harness.js +66 -16
- package/dist/engine/harness/types.d.ts +31 -2
- package/dist/engine/harness/types.js +14 -1
- package/dist/engine/llm/tool-turns.d.ts +19 -2
- package/dist/engine/llm/tool-turns.js +29 -2
- package/dist/engine/llm/types.d.ts +103 -22
- package/dist/engine/llm/types.js +1 -1
- package/dist/engine/loop/agent-loop.d.ts +18 -9
- package/dist/engine/loop/agent-loop.js +115 -24
- package/dist/engine/loop/types.d.ts +14 -6
- package/dist/engine/lsp/node-lsp-manager.d.ts +6 -4
- package/dist/engine/lsp/node-lsp-manager.js +22 -21
- package/dist/engine/session/import-validate.js +2 -0
- package/dist/engine/session/repo-utils.d.ts +13 -7
- package/dist/engine/session/repo-utils.js +9 -4
- package/dist/index.d.ts +48 -27
- package/dist/index.js +38 -20
- package/dist/internal/harness.d.ts +1 -1
- package/dist/internal/llm.d.ts +2 -2
- package/dist/internal/llm.js +1 -1
- package/dist/orchestration/goal.js +1 -1
- package/dist/orchestration/governance-baseline-validity.d.ts +20 -5
- package/dist/orchestration/governance-baseline-validity.js +87 -16
- package/dist/orchestration/run-workflow-tool.d.ts +15 -12
- package/dist/orchestration/run-workflow-tool.js +757 -331
- package/dist/orchestration/workflow-governance.d.ts +1 -1
- package/dist/orchestration/workflow-observe.d.ts +22 -2
- package/dist/orchestration/workflow-observe.js +20 -9
- package/dist/orchestration/workflow-park-adoption.d.ts +380 -0
- package/dist/orchestration/workflow-park-adoption.js +617 -0
- package/dist/orchestration/workflow-size-guideline.d.ts +6 -8
- package/dist/orchestration/workflow-size-guideline.js +12 -14
- package/dist/orchestration/workflow-types.d.ts +97 -17
- package/dist/orchestration/workflow-types.js +39 -8
- package/dist/orchestration/workflow.d.ts +70 -26
- package/dist/orchestration/workflow.js +495 -199
- package/dist/prompt-assembly/artifact.js +4 -3
- package/dist/prompt-assembly/assemble.d.ts +2 -0
- package/dist/prompt-assembly/assemble.js +4 -1
- package/dist/prompt-assembly/bands.d.ts +3 -0
- package/dist/prompt-assembly/bands.js +6 -0
- package/dist/prompt-assembly/catalog/constitution.d.ts +1 -1
- package/dist/prompt-assembly/catalog/constitution.js +74 -9
- package/dist/prompt-assembly/catalog/core-behavior.d.ts +5 -4
- package/dist/prompt-assembly/catalog/core-behavior.js +46 -9
- package/dist/prompt-assembly/catalog/engine.d.ts +110 -5
- package/dist/prompt-assembly/catalog/engine.js +13 -0
- package/dist/prompt-assembly/catalog/events.d.ts +852 -0
- package/dist/prompt-assembly/catalog/events.js +62 -0
- package/dist/prompt-assembly/catalog/index.js +2 -1
- package/dist/prompt-assembly/catalog/locales/index.d.ts +2 -2
- package/dist/prompt-assembly/catalog/locales/index.js +4 -2
- package/dist/prompt-assembly/catalog/locales/zh-Hans/constitution.js +53 -1
- package/dist/prompt-assembly/catalog/locales/zh-Hans/core-behavior.js +45 -9
- package/dist/prompt-assembly/catalog/locales/zh-Hans/engine.js +12 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/events.d.ts +7 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/events.js +57 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/mechanism.d.ts +8 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/mechanism.js +56 -0
- package/dist/prompt-assembly/catalog/locales/zh-Hans/modes.js +8 -2
- package/dist/prompt-assembly/catalog/locales/zh-Hans/role.js +37 -9
- package/dist/prompt-assembly/catalog/mechanism.d.ts +427 -0
- package/dist/prompt-assembly/catalog/mechanism.js +62 -0
- package/dist/prompt-assembly/catalog/memory.d.ts +3 -3
- package/dist/prompt-assembly/catalog/memory.js +12 -3
- package/dist/prompt-assembly/catalog/modes.d.ts +2 -2
- package/dist/prompt-assembly/catalog/modes.js +7 -1
- package/dist/prompt-assembly/catalog/role.d.ts +1 -1
- package/dist/prompt-assembly/catalog/role.js +43 -14
- package/dist/prompt-assembly/catalog/schema.d.ts +43 -20
- package/dist/prompt-assembly/catalog/schema.js +17 -6
- package/dist/prompt-assembly/catalog/sections.d.ts +1 -1
- package/dist/prompt-assembly/catalog/sections.js +20 -12
- package/dist/prompt-assembly/composer.d.ts +3 -0
- package/dist/prompt-assembly/composer.js +11 -5
- package/dist/prompt-assembly/engine-text.d.ts +14 -4
- package/dist/prompt-assembly/engine-text.js +18 -9
- package/dist/prompt-assembly/event-registry.d.ts +38 -31
- package/dist/prompt-assembly/event-registry.js +185 -25
- package/dist/prompt-assembly/explain.d.ts +24 -0
- package/dist/prompt-assembly/explain.js +11 -0
- package/dist/prompt-assembly/locale-review.js +3 -2
- package/dist/prompt-assembly/overlay.d.ts +25 -7
- package/dist/prompt-assembly/overlay.js +68 -14
- package/dist/prompt-assembly/select.d.ts +4 -3
- package/dist/prompt-assembly/select.js +10 -2
- package/dist/prompt-assembly/sugar.d.ts +3 -2
- package/dist/prompt-assembly/sugar.js +2 -2
- package/dist/prompt-assembly/tool-catalog.js +3 -2
- package/dist/prompt-assembly/turn-snapshot.d.ts +1 -0
- package/dist/prompt-assembly/turn-snapshot.js +1 -0
- package/dist/prompt-assembly/types.d.ts +3 -4
- package/dist/prompts/default.d.ts +6 -45
- package/dist/prompts/default.js +3 -21
- package/dist/stores/file/adoption/adopt.d.ts +13 -3
- package/dist/stores/file/adoption/adopt.js +90 -95
- package/dist/stores/file/adoption/marker.d.ts +2 -1
- package/dist/stores/file/background-agent-store.d.ts +61 -0
- package/dist/stores/file/background-agent-store.js +64 -15
- package/dist/stores/file/checkpoint-store.d.ts +30 -2
- package/dist/stores/file/checkpoint-store.js +72 -23
- package/dist/stores/file/file-history-store.d.ts +13 -7
- package/dist/stores/file/file-history-store.js +170 -46
- package/dist/stores/file/fs-atomic.d.ts +57 -2
- package/dist/stores/file/fs-atomic.js +116 -48
- package/dist/stores/file/index.d.ts +2 -0
- package/dist/stores/file/index.js +2 -0
- package/dist/stores/file/ledger-damage.d.ts +87 -0
- package/dist/stores/file/ledger-damage.js +103 -0
- package/dist/stores/file/session-policy-store.d.ts +36 -4
- package/dist/stores/file/session-policy-store.js +177 -6
- package/dist/stores/file/shared-ledger.d.ts +123 -11
- package/dist/stores/file/shared-ledger.js +113 -18
- package/dist/stores/file/tool-result-store.d.ts +30 -1
- package/dist/stores/file/tool-result-store.js +60 -6
- package/dist/stores/file/workflow-journal-store.d.ts +73 -26
- package/dist/stores/file/workflow-journal-store.js +195 -32
- package/dist/stores/file/workflow-run-store.d.ts +47 -2
- package/dist/stores/file/workflow-run-store.js +17 -14
- package/dist/tools/artifact/artifact-tool.d.ts +9 -6
- package/dist/tools/artifact/artifact-tool.js +76 -40
- package/dist/tools/fs/env-error-detail.d.ts +11 -0
- package/dist/tools/fs/env-error-detail.js +13 -2
- package/dist/tools/fs/fs-bash.js +30 -21
- package/dist/tools/fs/fs-pdf.d.ts +1 -1
- package/dist/tools/fs/fs-pdf.js +2 -2
- package/dist/tools/fs/fs-read.js +4 -4
- package/dist/tools/fs/fs-shared.d.ts +26 -9
- package/dist/tools/fs/fs-shared.js +12 -6
- package/dist/tools/fs/fs-write.d.ts +6 -4
- package/dist/tools/fs/fs-write.js +24 -18
- package/dist/tools/fs/pattern-kill-guard.js +2 -1
- package/dist/tools/fs/pdf.d.ts +8 -0
- package/dist/tools/fs/pdf.js +10 -0
- package/dist/tools/fs/program-read-model.d.ts +4 -0
- package/dist/tools/fs/program-read-model.rows.js +3 -3
- package/dist/tools/fs/read-floor.d.ts +11 -9
- package/dist/tools/fs/read-floor.js +7 -10
- package/dist/tools/fs/removal-targets.d.ts +4 -3
- package/dist/tools/fs/removal-targets.js +27 -9
- package/dist/tools/fs/safety.d.ts +29 -107
- package/dist/tools/fs/safety.js +16 -118
- package/dist/tools/fs/shell-read-check.d.ts +4 -2
- package/dist/tools/fs/shell-read-check.js +6 -2
- package/dist/tools/fs/shell-read-environment.d.ts +10 -2
- package/dist/tools/fs/shell-read-environment.js +20 -11
- package/dist/tools/fs/shell-read-judge.d.ts +19 -7
- package/dist/tools/fs/shell-read-judge.js +9 -3
- package/dist/tools/fs/shell-reentry-text.d.ts +8 -0
- package/dist/tools/fs/shell-reentry-text.js +56 -0
- package/dist/tools/monitor.js +7 -5
- package/dist/tools/scheduler-tools.d.ts +39 -1
- package/dist/tools/scheduler-tools.js +84 -35
- package/dist/tools/task-list.d.ts +12 -4
- package/dist/tools/task-list.js +10 -7
- package/dist/tools/web.d.ts +2 -8
- package/dist/tools/web.js +5 -5
- package/dist/tools/worktree.js +18 -15
- package/package.json +6 -3
- package/test/export-surface.snapshot.json +344 -14
- package/wire-changes/core-stores-sql@7.68.5.json +39 -0
- package/wire-changes/core-stores-sql@7.69.0.json +39 -0
- package/wire-changes/core@7.68.5.json +141 -0
- package/wire-changes/core@7.69.0.json +9561 -0
- package/wire-changes/mods-kernel@7.68.5.json +39 -0
- package/wire-changes/mods-kernel@7.69.0.json +80 -0
- package/wire-changes/primitives@7.68.5.json +39 -0
- package/wire-changes/primitives@7.69.0.json +79 -0
- package/wire-changes/wiki-gate@7.68.5.json +39 -0
- package/wire-changes/wiki-gate@7.69.0.json +39 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
2
|
import { escapeEnvelopeTag, inlineUntrusted, sanitizeUntrustedText } from "./untrusted-text.js";
|
|
3
3
|
import { describeRejectedValue } from "./tool-search-setting.js";
|
|
4
|
-
import { egressText } from "./untrusted-egress.js";
|
|
5
|
-
import { redactThenCut } from "../agents/subagent-steps.js";
|
|
4
|
+
import { egressText, redactThenCut } from "./untrusted-egress.js";
|
|
6
5
|
import { PEER_MESSAGE_NOTICE } from "../agents/peer-admission.js";
|
|
7
6
|
import { buildCrossSessionEnvelope, CROSS_PRINCIPAL_MESSAGE_NOTICE, CROSS_SESSION_MESSAGE_NOTICE, neutralizePeerBody } from "../agents/cross-session-envelope.js";
|
|
8
7
|
import { isAskUnresolvableCause } from "./ask-unresolvable-notice.js";
|
|
9
8
|
import { deliverEngineNotice } from "./engine-notice.js";
|
|
9
|
+
import { isAutoModeFallbackCause } from "./auto-mode.js";
|
|
10
10
|
import { sameOccupant } from "../engine/session/repo-utils.js";
|
|
11
|
+
import { codedRefusal } from "./thrown-value.js";
|
|
11
12
|
export const TASK_NOTIFICATION_TERMINAL_STATUSES = Object.freeze(["completed", "failed", "killed", "cancelled"]);
|
|
12
13
|
export const NOTIFICATION_INJECTION_OUTCOMES = Object.freeze(["queued", "parked", "parked_durably", "dropped_duplicate", "refused"]);
|
|
13
14
|
export function isNotificationInjectionOutcome(value) {
|
|
@@ -85,8 +86,11 @@ export function taskNotificationDedupKey(n) {
|
|
|
85
86
|
const attempt = n.attempt !== undefined && Number.isInteger(n.attempt) && n.attempt > 1 ? `:a${n.attempt}` : "";
|
|
86
87
|
return `task_notification:${taskNotificationLaneKey(n)}:${n.status}${n.seq !== undefined ? `:${n.seq}` : ""}${attempt}`;
|
|
87
88
|
}
|
|
88
|
-
export function taskNotificationNoteOptions(payload) {
|
|
89
|
-
return { provenance: "engine-note", enginePayload: payload, engineNoteKey: taskNotificationDedupKey(payload) };
|
|
89
|
+
export function taskNotificationNoteOptions(payload, priority) {
|
|
90
|
+
return { provenance: "engine-note", enginePayload: payload, engineNoteKey: taskNotificationDedupKey(payload), ...(priority !== undefined ? { engineTier: priority } : {}) };
|
|
91
|
+
}
|
|
92
|
+
export function taskNotificationFrame(payload, priority) {
|
|
93
|
+
return { type: "task_notification", notification: payload, noteKey: taskNotificationDedupKey(payload), ...(priority !== undefined ? { priority } : {}) };
|
|
90
94
|
}
|
|
91
95
|
export function taskNotificationLaneKey(n) {
|
|
92
96
|
return n.task_type === "external" ? `external:${n.task_id}` : n.task_id;
|
|
@@ -298,8 +302,13 @@ function malformedFacet(f) {
|
|
|
298
302
|
return "spawnName outside the spawn-name grammar";
|
|
299
303
|
if (f["handback"] !== undefined && !(typeof f["handback"] === "string" && HANDBACK_STATES.includes(f["handback"])))
|
|
300
304
|
return "handback outside its closed set";
|
|
305
|
+
const u = f["unreviewed"];
|
|
306
|
+
if (u !== undefined && !(u !== null && typeof u === "object" && !Array.isArray(u) && Object.keys(u).length === 1 && isAutoModeFallbackCause(u.handback)))
|
|
307
|
+
return "unreviewed is not a hand-back cause record";
|
|
301
308
|
if (f["completionId"] !== undefined && !(typeof f["completionId"] === "string" && f["completionId"] !== ""))
|
|
302
309
|
return "completionId is not a non-empty string";
|
|
310
|
+
if (f["resumableUntil"] !== undefined && !(typeof f["resumableUntil"] === "number" && Number.isFinite(f["resumableUntil"]) && f["resumableUntil"] >= 0))
|
|
311
|
+
return "resumableUntil is not an epoch-ms instant";
|
|
303
312
|
const steps = f["recentSteps"];
|
|
304
313
|
if (steps !== undefined && !(Array.isArray(steps) && steps.every((s) => s !== null && typeof s === "object" && typeof s.tool === "string" && typeof s.target === "string" && typeof s.outcome === "string")))
|
|
305
314
|
return "recentSteps is not a list of steps";
|
|
@@ -415,6 +424,7 @@ export class DeliveryObligations {
|
|
|
415
424
|
}
|
|
416
425
|
}
|
|
417
426
|
const ONE_SHOT_WAIT_CEILING_MS = 600_000;
|
|
427
|
+
export const oneShotEndingBook = (oneShot, book) => (oneShot === true ? book : undefined);
|
|
418
428
|
const LANE_OBLIGATIONS = new WeakMap();
|
|
419
429
|
export function bindDeliveryObligations(sink, book) {
|
|
420
430
|
LANE_OBLIGATIONS.set(sink, book);
|
|
@@ -434,27 +444,31 @@ export function moveTerminalDelivery(from, to, task) {
|
|
|
434
444
|
oweTerminalDelivery(to, task);
|
|
435
445
|
}
|
|
436
446
|
export function createLiveNotificationLane(seat) {
|
|
437
|
-
const handedOff = new
|
|
438
|
-
const enter = (admits) => (payload, priority, onDisposition) => {
|
|
447
|
+
const handedOff = new Map();
|
|
448
|
+
const enter = (admits, producer = false) => (payload, priority, onDisposition) => {
|
|
439
449
|
const dedupKey = taskNotificationDedupKey(payload);
|
|
440
450
|
if (seat.alreadyDelivered(dedupKey))
|
|
441
451
|
return "duplicate";
|
|
442
452
|
if (!admits(dedupKey))
|
|
443
453
|
return "unavailable";
|
|
454
|
+
if (producer && handedOff.get(dedupKey) === true && seat.parkedDurably(dedupKey)) {
|
|
455
|
+
handedOff.set(dedupKey, false);
|
|
456
|
+
seat.queue.forget(dedupKey);
|
|
457
|
+
}
|
|
444
458
|
const accepted = seat.queue.enqueue({ kind: "task_notification", priority, dedupKey, payload, ...(onDisposition !== undefined ? { onDisposition } : {}) });
|
|
445
459
|
if (!accepted)
|
|
446
460
|
return "pending";
|
|
447
461
|
return "taken";
|
|
448
462
|
};
|
|
449
463
|
return {
|
|
450
|
-
take: enter(() => seat.isLive()),
|
|
464
|
+
take: enter(() => seat.isLive(), true),
|
|
451
465
|
takeAsDestination: enter((dedupKey) => seat.isLive() && seat.canTakeNow() && !handedOff.has(dedupKey)),
|
|
452
466
|
handOff: (payload) => {
|
|
453
467
|
if (!seat.isLive())
|
|
454
468
|
return;
|
|
455
|
-
handedOff.
|
|
469
|
+
handedOff.set(taskNotificationDedupKey(payload), true);
|
|
456
470
|
if (handedOff.size > MAX_DEDUP_KEYS) {
|
|
457
|
-
for (const k of handedOff) {
|
|
471
|
+
for (const k of handedOff.keys()) {
|
|
458
472
|
handedOff.delete(k);
|
|
459
473
|
if (handedOff.size <= MAX_DEDUP_KEYS)
|
|
460
474
|
break;
|
|
@@ -507,8 +521,8 @@ export class SessionLiveNotificationLanes {
|
|
|
507
521
|
return this.lanes.size;
|
|
508
522
|
}
|
|
509
523
|
}
|
|
510
|
-
function
|
|
511
|
-
return payload.agentMessage !== undefined || (
|
|
524
|
+
export function parksInSessionBox(payload, deployment) {
|
|
525
|
+
return payload.agentMessage !== undefined || (deployment.sessionBoxEngineFrames === true && isEngineFrameParkable(payload));
|
|
512
526
|
}
|
|
513
527
|
function keysOf(held, address) {
|
|
514
528
|
const entry = held.get(address.sessionId);
|
|
@@ -535,48 +549,80 @@ function addOccupantKey(held, address, dedupKey) {
|
|
|
535
549
|
}
|
|
536
550
|
}
|
|
537
551
|
}
|
|
538
|
-
export class
|
|
552
|
+
export class SessionRouteTable {
|
|
539
553
|
sessions = new Map();
|
|
554
|
+
liveLanes = new SessionLiveNotificationLanes();
|
|
555
|
+
droppedSessions = 0;
|
|
556
|
+
evictedSessions = new Map();
|
|
557
|
+
unattributedDrops = 0;
|
|
558
|
+
seats = new Map();
|
|
559
|
+
routed = new Map();
|
|
560
|
+
durable = new Map();
|
|
561
|
+
}
|
|
562
|
+
const ROUTE_TABLES_OF_STORE = new WeakMap();
|
|
563
|
+
export function sessionRouteTableOf(store, mailbox, engineFrames) {
|
|
564
|
+
let ofStore = ROUTE_TABLES_OF_STORE.get(store);
|
|
565
|
+
if (ofStore === undefined) {
|
|
566
|
+
ofStore = { byMailbox: new WeakMap() };
|
|
567
|
+
ROUTE_TABLES_OF_STORE.set(store, ofStore);
|
|
568
|
+
}
|
|
569
|
+
if (mailbox === undefined || mailbox === null)
|
|
570
|
+
return (ofStore.unboxed ??= new SessionRouteTable());
|
|
571
|
+
const held = ofStore.byMailbox.get(mailbox);
|
|
572
|
+
if (held !== undefined) {
|
|
573
|
+
if (held.engineFrames !== engineFrames) {
|
|
574
|
+
throw codedRefusal("config.session_box_floor_mismatch", `RunnerDeps.sessionBoxEngineFrames is ${engineFrames ? "true" : "not true"} on this Runner, but the box floor this process already registered for this session store object and this mailbox object is ${held.engineFrames ? "true" : "not true"} — Runners over one session store object and one mailbox object share one session route table, and whether every drainer of those boxes reads engine frames is one fact of that pair, kept for as long as the store object lives: declare it alike, or give this Runner another session store object to change it`);
|
|
575
|
+
}
|
|
576
|
+
return held.table;
|
|
577
|
+
}
|
|
578
|
+
const seat = { table: new SessionRouteTable(), engineFrames };
|
|
579
|
+
ofStore.byMailbox.set(mailbox, seat);
|
|
580
|
+
return seat.table;
|
|
581
|
+
}
|
|
582
|
+
export class PendingSessionNotifications {
|
|
583
|
+
table;
|
|
540
584
|
noticeSeat;
|
|
541
585
|
unseatedBoxSeat;
|
|
542
586
|
constructor(seats) {
|
|
587
|
+
this.table = seats?.table ?? new SessionRouteTable();
|
|
543
588
|
this.noticeSeat = seats?.onNotice ?? (() => undefined);
|
|
544
589
|
this.unseatedBoxSeat = seats?.boxFor;
|
|
545
590
|
}
|
|
546
|
-
liveLanes
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
591
|
+
get liveLanes() {
|
|
592
|
+
return this.table.liveLanes;
|
|
593
|
+
}
|
|
594
|
+
get droppedSessions() {
|
|
595
|
+
return this.table.droppedSessions;
|
|
596
|
+
}
|
|
551
597
|
admit(address, box) {
|
|
552
598
|
if (address.unread === true)
|
|
553
599
|
return;
|
|
554
|
-
this.seats.delete(address.sessionId);
|
|
555
|
-
this.seats.set(address.sessionId, { occupant: address.occupant, ...(box !== undefined ? { box } : {}) });
|
|
556
|
-
for (const id of this.seats.keys()) {
|
|
557
|
-
if (this.seats.size <= MAX_SESSION_BOX_BINDINGS)
|
|
600
|
+
this.table.seats.delete(address.sessionId);
|
|
601
|
+
this.table.seats.set(address.sessionId, { occupant: address.occupant, ...(box !== undefined ? { box } : {}) });
|
|
602
|
+
for (const id of this.table.seats.keys()) {
|
|
603
|
+
if (this.table.seats.size <= MAX_SESSION_BOX_BINDINGS)
|
|
558
604
|
break;
|
|
559
|
-
if (!this.sessions.has(id))
|
|
560
|
-
this.seats.delete(id);
|
|
605
|
+
if (!this.table.sessions.has(id))
|
|
606
|
+
this.table.seats.delete(id);
|
|
561
607
|
}
|
|
562
|
-
const parked = this.sessions.get(address.sessionId);
|
|
608
|
+
const parked = this.table.sessions.get(address.sessionId);
|
|
563
609
|
if (parked !== undefined && !sameOccupant(parked.occupant, address.occupant))
|
|
564
610
|
this.discardRecord(address.sessionId, parked, address.occupant);
|
|
565
|
-
for (const held of [this.evictedSessions, this.routed, this.durable]) {
|
|
611
|
+
for (const held of [this.table.evictedSessions, this.table.routed, this.table.durable]) {
|
|
566
612
|
const entry = held.get(address.sessionId);
|
|
567
613
|
if (entry !== undefined && !sameOccupant(entry.occupant, address.occupant))
|
|
568
614
|
held.delete(address.sessionId);
|
|
569
615
|
}
|
|
570
616
|
}
|
|
571
617
|
sessionBoxFor(address) {
|
|
572
|
-
const seat = this.seats.get(address.sessionId);
|
|
618
|
+
const seat = this.table.seats.get(address.sessionId);
|
|
573
619
|
if (seat !== undefined)
|
|
574
620
|
return sameOccupant(seat.occupant, address.occupant) ? seat.box : undefined;
|
|
575
621
|
const verdict = this.boxVerdictOf(address);
|
|
576
622
|
return verdict?.ok === true ? verdict.box : undefined;
|
|
577
623
|
}
|
|
578
624
|
holdsSeat(sessionId) {
|
|
579
|
-
return this.seats.has(sessionId);
|
|
625
|
+
return this.table.seats.has(sessionId);
|
|
580
626
|
}
|
|
581
627
|
boxVerdictOf(address) {
|
|
582
628
|
return address.scope !== undefined ? this.unseatedBoxSeat?.({ ...address, scope: address.scope }) : undefined;
|
|
@@ -597,7 +643,7 @@ export class PendingSessionNotifications {
|
|
|
597
643
|
return false;
|
|
598
644
|
const { seat } = stale;
|
|
599
645
|
const current = { sessionId: address.sessionId, occupant: seat?.occupant };
|
|
600
|
-
const path = seat !== undefined && this.liveLanes.holds(current) ? "live" : seat?.box !== undefined &&
|
|
646
|
+
const path = seat !== undefined && this.table.liveLanes.holds(current) ? "live" : seat?.box !== undefined && parksInSessionBox(payload, { sessionBoxEngineFrames: seat.box.engineFrames }) ? "box" : "drain";
|
|
601
647
|
this.announceDiscard(address, seat?.occupant, frameDelivery(payload), path);
|
|
602
648
|
return true;
|
|
603
649
|
}
|
|
@@ -609,7 +655,7 @@ export class PendingSessionNotifications {
|
|
|
609
655
|
return true;
|
|
610
656
|
}
|
|
611
657
|
staleAgainst(address) {
|
|
612
|
-
const seat = this.seats.get(address.sessionId);
|
|
658
|
+
const seat = this.table.seats.get(address.sessionId);
|
|
613
659
|
if (address.unread !== true && (seat === undefined || sameOccupant(address.occupant, seat.occupant)))
|
|
614
660
|
return undefined;
|
|
615
661
|
return { seat };
|
|
@@ -618,13 +664,13 @@ export class PendingSessionNotifications {
|
|
|
618
664
|
deliverEngineNotice(this.noticeSeat(), deliveryDiscardedNotice(address, current, delivery, path));
|
|
619
665
|
}
|
|
620
666
|
discardRecord(sessionId, record, current) {
|
|
621
|
-
if (this.sessions.get(sessionId) === record)
|
|
622
|
-
this.sessions.delete(sessionId);
|
|
667
|
+
if (this.table.sessions.get(sessionId) === record)
|
|
668
|
+
this.table.sessions.delete(sessionId);
|
|
623
669
|
for (const n of record.items)
|
|
624
670
|
this.announceDiscard({ sessionId, occupant: record.occupant }, current, frameDelivery(n), "drain");
|
|
625
671
|
}
|
|
626
672
|
recordOf(address) {
|
|
627
|
-
const s = this.sessions.get(address.sessionId);
|
|
673
|
+
const s = this.table.sessions.get(address.sessionId);
|
|
628
674
|
return s !== undefined && sameOccupant(s.occupant, address.occupant) ? s : undefined;
|
|
629
675
|
}
|
|
630
676
|
settleBoxDebts(address, signal) {
|
|
@@ -651,7 +697,7 @@ export class PendingSessionNotifications {
|
|
|
651
697
|
if (p !== undefined)
|
|
652
698
|
tiers.set(n, p);
|
|
653
699
|
}
|
|
654
|
-
this.sessions.set(sessionId, { occupant: s.occupant, items: owing, dropped: new Map(), keys: new Set(owing.map((n) => taskNotificationDedupKey(n))), priorities: tiers, boxDebts: debts });
|
|
700
|
+
this.table.sessions.set(sessionId, { occupant: s.occupant, items: owing, dropped: new Map(), keys: new Set(owing.map((n) => taskNotificationDedupKey(n))), priorities: tiers, boxDebts: debts });
|
|
655
701
|
const rest = s.items.filter((n) => !debts.has(n));
|
|
656
702
|
return rest.length === 0 && s.dropped.size === 0 ? undefined : { ...s, items: rest };
|
|
657
703
|
}
|
|
@@ -682,41 +728,41 @@ export class PendingSessionNotifications {
|
|
|
682
728
|
s.priorities?.delete(copy);
|
|
683
729
|
this.noteDurablePark(address, key);
|
|
684
730
|
if (s.items.length === 0 && s.dropped.size === 0)
|
|
685
|
-
this.sessions.delete(sessionId);
|
|
731
|
+
this.table.sessions.delete(sessionId);
|
|
686
732
|
}
|
|
687
733
|
pend(address, n, priority, debt) {
|
|
688
734
|
if (this.discardsStale(address, n))
|
|
689
735
|
return false;
|
|
690
736
|
const sessionId = address.sessionId;
|
|
691
|
-
let s = this.sessions.get(sessionId);
|
|
737
|
+
let s = this.table.sessions.get(sessionId);
|
|
692
738
|
if (s !== undefined && !sameOccupant(s.occupant, address.occupant)) {
|
|
693
739
|
this.discardRecord(sessionId, s, address.occupant);
|
|
694
740
|
s = undefined;
|
|
695
741
|
}
|
|
696
742
|
if (s === undefined) {
|
|
697
|
-
if (this.sessions.size >= MAX_PENDING_SESSIONS) {
|
|
698
|
-
const oldest = this.sessions.keys().next().value;
|
|
743
|
+
if (this.table.sessions.size >= MAX_PENDING_SESSIONS) {
|
|
744
|
+
const oldest = this.table.sessions.keys().next().value;
|
|
699
745
|
if (oldest !== undefined) {
|
|
700
|
-
const victim = this.sessions.get(oldest);
|
|
701
|
-
this.sessions.delete(oldest);
|
|
702
|
-
this.droppedSessions += 1;
|
|
746
|
+
const victim = this.table.sessions.get(oldest);
|
|
747
|
+
this.table.sessions.delete(oldest);
|
|
748
|
+
this.table.droppedSessions += 1;
|
|
703
749
|
const lost = (victim?.items.length ?? 0) + [...(victim?.dropped.values() ?? [])].reduce((a, d) => a + d.count, 0);
|
|
704
750
|
if (lost > 0) {
|
|
705
|
-
if (!this.evictedSessions.has(oldest) && this.evictedSessions.size >= MAX_TOMBSTONES) {
|
|
706
|
-
const oldestTomb = this.evictedSessions.keys().next().value;
|
|
751
|
+
if (!this.table.evictedSessions.has(oldest) && this.table.evictedSessions.size >= MAX_TOMBSTONES) {
|
|
752
|
+
const oldestTomb = this.table.evictedSessions.keys().next().value;
|
|
707
753
|
if (oldestTomb !== undefined) {
|
|
708
|
-
this.unattributedDrops += this.evictedSessions.get(oldestTomb)?.count ?? 0;
|
|
709
|
-
this.evictedSessions.delete(oldestTomb);
|
|
754
|
+
this.table.unattributedDrops += this.table.evictedSessions.get(oldestTomb)?.count ?? 0;
|
|
755
|
+
this.table.evictedSessions.delete(oldestTomb);
|
|
710
756
|
}
|
|
711
757
|
}
|
|
712
|
-
const tomb = this.evictedSessions.get(oldest);
|
|
758
|
+
const tomb = this.table.evictedSessions.get(oldest);
|
|
713
759
|
const occupant = victim?.occupant;
|
|
714
|
-
this.evictedSessions.set(oldest, { occupant, count: (tomb !== undefined && sameOccupant(tomb.occupant, occupant) ? tomb.count : 0) + lost });
|
|
760
|
+
this.table.evictedSessions.set(oldest, { occupant, count: (tomb !== undefined && sameOccupant(tomb.occupant, occupant) ? tomb.count : 0) + lost });
|
|
715
761
|
}
|
|
716
762
|
}
|
|
717
763
|
}
|
|
718
764
|
s = { occupant: address.occupant, items: [], dropped: new Map(), keys: new Set(), priorities: new Map() };
|
|
719
|
-
this.sessions.set(sessionId, s);
|
|
765
|
+
this.table.sessions.set(sessionId, s);
|
|
720
766
|
}
|
|
721
767
|
const key = taskNotificationDedupKey(n);
|
|
722
768
|
if (s.keys.has(key))
|
|
@@ -742,13 +788,13 @@ export class PendingSessionNotifications {
|
|
|
742
788
|
if (address.unread === true)
|
|
743
789
|
return undefined;
|
|
744
790
|
const sessionId = address.sessionId;
|
|
745
|
-
this.routed.delete(sessionId);
|
|
746
|
-
const held = this.sessions.get(sessionId);
|
|
791
|
+
this.table.routed.delete(sessionId);
|
|
792
|
+
const held = this.table.sessions.get(sessionId);
|
|
747
793
|
if (held !== undefined && !sameOccupant(held.occupant, address.occupant))
|
|
748
794
|
this.discardRecord(sessionId, held, address.occupant);
|
|
749
795
|
const parked = this.recordOf(address);
|
|
750
796
|
if (parked !== undefined)
|
|
751
|
-
this.sessions.delete(sessionId);
|
|
797
|
+
this.table.sessions.delete(sessionId);
|
|
752
798
|
const s = parked !== undefined ? this.keepBackOwing(sessionId, parked) : undefined;
|
|
753
799
|
if (s !== undefined) {
|
|
754
800
|
const rank = (n) => {
|
|
@@ -757,39 +803,40 @@ export class PendingSessionNotifications {
|
|
|
757
803
|
};
|
|
758
804
|
s.items = [...s.items].sort((a, b) => rank(a) - rank(b));
|
|
759
805
|
}
|
|
760
|
-
const tombstone = this.evictedSessions.get(sessionId);
|
|
806
|
+
const tombstone = this.table.evictedSessions.get(sessionId);
|
|
761
807
|
const tomb = tombstone !== undefined && sameOccupant(tombstone.occupant, address.occupant) ? tombstone.count : undefined;
|
|
762
808
|
if (tombstone !== undefined)
|
|
763
|
-
this.evictedSessions.delete(sessionId);
|
|
764
|
-
if (tomb === undefined && this.unattributedDrops === 0)
|
|
809
|
+
this.table.evictedSessions.delete(sessionId);
|
|
810
|
+
if (tomb === undefined && this.table.unattributedDrops === 0)
|
|
765
811
|
return s;
|
|
766
|
-
const carried = this.unattributedDrops;
|
|
767
|
-
this.unattributedDrops = 0;
|
|
812
|
+
const carried = this.table.unattributedDrops;
|
|
813
|
+
this.table.unattributedDrops = 0;
|
|
768
814
|
const out = s ?? { items: [], dropped: new Map() };
|
|
769
815
|
out.droppedWholeSession = (out.droppedWholeSession ?? 0) + (tomb ?? 0) + carried;
|
|
770
816
|
return out;
|
|
771
817
|
}
|
|
772
|
-
routed = new Map();
|
|
773
818
|
holdsKey(address, dedupKey) {
|
|
774
|
-
return this.recordOf(address)?.keys.has(dedupKey) === true || keysOf(this.routed, address)?.has(dedupKey) === true ||
|
|
819
|
+
return this.recordOf(address)?.keys.has(dedupKey) === true || keysOf(this.table.routed, address)?.has(dedupKey) === true || this.holdsDurably(address, dedupKey);
|
|
820
|
+
}
|
|
821
|
+
holdsDurably(address, dedupKey) {
|
|
822
|
+
return keysOf(this.table.durable, address)?.has(dedupKey) === true;
|
|
775
823
|
}
|
|
776
|
-
durable = new Map();
|
|
777
824
|
noteDurablePark(address, dedupKey) {
|
|
778
|
-
addOccupantKey(this.durable, address, dedupKey);
|
|
825
|
+
addOccupantKey(this.table.durable, address, dedupKey);
|
|
779
826
|
}
|
|
780
827
|
forgetDurablePark(address, dedupKey) {
|
|
781
|
-
const mine = keysOf(this.durable, address);
|
|
828
|
+
const mine = keysOf(this.table.durable, address);
|
|
782
829
|
if (mine === undefined)
|
|
783
830
|
return;
|
|
784
831
|
mine.delete(dedupKey);
|
|
785
832
|
if (mine.size === 0)
|
|
786
|
-
this.durable.delete(address.sessionId);
|
|
833
|
+
this.table.durable.delete(address.sessionId);
|
|
787
834
|
}
|
|
788
835
|
markDelivered(address, dedupKey) {
|
|
789
|
-
addOccupantKey(this.routed, address, dedupKey);
|
|
836
|
+
addOccupantKey(this.table.routed, address, dedupKey);
|
|
790
837
|
}
|
|
791
838
|
get size() {
|
|
792
|
-
return this.sessions.size;
|
|
839
|
+
return this.table.sessions.size;
|
|
793
840
|
}
|
|
794
841
|
}
|
|
795
842
|
export class DurableAppendObligations {
|
|
@@ -822,55 +869,63 @@ export function routeOrParkNotification(store, address, payload, priority, onDis
|
|
|
822
869
|
}
|
|
823
870
|
const routed = store.liveLanes.deliver(address, payload, priority, { ...(onDisposition !== undefined ? { onDisposition } : {}) });
|
|
824
871
|
if (routed === "unavailable") {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
872
|
+
parkAtSeat(store, address, payload, priority, onDisposition, onUnkept);
|
|
873
|
+
}
|
|
874
|
+
else if (routed !== "taken") {
|
|
875
|
+
onDisposition?.("queued");
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
export function parkAtSeat(store, address, payload, priority, onDisposition, onUnkept) {
|
|
879
|
+
if (store.discardsStale(address, payload)) {
|
|
880
|
+
onDisposition?.("refused");
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
const dedupKey = taskNotificationDedupKey(payload);
|
|
884
|
+
const box = store.sessionBoxFor(address);
|
|
885
|
+
const carrier = payload.agentMessage;
|
|
886
|
+
if (box !== undefined && parksInSessionBox(payload, { sessionBoxEngineFrames: box.engineFrames })) {
|
|
887
|
+
store.noteDurablePark(address, dedupKey);
|
|
888
|
+
const record = carrier !== undefined ? sessionBoxRecordOf({ ...payload, agentMessage: carrier }, address) : engineFrameRecordOf(payload, priority, address);
|
|
889
|
+
const ask = () => {
|
|
890
|
+
try {
|
|
891
|
+
return Promise.resolve(box.mailbox.append(box.scope, box.handle, record));
|
|
892
|
+
}
|
|
893
|
+
catch (e) {
|
|
894
|
+
return Promise.reject(e);
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
const appended = ask().catch((first) => {
|
|
898
|
+
try {
|
|
899
|
+
box.onError?.(first);
|
|
900
|
+
}
|
|
901
|
+
catch {
|
|
902
|
+
}
|
|
903
|
+
return ask();
|
|
904
|
+
});
|
|
905
|
+
const settled = appended.then(() => onDisposition?.("parked_durably"), (second) => {
|
|
906
|
+
store.forgetDurablePark(address, dedupKey);
|
|
907
|
+
if (!store.holdsSeat(address.sessionId)) {
|
|
831
908
|
try {
|
|
832
|
-
|
|
909
|
+
box.onError?.(new Error(`the ${inlineUntrusted(String(payload.task_type), 40)} frame of task ${inlineUntrusted(String(payload.task_id), 120)} could not be written to session ${inlineUntrusted(address.sessionId, 120)}'s durable box (asked twice), and no leg of that session is seated on any Runner of this process over the same session store and mailbox to read a copy kept in process: it was not kept`, { cause: second }));
|
|
833
910
|
}
|
|
834
|
-
catch
|
|
835
|
-
return Promise.reject(e);
|
|
911
|
+
catch {
|
|
836
912
|
}
|
|
837
|
-
};
|
|
838
|
-
const appended = ask().catch((first) => {
|
|
839
913
|
try {
|
|
840
|
-
|
|
914
|
+
onUnkept?.();
|
|
841
915
|
}
|
|
842
916
|
catch {
|
|
843
917
|
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
catch {
|
|
853
|
-
}
|
|
854
|
-
try {
|
|
855
|
-
onUnkept?.();
|
|
856
|
-
}
|
|
857
|
-
catch {
|
|
858
|
-
}
|
|
859
|
-
onDisposition?.("refused");
|
|
860
|
-
return;
|
|
861
|
-
}
|
|
862
|
-
const parked = store.pend(address, payload, priority, { box, record });
|
|
863
|
-
onDisposition?.(parked ? "parked" : "refused");
|
|
864
|
-
});
|
|
865
|
-
DurableAppendObligations.current()?.track(settled);
|
|
866
|
-
return;
|
|
867
|
-
}
|
|
868
|
-
const parked = store.pend(address, payload, priority);
|
|
869
|
-
onDisposition?.(parked ? "parked" : "refused");
|
|
870
|
-
}
|
|
871
|
-
else if (routed !== "taken") {
|
|
872
|
-
onDisposition?.("queued");
|
|
918
|
+
onDisposition?.("refused");
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
921
|
+
const parked = store.pend(address, payload, priority, { box, record });
|
|
922
|
+
onDisposition?.(parked ? "parked" : "refused");
|
|
923
|
+
});
|
|
924
|
+
DurableAppendObligations.current()?.track(settled);
|
|
925
|
+
return;
|
|
873
926
|
}
|
|
927
|
+
const parked = store.pend(address, payload, priority);
|
|
928
|
+
onDisposition?.(parked ? "parked" : "refused");
|
|
874
929
|
}
|
|
875
930
|
export function sessionBoxRecordOf(payload, to) {
|
|
876
931
|
const peer = payload.peer;
|
|
@@ -1023,6 +1078,9 @@ export class SystemInjectionQueue {
|
|
|
1023
1078
|
}
|
|
1024
1079
|
return true;
|
|
1025
1080
|
}
|
|
1081
|
+
forget(dedupKey) {
|
|
1082
|
+
this.dedup.delete(dedupKey);
|
|
1083
|
+
}
|
|
1026
1084
|
drain(priority) {
|
|
1027
1085
|
if (priority !== undefined && !isSystemInjectionPriority(priority)) {
|
|
1028
1086
|
throw new Error(`SystemInjectionQueue: unknown priority ${JSON.stringify(priority)} — expected one of ${SYSTEM_INJECTION_PRIORITIES.join("/")}`);
|
|
@@ -67,6 +67,11 @@ export declare function durableAgentArmedLane(core: DurableAgentCore, id: string
|
|
|
67
67
|
* built to prevent. Reading through the handle also survives the map eviction (the closure keeps the
|
|
68
68
|
* handle object alive), so the outlives-terminal-GC property the retain arms rely on is unchanged. */
|
|
69
69
|
export declare function durableAgentRowProbeLane(core: DurableAgentCore, id: string): (() => Promise<boolean>) | undefined;
|
|
70
|
+
/** The row-side facts the durable rung admits a row on (`durableRungAdmitsRow`: its agent type, its transcript anchor, its
|
|
71
|
+
* birth floor), read off this process's copy of the row's durable record — the facts tier-3 reads off the stored row.
|
|
72
|
+
* Undefined when the row has no durable lane. Read after the row's probe resolved: the probe flushes the lane the record
|
|
73
|
+
* is written through. */
|
|
74
|
+
export declare function durableAgentRowFactsLane(core: DurableAgentCore, id: string): Pick<BackgroundAgentRecord, "agentType" | "sessionId" | "policyFloor"> | undefined;
|
|
70
75
|
/** design/151 §7.3 (F-8) — open the in-process claim window for a tier-3 revival of `id`.
|
|
71
76
|
* SYNCHRONOUS admission check + mark in one call: refuses (false) while the handle is live
|
|
72
77
|
* running/pending in THIS process (the live delivery ladder owns it), while a reap sweep is
|
|
@@ -324,6 +329,13 @@ export declare function settleBackgroundAgentLane(core: DurableAgentCore, id: st
|
|
|
324
329
|
}): "completed" | "failed" | "killed" | undefined;
|
|
325
330
|
/** Abort every background agent belonging to `access` (parent-task teardown — a finished parent must
|
|
326
331
|
* not leave orphan child runs burning tokens; mirrors clearBackgroundForOwner for bash). */
|
|
332
|
+
/** Whether the owner sweep ({@link abortBackgroundAgentsForOwnerLane}) under `access` and `opts` takes this row: a running background
|
|
333
|
+
* agent `access` reaches, of the lifetime `opts` names. The one selection the sweep makes and a reader of what a run's end will stop
|
|
334
|
+
* asks ({@link TaskRegistry.runEndReading}). */
|
|
335
|
+
export declare function ownerSweepTakes(handle: RegisteredTaskHandle, access: TaskAccess, opts?: {
|
|
336
|
+
skipSessionScoped?: boolean;
|
|
337
|
+
sessionScopedOnly?: boolean;
|
|
338
|
+
}): handle is BackgroundAgentTaskHandle;
|
|
327
339
|
export declare function abortBackgroundAgentsForOwnerLane(core: DurableAgentCore, access: TaskAccess, opts?: {
|
|
328
340
|
skipSessionScoped?: boolean;
|
|
329
341
|
sessionScopedOnly?: boolean;
|
|
@@ -10,7 +10,7 @@ import { clipTaskOutput, assertOwnership, sleepPollStep, alreadyTerminalStopNote
|
|
|
10
10
|
import { codedRefusal, thrownLabel } from "./thrown-value.js";
|
|
11
11
|
import { readExtensionRequester } from "./extension-requester.js";
|
|
12
12
|
import { closestName } from "./closest-name.js";
|
|
13
|
-
import { agentStateSourceOfHandle, agentStateSummary, readAgentState } from "./agent-state.js";
|
|
13
|
+
import { agentParkSentence, agentStateSourceOfHandle, agentStateSummary, readAgentState } from "./agent-state.js";
|
|
14
14
|
import { deliverEngineNotice } from "./engine-notice.js";
|
|
15
15
|
function sayDurableRowUnpersisted(kind, handle, line) {
|
|
16
16
|
deliverEngineNotice(undefined, { code: "delegation.durable_row_unpersisted", message: line, detail: { kind, handle } });
|
|
@@ -194,6 +194,15 @@ export function durableAgentRowProbeLane(core, id) {
|
|
|
194
194
|
return lane.written && !lane.poisoned && !lane.flushFailed;
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
|
+
export function durableAgentRowFactsLane(core, id) {
|
|
198
|
+
const h = core.handles.get(id);
|
|
199
|
+
if (!h || h.type !== "background_agent")
|
|
200
|
+
return undefined;
|
|
201
|
+
const record = h.durable?.record;
|
|
202
|
+
if (record === undefined)
|
|
203
|
+
return undefined;
|
|
204
|
+
return { ...(record.agentType !== undefined ? { agentType: record.agentType } : {}), ...(record.sessionId !== undefined ? { sessionId: record.sessionId } : {}), ...(record.policyFloor !== undefined ? { policyFloor: record.policyFloor } : {}) };
|
|
205
|
+
}
|
|
197
206
|
export function beginDurableClaimLane(core, id) {
|
|
198
207
|
const live = core.handles.get(id);
|
|
199
208
|
if (live !== undefined && (live.status === "running" || live.status === "pending"))
|
|
@@ -921,14 +930,19 @@ export function settleBackgroundAgentLane(core, id, outcome) {
|
|
|
921
930
|
}, ["parkedCheckpointToken", "parkClaimId", "parkedAt"]);
|
|
922
931
|
return outcome.status;
|
|
923
932
|
}
|
|
933
|
+
export function ownerSweepTakes(handle, access, opts) {
|
|
934
|
+
if (handle.type !== "background_agent" || handle.status !== "running" || !canAccess(handle, access))
|
|
935
|
+
return false;
|
|
936
|
+
if (opts?.skipSessionScoped && handle.sessionScoped)
|
|
937
|
+
return false;
|
|
938
|
+
if (opts?.sessionScopedOnly && !handle.sessionScoped)
|
|
939
|
+
return false;
|
|
940
|
+
return true;
|
|
941
|
+
}
|
|
924
942
|
export function abortBackgroundAgentsForOwnerLane(core, access, opts) {
|
|
925
943
|
let aborted = 0;
|
|
926
944
|
for (const handle of core.handles.values()) {
|
|
927
|
-
if (
|
|
928
|
-
continue;
|
|
929
|
-
if (opts?.skipSessionScoped && handle.sessionScoped)
|
|
930
|
-
continue;
|
|
931
|
-
if (opts?.sessionScopedOnly && !handle.sessionScoped)
|
|
945
|
+
if (!ownerSweepTakes(handle, access, opts))
|
|
932
946
|
continue;
|
|
933
947
|
core.markStopSource(handle.id, "parent");
|
|
934
948
|
handle.abort.abort();
|
|
@@ -1405,7 +1419,7 @@ export function serveDurableAgentRowLane(row, agentState) {
|
|
|
1405
1419
|
if (row.status === "parked") {
|
|
1406
1420
|
return {
|
|
1407
1421
|
content: delimitUntrusted(`task ${row.handle}`, `status: parked
|
|
1408
|
-
${stateLine}
|
|
1422
|
+
${stateLine}${agentParkSentence(agentState?.park)}`),
|
|
1409
1423
|
details: buildAgentPollDetails({
|
|
1410
1424
|
taskId: row.handle,
|
|
1411
1425
|
status: "parked",
|
|
@@ -1454,7 +1468,7 @@ export async function pollBackgroundAgentLane(handle, deadline, signal, checkpoi
|
|
|
1454
1468
|
return {
|
|
1455
1469
|
content: delimitUntrusted(`task ${handle.id}`, `status: parked
|
|
1456
1470
|
state: ${agentStateSummary(agentState)}
|
|
1457
|
-
|
|
1471
|
+
${agentParkSentence(agentState.park)}`),
|
|
1458
1472
|
details: buildAgentPollDetails({
|
|
1459
1473
|
taskId: handle.id,
|
|
1460
1474
|
status: "parked",
|
|
@@ -1478,7 +1492,7 @@ The agent is durably suspended, waiting for an approval decision. It resumes whe
|
|
|
1478
1492
|
completionId: handle.completionId,
|
|
1479
1493
|
updatedAt: handle.updatedAt,
|
|
1480
1494
|
};
|
|
1481
|
-
const stateRead = readAgentState(agentStateSourceOfHandle({ status: snap.status, updatedAt: snap.updatedAt }), checkpointSeat, Date.now());
|
|
1495
|
+
const stateRead = readAgentState(agentStateSourceOfHandle({ id: handle.id, scope: handle.scope, status: snap.status, updatedAt: snap.updatedAt }), checkpointSeat, Date.now());
|
|
1482
1496
|
const agentState = stateRead instanceof Promise ? await stateRead : stateRead;
|
|
1483
1497
|
const fullResult = snap.result ? (handle.resultFull ?? snap.result) : undefined;
|
|
1484
1498
|
const resultText = fullResult !== undefined ? clipTaskOutput(fullResult, handle.outputFile) : undefined;
|
|
@@ -972,7 +972,9 @@ export interface ParkedClaimTicket {
|
|
|
972
972
|
* {@link TaskRegistry.rollbackParkedClaim} answers and the one a drive reports. One word, one meaning:
|
|
973
973
|
*
|
|
974
974
|
* `rolled_back` = the reservation was cleared while the checkpoint read pending, and the park stands: the same approval
|
|
975
|
-
* may be
|
|
975
|
+
* may be claimed again (a check read after the clear that fails keeps this word; see KNOWN-LIMITS) — whether a new attempt can
|
|
976
|
+
* go further is the failure's own word, not this one: a refusal of the row itself (its judge's verdict, before any claim) fails
|
|
977
|
+
* the same way on this engine every time. `failed` = the
|
|
976
978
|
* cycle ended on this attempt: the approval is no longer redeemable (its checkpoint expired or is gone, or it was
|
|
977
979
|
* resolved), and this attempt carries the cycle's terminal. `lost` = another transition owns the row (a newer claim,
|
|
978
980
|
* an earlier rollback, a stop or the stale-claim sweep): that transition, not this attempt, speaks for the cycle.
|
|
@@ -992,7 +994,7 @@ export type ParkedClaimRollback = (typeof PARKED_CLAIM_ROLLBACKS)[number];
|
|
|
992
994
|
export declare const PARKED_CLAIM_ROLLBACK_FACE: {
|
|
993
995
|
readonly rolled_back: {
|
|
994
996
|
readonly carriesTerminal: false;
|
|
995
|
-
readonly lead: "parked resume rolled back — the approval is still pending
|
|
997
|
+
readonly lead: "parked resume rolled back — the approval is still pending";
|
|
996
998
|
};
|
|
997
999
|
readonly failed: {
|
|
998
1000
|
readonly carriesTerminal: true;
|
|
@@ -352,7 +352,7 @@ export function isLiveSessionResidentAgent(handle) {
|
|
|
352
352
|
}
|
|
353
353
|
export const PARKED_CLAIM_ROLLBACKS = Object.freeze(["rolled_back", "failed", "lost", "retry"]);
|
|
354
354
|
export const PARKED_CLAIM_ROLLBACK_FACE = {
|
|
355
|
-
rolled_back: { carriesTerminal: false, lead: "parked resume rolled back — the approval is still pending
|
|
355
|
+
rolled_back: { carriesTerminal: false, lead: "parked resume rolled back — the approval is still pending" },
|
|
356
356
|
failed: { carriesTerminal: true, lead: "parked resume failed — the approval is no longer redeemable" },
|
|
357
357
|
lost: { carriesTerminal: false, lead: "parked resume did not proceed — another transition owns this row and speaks for its cycle" },
|
|
358
358
|
retry: { carriesTerminal: false, lead: "parked resume did not proceed — its rollback could not complete against the stores (a reservation that still stands is cleared by the stale-claim sweep)" },
|
|
@@ -101,7 +101,13 @@ export async function pollWorkflowLane(handle, access, deadline, signal) {
|
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
103
|
export async function stopWorkflowLane(handle) {
|
|
104
|
-
|
|
104
|
+
const ended = handle.status !== "running";
|
|
105
|
+
if (!ended) {
|
|
106
|
+
handle.status = "cancelled";
|
|
107
|
+
stampActivity(handle);
|
|
108
|
+
}
|
|
109
|
+
handle.handle.cancel("TaskStop requested");
|
|
110
|
+
if (ended) {
|
|
105
111
|
return {
|
|
106
112
|
content: JSON.stringify({
|
|
107
113
|
task_id: handle.id,
|
|
@@ -109,14 +115,11 @@ export async function stopWorkflowLane(handle) {
|
|
|
109
115
|
type: "workflow",
|
|
110
116
|
status: handle.status,
|
|
111
117
|
stopped: false,
|
|
112
|
-
note: `workflow already ${handle.status} —
|
|
118
|
+
note: `workflow already ${handle.status} — its row is unchanged; any of its agents still running were signalled to stop. Its completion notification carries its final state.`,
|
|
113
119
|
}),
|
|
114
120
|
details: { task_id: handle.id, type: "workflow", status: handle.status, retrieval_status: "success" },
|
|
115
121
|
};
|
|
116
122
|
}
|
|
117
|
-
handle.status = "cancelled";
|
|
118
|
-
stampActivity(handle);
|
|
119
|
-
handle.handle.cancel("TaskStop requested");
|
|
120
123
|
return {
|
|
121
124
|
content: JSON.stringify({
|
|
122
125
|
task_id: handle.id,
|