@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
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { QueueTransitionLog } from "./queue-transition-log.js";
|
|
2
3
|
import { wrapPaneEnvelope } from "../lib/pane-envelope.js";
|
|
3
4
|
import { computeClosureRequiredAt, validateClosure, } from "./hot-potato-enforcer.js";
|
|
5
|
+
import { isHumanSeatSession, validateHumanPark, validateHumanRoute } from "./human-route-enforcer.js";
|
|
4
6
|
export const QUEUE_STATES = [
|
|
5
7
|
"pending",
|
|
6
8
|
"in-progress",
|
|
@@ -11,6 +13,17 @@ export const QUEUE_STATES = [
|
|
|
11
13
|
"canceled",
|
|
12
14
|
"handed-off",
|
|
13
15
|
];
|
|
16
|
+
/** OPR.0.4.6.FS-1 (W2 P1): the queue's terminal state set, named ONCE. The
|
|
17
|
+
* archiver (queue-retention.ts) AND the inline closure guards below all consume
|
|
18
|
+
* THIS predicate, so a future terminal-state addition can never silently
|
|
19
|
+
* diverge the archiver from the queue (arch D3-REFINEMENT P1; widen-never-sibling).
|
|
20
|
+
* `['done','handed-off']` is the full terminal set — workflow step closures exit
|
|
21
|
+
* `handoff -> state=handed-off`, the highest-volume terminal class. The `satisfies`
|
|
22
|
+
* clause is the compile guard: removing a state from QUEUE_STATES fails here. */
|
|
23
|
+
export const TERMINAL_QUEUE_STATES = ["done", "handed-off"];
|
|
24
|
+
export function isTerminalState(state) {
|
|
25
|
+
return TERMINAL_QUEUE_STATES.includes(state);
|
|
26
|
+
}
|
|
14
27
|
export const QUEUE_PRIORITIES = ["routine", "urgent", "critical"];
|
|
15
28
|
export class QueueRepositoryError extends Error {
|
|
16
29
|
code;
|
|
@@ -21,13 +34,61 @@ export class QueueRepositoryError extends Error {
|
|
|
21
34
|
this.meta = meta;
|
|
22
35
|
}
|
|
23
36
|
}
|
|
24
|
-
|
|
37
|
+
/** OPR.0.4.6.WF5 (guard-named fix shape): exported so the workflow
|
|
38
|
+
* domain can PREALLOCATE a gate packet's id — the class-(c) exception
|
|
39
|
+
* identity tags need occurrence:<gatePacketId> ON the packet at create
|
|
40
|
+
* (one item, tagged in its own create — never a second item, never a
|
|
41
|
+
* post-create tag rewrite). The queue still mints ids for every caller
|
|
42
|
+
* that does not preallocate. */
|
|
43
|
+
export function newQitemId() {
|
|
25
44
|
const ts = new Date().toISOString().replace(/[-:T.Z]/g, "").slice(0, 14);
|
|
26
45
|
const hex = Math.floor(Math.random() * 0xffffffff)
|
|
27
46
|
.toString(16)
|
|
28
47
|
.padStart(8, "0");
|
|
29
48
|
return `qitem-${ts}-${hex}`;
|
|
30
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* OPR.0.4.6.MH3 Q-a: is this the SQLite PRIMARY KEY conflict on
|
|
52
|
+
* queue_items.qitem_id? better-sqlite3 sets `.code` on its SqliteError; the
|
|
53
|
+
* message check is a defensive twin so a driver-name change never silently
|
|
54
|
+
* turns an idempotent absorb into a 500.
|
|
55
|
+
*/
|
|
56
|
+
export function isQitemPrimaryKeyConflict(err) {
|
|
57
|
+
if (!(err instanceof Error))
|
|
58
|
+
return false;
|
|
59
|
+
const code = err.code ?? "";
|
|
60
|
+
if (code === "SQLITE_CONSTRAINT_PRIMARYKEY" || code === "SQLITE_CONSTRAINT_UNIQUE")
|
|
61
|
+
return true;
|
|
62
|
+
return /UNIQUE constraint failed: queue_items\.qitem_id/.test(err.message);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* OPR.0.4.6.MH3 D-1 (FR-4/FR-5): the deterministic cross-host SUCCESSOR id.
|
|
66
|
+
*
|
|
67
|
+
* A cross-host handoff exposes no caller `--id`, so the successor's dedup
|
|
68
|
+
* identity must come from the operation itself: the id is a PURE, STATELESS
|
|
69
|
+
* function of (source qitemId, destination session, destination host). Same
|
|
70
|
+
* arguments → same id on every re-drive, across daemon restarts, with zero
|
|
71
|
+
* local state — so the origin-side PRIMARY KEY absorb (Q-a) converges every
|
|
72
|
+
* interrupted-close re-drive. Source→successor is 1:1 by construction (a
|
|
73
|
+
* closed source is terminal; nothing re-opens it). The `qitem-xh-` namespace
|
|
74
|
+
* makes collision with organic `qitem-<ts>-<hex>` ids structurally impossible
|
|
75
|
+
* (plan R-2). The compound key is JSON-encoded — no hand-rolled separators.
|
|
76
|
+
*
|
|
77
|
+
* n1 residual (arch-named, inherent to the ratified at-least-once/no-2PC
|
|
78
|
+
* fence — NOT a dedup bug): a re-drive naming a DIFFERENT destination before
|
|
79
|
+
* the source close lands is a NEW handoff decision and derives a DIFFERENT
|
|
80
|
+
* id, so it cannot absorb the earlier successor — that earlier successor can
|
|
81
|
+
* remain live on the target host. The chain_of_record + cross-host provenance
|
|
82
|
+
* tags keep such an orphan visible/traceable; the source-close conflict check
|
|
83
|
+
* surfaces the disagreement rather than overwriting it.
|
|
84
|
+
*/
|
|
85
|
+
export function deriveCrossHostSuccessorId(sourceQitemId, destinationSession, hostId) {
|
|
86
|
+
const digest = createHash("sha256")
|
|
87
|
+
.update(JSON.stringify([sourceQitemId, destinationSession, hostId]))
|
|
88
|
+
.digest("hex")
|
|
89
|
+
.slice(0, 16);
|
|
90
|
+
return `qitem-xh-${digest}`;
|
|
91
|
+
}
|
|
31
92
|
/** PL-007 — defensive column probe. Older test fixtures bypass the
|
|
32
93
|
* canonical migration list, so target_repo may be absent. Mirrors
|
|
33
94
|
* the `hasNodeColumn` pattern in rig-repository.ts. */
|
|
@@ -62,14 +123,20 @@ export class QueueRepository {
|
|
|
62
123
|
* Production daemons always have the column (migration is in startup.ts). */
|
|
63
124
|
hasTargetRepoColumn;
|
|
64
125
|
hasSummaryColumn;
|
|
126
|
+
hasEvidenceRefColumn;
|
|
127
|
+
/** OPR.0.4.6.WF3 FR-6 — injected by startup (never imported): the
|
|
128
|
+
* workflow domain's is-live-frontier-packet predicate. */
|
|
129
|
+
workflowFrontierPredicate;
|
|
65
130
|
constructor(db, eventBus, opts) {
|
|
66
131
|
this.db = db;
|
|
67
132
|
this.eventBus = eventBus;
|
|
68
133
|
this.transitionLog = new QueueTransitionLog(db);
|
|
69
134
|
this.validateRig = opts?.validateRig ?? (() => true);
|
|
70
135
|
this.transport = opts?.transport;
|
|
136
|
+
this.workflowFrontierPredicate = opts?.workflowFrontierPredicate;
|
|
71
137
|
this.hasTargetRepoColumn = detectQueueColumn(db, "target_repo");
|
|
72
138
|
this.hasSummaryColumn = detectQueueColumn(db, "summary");
|
|
139
|
+
this.hasEvidenceRefColumn = detectQueueColumn(db, "evidence_ref");
|
|
73
140
|
// OPR.0.3.2.20 — register the EXACT human-seat regex predicate as
|
|
74
141
|
// a SQLite function so the attention query can apply the strict
|
|
75
142
|
// check BEFORE LIMIT. LIKE / GLOB patterns are supersets that
|
|
@@ -78,11 +145,10 @@ export class QueueRepository {
|
|
|
78
145
|
// behind them (guard re-verify-3 qitem-20260518193005 BLOCKER 1).
|
|
79
146
|
// better-sqlite3 db.function is idempotent; safe to call once at
|
|
80
147
|
// construction.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
});
|
|
148
|
+
// OPR.0.4.4.19: single-source regex — the SQL function delegates to the
|
|
149
|
+
// human-route-enforcer's exported predicate so SQL-side and TS-side
|
|
150
|
+
// checks cannot drift.
|
|
151
|
+
db.function("is_human_seat_session", { deterministic: true }, (value) => isHumanSeatSession(value) ? 1 : 0);
|
|
86
152
|
}
|
|
87
153
|
/**
|
|
88
154
|
* Attach the wake-path transport AFTER construction. Used by daemon
|
|
@@ -111,12 +177,14 @@ export class QueueRepository {
|
|
|
111
177
|
* came from + a reply hint. When undefined, the envelope falls back
|
|
112
178
|
* to the canonical "<unknown sender>" marker (matches wrapPaneEnvelope).
|
|
113
179
|
*/
|
|
114
|
-
async maybeNudge(qitemId, destinationSession, nudgeOpt, sourceSession) {
|
|
180
|
+
async maybeNudge(qitemId, destinationSession, nudgeOpt, sourceSession, bodyOverride) {
|
|
115
181
|
if (nudgeOpt === false)
|
|
116
182
|
return;
|
|
117
183
|
if (!this.transport)
|
|
118
184
|
return;
|
|
119
|
-
|
|
185
|
+
// OPR.0.4.4.19 FR-7: bodyOverride lets the resolve verb carry the
|
|
186
|
+
// decision text to the parked owner; default stays the handoff nudge.
|
|
187
|
+
const bareBody = bodyOverride ?? `Queue handoff: ${qitemId} - check your queue.`;
|
|
120
188
|
const text = wrapPaneEnvelope(sourceSession, destinationSession, bareBody);
|
|
121
189
|
try {
|
|
122
190
|
const res = await this.transport.send(destinationSession, text, { verify: true });
|
|
@@ -142,7 +210,36 @@ export class QueueRepository {
|
|
|
142
210
|
throw new QueueRepositoryError("unknown_destination_rig", `destination_session ${input.destinationSession} references an unknown rig`);
|
|
143
211
|
}
|
|
144
212
|
const txn = this.db.transaction(() => this.createInTransactionalContext(input));
|
|
145
|
-
|
|
213
|
+
let id;
|
|
214
|
+
let persistedEvent;
|
|
215
|
+
try {
|
|
216
|
+
({ qitemId: id, persistedEvent } = txn());
|
|
217
|
+
}
|
|
218
|
+
catch (err) {
|
|
219
|
+
// OPR.0.4.6.MH3 Q-a (FR-5): at-least-once cross-host forwards retry with
|
|
220
|
+
// the SAME minted qitemId, so a PK conflict on an EXISTING row is an
|
|
221
|
+
// idempotent RE-DELIVERY when the identity fields match — return the
|
|
222
|
+
// stored row (no second insert, no second event/nudge). A conflict whose
|
|
223
|
+
// identity fields DIFFER (same id, different destination/source) is a
|
|
224
|
+
// caller id-reuse bug — a structured error, never a silent overwrite.
|
|
225
|
+
// Local (non-forwarded) creates that pass an explicit --id keep the same
|
|
226
|
+
// safety for free.
|
|
227
|
+
if (input.qitemId && isQitemPrimaryKeyConflict(err)) {
|
|
228
|
+
const existing = this.getById(input.qitemId);
|
|
229
|
+
if (existing) {
|
|
230
|
+
if (existing.destinationSession === input.destinationSession &&
|
|
231
|
+
existing.sourceSession === input.sourceSession) {
|
|
232
|
+
return existing;
|
|
233
|
+
}
|
|
234
|
+
throw new QueueRepositoryError("qitem_id_reuse", `qitem ${input.qitemId} already exists with a different destination/source — id reuse is a caller bug, not an idempotent retry`, {
|
|
235
|
+
qitemId: input.qitemId,
|
|
236
|
+
existingDestination: existing.destinationSession,
|
|
237
|
+
existingSource: existing.sourceSession,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
throw err;
|
|
242
|
+
}
|
|
146
243
|
this.eventBus.notifySubscribers(persistedEvent);
|
|
147
244
|
await this.maybeNudge(id, input.destinationSession, input.nudge, input.sourceSession);
|
|
148
245
|
return this.getByIdOrThrow(id);
|
|
@@ -189,6 +286,20 @@ export class QueueRepository {
|
|
|
189
286
|
* provides the atomic boundary).
|
|
190
287
|
*/
|
|
191
288
|
createInTransactionalContext(input) {
|
|
289
|
+
// OPR.0.4.4.19 FR-4/FR-5 — human-routed items require summary +
|
|
290
|
+
// evidence_ref at the domain write path (the validateClosure pattern).
|
|
291
|
+
// The validator is a no-op for non-human-routed items (BR-1).
|
|
292
|
+
const humanRoute = validateHumanRoute({
|
|
293
|
+
tier: input.tier ?? null,
|
|
294
|
+
destinationSession: input.destinationSession,
|
|
295
|
+
summary: input.summary ?? null,
|
|
296
|
+
evidenceRef: input.evidenceRef ?? null,
|
|
297
|
+
});
|
|
298
|
+
if (!humanRoute.ok) {
|
|
299
|
+
throw new QueueRepositoryError(humanRoute.code, humanRoute.message, {
|
|
300
|
+
missingFields: humanRoute.missingFields,
|
|
301
|
+
});
|
|
302
|
+
}
|
|
192
303
|
const id = input.qitemId ?? newQitemId();
|
|
193
304
|
const ts = new Date().toISOString();
|
|
194
305
|
const priority = input.priority ?? "routine";
|
|
@@ -214,6 +325,7 @@ export class QueueRepository {
|
|
|
214
325
|
.run(id, ts, ts, input.sourceSession, input.destinationSession, priority, tier, tags, expiresAt, chain, input.body);
|
|
215
326
|
}
|
|
216
327
|
this.persistSummary(id, input.summary ?? null);
|
|
328
|
+
this.persistEvidenceRef(id, input.evidenceRef ?? null);
|
|
217
329
|
this.transitionLog.append({
|
|
218
330
|
qitemId: id,
|
|
219
331
|
state: "pending",
|
|
@@ -227,6 +339,7 @@ export class QueueRepository {
|
|
|
227
339
|
destinationSession: input.destinationSession,
|
|
228
340
|
priority,
|
|
229
341
|
tier,
|
|
342
|
+
summary: input.summary ?? null,
|
|
230
343
|
});
|
|
231
344
|
return { qitemId: id, persistedEvent };
|
|
232
345
|
}
|
|
@@ -240,7 +353,7 @@ export class QueueRepository {
|
|
|
240
353
|
if (!source) {
|
|
241
354
|
throw new QueueRepositoryError("qitem_not_found", `qitem ${input.qitemId} not found`);
|
|
242
355
|
}
|
|
243
|
-
if (source.state
|
|
356
|
+
if (isTerminalState(source.state)) {
|
|
244
357
|
throw new QueueRepositoryError("qitem_already_terminal", `qitem ${input.qitemId} is already in terminal state ${source.state}`);
|
|
245
358
|
}
|
|
246
359
|
if (!this.validateRig(input.toSession)) {
|
|
@@ -254,6 +367,20 @@ export class QueueRepository {
|
|
|
254
367
|
const tags = input.tags ? JSON.stringify(input.tags) : (source.tags ? JSON.stringify(source.tags) : null);
|
|
255
368
|
const chain = JSON.stringify([...(source.chainOfRecord ?? []), source.qitemId]);
|
|
256
369
|
const targetRepo = input.targetRepo === undefined ? source.targetRepo : input.targetRepo;
|
|
370
|
+
// OPR.0.4.4.19 FR-4/FR-5 — the handoff authors a NEW qitem; when that
|
|
371
|
+
// new item is human-routed it requires its OWN summary + evidence_ref
|
|
372
|
+
// (neither is inherited from the source — 044 semantics preserved).
|
|
373
|
+
const humanRoute = validateHumanRoute({
|
|
374
|
+
tier,
|
|
375
|
+
destinationSession: input.toSession,
|
|
376
|
+
summary: input.summary ?? null,
|
|
377
|
+
evidenceRef: input.evidenceRef ?? null,
|
|
378
|
+
});
|
|
379
|
+
if (!humanRoute.ok) {
|
|
380
|
+
throw new QueueRepositoryError(humanRoute.code, humanRoute.message, {
|
|
381
|
+
missingFields: humanRoute.missingFields,
|
|
382
|
+
});
|
|
383
|
+
}
|
|
257
384
|
const events = [];
|
|
258
385
|
const txn = this.db.transaction(() => {
|
|
259
386
|
this.db
|
|
@@ -290,6 +417,7 @@ export class QueueRepository {
|
|
|
290
417
|
.run(newId, ts, ts, input.fromSession, input.toSession, priority, tier, tags, source.qitemId, chain, body);
|
|
291
418
|
}
|
|
292
419
|
this.persistSummary(newId, input.summary ?? null);
|
|
420
|
+
this.persistEvidenceRef(newId, input.evidenceRef ?? null);
|
|
293
421
|
this.transitionLog.append({
|
|
294
422
|
qitemId: newId,
|
|
295
423
|
state: "pending",
|
|
@@ -302,6 +430,7 @@ export class QueueRepository {
|
|
|
302
430
|
fromSession: input.fromSession,
|
|
303
431
|
toSession: input.toSession,
|
|
304
432
|
closureReason: "handed_off_to",
|
|
433
|
+
summary: source.summary ?? null,
|
|
305
434
|
});
|
|
306
435
|
events.push({ name: "queue.handed_off", payload: handoffEvent });
|
|
307
436
|
const createdEvent = this.eventBus.persistWithinTransaction({
|
|
@@ -311,6 +440,7 @@ export class QueueRepository {
|
|
|
311
440
|
destinationSession: input.toSession,
|
|
312
441
|
priority,
|
|
313
442
|
tier,
|
|
443
|
+
summary: input.summary ?? null,
|
|
314
444
|
});
|
|
315
445
|
events.push({ name: "queue.created", payload: createdEvent });
|
|
316
446
|
});
|
|
@@ -336,7 +466,7 @@ export class QueueRepository {
|
|
|
336
466
|
if (!source) {
|
|
337
467
|
throw new QueueRepositoryError("qitem_not_found", `qitem ${input.qitemId} not found`);
|
|
338
468
|
}
|
|
339
|
-
if (source.state
|
|
469
|
+
if (isTerminalState(source.state)) {
|
|
340
470
|
throw new QueueRepositoryError("qitem_already_terminal", `qitem ${input.qitemId} is already in terminal state ${source.state}`);
|
|
341
471
|
}
|
|
342
472
|
if (!this.validateRig(input.toSession)) {
|
|
@@ -350,6 +480,18 @@ export class QueueRepository {
|
|
|
350
480
|
const tags = input.tags ? JSON.stringify(input.tags) : (source.tags ? JSON.stringify(source.tags) : null);
|
|
351
481
|
const chain = JSON.stringify([...(source.chainOfRecord ?? []), source.qitemId]);
|
|
352
482
|
const targetRepo = input.targetRepo === undefined ? source.targetRepo : input.targetRepo;
|
|
483
|
+
// OPR.0.4.4.19 FR-4/FR-5 — same new-item enforcement as handoff().
|
|
484
|
+
const humanRoute = validateHumanRoute({
|
|
485
|
+
tier,
|
|
486
|
+
destinationSession: input.toSession,
|
|
487
|
+
summary: input.summary ?? null,
|
|
488
|
+
evidenceRef: input.evidenceRef ?? null,
|
|
489
|
+
});
|
|
490
|
+
if (!humanRoute.ok) {
|
|
491
|
+
throw new QueueRepositoryError(humanRoute.code, humanRoute.message, {
|
|
492
|
+
missingFields: humanRoute.missingFields,
|
|
493
|
+
});
|
|
494
|
+
}
|
|
353
495
|
const events = [];
|
|
354
496
|
const txn = this.db.transaction(() => {
|
|
355
497
|
this.db
|
|
@@ -386,6 +528,7 @@ export class QueueRepository {
|
|
|
386
528
|
.run(newId, ts, ts, input.fromSession, input.toSession, priority, tier, tags, source.qitemId, chain, body);
|
|
387
529
|
}
|
|
388
530
|
this.persistSummary(newId, input.summary ?? null);
|
|
531
|
+
this.persistEvidenceRef(newId, input.evidenceRef ?? null);
|
|
389
532
|
this.transitionLog.append({
|
|
390
533
|
qitemId: newId,
|
|
391
534
|
state: "pending",
|
|
@@ -398,6 +541,7 @@ export class QueueRepository {
|
|
|
398
541
|
fromSession: input.fromSession,
|
|
399
542
|
toSession: input.toSession,
|
|
400
543
|
closureReason: "handed_off_to",
|
|
544
|
+
summary: source.summary ?? null,
|
|
401
545
|
});
|
|
402
546
|
events.push({ name: "queue.handed_off", payload: handoffEvent });
|
|
403
547
|
const createdEvent = this.eventBus.persistWithinTransaction({
|
|
@@ -407,6 +551,7 @@ export class QueueRepository {
|
|
|
407
551
|
destinationSession: input.toSession,
|
|
408
552
|
priority,
|
|
409
553
|
tier,
|
|
554
|
+
summary: input.summary ?? null,
|
|
410
555
|
});
|
|
411
556
|
events.push({ name: "queue.created", payload: createdEvent });
|
|
412
557
|
});
|
|
@@ -420,6 +565,85 @@ export class QueueRepository {
|
|
|
420
565
|
created: this.getByIdOrThrow(newId),
|
|
421
566
|
};
|
|
422
567
|
}
|
|
568
|
+
/**
|
|
569
|
+
* OPR.0.4.6.MH3 FR-4 (C2, arch Q-c): the LOCAL half of a cross-host
|
|
570
|
+
* handoff — close the source row AFTER the successor-create was forwarded
|
|
571
|
+
* to (and accepted by) the target host. The two sides live in two DBs, so
|
|
572
|
+
* this is deliberately NOT the atomic close+create of {@link handoff}: the
|
|
573
|
+
* boundary is bridged by message-passing (successor-create FIRST on the
|
|
574
|
+
* origin host, this source-close SECOND — never the reverse, so a crash
|
|
575
|
+
* between the two leaves a live duplicate the idempotent re-drive
|
|
576
|
+
* converges, never a dropped potato).
|
|
577
|
+
*
|
|
578
|
+
* Re-drive semantics (FR-4/FR-5, the interrupted-close case):
|
|
579
|
+
* - source already terminal WITH a MATCHING closureTarget → idempotent
|
|
580
|
+
* absorb: return the stored row unchanged (`absorbed: true`) — no
|
|
581
|
+
* second close, no second event.
|
|
582
|
+
* - source already terminal with a MISMATCHED closureTarget → structured
|
|
583
|
+
* `cross_host_close_conflict` (someone else closed it meanwhile —
|
|
584
|
+
* surface, never overwrite).
|
|
585
|
+
* - otherwise → close exactly like the local handoff's close leg:
|
|
586
|
+
* `closure_reason=handed_off_to`; `closure_target` carries the OPAQUE
|
|
587
|
+
* three-part `<member@rig>@<host>` form (arch R1 — presence-checked
|
|
588
|
+
* display/audit metadata, NEVER parsed for routing); `handed_off_to`
|
|
589
|
+
* stays the two-part `member@rig` (BR-1 — session-string carriers
|
|
590
|
+
* never gain `@host`).
|
|
591
|
+
*/
|
|
592
|
+
closeCrossHostHandoffSource(input) {
|
|
593
|
+
const source = this.getById(input.qitemId);
|
|
594
|
+
if (!source) {
|
|
595
|
+
throw new QueueRepositoryError("qitem_not_found", `qitem ${input.qitemId} not found`);
|
|
596
|
+
}
|
|
597
|
+
if (isTerminalState(source.state)) {
|
|
598
|
+
if (source.closureTarget === input.closureTarget) {
|
|
599
|
+
return { item: source, absorbed: true };
|
|
600
|
+
}
|
|
601
|
+
throw new QueueRepositoryError("cross_host_close_conflict", `qitem ${input.qitemId} is already closed toward ${source.closureTarget ?? "<no closure_target>"} — this re-drive names ${input.closureTarget}; surfacing the conflict, never overwriting`, {
|
|
602
|
+
qitemId: input.qitemId,
|
|
603
|
+
existingClosureTarget: source.closureTarget,
|
|
604
|
+
attemptedClosureTarget: input.closureTarget,
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
const ts = new Date().toISOString();
|
|
608
|
+
const events = [];
|
|
609
|
+
const txn = this.db.transaction(() => {
|
|
610
|
+
this.db
|
|
611
|
+
.prepare(`UPDATE queue_items
|
|
612
|
+
SET state = ?,
|
|
613
|
+
ts_updated = ?,
|
|
614
|
+
handed_off_to = ?,
|
|
615
|
+
closure_reason = 'handed_off_to',
|
|
616
|
+
closure_target = ?
|
|
617
|
+
WHERE qitem_id = ?`)
|
|
618
|
+
.run(input.terminalState, ts, input.toSession, input.closureTarget, input.qitemId);
|
|
619
|
+
this.transitionLog.append({
|
|
620
|
+
qitemId: input.qitemId,
|
|
621
|
+
state: input.terminalState,
|
|
622
|
+
actorSession: input.fromSession,
|
|
623
|
+
// BR-1: the minted note carries the TWO-PART toSession only — the
|
|
624
|
+
// host-qualified 3-part form is allowed in closure_target and nowhere
|
|
625
|
+
// else, and transition_note is a durable carrier.
|
|
626
|
+
transitionNote: input.transitionNote ?? `cross-host handoff to ${input.toSession}`,
|
|
627
|
+
closureReason: "handed_off_to",
|
|
628
|
+
closureTarget: input.closureTarget,
|
|
629
|
+
});
|
|
630
|
+
const handoffEvent = this.eventBus.persistWithinTransaction({
|
|
631
|
+
type: "queue.handed_off",
|
|
632
|
+
qitemId: input.qitemId,
|
|
633
|
+
fromSession: input.fromSession,
|
|
634
|
+
// The event body is a session-string carrier — two-part only (BR-1).
|
|
635
|
+
toSession: input.toSession,
|
|
636
|
+
closureReason: "handed_off_to",
|
|
637
|
+
summary: source.summary ?? null,
|
|
638
|
+
});
|
|
639
|
+
events.push(handoffEvent);
|
|
640
|
+
});
|
|
641
|
+
txn();
|
|
642
|
+
for (const e of events) {
|
|
643
|
+
this.eventBus.notifySubscribers(e);
|
|
644
|
+
}
|
|
645
|
+
return { item: this.getByIdOrThrow(input.qitemId), absorbed: false };
|
|
646
|
+
}
|
|
423
647
|
/**
|
|
424
648
|
* `whoami` — return the seat's queue position from the daemon's perspective.
|
|
425
649
|
* Counts active qitems (pending + in-progress + blocked) destined for the
|
|
@@ -494,6 +718,7 @@ export class QueueRepository {
|
|
|
494
718
|
destinationSession: input.destinationSession,
|
|
495
719
|
claimedAt: ts,
|
|
496
720
|
closureRequiredAt,
|
|
721
|
+
summary: qitem.summary ?? null,
|
|
497
722
|
});
|
|
498
723
|
});
|
|
499
724
|
const persistedEvent = txn();
|
|
@@ -529,6 +754,7 @@ export class QueueRepository {
|
|
|
529
754
|
qitemId,
|
|
530
755
|
destinationSession,
|
|
531
756
|
reason,
|
|
757
|
+
summary: qitem.summary ?? null,
|
|
532
758
|
});
|
|
533
759
|
});
|
|
534
760
|
const persistedEvent = txn();
|
|
@@ -602,6 +828,48 @@ export class QueueRepository {
|
|
|
602
828
|
validReasons: "validReasons" in validation ? validation.validReasons : undefined,
|
|
603
829
|
});
|
|
604
830
|
}
|
|
831
|
+
// OPR.0.4.6.WF3 FR-6 — the frontier close-path guard (pm ruling:
|
|
832
|
+
// PREVENTION over detection). A TERMINAL closure (done/handed-off)
|
|
833
|
+
// of a LIVE workflow-frontier packet from a NON-workflow verb
|
|
834
|
+
// would strand the instance: the frontier would reference a
|
|
835
|
+
// closed packet and the workflow's own bookkeeping (trail,
|
|
836
|
+
// rebind, events) would never happen. Reject LOUD with
|
|
837
|
+
// what/why/fix naming the workflow verbs. The workflow domain's
|
|
838
|
+
// own writers pass viaWorkflowVerb (they hold the invariant);
|
|
839
|
+
// non-workflow qitems return null from the predicate — closure
|
|
840
|
+
// behavior byte-identical (the zero-friction negative).
|
|
841
|
+
const isTerminalClosure = isTerminalState(input.state);
|
|
842
|
+
if (isTerminalClosure && !input.viaWorkflowVerb && this.workflowFrontierPredicate) {
|
|
843
|
+
const binding = this.workflowFrontierPredicate(input.qitemId);
|
|
844
|
+
if (binding) {
|
|
845
|
+
throw new QueueRepositoryError("workflow_frontier_packet", `qitem ${input.qitemId} is the LIVE frontier packet of workflow instance ${binding.instanceId} (${binding.workflowName}). Closing it out-of-band would strand the workflow. Use the workflow verbs instead: rig workflow project (advance) | rig workflow route (re-target the owner).`, { instanceId: binding.instanceId, workflowName: binding.workflowName, qitemId: input.qitemId });
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
// OPR.0.4.4.19 FR-6 — leg-1 park (state=blocked on a HUMAN-seat blocker):
|
|
849
|
+
// enforce summary + evidence_ref at the park moment, evaluated on the
|
|
850
|
+
// EFFECTIVE values (provided on this call, else already on the item) so
|
|
851
|
+
// an item that carried them from create parks without re-entry. The
|
|
852
|
+
// enforcement is here at the write path — the `rig queue block` verb and
|
|
853
|
+
// raw `update --state blocked` hit the same validator (no verb-only
|
|
854
|
+
// enforcement). Blocking on another qitem requires nothing new (BR-1).
|
|
855
|
+
const effectiveBlockedOn = input.blockedOn ?? qitem.blockedOn;
|
|
856
|
+
const isHumanPark = input.state === "blocked" && isHumanSeatSession(effectiveBlockedOn);
|
|
857
|
+
let effectiveSummary = qitem.summary;
|
|
858
|
+
let effectiveEvidenceRef = qitem.evidenceRef;
|
|
859
|
+
if (isHumanPark) {
|
|
860
|
+
effectiveSummary = input.summary ?? qitem.summary;
|
|
861
|
+
effectiveEvidenceRef = input.evidenceRef ?? qitem.evidenceRef;
|
|
862
|
+
const park = validateHumanPark({
|
|
863
|
+
blockedOn: effectiveBlockedOn,
|
|
864
|
+
summary: effectiveSummary,
|
|
865
|
+
evidenceRef: effectiveEvidenceRef,
|
|
866
|
+
});
|
|
867
|
+
if (!park.ok) {
|
|
868
|
+
throw new QueueRepositoryError(park.code, park.message, {
|
|
869
|
+
missingFields: park.missingFields,
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
}
|
|
605
873
|
const ts = new Date().toISOString();
|
|
606
874
|
const fromState = qitem.state;
|
|
607
875
|
this.db
|
|
@@ -614,6 +882,13 @@ export class QueueRepository {
|
|
|
614
882
|
blocked_on = COALESCE(?, blocked_on)
|
|
615
883
|
WHERE qitem_id = ?`)
|
|
616
884
|
.run(input.state, ts, validation.closureReason, validation.closureTarget, input.handedOffTo ?? null, input.blockedOn ?? null, input.qitemId);
|
|
885
|
+
// FR-6: park-time summary/evidence_ref are PERSISTED onto the existing
|
|
886
|
+
// item (not merely validated-then-dropped) — visible to the attention
|
|
887
|
+
// query and to Packet 2. Only the park path writes them.
|
|
888
|
+
if (isHumanPark) {
|
|
889
|
+
this.persistSummary(input.qitemId, input.summary ?? null);
|
|
890
|
+
this.persistEvidenceRef(input.qitemId, input.evidenceRef ?? null);
|
|
891
|
+
}
|
|
617
892
|
this.transitionLog.append({
|
|
618
893
|
qitemId: input.qitemId,
|
|
619
894
|
state: input.state,
|
|
@@ -630,6 +905,9 @@ export class QueueRepository {
|
|
|
630
905
|
closureReason: validation.closureReason ?? null,
|
|
631
906
|
closureTarget: validation.closureTarget ?? null,
|
|
632
907
|
actorSession: input.actorSession,
|
|
908
|
+
// FR-1 × FR-6: the event carries the summary as of THIS mutation
|
|
909
|
+
// (park-time summary included) so surfaces refresh without a fetch.
|
|
910
|
+
summary: effectiveSummary ?? null,
|
|
633
911
|
});
|
|
634
912
|
}
|
|
635
913
|
getById(qitemId) {
|
|
@@ -733,11 +1011,16 @@ export class QueueRepository {
|
|
|
733
1011
|
// (e.g., 'human-@kernel' — empty name segment) are rejected at
|
|
734
1012
|
// the SQL stage, BEFORE LIMIT, so they cannot saturate the LIMIT
|
|
735
1013
|
// window and hide valid attention items.
|
|
1014
|
+
// OPR.0.4.4.19 FR-6 — the attention predicate gains the leg-1 park
|
|
1015
|
+
// clause: a qitem parked as state=blocked on a HUMAN-seat blocker is a
|
|
1016
|
+
// decision the human owes. Blocking on another qitem (today's shipped
|
|
1017
|
+
// usage) does NOT match — is_human_seat_session rejects qitem ids.
|
|
736
1018
|
const conditions = [
|
|
737
1019
|
`state IN (${statePlaceholders})`,
|
|
738
1020
|
`(
|
|
739
1021
|
tier = 'human-gate'
|
|
740
1022
|
OR is_human_seat_session(destination_session) = 1
|
|
1023
|
+
OR (state = 'blocked' AND is_human_seat_session(blocked_on) = 1)
|
|
741
1024
|
)`,
|
|
742
1025
|
];
|
|
743
1026
|
const params = [...states];
|
|
@@ -847,6 +1130,13 @@ export class QueueRepository {
|
|
|
847
1130
|
this.db.prepare("UPDATE queue_items SET summary = ? WHERE qitem_id = ?").run(summary, qitemId);
|
|
848
1131
|
}
|
|
849
1132
|
}
|
|
1133
|
+
/** OPR.0.4.4.19 FR-5 — persist the optional evidence_ref additively, same
|
|
1134
|
+
* contract as persistSummary (pre-048 fixtures degrade; NULL default). */
|
|
1135
|
+
persistEvidenceRef(qitemId, evidenceRef) {
|
|
1136
|
+
if (this.hasEvidenceRefColumn && evidenceRef !== null) {
|
|
1137
|
+
this.db.prepare("UPDATE queue_items SET evidence_ref = ? WHERE qitem_id = ?").run(evidenceRef, qitemId);
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
850
1140
|
rowToItem(row) {
|
|
851
1141
|
return {
|
|
852
1142
|
qitemId: row.qitem_id,
|
|
@@ -867,6 +1157,9 @@ export class QueueRepository {
|
|
|
867
1157
|
// OPR.0.4.1.18: summary present only when migration 044 has applied;
|
|
868
1158
|
// legacy/minimal fixtures supply rows where summary is undefined → null.
|
|
869
1159
|
summary: row.summary ?? null,
|
|
1160
|
+
// OPR.0.4.4.19 FR-5: evidence_ref present only when migration 048 has
|
|
1161
|
+
// applied; legacy fixtures degrade to null.
|
|
1162
|
+
evidenceRef: row.evidence_ref ?? null,
|
|
870
1163
|
closureReason: row.closure_reason,
|
|
871
1164
|
closureTarget: row.closure_target,
|
|
872
1165
|
closureRequiredAt: row.closure_required_at,
|