@openrig/cli 0.3.1 → 0.3.3-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/daemon/assets/plugins/openrig-core/skills/forming-an-openrig-mental-model/SKILL.md +1 -1
- package/daemon/assets/plugins/openrig-core/skills/openrig-user/SKILL.md +8 -8
- package/daemon/dist/adapters/cmux-transport.d.ts.map +1 -1
- package/daemon/dist/adapters/cmux-transport.js +51 -9
- package/daemon/dist/adapters/cmux-transport.js.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +34 -5
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +68 -1
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +141 -2
- 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/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/db/migrations/042_rig_archive.d.ts +16 -0
- package/daemon/dist/db/migrations/042_rig_archive.d.ts.map +1 -0
- package/daemon/dist/db/migrations/042_rig_archive.js +21 -0
- package/daemon/dist/db/migrations/042_rig_archive.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.js +27 -0
- package/daemon/dist/domain/agent-manifest.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/context-monitor.d.ts +5 -1
- package/daemon/dist/domain/context-monitor.d.ts.map +1 -1
- package/daemon/dist/domain/context-monitor.js +28 -15
- 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/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/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 +10 -0
- package/daemon/dist/domain/profile-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/profile-resolver.js +4 -0
- package/daemon/dist/domain/profile-resolver.js.map +1 -1
- package/daemon/dist/domain/ps-projection.d.ts +28 -1
- package/daemon/dist/domain/ps-projection.d.ts.map +1 -1
- package/daemon/dist/domain/ps-projection.js +67 -1
- package/daemon/dist/domain/ps-projection.js.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +37 -1
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +99 -2
- 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-expansion-service.d.ts +1 -1
- package/daemon/dist/domain/rig-expansion-service.d.ts.map +1 -1
- package/daemon/dist/domain/rig-expansion-service.js +12 -10
- package/daemon/dist/domain/rig-expansion-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/rig-repository.d.ts +28 -2
- package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/daemon/dist/domain/rig-repository.js +40 -3
- package/daemon/dist/domain/rig-repository.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts +177 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +414 -55
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.d.ts +19 -1
- package/daemon/dist/domain/rigspec-preflight.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-preflight.js +30 -12
- package/daemon/dist/domain/rigspec-preflight.js.map +1 -1
- package/daemon/dist/domain/rigspec-schema.d.ts +1 -0
- package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-schema.js +4 -1
- package/daemon/dist/domain/rigspec-schema.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 +15 -0
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +8 -3
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.d.ts +12 -0
- package/daemon/dist/domain/slices/slice-indexer.d.ts.map +1 -1
- package/daemon/dist/domain/slices/slice-indexer.js +23 -0
- package/daemon/dist/domain/slices/slice-indexer.js.map +1 -1
- 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/topology-converge.d.ts +97 -0
- package/daemon/dist/domain/topology-converge.d.ts.map +1 -0
- package/daemon/dist/domain/topology-converge.js +70 -0
- package/daemon/dist/domain/topology-converge.js.map +1 -0
- package/daemon/dist/domain/types.d.ts +85 -3
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/whoami-service.d.ts +8 -0
- package/daemon/dist/domain/whoami-service.d.ts.map +1 -1
- package/daemon/dist/domain/whoami-service.js +1 -0
- package/daemon/dist/domain/whoami-service.js.map +1 -1
- package/daemon/dist/domain/workflow-runtime.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-runtime.js +9 -1
- package/daemon/dist/domain/workflow-runtime.js.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.d.ts +41 -0
- package/daemon/dist/domain/workflow-spec-cache.d.ts.map +1 -1
- package/daemon/dist/domain/workflow-spec-cache.js +63 -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 +156 -3
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -1
- 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.map +1 -1
- package/daemon/dist/index.js +11 -0
- package/daemon/dist/index.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/ps.js +4 -1
- package/daemon/dist/routes/ps.js.map +1 -1
- 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-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 +134 -4
- 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/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 +10 -0
- package/daemon/dist/server.d.ts.map +1 -1
- package/daemon/dist/server.js +11 -0
- package/daemon/dist/server.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +46 -4
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/docs/reference/getting-started.md +69 -0
- package/daemon/specs/agents/orchestration/orchestrator/guidance/role.md +28 -4
- package/daemon/specs/agents/shared/skills/core/openrig-user/SKILL.md +361 -15
- package/daemon/specs/agents/shared/skills/core/rig-lifecycle/SKILL.md +2 -2
- package/daemon/specs/rigs/launch/conveyor/rig.yaml +1 -1
- 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/add.d.ts +4 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +115 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/archive.d.ts +10 -0
- package/dist/commands/archive.d.ts.map +1 -0
- package/dist/commands/archive.js +68 -0
- package/dist/commands/archive.js.map +1 -0
- package/dist/commands/bootstrap.js +2 -2
- package/dist/commands/bootstrap.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 +40 -5
- package/dist/commands/config-init-workspace.js.map +1 -1
- package/dist/commands/discover.js +2 -2
- package/dist/commands/discover.js.map +1 -1
- package/dist/commands/down.d.ts +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +91 -3
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/ps.d.ts.map +1 -1
- package/dist/commands/ps.js +72 -10
- 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.map +1 -1
- package/dist/commands/send.js +11 -0
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/setup.d.ts +7 -0
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +28 -1
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +35 -2
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/unarchive.d.ts +10 -0
- package/dist/commands/unarchive.d.ts.map +1 -0
- package/dist/commands/unarchive.js +53 -0
- package/dist/commands/unarchive.js.map +1 -0
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +97 -0
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +4 -1
- package/dist/commands/whoami.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 +141 -4
- 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 +140 -10
- package/dist/commands/workspace.js.map +1 -1
- package/dist/daemon-lifecycle.d.ts +48 -1
- package/dist/daemon-lifecycle.d.ts.map +1 -1
- package/dist/daemon-lifecycle.js +57 -2
- package/dist/daemon-lifecycle.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -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/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +29 -0
- package/dist/mcp-server.js.map +1 -1
- package/dist/release-surface/affected-skills.d.ts +49 -0
- package/dist/release-surface/affected-skills.d.ts.map +1 -0
- package/dist/release-surface/affected-skills.js +153 -0
- package/dist/release-surface/affected-skills.js.map +1 -0
- package/dist/release-surface/extract-surface.d.ts +23 -0
- package/dist/release-surface/extract-surface.d.ts.map +1 -0
- package/dist/release-surface/extract-surface.js +193 -0
- package/dist/release-surface/extract-surface.js.map +1 -0
- package/dist/release-surface/generate.d.ts +2 -0
- package/dist/release-surface/generate.d.ts.map +1 -0
- package/dist/release-surface/generate.js +51 -0
- package/dist/release-surface/generate.js.map +1 -0
- package/dist/release-surface/surface-diff.d.ts +40 -0
- package/dist/release-surface/surface-diff.d.ts.map +1 -0
- package/dist/release-surface/surface-diff.js +212 -0
- package/dist/release-surface/surface-diff.js.map +1 -0
- package/package.json +2 -2
- package/ui/dist/assets/index-CrJgCmkX.js +552 -0
- package/ui/dist/index.html +1 -1
- package/ui/dist/assets/index-Rl3ZBrUg.js +0 -547
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundle install audit trail (Item 4 / slice-05 Checkpoint 5.1).
|
|
3
|
+
*
|
|
4
|
+
* Append-only JSONL log of bundle install events. Matches the JSONL audit-
|
|
5
|
+
* trail convention used by Transcript / Log Cleanup v0 and UI Enhancement
|
|
6
|
+
* Pack v0 — no new SQLite schema or migration.
|
|
7
|
+
*
|
|
8
|
+
* Default location is ~/.openrig/bundle-audit.jsonl. The writer is a pure
|
|
9
|
+
* data sink: callers (the /api/bundles/install route handler) compose the
|
|
10
|
+
* record at the right moment in the install lifecycle and hand it to
|
|
11
|
+
* BundleAuditWriter.append. The reader exposes a small filter API
|
|
12
|
+
* (rig name + since timestamp) for the /api/bundles/history endpoint and
|
|
13
|
+
* the `rig bundle history` CLI subcommand (both land at Checkpoint 5.2).
|
|
14
|
+
*
|
|
15
|
+
* FsOps injection mirrors the codebase pattern for testability: real
|
|
16
|
+
* implementation reads/writes node:fs; tests substitute an in-memory mock.
|
|
17
|
+
*/
|
|
18
|
+
/** A single bundle install audit row. */
|
|
19
|
+
export interface BundleAuditRecord {
|
|
20
|
+
/** ISO timestamp of when the install event was recorded. */
|
|
21
|
+
installedAt: string;
|
|
22
|
+
/** Source bundle path the install operated on. */
|
|
23
|
+
bundlePath: string;
|
|
24
|
+
/** SHA-256 archive hash (when available from bundle's sibling digest). */
|
|
25
|
+
archiveHash?: string;
|
|
26
|
+
/** ULID of the rig the install targeted (when applicable). */
|
|
27
|
+
targetRigId?: string;
|
|
28
|
+
/** Name of the rig the install targeted (when applicable). */
|
|
29
|
+
targetRigName?: string;
|
|
30
|
+
/** Hostname recorded in the bundle's provenance (Item 1), when present. */
|
|
31
|
+
sourceHost?: string;
|
|
32
|
+
/** Daemon version at install time. */
|
|
33
|
+
daemonVersion?: string;
|
|
34
|
+
/** CLI version at install time (when CLI sent it; Item 1 + Item 2 path). */
|
|
35
|
+
cliVersion?: string;
|
|
36
|
+
/** Install outcome — keep honest (partial = some stages ok, some not). */
|
|
37
|
+
outcome: "success" | "failed" | "partial";
|
|
38
|
+
}
|
|
39
|
+
/** Filesystem injection point — real impl wraps node:fs. Tests substitute in-memory. */
|
|
40
|
+
export interface BundleAuditFsOps {
|
|
41
|
+
appendFile: (path: string, content: string) => void;
|
|
42
|
+
readFile: (path: string) => string;
|
|
43
|
+
exists: (path: string) => boolean;
|
|
44
|
+
mkdirp: (path: string) => void;
|
|
45
|
+
}
|
|
46
|
+
/** Configuration for the audit writer + reader. */
|
|
47
|
+
export interface BundleAuditOpts {
|
|
48
|
+
/** Absolute path to the JSONL file (default location: ~/.openrig/bundle-audit.jsonl). */
|
|
49
|
+
auditPath: string;
|
|
50
|
+
}
|
|
51
|
+
/** Append-only writer for bundle install audit records. */
|
|
52
|
+
export declare class BundleAuditWriter {
|
|
53
|
+
private opts;
|
|
54
|
+
private fs;
|
|
55
|
+
constructor(deps: {
|
|
56
|
+
opts: BundleAuditOpts;
|
|
57
|
+
fsOps: BundleAuditFsOps;
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Append one record to the JSONL file. Creates the parent directory if
|
|
61
|
+
* missing. Each record is one JSON object on its own line (operator can
|
|
62
|
+
* tail -f for live monitoring). Throws on filesystem errors via fsOps.
|
|
63
|
+
*/
|
|
64
|
+
append(record: BundleAuditRecord): void;
|
|
65
|
+
}
|
|
66
|
+
/** Filters supported by the audit reader (subset of /api/bundles/history). */
|
|
67
|
+
export interface BundleAuditFilters {
|
|
68
|
+
/** When set, only return records whose targetRigName equals this value. */
|
|
69
|
+
rig?: string;
|
|
70
|
+
/** When set, only return records whose installedAt is >= this ISO timestamp. */
|
|
71
|
+
since?: string;
|
|
72
|
+
}
|
|
73
|
+
/** Reader for the bundle install audit JSONL file. */
|
|
74
|
+
export declare class BundleAuditReader {
|
|
75
|
+
private opts;
|
|
76
|
+
private fs;
|
|
77
|
+
constructor(deps: {
|
|
78
|
+
opts: BundleAuditOpts;
|
|
79
|
+
fsOps: BundleAuditFsOps;
|
|
80
|
+
});
|
|
81
|
+
/**
|
|
82
|
+
* Return all audit records (optionally filtered). Malformed lines are
|
|
83
|
+
* skipped silently — forward-compat with future record-shape evolutions
|
|
84
|
+
* that don't parse under the current shape; the readable lines still
|
|
85
|
+
* surface. Records are returned in append order (oldest first).
|
|
86
|
+
*/
|
|
87
|
+
list(filters?: BundleAuditFilters): BundleAuditRecord[];
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=bundle-audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-audit.d.ts","sourceRoot":"","sources":["../../src/domain/bundle-audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,yCAAyC;AACzC,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,OAAO,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;CAC3C;AAED,wFAAwF;AACxF,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACnC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,mDAAmD;AACnD,MAAM,WAAW,eAAe;IAC9B,yFAAyF;IACzF,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,2DAA2D;AAC3D,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,IAAI,CAAkB;IAC9B,OAAO,CAAC,EAAE,CAAmB;gBAEjB,IAAI,EAAE;QAAE,IAAI,EAAE,eAAe,CAAC;QAAC,KAAK,EAAE,gBAAgB,CAAA;KAAE;IAKpE;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;CAKxC;AAED,8EAA8E;AAC9E,MAAM,WAAW,kBAAkB;IACjC,2EAA2E;IAC3E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,sDAAsD;AACtD,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,IAAI,CAAkB;IAC9B,OAAO,CAAC,EAAE,CAAmB;gBAEjB,IAAI,EAAE;QAAE,IAAI,EAAE,eAAe,CAAC;QAAC,KAAK,EAAE,gBAAgB,CAAA;KAAE;IAKpE;;;;;OAKG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,kBAAkB,GAAG,iBAAiB,EAAE;CAiBxD"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundle install audit trail (Item 4 / slice-05 Checkpoint 5.1).
|
|
3
|
+
*
|
|
4
|
+
* Append-only JSONL log of bundle install events. Matches the JSONL audit-
|
|
5
|
+
* trail convention used by Transcript / Log Cleanup v0 and UI Enhancement
|
|
6
|
+
* Pack v0 — no new SQLite schema or migration.
|
|
7
|
+
*
|
|
8
|
+
* Default location is ~/.openrig/bundle-audit.jsonl. The writer is a pure
|
|
9
|
+
* data sink: callers (the /api/bundles/install route handler) compose the
|
|
10
|
+
* record at the right moment in the install lifecycle and hand it to
|
|
11
|
+
* BundleAuditWriter.append. The reader exposes a small filter API
|
|
12
|
+
* (rig name + since timestamp) for the /api/bundles/history endpoint and
|
|
13
|
+
* the `rig bundle history` CLI subcommand (both land at Checkpoint 5.2).
|
|
14
|
+
*
|
|
15
|
+
* FsOps injection mirrors the codebase pattern for testability: real
|
|
16
|
+
* implementation reads/writes node:fs; tests substitute an in-memory mock.
|
|
17
|
+
*/
|
|
18
|
+
import nodePath from "node:path";
|
|
19
|
+
/** Append-only writer for bundle install audit records. */
|
|
20
|
+
export class BundleAuditWriter {
|
|
21
|
+
opts;
|
|
22
|
+
fs;
|
|
23
|
+
constructor(deps) {
|
|
24
|
+
this.opts = deps.opts;
|
|
25
|
+
this.fs = deps.fsOps;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Append one record to the JSONL file. Creates the parent directory if
|
|
29
|
+
* missing. Each record is one JSON object on its own line (operator can
|
|
30
|
+
* tail -f for live monitoring). Throws on filesystem errors via fsOps.
|
|
31
|
+
*/
|
|
32
|
+
append(record) {
|
|
33
|
+
this.fs.mkdirp(nodePath.dirname(this.opts.auditPath));
|
|
34
|
+
const line = `${JSON.stringify(record)}\n`;
|
|
35
|
+
this.fs.appendFile(this.opts.auditPath, line);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Reader for the bundle install audit JSONL file. */
|
|
39
|
+
export class BundleAuditReader {
|
|
40
|
+
opts;
|
|
41
|
+
fs;
|
|
42
|
+
constructor(deps) {
|
|
43
|
+
this.opts = deps.opts;
|
|
44
|
+
this.fs = deps.fsOps;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Return all audit records (optionally filtered). Malformed lines are
|
|
48
|
+
* skipped silently — forward-compat with future record-shape evolutions
|
|
49
|
+
* that don't parse under the current shape; the readable lines still
|
|
50
|
+
* surface. Records are returned in append order (oldest first).
|
|
51
|
+
*/
|
|
52
|
+
list(filters) {
|
|
53
|
+
if (!this.fs.exists(this.opts.auditPath))
|
|
54
|
+
return [];
|
|
55
|
+
const content = this.fs.readFile(this.opts.auditPath);
|
|
56
|
+
const lines = content.split("\n").filter((l) => l.length > 0);
|
|
57
|
+
const records = [];
|
|
58
|
+
for (const line of lines) {
|
|
59
|
+
try {
|
|
60
|
+
const parsed = JSON.parse(line);
|
|
61
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
62
|
+
records.push(parsed);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
// Malformed line — skip silently.
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return applyFilters(records, filters);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** Apply the supported filters to an in-memory record array. */
|
|
73
|
+
function applyFilters(records, filters) {
|
|
74
|
+
if (!filters)
|
|
75
|
+
return records;
|
|
76
|
+
let out = records;
|
|
77
|
+
if (filters.rig !== undefined && filters.rig.length > 0) {
|
|
78
|
+
const rigName = filters.rig;
|
|
79
|
+
out = out.filter((r) => r.targetRigName === rigName);
|
|
80
|
+
}
|
|
81
|
+
if (filters.since !== undefined && filters.since.length > 0) {
|
|
82
|
+
const since = filters.since;
|
|
83
|
+
out = out.filter((r) => r.installedAt >= since);
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=bundle-audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-audit.js","sourceRoot":"","sources":["../../src/domain/bundle-audit.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundle conflict detector (Item 3 / slice-05 Checkpoint 4.1).
|
|
3
|
+
*
|
|
4
|
+
* Pure function. Compares a bundle's declared identifiers against the daemon's
|
|
5
|
+
* current state and returns a structured conflict report. Callers (route
|
|
6
|
+
* handlers in Checkpoint 4.2) provide the daemon state (listRigs() etc.); the
|
|
7
|
+
* detector itself has no daemon dependencies — fully unit-testable.
|
|
8
|
+
*
|
|
9
|
+
* Fails CLOSED: the conflict list is the source of truth. Missing or ambiguous
|
|
10
|
+
* input is treated as no-conflict-detectable, NOT as bypass — Items 4.2+ will
|
|
11
|
+
* surface ambiguity as a conflict where appropriate. This commit ships the
|
|
12
|
+
* rig-name collision check only; agent / port / managed-app / sibling-primitive
|
|
13
|
+
* checks land in Checkpoint 4.3 + 4.4.
|
|
14
|
+
*
|
|
15
|
+
* Extends, does NOT replace, the existing 409 "install already in progress"
|
|
16
|
+
* guard at /api/bundles/install (concurrency lock) per PRD Item 3 §
|
|
17
|
+
* "extends, does NOT replace".
|
|
18
|
+
*/
|
|
19
|
+
/** A rig-name collision: bundle declares a rig name that a currently-running rig already uses. */
|
|
20
|
+
export interface RigNameCollision {
|
|
21
|
+
kind: "rig_name_collision";
|
|
22
|
+
/** Name declared by the bundle's rig spec. */
|
|
23
|
+
bundleRigName: string;
|
|
24
|
+
/** Identity of the running rig that holds the same name. */
|
|
25
|
+
collisionWith: {
|
|
26
|
+
rigId: string;
|
|
27
|
+
rigName: string;
|
|
28
|
+
};
|
|
29
|
+
/** Human-readable summary suitable for the 3-part error description line. */
|
|
30
|
+
description: string;
|
|
31
|
+
/** Operator-actionable resolutions (3-part error what-to-do line). */
|
|
32
|
+
resolutions: string[];
|
|
33
|
+
}
|
|
34
|
+
/** Discriminated union over all conflict kinds. Extends in Checkpoint 4.3+. */
|
|
35
|
+
export type BundleConflict = RigNameCollision;
|
|
36
|
+
/** Result of a conflict check. */
|
|
37
|
+
export interface ConflictReport {
|
|
38
|
+
conflicts: BundleConflict[];
|
|
39
|
+
hasConflicts: boolean;
|
|
40
|
+
}
|
|
41
|
+
/** Input to detectBundleConflicts. Pure data; no daemon handles. */
|
|
42
|
+
export interface DetectConflictsInput {
|
|
43
|
+
/** Rig name declared in the bundle's rig spec (rig.yaml `name:` field). */
|
|
44
|
+
bundleRigName: string;
|
|
45
|
+
/** Snapshot of currently-running rigs from rigRepo.listRigs(). */
|
|
46
|
+
runningRigs: Array<{
|
|
47
|
+
rigId: string;
|
|
48
|
+
name: string;
|
|
49
|
+
}>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Run the conflict checks for an install candidate. Returns the full conflict
|
|
53
|
+
* list (Checkpoint 4.2 returns it via /install --plan; --apply blocks on
|
|
54
|
+
* non-empty unless --force).
|
|
55
|
+
*/
|
|
56
|
+
export declare function detectBundleConflicts(input: DetectConflictsInput): ConflictReport;
|
|
57
|
+
//# sourceMappingURL=bundle-conflict-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-conflict-detector.d.ts","sourceRoot":"","sources":["../../src/domain/bundle-conflict-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,kGAAkG;AAClG,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,8CAA8C;IAC9C,aAAa,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAClD,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,+EAA+E;AAC/E,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAE9C,kCAAkC;AAClC,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,oEAAoE;AACpE,MAAM,WAAW,oBAAoB;IACnC,2EAA2E;IAC3E,aAAa,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,WAAW,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,GAAG,cAAc,CA0BjF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundle conflict detector (Item 3 / slice-05 Checkpoint 4.1).
|
|
3
|
+
*
|
|
4
|
+
* Pure function. Compares a bundle's declared identifiers against the daemon's
|
|
5
|
+
* current state and returns a structured conflict report. Callers (route
|
|
6
|
+
* handlers in Checkpoint 4.2) provide the daemon state (listRigs() etc.); the
|
|
7
|
+
* detector itself has no daemon dependencies — fully unit-testable.
|
|
8
|
+
*
|
|
9
|
+
* Fails CLOSED: the conflict list is the source of truth. Missing or ambiguous
|
|
10
|
+
* input is treated as no-conflict-detectable, NOT as bypass — Items 4.2+ will
|
|
11
|
+
* surface ambiguity as a conflict where appropriate. This commit ships the
|
|
12
|
+
* rig-name collision check only; agent / port / managed-app / sibling-primitive
|
|
13
|
+
* checks land in Checkpoint 4.3 + 4.4.
|
|
14
|
+
*
|
|
15
|
+
* Extends, does NOT replace, the existing 409 "install already in progress"
|
|
16
|
+
* guard at /api/bundles/install (concurrency lock) per PRD Item 3 §
|
|
17
|
+
* "extends, does NOT replace".
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Run the conflict checks for an install candidate. Returns the full conflict
|
|
21
|
+
* list (Checkpoint 4.2 returns it via /install --plan; --apply blocks on
|
|
22
|
+
* non-empty unless --force).
|
|
23
|
+
*/
|
|
24
|
+
export function detectBundleConflicts(input) {
|
|
25
|
+
const conflicts = [];
|
|
26
|
+
// Rig-name collision: bundle declares a name a running rig already holds.
|
|
27
|
+
// O(n) scan over runningRigs — acceptable for the seat-scale rig counts the
|
|
28
|
+
// daemon manages (tens, not thousands).
|
|
29
|
+
if (input.bundleRigName && input.bundleRigName.length > 0) {
|
|
30
|
+
for (const rig of input.runningRigs) {
|
|
31
|
+
if (rig.name === input.bundleRigName) {
|
|
32
|
+
conflicts.push({
|
|
33
|
+
kind: "rig_name_collision",
|
|
34
|
+
bundleRigName: input.bundleRigName,
|
|
35
|
+
collisionWith: { rigId: rig.rigId, rigName: rig.name },
|
|
36
|
+
description: `bundle declares rig name '${input.bundleRigName}' but a running rig with this name already exists (rigId: ${rig.rigId})`,
|
|
37
|
+
resolutions: [
|
|
38
|
+
"use --target <newname> on install to rename the rig on install (lands at Checkpoint 4.2)",
|
|
39
|
+
`stop the running rig first (e.g. rig down ${rig.name}) and re-attempt install`,
|
|
40
|
+
"use --force on install for an operator-explicit override (lands at Checkpoint 4.2; NOT recommended for routine use)",
|
|
41
|
+
],
|
|
42
|
+
});
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return { conflicts, hasConflicts: conflicts.length > 0 };
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=bundle-conflict-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-conflict-detector.js","sourceRoot":"","sources":["../../src/domain/bundle-conflict-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAgCH;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAA2B;IAC/D,MAAM,SAAS,GAAqB,EAAE,CAAC;IAEvC,0EAA0E;IAC1E,4EAA4E;IAC5E,wCAAwC;IACxC,IAAI,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1D,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC;YACpC,IAAI,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,aAAa,EAAE,CAAC;gBACrC,SAAS,CAAC,IAAI,CAAC;oBACb,IAAI,EAAE,oBAAoB;oBAC1B,aAAa,EAAE,KAAK,CAAC,aAAa;oBAClC,aAAa,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE;oBACtD,WAAW,EAAE,6BAA6B,KAAK,CAAC,aAAa,6DAA6D,GAAG,CAAC,KAAK,GAAG;oBACtI,WAAW,EAAE;wBACX,0FAA0F;wBAC1F,6CAA6C,GAAG,CAAC,IAAI,0BAA0B;wBAC/E,qHAAqH;qBACtH;iBACF,CAAC,CAAC;gBACH,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundle context_packs router (Item 6 / slice-05 Checkpoint 7.3f step 2).
|
|
3
|
+
*
|
|
4
|
+
* Pure function. Copies context-pack directories declared in a bundle
|
|
5
|
+
* manifest's context_packs[] block from the bundle's extracted tree to
|
|
6
|
+
* the operator context-packs library. No daemon dependencies — fully
|
|
7
|
+
* unit-testable via FsOps injection.
|
|
8
|
+
*
|
|
9
|
+
* Per PRD §Item 6 line 196: context_packs entries are paths to a
|
|
10
|
+
* context-pack's manifest.yaml file inside the bundle. The PACK is the
|
|
11
|
+
* PARENT DIRECTORY of that manifest.yaml (per context-pack-types.ts:9-10
|
|
12
|
+
* and context-pack-library-service.ts:50-77: a pack is a directory whose
|
|
13
|
+
* immediate children include manifest.yaml + the referenced content
|
|
14
|
+
* files). The router copies that parent dir to
|
|
15
|
+
* <targetContextPacksDir>/<basename(parentDir)>/ — the operator-host
|
|
16
|
+
* canonical layout the live consumer scans.
|
|
17
|
+
*
|
|
18
|
+
* Banked degenerate-input dogfood discipline (extended from the
|
|
19
|
+
* workflow_specs basename-collision + non-YAML cycles): every router
|
|
20
|
+
* commit explicitly probes the failure-class edges through the live
|
|
21
|
+
* consumer's contract before claiming routedCount truthful. For
|
|
22
|
+
* context_packs the consumer-invisibility classes are:
|
|
23
|
+
* - Declared path basename is NOT "manifest.yaml" → consumer never
|
|
24
|
+
* scans (it looks for manifest.yaml at the pack dir root). status=
|
|
25
|
+
* not_manifest.
|
|
26
|
+
* - Two declared paths whose parent-dir basename collide → second
|
|
27
|
+
* would silently overwrite the first; status=conflict; first wins.
|
|
28
|
+
* - Source pack dir not present in bundle → status=missing (honest skip).
|
|
29
|
+
* - Source path escapes bundleRoot → status=unsafe.
|
|
30
|
+
*
|
|
31
|
+
* Both-sides containment (banked
|
|
32
|
+
* feedback_pre_existing_trust_boundary_reuse_canonical_helper addendum):
|
|
33
|
+
* source-side under bundleRoot, target-side under targetContextPacksDir
|
|
34
|
+
* (target via basename so structurally safe; defensive check retained).
|
|
35
|
+
*
|
|
36
|
+
* /install handler integration lands at Checkpoint 7.3f step 3 with a
|
|
37
|
+
* real consumer-scan() proof against the routed dir (mirror of the
|
|
38
|
+
* workflow_specs scanWorkflowSpecFolder reachability proof at d81456dc).
|
|
39
|
+
*/
|
|
40
|
+
/** Filesystem injection point — real impl wraps node:fs. Tests substitute in-memory. */
|
|
41
|
+
export interface ContextPacksRouterFsOps {
|
|
42
|
+
exists: (path: string) => boolean;
|
|
43
|
+
isDirectory: (path: string) => boolean;
|
|
44
|
+
mkdirp: (path: string) => void;
|
|
45
|
+
copyDir: (src: string, dest: string) => void;
|
|
46
|
+
}
|
|
47
|
+
/** Inputs to routeContextPacks. */
|
|
48
|
+
export interface RouteContextPacksInput {
|
|
49
|
+
/** Absolute path to the bundle's extracted root (tmp dir from unpack). */
|
|
50
|
+
bundleRoot: string;
|
|
51
|
+
/** Relative paths to context-pack manifest.yaml files declared in the
|
|
52
|
+
* bundle manifest's context_packs[] block. */
|
|
53
|
+
declaredContextPacks: string[];
|
|
54
|
+
/** Absolute path to the operator context-packs library (per
|
|
55
|
+
* context-pack-types.ts:9-10: typically `<openrigHome>/context-packs`
|
|
56
|
+
* or a workspace-local `.openrig/context-packs`). Caller resolves. */
|
|
57
|
+
targetContextPacksDir: string;
|
|
58
|
+
}
|
|
59
|
+
/** One routed context_pack (or one rejection). */
|
|
60
|
+
export interface RoutedContextPackRecord {
|
|
61
|
+
/** Declared path from manifest.context_packs[]. */
|
|
62
|
+
declaredPath: string;
|
|
63
|
+
/** "routed" = pack dir copied successfully and consumer-visible.
|
|
64
|
+
* "missing" = pack manifest source not in bundle (honest skip).
|
|
65
|
+
* "unsafe" = source escapes bundleRoot OR target escapes
|
|
66
|
+
* targetContextPacksDir (structurally impossible given basename, kept
|
|
67
|
+
* defensive).
|
|
68
|
+
* "not_manifest" = declared path basename is not "manifest.yaml" —
|
|
69
|
+
* consumer (context-pack-library-service.scan) scans pack dirs for a
|
|
70
|
+
* top-level manifest.yaml file; any other basename is invisible-by-
|
|
71
|
+
* construction.
|
|
72
|
+
* "not_directory" = parent of the declared manifest path is not a
|
|
73
|
+
* directory in the bundle tree.
|
|
74
|
+
* "conflict" = parent-dir basename collides with an earlier routed
|
|
75
|
+
* pack; first wins, second flagged so routedCount stays truthful at
|
|
76
|
+
* the consumer-visible boundary (banked 16ebb8af lesson). */
|
|
77
|
+
status: "routed" | "missing" | "unsafe" | "not_manifest" | "not_directory" | "conflict";
|
|
78
|
+
/** Where the pack landed in the target library (absolute pack dir
|
|
79
|
+
* path), if routed. */
|
|
80
|
+
installedAt?: string;
|
|
81
|
+
/** Human-readable detail (3-part error shape input for caller). */
|
|
82
|
+
detail?: string;
|
|
83
|
+
}
|
|
84
|
+
/** Aggregate routing result. */
|
|
85
|
+
export interface RouteContextPacksResult {
|
|
86
|
+
records: RoutedContextPackRecord[];
|
|
87
|
+
routedCount: number;
|
|
88
|
+
rejectedCount: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Route each declared context_pack from the bundle tree to the operator
|
|
92
|
+
* context-packs library. Per-entry safety: SOURCE containment under
|
|
93
|
+
* bundleRoot + TARGET containment under targetContextPacksDir.
|
|
94
|
+
* Degenerate inputs the consumer ignores (non-manifest.yaml basename;
|
|
95
|
+
* parent-dir basename collisions) are caught BEFORE write so the
|
|
96
|
+
* routedCount stays truthful at the consumer-visible boundary. Caller
|
|
97
|
+
* writes the install audit record using the records returned here.
|
|
98
|
+
*/
|
|
99
|
+
export declare function routeContextPacks(input: RouteContextPacksInput, fs: ContextPacksRouterFsOps): RouteContextPacksResult;
|
|
100
|
+
//# sourceMappingURL=bundle-context-packs-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-context-packs-router.d.ts","sourceRoot":"","sources":["../../src/domain/bundle-context-packs-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH,wFAAwF;AACxF,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAED,mCAAmC;AACnC,MAAM,WAAW,sBAAsB;IACrC,0EAA0E;IAC1E,UAAU,EAAE,MAAM,CAAC;IACnB;mDAC+C;IAC/C,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B;;2EAEuE;IACvE,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAED,kDAAkD;AAClD,MAAM,WAAW,uBAAuB;IACtC,mDAAmD;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;;;iEAa6D;IAC7D,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,cAAc,GAAG,eAAe,GAAG,UAAU,CAAC;IACxF;4BACwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,gCAAgC;AAChC,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,uBAAuB,EAAE,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,sBAAsB,EAC7B,EAAE,EAAE,uBAAuB,GAC1B,uBAAuB,CA6GzB"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundle context_packs router (Item 6 / slice-05 Checkpoint 7.3f step 2).
|
|
3
|
+
*
|
|
4
|
+
* Pure function. Copies context-pack directories declared in a bundle
|
|
5
|
+
* manifest's context_packs[] block from the bundle's extracted tree to
|
|
6
|
+
* the operator context-packs library. No daemon dependencies — fully
|
|
7
|
+
* unit-testable via FsOps injection.
|
|
8
|
+
*
|
|
9
|
+
* Per PRD §Item 6 line 196: context_packs entries are paths to a
|
|
10
|
+
* context-pack's manifest.yaml file inside the bundle. The PACK is the
|
|
11
|
+
* PARENT DIRECTORY of that manifest.yaml (per context-pack-types.ts:9-10
|
|
12
|
+
* and context-pack-library-service.ts:50-77: a pack is a directory whose
|
|
13
|
+
* immediate children include manifest.yaml + the referenced content
|
|
14
|
+
* files). The router copies that parent dir to
|
|
15
|
+
* <targetContextPacksDir>/<basename(parentDir)>/ — the operator-host
|
|
16
|
+
* canonical layout the live consumer scans.
|
|
17
|
+
*
|
|
18
|
+
* Banked degenerate-input dogfood discipline (extended from the
|
|
19
|
+
* workflow_specs basename-collision + non-YAML cycles): every router
|
|
20
|
+
* commit explicitly probes the failure-class edges through the live
|
|
21
|
+
* consumer's contract before claiming routedCount truthful. For
|
|
22
|
+
* context_packs the consumer-invisibility classes are:
|
|
23
|
+
* - Declared path basename is NOT "manifest.yaml" → consumer never
|
|
24
|
+
* scans (it looks for manifest.yaml at the pack dir root). status=
|
|
25
|
+
* not_manifest.
|
|
26
|
+
* - Two declared paths whose parent-dir basename collide → second
|
|
27
|
+
* would silently overwrite the first; status=conflict; first wins.
|
|
28
|
+
* - Source pack dir not present in bundle → status=missing (honest skip).
|
|
29
|
+
* - Source path escapes bundleRoot → status=unsafe.
|
|
30
|
+
*
|
|
31
|
+
* Both-sides containment (banked
|
|
32
|
+
* feedback_pre_existing_trust_boundary_reuse_canonical_helper addendum):
|
|
33
|
+
* source-side under bundleRoot, target-side under targetContextPacksDir
|
|
34
|
+
* (target via basename so structurally safe; defensive check retained).
|
|
35
|
+
*
|
|
36
|
+
* /install handler integration lands at Checkpoint 7.3f step 3 with a
|
|
37
|
+
* real consumer-scan() proof against the routed dir (mirror of the
|
|
38
|
+
* workflow_specs scanWorkflowSpecFolder reachability proof at d81456dc).
|
|
39
|
+
*/
|
|
40
|
+
import nodePath from "node:path";
|
|
41
|
+
/**
|
|
42
|
+
* Route each declared context_pack from the bundle tree to the operator
|
|
43
|
+
* context-packs library. Per-entry safety: SOURCE containment under
|
|
44
|
+
* bundleRoot + TARGET containment under targetContextPacksDir.
|
|
45
|
+
* Degenerate inputs the consumer ignores (non-manifest.yaml basename;
|
|
46
|
+
* parent-dir basename collisions) are caught BEFORE write so the
|
|
47
|
+
* routedCount stays truthful at the consumer-visible boundary. Caller
|
|
48
|
+
* writes the install audit record using the records returned here.
|
|
49
|
+
*/
|
|
50
|
+
export function routeContextPacks(input, fs) {
|
|
51
|
+
const records = [];
|
|
52
|
+
const bundleRootResolved = nodePath.resolve(input.bundleRoot);
|
|
53
|
+
const targetRootResolved = nodePath.resolve(input.targetContextPacksDir);
|
|
54
|
+
fs.mkdirp(input.targetContextPacksDir);
|
|
55
|
+
// Track parent-dir basenames already routed so collisions surface as
|
|
56
|
+
// conflict records, not silent overwrites (banked workflow_specs lesson
|
|
57
|
+
// 16ebb8af).
|
|
58
|
+
const routedDirNames = new Set();
|
|
59
|
+
for (const declared of input.declaredContextPacks) {
|
|
60
|
+
// Consumer-visibility prefilter: context-pack-library-service scans
|
|
61
|
+
// pack dirs whose immediate child is manifest.yaml. Any declared path
|
|
62
|
+
// whose basename isn't "manifest.yaml" routes to a dir the consumer
|
|
63
|
+
// will never recognize as a pack. Reject pre-write so routedCount
|
|
64
|
+
// stays truthful at the consumer-visible boundary.
|
|
65
|
+
if (nodePath.basename(declared) !== "manifest.yaml") {
|
|
66
|
+
records.push({
|
|
67
|
+
declaredPath: declared,
|
|
68
|
+
status: "not_manifest",
|
|
69
|
+
detail: `context_pack '${declared}' basename is not 'manifest.yaml'; context-pack-library scans pack dirs for a top-level manifest.yaml`,
|
|
70
|
+
});
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const sourceAbs = nodePath.resolve(input.bundleRoot, declared);
|
|
74
|
+
// Defense-in-depth path-containment on SOURCE (mirrors skills/
|
|
75
|
+
// workflow_specs routers).
|
|
76
|
+
if (sourceAbs !== bundleRootResolved && !sourceAbs.startsWith(bundleRootResolved + nodePath.sep)) {
|
|
77
|
+
records.push({
|
|
78
|
+
declaredPath: declared,
|
|
79
|
+
status: "unsafe",
|
|
80
|
+
detail: `context_pack path '${declared}' escapes bundle workspace; rejected`,
|
|
81
|
+
});
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
// Manifest-file existence check (banked B1 from a0e7e0e1 guard catch):
|
|
85
|
+
// the consumer (context-pack-library-service.scan, line 76) skips any
|
|
86
|
+
// pack dir whose manifest.yaml is absent. A parent-dir-exists-but-
|
|
87
|
+
// manifest-missing pack would route as status=routed but be invisible
|
|
88
|
+
// to the consumer — false-positive routedCount class. Check the file
|
|
89
|
+
// ITSELF, not just the parent, to keep routedCount truthful at the
|
|
90
|
+
// consumer-visible boundary.
|
|
91
|
+
if (!fs.exists(sourceAbs)) {
|
|
92
|
+
records.push({
|
|
93
|
+
declaredPath: declared,
|
|
94
|
+
status: "missing",
|
|
95
|
+
detail: `context_pack manifest '${declared}' not present in bundle; skipped (consumer requires the file itself)`,
|
|
96
|
+
});
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
// Manifest-type check (banked B2 from d491eca9 guard catch): exists()
|
|
100
|
+
// returns true for both files AND directories. If sourceAbs exists as
|
|
101
|
+
// a directory (named manifest.yaml, but a dir not a file), the live
|
|
102
|
+
// consumer's readFileSync(manifestPath) throws and scan() records an
|
|
103
|
+
// error diagnostic instead of indexing a visible pack — false-positive
|
|
104
|
+
// routedCount class. Reject pre-write so routedCount stays truthful at
|
|
105
|
+
// the consumer-visible boundary.
|
|
106
|
+
if (fs.isDirectory(sourceAbs)) {
|
|
107
|
+
records.push({
|
|
108
|
+
declaredPath: declared,
|
|
109
|
+
status: "not_manifest",
|
|
110
|
+
detail: `context_pack manifest '${declared}' exists but is a directory, not a file; consumer requires manifest.yaml to be a readable file`,
|
|
111
|
+
});
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const sourcePackDir = nodePath.dirname(sourceAbs);
|
|
115
|
+
if (!fs.isDirectory(sourcePackDir)) {
|
|
116
|
+
records.push({
|
|
117
|
+
declaredPath: declared,
|
|
118
|
+
status: "not_directory",
|
|
119
|
+
detail: `context_pack parent of '${declared}' is not a directory; skipped`,
|
|
120
|
+
});
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
const dirName = nodePath.basename(sourcePackDir);
|
|
124
|
+
// Target = <targetContextPacksDir>/<basename(parentDir)>/ (the operator-
|
|
125
|
+
// host canonical layout per context-pack-types.ts:9-10).
|
|
126
|
+
const targetAbs = nodePath.resolve(input.targetContextPacksDir, dirName);
|
|
127
|
+
// Sanity check (basename is structurally safe but the resolve could
|
|
128
|
+
// theoretically be a no-op for "" → keep the check, expected always-
|
|
129
|
+
// true).
|
|
130
|
+
if (targetAbs !== targetRootResolved && !targetAbs.startsWith(targetRootResolved + nodePath.sep)) {
|
|
131
|
+
records.push({
|
|
132
|
+
declaredPath: declared,
|
|
133
|
+
status: "unsafe",
|
|
134
|
+
detail: `context_pack target path for '${declared}' escapes target context-packs library; rejected`,
|
|
135
|
+
});
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (routedDirNames.has(dirName)) {
|
|
139
|
+
records.push({
|
|
140
|
+
declaredPath: declared,
|
|
141
|
+
status: "conflict",
|
|
142
|
+
detail: `context_pack parent-dir basename '${dirName}' collides with an earlier declared path; only the first is routed (banked collision-detection lesson)`,
|
|
143
|
+
});
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
fs.copyDir(sourcePackDir, targetAbs);
|
|
147
|
+
routedDirNames.add(dirName);
|
|
148
|
+
records.push({
|
|
149
|
+
declaredPath: declared,
|
|
150
|
+
status: "routed",
|
|
151
|
+
installedAt: targetAbs,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
const routedCount = records.filter((r) => r.status === "routed").length;
|
|
155
|
+
const rejectedCount = records.length - routedCount;
|
|
156
|
+
return { records, routedCount, rejectedCount };
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=bundle-context-packs-router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-context-packs-router.js","sourceRoot":"","sources":["../../src/domain/bundle-context-packs-router.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bundle plugins router (Item 6 / slice-05 Checkpoint 7.3c).
|
|
3
|
+
*
|
|
4
|
+
* Pure function. Copies plugin trees declared in a bundle manifest's
|
|
5
|
+
* plugins[] block from the bundle's extracted tree to the operator plugins
|
|
6
|
+
* library (per-id subdir). Mirrors the bundle-skills-router pattern: FsOps
|
|
7
|
+
* injection; both-sides path containment (banked
|
|
8
|
+
* feedback_pre_existing_trust_boundary_reuse_canonical_helper addendum:
|
|
9
|
+
* contain BOTH source AND target when handling untrusted path input);
|
|
10
|
+
* missing source surfaces as status=missing; unsafe paths rejected with
|
|
11
|
+
* status=unsafe.
|
|
12
|
+
*
|
|
13
|
+
* Per orch-ratified HYBRID decision: v0 source.kind is local only (path
|
|
14
|
+
* under the bundle's extracted tree). Other kinds (external operator-host
|
|
15
|
+
* paths, remote fetch) reserved for future.
|
|
16
|
+
*
|
|
17
|
+
* /install handler integration lands at Checkpoint 7.3d.
|
|
18
|
+
*/
|
|
19
|
+
/** Filesystem injection point — real impl wraps node:fs. Tests substitute in-memory. */
|
|
20
|
+
export interface PluginsRouterFsOps {
|
|
21
|
+
exists: (path: string) => boolean;
|
|
22
|
+
isDirectory: (path: string) => boolean;
|
|
23
|
+
mkdirp: (path: string) => void;
|
|
24
|
+
copyDir: (src: string, dest: string) => void;
|
|
25
|
+
}
|
|
26
|
+
/** A plugin reference in the bundle manifest. Matches the daemon's BundlePluginReference shape. */
|
|
27
|
+
export interface PluginRoutingInput {
|
|
28
|
+
id: string;
|
|
29
|
+
source: {
|
|
30
|
+
kind: "local";
|
|
31
|
+
path: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** Inputs to routePlugins. */
|
|
35
|
+
export interface RoutePluginsInput {
|
|
36
|
+
/** Absolute path to the bundle's extracted root (tmp dir from unpack). */
|
|
37
|
+
bundleRoot: string;
|
|
38
|
+
/** Plugin references declared in the manifest. */
|
|
39
|
+
declaredPlugins: PluginRoutingInput[];
|
|
40
|
+
/** Absolute path to the operator plugins library (default ~/.openrig/plugins). */
|
|
41
|
+
targetPluginsDir: string;
|
|
42
|
+
}
|
|
43
|
+
/** One routed plugin (or one rejection). */
|
|
44
|
+
export interface RoutedPluginRecord {
|
|
45
|
+
/** Plugin id from manifest.plugins[].id. */
|
|
46
|
+
id: string;
|
|
47
|
+
/** "routed" = directory copied; "missing" = source not in bundle; "unsafe"
|
|
48
|
+
* = source or target escapes its bounding directory; "not_directory" =
|
|
49
|
+
* source path is not a directory. */
|
|
50
|
+
status: "routed" | "missing" | "unsafe" | "not_directory";
|
|
51
|
+
/** Where the plugin landed in the target library (absolute path), if routed. */
|
|
52
|
+
installedAt?: string;
|
|
53
|
+
/** Human-readable detail. */
|
|
54
|
+
detail?: string;
|
|
55
|
+
}
|
|
56
|
+
/** Aggregate routing result. */
|
|
57
|
+
export interface RoutePluginsResult {
|
|
58
|
+
records: RoutedPluginRecord[];
|
|
59
|
+
routedCount: number;
|
|
60
|
+
rejectedCount: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Route each declared plugin from the bundle tree to the operator plugins
|
|
64
|
+
* library as <targetPluginsDir>/<id>/. Per-plugin safety: BOTH source path
|
|
65
|
+
* (under bundleRoot) AND target path (under targetPluginsDir) are
|
|
66
|
+
* containment-checked. Banked both-sides-of-trust-boundary lesson applied.
|
|
67
|
+
*/
|
|
68
|
+
export declare function routePlugins(input: RoutePluginsInput, fs: PluginsRouterFsOps): RoutePluginsResult;
|
|
69
|
+
//# sourceMappingURL=bundle-plugins-router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle-plugins-router.d.ts","sourceRoot":"","sources":["../../src/domain/bundle-plugins-router.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,wFAAwF;AACxF,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACvC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C;AAED,mGAAmG;AACnG,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE;QAAE,IAAI,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACzC;AAED,8BAA8B;AAC9B,MAAM,WAAW,iBAAiB;IAChC,0EAA0E;IAC1E,UAAU,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,eAAe,EAAE,kBAAkB,EAAE,CAAC;IACtC,kFAAkF;IAClF,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,4CAA4C;AAC5C,MAAM,WAAW,kBAAkB;IACjC,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX;;yCAEqC;IACrC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,eAAe,CAAC;IAC1D,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,gCAAgC;AAChC,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,EAAE,EAAE,EAAE,kBAAkB,GAAG,kBAAkB,CA8DjG"}
|