@openrig/cli 0.2.0 → 0.3.0
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/dist/adapters/claude-code-adapter.d.ts +10 -0
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +41 -3
- package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/daemon/dist/builtins/workflow-specs/basic-loop.yaml +76 -0
- package/daemon/dist/builtins/workflow-specs/conveyor.yaml +80 -0
- package/daemon/dist/db/migrations/026_inbox_entries.d.ts +1 -1
- package/daemon/dist/db/migrations/026_inbox_entries.js +1 -1
- package/daemon/dist/db/migrations/029_classifier_leases.d.ts +1 -1
- package/daemon/dist/db/migrations/029_classifier_leases.js +1 -1
- package/daemon/dist/db/migrations/037_mission_control_actions.d.ts +51 -0
- package/daemon/dist/db/migrations/037_mission_control_actions.d.ts.map +1 -0
- package/daemon/dist/db/migrations/037_mission_control_actions.js +74 -0
- package/daemon/dist/db/migrations/037_mission_control_actions.js.map +1 -0
- package/daemon/dist/db/migrations/038_workspace_primitive.d.ts +16 -0
- package/daemon/dist/db/migrations/038_workspace_primitive.d.ts.map +1 -0
- package/daemon/dist/db/migrations/038_workspace_primitive.js +20 -0
- package/daemon/dist/db/migrations/038_workspace_primitive.js.map +1 -0
- package/daemon/dist/db/migrations/039_queue_target_repo.d.ts +16 -0
- package/daemon/dist/db/migrations/039_queue_target_repo.d.ts.map +1 -0
- package/daemon/dist/db/migrations/039_queue_target_repo.js +21 -0
- package/daemon/dist/db/migrations/039_queue_target_repo.js.map +1 -0
- package/daemon/dist/domain/active-lens-store.d.ts +23 -0
- package/daemon/dist/domain/active-lens-store.d.ts.map +1 -0
- package/daemon/dist/domain/active-lens-store.js +87 -0
- package/daemon/dist/domain/active-lens-store.js.map +1 -0
- package/daemon/dist/domain/agent-images/agent-image-library-service.d.ts +68 -0
- package/daemon/dist/domain/agent-images/agent-image-library-service.d.ts.map +1 -0
- package/daemon/dist/domain/agent-images/agent-image-library-service.js +339 -0
- package/daemon/dist/domain/agent-images/agent-image-library-service.js.map +1 -0
- package/daemon/dist/domain/agent-images/agent-image-types.d.ts +113 -0
- package/daemon/dist/domain/agent-images/agent-image-types.d.ts.map +1 -0
- package/daemon/dist/domain/agent-images/agent-image-types.js +24 -0
- package/daemon/dist/domain/agent-images/agent-image-types.js.map +1 -0
- package/daemon/dist/domain/agent-images/evidence-guard.d.ts +26 -0
- package/daemon/dist/domain/agent-images/evidence-guard.d.ts.map +1 -0
- package/daemon/dist/domain/agent-images/evidence-guard.js +185 -0
- package/daemon/dist/domain/agent-images/evidence-guard.js.map +1 -0
- package/daemon/dist/domain/agent-images/manifest-parser.d.ts +3 -0
- package/daemon/dist/domain/agent-images/manifest-parser.d.ts.map +1 -0
- package/daemon/dist/domain/agent-images/manifest-parser.js +114 -0
- package/daemon/dist/domain/agent-images/manifest-parser.js.map +1 -0
- package/daemon/dist/domain/agent-images/resume-token-discovery.d.ts +28 -0
- package/daemon/dist/domain/agent-images/resume-token-discovery.d.ts.map +1 -0
- package/daemon/dist/domain/agent-images/resume-token-discovery.js +83 -0
- package/daemon/dist/domain/agent-images/resume-token-discovery.js.map +1 -0
- package/daemon/dist/domain/agent-images/snapshot-capturer.d.ts +36 -0
- package/daemon/dist/domain/agent-images/snapshot-capturer.d.ts.map +1 -0
- package/daemon/dist/domain/agent-images/snapshot-capturer.js +58 -0
- package/daemon/dist/domain/agent-images/snapshot-capturer.js.map +1 -0
- package/daemon/dist/domain/agent-starter-resolver.d.ts +10 -16
- package/daemon/dist/domain/agent-starter-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/agent-starter-resolver.js +11 -13
- package/daemon/dist/domain/agent-starter-resolver.js.map +1 -1
- package/daemon/dist/domain/classifier-lease-manager.d.ts +1 -1
- package/daemon/dist/domain/classifier-lease-manager.js +1 -1
- package/daemon/dist/domain/conflict-detector.d.ts.map +1 -1
- package/daemon/dist/domain/conflict-detector.js +6 -3
- package/daemon/dist/domain/conflict-detector.js.map +1 -1
- package/daemon/dist/domain/context-monitor.d.ts +5 -4
- package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
- package/daemon/dist/domain/context-monitor.js +26 -11
- package/daemon/dist/domain/context-monitor.js.map +1 -1
- package/daemon/dist/domain/context-packs/bundle-assembler.d.ts +49 -0
- package/daemon/dist/domain/context-packs/bundle-assembler.d.ts.map +1 -0
- package/daemon/dist/domain/context-packs/bundle-assembler.js +81 -0
- package/daemon/dist/domain/context-packs/bundle-assembler.js.map +1 -0
- package/daemon/dist/domain/context-packs/context-pack-library-service.d.ts +41 -0
- package/daemon/dist/domain/context-packs/context-pack-library-service.d.ts.map +1 -0
- package/daemon/dist/domain/context-packs/context-pack-library-service.js +148 -0
- package/daemon/dist/domain/context-packs/context-pack-library-service.js.map +1 -0
- package/daemon/dist/domain/context-packs/context-pack-types.d.ts +64 -0
- package/daemon/dist/domain/context-packs/context-pack-types.d.ts.map +1 -0
- package/daemon/dist/domain/context-packs/context-pack-types.js +22 -0
- package/daemon/dist/domain/context-packs/context-pack-types.js.map +1 -0
- package/daemon/dist/domain/context-packs/manifest-parser.d.ts +3 -0
- package/daemon/dist/domain/context-packs/manifest-parser.d.ts.map +1 -0
- package/daemon/dist/domain/context-packs/manifest-parser.js +74 -0
- package/daemon/dist/domain/context-packs/manifest-parser.js.map +1 -0
- package/daemon/dist/domain/context-usage-store.d.ts +14 -1
- package/daemon/dist/domain/context-usage-store.d.ts.map +1 -1
- package/daemon/dist/domain/context-usage-store.js +156 -1
- package/daemon/dist/domain/context-usage-store.js.map +1 -1
- package/daemon/dist/domain/files/file-write-service.d.ts +61 -0
- package/daemon/dist/domain/files/file-write-service.d.ts.map +1 -0
- package/daemon/dist/domain/files/file-write-service.js +180 -0
- package/daemon/dist/domain/files/file-write-service.js.map +1 -0
- package/daemon/dist/domain/files/path-safety.d.ts +47 -0
- package/daemon/dist/domain/files/path-safety.d.ts.map +1 -0
- package/daemon/dist/domain/files/path-safety.js +176 -0
- package/daemon/dist/domain/files/path-safety.js.map +1 -0
- package/daemon/dist/domain/graph-projection.d.ts +14 -1
- package/daemon/dist/domain/graph-projection.d.ts.map +1 -1
- package/daemon/dist/domain/graph-projection.js +8 -0
- package/daemon/dist/domain/graph-projection.js.map +1 -1
- package/daemon/dist/domain/install-engine.d.ts.map +1 -1
- package/daemon/dist/domain/install-engine.js +22 -6
- package/daemon/dist/domain/install-engine.js.map +1 -1
- package/daemon/dist/domain/install-verifier.d.ts.map +1 -1
- package/daemon/dist/domain/install-verifier.js +10 -5
- package/daemon/dist/domain/install-verifier.js.map +1 -1
- package/daemon/dist/domain/managed-blocks.d.ts.map +1 -1
- package/daemon/dist/domain/managed-blocks.js +22 -3
- package/daemon/dist/domain/managed-blocks.js.map +1 -1
- package/daemon/dist/domain/mission-control/audit-browse.d.ts +26 -0
- package/daemon/dist/domain/mission-control/audit-browse.d.ts.map +1 -0
- package/daemon/dist/domain/mission-control/audit-browse.js +101 -0
- package/daemon/dist/domain/mission-control/audit-browse.js.map +1 -0
- package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts +51 -0
- package/daemon/dist/domain/mission-control/mission-control-action-log.d.ts.map +1 -0
- package/daemon/dist/domain/mission-control/mission-control-action-log.js +124 -0
- package/daemon/dist/domain/mission-control/mission-control-action-log.js.map +1 -0
- package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.d.ts +131 -0
- package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.d.ts.map +1 -0
- package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.js +232 -0
- package/daemon/dist/domain/mission-control/mission-control-fleet-cli-capability.js.map +1 -0
- package/daemon/dist/domain/mission-control/mission-control-read-layer.d.ts +85 -0
- package/daemon/dist/domain/mission-control/mission-control-read-layer.d.ts.map +1 -0
- package/daemon/dist/domain/mission-control/mission-control-read-layer.js +265 -0
- package/daemon/dist/domain/mission-control/mission-control-read-layer.js.map +1 -0
- package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts +69 -0
- package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -0
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js +300 -0
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -0
- package/daemon/dist/domain/mission-control/notification-adapter-ntfy.d.ts +18 -0
- package/daemon/dist/domain/mission-control/notification-adapter-ntfy.d.ts.map +1 -0
- package/daemon/dist/domain/mission-control/notification-adapter-ntfy.js +48 -0
- package/daemon/dist/domain/mission-control/notification-adapter-ntfy.js.map +1 -0
- package/daemon/dist/domain/mission-control/notification-adapter-types.d.ts +25 -0
- package/daemon/dist/domain/mission-control/notification-adapter-types.d.ts.map +1 -0
- package/daemon/dist/domain/mission-control/notification-adapter-types.js +7 -0
- package/daemon/dist/domain/mission-control/notification-adapter-types.js.map +1 -0
- package/daemon/dist/domain/mission-control/notification-adapter-webhook.d.ts +27 -0
- package/daemon/dist/domain/mission-control/notification-adapter-webhook.d.ts.map +1 -0
- package/daemon/dist/domain/mission-control/notification-adapter-webhook.js +47 -0
- package/daemon/dist/domain/mission-control/notification-adapter-webhook.js.map +1 -0
- package/daemon/dist/domain/mission-control/notification-dispatcher.d.ts +53 -0
- package/daemon/dist/domain/mission-control/notification-dispatcher.d.ts.map +1 -0
- package/daemon/dist/domain/mission-control/notification-dispatcher.js +181 -0
- package/daemon/dist/domain/mission-control/notification-dispatcher.js.map +1 -0
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +24 -0
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +7 -5
- package/daemon/dist/domain/node-launcher.js.map +1 -1
- package/daemon/dist/domain/preview/preview-rate-limiter.d.ts +20 -0
- package/daemon/dist/domain/preview/preview-rate-limiter.d.ts.map +1 -0
- package/daemon/dist/domain/preview/preview-rate-limiter.js +46 -0
- package/daemon/dist/domain/preview/preview-rate-limiter.js.map +1 -0
- package/daemon/dist/domain/profile-resolver.d.ts +5 -0
- package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/profile-resolver.js +62 -8
- package/daemon/dist/domain/profile-resolver.js.map +1 -1
- package/daemon/dist/domain/progress/progress-indexer.d.ts +73 -0
- package/daemon/dist/domain/progress/progress-indexer.d.ts.map +1 -0
- package/daemon/dist/domain/progress/progress-indexer.js +210 -0
- package/daemon/dist/domain/progress/progress-indexer.js.map +1 -0
- package/daemon/dist/domain/project-classifier.d.ts +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +22 -4
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +80 -22
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/rehydrate-eligibility.d.ts +16 -0
- package/daemon/dist/domain/rehydrate-eligibility.d.ts.map +1 -0
- package/daemon/dist/domain/rehydrate-eligibility.js +43 -0
- package/daemon/dist/domain/rehydrate-eligibility.js.map +1 -0
- package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
- package/daemon/dist/domain/restore-check-service.js +19 -6
- package/daemon/dist/domain/restore-check-service.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +4 -2
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/rig-repository.d.ts +14 -0
- package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/daemon/dist/domain/rig-repository.js +41 -0
- package/daemon/dist/domain/rig-repository.js.map +1 -1
- package/daemon/dist/domain/rig-teardown.d.ts.map +1 -1
- package/daemon/dist/domain/rig-teardown.js +5 -0
- package/daemon/dist/domain/rig-teardown.js.map +1 -1
- package/daemon/dist/domain/rigspec-codec.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-codec.js +15 -0
- package/daemon/dist/domain/rigspec-codec.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts +29 -0
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +136 -4
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-schema.js +157 -4
- package/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/daemon/dist/domain/runtime-adapter.d.ts +11 -0
- package/daemon/dist/domain/runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/domain/runtime-adapter.js.map +1 -1
- package/daemon/dist/domain/skill-discovery.d.ts +51 -0
- package/daemon/dist/domain/skill-discovery.d.ts.map +1 -0
- package/daemon/dist/domain/skill-discovery.js +144 -0
- package/daemon/dist/domain/skill-discovery.js.map +1 -0
- package/daemon/dist/domain/slices/slice-detail-projector.d.ts +182 -0
- package/daemon/dist/domain/slices/slice-detail-projector.d.ts.map +1 -0
- package/daemon/dist/domain/slices/slice-detail-projector.js +508 -0
- package/daemon/dist/domain/slices/slice-detail-projector.js.map +1 -0
- package/daemon/dist/domain/slices/slice-indexer.d.ts +118 -0
- package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -0
- package/daemon/dist/domain/slices/slice-indexer.js +503 -0
- package/daemon/dist/domain/slices/slice-indexer.js.map +1 -0
- package/daemon/dist/domain/spec-library-service.d.ts +17 -2
- package/daemon/dist/domain/spec-library-service.d.ts.map +1 -1
- package/daemon/dist/domain/spec-library-service.js +31 -1
- package/daemon/dist/domain/spec-library-service.js.map +1 -1
- package/daemon/dist/domain/spec-library-workflow-scanner.d.ts +81 -0
- package/daemon/dist/domain/spec-library-workflow-scanner.d.ts.map +1 -0
- package/daemon/dist/domain/spec-library-workflow-scanner.js +171 -0
- package/daemon/dist/domain/spec-library-workflow-scanner.js.map +1 -0
- package/daemon/dist/domain/startup-validation.d.ts.map +1 -1
- package/daemon/dist/domain/startup-validation.js +57 -11
- package/daemon/dist/domain/startup-validation.js.map +1 -1
- package/daemon/dist/domain/steering/health-summary.d.ts +39 -0
- package/daemon/dist/domain/steering/health-summary.d.ts.map +1 -0
- package/daemon/dist/domain/steering/health-summary.js +100 -0
- package/daemon/dist/domain/steering/health-summary.js.map +1 -0
- package/daemon/dist/domain/steering/steering-composer.d.ts +102 -0
- package/daemon/dist/domain/steering/steering-composer.d.ts.map +1 -0
- package/daemon/dist/domain/steering/steering-composer.js +263 -0
- package/daemon/dist/domain/steering/steering-composer.js.map +1 -0
- package/daemon/dist/domain/transcript-capture.d.ts.map +1 -1
- package/daemon/dist/domain/transcript-capture.js +7 -4
- package/daemon/dist/domain/transcript-capture.js.map +1 -1
- package/daemon/dist/domain/transcript-rotation.d.ts +29 -0
- package/daemon/dist/domain/transcript-rotation.d.ts.map +1 -0
- package/daemon/dist/domain/transcript-rotation.js +109 -0
- package/daemon/dist/domain/transcript-rotation.js.map +1 -0
- package/daemon/dist/domain/transcript-store.d.ts.map +1 -1
- package/daemon/dist/domain/transcript-store.js +7 -1
- package/daemon/dist/domain/transcript-store.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +101 -2
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js +8 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts +42 -0
- package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -0
- package/daemon/dist/domain/user-settings/settings-store.js +364 -0
- package/daemon/dist/domain/user-settings/settings-store.js.map +1 -0
- package/daemon/dist/domain/view-event-bridge.d.ts.map +1 -1
- package/daemon/dist/domain/view-event-bridge.js +2 -3
- package/daemon/dist/domain/view-event-bridge.js.map +1 -1
- package/daemon/dist/domain/whoami-service.d.ts +29 -0
- package/daemon/dist/domain/whoami-service.d.ts.map +1 -1
- package/daemon/dist/domain/whoami-service.js +68 -0
- package/daemon/dist/domain/whoami-service.js.map +1 -1
- package/daemon/dist/domain/workflow/slice-workflow-binding.d.ts +21 -0
- package/daemon/dist/domain/workflow/slice-workflow-binding.d.ts.map +1 -0
- package/daemon/dist/domain/workflow/slice-workflow-binding.js +103 -0
- package/daemon/dist/domain/workflow/slice-workflow-binding.js.map +1 -0
- package/daemon/dist/domain/workflow/slice-workflow-projection.d.ts +81 -0
- package/daemon/dist/domain/workflow/slice-workflow-projection.d.ts.map +1 -0
- package/daemon/dist/domain/workflow/slice-workflow-projection.js +127 -0
- package/daemon/dist/domain/workflow/slice-workflow-projection.js.map +1 -0
- package/daemon/dist/domain/workflow/starter-spec-loader.d.ts +51 -0
- package/daemon/dist/domain/workflow/starter-spec-loader.d.ts.map +1 -0
- package/daemon/dist/domain/workflow/starter-spec-loader.js +140 -0
- package/daemon/dist/domain/workflow/starter-spec-loader.js.map +1 -0
- package/daemon/dist/domain/workflow-projector.js +11 -3
- package/daemon/dist/domain/workflow-projector.js.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.d.ts +7 -0
- package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.js +62 -15
- package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
- package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts +6 -0
- package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts.map +1 -0
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js +207 -0
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -0
- package/daemon/dist/domain/workspace/frontmatter-validator.d.ts +40 -0
- package/daemon/dist/domain/workspace/frontmatter-validator.d.ts.map +1 -0
- package/daemon/dist/domain/workspace/frontmatter-validator.js +185 -0
- package/daemon/dist/domain/workspace/frontmatter-validator.js.map +1 -0
- package/daemon/dist/domain/workspace/workspace-resolver.d.ts +25 -0
- package/daemon/dist/domain/workspace/workspace-resolver.d.ts.map +1 -0
- package/daemon/dist/domain/workspace/workspace-resolver.js +86 -0
- package/daemon/dist/domain/workspace/workspace-resolver.js.map +1 -0
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +10 -1
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/middleware/auth-bearer-token.d.ts +49 -0
- package/daemon/dist/middleware/auth-bearer-token.d.ts.map +1 -0
- package/daemon/dist/middleware/auth-bearer-token.js +135 -0
- package/daemon/dist/middleware/auth-bearer-token.js.map +1 -0
- package/daemon/dist/openrig-compat.d.ts +1 -1
- package/daemon/dist/openrig-compat.d.ts.map +1 -1
- package/daemon/dist/openrig-compat.js +6 -4
- package/daemon/dist/openrig-compat.js.map +1 -1
- package/daemon/dist/routes/agent-images.d.ts +8 -0
- package/daemon/dist/routes/agent-images.d.ts.map +1 -0
- package/daemon/dist/routes/agent-images.js +253 -0
- package/daemon/dist/routes/agent-images.js.map +1 -0
- package/daemon/dist/routes/config.d.ts +3 -0
- package/daemon/dist/routes/config.d.ts.map +1 -0
- package/daemon/dist/routes/config.js +109 -0
- package/daemon/dist/routes/config.js.map +1 -0
- package/daemon/dist/routes/context-packs.d.ts +3 -0
- package/daemon/dist/routes/context-packs.d.ts.map +1 -0
- package/daemon/dist/routes/context-packs.js +129 -0
- package/daemon/dist/routes/context-packs.js.map +1 -0
- package/daemon/dist/routes/files.d.ts +17 -0
- package/daemon/dist/routes/files.d.ts.map +1 -0
- package/daemon/dist/routes/files.js +262 -0
- package/daemon/dist/routes/files.js.map +1 -0
- package/daemon/dist/routes/health-summary.d.ts +9 -0
- package/daemon/dist/routes/health-summary.d.ts.map +1 -0
- package/daemon/dist/routes/health-summary.js +33 -0
- package/daemon/dist/routes/health-summary.js.map +1 -0
- package/daemon/dist/routes/mission-control.d.ts +37 -0
- package/daemon/dist/routes/mission-control.d.ts.map +1 -0
- package/daemon/dist/routes/mission-control.js +283 -0
- package/daemon/dist/routes/mission-control.js.map +1 -0
- package/daemon/dist/routes/progress.d.ts +7 -0
- package/daemon/dist/routes/progress.d.ts.map +1 -0
- package/daemon/dist/routes/progress.js +33 -0
- package/daemon/dist/routes/progress.js.map +1 -0
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +52 -1
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/rigs.d.ts +3 -0
- package/daemon/dist/routes/rigs.d.ts.map +1 -1
- package/daemon/dist/routes/rigs.js +73 -7
- package/daemon/dist/routes/rigs.js.map +1 -1
- package/daemon/dist/routes/rigspec.js +6 -3
- package/daemon/dist/routes/rigspec.js.map +1 -1
- package/daemon/dist/routes/sessions.d.ts.map +1 -1
- package/daemon/dist/routes/sessions.js +119 -0
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/slices.d.ts +9 -0
- package/daemon/dist/routes/slices.d.ts.map +1 -0
- package/daemon/dist/routes/slices.js +192 -0
- package/daemon/dist/routes/slices.js.map +1 -0
- package/daemon/dist/routes/spec-library.d.ts.map +1 -1
- package/daemon/dist/routes/spec-library.js +72 -5
- package/daemon/dist/routes/spec-library.js.map +1 -1
- package/daemon/dist/routes/steering.d.ts +7 -0
- package/daemon/dist/routes/steering.d.ts.map +1 -0
- package/daemon/dist/routes/steering.js +27 -0
- package/daemon/dist/routes/steering.js.map +1 -0
- package/daemon/dist/routes/up.d.ts.map +1 -1
- package/daemon/dist/routes/up.js +21 -3
- package/daemon/dist/routes/up.js.map +1 -1
- package/daemon/dist/routes/whoami.d.ts.map +1 -1
- package/daemon/dist/routes/whoami.js +6 -1
- package/daemon/dist/routes/whoami.js.map +1 -1
- package/daemon/dist/routes/workflow.d.ts.map +1 -1
- package/daemon/dist/routes/workflow.js +43 -0
- package/daemon/dist/routes/workflow.js.map +1 -1
- package/daemon/dist/routes/workspace.d.ts +3 -0
- package/daemon/dist/routes/workspace.d.ts.map +1 -0
- package/daemon/dist/routes/workspace.js +53 -0
- package/daemon/dist/routes/workspace.js.map +1 -0
- package/daemon/dist/server.d.ts +51 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +52 -1
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts +9 -0
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +385 -2
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/docs/reference/agent-spec.md +7 -7
- package/daemon/docs/reference/agent-startup-guide.md +2 -2
- package/daemon/docs/reference/project-workspace.md +102 -0
- package/daemon/specs/agents/apps/vault-specialist/agent.yaml +1 -1
- package/daemon/specs/agents/apps/vault-specialist/guidance/role.md +0 -1
- package/daemon/specs/agents/conveyor/builder/agent.yaml +35 -0
- package/daemon/specs/agents/conveyor/builder/guidance/role.md +31 -0
- package/daemon/specs/agents/conveyor/builder/startup/context.md +9 -0
- package/daemon/specs/agents/conveyor/lead/agent.yaml +35 -0
- package/daemon/specs/agents/conveyor/lead/guidance/role.md +34 -0
- package/daemon/specs/agents/conveyor/lead/startup/context.md +15 -0
- package/daemon/specs/agents/conveyor/planner/agent.yaml +35 -0
- package/daemon/specs/agents/conveyor/planner/guidance/role.md +29 -0
- package/daemon/specs/agents/conveyor/planner/startup/context.md +12 -0
- package/daemon/specs/agents/conveyor/reviewer/agent.yaml +35 -0
- package/daemon/specs/agents/conveyor/reviewer/guidance/role.md +29 -0
- package/daemon/specs/agents/conveyor/reviewer/startup/context.md +10 -0
- package/daemon/specs/agents/development/implementer/agent.yaml +1 -1
- package/daemon/specs/agents/development/implementer/guidance/role.md +0 -1
- package/daemon/specs/agents/orchestration/orchestrator/agent.yaml +1 -1
- package/daemon/specs/agents/orchestration/orchestrator/guidance/role.md +2 -3
- package/daemon/specs/agents/shared/agent.yaml +0 -2
- package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +25 -0
- package/daemon/specs/agents/shared/skills/core/openrig-user-settings/SKILL.md +153 -0
- package/daemon/specs/agents/shared/skills/rig-architect/SKILL.md +1 -1
- package/daemon/specs/rigs/launch/conveyor/CULTURE.md +34 -0
- package/daemon/specs/rigs/launch/conveyor/README.md +33 -0
- package/daemon/specs/rigs/launch/conveyor/rig.yaml +72 -0
- package/daemon/specs/rigs/preview/product-team/CULTURE.md +2 -2
- package/daemon/specs/rigs/preview/product-team/rig.yaml +3 -4
- package/dist/commands/agent-image.d.ts +4 -0
- package/dist/commands/agent-image.d.ts.map +1 -0
- package/dist/commands/agent-image.js +352 -0
- package/dist/commands/agent-image.js.map +1 -0
- package/dist/commands/config-init-workspace.d.ts +35 -0
- package/dist/commands/config-init-workspace.d.ts.map +1 -0
- package/dist/commands/config-init-workspace.js +300 -0
- package/dist/commands/config-init-workspace.js.map +1 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +78 -18
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/context-pack.d.ts +4 -0
- package/dist/commands/context-pack.d.ts.map +1 -0
- package/dist/commands/context-pack.js +357 -0
- package/dist/commands/context-pack.js.map +1 -0
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +8 -0
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/commands/import.js +7 -2
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +173 -14
- package/dist/commands/ps.js.map +1 -1
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +9 -0
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/send.d.ts +7 -0
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +24 -1
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/specs.d.ts +4 -2
- package/dist/commands/specs.d.ts.map +1 -1
- package/dist/commands/specs.js +12 -8
- package/dist/commands/specs.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +17 -3
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +9 -4
- package/dist/commands/whoami.js.map +1 -1
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +37 -0
- package/dist/commands/workflow.js.map +1 -1
- package/dist/commands/workspace.d.ts +6 -0
- package/dist/commands/workspace.d.ts.map +1 -0
- package/dist/commands/workspace.js +83 -0
- package/dist/commands/workspace.js.map +1 -0
- package/dist/config-store.d.ts +73 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +314 -42
- package/dist/config-store.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +22 -0
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +41 -0
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/openrig-compat.d.ts +1 -1
- package/dist/openrig-compat.d.ts.map +1 -1
- package/dist/openrig-compat.js +6 -4
- package/dist/openrig-compat.js.map +1 -1
- package/dist/restore-packet/claude-transcript-parser.js +1 -1
- package/dist/restore-packet/claude-transcript-parser.js.map +1 -1
- package/dist/restore-packet/codex-jsonl-parser.js +1 -1
- package/dist/restore-packet/codex-jsonl-parser.js.map +1 -1
- package/package.json +2 -2
- package/ui/dist/assets/index-BDHU1JUK.js +412 -0
- package/ui/dist/assets/index-DXTyJSqu.css +1 -0
- package/ui/dist/graphics/operator-climber-monochrome.png +0 -0
- package/ui/dist/index.html +3 -2
- package/daemon/specs/agents/shared/skills/mental-model-ha/SKILL.md +0 -956
- package/ui/dist/assets/index-B09doO8H.js +0 -139
- package/ui/dist/assets/index-Dec25siz.css +0 -1
- package/ui/dist/assets/index-GNYaWmBj.js +0 -225
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
// PL-005 Phase A: Mission Control read layer.
|
|
2
|
+
//
|
|
3
|
+
// Maps the 7 Mission Control views to data sources:
|
|
4
|
+
// - my-queue → queue_items where destination_session = operator
|
|
5
|
+
// AND tier='human-gate'
|
|
6
|
+
// - human-gate → queue_items where tier='human-gate'
|
|
7
|
+
// - fleet → shell out to `rig ps --nodes --json` (graceful
|
|
8
|
+
// degradation per 4-sub-clause spec)
|
|
9
|
+
// - active-work → queue_items where state in (pending, in-progress,
|
|
10
|
+
// blocked) sorted by priority
|
|
11
|
+
// - recent-ships → queue_items where state in (done, handed-off)
|
|
12
|
+
// ORDER BY ts_updated DESC LIMIT 10
|
|
13
|
+
// - recently-active → PL-004 Phase B ViewProjector built-in view
|
|
14
|
+
// - recent-observations → stream_items table (Phase A daemon-backed source)
|
|
15
|
+
// with ~/.openrig/stream/<date>.jsonl as graceful
|
|
16
|
+
// degradation fallback
|
|
17
|
+
//
|
|
18
|
+
// Each row carries the 9-field phone-friendly content model (PRD § Acceptance
|
|
19
|
+
// Criteria item 1; non-negotiable across all 7 views regardless of UI density).
|
|
20
|
+
//
|
|
21
|
+
// Source-of-truth integration: PL-004 daemon-backed coordination services
|
|
22
|
+
// are the primary read path. Filesystem/CLI fallbacks are for graceful
|
|
23
|
+
// degradation only.
|
|
24
|
+
export const MISSION_CONTROL_VIEWS = [
|
|
25
|
+
"my-queue",
|
|
26
|
+
"human-gate",
|
|
27
|
+
"fleet",
|
|
28
|
+
"active-work",
|
|
29
|
+
"recent-ships",
|
|
30
|
+
"recently-active",
|
|
31
|
+
"recent-observations",
|
|
32
|
+
];
|
|
33
|
+
const DEFAULT_OPERATOR_SESSION = "human-operator@kernel";
|
|
34
|
+
const RECENT_SHIPS_LIMIT = 10;
|
|
35
|
+
const ACTIVE_WORK_LIMIT = 50;
|
|
36
|
+
const RECENT_OBSERVATIONS_LIMIT = 50;
|
|
37
|
+
const PRIORITY_RANK = {
|
|
38
|
+
critical: 0,
|
|
39
|
+
high: 1,
|
|
40
|
+
routine: 2,
|
|
41
|
+
background: 3,
|
|
42
|
+
};
|
|
43
|
+
export class MissionControlReadLayer {
|
|
44
|
+
queueRepo;
|
|
45
|
+
viewProjector;
|
|
46
|
+
streamStore;
|
|
47
|
+
fleetCliCapability;
|
|
48
|
+
defaultOperatorSession;
|
|
49
|
+
constructor(deps) {
|
|
50
|
+
this.queueRepo = deps.queueRepo;
|
|
51
|
+
this.viewProjector = deps.viewProjector;
|
|
52
|
+
this.streamStore = deps.streamStore;
|
|
53
|
+
this.fleetCliCapability = deps.fleetCliCapability;
|
|
54
|
+
this.defaultOperatorSession = deps.defaultOperatorSession ?? DEFAULT_OPERATOR_SESSION;
|
|
55
|
+
}
|
|
56
|
+
async readView(viewName, opts) {
|
|
57
|
+
switch (viewName) {
|
|
58
|
+
case "my-queue":
|
|
59
|
+
return this.readMyQueue(opts?.operatorSession ?? this.defaultOperatorSession);
|
|
60
|
+
case "human-gate":
|
|
61
|
+
return this.readHumanGate();
|
|
62
|
+
case "fleet":
|
|
63
|
+
return this.readFleet();
|
|
64
|
+
case "active-work":
|
|
65
|
+
return this.readActiveWork();
|
|
66
|
+
case "recent-ships":
|
|
67
|
+
return this.readRecentShips();
|
|
68
|
+
case "recently-active":
|
|
69
|
+
return this.readRecentlyActive();
|
|
70
|
+
case "recent-observations":
|
|
71
|
+
return this.readRecentObservations();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
readMyQueue(operatorSession) {
|
|
75
|
+
const items = this.queueRepo.list({
|
|
76
|
+
destinationSession: operatorSession,
|
|
77
|
+
state: ["pending", "in-progress", "blocked"],
|
|
78
|
+
limit: ACTIVE_WORK_LIMIT,
|
|
79
|
+
});
|
|
80
|
+
const humanGateOnly = items.filter((q) => q.tier === "human-gate");
|
|
81
|
+
return {
|
|
82
|
+
viewName: "my-queue",
|
|
83
|
+
rows: humanGateOnly.map((q) => qitemToRow(q, { defaultReadCost: "skim/approve" })),
|
|
84
|
+
meta: { rowCount: humanGateOnly.length },
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
readHumanGate() {
|
|
88
|
+
const items = this.queueRepo.list({
|
|
89
|
+
state: ["pending", "in-progress", "blocked"],
|
|
90
|
+
limit: ACTIVE_WORK_LIMIT,
|
|
91
|
+
});
|
|
92
|
+
const humanGateOnly = items.filter((q) => q.tier === "human-gate");
|
|
93
|
+
return {
|
|
94
|
+
viewName: "human-gate",
|
|
95
|
+
rows: humanGateOnly.map((q) => qitemToRow(q, { defaultReadCost: "skim/approve" })),
|
|
96
|
+
meta: { rowCount: humanGateOnly.length },
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async readFleet() {
|
|
100
|
+
const fleet = await this.fleetCliCapability.rollupFleet();
|
|
101
|
+
const rows = fleet.rows.map((r) => fleetRowToCompactRow(r));
|
|
102
|
+
return {
|
|
103
|
+
viewName: "fleet",
|
|
104
|
+
rows,
|
|
105
|
+
meta: {
|
|
106
|
+
rowCount: rows.length,
|
|
107
|
+
rigsRunningStaleCli: fleet.staleCliCount,
|
|
108
|
+
degradedFields: fleet.degradedFields.length > 0 ? fleet.degradedFields : undefined,
|
|
109
|
+
sourceFallback: fleet.sourceFallback ?? undefined,
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
readActiveWork() {
|
|
114
|
+
const items = this.queueRepo.list({
|
|
115
|
+
state: ["pending", "in-progress", "blocked"],
|
|
116
|
+
limit: ACTIVE_WORK_LIMIT,
|
|
117
|
+
});
|
|
118
|
+
items.sort((a, b) => {
|
|
119
|
+
const ar = PRIORITY_RANK[a.priority] ?? 99;
|
|
120
|
+
const br = PRIORITY_RANK[b.priority] ?? 99;
|
|
121
|
+
if (ar !== br)
|
|
122
|
+
return ar - br;
|
|
123
|
+
return a.tsUpdated.localeCompare(b.tsUpdated);
|
|
124
|
+
});
|
|
125
|
+
return {
|
|
126
|
+
viewName: "active-work",
|
|
127
|
+
rows: items.map((q) => qitemToRow(q, { defaultReadCost: "full" })),
|
|
128
|
+
meta: { rowCount: items.length },
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
readRecentShips() {
|
|
132
|
+
const done = this.queueRepo.list({
|
|
133
|
+
state: ["done", "handed-off"],
|
|
134
|
+
limit: RECENT_SHIPS_LIMIT * 4,
|
|
135
|
+
});
|
|
136
|
+
done.sort((a, b) => b.tsUpdated.localeCompare(a.tsUpdated));
|
|
137
|
+
const top = done.slice(0, RECENT_SHIPS_LIMIT);
|
|
138
|
+
return {
|
|
139
|
+
viewName: "recent-ships",
|
|
140
|
+
rows: top.map((q) => qitemToRow(q, { defaultReadCost: "summary-only" })),
|
|
141
|
+
meta: { rowCount: top.length },
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
readRecentlyActive() {
|
|
145
|
+
// Delegates to PL-004 Phase B's built-in `recently-active` view.
|
|
146
|
+
const result = this.viewProjector.show("recently-active");
|
|
147
|
+
const rows = result.rows.map((row) => builtinViewRowToCompactRow("recently-active", row));
|
|
148
|
+
return {
|
|
149
|
+
viewName: "recently-active",
|
|
150
|
+
rows,
|
|
151
|
+
meta: { rowCount: rows.length },
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
readRecentObservations() {
|
|
155
|
+
if (!this.streamStore) {
|
|
156
|
+
return {
|
|
157
|
+
viewName: "recent-observations",
|
|
158
|
+
rows: [],
|
|
159
|
+
meta: { rowCount: 0, sourceFallback: "stream-store-not-wired" },
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
const items = this.streamStore.list({ limit: RECENT_OBSERVATIONS_LIMIT });
|
|
163
|
+
const rows = items.map((s) => streamItemToCompactRow(s));
|
|
164
|
+
return {
|
|
165
|
+
viewName: "recent-observations",
|
|
166
|
+
rows,
|
|
167
|
+
meta: { rowCount: rows.length },
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function qitemToRow(q, opts) {
|
|
172
|
+
const state = qitemStateToCompactState(q.state);
|
|
173
|
+
const nextAction = q.state === "blocked" ? `unblock: ${q.blockedOn ?? "external-gate"}` : null;
|
|
174
|
+
const pendingHumanDecision = q.tier === "human-gate" ? `${q.priority} human-gate item` : null;
|
|
175
|
+
return {
|
|
176
|
+
rigOrMissionName: q.destinationSession,
|
|
177
|
+
currentPhase: q.tier ?? null,
|
|
178
|
+
state,
|
|
179
|
+
nextAction,
|
|
180
|
+
pendingHumanDecision,
|
|
181
|
+
readCost: opts.defaultReadCost,
|
|
182
|
+
lastUpdate: q.tsUpdated,
|
|
183
|
+
confidenceFreshness: q.priority,
|
|
184
|
+
evidenceLink: null,
|
|
185
|
+
qitemId: q.qitemId,
|
|
186
|
+
rawSourceRef: q.sourceSession,
|
|
187
|
+
qitemSummary: summarizeBody(q.body),
|
|
188
|
+
qitemBody: q.body,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function summarizeBody(body) {
|
|
192
|
+
const compact = body.replace(/\s+/g, " ").trim();
|
|
193
|
+
if (compact.length <= 120)
|
|
194
|
+
return compact;
|
|
195
|
+
return `${compact.slice(0, 117).trimEnd()}...`;
|
|
196
|
+
}
|
|
197
|
+
function qitemStateToCompactState(state) {
|
|
198
|
+
switch (state) {
|
|
199
|
+
case "in-progress":
|
|
200
|
+
return "active";
|
|
201
|
+
case "pending":
|
|
202
|
+
return "idle";
|
|
203
|
+
case "blocked":
|
|
204
|
+
return "blocked";
|
|
205
|
+
case "failed":
|
|
206
|
+
case "denied":
|
|
207
|
+
case "canceled":
|
|
208
|
+
return "degraded";
|
|
209
|
+
case "done":
|
|
210
|
+
case "handed-off":
|
|
211
|
+
return "idle";
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function fleetRowToCompactRow(r) {
|
|
215
|
+
return {
|
|
216
|
+
rigOrMissionName: r.rigName,
|
|
217
|
+
currentPhase: r.lifecycleState ?? null,
|
|
218
|
+
state: r.activityState,
|
|
219
|
+
nextAction: r.attentionReason ?? null,
|
|
220
|
+
pendingHumanDecision: null,
|
|
221
|
+
readCost: "summary-only",
|
|
222
|
+
lastUpdate: r.lastUpdate,
|
|
223
|
+
confidenceFreshness: r.cliVersionLabel,
|
|
224
|
+
evidenceLink: null,
|
|
225
|
+
qitemId: null,
|
|
226
|
+
rawSourceRef: r.rigName,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
function builtinViewRowToCompactRow(viewName, row) {
|
|
230
|
+
const get = (k) => {
|
|
231
|
+
const v = row[k];
|
|
232
|
+
if (v === undefined || v === null)
|
|
233
|
+
return null;
|
|
234
|
+
return String(v);
|
|
235
|
+
};
|
|
236
|
+
return {
|
|
237
|
+
rigOrMissionName: get("destination_session") ?? get("rig_name") ?? get("rigName") ?? viewName,
|
|
238
|
+
currentPhase: get("tier") ?? get("state") ?? null,
|
|
239
|
+
state: "idle",
|
|
240
|
+
nextAction: null,
|
|
241
|
+
pendingHumanDecision: null,
|
|
242
|
+
readCost: "summary-only",
|
|
243
|
+
lastUpdate: get("ts_updated") ?? get("ts_emitted") ?? new Date().toISOString(),
|
|
244
|
+
confidenceFreshness: get("priority") ?? null,
|
|
245
|
+
evidenceLink: null,
|
|
246
|
+
qitemId: get("qitem_id"),
|
|
247
|
+
rawSourceRef: get("source_session"),
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
function streamItemToCompactRow(s) {
|
|
251
|
+
return {
|
|
252
|
+
rigOrMissionName: s.sourceSession,
|
|
253
|
+
currentPhase: s.hintType ?? null,
|
|
254
|
+
state: s.hintUrgency === "critical" ? "attention" : "idle",
|
|
255
|
+
nextAction: s.hintDestination ?? null,
|
|
256
|
+
pendingHumanDecision: null,
|
|
257
|
+
readCost: "summary-only",
|
|
258
|
+
lastUpdate: s.tsEmitted,
|
|
259
|
+
confidenceFreshness: s.hintUrgency ?? null,
|
|
260
|
+
evidenceLink: null,
|
|
261
|
+
qitemId: null,
|
|
262
|
+
rawSourceRef: s.streamItemId,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=mission-control-read-layer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mission-control-read-layer.js","sourceRoot":"","sources":["../../../src/domain/mission-control/mission-control-read-layer.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C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Y,CAAC,IAAI,GAAG,CAAC,YAAY,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC9E,mBAAmB,EAAE,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI;QAC5C,YAAY,EAAE,IAAI;QAClB,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC;QACxB,YAAY,EAAE,GAAG,CAAC,gBAAgB,CAAC;KACpC,CAAC;AACJ,CAAC;AAED,SAAS,sBAAsB,CAAC,CAAa;IAC3C,OAAO;QACL,gBAAgB,EAAE,CAAC,CAAC,aAAa;QACjC,YAAY,EAAE,CAAC,CAAC,QAAQ,IAAI,IAAI;QAChC,KAAK,EAAE,CAAC,CAAC,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM;QAC1D,UAAU,EAAE,CAAC,CAAC,eAAe,IAAI,IAAI;QACrC,oBAAoB,EAAE,IAAI;QAC1B,QAAQ,EAAE,cAAc;QACxB,UAAU,EAAE,CAAC,CAAC,SAAS;QACvB,mBAAmB,EAAE,CAAC,CAAC,WAAW,IAAI,IAAI;QAC1C,YAAY,EAAE,IAAI;QAClB,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,CAAC,CAAC,YAAY;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type Database from "better-sqlite3";
|
|
2
|
+
import type { EventBus } from "../event-bus.js";
|
|
3
|
+
import type { QueueRepository, QueueItem } from "../queue-repository.js";
|
|
4
|
+
import { MissionControlActionLog, type MissionControlVerb } from "./mission-control-action-log.js";
|
|
5
|
+
export declare class MissionControlWriteContractError extends Error {
|
|
6
|
+
readonly code: string;
|
|
7
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
8
|
+
constructor(code: string, message: string, details?: Record<string, unknown> | undefined);
|
|
9
|
+
}
|
|
10
|
+
export interface MissionControlActionInput {
|
|
11
|
+
verb: MissionControlVerb;
|
|
12
|
+
qitemId: string;
|
|
13
|
+
actorSession: string;
|
|
14
|
+
/** Required for `route` and `handoff`. */
|
|
15
|
+
destinationSession?: string;
|
|
16
|
+
/** Body for the new packet on `route`/`handoff`; defaults to source body. */
|
|
17
|
+
body?: string;
|
|
18
|
+
/** Required for `annotate`. */
|
|
19
|
+
annotation?: string;
|
|
20
|
+
/** Required for `hold` and `drop`; optional advisory text otherwise. */
|
|
21
|
+
reason?: string;
|
|
22
|
+
/** Operator-supplied audit context. */
|
|
23
|
+
auditNotes?: Record<string, unknown>;
|
|
24
|
+
/**
|
|
25
|
+
* For handoff: opt-in best-effort wake. Default true (PL-004 Phase A R1
|
|
26
|
+
* pattern: durable + waking by default; operators opt out for cold queues).
|
|
27
|
+
* notify failure does NOT roll back durable state.
|
|
28
|
+
*/
|
|
29
|
+
notify?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface MissionControlActionResult {
|
|
32
|
+
actionId: string;
|
|
33
|
+
verb: MissionControlVerb;
|
|
34
|
+
qitemId: string;
|
|
35
|
+
closedQitem: QueueItem | null;
|
|
36
|
+
createdQitemId: string | null;
|
|
37
|
+
notifyAttempted: boolean;
|
|
38
|
+
notifyResult: string | null;
|
|
39
|
+
auditedAt: string;
|
|
40
|
+
}
|
|
41
|
+
interface WriteContractDeps {
|
|
42
|
+
db: Database.Database;
|
|
43
|
+
eventBus: EventBus;
|
|
44
|
+
queueRepo: QueueRepository;
|
|
45
|
+
actionLog: MissionControlActionLog;
|
|
46
|
+
now?: () => Date;
|
|
47
|
+
}
|
|
48
|
+
export declare class MissionControlWriteContract {
|
|
49
|
+
private readonly db;
|
|
50
|
+
private readonly eventBus;
|
|
51
|
+
private readonly queueRepo;
|
|
52
|
+
private readonly actionLog;
|
|
53
|
+
private readonly now;
|
|
54
|
+
constructor(deps: WriteContractDeps);
|
|
55
|
+
/**
|
|
56
|
+
* Execute one verb. Atomic at the durable layer: queue mutation +
|
|
57
|
+
* audit record + event persistence in one transaction. Post-commit:
|
|
58
|
+
* notify subscribers + opt-in transport wake (handoff only).
|
|
59
|
+
*/
|
|
60
|
+
act(input: MissionControlActionInput): Promise<MissionControlActionResult>;
|
|
61
|
+
/**
|
|
62
|
+
* Annotate has no queue mutation — only an audit record + event.
|
|
63
|
+
* Still wrapped in a transaction so the audit + event are atomic.
|
|
64
|
+
*/
|
|
65
|
+
private annotateOnly;
|
|
66
|
+
private requireMutableQitem;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=mission-control-write-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mission-control-write-contract.d.ts","sourceRoot":"","sources":["../../../src/domain/mission-control/mission-control-write-contract.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEzE,OAAO,EACL,uBAAuB,EAEvB,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAC;AAEzC,qBAAa,gCAAiC,SAAQ,KAAK;aAEvC,IAAI,EAAE,MAAM;aAEZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAFjC,IAAI,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM,EACC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA;CAKpD;AAED,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wEAAwE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D-BEARING. Per PRD § Acceptance Criteria + slice IMPL § Guard
|
|
4
|
+
// Checkpoint Focus item 2: each of 7 verbs is one atomic transaction.
|
|
5
|
+
// The 4-step `handoff` shape (source-update + destination-create +
|
|
6
|
+
// opt-in best-effort notify + audit-record append) is the canonical
|
|
7
|
+
// proof case; other 6 verbs follow the same atomic-update + audit
|
|
8
|
+
// shape with verb-specific metadata.
|
|
9
|
+
//
|
|
10
|
+
// Composition (one db.transaction per verb call):
|
|
11
|
+
// 1. Verify the target qitem exists and isn't already terminal.
|
|
12
|
+
// 2. Compute the verb-specific queue mutation via Phase D's
|
|
13
|
+
// QueueRepository.updateWithinTransaction (preserves Phase A
|
|
14
|
+
// hot-potato closure validation; emits queue.updated event).
|
|
15
|
+
// 3. For handoff: also call QueueRepository.createWithinTransaction
|
|
16
|
+
// to make the destination packet (the same outer txn).
|
|
17
|
+
// 4. Append the mission_control_actions audit record with before +
|
|
18
|
+
// after state snapshots.
|
|
19
|
+
// 5. Persist the mission_control.action_executed event.
|
|
20
|
+
//
|
|
21
|
+
// Post-commit (outside the transaction): notifySubscribers + opt-in
|
|
22
|
+
// best-effort transport notify. Notify failure does NOT roll back
|
|
23
|
+
// durable mutations (PRD invariant: "notify failure does NOT roll
|
|
24
|
+
// back durable mutations").
|
|
25
|
+
//
|
|
26
|
+
// Verb mappings:
|
|
27
|
+
// approve → state="done", closure_reason="no-follow-on"
|
|
28
|
+
// deny → state="done", closure_reason="denied"
|
|
29
|
+
// route → state="done", closure_reason="handed_off_to",
|
|
30
|
+
// closure_target+handed_off_to=<route target>;
|
|
31
|
+
// creates new qitem at the route target (1-hop)
|
|
32
|
+
// annotate → no queue mutation; audit record only (annotation field
|
|
33
|
+
// attached to mission_control_actions)
|
|
34
|
+
// hold → state="blocked", closure_reason="blocked_on",
|
|
35
|
+
// closure_target+blocked_on=<reason text>
|
|
36
|
+
// drop → state="done", closure_reason="canceled",
|
|
37
|
+
// closure_target=<reason>
|
|
38
|
+
// handoff → state="handed-off", closure_reason="handed_off_to",
|
|
39
|
+
// closure_target+handed_off_to=<destination>;
|
|
40
|
+
// creates new qitem at destination (4-step canonical)
|
|
41
|
+
import { MissionControlActionLogError, } from "./mission-control-action-log.js";
|
|
42
|
+
export class MissionControlWriteContractError extends Error {
|
|
43
|
+
code;
|
|
44
|
+
details;
|
|
45
|
+
constructor(code, message, details) {
|
|
46
|
+
super(message);
|
|
47
|
+
this.code = code;
|
|
48
|
+
this.details = details;
|
|
49
|
+
this.name = "MissionControlWriteContractError";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export class MissionControlWriteContract {
|
|
53
|
+
db;
|
|
54
|
+
eventBus;
|
|
55
|
+
queueRepo;
|
|
56
|
+
actionLog;
|
|
57
|
+
now;
|
|
58
|
+
constructor(deps) {
|
|
59
|
+
this.db = deps.db;
|
|
60
|
+
this.eventBus = deps.eventBus;
|
|
61
|
+
this.queueRepo = deps.queueRepo;
|
|
62
|
+
this.actionLog = deps.actionLog;
|
|
63
|
+
this.now = deps.now ?? (() => new Date());
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Execute one verb. Atomic at the durable layer: queue mutation +
|
|
67
|
+
* audit record + event persistence in one transaction. Post-commit:
|
|
68
|
+
* notify subscribers + opt-in transport wake (handoff only).
|
|
69
|
+
*/
|
|
70
|
+
async act(input) {
|
|
71
|
+
if (input.verb === "annotate") {
|
|
72
|
+
return this.annotateOnly(input);
|
|
73
|
+
}
|
|
74
|
+
const source = this.requireMutableQitem(input.qitemId);
|
|
75
|
+
if ((input.verb === "route" || input.verb === "handoff") && !input.destinationSession) {
|
|
76
|
+
throw new MissionControlWriteContractError("destination_required", `verb=${input.verb} requires destinationSession`, { verb: input.verb });
|
|
77
|
+
}
|
|
78
|
+
const evaluatedAt = this.now().toISOString();
|
|
79
|
+
const closure = verbToClosure(input);
|
|
80
|
+
const beforeSnapshot = snapshotQitem(source);
|
|
81
|
+
let createdQitemId = null;
|
|
82
|
+
let createdDestination;
|
|
83
|
+
let createdNudge;
|
|
84
|
+
let actionEntry = null;
|
|
85
|
+
const persistedEvents = [];
|
|
86
|
+
const txn = this.db.transaction(() => {
|
|
87
|
+
// 1. Close/transition the source via Phase A's queue closure primitive.
|
|
88
|
+
const closeResult = this.queueRepo.updateWithinTransaction({
|
|
89
|
+
qitemId: input.qitemId,
|
|
90
|
+
actorSession: input.actorSession,
|
|
91
|
+
state: closure.state,
|
|
92
|
+
closureReason: closure.closureReason,
|
|
93
|
+
closureTarget: closure.closureTarget ?? undefined,
|
|
94
|
+
handedOffTo: closure.handedOffTo,
|
|
95
|
+
blockedOn: closure.blockedOn,
|
|
96
|
+
transitionNote: `mission-control:${input.verb}${input.reason ? ` (${input.reason})` : ""}`,
|
|
97
|
+
});
|
|
98
|
+
persistedEvents.push(closeResult.persistedEvent);
|
|
99
|
+
// 2. For route/handoff: create the destination packet in same txn.
|
|
100
|
+
if ((input.verb === "route" || input.verb === "handoff") && input.destinationSession) {
|
|
101
|
+
const created = this.queueRepo.createWithinTransaction({
|
|
102
|
+
sourceSession: input.actorSession,
|
|
103
|
+
destinationSession: input.destinationSession,
|
|
104
|
+
body: input.body ?? source.body,
|
|
105
|
+
priority: source.priority,
|
|
106
|
+
tier: source.tier ?? undefined,
|
|
107
|
+
tags: source.tags
|
|
108
|
+
? [...source.tags, `mission-control:${input.verb}`]
|
|
109
|
+
: [`mission-control:${input.verb}`],
|
|
110
|
+
chainOfRecord: [...(source.chainOfRecord ?? []), input.qitemId],
|
|
111
|
+
// Default nudge handled post-commit per Phase D pattern.
|
|
112
|
+
nudge: input.notify,
|
|
113
|
+
});
|
|
114
|
+
createdQitemId = created.qitemId;
|
|
115
|
+
createdDestination = created.destinationSession;
|
|
116
|
+
createdNudge = created.nudge;
|
|
117
|
+
persistedEvents.push(created.persistedEvent);
|
|
118
|
+
}
|
|
119
|
+
// 3. Append the audit record. Snapshot the closed qitem state.
|
|
120
|
+
const closedQitem = this.queueRepo.getById(input.qitemId);
|
|
121
|
+
const afterSnapshot = closedQitem ? snapshotQitem(closedQitem) : null;
|
|
122
|
+
actionEntry = this.actionLog.record({
|
|
123
|
+
actionVerb: input.verb,
|
|
124
|
+
qitemId: input.qitemId,
|
|
125
|
+
actorSession: input.actorSession,
|
|
126
|
+
actedAt: evaluatedAt,
|
|
127
|
+
beforeState: beforeSnapshot,
|
|
128
|
+
afterState: afterSnapshot,
|
|
129
|
+
reason: input.reason ?? null,
|
|
130
|
+
annotation: input.annotation ?? null,
|
|
131
|
+
notifyAttempted: false,
|
|
132
|
+
notifyResult: null,
|
|
133
|
+
auditNotes: input.auditNotes ?? null,
|
|
134
|
+
});
|
|
135
|
+
// 4. Persist the mission_control.action_executed event in same txn.
|
|
136
|
+
persistedEvents.push(this.eventBus.persistWithinTransaction({
|
|
137
|
+
type: "mission_control.action_executed",
|
|
138
|
+
actionId: actionEntry.actionId,
|
|
139
|
+
actionVerb: input.verb,
|
|
140
|
+
qitemId: input.qitemId,
|
|
141
|
+
actorSession: input.actorSession,
|
|
142
|
+
}));
|
|
143
|
+
});
|
|
144
|
+
try {
|
|
145
|
+
txn();
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
if (err instanceof MissionControlActionLogError) {
|
|
149
|
+
throw new MissionControlWriteContractError(err.code, err.message, err.details);
|
|
150
|
+
}
|
|
151
|
+
throw err;
|
|
152
|
+
}
|
|
153
|
+
// Post-commit: fan out events.
|
|
154
|
+
for (const e of persistedEvents)
|
|
155
|
+
this.eventBus.notifySubscribers(e);
|
|
156
|
+
// Post-commit best-effort notify on handoff/route. Default true per
|
|
157
|
+
// PL-004 R1 pattern; failure does NOT roll back durable mutations.
|
|
158
|
+
let notifyAttempted = false;
|
|
159
|
+
let notifyResult = null;
|
|
160
|
+
if (createdQitemId && createdDestination && (input.verb === "route" || input.verb === "handoff")) {
|
|
161
|
+
try {
|
|
162
|
+
await this.queueRepo.maybeNudge(createdQitemId, createdDestination, createdNudge);
|
|
163
|
+
notifyAttempted = createdNudge !== false;
|
|
164
|
+
notifyResult = notifyAttempted ? "attempted-best-effort" : "skipped";
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
notifyAttempted = true;
|
|
168
|
+
notifyResult = `failed:${err instanceof Error ? err.message : String(err)}`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
actionId: actionEntry.actionId,
|
|
173
|
+
verb: input.verb,
|
|
174
|
+
qitemId: input.qitemId,
|
|
175
|
+
closedQitem: this.queueRepo.getById(input.qitemId),
|
|
176
|
+
createdQitemId,
|
|
177
|
+
notifyAttempted,
|
|
178
|
+
notifyResult,
|
|
179
|
+
auditedAt: evaluatedAt,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Annotate has no queue mutation — only an audit record + event.
|
|
184
|
+
* Still wrapped in a transaction so the audit + event are atomic.
|
|
185
|
+
*/
|
|
186
|
+
async annotateOnly(input) {
|
|
187
|
+
if (!input.annotation) {
|
|
188
|
+
throw new MissionControlWriteContractError("annotation_required", `verb=annotate requires annotation`, { verb: input.verb });
|
|
189
|
+
}
|
|
190
|
+
const source = this.requireMutableQitem(input.qitemId);
|
|
191
|
+
const snapshot = snapshotQitem(source);
|
|
192
|
+
const evaluatedAt = this.now().toISOString();
|
|
193
|
+
let actionEntry = null;
|
|
194
|
+
const persistedEvents = [];
|
|
195
|
+
const txn = this.db.transaction(() => {
|
|
196
|
+
actionEntry = this.actionLog.record({
|
|
197
|
+
actionVerb: "annotate",
|
|
198
|
+
qitemId: input.qitemId,
|
|
199
|
+
actorSession: input.actorSession,
|
|
200
|
+
actedAt: evaluatedAt,
|
|
201
|
+
beforeState: snapshot,
|
|
202
|
+
afterState: snapshot,
|
|
203
|
+
annotation: input.annotation,
|
|
204
|
+
auditNotes: input.auditNotes ?? null,
|
|
205
|
+
});
|
|
206
|
+
persistedEvents.push(this.eventBus.persistWithinTransaction({
|
|
207
|
+
type: "mission_control.action_executed",
|
|
208
|
+
actionId: actionEntry.actionId,
|
|
209
|
+
actionVerb: "annotate",
|
|
210
|
+
qitemId: input.qitemId,
|
|
211
|
+
actorSession: input.actorSession,
|
|
212
|
+
}));
|
|
213
|
+
});
|
|
214
|
+
txn();
|
|
215
|
+
for (const e of persistedEvents)
|
|
216
|
+
this.eventBus.notifySubscribers(e);
|
|
217
|
+
return {
|
|
218
|
+
actionId: actionEntry.actionId,
|
|
219
|
+
verb: "annotate",
|
|
220
|
+
qitemId: input.qitemId,
|
|
221
|
+
closedQitem: this.queueRepo.getById(input.qitemId),
|
|
222
|
+
createdQitemId: null,
|
|
223
|
+
notifyAttempted: false,
|
|
224
|
+
notifyResult: null,
|
|
225
|
+
auditedAt: evaluatedAt,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
requireMutableQitem(qitemId) {
|
|
229
|
+
const source = this.queueRepo.getById(qitemId);
|
|
230
|
+
if (!source) {
|
|
231
|
+
throw new MissionControlWriteContractError("qitem_not_found", `qitem ${qitemId} not found`, { qitemId });
|
|
232
|
+
}
|
|
233
|
+
if (source.state === "done" || source.state === "handed-off") {
|
|
234
|
+
throw new MissionControlWriteContractError("qitem_already_terminal", `qitem ${qitemId} is already terminal (state=${source.state}); Mission Control cannot mutate terminal items`, { qitemId, state: source.state });
|
|
235
|
+
}
|
|
236
|
+
return source;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function verbToClosure(input) {
|
|
240
|
+
switch (input.verb) {
|
|
241
|
+
case "approve":
|
|
242
|
+
return {
|
|
243
|
+
state: "done",
|
|
244
|
+
closureReason: "no-follow-on",
|
|
245
|
+
closureTarget: input.reason ?? null,
|
|
246
|
+
};
|
|
247
|
+
case "deny":
|
|
248
|
+
return {
|
|
249
|
+
state: "done",
|
|
250
|
+
closureReason: "denied",
|
|
251
|
+
closureTarget: input.reason ?? "operator denied",
|
|
252
|
+
};
|
|
253
|
+
case "route":
|
|
254
|
+
return {
|
|
255
|
+
state: "handed-off",
|
|
256
|
+
closureReason: "handed_off_to",
|
|
257
|
+
closureTarget: input.destinationSession,
|
|
258
|
+
handedOffTo: input.destinationSession,
|
|
259
|
+
};
|
|
260
|
+
case "hold":
|
|
261
|
+
return {
|
|
262
|
+
state: "blocked",
|
|
263
|
+
closureReason: "blocked_on",
|
|
264
|
+
closureTarget: input.reason,
|
|
265
|
+
blockedOn: input.reason,
|
|
266
|
+
};
|
|
267
|
+
case "drop":
|
|
268
|
+
return {
|
|
269
|
+
state: "done",
|
|
270
|
+
closureReason: "canceled",
|
|
271
|
+
closureTarget: input.reason,
|
|
272
|
+
};
|
|
273
|
+
case "handoff":
|
|
274
|
+
return {
|
|
275
|
+
state: "handed-off",
|
|
276
|
+
closureReason: "handed_off_to",
|
|
277
|
+
closureTarget: input.destinationSession,
|
|
278
|
+
handedOffTo: input.destinationSession,
|
|
279
|
+
};
|
|
280
|
+
case "annotate":
|
|
281
|
+
// Should never reach here — annotate is handled by annotateOnly().
|
|
282
|
+
throw new MissionControlWriteContractError("internal_invariant", "annotate verb should have been routed to annotateOnly");
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
function snapshotQitem(q) {
|
|
286
|
+
return {
|
|
287
|
+
qitemId: q.qitemId,
|
|
288
|
+
state: q.state,
|
|
289
|
+
sourceSession: q.sourceSession,
|
|
290
|
+
destinationSession: q.destinationSession,
|
|
291
|
+
priority: q.priority,
|
|
292
|
+
tier: q.tier,
|
|
293
|
+
closureReason: q.closureReason,
|
|
294
|
+
closureTarget: q.closureTarget,
|
|
295
|
+
handedOffTo: q.handedOffTo,
|
|
296
|
+
blockedOn: q.blockedOn,
|
|
297
|
+
tsUpdated: q.tsUpdated,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=mission-control-write-contract.js.map
|