open-multi-agent-kit 1.0.0 → 1.2.2
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 +52 -1
- package/README.md +2 -2
- package/dist/approval-api.d.ts +5 -0
- package/dist/approval-api.d.ts.map +1 -0
- package/dist/approval-api.js +5 -0
- package/dist/approval-api.js.map +1 -0
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +1 -0
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/session-picker.d.ts +2 -2
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/commands/verified-run-cli.d.ts.map +1 -1
- package/dist/commands/verified-run-cli.js +69 -22
- package/dist/commands/verified-run-cli.js.map +1 -1
- package/dist/commands/verified-run-signal.d.ts +3 -0
- package/dist/commands/verified-run-signal.d.ts.map +1 -0
- package/dist/commands/verified-run-signal.js +15 -0
- package/dist/commands/verified-run-signal.js.map +1 -0
- package/dist/coordination/awareness.d.ts +32 -0
- package/dist/coordination/awareness.d.ts.map +1 -0
- package/dist/coordination/awareness.js +55 -0
- package/dist/coordination/awareness.js.map +1 -0
- package/dist/coordination/broker.d.ts +79 -0
- package/dist/coordination/broker.d.ts.map +1 -0
- package/dist/coordination/broker.js +202 -0
- package/dist/coordination/broker.js.map +1 -0
- package/dist/coordination/index.d.ts +16 -0
- package/dist/coordination/index.d.ts.map +1 -0
- package/dist/coordination/index.js +16 -0
- package/dist/coordination/index.js.map +1 -0
- package/dist/coordination/integration.d.ts +59 -0
- package/dist/coordination/integration.d.ts.map +1 -0
- package/dist/coordination/integration.js +126 -0
- package/dist/coordination/integration.js.map +1 -0
- package/dist/coordination/operation.d.ts +107 -0
- package/dist/coordination/operation.d.ts.map +1 -0
- package/dist/coordination/operation.js +231 -0
- package/dist/coordination/operation.js.map +1 -0
- package/dist/coordination/resource.d.ts +33 -0
- package/dist/coordination/resource.d.ts.map +1 -0
- package/dist/coordination/resource.js +95 -0
- package/dist/coordination/resource.js.map +1 -0
- package/dist/coordination/session.d.ts +74 -0
- package/dist/coordination/session.d.ts.map +1 -0
- package/dist/coordination/session.js +143 -0
- package/dist/coordination/session.js.map +1 -0
- package/dist/coordination/types.d.ts +68 -0
- package/dist/coordination/types.d.ts.map +1 -0
- package/dist/coordination/types.js +26 -0
- package/dist/coordination/types.js.map +1 -0
- package/dist/core/adaptorch-bridge.d.ts +1 -1
- package/dist/core/adaptorch-bridge.d.ts.map +1 -1
- package/dist/core/adaptorch-bridge.js +1 -1
- package/dist/core/adaptorch-bridge.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +16 -16
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +35 -15
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/canonical-json.d.ts +3 -0
- package/dist/core/canonical-json.d.ts.map +1 -0
- package/dist/core/canonical-json.js +20 -0
- package/dist/core/canonical-json.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +7 -3
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +14 -29
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/control-state.d.ts +41 -0
- package/dist/core/compaction/control-state.d.ts.map +1 -0
- package/dist/core/compaction/control-state.js +85 -0
- package/dist/core/compaction/control-state.js.map +1 -0
- package/dist/core/compaction/fallback.d.ts +71 -0
- package/dist/core/compaction/fallback.d.ts.map +1 -0
- package/dist/core/compaction/fallback.js +118 -0
- package/dist/core/compaction/fallback.js.map +1 -0
- package/dist/core/compaction/index.d.ts +2 -0
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +2 -0
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/compaction/model-failover.d.ts +21 -0
- package/dist/core/compaction/model-failover.d.ts.map +1 -0
- package/dist/core/compaction/model-failover.js +46 -0
- package/dist/core/compaction/model-failover.js.map +1 -0
- package/dist/core/compaction/session-summary.d.ts +21 -0
- package/dist/core/compaction/session-summary.d.ts.map +1 -0
- package/dist/core/compaction/session-summary.js +27 -0
- package/dist/core/compaction/session-summary.js.map +1 -0
- package/dist/core/context-budget-headroom-candidates.d.ts +16 -1
- package/dist/core/context-budget-headroom-candidates.d.ts.map +1 -1
- package/dist/core/context-budget-headroom-candidates.js +31 -13
- package/dist/core/context-budget-headroom-candidates.js.map +1 -1
- package/dist/core/context-budget-headroom-types.d.ts +7 -1
- package/dist/core/context-budget-headroom-types.d.ts.map +1 -1
- package/dist/core/context-budget-headroom-types.js +0 -1
- package/dist/core/context-budget-headroom-types.js.map +1 -1
- package/dist/core/context-budget-headroom.d.ts +10 -0
- package/dist/core/context-budget-headroom.d.ts.map +1 -1
- package/dist/core/context-budget-headroom.js +11 -2
- package/dist/core/context-budget-headroom.js.map +1 -1
- package/dist/core/context-budget-v2-global-pass.d.ts +21 -0
- package/dist/core/context-budget-v2-global-pass.d.ts.map +1 -0
- package/dist/core/context-budget-v2-global-pass.js +203 -0
- package/dist/core/context-budget-v2-global-pass.js.map +1 -0
- package/dist/core/context-budget-v2-planned-items.d.ts +12 -0
- package/dist/core/context-budget-v2-planned-items.d.ts.map +1 -1
- package/dist/core/context-budget-v2-planned-items.js +21 -2
- package/dist/core/context-budget-v2-planned-items.js.map +1 -1
- package/dist/core/context-budget-v2-planner.d.ts.map +1 -1
- package/dist/core/context-budget-v2-planner.js +18 -19
- package/dist/core/context-budget-v2-planner.js.map +1 -1
- package/dist/core/context-budget-v2-scoring.d.ts +7 -1
- package/dist/core/context-budget-v2-scoring.d.ts.map +1 -1
- package/dist/core/context-budget-v2-scoring.js.map +1 -1
- package/dist/core/context-budget-v2-selection.d.ts +3 -0
- package/dist/core/context-budget-v2-selection.d.ts.map +1 -1
- package/dist/core/context-budget-v2-selection.js +6 -2
- package/dist/core/context-budget-v2-selection.js.map +1 -1
- package/dist/core/context-budget-v2-types.d.ts +6 -1
- package/dist/core/context-budget-v2-types.d.ts.map +1 -1
- package/dist/core/context-budget-v2-types.js +6 -1
- package/dist/core/context-budget-v2-types.js.map +1 -1
- package/dist/core/export-html/template.js +14 -0
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/session-lifecycle-types.d.ts +14 -0
- package/dist/core/extensions/session-lifecycle-types.d.ts.map +1 -0
- package/dist/core/extensions/session-lifecycle-types.js +2 -0
- package/dist/core/extensions/session-lifecycle-types.js.map +1 -0
- package/dist/core/extensions/types.d.ts +4 -9
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +10 -1
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +3 -6
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/legacy-resource-policy.d.ts +7 -0
- package/dist/core/legacy-resource-policy.d.ts.map +1 -0
- package/dist/core/legacy-resource-policy.js +9 -0
- package/dist/core/legacy-resource-policy.js.map +1 -0
- package/dist/core/mcp/config.d.ts.map +1 -1
- package/dist/core/mcp/config.js +17 -3
- package/dist/core/mcp/config.js.map +1 -1
- package/dist/core/mcp/connection-queue.d.ts +12 -0
- package/dist/core/mcp/connection-queue.d.ts.map +1 -0
- package/dist/core/mcp/connection-queue.js +46 -0
- package/dist/core/mcp/connection-queue.js.map +1 -0
- package/dist/core/mcp/manager-runtime.d.ts +55 -0
- package/dist/core/mcp/manager-runtime.d.ts.map +1 -0
- package/dist/core/mcp/manager-runtime.js +66 -0
- package/dist/core/mcp/manager-runtime.js.map +1 -0
- package/dist/core/mcp/manager.d.ts +12 -68
- package/dist/core/mcp/manager.d.ts.map +1 -1
- package/dist/core/mcp/manager.js +33 -113
- package/dist/core/mcp/manager.js.map +1 -1
- package/dist/core/mcp/protocol.d.ts.map +1 -1
- package/dist/core/mcp/protocol.js +70 -40
- package/dist/core/mcp/protocol.js.map +1 -1
- package/dist/core/package-manager.d.ts +4 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +59 -129
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/package-resource-patterns.d.ts +7 -0
- package/dist/core/package-resource-patterns.d.ts.map +1 -0
- package/dist/core/package-resource-patterns.js +99 -0
- package/dist/core/package-resource-patterns.js.map +1 -0
- package/dist/core/provider-default-models.d.ts +1 -0
- package/dist/core/provider-default-models.d.ts.map +1 -1
- package/dist/core/provider-default-models.js +1 -0
- package/dist/core/provider-default-models.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +1 -0
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/provider-resilience.d.ts +9 -0
- package/dist/core/provider-resilience.d.ts.map +1 -1
- package/dist/core/provider-resilience.js +15 -0
- package/dist/core/provider-resilience.js.map +1 -1
- package/dist/core/reasoning-router-resolver.d.ts +7 -0
- package/dist/core/reasoning-router-resolver.d.ts.map +1 -1
- package/dist/core/reasoning-router-resolver.js +21 -3
- package/dist/core/reasoning-router-resolver.js.map +1 -1
- package/dist/core/reasoning-router-v4.d.ts +13 -7
- package/dist/core/reasoning-router-v4.d.ts.map +1 -1
- package/dist/core/reasoning-router-v4.js +8 -5
- package/dist/core/reasoning-router-v4.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +4 -8
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/run-execution-api.d.ts +8 -1
- package/dist/core/run-execution-api.d.ts.map +1 -1
- package/dist/core/run-execution-api.js +4 -0
- package/dist/core/run-execution-api.js.map +1 -1
- package/dist/core/run-journal.d.ts +1 -2
- package/dist/core/run-journal.d.ts.map +1 -1
- package/dist/core/run-journal.js +2 -19
- package/dist/core/run-journal.js.map +1 -1
- package/dist/core/session-compaction-service.d.ts +15 -0
- package/dist/core/session-compaction-service.d.ts.map +1 -1
- package/dist/core/session-compaction-service.js +17 -4
- package/dist/core/session-compaction-service.js.map +1 -1
- package/dist/core/session-listing.d.ts +51 -0
- package/dist/core/session-listing.d.ts.map +1 -0
- package/dist/core/session-listing.js +111 -0
- package/dist/core/session-listing.js.map +1 -0
- package/dist/core/session-manager.d.ts +12 -37
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +12 -118
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-message-text.d.ts +5 -0
- package/dist/core/session-message-text.d.ts.map +1 -0
- package/dist/core/session-message-text.js +9 -0
- package/dist/core/session-message-text.js.map +1 -0
- package/dist/core/skills-catalog-cache.d.ts +2 -0
- package/dist/core/skills-catalog-cache.d.ts.map +1 -1
- package/dist/core/skills-catalog-cache.js +71 -17
- package/dist/core/skills-catalog-cache.js.map +1 -1
- package/dist/core/todo-runtime-state.d.ts +12 -0
- package/dist/core/todo-runtime-state.d.ts.map +1 -1
- package/dist/core/todo-runtime-state.js +23 -0
- package/dist/core/todo-runtime-state.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/verified-run/authority-clock.d.ts +3 -0
- package/dist/core/verified-run/authority-clock.d.ts.map +1 -0
- package/dist/core/verified-run/authority-clock.js +25 -0
- package/dist/core/verified-run/authority-clock.js.map +1 -0
- package/dist/core/verified-run/authority-errors.d.ts +10 -0
- package/dist/core/verified-run/authority-errors.d.ts.map +1 -0
- package/dist/core/verified-run/authority-errors.js +17 -0
- package/dist/core/verified-run/authority-errors.js.map +1 -0
- package/dist/core/verified-run/authority-events.d.ts +126 -0
- package/dist/core/verified-run/authority-events.d.ts.map +1 -0
- package/dist/core/verified-run/authority-events.js +482 -0
- package/dist/core/verified-run/authority-events.js.map +1 -0
- package/dist/core/verified-run/authority-journal.d.ts +27 -0
- package/dist/core/verified-run/authority-journal.d.ts.map +1 -0
- package/dist/core/verified-run/authority-journal.js +83 -0
- package/dist/core/verified-run/authority-journal.js.map +1 -0
- package/dist/core/verified-run/authority-meaning.d.ts +13 -0
- package/dist/core/verified-run/authority-meaning.d.ts.map +1 -0
- package/dist/core/verified-run/authority-meaning.js +40 -0
- package/dist/core/verified-run/authority-meaning.js.map +1 -0
- package/dist/core/verified-run/authority-runtime.d.ts +82 -0
- package/dist/core/verified-run/authority-runtime.d.ts.map +1 -0
- package/dist/core/verified-run/authority-runtime.js +169 -0
- package/dist/core/verified-run/authority-runtime.js.map +1 -0
- package/dist/core/verified-run/authority-store.d.ts +204 -0
- package/dist/core/verified-run/authority-store.d.ts.map +1 -0
- package/dist/core/verified-run/authority-store.js +852 -0
- package/dist/core/verified-run/authority-store.js.map +1 -0
- package/dist/core/verified-run/broker.d.ts +8 -1
- package/dist/core/verified-run/broker.d.ts.map +1 -1
- package/dist/core/verified-run/broker.js +94 -90
- package/dist/core/verified-run/broker.js.map +1 -1
- package/dist/core/verified-run/candidate-policy.d.ts +10 -0
- package/dist/core/verified-run/candidate-policy.d.ts.map +1 -0
- package/dist/core/verified-run/candidate-policy.js +33 -0
- package/dist/core/verified-run/candidate-policy.js.map +1 -0
- package/dist/core/verified-run/candidate.d.ts.map +1 -1
- package/dist/core/verified-run/candidate.js +5 -10
- package/dist/core/verified-run/candidate.js.map +1 -1
- package/dist/core/verified-run/coordinator.d.ts +35 -17
- package/dist/core/verified-run/coordinator.d.ts.map +1 -1
- package/dist/core/verified-run/coordinator.js +111 -57
- package/dist/core/verified-run/coordinator.js.map +1 -1
- package/dist/core/verified-run/dag-phase.d.ts.map +1 -1
- package/dist/core/verified-run/dag-phase.js +1 -1
- package/dist/core/verified-run/dag-phase.js.map +1 -1
- package/dist/core/verified-run/dag-recovery.d.ts +5 -1
- package/dist/core/verified-run/dag-recovery.d.ts.map +1 -1
- package/dist/core/verified-run/dag-recovery.js +10 -4
- package/dist/core/verified-run/dag-recovery.js.map +1 -1
- package/dist/core/verified-run/event-parser.d.ts.map +1 -1
- package/dist/core/verified-run/event-parser.js +33 -0
- package/dist/core/verified-run/event-parser.js.map +1 -1
- package/dist/core/verified-run/evidence-read-projection.d.ts +4 -0
- package/dist/core/verified-run/evidence-read-projection.d.ts.map +1 -0
- package/dist/core/verified-run/evidence-read-projection.js +27 -0
- package/dist/core/verified-run/evidence-read-projection.js.map +1 -0
- package/dist/core/verified-run/evidence.d.ts +12 -1
- package/dist/core/verified-run/evidence.d.ts.map +1 -1
- package/dist/core/verified-run/evidence.js +51 -2
- package/dist/core/verified-run/evidence.js.map +1 -1
- package/dist/core/verified-run/git-candidate-preflight.d.ts +4 -0
- package/dist/core/verified-run/git-candidate-preflight.d.ts.map +1 -0
- package/dist/core/verified-run/git-candidate-preflight.js +34 -0
- package/dist/core/verified-run/git-candidate-preflight.js.map +1 -0
- package/dist/core/verified-run/git-effect-supervisor.d.ts +24 -0
- package/dist/core/verified-run/git-effect-supervisor.d.ts.map +1 -0
- package/dist/core/verified-run/git-effect-supervisor.js +174 -0
- package/dist/core/verified-run/git-effect-supervisor.js.map +1 -0
- package/dist/core/verified-run/git-execution.d.ts +27 -0
- package/dist/core/verified-run/git-execution.d.ts.map +1 -0
- package/dist/core/verified-run/git-execution.js +118 -0
- package/dist/core/verified-run/git-execution.js.map +1 -0
- package/dist/core/verified-run/git-plumbing.d.ts +37 -0
- package/dist/core/verified-run/git-plumbing.d.ts.map +1 -0
- package/dist/core/verified-run/git-plumbing.js +171 -0
- package/dist/core/verified-run/git-plumbing.js.map +1 -0
- package/dist/core/verified-run/git-publication-worker.d.ts +2 -0
- package/dist/core/verified-run/git-publication-worker.d.ts.map +1 -0
- package/dist/core/verified-run/git-publication-worker.js +54 -0
- package/dist/core/verified-run/git-publication-worker.js.map +1 -0
- package/dist/core/verified-run/git-sandbox-layout.d.ts +4 -0
- package/dist/core/verified-run/git-sandbox-layout.d.ts.map +1 -0
- package/dist/core/verified-run/git-sandbox-layout.js +29 -0
- package/dist/core/verified-run/git-sandbox-layout.js.map +1 -0
- package/dist/core/verified-run/git-worker-protocol.d.ts +19 -0
- package/dist/core/verified-run/git-worker-protocol.d.ts.map +1 -0
- package/dist/core/verified-run/git-worker-protocol.js +109 -0
- package/dist/core/verified-run/git-worker-protocol.js.map +1 -0
- package/dist/core/verified-run/git-worker-runtime.d.ts +19 -0
- package/dist/core/verified-run/git-worker-runtime.d.ts.map +1 -0
- package/dist/core/verified-run/git-worker-runtime.js +74 -0
- package/dist/core/verified-run/git-worker-runtime.js.map +1 -0
- package/dist/core/verified-run/journal.d.ts +2 -3
- package/dist/core/verified-run/journal.d.ts.map +1 -1
- package/dist/core/verified-run/journal.js.map +1 -1
- package/dist/core/verified-run/namespace-identity.d.ts.map +1 -1
- package/dist/core/verified-run/namespace-identity.js +1 -1
- package/dist/core/verified-run/namespace-identity.js.map +1 -1
- package/dist/core/verified-run/owned-execution.d.ts +10 -1
- package/dist/core/verified-run/owned-execution.d.ts.map +1 -1
- package/dist/core/verified-run/owned-execution.js +124 -31
- package/dist/core/verified-run/owned-execution.js.map +1 -1
- package/dist/core/verified-run/phase-context.d.ts +2 -0
- package/dist/core/verified-run/phase-context.d.ts.map +1 -1
- package/dist/core/verified-run/phase-context.js.map +1 -1
- package/dist/core/verified-run/projection.d.ts.map +1 -1
- package/dist/core/verified-run/projection.js +51 -1
- package/dist/core/verified-run/projection.js.map +1 -1
- package/dist/core/verified-run/publish-preflight.d.ts +12 -0
- package/dist/core/verified-run/publish-preflight.d.ts.map +1 -0
- package/dist/core/verified-run/publish-preflight.js +38 -0
- package/dist/core/verified-run/publish-preflight.js.map +1 -0
- package/dist/core/verified-run/publish-start.d.ts +5 -0
- package/dist/core/verified-run/publish-start.d.ts.map +1 -0
- package/dist/core/verified-run/publish-start.js +7 -0
- package/dist/core/verified-run/publish-start.js.map +1 -0
- package/dist/core/verified-run/recovery-projection.d.ts.map +1 -1
- package/dist/core/verified-run/recovery-projection.js +5 -0
- package/dist/core/verified-run/recovery-projection.js.map +1 -1
- package/dist/core/verified-run/recovery.d.ts +5 -1
- package/dist/core/verified-run/recovery.d.ts.map +1 -1
- package/dist/core/verified-run/recovery.js +10 -4
- package/dist/core/verified-run/recovery.js.map +1 -1
- package/dist/core/verified-run/run-plan.d.ts +17 -0
- package/dist/core/verified-run/run-plan.d.ts.map +1 -0
- package/dist/core/verified-run/run-plan.js +18 -0
- package/dist/core/verified-run/run-plan.js.map +1 -0
- package/dist/core/verified-run/run-publish-owned.d.ts +6 -0
- package/dist/core/verified-run/run-publish-owned.d.ts.map +1 -0
- package/dist/core/verified-run/run-publish-owned.js +199 -0
- package/dist/core/verified-run/run-publish-owned.js.map +1 -0
- package/dist/core/verified-run/run-publish.d.ts +19 -0
- package/dist/core/verified-run/run-publish.d.ts.map +1 -0
- package/dist/core/verified-run/run-publish.js +210 -0
- package/dist/core/verified-run/run-publish.js.map +1 -0
- package/dist/core/verified-run/run-status-owned.d.ts +4 -0
- package/dist/core/verified-run/run-status-owned.d.ts.map +1 -0
- package/dist/core/verified-run/run-status-owned.js +14 -0
- package/dist/core/verified-run/run-status-owned.js.map +1 -0
- package/dist/core/verified-run/run-status.d.ts +133 -0
- package/dist/core/verified-run/run-status.d.ts.map +1 -0
- package/dist/core/verified-run/run-status.js +193 -0
- package/dist/core/verified-run/run-status.js.map +1 -0
- package/dist/core/verified-run/run-types.d.ts +31 -0
- package/dist/core/verified-run/run-types.d.ts.map +1 -1
- package/dist/core/verified-run/run-types.js.map +1 -1
- package/dist/core/verified-run/storage.d.ts.map +1 -1
- package/dist/core/verified-run/storage.js +1 -1
- package/dist/core/verified-run/storage.js.map +1 -1
- package/dist/core/verified-run/supervisor-adapter.d.ts +77 -0
- package/dist/core/verified-run/supervisor-adapter.d.ts.map +1 -0
- package/dist/core/verified-run/supervisor-adapter.js +164 -0
- package/dist/core/verified-run/supervisor-adapter.js.map +1 -0
- package/dist/core/verified-run/verification-phase.d.ts.map +1 -1
- package/dist/core/verified-run/verification-phase.js +1 -1
- package/dist/core/verified-run/verification-phase.js.map +1 -1
- package/dist/core/verified-run/writer-phase.d.ts.map +1 -1
- package/dist/core/verified-run/writer-phase.js +1 -0
- package/dist/core/verified-run/writer-phase.js.map +1 -1
- package/dist/core/verified-run/writer-recovery.d.ts +2 -0
- package/dist/core/verified-run/writer-recovery.d.ts.map +1 -1
- package/dist/core/verified-run/writer-recovery.js +1 -0
- package/dist/core/verified-run/writer-recovery.js.map +1 -1
- package/dist/core/workload-shard-execution-types.d.ts +4 -1
- package/dist/core/workload-shard-execution-types.d.ts.map +1 -1
- package/dist/core/workload-shard-execution-types.js.map +1 -1
- package/dist/core/workload-shard-executor.d.ts +2 -2
- package/dist/core/workload-shard-executor.d.ts.map +1 -1
- package/dist/core/workload-shard-executor.js +16 -37
- package/dist/core/workload-shard-executor.js.map +1 -1
- package/dist/core/workload-shard-frontier.d.ts +5 -0
- package/dist/core/workload-shard-frontier.d.ts.map +1 -0
- package/dist/core/workload-shard-frontier.js +47 -0
- package/dist/core/workload-shard-frontier.js.map +1 -0
- package/dist/core/workload-shard-runner.d.ts.map +1 -1
- package/dist/core/workload-shard-runner.js +28 -17
- package/dist/core/workload-shard-runner.js.map +1 -1
- package/dist/index.d.ts +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +2 -1
- package/dist/main.js.map +1 -1
- package/dist/metacognition/bridge-result.d.ts +148 -0
- package/dist/metacognition/bridge-result.d.ts.map +1 -0
- package/dist/metacognition/bridge-result.js +46 -0
- package/dist/metacognition/bridge-result.js.map +1 -0
- package/dist/metacognition/calibration-selective.d.ts +78 -0
- package/dist/metacognition/calibration-selective.d.ts.map +1 -0
- package/dist/metacognition/calibration-selective.js +167 -0
- package/dist/metacognition/calibration-selective.js.map +1 -0
- package/dist/metacognition/calibration.d.ts +62 -0
- package/dist/metacognition/calibration.d.ts.map +1 -0
- package/dist/metacognition/calibration.js +122 -0
- package/dist/metacognition/calibration.js.map +1 -0
- package/dist/metacognition/checkpoint.d.ts +60 -0
- package/dist/metacognition/checkpoint.d.ts.map +1 -0
- package/dist/metacognition/checkpoint.js +57 -0
- package/dist/metacognition/checkpoint.js.map +1 -0
- package/dist/metacognition/context7.d.ts +48 -0
- package/dist/metacognition/context7.d.ts.map +1 -0
- package/dist/metacognition/context7.js +154 -0
- package/dist/metacognition/context7.js.map +1 -0
- package/dist/metacognition/decision.d.ts +44 -0
- package/dist/metacognition/decision.d.ts.map +1 -0
- package/dist/metacognition/decision.js +111 -0
- package/dist/metacognition/decision.js.map +1 -0
- package/dist/metacognition/evaluation.d.ts +73 -0
- package/dist/metacognition/evaluation.d.ts.map +1 -0
- package/dist/metacognition/evaluation.js +97 -0
- package/dist/metacognition/evaluation.js.map +1 -0
- package/dist/metacognition/index.d.ts +32 -0
- package/dist/metacognition/index.d.ts.map +1 -0
- package/dist/metacognition/index.js +32 -0
- package/dist/metacognition/index.js.map +1 -0
- package/dist/metacognition/knowledge-action.d.ts +43 -0
- package/dist/metacognition/knowledge-action.d.ts.map +1 -0
- package/dist/metacognition/knowledge-action.js +60 -0
- package/dist/metacognition/knowledge-action.js.map +1 -0
- package/dist/metacognition/knowledge.d.ts +84 -0
- package/dist/metacognition/knowledge.d.ts.map +1 -0
- package/dist/metacognition/knowledge.js +165 -0
- package/dist/metacognition/knowledge.js.map +1 -0
- package/dist/metacognition/obligations.d.ts +82 -0
- package/dist/metacognition/obligations.d.ts.map +1 -0
- package/dist/metacognition/obligations.js +139 -0
- package/dist/metacognition/obligations.js.map +1 -0
- package/dist/metacognition/observation-validity.d.ts +83 -0
- package/dist/metacognition/observation-validity.d.ts.map +1 -0
- package/dist/metacognition/observation-validity.js +118 -0
- package/dist/metacognition/observation-validity.js.map +1 -0
- package/dist/metacognition/observe.d.ts +45 -0
- package/dist/metacognition/observe.d.ts.map +1 -0
- package/dist/metacognition/observe.js +59 -0
- package/dist/metacognition/observe.js.map +1 -0
- package/dist/metacognition/policy.d.ts +53 -0
- package/dist/metacognition/policy.d.ts.map +1 -0
- package/dist/metacognition/policy.js +155 -0
- package/dist/metacognition/policy.js.map +1 -0
- package/dist/metacognition/predictions.d.ts +78 -0
- package/dist/metacognition/predictions.d.ts.map +1 -0
- package/dist/metacognition/predictions.js +181 -0
- package/dist/metacognition/predictions.js.map +1 -0
- package/dist/metacognition/retrieval.d.ts +53 -0
- package/dist/metacognition/retrieval.d.ts.map +1 -0
- package/dist/metacognition/retrieval.js +170 -0
- package/dist/metacognition/retrieval.js.map +1 -0
- package/dist/metacognition/risk.d.ts +48 -0
- package/dist/metacognition/risk.d.ts.map +1 -0
- package/dist/metacognition/risk.js +179 -0
- package/dist/metacognition/risk.js.map +1 -0
- package/dist/metacognition/route-economics.d.ts +95 -0
- package/dist/metacognition/route-economics.d.ts.map +1 -0
- package/dist/metacognition/route-economics.js +110 -0
- package/dist/metacognition/route-economics.js.map +1 -0
- package/dist/metacognition/runtime-bridge.d.ts +81 -0
- package/dist/metacognition/runtime-bridge.d.ts.map +1 -0
- package/dist/metacognition/runtime-bridge.js +458 -0
- package/dist/metacognition/runtime-bridge.js.map +1 -0
- package/dist/metacognition/skills.d.ts +42 -0
- package/dist/metacognition/skills.d.ts.map +1 -0
- package/dist/metacognition/skills.js +220 -0
- package/dist/metacognition/skills.js.map +1 -0
- package/dist/metacognition/state.d.ts +110 -0
- package/dist/metacognition/state.d.ts.map +1 -0
- package/dist/metacognition/state.js +52 -0
- package/dist/metacognition/state.js.map +1 -0
- package/dist/metacognition/validation.d.ts +19 -0
- package/dist/metacognition/validation.d.ts.map +1 -0
- package/dist/metacognition/validation.js +58 -0
- package/dist/metacognition/validation.js.map +1 -0
- package/dist/metacognition/verification.d.ts +93 -0
- package/dist/metacognition/verification.d.ts.map +1 -0
- package/dist/metacognition/verification.js +132 -0
- package/dist/metacognition/verification.js.map +1 -0
- package/dist/metacognition/verifier.d.ts +49 -0
- package/dist/metacognition/verifier.d.ts.map +1 -0
- package/dist/metacognition/verifier.js +88 -0
- package/dist/metacognition/verifier.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +2 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +42 -26
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/chat-container.d.ts +7 -0
- package/dist/modes/interactive/components/chat-container.d.ts.map +1 -0
- package/dist/modes/interactive/components/chat-container.js +14 -0
- package/dist/modes/interactive/components/chat-container.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +4 -2
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +0 -1
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-async-search.d.ts +33 -0
- package/dist/modes/interactive/components/session-selector-async-search.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-async-search.js +109 -0
- package/dist/modes/interactive/components/session-selector-async-search.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-loaders.d.ts +6 -0
- package/dist/modes/interactive/components/session-selector-loaders.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-loaders.js +9 -0
- package/dist/modes/interactive/components/session-selector-loaders.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-tree.d.ts +16 -0
- package/dist/modes/interactive/components/session-selector-tree.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-tree.js +46 -0
- package/dist/modes/interactive/components/session-selector-tree.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +6 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +36 -76
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution-images.d.ts +32 -0
- package/dist/modes/interactive/components/tool-execution-images.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution-images.js +144 -0
- package/dist/modes/interactive/components/tool-execution-images.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +3 -4
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +22 -71
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +7 -9
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/tui-diagnostics.d.ts +8 -4
- package/dist/modes/interactive/tui-diagnostics.d.ts.map +1 -1
- package/dist/modes/interactive/tui-diagnostics.js +35 -1
- package/dist/modes/interactive/tui-diagnostics.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +14 -17
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-response.d.ts +5 -0
- package/dist/modes/rpc/rpc-response.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-response.js +17 -0
- package/dist/modes/rpc/rpc-response.js.map +1 -0
- package/dist/observation/identity.d.ts +14 -0
- package/dist/observation/identity.d.ts.map +1 -0
- package/dist/observation/identity.js +29 -0
- package/dist/observation/identity.js.map +1 -0
- package/dist/observation/index.d.ts +13 -0
- package/dist/observation/index.d.ts.map +1 -0
- package/dist/observation/index.js +13 -0
- package/dist/observation/index.js.map +1 -0
- package/dist/observation/observe-mode.d.ts +46 -0
- package/dist/observation/observe-mode.d.ts.map +1 -0
- package/dist/observation/observe-mode.js +83 -0
- package/dist/observation/observe-mode.js.map +1 -0
- package/dist/observation/store.d.ts +53 -0
- package/dist/observation/store.d.ts.map +1 -0
- package/dist/observation/store.js +126 -0
- package/dist/observation/store.js.map +1 -0
- package/dist/observation/types.d.ts +72 -0
- package/dist/observation/types.d.ts.map +1 -0
- package/dist/observation/types.js +9 -0
- package/dist/observation/types.js.map +1 -0
- package/dist/observation/view.d.ts +39 -0
- package/dist/observation/view.d.ts.map +1 -0
- package/dist/observation/view.js +173 -0
- package/dist/observation/view.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js +2 -3
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +3 -5
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/adaptorch-preview-spec.md +7 -7
- package/docs/atomic-commit-planning.md +69 -0
- package/docs/compaction.md +26 -1
- package/docs/extensions.md +14 -0
- package/docs/mcp.md +22 -0
- package/docs/metacognition.md +130 -0
- package/docs/model-catalog-refresh.md +218 -1
- package/docs/models.md +1 -1
- package/docs/providers.md +53 -0
- package/docs/runtime-algorithms.md +156 -7
- package/docs/session-format.md +8 -0
- package/docs/sessions.md +19 -0
- package/docs/skills.md +19 -0
- package/docs/terminal-setup.md +15 -0
- package/docs/tui.md +41 -0
- package/docs/verified-run-safety.md +75 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/doom-overlay/wad-finder.ts +7 -3
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +18 -18
- package/package.json +6 -8
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { acquireSessionOwnerLeaseSync } from "../session-owner-lease.js";
|
|
3
|
+
import { openRunAuthority } from "./authority-runtime.js";
|
|
4
|
+
import { loadCandidate } from "./candidate.js";
|
|
5
|
+
import { GitOperationBudget } from "./git-execution.js";
|
|
6
|
+
import { assertGitWorkspaceRoot, casRef, GitRefCasError, OMK_ACCEPTED_REF, objectExists, repoObjectFormat, resolveRef, sealCandidateCommit, zeroOid, } from "./git-plumbing.js";
|
|
7
|
+
import { journalPath, VerifiedRunJournal } from "./journal.js";
|
|
8
|
+
import { assertPublishable } from "./publish-preflight.js";
|
|
9
|
+
import { assertPublishEffectStart } from "./publish-start.js";
|
|
10
|
+
import { requireRunJournal } from "./recovery-command.js";
|
|
11
|
+
import { digestObject, VerifiedRunError } from "./storage.js";
|
|
12
|
+
export { OMK_ACCEPTED_REF };
|
|
13
|
+
export { publishPolicyDigest } from "./publish-preflight.js";
|
|
14
|
+
function openPublishIntents(journal) {
|
|
15
|
+
return journal.records.flatMap(({ event }) => (event.kind === "publish_intent" ? [event] : []));
|
|
16
|
+
}
|
|
17
|
+
function terminalFor(journal, commandId) {
|
|
18
|
+
return journal.records.some(({ event }) => (event.kind === "published" || event.kind === "publish_failed") && event.commandId === commandId);
|
|
19
|
+
}
|
|
20
|
+
export function publishDisposition(journal, command) {
|
|
21
|
+
const first = journal.records[0]?.event;
|
|
22
|
+
if (first?.kind !== "created" ||
|
|
23
|
+
first.contract.runId !== command.runId ||
|
|
24
|
+
digestObject(first.contract) !== command.contractDigest)
|
|
25
|
+
throw new VerifiedRunError("command_conflict");
|
|
26
|
+
if (first.command.commandId === command.commandId)
|
|
27
|
+
throw new VerifiedRunError("command_conflict");
|
|
28
|
+
const own = openPublishIntents(journal).find((event) => event.commandId === command.commandId);
|
|
29
|
+
if (own) {
|
|
30
|
+
if (own.candidateDigest !== command.candidateDigest ||
|
|
31
|
+
own.parentOid !== command.parentOid ||
|
|
32
|
+
own.receiptDigest !== command.receiptDigest ||
|
|
33
|
+
own.policyDigest !== command.policyDigest)
|
|
34
|
+
throw new VerifiedRunError("command_conflict");
|
|
35
|
+
return terminalFor(journal, command.commandId) ? "completed" : "resume";
|
|
36
|
+
}
|
|
37
|
+
if (command.expectedRevision !== journal.state.revision || command.expectedGeneration !== journal.state.generation)
|
|
38
|
+
throw new VerifiedRunError("stale_revision");
|
|
39
|
+
if (journal.state.publication === "intent")
|
|
40
|
+
throw new VerifiedRunError("reconciliation_required");
|
|
41
|
+
if (journal.state.publication === "accepted")
|
|
42
|
+
throw new VerifiedRunError("already_published");
|
|
43
|
+
return "new";
|
|
44
|
+
}
|
|
45
|
+
export function publishVerifiedRun(runPath, command, options = {}) {
|
|
46
|
+
const initial = requireRunJournal(runPath);
|
|
47
|
+
if (publishDisposition(initial, command) === "completed")
|
|
48
|
+
return initial.state;
|
|
49
|
+
if (options.signal?.aborted)
|
|
50
|
+
throw new VerifiedRunError("cancelled");
|
|
51
|
+
const owner = acquireSessionOwnerLeaseSync(journalPath(runPath));
|
|
52
|
+
let opened = null;
|
|
53
|
+
try {
|
|
54
|
+
const snapshot = requireRunJournal(runPath);
|
|
55
|
+
if (publishDisposition(snapshot, command) === "completed")
|
|
56
|
+
return snapshot.state;
|
|
57
|
+
if (!options.authority)
|
|
58
|
+
opened = openRunAuthority(runPath);
|
|
59
|
+
const authority = options.authority ?? opened;
|
|
60
|
+
if (!authority)
|
|
61
|
+
throw new VerifiedRunError("authority");
|
|
62
|
+
const journal = new VerifiedRunJournal(runPath, owner);
|
|
63
|
+
return executePublish(runPath, snapshot, journal, command, options, authority);
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
try {
|
|
67
|
+
opened?.store.release();
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
owner.release();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export function recordPublished(journal, command, candidateOid) {
|
|
75
|
+
return journal.append({
|
|
76
|
+
kind: "published",
|
|
77
|
+
commandId: command.commandId,
|
|
78
|
+
candidateOid,
|
|
79
|
+
previousOid: command.parentOid,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function executePublish(runPath, snapshot, journal, command, options, authority) {
|
|
83
|
+
const budget = new GitOperationBudget({ signal: options.signal, timeoutMs: options.timeoutMs ?? 60_000 });
|
|
84
|
+
budget.remaining();
|
|
85
|
+
const { contract, state } = assertPublishable(snapshot, command, runPath);
|
|
86
|
+
const repoRoot = realpathSync(contract.workspace.root);
|
|
87
|
+
assertGitWorkspaceRoot(repoRoot, budget);
|
|
88
|
+
const zero = zeroOid(repoObjectFormat(repoRoot, budget));
|
|
89
|
+
if (command.parentOid.length !== zero.length)
|
|
90
|
+
throw new VerifiedRunError("invalid_binding");
|
|
91
|
+
const resumed = state.publication === "intent" && state.publicationCommandId === command.commandId;
|
|
92
|
+
// Recovery observes the existing ref; it does not restart a terminal/unknown effect.
|
|
93
|
+
if (resumed) {
|
|
94
|
+
const sealed = state.publicationCandidateOid;
|
|
95
|
+
if (!sealed)
|
|
96
|
+
throw new VerifiedRunError("invalid_binding");
|
|
97
|
+
const observed = resolveRef(repoRoot, OMK_ACCEPTED_REF, budget);
|
|
98
|
+
if (observed === sealed && objectExists(repoRoot, sealed, budget))
|
|
99
|
+
return recordPublished(journal, command, sealed);
|
|
100
|
+
if ((observed ?? zero) !== command.parentOid)
|
|
101
|
+
return journal.append({
|
|
102
|
+
kind: "publish_failed",
|
|
103
|
+
commandId: command.commandId,
|
|
104
|
+
code: "reconciliation-required",
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
budget.remaining();
|
|
108
|
+
const refClaims = [
|
|
109
|
+
{
|
|
110
|
+
namespace: "git-ref",
|
|
111
|
+
instanceId: "verified-run",
|
|
112
|
+
canonicalKey: `omk-accepted-ref/${digestObject(repoRoot).slice(0, 16)}`,
|
|
113
|
+
access: "write",
|
|
114
|
+
generation: String(state.generation),
|
|
115
|
+
},
|
|
116
|
+
];
|
|
117
|
+
const admission = authority.store.acquire({
|
|
118
|
+
sessionId: authority.sessionId,
|
|
119
|
+
incarnation: authority.incarnation,
|
|
120
|
+
commandId: command.commandId,
|
|
121
|
+
intentDigest: digestObject({
|
|
122
|
+
candidateDigest: command.candidateDigest,
|
|
123
|
+
parentOid: command.parentOid,
|
|
124
|
+
receiptDigest: command.receiptDigest,
|
|
125
|
+
policyDigest: command.policyDigest,
|
|
126
|
+
targetRef: OMK_ACCEPTED_REF,
|
|
127
|
+
}),
|
|
128
|
+
claims: refClaims,
|
|
129
|
+
now: Date.now(),
|
|
130
|
+
ttl: 60_000,
|
|
131
|
+
});
|
|
132
|
+
if (admission.status !== "granted")
|
|
133
|
+
throw new VerifiedRunError("authority_blocked");
|
|
134
|
+
const token = admission.token;
|
|
135
|
+
// Failure here must not settle somebody else's running/quarantined grant.
|
|
136
|
+
assertPublishEffectStart(authority.store, token, refClaims, admission.duplicate);
|
|
137
|
+
let uncertain = false;
|
|
138
|
+
try {
|
|
139
|
+
budget.remaining();
|
|
140
|
+
const candidate = loadCandidate(runPath, state.candidateDigest, contract.budget);
|
|
141
|
+
const candidateOid = sealCandidateCommit(repoRoot, {
|
|
142
|
+
manifest: candidate.manifest,
|
|
143
|
+
contents: candidate.contents,
|
|
144
|
+
parentOid: command.parentOid,
|
|
145
|
+
zeroOid: zero,
|
|
146
|
+
runId: contract.runId,
|
|
147
|
+
candidateDigest: state.candidateDigest,
|
|
148
|
+
receiptDigest: state.receiptDigest,
|
|
149
|
+
}, budget);
|
|
150
|
+
if (resumed) {
|
|
151
|
+
if (state.publicationCandidateOid !== candidateOid)
|
|
152
|
+
throw new VerifiedRunError("invalid_binding");
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
journal.append({
|
|
156
|
+
kind: "publish_intent",
|
|
157
|
+
commandId: command.commandId,
|
|
158
|
+
candidateDigest: state.candidateDigest,
|
|
159
|
+
candidateOid,
|
|
160
|
+
parentOid: command.parentOid,
|
|
161
|
+
targetRef: OMK_ACCEPTED_REF,
|
|
162
|
+
receiptDigest: state.receiptDigest,
|
|
163
|
+
policyDigest: command.policyDigest,
|
|
164
|
+
generation: state.generation,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
const observed = resolveRef(repoRoot, OMK_ACCEPTED_REF, budget);
|
|
168
|
+
if (observed === candidateOid && objectExists(repoRoot, candidateOid, budget))
|
|
169
|
+
return recordPublished(journal, command, candidateOid);
|
|
170
|
+
if ((observed ?? zero) !== command.parentOid)
|
|
171
|
+
return journal.append({
|
|
172
|
+
kind: "publish_failed",
|
|
173
|
+
commandId: command.commandId,
|
|
174
|
+
code: resumed ? "reconciliation-required" : "stale-parent",
|
|
175
|
+
});
|
|
176
|
+
budget.remaining();
|
|
177
|
+
if (!authority.store.effectAuthorized(token, refClaims))
|
|
178
|
+
throw new VerifiedRunError("authority");
|
|
179
|
+
try {
|
|
180
|
+
casRef(repoRoot, OMK_ACCEPTED_REF, candidateOid, command.parentOid, budget);
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
if (!(error instanceof GitRefCasError))
|
|
184
|
+
throw error;
|
|
185
|
+
const recoveryBudget = new GitOperationBudget({ timeoutMs: 5_000 });
|
|
186
|
+
const after = resolveRef(repoRoot, OMK_ACCEPTED_REF, recoveryBudget);
|
|
187
|
+
if (after === candidateOid && objectExists(repoRoot, candidateOid, recoveryBudget))
|
|
188
|
+
return recordPublished(journal, command, candidateOid);
|
|
189
|
+
return journal.append({
|
|
190
|
+
kind: "publish_failed",
|
|
191
|
+
commandId: command.commandId,
|
|
192
|
+
code: after === observed ? "ref-rejected" : resumed ? "reconciliation-required" : "stale-parent",
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
// Once CAS succeeded, cancellation must not undo the committed publication.
|
|
196
|
+
options.afterCas?.();
|
|
197
|
+
return recordPublished(journal, command, candidateOid);
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
uncertain = error instanceof VerifiedRunError && error.code === "git_outcome_unknown";
|
|
201
|
+
throw error;
|
|
202
|
+
}
|
|
203
|
+
finally {
|
|
204
|
+
if (uncertain)
|
|
205
|
+
authority.store.cancel(token);
|
|
206
|
+
else
|
|
207
|
+
authority.store.confirmTerminated(token);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=run-publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-publish.js","sourceRoot":"","sources":["../../../src/core/verified-run/run-publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAqB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACN,sBAAsB,EACtB,MAAM,EACN,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,OAAO,GACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAwB,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AA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AAE,OAAO,EAAE,YAAY,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,SAAS,GAAG,KAAK,YAAY,gBAAgB,IAAI,KAAK,CAAC,IAAI,KAAK,qBAAqB,CAAC;QACtF,MAAM,KAAK,CAAC;IACb,CAAC;YAAS,CAAC;QACV,IAAI,SAAS;YAAE,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;;YACxC,SAAS,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;AAAA,CACD","sourcesContent":["import { realpathSync } from \"node:fs\";\nimport type { RunPublishCommand } from \"omk-protocol\";\nimport { acquireSessionOwnerLeaseSync } from \"../session-owner-lease.ts\";\nimport { openRunAuthority, type RunAuthority } from \"./authority-runtime.ts\";\nimport { loadCandidate } from \"./candidate.ts\";\nimport { GitOperationBudget } from \"./git-execution.ts\";\nimport {\n\tassertGitWorkspaceRoot,\n\tcasRef,\n\tGitRefCasError,\n\tOMK_ACCEPTED_REF,\n\tobjectExists,\n\trepoObjectFormat,\n\tresolveRef,\n\tsealCandidateCommit,\n\tzeroOid,\n} from \"./git-plumbing.ts\";\nimport { type JournalSnapshot, journalPath, VerifiedRunJournal } from \"./journal.ts\";\nimport { assertPublishable } from \"./publish-preflight.ts\";\nimport { assertPublishEffectStart } from \"./publish-start.ts\";\nimport { requireRunJournal } from \"./recovery-command.ts\";\nimport type { RunEvent, RunProjection } from \"./run-types.ts\";\nimport { digestObject, VerifiedRunError } from \"./storage.ts\";\nexport { OMK_ACCEPTED_REF };\nexport { publishPolicyDigest } from \"./publish-preflight.ts\";\n\ntype PublishIntent = Extract<RunEvent, { kind: \"publish_intent\" }>;\nfunction openPublishIntents(journal: JournalSnapshot): readonly PublishIntent[] {\n\treturn journal.records.flatMap(({ event }) => (event.kind === \"publish_intent\" ? [event] : []));\n}\nfunction terminalFor(journal: JournalSnapshot, commandId: string): boolean {\n\treturn journal.records.some(\n\t\t({ event }) => (event.kind === \"published\" || event.kind === \"publish_failed\") && event.commandId === commandId,\n\t);\n}\nexport function publishDisposition(\n\tjournal: JournalSnapshot,\n\tcommand: RunPublishCommand,\n): \"completed\" | \"resume\" | \"new\" {\n\tconst first = journal.records[0]?.event;\n\tif (\n\t\tfirst?.kind !== \"created\" ||\n\t\tfirst.contract.runId !== command.runId ||\n\t\tdigestObject(first.contract) !== command.contractDigest\n\t)\n\t\tthrow new VerifiedRunError(\"command_conflict\");\n\tif (first.command.commandId === command.commandId) throw new VerifiedRunError(\"command_conflict\");\n\tconst own = openPublishIntents(journal).find((event) => event.commandId === command.commandId);\n\tif (own) {\n\t\tif (\n\t\t\town.candidateDigest !== command.candidateDigest ||\n\t\t\town.parentOid !== command.parentOid ||\n\t\t\town.receiptDigest !== command.receiptDigest ||\n\t\t\town.policyDigest !== command.policyDigest\n\t\t)\n\t\t\tthrow new VerifiedRunError(\"command_conflict\");\n\t\treturn terminalFor(journal, command.commandId) ? \"completed\" : \"resume\";\n\t}\n\tif (command.expectedRevision !== journal.state.revision || command.expectedGeneration !== journal.state.generation)\n\t\tthrow new VerifiedRunError(\"stale_revision\");\n\tif (journal.state.publication === \"intent\") throw new VerifiedRunError(\"reconciliation_required\");\n\tif (journal.state.publication === \"accepted\") throw new VerifiedRunError(\"already_published\");\n\treturn \"new\";\n}\n\nexport interface PublishOptions {\n\t/** Fault injection after a successful CAS, before the result record. */\n\treadonly afterCas?: () => void;\n\treadonly signal?: AbortSignal;\n\t/** One monotonic deadline shared by all Git writes, never replenished per file. */\n\treadonly timeoutMs?: number;\n\treadonly authority?: RunAuthority;\n}\n\nexport function publishVerifiedRun(\n\trunPath: string,\n\tcommand: RunPublishCommand,\n\toptions: PublishOptions = {},\n): RunProjection {\n\tconst initial = requireRunJournal(runPath);\n\tif (publishDisposition(initial, command) === \"completed\") return initial.state;\n\tif (options.signal?.aborted) throw new VerifiedRunError(\"cancelled\");\n\tconst owner = acquireSessionOwnerLeaseSync(journalPath(runPath));\n\tlet opened: RunAuthority | null = null;\n\ttry {\n\t\tconst snapshot = requireRunJournal(runPath);\n\t\tif (publishDisposition(snapshot, command) === \"completed\") return snapshot.state;\n\t\tif (!options.authority) opened = openRunAuthority(runPath);\n\t\tconst authority = options.authority ?? opened;\n\t\tif (!authority) throw new VerifiedRunError(\"authority\");\n\t\tconst journal = new VerifiedRunJournal(runPath, owner);\n\t\treturn executePublish(runPath, snapshot, journal, command, options, authority);\n\t} finally {\n\t\ttry {\n\t\t\topened?.store.release();\n\t\t} finally {\n\t\t\towner.release();\n\t\t}\n\t}\n}\n\nexport function recordPublished(\n\tjournal: VerifiedRunJournal,\n\tcommand: RunPublishCommand,\n\tcandidateOid: string,\n): RunProjection {\n\treturn journal.append({\n\t\tkind: \"published\",\n\t\tcommandId: command.commandId,\n\t\tcandidateOid,\n\t\tpreviousOid: command.parentOid,\n\t});\n}\n\nfunction executePublish(\n\trunPath: string,\n\tsnapshot: JournalSnapshot,\n\tjournal: VerifiedRunJournal,\n\tcommand: RunPublishCommand,\n\toptions: PublishOptions,\n\tauthority: RunAuthority,\n): RunProjection {\n\tconst budget = new GitOperationBudget({ signal: options.signal, timeoutMs: options.timeoutMs ?? 60_000 });\n\tbudget.remaining();\n\tconst { contract, state } = assertPublishable(snapshot, command, runPath);\n\tconst repoRoot = realpathSync(contract.workspace.root);\n\tassertGitWorkspaceRoot(repoRoot, budget);\n\tconst zero = zeroOid(repoObjectFormat(repoRoot, budget));\n\tif (command.parentOid.length !== zero.length) throw new VerifiedRunError(\"invalid_binding\");\n\tconst resumed = state.publication === \"intent\" && state.publicationCommandId === command.commandId;\n\t// Recovery observes the existing ref; it does not restart a terminal/unknown effect.\n\tif (resumed) {\n\t\tconst sealed = state.publicationCandidateOid;\n\t\tif (!sealed) throw new VerifiedRunError(\"invalid_binding\");\n\t\tconst observed = resolveRef(repoRoot, OMK_ACCEPTED_REF, budget);\n\t\tif (observed === sealed && objectExists(repoRoot, sealed, budget))\n\t\t\treturn recordPublished(journal, command, sealed);\n\t\tif ((observed ?? zero) !== command.parentOid)\n\t\t\treturn journal.append({\n\t\t\t\tkind: \"publish_failed\",\n\t\t\t\tcommandId: command.commandId,\n\t\t\t\tcode: \"reconciliation-required\",\n\t\t\t});\n\t}\n\tbudget.remaining();\n\tconst refClaims = [\n\t\t{\n\t\t\tnamespace: \"git-ref\",\n\t\t\tinstanceId: \"verified-run\",\n\t\t\tcanonicalKey: `omk-accepted-ref/${digestObject(repoRoot).slice(0, 16)}`,\n\t\t\taccess: \"write\",\n\t\t\tgeneration: String(state.generation),\n\t\t},\n\t];\n\tconst admission = authority.store.acquire({\n\t\tsessionId: authority.sessionId,\n\t\tincarnation: authority.incarnation,\n\t\tcommandId: command.commandId,\n\t\tintentDigest: digestObject({\n\t\t\tcandidateDigest: command.candidateDigest,\n\t\t\tparentOid: command.parentOid,\n\t\t\treceiptDigest: command.receiptDigest,\n\t\t\tpolicyDigest: command.policyDigest,\n\t\t\ttargetRef: OMK_ACCEPTED_REF,\n\t\t}),\n\t\tclaims: refClaims,\n\t\tnow: Date.now(),\n\t\tttl: 60_000,\n\t});\n\tif (admission.status !== \"granted\") throw new VerifiedRunError(\"authority_blocked\");\n\tconst token = admission.token;\n\t// Failure here must not settle somebody else's running/quarantined grant.\n\tassertPublishEffectStart(authority.store, token, refClaims, admission.duplicate);\n\tlet uncertain = false;\n\ttry {\n\t\tbudget.remaining();\n\t\tconst candidate = loadCandidate(runPath, state.candidateDigest, contract.budget);\n\t\tconst candidateOid = sealCandidateCommit(\n\t\t\trepoRoot,\n\t\t\t{\n\t\t\t\tmanifest: candidate.manifest,\n\t\t\t\tcontents: candidate.contents,\n\t\t\t\tparentOid: command.parentOid,\n\t\t\t\tzeroOid: zero,\n\t\t\t\trunId: contract.runId,\n\t\t\t\tcandidateDigest: state.candidateDigest,\n\t\t\t\treceiptDigest: state.receiptDigest,\n\t\t\t},\n\t\t\tbudget,\n\t\t);\n\t\tif (resumed) {\n\t\t\tif (state.publicationCandidateOid !== candidateOid) throw new VerifiedRunError(\"invalid_binding\");\n\t\t} else {\n\t\t\tjournal.append({\n\t\t\t\tkind: \"publish_intent\",\n\t\t\t\tcommandId: command.commandId,\n\t\t\t\tcandidateDigest: state.candidateDigest,\n\t\t\t\tcandidateOid,\n\t\t\t\tparentOid: command.parentOid,\n\t\t\t\ttargetRef: OMK_ACCEPTED_REF,\n\t\t\t\treceiptDigest: state.receiptDigest,\n\t\t\t\tpolicyDigest: command.policyDigest,\n\t\t\t\tgeneration: state.generation,\n\t\t\t});\n\t\t}\n\t\tconst observed = resolveRef(repoRoot, OMK_ACCEPTED_REF, budget);\n\t\tif (observed === candidateOid && objectExists(repoRoot, candidateOid, budget))\n\t\t\treturn recordPublished(journal, command, candidateOid);\n\t\tif ((observed ?? zero) !== command.parentOid)\n\t\t\treturn journal.append({\n\t\t\t\tkind: \"publish_failed\",\n\t\t\t\tcommandId: command.commandId,\n\t\t\t\tcode: resumed ? \"reconciliation-required\" : \"stale-parent\",\n\t\t\t});\n\t\tbudget.remaining();\n\t\tif (!authority.store.effectAuthorized(token, refClaims)) throw new VerifiedRunError(\"authority\");\n\t\ttry {\n\t\t\tcasRef(repoRoot, OMK_ACCEPTED_REF, candidateOid, command.parentOid, budget);\n\t\t} catch (error) {\n\t\t\tif (!(error instanceof GitRefCasError)) throw error;\n\t\t\tconst recoveryBudget = new GitOperationBudget({ timeoutMs: 5_000 });\n\t\t\tconst after = resolveRef(repoRoot, OMK_ACCEPTED_REF, recoveryBudget);\n\t\t\tif (after === candidateOid && objectExists(repoRoot, candidateOid, recoveryBudget))\n\t\t\t\treturn recordPublished(journal, command, candidateOid);\n\t\t\treturn journal.append({\n\t\t\t\tkind: \"publish_failed\",\n\t\t\t\tcommandId: command.commandId,\n\t\t\t\tcode: after === observed ? \"ref-rejected\" : resumed ? \"reconciliation-required\" : \"stale-parent\",\n\t\t\t});\n\t\t}\n\t\t// Once CAS succeeded, cancellation must not undo the committed publication.\n\t\toptions.afterCas?.();\n\t\treturn recordPublished(journal, command, candidateOid);\n\t} catch (error) {\n\t\tuncertain = error instanceof VerifiedRunError && error.code === \"git_outcome_unknown\";\n\t\tthrow error;\n\t} finally {\n\t\tif (uncertain) authority.store.cancel(token);\n\t\telse authority.store.confirmTerminated(token);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AuthorityStatus, RunStatus } from "./run-status.ts";
|
|
2
|
+
/** A published ref and a terminated execution owner are independent observations. */
|
|
3
|
+
export declare function withOwnedGitStatus(status: RunStatus, authority: AuthorityStatus): RunStatus;
|
|
4
|
+
//# sourceMappingURL=run-status-owned.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-status-owned.d.ts","sourceRoot":"","sources":["../../../src/core/verified-run/run-status-owned.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAElE,qFAAqF;AACrF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,GAAG,SAAS,CAY3F","sourcesContent":["import type { AuthorityStatus, RunStatus } from \"./run-status.ts\";\n\n/** A published ref and a terminated execution owner are independent observations. */\nexport function withOwnedGitStatus(status: RunStatus, authority: AuthorityStatus): RunStatus {\n\tconst pending = authority.blockingGrants.filter(\n\t\t(grant) => grant.sessionId === status.runId && grant.claims.some((claim) => claim.namespace === \"git-ref\"),\n\t).length;\n\tif (pending === 0) return status;\n\treturn Object.freeze({\n\t\t...status,\n\t\tcleanSuccess: false,\n\t\tterminal: false,\n\t\tpendingEffects: status.pendingEffects + pending,\n\t\tunresolved: Object.freeze([...new Set([...status.unresolved, \"pending_effects\" as const])]),\n\t});\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** A published ref and a terminated execution owner are independent observations. */
|
|
2
|
+
export function withOwnedGitStatus(status, authority) {
|
|
3
|
+
const pending = authority.blockingGrants.filter((grant) => grant.sessionId === status.runId && grant.claims.some((claim) => claim.namespace === "git-ref")).length;
|
|
4
|
+
if (pending === 0)
|
|
5
|
+
return status;
|
|
6
|
+
return Object.freeze({
|
|
7
|
+
...status,
|
|
8
|
+
cleanSuccess: false,
|
|
9
|
+
terminal: false,
|
|
10
|
+
pendingEffects: status.pendingEffects + pending,
|
|
11
|
+
unresolved: Object.freeze([...new Set([...status.unresolved, "pending_effects"])]),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=run-status-owned.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-status-owned.js","sourceRoot":"","sources":["../../../src/core/verified-run/run-status-owned.ts"],"names":[],"mappings":"AAEA,qFAAqF;AACrF,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,SAA0B,EAAa;IAC5F,MAAM,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAC9C,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,KAAK,MAAM,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAC1G,CAAC,MAAM,CAAC;IACT,IAAI,OAAO,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IACjC,OAAO,MAAM,CAAC,MAAM,CAAC;QACpB,GAAG,MAAM;QACT,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;QACf,cAAc,EAAE,MAAM,CAAC,cAAc,GAAG,OAAO;QAC/C,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,EAAE,iBAA0B,CAAC,CAAC,CAAC,CAAC;KAC3F,CAAC,CAAC;AAAA,CACH","sourcesContent":["import type { AuthorityStatus, RunStatus } from \"./run-status.ts\";\n\n/** A published ref and a terminated execution owner are independent observations. */\nexport function withOwnedGitStatus(status: RunStatus, authority: AuthorityStatus): RunStatus {\n\tconst pending = authority.blockingGrants.filter(\n\t\t(grant) => grant.sessionId === status.runId && grant.claims.some((claim) => claim.namespace === \"git-ref\"),\n\t).length;\n\tif (pending === 0) return status;\n\treturn Object.freeze({\n\t\t...status,\n\t\tcleanSuccess: false,\n\t\tterminal: false,\n\t\tpendingEffects: status.pendingEffects + pending,\n\t\tunresolved: Object.freeze([...new Set([...status.unresolved, \"pending_effects\" as const])]),\n\t});\n}\n"]}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { AuthorityEvent, AuthorityGrantRecord, AuthorityProjection } from "./authority-events.ts";
|
|
2
|
+
import type { RunProjection } from "./run-types.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Derived lifecycle/recovery status surfaces (WP06).
|
|
5
|
+
*
|
|
6
|
+
* Everything here is a pure function of the replayed journals: the run
|
|
7
|
+
* projection and the authority projection/records are the single source of
|
|
8
|
+
* truth, and this module never invents parallel status strings — `lifecycle`
|
|
9
|
+
* and `completion` are named projections of the same facts the axes already
|
|
10
|
+
* report (`execution`, `settlement`, `verification`, `application`,
|
|
11
|
+
* `publication`, `failure`, grant states and transition events).
|
|
12
|
+
*
|
|
13
|
+
* Separations the surface guarantees (docs/03, docs/12 WP06):
|
|
14
|
+
* - cancellation requested vs terminated: an authority grant that got
|
|
15
|
+
* `cancel-requested` with a live effect stays `quarantined` and keeps its
|
|
16
|
+
* claims until `termination-observed` witnesses it;
|
|
17
|
+
* - prompt settled vs verified vs published: `completion` is a three-tier
|
|
18
|
+
* ladder (`prompt_settled` < `verification_passed` < `published`) derived
|
|
19
|
+
* from candidate/receipt/publication facts, never from prose;
|
|
20
|
+
* - accepted vs published: `lifecycle: "accepted"` is the verified,
|
|
21
|
+
* publishable state; `published` requires the CAS result record;
|
|
22
|
+
* - recovery/unknown states vs clean success: `cleanSuccess` is true only
|
|
23
|
+
* for a terminal run with an empty `unresolved` list — quarantine,
|
|
24
|
+
* unverified termination, a refused or half-published outbox entry and a
|
|
25
|
+
* violated check set all stay visible instead of collapsing into success.
|
|
26
|
+
*/
|
|
27
|
+
/** Single-token lifecycle derived from the run axes; snake_case matches the projection vocabulary. */
|
|
28
|
+
export type RunLifecycle = "queued" | "running" | "verifying" | "resuming" | "blocked" | "accepted" | "published" | "violated" | "cancelled" | "failed" | "quarantined";
|
|
29
|
+
/** User-visible completion ladder: prompt-settled < verification-passed < published (docs/03 §10). */
|
|
30
|
+
export type RunCompletion = "none" | "prompt_settled" | "verification_passed" | "published";
|
|
31
|
+
/** Machine-collected open concerns; a clean terminal run carries none. */
|
|
32
|
+
export type RunUnresolved = "pending_effects" | "verification_pending" | "verification_violated" | "publication_intent" | "publication_refused" | "publication_reconciliation_required";
|
|
33
|
+
export interface RunRecoveryCommand {
|
|
34
|
+
/** The recovery CLI verb to run. */
|
|
35
|
+
readonly command: "resume" | "retry_tasks" | "restart_writer" | "publish";
|
|
36
|
+
/** Exact target identity the command must name. */
|
|
37
|
+
readonly runId: string;
|
|
38
|
+
readonly revision: number;
|
|
39
|
+
readonly generation: number;
|
|
40
|
+
/** Scope: candidate/base digests or task ids the command binds. */
|
|
41
|
+
readonly scope: {
|
|
42
|
+
readonly candidateDigest?: string;
|
|
43
|
+
readonly baseDigest?: string;
|
|
44
|
+
readonly taskIds?: readonly string[];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Projection-level eligibility only — deadline, clock and namespace
|
|
48
|
+
* readiness are host-checked by `inspectRecovery`/`inspectWriterRecovery`/
|
|
49
|
+
* `inspectTaskRecovery`; this hint never claims the command will succeed.
|
|
50
|
+
*/
|
|
51
|
+
readonly advisory: true;
|
|
52
|
+
}
|
|
53
|
+
export interface RunStatus {
|
|
54
|
+
readonly runId: string;
|
|
55
|
+
readonly revision: number;
|
|
56
|
+
readonly generation: number;
|
|
57
|
+
readonly lifecycle: RunLifecycle;
|
|
58
|
+
readonly completion: RunCompletion;
|
|
59
|
+
/** True only for a terminal run that reached verification_passed/published with zero unresolved concerns. */
|
|
60
|
+
readonly cleanSuccess: boolean;
|
|
61
|
+
readonly terminal: boolean;
|
|
62
|
+
readonly unresolved: readonly RunUnresolved[];
|
|
63
|
+
/** Verbatim axes, same strings the journal projection computes. */
|
|
64
|
+
readonly execution: RunProjection["execution"];
|
|
65
|
+
readonly settlement: RunProjection["settlement"];
|
|
66
|
+
readonly verification: RunProjection["verification"];
|
|
67
|
+
readonly application: RunProjection["application"];
|
|
68
|
+
readonly publication: {
|
|
69
|
+
readonly state: RunProjection["publication"];
|
|
70
|
+
readonly commandId: string | null;
|
|
71
|
+
readonly candidateOid: string | null;
|
|
72
|
+
readonly ref: string | null;
|
|
73
|
+
readonly failure: string | null;
|
|
74
|
+
};
|
|
75
|
+
/** Failure code as recorded (`descendant_escape`, `termination_unverified`, `cancelled`, …). */
|
|
76
|
+
readonly cause: string | null;
|
|
77
|
+
readonly pendingEffects: number;
|
|
78
|
+
readonly writerOpen: boolean;
|
|
79
|
+
readonly recovery: RunProjection["lastRecovery"];
|
|
80
|
+
readonly recoveryCommands: readonly RunRecoveryCommand[];
|
|
81
|
+
}
|
|
82
|
+
/** Derive the status view; pure projection truth in, status out, no I/O. */
|
|
83
|
+
export declare function deriveRunStatus(state: RunProjection): RunStatus;
|
|
84
|
+
export type AuthorityGrantCause = "cancel_requested" | "authorization_expired" | "restart_unreconciled" | "unwitnessed";
|
|
85
|
+
export interface AuthorityGrantStatus {
|
|
86
|
+
readonly grantSequence: string;
|
|
87
|
+
readonly sessionId: string;
|
|
88
|
+
readonly sessionIncarnation: string;
|
|
89
|
+
readonly authorityEpoch: string;
|
|
90
|
+
readonly commandId: string;
|
|
91
|
+
readonly intentDigest: string;
|
|
92
|
+
/** Verbatim grant state — the authority projection's own vocabulary. */
|
|
93
|
+
readonly state: AuthorityGrantRecord["state"];
|
|
94
|
+
readonly effectLive: boolean;
|
|
95
|
+
/** Claims this grant still holds — what it blocks, with exact scope. */
|
|
96
|
+
readonly claims: readonly {
|
|
97
|
+
readonly namespace: string;
|
|
98
|
+
readonly instanceId: string;
|
|
99
|
+
readonly canonicalKey: string;
|
|
100
|
+
readonly access: string;
|
|
101
|
+
readonly generation: string;
|
|
102
|
+
}[];
|
|
103
|
+
readonly weight: number;
|
|
104
|
+
readonly dispatchId: string | null;
|
|
105
|
+
readonly authorizationDeadline: number;
|
|
106
|
+
/** Why the grant is in this state; null when records were not supplied. */
|
|
107
|
+
readonly cause: AuthorityGrantCause | null;
|
|
108
|
+
/**
|
|
109
|
+
* Cancellation requested vs terminated: true only when a
|
|
110
|
+
* `termination-observed` record witnessed this exact grant.
|
|
111
|
+
*/
|
|
112
|
+
readonly terminationWitnessed: boolean;
|
|
113
|
+
}
|
|
114
|
+
export interface AuthorityStatus {
|
|
115
|
+
readonly epoch: string | null;
|
|
116
|
+
readonly reconciledEpoch: string | null;
|
|
117
|
+
readonly pendingReconcile: boolean;
|
|
118
|
+
/** Grants still holding claims — what is blocking new admission. */
|
|
119
|
+
readonly blockingGrants: readonly AuthorityGrantStatus[];
|
|
120
|
+
readonly settledGrantCount: number;
|
|
121
|
+
readonly tombstoneCount: number;
|
|
122
|
+
readonly incarnations: readonly {
|
|
123
|
+
readonly sessionId: string;
|
|
124
|
+
readonly incarnation: string;
|
|
125
|
+
}[];
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Derive the authority status from the committed projection; pass the journal
|
|
129
|
+
* records' events so quarantine/cancel causes stay distinguishable — the
|
|
130
|
+
* projection alone intentionally does not restate them.
|
|
131
|
+
*/
|
|
132
|
+
export declare function deriveAuthorityStatus(projection: AuthorityProjection, events?: readonly AuthorityEvent[]): AuthorityStatus;
|
|
133
|
+
//# sourceMappingURL=run-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-status.d.ts","sourceRoot":"","sources":["../../../src/core/verified-run/run-status.ts"],"names":[],"mappings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AAM,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,sEAAoE;IACpE,QAAQ,CAAC,cAAc,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACzD,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,SAAS;QAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC/F;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACpC,UAAU,EAAE,mBAAmB,EAC/B,MAAM,GAAE,SAAS,cAAc,EAAO,GACpC,eAAe,CA+DjB","sourcesContent":["import { MAX_VERIFIED_RUN_GENERATIONS } from \"omk-protocol\";\nimport { SETTLED_EFFECT_STATES } from \"../../coordination/types.ts\";\nimport type { AuthorityEvent, AuthorityGrantRecord, AuthorityProjection } from \"./authority-events.ts\";\nimport { authorityPendingReconcile } from \"./authority-events.ts\";\nimport type { RunProjection } from \"./run-types.ts\";\n\n/**\n * Derived lifecycle/recovery status surfaces (WP06).\n *\n * Everything here is a pure function of the replayed journals: the run\n * projection and the authority projection/records are the single source of\n * truth, and this module never invents parallel status strings — `lifecycle`\n * and `completion` are named projections of the same facts the axes already\n * report (`execution`, `settlement`, `verification`, `application`,\n * `publication`, `failure`, grant states and transition events).\n *\n * Separations the surface guarantees (docs/03, docs/12 WP06):\n * - cancellation requested vs terminated: an authority grant that got\n * `cancel-requested` with a live effect stays `quarantined` and keeps its\n * claims until `termination-observed` witnesses it;\n * - prompt settled vs verified vs published: `completion` is a three-tier\n * ladder (`prompt_settled` < `verification_passed` < `published`) derived\n * from candidate/receipt/publication facts, never from prose;\n * - accepted vs published: `lifecycle: \"accepted\"` is the verified,\n * publishable state; `published` requires the CAS result record;\n * - recovery/unknown states vs clean success: `cleanSuccess` is true only\n * for a terminal run with an empty `unresolved` list — quarantine,\n * unverified termination, a refused or half-published outbox entry and a\n * violated check set all stay visible instead of collapsing into success.\n */\n\n/** Single-token lifecycle derived from the run axes; snake_case matches the projection vocabulary. */\nexport type RunLifecycle =\n\t| \"queued\"\n\t| \"running\"\n\t| \"verifying\"\n\t| \"resuming\"\n\t| \"blocked\"\n\t| \"accepted\"\n\t| \"published\"\n\t| \"violated\"\n\t| \"cancelled\"\n\t| \"failed\"\n\t| \"quarantined\";\n\n/** User-visible completion ladder: prompt-settled < verification-passed < published (docs/03 §10). */\nexport type RunCompletion = \"none\" | \"prompt_settled\" | \"verification_passed\" | \"published\";\n\n/** Machine-collected open concerns; a clean terminal run carries none. */\nexport type RunUnresolved =\n\t| \"pending_effects\"\n\t| \"verification_pending\"\n\t| \"verification_violated\"\n\t| \"publication_intent\"\n\t| \"publication_refused\"\n\t| \"publication_reconciliation_required\";\n\nexport interface RunRecoveryCommand {\n\t/** The recovery CLI verb to run. */\n\treadonly command: \"resume\" | \"retry_tasks\" | \"restart_writer\" | \"publish\";\n\t/** Exact target identity the command must name. */\n\treadonly runId: string;\n\treadonly revision: number;\n\treadonly generation: number;\n\t/** Scope: candidate/base digests or task ids the command binds. */\n\treadonly scope: {\n\t\treadonly candidateDigest?: string;\n\t\treadonly baseDigest?: string;\n\t\treadonly taskIds?: readonly string[];\n\t};\n\t/**\n\t * Projection-level eligibility only — deadline, clock and namespace\n\t * readiness are host-checked by `inspectRecovery`/`inspectWriterRecovery`/\n\t * `inspectTaskRecovery`; this hint never claims the command will succeed.\n\t */\n\treadonly advisory: true;\n}\n\nexport interface RunStatus {\n\treadonly runId: string;\n\treadonly revision: number;\n\treadonly generation: number;\n\treadonly lifecycle: RunLifecycle;\n\treadonly completion: RunCompletion;\n\t/** True only for a terminal run that reached verification_passed/published with zero unresolved concerns. */\n\treadonly cleanSuccess: boolean;\n\treadonly terminal: boolean;\n\treadonly unresolved: readonly RunUnresolved[];\n\t/** Verbatim axes, same strings the journal projection computes. */\n\treadonly execution: RunProjection[\"execution\"];\n\treadonly settlement: RunProjection[\"settlement\"];\n\treadonly verification: RunProjection[\"verification\"];\n\treadonly application: RunProjection[\"application\"];\n\treadonly publication: {\n\t\treadonly state: RunProjection[\"publication\"];\n\t\treadonly commandId: string | null;\n\t\treadonly candidateOid: string | null;\n\t\treadonly ref: string | null;\n\t\treadonly failure: string | null;\n\t};\n\t/** Failure code as recorded (`descendant_escape`, `termination_unverified`, `cancelled`, …). */\n\treadonly cause: string | null;\n\treadonly pendingEffects: number;\n\treadonly writerOpen: boolean;\n\treadonly recovery: RunProjection[\"lastRecovery\"];\n\treadonly recoveryCommands: readonly RunRecoveryCommand[];\n}\n\n/** Derive the status view; pure projection truth in, status out, no I/O. */\nexport function deriveRunStatus(state: RunProjection): RunStatus {\n\tconst unresolved: RunUnresolved[] = [];\n\tif (state.activeExecutionIds.length > 0 || state.writerOpen) unresolved.push(\"pending_effects\");\n\tif (state.candidateDigest && !state.receiptDigest && state.execution !== \"failed\" && state.execution !== \"ready\")\n\t\tunresolved.push(\"verification_pending\");\n\tif (state.verification === \"violated\") unresolved.push(\"verification_violated\");\n\tif (state.publication === \"intent\") unresolved.push(\"publication_intent\");\n\tif (state.publication === \"failed\") unresolved.push(\"publication_refused\");\n\tif (state.publication === \"reconciliation_required\") unresolved.push(\"publication_reconciliation_required\");\n\n\tconst completion: RunCompletion =\n\t\tstate.publication === \"accepted\"\n\t\t\t? \"published\"\n\t\t\t: state.verification === \"verified\"\n\t\t\t\t? \"verification_passed\"\n\t\t\t\t: state.candidateDigest\n\t\t\t\t\t? \"prompt_settled\"\n\t\t\t\t\t: \"none\";\n\n\tconst terminal = state.execution === \"succeeded\" || state.execution === \"failed\";\n\tlet lifecycle: RunLifecycle;\n\tif (state.settlement === \"quarantined\") lifecycle = \"quarantined\";\n\telse if (state.execution === \"ready\") lifecycle = \"queued\";\n\telse if (state.execution === \"running\") {\n\t\tif (state.lastRecovery && state.lastRecovery.generation === state.generation) lifecycle = \"resuming\";\n\t\telse if (state.candidateDigest && !state.receiptDigest) lifecycle = \"verifying\";\n\t\telse lifecycle = \"running\";\n\t} else if (state.execution === \"paused\") lifecycle = \"blocked\";\n\telse if (state.execution === \"failed\") lifecycle = state.failure === \"cancelled\" ? \"cancelled\" : \"failed\";\n\telse if (state.verification === \"verified\") lifecycle = state.publication === \"accepted\" ? \"published\" : \"accepted\";\n\telse lifecycle = \"violated\";\n\n\treturn Object.freeze({\n\t\trunId: state.runId,\n\t\trevision: state.revision,\n\t\tgeneration: state.generation,\n\t\tlifecycle,\n\t\tcompletion,\n\t\t// Clean success means the verification ladder actually climbed: a\n\t\t// terminal cancel/failure/violation, or a verified run with an open\n\t\t// publish outbox, never reports clean.\n\t\tcleanSuccess:\n\t\t\tterminal && unresolved.length === 0 && (completion === \"verification_passed\" || completion === \"published\"),\n\t\tterminal,\n\t\tunresolved: Object.freeze(unresolved),\n\t\texecution: state.execution,\n\t\tsettlement: state.settlement,\n\t\tverification: state.verification,\n\t\tapplication: state.application,\n\t\tpublication: Object.freeze({\n\t\t\tstate: state.publication,\n\t\t\tcommandId: state.publicationCommandId,\n\t\t\tcandidateOid: state.publicationCandidateOid,\n\t\t\tref: state.publicationRef,\n\t\t\tfailure: state.publicationFailure,\n\t\t}),\n\t\tcause: state.failure,\n\t\tpendingEffects: state.activeExecutionIds.length,\n\t\twriterOpen: state.writerOpen,\n\t\trecovery: state.lastRecovery,\n\t\trecoveryCommands: Object.freeze(recoveryCommands(state)),\n\t});\n}\n\nfunction recoveryCommands(state: RunProjection): RunRecoveryCommand[] {\n\tconst commands: RunRecoveryCommand[] = [];\n\tif (state.generation >= MAX_VERIFIED_RUN_GENERATIONS) return commands;\n\tconst base = { runId: state.runId, revision: state.revision, generation: state.generation } as const;\n\t// A frozen candidate can be re-verified under a new generation (resume gate\n\t// mirrors `assertCandidateRecoverable`: candidate, no receipt, not failed).\n\tif (\n\t\tstate.candidateDigest &&\n\t\t!state.receiptDigest &&\n\t\t!state.writerOpen &&\n\t\tstate.execution !== \"failed\" &&\n\t\tstate.execution !== \"ready\"\n\t) {\n\t\tcommands.push({\n\t\t\t...base,\n\t\t\tcommand: \"resume\",\n\t\t\tscope: { candidateDigest: state.candidateDigest },\n\t\t\tadvisory: true,\n\t\t});\n\t}\n\t// DAG tasks can be retried from the input checkpoint (retry gate mirrors\n\t// `commandDisposition`: input checkpoint present, tasks exist).\n\tif (state.inputDigest && state.tasks.length > 0) {\n\t\tconst failed = state.tasks\n\t\t\t.filter((task) => task.status === \"failed\" || (task.status === \"pending\" && task.attempt > 0))\n\t\t\t.map((task) => task.taskId);\n\t\tif (failed.length > 0) {\n\t\t\tcommands.push({\n\t\t\t\t...base,\n\t\t\t\tcommand: \"retry_tasks\",\n\t\t\t\tscope: { baseDigest: state.inputDigest, taskIds: Object.freeze(failed) },\n\t\t\t\tadvisory: true,\n\t\t\t});\n\t\t}\n\t}\n\t// A writer that never produced a candidate restarts from the input\n\t// checkpoint (non-DAG profiles only; DAG recovery is retry_tasks).\n\tif (state.inputDigest && !state.candidateDigest && state.tasks.length === 0 && state.execution !== \"ready\") {\n\t\tcommands.push({\n\t\t\t...base,\n\t\t\tcommand: \"restart_writer\",\n\t\t\tscope: { baseDigest: state.inputDigest },\n\t\t\tadvisory: true,\n\t\t});\n\t}\n\t// The publish outbox: a verified, settled run can publish; a refused or\n\t// half-published intent is re-driven by the same command identity.\n\tif (\n\t\tstate.application === \"candidate_ready\" &&\n\t\tstate.settlement === \"settled\" &&\n\t\tstate.receiptDigest &&\n\t\tstate.candidateDigest &&\n\t\t(state.publication === \"none\" || state.publication === \"failed\" || state.publication === \"intent\")\n\t) {\n\t\tcommands.push({\n\t\t\t...base,\n\t\t\tcommand: \"publish\",\n\t\t\tscope: { candidateDigest: state.candidateDigest },\n\t\t\tadvisory: true,\n\t\t});\n\t}\n\treturn commands;\n}\n\nexport type AuthorityGrantCause = \"cancel_requested\" | \"authorization_expired\" | \"restart_unreconciled\" | \"unwitnessed\";\n\nexport interface AuthorityGrantStatus {\n\treadonly grantSequence: string;\n\treadonly sessionId: string;\n\treadonly sessionIncarnation: string;\n\treadonly authorityEpoch: string;\n\treadonly commandId: string;\n\treadonly intentDigest: string;\n\t/** Verbatim grant state — the authority projection's own vocabulary. */\n\treadonly state: AuthorityGrantRecord[\"state\"];\n\treadonly effectLive: boolean;\n\t/** Claims this grant still holds — what it blocks, with exact scope. */\n\treadonly claims: readonly {\n\t\treadonly namespace: string;\n\t\treadonly instanceId: string;\n\t\treadonly canonicalKey: string;\n\t\treadonly access: string;\n\t\treadonly generation: string;\n\t}[];\n\treadonly weight: number;\n\treadonly dispatchId: string | null;\n\treadonly authorizationDeadline: number;\n\t/** Why the grant is in this state; null when records were not supplied. */\n\treadonly cause: AuthorityGrantCause | null;\n\t/**\n\t * Cancellation requested vs terminated: true only when a\n\t * `termination-observed` record witnessed this exact grant.\n\t */\n\treadonly terminationWitnessed: boolean;\n}\n\nexport interface AuthorityStatus {\n\treadonly epoch: string | null;\n\treadonly reconciledEpoch: string | null;\n\treadonly pendingReconcile: boolean;\n\t/** Grants still holding claims — what is blocking new admission. */\n\treadonly blockingGrants: readonly AuthorityGrantStatus[];\n\treadonly settledGrantCount: number;\n\treadonly tombstoneCount: number;\n\treadonly incarnations: readonly { readonly sessionId: string; readonly incarnation: string }[];\n}\n\n/**\n * Derive the authority status from the committed projection; pass the journal\n * records' events so quarantine/cancel causes stay distinguishable — the\n * projection alone intentionally does not restate them.\n */\nexport function deriveAuthorityStatus(\n\tprojection: AuthorityProjection,\n\tevents: readonly AuthorityEvent[] = [],\n): AuthorityStatus {\n\tconst transitionOf = (grantSequence: string): AuthorityGrantCause | null => {\n\t\tfor (let index = events.length - 1; index >= 0; index--) {\n\t\t\tconst event = events[index]!;\n\t\t\tif (event.kind === \"cancel-requested\" && event.grantSequence === grantSequence) return \"cancel_requested\";\n\t\t\tif (event.kind === \"authorization-expired\" && event.grantSequence === grantSequence)\n\t\t\t\treturn \"authorization_expired\";\n\t\t\tif (event.kind === \"quarantined\" && event.grantSequence === grantSequence) return \"restart_unreconciled\";\n\t\t\tif (\n\t\t\t\tevent.kind === \"authority-epoch-advanced\" &&\n\t\t\t\tevent.transitions.some((transition) => transition.grantSequence === grantSequence)\n\t\t\t)\n\t\t\t\treturn \"restart_unreconciled\";\n\t\t}\n\t\treturn null;\n\t};\n\tconst witnessed = new Set(\n\t\tevents.flatMap((event) => (event.kind === \"termination-observed\" ? [event.grantSequence] : [])),\n\t);\n\tconst grants = [...projection.grants.values()];\n\tconst blocking = grants.filter((grant) => !SETTLED_EFFECT_STATES.has(grant.state));\n\treturn Object.freeze({\n\t\tepoch: projection.epoch,\n\t\treconciledEpoch: projection.reconciledEpoch,\n\t\tpendingReconcile: authorityPendingReconcile(projection),\n\t\tblockingGrants: Object.freeze(\n\t\t\tblocking.map((grant) =>\n\t\t\t\tObject.freeze({\n\t\t\t\t\tgrantSequence: grant.token.grantSequence,\n\t\t\t\t\tsessionId: grant.token.sessionId,\n\t\t\t\t\tsessionIncarnation: grant.token.sessionIncarnation,\n\t\t\t\t\tauthorityEpoch: grant.token.authorityEpoch,\n\t\t\t\t\tcommandId: grant.commandId,\n\t\t\t\t\tintentDigest: grant.intentDigest,\n\t\t\t\t\tstate: grant.state,\n\t\t\t\t\teffectLive: grant.effectLive,\n\t\t\t\t\tclaims: Object.freeze(\n\t\t\t\t\t\tgrant.claims.map((claim) =>\n\t\t\t\t\t\t\tObject.freeze({\n\t\t\t\t\t\t\t\tnamespace: claim.namespace,\n\t\t\t\t\t\t\t\tinstanceId: claim.instanceId,\n\t\t\t\t\t\t\t\tcanonicalKey: claim.canonicalKey,\n\t\t\t\t\t\t\t\taccess: claim.access,\n\t\t\t\t\t\t\t\tgeneration: claim.generation,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t\tweight: grant.weight,\n\t\t\t\t\tdispatchId: grant.dispatchId,\n\t\t\t\t\tauthorizationDeadline: grant.token.authorizationDeadline,\n\t\t\t\t\tcause: grant.state === \"quarantined\" ? (transitionOf(grant.token.grantSequence) ?? \"unwitnessed\") : null,\n\t\t\t\t\tterminationWitnessed: witnessed.has(grant.token.grantSequence),\n\t\t\t\t}),\n\t\t\t),\n\t\t),\n\t\tsettledGrantCount: grants.length - blocking.length,\n\t\ttombstoneCount: projection.tombstones.size,\n\t\tincarnations: Object.freeze(\n\t\t\t[...projection.incarnations.entries()].map(([sessionId, incarnation]) =>\n\t\t\t\tObject.freeze({ sessionId, incarnation }),\n\t\t\t),\n\t\t),\n\t});\n}\n"]}
|