@openrig/cli 0.4.4 → 0.4.6
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/daemon/assets/plugins/openrig-core/skills/mission-slice-sop/SKILL.md +6 -8
- package/daemon/assets/plugins/openrig-core/skills/openrig-cmux/SKILL.md +86 -0
- package/daemon/assets/plugins/openrig-core/skills/openrig-herdr/SKILL.md +158 -0
- package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +744 -96
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +12 -8
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/pi-resume.d.ts +32 -0
- package/daemon/dist/adapters/pi-resume.d.ts.map +1 -0
- package/daemon/dist/adapters/pi-resume.js +125 -0
- package/daemon/dist/adapters/pi-resume.js.map +1 -0
- package/daemon/dist/adapters/pi-runner-protocol.d.ts +88 -0
- package/daemon/dist/adapters/pi-runner-protocol.d.ts.map +1 -0
- package/daemon/dist/adapters/pi-runner-protocol.js +153 -0
- package/daemon/dist/adapters/pi-runner-protocol.js.map +1 -0
- package/daemon/dist/adapters/pi-runner.d.ts +99 -0
- package/daemon/dist/adapters/pi-runner.d.ts.map +1 -0
- package/daemon/dist/adapters/pi-runner.js +519 -0
- package/daemon/dist/adapters/pi-runner.js.map +1 -0
- package/daemon/dist/adapters/pi-runtime-adapter.d.ts +61 -0
- package/daemon/dist/adapters/pi-runtime-adapter.d.ts.map +1 -0
- package/daemon/dist/adapters/pi-runtime-adapter.js +356 -0
- package/daemon/dist/adapters/pi-runtime-adapter.js.map +1 -0
- package/daemon/dist/adapters/tmux.d.ts +22 -1
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +40 -1
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/build-info.js +3 -3
- package/daemon/dist/builtins/workflow-specs/branched-remediation.yaml +31 -0
- package/daemon/dist/builtins/workflow-specs/factory-rsi.yaml +152 -0
- package/daemon/dist/builtins/workflow-specs/gated-release.yaml +26 -0
- package/daemon/dist/builtins/workflow-specs/linear-build.yaml +21 -0
- package/daemon/dist/db/migrations/049_workflow_instance_version.d.ts +20 -0
- package/daemon/dist/db/migrations/049_workflow_instance_version.d.ts.map +1 -0
- package/daemon/dist/db/migrations/049_workflow_instance_version.js +24 -0
- package/daemon/dist/db/migrations/049_workflow_instance_version.js.map +1 -0
- package/daemon/dist/db/migrations/050_workflow_spec_json.d.ts +22 -0
- package/daemon/dist/db/migrations/050_workflow_spec_json.d.ts.map +1 -0
- package/daemon/dist/db/migrations/050_workflow_spec_json.js +26 -0
- package/daemon/dist/db/migrations/050_workflow_spec_json.js.map +1 -0
- package/daemon/dist/db/migrations/051_workflow_resume.d.ts +22 -0
- package/daemon/dist/db/migrations/051_workflow_resume.d.ts.map +1 -0
- package/daemon/dist/db/migrations/051_workflow_resume.js +27 -0
- package/daemon/dist/db/migrations/051_workflow_resume.js.map +1 -0
- package/daemon/dist/db/migrations/052_workflow_instance_bound_rig.d.ts +26 -0
- package/daemon/dist/db/migrations/052_workflow_instance_bound_rig.d.ts.map +1 -0
- package/daemon/dist/db/migrations/052_workflow_instance_bound_rig.js +30 -0
- package/daemon/dist/db/migrations/052_workflow_instance_bound_rig.js.map +1 -0
- package/daemon/dist/db/migrations/053_sessions_node_id_index.d.ts +48 -0
- package/daemon/dist/db/migrations/053_sessions_node_id_index.d.ts.map +1 -0
- package/daemon/dist/db/migrations/053_sessions_node_id_index.js +53 -0
- package/daemon/dist/db/migrations/053_sessions_node_id_index.js.map +1 -0
- package/daemon/dist/db/migrations/054_queue_transitions_archive.d.ts +34 -0
- package/daemon/dist/db/migrations/054_queue_transitions_archive.d.ts.map +1 -0
- package/daemon/dist/db/migrations/054_queue_transitions_archive.js +49 -0
- package/daemon/dist/db/migrations/054_queue_transitions_archive.js.map +1 -0
- package/daemon/dist/domain/claim-service.d.ts +11 -0
- 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/discovery-types.d.ts +1 -1
- package/daemon/dist/domain/discovery-types.d.ts.map +1 -1
- package/daemon/dist/domain/hosts/hosts-registry-reader.d.ts +1 -0
- package/daemon/dist/domain/hosts/hosts-registry-reader.d.ts.map +1 -1
- package/daemon/dist/domain/hosts/hosts-registry-reader.js +19 -0
- package/daemon/dist/domain/hosts/hosts-registry-reader.js.map +1 -1
- package/daemon/dist/domain/hosts/hosts-registry-writer.d.ts +11 -0
- package/daemon/dist/domain/hosts/hosts-registry-writer.d.ts.map +1 -0
- package/daemon/dist/domain/hosts/hosts-registry-writer.js +54 -0
- package/daemon/dist/domain/hosts/hosts-registry-writer.js.map +1 -0
- package/daemon/dist/domain/hosts/read-through.d.ts +28 -0
- package/daemon/dist/domain/hosts/read-through.d.ts.map +1 -0
- package/daemon/dist/domain/hosts/read-through.js +139 -0
- package/daemon/dist/domain/hosts/read-through.js.map +1 -0
- package/daemon/dist/domain/hosts/remote-daemon-http.d.ts +21 -0
- package/daemon/dist/domain/hosts/remote-daemon-http.d.ts.map +1 -1
- package/daemon/dist/domain/hosts/remote-daemon-http.js +49 -0
- package/daemon/dist/domain/hosts/remote-daemon-http.js.map +1 -1
- package/daemon/dist/domain/node-inventory.d.ts +18 -0
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +206 -95
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts +11 -0
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +10 -0
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/policies/workflow-keepalive.d.ts +7 -0
- package/daemon/dist/domain/policies/workflow-keepalive.d.ts.map +1 -1
- package/daemon/dist/domain/policies/workflow-keepalive.js +93 -13
- package/daemon/dist/domain/policies/workflow-keepalive.js.map +1 -1
- package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
- package/daemon/dist/domain/ps-projection.js +37 -26
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +105 -0
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +193 -4
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-retention.d.ts +130 -0
- package/daemon/dist/domain/queue-retention.d.ts.map +1 -0
- package/daemon/dist/domain/queue-retention.js +224 -0
- package/daemon/dist/domain/queue-retention.js.map +1 -0
- package/daemon/dist/domain/restore-orchestrator.d.ts +5 -0
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +29 -2
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/resume-token-capture.d.ts +13 -0
- package/daemon/dist/domain/resume-token-capture.d.ts.map +1 -1
- package/daemon/dist/domain/resume-token-capture.js +14 -1
- package/daemon/dist/domain/resume-token-capture.js.map +1 -1
- package/daemon/dist/domain/resume-token-validation.d.ts +1 -1
- package/daemon/dist/domain/resume-token-validation.d.ts.map +1 -1
- package/daemon/dist/domain/resume-token-validation.js +58 -10
- package/daemon/dist/domain/resume-token-validation.js.map +1 -1
- package/daemon/dist/domain/review/compose.d.ts +50 -1
- package/daemon/dist/domain/review/compose.d.ts.map +1 -1
- package/daemon/dist/domain/review/compose.js +92 -3
- package/daemon/dist/domain/review/compose.js.map +1 -1
- package/daemon/dist/domain/review/fleet-compose.d.ts +52 -0
- package/daemon/dist/domain/review/fleet-compose.d.ts.map +1 -0
- package/daemon/dist/domain/review/fleet-compose.js +294 -0
- package/daemon/dist/domain/review/fleet-compose.js.map +1 -0
- package/daemon/dist/domain/review/gather.d.ts +16 -1
- package/daemon/dist/domain/review/gather.d.ts.map +1 -1
- package/daemon/dist/domain/review/gather.js +177 -41
- package/daemon/dist/domain/review/gather.js.map +1 -1
- package/daemon/dist/domain/review/types.d.ts +104 -1
- package/daemon/dist/domain/review/types.d.ts.map +1 -1
- package/daemon/dist/domain/rig-expansion-service.d.ts.map +1 -1
- package/daemon/dist/domain/rig-expansion-service.js +3 -0
- package/daemon/dist/domain/rig-expansion-service.js.map +1 -1
- package/daemon/dist/domain/rig-repository.d.ts +7 -6
- package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/daemon/dist/domain/rig-repository.js +33 -11
- package/daemon/dist/domain/rig-repository.js.map +1 -1
- package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-codec.js +3 -0
- package/daemon/dist/domain/rigspec-codec.js.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.js +4 -0
- package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +11 -0
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.d.ts +6 -0
- package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.js +26 -1
- package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
- package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-schema.js +20 -1
- package/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/daemon/dist/domain/runtime-verifier.d.ts +7 -1
- package/daemon/dist/domain/runtime-verifier.d.ts.map +1 -1
- package/daemon/dist/domain/runtime-verifier.js +39 -1
- package/daemon/dist/domain/runtime-verifier.js.map +1 -1
- package/daemon/dist/domain/seat-handover-service.d.ts +9 -0
- package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-handover-service.js +2 -0
- package/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/daemon/dist/domain/seat-identity-store.d.ts +7 -0
- package/daemon/dist/domain/seat-identity-store.d.ts.map +1 -1
- package/daemon/dist/domain/seat-identity-store.js +27 -0
- package/daemon/dist/domain/seat-identity-store.js.map +1 -1
- package/daemon/dist/domain/seat-status-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-status-service.js +6 -4
- package/daemon/dist/domain/seat-status-service.js.map +1 -1
- package/daemon/dist/domain/session-name.d.ts +22 -0
- package/daemon/dist/domain/session-name.d.ts.map +1 -1
- package/daemon/dist/domain/session-name.js +29 -0
- package/daemon/dist/domain/session-name.js.map +1 -1
- package/daemon/dist/domain/slices/slice-detail-projector.d.ts.map +1 -1
- package/daemon/dist/domain/slices/slice-detail-projector.js +4 -5
- package/daemon/dist/domain/slices/slice-detail-projector.js.map +1 -1
- package/daemon/dist/domain/spec-library-workflow-scanner.d.ts +18 -2
- package/daemon/dist/domain/spec-library-workflow-scanner.d.ts.map +1 -1
- package/daemon/dist/domain/spec-library-workflow-scanner.js +23 -1
- package/daemon/dist/domain/spec-library-workflow-scanner.js.map +1 -1
- package/daemon/dist/domain/startup-proof.d.ts +10 -6
- package/daemon/dist/domain/startup-proof.d.ts.map +1 -1
- package/daemon/dist/domain/startup-proof.js +35 -7
- package/daemon/dist/domain/startup-proof.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 +13 -0
- package/daemon/dist/domain/successor-session-launcher.js.map +1 -1
- package/daemon/dist/domain/terminal/cmux-provider-adapter.d.ts +27 -0
- package/daemon/dist/domain/terminal/cmux-provider-adapter.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/cmux-provider-adapter.js +67 -0
- package/daemon/dist/domain/terminal/cmux-provider-adapter.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-adapter.d.ts +77 -0
- package/daemon/dist/domain/terminal/herdr-adapter.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-adapter.js +266 -0
- package/daemon/dist/domain/terminal/herdr-adapter.js.map +1 -0
- package/daemon/dist/domain/terminal/herdr-transport.d.ts +50 -0
- package/daemon/dist/domain/terminal/herdr-transport.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/herdr-transport.js +145 -0
- package/daemon/dist/domain/terminal/herdr-transport.js.map +1 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts +88 -0
- package/daemon/dist/domain/terminal/terminal-provider.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/terminal-provider.js +17 -0
- package/daemon/dist/domain/terminal/terminal-provider.js.map +1 -0
- package/daemon/dist/domain/terminal/terminal-service.d.ts +60 -0
- package/daemon/dist/domain/terminal/terminal-service.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/terminal-service.js +174 -0
- package/daemon/dist/domain/terminal/terminal-service.js.map +1 -0
- package/daemon/dist/domain/terminal/terminal-views-store.d.ts +77 -0
- package/daemon/dist/domain/terminal/terminal-views-store.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/terminal-views-store.js +146 -0
- package/daemon/dist/domain/terminal/terminal-views-store.js.map +1 -0
- package/daemon/dist/domain/terminal/view-composer.d.ts +42 -0
- package/daemon/dist/domain/terminal/view-composer.d.ts.map +1 -0
- package/daemon/dist/domain/terminal/view-composer.js +137 -0
- package/daemon/dist/domain/terminal/view-composer.js.map +1 -0
- package/daemon/dist/domain/tmux-option-defaults.d.ts +89 -0
- package/daemon/dist/domain/tmux-option-defaults.d.ts.map +1 -0
- package/daemon/dist/domain/tmux-option-defaults.js +132 -0
- package/daemon/dist/domain/tmux-option-defaults.js.map +1 -0
- package/daemon/dist/domain/types.d.ts +34 -1
- 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-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 +92 -0
- package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/daemon/dist/domain/workflow/slice-workflow-projection.d.ts.map +1 -1
- package/daemon/dist/domain/workflow/slice-workflow-projection.js +6 -2
- package/daemon/dist/domain/workflow/slice-workflow-projection.js.map +1 -1
- package/daemon/dist/domain/workflow-boot-sweep.d.ts +28 -0
- package/daemon/dist/domain/workflow-boot-sweep.d.ts.map +1 -0
- package/daemon/dist/domain/workflow-boot-sweep.js +102 -0
- package/daemon/dist/domain/workflow-boot-sweep.js.map +1 -0
- package/daemon/dist/domain/workflow-deadline.d.ts +74 -0
- package/daemon/dist/domain/workflow-deadline.d.ts.map +1 -0
- package/daemon/dist/domain/workflow-deadline.js +165 -0
- package/daemon/dist/domain/workflow-deadline.js.map +1 -0
- package/daemon/dist/domain/workflow-exception-escalation.d.ts +33 -0
- package/daemon/dist/domain/workflow-exception-escalation.d.ts.map +1 -0
- package/daemon/dist/domain/workflow-exception-escalation.js +104 -0
- package/daemon/dist/domain/workflow-exception-escalation.js.map +1 -0
- package/daemon/dist/domain/workflow-exception-router.d.ts +33 -0
- package/daemon/dist/domain/workflow-exception-router.d.ts.map +1 -0
- package/daemon/dist/domain/workflow-exception-router.js +96 -0
- package/daemon/dist/domain/workflow-exception-router.js.map +1 -0
- package/daemon/dist/domain/workflow-exception.d.ts +90 -0
- package/daemon/dist/domain/workflow-exception.d.ts.map +1 -0
- package/daemon/dist/domain/workflow-exception.js +122 -0
- package/daemon/dist/domain/workflow-exception.js.map +1 -0
- package/daemon/dist/domain/workflow-frontier-guard.d.ts +24 -0
- package/daemon/dist/domain/workflow-frontier-guard.d.ts.map +1 -0
- package/daemon/dist/domain/workflow-frontier-guard.js +30 -0
- package/daemon/dist/domain/workflow-frontier-guard.js.map +1 -0
- package/daemon/dist/domain/workflow-instance-store.d.ts +28 -0
- package/daemon/dist/domain/workflow-instance-store.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-instance-store.js +66 -10
- package/daemon/dist/domain/workflow-instance-store.js.map +1 -1
- package/daemon/dist/domain/workflow-keepalive-arming.d.ts +35 -0
- package/daemon/dist/domain/workflow-keepalive-arming.d.ts.map +1 -0
- package/daemon/dist/domain/workflow-keepalive-arming.js +87 -0
- package/daemon/dist/domain/workflow-keepalive-arming.js.map +1 -0
- package/daemon/dist/domain/workflow-projector.d.ts +117 -2
- package/daemon/dist/domain/workflow-projector.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-projector.js +672 -41
- package/daemon/dist/domain/workflow-projector.js.map +1 -1
- package/daemon/dist/domain/workflow-role-context.d.ts +57 -0
- package/daemon/dist/domain/workflow-role-context.d.ts.map +1 -0
- package/daemon/dist/domain/workflow-role-context.js +120 -0
- package/daemon/dist/domain/workflow-role-context.js.map +1 -0
- package/daemon/dist/domain/workflow-role-resolver.d.ts +65 -0
- package/daemon/dist/domain/workflow-role-resolver.d.ts.map +1 -0
- package/daemon/dist/domain/workflow-role-resolver.js +108 -0
- package/daemon/dist/domain/workflow-role-resolver.js.map +1 -0
- package/daemon/dist/domain/workflow-runtime.d.ts +157 -1
- package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-runtime.js +718 -11
- package/daemon/dist/domain/workflow-runtime.js.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.d.ts +26 -1
- package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.js +327 -13
- package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
- package/daemon/dist/domain/workflow-types.d.ts +143 -8
- package/daemon/dist/domain/workflow-types.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-types.js +14 -1
- package/daemon/dist/domain/workflow-types.js.map +1 -1
- package/daemon/dist/domain/workflow-validator.d.ts +11 -1
- package/daemon/dist/domain/workflow-validator.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-validator.js +246 -1
- package/daemon/dist/domain/workflow-validator.js.map +1 -1
- package/daemon/dist/index.d.ts +17 -0
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +44 -0
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/routes/activity.js +22 -0
- package/daemon/dist/routes/activity.js.map +1 -1
- package/daemon/dist/routes/hosts.d.ts +5 -0
- package/daemon/dist/routes/hosts.d.ts.map +1 -0
- package/daemon/dist/routes/hosts.js +346 -0
- package/daemon/dist/routes/hosts.js.map +1 -0
- package/daemon/dist/routes/queue.d.ts +2 -7
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +264 -9
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/review.d.ts.map +1 -1
- package/daemon/dist/routes/review.js +26 -0
- package/daemon/dist/routes/review.js.map +1 -1
- package/daemon/dist/routes/seat.js +13 -0
- package/daemon/dist/routes/seat.js.map +1 -1
- package/daemon/dist/routes/terminal.d.ts +11 -0
- package/daemon/dist/routes/terminal.d.ts.map +1 -0
- package/daemon/dist/routes/terminal.js +104 -0
- package/daemon/dist/routes/terminal.js.map +1 -0
- package/daemon/dist/routes/workflow.d.ts.map +1 -1
- package/daemon/dist/routes/workflow.js +102 -10
- package/daemon/dist/routes/workflow.js.map +1 -1
- package/daemon/dist/server.d.ts +5 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +22 -0
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +221 -12
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/specs/agents/factory-rsi/dogfood/agent.yaml +29 -0
- package/daemon/specs/agents/factory-rsi/dogfood/guidance/role.md +37 -0
- package/daemon/specs/agents/factory-rsi/release-manager/agent.yaml +29 -0
- package/daemon/specs/agents/factory-rsi/release-manager/guidance/role.md +40 -0
- package/daemon/specs/agents/shared/skills/core/mission-slice-sop/SKILL.md +6 -8
- package/daemon/specs/agents/shared/skills/core/openrig-cmux/SKILL.md +86 -0
- package/daemon/specs/agents/shared/skills/core/openrig-herdr/SKILL.md +158 -0
- package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +6 -6
- package/daemon/specs/rigs/launch/factory-rsi/CULTURE.md +47 -0
- package/daemon/specs/rigs/launch/factory-rsi/rig.yaml +115 -0
- package/dist/build-info.js +3 -3
- package/dist/commands/broadcast.d.ts +6 -1
- package/dist/commands/broadcast.d.ts.map +1 -1
- package/dist/commands/broadcast.js +101 -15
- package/dist/commands/broadcast.js.map +1 -1
- package/dist/commands/capture.d.ts.map +1 -1
- package/dist/commands/capture.js +99 -8
- package/dist/commands/capture.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +4 -0
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +5 -0
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/host.d.ts +14 -0
- package/dist/commands/host.d.ts.map +1 -1
- package/dist/commands/host.js +338 -14
- package/dist/commands/host.js.map +1 -1
- package/dist/commands/launch.d.ts.map +1 -1
- package/dist/commands/launch.js +5 -0
- package/dist/commands/launch.js.map +1 -1
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +10 -4
- package/dist/commands/ps.js.map +1 -1
- package/dist/commands/queue.d.ts +36 -0
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +73 -7
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/restore-packet.d.ts.map +1 -1
- package/dist/commands/restore-packet.js +13 -2
- package/dist/commands/restore-packet.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +114 -9
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/terminal.d.ts +6 -0
- package/dist/commands/terminal.d.ts.map +1 -0
- package/dist/commands/terminal.js +116 -0
- package/dist/commands/terminal.js.map +1 -0
- package/dist/commands/transcript.d.ts +6 -1
- package/dist/commands/transcript.d.ts.map +1 -1
- package/dist/commands/transcript.js +113 -30
- package/dist/commands/transcript.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +9 -0
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +11 -0
- package/dist/commands/whoami.js.map +1 -1
- package/dist/commands/workflow-errors.d.ts +23 -0
- package/dist/commands/workflow-errors.d.ts.map +1 -0
- package/dist/commands/workflow-errors.js +100 -0
- package/dist/commands/workflow-errors.js.map +1 -0
- package/dist/commands/workflow-follow.d.ts +71 -0
- package/dist/commands/workflow-follow.d.ts.map +1 -0
- package/dist/commands/workflow-follow.js +259 -0
- package/dist/commands/workflow-follow.js.map +1 -0
- package/dist/commands/workflow-render.d.ts +114 -0
- package/dist/commands/workflow-render.d.ts.map +1 -0
- package/dist/commands/workflow-render.js +223 -0
- package/dist/commands/workflow-render.js.map +1 -0
- package/dist/commands/workflow.d.ts +1 -0
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +278 -14
- package/dist/commands/workflow.js.map +1 -1
- package/dist/config-store.d.ts +15 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +103 -0
- package/dist/config-store.js.map +1 -1
- package/dist/cross-host-cli-helpers.d.ts +13 -0
- package/dist/cross-host-cli-helpers.d.ts.map +1 -1
- package/dist/cross-host-cli-helpers.js +27 -0
- package/dist/cross-host-cli-helpers.js.map +1 -1
- package/dist/cross-host-target.d.ts +49 -0
- package/dist/cross-host-target.d.ts.map +1 -0
- package/dist/cross-host-target.js +35 -0
- package/dist/cross-host-target.js.map +1 -0
- package/dist/host-registry.d.ts +8 -0
- package/dist/host-registry.d.ts.map +1 -1
- package/dist/host-registry.js +32 -0
- package/dist/host-registry.js.map +1 -1
- package/dist/host-selection.d.ts +13 -0
- package/dist/host-selection.d.ts.map +1 -0
- package/dist/host-selection.js +54 -0
- package/dist/host-selection.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/remote-host-ops.d.ts +1 -0
- package/dist/remote-host-ops.d.ts.map +1 -1
- package/dist/remote-host-ops.js +11 -4
- package/dist/remote-host-ops.js.map +1 -1
- package/dist/session-name.d.ts +23 -0
- package/dist/session-name.d.ts.map +1 -0
- package/dist/session-name.js +61 -0
- package/dist/session-name.js.map +1 -0
- package/package.json +1 -1
- package/ui/dist/assets/index-CFqxa0zW.css +32 -0
- package/ui/dist/assets/index-zrFqS7gL.js +623 -0
- package/ui/dist/index.html +2 -2
- package/ui/dist/assets/index-D69ZhNIr.js +0 -598
- package/ui/dist/assets/index-DJYun-8d.css +0 -32
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// OPR.0.4.6.WF5 FR-2: the maturity dial — exception ROUTING (v1.3 founder
|
|
2
|
+
// inversion). CLASSIFICATION ≠ ROUTING: workflow-exception.ts detects;
|
|
3
|
+
// this module maps class → target, deterministically.
|
|
4
|
+
//
|
|
5
|
+
// THE DIAL CHAIN (arch-ruled, in order):
|
|
6
|
+
// 1. the spec's declared per-CLASS position (exception_routing.classes)
|
|
7
|
+
// 2. the spec's declared per-WORKFLOW default (exception_routing.default)
|
|
8
|
+
// 3. the host-level dial default (settings key
|
|
9
|
+
// `workflow.exception_routing` — the MH-1 dynamic-key pattern;
|
|
10
|
+
// READ BY THE CALLER and passed in: this module stays pure)
|
|
11
|
+
// 4. absent everywhere → ORCHESTRATOR-FIRST (the v1.3 engine default)
|
|
12
|
+
//
|
|
13
|
+
// Position → target:
|
|
14
|
+
// orchestrator → the spec-declared orchestrator role, resolved through
|
|
15
|
+
// the SAME shipped role→preferred_targets mechanism step owners use
|
|
16
|
+
// (caller passes the resolver — no new resolution machinery, no
|
|
17
|
+
// binding-layer dependency). Unresolvable → THE NEVER-LOST FALLBACK:
|
|
18
|
+
// the human seat (an exception NEVER fails to route).
|
|
19
|
+
// human_only → the human seat FIRST, and it GATES there (the
|
|
20
|
+
// orchestrator never auto-acts). Class (c) is intrinsically
|
|
21
|
+
// human-only — its WF-2-compiled park IS the item; FR-2 mints no
|
|
22
|
+
// second one, so class (c) never reaches item creation here.
|
|
23
|
+
//
|
|
24
|
+
// THE TIER SPLIT (arch re-rule sharpening; guard's fence): the shipped
|
|
25
|
+
// attention union matches ON TIER regardless of destination, so
|
|
26
|
+
// `tier='human-gate'` rides ONLY human-routed positions (human_only ·
|
|
27
|
+
// the fallback · class-c); an orchestrator-routed item carries the
|
|
28
|
+
// ordinary workflow tier. The shape splits HERE, in this module — the
|
|
29
|
+
// shipped attention predicate is never edited by this slice.
|
|
30
|
+
//
|
|
31
|
+
// Dial semantics: same recorded state + same config = same target, every
|
|
32
|
+
// time. A dial change applies to FUTURE items only — resolution runs
|
|
33
|
+
// exactly once, at item creation; nothing re-routes live items.
|
|
34
|
+
/** The ordinary workflow-packet tier (the shipped default the attention
|
|
35
|
+
* union deliberately does NOT match on). */
|
|
36
|
+
export const WORKFLOW_EXCEPTION_ORCHESTRATOR_TIER = "mode2";
|
|
37
|
+
/** The human-routed tier — the attention union's first leg. */
|
|
38
|
+
export const WORKFLOW_EXCEPTION_HUMAN_TIER = "human-gate";
|
|
39
|
+
export function resolveExceptionRoute(input) {
|
|
40
|
+
// Class (c) is intrinsically human-only by its nature (a human decision
|
|
41
|
+
// IS the exception); the dial cannot re-point it.
|
|
42
|
+
let position;
|
|
43
|
+
let resolvedVia;
|
|
44
|
+
const routing = input.spec.exception_routing;
|
|
45
|
+
if (input.exceptionClass === "human_gate_trip") {
|
|
46
|
+
position = "human_only";
|
|
47
|
+
resolvedVia = "class-intrinsic";
|
|
48
|
+
}
|
|
49
|
+
else if (routing?.classes?.[input.exceptionClass]) {
|
|
50
|
+
position = routing.classes[input.exceptionClass];
|
|
51
|
+
resolvedVia = "class-declared";
|
|
52
|
+
}
|
|
53
|
+
else if (routing?.default) {
|
|
54
|
+
position = routing.default;
|
|
55
|
+
resolvedVia = "workflow-declared";
|
|
56
|
+
}
|
|
57
|
+
else if (input.hostDialDefault) {
|
|
58
|
+
position = input.hostDialDefault;
|
|
59
|
+
resolvedVia = "host-default";
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
position = "orchestrator";
|
|
63
|
+
resolvedVia = "engine-default";
|
|
64
|
+
}
|
|
65
|
+
if (position === "human_only") {
|
|
66
|
+
return {
|
|
67
|
+
position: "human_only",
|
|
68
|
+
destinationSession: input.humanFallbackSeat,
|
|
69
|
+
tier: WORKFLOW_EXCEPTION_HUMAN_TIER,
|
|
70
|
+
humanRouted: true,
|
|
71
|
+
resolvedVia,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
// orchestrator position: resolve the declared orchestrator role via the
|
|
75
|
+
// shipped mechanism; unresolvable (no role declared, role unknown, or
|
|
76
|
+
// no target) = the never-lost human fallback.
|
|
77
|
+
const roleName = routing?.orchestrator_role;
|
|
78
|
+
const target = roleName ? input.resolveRoleTarget(roleName) : null;
|
|
79
|
+
if (!target) {
|
|
80
|
+
return {
|
|
81
|
+
position: "fallback",
|
|
82
|
+
destinationSession: input.humanFallbackSeat,
|
|
83
|
+
tier: WORKFLOW_EXCEPTION_HUMAN_TIER,
|
|
84
|
+
humanRouted: true,
|
|
85
|
+
resolvedVia,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
position: "orchestrator",
|
|
90
|
+
destinationSession: target,
|
|
91
|
+
tier: WORKFLOW_EXCEPTION_ORCHESTRATOR_TIER,
|
|
92
|
+
humanRouted: false,
|
|
93
|
+
resolvedVia,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=workflow-exception-router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-exception-router.js","sourceRoot":"","sources":["../../src/domain/workflow-exception-router.ts"],"names":[],"mappings":"AAAA,0EAA0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IACpC,CAAC;SAAM,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;QACjC,QAAQ,GAAG,KAAK,CAAC,eAAe,CAAC;QACjC,WAAW,GAAG,cAAc,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,QAAQ,GAAG,cAAc,CAAC;QAC1B,WAAW,GAAG,gBAAgB,CAAC;IACjC,CAAC;IAED,IAAI,QAAQ,KAAK,YAAY,EAAE,CAAC;QAC9B,OAAO;YACL,QAAQ,EAAE,YAAY;YACtB,kBAAkB,EAAE,KAAK,CAAC,iBAAiB;YAC3C,IAAI,EAAE,6BAA6B;YACnC,WAAW,EAAE,IAAI;YACjB,WAAW;SACZ,CAAC;IACJ,CAAC;IAED,wEAAwE;IACxE,sEAAsE;IACtE,8CAA8C;IAC9C,MAAM,QAAQ,GAAG,OAAO,EAAE,iBAAiB,CAAC;IAC5C,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnE,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,QAAQ,EAAE,UAAU;YACpB,kBAAkB,EAAE,KAAK,CAAC,iBAAiB;YAC3C,IAAI,EAAE,6BAA6B;YACnC,WAAW,EAAE,IAAI;YACjB,WAAW;SACZ,CAAC;IACJ,CAAC;IACD,OAAO;QACL,QAAQ,EAAE,cAAc;QACxB,kBAAkB,EAAE,MAAM;QAC1B,IAAI,EAAE,oCAAoC;QAC1C,WAAW,EAAE,KAAK;QAClB,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { WorkflowDeadlineVerdict, WorkflowStepDeadlineEvidence } from "./workflow-deadline.js";
|
|
2
|
+
import type { WorkflowInstance } from "./workflow-types.js";
|
|
3
|
+
export declare const WORKFLOW_EXCEPTION_CLASSES: readonly ["unmapped_failed", "stuck_overdue", "human_gate_trip"];
|
|
4
|
+
export type WorkflowExceptionClass = (typeof WORKFLOW_EXCEPTION_CLASSES)[number];
|
|
5
|
+
/**
|
|
6
|
+
* THE OCCURRENCE DEFINITION (the single home — every dedup and
|
|
7
|
+
* new-occurrence rule reads from this sentence): one occurrence is one
|
|
8
|
+
* (instance, step, class) failure EPISODE, keyed by the recorded qitem id
|
|
9
|
+
* of the packet that embodies the episode — re-detections of the same
|
|
10
|
+
* unresolved episode share the key and dedupe into ONE item; resolve+resume
|
|
11
|
+
* closes the occurrence, and any later episode of the same step carries a
|
|
12
|
+
* NEW packet id and is therefore a NEW occurrence, never absorbed by the
|
|
13
|
+
* resolved past.
|
|
14
|
+
*
|
|
15
|
+
* The key is a RECORDED FACT (arch cell-2 ruling: identity = structured
|
|
16
|
+
* tags; a column stays delivery's option — not taken):
|
|
17
|
+
* (a) the frontier packet whose failed close felled the instance
|
|
18
|
+
* (b) the overdue packet named by the deadline evaluator's evidence
|
|
19
|
+
* (c) the compiled gate packet parked on the human
|
|
20
|
+
*/
|
|
21
|
+
export interface WorkflowExceptionIdentity {
|
|
22
|
+
workflowName: string;
|
|
23
|
+
instanceId: string;
|
|
24
|
+
/** Nullable only for class (a) on a pre-R2 row with no trail context. */
|
|
25
|
+
stepId: string | null;
|
|
26
|
+
exceptionClass: WorkflowExceptionClass;
|
|
27
|
+
/** The recorded packet id of this episode — see the occurrence JSDoc. */
|
|
28
|
+
occurrenceKey: string;
|
|
29
|
+
}
|
|
30
|
+
export interface WorkflowException {
|
|
31
|
+
identity: WorkflowExceptionIdentity;
|
|
32
|
+
/** Plain-language, evidence-bearing reason (rides the item's summary). */
|
|
33
|
+
reason: string;
|
|
34
|
+
/** Class-(b) carries the evaluator's evidence verbatim; (a)/(c) null. */
|
|
35
|
+
deadlineEvidence: WorkflowStepDeadlineEvidence | null;
|
|
36
|
+
}
|
|
37
|
+
/** The minimal recorded-state view class (a) classifies over. Callers pass
|
|
38
|
+
* the failed close's recorded facts (trail row / lastContinuationDecision);
|
|
39
|
+
* this module never queries. */
|
|
40
|
+
export interface FailedInstanceView {
|
|
41
|
+
instance: Pick<WorkflowInstance, "instanceId" | "workflowName" | "status" | "currentStepId" | "lastContinuationDecision">;
|
|
42
|
+
/** The step that closed failed (trail.step_id of the failing close). */
|
|
43
|
+
failedStepId: string | null;
|
|
44
|
+
/** The packet whose failed close felled the instance (trail.prior_qitem_id). */
|
|
45
|
+
failedPacketId: string;
|
|
46
|
+
/** The recorded failure note if any (resultNote / event reason). */
|
|
47
|
+
failureReason: string | null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Class (a): unmapped_failed. Pure: same view → same classification,
|
|
51
|
+
* replayed N times. A non-failed instance NEVER classifies (the mapped-
|
|
52
|
+
* failed negative: branch-routed failures keep status=active and are
|
|
53
|
+
* deterministic remediation, not exceptions).
|
|
54
|
+
*/
|
|
55
|
+
export declare function classifyFailedInstance(view: FailedInstanceView): WorkflowException | null;
|
|
56
|
+
/**
|
|
57
|
+
* Class (b): stuck_overdue. CONSUMES the WF-1 evaluator's verdict verbatim
|
|
58
|
+
* (rail: the single threshold home classifies; this function only lifts a
|
|
59
|
+
* non-healthy verdict into the exception shape). Healthy → null.
|
|
60
|
+
*/
|
|
61
|
+
export declare function classifyDeadlineVerdict(workflowName: string, verdict: WorkflowDeadlineVerdict): WorkflowException | null;
|
|
62
|
+
/** The recorded facts of a gate reach — the compiled kind is WF-2's
|
|
63
|
+
* recorded output, not a re-derivation. */
|
|
64
|
+
export interface GateTripView {
|
|
65
|
+
workflowName: string;
|
|
66
|
+
instanceId: string;
|
|
67
|
+
gatedStepId: string;
|
|
68
|
+
/** GateCompileResult.kind — "human" | "handler-role". */
|
|
69
|
+
gateKind: "human" | "handler-role";
|
|
70
|
+
/** The compiled gate packet's qitem id. */
|
|
71
|
+
gatePacketId: string;
|
|
72
|
+
/** The human seat the packet parks on (null for handler-role). */
|
|
73
|
+
parkOn: string | null;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Class (c): human_gate_trip — HUMAN-target gates only. THE HANDLER-ROLE
|
|
77
|
+
* NEGATIVE lives here: a handler-role gate returns null (a deterministic
|
|
78
|
+
* handoff, not an exception; the (a)/(b) backstop covers the handler's own
|
|
79
|
+
* step). Class (c) is intrinsically human-only at the dial.
|
|
80
|
+
*/
|
|
81
|
+
export declare function classifyGateTrip(view: GateTripView): WorkflowException | null;
|
|
82
|
+
/** Tag prefixes: `workflow:`/`instance:` extend the SHIPPED stamp
|
|
83
|
+
* (workflow-runtime.ts / workflow-projector.ts already emit them);
|
|
84
|
+
* `step:`/`exception:`/`occurrence:` are WF-5's additions (arch cell 2).
|
|
85
|
+
* FR-2 dedup and FR-3 cross-channel one-count JOIN on these BY QUERY —
|
|
86
|
+
* never by summary parsing. */
|
|
87
|
+
export declare function workflowExceptionTags(identity: WorkflowExceptionIdentity): string[];
|
|
88
|
+
/** The query key for within-occurrence dedup: one item per this tuple. */
|
|
89
|
+
export declare function occurrenceDedupKey(identity: WorkflowExceptionIdentity): string;
|
|
90
|
+
//# sourceMappingURL=workflow-exception.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-exception.d.ts","sourceRoot":"","sources":["../../src/domain/workflow-exception.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACpG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,eAAO,MAAM,0BAA0B,kEAI7B,CAAC;AACX,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,cAAc,EA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AAyB,GAAG,MAAM,EAAE,CAUnF;AAED,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,MAAM,CAE9E"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// OPR.0.4.6.WF5 FR-1: the closed exception taxonomy.
|
|
2
|
+
//
|
|
3
|
+
// An EXCEPTION is one of exactly three classes, each a PURE PREDICATE over
|
|
4
|
+
// recorded state (BR-1: never ambient probing, never judgment in the engine —
|
|
5
|
+
// agent judgment lives in RESOLVING, not detecting). Extending this taxonomy
|
|
6
|
+
// is a convention change, not driver discretion.
|
|
7
|
+
//
|
|
8
|
+
// (a) unmapped_failed — an instance entered status=failed. A MAPPED
|
|
9
|
+
// `failed` exit routes to its WF-2 remediation branch inside the same
|
|
10
|
+
// transaction (instance stays active) and is NOT an exception; only an
|
|
11
|
+
// unrouted failed close — including the engine-authored max_hops
|
|
12
|
+
// conversion — lands the instance in `failed`, so the recorded status
|
|
13
|
+
// IS the predicate.
|
|
14
|
+
// (b) stuck_overdue — a frontier packet past its deadline AS CLASSIFIED BY
|
|
15
|
+
// WF-1 FR-2's evaluator (workflow-deadline.ts, the single threshold
|
|
16
|
+
// home). This module consumes the verdict verbatim and never
|
|
17
|
+
// recomputes an anchor or threshold.
|
|
18
|
+
// (c) human_gate_trip — a WF-2 gate with a HUMAN target reached. The
|
|
19
|
+
// WF-2-compiled park IS the attention item (FR-2 mints no second one);
|
|
20
|
+
// this class exists so the item carries the exception identity.
|
|
21
|
+
//
|
|
22
|
+
// THE HANDLER-ROLE SPLIT (spec-guard blocker 2, ratified): a handler-role
|
|
23
|
+
// gate-trip is NOT an exception — it is a deterministic agent handoff by
|
|
24
|
+
// design. The escalation leg is the backstop BEHIND the handler: if the
|
|
25
|
+
// handler's own step fails or goes stuck, classes (a)/(b) fire on it.
|
|
26
|
+
//
|
|
27
|
+
// v1.3: CLASSIFICATION ≠ ROUTING. The maturity dial (workflow-exception-
|
|
28
|
+
// router.ts) maps class → target; nothing here knows about destinations.
|
|
29
|
+
export const WORKFLOW_EXCEPTION_CLASSES = [
|
|
30
|
+
"unmapped_failed",
|
|
31
|
+
"stuck_overdue",
|
|
32
|
+
"human_gate_trip",
|
|
33
|
+
];
|
|
34
|
+
/**
|
|
35
|
+
* Class (a): unmapped_failed. Pure: same view → same classification,
|
|
36
|
+
* replayed N times. A non-failed instance NEVER classifies (the mapped-
|
|
37
|
+
* failed negative: branch-routed failures keep status=active and are
|
|
38
|
+
* deterministic remediation, not exceptions).
|
|
39
|
+
*/
|
|
40
|
+
export function classifyFailedInstance(view) {
|
|
41
|
+
if (view.instance.status !== "failed")
|
|
42
|
+
return null;
|
|
43
|
+
return {
|
|
44
|
+
identity: {
|
|
45
|
+
workflowName: view.instance.workflowName,
|
|
46
|
+
instanceId: view.instance.instanceId,
|
|
47
|
+
stepId: view.failedStepId,
|
|
48
|
+
exceptionClass: "unmapped_failed",
|
|
49
|
+
occurrenceKey: view.failedPacketId,
|
|
50
|
+
},
|
|
51
|
+
reason: view.failureReason
|
|
52
|
+
? `workflow step failed with no remediation branch: ${view.failureReason}`
|
|
53
|
+
: "workflow step failed with no remediation branch",
|
|
54
|
+
deadlineEvidence: null,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Class (b): stuck_overdue. CONSUMES the WF-1 evaluator's verdict verbatim
|
|
59
|
+
* (rail: the single threshold home classifies; this function only lifts a
|
|
60
|
+
* non-healthy verdict into the exception shape). Healthy → null.
|
|
61
|
+
*/
|
|
62
|
+
export function classifyDeadlineVerdict(workflowName, verdict) {
|
|
63
|
+
if (verdict.state === "healthy" || !verdict.evidence)
|
|
64
|
+
return null;
|
|
65
|
+
const e = verdict.evidence;
|
|
66
|
+
return {
|
|
67
|
+
identity: {
|
|
68
|
+
workflowName,
|
|
69
|
+
instanceId: e.instanceId,
|
|
70
|
+
stepId: e.stepId,
|
|
71
|
+
exceptionClass: "stuck_overdue",
|
|
72
|
+
occurrenceKey: e.packetId,
|
|
73
|
+
},
|
|
74
|
+
reason: `workflow step ${e.stepId ?? "(unbound)"} is ${verdict.state} — packet ${e.packetId} ` +
|
|
75
|
+
`held by ${e.ownerSession}, ${e.overdueBySeconds}s past its ${e.anchor} anchor`,
|
|
76
|
+
deadlineEvidence: e,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Class (c): human_gate_trip — HUMAN-target gates only. THE HANDLER-ROLE
|
|
81
|
+
* NEGATIVE lives here: a handler-role gate returns null (a deterministic
|
|
82
|
+
* handoff, not an exception; the (a)/(b) backstop covers the handler's own
|
|
83
|
+
* step). Class (c) is intrinsically human-only at the dial.
|
|
84
|
+
*/
|
|
85
|
+
export function classifyGateTrip(view) {
|
|
86
|
+
if (view.gateKind !== "human")
|
|
87
|
+
return null;
|
|
88
|
+
return {
|
|
89
|
+
identity: {
|
|
90
|
+
workflowName: view.workflowName,
|
|
91
|
+
instanceId: view.instanceId,
|
|
92
|
+
stepId: view.gatedStepId,
|
|
93
|
+
exceptionClass: "human_gate_trip",
|
|
94
|
+
occurrenceKey: view.gatePacketId,
|
|
95
|
+
},
|
|
96
|
+
reason: `human decision required at gated step ${view.gatedStepId}` +
|
|
97
|
+
(view.parkOn ? ` (parked on ${view.parkOn})` : ""),
|
|
98
|
+
deadlineEvidence: null,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/** Tag prefixes: `workflow:`/`instance:` extend the SHIPPED stamp
|
|
102
|
+
* (workflow-runtime.ts / workflow-projector.ts already emit them);
|
|
103
|
+
* `step:`/`exception:`/`occurrence:` are WF-5's additions (arch cell 2).
|
|
104
|
+
* FR-2 dedup and FR-3 cross-channel one-count JOIN on these BY QUERY —
|
|
105
|
+
* never by summary parsing. */
|
|
106
|
+
export function workflowExceptionTags(identity) {
|
|
107
|
+
const tags = [
|
|
108
|
+
"workflow-exception",
|
|
109
|
+
`workflow:${identity.workflowName}`,
|
|
110
|
+
`instance:${identity.instanceId}`,
|
|
111
|
+
`exception:${identity.exceptionClass}`,
|
|
112
|
+
`occurrence:${identity.occurrenceKey}`,
|
|
113
|
+
];
|
|
114
|
+
if (identity.stepId)
|
|
115
|
+
tags.splice(3, 0, `step:${identity.stepId}`);
|
|
116
|
+
return tags;
|
|
117
|
+
}
|
|
118
|
+
/** The query key for within-occurrence dedup: one item per this tuple. */
|
|
119
|
+
export function occurrenceDedupKey(identity) {
|
|
120
|
+
return `${identity.instanceId}|${identity.stepId ?? ""}|${identity.exceptionClass}|${identity.occurrenceKey}`;
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=workflow-exception.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-exception.js","sourceRoot":"","sources":["../../src/domain/workflow-exception.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,EAAE;AACF,2EAA2E;AAC3E,8EAA8E;AAC9E,6EAA6E;AAC7E,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,4EAA4E;AAC5E,6EAA6E;AAC7E,uEAAuE;AACvE,4EAA4E;AAC5E,0BAA0B;AAC1B,6EAA6E;AAC7E,0EAA0E;AAC1E,mEAAmE;AACnE,2CAA2C;AAC3C,uEAAuE;AACvE,6EAA6E;AAC7E,sEAAsE;AACtE,EAAE;AACF,0EAA0E;AAC1E,yEAAyE;AACzE,wEAAwE;AACxE,sEAAsE;AACtE,EAAE;AACF,yEAAyE;AACzE,yEAAyE;AAKzE,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,iBAAiB;IACjB,eAAe;IACf,iBAAiB;CACT,CAAC;AAqDX;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAwB;IAC7D,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACnD,OAAO;QACL,QAAQ,EAAE;YACR,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY;YACxC,U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,EAAE,iBAAiB;YACjC,aAAa,EAAE,IAAI,CAAC,YAAY;SACjC;QACD,MAAM,EAAE,yCAAyC,IAAI,CAAC,WAAW,EAAE;YACjE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACpD,gBAAgB,EAAE,IAAI;KACvB,CAAC;AACJ,CAAC;AAED;;;;gCAIgC;AAChC,MAAM,UAAU,qBAAqB,CAAC,QAAmC;IACvE,MAAM,IAAI,GAAG;QACX,oBAAoB;QACpB,YAAY,QAAQ,CAAC,YAAY,EAAE;QACnC,YAAY,QAAQ,CAAC,UAAU,EAAE;QACjC,aAAa,QAAQ,CAAC,cAAc,EAAE;QACtC,cAAc,QAAQ,CAAC,aAAa,EAAE;KACvC,CAAC;IACF,IAAI,QAAQ,CAAC,MAAM;QAAE,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAClE,OAAO,IAAI,CAAC;AACd,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,kBAAkB,CAAC,QAAmC;IACpE,OAAO,GAAG,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,MAAM,IAAI,EAAE,IAAI,QAAQ,CAAC,cAAc,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC;AAChH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type Database from "better-sqlite3";
|
|
2
|
+
/**
|
|
3
|
+
* OPR.0.4.6.WF3 FR-6 — the frontier close-path guard's PREDICATE (pm
|
|
4
|
+
* convention ruling: prevention over detection).
|
|
5
|
+
*
|
|
6
|
+
* THE LAYERING PIN (arch, binding, Rev-1): the queue is the lower
|
|
7
|
+
* primitive and NEVER imports the workflow domain. This module is the
|
|
8
|
+
* workflow domain's export; startup INJECTS the predicate into
|
|
9
|
+
* QueueRepository (the `validateRig` injection precedent exactly).
|
|
10
|
+
* Same functional behavior as a direct import, without the module
|
|
11
|
+
* cycle the next refactor would strangle on.
|
|
12
|
+
*
|
|
13
|
+
* The predicate answers: is this qitem a LIVE workflow-frontier
|
|
14
|
+
* packet? Null for every non-workflow qitem — the zero-friction
|
|
15
|
+
* negative (non-workflow closure behavior stays byte-identical; no
|
|
16
|
+
* new rejections ride this predicate for ordinary traffic).
|
|
17
|
+
*/
|
|
18
|
+
export interface WorkflowFrontierBinding {
|
|
19
|
+
instanceId: string;
|
|
20
|
+
workflowName: string;
|
|
21
|
+
}
|
|
22
|
+
export type WorkflowFrontierPredicate = (qitemId: string) => WorkflowFrontierBinding | null;
|
|
23
|
+
export declare function createWorkflowFrontierPredicate(db: Database.Database): WorkflowFrontierPredicate;
|
|
24
|
+
//# sourceMappingURL=workflow-frontier-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-frontier-guard.d.ts","sourceRoot":"","sources":["../../src/domain/workflow-frontier-guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,yBAAyB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,uBAAuB,GAAG,IAAI,CAAC;AAE5F,wBAAgB,+BAA+B,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,yBAAyB,CA2BhG"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export function createWorkflowFrontierPredicate(db) {
|
|
2
|
+
return (qitemId) => {
|
|
3
|
+
// current_frontier is a JSON array column; a frontier membership
|
|
4
|
+
// check is a containment probe on the serialized id. Scoped to
|
|
5
|
+
// LIVE instances only — terminal instances hold no frontier.
|
|
6
|
+
let row;
|
|
7
|
+
try {
|
|
8
|
+
row = db
|
|
9
|
+
.prepare(`SELECT instance_id, workflow_name FROM workflow_instances
|
|
10
|
+
WHERE status IN ('active','waiting') AND current_frontier_json LIKE ?
|
|
11
|
+
LIMIT 1`)
|
|
12
|
+
.get(`%"${qitemId}"%`);
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
// Pre-workflow schemas (no workflow_instances table): nothing to
|
|
16
|
+
// guard — identical to the predicate-absent posture. ONLY that
|
|
17
|
+
// case is tolerated: any other SQL error (e.g. a renamed column)
|
|
18
|
+
// must fail LOUD — a swallowed error here silently disables a
|
|
19
|
+
// correctness guard (VM-caught: the first draft ate its own
|
|
20
|
+
// wrong-column error and the guard never fired).
|
|
21
|
+
if (err instanceof Error && /no such table/i.test(err.message))
|
|
22
|
+
return null;
|
|
23
|
+
throw err;
|
|
24
|
+
}
|
|
25
|
+
if (!row?.instance_id)
|
|
26
|
+
return null;
|
|
27
|
+
return { instanceId: row.instance_id, workflowName: row.workflow_name ?? "(unknown)" };
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=workflow-frontier-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-frontier-guard.js","sourceRoot":"","sources":["../../src/domain/workflow-frontier-guard.ts"],"names":[],"mappings":"AA0BA,MAAM,UAAU,+BAA+B,CAAC,EAAqB;IACnE,OAAO,CAAC,OAAe,EAAkC,EAAE;QACzD,iEAAiE;QACjE,+DAA+D;QAC/D,6DAA6D;QAC7D,IAAI,GAAiE,CAAC;QACtE,IAAI,CAAC;YACH,GAAG,GAAG,EAAE;iBACL,OAAO,CACN;;mBAES,CACV;iBACA,GAAG,CAAC,KAAK,OAAO,IAAI,CAAe,CAAC;QACzC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,iEAAiE;YACjE,+DAA+D;YAC/D,iEAAiE;YACjE,8DAA8D;YAC9D,4DAA4D;YAC5D,iDAAiD;YACjD,IAAI,GAAG,YAAY,KAAK,IAAI,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC;gBAAE,OAAO,IAAI,CAAC;YAC5E,MAAM,GAAG,CAAC;QACZ,CAAC;QACD,IAAI,CAAC,GAAG,EAAE,WAAW;YAAE,OAAO,IAAI,CAAC;QACnC,OAAO,EAAE,UAAU,EAAE,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,GAAG,CAAC,aAAa,IAAI,WAAW,EAAE,CAAC;IACzF,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -7,6 +7,12 @@ export interface CreateWorkflowInstanceInput {
|
|
|
7
7
|
initialFrontier?: string[];
|
|
8
8
|
/** R2: durable current-step binding set at instantiate time. */
|
|
9
9
|
currentStepId?: string;
|
|
10
|
+
/**
|
|
11
|
+
* OPR.0.4.6.FAC1: the rig NAME this instance binds to (already
|
|
12
|
+
* resolved by the runtime: targetRig override ?? spec.target.rig).
|
|
13
|
+
* null/absent = unbound (today's behavior byte-identical).
|
|
14
|
+
*/
|
|
15
|
+
boundRig?: string | null;
|
|
10
16
|
}
|
|
11
17
|
export declare class WorkflowInstanceError extends Error {
|
|
12
18
|
readonly code: string;
|
|
@@ -16,6 +22,9 @@ export declare class WorkflowInstanceError extends Error {
|
|
|
16
22
|
export declare class WorkflowInstanceStore {
|
|
17
23
|
private readonly db;
|
|
18
24
|
private readonly now;
|
|
25
|
+
private readonly hasVersionColumn;
|
|
26
|
+
private readonly hasResumeColumns;
|
|
27
|
+
private readonly hasBoundRigColumn;
|
|
19
28
|
constructor(db: Database.Database, now?: () => Date);
|
|
20
29
|
create(input: CreateWorkflowInstanceInput): WorkflowInstance;
|
|
21
30
|
getById(instanceId: string): WorkflowInstance | null;
|
|
@@ -41,6 +50,25 @@ export declare class WorkflowInstanceStore {
|
|
|
41
50
|
* the symbol "clear-current-step" (typed as the literal below).
|
|
42
51
|
*/
|
|
43
52
|
currentStepId?: string | "preserve" | "clear";
|
|
53
|
+
/**
|
|
54
|
+
* OPR.0.4.6.WF1 FR-5 — the optimistic-concurrency guard. When
|
|
55
|
+
* provided, the UPDATE is qualified `WHERE version = ?` and bumps
|
|
56
|
+
* `version = version + 1`; zero rows changed throws the
|
|
57
|
+
* structured `instance_version_conflict` naming expected/actual
|
|
58
|
+
* (the caller's transaction rolls back whole). When omitted,
|
|
59
|
+
* legacy unguarded behavior (no version read, no bump) — the
|
|
60
|
+
* projector ALWAYS provides it.
|
|
61
|
+
*/
|
|
62
|
+
expectedVersion?: number;
|
|
63
|
+
/**
|
|
64
|
+
* OPR.0.4.6.WF5 FR-4 — the resume stamp: sets the recorded
|
|
65
|
+
* redrive count AND the livelock-rail hops baseline atomically
|
|
66
|
+
* with the frontier rebind. Only resume() passes it.
|
|
67
|
+
*/
|
|
68
|
+
resumeStamp?: {
|
|
69
|
+
resumeCount: number;
|
|
70
|
+
hopsBaseline: number;
|
|
71
|
+
};
|
|
44
72
|
}): void;
|
|
45
73
|
}
|
|
46
74
|
//# sourceMappingURL=workflow-instance-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-instance-store.d.ts","sourceRoot":"","sources":["../../src/domain/workflow-instance-store.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-instance-store.d.ts","sourceRoot":"","sources":["../../src/domain/workflow-instance-store.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EACV,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AA2C7B,MAAM,WAAW,2BAA2B;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE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AM,GAAG,IAAI,CAAC;QAClC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B;;;;;;WAMG;QACH,aAAa,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;QAC9C;;;;;;;;WAQG;QACH,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB;;;;WAIG;QACH,WAAW,CAAC,EAAE;YAAE,WAAW,EAAE,MAAM,CAAC;YAAC,YAAY,EAAE,MAAM,CAAA;SAAE,CAAC;KACxD,GACL,IAAI;CAoDR"}
|
|
@@ -5,6 +5,21 @@
|
|
|
5
5
|
// daemon restart without filesystem reconciliation: list/getById query
|
|
6
6
|
// SQLite directly.
|
|
7
7
|
import { ulid } from "ulid";
|
|
8
|
+
/** Defensive column probe (the detectQueueColumn house pattern) —
|
|
9
|
+
* older test fixtures bypass the canonical migration list, so the
|
|
10
|
+
* version column (migration 049) may be absent; the guard degrades
|
|
11
|
+
* to legacy unguarded updates there. Production always migrates. */
|
|
12
|
+
function detectInstanceColumn(db, columnName) {
|
|
13
|
+
try {
|
|
14
|
+
return db
|
|
15
|
+
.prepare("PRAGMA table_info(workflow_instances)")
|
|
16
|
+
.all()
|
|
17
|
+
.some((row) => row.name === columnName);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
8
23
|
export class WorkflowInstanceError extends Error {
|
|
9
24
|
code;
|
|
10
25
|
details;
|
|
@@ -18,20 +33,42 @@ export class WorkflowInstanceError extends Error {
|
|
|
18
33
|
export class WorkflowInstanceStore {
|
|
19
34
|
db;
|
|
20
35
|
now;
|
|
36
|
+
hasVersionColumn;
|
|
37
|
+
hasResumeColumns;
|
|
38
|
+
hasBoundRigColumn;
|
|
21
39
|
constructor(db, now = () => new Date()) {
|
|
22
40
|
this.db = db;
|
|
23
41
|
this.now = now;
|
|
42
|
+
this.hasVersionColumn = detectInstanceColumn(db, "version");
|
|
43
|
+
this.hasResumeColumns = detectInstanceColumn(db, "resume_count");
|
|
44
|
+
this.hasBoundRigColumn = detectInstanceColumn(db, "bound_rig");
|
|
24
45
|
}
|
|
25
46
|
create(input) {
|
|
26
47
|
const instanceId = ulid();
|
|
27
48
|
const createdAt = this.now().toISOString();
|
|
28
49
|
const frontier = input.initialFrontier ?? [];
|
|
50
|
+
// OPR.0.4.6.FAC1: bound_rig rides the same defensive column probe
|
|
51
|
+
// as version/resume (legacy fixtures without migration 052 keep the
|
|
52
|
+
// legacy INSERT; production always migrates).
|
|
53
|
+
const boundRigCol = this.hasBoundRigColumn ? ", bound_rig" : "";
|
|
54
|
+
const boundRigVal = this.hasBoundRigColumn ? ", ?" : "";
|
|
55
|
+
const params = [
|
|
56
|
+
instanceId,
|
|
57
|
+
input.workflowName,
|
|
58
|
+
input.workflowVersion,
|
|
59
|
+
input.createdBySession,
|
|
60
|
+
createdAt,
|
|
61
|
+
JSON.stringify(frontier),
|
|
62
|
+
input.currentStepId ?? null,
|
|
63
|
+
];
|
|
64
|
+
if (this.hasBoundRigColumn)
|
|
65
|
+
params.push(input.boundRig ?? null);
|
|
29
66
|
this.db
|
|
30
67
|
.prepare(`INSERT INTO workflow_instances (
|
|
31
68
|
instance_id, workflow_name, workflow_version, created_by_session,
|
|
32
|
-
created_at, status, current_frontier_json, current_step_id, hop_count
|
|
33
|
-
) VALUES (?, ?, ?, ?, ?, 'active', ?, ?, 0)`)
|
|
34
|
-
.run(
|
|
69
|
+
created_at, status, current_frontier_json, current_step_id, hop_count${boundRigCol}
|
|
70
|
+
) VALUES (?, ?, ?, ?, ?, 'active', ?, ?, 0${boundRigVal})`)
|
|
71
|
+
.run(...params);
|
|
35
72
|
return this.getByIdOrThrow(instanceId);
|
|
36
73
|
}
|
|
37
74
|
getById(instanceId) {
|
|
@@ -67,6 +104,12 @@ export class WorkflowInstanceStore {
|
|
|
67
104
|
*/
|
|
68
105
|
updateFrontier(instanceId, nextFrontier, nextStatus, opts = {}) {
|
|
69
106
|
const setHop = opts.bumpHopCount ? "hop_count = hop_count + 1, " : "";
|
|
107
|
+
const setResume = opts.resumeStamp && this.hasResumeColumns
|
|
108
|
+
? `resume_count = ${Number(opts.resumeStamp.resumeCount)}, hops_baseline = ${Number(opts.resumeStamp.hopsBaseline)}, `
|
|
109
|
+
: "";
|
|
110
|
+
const guardVersion = opts.expectedVersion !== undefined && this.hasVersionColumn;
|
|
111
|
+
const setVersion = guardVersion ? "version = version + 1, " : "";
|
|
112
|
+
const versionWhere = guardVersion ? " AND version = ?" : "";
|
|
70
113
|
let currentStepClause = "";
|
|
71
114
|
let currentStepValue;
|
|
72
115
|
if (opts.currentStepId === "preserve" || opts.currentStepId === undefined) {
|
|
@@ -81,17 +124,26 @@ export class WorkflowInstanceStore {
|
|
|
81
124
|
currentStepValue = opts.currentStepId;
|
|
82
125
|
}
|
|
83
126
|
const sql = `UPDATE workflow_instances SET
|
|
84
|
-
${setHop}${currentStepClause}status = ?, current_frontier_json = ?,
|
|
127
|
+
${setVersion}${setHop}${setResume}${currentStepClause}status = ?, current_frontier_json = ?,
|
|
85
128
|
last_continuation_decision_json = COALESCE(?, last_continuation_decision_json),
|
|
86
129
|
fallback_synthesis = COALESCE(?, fallback_synthesis),
|
|
87
130
|
completed_at = COALESCE(?, completed_at)
|
|
88
|
-
WHERE instance_id =
|
|
131
|
+
WHERE instance_id = ?${versionWhere}`;
|
|
89
132
|
const stmt = this.db.prepare(sql);
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
133
|
+
const params = [];
|
|
134
|
+
if (currentStepValue !== undefined)
|
|
135
|
+
params.push(currentStepValue);
|
|
136
|
+
params.push(nextStatus, JSON.stringify(nextFrontier), opts.lastContinuationDecision ? JSON.stringify(opts.lastContinuationDecision) : null, opts.fallbackSynthesis ?? null, opts.completedAt ?? null, instanceId);
|
|
137
|
+
if (guardVersion)
|
|
138
|
+
params.push(opts.expectedVersion);
|
|
139
|
+
const info = stmt.run(...params);
|
|
140
|
+
if (guardVersion && info.changes === 0) {
|
|
141
|
+
const current = this.getById(instanceId);
|
|
142
|
+
throw new WorkflowInstanceError("instance_version_conflict", `workflow instance ${instanceId} advanced concurrently: expected version ${opts.expectedVersion}, actual ${current ? current.version : "(instance missing)"} — the losing writer's transaction rolls back whole; re-read and re-project against current state`, {
|
|
143
|
+
instanceId,
|
|
144
|
+
expectedVersion: opts.expectedVersion,
|
|
145
|
+
actualVersion: current?.version ?? null,
|
|
146
|
+
});
|
|
95
147
|
}
|
|
96
148
|
}
|
|
97
149
|
}
|
|
@@ -111,6 +163,10 @@ function rowToInstance(row) {
|
|
|
111
163
|
? JSON.parse(row.last_continuation_decision_json)
|
|
112
164
|
: null,
|
|
113
165
|
completedAt: row.completed_at,
|
|
166
|
+
version: row.version ?? 0,
|
|
167
|
+
resumeCount: row.resume_count ?? 0,
|
|
168
|
+
hopsBaseline: row.hops_baseline ?? 0,
|
|
169
|
+
boundRig: row.bound_rig ?? null,
|
|
114
170
|
};
|
|
115
171
|
}
|
|
116
172
|
//# sourceMappingURL=workflow-instance-store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-instance-store.js","sourceRoot":"","sources":["../../src/domain/workflow-instance-store.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,EAAE;AACF,0DAA0D;AAC1D,uEAAuE;AACvE,uEAAuE;AACvE,mBAAmB;AAGnB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"workflow-instance-store.js","sourceRoot":"","sources":["../../src/domain/workflow-instance-store.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,EAAE;AACF,0DAA0D;AAC1D,uEAAuE;AACvE,uEAAuE;AACvE,mBAAmB;AAGnB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAgC5B;;;qEAGqE;AACrE,SAAS,oBAAoB,CAAC,EAAqB,EAAE,UAAkB;IACrE,IAAI,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,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,oBAAoB,mGAAmG,EAC9P;gBACE,UAAU;gBACV,eAAe,EAAE,IAAI,CAAC,eAAe;gBACrC,aAAa,EAAE,OAAO,EAAE,OAAO,IAAI,IAAI;aACxC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;CACF;AAED,SAAS,aAAa,CAAC,GAAgB;IACrC,OAAO;QACL,UAAU,EAAE,GAAG,CAAC,WAAW;QAC3B,YAAY,EAAE,GAAG,CAAC,aAAa;QAC/B,eAAe,EAAE,GAAG,CAAC,gBAAgB;QACrC,gBAAgB,EAAE,GAAG,CAAC,kBAAkB;QACxC,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,MAAM,EAAE,GAAG,CAAC,MAAgC;QAC5C,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,qBAAqB,CAAa;QAClE,aAAa,EAAE,GAAG,CAAC,eAAe;QAClC,QAAQ,EAAE,GAAG,CAAC,SAAS;QACvB,iBAAiB,EAAE,GAAG,CAAC,kBAAkB;QACzC,wBAAwB,EAAE,GAAG,CAAC,+BAA+B;YAC3D,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,+BAA+B,CAA6B;YAC9E,CAAC,CAAC,IAAI;QACR,WAAW,EAAE,GAAG,CAAC,YAAY;QAC7B,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,CAAC;QACzB,WAAW,EAAE,GAAG,CAAC,YAAY,IAAI,CAAC;QAClC,YAAY,EAAE,GAAG,CAAC,aAAa,IAAI,CAAC;QACpC,QAAQ,EAAE,GAAG,CAAC,SAAS,IAAI,IAAI;KAChC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { WatchdogJob, WatchdogJobsRepository } from "./watchdog-jobs-repository.js";
|
|
2
|
+
/**
|
|
3
|
+
* Evaluation cadence for auto-armed keepalive jobs. Deadline-gated
|
|
4
|
+
* evaluations are quiet skips until overdue, so this interval costs
|
|
5
|
+
* nothing on the happy path (quiet skips are not even recorded in
|
|
6
|
+
* watchdog history).
|
|
7
|
+
*/
|
|
8
|
+
export declare const WORKFLOW_KEEPALIVE_AUTO_INTERVAL_SECONDS: number;
|
|
9
|
+
export declare function buildKeepaliveSpecYaml(instanceId: string, targetSession: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Find the active auto/manual keepalive job carrying this instance id.
|
|
12
|
+
* Jobs carry context only inside spec_yaml (no context column); ULIDs
|
|
13
|
+
* are 26-char unique so a containment check is exact in practice.
|
|
14
|
+
*/
|
|
15
|
+
export declare function findArmedKeepaliveJob(repo: WatchdogJobsRepository, instanceId: string): WatchdogJob | null;
|
|
16
|
+
/**
|
|
17
|
+
* Idempotent in-transaction arm: registers the per-instance keepalive
|
|
18
|
+
* job if no active one exists. Composable inside the scribe txn
|
|
19
|
+
* (register is a plain INSERT).
|
|
20
|
+
*/
|
|
21
|
+
export declare function ensureWorkflowKeepaliveArmed(repo: WatchdogJobsRepository, input: {
|
|
22
|
+
instanceId: string;
|
|
23
|
+
targetSession: string;
|
|
24
|
+
registeredBySession: string;
|
|
25
|
+
}): {
|
|
26
|
+
jobId: string;
|
|
27
|
+
newlyArmed: boolean;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* In-transaction disarm on terminal instance state (completed/failed):
|
|
31
|
+
* the job goes terminal so no orphaned watchdog noise survives the
|
|
32
|
+
* instance (FR-3 AC). No-op when nothing is armed.
|
|
33
|
+
*/
|
|
34
|
+
export declare function disarmWorkflowKeepalive(repo: WatchdogJobsRepository, instanceId: string, reason: string): string | null;
|
|
35
|
+
//# sourceMappingURL=workflow-keepalive-arming.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-keepalive-arming.d.ts","sourceRoot":"","sources":["../../src/domain/workflow-keepalive-arming.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EACV,WAAW,EACX,sBAAsB,EACvB,MAAM,+BAA+B,CAAC;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,wCAAwC,QAAU,CAAC;AAEhE,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAUxF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,sBAAsB,EAC5B,UAAU,EAAE,MAAM,GACjB,WAAW,GAAG,IAAI,CAQpB;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,sBAAsB,EAC5B,KAAK,EAAE;IACL,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,GACA;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAWxC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,sBAAsB,EAC5B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,MAAM,GAAG,IAAI,CAKf"}
|