@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,86 @@
|
|
|
1
|
+
// PL-007 Workspace Primitive v0 — runtime resolution of typed workspace
|
|
2
|
+
// context for whoami / node-inventory consumers.
|
|
3
|
+
//
|
|
4
|
+
// Given a persisted RigSpec.workspace block + a node's cwd + an optional
|
|
5
|
+
// per-session env override, derive:
|
|
6
|
+
// - workspaceRoot — verbatim from the spec
|
|
7
|
+
// - activeRepo — env override, else default_repo, else null
|
|
8
|
+
// - repos — typed list (name, path, kind)
|
|
9
|
+
// - knowledgeRoot, knowledgeKind — verbatim when declared
|
|
10
|
+
//
|
|
11
|
+
// Per-node kind resolution (used by node-inventory) walks the cwd up the
|
|
12
|
+
// directory tree looking for the longest containing repo path; falls back
|
|
13
|
+
// to "knowledge" when cwd is under knowledgeRoot, else null.
|
|
14
|
+
import * as path from "node:path";
|
|
15
|
+
export function resolveWorkspaceContext(opts) {
|
|
16
|
+
const { spec, envOverride } = opts;
|
|
17
|
+
if (!spec)
|
|
18
|
+
return null;
|
|
19
|
+
// env override wins when it names a declared repo; otherwise fall through
|
|
20
|
+
// to default_repo. Unknown override is honored verbatim per PL-007 PRD §
|
|
21
|
+
// Item 3 — operators set OPENRIG_TARGET_REPO consciously.
|
|
22
|
+
const repoNames = new Set(spec.repos.map((r) => r.name));
|
|
23
|
+
let activeRepo = null;
|
|
24
|
+
if (envOverride && envOverride.trim() !== "") {
|
|
25
|
+
activeRepo = envOverride;
|
|
26
|
+
}
|
|
27
|
+
else if (spec.defaultRepo && repoNames.has(spec.defaultRepo)) {
|
|
28
|
+
activeRepo = spec.defaultRepo;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
workspaceRoot: spec.workspaceRoot,
|
|
32
|
+
activeRepo,
|
|
33
|
+
repos: spec.repos.map((r) => ({ name: r.name, path: r.path, kind: r.kind })),
|
|
34
|
+
knowledgeRoot: spec.knowledgeRoot ?? null,
|
|
35
|
+
knowledgeKind: spec.knowledgeRoot ? "knowledge" : null,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** PL-007 — per-node workspace summary derived from a node's cwd against
|
|
39
|
+
* the rig's WorkspaceSpec. Used by NodeInventory. Returns null when the
|
|
40
|
+
* rig has no workspace declaration. */
|
|
41
|
+
export function resolveNodeWorkspace(opts) {
|
|
42
|
+
const { spec, cwd } = opts;
|
|
43
|
+
if (!spec)
|
|
44
|
+
return null;
|
|
45
|
+
let activeRepo = null;
|
|
46
|
+
let kind = null;
|
|
47
|
+
if (cwd) {
|
|
48
|
+
// Find the longest-prefix repo whose path contains cwd.
|
|
49
|
+
let best = null;
|
|
50
|
+
for (const r of spec.repos) {
|
|
51
|
+
if (isInside(cwd, r.path) && r.path.length > (best?.len ?? -1)) {
|
|
52
|
+
best = { name: r.name, kind: r.kind, len: r.path.length };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (best) {
|
|
56
|
+
activeRepo = best.name;
|
|
57
|
+
kind = best.kind;
|
|
58
|
+
}
|
|
59
|
+
else if (spec.knowledgeRoot && isInside(cwd, spec.knowledgeRoot)) {
|
|
60
|
+
kind = "knowledge";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Fall back to the rig's default_repo when cwd doesn't resolve.
|
|
64
|
+
if (!activeRepo && spec.defaultRepo) {
|
|
65
|
+
activeRepo = spec.defaultRepo;
|
|
66
|
+
if (!kind) {
|
|
67
|
+
const r = spec.repos.find((x) => x.name === spec.defaultRepo);
|
|
68
|
+
if (r)
|
|
69
|
+
kind = r.kind;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
workspaceRoot: spec.workspaceRoot,
|
|
74
|
+
activeRepo,
|
|
75
|
+
kind,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function isInside(child, parent) {
|
|
79
|
+
const normChild = path.resolve(child);
|
|
80
|
+
const normParent = path.resolve(parent);
|
|
81
|
+
if (normChild === normParent)
|
|
82
|
+
return true;
|
|
83
|
+
const rel = path.relative(normParent, normChild);
|
|
84
|
+
return rel !== "" && !rel.startsWith("..") && !path.isAbsolute(rel);
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=workspace-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-resolver.js","sourceRoot":"","sources":["../../../src/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,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC;YAC9D,IAAI,CAAC;gBAAE,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO;QACL,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,UAAU;QACV,IAAI;KACL,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa,EAAE,MAAc;IAC7C,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,SAAS,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACjD,OAAO,GAAG,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,wBAAsB,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,mDA0C9C"}
|
package/daemon/dist/index.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { serve } from "@hono/node-server";
|
|
2
2
|
import { readOpenRigEnv } from "./openrig-compat.js";
|
|
3
3
|
import { createDaemon } from "./startup.js";
|
|
4
|
+
import { assertBindAuthInvariant } from "./middleware/auth-bearer-token.js";
|
|
4
5
|
export async function startServer(port) {
|
|
5
6
|
const p = port ?? parseInt(readOpenRigEnv("OPENRIG_PORT", "RIGGED_PORT") ?? "7433", 10);
|
|
6
7
|
const dbPath = readOpenRigEnv("OPENRIG_DB", "RIGGED_DB") ?? "openrig.sqlite";
|
|
7
|
-
const { app, contextMonitor, deps } = await createDaemon({ dbPath });
|
|
8
8
|
const h = readOpenRigEnv("OPENRIG_HOST", "RIGGED_HOST") ?? "127.0.0.1";
|
|
9
|
+
// PL-005 Phase B: bearer token for Mission Control write verbs.
|
|
10
|
+
// No legacy alias (this env var is new in Phase B).
|
|
11
|
+
const bearerToken = process.env.OPENRIG_AUTH_BEARER_TOKEN ?? null;
|
|
12
|
+
// PL-005 Phase B HARD-GATE (audit row 8): refuse non-loopback bind
|
|
13
|
+
// when no bearer token is configured. Prevents shipping a tailnet-
|
|
14
|
+
// bound daemon with no auth on Mission Control write verbs.
|
|
15
|
+
// Throws AuthBearerTokenStartupError before any DB or HTTP work.
|
|
16
|
+
assertBindAuthInvariant({ host: h, bearerToken });
|
|
17
|
+
const { app, contextMonitor, deps } = await createDaemon({ dbPath, bearerToken });
|
|
9
18
|
const server = serve({ fetch: app.fetch, port: p, hostname: h }, (info) => {
|
|
10
19
|
console.log(`OpenRig daemon listening on http://localhost:${info.port}`);
|
|
11
20
|
// Start context monitor polling only after successful server bind
|
package/daemon/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CA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AAC,CAAC,CAAC;IAEH,oEAAoE;IACpE,qEAAqE;IACrE,MAAM,QAAQ,GAAG,KAAK,EAAE,GAAW,EAAE,EAAE;QACrC,OAAO,CAAC,GAAG,CAAC,2BAA2B,GAAG,iBAAiB,CAAC,CAAC;QAC7D,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC;QACvC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;IACtD,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;IAExD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,4EAA4E;AAC5E,MAAM,WAAW,GACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACf,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AAElD,IAAI,WAAW,EAAE,CAAC;IAChB,WAAW,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { MiddlewareHandler } from "hono";
|
|
2
|
+
/**
|
|
3
|
+
* Constant-time string equality using Node's timingSafeEqual.
|
|
4
|
+
* Returns false when lengths differ (timingSafeEqual throws on
|
|
5
|
+
* length mismatch; we pad-compare to keep a constant-ish branch
|
|
6
|
+
* profile while still returning the honest false).
|
|
7
|
+
*/
|
|
8
|
+
export declare function constantTimeEqual(a: string, b: string): boolean;
|
|
9
|
+
export interface AuthBearerTokenOpts {
|
|
10
|
+
/**
|
|
11
|
+
* The expected bearer token. When this is null, the middleware
|
|
12
|
+
* lets all requests through (the daemon-level startup check
|
|
13
|
+
* elsewhere ensures this only happens when bound on loopback).
|
|
14
|
+
*/
|
|
15
|
+
expectedToken: string | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Hono middleware that enforces bearer-token auth on the routes it
|
|
19
|
+
* is mounted on. Returns 401 with a three-part error body for missing
|
|
20
|
+
* or mismatched tokens.
|
|
21
|
+
*
|
|
22
|
+
* When `expectedToken` is null, the middleware passes through. The
|
|
23
|
+
* startup check in `startup.ts` ensures null is only valid when the
|
|
24
|
+
* bind interface is loopback.
|
|
25
|
+
*/
|
|
26
|
+
export declare function authBearerTokenMiddleware(opts: AuthBearerTokenOpts): MiddlewareHandler;
|
|
27
|
+
/**
|
|
28
|
+
* Detect whether a host bind value is loopback-only (safe to skip
|
|
29
|
+
* bearer requirement) vs non-loopback (tailnet / public; requires
|
|
30
|
+
* bearer). Loopback set: `127.x.x.x`, `::1`, `localhost`. Anything
|
|
31
|
+
* else (including `0.0.0.0`, `::`, named hostnames, tailnet IPs) is
|
|
32
|
+
* treated as non-loopback.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isLoopbackBind(host: string | undefined | null): boolean;
|
|
35
|
+
export declare class AuthBearerTokenStartupError extends Error {
|
|
36
|
+
constructor(message: string);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Startup-side check (HARD-GATE audit row 8). Throws an explicit
|
|
40
|
+
* AuthBearerTokenStartupError when the bind interface is non-loopback
|
|
41
|
+
* AND the bearer token is empty. Called from index.ts BEFORE
|
|
42
|
+
* `serve()` listens, so the daemon refuses to start in the unsafe
|
|
43
|
+
* configuration.
|
|
44
|
+
*/
|
|
45
|
+
export declare function assertBindAuthInvariant(opts: {
|
|
46
|
+
host: string;
|
|
47
|
+
bearerToken: string | null;
|
|
48
|
+
}): void;
|
|
49
|
+
//# sourceMappingURL=auth-bearer-token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-bearer-token.d.ts","sourceRoot":"","sources":["../../src/middleware/auth-bearer-token.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAC;AAE9C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAe/D;AAwBD,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,mBAAmB,GACxB,iBAAiB,CAyBnB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAWvE;AAED,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,GAAG,IAAI,CAQP"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// PL-005 Phase B: bearer-token middleware for /api/mission-control/*.
|
|
2
|
+
//
|
|
3
|
+
// Per slice IMPL § Write Set + audit hard-gates 8 + 9:
|
|
4
|
+
// - Constant-time bearer comparison via Node `crypto.timingSafeEqual`.
|
|
5
|
+
// No early-return on byte mismatch.
|
|
6
|
+
// - 401 with three-part error body on missing or mismatched token
|
|
7
|
+
// (what failed + why it matters + what to do).
|
|
8
|
+
// - Daemon refuses to start with a non-loopback bind interface AND
|
|
9
|
+
// empty bearer config — startup-side check (see startup.ts).
|
|
10
|
+
//
|
|
11
|
+
// MVP context (single-developer, single-user, single-host): one static
|
|
12
|
+
// bearer token sourced from a config field. NO OAuth / SSO / per-user
|
|
13
|
+
// routing / role-based permissions / token rotation. Token holder is
|
|
14
|
+
// fully privileged.
|
|
15
|
+
//
|
|
16
|
+
// Mounted on /api/mission-control/* write verbs at minimum (POST
|
|
17
|
+
// /action, POST /notifications/test). Reads (GET /views, /audit, etc.)
|
|
18
|
+
// MAY be gated under the same token at operator option (Phase B
|
|
19
|
+
// driver default: gate writes only; reads remain open behind tailnet
|
|
20
|
+
// bind for the headed-browser-from-phone case where the operator
|
|
21
|
+
// hasn't typed the token into mobile yet — the bearer is for write
|
|
22
|
+
// integrity, not view confidentiality).
|
|
23
|
+
import { Buffer } from "node:buffer";
|
|
24
|
+
import { timingSafeEqual } from "node:crypto";
|
|
25
|
+
/**
|
|
26
|
+
* Constant-time string equality using Node's timingSafeEqual.
|
|
27
|
+
* Returns false when lengths differ (timingSafeEqual throws on
|
|
28
|
+
* length mismatch; we pad-compare to keep a constant-ish branch
|
|
29
|
+
* profile while still returning the honest false).
|
|
30
|
+
*/
|
|
31
|
+
export function constantTimeEqual(a, b) {
|
|
32
|
+
// Length check is unavoidable for timingSafeEqual to work, but the
|
|
33
|
+
// compare is still constant-time within the equal-length case. For
|
|
34
|
+
// unequal lengths we still run a fixed-size compare against a buffer
|
|
35
|
+
// of zeros so an attacker cannot infer "wrong length vs wrong byte"
|
|
36
|
+
// from response timing.
|
|
37
|
+
const aBuf = Buffer.from(a, "utf8");
|
|
38
|
+
const bBuf = Buffer.from(b, "utf8");
|
|
39
|
+
if (aBuf.length !== bBuf.length) {
|
|
40
|
+
// Compare against a same-length zero buffer to keep the call site
|
|
41
|
+
// cost similar across mismatch paths. Result is always false here.
|
|
42
|
+
timingSafeEqual(aBuf, Buffer.alloc(aBuf.length));
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return timingSafeEqual(aBuf, bBuf);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Three-part error body shape per OpenRig honest-error-reporting
|
|
49
|
+
* convention. Renders inside the route's c.json call.
|
|
50
|
+
*/
|
|
51
|
+
function unauthorizedBody(reason) {
|
|
52
|
+
return {
|
|
53
|
+
error: "unauthorized",
|
|
54
|
+
message: `Mission Control auth failed: ${reason}`,
|
|
55
|
+
what_failed: reason,
|
|
56
|
+
why_it_matters: "Mission Control write verbs require a bearer token because the daemon may be bound on a non-loopback interface (tailnet) where unauthenticated mutation would be unsafe.",
|
|
57
|
+
what_to_do: "Set the auth.bearerToken field in daemon config (or OPENRIG_AUTH_BEARER_TOKEN env), restart the daemon, and resend the request with `Authorization: Bearer <token>`.",
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Hono middleware that enforces bearer-token auth on the routes it
|
|
62
|
+
* is mounted on. Returns 401 with a three-part error body for missing
|
|
63
|
+
* or mismatched tokens.
|
|
64
|
+
*
|
|
65
|
+
* When `expectedToken` is null, the middleware passes through. The
|
|
66
|
+
* startup check in `startup.ts` ensures null is only valid when the
|
|
67
|
+
* bind interface is loopback.
|
|
68
|
+
*/
|
|
69
|
+
export function authBearerTokenMiddleware(opts) {
|
|
70
|
+
const { expectedToken } = opts;
|
|
71
|
+
return async (c, next) => {
|
|
72
|
+
if (expectedToken === null) {
|
|
73
|
+
// Loopback-only mode (no bearer configured). Pass through.
|
|
74
|
+
await next();
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const header = c.req.header("Authorization") ?? c.req.header("authorization");
|
|
78
|
+
if (!header) {
|
|
79
|
+
return c.json(unauthorizedBody("missing Authorization header"), 401);
|
|
80
|
+
}
|
|
81
|
+
const match = /^Bearer\s+(.+)$/i.exec(header);
|
|
82
|
+
if (!match) {
|
|
83
|
+
return c.json(unauthorizedBody("Authorization header must be 'Bearer <token>'"), 401);
|
|
84
|
+
}
|
|
85
|
+
const provided = match[1].trim();
|
|
86
|
+
if (!constantTimeEqual(provided, expectedToken)) {
|
|
87
|
+
return c.json(unauthorizedBody("bearer token does not match"), 401);
|
|
88
|
+
}
|
|
89
|
+
await next();
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Detect whether a host bind value is loopback-only (safe to skip
|
|
94
|
+
* bearer requirement) vs non-loopback (tailnet / public; requires
|
|
95
|
+
* bearer). Loopback set: `127.x.x.x`, `::1`, `localhost`. Anything
|
|
96
|
+
* else (including `0.0.0.0`, `::`, named hostnames, tailnet IPs) is
|
|
97
|
+
* treated as non-loopback.
|
|
98
|
+
*/
|
|
99
|
+
export function isLoopbackBind(host) {
|
|
100
|
+
if (!host || host.length === 0) {
|
|
101
|
+
// Default Hono / @hono/node-server bind is 0.0.0.0 — treat as
|
|
102
|
+
// non-loopback for safety (force operator to either bind explicitly
|
|
103
|
+
// to 127.0.0.1 or set the bearer token).
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
const trimmed = host.trim().toLowerCase();
|
|
107
|
+
if (trimmed === "localhost" || trimmed === "::1" || trimmed === "[::1]")
|
|
108
|
+
return true;
|
|
109
|
+
if (trimmed.startsWith("127."))
|
|
110
|
+
return true;
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
export class AuthBearerTokenStartupError extends Error {
|
|
114
|
+
constructor(message) {
|
|
115
|
+
super(message);
|
|
116
|
+
this.name = "AuthBearerTokenStartupError";
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Startup-side check (HARD-GATE audit row 8). Throws an explicit
|
|
121
|
+
* AuthBearerTokenStartupError when the bind interface is non-loopback
|
|
122
|
+
* AND the bearer token is empty. Called from index.ts BEFORE
|
|
123
|
+
* `serve()` listens, so the daemon refuses to start in the unsafe
|
|
124
|
+
* configuration.
|
|
125
|
+
*/
|
|
126
|
+
export function assertBindAuthInvariant(opts) {
|
|
127
|
+
if (isLoopbackBind(opts.host))
|
|
128
|
+
return;
|
|
129
|
+
if (opts.bearerToken && opts.bearerToken.length > 0)
|
|
130
|
+
return;
|
|
131
|
+
throw new AuthBearerTokenStartupError(`daemon refusing to start: bind host '${opts.host}' is non-loopback but auth.bearerToken (env OPENRIG_AUTH_BEARER_TOKEN) is empty. ` +
|
|
132
|
+
`Either bind to 127.0.0.1 / localhost, OR set OPENRIG_AUTH_BEARER_TOKEN to a non-empty value before start. ` +
|
|
133
|
+
`Mission Control write verbs require bearer auth on any non-loopback bind because tailnet/public exposure without auth would let any peer on the network mutate operator state.`);
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=auth-bearer-token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-bearer-token.js","sourceRoot":"","sources":["../../src/middleware/auth-bearer-token.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,uDAAuD;AACvD,yEAAyE;AACzE,wCAAwC;AACxC,oEAAoE;AACpE,mDAAmD;AACnD,qEAAqE;AACrE,iEAAiE;AACjE,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,qEAAqE;AACrE,oBAAoB;AACpB,EAAE;AACF,iEAAiE;AACjE,uEAAuE;AACvE,gEAAgE;AAChE,qEAAqE;AACrE,iEAAiE;AACjE,mEAAmE;AACnE,wCAAwC;AAExC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,CAAS,EAAE,CAAS;IACpD,mEAAmE;IACnE,mEAAmE;IACnE,qEAAqE;IACrE,oEAAoE;IACpE,wBAAwB;IACxB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACpC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;IACpC,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;QAChC,kEAAkE;QAClE,mEAAmE;QACnE,eAAe,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|
|
|
2
2
|
export declare function getLegacyRiggedHome(): string;
|
|
3
3
|
export declare const OPENRIG_HOME: string;
|
|
4
4
|
export declare const LEGACY_RIGGED_HOME: string;
|
|
5
|
-
export declare function readOpenRigEnv(primary: string, legacy
|
|
5
|
+
export declare function readOpenRigEnv(primary: string, legacy?: string): string | undefined;
|
|
6
6
|
export declare function getPreferredOpenRigHome(): string;
|
|
7
7
|
export declare function getDefaultOpenRigPath(filename: string): string;
|
|
8
8
|
export declare function getCompatibleOpenRigPath(filename: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openrig-compat.d.ts","sourceRoot":"","sources":["../src/openrig-compat.ts"],"names":[],"mappings":"AAMA,wBAAgB,cAAc,IAAI,MAAM,CAIvC;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,eAAO,MAAM,YAAY,QAAmB,CAAC;AAC7C,eAAO,MAAM,kBAAkB,QAAwB,CAAC;AAQxD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"openrig-compat.d.ts","sourceRoot":"","sources":["../src/openrig-compat.ts"],"names":[],"mappings":"AAMA,wBAAgB,cAAc,IAAI,MAAM,CAIvC;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,eAAO,MAAM,YAAY,QAAmB,CAAC;AAC7C,eAAO,MAAM,kBAAkB,QAAwB,CAAC;AAQxD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAanF;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAahD;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAgBjE"}
|
|
@@ -23,10 +23,12 @@ export function readOpenRigEnv(primary, legacy) {
|
|
|
23
23
|
const primaryValue = process.env[primary];
|
|
24
24
|
if (primaryValue !== undefined && primaryValue !== "")
|
|
25
25
|
return primaryValue;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
if (legacy) {
|
|
27
|
+
const legacyValue = process.env[legacy];
|
|
28
|
+
if (legacyValue !== undefined && legacyValue !== "") {
|
|
29
|
+
warnOnce(`env:${legacy}`, `Warning: ${legacy} is deprecated; use ${primary} instead.`);
|
|
30
|
+
return legacyValue;
|
|
31
|
+
}
|
|
30
32
|
}
|
|
31
33
|
return undefined;
|
|
32
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openrig-compat.js","sourceRoot":"","sources":["../src/openrig-compat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;AAErC,MAAM,UAAU,cAAc;IAC5B,MAAM,UAAU,GAAG,cAAc,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;IACjE,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,UAAU,CAAC;IAChD,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,cAAc,EAAE,CAAC;AAC7C,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,EAAE,CAAC;AAExD,SAAS,QAAQ,CAAC,GAAW,EAAE,OAAe;IAC5C,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;QAA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C;QAC3B,QAAQ,CACN,QAAQ,QAAQ,EAAE,EAClB,oCAAoC,UAAU,gBAAgB,WAAW,GAAG,CAC7E,CAAC;QACF,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
export interface AgentImageRoutesDeps {
|
|
3
|
+
/** Spec-library roots scanned by the evidence guard. v0 includes
|
|
4
|
+
* the canonical user spec directory + workspace specs root. */
|
|
5
|
+
specRoots: () => readonly string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function agentImagesRoutes(deps: AgentImageRoutesDeps): Hono;
|
|
8
|
+
//# sourceMappingURL=agent-images.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-images.d.ts","sourceRoot":"","sources":["../../src/routes/agent-images.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AA6B5B,MAAM,WAAW,oBAAoB;IACnC;oEACgE;IAChE,SAAS,EAAE,MAAM,SAAS,MAAM,EAAE,CAAC;CACpC;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAoMlE"}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
// Fork Primitive + Starter Agent Images v0 (PL-016) — daemon HTTP
|
|
2
|
+
// routes.
|
|
3
|
+
//
|
|
4
|
+
// Endpoints:
|
|
5
|
+
// GET /api/agent-images/library — list all images (resume token redacted)
|
|
6
|
+
// POST /api/agent-images/library/sync — re-walk discovery roots
|
|
7
|
+
// GET /api/agent-images/library/:id — image manifest + stats (resume token redacted)
|
|
8
|
+
// GET /api/agent-images/library/:id/preview — manifest + sized supplementary file metadata
|
|
9
|
+
// POST /api/agent-images/library/:id/pin — pin from prune
|
|
10
|
+
// POST /api/agent-images/library/:id/unpin — unpin
|
|
11
|
+
// DELETE /api/agent-images/library/:id — delete (subject to evidence guard unless force=true)
|
|
12
|
+
// POST /api/agent-images/snapshot — capture a new image from a source seat
|
|
13
|
+
// POST /api/agent-images/prune — prune evictable images (dry-run by default)
|
|
14
|
+
//
|
|
15
|
+
// Resume tokens are NEVER returned over the wire — they're redacted at
|
|
16
|
+
// route boundary. Only the rigspec-instantiator (in-process) consumes
|
|
17
|
+
// the token directly.
|
|
18
|
+
import { Hono } from "hono";
|
|
19
|
+
import { rmSync } from "node:fs";
|
|
20
|
+
import { evaluateProtection } from "../domain/agent-images/evidence-guard.js";
|
|
21
|
+
import { AgentImageError } from "../domain/agent-images/agent-image-types.js";
|
|
22
|
+
function redactResumeToken(entry) {
|
|
23
|
+
return { ...entry, sourceResumeToken: "(redacted)" };
|
|
24
|
+
}
|
|
25
|
+
export function agentImagesRoutes(deps) {
|
|
26
|
+
const router = new Hono();
|
|
27
|
+
router.get("/library", (c) => {
|
|
28
|
+
const lib = c.get("agentImageLibrary");
|
|
29
|
+
if (!lib)
|
|
30
|
+
return c.json({ error: "agent_image_library_unavailable" }, 503);
|
|
31
|
+
return c.json(lib.list().map(redactResumeToken));
|
|
32
|
+
});
|
|
33
|
+
router.post("/library/sync", (c) => {
|
|
34
|
+
const lib = c.get("agentImageLibrary");
|
|
35
|
+
if (!lib)
|
|
36
|
+
return c.json({ error: "agent_image_library_unavailable" }, 503);
|
|
37
|
+
const result = lib.scan();
|
|
38
|
+
return c.json({ ...result, entries: lib.list().map(redactResumeToken) });
|
|
39
|
+
});
|
|
40
|
+
router.post("/snapshot", async (c) => {
|
|
41
|
+
const capturer = c.get("snapshotCapturer");
|
|
42
|
+
if (!capturer)
|
|
43
|
+
return c.json({ error: "snapshot_capturer_unavailable" }, 503);
|
|
44
|
+
const body = (await c.req.json().catch(() => ({})));
|
|
45
|
+
if (!body.sourceSession || !body.name) {
|
|
46
|
+
return c.json({
|
|
47
|
+
error: "missing_required_fields",
|
|
48
|
+
hint: "POST body must include { sourceSession, name }",
|
|
49
|
+
}, 400);
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const result = capturer.capture({
|
|
53
|
+
sourceSession: body.sourceSession,
|
|
54
|
+
name: body.name,
|
|
55
|
+
version: body.version,
|
|
56
|
+
notes: body.notes,
|
|
57
|
+
estimatedTokens: body.estimatedTokens,
|
|
58
|
+
lineage: body.lineage,
|
|
59
|
+
});
|
|
60
|
+
// Redact resume token in the response — operator just needs the
|
|
61
|
+
// image id and on-disk path.
|
|
62
|
+
return c.json({
|
|
63
|
+
imageId: result.imageId,
|
|
64
|
+
imagePath: result.imagePath,
|
|
65
|
+
manifest: { ...result.manifest, sourceResumeToken: "(redacted)" },
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
if (err instanceof AgentImageError) {
|
|
70
|
+
const status = err.code === "image_not_found" ? 404
|
|
71
|
+
: err.code === "runtime_mismatch" ? 400
|
|
72
|
+
: err.code === "image_referenced" ? 409
|
|
73
|
+
: 500;
|
|
74
|
+
return c.json({ error: err.code, message: err.message, details: err.details ?? null }, status);
|
|
75
|
+
}
|
|
76
|
+
return c.json({ error: "snapshot_failed", message: err.message }, 500);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
router.post("/prune", async (c) => {
|
|
80
|
+
const lib = c.get("agentImageLibrary");
|
|
81
|
+
if (!lib)
|
|
82
|
+
return c.json({ error: "agent_image_library_unavailable" }, 503);
|
|
83
|
+
const body = (await c.req.json().catch(() => ({})));
|
|
84
|
+
const dryRun = body.dryRun !== false;
|
|
85
|
+
const force = !!body.force;
|
|
86
|
+
const images = lib.list();
|
|
87
|
+
const protections = evaluateProtection({
|
|
88
|
+
images,
|
|
89
|
+
specRoots: deps.specRoots(),
|
|
90
|
+
});
|
|
91
|
+
const protectedImages = protections.filter((p) => p.protected);
|
|
92
|
+
const evictable = protections.filter((p) => !p.protected);
|
|
93
|
+
if (dryRun) {
|
|
94
|
+
return c.json({
|
|
95
|
+
dryRun: true,
|
|
96
|
+
protected: protectedImages,
|
|
97
|
+
evictable: evictable.map((p) => ({ imageId: p.imageId, imageName: p.imageName, imageVersion: p.imageVersion })),
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
// Real prune: delete evictable images. Force overrides the guard
|
|
101
|
+
// — protected images get deleted too. CATASTROPHIC bounce risk on
|
|
102
|
+
// force; surface it visibly in the response.
|
|
103
|
+
const targets = force ? protections : evictable;
|
|
104
|
+
const deleted = [];
|
|
105
|
+
const errors = [];
|
|
106
|
+
for (const t of targets) {
|
|
107
|
+
const entry = lib.get(t.imageId);
|
|
108
|
+
if (!entry)
|
|
109
|
+
continue;
|
|
110
|
+
try {
|
|
111
|
+
rmSync(entry.sourcePath, { recursive: true, force: true });
|
|
112
|
+
deleted.push(t.imageId);
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
errors.push({ imageId: t.imageId, error: err.message });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
lib.scan();
|
|
119
|
+
return c.json({
|
|
120
|
+
dryRun: false,
|
|
121
|
+
forced: force,
|
|
122
|
+
deleted,
|
|
123
|
+
errors,
|
|
124
|
+
protected: force ? [] : protectedImages,
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
router.get("/library/:id", (c) => {
|
|
128
|
+
const lib = c.get("agentImageLibrary");
|
|
129
|
+
if (!lib)
|
|
130
|
+
return c.json({ error: "agent_image_library_unavailable" }, 503);
|
|
131
|
+
const id = decodeURIComponent(c.req.param("id"));
|
|
132
|
+
if (id === "sync" || id === "snapshot" || id === "prune")
|
|
133
|
+
return c.notFound();
|
|
134
|
+
const entry = lib.get(id);
|
|
135
|
+
if (!entry)
|
|
136
|
+
return c.json({ error: `Agent image '${id}' not found in library` }, 404);
|
|
137
|
+
return c.json(redactResumeToken(entry));
|
|
138
|
+
});
|
|
139
|
+
router.get("/library/:id/preview", (c) => {
|
|
140
|
+
const lib = c.get("agentImageLibrary");
|
|
141
|
+
if (!lib)
|
|
142
|
+
return c.json({ error: "agent_image_library_unavailable" }, 503);
|
|
143
|
+
const id = decodeURIComponent(c.req.param("id"));
|
|
144
|
+
const entry = lib.get(id);
|
|
145
|
+
if (!entry)
|
|
146
|
+
return c.json({ error: `Agent image '${id}' not found in library` }, 404);
|
|
147
|
+
return c.json({
|
|
148
|
+
id,
|
|
149
|
+
name: entry.name,
|
|
150
|
+
version: entry.version,
|
|
151
|
+
runtime: entry.runtime,
|
|
152
|
+
sourceSeat: entry.sourceSeat,
|
|
153
|
+
manifestEstimatedTokens: entry.manifestEstimatedTokens,
|
|
154
|
+
derivedEstimatedTokens: entry.derivedEstimatedTokens,
|
|
155
|
+
stats: entry.stats,
|
|
156
|
+
lineage: entry.lineage,
|
|
157
|
+
pinned: entry.pinned,
|
|
158
|
+
notes: entry.notes,
|
|
159
|
+
files: entry.files,
|
|
160
|
+
starterSnippet: buildStarterSnippet(entry),
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
router.post("/library/:id/pin", (c) => {
|
|
164
|
+
const lib = c.get("agentImageLibrary");
|
|
165
|
+
if (!lib)
|
|
166
|
+
return c.json({ error: "agent_image_library_unavailable" }, 503);
|
|
167
|
+
const id = decodeURIComponent(c.req.param("id"));
|
|
168
|
+
try {
|
|
169
|
+
lib.pin(id);
|
|
170
|
+
return c.json({ ok: true, id, pinned: true });
|
|
171
|
+
}
|
|
172
|
+
catch (err) {
|
|
173
|
+
if (err instanceof AgentImageError && err.code === "image_not_found") {
|
|
174
|
+
return c.json({ error: err.code, message: err.message }, 404);
|
|
175
|
+
}
|
|
176
|
+
return c.json({ error: "pin_failed", message: err.message }, 500);
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
router.post("/library/:id/unpin", (c) => {
|
|
180
|
+
const lib = c.get("agentImageLibrary");
|
|
181
|
+
if (!lib)
|
|
182
|
+
return c.json({ error: "agent_image_library_unavailable" }, 503);
|
|
183
|
+
const id = decodeURIComponent(c.req.param("id"));
|
|
184
|
+
try {
|
|
185
|
+
lib.unpin(id);
|
|
186
|
+
return c.json({ ok: true, id, pinned: false });
|
|
187
|
+
}
|
|
188
|
+
catch (err) {
|
|
189
|
+
if (err instanceof AgentImageError && err.code === "image_not_found") {
|
|
190
|
+
return c.json({ error: err.code, message: err.message }, 404);
|
|
191
|
+
}
|
|
192
|
+
return c.json({ error: "unpin_failed", message: err.message }, 500);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
router.delete("/library/:id", (c) => {
|
|
196
|
+
const lib = c.get("agentImageLibrary");
|
|
197
|
+
if (!lib)
|
|
198
|
+
return c.json({ error: "agent_image_library_unavailable" }, 503);
|
|
199
|
+
const id = decodeURIComponent(c.req.param("id"));
|
|
200
|
+
const force = (c.req.query("force") ?? "") === "true";
|
|
201
|
+
const entry = lib.get(id);
|
|
202
|
+
if (!entry)
|
|
203
|
+
return c.json({ error: `Agent image '${id}' not found in library` }, 404);
|
|
204
|
+
// Evidence guard for non-force deletes.
|
|
205
|
+
if (!force) {
|
|
206
|
+
const protections = evaluateProtection({
|
|
207
|
+
images: lib.list(),
|
|
208
|
+
specRoots: deps.specRoots(),
|
|
209
|
+
});
|
|
210
|
+
const status = protections.find((p) => p.imageId === id);
|
|
211
|
+
if (status && status.protected) {
|
|
212
|
+
return c.json({
|
|
213
|
+
error: "image_referenced",
|
|
214
|
+
message: `Agent image '${id}' is protected: ${status.reasons.join(", ")}. Use force=true to override.`,
|
|
215
|
+
reasons: status.reasons,
|
|
216
|
+
references: status.references,
|
|
217
|
+
}, 409);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
try {
|
|
221
|
+
rmSync(entry.sourcePath, { recursive: true, force: true });
|
|
222
|
+
lib.scan();
|
|
223
|
+
return c.json({ ok: true, id, forced: force });
|
|
224
|
+
}
|
|
225
|
+
catch (err) {
|
|
226
|
+
return c.json({ error: "delete_failed", message: err.message }, 500);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
return router;
|
|
230
|
+
}
|
|
231
|
+
/** PRD § Item 5: review-pane "Use as starter" surface. We synthesize
|
|
232
|
+
* the agent.yaml snippet here so the UI can render it directly with
|
|
233
|
+
* no client-side templating.
|
|
234
|
+
*
|
|
235
|
+
* PL-016 source-cwd behavior: when the
|
|
236
|
+
* manifest carries source_cwd, the snippet emits `cwd: <source_cwd>`
|
|
237
|
+
* ahead of the session_source block. The fork
|
|
238
|
+
* starts in the SAME directory the parent session was created in,
|
|
239
|
+
* Claude's project-dir-scoped session storage works because the jsonl
|
|
240
|
+
* file lives there. The daemon relies on provider cwd resolution and
|
|
241
|
+
* does NOT override cwd at fork dispatch. If the operator manually
|
|
242
|
+
* changes cwd, fork fails honestly with "no
|
|
243
|
+
* conversation found". Manifests without source_cwd (pre-Finding-2)
|
|
244
|
+
* render without the cwd line for back-compat. */
|
|
245
|
+
function buildStarterSnippet(entry) {
|
|
246
|
+
const lines = [];
|
|
247
|
+
if (entry.sourceCwd) {
|
|
248
|
+
lines.push(`cwd: ${JSON.stringify(entry.sourceCwd)}`);
|
|
249
|
+
}
|
|
250
|
+
lines.push("session_source:", " mode: agent_image", " ref:", " kind: image_name", ` value: ${JSON.stringify(entry.name)}`, ` version: ${JSON.stringify(entry.version)}`);
|
|
251
|
+
return lines.join("\n") + "\n";
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=agent-images.js.map
|