@openrig/cli 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/daemon/assets/plugins/openrig-core/.claude-plugin/plugin.json +15 -0
- package/daemon/assets/plugins/openrig-core/.codex-plugin/plugin.json +24 -0
- package/daemon/assets/plugins/openrig-core/LICENSE +200 -0
- package/daemon/assets/plugins/openrig-core/README.md +42 -0
- package/daemon/assets/plugins/openrig-core/hooks/claude.json +78 -0
- package/daemon/assets/plugins/openrig-core/hooks/codex.json +37 -0
- package/daemon/assets/{openrig-activity-hook-relay.cjs → plugins/openrig-core/hooks/scripts/activity-relay.cjs} +12 -0
- package/daemon/assets/plugins/openrig-core/hooks/scripts/compaction-restore-bridge.cjs +172 -0
- package/daemon/assets/plugins/openrig-core/skills/agent-startup-and-context-ingestion/SKILL.md +104 -0
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/SKILL.md +131 -0
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/precompact-hook.mjs +174 -0
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +433 -0
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/templates/compact-instruction.md +1 -0
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/templates/post-compact-restore-instruction.md +1 -0
- package/daemon/assets/plugins/openrig-core/skills/forming-an-openrig-mental-model/SKILL.md +305 -0
- package/daemon/{specs/agents/shared/skills/rig-architect → assets/plugins/openrig-core/skills/openrig-architect}/SKILL.md +38 -19
- package/daemon/assets/plugins/openrig-core/skills/openrig-operator/SKILL.md +222 -0
- package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +597 -0
- package/daemon/assets/plugins/openrig-core/skills/queue-handoff/SKILL.md +122 -0
- package/daemon/assets/plugins/openrig-core/skills/seat-continuity-and-handover/SKILL.md +137 -0
- package/daemon/assets/vm-preview-fixtures/README.md +48 -0
- package/daemon/assets/vm-preview-fixtures/workflows/sample-basic-loop.yaml +79 -0
- package/daemon/dist/adapters/claude-code-adapter.d.ts +11 -3
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +58 -60
- package/daemon/dist/adapters/claude-code-adapter.js.map +1 -1
- package/daemon/dist/adapters/cmux-transport.d.ts.map +1 -1
- package/daemon/dist/adapters/cmux-transport.js +81 -2
- package/daemon/dist/adapters/cmux-transport.js.map +1 -1
- package/daemon/dist/adapters/cmux.d.ts +4 -0
- package/daemon/dist/adapters/cmux.d.ts.map +1 -1
- package/daemon/dist/adapters/cmux.js +87 -0
- package/daemon/dist/adapters/cmux.js.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts +14 -3
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +43 -57
- package/daemon/dist/adapters/codex-runtime-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/db/migrations/040_workflow_specs_diagnostic.d.ts +32 -0
- package/daemon/dist/db/migrations/040_workflow_specs_diagnostic.d.ts.map +1 -0
- package/daemon/dist/db/migrations/040_workflow_specs_diagnostic.js +37 -0
- package/daemon/dist/db/migrations/040_workflow_specs_diagnostic.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-manifest.d.ts.map +1 -1
- package/daemon/dist/domain/agent-manifest.js +116 -37
- package/daemon/dist/domain/agent-manifest.js.map +1 -1
- package/daemon/dist/domain/agent-resolver.js +1 -1
- package/daemon/dist/domain/agent-resolver.js.map +1 -1
- 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/claude-compaction-enforcer.d.ts +81 -0
- package/daemon/dist/domain/claude-compaction-enforcer.d.ts.map +1 -0
- package/daemon/dist/domain/claude-compaction-enforcer.js +242 -0
- package/daemon/dist/domain/claude-compaction-enforcer.js.map +1 -0
- package/daemon/dist/domain/cmux-layout-service.d.ts +41 -0
- package/daemon/dist/domain/cmux-layout-service.d.ts.map +1 -0
- package/daemon/dist/domain/cmux-layout-service.js +184 -0
- package/daemon/dist/domain/cmux-layout-service.js.map +1 -0
- 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 +20 -5
- package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
- package/daemon/dist/domain/context-monitor.js +63 -13
- 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/kernel-boot-tracker.d.ts +74 -0
- package/daemon/dist/domain/kernel-boot-tracker.d.ts.map +1 -0
- package/daemon/dist/domain/kernel-boot-tracker.js +213 -0
- package/daemon/dist/domain/kernel-boot-tracker.js.map +1 -0
- package/daemon/dist/domain/kernel-boot.d.ts +50 -0
- package/daemon/dist/domain/kernel-boot.d.ts.map +1 -0
- package/daemon/dist/domain/kernel-boot.js +147 -0
- package/daemon/dist/domain/kernel-boot.js.map +1 -0
- 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 +90 -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 +279 -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 +302 -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/plugin-discovery-service.d.ts +150 -0
- package/daemon/dist/domain/plugin-discovery-service.d.ts.map +1 -0
- package/daemon/dist/domain/plugin-discovery-service.js +468 -0
- package/daemon/dist/domain/plugin-discovery-service.js.map +1 -0
- package/daemon/dist/domain/plugin-vendor-service.d.ts +54 -0
- package/daemon/dist/domain/plugin-vendor-service.d.ts.map +1 -0
- package/daemon/dist/domain/plugin-vendor-service.js +111 -0
- package/daemon/dist/domain/plugin-vendor-service.js.map +1 -0
- 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 +8 -3
- package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/profile-resolver.js +69 -15
- 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/projection-planner.d.ts +7 -1
- package/daemon/dist/domain/projection-planner.d.ts.map +1 -1
- package/daemon/dist/domain/projection-planner.js +44 -4
- package/daemon/dist/domain/projection-planner.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +30 -5
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +94 -27
- 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/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +33 -0
- package/daemon/dist/domain/session-transport.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/skill-library-discovery.d.ts +68 -0
- package/daemon/dist/domain/skill-library-discovery.d.ts.map +1 -0
- package/daemon/dist/domain/skill-library-discovery.js +144 -0
- package/daemon/dist/domain/skill-library-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 +137 -0
- package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -0
- package/daemon/dist/domain/slices/slice-indexer.js +585 -0
- package/daemon/dist/domain/slices/slice-indexer.js.map +1 -0
- package/daemon/dist/domain/spec-library-service.d.ts +23 -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 +124 -0
- package/daemon/dist/domain/spec-library-workflow-scanner.d.ts.map +1 -0
- package/daemon/dist/domain/spec-library-workflow-scanner.js +325 -0
- package/daemon/dist/domain/spec-library-workflow-scanner.js.map +1 -0
- package/daemon/dist/domain/spec-review-service.d.ts +1 -1
- package/daemon/dist/domain/spec-review-service.d.ts.map +1 -1
- package/daemon/dist/domain/spec-review-service.js +14 -1
- package/daemon/dist/domain/spec-review-service.js.map +1 -1
- 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 +128 -9
- 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 +66 -0
- package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -0
- package/daemon/dist/domain/user-settings/settings-store.js +546 -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 +34 -0
- package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.js +121 -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 +252 -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/getting-started-narrative.d.ts +15 -0
- package/daemon/dist/domain/workspace/getting-started-narrative.d.ts.map +1 -0
- package/daemon/dist/domain/workspace/getting-started-narrative.js +237 -0
- package/daemon/dist/domain/workspace/getting-started-narrative.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 +2 -1
- package/daemon/dist/index.d.ts.map +1 -1
- package/daemon/dist/index.js +56 -12
- package/daemon/dist/index.js.map +1 -1
- package/daemon/dist/lib/pane-envelope.d.ts +7 -0
- package/daemon/dist/lib/pane-envelope.d.ts.map +1 -0
- package/daemon/dist/lib/pane-envelope.js +38 -0
- package/daemon/dist/lib/pane-envelope.js.map +1 -0
- package/daemon/dist/middleware/auth-bearer-token.d.ts +91 -0
- package/daemon/dist/middleware/auth-bearer-token.d.ts.map +1 -0
- package/daemon/dist/middleware/auth-bearer-token.js +236 -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/kernel-status.d.ts +3 -0
- package/daemon/dist/routes/kernel-status.d.ts.map +1 -0
- package/daemon/dist/routes/kernel-status.js +40 -0
- package/daemon/dist/routes/kernel-status.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 +306 -0
- package/daemon/dist/routes/mission-control.js.map +1 -0
- package/daemon/dist/routes/missions.d.ts +3 -0
- package/daemon/dist/routes/missions.d.ts.map +1 -0
- package/daemon/dist/routes/missions.js +195 -0
- package/daemon/dist/routes/missions.js.map +1 -0
- package/daemon/dist/routes/plugins.d.ts +3 -0
- package/daemon/dist/routes/plugins.d.ts.map +1 -0
- package/daemon/dist/routes/plugins.js +223 -0
- package/daemon/dist/routes/plugins.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/rig-cmux.d.ts +3 -0
- package/daemon/dist/routes/rig-cmux.d.ts.map +1 -0
- package/daemon/dist/routes/rig-cmux.js +121 -0
- package/daemon/dist/routes/rig-cmux.js.map +1 -0
- 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/skills.d.ts +3 -0
- package/daemon/dist/routes/skills.d.ts.map +1 -0
- package/daemon/dist/routes/skills.js +147 -0
- package/daemon/dist/routes/skills.js.map +1 -0
- 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 +207 -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 +87 -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 +82 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +82 -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 +577 -5
- 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 -2
- package/daemon/specs/agents/apps/vault-specialist/guidance/role.md +0 -1
- package/daemon/specs/agents/conveyor/builder/agent.yaml +34 -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 +34 -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 +34 -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 +34 -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/design/product-designer/agent.yaml +0 -1
- package/daemon/specs/agents/development/implementer/agent.yaml +1 -2
- package/daemon/specs/agents/development/implementer/guidance/role.md +0 -1
- package/daemon/specs/agents/development/qa/agent.yaml +0 -1
- package/daemon/specs/agents/development/qa/guidance/role.md +0 -2
- package/daemon/specs/agents/orchestration/orchestrator/agent.yaml +1 -2
- package/daemon/specs/agents/orchestration/orchestrator/guidance/role.md +2 -3
- package/daemon/specs/agents/research/analyst/agent.yaml +0 -1
- package/daemon/specs/agents/research/synthesizer/agent.yaml +0 -1
- package/daemon/specs/agents/review/independent-reviewer/agent.yaml +0 -1
- package/daemon/specs/agents/shared/agent.yaml +6 -8
- package/daemon/specs/agents/shared/skills/core/openrig-architect/SKILL.md +361 -0
- package/daemon/specs/agents/shared/skills/core/openrig-installer/SKILL.md +142 -0
- package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +30 -0
- package/daemon/specs/agents/shared/skills/core/openrig-user-settings/SKILL.md +153 -0
- package/daemon/specs/agents/shared/skills/core/rig-lifecycle/SKILL.md +116 -0
- package/daemon/specs/agents/shared/skills/pods/development-team/SKILL.md +0 -1
- package/daemon/specs/agents/shared/skills/pods/orchestration-team/SKILL.md +2 -2
- package/daemon/specs/agents/shared/skills/process/agent-browser/LOCAL-INSIGHTS.md +6 -6
- package/daemon/specs/agents/shared/skills/process/agent-browser/OPENRIG.md +40 -0
- package/daemon/specs/agents/shared/skills/process/agent-browser/SKILL.md +10 -0
- package/daemon/specs/agents/shared/skills/process/brainstorming/OPENRIG.md +48 -0
- package/daemon/specs/agents/shared/skills/process/brainstorming/SKILL.md +11 -0
- package/daemon/specs/agents/shared/skills/process/dogfood/SKILL.md +5 -0
- package/daemon/specs/agents/shared/skills/process/executing-plans/OPENRIG.md +56 -0
- package/daemon/specs/agents/shared/skills/process/executing-plans/SKILL.md +10 -0
- package/daemon/specs/agents/shared/skills/process/frontend-design/SKILL.md +5 -0
- package/daemon/specs/agents/shared/skills/process/systematic-debugging/SKILL.md +5 -0
- package/daemon/specs/agents/shared/skills/process/test-driven-development/SKILL.md +5 -0
- package/daemon/specs/agents/shared/skills/process/using-superpowers/OPENRIG.md +48 -0
- package/daemon/specs/agents/shared/skills/process/using-superpowers/SKILL.md +11 -0
- package/daemon/specs/agents/shared/skills/process/verification-before-completion/SKILL.md +5 -0
- package/daemon/specs/agents/shared/skills/process/writing-plans/OPENRIG.md +52 -0
- package/daemon/specs/agents/shared/skills/process/writing-plans/SKILL.md +12 -2
- 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/launch/kernel/agents/advisor/lead/agent.yaml +35 -0
- package/daemon/specs/rigs/launch/kernel/agents/advisor/lead/guidance/role.md +50 -0
- package/daemon/specs/rigs/launch/kernel/agents/advisor/lead/startup/context.md +37 -0
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/agent.yaml +35 -0
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/guidance/role.md +49 -0
- package/daemon/specs/rigs/launch/kernel/agents/operator/agent/startup/context.md +63 -0
- package/daemon/specs/rigs/launch/kernel/agents/queue/worker/agent.yaml +35 -0
- package/daemon/specs/rigs/launch/kernel/agents/queue/worker/guidance/role.md +33 -0
- package/daemon/specs/rigs/launch/kernel/agents/queue/worker/startup/context.md +30 -0
- package/daemon/specs/rigs/launch/kernel/culture/CULTURE.md +69 -0
- package/daemon/specs/rigs/launch/kernel/rig-claude-only.yaml +59 -0
- package/daemon/specs/rigs/launch/kernel/rig-codex-only.yaml +59 -0
- package/daemon/specs/rigs/launch/kernel/rig.yaml +69 -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 +553 -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 +86 -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 +61 -1
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/heartbeat.d.ts.map +1 -1
- package/dist/commands/heartbeat.js +0 -5
- package/dist/commands/heartbeat.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/plugin.d.ts +4 -0
- package/dist/commands/plugin.d.ts.map +1 -0
- package/dist/commands/plugin.js +395 -0
- package/dist/commands/plugin.js.map +1 -0
- 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 +15 -0
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +32 -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 +30 -4
- 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 +90 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +477 -42
- package/dist/config-store.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +42 -1
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +98 -7
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/host-registry.d.ts +1 -1
- package/dist/host-registry.js +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -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-C_Q5FczU.css +1 -0
- package/ui/dist/assets/index-Rl3ZBrUg.js +547 -0
- package/ui/dist/graphics/operator-climber-monochrome.png +0 -0
- package/ui/dist/index.html +3 -2
- package/daemon/specs/agents/shared/skills/claude-compact-in-place/SKILL.md +0 -100
- package/daemon/specs/agents/shared/skills/mental-model-ha/SKILL.md +0 -956
- package/daemon/specs/agents/shared/skills/process/containerized-e2e/SKILL.md +0 -256
- package/daemon/specs/agents/shared/skills/process/containerized-e2e/scripts/Dockerfile +0 -39
- package/daemon/specs/agents/shared/skills/process/containerized-e2e/scripts/build-e2e-image.sh +0 -37
- package/daemon/specs/agents/shared/skills/process/containerized-e2e/templates/control-plane-test.yaml +0 -40
- package/daemon/specs/agents/shared/skills/process/containerized-e2e/templates/e2e-report-template.md +0 -94
- package/daemon/specs/agents/shared/skills/process/containerized-e2e/templates/expansion-collision-fragment.yaml +0 -13
- package/daemon/specs/agents/shared/skills/process/containerized-e2e/templates/expansion-pod-fragment.yaml +0 -14
- 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
|
@@ -2,6 +2,7 @@ import type Database from "better-sqlite3";
|
|
|
2
2
|
import type { RigRepository } from "./rig-repository.js";
|
|
3
3
|
import type { SessionRegistry } from "./session-registry.js";
|
|
4
4
|
import type { TranscriptStore } from "./transcript-store.js";
|
|
5
|
+
import { type WhoamiWorkspaceBlock } from "./workspace/workspace-resolver.js";
|
|
5
6
|
export interface WhoamiResult {
|
|
6
7
|
resolvedBy: "node_id" | "session_name";
|
|
7
8
|
identity: {
|
|
@@ -58,7 +59,28 @@ export interface WhoamiResult {
|
|
|
58
59
|
captureExamples: string[];
|
|
59
60
|
};
|
|
60
61
|
contextUsage?: import("./types.js").ContextUsage;
|
|
62
|
+
/** PL-012 Token / Context Usage Surface v0 — runtime-specific context
|
|
63
|
+
* detail surfaced alongside the cross-runtime contextUsage primitive.
|
|
64
|
+
* Codex: threadId from the per-pid logs DB. Claude Code: resumeToken
|
|
65
|
+
* + current usage from the context-usage sample. Terminal: null. */
|
|
66
|
+
runtimeContext?: RuntimeContext | null;
|
|
67
|
+
/** PL-007 Workspace Primitive v0 — typed workspace block when the
|
|
68
|
+
* rig's RigSpec declares one. null when the rig has no workspace
|
|
69
|
+
* declaration; agents fall back to cwd-only orientation. */
|
|
70
|
+
workspace?: WhoamiWorkspaceBlock | null;
|
|
61
71
|
}
|
|
72
|
+
export type RuntimeContext = {
|
|
73
|
+
runtime: "codex";
|
|
74
|
+
threadId: string | null;
|
|
75
|
+
conversationId: string | null;
|
|
76
|
+
estimatedTokens: number | null;
|
|
77
|
+
lastSampledAt: string | null;
|
|
78
|
+
} | {
|
|
79
|
+
runtime: "claude-code";
|
|
80
|
+
resumeToken: string | null;
|
|
81
|
+
estimatedTokens: number | null;
|
|
82
|
+
lastSampledAt: string | null;
|
|
83
|
+
};
|
|
62
84
|
export declare class WhoamiAmbiguousError extends Error {
|
|
63
85
|
constructor(message: string);
|
|
64
86
|
}
|
|
@@ -79,7 +101,14 @@ export declare class WhoamiService {
|
|
|
79
101
|
resolve(query: {
|
|
80
102
|
nodeId?: string;
|
|
81
103
|
sessionName?: string;
|
|
104
|
+
targetRepoOverride?: string;
|
|
82
105
|
}): WhoamiResult | null;
|
|
106
|
+
/** PL-012: produce the runtime-specific context block. v0 surfaces
|
|
107
|
+
* what the daemon already has captured without taking on new pid /
|
|
108
|
+
* log lookups (those need helper plumbing across the daemon's tmux
|
|
109
|
+
* adapter). When data isn't available, fields return null honestly
|
|
110
|
+
* instead of fabricating. Terminal seats: null entire block. */
|
|
111
|
+
private computeRuntimeContext;
|
|
83
112
|
private getCurrentSessionName;
|
|
84
113
|
}
|
|
85
114
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whoami-service.d.ts","sourceRoot":"","sources":["../../src/domain/whoami-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,M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GAAG,IAAI,CAAC;IAC9B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,GACD;IACE,OAAO,EAAE,aAAa,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEN,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAI5B;AA0CD,UAAU,UAAU;IAClB,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC;IACtB,OAAO,EAAE,aAAa,CAAC;IACvB,eAAe,EAAE,eAAe,CAAC;IACjC,eAAe,EAAE,eAAe,CAAC;IACjC,iBAAiB,CAAC,EAAE,OAAO,0BAA0B,EAAE,iBAAiB,CAAC;CAC1E;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,EAAE,CAAoB;IAC9B,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,iBAAiB,CAA8D;gBAE3E,IAAI,EAAE,UAAU;IAQ5B,OAAO,CAAC,KAAK,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,YAAY,GAAG,IAAI;IAgM3G;;;;qEAIiE;IACjE,OAAO,CAAC,qBAAqB;IAoD7B,OAAO,CAAC,qBAAqB;CAe9B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveWorkspaceContext } from "./workspace/workspace-resolver.js";
|
|
1
2
|
export class WhoamiAmbiguousError extends Error {
|
|
2
3
|
constructor(message) {
|
|
3
4
|
super(message);
|
|
@@ -166,6 +167,19 @@ export class WhoamiService {
|
|
|
166
167
|
const contextUsage = this.contextUsageStore && currentSessionName
|
|
167
168
|
? this.contextUsageStore.getForNode(nodeRow.id, currentSessionName)
|
|
168
169
|
: undefined;
|
|
170
|
+
// PL-012: runtime-specific context block. Codex/Claude Code surface
|
|
171
|
+
// additional debug-friendly detail; terminal seats have no
|
|
172
|
+
// conversation context and report null.
|
|
173
|
+
const runtimeContext = this.computeRuntimeContext(nodeRow.id, identity.runtime, contextUsage);
|
|
174
|
+
// PL-007: workspace block resolved from RigSpec.workspace. activeRepo
|
|
175
|
+
// resolves per-rig default first; envOverride lets per-session
|
|
176
|
+
// OPENRIG_TARGET_REPO override (subject to repo-name validation).
|
|
177
|
+
const workspaceSpec = this.rigRepo.getRigWorkspace(nodeRow.rig_id);
|
|
178
|
+
const workspace = resolveWorkspaceContext({
|
|
179
|
+
spec: workspaceSpec,
|
|
180
|
+
cwd: nodeRow.cwd,
|
|
181
|
+
envOverride: query.targetRepoOverride ?? process.env["OPENRIG_TARGET_REPO"] ?? null,
|
|
182
|
+
});
|
|
169
183
|
return {
|
|
170
184
|
resolvedBy,
|
|
171
185
|
identity,
|
|
@@ -174,8 +188,62 @@ export class WhoamiService {
|
|
|
174
188
|
transcript,
|
|
175
189
|
commands: { sendExamples, captureExamples },
|
|
176
190
|
contextUsage,
|
|
191
|
+
runtimeContext,
|
|
192
|
+
workspace,
|
|
177
193
|
};
|
|
178
194
|
}
|
|
195
|
+
/** PL-012: produce the runtime-specific context block. v0 surfaces
|
|
196
|
+
* what the daemon already has captured without taking on new pid /
|
|
197
|
+
* log lookups (those need helper plumbing across the daemon's tmux
|
|
198
|
+
* adapter). When data isn't available, fields return null honestly
|
|
199
|
+
* instead of fabricating. Terminal seats: null entire block. */
|
|
200
|
+
computeRuntimeContext(nodeId, runtime, contextUsage) {
|
|
201
|
+
if (runtime === "terminal")
|
|
202
|
+
return null;
|
|
203
|
+
const totalIn = contextUsage?.totalInputTokens ?? 0;
|
|
204
|
+
const totalOut = contextUsage?.totalOutputTokens ?? 0;
|
|
205
|
+
const estimatedTokens = (contextUsage?.availability === "known")
|
|
206
|
+
? (totalIn + totalOut) || null
|
|
207
|
+
: null;
|
|
208
|
+
const lastSampledAt = contextUsage?.sampledAt ?? null;
|
|
209
|
+
if (runtime === "codex") {
|
|
210
|
+
// Codex thread-id resolution requires a pid (codex-thread-id.ts is
|
|
211
|
+
// pid-keyed). Surface null at v0 — the operator drops to terminal
|
|
212
|
+
// for thread-id extraction. NAMED v0+1 trigger: dogfood reports
|
|
213
|
+
// needing UI-side thread-id without terminal drop.
|
|
214
|
+
return {
|
|
215
|
+
runtime: "codex",
|
|
216
|
+
threadId: null,
|
|
217
|
+
conversationId: null,
|
|
218
|
+
estimatedTokens,
|
|
219
|
+
lastSampledAt,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
if (runtime === "claude-code") {
|
|
223
|
+
// resumeToken lives on sessions.resume_token (migration 006).
|
|
224
|
+
// Read the most-recent session for this node.
|
|
225
|
+
let resumeToken = null;
|
|
226
|
+
try {
|
|
227
|
+
const row = this.db
|
|
228
|
+
.prepare("SELECT resume_token FROM sessions WHERE node_id = ? ORDER BY id DESC LIMIT 1")
|
|
229
|
+
.get(nodeId);
|
|
230
|
+
resumeToken = row?.resume_token ?? null;
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
// Migration absent (test harness) — surface null honestly.
|
|
234
|
+
resumeToken = null;
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
runtime: "claude-code",
|
|
238
|
+
resumeToken,
|
|
239
|
+
estimatedTokens,
|
|
240
|
+
lastSampledAt,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
// Unknown runtime: surface null until the daemon learns the
|
|
244
|
+
// runtime's context exposure shape. PL-005 honest-degradation.
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
179
247
|
getCurrentSessionName(nodeId, rigId) {
|
|
180
248
|
// Prefer binding's current transport/session anchor
|
|
181
249
|
const binding = this.db
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"whoami-service.js","sourceRoot":"","sources":["../../src/domain/whoami-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"whoami-service.js","sourceRoot":"","sources":["../../src/domain/whoami-service.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,uBAAuB,EAA6B,MAAM,mCAAmC,CAAC;AAwEvG,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAkDD,MAAM,OAAO,aAAa;IAChB,EAAE,CAAoB;IACtB,OAAO,CAAgB;IACvB,eAAe,CAAkB;IACjC,eAAe,CAAkB;IACjC,iBAAiB,CAA8D;IAEvF,YAAY,IAAgB;QAC1B,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC5C,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC;QAC5C,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC;IAC1D,CAAC;IAED,OAAO,CAAC,KAA6E;QACnF,IAAI,OAA4B,CAAC;QACjC,IAAI,UAAsC,CAAC;QAC3C,IAAI,kBAAiC,CAAC;QAEtC,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACjB,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAwB,CAAC;YACvG,IAAI,CAAC,OAAO;gBAAE,OAAO,IAAI,CAAC;YAC1B,UAAU,GAAG,SAAS,CAAC;YACvB,kBAAkB,GAAG,IAAI,CAAC,qBAA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ACD,4DAA4D;QAC5D,+DAA+D;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,qBAAqB,CAAC,MAAc,EAAE,KAAa;QACzD,oDAAoD;QACpD,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE;aACpB,OAAO,CAAC,4EAA4E,CAAC;aACrF,GAAG,CAAC,MAAM,CAAsF,CAAC;QACpG,IAAI,OAAO,EAAE,YAAY;YAAE,OAAO,OAAO,CAAC,YAAY,CAAC;QACvD,IAAI,OAAO,EAAE,qBAAqB;YAAE,OAAO,OAAO,CAAC,qBAAqB,CAAC;QAEzE,sCAAsC;QACtC,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE;aACjB,OAAO,CAAC,8EAA8E,CAAC;aACvF,GAAG,CAAC,MAAM,CAAyC,CAAC;QAEvD,OAAO,IAAI,EAAE,YAAY,IAAI,IAAI,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type Database from "better-sqlite3";
|
|
2
|
+
export interface SliceWorkflowBinding {
|
|
3
|
+
/** The most recent workflow_instance touching the slice's qitem set. */
|
|
4
|
+
instanceId: string;
|
|
5
|
+
workflowName: string;
|
|
6
|
+
workflowVersion: string;
|
|
7
|
+
status: string;
|
|
8
|
+
currentStepId: string | null;
|
|
9
|
+
/** Frontier qitem_ids parsed from the JSON column. */
|
|
10
|
+
currentFrontier: string[];
|
|
11
|
+
hopCount: number;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
completedAt: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface SliceWorkflowBindingResult {
|
|
16
|
+
primary: SliceWorkflowBinding | null;
|
|
17
|
+
/** Other instances touching the slice; surfaced for "+N more" UI. */
|
|
18
|
+
additionalInstanceIds: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare function findSliceWorkflowBinding(db: Database.Database, qitemIds: string[]): SliceWorkflowBindingResult;
|
|
21
|
+
//# sourceMappingURL=slice-workflow-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slice-workflow-binding.d.ts","sourceRoot":"","sources":["../../../src/domain/workflow/slice-workflow-binding.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,MAAM,WAAW,oBAAoB;IACnC,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,sDAAsD;IACtD,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACrC,qEAAqE;IACrE,qBAAqB,EAAE,MAAM,EAAE,CAAC;CACjC;AAcD,wBAAgB,wBAAwB,CACtC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,QAAQ,EAAE,MAAM,EAAE,GACjB,0BAA0B,CA4D5B"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Slice Story View v1 — slice → workflow_instance binding helper.
|
|
2
|
+
//
|
|
3
|
+
// Given a slice's qitem set, find the workflow_instance(s) that touch
|
|
4
|
+
// any of those qitems. Two signals (UNION):
|
|
5
|
+
//
|
|
6
|
+
// 1. workflow_step_trails.prior_qitem_id IN (slice qitems) -- step closure
|
|
7
|
+
// OR workflow_step_trails.next_qitem_id IN (slice qitems) -- step projection
|
|
8
|
+
// → instance has historically touched this slice
|
|
9
|
+
// 2. workflow_instances.current_frontier_json LIKE '%qitemId%'
|
|
10
|
+
// → instance is currently active on a slice qitem
|
|
11
|
+
//
|
|
12
|
+
// Returns the instance id(s) sorted by created_at DESC. v1 picks the
|
|
13
|
+
// most-recent instance when multiple bind to the slice (per PRD: "when
|
|
14
|
+
// a slice has more than one workflow_instance, v1 picks the most recent
|
|
15
|
+
// or surfaces a 'multiple instances' indicator; driver picks the exact
|
|
16
|
+
// UX with review at audit time"). The picked-most-recent
|
|
17
|
+
// behavior is the operator-friendly default; the multiple-instance
|
|
18
|
+
// indicator is exposed via the `additionalInstanceIds` field so the UI
|
|
19
|
+
// can surface a "+N more" hint without losing data.
|
|
20
|
+
//
|
|
21
|
+
// MVP single-host context: this query runs ad-hoc per slice detail
|
|
22
|
+
// fetch; not cached. The detail projector itself caches at the slice
|
|
23
|
+
// indexer's TTL boundary.
|
|
24
|
+
export function findSliceWorkflowBinding(db, qitemIds) {
|
|
25
|
+
if (qitemIds.length === 0)
|
|
26
|
+
return { primary: null, additionalInstanceIds: [] };
|
|
27
|
+
const instanceIds = new Set();
|
|
28
|
+
// Signal 1: trails referencing slice qitems via prior_qitem_id or next_qitem_id.
|
|
29
|
+
try {
|
|
30
|
+
const placeholders = qitemIds.map(() => "?").join(",");
|
|
31
|
+
const trailRows = db.prepare(`SELECT DISTINCT instance_id FROM workflow_step_trails
|
|
32
|
+
WHERE prior_qitem_id IN (${placeholders})
|
|
33
|
+
OR next_qitem_id IN (${placeholders})`).all(...qitemIds, ...qitemIds);
|
|
34
|
+
for (const r of trailRows)
|
|
35
|
+
instanceIds.add(r.instance_id);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// workflow_step_trails absent — skip
|
|
39
|
+
}
|
|
40
|
+
// Signal 2: live frontier on a slice qitem (active step packet).
|
|
41
|
+
// current_frontier_json is a JSON array of strings; LIKE '%"qitem"%'
|
|
42
|
+
// is a cheap heuristic that matches the JSON-encoded form. False
|
|
43
|
+
// positives possible if a qitem id appears as a substring of an
|
|
44
|
+
// unrelated id, but ULID prefix discipline (timestamps + random) makes
|
|
45
|
+
// collisions astronomically unlikely at single-host MVP scale.
|
|
46
|
+
try {
|
|
47
|
+
for (const qid of qitemIds) {
|
|
48
|
+
const liveRows = db.prepare(`SELECT instance_id FROM workflow_instances
|
|
49
|
+
WHERE current_frontier_json LIKE ?`).all(`%${qid}%`);
|
|
50
|
+
for (const r of liveRows)
|
|
51
|
+
instanceIds.add(r.instance_id);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// workflow_instances absent — skip
|
|
56
|
+
}
|
|
57
|
+
if (instanceIds.size === 0)
|
|
58
|
+
return { primary: null, additionalInstanceIds: [] };
|
|
59
|
+
// Resolve full rows; sort by created_at DESC; pick most recent as primary.
|
|
60
|
+
const idList = Array.from(instanceIds);
|
|
61
|
+
const idPlaceholders = idList.map(() => "?").join(",");
|
|
62
|
+
let rows = [];
|
|
63
|
+
try {
|
|
64
|
+
rows = db.prepare(`SELECT instance_id, workflow_name, workflow_version, status,
|
|
65
|
+
current_frontier_json, current_step_id, hop_count,
|
|
66
|
+
created_at, completed_at
|
|
67
|
+
FROM workflow_instances
|
|
68
|
+
WHERE instance_id IN (${idPlaceholders})
|
|
69
|
+
ORDER BY created_at DESC, instance_id DESC`).all(...idList);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return { primary: null, additionalInstanceIds: [] };
|
|
73
|
+
}
|
|
74
|
+
if (rows.length === 0)
|
|
75
|
+
return { primary: null, additionalInstanceIds: [] };
|
|
76
|
+
const primary = rowToBinding(rows[0]);
|
|
77
|
+
const additional = rows.slice(1).map((r) => r.instance_id);
|
|
78
|
+
return { primary, additionalInstanceIds: additional };
|
|
79
|
+
}
|
|
80
|
+
function rowToBinding(row) {
|
|
81
|
+
let frontier = [];
|
|
82
|
+
try {
|
|
83
|
+
const parsed = JSON.parse(row.current_frontier_json);
|
|
84
|
+
if (Array.isArray(parsed))
|
|
85
|
+
frontier = parsed.filter((x) => typeof x === "string");
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// malformed JSON — empty frontier (instance is in a degraded state;
|
|
89
|
+
// the v1 UI will still render the bound workflow_name + status).
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
instanceId: row.instance_id,
|
|
93
|
+
workflowName: row.workflow_name,
|
|
94
|
+
workflowVersion: row.workflow_version,
|
|
95
|
+
status: row.status,
|
|
96
|
+
currentStepId: row.current_step_id,
|
|
97
|
+
currentFrontier: frontier,
|
|
98
|
+
hopCount: row.hop_count,
|
|
99
|
+
createdAt: row.created_at,
|
|
100
|
+
completedAt: row.completed_at,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=slice-workflow-binding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slice-workflow-binding.js","sourceRoot":"","sources":["../../../src/domain/workflow/slice-workflow-binding.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,sEAAsE;AACtE,4CAA4C;AAC5C,EAAE;AACF,8EAA8E;AAC9E,kFAAkF;AAClF,sDAAsD;AACtD,iEAAiE;AACjE,uDAAuD;AACvD,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,wEAAwE;AACxE,uEAAuE;AACvE,yDAAyD;AACzD,mEAAmE;AACnE,uEAAuE;AACvE,oDAAoD;AACpD,EAAE;AACF,mEAAmE;AACnE,qEAAqE;AACrE,0BAA0B;AAoC1B,MAAM,UAAU,wBAAwB,CACtC,EAAqB,EACrB,QAAkB;IAElB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,qBAAqB,EAAE,EAAE,EAAE,CAAC;IAE/E,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;IAEtC,iFAAiF;IACjF,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvD,MAAM,SAAS,GAAG,EAAE,CAAC,OAAO,CAC1B;kCA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|
|
|
1
|
+
import type { WorkflowSpec } from "../workflow-types.js";
|
|
2
|
+
export interface SpecGraphNode {
|
|
3
|
+
/** step.id (e.g., "discovery"). */
|
|
4
|
+
stepId: string;
|
|
5
|
+
/** Display label = step.role title with id fallback. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** step.actor_role (e.g., "discovery-router"). */
|
|
8
|
+
role: string;
|
|
9
|
+
/** First preferred_target seat for this role, when declared. UI uses
|
|
10
|
+
* this to compose PL-019 activity indicators on the spec node. */
|
|
11
|
+
preferredTarget: string | null;
|
|
12
|
+
/** True for the spec's entry step (the one workflow_instance starts on). */
|
|
13
|
+
isEntry: boolean;
|
|
14
|
+
/** True when this is the active step on the bound instance. */
|
|
15
|
+
isCurrent: boolean;
|
|
16
|
+
/** True when this step has no next_hop pointing forward (possible terminal). */
|
|
17
|
+
isTerminal: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface SpecGraphEdge {
|
|
20
|
+
fromStepId: string;
|
|
21
|
+
toStepId: string;
|
|
22
|
+
/** "direct" only at v1 — Phase D's spec format does not carry
|
|
23
|
+
* routing_type yet (audit row 6 carve-out). */
|
|
24
|
+
routingType: "direct";
|
|
25
|
+
/** True when this edge is the loop-back edge (target step earlier in
|
|
26
|
+
* declared order than source). UI uses this to optionally curve the
|
|
27
|
+
* edge differently from forward edges. */
|
|
28
|
+
isLoopBack: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface SpecGraphPayload {
|
|
31
|
+
specName: string;
|
|
32
|
+
specVersion: string;
|
|
33
|
+
nodes: SpecGraphNode[];
|
|
34
|
+
edges: SpecGraphEdge[];
|
|
35
|
+
}
|
|
36
|
+
export interface PhaseDefinition {
|
|
37
|
+
/** step.id (the canonical phase tag). */
|
|
38
|
+
id: string;
|
|
39
|
+
/** Human label = role title fallback to step.id. */
|
|
40
|
+
label: string;
|
|
41
|
+
role: string;
|
|
42
|
+
}
|
|
43
|
+
export interface CurrentStepPayload {
|
|
44
|
+
stepId: string;
|
|
45
|
+
role: string;
|
|
46
|
+
objective: string | null;
|
|
47
|
+
/** Phase D's WorkflowStepSpec.allowed_exits enum subset. */
|
|
48
|
+
allowedExits: string[];
|
|
49
|
+
/** Resolved next-step destinations from next_hop.suggested_roles
|
|
50
|
+
* mapped back to step ids. Empty array when no next_hop or no roles. */
|
|
51
|
+
allowedNextSteps: Array<{
|
|
52
|
+
stepId: string;
|
|
53
|
+
role: string;
|
|
54
|
+
reason: "next_hop";
|
|
55
|
+
}>;
|
|
56
|
+
hopCount: number;
|
|
57
|
+
instanceStatus: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Projects the spec graph for the Topology tab. Nodes are ordered by
|
|
61
|
+
* the spec's declared step order; edges are derived from each step's
|
|
62
|
+
* next_hop.suggested_roles list resolved back to step ids.
|
|
63
|
+
*/
|
|
64
|
+
export declare function projectSpecGraph(spec: WorkflowSpec, currentStepId: string | null): SpecGraphPayload;
|
|
65
|
+
/**
|
|
66
|
+
* Projects the spec's phase definitions. Each step contributes one phase
|
|
67
|
+
* (canonical tag = step.id; label = step.actor_role). The Story tab
|
|
68
|
+
* groups events by phase id when a step trail exists for the event's
|
|
69
|
+
* qitem; events without a trail mapping render in an "untagged" group
|
|
70
|
+
* (the UI decides the literal label).
|
|
71
|
+
*/
|
|
72
|
+
export declare function projectPhaseDefinitions(spec: WorkflowSpec): PhaseDefinition[];
|
|
73
|
+
/**
|
|
74
|
+
* Projects the Current Step payload from the spec + the bound instance's
|
|
75
|
+
* current_step_id. Returns null when current_step_id is null (terminal
|
|
76
|
+
* instance) or doesn't resolve against the spec (instance instantiated
|
|
77
|
+
* against a different spec version that has since changed shape — UI
|
|
78
|
+
* surfaces this as "current step unknown").
|
|
79
|
+
*/
|
|
80
|
+
export declare function projectCurrentStep(spec: WorkflowSpec, currentStepId: string | null, hopCount: number, instanceStatus: string): CurrentStepPayload | null;
|
|
81
|
+
//# sourceMappingURL=slice-workflow-projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slice-workflow-projection.d.ts","sourceRoot":"","sources":["../../../src/domain/workflow/slice-workflow-projection.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,sBAAsB,CAAC;AAE3E,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb;uEACmE;IACnE,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,4EAA4E;IAC5E,OAAO,EAAE,OAAO,CAAC;IACjB,+DAA+D;IAC/D,SAAS,EAAE,OAAO,CAAC;IACnB,gFAAgF;IAChF,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB;oDACgD;IAChD,WAAW,EAAE,QAAQ,CAAC;IACtB;;+CAE2C;IAC3C,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,4DAA4D;IAC5D,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB;6EACyE;IACzE,gBAAgB,EAAE,KAAK,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,UAAU,CAAA;KAAE,CAAC,CAAC;IAC9E,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,YAAY,EAClB,aAAa,EAAE,MAAM,GAAG,IAAI,GAC3B,gBAAgB,CA+ClB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,YAAY,GAAG,eAAe,EAAE,CAM7E;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,YAAY,EAClB,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GACrB,kBAAkB,GAAG,IAAI,CAuB3B"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Slice Story View v1 — workflow_spec → per-tab payload projection.
|
|
2
|
+
//
|
|
3
|
+
// Given a SliceWorkflowBinding (the resolved instance) and the bound
|
|
4
|
+
// WorkflowSpec (read through Phase D's WorkflowSpecCache), project the
|
|
5
|
+
// four v1-floor dimensions:
|
|
6
|
+
//
|
|
7
|
+
// 1. specGraph — nodes (one per step) + edges (from each step's
|
|
8
|
+
// next_hop.suggested_roles → next-step ids). All edges carry
|
|
9
|
+
// routingType: "direct" because Phase D's spec format does NOT
|
|
10
|
+
// yet have a routing_type field (per audit row 6 carve-out:
|
|
11
|
+
// dimension #4 ships as default-styled solid edges only;
|
|
12
|
+
// routing-type metadata is v2+).
|
|
13
|
+
// 2. phaseDefinitions — step.id → { label, role } so the Story tab
|
|
14
|
+
// can group events by spec-declared phase tags. Replaces v0's
|
|
15
|
+
// hardcoded legacy phase taxonomy with spec-driven mapping.
|
|
16
|
+
// 3. currentStep — bound instance's current_step_id resolved against
|
|
17
|
+
// the spec, returning step.objective + allowed_exits + the
|
|
18
|
+
// enumerated next-step destinations from next_hop.
|
|
19
|
+
// 4. eventPhaseFor(stepId) — convenience used by SliceDetailProjector
|
|
20
|
+
// to tag each StoryEvent with the spec's phase id when the event
|
|
21
|
+
// can be mapped to a step (via workflow_step_trails join). When
|
|
22
|
+
// there is no mapping, the event stays untagged (UI renders it in
|
|
23
|
+
// the "Other" or "Untagged" group).
|
|
24
|
+
/**
|
|
25
|
+
* Projects the spec graph for the Topology tab. Nodes are ordered by
|
|
26
|
+
* the spec's declared step order; edges are derived from each step's
|
|
27
|
+
* next_hop.suggested_roles list resolved back to step ids.
|
|
28
|
+
*/
|
|
29
|
+
export function projectSpecGraph(spec, currentStepId) {
|
|
30
|
+
const declaredOrder = spec.steps.map((s) => s.id);
|
|
31
|
+
const stepByRole = new Map();
|
|
32
|
+
for (const step of spec.steps) {
|
|
33
|
+
if (!stepByRole.has(step.actor_role))
|
|
34
|
+
stepByRole.set(step.actor_role, step);
|
|
35
|
+
}
|
|
36
|
+
const entryRole = spec.entry?.role ?? spec.steps[0]?.actor_role;
|
|
37
|
+
const entryStepId = entryRole ? stepByRole.get(entryRole)?.id : undefined;
|
|
38
|
+
const nodes = spec.steps.map((step) => {
|
|
39
|
+
const roleSpec = spec.roles[step.actor_role] ?? {};
|
|
40
|
+
const firstTarget = roleSpec.preferred_targets?.[0] ?? null;
|
|
41
|
+
return {
|
|
42
|
+
stepId: step.id,
|
|
43
|
+
label: step.actor_role,
|
|
44
|
+
role: step.actor_role,
|
|
45
|
+
preferredTarget: firstTarget,
|
|
46
|
+
isEntry: step.id === entryStepId,
|
|
47
|
+
isCurrent: step.id === currentStepId,
|
|
48
|
+
isTerminal: !hasNextHop(step),
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
const edges = [];
|
|
52
|
+
for (const step of spec.steps) {
|
|
53
|
+
const suggestedRoles = step.next_hop?.suggested_roles ?? [];
|
|
54
|
+
for (const role of suggestedRoles) {
|
|
55
|
+
const target = stepByRole.get(role);
|
|
56
|
+
if (!target)
|
|
57
|
+
continue;
|
|
58
|
+
const fromIdx = declaredOrder.indexOf(step.id);
|
|
59
|
+
const toIdx = declaredOrder.indexOf(target.id);
|
|
60
|
+
edges.push({
|
|
61
|
+
fromStepId: step.id,
|
|
62
|
+
toStepId: target.id,
|
|
63
|
+
routingType: "direct",
|
|
64
|
+
isLoopBack: toIdx >= 0 && fromIdx >= 0 && toIdx <= fromIdx,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
specName: spec.id,
|
|
70
|
+
specVersion: spec.version,
|
|
71
|
+
nodes,
|
|
72
|
+
edges,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Projects the spec's phase definitions. Each step contributes one phase
|
|
77
|
+
* (canonical tag = step.id; label = step.actor_role). The Story tab
|
|
78
|
+
* groups events by phase id when a step trail exists for the event's
|
|
79
|
+
* qitem; events without a trail mapping render in an "untagged" group
|
|
80
|
+
* (the UI decides the literal label).
|
|
81
|
+
*/
|
|
82
|
+
export function projectPhaseDefinitions(spec) {
|
|
83
|
+
return spec.steps.map((step) => ({
|
|
84
|
+
id: step.id,
|
|
85
|
+
label: step.actor_role,
|
|
86
|
+
role: step.actor_role,
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Projects the Current Step payload from the spec + the bound instance's
|
|
91
|
+
* current_step_id. Returns null when current_step_id is null (terminal
|
|
92
|
+
* instance) or doesn't resolve against the spec (instance instantiated
|
|
93
|
+
* against a different spec version that has since changed shape — UI
|
|
94
|
+
* surfaces this as "current step unknown").
|
|
95
|
+
*/
|
|
96
|
+
export function projectCurrentStep(spec, currentStepId, hopCount, instanceStatus) {
|
|
97
|
+
if (!currentStepId)
|
|
98
|
+
return null;
|
|
99
|
+
const step = spec.steps.find((s) => s.id === currentStepId);
|
|
100
|
+
if (!step)
|
|
101
|
+
return null;
|
|
102
|
+
const stepByRole = new Map();
|
|
103
|
+
for (const s of spec.steps) {
|
|
104
|
+
if (!stepByRole.has(s.actor_role))
|
|
105
|
+
stepByRole.set(s.actor_role, s);
|
|
106
|
+
}
|
|
107
|
+
const allowedNextSteps = [];
|
|
108
|
+
for (const role of step.next_hop?.suggested_roles ?? []) {
|
|
109
|
+
const target = stepByRole.get(role);
|
|
110
|
+
if (!target)
|
|
111
|
+
continue;
|
|
112
|
+
allowedNextSteps.push({ stepId: target.id, role, reason: "next_hop" });
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
stepId: step.id,
|
|
116
|
+
role: step.actor_role,
|
|
117
|
+
objective: step.objective ?? null,
|
|
118
|
+
allowedExits: [...(step.allowed_exits ?? [])],
|
|
119
|
+
allowedNextSteps,
|
|
120
|
+
hopCount,
|
|
121
|
+
instanceStatus,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function hasNextHop(step) {
|
|
125
|
+
return (step.next_hop?.suggested_roles ?? []).length > 0;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=slice-workflow-projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slice-workflow-projection.js","sourceRoot":"","sources":["../../../src/domain/workflow/slice-workflow-projection.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,kEAAkE;AAClE,oEAAoE;AACpE,iEAAiE;AACjE,8DAA8D;AAC9D,sCAAsC;AACtC,qEAAqE;AACrE,mEAAmE;AACnE,iEAAiE;AACjE,uEAAuE;AACvE,gEAAgE;AAChE,wDAAwD;AACxD,wEAAwE;AACxE,sEAAsE;AACtE,qEAAqE;AACrE,uEAAuE;AACvE,yCAAyC;AA8DzC;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,IAAkB,EAClB,aAA4B;IAE5B,MAAM,aAAa,GAAG,IAAI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C"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type WorkflowSpecCache } from "../workflow-spec-cache.js";
|
|
2
|
+
export interface StarterSpecLoadResult {
|
|
3
|
+
/** Specs newly seeded into the cache during this call. */
|
|
4
|
+
loaded: Array<{
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
sourcePath: string;
|
|
8
|
+
}>;
|
|
9
|
+
/** Specs that were already cached (operator override or prior startup). */
|
|
10
|
+
skipped: Array<{
|
|
11
|
+
name: string;
|
|
12
|
+
version: string;
|
|
13
|
+
sourcePathInCache: string;
|
|
14
|
+
}>;
|
|
15
|
+
/** Specs that failed to parse / load — surfaced for diagnostic logging. */
|
|
16
|
+
errors: Array<{
|
|
17
|
+
sourcePath: string;
|
|
18
|
+
code: string;
|
|
19
|
+
message: string;
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export interface StarterSpecLoaderOpts {
|
|
23
|
+
/** Phase D's workflow-spec-cache (already constructed in startup.ts). */
|
|
24
|
+
cache: WorkflowSpecCache;
|
|
25
|
+
/** Absolute directory containing built-in starter spec files (.yaml only at v0). */
|
|
26
|
+
builtinDir: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Walks the builtinDir and seeds each spec file into the cache, skipping
|
|
30
|
+
* those that are already cached for the same (name, version). Idempotent
|
|
31
|
+
* on repeated calls. Returns a structured result for diagnostic logging
|
|
32
|
+
* (which the daemon can log at INFO; tests assert on the shape).
|
|
33
|
+
*
|
|
34
|
+
* If the builtinDir doesn't exist, returns an empty result (no error) —
|
|
35
|
+
* a daemon shipped without bundled starter specs is a valid configuration.
|
|
36
|
+
*/
|
|
37
|
+
export declare function loadStarterWorkflowSpecs(opts: StarterSpecLoaderOpts): StarterSpecLoadResult;
|
|
38
|
+
/**
|
|
39
|
+
* Resolves the default built-in starter directory relative to this
|
|
40
|
+
* loader file's location on disk. Works in both dev (running from
|
|
41
|
+
* `src/`) and prod (running from `dist/`) — the build step copies the
|
|
42
|
+
* workflow spec files to `dist/builtins/workflow-specs/` when bundled
|
|
43
|
+
* specs are present, so the resolved path works in both layouts.
|
|
44
|
+
*
|
|
45
|
+
* Layout: this file is at `<pkg>/{src|dist}/domain/workflow/`. The
|
|
46
|
+
* built-in dir is at `<pkg>/{src|dist}/builtins/workflow-specs/`. Two
|
|
47
|
+
* levels up from this file's dirname is the package's src/ or dist/
|
|
48
|
+
* root.
|
|
49
|
+
*/
|
|
50
|
+
export declare function defaultBuiltinSpecsDir(): string;
|
|
51
|
+
//# sourceMappingURL=starter-spec-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"starter-spec-loader.d.ts","sourceRoot":"","sources":["../../../src/domain/workflow/starter-spec-loader.ts"],"names":[],"mappings":"AA0BA,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,WAAW,qBAAqB;IACpC,0DAA0D;IAC1D,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrE,2EAA2E;IAC3E,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7E,2EAA2E;IAC3E,MAAM,EAAE,KAAK,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,qBAAqB;IACpC,yEAAyE;IACzE,KAAK,EAAE,iBAAiB,CAAC;IACzB,oFAAoF;IACpF,UAAU,EAAE,MAAM,CAAC;CACpB;AAID;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,qBAAqB,GAAG,qBAAqB,CAkF3F;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,CAK/C"}
|