@openrig/cli 0.3.0 → 0.3.2
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 +1 -3
- package/daemon/dist/adapters/claude-code-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/claude-code-adapter.js +17 -57
- 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 +45 -58
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +36 -0
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +66 -0
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/db/migrations/037_mission_control_actions.d.ts +5 -1
- package/daemon/dist/db/migrations/037_mission_control_actions.d.ts.map +1 -1
- package/daemon/dist/db/migrations/037_mission_control_actions.js +5 -1
- package/daemon/dist/db/migrations/037_mission_control_actions.js.map +1 -1
- 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/db/migrations/041_rig_policy.d.ts +32 -0
- package/daemon/dist/db/migrations/041_rig_policy.d.ts.map +1 -0
- package/daemon/dist/db/migrations/041_rig_policy.js +47 -0
- package/daemon/dist/db/migrations/041_rig_policy.js.map +1 -0
- package/daemon/dist/domain/agent-images/resume-token-discovery.js +1 -1
- package/daemon/dist/domain/agent-images/resume-token-discovery.js.map +1 -1
- package/daemon/dist/domain/agent-images/snapshot-capturer.d.ts.map +1 -1
- package/daemon/dist/domain/agent-images/snapshot-capturer.js +2 -1
- package/daemon/dist/domain/agent-images/snapshot-capturer.js.map +1 -1
- package/daemon/dist/domain/agent-manifest.d.ts.map +1 -1
- package/daemon/dist/domain/agent-manifest.js +143 -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/bootstrap-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/bootstrap-orchestrator.js +86 -6
- package/daemon/dist/domain/bootstrap-orchestrator.js.map +1 -1
- package/daemon/dist/domain/bundle-agent-images-router.d.ts +95 -0
- package/daemon/dist/domain/bundle-agent-images-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-agent-images-router.js +140 -0
- package/daemon/dist/domain/bundle-agent-images-router.js.map +1 -0
- package/daemon/dist/domain/bundle-assembler.d.ts +18 -1
- package/daemon/dist/domain/bundle-assembler.d.ts.map +1 -1
- package/daemon/dist/domain/bundle-assembler.js +11 -1
- package/daemon/dist/domain/bundle-assembler.js.map +1 -1
- package/daemon/dist/domain/bundle-audit.d.ts +89 -0
- package/daemon/dist/domain/bundle-audit.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-audit.js +87 -0
- package/daemon/dist/domain/bundle-audit.js.map +1 -0
- package/daemon/dist/domain/bundle-conflict-detector.d.ts +57 -0
- package/daemon/dist/domain/bundle-conflict-detector.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-conflict-detector.js +49 -0
- package/daemon/dist/domain/bundle-conflict-detector.js.map +1 -0
- package/daemon/dist/domain/bundle-context-packs-router.d.ts +100 -0
- package/daemon/dist/domain/bundle-context-packs-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-context-packs-router.js +158 -0
- package/daemon/dist/domain/bundle-context-packs-router.js.map +1 -0
- package/daemon/dist/domain/bundle-plugins-router.d.ts +69 -0
- package/daemon/dist/domain/bundle-plugins-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-plugins-router.js +87 -0
- package/daemon/dist/domain/bundle-plugins-router.js.map +1 -0
- package/daemon/dist/domain/bundle-skills-router.d.ts +62 -0
- package/daemon/dist/domain/bundle-skills-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-skills-router.js +90 -0
- package/daemon/dist/domain/bundle-skills-router.js.map +1 -0
- package/daemon/dist/domain/bundle-types.d.ts +106 -0
- package/daemon/dist/domain/bundle-types.d.ts.map +1 -1
- package/daemon/dist/domain/bundle-types.js +375 -0
- package/daemon/dist/domain/bundle-types.js.map +1 -1
- package/daemon/dist/domain/bundle-workflow-specs-router.d.ts +94 -0
- package/daemon/dist/domain/bundle-workflow-specs-router.d.ts.map +1 -0
- package/daemon/dist/domain/bundle-workflow-specs-router.js +144 -0
- package/daemon/dist/domain/bundle-workflow-specs-router.js.map +1 -0
- 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/context-monitor.d.ts +19 -1
- package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
- package/daemon/dist/domain/context-monitor.js +62 -14
- package/daemon/dist/domain/context-monitor.js.map +1 -1
- package/daemon/dist/domain/graph-projection.d.ts +6 -0
- package/daemon/dist/domain/graph-projection.d.ts.map +1 -1
- package/daemon/dist/domain/graph-projection.js +6 -0
- package/daemon/dist/domain/graph-projection.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/mission-control/mission-control-read-layer.d.ts +5 -0
- package/daemon/dist/domain/mission-control/mission-control-read-layer.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-read-layer.js +16 -2
- package/daemon/dist/domain/mission-control/mission-control-read-layer.js.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.d.ts.map +1 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js +3 -1
- package/daemon/dist/domain/mission-control/mission-control-write-contract.js.map +1 -1
- package/daemon/dist/domain/native-resume-probe.js +7 -7
- package/daemon/dist/domain/native-resume-probe.js.map +1 -1
- package/daemon/dist/domain/node-inventory.d.ts +18 -0
- package/daemon/dist/domain/node-inventory.d.ts.map +1 -1
- package/daemon/dist/domain/node-inventory.js +98 -0
- package/daemon/dist/domain/node-inventory.js.map +1 -1
- package/daemon/dist/domain/node-launcher.d.ts +12 -0
- package/daemon/dist/domain/node-launcher.d.ts.map +1 -1
- package/daemon/dist/domain/node-launcher.js +25 -1
- 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/pod-bundle-assembler.d.ts +16 -1
- package/daemon/dist/domain/pod-bundle-assembler.d.ts.map +1 -1
- package/daemon/dist/domain/pod-bundle-assembler.js +11 -1
- package/daemon/dist/domain/pod-bundle-assembler.js.map +1 -1
- package/daemon/dist/domain/profile-resolver.d.ts +13 -3
- package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/profile-resolver.js +11 -7
- package/daemon/dist/domain/profile-resolver.js.map +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/ps-projection.d.ts +22 -0
- package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
- package/daemon/dist/domain/ps-projection.js +57 -0
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +44 -1
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +112 -6
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/restore-check-service.d.ts +4 -0
- package/daemon/dist/domain/restore-check-service.d.ts.map +1 -1
- package/daemon/dist/domain/restore-check-service.js +16 -7
- package/daemon/dist/domain/restore-check-service.js.map +1 -1
- package/daemon/dist/domain/rig-policy/rig-policy-defaults.d.ts +48 -0
- package/daemon/dist/domain/rig-policy/rig-policy-defaults.d.ts.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-defaults.js +96 -0
- package/daemon/dist/domain/rig-policy/rig-policy-defaults.js.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-store.d.ts +46 -0
- package/daemon/dist/domain/rig-policy/rig-policy-store.d.ts.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-store.js +171 -0
- package/daemon/dist/domain/rig-policy/rig-policy-store.js.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-types.d.ts +145 -0
- package/daemon/dist/domain/rig-policy/rig-policy-types.d.ts.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-types.js +52 -0
- package/daemon/dist/domain/rig-policy/rig-policy-types.js.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-validator.d.ts +58 -0
- package/daemon/dist/domain/rig-policy/rig-policy-validator.d.ts.map +1 -0
- package/daemon/dist/domain/rig-policy/rig-policy-validator.js +211 -0
- package/daemon/dist/domain/rig-policy/rig-policy-validator.js.map +1 -0
- package/daemon/dist/domain/rigspec-instantiator.d.ts +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +109 -18
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/seat-activity-service.d.ts +79 -0
- package/daemon/dist/domain/seat-activity-service.d.ts.map +1 -0
- package/daemon/dist/domain/seat-activity-service.js +123 -0
- package/daemon/dist/domain/seat-activity-service.js.map +1 -0
- 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-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-indexer.d.ts +31 -0
- package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.js +111 -6
- package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
- package/daemon/dist/domain/spec-library-service.d.ts +6 -0
- package/daemon/dist/domain/spec-library-service.d.ts.map +1 -1
- package/daemon/dist/domain/spec-library-service.js +19 -0
- package/daemon/dist/domain/spec-library-service.js.map +1 -1
- package/daemon/dist/domain/spec-library-workflow-scanner.d.ts +43 -0
- package/daemon/dist/domain/spec-library-workflow-scanner.d.ts.map +1 -1
- package/daemon/dist/domain/spec-library-workflow-scanner.js +157 -3
- package/daemon/dist/domain/spec-library-workflow-scanner.js.map +1 -1
- 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/types.d.ts +106 -10
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts +25 -1
- package/daemon/dist/domain/user-settings/settings-store.d.ts.map +1 -1
- package/daemon/dist/domain/user-settings/settings-store.js +186 -4
- package/daemon/dist/domain/user-settings/settings-store.js.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.d.ts +49 -0
- package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.js +96 -0
- package/daemon/dist/domain/workflow-spec-cache.js.map +1 -1
- package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts +7 -0
- package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts.map +1 -1
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js +201 -3
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -1
- 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-doctor.d.ts +197 -0
- package/daemon/dist/domain/workspace/workspace-doctor.d.ts.map +1 -0
- package/daemon/dist/domain/workspace/workspace-doctor.js +448 -0
- package/daemon/dist/domain/workspace/workspace-doctor.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 +63 -17
- 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 +47 -5
- package/daemon/dist/middleware/auth-bearer-token.d.ts.map +1 -1
- package/daemon/dist/middleware/auth-bearer-token.js +109 -8
- package/daemon/dist/middleware/auth-bearer-token.js.map +1 -1
- package/daemon/dist/routes/bundles.d.ts.map +1 -1
- package/daemon/dist/routes/bundles.js +966 -7
- package/daemon/dist/routes/bundles.js.map +1 -1
- package/daemon/dist/routes/config.d.ts.map +1 -1
- package/daemon/dist/routes/config.js +19 -2
- package/daemon/dist/routes/config.js.map +1 -1
- package/daemon/dist/routes/info.d.ts +3 -0
- package/daemon/dist/routes/info.d.ts.map +1 -0
- package/daemon/dist/routes/info.js +20 -0
- package/daemon/dist/routes/info.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.map +1 -1
- package/daemon/dist/routes/mission-control.js +25 -2
- package/daemon/dist/routes/mission-control.js.map +1 -1
- 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/queue.d.ts +18 -0
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +97 -5
- 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/rig-policy.d.ts +9 -0
- package/daemon/dist/routes/rig-policy.d.ts.map +1 -0
- package/daemon/dist/routes/rig-policy.js +174 -0
- package/daemon/dist/routes/rig-policy.js.map +1 -0
- package/daemon/dist/routes/rigs.d.ts.map +1 -1
- package/daemon/dist/routes/rigs.js +10 -2
- package/daemon/dist/routes/rigs.js.map +1 -1
- package/daemon/dist/routes/sessions.d.ts.map +1 -1
- package/daemon/dist/routes/sessions.js +26 -3
- 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.map +1 -1
- package/daemon/dist/routes/slices.js +15 -0
- package/daemon/dist/routes/slices.js.map +1 -1
- package/daemon/dist/routes/spec-library.d.ts.map +1 -1
- package/daemon/dist/routes/spec-library.js +16 -1
- package/daemon/dist/routes/spec-library.js.map +1 -1
- package/daemon/dist/routes/up.d.ts +25 -0
- package/daemon/dist/routes/up.d.ts.map +1 -1
- package/daemon/dist/routes/up.js +70 -3
- package/daemon/dist/routes/up.js.map +1 -1
- package/daemon/dist/routes/workspace.d.ts.map +1 -1
- package/daemon/dist/routes/workspace.js +80 -1
- package/daemon/dist/routes/workspace.js.map +1 -1
- package/daemon/dist/server.d.ts +41 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +41 -0
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +236 -6
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/specs/agents/apps/vault-specialist/agent.yaml +0 -1
- package/daemon/specs/agents/conveyor/builder/agent.yaml +0 -1
- package/daemon/specs/agents/conveyor/lead/agent.yaml +0 -1
- package/daemon/specs/agents/conveyor/planner/agent.yaml +0 -1
- package/daemon/specs/agents/conveyor/reviewer/agent.yaml +0 -1
- package/daemon/specs/agents/design/product-designer/agent.yaml +0 -1
- package/daemon/specs/agents/development/implementer/agent.yaml +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 +0 -1
- package/daemon/specs/agents/orchestration/orchestrator/guidance/role.md +28 -4
- 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 -6
- 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 +288 -6
- package/daemon/specs/agents/shared/skills/core/openrig-user-settings/SKILL.md +4 -4
- 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/rig.yaml +1 -1
- 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/dist/client.d.ts +3 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +13 -1
- package/dist/client.js.map +1 -1
- package/dist/commands/bundle.d.ts.map +1 -1
- package/dist/commands/bundle.js +123 -2
- package/dist/commands/bundle.js.map +1 -1
- package/dist/commands/config-init-workspace.d.ts.map +1 -1
- package/dist/commands/config-init-workspace.js +293 -5
- package/dist/commands/config-init-workspace.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +11 -3
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +53 -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/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 +51 -8
- package/dist/commands/ps.js.map +1 -1
- package/dist/commands/queue.d.ts +6 -0
- package/dist/commands/queue.d.ts.map +1 -1
- package/dist/commands/queue.js +103 -5
- package/dist/commands/queue.js.map +1 -1
- package/dist/commands/rig-policy.d.ts +48 -0
- package/dist/commands/rig-policy.d.ts.map +1 -0
- package/dist/commands/rig-policy.js +429 -0
- package/dist/commands/rig-policy.js.map +1 -0
- package/dist/commands/scope.d.ts +6 -0
- package/dist/commands/scope.d.ts.map +1 -0
- package/dist/commands/scope.js +659 -0
- package/dist/commands/scope.js.map +1 -0
- package/dist/commands/send.d.ts +8 -0
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +8 -0
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +60 -1
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/workflow.d.ts +9 -0
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +139 -1
- package/dist/commands/workflow.js.map +1 -1
- package/dist/commands/workspace.d.ts +20 -0
- package/dist/commands/workspace.d.ts.map +1 -1
- package/dist/commands/workspace.js +138 -7
- package/dist/commands/workspace.js.map +1 -1
- package/dist/config-store.d.ts +18 -1
- package/dist/config-store.d.ts.map +1 -1
- package/dist/config-store.js +167 -4
- package/dist/config-store.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +45 -2
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +90 -9
- 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 +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/scope/dot-id.d.ts +43 -0
- package/dist/lib/scope/dot-id.d.ts.map +1 -0
- package/dist/lib/scope/dot-id.js +165 -0
- package/dist/lib/scope/dot-id.js.map +1 -0
- package/dist/lib/scope/scope-fs.d.ts +79 -0
- package/dist/lib/scope/scope-fs.d.ts.map +1 -0
- package/dist/lib/scope/scope-fs.js +468 -0
- package/dist/lib/scope/scope-fs.js.map +1 -0
- package/dist/lib/scope/templates.d.ts +38 -0
- package/dist/lib/scope/templates.d.ts.map +1 -0
- package/dist/lib/scope/templates.js +109 -0
- package/dist/lib/scope/templates.js.map +1 -0
- package/dist/lib/scope/types.d.ts +61 -0
- package/dist/lib/scope/types.d.ts.map +1 -0
- package/dist/lib/scope/types.js +38 -0
- package/dist/lib/scope/types.js.map +1 -0
- package/dist/lib/scope-templates/backlog-deprecation.md +26 -0
- package/dist/lib/scope-templates/backlog-tech-debt.md +22 -0
- package/dist/lib/scope-templates/bug-fix.md +30 -0
- package/dist/lib/scope-templates/mission-notes.md +97 -0
- package/dist/lib/scope-templates/mission-placeholder.md +20 -0
- package/dist/lib/scope-templates/mission-release.md +25 -0
- package/dist/lib/scope-templates/placeholder.md +30 -0
- package/dist/lib/scope-templates/release-feature.md +26 -0
- package/dist/lib/scope-templates/research.md +22 -0
- package/package.json +2 -2
- package/ui/dist/assets/index-C_Q5FczU.css +1 -0
- package/ui/dist/assets/index-GjTxfi9S.js +547 -0
- package/ui/dist/index.html +2 -2
- package/daemon/specs/agents/shared/skills/claude-compact-in-place/SKILL.md +0 -100
- 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-BDHU1JUK.js +0 -412
- package/ui/dist/assets/index-DXTyJSqu.css +0 -1
|
@@ -0,0 +1,468 @@
|
|
|
1
|
+
// Phase 3a slice 3.3 — Plugin Discovery Service.
|
|
2
|
+
//
|
|
3
|
+
// SC-29 EXCEPTION #8 declared verbatim:
|
|
4
|
+
// "Slice 3.3 (UI plugin surface) requires daemon-side plugin-discovery-service
|
|
5
|
+
// + 3 HTTP routes (GET /api/plugins, GET /api/plugins/:id, GET /api/plugins/:id/used-by)
|
|
6
|
+
// as backing API. No additional state, no SQL migration, no mutation routes.
|
|
7
|
+
// Read-only discovery surface aggregating filesystem-scan unions per
|
|
8
|
+
// DESIGN.md §5.4. Per IMPL-PRD §3.3 'Code touches' this allocation is explicit;
|
|
9
|
+
// documenting in compliance with banked SC-29 verbatim-declaration rule."
|
|
10
|
+
//
|
|
11
|
+
// What it does (DESIGN.md §5.4 — auto-discovery library = derived view):
|
|
12
|
+
// - Scans 3 filesystem roots for plugin manifests:
|
|
13
|
+
// * ~/.openrig/plugins/<id>/ (vendored)
|
|
14
|
+
// * ~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/ (claude cache)
|
|
15
|
+
// * ~/.codex/plugins/cache/<marketplace>/<plugin>/<version>/ (codex cache)
|
|
16
|
+
// - Returns aggregated list with provenance labels per source root.
|
|
17
|
+
// - For getPlugin(id), reads .claude-plugin/plugin.json and/or .codex-plugin/plugin.json
|
|
18
|
+
// and summarizes the tree (skills/, hooks, mcp_servers, etc.) so the UI
|
|
19
|
+
// viewer can show what the plugin ships without re-reading files.
|
|
20
|
+
// - For findUsedBy(id), parses agent.yaml files in the spec library and
|
|
21
|
+
// walks resources.plugins[].id to collect references. Operates on parsed
|
|
22
|
+
// YAML structure (NOT string-grep) so comments + adjacent text don't
|
|
23
|
+
// produce false positives.
|
|
24
|
+
//
|
|
25
|
+
// Branch-merge-friendly: this service operates on filesystem reads + parsed
|
|
26
|
+
// YAML; doesn't depend on batch 1's PluginResource type from
|
|
27
|
+
// plugin-primitive-v0 branch. The agent YAML structure it reads
|
|
28
|
+
// (resources.plugins[].id + profile.uses.plugins[]) is exactly what batch 1
|
|
29
|
+
// produces, so post-merge the service continues to work unchanged.
|
|
30
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
31
|
+
import { join, basename } from "node:path";
|
|
32
|
+
import { parse as parseYaml } from "yaml";
|
|
33
|
+
const CLAUDE_MANIFEST_REL = ".claude-plugin/plugin.json";
|
|
34
|
+
const CODEX_MANIFEST_REL = ".codex-plugin/plugin.json";
|
|
35
|
+
export class PluginDiscoveryService {
|
|
36
|
+
opts;
|
|
37
|
+
constructor(opts) {
|
|
38
|
+
this.opts = opts;
|
|
39
|
+
}
|
|
40
|
+
listPlugins(filterOpts = {}) {
|
|
41
|
+
const out = [];
|
|
42
|
+
// 1. Vendored OpenRig plugins.
|
|
43
|
+
if (existsSync(this.opts.openrigPluginsDir)) {
|
|
44
|
+
for (const entry of safeReaddir(this.opts.openrigPluginsDir)) {
|
|
45
|
+
const pluginPath = join(this.opts.openrigPluginsDir, entry);
|
|
46
|
+
if (!isDir(pluginPath))
|
|
47
|
+
continue;
|
|
48
|
+
const detected = this.detectPlugin(pluginPath, "vendored", entry);
|
|
49
|
+
if (detected)
|
|
50
|
+
out.push(detected);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// 2. Claude Code cache: ~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/
|
|
54
|
+
if (existsSync(this.opts.claudeCacheDir)) {
|
|
55
|
+
for (const marketplace of safeReaddir(this.opts.claudeCacheDir)) {
|
|
56
|
+
const marketplacePath = join(this.opts.claudeCacheDir, marketplace);
|
|
57
|
+
if (!isDir(marketplacePath))
|
|
58
|
+
continue;
|
|
59
|
+
for (const plugin of safeReaddir(marketplacePath)) {
|
|
60
|
+
const pluginRoot = join(marketplacePath, plugin);
|
|
61
|
+
if (!isDir(pluginRoot))
|
|
62
|
+
continue;
|
|
63
|
+
for (const version of safeReaddir(pluginRoot)) {
|
|
64
|
+
const versionPath = join(pluginRoot, version);
|
|
65
|
+
if (!isDir(versionPath))
|
|
66
|
+
continue;
|
|
67
|
+
const id = `claude-cache:${marketplace}/${plugin}/${version}`;
|
|
68
|
+
const sourceLabel = `claude-cache:${marketplace}/${plugin}/${version}`;
|
|
69
|
+
const detected = this.detectPlugin(versionPath, "claude-cache", id, sourceLabel);
|
|
70
|
+
if (detected)
|
|
71
|
+
out.push(detected);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// 3. Codex cache: ~/.codex/plugins/cache/<marketplace>/<plugin>/<version>/
|
|
77
|
+
if (existsSync(this.opts.codexCacheDir)) {
|
|
78
|
+
for (const marketplace of safeReaddir(this.opts.codexCacheDir)) {
|
|
79
|
+
const marketplacePath = join(this.opts.codexCacheDir, marketplace);
|
|
80
|
+
if (!isDir(marketplacePath))
|
|
81
|
+
continue;
|
|
82
|
+
for (const plugin of safeReaddir(marketplacePath)) {
|
|
83
|
+
const pluginRoot = join(marketplacePath, plugin);
|
|
84
|
+
if (!isDir(pluginRoot))
|
|
85
|
+
continue;
|
|
86
|
+
for (const version of safeReaddir(pluginRoot)) {
|
|
87
|
+
const versionPath = join(pluginRoot, version);
|
|
88
|
+
if (!isDir(versionPath))
|
|
89
|
+
continue;
|
|
90
|
+
const id = `codex-cache:${marketplace}/${plugin}/${version}`;
|
|
91
|
+
const sourceLabel = `codex-cache:${marketplace}/${plugin}/${version}`;
|
|
92
|
+
const detected = this.detectPlugin(versionPath, "codex-cache", id, sourceLabel);
|
|
93
|
+
if (detected)
|
|
94
|
+
out.push(detected);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
// 4. Slice 3.3 fix-C — rig-bundled cwd plugin roots.
|
|
100
|
+
// Per-call opts override constructor opts; effective cwd set is the
|
|
101
|
+
// union when both are present (per-call wins by replacement, NOT
|
|
102
|
+
// append-to-constructor, because the API layer's ?cwd=<path> intent
|
|
103
|
+
// is "ALL plugins this specific rig sees" — predictable + cacheable).
|
|
104
|
+
const effectiveCwds = filterOpts.cwdScanRoots ?? this.opts.cwdScanRoots ?? [];
|
|
105
|
+
for (const cwd of effectiveCwds) {
|
|
106
|
+
this.scanCwdBundledPlugins(cwd, out);
|
|
107
|
+
}
|
|
108
|
+
let filtered = out;
|
|
109
|
+
if (filterOpts.runtimeFilter) {
|
|
110
|
+
filtered = filtered.filter((p) => p.runtimes.includes(filterOpts.runtimeFilter));
|
|
111
|
+
}
|
|
112
|
+
if (filterOpts.sourceFilter) {
|
|
113
|
+
filtered = filtered.filter((p) => p.source === filterOpts.sourceFilter);
|
|
114
|
+
}
|
|
115
|
+
return filtered;
|
|
116
|
+
}
|
|
117
|
+
// Slice 3.3 fix-C — scan a single rig cwd for `.claude/plugins/*` +
|
|
118
|
+
// `.codex/plugins/*` bundles. Emits one PluginEntry per discovered
|
|
119
|
+
// plugin manifest (matches the same detection rule as the other
|
|
120
|
+
// source roots: presence of `.claude-plugin/plugin.json` and/or
|
|
121
|
+
// `.codex-plugin/plugin.json` inside the plugin folder).
|
|
122
|
+
scanCwdBundledPlugins(cwd, out) {
|
|
123
|
+
if (!existsSync(cwd))
|
|
124
|
+
return;
|
|
125
|
+
const claudePluginsDir = join(cwd, ".claude", "plugins");
|
|
126
|
+
if (existsSync(claudePluginsDir)) {
|
|
127
|
+
for (const entry of safeReaddir(claudePluginsDir)) {
|
|
128
|
+
const pluginPath = join(claudePluginsDir, entry);
|
|
129
|
+
if (!isDir(pluginPath))
|
|
130
|
+
continue;
|
|
131
|
+
const id = `rig-cwd:${cwd}/.claude/plugins/${entry}`;
|
|
132
|
+
const sourceLabel = `rig-cwd:${basename(cwd)}/${entry}`;
|
|
133
|
+
const detected = this.detectPlugin(pluginPath, "rig-cwd", id, sourceLabel);
|
|
134
|
+
if (detected)
|
|
135
|
+
out.push(detected);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const codexPluginsDir = join(cwd, ".codex", "plugins");
|
|
139
|
+
if (existsSync(codexPluginsDir)) {
|
|
140
|
+
for (const entry of safeReaddir(codexPluginsDir)) {
|
|
141
|
+
const pluginPath = join(codexPluginsDir, entry);
|
|
142
|
+
if (!isDir(pluginPath))
|
|
143
|
+
continue;
|
|
144
|
+
const id = `rig-cwd:${cwd}/.codex/plugins/${entry}`;
|
|
145
|
+
const sourceLabel = `rig-cwd:${basename(cwd)}/${entry}`;
|
|
146
|
+
const detected = this.detectPlugin(pluginPath, "rig-cwd", id, sourceLabel);
|
|
147
|
+
if (detected)
|
|
148
|
+
out.push(detected);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
getPlugin(id) {
|
|
153
|
+
// Slice 3.3 fix-iteration — rig-cwd: IDs are self-resolvable.
|
|
154
|
+
// Pre-fix, getPlugin called this.listPlugins() (no opts), which
|
|
155
|
+
// excluded rig-cwd entries because cwdScanRoots is empty by default.
|
|
156
|
+
// Result: /api/plugins?cwd= returned a rig-cwd id, /api/plugins/:id
|
|
157
|
+
// 404'd on the same id (redo-guard-2 BLOCK item 1). Fix: parse the
|
|
158
|
+
// cwd out of the rig-cwd: prefix and pass it as cwdScanRoots so
|
|
159
|
+
// the entry is in the list. ID format constructed in
|
|
160
|
+
// scanCwdBundledPlugins:
|
|
161
|
+
// rig-cwd:<cwd>/.claude/plugins/<plugin>
|
|
162
|
+
// rig-cwd:<cwd>/.codex/plugins/<plugin>
|
|
163
|
+
const cwdScanRoots = extractCwdFromRigCwdId(id);
|
|
164
|
+
const entry = this.listPlugins(cwdScanRoots ? { cwdScanRoots } : {}).find((p) => p.id === id);
|
|
165
|
+
if (!entry)
|
|
166
|
+
return null;
|
|
167
|
+
const claudeManifestPath = join(entry.path, CLAUDE_MANIFEST_REL);
|
|
168
|
+
const codexManifestPath = join(entry.path, CODEX_MANIFEST_REL);
|
|
169
|
+
const claudeManifest = readManifest(claudeManifestPath);
|
|
170
|
+
const codexManifest = readManifest(codexManifestPath);
|
|
171
|
+
const skills = [];
|
|
172
|
+
const skillsDir = join(entry.path, "skills");
|
|
173
|
+
if (existsSync(skillsDir)) {
|
|
174
|
+
for (const skillName of safeReaddir(skillsDir)) {
|
|
175
|
+
const skillPath = join(skillsDir, skillName);
|
|
176
|
+
if (isDir(skillPath)) {
|
|
177
|
+
skills.push({ name: skillName, relativePath: `skills/${skillName}` });
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
const hooks = [];
|
|
182
|
+
const hooksDir = join(entry.path, "hooks");
|
|
183
|
+
if (existsSync(hooksDir)) {
|
|
184
|
+
const claudeHooks = join(hooksDir, "claude.json");
|
|
185
|
+
if (existsSync(claudeHooks)) {
|
|
186
|
+
hooks.push({
|
|
187
|
+
runtime: "claude",
|
|
188
|
+
relativePath: "hooks/claude.json",
|
|
189
|
+
events: extractHookEvents(claudeHooks),
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
const codexHooks = join(hooksDir, "codex.json");
|
|
193
|
+
if (existsSync(codexHooks)) {
|
|
194
|
+
hooks.push({
|
|
195
|
+
runtime: "codex",
|
|
196
|
+
relativePath: "hooks/codex.json",
|
|
197
|
+
events: extractHookEvents(codexHooks),
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
// Slice 3.3 fix-A — MCP server discovery from each runtime's manifest.
|
|
202
|
+
const mcpServers = [
|
|
203
|
+
...readMcpServers(claudeManifest, "claude"),
|
|
204
|
+
...readMcpServers(codexManifest, "codex"),
|
|
205
|
+
];
|
|
206
|
+
return { entry, claudeManifest, codexManifest, skills, hooks, mcpServers };
|
|
207
|
+
}
|
|
208
|
+
findUsedBy(pluginId) {
|
|
209
|
+
const refs = [];
|
|
210
|
+
if (!existsSync(this.opts.specLibraryDir))
|
|
211
|
+
return refs;
|
|
212
|
+
for (const candidate of walkAgentYamls(this.opts.specLibraryDir)) {
|
|
213
|
+
const parsed = safeParseYaml(candidate.content);
|
|
214
|
+
if (!parsed || typeof parsed !== "object")
|
|
215
|
+
continue;
|
|
216
|
+
const resourcesPlugins = readResourcesPlugins(parsed);
|
|
217
|
+
const declaresThisPlugin = resourcesPlugins.some((p) => p === pluginId);
|
|
218
|
+
if (!declaresThisPlugin)
|
|
219
|
+
continue;
|
|
220
|
+
const profiles = readProfilesUsingPlugin(parsed, pluginId);
|
|
221
|
+
const agentName = readField(parsed, "name");
|
|
222
|
+
if (!agentName)
|
|
223
|
+
continue;
|
|
224
|
+
refs.push({ agentName, sourcePath: candidate.path, profiles });
|
|
225
|
+
}
|
|
226
|
+
return refs;
|
|
227
|
+
}
|
|
228
|
+
// -- helpers --
|
|
229
|
+
detectPlugin(pluginPath, source, explicitId, explicitSourceLabel) {
|
|
230
|
+
const claudeManifestPath = join(pluginPath, CLAUDE_MANIFEST_REL);
|
|
231
|
+
const codexManifestPath = join(pluginPath, CODEX_MANIFEST_REL);
|
|
232
|
+
const hasClaude = existsSync(claudeManifestPath);
|
|
233
|
+
const hasCodex = existsSync(codexManifestPath);
|
|
234
|
+
if (!hasClaude && !hasCodex)
|
|
235
|
+
return null;
|
|
236
|
+
const runtimes = [];
|
|
237
|
+
if (hasClaude)
|
|
238
|
+
runtimes.push("claude");
|
|
239
|
+
if (hasCodex)
|
|
240
|
+
runtimes.push("codex");
|
|
241
|
+
// Read the first available manifest for name/version/description.
|
|
242
|
+
const primaryManifestPath = hasClaude ? claudeManifestPath : codexManifestPath;
|
|
243
|
+
const manifest = readManifest(primaryManifestPath);
|
|
244
|
+
if (!manifest)
|
|
245
|
+
return null;
|
|
246
|
+
const name = manifest.name ?? basename(pluginPath);
|
|
247
|
+
const version = manifest.version ?? "unknown";
|
|
248
|
+
const description = manifest.description;
|
|
249
|
+
const sourceLabel = explicitSourceLabel ?? `vendored:${name}`;
|
|
250
|
+
let lastSeenAt = null;
|
|
251
|
+
try {
|
|
252
|
+
const stat = statSync(primaryManifestPath);
|
|
253
|
+
lastSeenAt = stat.mtime.toISOString();
|
|
254
|
+
}
|
|
255
|
+
catch {
|
|
256
|
+
lastSeenAt = null;
|
|
257
|
+
}
|
|
258
|
+
// Slice 28 — skillCount: count subdirectories under <plugin>/skills/.
|
|
259
|
+
// Matches the detail-side enumeration in getPlugin() which also
|
|
260
|
+
// collects subdirs under that path (no .md filtering at this level
|
|
261
|
+
// — every shipped skill folder counts, whether or not it has
|
|
262
|
+
// landed a SKILL.md yet).
|
|
263
|
+
let skillCount = 0;
|
|
264
|
+
const skillsDir = join(pluginPath, "skills");
|
|
265
|
+
if (existsSync(skillsDir)) {
|
|
266
|
+
for (const entry of safeReaddir(skillsDir)) {
|
|
267
|
+
if (isDir(join(skillsDir, entry)))
|
|
268
|
+
skillCount += 1;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
return {
|
|
272
|
+
id: explicitId,
|
|
273
|
+
name,
|
|
274
|
+
version,
|
|
275
|
+
description,
|
|
276
|
+
source,
|
|
277
|
+
sourceLabel,
|
|
278
|
+
runtimes,
|
|
279
|
+
path: pluginPath,
|
|
280
|
+
lastSeenAt,
|
|
281
|
+
skillCount,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
// Slice 3.3 fix-iteration — parse cwd from a rig-cwd: id so getPlugin
|
|
286
|
+
// can re-scan that cwd before the lookup. Returns the cwd in a
|
|
287
|
+
// single-element array (caller passes as cwdScanRoots) or null when
|
|
288
|
+
// the id is not a rig-cwd: id, can't be parsed, or both manifest dir
|
|
289
|
+
// markers are absent. Tolerant of both `/.claude/plugins/` and
|
|
290
|
+
// `/.codex/plugins/` markers (whichever appears first wins; in the
|
|
291
|
+
// canonical id one of them is always present).
|
|
292
|
+
const RIG_CWD_PREFIX = "rig-cwd:";
|
|
293
|
+
const CLAUDE_MARKER = "/.claude/plugins/";
|
|
294
|
+
const CODEX_MARKER = "/.codex/plugins/";
|
|
295
|
+
function extractCwdFromRigCwdId(id) {
|
|
296
|
+
if (!id.startsWith(RIG_CWD_PREFIX))
|
|
297
|
+
return null;
|
|
298
|
+
const rest = id.slice(RIG_CWD_PREFIX.length);
|
|
299
|
+
const claudeIdx = rest.indexOf(CLAUDE_MARKER);
|
|
300
|
+
const codexIdx = rest.indexOf(CODEX_MARKER);
|
|
301
|
+
let cwd = null;
|
|
302
|
+
if (claudeIdx >= 0 && (codexIdx < 0 || claudeIdx < codexIdx)) {
|
|
303
|
+
cwd = rest.slice(0, claudeIdx);
|
|
304
|
+
}
|
|
305
|
+
else if (codexIdx >= 0) {
|
|
306
|
+
cwd = rest.slice(0, codexIdx);
|
|
307
|
+
}
|
|
308
|
+
if (!cwd)
|
|
309
|
+
return null;
|
|
310
|
+
return [cwd];
|
|
311
|
+
}
|
|
312
|
+
function safeReaddir(dir) {
|
|
313
|
+
try {
|
|
314
|
+
return readdirSync(dir);
|
|
315
|
+
}
|
|
316
|
+
catch {
|
|
317
|
+
return [];
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function isDir(p) {
|
|
321
|
+
try {
|
|
322
|
+
return statSync(p).isDirectory();
|
|
323
|
+
}
|
|
324
|
+
catch {
|
|
325
|
+
return false;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function readManifest(manifestPath) {
|
|
329
|
+
if (!existsSync(manifestPath))
|
|
330
|
+
return null;
|
|
331
|
+
try {
|
|
332
|
+
const raw = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
333
|
+
return {
|
|
334
|
+
raw,
|
|
335
|
+
name: typeof raw.name === "string" ? raw.name : null,
|
|
336
|
+
version: typeof raw.version === "string" ? raw.version : null,
|
|
337
|
+
description: typeof raw.description === "string" ? raw.description : null,
|
|
338
|
+
homepage: typeof raw.homepage === "string" ? raw.homepage : null,
|
|
339
|
+
repository: typeof raw.repository === "string" ? raw.repository : null,
|
|
340
|
+
license: typeof raw.license === "string" ? raw.license : null,
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
catch {
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
// Slice 3.3 fix-A — read MCP server declarations from a manifest's
|
|
348
|
+
// `mcpServers` field. The Claude/Codex plugin spec convention is
|
|
349
|
+
// mcpServers: { <name>: { command, args, transport, ... } }. We
|
|
350
|
+
// surface the names + best-effort command/transport for the UI.
|
|
351
|
+
function readMcpServers(manifest, runtime) {
|
|
352
|
+
if (!manifest)
|
|
353
|
+
return [];
|
|
354
|
+
const raw = manifest.raw;
|
|
355
|
+
if (!raw || typeof raw !== "object")
|
|
356
|
+
return [];
|
|
357
|
+
const mcpServers = raw["mcpServers"];
|
|
358
|
+
if (!mcpServers || typeof mcpServers !== "object" || Array.isArray(mcpServers)) {
|
|
359
|
+
return [];
|
|
360
|
+
}
|
|
361
|
+
const out = [];
|
|
362
|
+
for (const [name, value] of Object.entries(mcpServers)) {
|
|
363
|
+
let command = null;
|
|
364
|
+
let transport = null;
|
|
365
|
+
if (value && typeof value === "object") {
|
|
366
|
+
const config = value;
|
|
367
|
+
if (typeof config.command === "string")
|
|
368
|
+
command = config.command;
|
|
369
|
+
if (typeof config.transport === "string")
|
|
370
|
+
transport = config.transport;
|
|
371
|
+
}
|
|
372
|
+
out.push({ runtime, name, command, transport });
|
|
373
|
+
}
|
|
374
|
+
return out;
|
|
375
|
+
}
|
|
376
|
+
function extractHookEvents(hooksJsonPath) {
|
|
377
|
+
try {
|
|
378
|
+
const data = JSON.parse(readFileSync(hooksJsonPath, "utf8"));
|
|
379
|
+
if (data.hooks && typeof data.hooks === "object") {
|
|
380
|
+
return Object.keys(data.hooks);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
catch {
|
|
384
|
+
// best-effort
|
|
385
|
+
}
|
|
386
|
+
return [];
|
|
387
|
+
}
|
|
388
|
+
function walkAgentYamls(rootDir) {
|
|
389
|
+
const out = [];
|
|
390
|
+
walk(rootDir);
|
|
391
|
+
return out;
|
|
392
|
+
function walk(dir) {
|
|
393
|
+
for (const entry of safeReaddir(dir)) {
|
|
394
|
+
const p = join(dir, entry);
|
|
395
|
+
if (isDir(p)) {
|
|
396
|
+
walk(p);
|
|
397
|
+
continue;
|
|
398
|
+
}
|
|
399
|
+
if (entry === "agent.yaml" || entry === "agent.yml") {
|
|
400
|
+
try {
|
|
401
|
+
const content = readFileSync(p, "utf8");
|
|
402
|
+
out.push({ path: p, content });
|
|
403
|
+
}
|
|
404
|
+
catch {
|
|
405
|
+
// best-effort; skip unreadable files
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
function safeParseYaml(content) {
|
|
412
|
+
try {
|
|
413
|
+
return parseYaml(content);
|
|
414
|
+
}
|
|
415
|
+
catch {
|
|
416
|
+
return null;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
function readField(obj, field) {
|
|
420
|
+
if (!obj || typeof obj !== "object")
|
|
421
|
+
return null;
|
|
422
|
+
const value = obj[field];
|
|
423
|
+
return typeof value === "string" ? value : null;
|
|
424
|
+
}
|
|
425
|
+
function readResourcesPlugins(spec) {
|
|
426
|
+
if (!spec || typeof spec !== "object")
|
|
427
|
+
return [];
|
|
428
|
+
const resources = spec["resources"];
|
|
429
|
+
if (!resources || typeof resources !== "object")
|
|
430
|
+
return [];
|
|
431
|
+
const plugins = resources["plugins"];
|
|
432
|
+
if (!Array.isArray(plugins))
|
|
433
|
+
return [];
|
|
434
|
+
const ids = [];
|
|
435
|
+
for (const p of plugins) {
|
|
436
|
+
if (p && typeof p === "object" && typeof p.id === "string") {
|
|
437
|
+
ids.push(p.id);
|
|
438
|
+
}
|
|
439
|
+
else if (typeof p === "string") {
|
|
440
|
+
// tolerate shorthand string form for forward-compat
|
|
441
|
+
ids.push(p);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return ids;
|
|
445
|
+
}
|
|
446
|
+
function readProfilesUsingPlugin(spec, pluginId) {
|
|
447
|
+
if (!spec || typeof spec !== "object")
|
|
448
|
+
return [];
|
|
449
|
+
const profiles = spec["profiles"];
|
|
450
|
+
if (!profiles || typeof profiles !== "object")
|
|
451
|
+
return [];
|
|
452
|
+
const matched = [];
|
|
453
|
+
for (const [profileName, profileVal] of Object.entries(profiles)) {
|
|
454
|
+
if (!profileVal || typeof profileVal !== "object")
|
|
455
|
+
continue;
|
|
456
|
+
const uses = profileVal["uses"];
|
|
457
|
+
if (!uses || typeof uses !== "object")
|
|
458
|
+
continue;
|
|
459
|
+
const usesPlugins = uses["plugins"];
|
|
460
|
+
if (!Array.isArray(usesPlugins))
|
|
461
|
+
continue;
|
|
462
|
+
if (usesPlugins.some((p) => p === pluginId)) {
|
|
463
|
+
matched.push(profileName);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return matched;
|
|
467
|
+
}
|
|
468
|
+
//# sourceMappingURL=plugin-discovery-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-discovery-service.js","sourceRoot":"","sources":["../../src/domain/plugin-discovery-service.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,EAAE;AACF,wCAAwC;AACxC,+EAA+E;AAC/E,yFAAyF;AACzF,6EAA6E;AAC7E,qEAAqE;AACrE,gFAAgF;AAChF,0EAA0E;AAC1E,EAAE;AACF,yEAAyE;AACzE,qDAAqD;AACrD,sEAAsE;AACtE,qFAAqF;AACrF,oFAAoF;AACpF,sEAAsE;AACtE,2FAA2F;AAC3F,4EAA4E;AAC5E,sEAAsE;AACtE,0EAA0E;AAC1E,6EAA6E;AAC7E,yEAAyE;AACzE,+BAA+B;AAC/B,EAAE;AACF,4EAA4E;AAC5E,6DAA6D;AAC7D,gEAAgE;AAChE,4EAA4E;AAC5E,mEAAmE;AAEnE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAkK1C,MAAM,mBAAmB,GAAG,4BAA4B,CAAC;AACzD,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAEvD,MAAM,OAAO,sBAAsB;IAChB,IAAI,CAA6B;IAElD,YAAY,IAAgC;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,WAAW,CAAC,aAA8B,EAAE;QAC1C,MAAM,GAAG,GAAkB,EAAE,CAAC;QAE9B,+BAA+B;QAC/B,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC5C,KAAK,MAAM,KAAK,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE,CAAC;gBAC7D,MAAM,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AAK,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAmC,CAAC,EAAE,CAAC;QAC5F,IAAI,CAAC,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ;YAAE,SAAS;QAC5D,MAAM,IAAI,GAAI,UAAsC,CAAC,MAAM,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,SAAS;QAChD,MAAM,WAAW,GAAI,IAAgC,CAAC,SAAS,CAAC,CAAC;QACjE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC;YAAE,SAAS;QAC1C,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC,EAAE,CAAC;YAC5C,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface PluginVendorFs {
|
|
2
|
+
readFile(path: string): string;
|
|
3
|
+
writeFile(path: string, content: string): void;
|
|
4
|
+
exists(path: string): boolean;
|
|
5
|
+
mkdirp(path: string): void;
|
|
6
|
+
listFiles(dir: string): string[];
|
|
7
|
+
rmrf?(path: string): void;
|
|
8
|
+
}
|
|
9
|
+
export interface HttpClientResponse {
|
|
10
|
+
ok: boolean;
|
|
11
|
+
status: number;
|
|
12
|
+
/** Body parsed by caller — not exercised in v0 since fetch failures are
|
|
13
|
+
* the expected normal-state. Future tarball-extraction would consume this. */
|
|
14
|
+
body?: unknown;
|
|
15
|
+
}
|
|
16
|
+
export type HttpClient = (url: string, opts?: {
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
}) => Promise<HttpClientResponse>;
|
|
19
|
+
export interface PluginVendorServiceDeps {
|
|
20
|
+
vendoredAssetsDir: string;
|
|
21
|
+
userPluginsDir: string;
|
|
22
|
+
fs: PluginVendorFs;
|
|
23
|
+
httpClient: HttpClient;
|
|
24
|
+
logger?: (...args: unknown[]) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare class PluginVendorService {
|
|
27
|
+
private vendoredAssetsDir;
|
|
28
|
+
private userPluginsDir;
|
|
29
|
+
private fs;
|
|
30
|
+
private httpClient;
|
|
31
|
+
private logger;
|
|
32
|
+
constructor(deps: PluginVendorServiceDeps);
|
|
33
|
+
/**
|
|
34
|
+
* Copy the vendored asset tree at <vendoredAssetsDir>/<pluginName>/ to the
|
|
35
|
+
* user plugin dir <userPluginsDir>/<pluginName>/ on first launch.
|
|
36
|
+
* Idempotent: hash-skip when source + dest content matches per file.
|
|
37
|
+
* No-op when the vendored asset doesn't exist (e.g. plugin not bundled).
|
|
38
|
+
*/
|
|
39
|
+
ensureVendored(pluginName: string): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Attempt to fetch the latest plugin tree from
|
|
42
|
+
* github.com/mvschwarz/openrig-plugins. Tolerates 404, network errors,
|
|
43
|
+
* and timeouts silently — vendored copy is ALWAYS the fallback.
|
|
44
|
+
* Logs outcome for operator observability.
|
|
45
|
+
*/
|
|
46
|
+
attemptAutoFetch(pluginName: string): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Orchestrate vendored-first then fetch-attempt.
|
|
49
|
+
* The vendored copy lands FIRST so it's always the fallback even if
|
|
50
|
+
* the fetch path fails for any reason.
|
|
51
|
+
*/
|
|
52
|
+
ensureLatest(pluginName: string): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=plugin-vendor-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-vendor-service.d.ts","sourceRoot":"","sources":["../../src/domain/plugin-vendor-service.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,SAAS,CA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IG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAItD"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// PluginVendorService — vendoring + auto-fetch for plugin trees.
|
|
2
|
+
//
|
|
3
|
+
// Per plugin-primitive Phase 3a slice 3.2 (IMPL-PRD §2.5 + DESIGN.md §5.5).
|
|
4
|
+
//
|
|
5
|
+
// Responsibilities:
|
|
6
|
+
// 1. ensureVendored(name): copy from packages/daemon/assets/plugins/<name>/
|
|
7
|
+
// to ~/.openrig/plugins/<name>/ on first launch (similar to how
|
|
8
|
+
// ~/.openrig/reference/ docs are copied today). Idempotent: hash-skip
|
|
9
|
+
// when content already matches.
|
|
10
|
+
// 2. attemptAutoFetch(name): try to fetch latest from
|
|
11
|
+
// github.com/mvschwarz/openrig-plugins. Tolerates 404, network errors,
|
|
12
|
+
// and timeouts silently per orch direction 2026-05-10 (vendored is
|
|
13
|
+
// always the fallback). Logs outcome for operator observability.
|
|
14
|
+
// 3. ensureLatest(name): orchestrates ensureVendored first, then
|
|
15
|
+
// attemptAutoFetch. The vendored copy is ALWAYS available even if
|
|
16
|
+
// the fetch fails for any reason.
|
|
17
|
+
//
|
|
18
|
+
// Design notes:
|
|
19
|
+
// - All fs ops + httpClient are injectable (testable without real
|
|
20
|
+
// filesystem or network).
|
|
21
|
+
// - 5s network timeout per IMPL-PRD §2.5.
|
|
22
|
+
// - The repo at github.com/mvschwarz/openrig-plugins is currently empty
|
|
23
|
+
// per founder authorization 2026-05-10 (LICENSE only); 404 is the
|
|
24
|
+
// expected normal-state response until a separate publish authorization.
|
|
25
|
+
import nodePath from "node:path";
|
|
26
|
+
import { createHash } from "node:crypto";
|
|
27
|
+
const DEFAULT_TIMEOUT_MS = 5000;
|
|
28
|
+
const REPO_BASE = "https://github.com/mvschwarz/openrig-plugins";
|
|
29
|
+
export class PluginVendorService {
|
|
30
|
+
vendoredAssetsDir;
|
|
31
|
+
userPluginsDir;
|
|
32
|
+
fs;
|
|
33
|
+
httpClient;
|
|
34
|
+
logger;
|
|
35
|
+
constructor(deps) {
|
|
36
|
+
this.vendoredAssetsDir = deps.vendoredAssetsDir;
|
|
37
|
+
this.userPluginsDir = deps.userPluginsDir;
|
|
38
|
+
this.fs = deps.fs;
|
|
39
|
+
this.httpClient = deps.httpClient;
|
|
40
|
+
this.logger = deps.logger ?? (() => { });
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Copy the vendored asset tree at <vendoredAssetsDir>/<pluginName>/ to the
|
|
44
|
+
* user plugin dir <userPluginsDir>/<pluginName>/ on first launch.
|
|
45
|
+
* Idempotent: hash-skip when source + dest content matches per file.
|
|
46
|
+
* No-op when the vendored asset doesn't exist (e.g. plugin not bundled).
|
|
47
|
+
*/
|
|
48
|
+
async ensureVendored(pluginName) {
|
|
49
|
+
const sourceDir = nodePath.join(this.vendoredAssetsDir, pluginName);
|
|
50
|
+
const targetDir = nodePath.join(this.userPluginsDir, pluginName);
|
|
51
|
+
if (!this.fs.exists(sourceDir)) {
|
|
52
|
+
this.logger(`[plugin-vendor] no vendored asset for "${pluginName}" at ${sourceDir}; skipping`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.fs.mkdirp(targetDir);
|
|
56
|
+
const files = this.fs.listFiles(sourceDir);
|
|
57
|
+
for (const relPath of files) {
|
|
58
|
+
const srcPath = nodePath.join(sourceDir, relPath);
|
|
59
|
+
const destPath = nodePath.join(targetDir, relPath);
|
|
60
|
+
const content = this.fs.readFile(srcPath);
|
|
61
|
+
// Hash-skip: only write if content differs (idempotent re-runs)
|
|
62
|
+
if (this.fs.exists(destPath) && hashContent(this.fs.readFile(destPath)) === hashContent(content)) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
this.fs.mkdirp(nodePath.dirname(destPath));
|
|
66
|
+
this.fs.writeFile(destPath, content);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Attempt to fetch the latest plugin tree from
|
|
71
|
+
* github.com/mvschwarz/openrig-plugins. Tolerates 404, network errors,
|
|
72
|
+
* and timeouts silently — vendored copy is ALWAYS the fallback.
|
|
73
|
+
* Logs outcome for operator observability.
|
|
74
|
+
*/
|
|
75
|
+
async attemptAutoFetch(pluginName) {
|
|
76
|
+
const url = `${REPO_BASE}/releases/latest/download/${pluginName}.tar.gz`;
|
|
77
|
+
try {
|
|
78
|
+
const response = await this.httpClient(url, { timeoutMs: DEFAULT_TIMEOUT_MS });
|
|
79
|
+
if (!response.ok) {
|
|
80
|
+
if (response.status === 404) {
|
|
81
|
+
this.logger(`[plugin-vendor] fetch ${pluginName} returned 404 (repo empty or release not published yet); falling back to vendored`);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
this.logger(`[plugin-vendor] fetch ${pluginName} returned status ${response.status}; falling back to vendored`);
|
|
85
|
+
}
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
// v0: tarball extraction NOT implemented — when slice 3.6 lands marketplace-
|
|
89
|
+
// consumption, this is where fetch-then-extract logic lives. For now,
|
|
90
|
+
// success path just logs.
|
|
91
|
+
this.logger(`[plugin-vendor] fetch ${pluginName} succeeded (${response.status}); v0 vendored copy still authoritative`);
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
95
|
+
this.logger(`[plugin-vendor] fetch ${pluginName} failed: ${msg}; falling back to vendored`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Orchestrate vendored-first then fetch-attempt.
|
|
100
|
+
* The vendored copy lands FIRST so it's always the fallback even if
|
|
101
|
+
* the fetch path fails for any reason.
|
|
102
|
+
*/
|
|
103
|
+
async ensureLatest(pluginName) {
|
|
104
|
+
await this.ensureVendored(pluginName);
|
|
105
|
+
await this.attemptAutoFetch(pluginName);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
function hashContent(content) {
|
|
109
|
+
return createHash("sha256").update(content).digest("hex");
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=plugin-vendor-service.js.map
|