oh-my-copilot 5.5.0 → 5.6.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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +1 -0
- package/bridge/__pycache__/gyoshu_bridge.cpython-312.pyc +0 -0
- package/bridge/claude-md-coordinator.cjs +2 -2
- package/bridge/cli.cjs +6290 -3436
- package/bridge/mcp-server.cjs +637 -503
- package/bridge/runtime-cli.cjs +516 -213
- package/bridge/team-bridge.cjs +141 -135
- package/bridge/team-mcp.cjs +201 -129
- package/bridge/team.js +473 -237
- package/copilot/hooks.json +43 -0
- package/dist/__tests__/chain-enqueuer-registration.test.d.ts +11 -0
- package/dist/__tests__/chain-enqueuer-registration.test.d.ts.map +1 -0
- package/dist/__tests__/chain-enqueuer-registration.test.js +122 -0
- package/dist/__tests__/chain-enqueuer-registration.test.js.map +1 -0
- package/dist/__tests__/copilot-hooks-manifest.test.js +3 -1
- package/dist/__tests__/copilot-hooks-manifest.test.js.map +1 -1
- package/dist/__tests__/directory-context-injector.test.js +41 -1
- package/dist/__tests__/directory-context-injector.test.js.map +1 -1
- package/dist/__tests__/hook-bridge-main-module.test.d.ts +2 -0
- package/dist/__tests__/hook-bridge-main-module.test.d.ts.map +1 -0
- package/dist/__tests__/hook-bridge-main-module.test.js +48 -0
- package/dist/__tests__/hook-bridge-main-module.test.js.map +1 -0
- package/dist/__tests__/ralph-prd-stale.test.js +12 -1
- package/dist/__tests__/ralph-prd-stale.test.js.map +1 -1
- package/dist/__tests__/ralph-prd.test.js +56 -0
- package/dist/__tests__/ralph-prd.test.js.map +1 -1
- package/dist/__tests__/run-cjs-graceful-fallback.test.js +2 -0
- package/dist/__tests__/run-cjs-graceful-fallback.test.js.map +1 -1
- package/dist/__tests__/session-end-forwarder-fallback.test.d.ts +2 -0
- package/dist/__tests__/session-end-forwarder-fallback.test.d.ts.map +1 -0
- package/dist/__tests__/session-end-forwarder-fallback.test.js +138 -0
- package/dist/__tests__/session-end-forwarder-fallback.test.js.map +1 -0
- package/dist/cli/__tests__/autoresearch-setup-session.test.js +67 -3
- package/dist/cli/__tests__/autoresearch-setup-session.test.js.map +1 -1
- package/dist/cli/__tests__/launch.test.js +73 -11
- package/dist/cli/__tests__/launch.test.js.map +1 -1
- package/dist/cli/__tests__/plugin-dir-capture.test.js +45 -0
- package/dist/cli/__tests__/plugin-dir-capture.test.js.map +1 -1
- package/dist/cli/__tests__/ralph-afk.test.d.ts +2 -0
- package/dist/cli/__tests__/ralph-afk.test.d.ts.map +1 -0
- package/dist/cli/__tests__/ralph-afk.test.js +312 -0
- package/dist/cli/__tests__/ralph-afk.test.js.map +1 -0
- package/dist/cli/__tests__/team.test.js +170 -0
- package/dist/cli/__tests__/team.test.js.map +1 -1
- package/dist/cli/__tests__/tmux-utils.test.js +132 -16
- package/dist/cli/__tests__/tmux-utils.test.js.map +1 -1
- package/dist/cli/autoresearch-setup-session.d.ts.map +1 -1
- package/dist/cli/autoresearch-setup-session.js +29 -9
- package/dist/cli/autoresearch-setup-session.js.map +1 -1
- package/dist/cli/commands/__tests__/factory-init.test.d.ts +2 -0
- package/dist/cli/commands/__tests__/factory-init.test.d.ts.map +1 -0
- package/dist/cli/commands/__tests__/factory-init.test.js +90 -0
- package/dist/cli/commands/__tests__/factory-init.test.js.map +1 -0
- package/dist/cli/commands/__tests__/intake-headless-flag.test.d.ts +2 -0
- package/dist/cli/commands/__tests__/intake-headless-flag.test.d.ts.map +1 -0
- package/dist/cli/commands/__tests__/intake-headless-flag.test.js +30 -0
- package/dist/cli/commands/__tests__/intake-headless-flag.test.js.map +1 -0
- package/dist/cli/commands/__tests__/intake.test.d.ts +2 -0
- package/dist/cli/commands/__tests__/intake.test.d.ts.map +1 -0
- package/dist/cli/commands/__tests__/intake.test.js +257 -0
- package/dist/cli/commands/__tests__/intake.test.js.map +1 -0
- package/dist/cli/commands/factory.d.ts +61 -0
- package/dist/cli/commands/factory.d.ts.map +1 -0
- package/dist/cli/commands/factory.js +190 -0
- package/dist/cli/commands/factory.js.map +1 -0
- package/dist/cli/commands/intake.d.ts +94 -0
- package/dist/cli/commands/intake.d.ts.map +1 -0
- package/dist/cli/commands/intake.js +311 -0
- package/dist/cli/commands/intake.js.map +1 -0
- package/dist/cli/commands/ralph.d.ts +88 -0
- package/dist/cli/commands/ralph.d.ts.map +1 -0
- package/dist/cli/commands/ralph.js +456 -0
- package/dist/cli/commands/ralph.js.map +1 -0
- package/dist/cli/commands/team.d.ts.map +1 -1
- package/dist/cli/commands/team.js +25 -5
- package/dist/cli/commands/team.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +7 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/launch.d.ts.map +1 -1
- package/dist/cli/launch.js +32 -7
- package/dist/cli/launch.js.map +1 -1
- package/dist/cli/team.d.ts.map +1 -1
- package/dist/cli/team.js +61 -7
- package/dist/cli/team.js.map +1 -1
- package/dist/cli/tmux-utils.d.ts +26 -0
- package/dist/cli/tmux-utils.d.ts.map +1 -1
- package/dist/cli/tmux-utils.js +61 -9
- package/dist/cli/tmux-utils.js.map +1 -1
- package/dist/config/__tests__/loader.test.js +138 -0
- package/dist/config/__tests__/loader.test.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +17 -0
- package/dist/config/loader.js.map +1 -1
- package/dist/factory/__tests__/check-run.test.d.ts +2 -0
- package/dist/factory/__tests__/check-run.test.d.ts.map +1 -0
- package/dist/factory/__tests__/check-run.test.js +213 -0
- package/dist/factory/__tests__/check-run.test.js.map +1 -0
- package/dist/factory/__tests__/listener.test.d.ts +2 -0
- package/dist/factory/__tests__/listener.test.d.ts.map +1 -0
- package/dist/factory/__tests__/listener.test.js +312 -0
- package/dist/factory/__tests__/listener.test.js.map +1 -0
- package/dist/factory/__tests__/map-frontier.test.d.ts +2 -0
- package/dist/factory/__tests__/map-frontier.test.d.ts.map +1 -0
- package/dist/factory/__tests__/map-frontier.test.js +128 -0
- package/dist/factory/__tests__/map-frontier.test.js.map +1 -0
- package/dist/factory/__tests__/map-ingest.test.d.ts +2 -0
- package/dist/factory/__tests__/map-ingest.test.d.ts.map +1 -0
- package/dist/factory/__tests__/map-ingest.test.js +166 -0
- package/dist/factory/__tests__/map-ingest.test.js.map +1 -0
- package/dist/factory/__tests__/map-run.test.d.ts +2 -0
- package/dist/factory/__tests__/map-run.test.d.ts.map +1 -0
- package/dist/factory/__tests__/map-run.test.js +148 -0
- package/dist/factory/__tests__/map-run.test.js.map +1 -0
- package/dist/factory/__tests__/status.test.d.ts +2 -0
- package/dist/factory/__tests__/status.test.d.ts.map +1 -0
- package/dist/factory/__tests__/status.test.js +77 -0
- package/dist/factory/__tests__/status.test.js.map +1 -0
- package/dist/factory/listener.d.ts +98 -0
- package/dist/factory/listener.d.ts.map +1 -0
- package/dist/factory/listener.js +315 -0
- package/dist/factory/listener.js.map +1 -0
- package/dist/factory/map-frontier.d.ts +73 -0
- package/dist/factory/map-frontier.d.ts.map +1 -0
- package/dist/factory/map-frontier.js +147 -0
- package/dist/factory/map-frontier.js.map +1 -0
- package/dist/factory/map-ingest.d.ts +79 -0
- package/dist/factory/map-ingest.d.ts.map +1 -0
- package/dist/factory/map-ingest.js +232 -0
- package/dist/factory/map-ingest.js.map +1 -0
- package/dist/factory/map-run.d.ts +74 -0
- package/dist/factory/map-run.d.ts.map +1 -0
- package/dist/factory/map-run.js +229 -0
- package/dist/factory/map-run.js.map +1 -0
- package/dist/factory/status.d.ts +33 -0
- package/dist/factory/status.d.ts.map +1 -0
- package/dist/factory/status.js +93 -0
- package/dist/factory/status.js.map +1 -0
- package/dist/factory/watchdog.d.ts +46 -0
- package/dist/factory/watchdog.d.ts.map +1 -0
- package/dist/factory/watchdog.js +130 -0
- package/dist/factory/watchdog.js.map +1 -0
- package/dist/factory/watchdog.test.d.ts +2 -0
- package/dist/factory/watchdog.test.d.ts.map +1 -0
- package/dist/factory/watchdog.test.js +111 -0
- package/dist/factory/watchdog.test.js.map +1 -0
- package/dist/graph/runtime/native-contained-fs.js +1 -1
- package/dist/graph/runtime/native-contained-fs.js.map +1 -1
- package/dist/hooks/__tests__/compaction-concurrency.test.js +20 -20
- package/dist/hooks/__tests__/compaction-concurrency.test.js.map +1 -1
- package/dist/hooks/__tests__/workflow-drift-guard-script.test.js +27 -0
- package/dist/hooks/__tests__/workflow-drift-guard-script.test.js.map +1 -1
- package/dist/hooks/bridge.d.ts +8 -0
- package/dist/hooks/bridge.d.ts.map +1 -1
- package/dist/hooks/bridge.js +38 -9
- package/dist/hooks/bridge.js.map +1 -1
- package/dist/hooks/code-simplifier/__tests__/global-config-path.test.d.ts +2 -0
- package/dist/hooks/code-simplifier/__tests__/global-config-path.test.d.ts.map +1 -0
- package/dist/hooks/code-simplifier/__tests__/global-config-path.test.js +89 -0
- package/dist/hooks/code-simplifier/__tests__/global-config-path.test.js.map +1 -0
- package/dist/hooks/code-simplifier/index.d.ts +1 -1
- package/dist/hooks/code-simplifier/index.js +1 -1
- package/dist/hooks/code-simplifier/jev-shadow.d.ts +5 -4
- package/dist/hooks/code-simplifier/jev-shadow.d.ts.map +1 -1
- package/dist/hooks/code-simplifier/jev-shadow.js +9 -4
- package/dist/hooks/code-simplifier/jev-shadow.js.map +1 -1
- package/dist/hooks/directory-readme-injector/index.d.ts.map +1 -1
- package/dist/hooks/directory-readme-injector/index.js +11 -2
- package/dist/hooks/directory-readme-injector/index.js.map +1 -1
- package/dist/hooks/jev/__tests__/active-mode.test.d.ts +9 -0
- package/dist/hooks/jev/__tests__/active-mode.test.d.ts.map +1 -0
- package/dist/hooks/jev/__tests__/active-mode.test.js +252 -0
- package/dist/hooks/jev/__tests__/active-mode.test.js.map +1 -0
- package/dist/hooks/jev/points.d.ts +3 -1
- package/dist/hooks/jev/points.d.ts.map +1 -1
- package/dist/hooks/jev/points.js +1 -0
- package/dist/hooks/jev/points.js.map +1 -1
- package/dist/hooks/jev/resolver.d.ts.map +1 -1
- package/dist/hooks/jev/resolver.js +17 -1
- package/dist/hooks/jev/resolver.js.map +1 -1
- package/dist/hooks/keyword-detector/index.d.ts +2 -0
- package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
- package/dist/hooks/keyword-detector/index.js +3 -3
- package/dist/hooks/keyword-detector/index.js.map +1 -1
- package/dist/hooks/keyword-detector/jev-shadow.d.ts +6 -4
- package/dist/hooks/keyword-detector/jev-shadow.d.ts.map +1 -1
- package/dist/hooks/keyword-detector/jev-shadow.js +18 -4
- package/dist/hooks/keyword-detector/jev-shadow.js.map +1 -1
- package/dist/hooks/learner/jev-shadow.d.ts +4 -3
- package/dist/hooks/learner/jev-shadow.d.ts.map +1 -1
- package/dist/hooks/learner/jev-shadow.js +14 -3
- package/dist/hooks/learner/jev-shadow.js.map +1 -1
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/index.js +22 -6
- package/dist/hooks/persistent-mode/index.js.map +1 -1
- package/dist/hooks/persistent-mode/jev-shadow.d.ts +7 -5
- package/dist/hooks/persistent-mode/jev-shadow.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/jev-shadow.js +28 -6
- package/dist/hooks/persistent-mode/jev-shadow.js.map +1 -1
- package/dist/hooks/preemptive-compaction/__tests__/jev-shadow.test.js +3 -3
- package/dist/hooks/preemptive-compaction/__tests__/jev-shadow.test.js.map +1 -1
- package/dist/hooks/preemptive-compaction/index.d.ts +5 -1
- package/dist/hooks/preemptive-compaction/index.d.ts.map +1 -1
- package/dist/hooks/preemptive-compaction/index.js +13 -8
- package/dist/hooks/preemptive-compaction/index.js.map +1 -1
- package/dist/hooks/preemptive-compaction/jev-shadow.d.ts +6 -5
- package/dist/hooks/preemptive-compaction/jev-shadow.d.ts.map +1 -1
- package/dist/hooks/preemptive-compaction/jev-shadow.js +18 -5
- package/dist/hooks/preemptive-compaction/jev-shadow.js.map +1 -1
- package/dist/hooks/ralph/__tests__/feedback-baseline.test.d.ts +2 -0
- package/dist/hooks/ralph/__tests__/feedback-baseline.test.d.ts.map +1 -0
- package/dist/hooks/ralph/__tests__/feedback-baseline.test.js +250 -0
- package/dist/hooks/ralph/__tests__/feedback-baseline.test.js.map +1 -0
- package/dist/hooks/ralph/feedback-baseline.d.ts +58 -0
- package/dist/hooks/ralph/feedback-baseline.d.ts.map +1 -0
- package/dist/hooks/ralph/feedback-baseline.js +141 -0
- package/dist/hooks/ralph/feedback-baseline.js.map +1 -0
- package/dist/hooks/ralph/index.d.ts +1 -1
- package/dist/hooks/ralph/index.d.ts.map +1 -1
- package/dist/hooks/ralph/index.js +1 -1
- package/dist/hooks/ralph/index.js.map +1 -1
- package/dist/hooks/ralph/jev-shadow.d.ts +4 -3
- package/dist/hooks/ralph/jev-shadow.d.ts.map +1 -1
- package/dist/hooks/ralph/jev-shadow.js +14 -4
- package/dist/hooks/ralph/jev-shadow.js.map +1 -1
- package/dist/hooks/ralph/loop.d.ts +7 -0
- package/dist/hooks/ralph/loop.d.ts.map +1 -1
- package/dist/hooks/ralph/loop.js +21 -0
- package/dist/hooks/ralph/loop.js.map +1 -1
- package/dist/hooks/ralph/prd.d.ts +17 -0
- package/dist/hooks/ralph/prd.d.ts.map +1 -1
- package/dist/hooks/ralph/prd.js +26 -1
- package/dist/hooks/ralph/prd.js.map +1 -1
- package/dist/hooks/registry/__tests__/registry.test.js +12 -4
- package/dist/hooks/registry/__tests__/registry.test.js.map +1 -1
- package/dist/hooks/rules-injector/matcher.d.ts.map +1 -1
- package/dist/hooks/rules-injector/matcher.js +35 -7
- package/dist/hooks/rules-injector/matcher.js.map +1 -1
- package/dist/hooks/rules-injector/matcher.test.d.ts +2 -0
- package/dist/hooks/rules-injector/matcher.test.d.ts.map +1 -0
- package/dist/hooks/rules-injector/matcher.test.js +58 -0
- package/dist/hooks/rules-injector/matcher.test.js.map +1 -0
- package/dist/hooks/session-end/__tests__/action-runner.test.js +51 -0
- package/dist/hooks/session-end/__tests__/action-runner.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/chain-enqueuer.test.d.ts +2 -0
- package/dist/hooks/session-end/__tests__/chain-enqueuer.test.d.ts.map +1 -0
- package/dist/hooks/session-end/__tests__/chain-enqueuer.test.js +274 -0
- package/dist/hooks/session-end/__tests__/chain-enqueuer.test.js.map +1 -0
- package/dist/hooks/session-end/__tests__/check-evidence.test.d.ts +2 -0
- package/dist/hooks/session-end/__tests__/check-evidence.test.d.ts.map +1 -0
- package/dist/hooks/session-end/__tests__/check-evidence.test.js +171 -0
- package/dist/hooks/session-end/__tests__/check-evidence.test.js.map +1 -0
- package/dist/hooks/session-end/__tests__/cleanup-manifest.test.js +21 -0
- package/dist/hooks/session-end/__tests__/cleanup-manifest.test.js.map +1 -1
- package/dist/hooks/session-end/__tests__/foreground-bootstrap.test.d.ts +10 -0
- package/dist/hooks/session-end/__tests__/foreground-bootstrap.test.d.ts.map +1 -0
- package/dist/hooks/session-end/__tests__/foreground-bootstrap.test.js +123 -0
- package/dist/hooks/session-end/__tests__/foreground-bootstrap.test.js.map +1 -0
- package/dist/hooks/session-end/__tests__/guardrails.test.d.ts +2 -0
- package/dist/hooks/session-end/__tests__/guardrails.test.d.ts.map +1 -0
- package/dist/hooks/session-end/__tests__/guardrails.test.js +184 -0
- package/dist/hooks/session-end/__tests__/guardrails.test.js.map +1 -0
- package/dist/hooks/session-end/__tests__/process-session-end-worker-spawn.test.d.ts +9 -0
- package/dist/hooks/session-end/__tests__/process-session-end-worker-spawn.test.d.ts.map +1 -0
- package/dist/hooks/session-end/__tests__/process-session-end-worker-spawn.test.js +96 -0
- package/dist/hooks/session-end/__tests__/process-session-end-worker-spawn.test.js.map +1 -0
- package/dist/hooks/session-end/__tests__/routing.test.d.ts +2 -0
- package/dist/hooks/session-end/__tests__/routing.test.d.ts.map +1 -0
- package/dist/hooks/session-end/__tests__/routing.test.js +135 -0
- package/dist/hooks/session-end/__tests__/routing.test.js.map +1 -0
- package/dist/hooks/session-end/__tests__/spawn-next.test.d.ts +2 -0
- package/dist/hooks/session-end/__tests__/spawn-next.test.d.ts.map +1 -0
- package/dist/hooks/session-end/__tests__/spawn-next.test.js +501 -0
- package/dist/hooks/session-end/__tests__/spawn-next.test.js.map +1 -0
- package/dist/hooks/session-end/__tests__/worker.test.js +102 -0
- package/dist/hooks/session-end/__tests__/worker.test.js.map +1 -1
- package/dist/hooks/session-end/action-runner.d.ts.map +1 -1
- package/dist/hooks/session-end/action-runner.js +24 -2
- package/dist/hooks/session-end/action-runner.js.map +1 -1
- package/dist/hooks/session-end/chain-enqueuer.d.ts +45 -0
- package/dist/hooks/session-end/chain-enqueuer.d.ts.map +1 -0
- package/dist/hooks/session-end/chain-enqueuer.js +191 -0
- package/dist/hooks/session-end/chain-enqueuer.js.map +1 -0
- package/dist/hooks/session-end/check-evidence.d.ts +29 -0
- package/dist/hooks/session-end/check-evidence.d.ts.map +1 -0
- package/dist/hooks/session-end/check-evidence.js +52 -0
- package/dist/hooks/session-end/check-evidence.js.map +1 -0
- package/dist/hooks/session-end/cleanup-manifest.d.ts +1 -1
- package/dist/hooks/session-end/cleanup-manifest.d.ts.map +1 -1
- package/dist/hooks/session-end/cleanup-manifest.js +22 -2
- package/dist/hooks/session-end/cleanup-manifest.js.map +1 -1
- package/dist/hooks/session-end/foreground-bootstrap.d.ts.map +1 -1
- package/dist/hooks/session-end/foreground-bootstrap.js +30 -4
- package/dist/hooks/session-end/foreground-bootstrap.js.map +1 -1
- package/dist/hooks/session-end/guardrails.d.ts +67 -0
- package/dist/hooks/session-end/guardrails.d.ts.map +1 -0
- package/dist/hooks/session-end/guardrails.js +149 -0
- package/dist/hooks/session-end/guardrails.js.map +1 -0
- package/dist/hooks/session-end/index.d.ts.map +1 -1
- package/dist/hooks/session-end/index.js +14 -6
- package/dist/hooks/session-end/index.js.map +1 -1
- package/dist/hooks/session-end/routing.d.ts +53 -0
- package/dist/hooks/session-end/routing.d.ts.map +1 -0
- package/dist/hooks/session-end/routing.js +75 -0
- package/dist/hooks/session-end/routing.js.map +1 -0
- package/dist/hooks/session-end/spawn-next.d.ts +117 -0
- package/dist/hooks/session-end/spawn-next.d.ts.map +1 -0
- package/dist/hooks/session-end/spawn-next.js +292 -0
- package/dist/hooks/session-end/spawn-next.js.map +1 -0
- package/dist/hooks/session-end/worker.d.ts.map +1 -1
- package/dist/hooks/session-end/worker.js +45 -5
- package/dist/hooks/session-end/worker.js.map +1 -1
- package/dist/hooks/task-size-detector/jev-shadow.d.ts +2 -1
- package/dist/hooks/task-size-detector/jev-shadow.d.ts.map +1 -1
- package/dist/hooks/task-size-detector/jev-shadow.js +19 -1
- package/dist/hooks/task-size-detector/jev-shadow.js.map +1 -1
- package/dist/installer/__tests__/hook-command-portability.test.js +57 -1
- package/dist/installer/__tests__/hook-command-portability.test.js.map +1 -1
- package/dist/installer/__tests__/mcp-registry.test.js +98 -0
- package/dist/installer/__tests__/mcp-registry.test.js.map +1 -1
- package/dist/installer/hooks.d.ts +7 -0
- package/dist/installer/hooks.d.ts.map +1 -1
- package/dist/installer/hooks.js +15 -0
- package/dist/installer/hooks.js.map +1 -1
- package/dist/installer/index.d.ts +12 -0
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +3 -1
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/mcp-registry.d.ts.map +1 -1
- package/dist/installer/mcp-registry.js +56 -6
- package/dist/installer/mcp-registry.js.map +1 -1
- package/dist/lib/__tests__/host-load-gate.test.d.ts +2 -0
- package/dist/lib/__tests__/host-load-gate.test.d.ts.map +1 -0
- package/dist/lib/__tests__/host-load-gate.test.js +377 -0
- package/dist/lib/__tests__/host-load-gate.test.js.map +1 -0
- package/dist/lib/__tests__/runs-ledger.test.d.ts +2 -0
- package/dist/lib/__tests__/runs-ledger.test.d.ts.map +1 -0
- package/dist/lib/__tests__/runs-ledger.test.js +99 -0
- package/dist/lib/__tests__/runs-ledger.test.js.map +1 -0
- package/dist/lib/atomic-write.d.ts +16 -0
- package/dist/lib/atomic-write.d.ts.map +1 -1
- package/dist/lib/atomic-write.js +27 -4
- package/dist/lib/atomic-write.js.map +1 -1
- package/dist/lib/host-load-gate.d.ts +110 -0
- package/dist/lib/host-load-gate.d.ts.map +1 -0
- package/dist/lib/host-load-gate.js +228 -0
- package/dist/lib/host-load-gate.js.map +1 -0
- package/dist/lib/mode-state-io.d.ts.map +1 -1
- package/dist/lib/mode-state-io.js +55 -18
- package/dist/lib/mode-state-io.js.map +1 -1
- package/dist/lib/runs-ledger.d.ts +45 -0
- package/dist/lib/runs-ledger.d.ts.map +1 -0
- package/dist/lib/runs-ledger.js +141 -0
- package/dist/lib/runs-ledger.js.map +1 -0
- package/dist/platform/executable-resolution.d.ts +13 -0
- package/dist/platform/executable-resolution.d.ts.map +1 -1
- package/dist/platform/executable-resolution.js +16 -0
- package/dist/platform/executable-resolution.js.map +1 -1
- package/dist/shared/types.d.ts +3 -0
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/team/__tests__/model-contract.test.js +63 -1
- package/dist/team/__tests__/model-contract.test.js.map +1 -1
- package/dist/team/__tests__/stage-router.test.js +22 -0
- package/dist/team/__tests__/stage-router.test.js.map +1 -1
- package/dist/team/__tests__/team-owner-epoch.test.js +33 -0
- package/dist/team/__tests__/team-owner-epoch.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.create-team.test.js +60 -2
- package/dist/team/__tests__/tmux-session.create-team.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.psmux.test.js +12 -0
- package/dist/team/__tests__/tmux-session.psmux.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.test.js +230 -7
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/__tests__/worker-launch-ack.test.js +62 -0
- package/dist/team/__tests__/worker-launch-ack.test.js.map +1 -1
- package/dist/team/model-contract.d.ts +3 -2
- package/dist/team/model-contract.d.ts.map +1 -1
- package/dist/team/model-contract.js +35 -10
- package/dist/team/model-contract.js.map +1 -1
- package/dist/team/runtime-v2.d.ts +13 -0
- package/dist/team/runtime-v2.d.ts.map +1 -1
- package/dist/team/runtime-v2.js +112 -7
- package/dist/team/runtime-v2.js.map +1 -1
- package/dist/team/scaling.d.ts.map +1 -1
- package/dist/team/scaling.js +4 -1
- package/dist/team/scaling.js.map +1 -1
- package/dist/team/stage-router.d.ts.map +1 -1
- package/dist/team/stage-router.js +3 -1
- package/dist/team/stage-router.js.map +1 -1
- package/dist/team/team-owner-epoch.d.ts.map +1 -1
- package/dist/team/team-owner-epoch.js +4 -7
- package/dist/team/team-owner-epoch.js.map +1 -1
- package/dist/team/tmux-session.d.ts +8 -1
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +71 -19
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/team/worker-launch-ack.d.ts +1 -1
- package/dist/team/worker-launch-ack.d.ts.map +1 -1
- package/dist/team/worker-launch-ack.js +28 -1
- package/dist/team/worker-launch-ack.js.map +1 -1
- package/dist/tools/lsp/__tests__/client-handle-data.test.js +83 -0
- package/dist/tools/lsp/__tests__/client-handle-data.test.js.map +1 -1
- package/dist/tools/lsp/client.d.ts.map +1 -1
- package/dist/tools/lsp/client.js +41 -11
- package/dist/tools/lsp/client.js.map +1 -1
- package/docs/CLAUDE.md +1 -1
- package/docs/HOOKS.md +235 -0
- package/docs/MIGRATION.md +132 -0
- package/docs/REFERENCE.md +26 -1
- package/docs/adr/03672-env-activated-active-mode.md +18 -1
- package/docs/design/FACTORY-FINAL-DESIGN.md +114 -0
- package/docs/design/P2-RUN-LEDGER-AND-INTAKE-PLAN.md +83 -0
- package/docs/factory/t6-acceptance/acceptance-comment.md +36 -0
- package/hooks/hooks.json +22 -1
- package/package.json +6 -2
- package/plugin.json +1 -1
- package/scripts/build-contained-fs.mjs +24 -2
- package/scripts/ci/check-multirepo-paths.mjs +3 -0
- package/scripts/code-simplifier.mjs +24 -2
- package/scripts/dev/repro-state-lock.mjs +67 -0
- package/scripts/git-guardrails.mjs +581 -0
- package/scripts/keyword-detector.mjs +21 -4
- package/scripts/lib/atomic-write.mjs +31 -8
- package/scripts/lib/jev-shadow.mjs +68 -29
- package/scripts/lib/run-reaper.mjs +114 -0
- package/scripts/lib/state-lock.mjs +22 -13
- package/scripts/post-tool-verifier.mjs +8 -2
- package/scripts/postinstall-contained-fs.mjs +56 -0
- package/scripts/pre-tool-enforcer.mjs +25 -8
- package/scripts/run.cjs +18 -0
- package/scripts/runs-reconciler.mjs +103 -0
- package/scripts/stale-run-reporter.mjs +73 -0
- package/scripts/workflow-drift-guard.mjs +6 -1
- package/skills/autopilot/SKILL.md +10 -2
- package/skills/harbor/SKILL.md +8 -0
- package/skills/omc-setup/phases/04-welcome.md +1 -1
- package/skills/ralph/SKILL.md +32 -15
- package/skills/refit/SKILL.md +8 -0
- package/skills/team/SKILL.md +2 -0
- package/templates/hooks/code-simplifier.mjs +24 -2
- package/templates/hooks/lib/atomic-write.mjs +31 -8
- package/templates/hooks/session-end.mjs +99 -0
- package/templates/hooks/workflow-drift-guard.mjs +6 -1
package/bridge/team-bridge.cjs
CHANGED
|
@@ -1188,13 +1188,13 @@ var init_worker_canonicalization = __esm({
|
|
|
1188
1188
|
});
|
|
1189
1189
|
|
|
1190
1190
|
// src/team/monitor.ts
|
|
1191
|
-
var
|
|
1191
|
+
var import_fs20, import_promises3, import_path22;
|
|
1192
1192
|
var init_monitor = __esm({
|
|
1193
1193
|
"src/team/monitor.ts"() {
|
|
1194
1194
|
"use strict";
|
|
1195
|
-
|
|
1195
|
+
import_fs20 = require("fs");
|
|
1196
1196
|
import_promises3 = require("fs/promises");
|
|
1197
|
-
|
|
1197
|
+
import_path22 = require("path");
|
|
1198
1198
|
init_types();
|
|
1199
1199
|
init_contracts();
|
|
1200
1200
|
init_state_paths();
|
|
@@ -1213,14 +1213,14 @@ __export(bridge_entry_exports, {
|
|
|
1213
1213
|
validateConfigPath: () => validateConfigPath
|
|
1214
1214
|
});
|
|
1215
1215
|
module.exports = __toCommonJS(bridge_entry_exports);
|
|
1216
|
-
var
|
|
1217
|
-
var
|
|
1218
|
-
var
|
|
1216
|
+
var import_fs29 = require("fs");
|
|
1217
|
+
var import_path31 = require("path");
|
|
1218
|
+
var import_os8 = require("os");
|
|
1219
1219
|
|
|
1220
1220
|
// src/team/mcp-team-bridge.ts
|
|
1221
1221
|
var import_child_process8 = require("child_process");
|
|
1222
|
-
var
|
|
1223
|
-
var
|
|
1222
|
+
var import_fs28 = require("fs");
|
|
1223
|
+
var import_path30 = require("path");
|
|
1224
1224
|
|
|
1225
1225
|
// src/team/fs-utils.ts
|
|
1226
1226
|
var import_fs = require("fs");
|
|
@@ -1278,18 +1278,18 @@ function validateResolvedPath(resolvedPath, expectedBase) {
|
|
|
1278
1278
|
init_worktree_paths();
|
|
1279
1279
|
|
|
1280
1280
|
// src/team/task-file-ops.ts
|
|
1281
|
-
var
|
|
1282
|
-
var
|
|
1281
|
+
var import_fs22 = require("fs");
|
|
1282
|
+
var import_path24 = require("path");
|
|
1283
1283
|
init_worktree_paths();
|
|
1284
1284
|
init_config_dir();
|
|
1285
1285
|
|
|
1286
1286
|
// src/team/tmux-session.ts
|
|
1287
|
-
var
|
|
1287
|
+
var import_fs21 = require("fs");
|
|
1288
1288
|
var import_crypto6 = require("crypto");
|
|
1289
1289
|
var import_child_process7 = require("child_process");
|
|
1290
1290
|
var import_util3 = require("util");
|
|
1291
|
-
var
|
|
1292
|
-
var
|
|
1291
|
+
var import_path23 = require("path");
|
|
1292
|
+
var import_os7 = require("os");
|
|
1293
1293
|
|
|
1294
1294
|
// src/cli/tmux-utils.ts
|
|
1295
1295
|
var import_child_process5 = require("child_process");
|
|
@@ -2398,6 +2398,7 @@ var PSMUX_NS_DIR = import_path15.win32.join(PSMUX_REGISTRY_DIR, "omg-ns");
|
|
|
2398
2398
|
// src/team/tmux-session.ts
|
|
2399
2399
|
init_types2();
|
|
2400
2400
|
init_team_owner_epoch();
|
|
2401
|
+
init_native_contained_fs();
|
|
2401
2402
|
|
|
2402
2403
|
// src/platform/process-utils.ts
|
|
2403
2404
|
var import_child_process6 = require("child_process");
|
|
@@ -2588,6 +2589,11 @@ function withFileLockSync(lockPath, fn, opts) {
|
|
|
2588
2589
|
}
|
|
2589
2590
|
}
|
|
2590
2591
|
|
|
2592
|
+
// src/lib/host-load-gate.ts
|
|
2593
|
+
var import_os6 = require("os");
|
|
2594
|
+
var import_fs18 = require("fs");
|
|
2595
|
+
var import_path20 = require("path");
|
|
2596
|
+
|
|
2591
2597
|
// src/team/worker-launch-ack.ts
|
|
2592
2598
|
var WORKER_LAUNCH_RECOVERY_GATE_CONTAINED_ENV = "OMC_WORKER_LAUNCH_RECOVERY_GATE_CONTAINED";
|
|
2593
2599
|
var WORKER_LAUNCH_INTERNAL_ENV_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -2600,8 +2606,8 @@ var WINDOWS_RESERVED_ENV_KEYS = new Set([...WORKER_LAUNCH_INTERNAL_ENV_KEYS, "Sy
|
|
|
2600
2606
|
|
|
2601
2607
|
// src/team/recovery-request-store.ts
|
|
2602
2608
|
var import_crypto5 = require("crypto");
|
|
2603
|
-
var
|
|
2604
|
-
var
|
|
2609
|
+
var import_fs19 = require("fs");
|
|
2610
|
+
var import_path21 = require("path");
|
|
2605
2611
|
init_types2();
|
|
2606
2612
|
init_state_paths();
|
|
2607
2613
|
init_process_identity_lock();
|
|
@@ -2635,22 +2641,22 @@ function acquireTaskLock(teamName, taskId, opts) {
|
|
|
2635
2641
|
const staleLockMs = opts?.staleLockMs ?? DEFAULT_STALE_LOCK_MS2;
|
|
2636
2642
|
const dir = canonicalTasksDir(teamName, opts?.cwd);
|
|
2637
2643
|
ensureDirWithMode(dir);
|
|
2638
|
-
const lockPath = (0,
|
|
2644
|
+
const lockPath = (0, import_path24.join)(dir, `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.lock`);
|
|
2639
2645
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
2640
2646
|
try {
|
|
2641
|
-
const fd = (0,
|
|
2647
|
+
const fd = (0, import_fs22.openSync)(lockPath, import_fs22.constants.O_CREAT | import_fs22.constants.O_EXCL | import_fs22.constants.O_WRONLY, 384);
|
|
2642
2648
|
const payload = JSON.stringify({
|
|
2643
2649
|
pid: process.pid,
|
|
2644
2650
|
workerName: opts?.workerName ?? "",
|
|
2645
2651
|
timestamp: Date.now()
|
|
2646
2652
|
});
|
|
2647
|
-
(0,
|
|
2653
|
+
(0, import_fs22.writeSync)(fd, payload, null, "utf-8");
|
|
2648
2654
|
return { fd, path: lockPath };
|
|
2649
2655
|
} catch (err) {
|
|
2650
2656
|
if (err && typeof err === "object" && "code" in err && err.code === "EEXIST") {
|
|
2651
2657
|
if (attempt === 0 && isLockStale2(lockPath, staleLockMs)) {
|
|
2652
2658
|
try {
|
|
2653
|
-
(0,
|
|
2659
|
+
(0, import_fs22.unlinkSync)(lockPath);
|
|
2654
2660
|
} catch {
|
|
2655
2661
|
}
|
|
2656
2662
|
continue;
|
|
@@ -2664,21 +2670,21 @@ function acquireTaskLock(teamName, taskId, opts) {
|
|
|
2664
2670
|
}
|
|
2665
2671
|
function releaseTaskLock(handle) {
|
|
2666
2672
|
try {
|
|
2667
|
-
(0,
|
|
2673
|
+
(0, import_fs22.closeSync)(handle.fd);
|
|
2668
2674
|
} catch {
|
|
2669
2675
|
}
|
|
2670
2676
|
try {
|
|
2671
|
-
(0,
|
|
2677
|
+
(0, import_fs22.unlinkSync)(handle.path);
|
|
2672
2678
|
} catch {
|
|
2673
2679
|
}
|
|
2674
2680
|
}
|
|
2675
2681
|
function isLockStale2(lockPath, staleLockMs) {
|
|
2676
2682
|
try {
|
|
2677
|
-
const stat = (0,
|
|
2683
|
+
const stat = (0, import_fs22.statSync)(lockPath);
|
|
2678
2684
|
const ageMs = Date.now() - stat.mtimeMs;
|
|
2679
2685
|
if (ageMs < staleLockMs) return false;
|
|
2680
2686
|
try {
|
|
2681
|
-
const raw = (0,
|
|
2687
|
+
const raw = (0, import_fs22.readFileSync)(lockPath, "utf-8");
|
|
2682
2688
|
const payload = JSON.parse(raw);
|
|
2683
2689
|
if (payload.pid && isProcessAlive(payload.pid)) return false;
|
|
2684
2690
|
} catch {
|
|
@@ -2697,37 +2703,37 @@ function sanitizeTaskId(taskId) {
|
|
|
2697
2703
|
function canonicalTasksDir(teamName, cwd) {
|
|
2698
2704
|
const root = cwd ?? process.cwd();
|
|
2699
2705
|
const dir = getTaskStoragePath(root, sanitizeName(teamName));
|
|
2700
|
-
validateResolvedPath(dir, (0,
|
|
2706
|
+
validateResolvedPath(dir, (0, import_path24.join)(getOmcRoot(root), "state", "team"));
|
|
2701
2707
|
return dir;
|
|
2702
2708
|
}
|
|
2703
2709
|
function legacyTasksDir(teamName) {
|
|
2704
2710
|
const claudeConfigDir = getCopilotConfigDir();
|
|
2705
2711
|
const dir = getLegacyTaskStoragePath(claudeConfigDir, sanitizeName(teamName));
|
|
2706
|
-
validateResolvedPath(dir, (0,
|
|
2712
|
+
validateResolvedPath(dir, (0, import_path24.join)(claudeConfigDir, "tasks"));
|
|
2707
2713
|
return dir;
|
|
2708
2714
|
}
|
|
2709
2715
|
function resolveTaskPathForRead(teamName, taskId, cwd) {
|
|
2710
2716
|
const safeTaskId = sanitizeTaskId(taskId);
|
|
2711
2717
|
const canonicalDir = canonicalTasksDir(teamName, cwd);
|
|
2712
|
-
const canonical = (0,
|
|
2713
|
-
if ((0,
|
|
2714
|
-
const legacyCanonical = (0,
|
|
2715
|
-
if ((0,
|
|
2716
|
-
const legacy = (0,
|
|
2717
|
-
if ((0,
|
|
2718
|
+
const canonical = (0, import_path24.join)(canonicalDir, `${normalizeTaskFileStem(safeTaskId)}.json`);
|
|
2719
|
+
if ((0, import_fs22.existsSync)(canonical)) return canonical;
|
|
2720
|
+
const legacyCanonical = (0, import_path24.join)(canonicalDir, `${safeTaskId}.json`);
|
|
2721
|
+
if ((0, import_fs22.existsSync)(legacyCanonical)) return legacyCanonical;
|
|
2722
|
+
const legacy = (0, import_path24.join)(legacyTasksDir(teamName), `${safeTaskId}.json`);
|
|
2723
|
+
if ((0, import_fs22.existsSync)(legacy)) return legacy;
|
|
2718
2724
|
return canonical;
|
|
2719
2725
|
}
|
|
2720
2726
|
function resolveTaskPathForWrite(teamName, taskId, cwd) {
|
|
2721
|
-
return (0,
|
|
2727
|
+
return (0, import_path24.join)(canonicalTasksDir(teamName, cwd), `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.json`);
|
|
2722
2728
|
}
|
|
2723
2729
|
function failureSidecarPath(teamName, taskId, cwd) {
|
|
2724
|
-
return (0,
|
|
2730
|
+
return (0, import_path24.join)(canonicalTasksDir(teamName, cwd), `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.failure.json`);
|
|
2725
2731
|
}
|
|
2726
2732
|
function readTask(teamName, taskId, opts) {
|
|
2727
2733
|
const filePath = resolveTaskPathForRead(teamName, taskId, opts?.cwd);
|
|
2728
|
-
if (!(0,
|
|
2734
|
+
if (!(0, import_fs22.existsSync)(filePath)) return null;
|
|
2729
2735
|
try {
|
|
2730
|
-
const raw = (0,
|
|
2736
|
+
const raw = (0, import_fs22.readFileSync)(filePath, "utf-8");
|
|
2731
2737
|
return JSON.parse(raw);
|
|
2732
2738
|
} catch {
|
|
2733
2739
|
return null;
|
|
@@ -2739,7 +2745,7 @@ function updateTask(teamName, taskId, updates, opts) {
|
|
|
2739
2745
|
const readPath = resolveTaskPathForRead(teamName, taskId, opts?.cwd);
|
|
2740
2746
|
let task;
|
|
2741
2747
|
try {
|
|
2742
|
-
const raw = (0,
|
|
2748
|
+
const raw = (0, import_fs22.readFileSync)(readPath, "utf-8");
|
|
2743
2749
|
task = JSON.parse(raw);
|
|
2744
2750
|
} catch {
|
|
2745
2751
|
throw new Error(`Task file not found or malformed: ${taskId}`);
|
|
@@ -2768,7 +2774,7 @@ function updateTask(teamName, taskId, updates, opts) {
|
|
|
2768
2774
|
}
|
|
2769
2775
|
async function findNextTask(teamName, workerName, opts) {
|
|
2770
2776
|
const dir = canonicalTasksDir(teamName, opts?.cwd);
|
|
2771
|
-
if (!(0,
|
|
2777
|
+
if (!(0, import_fs22.existsSync)(dir)) return null;
|
|
2772
2778
|
const taskIds = listTaskIds(teamName, opts);
|
|
2773
2779
|
for (const id of taskIds) {
|
|
2774
2780
|
const task = readTask(teamName, id, opts);
|
|
@@ -2787,7 +2793,7 @@ async function findNextTask(teamName, workerName, opts) {
|
|
|
2787
2793
|
let taskData;
|
|
2788
2794
|
try {
|
|
2789
2795
|
const readPath = resolveTaskPathForRead(teamName, id, opts?.cwd);
|
|
2790
|
-
const raw = (0,
|
|
2796
|
+
const raw = (0, import_fs22.readFileSync)(readPath, "utf-8");
|
|
2791
2797
|
taskData = JSON.parse(raw);
|
|
2792
2798
|
} catch {
|
|
2793
2799
|
continue;
|
|
@@ -2826,9 +2832,9 @@ function writeTaskFailure(teamName, taskId, error, opts) {
|
|
|
2826
2832
|
}
|
|
2827
2833
|
function readTaskFailure(teamName, taskId, opts) {
|
|
2828
2834
|
const filePath = failureSidecarPath(teamName, taskId, opts?.cwd);
|
|
2829
|
-
if (!(0,
|
|
2835
|
+
if (!(0, import_fs22.existsSync)(filePath)) return null;
|
|
2830
2836
|
try {
|
|
2831
|
-
const raw = (0,
|
|
2837
|
+
const raw = (0, import_fs22.readFileSync)(filePath, "utf-8");
|
|
2832
2838
|
return JSON.parse(raw);
|
|
2833
2839
|
} catch {
|
|
2834
2840
|
return null;
|
|
@@ -2836,9 +2842,9 @@ function readTaskFailure(teamName, taskId, opts) {
|
|
|
2836
2842
|
}
|
|
2837
2843
|
function listTaskIds(teamName, opts) {
|
|
2838
2844
|
const scanDir = (dir) => {
|
|
2839
|
-
if (!(0,
|
|
2845
|
+
if (!(0, import_fs22.existsSync)(dir)) return [];
|
|
2840
2846
|
try {
|
|
2841
|
-
return (0,
|
|
2847
|
+
return (0, import_fs22.readdirSync)(dir).filter((f) => f.endsWith(".json") && !f.includes(".tmp.") && !f.includes(".failure.") && !f.endsWith(".lock")).map((f) => f.replace(/^task-/, "").replace(".json", ""));
|
|
2842
2848
|
} catch {
|
|
2843
2849
|
return [];
|
|
2844
2850
|
}
|
|
@@ -2856,32 +2862,32 @@ function listTaskIds(teamName, opts) {
|
|
|
2856
2862
|
}
|
|
2857
2863
|
|
|
2858
2864
|
// src/team/inbox-outbox.ts
|
|
2859
|
-
var
|
|
2860
|
-
var
|
|
2865
|
+
var import_fs23 = require("fs");
|
|
2866
|
+
var import_path25 = require("path");
|
|
2861
2867
|
init_config_dir();
|
|
2862
2868
|
var MAX_INBOX_READ_SIZE = 10 * 1024 * 1024;
|
|
2863
2869
|
function teamsDir(teamName) {
|
|
2864
|
-
const result = (0,
|
|
2865
|
-
validateResolvedPath(result, (0,
|
|
2870
|
+
const result = (0, import_path25.join)(getCopilotConfigDir(), "teams", sanitizeName(teamName));
|
|
2871
|
+
validateResolvedPath(result, (0, import_path25.join)(getCopilotConfigDir(), "teams"));
|
|
2866
2872
|
return result;
|
|
2867
2873
|
}
|
|
2868
2874
|
function inboxPath(teamName, workerName) {
|
|
2869
|
-
return (0,
|
|
2875
|
+
return (0, import_path25.join)(teamsDir(teamName), "inbox", `${sanitizeName(workerName)}.jsonl`);
|
|
2870
2876
|
}
|
|
2871
2877
|
function inboxCursorPath(teamName, workerName) {
|
|
2872
|
-
return (0,
|
|
2878
|
+
return (0, import_path25.join)(teamsDir(teamName), "inbox", `${sanitizeName(workerName)}.offset`);
|
|
2873
2879
|
}
|
|
2874
2880
|
function outboxPath(teamName, workerName) {
|
|
2875
|
-
return (0,
|
|
2881
|
+
return (0, import_path25.join)(teamsDir(teamName), "outbox", `${sanitizeName(workerName)}.jsonl`);
|
|
2876
2882
|
}
|
|
2877
2883
|
function signalPath(teamName, workerName) {
|
|
2878
|
-
return (0,
|
|
2884
|
+
return (0, import_path25.join)(teamsDir(teamName), "signals", `${sanitizeName(workerName)}.shutdown`);
|
|
2879
2885
|
}
|
|
2880
2886
|
function drainSignalPath(teamName, workerName) {
|
|
2881
|
-
return (0,
|
|
2887
|
+
return (0, import_path25.join)(teamsDir(teamName), "signals", `${sanitizeName(workerName)}.drain`);
|
|
2882
2888
|
}
|
|
2883
2889
|
function ensureDir(filePath) {
|
|
2884
|
-
const dir = (0,
|
|
2890
|
+
const dir = (0, import_path25.dirname)(filePath);
|
|
2885
2891
|
ensureDirWithMode(dir);
|
|
2886
2892
|
}
|
|
2887
2893
|
function appendOutbox(teamName, workerName, message) {
|
|
@@ -2891,32 +2897,32 @@ function appendOutbox(teamName, workerName, message) {
|
|
|
2891
2897
|
}
|
|
2892
2898
|
function rotateOutboxIfNeeded(teamName, workerName, maxLines) {
|
|
2893
2899
|
const filePath = outboxPath(teamName, workerName);
|
|
2894
|
-
if (!(0,
|
|
2900
|
+
if (!(0, import_fs23.existsSync)(filePath)) return;
|
|
2895
2901
|
try {
|
|
2896
|
-
const content = (0,
|
|
2902
|
+
const content = (0, import_fs23.readFileSync)(filePath, "utf-8");
|
|
2897
2903
|
const lines = content.split("\n").filter((l) => l.trim());
|
|
2898
2904
|
if (lines.length <= maxLines) return;
|
|
2899
2905
|
const keepCount = Math.floor(maxLines / 2);
|
|
2900
2906
|
const kept = keepCount === 0 ? [] : lines.slice(-keepCount);
|
|
2901
2907
|
const tmpPath = `${filePath}.tmp.${process.pid}.${Date.now()}`;
|
|
2902
2908
|
writeFileWithMode(tmpPath, kept.join("\n") + "\n");
|
|
2903
|
-
(0,
|
|
2909
|
+
(0, import_fs23.renameSync)(tmpPath, filePath);
|
|
2904
2910
|
} catch {
|
|
2905
2911
|
}
|
|
2906
2912
|
}
|
|
2907
2913
|
function rotateInboxIfNeeded(teamName, workerName, maxSizeBytes) {
|
|
2908
2914
|
const filePath = inboxPath(teamName, workerName);
|
|
2909
|
-
if (!(0,
|
|
2915
|
+
if (!(0, import_fs23.existsSync)(filePath)) return;
|
|
2910
2916
|
try {
|
|
2911
|
-
const stat = (0,
|
|
2917
|
+
const stat = (0, import_fs23.statSync)(filePath);
|
|
2912
2918
|
if (stat.size <= maxSizeBytes) return;
|
|
2913
|
-
const content = (0,
|
|
2919
|
+
const content = (0, import_fs23.readFileSync)(filePath, "utf-8");
|
|
2914
2920
|
const lines = content.split("\n").filter((l) => l.trim());
|
|
2915
2921
|
const keepCount = Math.max(1, Math.floor(lines.length / 2));
|
|
2916
2922
|
const kept = lines.slice(-keepCount);
|
|
2917
2923
|
const tmpPath = `${filePath}.tmp.${process.pid}.${Date.now()}`;
|
|
2918
2924
|
writeFileWithMode(tmpPath, kept.join("\n") + "\n");
|
|
2919
|
-
(0,
|
|
2925
|
+
(0, import_fs23.renameSync)(tmpPath, filePath);
|
|
2920
2926
|
const cursorFile = inboxCursorPath(teamName, workerName);
|
|
2921
2927
|
atomicWriteJson(cursorFile, { bytesRead: 0 });
|
|
2922
2928
|
} catch {
|
|
@@ -2925,16 +2931,16 @@ function rotateInboxIfNeeded(teamName, workerName, maxSizeBytes) {
|
|
|
2925
2931
|
function readNewInboxMessages(teamName, workerName) {
|
|
2926
2932
|
const inbox = inboxPath(teamName, workerName);
|
|
2927
2933
|
const cursorFile = inboxCursorPath(teamName, workerName);
|
|
2928
|
-
if (!(0,
|
|
2934
|
+
if (!(0, import_fs23.existsSync)(inbox)) return [];
|
|
2929
2935
|
let offset = 0;
|
|
2930
|
-
if ((0,
|
|
2936
|
+
if ((0, import_fs23.existsSync)(cursorFile)) {
|
|
2931
2937
|
try {
|
|
2932
|
-
const cursor = JSON.parse((0,
|
|
2938
|
+
const cursor = JSON.parse((0, import_fs23.readFileSync)(cursorFile, "utf-8"));
|
|
2933
2939
|
offset = cursor.bytesRead;
|
|
2934
2940
|
} catch {
|
|
2935
2941
|
}
|
|
2936
2942
|
}
|
|
2937
|
-
const stat = (0,
|
|
2943
|
+
const stat = (0, import_fs23.statSync)(inbox);
|
|
2938
2944
|
if (stat.size < offset) {
|
|
2939
2945
|
offset = 0;
|
|
2940
2946
|
}
|
|
@@ -2944,12 +2950,12 @@ function readNewInboxMessages(teamName, workerName) {
|
|
|
2944
2950
|
if (cappedSize < readSize) {
|
|
2945
2951
|
console.warn(`[inbox-outbox] Inbox for ${workerName} exceeds ${MAX_INBOX_READ_SIZE} bytes, reading truncated`);
|
|
2946
2952
|
}
|
|
2947
|
-
const fd = (0,
|
|
2953
|
+
const fd = (0, import_fs23.openSync)(inbox, "r");
|
|
2948
2954
|
const buffer = Buffer.alloc(cappedSize);
|
|
2949
2955
|
try {
|
|
2950
|
-
(0,
|
|
2956
|
+
(0, import_fs23.readSync)(fd, buffer, 0, buffer.length, offset);
|
|
2951
2957
|
} finally {
|
|
2952
|
-
(0,
|
|
2958
|
+
(0, import_fs23.closeSync)(fd);
|
|
2953
2959
|
}
|
|
2954
2960
|
const newData = buffer.toString("utf-8");
|
|
2955
2961
|
const lastNewlineIdx = newData.lastIndexOf("\n");
|
|
@@ -2986,9 +2992,9 @@ function readNewInboxMessages(teamName, workerName) {
|
|
|
2986
2992
|
}
|
|
2987
2993
|
function checkShutdownSignal(teamName, workerName) {
|
|
2988
2994
|
const filePath = signalPath(teamName, workerName);
|
|
2989
|
-
if (!(0,
|
|
2995
|
+
if (!(0, import_fs23.existsSync)(filePath)) return null;
|
|
2990
2996
|
try {
|
|
2991
|
-
const raw = (0,
|
|
2997
|
+
const raw = (0, import_fs23.readFileSync)(filePath, "utf-8");
|
|
2992
2998
|
return JSON.parse(raw);
|
|
2993
2999
|
} catch {
|
|
2994
3000
|
return null;
|
|
@@ -2996,18 +3002,18 @@ function checkShutdownSignal(teamName, workerName) {
|
|
|
2996
3002
|
}
|
|
2997
3003
|
function deleteShutdownSignal(teamName, workerName) {
|
|
2998
3004
|
const filePath = signalPath(teamName, workerName);
|
|
2999
|
-
if ((0,
|
|
3005
|
+
if ((0, import_fs23.existsSync)(filePath)) {
|
|
3000
3006
|
try {
|
|
3001
|
-
(0,
|
|
3007
|
+
(0, import_fs23.unlinkSync)(filePath);
|
|
3002
3008
|
} catch {
|
|
3003
3009
|
}
|
|
3004
3010
|
}
|
|
3005
3011
|
}
|
|
3006
3012
|
function checkDrainSignal(teamName, workerName) {
|
|
3007
3013
|
const filePath = drainSignalPath(teamName, workerName);
|
|
3008
|
-
if (!(0,
|
|
3014
|
+
if (!(0, import_fs23.existsSync)(filePath)) return null;
|
|
3009
3015
|
try {
|
|
3010
|
-
const raw = (0,
|
|
3016
|
+
const raw = (0, import_fs23.readFileSync)(filePath, "utf-8");
|
|
3011
3017
|
return JSON.parse(raw);
|
|
3012
3018
|
} catch {
|
|
3013
3019
|
return null;
|
|
@@ -3015,34 +3021,34 @@ function checkDrainSignal(teamName, workerName) {
|
|
|
3015
3021
|
}
|
|
3016
3022
|
function deleteDrainSignal(teamName, workerName) {
|
|
3017
3023
|
const filePath = drainSignalPath(teamName, workerName);
|
|
3018
|
-
if ((0,
|
|
3024
|
+
if ((0, import_fs23.existsSync)(filePath)) {
|
|
3019
3025
|
try {
|
|
3020
|
-
(0,
|
|
3026
|
+
(0, import_fs23.unlinkSync)(filePath);
|
|
3021
3027
|
} catch {
|
|
3022
3028
|
}
|
|
3023
3029
|
}
|
|
3024
3030
|
}
|
|
3025
3031
|
|
|
3026
3032
|
// src/team/team-registration.ts
|
|
3027
|
-
var
|
|
3028
|
-
var
|
|
3033
|
+
var import_fs24 = require("fs");
|
|
3034
|
+
var import_path26 = require("path");
|
|
3029
3035
|
init_config_dir();
|
|
3030
3036
|
init_worktree_paths();
|
|
3031
3037
|
function configPath(teamName) {
|
|
3032
|
-
const result = (0,
|
|
3033
|
-
validateResolvedPath(result, (0,
|
|
3038
|
+
const result = (0, import_path26.join)(getCopilotConfigDir(), "teams", sanitizeName(teamName), "config.json");
|
|
3039
|
+
validateResolvedPath(result, (0, import_path26.join)(getCopilotConfigDir(), "teams"));
|
|
3034
3040
|
return result;
|
|
3035
3041
|
}
|
|
3036
3042
|
function shadowRegistryPath(workingDirectory) {
|
|
3037
|
-
const result = (0,
|
|
3038
|
-
validateResolvedPath(result, (0,
|
|
3043
|
+
const result = (0, import_path26.join)(getOmcRoot(workingDirectory), "state", "team-mcp-workers.json");
|
|
3044
|
+
validateResolvedPath(result, (0, import_path26.join)(getOmcRoot(workingDirectory), "state"));
|
|
3039
3045
|
return result;
|
|
3040
3046
|
}
|
|
3041
3047
|
function unregisterMcpWorker(teamName, workerName, workingDirectory) {
|
|
3042
3048
|
const configFile = configPath(teamName);
|
|
3043
|
-
if ((0,
|
|
3049
|
+
if ((0, import_fs24.existsSync)(configFile)) {
|
|
3044
3050
|
try {
|
|
3045
|
-
const raw = (0,
|
|
3051
|
+
const raw = (0, import_fs24.readFileSync)(configFile, "utf-8");
|
|
3046
3052
|
const config = JSON.parse(raw);
|
|
3047
3053
|
const members = Array.isArray(config.members) ? config.members : [];
|
|
3048
3054
|
config.members = members.filter((m) => m.name !== workerName);
|
|
@@ -3053,9 +3059,9 @@ function unregisterMcpWorker(teamName, workerName, workingDirectory) {
|
|
|
3053
3059
|
const shadowFile = shadowRegistryPath(workingDirectory);
|
|
3054
3060
|
try {
|
|
3055
3061
|
withFileLockSync(shadowFile + ".lock", () => {
|
|
3056
|
-
if ((0,
|
|
3062
|
+
if ((0, import_fs24.existsSync)(shadowFile)) {
|
|
3057
3063
|
try {
|
|
3058
|
-
const registry = JSON.parse((0,
|
|
3064
|
+
const registry = JSON.parse((0, import_fs24.readFileSync)(shadowFile, "utf-8"));
|
|
3059
3065
|
registry.workers = (registry.workers || []).filter((w) => w.name !== workerName);
|
|
3060
3066
|
atomicWriteJson(shadowFile, registry);
|
|
3061
3067
|
} catch {
|
|
@@ -3071,9 +3077,9 @@ function isMcpWorker(member) {
|
|
|
3071
3077
|
function listMcpWorkers(teamName, workingDirectory) {
|
|
3072
3078
|
const workers = /* @__PURE__ */ new Map();
|
|
3073
3079
|
const configFile = configPath(teamName);
|
|
3074
|
-
if ((0,
|
|
3080
|
+
if ((0, import_fs24.existsSync)(configFile)) {
|
|
3075
3081
|
try {
|
|
3076
|
-
const raw = (0,
|
|
3082
|
+
const raw = (0, import_fs24.readFileSync)(configFile, "utf-8");
|
|
3077
3083
|
const config = JSON.parse(raw);
|
|
3078
3084
|
const members = Array.isArray(config.members) ? config.members : [];
|
|
3079
3085
|
for (const m of members) {
|
|
@@ -3085,9 +3091,9 @@ function listMcpWorkers(teamName, workingDirectory) {
|
|
|
3085
3091
|
}
|
|
3086
3092
|
}
|
|
3087
3093
|
const shadowFile = shadowRegistryPath(workingDirectory);
|
|
3088
|
-
if ((0,
|
|
3094
|
+
if ((0, import_fs24.existsSync)(shadowFile)) {
|
|
3089
3095
|
try {
|
|
3090
|
-
const registry = JSON.parse((0,
|
|
3096
|
+
const registry = JSON.parse((0, import_fs24.readFileSync)(shadowFile, "utf-8"));
|
|
3091
3097
|
for (const w of registry.workers || []) {
|
|
3092
3098
|
workers.set(w.name, w);
|
|
3093
3099
|
}
|
|
@@ -3098,11 +3104,11 @@ function listMcpWorkers(teamName, workingDirectory) {
|
|
|
3098
3104
|
}
|
|
3099
3105
|
|
|
3100
3106
|
// src/team/heartbeat.ts
|
|
3101
|
-
var
|
|
3102
|
-
var
|
|
3107
|
+
var import_fs25 = require("fs");
|
|
3108
|
+
var import_path27 = require("path");
|
|
3103
3109
|
init_worktree_paths();
|
|
3104
3110
|
function heartbeatPath(workingDirectory, teamName, workerName) {
|
|
3105
|
-
return (0,
|
|
3111
|
+
return (0, import_path27.join)(getOmcRoot(workingDirectory), "state", "team-bridge", sanitizeName(teamName), `${sanitizeName(workerName)}.heartbeat.json`);
|
|
3106
3112
|
}
|
|
3107
3113
|
function writeHeartbeat(workingDirectory, data) {
|
|
3108
3114
|
const filePath = heartbeatPath(workingDirectory, data.teamName, data.workerName);
|
|
@@ -3110,9 +3116,9 @@ function writeHeartbeat(workingDirectory, data) {
|
|
|
3110
3116
|
}
|
|
3111
3117
|
function readHeartbeat(workingDirectory, teamName, workerName) {
|
|
3112
3118
|
const filePath = heartbeatPath(workingDirectory, teamName, workerName);
|
|
3113
|
-
if (!(0,
|
|
3119
|
+
if (!(0, import_fs25.existsSync)(filePath)) return null;
|
|
3114
3120
|
try {
|
|
3115
|
-
const raw = (0,
|
|
3121
|
+
const raw = (0, import_fs25.readFileSync)(filePath, "utf-8");
|
|
3116
3122
|
return JSON.parse(raw);
|
|
3117
3123
|
} catch {
|
|
3118
3124
|
return null;
|
|
@@ -3131,9 +3137,9 @@ function isWorkerAlive(workingDirectory, teamName, workerName, maxAgeMs) {
|
|
|
3131
3137
|
}
|
|
3132
3138
|
function deleteHeartbeat(workingDirectory, teamName, workerName) {
|
|
3133
3139
|
const filePath = heartbeatPath(workingDirectory, teamName, workerName);
|
|
3134
|
-
if ((0,
|
|
3140
|
+
if ((0, import_fs25.existsSync)(filePath)) {
|
|
3135
3141
|
try {
|
|
3136
|
-
(0,
|
|
3142
|
+
(0, import_fs25.unlinkSync)(filePath);
|
|
3137
3143
|
} catch {
|
|
3138
3144
|
}
|
|
3139
3145
|
}
|
|
@@ -3289,28 +3295,28 @@ function findPermissionViolations(changedPaths, permissions, cwd) {
|
|
|
3289
3295
|
}
|
|
3290
3296
|
|
|
3291
3297
|
// src/agents/prompt-helpers.ts
|
|
3292
|
-
var
|
|
3293
|
-
var
|
|
3298
|
+
var import_fs26 = require("fs");
|
|
3299
|
+
var import_path28 = require("path");
|
|
3294
3300
|
var import_url4 = require("url");
|
|
3295
3301
|
function getPackageDir3() {
|
|
3296
3302
|
if (typeof __dirname !== "undefined" && __dirname) {
|
|
3297
|
-
const currentDirName = (0,
|
|
3298
|
-
const parentDirName = (0,
|
|
3303
|
+
const currentDirName = (0, import_path28.basename)(__dirname);
|
|
3304
|
+
const parentDirName = (0, import_path28.basename)((0, import_path28.dirname)(__dirname));
|
|
3299
3305
|
if (currentDirName === "bridge") {
|
|
3300
|
-
return (0,
|
|
3306
|
+
return (0, import_path28.join)(__dirname, "..");
|
|
3301
3307
|
}
|
|
3302
3308
|
if (currentDirName === "agents" && (parentDirName === "src" || parentDirName === "dist")) {
|
|
3303
|
-
return (0,
|
|
3309
|
+
return (0, import_path28.join)(__dirname, "..", "..");
|
|
3304
3310
|
}
|
|
3305
3311
|
}
|
|
3306
3312
|
try {
|
|
3307
3313
|
const __filename = (0, import_url4.fileURLToPath)(importMetaUrl);
|
|
3308
|
-
const __dirname2 = (0,
|
|
3309
|
-
const currentDirName = (0,
|
|
3314
|
+
const __dirname2 = (0, import_path28.dirname)(__filename);
|
|
3315
|
+
const currentDirName = (0, import_path28.basename)(__dirname2);
|
|
3310
3316
|
if (currentDirName === "bridge") {
|
|
3311
|
-
return (0,
|
|
3317
|
+
return (0, import_path28.join)(__dirname2, "..");
|
|
3312
3318
|
}
|
|
3313
|
-
return (0,
|
|
3319
|
+
return (0, import_path28.join)(__dirname2, "..", "..");
|
|
3314
3320
|
} catch {
|
|
3315
3321
|
}
|
|
3316
3322
|
return process.cwd();
|
|
@@ -3326,9 +3332,9 @@ function getValidAgentRoles() {
|
|
|
3326
3332
|
} catch {
|
|
3327
3333
|
}
|
|
3328
3334
|
try {
|
|
3329
|
-
const agentsDir = (0,
|
|
3330
|
-
const files = (0,
|
|
3331
|
-
_cachedRoles = files.filter((f) => f.endsWith(".md")).map((f) => (0,
|
|
3335
|
+
const agentsDir = (0, import_path28.join)(getPackageDir3(), "agents");
|
|
3336
|
+
const files = (0, import_fs26.readdirSync)(agentsDir);
|
|
3337
|
+
_cachedRoles = files.filter((f) => f.endsWith(".md")).map((f) => (0, import_path28.basename)(f, ".md")).sort();
|
|
3332
3338
|
} catch (err) {
|
|
3333
3339
|
console.error("[prompt-injection] CRITICAL: Could not scan agents/ directory for role discovery:", err);
|
|
3334
3340
|
_cachedRoles = [];
|
|
@@ -3350,8 +3356,8 @@ function sanitizePromptContent(content, maxLength = 4e3) {
|
|
|
3350
3356
|
}
|
|
3351
3357
|
|
|
3352
3358
|
// src/team/team-status.ts
|
|
3353
|
-
var
|
|
3354
|
-
var
|
|
3359
|
+
var import_fs27 = require("fs");
|
|
3360
|
+
var import_path29 = require("path");
|
|
3355
3361
|
init_config_dir();
|
|
3356
3362
|
|
|
3357
3363
|
// src/team/usage-tracker.ts
|
|
@@ -3442,10 +3448,10 @@ function emptyUsageReport(teamName) {
|
|
|
3442
3448
|
function peekRecentOutboxMessages(teamName, workerName, maxMessages = 10) {
|
|
3443
3449
|
const safeName = sanitizeName(teamName);
|
|
3444
3450
|
const safeWorker = sanitizeName(workerName);
|
|
3445
|
-
const outboxPath2 = (0,
|
|
3446
|
-
if (!(0,
|
|
3451
|
+
const outboxPath2 = (0, import_path29.join)(getCopilotConfigDir(), "teams", safeName, "outbox", `${safeWorker}.jsonl`);
|
|
3452
|
+
if (!(0, import_fs27.existsSync)(outboxPath2)) return [];
|
|
3447
3453
|
try {
|
|
3448
|
-
const content = (0,
|
|
3454
|
+
const content = (0, import_fs27.readFileSync)(outboxPath2, "utf-8");
|
|
3449
3455
|
const lines = content.split("\n").filter((l) => l.trim());
|
|
3450
3456
|
const recentLines = lines.slice(-maxMessages);
|
|
3451
3457
|
const messages = [];
|
|
@@ -3718,29 +3724,29 @@ function buildTaskPrompt(task, messages, config) {
|
|
|
3718
3724
|
return result;
|
|
3719
3725
|
}
|
|
3720
3726
|
function writePromptFile(config, taskId, prompt) {
|
|
3721
|
-
const dir = (0,
|
|
3727
|
+
const dir = (0, import_path30.join)(getOmcRoot(config.workingDirectory), "prompts");
|
|
3722
3728
|
ensureDirWithMode(dir);
|
|
3723
3729
|
const filename = `team-${config.teamName}-task-${taskId}-${Date.now()}.md`;
|
|
3724
|
-
const filePath = (0,
|
|
3730
|
+
const filePath = (0, import_path30.join)(dir, filename);
|
|
3725
3731
|
writeFileWithMode(filePath, prompt);
|
|
3726
3732
|
return filePath;
|
|
3727
3733
|
}
|
|
3728
3734
|
function getOutputPath(config, taskId) {
|
|
3729
|
-
const dir = (0,
|
|
3735
|
+
const dir = (0, import_path30.join)(getOmcRoot(config.workingDirectory), "outputs");
|
|
3730
3736
|
ensureDirWithMode(dir);
|
|
3731
3737
|
const suffix = Math.random().toString(36).slice(2, 8);
|
|
3732
|
-
return (0,
|
|
3738
|
+
return (0, import_path30.join)(
|
|
3733
3739
|
dir,
|
|
3734
3740
|
`team-${config.teamName}-task-${taskId}-${Date.now()}-${suffix}.md`
|
|
3735
3741
|
);
|
|
3736
3742
|
}
|
|
3737
3743
|
function readOutputSummary(outputFile) {
|
|
3738
3744
|
try {
|
|
3739
|
-
if (!(0,
|
|
3745
|
+
if (!(0, import_fs28.existsSync)(outputFile)) return "(no output file)";
|
|
3740
3746
|
const buf = Buffer.alloc(1024);
|
|
3741
|
-
const fd = (0,
|
|
3747
|
+
const fd = (0, import_fs28.openSync)(outputFile, "r");
|
|
3742
3748
|
try {
|
|
3743
|
-
const bytesRead = (0,
|
|
3749
|
+
const bytesRead = (0, import_fs28.readSync)(fd, buf, 0, 1024, 0);
|
|
3744
3750
|
if (bytesRead === 0) return "(empty output)";
|
|
3745
3751
|
const content = buf.toString("utf-8", 0, bytesRead);
|
|
3746
3752
|
if (content.length > 500) {
|
|
@@ -3748,7 +3754,7 @@ function readOutputSummary(outputFile) {
|
|
|
3748
3754
|
}
|
|
3749
3755
|
return content;
|
|
3750
3756
|
} finally {
|
|
3751
|
-
(0,
|
|
3757
|
+
(0, import_fs28.closeSync)(fd);
|
|
3752
3758
|
}
|
|
3753
3759
|
} catch {
|
|
3754
3760
|
return "(error reading output)";
|
|
@@ -4304,16 +4310,16 @@ ${violationSummary}`
|
|
|
4304
4310
|
init_worktree_paths();
|
|
4305
4311
|
init_config_dir();
|
|
4306
4312
|
function validateConfigPath(configPath2, homeDir, claudeConfigDir) {
|
|
4307
|
-
const resolved = (0,
|
|
4308
|
-
const normalizedHome = (0,
|
|
4313
|
+
const resolved = (0, import_path31.resolve)(configPath2);
|
|
4314
|
+
const normalizedHome = (0, import_path31.resolve)(homeDir);
|
|
4309
4315
|
const isUnderHome = isAtOrUnder(normalizedHome, resolved);
|
|
4310
|
-
const normalizedConfigDir = (0,
|
|
4311
|
-
const normalizedOmcDir = (0,
|
|
4316
|
+
const normalizedConfigDir = (0, import_path31.resolve)(claudeConfigDir);
|
|
4317
|
+
const normalizedOmcDir = (0, import_path31.resolve)(homeDir, ".omg");
|
|
4312
4318
|
const isTrustedSubpath = isAtOrUnder(normalizedConfigDir, resolved) || isAtOrUnder(normalizedOmcDir, resolved) || hasOmcPathSegment(resolved);
|
|
4313
4319
|
if (!isUnderHome || !isTrustedSubpath) return false;
|
|
4314
4320
|
try {
|
|
4315
|
-
const parentDir = (0,
|
|
4316
|
-
const realParent = (0,
|
|
4321
|
+
const parentDir = (0, import_path31.resolve)(resolved, "..");
|
|
4322
|
+
const realParent = (0, import_fs29.realpathSync)(parentDir);
|
|
4317
4323
|
if (!isAtOrUnder(normalizedHome, realParent)) {
|
|
4318
4324
|
return false;
|
|
4319
4325
|
}
|
|
@@ -4322,9 +4328,9 @@ function validateConfigPath(configPath2, homeDir, claudeConfigDir) {
|
|
|
4322
4328
|
return true;
|
|
4323
4329
|
}
|
|
4324
4330
|
function isAtOrUnder(parent, child) {
|
|
4325
|
-
const rel = (0,
|
|
4331
|
+
const rel = (0, import_path31.relative)(parent, child);
|
|
4326
4332
|
if (rel === "") return true;
|
|
4327
|
-
return !rel.startsWith("..") && !(0,
|
|
4333
|
+
return !rel.startsWith("..") && !(0, import_path31.isAbsolute)(rel);
|
|
4328
4334
|
}
|
|
4329
4335
|
function hasOmcPathSegment(absolutePath) {
|
|
4330
4336
|
return absolutePath.split(/[\\/]/).includes(".omg");
|
|
@@ -4332,15 +4338,15 @@ function hasOmcPathSegment(absolutePath) {
|
|
|
4332
4338
|
function validateBridgeWorkingDirectory(workingDirectory) {
|
|
4333
4339
|
let stat;
|
|
4334
4340
|
try {
|
|
4335
|
-
stat = (0,
|
|
4341
|
+
stat = (0, import_fs29.statSync)(workingDirectory);
|
|
4336
4342
|
} catch {
|
|
4337
4343
|
throw new Error(`workingDirectory does not exist: ${workingDirectory}`);
|
|
4338
4344
|
}
|
|
4339
4345
|
if (!stat.isDirectory()) {
|
|
4340
4346
|
throw new Error(`workingDirectory is not a directory: ${workingDirectory}`);
|
|
4341
4347
|
}
|
|
4342
|
-
const resolved = (0,
|
|
4343
|
-
const home = (0,
|
|
4348
|
+
const resolved = (0, import_fs29.realpathSync)(workingDirectory);
|
|
4349
|
+
const home = (0, import_path31.resolve)((0, import_os8.homedir)());
|
|
4344
4350
|
if (!isAtOrUnder(home, resolved)) {
|
|
4345
4351
|
throw new Error(`workingDirectory is outside home directory: ${resolved}`);
|
|
4346
4352
|
}
|
|
@@ -4355,8 +4361,8 @@ function main() {
|
|
|
4355
4361
|
console.error("Usage: node bridge-entry.js --config <path-to-config.json>");
|
|
4356
4362
|
process.exit(1);
|
|
4357
4363
|
}
|
|
4358
|
-
const configPath2 = (0,
|
|
4359
|
-
const home = (0,
|
|
4364
|
+
const configPath2 = (0, import_path31.resolve)(process.argv[configIdx + 1]);
|
|
4365
|
+
const home = (0, import_os8.homedir)();
|
|
4360
4366
|
const claudeConfigDir = getCopilotConfigDir();
|
|
4361
4367
|
if (!validateConfigPath(configPath2, home, claudeConfigDir)) {
|
|
4362
4368
|
console.error(`Config path must be under ~/ with ${claudeConfigDir} or ~/.omg/ subpath: ${configPath2}`);
|
|
@@ -4364,7 +4370,7 @@ function main() {
|
|
|
4364
4370
|
}
|
|
4365
4371
|
let config;
|
|
4366
4372
|
try {
|
|
4367
|
-
const raw = (0,
|
|
4373
|
+
const raw = (0, import_fs29.readFileSync)(configPath2, "utf-8");
|
|
4368
4374
|
config = JSON.parse(raw);
|
|
4369
4375
|
} catch (err) {
|
|
4370
4376
|
console.error(`Failed to read config from ${configPath2}: ${err.message}`);
|