@openrig/cli 0.4.3 → 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/guidance/openrig-start.md +6 -0
- package/daemon/assets/plugins/openrig-core/skills/mission-slice-sop/SKILL.md +47 -21
- 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 +742 -94
- 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.d.ts +12 -0
- package/daemon/dist/build-info.d.ts.map +1 -0
- package/daemon/dist/build-info.js +11 -0
- package/daemon/dist/build-info.js.map +1 -0
- 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/048_queue_item_evidence_ref.d.ts +18 -0
- package/daemon/dist/db/migrations/048_queue_item_evidence_ref.d.ts.map +1 -0
- package/daemon/dist/db/migrations/048_queue_item_evidence_ref.js +22 -0
- package/daemon/dist/db/migrations/048_queue_item_evidence_ref.js.map +1 -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/feed/attention-aggregator.d.ts +31 -0
- package/daemon/dist/domain/feed/attention-aggregator.d.ts.map +1 -0
- package/daemon/dist/domain/feed/attention-aggregator.js +119 -0
- package/daemon/dist/domain/feed/attention-aggregator.js.map +1 -0
- package/daemon/dist/domain/files/file-write-service.d.ts +11 -2
- package/daemon/dist/domain/files/file-write-service.d.ts.map +1 -1
- package/daemon/dist/domain/files/file-write-service.js +77 -0
- package/daemon/dist/domain/files/file-write-service.js.map +1 -1
- package/daemon/dist/domain/hosts/fanout-contract.d.ts +33 -0
- package/daemon/dist/domain/hosts/fanout-contract.d.ts.map +1 -0
- package/daemon/dist/domain/hosts/fanout-contract.js +23 -0
- package/daemon/dist/domain/hosts/fanout-contract.js.map +1 -0
- package/daemon/dist/domain/hosts/hosts-registry-reader.d.ts +50 -0
- package/daemon/dist/domain/hosts/hosts-registry-reader.d.ts.map +1 -0
- package/daemon/dist/domain/hosts/hosts-registry-reader.js +184 -0
- package/daemon/dist/domain/hosts/hosts-registry-reader.js.map +1 -0
- 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 +56 -0
- package/daemon/dist/domain/hosts/remote-daemon-http.d.ts.map +1 -0
- package/daemon/dist/domain/hosts/remote-daemon-http.js +154 -0
- package/daemon/dist/domain/hosts/remote-daemon-http.js.map +1 -0
- package/daemon/dist/domain/human-route-enforcer.d.ts +71 -0
- package/daemon/dist/domain/human-route-enforcer.d.ts.map +1 -0
- package/daemon/dist/domain/human-route-enforcer.js +80 -0
- package/daemon/dist/domain/human-route-enforcer.js.map +1 -0
- package/daemon/dist/domain/mission-control/audit-browse.d.ts +8 -0
- package/daemon/dist/domain/mission-control/audit-browse.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/audit-browse.js +19 -0
- package/daemon/dist/domain/mission-control/audit-browse.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts +1 -1
- package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-action-log.js +4 -0
- package/daemon/dist/domain/mission-control/mission-control-action-log.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.js +1 -1
- package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-read-layer.js +1 -1
- package/daemon/dist/domain/mission-control/mission-control-read-layer.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +28 -0
- 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 +125 -0
- package/daemon/dist/domain/mission-control/mission-control-write-contract.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 +28 -1
- package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
- package/daemon/dist/domain/ps-projection.js +76 -26
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +130 -1
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +304 -11
- 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/brief-spine.d.ts +19 -0
- package/daemon/dist/domain/review/brief-spine.d.ts.map +1 -0
- package/daemon/dist/domain/review/brief-spine.js +86 -0
- package/daemon/dist/domain/review/brief-spine.js.map +1 -0
- package/daemon/dist/domain/review/compose.d.ts +277 -0
- package/daemon/dist/domain/review/compose.d.ts.map +1 -0
- package/daemon/dist/domain/review/compose.js +862 -0
- package/daemon/dist/domain/review/compose.js.map +1 -0
- 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/freeze.d.ts +31 -0
- package/daemon/dist/domain/review/freeze.d.ts.map +1 -0
- package/daemon/dist/domain/review/freeze.js +257 -0
- package/daemon/dist/domain/review/freeze.js.map +1 -0
- package/daemon/dist/domain/review/gather.d.ts +115 -0
- package/daemon/dist/domain/review/gather.d.ts.map +1 -0
- package/daemon/dist/domain/review/gather.js +812 -0
- package/daemon/dist/domain/review/gather.js.map +1 -0
- package/daemon/dist/domain/review/types.d.ts +361 -0
- package/daemon/dist/domain/review/types.d.ts.map +1 -0
- package/daemon/dist/domain/review/types.js +35 -0
- package/daemon/dist/domain/review/types.js.map +1 -0
- 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/scope/scope-approve.d.ts +64 -0
- package/daemon/dist/domain/scope/scope-approve.d.ts.map +1 -0
- package/daemon/dist/domain/scope/scope-approve.js +153 -0
- package/daemon/dist/domain/scope/scope-approve.js.map +1 -0
- package/daemon/dist/domain/scope/scope-audit.d.ts +9 -1
- package/daemon/dist/domain/scope/scope-audit.d.ts.map +1 -1
- package/daemon/dist/domain/scope/scope-audit.js +173 -1
- package/daemon/dist/domain/scope/scope-audit.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/topology/multi-rig-launcher.d.ts +49 -0
- package/daemon/dist/domain/topology/multi-rig-launcher.d.ts.map +1 -0
- package/daemon/dist/domain/topology/multi-rig-launcher.js +132 -0
- package/daemon/dist/domain/topology/multi-rig-launcher.js.map +1 -0
- package/daemon/dist/domain/topology/remote-up-leaf.d.ts +29 -0
- package/daemon/dist/domain/topology/remote-up-leaf.d.ts.map +1 -0
- package/daemon/dist/domain/topology/remote-up-leaf.js +60 -0
- package/daemon/dist/domain/topology/remote-up-leaf.js.map +1 -0
- package/daemon/dist/domain/topology/topology-manifest.d.ts +34 -0
- package/daemon/dist/domain/topology/topology-manifest.d.ts.map +1 -0
- package/daemon/dist/domain/topology/topology-manifest.js +195 -0
- package/daemon/dist/domain/topology/topology-manifest.js.map +1 -0
- package/daemon/dist/domain/types.d.ts +39 -1
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/up-command-router.d.ts +1 -1
- package/daemon/dist/domain/up-command-router.d.ts.map +1 -1
- package/daemon/dist/domain/up-command-router.js +34 -2
- package/daemon/dist/domain/up-command-router.js.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts +18 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.js +201 -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/domain/workspace/default-workspace-scaffold.d.ts.map +1 -1
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js +51 -6
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -1
- package/daemon/dist/domain/workspace/workspace-doctor.d.ts +11 -0
- package/daemon/dist/domain/workspace/workspace-doctor.d.ts.map +1 -1
- package/daemon/dist/domain/workspace/workspace-doctor.js +82 -0
- package/daemon/dist/domain/workspace/workspace-doctor.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/config.d.ts.map +1 -1
- package/daemon/dist/routes/config.js +15 -6
- package/daemon/dist/routes/config.js.map +1 -1
- package/daemon/dist/routes/files.d.ts.map +1 -1
- package/daemon/dist/routes/files.js +45 -1
- package/daemon/dist/routes/files.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/mission-control.d.ts.map +1 -1
- package/daemon/dist/routes/mission-control.js +67 -2
- package/daemon/dist/routes/mission-control.js.map +1 -1
- package/daemon/dist/routes/queue.d.ts +10 -9
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +305 -10
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/review.d.ts +3 -0
- package/daemon/dist/routes/review.d.ts.map +1 -0
- package/daemon/dist/routes/review.js +195 -0
- package/daemon/dist/routes/review.js.map +1 -0
- package/daemon/dist/routes/scope-approve.d.ts +3 -0
- package/daemon/dist/routes/scope-approve.d.ts.map +1 -0
- package/daemon/dist/routes/scope-approve.js +55 -0
- package/daemon/dist/routes/scope-approve.js.map +1 -0
- package/daemon/dist/routes/scope-audit.d.ts.map +1 -1
- package/daemon/dist/routes/scope-audit.js +28 -1
- package/daemon/dist/routes/scope-audit.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/slices.d.ts.map +1 -1
- package/daemon/dist/routes/slices.js +49 -9
- package/daemon/dist/routes/slices.js.map +1 -1
- package/daemon/dist/routes/terminal-ws.d.ts.map +1 -1
- package/daemon/dist/routes/terminal-ws.js +58 -21
- package/daemon/dist/routes/terminal-ws.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/up.d.ts.map +1 -1
- package/daemon/dist/routes/up.js +84 -0
- package/daemon/dist/routes/up.js.map +1 -1
- 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/routes/workspace.js +2 -2
- package/daemon/dist/server.d.ts +6 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +36 -1
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +238 -14
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/docs/reference/agent-startup-guide.md +1 -1
- package/daemon/docs/reference/product-factory-vps-runbook.md +132 -0
- package/daemon/docs/reference/sdlc-conventions.md +187 -0
- package/daemon/specs/agents/conveyor/builder/agent.yaml +1 -1
- package/daemon/specs/agents/conveyor/builder/guidance/role.md +1 -0
- package/daemon/specs/agents/conveyor/lead/agent.yaml +1 -1
- package/daemon/specs/agents/conveyor/lead/guidance/role.md +1 -0
- package/daemon/specs/agents/conveyor/planner/agent.yaml +1 -1
- package/daemon/specs/agents/conveyor/planner/guidance/role.md +1 -0
- package/daemon/specs/agents/conveyor/reviewer/agent.yaml +1 -1
- package/daemon/specs/agents/conveyor/reviewer/guidance/role.md +1 -0
- package/daemon/specs/agents/design/product-designer/agent.yaml +1 -1
- package/daemon/specs/agents/design/product-designer/guidance/role.md +1 -0
- package/daemon/specs/agents/development/implementer/agent.yaml +1 -1
- package/daemon/specs/agents/development/implementer/guidance/role.md +1 -0
- package/daemon/specs/agents/development/qa/agent.yaml +1 -1
- package/daemon/specs/agents/development/qa/guidance/role.md +1 -0
- 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/orchestration/orchestrator/agent.yaml +1 -1
- package/daemon/specs/agents/orchestration/orchestrator/guidance/role.md +1 -0
- package/daemon/specs/agents/product-management/pm/agent.yaml +1 -0
- package/daemon/specs/agents/product-management/pm/guidance/role.md +13 -0
- package/daemon/specs/agents/review/independent-reviewer/agent.yaml +1 -1
- package/daemon/specs/agents/review/independent-reviewer/guidance/role.md +1 -0
- package/daemon/specs/agents/shared/agent.yaml +2 -0
- package/daemon/specs/agents/shared/skills/core/mission-slice-sop/SKILL.md +113 -0
- 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-operator/SKILL.md +4 -4
- package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +75 -29
- package/daemon/specs/agents/shared/skills/pods/orchestration-team/SKILL.md +2 -2
- package/daemon/specs/rigs/focused/pm-team/CULTURE.md +4 -0
- package/daemon/specs/rigs/launch/factory-rsi/CULTURE.md +47 -0
- package/daemon/specs/rigs/launch/factory-rsi/rig.yaml +115 -0
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +1 -1
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/startup/context.md +1 -1
- package/daemon/specs/rigs/preview/product-team/CULTURE.md +4 -0
- package/dist/build-info.d.ts +8 -0
- package/dist/build-info.d.ts.map +1 -0
- package/dist/build-info.js +11 -0
- package/dist/build-info.js.map +1 -0
- 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-init-workspace.d.ts.map +1 -1
- package/dist/commands/config-init-workspace.js +20 -4
- package/dist/commands/config-init-workspace.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/doctor.js +2 -2
- package/dist/commands/doctor.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/expand.js +1 -1
- package/dist/commands/expand.js.map +1 -1
- package/dist/commands/file.d.ts +7 -0
- package/dist/commands/file.d.ts.map +1 -0
- package/dist/commands/file.js +77 -0
- package/dist/commands/file.js.map +1 -0
- package/dist/commands/host.d.ts +48 -0
- package/dist/commands/host.d.ts.map +1 -0
- package/dist/commands/host.js +772 -0
- package/dist/commands/host.js.map +1 -0
- 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/proof.d.ts +54 -0
- package/dist/commands/proof.d.ts.map +1 -0
- package/dist/commands/proof.js +311 -0
- package/dist/commands/proof.js.map +1 -0
- package/dist/commands/ps.d.ts +41 -7
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +353 -135
- 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 +149 -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/scope.d.ts.map +1 -1
- package/dist/commands/scope.js +140 -3
- package/dist/commands/scope.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +127 -13
- 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 +2 -0
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +78 -2
- 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/commands/workspace.js +6 -6
- package/dist/commands/workspace.js.map +1 -1
- package/dist/config-store.d.ts +19 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +171 -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-executor.d.ts +1 -0
- package/dist/cross-host-executor.d.ts.map +1 -1
- package/dist/cross-host-executor.js +4 -1
- package/dist/cross-host-executor.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/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +4 -1
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/host-registry.d.ts +17 -0
- package/dist/host-registry.d.ts.map +1 -1
- package/dist/host-registry.js +64 -2
- 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 +9 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/file-transfer.d.ts +89 -0
- package/dist/lib/file-transfer.d.ts.map +1 -0
- package/dist/lib/file-transfer.js +300 -0
- package/dist/lib/file-transfer.js.map +1 -0
- package/dist/lib/hosts/fanout-contract.d.ts +33 -0
- package/dist/lib/hosts/fanout-contract.d.ts.map +1 -0
- package/dist/lib/hosts/fanout-contract.js +23 -0
- package/dist/lib/hosts/fanout-contract.js.map +1 -0
- package/dist/lib/scope/scope-audit.d.ts +9 -1
- package/dist/lib/scope/scope-audit.d.ts.map +1 -1
- package/dist/lib/scope/scope-audit.js +173 -1
- package/dist/lib/scope/scope-audit.js.map +1 -1
- package/dist/lib/scope/templates.d.ts +1 -0
- package/dist/lib/scope/templates.d.ts.map +1 -1
- package/dist/lib/scope/templates.js +9 -0
- package/dist/lib/scope/templates.js.map +1 -1
- package/dist/lib/scope-templates/backlog-deprecation.md +16 -0
- package/dist/lib/scope-templates/backlog-tech-debt.md +16 -0
- package/dist/lib/scope-templates/bug-fix.md +16 -0
- package/dist/lib/scope-templates/implementation-prd.md +33 -0
- package/dist/lib/scope-templates/mission-placeholder.md +1 -1
- package/dist/lib/scope-templates/mission-progress.md +1 -1
- package/dist/lib/scope-templates/mission-release.md +1 -1
- package/dist/lib/scope-templates/placeholder.md +11 -7
- package/dist/lib/scope-templates/proof.md +5 -1
- package/dist/lib/scope-templates/release-feature.md +14 -6
- package/dist/lib/scope-templates/research.md +16 -0
- package/dist/lib/scope-templates/slice-progress.md +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/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +11 -1
- package/dist/version.js.map +1 -1
- 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-DYZniQcc.js +0 -597
- package/ui/dist/assets/index-trcb4Yf_.css +0 -32
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export interface DeadlineInstanceView {
|
|
2
|
+
instanceId: string;
|
|
3
|
+
status: string;
|
|
4
|
+
currentFrontier: string[];
|
|
5
|
+
currentStepId: string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface DeadlinePacketView {
|
|
8
|
+
qitemId: string;
|
|
9
|
+
state: string;
|
|
10
|
+
destinationSession: string;
|
|
11
|
+
tsCreated: string;
|
|
12
|
+
claimedAt: string | null;
|
|
13
|
+
closureRequiredAt: string | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* THE single threshold home (arch gate-leg ruling: EXPORTED, documented
|
|
17
|
+
* as the one place this number lives — WF-5's class-(b) stuck/overdue
|
|
18
|
+
* thresholds bind to this constant by ruling; they never redefine it).
|
|
19
|
+
*
|
|
20
|
+
* Derivation: the shipped routine-tier SLA (TIER_SLA_SECONDS.routine =
|
|
21
|
+
* 4h in hot-potato-enforcer.ts — module-private there, so the value is
|
|
22
|
+
* restated rather than imported; the derivation is this sentence).
|
|
23
|
+
* Workflow step packets carry tier "mode2" with no SLA entry, so this
|
|
24
|
+
* constant is the effective deadline for both unclaimed anchors and
|
|
25
|
+
* the claimed-null-deadline anchor.
|
|
26
|
+
*/
|
|
27
|
+
export declare const WORKFLOW_STEP_STUCK_THRESHOLD_SECONDS: number;
|
|
28
|
+
export type WorkflowStepDeadlineState = "healthy" | "overdue-claimed" | "overdue-unclaimed";
|
|
29
|
+
export interface WorkflowStepDeadlineEvidence {
|
|
30
|
+
instanceId: string;
|
|
31
|
+
/** The instance's durable current step binding (may be null pre-R2). */
|
|
32
|
+
stepId: string | null;
|
|
33
|
+
packetId: string;
|
|
34
|
+
ownerSession: string;
|
|
35
|
+
packetState: string;
|
|
36
|
+
/** Which anchor classified this packet (the JSDoc classification). */
|
|
37
|
+
anchor: "closure_required_at" | "claimed_at" | "created_at";
|
|
38
|
+
/** ISO timestamp the anchor points at (deadline or anchor start). */
|
|
39
|
+
anchorAt: string;
|
|
40
|
+
/** Seconds past the effective deadline (>= 0 when overdue). */
|
|
41
|
+
overdueBySeconds: number;
|
|
42
|
+
/** Age of the packet since creation, seconds. */
|
|
43
|
+
ageSeconds: number;
|
|
44
|
+
/** claimed_at when the row still carries it (sub-states 1/2). */
|
|
45
|
+
claimedAt: string | null;
|
|
46
|
+
}
|
|
47
|
+
export interface WorkflowDeadlineVerdict {
|
|
48
|
+
state: WorkflowStepDeadlineState;
|
|
49
|
+
/** Present iff state != healthy. */
|
|
50
|
+
evidence: WorkflowStepDeadlineEvidence | null;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Evaluate one instance's frontier against the deadline model. Pure:
|
|
54
|
+
* (instance, packets, now) -> verdict. `packets` are the queue rows
|
|
55
|
+
* for instance.currentFrontier (missing rows are ignored — a frontier
|
|
56
|
+
* id that no longer resolves is a different corruption class, guarded
|
|
57
|
+
* elsewhere).
|
|
58
|
+
*
|
|
59
|
+
* Only `active` and `waiting` instances can be overdue; terminal
|
|
60
|
+
* instances are always healthy (nothing to nudge).
|
|
61
|
+
*/
|
|
62
|
+
export declare function evaluateStepDeadline(instance: DeadlineInstanceView, packets: Array<DeadlinePacketView | null | undefined>, now: Date): WorkflowDeadlineVerdict;
|
|
63
|
+
/**
|
|
64
|
+
* FR-6 (G4) helper: the max_hops comparison, structured against an
|
|
65
|
+
* EFFECTIVE BASELINE (arch N1 ruling). v1 pins baseline = 0
|
|
66
|
+
* (MAX_HOPS_BASELINE_V1); WF-5 FR-4's resume later amends the baseline
|
|
67
|
+
* so each redrive gets one bounded window — this helper is the seam,
|
|
68
|
+
* never hard-welded to lifetime-total.
|
|
69
|
+
*
|
|
70
|
+
* Returns true when executing ONE MORE hop would exceed the guard.
|
|
71
|
+
*/
|
|
72
|
+
export declare const MAX_HOPS_BASELINE_V1 = 0;
|
|
73
|
+
export declare function exceedsMaxHops(hopCount: number, baseline: number, maxHops: number | undefined): boolean;
|
|
74
|
+
//# sourceMappingURL=workflow-deadline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-deadline.d.ts","sourceRoot":"","sources":["../../src/domain/workflow-deadline.ts"],"names":[],"mappings":"AAwDA,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qCAAqC,QAAc,CAAC;AAEjE,MAAM,MAAM,yBAAyB,GACjC,SAAS,GACT,iBAAiB,GACjB,mBAAmB,CAAC;AAExB,MAAM,WAAW,4BAA4B;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,MAAM,EAAE,qBAAqB,GAAG,YAAY,GAAG,YAAY,CAAC;IAC5D,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,gBAAgB,EAAE,MAAM,CAAC;IACzB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,yBAAyB,CAAC;IACjC,oCAAoC;IACpC,QAAQ,EAAE,4BAA4B,GAAG,IAAI,CAAC;CAC/C;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,EAAE,KAAK,CAAC,kBAAkB,GAAG,IAAI,GAAG,SAAS,CAAC,EACrD,GAAG,EAAE,IAAI,GACR,uBAAuB,CAuDzB;AA6BD;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,OAAO,CAST"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
// OPR.0.4.6.WF1 FR-2: the step-deadline evaluator (pure).
|
|
2
|
+
//
|
|
3
|
+
// Closes G1 — the 0.4.3 dead-seat class: before this slice a dead or
|
|
4
|
+
// compacted seat parked a workflow step forever because NO deadline
|
|
5
|
+
// existed anywhere in the workflow domain. This evaluator derives a
|
|
6
|
+
// stuck/overdue verdict for an instance from queue mechanics the
|
|
7
|
+
// system already records — it introduces NO new clock, NO new stored
|
|
8
|
+
// state, and NO queue-layer change.
|
|
9
|
+
//
|
|
10
|
+
// STUCK IS DERIVED STATE, NEVER STORED (ACK plan commit 2): every
|
|
11
|
+
// caller (keepalive policy, boot sweep, list/show/trace surfaces)
|
|
12
|
+
// recomputes the verdict from (instance, frontier packets, now); a
|
|
13
|
+
// normal re-projection therefore self-clears the stuck marker (the
|
|
14
|
+
// FR-2 AC) and nothing can go stale. BR-1 holds: this evaluator is
|
|
15
|
+
// consumed by observability + nudge paths ONLY — never by a routing
|
|
16
|
+
// decision.
|
|
17
|
+
//
|
|
18
|
+
// THE ANCHOR CLASSIFICATION (arch gate-leg ruling + third-state note,
|
|
19
|
+
// Rev-1; extended by the mode2-tier source discovery, flagged to arch
|
|
20
|
+
// 2026-07-06):
|
|
21
|
+
//
|
|
22
|
+
// 1. CLAIMED with a deadline — state=in-progress and
|
|
23
|
+
// closure_required_at set (computed only at claim,
|
|
24
|
+
// queue-repository.ts:858-870). Anchor = closure_required_at.
|
|
25
|
+
// NOTE: workflow step packets ship with tier "mode2", which has
|
|
26
|
+
// no TIER_SLA_SECONDS entry, so TODAY this sub-state is empty for
|
|
27
|
+
// workflow packets — kept because it is the honest anchor the
|
|
28
|
+
// moment tiers change, and the evaluator must never silently
|
|
29
|
+
// ignore a real closure_required_at.
|
|
30
|
+
// 2. CLAIMED with NO deadline — state=in-progress,
|
|
31
|
+
// closure_required_at NULL (the mode2 reality). Anchor =
|
|
32
|
+
// claimed_at + WORKFLOW_STEP_STUCK_THRESHOLD_SECONDS.
|
|
33
|
+
// 3. NEVER-CLAIMED — state=pending, never claimed (the
|
|
34
|
+
// dead-seat-BEFORE-claim / lost-nudge case: the projector creates
|
|
35
|
+
// the next packet PENDING in-txn and nudges only post-commit, so
|
|
36
|
+
// a dead owner leaves it unclaimed forever). Anchor =
|
|
37
|
+
// created_at + threshold.
|
|
38
|
+
// 4. UNCLAIMED-AFTER-CLAIM (the arch third state) — state=pending
|
|
39
|
+
// after an unclaim, which NULLs claimed_at AND
|
|
40
|
+
// closure_required_at (queue-repository.ts:908-917), making the
|
|
41
|
+
// row indistinguishable from never-claimed. Anchor = created_at +
|
|
42
|
+
// threshold — deliberately INCLUDING the elapsed claimed period,
|
|
43
|
+
// so the packet may surface overdue immediately after unclaim.
|
|
44
|
+
// That direction is safe (early nudge noise beats silent parking;
|
|
45
|
+
// BR-4 — nothing blocks). Claim history remains recoverable via
|
|
46
|
+
// queue_transitions; callers that render evidence may enrich from
|
|
47
|
+
// there.
|
|
48
|
+
//
|
|
49
|
+
// A `blocked` frontier packet (a waiting park) is HEALTHY here: the
|
|
50
|
+
// park is an honest recorded state and waiting instances are already
|
|
51
|
+
// keepalive-eligible; park-duration policy is WF-5's lane.
|
|
52
|
+
/**
|
|
53
|
+
* THE single threshold home (arch gate-leg ruling: EXPORTED, documented
|
|
54
|
+
* as the one place this number lives — WF-5's class-(b) stuck/overdue
|
|
55
|
+
* thresholds bind to this constant by ruling; they never redefine it).
|
|
56
|
+
*
|
|
57
|
+
* Derivation: the shipped routine-tier SLA (TIER_SLA_SECONDS.routine =
|
|
58
|
+
* 4h in hot-potato-enforcer.ts — module-private there, so the value is
|
|
59
|
+
* restated rather than imported; the derivation is this sentence).
|
|
60
|
+
* Workflow step packets carry tier "mode2" with no SLA entry, so this
|
|
61
|
+
* constant is the effective deadline for both unclaimed anchors and
|
|
62
|
+
* the claimed-null-deadline anchor.
|
|
63
|
+
*/
|
|
64
|
+
export const WORKFLOW_STEP_STUCK_THRESHOLD_SECONDS = 4 * 60 * 60;
|
|
65
|
+
/**
|
|
66
|
+
* Evaluate one instance's frontier against the deadline model. Pure:
|
|
67
|
+
* (instance, packets, now) -> verdict. `packets` are the queue rows
|
|
68
|
+
* for instance.currentFrontier (missing rows are ignored — a frontier
|
|
69
|
+
* id that no longer resolves is a different corruption class, guarded
|
|
70
|
+
* elsewhere).
|
|
71
|
+
*
|
|
72
|
+
* Only `active` and `waiting` instances can be overdue; terminal
|
|
73
|
+
* instances are always healthy (nothing to nudge).
|
|
74
|
+
*/
|
|
75
|
+
export function evaluateStepDeadline(instance, packets, now) {
|
|
76
|
+
if (instance.status !== "active" && instance.status !== "waiting") {
|
|
77
|
+
return { state: "healthy", evidence: null };
|
|
78
|
+
}
|
|
79
|
+
const nowMs = now.getTime();
|
|
80
|
+
const thresholdMs = WORKFLOW_STEP_STUCK_THRESHOLD_SECONDS * 1000;
|
|
81
|
+
for (const packet of packets) {
|
|
82
|
+
if (!packet)
|
|
83
|
+
continue;
|
|
84
|
+
if (!instance.currentFrontier.includes(packet.qitemId))
|
|
85
|
+
continue;
|
|
86
|
+
if (packet.state === "in-progress") {
|
|
87
|
+
// Sub-states 1 + 2: claimed.
|
|
88
|
+
const deadlineMs = packet.closureRequiredAt
|
|
89
|
+
? new Date(packet.closureRequiredAt).getTime()
|
|
90
|
+
: packet.claimedAt
|
|
91
|
+
? new Date(packet.claimedAt).getTime() + thresholdMs
|
|
92
|
+
: new Date(packet.tsCreated).getTime() + thresholdMs;
|
|
93
|
+
if (nowMs >= deadlineMs) {
|
|
94
|
+
return {
|
|
95
|
+
state: "overdue-claimed",
|
|
96
|
+
evidence: buildEvidence(instance, packet, nowMs, {
|
|
97
|
+
anchor: packet.closureRequiredAt
|
|
98
|
+
? "closure_required_at"
|
|
99
|
+
: packet.claimedAt
|
|
100
|
+
? "claimed_at"
|
|
101
|
+
: "created_at",
|
|
102
|
+
anchorAt: packet.closureRequiredAt ??
|
|
103
|
+
packet.claimedAt ??
|
|
104
|
+
packet.tsCreated,
|
|
105
|
+
deadlineMs,
|
|
106
|
+
}),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else if (packet.state === "pending") {
|
|
111
|
+
// Sub-states 3 + 4: never-claimed OR unclaimed-after-claim
|
|
112
|
+
// (indistinguishable at the row after unclaim NULLs claimed_at;
|
|
113
|
+
// both deliberately anchor on created_at).
|
|
114
|
+
const deadlineMs = new Date(packet.tsCreated).getTime() + thresholdMs;
|
|
115
|
+
if (nowMs >= deadlineMs) {
|
|
116
|
+
return {
|
|
117
|
+
state: "overdue-unclaimed",
|
|
118
|
+
evidence: buildEvidence(instance, packet, nowMs, {
|
|
119
|
+
anchor: "created_at",
|
|
120
|
+
anchorAt: packet.tsCreated,
|
|
121
|
+
deadlineMs,
|
|
122
|
+
}),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// `blocked` (waiting park) and any closed state on the frontier:
|
|
127
|
+
// healthy by classification.
|
|
128
|
+
}
|
|
129
|
+
return { state: "healthy", evidence: null };
|
|
130
|
+
}
|
|
131
|
+
function buildEvidence(instance, packet, nowMs, input) {
|
|
132
|
+
return {
|
|
133
|
+
instanceId: instance.instanceId,
|
|
134
|
+
stepId: instance.currentStepId,
|
|
135
|
+
packetId: packet.qitemId,
|
|
136
|
+
ownerSession: packet.destinationSession,
|
|
137
|
+
packetState: packet.state,
|
|
138
|
+
anchor: input.anchor,
|
|
139
|
+
anchorAt: input.anchorAt,
|
|
140
|
+
overdueBySeconds: Math.max(0, Math.floor((nowMs - input.deadlineMs) / 1000)),
|
|
141
|
+
ageSeconds: Math.max(0, Math.floor((nowMs - new Date(packet.tsCreated).getTime()) / 1000)),
|
|
142
|
+
claimedAt: packet.claimedAt,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* FR-6 (G4) helper: the max_hops comparison, structured against an
|
|
147
|
+
* EFFECTIVE BASELINE (arch N1 ruling). v1 pins baseline = 0
|
|
148
|
+
* (MAX_HOPS_BASELINE_V1); WF-5 FR-4's resume later amends the baseline
|
|
149
|
+
* so each redrive gets one bounded window — this helper is the seam,
|
|
150
|
+
* never hard-welded to lifetime-total.
|
|
151
|
+
*
|
|
152
|
+
* Returns true when executing ONE MORE hop would exceed the guard.
|
|
153
|
+
*/
|
|
154
|
+
export const MAX_HOPS_BASELINE_V1 = 0;
|
|
155
|
+
export function exceedsMaxHops(hopCount, baseline, maxHops) {
|
|
156
|
+
// Guard blocker 2 hardening: only an ENFORCEABLE guard compares.
|
|
157
|
+
// The parser rejects malformed values going forward; this check
|
|
158
|
+
// protects against pre-fix cached spec_json blobs (a string would
|
|
159
|
+
// silently never trip; a null would coerce to 0 and ALWAYS trip).
|
|
160
|
+
if (typeof maxHops !== "number" || !Number.isInteger(maxHops) || maxHops < 1) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
return hopCount + 1 - baseline > maxHops;
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=workflow-deadline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-deadline.js","sourceRoot":"","sources":["../../src/domain/workflow-deadline.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,EAAE;AACF,qEAAqE;AACrE,oEAAoE;AACpE,oEAAoE;AACpE,iEAAiE;AACjE,qEAAqE;AACrE,oCAAoC;AACpC,EAAE;AACF,kEAAkE;AAClE,kEAAkE;AAClE,mEAAmE;AACnE,mEAAmE;AACnE,mEAAmE;AACnE,oEAAoE;AACpE,YAAY;AACZ,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,eAAe;AACf,EAAE;AACF,uDAAuD;AACvD,wDAAwD;AACxD,mEAAmE;AACnE,qEAAqE;AACrE,uEAAuE;AACvE,mEAAmE;AACnE,kEAAkE;AAClE,0CAA0C;AAC1C,qDAAqD;AACrD,8DAA8D;AAC9D,2DAA2D;AAC3D,yDAAyD;AACzD,uEAAuE;AACvE,sEAAsE;AACtE,2DAA2D;AAC3D,+BAA+B;AAC/B,oEAAoE;AACpE,oDAAoD;AACpD,qEAAqE;AACrE,uEAAuE;AACvE,sEAAsE;AACtE,oEAAoE;AACpE,uEAAuE;AACvE,qEAAqE;AACrE,uEAAuE;AACvE,cAAc;AACd,EAAE;AACF,oEAAoE;AACpE,qEAAqE;AACrE,2DAA2D;AAsB3D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;AAgCjE;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAClC,QAA8B,EAC9B,OAAqD,EACrD,GAAS;IAET,IAAI,QAAQ,CAAC,MAAM,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAA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I,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAClE;QACD,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC,MAAM,UAAU,cAAc,CAC5B,QAAgB,EAChB,QAAgB,EAChB,OAA2B;IAE3B,iEAAiE;IACjE,gEAAgE;IAChE,kEAAkE;IAClE,kEAAkE;IAClE,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAC7E,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,QAAQ,GAAG,CAAC,GAAG,QAAQ,GAAG,OAAO,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type Database from "better-sqlite3";
|
|
2
|
+
import type { QueueRepository } from "./queue-repository.js";
|
|
3
|
+
import type { WorkflowDeadlineVerdict } from "./workflow-deadline.js";
|
|
4
|
+
import { type WorkflowExceptionClass } from "./workflow-exception.js";
|
|
5
|
+
import type { ExceptionRoute } from "./workflow-exception-router.js";
|
|
6
|
+
export interface EnsureStuckExceptionInput {
|
|
7
|
+
workflowName: string;
|
|
8
|
+
workflowVersion: string;
|
|
9
|
+
/** The session recorded as the item's source (the instance creator —
|
|
10
|
+
* a real, validated session; the detector is machinery, not a seat). */
|
|
11
|
+
createdBySession: string;
|
|
12
|
+
verdict: WorkflowDeadlineVerdict;
|
|
13
|
+
}
|
|
14
|
+
export interface EnsureStuckExceptionResult {
|
|
15
|
+
outcome: "skipped-healthy" | "deduped" | "created";
|
|
16
|
+
qitemId?: string;
|
|
17
|
+
}
|
|
18
|
+
export type EnsureStuckExceptionItem = (input: EnsureStuckExceptionInput) => Promise<EnsureStuckExceptionResult>;
|
|
19
|
+
export interface StuckExceptionDeps {
|
|
20
|
+
db: Database.Database;
|
|
21
|
+
queueRepo: QueueRepository;
|
|
22
|
+
/** The maturity-dial resolution for a cached spec (runtime-owned —
|
|
23
|
+
* spec lookup + the shipped role resolution live there). null =
|
|
24
|
+
* spec not cached; the never-lost fallback applies.
|
|
25
|
+
* OPR.0.4.6.FAC1 (arch Q3): boundRig = the stuck instance's bound
|
|
26
|
+
* rig (read from workflow_instances at detection time) so the
|
|
27
|
+
* orchestrator-role dial position resolves capability-aware. */
|
|
28
|
+
resolveRoute: (workflowName: string, workflowVersion: string, exceptionClass: WorkflowExceptionClass, boundRig?: string | null) => ExceptionRoute | null;
|
|
29
|
+
humanFallbackSeat?: string;
|
|
30
|
+
log?: (line: string) => void;
|
|
31
|
+
}
|
|
32
|
+
export declare function makeEnsureStuckExceptionItem(deps: StuckExceptionDeps): EnsureStuckExceptionItem;
|
|
33
|
+
//# sourceMappingURL=workflow-exception-escalation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-exception-escalation.d.ts","sourceRoot":"","sources":["../../src/domain/workflow-exception-escalation.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB;6EACyE;IACzE,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,uBAAuB,CAAC;CAClC;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAAC;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,wBAAwB,GAAG,CACrC,KAAK,EAAE,yBAAyB,KAC7B,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAEzC,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC;IACtB,SAAS,EAAE,eAAe,CAAC;IAC3B;;;;;qEAKiE;IACjE,YAAY,EAAE,CACZ,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,sBAAsB,EACtC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,KACrB,cAAc,GAAG,IAAI,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,kBAAkB,GAAG,wBAAwB,CAwF/F"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// OPR.0.4.6.WF5 FR-2 class (b): detection-time exception items for
|
|
2
|
+
// STUCK/OVERDUE instances.
|
|
3
|
+
//
|
|
4
|
+
// Class (b) has NO state-change transaction to ride — the item is created
|
|
5
|
+
// AT DETECTION TIME by the sweep/keepalive evaluation, and its never-lost
|
|
6
|
+
// guarantee is WF-1's crash-surviving sweep: re-detection re-creates a
|
|
7
|
+
// missed item on the next pass (P2 cleanup honored: no same-txn claim is
|
|
8
|
+
// made or implemented here).
|
|
9
|
+
//
|
|
10
|
+
// DEDUP (the occurrence contract): exactly ONE OPEN item per
|
|
11
|
+
// (instance, step, class, occurrence) — the occurrence key is the overdue
|
|
12
|
+
// packet id named by the WF-1 evaluator's evidence. Re-detections of the
|
|
13
|
+
// same unresolved episode find the open item by TAG QUERY (never summary
|
|
14
|
+
// parsing) and re-nudge it instead of minting a duplicate. A resolved/
|
|
15
|
+
// closed item with the episode still live is a MISSED item — the next
|
|
16
|
+
// detection re-creates it (the sweep guarantee), keeping exactly one
|
|
17
|
+
// OPEN item per occurrence at all times.
|
|
18
|
+
//
|
|
19
|
+
// The policy shape is untouched (X5 stands: PolicyEvaluation remains
|
|
20
|
+
// send|skip|terminal) — the keepalive calls this injected helper as a
|
|
21
|
+
// side effect of its EXISTING evaluation; the sweep likewise. Injection
|
|
22
|
+
// at startup per the validateRig precedent.
|
|
23
|
+
import { classifyDeadlineVerdict, workflowExceptionTags, } from "./workflow-exception.js";
|
|
24
|
+
export function makeEnsureStuckExceptionItem(deps) {
|
|
25
|
+
const log = deps.log ?? (() => { });
|
|
26
|
+
const fallbackSeat = deps.humanFallbackSeat ?? "human@host";
|
|
27
|
+
return async (input) => {
|
|
28
|
+
const exception = classifyDeadlineVerdict(input.workflowName, input.verdict);
|
|
29
|
+
if (!exception)
|
|
30
|
+
return { outcome: "skipped-healthy" };
|
|
31
|
+
// Dedup by tag query against OPEN states only (pending | in-progress
|
|
32
|
+
// | blocked): one open item per occurrence; a closed item with the
|
|
33
|
+
// episode still live is missed and gets re-created.
|
|
34
|
+
const open = deps.db
|
|
35
|
+
.prepare(`SELECT qitem_id, destination_session FROM queue_items
|
|
36
|
+
WHERE state IN ('pending','in-progress','blocked')
|
|
37
|
+
AND tags LIKE ? AND tags LIKE ?`)
|
|
38
|
+
.get(`%"occurrence:${exception.identity.occurrenceKey}"%`, `%"exception:stuck_overdue"%`);
|
|
39
|
+
if (open) {
|
|
40
|
+
// Re-detection of the same unresolved episode: re-nudge the ONE
|
|
41
|
+
// item (best-effort — the durable item is the guarantee).
|
|
42
|
+
await deps.queueRepo.maybeNudge(open.qitem_id, open.destination_session, undefined);
|
|
43
|
+
return { outcome: "deduped", qitemId: open.qitem_id };
|
|
44
|
+
}
|
|
45
|
+
// OPR.0.4.6.FAC1 (arch Q3): each exception item is a FRESH routing
|
|
46
|
+
// decision at its own detection moment — read the stuck instance's
|
|
47
|
+
// bound rig NOW (defensive to a pre-052 fixture db: absent column
|
|
48
|
+
// reads as unbound, the shipped behavior).
|
|
49
|
+
let detectionBoundRig = null;
|
|
50
|
+
const stuckInstanceId = exception.deadlineEvidence?.instanceId;
|
|
51
|
+
if (stuckInstanceId) {
|
|
52
|
+
try {
|
|
53
|
+
const row = deps.db
|
|
54
|
+
.prepare(`SELECT bound_rig FROM workflow_instances WHERE instance_id = ?`)
|
|
55
|
+
.get(stuckInstanceId);
|
|
56
|
+
detectionBoundRig = row?.bound_rig ?? null;
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
detectionBoundRig = null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const route = deps.resolveRoute(input.workflowName, input.workflowVersion, "stuck_overdue", detectionBoundRig) ?? {
|
|
63
|
+
position: "fallback",
|
|
64
|
+
destinationSession: fallbackSeat,
|
|
65
|
+
tier: "human-gate",
|
|
66
|
+
humanRouted: true,
|
|
67
|
+
resolvedVia: "engine-default",
|
|
68
|
+
};
|
|
69
|
+
const e = exception.deadlineEvidence;
|
|
70
|
+
const evidenceRef = `rig workflow trace ${e.instanceId}`;
|
|
71
|
+
const body = `WORKFLOW EXCEPTION (stuck_overdue)\n` +
|
|
72
|
+
`workflow: ${input.workflowName} v${input.workflowVersion}\n` +
|
|
73
|
+
`instance: ${e.instanceId}\n` +
|
|
74
|
+
`step: ${e.stepId ?? "(unbound)"} — packet ${e.packetId} held by ${e.ownerSession} (${e.packetState})\n` +
|
|
75
|
+
`deadline: ${e.overdueBySeconds}s past the ${e.anchor} anchor (${e.anchorAt}); packet age ${e.ageSeconds}s\n` +
|
|
76
|
+
`reason: ${exception.reason}\n` +
|
|
77
|
+
`evidence: ${evidenceRef}\n` +
|
|
78
|
+
`resolve: re-nudge/replace the owner per the WF-1 dead-seat mechanics (the step re-projects and the flow continues from this step); this item clears when the instance leaves the exception state.`;
|
|
79
|
+
const createItem = (destination, tier) => deps.queueRepo.create({
|
|
80
|
+
sourceSession: input.createdBySession,
|
|
81
|
+
destinationSession: destination,
|
|
82
|
+
body,
|
|
83
|
+
priority: "urgent",
|
|
84
|
+
tier,
|
|
85
|
+
tags: workflowExceptionTags(exception.identity),
|
|
86
|
+
summary: exception.reason,
|
|
87
|
+
evidenceRef,
|
|
88
|
+
});
|
|
89
|
+
let created;
|
|
90
|
+
try {
|
|
91
|
+
created = await createItem(route.destinationSession, route.tier);
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
// THE NEVER-LOST WRITE-GATE FALLBACK (same contract as class (a)):
|
|
95
|
+
// a gate-rejected routed destination re-routes human@host rather
|
|
96
|
+
// than losing the exception. A failure of THIS create is a real
|
|
97
|
+
// storage error and propagates to the caller's non-fatal handling.
|
|
98
|
+
created = await createItem(fallbackSeat, "human-gate");
|
|
99
|
+
}
|
|
100
|
+
log(`workflow exception: stuck_overdue item ${created.qitemId} created for instance ${e.instanceId} (step ${e.stepId ?? "?"}, ${route.position})`);
|
|
101
|
+
return { outcome: "created", qitemId: created.qitemId };
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=workflow-exception-escalation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-exception-escalation.js","sourceRoot":"","sources":["../../src/domain/workflow-exception-escalation.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,2BAA2B;AAC3B,EAAE;AACF,0EAA0E;AAC1E,0EAA0E;AAC1E,uEAAuE;AACvE,yEAAyE;AACzE,6BAA6B;AAC7B,EAAE;AACF,6DAA6D;AAC7D,0EAA0E;AAC1E,yEAAyE;AACzE,yEAAyE;AACzE,uEAAuE;AACvE,sEAAsE;AACtE,qEAAqE;AACrE,yCAAyC;AACzC,EAAE;AACF,qEAAqE;AACrE,sEAAsE;AACtE,wEAAwE;AACxE,4CAA4C;AAK5C,OAAO,EACL,uBAAuB,EACvB,qBAAqB,GAEtB,MAAM,yBAAyB,CAAC;AAwCjC,MAAM,UAAU,4BAA4B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S,CAAC,MAAM;YACzB,WAAW;SACZ,CAAC,CAAC;QACL,IAAI,OAAO,CAAC;QACZ,IAAI,CAAC;YACH,OAAO,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACnE,CAAC;QAAC,MAAM,CAAC;YACP,mEAAmE;YACnE,iEAAiE;YACjE,gEAAgE;YAChE,mEAAmE;YACnE,OAAO,GAAG,MAAM,UAAU,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;QACzD,CAAC;QACD,GAAG,CACD,0CAA0C,OAAO,CAAC,OAAO,yBAAyB,CAAC,CAAC,UAAU,UAAU,CAAC,CAAC,MAAM,IAAI,GAAG,KAAK,KAAK,CAAC,QAAQ,GAAG,CAC9I,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1D,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { WorkflowExceptionClass } from "./workflow-exception.js";
|
|
2
|
+
import type { WorkflowExceptionDialPosition, WorkflowSpec } from "./workflow-types.js";
|
|
3
|
+
/** The ordinary workflow-packet tier (the shipped default the attention
|
|
4
|
+
* union deliberately does NOT match on). */
|
|
5
|
+
export declare const WORKFLOW_EXCEPTION_ORCHESTRATOR_TIER = "mode2";
|
|
6
|
+
/** The human-routed tier — the attention union's first leg. */
|
|
7
|
+
export declare const WORKFLOW_EXCEPTION_HUMAN_TIER = "human-gate";
|
|
8
|
+
export interface ExceptionRouteInput {
|
|
9
|
+
exceptionClass: WorkflowExceptionClass;
|
|
10
|
+
spec: Pick<WorkflowSpec, "exception_routing" | "roles">;
|
|
11
|
+
/** The host-level dial default (settings `workflow.exception_routing`),
|
|
12
|
+
* read by the caller; null = key unset. */
|
|
13
|
+
hostDialDefault: WorkflowExceptionDialPosition | null;
|
|
14
|
+
/** The shipped role→preferred_targets resolution, wrapped by the caller
|
|
15
|
+
* (workflow-runtime owns runtime matching). null = unresolvable. */
|
|
16
|
+
resolveRoleTarget: (roleName: string) => string | null;
|
|
17
|
+
/** The honest never-lost fallback seat (human@<host> form). */
|
|
18
|
+
humanFallbackSeat: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ExceptionRoute {
|
|
21
|
+
/** Where the chain landed. `fallback` = orchestrator position whose
|
|
22
|
+
* role target did not resolve (still never lost). */
|
|
23
|
+
position: "orchestrator" | "human_only" | "fallback";
|
|
24
|
+
destinationSession: string;
|
|
25
|
+
/** THE TIER SPLIT — human-gate iff humanRouted. */
|
|
26
|
+
tier: string;
|
|
27
|
+
humanRouted: boolean;
|
|
28
|
+
/** Which chain link decided the position (recorded in item evidence —
|
|
29
|
+
* the dial walks assert it). */
|
|
30
|
+
resolvedVia: "class-intrinsic" | "class-declared" | "workflow-declared" | "host-default" | "engine-default";
|
|
31
|
+
}
|
|
32
|
+
export declare function resolveExceptionRoute(input: ExceptionRouteInput): ExceptionRoute;
|
|
33
|
+
//# sourceMappingURL=workflow-exception-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-exception-router.d.ts","sourceRoot":"","sources":["../../src/domain/workflow-exception-router.ts"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EAAE,6BAA6B,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEvF;6CAC6C;AAC7C,eAAO,MAAM,oCAAoC,UAAU,CAAC;AAC5D,+DAA+D;AAC/D,eAAO,MAAM,6BAA6B,eAAe,CAAC;AAE1D,MAAM,WAAW,mBAAmB;IAClC,cAAc,EAAE,sBAAsB,CAAC;IACvC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,mBAAmB,GAAG,OAAO,CAAC,CAAC;IACxD;gDAC4C;IAC5C,eAAe,EAAE,6BAA6B,GAAG,IAAI,CAAC;IACtD;yEACqE;IACrE,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IACvD,+DAA+D;IAC/D,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B;0DACsD;IACtD,QAAQ,EAAE,cAAc,GAAG,YAAY,GAAG,UAAU,CAAC;IACrD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB;qCACiC;IACjC,WAAW,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,cAAc,GAAG,gBAAgB,CAAC;CAC7G;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,mBAAmB,GAAG,cAAc,CAsDhF"}
|
|
@@ -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-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AC3B,WAAW,GAAG,mBAAmB,CAAC;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,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