@openrig/cli 0.7.15 → 0.7.17
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/README.md +9 -9
- package/daemon/assets/onboarding/02-self-and-competent-action.md +5 -41
- package/daemon/assets/plugins/openrig/.claude-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig/.codex-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig/.cursor-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig/README.md +26 -7
- package/daemon/assets/plugins/openrig/plugin.json +1 -1
- package/daemon/assets/plugins/openrig/skills/working-with-an-openrig-team/SKILL.md +22 -6
- package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +1 -1
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.md +4 -1
- package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +1 -1
- package/daemon/assets/skills/rigs/SKILL.md +155 -41
- package/daemon/assets/skills/rigs/references/installing-for-someone.md +47 -0
- package/daemon/context-packs/help/manifest.yaml +1 -1
- package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
- package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +169 -40
- package/daemon/context-packs/reference/getting-started.md +12 -11
- package/daemon/context-packs/reference/manifest.yaml +4 -1
- package/daemon/context-packs/reference/product-journey-sdlc.md +348 -0
- package/daemon/context-packs/reference/rig-spec.md +92 -4
- package/daemon/context-packs/reference/whats-new.md +397 -5
- package/daemon/context-packs/skills/agent-operated-software/manifest.yaml +1 -1
- package/daemon/context-packs/skills/agent-operated-workflows/manifest.yaml +1 -1
- package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +1 -1
- package/daemon/context-packs/skills/claude-compaction-restore/SKILL.md +4 -1
- package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-software-factory/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-software-factory/references/worked-example.md +1 -1
- package/daemon/context-packs/skills/core/openrig-upgrade/SKILL.md +2 -0
- package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/working-with-an-openrig-team/SKILL.md +22 -6
- package/daemon/context-packs/skills/core/working-with-an-openrig-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/delegating-work/manifest.yaml +1 -1
- package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +1 -1
- package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +1 -1
- package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +1 -1
- package/daemon/context-packs/skills/openrig-user/manifest.yaml +1 -1
- package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/queue-handoff/manifest.yaml +1 -1
- package/daemon/context-packs/skills/refocusing/manifest.yaml +1 -1
- package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +1 -1
- package/daemon/context-packs/skills/seat-continuity-and-handover/SKILL.md +1 -1
- package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +1 -1
- package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +1 -1
- package/daemon/context-packs/skills/software-for-agents/manifest.yaml +1 -1
- package/daemon/context-packs/world-example/manifest.yaml +1 -1
- package/daemon/context-packs/world-public/manifest.yaml +1 -1
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +42 -6
- package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/daemon/dist/adapters/claude-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-resume.js +4 -2
- package/daemon/dist/adapters/claude-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-resume.d.ts +2 -0
- package/daemon/dist/adapters/codex-resume.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-resume.js +28 -11
- package/daemon/dist/adapters/codex-resume.js.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts +15 -0
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +75 -28
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/openshell-driver.d.ts +1 -0
- package/daemon/dist/adapters/openshell-driver.d.ts.map +1 -1
- package/daemon/dist/adapters/openshell-driver.js +3 -0
- package/daemon/dist/adapters/openshell-driver.js.map +1 -1
- package/daemon/dist/adapters/openshell-podman-observer.d.ts +9 -7
- package/daemon/dist/adapters/openshell-podman-observer.d.ts.map +1 -1
- package/daemon/dist/adapters/openshell-podman-observer.js +20 -3
- package/daemon/dist/adapters/openshell-podman-observer.js.map +1 -1
- package/daemon/dist/adapters/pi-runner.d.ts +38 -4
- package/daemon/dist/adapters/pi-runner.d.ts.map +1 -1
- package/daemon/dist/adapters/pi-runner.js +244 -30
- package/daemon/dist/adapters/pi-runner.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +6 -0
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +17 -3
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/build-info.js +3 -3
- package/daemon/dist/db/all-migrations.d.ts.map +1 -1
- package/daemon/dist/db/all-migrations.js +8 -0
- package/daemon/dist/db/all-migrations.js.map +1 -1
- package/daemon/dist/db/migrations/167_seat_handover_attempts.d.ts +14 -0
- package/daemon/dist/db/migrations/167_seat_handover_attempts.d.ts.map +1 -0
- package/daemon/dist/db/migrations/167_seat_handover_attempts.js +54 -0
- package/daemon/dist/db/migrations/167_seat_handover_attempts.js.map +1 -0
- package/daemon/dist/db/migrations/168_context_usage_occupant_generation.d.ts +6 -0
- package/daemon/dist/db/migrations/168_context_usage_occupant_generation.d.ts.map +1 -0
- package/daemon/dist/db/migrations/168_context_usage_occupant_generation.js +10 -0
- package/daemon/dist/db/migrations/168_context_usage_occupant_generation.js.map +1 -0
- package/daemon/dist/db/migrations/169_seat_runtime_home_records.d.ts +5 -0
- package/daemon/dist/db/migrations/169_seat_runtime_home_records.d.ts.map +1 -0
- package/daemon/dist/db/migrations/169_seat_runtime_home_records.js +25 -0
- package/daemon/dist/db/migrations/169_seat_runtime_home_records.js.map +1 -0
- package/daemon/dist/db/migrations/170_rig_delivery_drains.d.ts +3 -0
- package/daemon/dist/db/migrations/170_rig_delivery_drains.d.ts.map +1 -0
- package/daemon/dist/db/migrations/170_rig_delivery_drains.js +21 -0
- package/daemon/dist/db/migrations/170_rig_delivery_drains.js.map +1 -0
- package/daemon/dist/domain/claim-service.d.ts +1 -3
- package/daemon/dist/domain/claim-service.d.ts.map +1 -1
- package/daemon/dist/domain/claim-service.js +3 -1
- package/daemon/dist/domain/claim-service.js.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts +11 -0
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.js +83 -36
- package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
- package/daemon/dist/domain/codex-filesystem-preflight.d.ts +33 -0
- package/daemon/dist/domain/codex-filesystem-preflight.d.ts.map +1 -0
- package/daemon/dist/domain/codex-filesystem-preflight.js +255 -0
- package/daemon/dist/domain/codex-filesystem-preflight.js.map +1 -0
- package/daemon/dist/domain/codex-member-permissions.d.ts +23 -2
- package/daemon/dist/domain/codex-member-permissions.d.ts.map +1 -1
- package/daemon/dist/domain/codex-member-permissions.js +55 -9
- package/daemon/dist/domain/codex-member-permissions.js.map +1 -1
- package/daemon/dist/domain/codex-network-default.d.ts +13 -0
- package/daemon/dist/domain/codex-network-default.d.ts.map +1 -1
- package/daemon/dist/domain/codex-network-default.js +37 -30
- package/daemon/dist/domain/codex-network-default.js.map +1 -1
- package/daemon/dist/domain/codex-thread-id.d.ts +13 -0
- package/daemon/dist/domain/codex-thread-id.d.ts.map +1 -1
- package/daemon/dist/domain/codex-thread-id.js +132 -9
- package/daemon/dist/domain/codex-thread-id.js.map +1 -1
- package/daemon/dist/domain/compaction-restore-notice.d.ts.map +1 -1
- package/daemon/dist/domain/compaction-restore-notice.js +59 -13
- package/daemon/dist/domain/compaction-restore-notice.js.map +1 -1
- package/daemon/dist/domain/connection-contract.d.ts.map +1 -1
- package/daemon/dist/domain/connection-contract.js +2 -1
- package/daemon/dist/domain/connection-contract.js.map +1 -1
- package/daemon/dist/domain/context-usage-store.d.ts +11 -2
- package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
- package/daemon/dist/domain/context-usage-store.js +33 -13
- package/daemon/dist/domain/context-usage-store.js.map +1 -1
- package/daemon/dist/domain/current-work.d.ts +5 -0
- package/daemon/dist/domain/current-work.d.ts.map +1 -1
- package/daemon/dist/domain/current-work.js +66 -4
- package/daemon/dist/domain/current-work.js.map +1 -1
- package/daemon/dist/domain/destination-successor.d.ts +3 -0
- package/daemon/dist/domain/destination-successor.d.ts.map +1 -0
- package/daemon/dist/domain/destination-successor.js +49 -0
- package/daemon/dist/domain/destination-successor.js.map +1 -0
- package/daemon/dist/domain/environment-lifecycle.d.ts +15 -0
- package/daemon/dist/domain/environment-lifecycle.d.ts.map +1 -1
- package/daemon/dist/domain/environment-lifecycle.js +22 -4
- package/daemon/dist/domain/environment-lifecycle.js.map +1 -1
- package/daemon/dist/domain/expected-conversation.d.ts.map +1 -1
- package/daemon/dist/domain/expected-conversation.js +26 -11
- package/daemon/dist/domain/expected-conversation.js.map +1 -1
- package/daemon/dist/domain/gateway/destination-resolver.d.ts +4 -0
- package/daemon/dist/domain/gateway/destination-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/destination-resolver.js +10 -3
- package/daemon/dist/domain/gateway/destination-resolver.js.map +1 -1
- package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts +3 -1
- package/daemon/dist/domain/gateway/operator-delivery-engine.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/operator-delivery-engine.js +14 -4
- package/daemon/dist/domain/gateway/operator-delivery-engine.js.map +1 -1
- package/daemon/dist/domain/health-diagnosis.d.ts.map +1 -1
- package/daemon/dist/domain/health-diagnosis.js +4 -0
- package/daemon/dist/domain/health-diagnosis.js.map +1 -1
- package/daemon/dist/domain/health-passive-ceremony.d.ts +3 -0
- package/daemon/dist/domain/health-passive-ceremony.d.ts.map +1 -1
- package/daemon/dist/domain/health-passive-ceremony.js +45 -4
- package/daemon/dist/domain/health-passive-ceremony.js.map +1 -1
- package/daemon/dist/domain/hosts/fleet-scopes.d.ts +111 -0
- package/daemon/dist/domain/hosts/fleet-scopes.d.ts.map +1 -0
- package/daemon/dist/domain/hosts/fleet-scopes.js +231 -0
- package/daemon/dist/domain/hosts/fleet-scopes.js.map +1 -0
- package/daemon/dist/domain/hosts/read-through.d.ts +1 -1
- package/daemon/dist/domain/hosts/read-through.d.ts.map +1 -1
- package/daemon/dist/domain/hosts/read-through.js +4 -0
- package/daemon/dist/domain/hosts/read-through.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
- package/daemon/dist/domain/native-model-picker.d.ts +2 -0
- package/daemon/dist/domain/native-model-picker.d.ts.map +1 -1
- package/daemon/dist/domain/native-model-picker.js +8 -2
- package/daemon/dist/domain/native-model-picker.js.map +1 -1
- package/daemon/dist/domain/native-permission-store.d.ts.map +1 -1
- package/daemon/dist/domain/native-permission-store.js +12 -5
- package/daemon/dist/domain/native-permission-store.js.map +1 -1
- package/daemon/dist/domain/native-process-lineage.d.ts +11 -1
- package/daemon/dist/domain/native-process-lineage.d.ts.map +1 -1
- package/daemon/dist/domain/native-process-lineage.js +25 -4
- package/daemon/dist/domain/native-process-lineage.js.map +1 -1
- package/daemon/dist/domain/native-resume-probe.d.ts.map +1 -1
- package/daemon/dist/domain/native-resume-probe.js +109 -26
- package/daemon/dist/domain/native-resume-probe.js.map +1 -1
- package/daemon/dist/domain/network/network-connector.d.ts.map +1 -1
- package/daemon/dist/domain/network/network-connector.js +5 -3
- package/daemon/dist/domain/network/network-connector.js.map +1 -1
- package/daemon/dist/domain/network/network-installations.d.ts +5 -4
- package/daemon/dist/domain/network/network-installations.d.ts.map +1 -1
- package/daemon/dist/domain/network/network-installations.js +42 -11
- package/daemon/dist/domain/network/network-installations.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts +6 -0
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +10 -3
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/occupant-invalidator.d.ts +4 -1
- package/daemon/dist/domain/occupant-invalidator.d.ts.map +1 -1
- package/daemon/dist/domain/occupant-invalidator.js +10 -2
- package/daemon/dist/domain/occupant-invalidator.js.map +1 -1
- package/daemon/dist/domain/operation-correlation.d.ts +1 -1
- package/daemon/dist/domain/operation-correlation.d.ts.map +1 -1
- package/daemon/dist/domain/operation-correlation.js +1 -1
- package/daemon/dist/domain/operation-correlation.js.map +1 -1
- package/daemon/dist/domain/permission-account.d.ts.map +1 -1
- package/daemon/dist/domain/permission-account.js +8 -6
- package/daemon/dist/domain/permission-account.js.map +1 -1
- package/daemon/dist/domain/permission-drift.d.ts.map +1 -1
- package/daemon/dist/domain/permission-drift.js +1 -1
- package/daemon/dist/domain/permission-drift.js.map +1 -1
- package/daemon/dist/domain/queue-destination-check.d.ts +2 -0
- package/daemon/dist/domain/queue-destination-check.d.ts.map +1 -1
- package/daemon/dist/domain/queue-destination-check.js +8 -11
- package/daemon/dist/domain/queue-destination-check.js.map +1 -1
- package/daemon/dist/domain/queue-erasure.d.ts +7 -1
- package/daemon/dist/domain/queue-erasure.d.ts.map +1 -1
- package/daemon/dist/domain/queue-erasure.js +226 -20
- package/daemon/dist/domain/queue-erasure.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +39 -17
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +96 -64
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.d.ts.map +1 -1
- package/daemon/dist/domain/queue-stuck-sweep.js +49 -21
- package/daemon/dist/domain/queue-stuck-sweep.js.map +1 -1
- package/daemon/dist/domain/queue-transition-log.d.ts +6 -0
- package/daemon/dist/domain/queue-transition-log.d.ts.map +1 -1
- package/daemon/dist/domain/queue-transition-log.js +9 -0
- package/daemon/dist/domain/queue-transition-log.js.map +1 -1
- package/daemon/dist/domain/queue-waiting.d.ts +4 -4
- package/daemon/dist/domain/queue-waiting.d.ts.map +1 -1
- package/daemon/dist/domain/queue-waiting.js +30 -16
- package/daemon/dist/domain/queue-waiting.js.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-ladder.js +90 -24
- package/daemon/dist/domain/queue-wake-ladder.js.map +1 -1
- package/daemon/dist/domain/receiver-context.js +1 -1
- package/daemon/dist/domain/receiver-context.js.map +1 -1
- package/daemon/dist/domain/restore-check-service.d.ts +13 -0
- package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
- package/daemon/dist/domain/restore-check-service.js +122 -9
- package/daemon/dist/domain/restore-check-service.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +4 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +132 -48
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/restore-preconditions.d.ts +2 -0
- package/daemon/dist/domain/restore-preconditions.d.ts.map +1 -1
- package/daemon/dist/domain/restore-preconditions.js +2 -0
- package/daemon/dist/domain/restore-preconditions.js.map +1 -1
- package/daemon/dist/domain/resume-metadata-refresher.d.ts +17 -4
- package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
- package/daemon/dist/domain/resume-metadata-refresher.js +64 -15
- package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
- package/daemon/dist/domain/resume-token-capture.d.ts +6 -0
- package/daemon/dist/domain/resume-token-capture.d.ts.map +1 -1
- package/daemon/dist/domain/resume-token-capture.js +14 -8
- package/daemon/dist/domain/resume-token-capture.js.map +1 -1
- package/daemon/dist/domain/rig-delivery-drain.d.ts +46 -0
- package/daemon/dist/domain/rig-delivery-drain.d.ts.map +1 -0
- package/daemon/dist/domain/rig-delivery-drain.js +128 -0
- package/daemon/dist/domain/rig-delivery-drain.js.map +1 -0
- package/daemon/dist/domain/rig-edge-ops.js +1 -1
- package/daemon/dist/domain/rig-edge-ops.js.map +1 -1
- package/daemon/dist/domain/rig-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/rig-lifecycle-service.js +4 -1
- package/daemon/dist/domain/rig-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/rig-teardown.d.ts +20 -3
- package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
- package/daemon/dist/domain/rig-teardown.js +71 -11
- package/daemon/dist/domain/rig-teardown.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +6 -2
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.d.ts +1 -1
- package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.js +36 -1
- package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
- package/daemon/dist/domain/rosters.d.ts +19 -0
- package/daemon/dist/domain/rosters.d.ts.map +1 -1
- package/daemon/dist/domain/rosters.js +69 -12
- package/daemon/dist/domain/rosters.js.map +1 -1
- package/daemon/dist/domain/runtime-adapter.d.ts +15 -0
- package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/runtime-adapter.js.map +1 -1
- package/daemon/dist/domain/seat-delivery-guard.d.ts +8 -2
- package/daemon/dist/domain/seat-delivery-guard.d.ts.map +1 -1
- package/daemon/dist/domain/seat-delivery-guard.js +38 -3
- package/daemon/dist/domain/seat-delivery-guard.js.map +1 -1
- package/daemon/dist/domain/seat-handover-attempts.d.ts +50 -0
- package/daemon/dist/domain/seat-handover-attempts.d.ts.map +1 -0
- package/daemon/dist/domain/seat-handover-attempts.js +75 -0
- package/daemon/dist/domain/seat-handover-attempts.js.map +1 -0
- package/daemon/dist/domain/seat-handover-service.d.ts +64 -1
- package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-handover-service.js +443 -29
- package/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/daemon/dist/domain/seat-launch-environment.d.ts +3 -2
- package/daemon/dist/domain/seat-launch-environment.d.ts.map +1 -1
- package/daemon/dist/domain/seat-launch-environment.js +16 -4
- package/daemon/dist/domain/seat-launch-environment.js.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.d.ts +47 -2
- package/daemon/dist/domain/seat-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-lifecycle-service.js +48 -2
- package/daemon/dist/domain/seat-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/seat-runtime-home-record-types.d.ts +16 -0
- package/daemon/dist/domain/seat-runtime-home-record-types.d.ts.map +1 -0
- package/daemon/dist/domain/seat-runtime-home-record-types.js +2 -0
- package/daemon/dist/domain/seat-runtime-home-record-types.js.map +1 -0
- package/daemon/dist/domain/seat-runtime-home-record.d.ts +173 -0
- package/daemon/dist/domain/seat-runtime-home-record.d.ts.map +1 -0
- package/daemon/dist/domain/seat-runtime-home-record.js +317 -0
- package/daemon/dist/domain/seat-runtime-home-record.js.map +1 -0
- package/daemon/dist/domain/seat-runtime-switch-service.d.ts +7 -0
- package/daemon/dist/domain/seat-runtime-switch-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-runtime-switch-service.js +47 -2
- package/daemon/dist/domain/seat-runtime-switch-service.js.map +1 -1
- package/daemon/dist/domain/seat-skill-storage.d.ts +16 -1
- package/daemon/dist/domain/seat-skill-storage.d.ts.map +1 -1
- package/daemon/dist/domain/seat-skill-storage.js +178 -1
- package/daemon/dist/domain/seat-skill-storage.js.map +1 -1
- package/daemon/dist/domain/session-name.d.ts +13 -0
- package/daemon/dist/domain/session-name.d.ts.map +1 -1
- package/daemon/dist/domain/session-name.js +77 -0
- package/daemon/dist/domain/session-name.js.map +1 -1
- package/daemon/dist/domain/session-registry.d.ts +7 -1
- package/daemon/dist/domain/session-registry.d.ts.map +1 -1
- package/daemon/dist/domain/session-registry.js +7 -4
- package/daemon/dist/domain/session-registry.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +1 -0
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +33 -9
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/shared-history-selection.d.ts +1 -0
- package/daemon/dist/domain/shared-history-selection.d.ts.map +1 -1
- package/daemon/dist/domain/shared-history-selection.js +3 -1
- package/daemon/dist/domain/shared-history-selection.js.map +1 -1
- package/daemon/dist/domain/skill-catalog.d.ts +3 -0
- package/daemon/dist/domain/skill-catalog.d.ts.map +1 -1
- package/daemon/dist/domain/skill-catalog.js +7 -3
- package/daemon/dist/domain/skill-catalog.js.map +1 -1
- package/daemon/dist/domain/snapshot-capture.d.ts +4 -1
- package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
- package/daemon/dist/domain/snapshot-capture.js +24 -12
- package/daemon/dist/domain/snapshot-capture.js.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.d.ts.map +1 -1
- package/daemon/dist/domain/startup-submission-evidence.js +3 -2
- package/daemon/dist/domain/startup-submission-evidence.js.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.d.ts +16 -0
- package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/successor-session-launcher.js +70 -38
- package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +43 -2
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/user-settings/settings-browser.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-browser.js +3 -1
- package/daemon/dist/domain/user-settings/settings-browser.js.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.js +6 -0
- package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.d.ts +4 -0
- package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.js +28 -1
- package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
- package/daemon/dist/domain/workflow-exception-escalation.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-exception-escalation.js +13 -8
- package/daemon/dist/domain/workflow-exception-escalation.js.map +1 -1
- package/daemon/dist/domain/workflow-instance-store.d.ts +14 -2
- package/daemon/dist/domain/workflow-instance-store.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-instance-store.js +41 -4
- package/daemon/dist/domain/workflow-instance-store.js.map +1 -1
- package/daemon/dist/domain/workflow-projector.d.ts +55 -0
- package/daemon/dist/domain/workflow-projector.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-projector.js +355 -174
- package/daemon/dist/domain/workflow-projector.js.map +1 -1
- package/daemon/dist/domain/workflow-reconciliation.d.ts +7 -1
- package/daemon/dist/domain/workflow-reconciliation.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-reconciliation.js +51 -13
- package/daemon/dist/domain/workflow-reconciliation.js.map +1 -1
- package/daemon/dist/domain/workflow-runtime.d.ts +11 -3
- package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-runtime.js +141 -27
- package/daemon/dist/domain/workflow-runtime.js.map +1 -1
- package/daemon/dist/lib/pane-envelope.d.ts.map +1 -1
- package/daemon/dist/lib/pane-envelope.js +12 -7
- package/daemon/dist/lib/pane-envelope.js.map +1 -1
- package/daemon/dist/routes/compaction.d.ts.map +1 -1
- package/daemon/dist/routes/compaction.js +6 -3
- package/daemon/dist/routes/compaction.js.map +1 -1
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +78 -31
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/restore-check.d.ts.map +1 -1
- package/daemon/dist/routes/restore-check.js +17 -0
- package/daemon/dist/routes/restore-check.js.map +1 -1
- package/daemon/dist/routes/rig-delivery-drain.d.ts +3 -0
- package/daemon/dist/routes/rig-delivery-drain.d.ts.map +1 -0
- package/daemon/dist/routes/rig-delivery-drain.js +46 -0
- package/daemon/dist/routes/rig-delivery-drain.js.map +1 -0
- package/daemon/dist/routes/scopes.d.ts.map +1 -1
- package/daemon/dist/routes/scopes.js +102 -19
- package/daemon/dist/routes/scopes.js.map +1 -1
- package/daemon/dist/routes/seat.d.ts.map +1 -1
- package/daemon/dist/routes/seat.js +50 -2
- package/daemon/dist/routes/seat.js.map +1 -1
- package/daemon/dist/routes/sessions.d.ts.map +1 -1
- package/daemon/dist/routes/sessions.js +54 -10
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/startup.d.ts.map +1 -1
- package/daemon/dist/routes/startup.js +230 -40
- package/daemon/dist/routes/startup.js.map +1 -1
- package/daemon/dist/routes/transport.d.ts.map +1 -1
- package/daemon/dist/routes/transport.js +36 -2
- package/daemon/dist/routes/transport.js.map +1 -1
- package/daemon/dist/routes/up.js +2 -0
- package/daemon/dist/routes/up.js.map +1 -1
- package/daemon/dist/routes/watchdog.d.ts.map +1 -1
- package/daemon/dist/routes/watchdog.js +7 -1
- package/daemon/dist/routes/watchdog.js.map +1 -1
- package/daemon/dist/routes/workflow.d.ts.map +1 -1
- package/daemon/dist/routes/workflow.js +23 -5
- package/daemon/dist/routes/workflow.js.map +1 -1
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +2 -0
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +111 -37
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/docs/reference/agent-startup-guide.md +90 -2
- package/daemon/docs/reference/daemon-http-clients.md +69 -0
- package/daemon/docs/reference/developing.md +1 -1
- package/daemon/docs/reference/gateway-participants.md +5 -3
- package/daemon/docs/reference/getting-started.md +12 -11
- package/daemon/docs/reference/hosted-members.md +4 -2
- package/daemon/docs/reference/network-connector.md +4 -3
- package/daemon/docs/reference/queue-erasure.md +16 -1
- package/daemon/docs/reference/quickstart.md +2 -2
- package/daemon/docs/reference/rig-spec.md +92 -4
- package/daemon/docs/reference/rosters.md +26 -0
- package/daemon/docs/reference/seat-delivery.md +7 -1
- package/daemon/docs/reference/whats-new.md +397 -5
- package/daemon/specs/agents/shared/skills/core/openrig-software-factory/references/worked-example.md +1 -1
- package/daemon/specs/agents/shared/skills/core/openrig-upgrade/SKILL.md +2 -0
- package/daemon/specs/agents/shared/skills/core/working-with-an-openrig-team/SKILL.md +22 -6
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +78 -18
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/startup/context.md +9 -6
- package/dist/build-info.js +3 -3
- package/dist/client.d.ts +7 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +11 -2
- package/dist/client.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +2 -0
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +5 -1
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/environment.js +1 -1
- package/dist/commands/environment.js.map +1 -1
- package/dist/commands/launch.d.ts.map +1 -1
- package/dist/commands/launch.js +8 -0
- package/dist/commands/launch.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +18 -1
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/network.d.ts +2 -0
- package/dist/commands/network.d.ts.map +1 -1
- package/dist/commands/network.js +14 -1
- package/dist/commands/network.js.map +1 -1
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +11 -5
- package/dist/commands/ps.js.map +1 -1
- package/dist/commands/queue.d.ts +1 -1
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +49 -12
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/restore.d.ts.map +1 -1
- package/dist/commands/restore.js +6 -1
- package/dist/commands/restore.js.map +1 -1
- package/dist/commands/roster.d.ts +4 -2
- package/dist/commands/roster.d.ts.map +1 -1
- package/dist/commands/roster.js +2 -2
- package/dist/commands/roster.js.map +1 -1
- package/dist/commands/seat.d.ts +2 -0
- package/dist/commands/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +201 -14
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +31 -6
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +5 -3
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +7 -0
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/walk.d.ts.map +1 -1
- package/dist/commands/walk.js +4 -0
- package/dist/commands/walk.js.map +1 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +30 -4
- package/dist/commands/workflow.js.map +1 -1
- package/dist/config-store.d.ts +3 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +5 -0
- package/dist/config-store.js.map +1 -1
- package/dist/lib/bundle-check.d.ts.map +1 -1
- package/dist/lib/bundle-check.js +33 -3
- package/dist/lib/bundle-check.js.map +1 -1
- package/dist/mcp-http.d.ts +3 -0
- package/dist/mcp-http.d.ts.map +1 -1
- package/dist/mcp-http.js +13 -0
- package/dist/mcp-http.js.map +1 -1
- package/dist/mcp-server.d.ts +9 -2
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +287 -69
- package/dist/mcp-server.js.map +1 -1
- package/dist/person-registration-offer.d.ts.map +1 -1
- package/dist/person-registration-offer.js +2 -1
- package/dist/person-registration-offer.js.map +1 -1
- package/package.json +2 -2
- package/tui/dist/commands/registry.d.ts.map +1 -1
- package/tui/dist/commands/registry.js +1 -0
- package/tui/dist/commands/registry.js.map +1 -1
- package/tui/dist/config/config-model.js +1 -1
- package/tui/dist/config/config-model.js.map +1 -1
- package/tui/dist/crash-cart/start-daemon.d.ts.map +1 -1
- package/tui/dist/crash-cart/start-daemon.js +4 -2
- package/tui/dist/crash-cart/start-daemon.js.map +1 -1
- package/tui/dist/daemon-client.d.ts +12 -1
- package/tui/dist/daemon-client.d.ts.map +1 -1
- package/tui/dist/daemon-client.js +44 -2
- package/tui/dist/daemon-client.js.map +1 -1
- package/tui/dist/hydrate.d.ts +1 -1
- package/tui/dist/hydrate.d.ts.map +1 -1
- package/tui/dist/hydrate.js +43 -1
- package/tui/dist/hydrate.js.map +1 -1
- package/tui/dist/main.js +3 -0
- package/tui/dist/main.js.map +1 -1
- package/tui/dist/page-read.d.ts.map +1 -1
- package/tui/dist/page-read.js +2 -1
- package/tui/dist/page-read.js.map +1 -1
- package/tui/dist/render.d.ts.map +1 -1
- package/tui/dist/render.js +110 -16
- package/tui/dist/render.js.map +1 -1
- package/tui/dist/scopes/fleet-scopes-model.d.ts +73 -0
- package/tui/dist/scopes/fleet-scopes-model.d.ts.map +1 -0
- package/tui/dist/scopes/fleet-scopes-model.js +102 -0
- package/tui/dist/scopes/fleet-scopes-model.js.map +1 -0
- package/tui/dist/scopes/scopes-model.d.ts +2 -0
- package/tui/dist/scopes/scopes-model.d.ts.map +1 -1
- package/tui/dist/scopes/scopes-model.js +7 -4
- package/tui/dist/scopes/scopes-model.js.map +1 -1
- package/tui/dist/sections.d.ts.map +1 -1
- package/tui/dist/sections.js +5 -0
- package/tui/dist/sections.js.map +1 -1
- package/tui/dist/startup.d.ts +5 -0
- package/tui/dist/startup.d.ts.map +1 -1
- package/tui/dist/startup.js +12 -0
- package/tui/dist/startup.js.map +1 -1
- package/tui/dist/state.d.ts.map +1 -1
- package/tui/dist/state.js +12 -5
- package/tui/dist/state.js.map +1 -1
- package/tui/dist/types.d.ts +18 -1
- package/tui/dist/types.d.ts.map +1 -1
|
@@ -28,7 +28,7 @@ import { selectRoleSeat } from "./workflow-role-resolver.js";
|
|
|
28
28
|
import { roleResolutionContext, tryResolveRoleByCapability, } from "./workflow-role-context.js";
|
|
29
29
|
import { packetScopeTags } from "./workflow-scope.js";
|
|
30
30
|
import { classifyFailureOccurrence, classifyGateTrip, workflowExceptionTags } from "./workflow-exception.js";
|
|
31
|
-
import { newQitemId, QueueRepositoryError } from "./queue-repository.js";
|
|
31
|
+
import { isTerminalState, newQitemId, QueueRepositoryError } from "./queue-repository.js";
|
|
32
32
|
import { resolveExceptionRoute } from "./workflow-exception-router.js";
|
|
33
33
|
import { workflowHumanDestination } from "./workflow-human-destination.js";
|
|
34
34
|
import { disarmWorkflowKeepalive, ensureWorkflowKeepaliveArmed, } from "./workflow-keepalive-arming.js";
|
|
@@ -106,6 +106,39 @@ export class WorkflowProjectorError extends Error {
|
|
|
106
106
|
this.name = "WorkflowProjectorError";
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
+
/** The projector's own trail record for a projection whose frontier packet the queue had already closed (an ordinary
|
|
110
|
+
* queue handoff moved the work on): the caller's whole intent, the queue state found and the next packets. The exit and
|
|
111
|
+
* next hop were recorded on the workflow, and the queue row wasn't written. project() never stores a caller's value
|
|
112
|
+
* for this key, so only the projector writes it. */
|
|
113
|
+
const QUEUE_ROW_ALREADY_CLOSED = "queue_row_already_closed";
|
|
114
|
+
function alreadyClosedRecord(input, state, nextQitemIds, nextStepIds, nextOwners) {
|
|
115
|
+
return { state, exit: input.exit, actor: input.actorSession, result_note: input.resultNote ?? null,
|
|
116
|
+
blocked_on: input.blockedOn ?? null, next_owner: input.nextOwnerSession ?? null, evidence: input.closureEvidence ?? null,
|
|
117
|
+
next_qitem_ids: nextQitemIds, next_step_ids: nextStepIds, next_owners: nextOwners };
|
|
118
|
+
}
|
|
119
|
+
/** The record, when the trail evidence holds a well-formed one; anything else reads as none. */
|
|
120
|
+
function readAlreadyClosedRecord(evidence) {
|
|
121
|
+
const value = evidence?.[QUEUE_ROW_ALREADY_CLOSED];
|
|
122
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
123
|
+
return null;
|
|
124
|
+
const r = value;
|
|
125
|
+
const text = (v) => typeof v === "string";
|
|
126
|
+
const textOrNull = (v) => v === null || text(v);
|
|
127
|
+
const ids = (v) => Array.isArray(v) && v.every(text);
|
|
128
|
+
const objectOrNull = (v) => v === null || (typeof v === "object" && !Array.isArray(v));
|
|
129
|
+
return text(r.state) && isTerminalState(r.state) && text(r.exit) && text(r.actor) && textOrNull(r.result_note)
|
|
130
|
+
&& textOrNull(r.blocked_on) && textOrNull(r.next_owner) && objectOrNull(r.evidence) && ids(r.next_qitem_ids)
|
|
131
|
+
&& ids(r.next_step_ids) && (r.next_owners === undefined || ids(r.next_owners)) ? r : null;
|
|
132
|
+
}
|
|
133
|
+
/** The caller repeats the recorded projection exactly: the same exit, actor, result note, blocker, next owner and evidence. */
|
|
134
|
+
function sameIntent(record, input) {
|
|
135
|
+
return record.exit === input.exit && record.actor === input.actorSession && record.result_note === (input.resultNote ?? null)
|
|
136
|
+
&& record.blocked_on === (input.blockedOn ?? null) && record.next_owner === (input.nextOwnerSession ?? null)
|
|
137
|
+
&& isDeepEqual(record.evidence, input.closureEvidence ?? null);
|
|
138
|
+
}
|
|
139
|
+
function alreadyClosedNotice(packetId, state, exit) {
|
|
140
|
+
return `packet ${packetId} was already ${state} in the queue, so the ${exit} exit was recorded on the workflow without writing its queue row`;
|
|
141
|
+
}
|
|
109
142
|
export class WorkflowProjector {
|
|
110
143
|
db;
|
|
111
144
|
eventBus;
|
|
@@ -146,7 +179,21 @@ export class WorkflowProjector {
|
|
|
146
179
|
* call site.
|
|
147
180
|
*/
|
|
148
181
|
async project(input) {
|
|
182
|
+
// The already-closed record's key is the projector's own: a value a caller supplies for it isn't stored or trusted.
|
|
183
|
+
const evidence = input.closureEvidence;
|
|
184
|
+
if (!evidence || !(QUEUE_ROW_ALREADY_CLOSED in evidence))
|
|
185
|
+
return this.projectStep(input);
|
|
186
|
+
const { [QUEUE_ROW_ALREADY_CLOSED]: _reserved, ...callerEvidence } = evidence;
|
|
187
|
+
const result = await this.projectStep({ ...input, closureEvidence: callerEvidence });
|
|
188
|
+
return { ...result, advisories: [...(result.advisories ?? []),
|
|
189
|
+
`closure evidence key ${QUEUE_ROW_ALREADY_CLOSED} is the projector's own, so the value supplied for it wasn't stored`] };
|
|
190
|
+
}
|
|
191
|
+
async projectStep(input) {
|
|
149
192
|
const instance = this.instanceStore.getByIdOrThrow(input.instanceId);
|
|
193
|
+
// The same whole intent again on a packet that was already closed when it was projected: report that projection.
|
|
194
|
+
const replay = this.alreadyClosedReplay(instance, input);
|
|
195
|
+
if (replay)
|
|
196
|
+
return replay;
|
|
150
197
|
if (instance.status !== "active" && instance.status !== "waiting") {
|
|
151
198
|
throw new WorkflowProjectorError("instance_not_active", `workflow instance ${instance.instanceId} has status ${instance.status}; only active|waiting instances accept project`, { instanceId: instance.instanceId, status: instance.status });
|
|
152
199
|
}
|
|
@@ -202,6 +249,9 @@ export class WorkflowProjector {
|
|
|
202
249
|
}
|
|
203
250
|
}
|
|
204
251
|
validateAcceptance(currentStep, input, instance);
|
|
252
|
+
// A frontier packet an ordinary queue handoff already closed: the queue refuses closing it again, and its history
|
|
253
|
+
// stays as recorded. The exit and next hop are still recorded on the workflow; only this row isn't written.
|
|
254
|
+
const alreadyClosed = isTerminalState(currentPacket.state) ? currentPacket.state : null;
|
|
205
255
|
const unansweredHumanGate = (input.exit === "done" || input.exit === "handoff") &&
|
|
206
256
|
currentStep.gate && isHumanSeatSession(currentStep.gate.target) &&
|
|
207
257
|
currentPacket.state === "blocked" && currentPacket.blockedOn === currentStep.gate.target
|
|
@@ -221,6 +271,7 @@ export class WorkflowProjector {
|
|
|
221
271
|
packetBinding,
|
|
222
272
|
currentOwnerSession: currentPacket.destinationSession,
|
|
223
273
|
unansweredHumanGate,
|
|
274
|
+
alreadyClosed,
|
|
224
275
|
});
|
|
225
276
|
}
|
|
226
277
|
// Determine next step (one-hop default; multi-hop is graduation).
|
|
@@ -366,40 +417,44 @@ export class WorkflowProjector {
|
|
|
366
417
|
resolvedNextOwner = owner;
|
|
367
418
|
}
|
|
368
419
|
}
|
|
420
|
+
if (resolvedNextOwner)
|
|
421
|
+
assertBoundWorkflowTarget(resolvedNextOwner, this.queueRepo);
|
|
369
422
|
// 2. R1 fix (guard blocker 1): close the current packet via Phase A's
|
|
370
423
|
// QueueRepository.updateWithinTransaction. This validates closure
|
|
371
424
|
// (Phase A hot-potato strict-rejection invariants), persists closure
|
|
372
425
|
// metadata (closure_reason, closure_target, handed_off_to / blocked_on),
|
|
373
426
|
// appends queue_transitions, and emits queue.updated — all inside this
|
|
374
427
|
// outer transaction. The Phase A closure authority is preserved.
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
428
|
+
if (!alreadyClosed) {
|
|
429
|
+
const closure = workflowExitToQueueClosure({ ...input, exit: effectiveExit, resultNote: effectiveResultNote }, resolvedNextOwner);
|
|
430
|
+
const queueUpdate = this.queueRepo.updateWithinTransaction({
|
|
431
|
+
qitemId: input.currentPacketId,
|
|
432
|
+
actorSession: input.actorSession,
|
|
433
|
+
identityProvenance: input.identityProvenance ?? null,
|
|
434
|
+
viaWorkflowVerb: true,
|
|
435
|
+
state: closure.state,
|
|
436
|
+
closureReason: closure.closureReason,
|
|
437
|
+
closureTarget: closure.closureTarget ?? undefined,
|
|
438
|
+
handedOffTo: closure.handedOffTo,
|
|
439
|
+
blockedOn: closure.blockedOn,
|
|
440
|
+
transitionNote: [closure.transitionNote, unansweredHumanGate].filter(Boolean).join("; "),
|
|
441
|
+
wakeMaxSeconds: effectiveExit === "waiting" && !routes ? currentStep.re_present_max_seconds : undefined,
|
|
442
|
+
wakeProgressEvidence: input.closureEvidence,
|
|
443
|
+
wakeAfterSeconds: effectiveExit === "waiting" && !routes
|
|
444
|
+
? currentStep.re_present_after_seconds
|
|
445
|
+
: undefined,
|
|
446
|
+
wakeMessage: effectiveExit === "waiting" && !routes && currentStep.re_present_after_seconds !== undefined
|
|
447
|
+
? workflowWaitWakeMessage({
|
|
448
|
+
spec,
|
|
449
|
+
instance,
|
|
450
|
+
step: currentStep,
|
|
451
|
+
packetId: input.currentPacketId,
|
|
452
|
+
ownerSession: currentPacket.destinationSession,
|
|
453
|
+
})
|
|
454
|
+
: undefined,
|
|
455
|
+
});
|
|
456
|
+
registerEvent(queueUpdate.persistedEvent);
|
|
457
|
+
}
|
|
403
458
|
// 3. If this close routes (structural handoff OR branch-mapped
|
|
404
459
|
// exit): create the next-step qitem in the same txn. A gated
|
|
405
460
|
// target compiles to the gate item (FR-5) — the SHIPPED write
|
|
@@ -519,6 +574,9 @@ export class WorkflowProjector {
|
|
|
519
574
|
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, holdMs);
|
|
520
575
|
}
|
|
521
576
|
// 4. Append step trail entry (prior + next ids).
|
|
577
|
+
if (alreadyClosed) {
|
|
578
|
+
effectiveClosureEvidence = { ...(effectiveClosureEvidence ?? {}), [QUEUE_ROW_ALREADY_CLOSED]: alreadyClosedRecord(input, alreadyClosed, nextQitemId ? [nextQitemId] : [], nextStepId ? [nextStepId] : [], nextQitemId && nextOwnerSession ? [nextOwnerSession] : []) };
|
|
579
|
+
}
|
|
522
580
|
this.trailLog.record({
|
|
523
581
|
instanceId: instance.instanceId,
|
|
524
582
|
stepId: currentStep.id,
|
|
@@ -716,7 +774,35 @@ export class WorkflowProjector {
|
|
|
716
774
|
nextOwnerSession,
|
|
717
775
|
nextStepId,
|
|
718
776
|
emittedEventTypes: persistedEvents.map((e) => e.type),
|
|
719
|
-
...(unansweredHumanGate ?
|
|
777
|
+
...withAdvisories([unansweredHumanGate, alreadyClosed ? alreadyClosedNotice(input.currentPacketId, alreadyClosed, input.exit) : undefined]),
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
/** A repeat, with the same whole intent, of the latest projection recorded on a packet the queue had already closed
|
|
781
|
+
* (and still has): the same result, read from that projection's trail record, with nothing written. Otherwise null. */
|
|
782
|
+
alreadyClosedReplay(instance, input) {
|
|
783
|
+
const packet = this.queueRepo.getById(input.currentPacketId);
|
|
784
|
+
if (!packet || !isTerminalState(packet.state))
|
|
785
|
+
return null;
|
|
786
|
+
const entry = this.trailLog.listForInstanceInAppendOrder(instance.instanceId)
|
|
787
|
+
.filter((candidate) => candidate.priorQitemId === input.currentPacketId).at(-1);
|
|
788
|
+
const recorded = readAlreadyClosedRecord(entry?.closureEvidence);
|
|
789
|
+
if (!entry || !recorded || !sameIntent(recorded, input))
|
|
790
|
+
return null;
|
|
791
|
+
const nextQitemId = recorded.next_qitem_ids[0] ?? null;
|
|
792
|
+
return {
|
|
793
|
+
instance,
|
|
794
|
+
closurePriorPacketId: input.currentPacketId,
|
|
795
|
+
closureReason: entry.closureReason,
|
|
796
|
+
nextQitemId,
|
|
797
|
+
// The owner recorded at projection, not the row's current one; an older record without it reads the row.
|
|
798
|
+
nextOwnerSession: recorded.next_owners ? recorded.next_owners[0] ?? null
|
|
799
|
+
: nextQitemId ? this.queueRepo.getById(nextQitemId)?.destinationSession ?? null : null,
|
|
800
|
+
nextStepId: recorded.next_step_ids[0] ?? null,
|
|
801
|
+
nextQitemIds: recorded.next_qitem_ids,
|
|
802
|
+
nextStepIds: recorded.next_step_ids,
|
|
803
|
+
emittedEventTypes: [],
|
|
804
|
+
absorbedReplay: true,
|
|
805
|
+
advisories: [alreadyClosedNotice(input.currentPacketId, recorded.state, input.exit)],
|
|
720
806
|
};
|
|
721
807
|
}
|
|
722
808
|
/** Failure, owning task and wake commit together on both executor paths.
|
|
@@ -750,37 +836,157 @@ export class WorkflowProjector {
|
|
|
750
836
|
`evidence: ${evidenceRef}\n` +
|
|
751
837
|
`resolve: diagnose via the trace above, then \`rig workflow resume ${instance.instanceId}${occurrenceId ? ` --occurrence ${occurrenceId}` : ""} [--decision <text>]\` re-drives from this step (completed steps never re-run).`;
|
|
752
838
|
// Routed to the person, a failed workflow step is an approval whose wait costs now: alert them.
|
|
753
|
-
const createExceptionItem = (destination, tier, toPerson) =>
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
839
|
+
const createExceptionItem = (destination, tier, toPerson) => {
|
|
840
|
+
assertBoundWorkflowTarget(destination, this.queueRepo);
|
|
841
|
+
return this.queueRepo.createWithinTransaction({
|
|
842
|
+
sourceSession: input.actorSession,
|
|
843
|
+
identityProvenance: input.identityProvenance ?? null,
|
|
844
|
+
destinationSession: destination,
|
|
845
|
+
body: itemBody,
|
|
846
|
+
priority: "urgent",
|
|
847
|
+
tier,
|
|
848
|
+
tags: [...workflowExceptionTags(exception.identity), ...packetScopeTags(instance, currentStep.id)],
|
|
849
|
+
summary: exception.reason,
|
|
850
|
+
evidenceRef,
|
|
851
|
+
chainOfRecord: [input.currentPacketId],
|
|
852
|
+
...(toPerson ? { humanAlert: true } : {}),
|
|
853
|
+
});
|
|
854
|
+
};
|
|
766
855
|
let createdException;
|
|
767
|
-
|
|
768
|
-
createdException = createExceptionItem(route.destinationSession, route.tier, route.humanRouted === true);
|
|
769
|
-
}
|
|
770
|
-
catch (error) {
|
|
771
|
-
if (!(error instanceof QueueRepositoryError) || error.code !== "unknown_destination_rig" || route.humanRouted)
|
|
772
|
-
throw error;
|
|
773
|
-
// Only an unavailable agent rig invokes human selection. Other
|
|
774
|
-
// admission/storage failures propagate unchanged and roll back the
|
|
775
|
-
// close, retaining the failure+attention-item atomic contract.
|
|
856
|
+
if (!route.humanRouted && !this.queueRepo.acceptsDestination(route.destinationSession)) {
|
|
776
857
|
createdException = createExceptionItem(workflowHumanDestination(this.exceptionDial?.humanFallbackSeat), "human-gate", true);
|
|
777
858
|
}
|
|
859
|
+
else {
|
|
860
|
+
try {
|
|
861
|
+
createdException = createExceptionItem(route.destinationSession, route.tier, route.humanRouted === true);
|
|
862
|
+
}
|
|
863
|
+
catch (error) {
|
|
864
|
+
if (!(error instanceof QueueRepositoryError) || error.code !== "unknown_destination_rig" || route.humanRouted)
|
|
865
|
+
throw error;
|
|
866
|
+
// Only an unavailable agent rig invokes human selection. Other
|
|
867
|
+
// admission/storage failures propagate unchanged and roll back the
|
|
868
|
+
// close, retaining the failure+attention-item atomic contract.
|
|
869
|
+
createdException = createExceptionItem(workflowHumanDestination(this.exceptionDial?.humanFallbackSeat), "human-gate", true);
|
|
870
|
+
}
|
|
871
|
+
}
|
|
778
872
|
registerEvent(createdException.persistedEvent);
|
|
779
873
|
this.queueRepo.stageHandoffWake(createdException.qitemId, input.actorSession, createdException.destinationSession, input.identityProvenance ?? null, createdException.nudge);
|
|
780
874
|
return { qitemId: createdException.qitemId, destinationSession: createdException.destinationSession, nudge: createdException.nudge };
|
|
781
875
|
}
|
|
876
|
+
/** Owner and gate for each step about to be projected, resolved before anything is written. */
|
|
877
|
+
planSuccessors(instance, spec, steps) {
|
|
878
|
+
return steps.map((step) => {
|
|
879
|
+
const gate = step.gate
|
|
880
|
+
? compileGate(spec, step, (session) => this.nodeRuntimeOf(session), roleResolutionContext(this.db, instance.boundRig))
|
|
881
|
+
: null;
|
|
882
|
+
const owner = gate?.destinationSession ?? resolveDefaultOwner(spec, step, (session) => this.nodeRuntimeOf(session), roleResolutionContext(this.db, instance.boundRig));
|
|
883
|
+
if (!owner) {
|
|
884
|
+
throw new WorkflowProjectorError("next_owner_unresolved", `cannot resolve next owner for dependency step "${step.id}"`, { instanceId: instance.instanceId, stepId: step.id });
|
|
885
|
+
}
|
|
886
|
+
assertBoundWorkflowTarget(owner, this.queueRepo);
|
|
887
|
+
return { step, gate, owner, packetId: newQitemId() };
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
/** One packet per planned step, inside the caller's envelope: the queue row and its staged wake, a gate's park, the
|
|
891
|
+
* frontier binding, the keepalive and the projected event. The caller updates the frontier and status, and delivers
|
|
892
|
+
* the wakes after commit. Ordinary projection and a revision share it. */
|
|
893
|
+
createSuccessors(input) {
|
|
894
|
+
const { instance, spec, actorSession, identityProvenance, addEvent } = input;
|
|
895
|
+
return input.plans.map((plan) => {
|
|
896
|
+
const created = this.queueRepo.createWithinTransaction({
|
|
897
|
+
qitemId: plan.packetId,
|
|
898
|
+
sourceSession: actorSession,
|
|
899
|
+
identityProvenance,
|
|
900
|
+
destinationSession: plan.owner,
|
|
901
|
+
body: input.body(plan),
|
|
902
|
+
priority: "routine",
|
|
903
|
+
tier: plan.gate?.tier ?? "mode2",
|
|
904
|
+
tags: ["workflow", plan.gate ? "gate" : "handoff", `workflow:${spec.id}`, `instance:${instance.instanceId}`, `step:${plan.step.id}`, ...packetScopeTags(instance, plan.step.id)],
|
|
905
|
+
summary: plan.gate?.summary ?? undefined,
|
|
906
|
+
evidenceRef: plan.gate?.evidenceRef ?? undefined,
|
|
907
|
+
chainOfRecord: input.chainOfRecord,
|
|
908
|
+
});
|
|
909
|
+
addEvent(created.persistedEvent);
|
|
910
|
+
this.queueRepo.stageHandoffWake(created.qitemId, actorSession, created.destinationSession, identityProvenance, created.nudge);
|
|
911
|
+
if (plan.gate?.parkOn) {
|
|
912
|
+
const parked = this.queueRepo.updateWithinTransaction({
|
|
913
|
+
qitemId: created.qitemId,
|
|
914
|
+
actorSession,
|
|
915
|
+
identityProvenance,
|
|
916
|
+
state: "blocked",
|
|
917
|
+
closureReason: "blocked_on",
|
|
918
|
+
closureTarget: plan.gate.parkOn,
|
|
919
|
+
blockedOn: plan.gate.parkOn,
|
|
920
|
+
transitionNote: `workflow gate: parked on ${plan.gate.parkOn} pending sign-off`,
|
|
921
|
+
});
|
|
922
|
+
addEvent(parked.persistedEvent);
|
|
923
|
+
}
|
|
924
|
+
this.instanceStore.bindFrontierPacket({
|
|
925
|
+
instanceId: instance.instanceId,
|
|
926
|
+
packetId: created.qitemId,
|
|
927
|
+
stepId: plan.step.id,
|
|
928
|
+
...input.binding,
|
|
929
|
+
});
|
|
930
|
+
if (this.watchdogJobsRepo) {
|
|
931
|
+
ensureWorkflowKeepaliveArmed(this.watchdogJobsRepo, {
|
|
932
|
+
instanceId: instance.instanceId,
|
|
933
|
+
packetId: created.qitemId,
|
|
934
|
+
targetSession: plan.owner,
|
|
935
|
+
registeredBySession: actorSession,
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
addEvent(this.eventBus.persistWithinTransaction({ type: "workflow.next_qitem_projected", instanceId: instance.instanceId, nextQitemId: created.qitemId, nextOwner: plan.owner, nextStepId: plan.step.id }));
|
|
939
|
+
return { qitemId: created.qitemId, step: plan.step, owner: plan.owner, nudge: created.nudge, blocked: Boolean(plan.gate?.parkOn) };
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
/** A revision's newly ready steps: owners and gates from the revised specification (already in the spec cache under
|
|
943
|
+
* `workflowVersion`), resolved before the revision writes, so an unresolved owner refuses the whole revision. */
|
|
944
|
+
planRevisionSuccessors(instance, workflowVersion, stepIds) {
|
|
945
|
+
const spec = this.specCache.getForInstance({ workflowName: instance.workflowName, workflowVersion, boundRig: instance.boundRig, startedSpec: null })?.spec;
|
|
946
|
+
if (!spec) {
|
|
947
|
+
throw new WorkflowProjectorError("spec_not_cached", `revised workflow spec ${instance.workflowName}@${workflowVersion} is not in the spec cache`, { instanceId: instance.instanceId, workflowVersion });
|
|
948
|
+
}
|
|
949
|
+
const steps = stepIds.map((id) => spec.steps.find((step) => step.id === id));
|
|
950
|
+
if (steps.some((step) => !step)) {
|
|
951
|
+
throw new WorkflowProjectorError("branch_target_missing", "a step the revision projects is missing from the revised specification", { instanceId: instance.instanceId, stepIds });
|
|
952
|
+
}
|
|
953
|
+
return { spec, plans: this.planSuccessors(instance, spec, steps) };
|
|
954
|
+
}
|
|
955
|
+
/** Projects a revision's planned steps through ordinary projection's path, inside the revision's envelope, then
|
|
956
|
+
* updates the frontier and status under the instance's version. The revision is their provenance: no packet closed,
|
|
957
|
+
* so they start a fresh branch with no chain of record. The caller delivers the wakes after commit. */
|
|
958
|
+
projectRevisionSuccessors(input) {
|
|
959
|
+
const { instance, spec, actorSession } = input;
|
|
960
|
+
const created = this.createSuccessors({
|
|
961
|
+
instance, spec, plans: input.plans, actorSession, identityProvenance: null, chainOfRecord: [], addEvent: input.register,
|
|
962
|
+
body: (plan) => workflowHandoffBody({
|
|
963
|
+
library: this.guidanceLibrary,
|
|
964
|
+
spec,
|
|
965
|
+
instance,
|
|
966
|
+
currentStep: null,
|
|
967
|
+
revision: { operationKey: input.operationKey, reason: input.reason },
|
|
968
|
+
nextStep: plan.step,
|
|
969
|
+
actorSession,
|
|
970
|
+
resultNote: undefined,
|
|
971
|
+
gate: plan.gate,
|
|
972
|
+
packetId: plan.packetId,
|
|
973
|
+
ownerSession: plan.owner,
|
|
974
|
+
}),
|
|
975
|
+
binding: { branchDrive: 0, hopCount: 0, hopsBaseline: 0 },
|
|
976
|
+
});
|
|
977
|
+
const nextFrontier = [...instance.currentFrontier, ...created.map((packet) => packet.qitemId)];
|
|
978
|
+
const nextStatus = nextFrontier.every((packetId) => this.queueRepo.getById(packetId)?.state === "blocked")
|
|
979
|
+
? "waiting" : "active";
|
|
980
|
+
const nextBindings = this.instanceStore.listFrontierBindings(instance.instanceId);
|
|
981
|
+
this.instanceStore.updateFrontier(instance.instanceId, nextFrontier, nextStatus, {
|
|
982
|
+
bumpHopCount: created.length > 0,
|
|
983
|
+
currentStepId: nextBindings.length === 1 ? nextBindings[0].stepId : "clear",
|
|
984
|
+
expectedVersion: instance.version,
|
|
985
|
+
});
|
|
986
|
+
return created;
|
|
987
|
+
}
|
|
782
988
|
async projectDependencyGraph(args) {
|
|
783
|
-
const { input, instance, spec, currentStep, packetBinding, currentOwnerSession, unansweredHumanGate } = args;
|
|
989
|
+
const { input, instance, spec, currentStep, packetBinding, currentOwnerSession, unansweredHumanGate, alreadyClosed } = args;
|
|
784
990
|
if (input.exit === "waiting" && instance.status === "waiting" && matchesStoredWaitingDecision(instance, input, currentStep.id, this.trailLog)) {
|
|
785
991
|
return {
|
|
786
992
|
instance,
|
|
@@ -797,22 +1003,7 @@ export class WorkflowProjector {
|
|
|
797
1003
|
}
|
|
798
1004
|
const mappedTarget = currentStep.next_hop?.on?.[input.exit];
|
|
799
1005
|
const completesPrerequisite = input.exit === "done" || input.exit === "handoff";
|
|
800
|
-
|
|
801
|
-
// A higher rank is a later done or handoff closure.
|
|
802
|
-
const trail = this.trailLog.listForInstanceInAppendOrder(instance.instanceId);
|
|
803
|
-
const latestCompletion = new Map();
|
|
804
|
-
trail.forEach((entry, index) => {
|
|
805
|
-
if (entry.closureReason === "done" || entry.closureReason === "handoff")
|
|
806
|
-
latestCompletion.set(entry.stepId, index + 1);
|
|
807
|
-
});
|
|
808
|
-
if (completesPrerequisite)
|
|
809
|
-
latestCompletion.set(currentStep.id, trail.length + 1);
|
|
810
|
-
// A completion older than a prerequisite's latest completion no longer counts, so a step
|
|
811
|
-
// re-run through a routed exit sends the steps that depend on it round again.
|
|
812
|
-
const completed = new Set([...latestCompletion]
|
|
813
|
-
.filter(([stepId, rank]) => (spec.steps.find((step) => step.id === stepId)?.depends_on ?? [])
|
|
814
|
-
.every((dependency) => (latestCompletion.get(dependency) ?? 0) < rank))
|
|
815
|
-
.map(([stepId]) => stepId));
|
|
1006
|
+
const completed = completedStepIds(spec, this.trailLog.listForInstanceInAppendOrder(instance.instanceId), completesPrerequisite ? currentStep.id : undefined);
|
|
816
1007
|
const liveBindings = this.instanceStore.listFrontierBindings(instance.instanceId);
|
|
817
1008
|
const liveStepIds = new Set(liveBindings.map((binding) => binding.stepId));
|
|
818
1009
|
const unresolved = this.instanceStore.listFailureOccurrences(instance.instanceId, "unresolved");
|
|
@@ -872,117 +1063,72 @@ export class WorkflowProjector {
|
|
|
872
1063
|
const createdPackets = [];
|
|
873
1064
|
this.eventBus.withNotifyEnvelope((register) => {
|
|
874
1065
|
const addEvent = (event) => { emitted.push(event); register(event); };
|
|
875
|
-
const ownerPlans =
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
step: currentStep,
|
|
915
|
-
packetId: input.currentPacketId,
|
|
916
|
-
ownerSession: currentOwnerSession,
|
|
917
|
-
})
|
|
918
|
-
: undefined,
|
|
919
|
-
});
|
|
920
|
-
addEvent(updated.persistedEvent);
|
|
1066
|
+
const ownerPlans = this.planSuccessors(instance, spec, nextSteps);
|
|
1067
|
+
if (!alreadyClosed) {
|
|
1068
|
+
const closureOwner = ownerPlans.length === 1 ? ownerPlans[0].owner : null;
|
|
1069
|
+
const closure = effectiveExit === "handoff" && ownerPlans.length !== 1
|
|
1070
|
+
? {
|
|
1071
|
+
state: "done",
|
|
1072
|
+
closureReason: "no-follow-on",
|
|
1073
|
+
closureTarget: null,
|
|
1074
|
+
transitionNote: `workflow graph: ${input.actorSession} completed ${currentStep.id}; ${ownerPlans.length} successors projected transactionally`,
|
|
1075
|
+
}
|
|
1076
|
+
: workflowExitToQueueClosure({ ...input, exit: effectiveExit, resultNote: effectiveResultNote }, closureOwner);
|
|
1077
|
+
const updated = this.queueRepo.updateWithinTransaction({
|
|
1078
|
+
qitemId: input.currentPacketId,
|
|
1079
|
+
actorSession: input.actorSession,
|
|
1080
|
+
identityProvenance: input.identityProvenance ?? null,
|
|
1081
|
+
viaWorkflowVerb: true,
|
|
1082
|
+
state: closure.state,
|
|
1083
|
+
closureReason: closure.closureReason,
|
|
1084
|
+
closureTarget: closure.closureTarget ?? undefined,
|
|
1085
|
+
handedOffTo: closure.handedOffTo,
|
|
1086
|
+
blockedOn: closure.blockedOn,
|
|
1087
|
+
transitionNote: [closure.transitionNote, unansweredHumanGate].filter(Boolean).join("; "),
|
|
1088
|
+
wakeMaxSeconds: effectiveExit === "waiting" && ownerPlans.length === 0 ? currentStep.re_present_max_seconds : undefined,
|
|
1089
|
+
wakeProgressEvidence: input.closureEvidence,
|
|
1090
|
+
wakeAfterSeconds: effectiveExit === "waiting" && ownerPlans.length === 0
|
|
1091
|
+
? currentStep.re_present_after_seconds
|
|
1092
|
+
: undefined,
|
|
1093
|
+
wakeMessage: effectiveExit === "waiting" && ownerPlans.length === 0 && currentStep.re_present_after_seconds !== undefined
|
|
1094
|
+
? workflowWaitWakeMessage({
|
|
1095
|
+
spec,
|
|
1096
|
+
instance,
|
|
1097
|
+
step: currentStep,
|
|
1098
|
+
packetId: input.currentPacketId,
|
|
1099
|
+
ownerSession: currentOwnerSession,
|
|
1100
|
+
})
|
|
1101
|
+
: undefined,
|
|
1102
|
+
});
|
|
1103
|
+
addEvent(updated.persistedEvent);
|
|
1104
|
+
}
|
|
921
1105
|
if (effectiveExit !== "waiting") {
|
|
922
1106
|
this.instanceStore.removeFrontierBinding(instance.instanceId, input.currentPacketId);
|
|
923
1107
|
if (this.watchdogJobsRepo) {
|
|
924
1108
|
disarmWorkflowKeepalive(this.watchdogJobsRepo, instance.instanceId, `workflow_packet_${effectiveExit}`, input.currentPacketId);
|
|
925
1109
|
}
|
|
926
1110
|
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
ownerSession: plan.owner,
|
|
944
|
-
}),
|
|
945
|
-
priority: "routine",
|
|
946
|
-
tier: plan.gate?.tier ?? "mode2",
|
|
947
|
-
tags: ["workflow", plan.gate ? "gate" : "handoff", `workflow:${spec.id}`, `instance:${instance.instanceId}`, `step:${plan.step.id}`, ...packetScopeTags(instance, plan.step.id)],
|
|
948
|
-
summary: plan.gate?.summary ?? undefined,
|
|
949
|
-
evidenceRef: plan.gate?.evidenceRef ?? undefined,
|
|
950
|
-
chainOfRecord: [input.currentPacketId],
|
|
951
|
-
});
|
|
952
|
-
addEvent(created.persistedEvent);
|
|
953
|
-
this.queueRepo.stageHandoffWake(created.qitemId, input.actorSession, created.destinationSession, input.identityProvenance ?? null, created.nudge);
|
|
954
|
-
if (plan.gate?.parkOn) {
|
|
955
|
-
const parked = this.queueRepo.updateWithinTransaction({
|
|
956
|
-
qitemId: created.qitemId,
|
|
957
|
-
actorSession: input.actorSession,
|
|
958
|
-
identityProvenance: input.identityProvenance ?? null,
|
|
959
|
-
state: "blocked",
|
|
960
|
-
closureReason: "blocked_on",
|
|
961
|
-
closureTarget: plan.gate.parkOn,
|
|
962
|
-
blockedOn: plan.gate.parkOn,
|
|
963
|
-
transitionNote: `workflow gate: parked on ${plan.gate.parkOn} pending sign-off`,
|
|
964
|
-
});
|
|
965
|
-
addEvent(parked.persistedEvent);
|
|
966
|
-
}
|
|
967
|
-
this.instanceStore.bindFrontierPacket({
|
|
968
|
-
instanceId: instance.instanceId,
|
|
969
|
-
packetId: created.qitemId,
|
|
970
|
-
stepId: plan.step.id,
|
|
1111
|
+
createdPackets.push(...this.createSuccessors({
|
|
1112
|
+
instance, spec, plans: ownerPlans, actorSession: input.actorSession,
|
|
1113
|
+
identityProvenance: input.identityProvenance ?? null, chainOfRecord: [input.currentPacketId], addEvent,
|
|
1114
|
+
body: (plan) => workflowHandoffBody({
|
|
1115
|
+
library: this.guidanceLibrary,
|
|
1116
|
+
spec,
|
|
1117
|
+
instance,
|
|
1118
|
+
currentStep,
|
|
1119
|
+
nextStep: plan.step,
|
|
1120
|
+
actorSession: input.actorSession,
|
|
1121
|
+
resultNote: effectiveResultNote,
|
|
1122
|
+
gate: plan.gate,
|
|
1123
|
+
packetId: plan.packetId,
|
|
1124
|
+
ownerSession: plan.owner,
|
|
1125
|
+
}),
|
|
1126
|
+
binding: {
|
|
971
1127
|
branchDrive: packetBinding.branchDrive + (ownerPlans.length > 1 ? 1 : 0),
|
|
972
1128
|
hopCount: packetBinding.hopCount + 1,
|
|
973
1129
|
hopsBaseline: packetBinding.hopsBaseline,
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
ensureWorkflowKeepaliveArmed(this.watchdogJobsRepo, {
|
|
977
|
-
instanceId: instance.instanceId,
|
|
978
|
-
packetId: created.qitemId,
|
|
979
|
-
targetSession: plan.owner,
|
|
980
|
-
registeredBySession: input.actorSession,
|
|
981
|
-
});
|
|
982
|
-
}
|
|
983
|
-
createdPackets.push({ qitemId: created.qitemId, step: plan.step, owner: plan.owner, nudge: created.nudge, blocked: Boolean(plan.gate?.parkOn) });
|
|
984
|
-
addEvent(this.eventBus.persistWithinTransaction({ type: "workflow.next_qitem_projected", instanceId: instance.instanceId, nextQitemId: created.qitemId, nextOwner: plan.owner, nextStepId: plan.step.id }));
|
|
985
|
-
}
|
|
1130
|
+
},
|
|
1131
|
+
}));
|
|
986
1132
|
if (isFailureOccurrence) {
|
|
987
1133
|
this.instanceStore.recordFailureOccurrence({
|
|
988
1134
|
instanceId: instance.instanceId,
|
|
@@ -1025,7 +1171,11 @@ export class WorkflowProjector {
|
|
|
1025
1171
|
stepRole: currentStep.actor_role,
|
|
1026
1172
|
closedAt: evaluatedAt,
|
|
1027
1173
|
closureReason: effectiveExit,
|
|
1028
|
-
closureEvidence: {
|
|
1174
|
+
closureEvidence: {
|
|
1175
|
+
...(effectiveClosureEvidence ?? {}),
|
|
1176
|
+
next_qitem_ids: createdPackets.map((packet) => packet.qitemId),
|
|
1177
|
+
...(alreadyClosed ? { [QUEUE_ROW_ALREADY_CLOSED]: alreadyClosedRecord(input, alreadyClosed, createdPackets.map((packet) => packet.qitemId), createdPackets.map((packet) => packet.step.id), createdPackets.map((packet) => packet.owner)) } : {}),
|
|
1178
|
+
},
|
|
1029
1179
|
actorSession: input.actorSession,
|
|
1030
1180
|
nextQitemId: createdPackets[0]?.qitemId ?? null,
|
|
1031
1181
|
priorQitemId: input.currentPacketId,
|
|
@@ -1056,7 +1206,7 @@ export class WorkflowProjector {
|
|
|
1056
1206
|
nextQitemIds: createdPackets.map((packet) => packet.qitemId),
|
|
1057
1207
|
nextStepIds: createdPackets.map((packet) => packet.step.id),
|
|
1058
1208
|
emittedEventTypes: emitted.map((event) => event.type),
|
|
1059
|
-
...(unansweredHumanGate ?
|
|
1209
|
+
...withAdvisories([unansweredHumanGate, alreadyClosed ? alreadyClosedNotice(input.currentPacketId, alreadyClosed, input.exit) : undefined]),
|
|
1060
1210
|
};
|
|
1061
1211
|
}
|
|
1062
1212
|
}
|
|
@@ -1101,6 +1251,10 @@ function matchesStoredWaitingDecision(instance, input, currentStepId, trailLog)
|
|
|
1101
1251
|
return false;
|
|
1102
1252
|
return isDeepEqual(storedRow.closureEvidence ?? null, input.closureEvidence ?? null);
|
|
1103
1253
|
}
|
|
1254
|
+
function withAdvisories(notices) {
|
|
1255
|
+
const advisories = notices.filter((notice) => Boolean(notice));
|
|
1256
|
+
return advisories.length ? { advisories } : {};
|
|
1257
|
+
}
|
|
1104
1258
|
function isDeepEqual(a, b) {
|
|
1105
1259
|
if (a === b)
|
|
1106
1260
|
return true;
|
|
@@ -1213,6 +1367,14 @@ function resolveRoleOnBoundRig(roleName, harness, roleCtx, stepId) {
|
|
|
1213
1367
|
candidates: result.disqualified,
|
|
1214
1368
|
});
|
|
1215
1369
|
}
|
|
1370
|
+
/** Preserve the old topology gate for template-looking rig names. Registered
|
|
1371
|
+
* literal names, including archived rigs, remain recordable as on main. */
|
|
1372
|
+
export function assertBoundWorkflowTarget(target, queue) {
|
|
1373
|
+
const at = target.indexOf("@");
|
|
1374
|
+
if (at >= 0 && target.slice(at + 1).includes("{rig}") && !queue.acceptsDestination(target)) {
|
|
1375
|
+
throw new QueueRepositoryError("unknown_destination_rig", `Workflow target ${target} has an unregistered rig name containing {rig}. Bind a rig with --rig <name>, or use a concrete registered destination.`, { destinationSession: target });
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1216
1378
|
/**
|
|
1217
1379
|
* Resolve a default owner for a step. v1 picks the first declared
|
|
1218
1380
|
* preferred_target. OPR.0.4.6.WF2 FR-2: a step with a `harness:` pin
|
|
@@ -1450,6 +1612,23 @@ export function workflowHumanGateGuidance(person) {
|
|
|
1450
1612
|
`While the person has not answered, preserve this park: use the continuation with --exit waiting --blocked-on ${person}. Bare --exit waiting replaces the human blocker with an external gate.`,
|
|
1451
1613
|
];
|
|
1452
1614
|
}
|
|
1615
|
+
/** The steps whose latest done or handoff completion is newer than each of their prerequisites' latest completion,
|
|
1616
|
+
* under `spec`'s dependencies. Ranked by trail append order, not closed_at, so a clock step-back can't reorder
|
|
1617
|
+
* completions; a completion older than a prerequisite's latest one no longer counts, so a step re-run through a routed
|
|
1618
|
+
* exit sends the steps that depend on it round again. `justCompleted` counts as the latest completion of all. */
|
|
1619
|
+
export function completedStepIds(spec, trail, justCompleted) {
|
|
1620
|
+
const latestCompletion = new Map();
|
|
1621
|
+
trail.forEach((entry, index) => {
|
|
1622
|
+
if (entry.closureReason === "done" || entry.closureReason === "handoff")
|
|
1623
|
+
latestCompletion.set(entry.stepId, index + 1);
|
|
1624
|
+
});
|
|
1625
|
+
if (justCompleted !== undefined)
|
|
1626
|
+
latestCompletion.set(justCompleted, trail.length + 1);
|
|
1627
|
+
return new Set([...latestCompletion]
|
|
1628
|
+
.filter(([stepId, rank]) => (spec.steps.find((step) => step.id === stepId)?.depends_on ?? [])
|
|
1629
|
+
.every((dependency) => (latestCompletion.get(dependency) ?? 0) < rank))
|
|
1630
|
+
.map(([stepId]) => stepId));
|
|
1631
|
+
}
|
|
1453
1632
|
function workflowHandoffBody(input) {
|
|
1454
1633
|
const lines = [
|
|
1455
1634
|
input.gate
|
|
@@ -1457,7 +1636,9 @@ function workflowHandoffBody(input) {
|
|
|
1457
1636
|
: `### Workflow handoff: ${input.spec.id}@${input.spec.version} step ${input.nextStep.id}`,
|
|
1458
1637
|
"",
|
|
1459
1638
|
`Workflow instance: ${input.instance.instanceId}`,
|
|
1460
|
-
|
|
1639
|
+
input.currentStep
|
|
1640
|
+
? `Prior step: ${input.currentStep.id} (${input.currentStep.actor_role}) closed by ${input.actorSession}`
|
|
1641
|
+
: `Projected by revision ${input.revision?.operationKey} (${input.actorSession}): every prerequisite of this step had completed. Decision: ${input.revision?.reason}`,
|
|
1461
1642
|
`This step: ${input.nextStep.id} (${input.nextStep.actor_role})`,
|
|
1462
1643
|
];
|
|
1463
1644
|
if (input.gate) {
|