@openrig/cli 0.4.2 → 0.4.4
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/hooks/scripts/activity-relay.cjs +42 -2
- package/daemon/assets/plugins/openrig-core/skills/mission-slice-sop/SKILL.md +115 -0
- package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +12 -12
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts +46 -0
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +167 -3
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +31 -0
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +62 -0
- 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/db/migrations/045_resume_verification.d.ts +29 -0
- package/daemon/dist/db/migrations/045_resume_verification.d.ts.map +1 -0
- package/daemon/dist/db/migrations/045_resume_verification.js +34 -0
- package/daemon/dist/db/migrations/045_resume_verification.js.map +1 -0
- package/daemon/dist/db/migrations/046_seat_identity_verdicts.d.ts +41 -0
- package/daemon/dist/db/migrations/046_seat_identity_verdicts.d.ts.map +1 -0
- package/daemon/dist/db/migrations/046_seat_identity_verdicts.js +56 -0
- package/daemon/dist/db/migrations/046_seat_identity_verdicts.js.map +1 -0
- package/daemon/dist/db/migrations/047_events_node_type_index.d.ts +48 -0
- package/daemon/dist/db/migrations/047_events_node_type_index.d.ts.map +1 -0
- package/daemon/dist/db/migrations/047_events_node_type_index.js +52 -0
- package/daemon/dist/db/migrations/047_events_node_type_index.js.map +1 -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/domain/activity-endpoint.d.ts +25 -0
- package/daemon/dist/domain/activity-endpoint.d.ts.map +1 -0
- package/daemon/dist/domain/activity-endpoint.js +91 -0
- package/daemon/dist/domain/activity-endpoint.js.map +1 -0
- package/daemon/dist/domain/claim-service.d.ts +36 -0
- package/daemon/dist/domain/claim-service.d.ts.map +1 -1
- package/daemon/dist/domain/claim-service.js +90 -0
- package/daemon/dist/domain/claim-service.js.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts +57 -0
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -1
- package/daemon/dist/domain/claude-compaction-enforcer.js +149 -3
- package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -1
- package/daemon/dist/domain/event-loop-monitor.d.ts +100 -0
- package/daemon/dist/domain/event-loop-monitor.d.ts.map +1 -0
- package/daemon/dist/domain/event-loop-monitor.js +127 -0
- package/daemon/dist/domain/event-loop-monitor.js.map +1 -0
- 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/gate-predicate.d.ts +29 -0
- package/daemon/dist/domain/gate-predicate.d.ts.map +1 -0
- package/daemon/dist/domain/gate-predicate.js +73 -0
- package/daemon/dist/domain/gate-predicate.js.map +1 -0
- package/daemon/dist/domain/graph-projection.d.ts +7 -1
- package/daemon/dist/domain/graph-projection.d.ts.map +1 -1
- package/daemon/dist/domain/graph-projection.js +19 -1
- package/daemon/dist/domain/graph-projection.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 +49 -0
- package/daemon/dist/domain/hosts/hosts-registry-reader.d.ts.map +1 -0
- package/daemon/dist/domain/hosts/hosts-registry-reader.js +165 -0
- package/daemon/dist/domain/hosts/hosts-registry-reader.js.map +1 -0
- package/daemon/dist/domain/hosts/remote-daemon-http.d.ts +35 -0
- package/daemon/dist/domain/hosts/remote-daemon-http.d.ts.map +1 -0
- package/daemon/dist/domain/hosts/remote-daemon-http.js +105 -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 +7 -1
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +84 -5
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/periodic-snapshot-scheduler.d.ts +4 -0
- package/daemon/dist/domain/periodic-snapshot-scheduler.d.ts.map +1 -1
- package/daemon/dist/domain/periodic-snapshot-scheduler.js +11 -0
- package/daemon/dist/domain/periodic-snapshot-scheduler.js.map +1 -1
- package/daemon/dist/domain/policies/idle-gate-qitem.d.ts +14 -0
- package/daemon/dist/domain/policies/idle-gate-qitem.d.ts.map +1 -0
- package/daemon/dist/domain/policies/idle-gate-qitem.js +114 -0
- package/daemon/dist/domain/policies/idle-gate-qitem.js.map +1 -0
- 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 +39 -0
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +25 -1
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +111 -7
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +8 -0
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +109 -27
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/restore-plan-preview.d.ts +25 -1
- package/daemon/dist/domain/restore-plan-preview.d.ts.map +1 -1
- package/daemon/dist/domain/restore-plan-preview.js +72 -4
- package/daemon/dist/domain/restore-plan-preview.js.map +1 -1
- package/daemon/dist/domain/resume-metadata-refresher.d.ts +44 -2
- package/daemon/dist/domain/resume-metadata-refresher.d.ts.map +1 -1
- package/daemon/dist/domain/resume-metadata-refresher.js +92 -6
- package/daemon/dist/domain/resume-metadata-refresher.js.map +1 -1
- package/daemon/dist/domain/resume-token-capture.d.ts +50 -0
- package/daemon/dist/domain/resume-token-capture.d.ts.map +1 -0
- package/daemon/dist/domain/resume-token-capture.js +63 -0
- package/daemon/dist/domain/resume-token-capture.js.map +1 -0
- 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 +228 -0
- package/daemon/dist/domain/review/compose.d.ts.map +1 -0
- package/daemon/dist/domain/review/compose.js +773 -0
- package/daemon/dist/domain/review/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 +100 -0
- package/daemon/dist/domain/review/gather.d.ts.map +1 -0
- package/daemon/dist/domain/review/gather.js +676 -0
- package/daemon/dist/domain/review/gather.js.map +1 -0
- package/daemon/dist/domain/review/types.d.ts +258 -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-status-compose.d.ts +62 -0
- package/daemon/dist/domain/rig-status-compose.d.ts.map +1 -0
- package/daemon/dist/domain/rig-status-compose.js +149 -0
- package/daemon/dist/domain/rig-status-compose.js.map +1 -0
- package/daemon/dist/domain/rig-teardown.d.ts +3 -1
- package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
- package/daemon/dist/domain/rig-teardown.js +4 -19
- package/daemon/dist/domain/rig-teardown.js.map +1 -1
- package/daemon/dist/domain/route-timing-recorder.d.ts +42 -0
- package/daemon/dist/domain/route-timing-recorder.d.ts.map +1 -0
- package/daemon/dist/domain/route-timing-recorder.js +62 -0
- package/daemon/dist/domain/route-timing-recorder.js.map +1 -0
- 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 +11 -1
- package/daemon/dist/domain/scope/scope-audit.d.ts.map +1 -1
- package/daemon/dist/domain/scope/scope-audit.js +203 -2
- package/daemon/dist/domain/scope/scope-audit.js.map +1 -1
- package/daemon/dist/domain/seat-handover-service.d.ts +50 -7
- package/daemon/dist/domain/seat-handover-service.d.ts.map +1 -1
- package/daemon/dist/domain/seat-handover-service.js +273 -33
- package/daemon/dist/domain/seat-handover-service.js.map +1 -1
- package/daemon/dist/domain/seat-identity-reconciler.d.ts +59 -0
- package/daemon/dist/domain/seat-identity-reconciler.d.ts.map +1 -0
- package/daemon/dist/domain/seat-identity-reconciler.js +207 -0
- package/daemon/dist/domain/seat-identity-reconciler.js.map +1 -0
- package/daemon/dist/domain/seat-identity-store.d.ts +27 -0
- package/daemon/dist/domain/seat-identity-store.d.ts.map +1 -0
- package/daemon/dist/domain/seat-identity-store.js +106 -0
- package/daemon/dist/domain/seat-identity-store.js.map +1 -0
- package/daemon/dist/domain/seat-switch-client-service.d.ts +57 -0
- package/daemon/dist/domain/seat-switch-client-service.d.ts.map +1 -0
- package/daemon/dist/domain/seat-switch-client-service.js +168 -0
- package/daemon/dist/domain/seat-switch-client-service.js.map +1 -0
- package/daemon/dist/domain/self-attach-service.d.ts +8 -0
- package/daemon/dist/domain/self-attach-service.d.ts.map +1 -1
- package/daemon/dist/domain/self-attach-service.js +20 -7
- package/daemon/dist/domain/self-attach-service.js.map +1 -1
- package/daemon/dist/domain/session-registry.d.ts +35 -4
- package/daemon/dist/domain/session-registry.d.ts.map +1 -1
- package/daemon/dist/domain/session-registry.js +89 -10
- package/daemon/dist/domain/session-registry.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +8 -1
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +143 -37
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/startup-orchestrator.js +34 -2
- package/daemon/dist/domain/startup-orchestrator.js.map +1 -1
- package/daemon/dist/domain/startup-proof.d.ts +63 -0
- package/daemon/dist/domain/startup-proof.d.ts.map +1 -0
- package/daemon/dist/domain/startup-proof.js +165 -0
- package/daemon/dist/domain/startup-proof.js.map +1 -0
- package/daemon/dist/domain/successor-session-launcher.d.ts +103 -0
- package/daemon/dist/domain/successor-session-launcher.d.ts.map +1 -0
- package/daemon/dist/domain/successor-session-launcher.js +246 -0
- package/daemon/dist/domain/successor-session-launcher.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 +86 -0
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js +8 -0
- 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 +17 -0
- package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.js +109 -0
- package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/daemon/dist/domain/watchdog-jobs-repository.d.ts +2 -2
- package/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-jobs-repository.js +4 -0
- package/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.js +19 -0
- package/daemon/dist/domain/watchdog-policy-engine.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.map +1 -1
- package/daemon/dist/index.js +18 -1
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/routes/activity.d.ts.map +1 -1
- package/daemon/dist/routes/activity.js +26 -0
- package/daemon/dist/routes/activity.js.map +1 -1
- package/daemon/dist/routes/agent-images.d.ts.map +1 -1
- package/daemon/dist/routes/agent-images.js +139 -0
- package/daemon/dist/routes/agent-images.js.map +1 -1
- package/daemon/dist/routes/compaction.d.ts +17 -0
- package/daemon/dist/routes/compaction.d.ts.map +1 -0
- package/daemon/dist/routes/compaction.js +125 -0
- package/daemon/dist/routes/compaction.js.map +1 -0
- 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/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 +8 -2
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +44 -4
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/restore-check.d.ts +10 -0
- package/daemon/dist/routes/restore-check.d.ts.map +1 -1
- package/daemon/dist/routes/restore-check.js +46 -37
- package/daemon/dist/routes/restore-check.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 +169 -0
- package/daemon/dist/routes/review.js.map +1 -0
- package/daemon/dist/routes/rigs.d.ts.map +1 -1
- package/daemon/dist/routes/rigs.js +70 -1
- package/daemon/dist/routes/rigs.js.map +1 -1
- 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.d.ts.map +1 -1
- package/daemon/dist/routes/seat.js +53 -2
- package/daemon/dist/routes/seat.js.map +1 -1
- package/daemon/dist/routes/sessions.d.ts.map +1 -1
- package/daemon/dist/routes/sessions.js +44 -9
- package/daemon/dist/routes/sessions.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/snapshots.d.ts.map +1 -1
- package/daemon/dist/routes/snapshots.js +16 -1
- package/daemon/dist/routes/snapshots.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/transport.d.ts.map +1 -1
- package/daemon/dist/routes/transport.js +12 -5
- package/daemon/dist/routes/transport.js.map +1 -1
- 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/workspace.js +2 -2
- package/daemon/dist/server.d.ts +33 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +41 -1
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts +1 -0
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +108 -20
- 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/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 +115 -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 +69 -23
- package/daemon/specs/agents/shared/skills/pods/orchestration-team/SKILL.md +3 -3
- package/daemon/specs/rigs/focused/pm-team/CULTURE.md +4 -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/compact.d.ts +15 -0
- package/dist/commands/compact.d.ts.map +1 -0
- package/dist/commands/compact.js +62 -0
- package/dist/commands/compact.js.map +1 -0
- 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/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +18 -2
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/doctor.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/fork.d.ts +4 -0
- package/dist/commands/fork.d.ts.map +1 -0
- package/dist/commands/fork.js +101 -0
- package/dist/commands/fork.js.map +1 -0
- package/dist/commands/host.d.ts +34 -0
- package/dist/commands/host.d.ts.map +1 -0
- package/dist/commands/host.js +448 -0
- package/dist/commands/host.js.map +1 -0
- package/dist/commands/launch.d.ts.map +1 -1
- package/dist/commands/launch.js +34 -4
- 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 +357 -135
- package/dist/commands/ps.js.map +1 -1
- package/dist/commands/queue.d.ts +6 -0
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +154 -4
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/reconcile-session.d.ts.map +1 -1
- package/dist/commands/reconcile-session.js +2 -2
- package/dist/commands/reconcile-session.js.map +1 -1
- package/dist/commands/restore-check.d.ts.map +1 -1
- package/dist/commands/restore-check.js +93 -0
- package/dist/commands/restore-check.js.map +1 -1
- package/dist/commands/scope.d.ts.map +1 -1
- package/dist/commands/scope.js +191 -4
- package/dist/commands/scope.js.map +1 -1
- package/dist/commands/seat.d.ts +17 -0
- package/dist/commands/seat.d.ts.map +1 -1
- package/dist/commands/seat.js +145 -32
- package/dist/commands/seat.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +161 -11
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/start.d.ts +5 -0
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/startup-proof.d.ts +24 -0
- package/dist/commands/startup-proof.d.ts.map +1 -0
- package/dist/commands/startup-proof.js +100 -0
- package/dist/commands/startup-proof.js.map +1 -0
- package/dist/commands/unclaim.js +2 -2
- package/dist/commands/unclaim.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 +79 -2
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/watchdog.js +2 -2
- package/dist/commands/watchdog.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 +4 -0
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +68 -0
- package/dist/config-store.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/daemon-lifecycle.d.ts +23 -0
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +54 -6
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/host-registry.d.ts +9 -0
- package/dist/host-registry.d.ts.map +1 -1
- package/dist/host-registry.js +32 -2
- package/dist/host-registry.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/codex-auth.d.ts +24 -0
- package/dist/lib/codex-auth.d.ts.map +1 -1
- package/dist/lib/codex-auth.js +89 -17
- package/dist/lib/codex-auth.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 +11 -1
- package/dist/lib/scope/scope-audit.d.ts.map +1 -1
- package/dist/lib/scope/scope-audit.js +203 -2
- 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 +41 -0
- package/dist/lib/scope-templates/mission-progress.md +2 -0
- package/dist/lib/scope-templates/mission-release.md +41 -0
- package/dist/lib/scope-templates/placeholder.md +12 -4
- package/dist/lib/scope-templates/proof.md +6 -0
- 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 +2 -0
- package/dist/openrig-compat.d.ts +19 -0
- package/dist/openrig-compat.d.ts.map +1 -1
- package/dist/openrig-compat.js +31 -1
- package/dist/openrig-compat.js.map +1 -1
- 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-D69ZhNIr.js +598 -0
- package/ui/dist/assets/index-DJYun-8d.css +32 -0
- package/ui/dist/index.html +23 -2
- package/ui/dist/assets/index-CnqRX7A3.css +0 -32
- package/ui/dist/assets/index-CtL9jXFt.js +0 -582
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
2
|
+
/** A presence-floor ACK is never proof (business rule 2). */
|
|
3
|
+
const BARE_ACK_TOKENS = new Set(["", "ack", "ok", "ready", "done", "oriented", "acknowledged"]);
|
|
4
|
+
export function computeContractHash(contractSource) {
|
|
5
|
+
return createHash("sha256").update(contractSource).digest("hex");
|
|
6
|
+
}
|
|
7
|
+
export function computeExpectedAnswer(challengeId, contractHash) {
|
|
8
|
+
return createHash("sha256").update(`${challengeId}:${contractHash}`).digest("hex").slice(0, 32);
|
|
9
|
+
}
|
|
10
|
+
function buildProofSubmissionCommand(challengeId, expectedAnswer) {
|
|
11
|
+
return `rig startup-proof submit --challenge-id ${challengeId} --answer ${expectedAnswer}`;
|
|
12
|
+
}
|
|
13
|
+
function buildPromptBlock(challengeId, expectedAnswer) {
|
|
14
|
+
return [
|
|
15
|
+
"--- OpenRig startup orientation challenge ---",
|
|
16
|
+
`challengeId: ${challengeId}`,
|
|
17
|
+
"After you have read your startup contract (all the files/identity above),",
|
|
18
|
+
"prove you oriented by submitting an authenticated startup_proof with EXACTLY:",
|
|
19
|
+
` answer: ${expectedAnswer}`,
|
|
20
|
+
"",
|
|
21
|
+
"Run this command from your shell/tools after reading the contract:",
|
|
22
|
+
buildProofSubmissionCommand(challengeId, expectedAnswer),
|
|
23
|
+
"A bare acknowledgement (\"ack\"/\"ready\") is presence only, NEVER proof.",
|
|
24
|
+
"--------------------------------------------",
|
|
25
|
+
].join("\n");
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Derive + persist (append-only event) a per-launch challenge and return the
|
|
29
|
+
* prompt block. Call at fresh/fresh-fallback managed launch, BEFORE the
|
|
30
|
+
* startup prompt is delivered, so the ground truth exists before any proof.
|
|
31
|
+
*/
|
|
32
|
+
export function issueStartupChallenge(eventBus, input) {
|
|
33
|
+
const challengeId = randomBytes(16).toString("hex");
|
|
34
|
+
const contractHash = computeContractHash(input.contractSource);
|
|
35
|
+
const expectedAnswer = computeExpectedAnswer(challengeId, contractHash);
|
|
36
|
+
eventBus.emit({
|
|
37
|
+
type: "node.startup_challenged",
|
|
38
|
+
rigId: input.rigId,
|
|
39
|
+
nodeId: input.nodeId,
|
|
40
|
+
challengeId,
|
|
41
|
+
contractHash,
|
|
42
|
+
});
|
|
43
|
+
return { challengeId, contractHash, expectedAnswer, promptBlock: buildPromptBlock(challengeId, expectedAnswer) };
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Verify an agent-emitted startup proof against the persisted per-launch
|
|
47
|
+
* challenge. Identity-bound + anti-replay + content-correct, or an
|
|
48
|
+
* append-only rejection with a per-reason code. Never sets `ready`; never
|
|
49
|
+
* routes through updateStartupStatus.
|
|
50
|
+
*/
|
|
51
|
+
export function verifyStartupProof(deps, input) {
|
|
52
|
+
const { store, eventBus } = deps;
|
|
53
|
+
const db = store.db;
|
|
54
|
+
// (a) IDENTITY — resolve {sessionId,nodeId,rigId}; an unknown identity is
|
|
55
|
+
// rejected and NO node-scoped state is projected (we cannot attribute an
|
|
56
|
+
// event to an unknown node).
|
|
57
|
+
const resolved = store.resolveSession({ sessionName: input.sessionName, nodeId: input.nodeId, runtime: input.runtime });
|
|
58
|
+
if (!resolved) {
|
|
59
|
+
return { ok: false, code: "identity_unbound", error: "startup_proof did not resolve to a managed session/node" };
|
|
60
|
+
}
|
|
61
|
+
// (a2) IDENTITY BINDING — the proof must bind to BOTH nodeId AND sessionName.
|
|
62
|
+
// `resolveSession` prioritizes nodeId and does NOT cross-check a supplied
|
|
63
|
+
// sessionName, so a proof carrying nodeId=node-a + sessionName=node-b would
|
|
64
|
+
// otherwise resolve to (and false-verify) node-a while claiming node-b's
|
|
65
|
+
// identity. Reject any conflict. We do NOT emit a node-scoped rejection for
|
|
66
|
+
// the resolved node here (mirroring identity_unbound): a mismatched /
|
|
67
|
+
// cross-seat / malformed proof must not touch the resolved node's projection
|
|
68
|
+
// at all — never verify it, and never downgrade it to `rejected` either.
|
|
69
|
+
// (runtime is a non-authoritative hint used for hook classification, not an
|
|
70
|
+
// identity key — the seat identity is the nodeId<->sessionName binding.)
|
|
71
|
+
if (input.sessionName && input.sessionName !== resolved.sessionName) {
|
|
72
|
+
return { ok: false, code: "identity_mismatch", error: "startup_proof nodeId and sessionName resolve to different seats" };
|
|
73
|
+
}
|
|
74
|
+
// Ground truth: the latest challenge issued for THIS node.
|
|
75
|
+
const challengeRow = db.prepare("SELECT payload, seq FROM events WHERE node_id = ? AND type = 'node.startup_challenged' ORDER BY seq DESC LIMIT 1").get(resolved.nodeId);
|
|
76
|
+
if (!challengeRow) {
|
|
77
|
+
// Never challenged (e.g. a resumed restore, or a non-agent path). A proof
|
|
78
|
+
// has nothing to verify against — reject as stale WITHOUT appending an
|
|
79
|
+
// event, so the node's oriented projection stays honest (`n-a`).
|
|
80
|
+
return { ok: false, code: "challenge_stale", error: "no active startup challenge for this node" };
|
|
81
|
+
}
|
|
82
|
+
let current;
|
|
83
|
+
try {
|
|
84
|
+
current = JSON.parse(challengeRow.payload);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return { ok: false, code: "challenge_stale", error: "startup challenge payload unreadable" };
|
|
88
|
+
}
|
|
89
|
+
const answer = (input.answer ?? "").trim();
|
|
90
|
+
const emitRejected = (reason) => {
|
|
91
|
+
eventBus.emit({
|
|
92
|
+
type: "node.startup_proof_rejected",
|
|
93
|
+
rigId: resolved.rigId,
|
|
94
|
+
nodeId: resolved.nodeId,
|
|
95
|
+
challengeId: input.challengeId ?? null,
|
|
96
|
+
reason,
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
// (b) THIS-LAUNCH — the answered challenge must be the current one. A
|
|
100
|
+
// replayed prior-launch answer carries a stale challengeId.
|
|
101
|
+
if (!input.challengeId || input.challengeId !== current.challengeId) {
|
|
102
|
+
emitRejected("challenge_stale");
|
|
103
|
+
return { ok: false, code: "challenge_stale", error: "challengeId does not match this launch's challenge (replay/stale)" };
|
|
104
|
+
}
|
|
105
|
+
// (d) bare-ACK / empty / presence-floor is never proof.
|
|
106
|
+
if (BARE_ACK_TOKENS.has(answer.toLowerCase())) {
|
|
107
|
+
emitRejected("bare_ack");
|
|
108
|
+
return { ok: false, code: "bare_ack", error: "a bare acknowledgement is presence only, never proof" };
|
|
109
|
+
}
|
|
110
|
+
// (c) CONTRACT — recompute the expected answer from the persisted contract
|
|
111
|
+
// hash. A plausible-but-content-wrong answer is rejected.
|
|
112
|
+
const expected = computeExpectedAnswer(current.challengeId, current.contractHash);
|
|
113
|
+
if (answer !== expected) {
|
|
114
|
+
emitRejected("contract_mismatch");
|
|
115
|
+
return { ok: false, code: "contract_mismatch", error: "proof answer does not match the delivered startup contract" };
|
|
116
|
+
}
|
|
117
|
+
eventBus.emit({
|
|
118
|
+
type: "node.startup_proof_verified",
|
|
119
|
+
rigId: resolved.rigId,
|
|
120
|
+
nodeId: resolved.nodeId,
|
|
121
|
+
sessionId: resolved.sessionId,
|
|
122
|
+
challengeId: current.challengeId,
|
|
123
|
+
contractHash: current.contractHash,
|
|
124
|
+
});
|
|
125
|
+
return { ok: true, nodeId: resolved.nodeId, rigId: resolved.rigId, challengeId: current.challengeId };
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Project the oriented signal for a node from the append-only proof events.
|
|
129
|
+
* `verified` requires a verified proof for the CURRENT (latest) challenge;
|
|
130
|
+
* `missing` = challenged but not yet proven; `rejected` = the latest proof for
|
|
131
|
+
* the current challenge was rejected; `n-a` = never challenged (resumed /
|
|
132
|
+
* non-agent / skip-harness). NEVER derived from startup_status.
|
|
133
|
+
*/
|
|
134
|
+
export function deriveOriented(db, nodeId) {
|
|
135
|
+
const rows = db.prepare("SELECT type, payload, seq FROM events WHERE node_id = ? AND type IN ('node.startup_challenged','node.startup_proof_verified','node.startup_proof_rejected') ORDER BY seq DESC").all(nodeId);
|
|
136
|
+
// Latest challenge governs.
|
|
137
|
+
const challengeRow = rows.find((r) => r.type === "node.startup_challenged");
|
|
138
|
+
if (!challengeRow)
|
|
139
|
+
return "n-a";
|
|
140
|
+
let currentChallengeId;
|
|
141
|
+
try {
|
|
142
|
+
currentChallengeId = JSON.parse(challengeRow.payload).challengeId;
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return "n-a";
|
|
146
|
+
}
|
|
147
|
+
// The most-recent proof event referencing the current challenge decides
|
|
148
|
+
// verified-vs-rejected (a later verify overrides an earlier reject).
|
|
149
|
+
for (const row of rows) {
|
|
150
|
+
if (row.type === "node.startup_challenged")
|
|
151
|
+
continue;
|
|
152
|
+
let cid = null;
|
|
153
|
+
try {
|
|
154
|
+
cid = JSON.parse(row.payload).challengeId;
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (cid !== currentChallengeId)
|
|
160
|
+
continue;
|
|
161
|
+
return row.type === "node.startup_proof_verified" ? "verified" : "rejected";
|
|
162
|
+
}
|
|
163
|
+
return "missing";
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=startup-proof.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-proof.js","sourceRoot":"","sources":["../../src/domain/startup-proof.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA6CtD,6DAA6D;AAC7D,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;AAEhG,MAAM,UAAU,mBAAmB,CAAC,cAAsB;IACxD,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,WAAmB,EAAE,YAAoB;IAC7E,OAAO,UAAU,CAAC,QAAQ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AG,CAAC,IAAI,KAAK,yBAAyB;YAAE,SAAS;QACrD,IAAI,GAAG,GAAkB,IAAI,CAAC;QAC9B,IAAI,CAAC;YAAC,GAAG,GAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAoC,CAAC,WAAW,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,SAAS;QAAC,CAAC;QAC1G,IAAI,GAAG,KAAK,kBAAkB;YAAE,SAAS;QACzC,OAAO,GAAG,CAAC,IAAI,KAAK,6BAA6B,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC;IAC9E,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { TmuxAdapter } from "../adapters/tmux.js";
|
|
2
|
+
import type { DiscoveryRepository } from "./discovery-repository.js";
|
|
3
|
+
import type { RuntimeAdapter } from "./runtime-adapter.js";
|
|
4
|
+
/**
|
|
5
|
+
* OPR.0.4.3.04 — the explicit successor-creation seam for the seat-handover
|
|
6
|
+
* full-cycle composer (IMPL-SPEC §2.1b; resolves the rev1-dual BLOCKING B1).
|
|
7
|
+
*
|
|
8
|
+
* It creates an UNMANAGED, discoverable tmux successor for a non-discovered
|
|
9
|
+
* handover source (fresh), routes it through REAL runtime startup so it becomes
|
|
10
|
+
* a LIVE, READY agent (not a bare shell), records it as an ACTIVE discovery
|
|
11
|
+
* candidate, and returns that candidate + the captured launch resume token so
|
|
12
|
+
* the composer can route it through the EXISTING discovered->commit rebind path.
|
|
13
|
+
* It deliberately does NOT `registerClaimedSession`/`upsertBinding` — the
|
|
14
|
+
* session stays unmanaged until the handover `commit` claims it, so the
|
|
15
|
+
* departing seat's binding is never touched before successor readiness.
|
|
16
|
+
*
|
|
17
|
+
* B1 (rev1-dual fix): the successor is launched through the runtime adapter's
|
|
18
|
+
* `launchHarness` + readiness poll — the SAME startup/readiness primitives
|
|
19
|
+
* `StartupOrchestrator` drives — WITHOUT the ahead-of-commit managed-session
|
|
20
|
+
* registration those `StartupOrchestrator.startNode` bookkeeping steps would
|
|
21
|
+
* require (updateStartupStatus / node_startup_context / updateResumeToken by
|
|
22
|
+
* sessionId all need a registered session row). Driving the adapter primitives
|
|
23
|
+
* directly is how we make the successor a live agent while keeping it unmanaged
|
|
24
|
+
* until commit. Any launch/readiness failure UNWINDS the created session and
|
|
25
|
+
* leaves the original binding intact (commit never runs).
|
|
26
|
+
*
|
|
27
|
+
* Why not `NodeLauncher.launchNode`: it refuses a bound node and, on success,
|
|
28
|
+
* registers a managed session + binding in the same transaction — which would
|
|
29
|
+
* trip `successor_already_managed` in the commit path. This seam creates a
|
|
30
|
+
* DISTINCT unmanaged session instead.
|
|
31
|
+
*/
|
|
32
|
+
export interface SuccessorNode {
|
|
33
|
+
id: string;
|
|
34
|
+
runtime: string | null;
|
|
35
|
+
cwd: string | null;
|
|
36
|
+
}
|
|
37
|
+
export type SuccessorLaunchResult = {
|
|
38
|
+
ok: true;
|
|
39
|
+
discoveredId: string;
|
|
40
|
+
tmuxSession: string;
|
|
41
|
+
tmuxPane: string;
|
|
42
|
+
resumeToken?: string;
|
|
43
|
+
resumeType?: string;
|
|
44
|
+
} | {
|
|
45
|
+
ok: false;
|
|
46
|
+
code: string;
|
|
47
|
+
step: "create_successor" | "resolve_pane" | "start_agent";
|
|
48
|
+
message: string;
|
|
49
|
+
};
|
|
50
|
+
export declare class SuccessorSessionLauncher {
|
|
51
|
+
private tmuxAdapter;
|
|
52
|
+
private discoveryRepo;
|
|
53
|
+
private sessionEnv;
|
|
54
|
+
private newId;
|
|
55
|
+
private runtimeAdapters;
|
|
56
|
+
private readinessTimeoutMs;
|
|
57
|
+
private sleep;
|
|
58
|
+
constructor(tmuxAdapter: TmuxAdapter, discoveryRepo: DiscoveryRepository, opts?: {
|
|
59
|
+
sessionEnv?: Record<string, string | undefined>;
|
|
60
|
+
newId?: () => string;
|
|
61
|
+
/** Runtime adapters keyed by runtime, used to launch + ready-probe the
|
|
62
|
+
* successor agent. Absent → a fresh successor cannot be launched. */
|
|
63
|
+
runtimeAdapters?: Record<string, RuntimeAdapter>;
|
|
64
|
+
/** Readiness timeout in ms (default 30000, mirrors StartupOrchestrator). */
|
|
65
|
+
readinessTimeoutMs?: number;
|
|
66
|
+
/** Injectable sleep (tests). */
|
|
67
|
+
sleep?: (ms: number) => Promise<void>;
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* Create the unmanaged successor tmux session, launch it into a LIVE agent,
|
|
71
|
+
* and record it as an active discovery candidate. The candidate satisfies the
|
|
72
|
+
* discovered->commit guards: active (upsert sets status='active'), distinct
|
|
73
|
+
* name, matching runtime hint, unmanaged (no binding/session claims it),
|
|
74
|
+
* tmux-present (just created). The returned resume token (if any) is the
|
|
75
|
+
* launch-scraped token the composer persists at commit (B2 for fresh).
|
|
76
|
+
*/
|
|
77
|
+
createSuccessor(input: {
|
|
78
|
+
node: SuccessorNode;
|
|
79
|
+
departingSessionName: string;
|
|
80
|
+
}): Promise<SuccessorLaunchResult>;
|
|
81
|
+
/**
|
|
82
|
+
* B1 — launch the successor into a live, ready agent via the runtime adapter's
|
|
83
|
+
* `launchHarness` + readiness probe (the same primitives StartupOrchestrator
|
|
84
|
+
* drives), capturing the launch resume token. No session/binding is
|
|
85
|
+
* registered — the successor stays unmanaged until commit. The token is NEVER
|
|
86
|
+
* logged or placed in a returned message.
|
|
87
|
+
*/
|
|
88
|
+
private startAgent;
|
|
89
|
+
/**
|
|
90
|
+
* Wait for harness readiness with exponential backoff (1s→2s→…→16s cap,
|
|
91
|
+
* 30s default timeout) — mirrors StartupOrchestrator.waitForReady.
|
|
92
|
+
*/
|
|
93
|
+
private waitForReady;
|
|
94
|
+
/**
|
|
95
|
+
* Failure cleanup for a created-but-not-committed successor. There is NO
|
|
96
|
+
* binding to unwind (commit never ran), so this only kills the unmanaged
|
|
97
|
+
* tmux session and marks the discovery candidate vanished. The original
|
|
98
|
+
* seat/binding is untouched.
|
|
99
|
+
*/
|
|
100
|
+
cleanup(tmuxSession: string, discoveredId: string | null): Promise<void>;
|
|
101
|
+
private killBestEffort;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=successor-session-launcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"successor-session-launcher.d.ts","sourceRoot":"","sources":["../../src/domain/successor-session-launcher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,OAAO,KAAK,EAAE,cAAc,EAAgC,MAAM,sBAAsB,CAAC;AAGzF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB;AAED,MAAM,MAAM,qBAAqB,GAC7B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GACpH;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,kBAAkB,GAAG,cAAc,GAAG,aAAa,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5G,qBAAa,wBAAwB;IACnC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,UAAU,CAAqC;IACvD,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,eAAe,CAAiC;IACxD,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,KAAK,CAAgC;gBAG3C,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,mBAAmB,EAClC,IAAI,GAAE;QACJ,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;QAChD,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;QACrB;8EACsE;QACtE,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;QACjD,4EAA4E;QAC5E,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,gCAAgC;QAChC,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KAClC;IAWR;;;;;;;OAOG;IACG,eAAe,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,aAAa,CAAC;QAAC,oBAAoB,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA0FnH;;;;;;OAMG;YACW,UAAU;IAmFxB;;;OAGG;YACW,YAAY;IAsB1B;;;;;OAKG;IACG,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YAKhE,cAAc;CAO7B"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { ulid } from "ulid";
|
|
2
|
+
import { isAttentionRequiredReadinessCode } from "./runtime-adapter.js";
|
|
3
|
+
export class SuccessorSessionLauncher {
|
|
4
|
+
tmuxAdapter;
|
|
5
|
+
discoveryRepo;
|
|
6
|
+
sessionEnv;
|
|
7
|
+
newId;
|
|
8
|
+
runtimeAdapters;
|
|
9
|
+
readinessTimeoutMs;
|
|
10
|
+
sleep;
|
|
11
|
+
constructor(tmuxAdapter, discoveryRepo, opts = {}) {
|
|
12
|
+
this.tmuxAdapter = tmuxAdapter;
|
|
13
|
+
this.discoveryRepo = discoveryRepo;
|
|
14
|
+
this.sessionEnv = opts.sessionEnv ?? {};
|
|
15
|
+
this.newId = opts.newId ?? ulid;
|
|
16
|
+
this.runtimeAdapters = opts.runtimeAdapters ?? {};
|
|
17
|
+
this.readinessTimeoutMs = opts.readinessTimeoutMs ?? 30_000;
|
|
18
|
+
this.sleep = opts.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Create the unmanaged successor tmux session, launch it into a LIVE agent,
|
|
22
|
+
* and record it as an active discovery candidate. The candidate satisfies the
|
|
23
|
+
* discovered->commit guards: active (upsert sets status='active'), distinct
|
|
24
|
+
* name, matching runtime hint, unmanaged (no binding/session claims it),
|
|
25
|
+
* tmux-present (just created). The returned resume token (if any) is the
|
|
26
|
+
* launch-scraped token the composer persists at commit (B2 for fresh).
|
|
27
|
+
*/
|
|
28
|
+
async createSuccessor(input) {
|
|
29
|
+
// Distinct successor name derived from the departing occupant's (valid)
|
|
30
|
+
// session name so it stays inside the tmux/OpenRig naming charset while
|
|
31
|
+
// never colliding with the current occupant.
|
|
32
|
+
const distinctName = `${input.departingSessionName}-h${this.newId().slice(-8)}`;
|
|
33
|
+
// OpenRig identity env mirrors NodeLauncher.launchNode's pattern so the
|
|
34
|
+
// successor self-identifies + reports activity exactly like a launched seat.
|
|
35
|
+
const env = compactEnv({
|
|
36
|
+
OPENRIG_NODE_ID: input.node.id,
|
|
37
|
+
OPENRIG_SESSION_NAME: distinctName,
|
|
38
|
+
OPENRIG_RUNTIME: input.node.runtime ?? undefined,
|
|
39
|
+
...this.sessionEnv,
|
|
40
|
+
});
|
|
41
|
+
const cwd = input.node.cwd ?? undefined;
|
|
42
|
+
// Driver note 1: create via the ACTUAL adapter signature createSession(name, cwd, env).
|
|
43
|
+
const created = await this.tmuxAdapter.createSession(distinctName, cwd, env);
|
|
44
|
+
if (!created.ok) {
|
|
45
|
+
// tmux can run hooks after creating the session; if a hook fails,
|
|
46
|
+
// `new-session` can return non-zero while the unmanaged session remains.
|
|
47
|
+
// Do not kill on duplicate_session, which may be a real pre-existing
|
|
48
|
+
// collision. All other failed-create cases get best-effort cleanup.
|
|
49
|
+
if (created.code !== "duplicate_session") {
|
|
50
|
+
await this.killBestEffort(distinctName);
|
|
51
|
+
}
|
|
52
|
+
return { ok: false, code: created.code, step: "create_successor", message: created.message };
|
|
53
|
+
}
|
|
54
|
+
// Driver note 2: resolve the real tmux pane AFTER create, BEFORE upsertDiscoveredSession —
|
|
55
|
+
// upsert requires a pane, and createSession returns only { ok: true }.
|
|
56
|
+
// A list-panes probe can THROW (permission/socket errors rethrow from the
|
|
57
|
+
// adapter); treat a throw EXACTLY like the null-pane case — kill the
|
|
58
|
+
// just-created successor and return the structured resolve_pane failure, so
|
|
59
|
+
// the unmanaged session is never left orphaned and the caller never sees an
|
|
60
|
+
// unstructured rejection/500.
|
|
61
|
+
let pane;
|
|
62
|
+
try {
|
|
63
|
+
const panes = await this.tmuxAdapter.listPanes(distinctName);
|
|
64
|
+
pane = panes.find((p) => p.active) ?? panes[0];
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
await this.tmuxAdapter.killSession(distinctName);
|
|
68
|
+
return {
|
|
69
|
+
ok: false,
|
|
70
|
+
code: "pane_probe_failed",
|
|
71
|
+
step: "resolve_pane",
|
|
72
|
+
message: `Could not probe tmux panes for successor session "${distinctName}": ${err instanceof Error ? err.message : String(err)}`,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (!pane) {
|
|
76
|
+
// No pane resolvable — kill the just-created session so nothing leaks.
|
|
77
|
+
await this.tmuxAdapter.killSession(distinctName);
|
|
78
|
+
return {
|
|
79
|
+
ok: false,
|
|
80
|
+
code: "pane_unresolved",
|
|
81
|
+
step: "resolve_pane",
|
|
82
|
+
message: `Could not resolve a tmux pane for successor session "${distinctName}".`,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
// B1 — route the successor through REAL runtime startup so it becomes a LIVE,
|
|
86
|
+
// READY agent BEFORE it can be committed. On ANY launch/readiness failure,
|
|
87
|
+
// unwind (kill the unmanaged session) and fail loudly naming the step; the
|
|
88
|
+
// original seat/binding is untouched because commit never runs.
|
|
89
|
+
const started = await this.startAgent(input.node, distinctName, pane.id, cwd);
|
|
90
|
+
if (!started.ok) {
|
|
91
|
+
await this.killBestEffort(distinctName);
|
|
92
|
+
return { ok: false, code: started.code, step: "start_agent", message: started.message };
|
|
93
|
+
}
|
|
94
|
+
const discovered = this.discoveryRepo.upsertDiscoveredSession({
|
|
95
|
+
tmuxSession: distinctName,
|
|
96
|
+
tmuxPane: pane.id,
|
|
97
|
+
// The hint equals the node's own runtime, so the commit-path runtime check
|
|
98
|
+
// always matches; null runtime records as "unknown" (which the check skips).
|
|
99
|
+
runtimeHint: (input.node.runtime ?? "unknown"),
|
|
100
|
+
confidence: "high",
|
|
101
|
+
cwd: input.node.cwd ?? undefined,
|
|
102
|
+
});
|
|
103
|
+
return {
|
|
104
|
+
ok: true,
|
|
105
|
+
discoveredId: discovered.id,
|
|
106
|
+
tmuxSession: distinctName,
|
|
107
|
+
tmuxPane: pane.id,
|
|
108
|
+
resumeToken: started.resumeToken,
|
|
109
|
+
resumeType: started.resumeType,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* B1 — launch the successor into a live, ready agent via the runtime adapter's
|
|
114
|
+
* `launchHarness` + readiness probe (the same primitives StartupOrchestrator
|
|
115
|
+
* drives), capturing the launch resume token. No session/binding is
|
|
116
|
+
* registered — the successor stays unmanaged until commit. The token is NEVER
|
|
117
|
+
* logged or placed in a returned message.
|
|
118
|
+
*/
|
|
119
|
+
async startAgent(node, tmuxSession, tmuxPane, cwd) {
|
|
120
|
+
const adapter = node.runtime ? this.runtimeAdapters[node.runtime] : undefined;
|
|
121
|
+
if (!adapter) {
|
|
122
|
+
return {
|
|
123
|
+
ok: false,
|
|
124
|
+
code: "successor_runtime_unsupported",
|
|
125
|
+
message: `No runtime adapter for "${node.runtime ?? "unknown"}"; a live successor cannot be launched for this seat.`,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
// Transient binding for the adapter launch/readiness probe — the successor
|
|
129
|
+
// is unmanaged, so there is no persisted binding row (id/updatedAt are inert
|
|
130
|
+
// for the adapter; it reads tmuxSession/tmuxPane/cwd). Model/config profile
|
|
131
|
+
// are not resolved here (v0): a fresh successor launches with the runtime's
|
|
132
|
+
// default profile, not the departing seat's AgentSpec-configured model —
|
|
133
|
+
// a live default-config agent beats a dead shell; full-fidelity relaunch is
|
|
134
|
+
// a tracked follow-on.
|
|
135
|
+
const binding = {
|
|
136
|
+
id: "",
|
|
137
|
+
nodeId: node.id,
|
|
138
|
+
attachmentType: "tmux",
|
|
139
|
+
tmuxSession,
|
|
140
|
+
tmuxWindow: null,
|
|
141
|
+
tmuxPane,
|
|
142
|
+
cmuxWorkspace: null,
|
|
143
|
+
cmuxSurface: null,
|
|
144
|
+
updatedAt: "",
|
|
145
|
+
cwd: cwd ?? "",
|
|
146
|
+
};
|
|
147
|
+
let launch;
|
|
148
|
+
try {
|
|
149
|
+
launch = await adapter.launchHarness(binding, { name: tmuxSession });
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
return { ok: false, code: "successor_launch_failed", message: `Successor harness launch threw: ${err instanceof Error ? err.message : String(err)}` };
|
|
153
|
+
}
|
|
154
|
+
if (!launch.ok) {
|
|
155
|
+
return { ok: false, code: "successor_launch_failed", message: `Successor harness launch failed: ${launch.error}` };
|
|
156
|
+
}
|
|
157
|
+
// Capture the launch-scraped resume token (never logged). Persisted by the
|
|
158
|
+
// composer at commit with provenance "scrape" (B2, launched modes).
|
|
159
|
+
let resumeToken;
|
|
160
|
+
let resumeType;
|
|
161
|
+
const trimmed = launch.resumeToken?.trim();
|
|
162
|
+
if (trimmed) {
|
|
163
|
+
resumeToken = trimmed;
|
|
164
|
+
resumeType = launch.resumeType;
|
|
165
|
+
}
|
|
166
|
+
// OPR.0.4.3.04 rev2 code-review fix — checkReady/waitForReady can THROW after
|
|
167
|
+
// createSession already succeeded (adapter/socket/permission errors rethrow).
|
|
168
|
+
// A thrown exception must NOT reject createSuccessor before its kill/unwind
|
|
169
|
+
// runs (that would LEAK the unmanaged successor + surface an unstructured 500).
|
|
170
|
+
// Catch it here and return a STRUCTURED ok:false so the caller kills the
|
|
171
|
+
// just-created session (killBestEffort) and fails loudly at step=start_agent —
|
|
172
|
+
// exactly like a returned readiness failure.
|
|
173
|
+
let readiness;
|
|
174
|
+
try {
|
|
175
|
+
readiness = await this.waitForReady(adapter, binding);
|
|
176
|
+
}
|
|
177
|
+
catch (err) {
|
|
178
|
+
return {
|
|
179
|
+
ok: false,
|
|
180
|
+
code: "successor_readiness_failed",
|
|
181
|
+
message: `Successor readiness probe threw: ${err instanceof Error ? err.message : String(err)}`,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
if (!readiness.ready) {
|
|
185
|
+
return {
|
|
186
|
+
ok: false,
|
|
187
|
+
code: isAttentionRequiredReadinessCode(readiness.code) ? "successor_attention_required" : "successor_not_ready",
|
|
188
|
+
message: `Successor did not become a ready agent: ${readiness.reason ?? "readiness timeout"}`,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
return { ok: true, resumeToken, resumeType };
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Wait for harness readiness with exponential backoff (1s→2s→…→16s cap,
|
|
195
|
+
* 30s default timeout) — mirrors StartupOrchestrator.waitForReady.
|
|
196
|
+
*/
|
|
197
|
+
async waitForReady(adapter, binding) {
|
|
198
|
+
const startTime = Date.now();
|
|
199
|
+
let delay = 1000;
|
|
200
|
+
const maxDelay = 16_000;
|
|
201
|
+
while (true) {
|
|
202
|
+
const result = await adapter.checkReady(binding);
|
|
203
|
+
if (result.ready)
|
|
204
|
+
return result;
|
|
205
|
+
if (isAttentionRequiredReadinessCode(result.code))
|
|
206
|
+
return result;
|
|
207
|
+
const elapsed = Date.now() - startTime;
|
|
208
|
+
if (elapsed + delay > this.readinessTimeoutMs) {
|
|
209
|
+
const finalResult = await adapter.checkReady(binding);
|
|
210
|
+
if (finalResult.ready)
|
|
211
|
+
return finalResult;
|
|
212
|
+
return { ready: false, reason: result.reason ?? "readiness timeout" };
|
|
213
|
+
}
|
|
214
|
+
await this.sleep(delay);
|
|
215
|
+
delay = Math.min(delay * 2, maxDelay);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Failure cleanup for a created-but-not-committed successor. There is NO
|
|
220
|
+
* binding to unwind (commit never ran), so this only kills the unmanaged
|
|
221
|
+
* tmux session and marks the discovery candidate vanished. The original
|
|
222
|
+
* seat/binding is untouched.
|
|
223
|
+
*/
|
|
224
|
+
async cleanup(tmuxSession, discoveredId) {
|
|
225
|
+
await this.tmuxAdapter.killSession(tmuxSession);
|
|
226
|
+
if (discoveredId)
|
|
227
|
+
this.discoveryRepo.markVanished([discoveredId]);
|
|
228
|
+
}
|
|
229
|
+
async killBestEffort(tmuxSession) {
|
|
230
|
+
try {
|
|
231
|
+
await this.tmuxAdapter.killSession(tmuxSession);
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
// Cleanup must not mask the original failure.
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
function compactEnv(input) {
|
|
239
|
+
const result = {};
|
|
240
|
+
for (const [key, value] of Object.entries(input)) {
|
|
241
|
+
if (typeof value === "string" && value.length > 0)
|
|
242
|
+
result[key] = value;
|
|
243
|
+
}
|
|
244
|
+
return result;
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=successor-session-launcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"successor-session-launcher.js","sourceRoot":"","sources":["../../src/domain/successor-session-launcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAK5B,OAAO,EAAE,g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,WAAmB,EAAE,YAA2B;QAC5D,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAChD,IAAI,YAAY;YAAE,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;IACpE,CAAC;IAEO,KAAK,CAAC,cAAc,CAAC,WAAmB;QAC9C,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;QAAC,MAAM,CAAC;YACP,8CAA8C;QAChD,CAAC;IACH,CAAC;CACF;AAED,SAAS,UAAU,CAAC,KAAyC;IAC3D,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACzE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { TopologyManifest } from "./topology-manifest.js";
|
|
2
|
+
import type { HostEntry, HostRegistryLoadResult } from "../hosts/hosts-registry-reader.js";
|
|
3
|
+
export type TopologyEntryStatus = "ok" | "failed" | "skipped";
|
|
4
|
+
export interface TopologyEntryResult {
|
|
5
|
+
rigRef: string;
|
|
6
|
+
/** Uniform on every entry: the placed host id, or the literal "local". */
|
|
7
|
+
host: string;
|
|
8
|
+
status: TopologyEntryStatus;
|
|
9
|
+
error?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface TopologyLaunchResult {
|
|
12
|
+
/** True ONLY when every entry is ok (FR-5 — no false green). */
|
|
13
|
+
ok: boolean;
|
|
14
|
+
entries: TopologyEntryResult[];
|
|
15
|
+
}
|
|
16
|
+
export interface MultiRigLauncherDeps {
|
|
17
|
+
/** The SAME public lock pair the up route uses (bootstrap-orchestrator). */
|
|
18
|
+
tryAcquire: (sourceRef: string) => boolean;
|
|
19
|
+
release: (sourceRef: string) => void;
|
|
20
|
+
/** The existing local single-rig leaf (public bootstrap() via routes/up.ts
|
|
21
|
+
* wiring). Resolves ok:false with the leaf's own error on failure — the
|
|
22
|
+
* launcher invents no failure taxonomy. */
|
|
23
|
+
launchLocal: (source: string) => Promise<{
|
|
24
|
+
ok: boolean;
|
|
25
|
+
error?: string;
|
|
26
|
+
}>;
|
|
27
|
+
/** The shipped remote POST /api/up leaf for a placed entry. */
|
|
28
|
+
launchRemote: (source: string, host: HostEntry) => Promise<{
|
|
29
|
+
ok: boolean;
|
|
30
|
+
error?: string;
|
|
31
|
+
}>;
|
|
32
|
+
/** Lazy hosts-registry read (shared reader) — consulted only when the
|
|
33
|
+
* manifest actually places entries on hosts. */
|
|
34
|
+
loadRegistry: () => HostRegistryLoadResult;
|
|
35
|
+
/** Resolve a local entry's manifest source string to the EXACT ref used
|
|
36
|
+
* for BOTH the lock and the leaf (guard fixback F1): the orchestrator
|
|
37
|
+
* normalizes lock keys with path.resolve, so locking the raw relative
|
|
38
|
+
* string would key against the daemon cwd while the leaf launches the
|
|
39
|
+
* manifest-dir-resolved file — false lock negatives (standalone up of
|
|
40
|
+
* the real path doesn't conflict) AND false positives (two manifests'
|
|
41
|
+
* './a.yaml' collide across different files). Identity when omitted. */
|
|
42
|
+
resolveLocalRef?: (source: string) => string;
|
|
43
|
+
}
|
|
44
|
+
export declare class MultiRigLauncher {
|
|
45
|
+
private deps;
|
|
46
|
+
constructor(deps: MultiRigLauncherDeps);
|
|
47
|
+
launch(manifest: TopologyManifest): Promise<TopologyLaunchResult>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=multi-rig-launcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-rig-launcher.d.ts","sourceRoot":"","sources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