claudecode-omc 4.4.10 → 4.7.4
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 +18 -4
- package/.claude-plugin/plugin.json +14 -1
- package/.mcp.json +0 -4
- package/README.de.md +260 -0
- package/README.es.md +27 -41
- package/README.fr.md +260 -0
- package/README.it.md +260 -0
- package/README.ja.md +27 -41
- package/README.ko.md +45 -54
- package/README.md +247 -14
- package/README.pt.md +23 -6
- package/README.ru.md +260 -0
- package/README.tr.md +260 -0
- package/README.vi.md +23 -6
- package/README.zh.md +27 -41
- package/agents/harsh-critic.md +254 -0
- package/bridge/cli.cjs +67181 -0
- package/bridge/gyoshu_bridge.py +69 -19
- package/bridge/mcp-server.cjs +846 -526
- package/bridge/runtime-cli.cjs +2861 -367
- package/bridge/team-bridge.cjs +216 -60
- package/bridge/team-mcp.cjs +493 -255
- package/bridge/team.js +1460 -0
- package/dist/__tests__/agent-registry.test.js +13 -3
- package/dist/__tests__/agent-registry.test.js.map +1 -1
- package/dist/__tests__/auto-slash-aliases.test.js +12 -20
- package/dist/__tests__/auto-slash-aliases.test.js.map +1 -1
- package/dist/__tests__/auto-update.test.js +1 -1
- package/dist/__tests__/auto-update.test.js.map +1 -1
- package/dist/__tests__/bash-history.test.js.map +1 -1
- package/dist/__tests__/cleanup-validation.test.d.ts +2 -0
- package/dist/__tests__/cleanup-validation.test.d.ts.map +1 -0
- package/dist/__tests__/cleanup-validation.test.js +44 -0
- package/dist/__tests__/cleanup-validation.test.js.map +1 -0
- package/dist/__tests__/config-force-inherit-env.test.d.ts +5 -0
- package/dist/__tests__/config-force-inherit-env.test.d.ts.map +1 -0
- package/dist/__tests__/config-force-inherit-env.test.js +35 -0
- package/dist/__tests__/config-force-inherit-env.test.js.map +1 -0
- package/dist/__tests__/consolidation-contracts.test.js +4 -7
- package/dist/__tests__/consolidation-contracts.test.js.map +1 -1
- package/dist/__tests__/daemon-module-path.test.d.ts +2 -0
- package/dist/__tests__/daemon-module-path.test.d.ts.map +1 -0
- package/dist/__tests__/daemon-module-path.test.js +29 -0
- package/dist/__tests__/daemon-module-path.test.js.map +1 -0
- package/dist/__tests__/delegation-enforcement-levels.test.js.map +1 -1
- package/dist/__tests__/delegation-enforcer.test.js +172 -0
- package/dist/__tests__/delegation-enforcer.test.js.map +1 -1
- package/dist/__tests__/doctor-conflicts.test.js +144 -1
- package/dist/__tests__/doctor-conflicts.test.js.map +1 -1
- package/dist/__tests__/file-lock.test.d.ts +2 -0
- package/dist/__tests__/file-lock.test.d.ts.map +1 -0
- package/dist/__tests__/file-lock.test.js +209 -0
- package/dist/__tests__/file-lock.test.js.map +1 -0
- package/dist/__tests__/hooks.test.js +27 -56
- package/dist/__tests__/hooks.test.js.map +1 -1
- package/dist/__tests__/hud/defaults.test.js +3 -0
- package/dist/__tests__/hud/defaults.test.js.map +1 -1
- package/dist/__tests__/hud/limits-error.test.d.ts +5 -0
- package/dist/__tests__/hud/limits-error.test.d.ts.map +1 -0
- package/dist/__tests__/hud/limits-error.test.js +43 -0
- package/dist/__tests__/hud/limits-error.test.js.map +1 -0
- package/dist/__tests__/hud/max-width.test.d.ts +2 -0
- package/dist/__tests__/hud/max-width.test.d.ts.map +1 -0
- package/dist/__tests__/hud/max-width.test.js +149 -0
- package/dist/__tests__/hud/max-width.test.js.map +1 -0
- package/dist/__tests__/hud/rate-limits-error.test.d.ts +5 -0
- package/dist/__tests__/hud/rate-limits-error.test.d.ts.map +1 -0
- package/dist/__tests__/hud/rate-limits-error.test.js +76 -0
- package/dist/__tests__/hud/rate-limits-error.test.js.map +1 -0
- package/dist/__tests__/hud/render.test.js +245 -1
- package/dist/__tests__/hud/render.test.js.map +1 -1
- package/dist/__tests__/hud/state.test.js +15 -0
- package/dist/__tests__/hud/state.test.js.map +1 -1
- package/dist/__tests__/hud/usage-api.test.js +19 -5
- package/dist/__tests__/hud/usage-api.test.js.map +1 -1
- package/dist/__tests__/hud/version-display.test.js +3 -1
- package/dist/__tests__/hud/version-display.test.js.map +1 -1
- package/dist/__tests__/hud-agents.test.js.map +1 -1
- package/dist/__tests__/hud-api-key-source.test.d.ts +7 -0
- package/dist/__tests__/hud-api-key-source.test.d.ts.map +1 -0
- package/dist/__tests__/hud-api-key-source.test.js +112 -0
- package/dist/__tests__/hud-api-key-source.test.js.map +1 -0
- package/dist/__tests__/hud-build-guidance.test.d.ts +2 -0
- package/dist/__tests__/hud-build-guidance.test.d.ts.map +1 -0
- package/dist/__tests__/hud-build-guidance.test.js +26 -0
- package/dist/__tests__/hud-build-guidance.test.js.map +1 -0
- package/dist/__tests__/installer-hooks-merge.test.js +1 -1
- package/dist/__tests__/installer-hooks-merge.test.js.map +1 -1
- package/dist/__tests__/installer.test.js +4 -0
- package/dist/__tests__/installer.test.js.map +1 -1
- package/dist/__tests__/job-management.test.js +1 -1
- package/dist/__tests__/job-management.test.js.map +1 -1
- package/dist/__tests__/live-data.test.js +11 -5
- package/dist/__tests__/live-data.test.js.map +1 -1
- package/dist/__tests__/mcp-default-config.test.d.ts +2 -0
- package/dist/__tests__/mcp-default-config.test.d.ts.map +1 -0
- package/dist/__tests__/mcp-default-config.test.js +13 -0
- package/dist/__tests__/mcp-default-config.test.js.map +1 -0
- package/dist/__tests__/model-routing.test.js.map +1 -1
- package/dist/__tests__/non-claude-provider-detection.test.d.ts +11 -0
- package/dist/__tests__/non-claude-provider-detection.test.d.ts.map +1 -0
- package/dist/__tests__/non-claude-provider-detection.test.js +303 -0
- package/dist/__tests__/non-claude-provider-detection.test.js.map +1 -0
- package/dist/__tests__/omc-tools-server.test.js +5 -5
- package/dist/__tests__/package-dir-resolution-regression.test.d.ts +2 -0
- package/dist/__tests__/package-dir-resolution-regression.test.d.ts.map +1 -0
- package/dist/__tests__/package-dir-resolution-regression.test.js +63 -0
- package/dist/__tests__/package-dir-resolution-regression.test.js.map +1 -0
- package/dist/__tests__/pipeline-orchestrator.test.d.ts +5 -0
- package/dist/__tests__/pipeline-orchestrator.test.d.ts.map +1 -0
- package/dist/__tests__/pipeline-orchestrator.test.js +244 -0
- package/dist/__tests__/pipeline-orchestrator.test.js.map +1 -0
- package/dist/__tests__/plugin-setup-deps.test.d.ts +2 -0
- package/dist/__tests__/plugin-setup-deps.test.d.ts.map +1 -0
- package/dist/__tests__/plugin-setup-deps.test.js +64 -0
- package/dist/__tests__/plugin-setup-deps.test.js.map +1 -0
- package/dist/__tests__/pre-tool-agent-prefix.test.d.ts +8 -0
- package/dist/__tests__/pre-tool-agent-prefix.test.d.ts.map +1 -0
- package/dist/__tests__/pre-tool-agent-prefix.test.js +131 -0
- package/dist/__tests__/pre-tool-agent-prefix.test.js.map +1 -0
- package/dist/__tests__/project-memory-merge.test.d.ts +2 -0
- package/dist/__tests__/project-memory-merge.test.d.ts.map +1 -0
- package/dist/__tests__/project-memory-merge.test.js +342 -0
- package/dist/__tests__/project-memory-merge.test.js.map +1 -0
- package/dist/__tests__/ralph-prd-mandatory.test.d.ts +2 -0
- package/dist/__tests__/ralph-prd-mandatory.test.d.ts.map +1 -0
- package/dist/__tests__/ralph-prd-mandatory.test.js +316 -0
- package/dist/__tests__/ralph-prd-mandatory.test.js.map +1 -0
- package/dist/__tests__/rate-limit-wait/daemon-bootstrap.test.d.ts +2 -0
- package/dist/__tests__/rate-limit-wait/daemon-bootstrap.test.d.ts.map +1 -0
- package/dist/__tests__/rate-limit-wait/daemon-bootstrap.test.js +94 -0
- package/dist/__tests__/rate-limit-wait/daemon-bootstrap.test.js.map +1 -0
- package/dist/__tests__/rate-limit-wait/daemon.test.js.map +1 -1
- package/dist/__tests__/rate-limit-wait/integration.test.js +33 -25
- package/dist/__tests__/rate-limit-wait/integration.test.js.map +1 -1
- package/dist/__tests__/rate-limit-wait/rate-limit-monitor.test.js +34 -26
- package/dist/__tests__/rate-limit-wait/rate-limit-monitor.test.js.map +1 -1
- package/dist/__tests__/rate-limit-wait/tmux-detector.test.js.map +1 -1
- package/dist/__tests__/resolve-node.test.js.map +1 -1
- package/dist/__tests__/resolve-transcript-path.test.d.ts +12 -0
- package/dist/__tests__/resolve-transcript-path.test.d.ts.map +1 -0
- package/dist/__tests__/resolve-transcript-path.test.js +167 -0
- package/dist/__tests__/resolve-transcript-path.test.js.map +1 -0
- package/dist/__tests__/routing-force-inherit.test.d.ts +8 -0
- package/dist/__tests__/routing-force-inherit.test.d.ts.map +1 -0
- package/dist/__tests__/routing-force-inherit.test.js +180 -0
- package/dist/__tests__/routing-force-inherit.test.js.map +1 -0
- package/dist/__tests__/run-cjs-graceful-fallback.test.js +2 -2
- package/dist/__tests__/run-cjs-graceful-fallback.test.js.map +1 -1
- package/dist/__tests__/shared-memory-concurrency.test.d.ts +8 -0
- package/dist/__tests__/shared-memory-concurrency.test.d.ts.map +1 -0
- package/dist/__tests__/shared-memory-concurrency.test.js +132 -0
- package/dist/__tests__/shared-memory-concurrency.test.js.map +1 -0
- package/dist/__tests__/shared-memory.test.d.ts +2 -0
- package/dist/__tests__/shared-memory.test.d.ts.map +1 -0
- package/dist/__tests__/shared-memory.test.js +345 -0
- package/dist/__tests__/shared-memory.test.js.map +1 -0
- package/dist/__tests__/shell-path.test.d.ts +5 -0
- package/dist/__tests__/shell-path.test.d.ts.map +1 -0
- package/dist/__tests__/shell-path.test.js +70 -0
- package/dist/__tests__/shell-path.test.js.map +1 -0
- package/dist/__tests__/skills.test.js +13 -10
- package/dist/__tests__/skills.test.js.map +1 -1
- package/dist/__tests__/slack-socket.test.d.ts +5 -0
- package/dist/__tests__/slack-socket.test.d.ts.map +1 -0
- package/dist/__tests__/slack-socket.test.js +252 -0
- package/dist/__tests__/slack-socket.test.js.map +1 -0
- package/dist/__tests__/smoke-functional.test.d.ts +8 -0
- package/dist/__tests__/smoke-functional.test.d.ts.map +1 -0
- package/dist/__tests__/smoke-functional.test.js +450 -0
- package/dist/__tests__/smoke-functional.test.js.map +1 -0
- package/dist/__tests__/smoke-pipeline-edge.test.d.ts +8 -0
- package/dist/__tests__/smoke-pipeline-edge.test.d.ts.map +1 -0
- package/dist/__tests__/smoke-pipeline-edge.test.js +435 -0
- package/dist/__tests__/smoke-pipeline-edge.test.js.map +1 -0
- package/dist/__tests__/smoke-slack-and-state.test.d.ts +13 -0
- package/dist/__tests__/smoke-slack-and-state.test.d.ts.map +1 -0
- package/dist/__tests__/smoke-slack-and-state.test.js +632 -0
- package/dist/__tests__/smoke-slack-and-state.test.js.map +1 -0
- package/dist/__tests__/smoke-team-worker.test.d.ts +15 -0
- package/dist/__tests__/smoke-team-worker.test.d.ts.map +1 -0
- package/dist/__tests__/smoke-team-worker.test.js +483 -0
- package/dist/__tests__/smoke-team-worker.test.js.map +1 -0
- package/dist/__tests__/ssrf-guard.test.d.ts +2 -0
- package/dist/__tests__/ssrf-guard.test.d.ts.map +1 -0
- package/dist/__tests__/ssrf-guard.test.js +96 -0
- package/dist/__tests__/ssrf-guard.test.js.map +1 -0
- package/dist/__tests__/task-continuation.test.js +1 -1
- package/dist/__tests__/task-continuation.test.js.map +1 -1
- package/dist/__tests__/tier0-contracts.test.js +5 -1
- package/dist/__tests__/tier0-contracts.test.js.map +1 -1
- package/dist/__tests__/tier0-docs-consistency.test.js +3 -4
- package/dist/__tests__/tier0-docs-consistency.test.js.map +1 -1
- package/dist/__tests__/tools/trace-tools.test.js +7 -3
- package/dist/__tests__/tools/trace-tools.test.js.map +1 -1
- package/dist/__tests__/types.test.js +4 -4
- package/dist/__tests__/types.test.js.map +1 -1
- package/dist/__tests__/worker-adapter.test.d.ts +5 -0
- package/dist/__tests__/worker-adapter.test.d.ts.map +1 -0
- package/dist/__tests__/worker-adapter.test.js +211 -0
- package/dist/__tests__/worker-adapter.test.js.map +1 -0
- package/dist/agents/definitions.d.ts +6 -5
- package/dist/agents/definitions.d.ts.map +1 -1
- package/dist/agents/definitions.js +11 -6
- package/dist/agents/definitions.js.map +1 -1
- package/dist/agents/harsh-critic.d.ts +14 -0
- package/dist/agents/harsh-critic.d.ts.map +1 -0
- package/dist/agents/harsh-critic.js +42 -0
- package/dist/agents/harsh-critic.js.map +1 -0
- package/dist/agents/index.d.ts +1 -3
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +1 -4
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/prompt-helpers.d.ts.map +1 -1
- package/dist/agents/prompt-helpers.js +21 -16
- package/dist/agents/prompt-helpers.js.map +1 -1
- package/dist/agents/prompt-sections/index.d.ts.map +1 -1
- package/dist/agents/prompt-sections/index.js +7 -3
- package/dist/agents/prompt-sections/index.js.map +1 -1
- package/dist/agents/utils.d.ts.map +1 -1
- package/dist/agents/utils.js +22 -13
- package/dist/agents/utils.js.map +1 -1
- package/dist/cli/__tests__/ask.test.d.ts +2 -0
- package/dist/cli/__tests__/ask.test.d.ts.map +1 -0
- package/dist/cli/__tests__/ask.test.js +282 -0
- package/dist/cli/__tests__/ask.test.js.map +1 -0
- package/dist/cli/__tests__/cli-boot.test.d.ts +8 -0
- package/dist/cli/__tests__/cli-boot.test.d.ts.map +1 -0
- package/dist/cli/__tests__/cli-boot.test.js +82 -0
- package/dist/cli/__tests__/cli-boot.test.js.map +1 -0
- package/dist/cli/__tests__/launch.test.js +11 -2
- package/dist/cli/__tests__/launch.test.js.map +1 -1
- package/dist/cli/__tests__/team-command-branding.test.d.ts +2 -0
- package/dist/cli/__tests__/team-command-branding.test.d.ts.map +1 -0
- package/dist/cli/__tests__/team-command-branding.test.js +14 -0
- package/dist/cli/__tests__/team-command-branding.test.js.map +1 -0
- package/dist/cli/__tests__/team-help.test.d.ts +2 -0
- package/dist/cli/__tests__/team-help.test.d.ts.map +1 -0
- package/dist/cli/__tests__/team-help.test.js +19 -0
- package/dist/cli/__tests__/team-help.test.js.map +1 -0
- package/dist/cli/__tests__/team-runtime-boundary.test.d.ts +2 -0
- package/dist/cli/__tests__/team-runtime-boundary.test.d.ts.map +1 -0
- package/dist/cli/__tests__/team-runtime-boundary.test.js +11 -0
- package/dist/cli/__tests__/team-runtime-boundary.test.js.map +1 -0
- package/dist/cli/__tests__/team.test.d.ts +2 -0
- package/dist/cli/__tests__/team.test.d.ts.map +1 -0
- package/dist/cli/__tests__/team.test.js +335 -0
- package/dist/cli/__tests__/team.test.js.map +1 -0
- package/dist/cli/__tests__/tmux-utils.test.d.ts +11 -0
- package/dist/cli/__tests__/tmux-utils.test.d.ts.map +1 -0
- package/dist/cli/__tests__/tmux-utils.test.js +145 -0
- package/dist/cli/__tests__/tmux-utils.test.js.map +1 -0
- package/dist/cli/ask.d.ts +13 -0
- package/dist/cli/ask.d.ts.map +1 -0
- package/dist/cli/ask.js +202 -0
- package/dist/cli/ask.js.map +1 -0
- package/dist/cli/commands/__tests__/team.test.d.ts +2 -0
- package/dist/cli/commands/__tests__/team.test.d.ts.map +1 -0
- package/dist/cli/commands/__tests__/team.test.js +177 -0
- package/dist/cli/commands/__tests__/team.test.js.map +1 -0
- package/dist/cli/commands/__tests__/teleport.test.js.map +1 -1
- package/dist/cli/commands/doctor-conflicts.d.ts +14 -1
- package/dist/cli/commands/doctor-conflicts.d.ts.map +1 -1
- package/dist/cli/commands/doctor-conflicts.js +126 -12
- package/dist/cli/commands/doctor-conflicts.js.map +1 -1
- package/dist/cli/commands/team.d.ts +19 -0
- package/dist/cli/commands/team.d.ts.map +1 -0
- package/dist/cli/commands/team.js +510 -0
- package/dist/cli/commands/team.js.map +1 -0
- package/dist/cli/commands/teleport.d.ts.map +1 -1
- package/dist/cli/commands/teleport.js +6 -4
- package/dist/cli/commands/teleport.js.map +1 -1
- package/dist/cli/index.js +58 -17
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/launch.d.ts.map +1 -1
- package/dist/cli/launch.js +12 -6
- package/dist/cli/launch.js.map +1 -1
- package/dist/cli/team.d.ts +76 -0
- package/dist/cli/team.d.ts.map +1 -0
- package/dist/cli/team.js +1117 -0
- package/dist/cli/team.js.map +1 -0
- package/dist/cli/tmux-utils.d.ts +10 -0
- package/dist/cli/tmux-utils.d.ts.map +1 -1
- package/dist/cli/tmux-utils.js +20 -1
- package/dist/cli/tmux-utils.js.map +1 -1
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +134 -48
- package/dist/config/loader.js.map +1 -1
- package/dist/config/models.d.ts +36 -14
- package/dist/config/models.d.ts.map +1 -1
- package/dist/config/models.js +94 -0
- package/dist/config/models.js.map +1 -1
- package/dist/constants/names.d.ts +6 -3
- package/dist/constants/names.d.ts.map +1 -1
- package/dist/constants/names.js +7 -3
- package/dist/constants/names.js.map +1 -1
- package/dist/features/auto-update.js +5 -5
- package/dist/features/auto-update.js.map +1 -1
- package/dist/features/boulder-state/storage.d.ts +1 -1
- package/dist/features/boulder-state/storage.d.ts.map +1 -1
- package/dist/features/boulder-state/storage.js +20 -22
- package/dist/features/boulder-state/storage.js.map +1 -1
- package/dist/features/delegation-enforcer.d.ts +5 -0
- package/dist/features/delegation-enforcer.d.ts.map +1 -1
- package/dist/features/delegation-enforcer.js +58 -5
- package/dist/features/delegation-enforcer.js.map +1 -1
- package/dist/features/model-routing/router.d.ts.map +1 -1
- package/dist/features/model-routing/router.js +11 -0
- package/dist/features/model-routing/router.js.map +1 -1
- package/dist/features/model-routing/types.d.ts +6 -0
- package/dist/features/model-routing/types.d.ts.map +1 -1
- package/dist/features/model-routing/types.js.map +1 -1
- package/dist/features/rate-limit-wait/daemon.d.ts +5 -0
- package/dist/features/rate-limit-wait/daemon.d.ts.map +1 -1
- package/dist/features/rate-limit-wait/daemon.js +38 -9
- package/dist/features/rate-limit-wait/daemon.js.map +1 -1
- package/dist/features/rate-limit-wait/rate-limit-monitor.d.ts.map +1 -1
- package/dist/features/rate-limit-wait/rate-limit-monitor.js +3 -2
- package/dist/features/rate-limit-wait/rate-limit-monitor.js.map +1 -1
- package/dist/features/rate-limit-wait/tmux-detector.d.ts.map +1 -1
- package/dist/features/rate-limit-wait/tmux-detector.js +8 -2
- package/dist/features/rate-limit-wait/tmux-detector.js.map +1 -1
- package/dist/features/state-manager/__tests__/cache.test.js +161 -1
- package/dist/features/state-manager/__tests__/cache.test.js.map +1 -1
- package/dist/features/state-manager/index.d.ts +2 -0
- package/dist/features/state-manager/index.d.ts.map +1 -1
- package/dist/features/state-manager/index.js +167 -51
- package/dist/features/state-manager/index.js.map +1 -1
- package/dist/hooks/__tests__/bridge-routing.test.js +124 -1
- package/dist/hooks/__tests__/bridge-routing.test.js.map +1 -1
- package/dist/hooks/__tests__/bridge-security.test.js +1 -1
- package/dist/hooks/__tests__/bridge-security.test.js.map +1 -1
- package/dist/hooks/__tests__/bridge-team-worker-guard.test.d.ts +2 -0
- package/dist/hooks/__tests__/bridge-team-worker-guard.test.d.ts.map +1 -0
- package/dist/hooks/__tests__/bridge-team-worker-guard.test.js +52 -0
- package/dist/hooks/__tests__/bridge-team-worker-guard.test.js.map +1 -0
- package/dist/hooks/__tests__/bridge.test.js.map +1 -1
- package/dist/hooks/__tests__/codebase-map.test.js.map +1 -1
- package/dist/hooks/__tests__/compaction-concurrency.test.js.map +1 -1
- package/dist/hooks/__tests__/stop-hook-openclaw-cooldown.test.d.ts +2 -0
- package/dist/hooks/__tests__/stop-hook-openclaw-cooldown.test.d.ts.map +1 -0
- package/dist/hooks/__tests__/stop-hook-openclaw-cooldown.test.js +65 -0
- package/dist/hooks/__tests__/stop-hook-openclaw-cooldown.test.js.map +1 -0
- package/dist/hooks/auto-slash-command/live-data.d.ts.map +1 -1
- package/dist/hooks/auto-slash-command/live-data.js +54 -25
- package/dist/hooks/auto-slash-command/live-data.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/cancel.test.js +1 -1
- package/dist/hooks/autopilot/__tests__/cancel.test.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/pipeline.test.d.ts +2 -0
- package/dist/hooks/autopilot/__tests__/pipeline.test.d.ts.map +1 -0
- package/dist/hooks/autopilot/__tests__/pipeline.test.js +375 -0
- package/dist/hooks/autopilot/__tests__/pipeline.test.js.map +1 -0
- package/dist/hooks/autopilot/__tests__/state.test.js +2 -2
- package/dist/hooks/autopilot/__tests__/state.test.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/summary.test.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/transition.test.js.map +1 -1
- package/dist/hooks/autopilot/__tests__/validation.test.js +3 -3
- package/dist/hooks/autopilot/__tests__/validation.test.js.map +1 -1
- package/dist/hooks/autopilot/adapters/execution-adapter.d.ts +12 -0
- package/dist/hooks/autopilot/adapters/execution-adapter.d.ts.map +1 -0
- package/dist/hooks/autopilot/adapters/execution-adapter.js +110 -0
- package/dist/hooks/autopilot/adapters/execution-adapter.js.map +1 -0
- package/dist/hooks/autopilot/adapters/index.d.ts +22 -0
- package/dist/hooks/autopilot/adapters/index.d.ts.map +1 -0
- package/dist/hooks/autopilot/adapters/index.js +32 -0
- package/dist/hooks/autopilot/adapters/index.js.map +1 -0
- package/dist/hooks/autopilot/adapters/qa-adapter.d.ts +12 -0
- package/dist/hooks/autopilot/adapters/qa-adapter.d.ts.map +1 -0
- package/dist/hooks/autopilot/adapters/qa-adapter.js +33 -0
- package/dist/hooks/autopilot/adapters/qa-adapter.js.map +1 -0
- package/dist/hooks/autopilot/adapters/ralph-adapter.d.ts +15 -0
- package/dist/hooks/autopilot/adapters/ralph-adapter.d.ts.map +1 -0
- package/dist/hooks/autopilot/adapters/ralph-adapter.js +102 -0
- package/dist/hooks/autopilot/adapters/ralph-adapter.js.map +1 -0
- package/dist/hooks/autopilot/adapters/ralplan-adapter.d.ts +14 -0
- package/dist/hooks/autopilot/adapters/ralplan-adapter.d.ts.map +1 -0
- package/dist/hooks/autopilot/adapters/ralplan-adapter.js +81 -0
- package/dist/hooks/autopilot/adapters/ralplan-adapter.js.map +1 -0
- package/dist/hooks/autopilot/enforcement.d.ts.map +1 -1
- package/dist/hooks/autopilot/enforcement.js +162 -0
- package/dist/hooks/autopilot/enforcement.js.map +1 -1
- package/dist/hooks/autopilot/index.d.ts +4 -0
- package/dist/hooks/autopilot/index.d.ts.map +1 -1
- package/dist/hooks/autopilot/index.js +5 -0
- package/dist/hooks/autopilot/index.js.map +1 -1
- package/dist/hooks/autopilot/pipeline-types.d.ts +133 -0
- package/dist/hooks/autopilot/pipeline-types.d.ts.map +1 -0
- package/dist/hooks/autopilot/pipeline-types.js +44 -0
- package/dist/hooks/autopilot/pipeline-types.js.map +1 -0
- package/dist/hooks/autopilot/pipeline.d.ts +124 -0
- package/dist/hooks/autopilot/pipeline.d.ts.map +1 -0
- package/dist/hooks/autopilot/pipeline.js +407 -0
- package/dist/hooks/autopilot/pipeline.js.map +1 -0
- package/dist/hooks/autopilot/state.d.ts +6 -6
- package/dist/hooks/autopilot/state.d.ts.map +1 -1
- package/dist/hooks/autopilot/state.js +71 -129
- package/dist/hooks/autopilot/state.js.map +1 -1
- package/dist/hooks/autopilot/types.d.ts +21 -0
- package/dist/hooks/autopilot/types.d.ts.map +1 -1
- package/dist/hooks/autopilot/types.js.map +1 -1
- package/dist/hooks/bridge-normalize.d.ts.map +1 -1
- package/dist/hooks/bridge-normalize.js +13 -2
- package/dist/hooks/bridge-normalize.js.map +1 -1
- package/dist/hooks/bridge.d.ts.map +1 -1
- package/dist/hooks/bridge.js +151 -27
- package/dist/hooks/bridge.js.map +1 -1
- package/dist/hooks/comment-checker/index.js +1 -1
- package/dist/hooks/comment-checker/index.js.map +1 -1
- package/dist/hooks/empty-message-sanitizer/__tests__/index.test.js +2 -2
- package/dist/hooks/empty-message-sanitizer/__tests__/index.test.js.map +1 -1
- package/dist/hooks/factcheck/__tests__/factcheck.test.d.ts +7 -0
- package/dist/hooks/factcheck/__tests__/factcheck.test.d.ts.map +1 -0
- package/dist/hooks/factcheck/__tests__/factcheck.test.js +153 -0
- package/dist/hooks/factcheck/__tests__/factcheck.test.js.map +1 -0
- package/dist/hooks/factcheck/__tests__/sentinel-gate.test.d.ts +5 -0
- package/dist/hooks/factcheck/__tests__/sentinel-gate.test.d.ts.map +1 -0
- package/dist/hooks/factcheck/__tests__/sentinel-gate.test.js +159 -0
- package/dist/hooks/factcheck/__tests__/sentinel-gate.test.js.map +1 -0
- package/dist/hooks/factcheck/__tests__/sentinel.test.d.ts +7 -0
- package/dist/hooks/factcheck/__tests__/sentinel.test.d.ts.map +1 -0
- package/dist/hooks/factcheck/__tests__/sentinel.test.js +117 -0
- package/dist/hooks/factcheck/__tests__/sentinel.test.js.map +1 -0
- package/dist/hooks/factcheck/checks.d.ts +36 -0
- package/dist/hooks/factcheck/checks.d.ts.map +1 -0
- package/dist/hooks/factcheck/checks.js +144 -0
- package/dist/hooks/factcheck/checks.js.map +1 -0
- package/dist/hooks/factcheck/config.d.ts +25 -0
- package/dist/hooks/factcheck/config.d.ts.map +1 -0
- package/dist/hooks/factcheck/config.js +125 -0
- package/dist/hooks/factcheck/config.js.map +1 -0
- package/dist/hooks/factcheck/index.d.ts +34 -0
- package/dist/hooks/factcheck/index.d.ts.map +1 -0
- package/dist/hooks/factcheck/index.js +120 -0
- package/dist/hooks/factcheck/index.js.map +1 -0
- package/dist/hooks/factcheck/sentinel.d.ts +32 -0
- package/dist/hooks/factcheck/sentinel.d.ts.map +1 -0
- package/dist/hooks/factcheck/sentinel.js +153 -0
- package/dist/hooks/factcheck/sentinel.js.map +1 -0
- package/dist/hooks/factcheck/types.d.ts +99 -0
- package/dist/hooks/factcheck/types.d.ts.map +1 -0
- package/dist/hooks/factcheck/types.js +27 -0
- package/dist/hooks/factcheck/types.js.map +1 -0
- package/dist/hooks/keyword-detector/__tests__/index.test.js +29 -80
- package/dist/hooks/keyword-detector/__tests__/index.test.js.map +1 -1
- package/dist/hooks/keyword-detector/index.d.ts +1 -1
- package/dist/hooks/keyword-detector/index.d.ts.map +1 -1
- package/dist/hooks/keyword-detector/index.js +11 -21
- package/dist/hooks/keyword-detector/index.js.map +1 -1
- package/dist/hooks/learner/bridge.d.ts.map +1 -1
- package/dist/hooks/learner/bridge.js +8 -0
- package/dist/hooks/learner/bridge.js.map +1 -1
- package/dist/hooks/learner/index.d.ts +15 -15
- package/dist/hooks/learner/index.d.ts.map +1 -1
- package/dist/hooks/learner/index.js +44 -38
- package/dist/hooks/learner/index.js.map +1 -1
- package/dist/hooks/mode-registry/__tests__/session-isolation.test.js +4 -2
- package/dist/hooks/mode-registry/__tests__/session-isolation.test.js.map +1 -1
- package/dist/hooks/mode-registry/index.d.ts +2 -13
- package/dist/hooks/mode-registry/index.d.ts.map +1 -1
- package/dist/hooks/mode-registry/index.js +77 -174
- package/dist/hooks/mode-registry/index.js.map +1 -1
- package/dist/hooks/mode-registry/types.d.ts +1 -1
- package/dist/hooks/mode-registry/types.d.ts.map +1 -1
- package/dist/hooks/notepad/index.d.ts.map +1 -1
- package/dist/hooks/notepad/index.js +83 -73
- package/dist/hooks/notepad/index.js.map +1 -1
- package/dist/hooks/omc-orchestrator/index.d.ts.map +1 -1
- package/dist/hooks/omc-orchestrator/index.js +2 -1
- package/dist/hooks/omc-orchestrator/index.js.map +1 -1
- package/dist/hooks/permission-handler/__tests__/index.test.js +2 -2
- package/dist/hooks/permission-handler/__tests__/index.test.js.map +1 -1
- package/dist/hooks/permission-handler/index.d.ts +1 -1
- package/dist/hooks/permission-handler/index.d.ts.map +1 -1
- package/dist/hooks/permission-handler/index.js +4 -8
- package/dist/hooks/permission-handler/index.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/rate-limit-stop.test.js +23 -0
- package/dist/hooks/persistent-mode/__tests__/rate-limit-stop.test.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/skill-state-stop.test.js.map +1 -1
- package/dist/hooks/persistent-mode/__tests__/tool-error.test.js +1 -1
- package/dist/hooks/persistent-mode/__tests__/tool-error.test.js.map +1 -1
- package/dist/hooks/persistent-mode/index.d.ts +3 -3
- package/dist/hooks/persistent-mode/index.d.ts.map +1 -1
- package/dist/hooks/persistent-mode/index.js +25 -12
- package/dist/hooks/persistent-mode/index.js.map +1 -1
- package/dist/hooks/persistent-mode/session-isolation.test.js +20 -4
- package/dist/hooks/persistent-mode/session-isolation.test.js.map +1 -1
- package/dist/hooks/persistent-mode/stop-hook-blocking.test.d.ts +2 -0
- package/dist/hooks/persistent-mode/stop-hook-blocking.test.d.ts.map +1 -0
- package/dist/hooks/persistent-mode/stop-hook-blocking.test.js +367 -0
- package/dist/hooks/persistent-mode/stop-hook-blocking.test.js.map +1 -0
- package/dist/hooks/pre-compact/index.d.ts +2 -14
- package/dist/hooks/pre-compact/index.d.ts.map +1 -1
- package/dist/hooks/pre-compact/index.js +8 -49
- package/dist/hooks/pre-compact/index.js.map +1 -1
- package/dist/hooks/preemptive-compaction/index.js +1 -1
- package/dist/hooks/preemptive-compaction/index.js.map +1 -1
- package/dist/hooks/project-memory/__tests__/integration.test.js +4 -2
- package/dist/hooks/project-memory/__tests__/integration.test.js.map +1 -1
- package/dist/hooks/project-memory/index.d.ts +9 -9
- package/dist/hooks/project-memory/index.d.ts.map +1 -1
- package/dist/hooks/project-memory/index.js +25 -25
- package/dist/hooks/project-memory/index.js.map +1 -1
- package/dist/hooks/project-memory/learner.d.ts.map +1 -1
- package/dist/hooks/project-memory/learner.js +92 -86
- package/dist/hooks/project-memory/learner.js.map +1 -1
- package/dist/hooks/project-memory/storage.d.ts +9 -0
- package/dist/hooks/project-memory/storage.d.ts.map +1 -1
- package/dist/hooks/project-memory/storage.js +15 -0
- package/dist/hooks/project-memory/storage.js.map +1 -1
- 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 +2 -0
- package/dist/hooks/ralph/index.js.map +1 -1
- package/dist/hooks/ralph/loop.d.ts +10 -2
- package/dist/hooks/ralph/loop.d.ts.map +1 -1
- package/dist/hooks/ralph/loop.js +64 -113
- package/dist/hooks/ralph/loop.js.map +1 -1
- package/dist/hooks/ralph/prd.d.ts.map +1 -1
- package/dist/hooks/ralph/prd.js +3 -2
- package/dist/hooks/ralph/prd.js.map +1 -1
- package/dist/hooks/ralph/progress.d.ts.map +1 -1
- package/dist/hooks/ralph/progress.js +6 -5
- package/dist/hooks/ralph/progress.js.map +1 -1
- package/dist/hooks/ralph/verifier.d.ts +3 -1
- package/dist/hooks/ralph/verifier.d.ts.map +1 -1
- package/dist/hooks/ralph/verifier.js +19 -7
- package/dist/hooks/ralph/verifier.js.map +1 -1
- package/dist/hooks/session-end/__tests__/openclaw-session-end.test.d.ts +2 -0
- package/dist/hooks/session-end/__tests__/openclaw-session-end.test.d.ts.map +1 -0
- package/dist/hooks/session-end/__tests__/openclaw-session-end.test.js +86 -0
- package/dist/hooks/session-end/__tests__/openclaw-session-end.test.js.map +1 -0
- package/dist/hooks/session-end/index.d.ts.map +1 -1
- package/dist/hooks/session-end/index.js +17 -17
- package/dist/hooks/session-end/index.js.map +1 -1
- package/dist/hooks/setup/index.d.ts.map +1 -1
- package/dist/hooks/setup/index.js +0 -2
- package/dist/hooks/setup/index.js.map +1 -1
- package/dist/hooks/skill-bridge.cjs +13 -4
- package/dist/hooks/skill-state/__tests__/skill-state.test.js.map +1 -1
- package/dist/hooks/skill-state/index.d.ts +0 -5
- package/dist/hooks/skill-state/index.d.ts.map +1 -1
- package/dist/hooks/skill-state/index.js +9 -55
- package/dist/hooks/skill-state/index.js.map +1 -1
- package/dist/hooks/subagent-tracker/__tests__/flush-race.test.js.map +1 -1
- package/dist/hooks/subagent-tracker/__tests__/index.test.js.map +1 -1
- package/dist/hooks/subagent-tracker/__tests__/session-replay.test.js +1 -1
- package/dist/hooks/subagent-tracker/__tests__/session-replay.test.js.map +1 -1
- package/dist/hooks/subagent-tracker/index.d.ts.map +1 -1
- package/dist/hooks/subagent-tracker/index.js +10 -22
- package/dist/hooks/subagent-tracker/index.js.map +1 -1
- package/dist/hooks/subagent-tracker/session-replay.d.ts.map +1 -1
- package/dist/hooks/subagent-tracker/session-replay.js +3 -2
- package/dist/hooks/subagent-tracker/session-replay.js.map +1 -1
- package/dist/hooks/task-size-detector/__tests__/index.test.js +7 -7
- package/dist/hooks/task-size-detector/__tests__/index.test.js.map +1 -1
- package/dist/hooks/task-size-detector/index.d.ts.map +1 -1
- package/dist/hooks/task-size-detector/index.js +0 -3
- package/dist/hooks/task-size-detector/index.js.map +1 -1
- package/dist/hooks/team-dispatch-hook.d.ts +65 -0
- package/dist/hooks/team-dispatch-hook.d.ts.map +1 -0
- package/dist/hooks/team-dispatch-hook.js +663 -0
- package/dist/hooks/team-dispatch-hook.js.map +1 -0
- package/dist/hooks/team-leader-nudge-hook.d.ts +36 -0
- package/dist/hooks/team-leader-nudge-hook.d.ts.map +1 -0
- package/dist/hooks/team-leader-nudge-hook.js +218 -0
- package/dist/hooks/team-leader-nudge-hook.js.map +1 -0
- package/dist/hooks/team-worker-hook.d.ts +45 -0
- package/dist/hooks/team-worker-hook.d.ts.map +1 -0
- package/dist/hooks/team-worker-hook.js +415 -0
- package/dist/hooks/team-worker-hook.js.map +1 -0
- package/dist/hooks/think-mode/__tests__/index.test.js.map +1 -1
- package/dist/hooks/todo-continuation/__tests__/isAuthenticationError.test.d.ts +2 -0
- package/dist/hooks/todo-continuation/__tests__/isAuthenticationError.test.d.ts.map +1 -0
- package/dist/hooks/todo-continuation/__tests__/isAuthenticationError.test.js +33 -0
- package/dist/hooks/todo-continuation/__tests__/isAuthenticationError.test.js.map +1 -0
- package/dist/hooks/todo-continuation/index.d.ts +12 -0
- package/dist/hooks/todo-continuation/index.d.ts.map +1 -1
- package/dist/hooks/todo-continuation/index.js +37 -1
- package/dist/hooks/todo-continuation/index.js.map +1 -1
- package/dist/hooks/ultrapilot/decomposer.d.ts.map +1 -1
- package/dist/hooks/ultrapilot/decomposer.js +3 -1
- package/dist/hooks/ultrapilot/decomposer.js.map +1 -1
- package/dist/hooks/ultrapilot/index.d.ts.map +1 -1
- package/dist/hooks/ultrapilot/index.js +3 -1
- package/dist/hooks/ultrapilot/index.js.map +1 -1
- package/dist/hooks/ultrapilot/state.d.ts +1 -1
- package/dist/hooks/ultrapilot/state.d.ts.map +1 -1
- package/dist/hooks/ultrapilot/state.js +45 -77
- package/dist/hooks/ultrapilot/state.js.map +1 -1
- package/dist/hooks/ultraqa/index.d.ts.map +1 -1
- package/dist/hooks/ultraqa/index.js +4 -77
- package/dist/hooks/ultraqa/index.js.map +1 -1
- package/dist/hooks/ultrawork/index.d.ts.map +1 -1
- package/dist/hooks/ultrawork/index.js +40 -82
- package/dist/hooks/ultrawork/index.js.map +1 -1
- package/dist/hooks/ultrawork/session-isolation.test.js +1 -1
- package/dist/hooks/ultrawork/session-isolation.test.js.map +1 -1
- package/dist/hud/elements/api-key-source.d.ts +30 -0
- package/dist/hud/elements/api-key-source.d.ts.map +1 -0
- package/dist/hud/elements/api-key-source.js +70 -0
- package/dist/hud/elements/api-key-source.js.map +1 -0
- package/dist/hud/elements/index.d.ts +1 -0
- package/dist/hud/elements/index.d.ts.map +1 -1
- package/dist/hud/elements/index.js +1 -0
- package/dist/hud/elements/index.js.map +1 -1
- package/dist/hud/elements/limits.d.ts +9 -1
- package/dist/hud/elements/limits.d.ts.map +1 -1
- package/dist/hud/elements/limits.js +18 -0
- package/dist/hud/elements/limits.js.map +1 -1
- package/dist/hud/index.d.ts.map +1 -1
- package/dist/hud/index.js +40 -25
- package/dist/hud/index.js.map +1 -1
- package/dist/hud/omc-state.d.ts.map +1 -1
- package/dist/hud/omc-state.js +6 -4
- package/dist/hud/omc-state.js.map +1 -1
- package/dist/hud/render.d.ts +9 -0
- package/dist/hud/render.d.ts.map +1 -1
- package/dist/hud/render.js +166 -15
- package/dist/hud/render.js.map +1 -1
- package/dist/hud/state.d.ts.map +1 -1
- package/dist/hud/state.js +23 -14
- package/dist/hud/state.js.map +1 -1
- package/dist/hud/stdin.d.ts.map +1 -1
- package/dist/hud/stdin.js +5 -2
- package/dist/hud/stdin.js.map +1 -1
- package/dist/hud/types.d.ts +34 -3
- package/dist/hud/types.d.ts.map +1 -1
- package/dist/hud/types.js +19 -0
- package/dist/hud/types.js.map +1 -1
- package/dist/hud/usage-api.d.ts +9 -6
- package/dist/hud/usage-api.d.ts.map +1 -1
- package/dist/hud/usage-api.js +115 -46
- package/dist/hud/usage-api.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/installer/__tests__/claude-md-merge.test.js +29 -0
- package/dist/installer/__tests__/claude-md-merge.test.js.map +1 -1
- package/dist/installer/__tests__/safe-installer.test.js +1 -1
- package/dist/installer/__tests__/safe-installer.test.js.map +1 -1
- package/dist/installer/hooks.d.ts.map +1 -1
- package/dist/installer/hooks.js +11 -12
- package/dist/installer/hooks.js.map +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +20 -16
- package/dist/installer/index.js.map +1 -1
- package/dist/interop/__tests__/worker-adapter-integration.test.d.ts +2 -0
- package/dist/interop/__tests__/worker-adapter-integration.test.d.ts.map +1 -0
- package/dist/interop/__tests__/worker-adapter-integration.test.js +219 -0
- package/dist/interop/__tests__/worker-adapter-integration.test.js.map +1 -0
- package/dist/interop/__tests__/worker-adapter.test.d.ts +2 -0
- package/dist/interop/__tests__/worker-adapter.test.d.ts.map +1 -0
- package/dist/interop/__tests__/worker-adapter.test.js +408 -0
- package/dist/interop/__tests__/worker-adapter.test.js.map +1 -0
- package/dist/interop/adapter-types.d.ts +39 -0
- package/dist/interop/adapter-types.d.ts.map +1 -0
- package/dist/interop/adapter-types.js +9 -0
- package/dist/interop/adapter-types.js.map +1 -0
- package/dist/interop/worker-adapter.d.ts +116 -0
- package/dist/interop/worker-adapter.d.ts.map +1 -0
- package/dist/interop/worker-adapter.js +324 -0
- package/dist/interop/worker-adapter.js.map +1 -0
- package/dist/lib/__tests__/mode-state-io.test.d.ts +2 -0
- package/dist/lib/__tests__/mode-state-io.test.d.ts.map +1 -0
- package/dist/lib/__tests__/mode-state-io.test.js +194 -0
- package/dist/lib/__tests__/mode-state-io.test.js.map +1 -0
- package/dist/lib/__tests__/payload-limits.test.d.ts +2 -0
- package/dist/lib/__tests__/payload-limits.test.d.ts.map +1 -0
- package/dist/lib/__tests__/payload-limits.test.js +124 -0
- package/dist/lib/__tests__/payload-limits.test.js.map +1 -0
- package/dist/lib/__tests__/worktree-paths.test.js +5 -4
- package/dist/lib/__tests__/worktree-paths.test.js.map +1 -1
- package/dist/lib/file-lock.d.ts +75 -0
- package/dist/lib/file-lock.d.ts.map +1 -0
- package/dist/lib/file-lock.js +246 -0
- package/dist/lib/file-lock.js.map +1 -0
- package/dist/lib/mode-names.d.ts +10 -3
- package/dist/lib/mode-names.d.ts.map +1 -1
- package/dist/lib/mode-names.js +12 -17
- package/dist/lib/mode-names.js.map +1 -1
- package/dist/lib/mode-state-io.d.ts +41 -0
- package/dist/lib/mode-state-io.d.ts.map +1 -0
- package/dist/lib/mode-state-io.js +127 -0
- package/dist/lib/mode-state-io.js.map +1 -0
- package/dist/lib/payload-limits.d.ts +31 -0
- package/dist/lib/payload-limits.d.ts.map +1 -0
- package/dist/lib/payload-limits.js +82 -0
- package/dist/lib/payload-limits.js.map +1 -0
- package/dist/lib/project-memory-merge.d.ts +36 -0
- package/dist/lib/project-memory-merge.d.ts.map +1 -0
- package/dist/lib/project-memory-merge.js +154 -0
- package/dist/lib/project-memory-merge.js.map +1 -0
- package/dist/lib/shared-memory.d.ts +82 -0
- package/dist/lib/shared-memory.d.ts.map +1 -0
- package/dist/lib/shared-memory.js +305 -0
- package/dist/lib/shared-memory.js.map +1 -0
- package/dist/lib/worktree-paths.d.ts +31 -3
- package/dist/lib/worktree-paths.d.ts.map +1 -1
- package/dist/lib/worktree-paths.js +147 -12
- package/dist/lib/worktree-paths.js.map +1 -1
- package/dist/mcp/__tests__/team-server-artifact-convergence.test.d.ts +2 -0
- package/dist/mcp/__tests__/team-server-artifact-convergence.test.d.ts.map +1 -0
- package/dist/mcp/__tests__/team-server-artifact-convergence.test.js +84 -0
- package/dist/mcp/__tests__/team-server-artifact-convergence.test.js.map +1 -0
- package/dist/mcp/__tests__/team-server-deprecation.test.d.ts +2 -0
- package/dist/mcp/__tests__/team-server-deprecation.test.d.ts.map +1 -0
- package/dist/mcp/__tests__/team-server-deprecation.test.js +54 -0
- package/dist/mcp/__tests__/team-server-deprecation.test.js.map +1 -0
- package/dist/mcp/omc-tools-server.d.ts +2 -0
- package/dist/mcp/omc-tools-server.d.ts.map +1 -1
- package/dist/mcp/omc-tools-server.js +9 -2
- package/dist/mcp/omc-tools-server.js.map +1 -1
- package/dist/mcp/team-job-convergence.d.ts +20 -0
- package/dist/mcp/team-job-convergence.d.ts.map +1 -0
- package/dist/mcp/team-job-convergence.js +101 -0
- package/dist/mcp/team-job-convergence.js.map +1 -0
- package/dist/mcp/team-server.d.ts +33 -10
- package/dist/mcp/team-server.d.ts.map +1 -1
- package/dist/mcp/team-server.js +219 -109
- package/dist/mcp/team-server.js.map +1 -1
- package/dist/notifications/__tests__/config.test.js +100 -6
- package/dist/notifications/__tests__/config.test.js.map +1 -1
- package/dist/notifications/__tests__/custom-integration.test.d.ts +8 -0
- package/dist/notifications/__tests__/custom-integration.test.d.ts.map +1 -0
- package/dist/notifications/__tests__/custom-integration.test.js +297 -0
- package/dist/notifications/__tests__/custom-integration.test.js.map +1 -0
- package/dist/notifications/__tests__/dispatcher.test.js +195 -0
- package/dist/notifications/__tests__/dispatcher.test.js.map +1 -1
- package/dist/notifications/__tests__/redact.test.d.ts +2 -0
- package/dist/notifications/__tests__/redact.test.d.ts.map +1 -0
- package/dist/notifications/__tests__/redact.test.js +111 -0
- package/dist/notifications/__tests__/redact.test.js.map +1 -0
- package/dist/notifications/__tests__/reply-listener.test.js +8 -1
- package/dist/notifications/__tests__/reply-listener.test.js.map +1 -1
- package/dist/notifications/__tests__/slack-socket.test.d.ts +2 -0
- package/dist/notifications/__tests__/slack-socket.test.d.ts.map +1 -0
- package/dist/notifications/__tests__/slack-socket.test.js +293 -0
- package/dist/notifications/__tests__/slack-socket.test.js.map +1 -0
- package/dist/notifications/__tests__/template-engine.test.js +32 -0
- package/dist/notifications/__tests__/template-engine.test.js.map +1 -1
- package/dist/notifications/config.d.ts +40 -0
- package/dist/notifications/config.d.ts.map +1 -1
- package/dist/notifications/config.js +201 -4
- package/dist/notifications/config.js.map +1 -1
- package/dist/notifications/dispatcher.d.ts +20 -1
- package/dist/notifications/dispatcher.d.ts.map +1 -1
- package/dist/notifications/dispatcher.js +183 -7
- package/dist/notifications/dispatcher.js.map +1 -1
- package/dist/notifications/hook-config-types.d.ts +1 -1
- package/dist/notifications/hook-config-types.d.ts.map +1 -1
- package/dist/notifications/index.d.ts +11 -2
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +13 -3
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications/presets.d.ts +43 -0
- package/dist/notifications/presets.d.ts.map +1 -0
- package/dist/notifications/presets.js +122 -0
- package/dist/notifications/presets.js.map +1 -0
- package/dist/notifications/redact.d.ts +21 -0
- package/dist/notifications/redact.d.ts.map +1 -0
- package/dist/notifications/redact.js +33 -0
- package/dist/notifications/redact.js.map +1 -0
- package/dist/notifications/reply-listener.d.ts +54 -2
- package/dist/notifications/reply-listener.d.ts.map +1 -1
- package/dist/notifications/reply-listener.js +178 -15
- package/dist/notifications/reply-listener.js.map +1 -1
- package/dist/notifications/session-registry.d.ts +1 -1
- package/dist/notifications/session-registry.d.ts.map +1 -1
- package/dist/notifications/slack-socket.d.ts +242 -0
- package/dist/notifications/slack-socket.d.ts.map +1 -0
- package/dist/notifications/slack-socket.js +603 -0
- package/dist/notifications/slack-socket.js.map +1 -0
- package/dist/notifications/template-engine.d.ts.map +1 -1
- package/dist/notifications/template-engine.js +4 -0
- package/dist/notifications/template-engine.js.map +1 -1
- package/dist/notifications/template-variables.d.ts +26 -0
- package/dist/notifications/template-variables.d.ts.map +1 -0
- package/dist/notifications/template-variables.js +139 -0
- package/dist/notifications/template-variables.js.map +1 -0
- package/dist/notifications/types.d.ts +75 -2
- package/dist/notifications/types.d.ts.map +1 -1
- package/dist/notifications/validation.d.ts +24 -0
- package/dist/notifications/validation.d.ts.map +1 -0
- package/dist/notifications/validation.js +167 -0
- package/dist/notifications/validation.js.map +1 -0
- package/dist/openclaw/__tests__/dispatcher.test.js +0 -1
- package/dist/openclaw/__tests__/dispatcher.test.js.map +1 -1
- package/dist/openclaw/__tests__/index.test.js +82 -0
- package/dist/openclaw/__tests__/index.test.js.map +1 -1
- package/dist/openclaw/index.d.ts.map +1 -1
- package/dist/openclaw/index.js +24 -1
- package/dist/openclaw/index.js.map +1 -1
- package/dist/openclaw/types.d.ts +12 -0
- package/dist/openclaw/types.d.ts.map +1 -1
- package/dist/shared/types.d.ts +84 -20
- package/dist/shared/types.d.ts.map +1 -1
- package/dist/team/__tests__/api-interop.command-dialect.test.d.ts +2 -0
- package/dist/team/__tests__/api-interop.command-dialect.test.d.ts.map +1 -0
- package/dist/team/__tests__/api-interop.command-dialect.test.js +26 -0
- package/dist/team/__tests__/api-interop.command-dialect.test.js.map +1 -0
- package/dist/team/__tests__/api-interop.compatibility.test.d.ts +2 -0
- package/dist/team/__tests__/api-interop.compatibility.test.d.ts.map +1 -0
- package/dist/team/__tests__/api-interop.compatibility.test.js +93 -0
- package/dist/team/__tests__/api-interop.compatibility.test.js.map +1 -0
- package/dist/team/__tests__/cli-path-resolution.test.d.ts +2 -0
- package/dist/team/__tests__/cli-path-resolution.test.d.ts.map +1 -0
- package/dist/team/__tests__/cli-path-resolution.test.js +281 -0
- package/dist/team/__tests__/cli-path-resolution.test.js.map +1 -0
- package/dist/team/__tests__/index.compat-exports.test.d.ts +2 -0
- package/dist/team/__tests__/index.compat-exports.test.d.ts.map +1 -0
- package/dist/team/__tests__/index.compat-exports.test.js +20 -0
- package/dist/team/__tests__/index.compat-exports.test.js.map +1 -0
- package/dist/team/__tests__/layout-stabilizer.test.d.ts +2 -0
- package/dist/team/__tests__/layout-stabilizer.test.d.ts.map +1 -0
- package/dist/team/__tests__/layout-stabilizer.test.js +217 -0
- package/dist/team/__tests__/layout-stabilizer.test.js.map +1 -0
- package/dist/team/__tests__/mcp-team-bridge.spawn-args.test.js +8 -4
- package/dist/team/__tests__/mcp-team-bridge.spawn-args.test.js.map +1 -1
- package/dist/team/__tests__/mcp-team-bridge.usage.test.js +4 -2
- package/dist/team/__tests__/mcp-team-bridge.usage.test.js.map +1 -1
- package/dist/team/__tests__/model-contract.test.js +84 -8
- package/dist/team/__tests__/model-contract.test.js.map +1 -1
- package/dist/team/__tests__/pane-readiness.test.d.ts +2 -0
- package/dist/team/__tests__/pane-readiness.test.d.ts.map +1 -0
- package/dist/team/__tests__/pane-readiness.test.js +185 -0
- package/dist/team/__tests__/pane-readiness.test.js.map +1 -0
- package/dist/team/__tests__/prompt-sanitization.test.js +1 -1
- package/dist/team/__tests__/prompt-sanitization.test.js.map +1 -1
- package/dist/team/__tests__/runtime-cli.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-cli.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-cli.test.js +159 -0
- package/dist/team/__tests__/runtime-cli.test.js.map +1 -0
- package/dist/team/__tests__/runtime-done-recovery.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-done-recovery.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-done-recovery.test.js +77 -0
- package/dist/team/__tests__/runtime-done-recovery.test.js.map +1 -0
- package/dist/team/__tests__/runtime-interop-spawn-regression.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-interop-spawn-regression.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-interop-spawn-regression.test.js +139 -0
- package/dist/team/__tests__/runtime-interop-spawn-regression.test.js.map +1 -0
- package/dist/team/__tests__/runtime-prompt-mode.test.js +167 -14
- package/dist/team/__tests__/runtime-prompt-mode.test.js.map +1 -1
- package/dist/team/__tests__/runtime-v2.feature-flag.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-v2.feature-flag.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-v2.feature-flag.test.js +20 -0
- package/dist/team/__tests__/runtime-v2.feature-flag.test.js.map +1 -0
- package/dist/team/__tests__/runtime-watchdog-retry.test.d.ts +2 -0
- package/dist/team/__tests__/runtime-watchdog-retry.test.d.ts.map +1 -0
- package/dist/team/__tests__/runtime-watchdog-retry.test.js +408 -0
- package/dist/team/__tests__/runtime-watchdog-retry.test.js.map +1 -0
- package/dist/team/__tests__/shell-path.test.d.ts +2 -0
- package/dist/team/__tests__/shell-path.test.d.ts.map +1 -0
- package/dist/team/__tests__/shell-path.test.js +193 -0
- package/dist/team/__tests__/shell-path.test.js.map +1 -0
- package/dist/team/__tests__/state-paths.test.d.ts +2 -0
- package/dist/team/__tests__/state-paths.test.d.ts.map +1 -0
- package/dist/team/__tests__/state-paths.test.js +16 -0
- package/dist/team/__tests__/state-paths.test.js.map +1 -0
- package/dist/team/__tests__/task-file-ops.test.js +8 -2
- package/dist/team/__tests__/task-file-ops.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.create-team.test.js +15 -17
- package/dist/team/__tests__/tmux-session.create-team.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.kill-team-session.test.d.ts +2 -0
- package/dist/team/__tests__/tmux-session.kill-team-session.test.d.ts.map +1 -0
- package/dist/team/__tests__/tmux-session.kill-team-session.test.js +56 -0
- package/dist/team/__tests__/tmux-session.kill-team-session.test.js.map +1 -0
- package/dist/team/__tests__/tmux-session.spawn.test.js +9 -0
- package/dist/team/__tests__/tmux-session.spawn.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.test.js +83 -5
- package/dist/team/__tests__/tmux-session.test.js.map +1 -1
- package/dist/team/__tests__/wait-for-shell-ready.test.d.ts +2 -0
- package/dist/team/__tests__/wait-for-shell-ready.test.d.ts.map +1 -0
- package/dist/team/__tests__/wait-for-shell-ready.test.js +242 -0
- package/dist/team/__tests__/wait-for-shell-ready.test.js.map +1 -0
- package/dist/team/__tests__/worker-bootstrap.test.js +11 -0
- package/dist/team/__tests__/worker-bootstrap.test.js.map +1 -1
- package/dist/team/api-interop.d.ts +20 -0
- package/dist/team/api-interop.d.ts.map +1 -0
- package/dist/team/api-interop.js +601 -0
- package/dist/team/api-interop.js.map +1 -0
- package/dist/team/contracts.d.ts +14 -0
- package/dist/team/contracts.d.ts.map +1 -0
- package/dist/team/contracts.js +32 -0
- package/dist/team/contracts.js.map +1 -0
- package/dist/team/dispatch-queue.d.ts +64 -0
- package/dist/team/dispatch-queue.d.ts.map +1 -0
- package/dist/team/dispatch-queue.js +288 -0
- package/dist/team/dispatch-queue.js.map +1 -0
- package/dist/team/events.d.ts +49 -0
- package/dist/team/events.d.ts.map +1 -0
- package/dist/team/events.js +113 -0
- package/dist/team/events.js.map +1 -0
- package/dist/team/index.d.ts +15 -2
- package/dist/team/index.d.ts.map +1 -1
- package/dist/team/index.js +14 -1
- package/dist/team/index.js.map +1 -1
- package/dist/team/layout-stabilizer.d.ts +23 -0
- package/dist/team/layout-stabilizer.d.ts.map +1 -0
- package/dist/team/layout-stabilizer.js +117 -0
- package/dist/team/layout-stabilizer.js.map +1 -0
- package/dist/team/mcp-comm.d.ts +99 -0
- package/dist/team/mcp-comm.d.ts.map +1 -0
- package/dist/team/mcp-comm.js +235 -0
- package/dist/team/mcp-comm.js.map +1 -0
- package/dist/team/mcp-team-bridge.d.ts +2 -2
- package/dist/team/mcp-team-bridge.d.ts.map +1 -1
- package/dist/team/mcp-team-bridge.js +263 -144
- package/dist/team/mcp-team-bridge.js.map +1 -1
- package/dist/team/model-contract.d.ts +28 -1
- package/dist/team/model-contract.d.ts.map +1 -1
- package/dist/team/model-contract.js +143 -5
- package/dist/team/model-contract.js.map +1 -1
- package/dist/team/monitor.d.ts +45 -0
- package/dist/team/monitor.d.ts.map +1 -0
- package/dist/team/monitor.js +339 -0
- package/dist/team/monitor.js.map +1 -0
- package/dist/team/runtime-cli.d.ts +24 -0
- package/dist/team/runtime-cli.d.ts.map +1 -1
- package/dist/team/runtime-cli.js +230 -12
- package/dist/team/runtime-cli.js.map +1 -1
- package/dist/team/runtime-v2.d.ts +122 -0
- package/dist/team/runtime-v2.d.ts.map +1 -0
- package/dist/team/runtime-v2.js +766 -0
- package/dist/team/runtime-v2.js.map +1 -0
- package/dist/team/runtime.d.ts +2 -0
- package/dist/team/runtime.d.ts.map +1 -1
- package/dist/team/runtime.js +145 -52
- package/dist/team/runtime.js.map +1 -1
- package/dist/team/scaling.d.ts +59 -0
- package/dist/team/scaling.d.ts.map +1 -0
- package/dist/team/scaling.js +311 -0
- package/dist/team/scaling.js.map +1 -0
- package/dist/team/sentinel-gate.d.ts +23 -0
- package/dist/team/sentinel-gate.d.ts.map +1 -0
- package/dist/team/sentinel-gate.js +127 -0
- package/dist/team/sentinel-gate.js.map +1 -0
- package/dist/team/shell-path.d.ts +21 -0
- package/dist/team/shell-path.d.ts.map +1 -0
- package/dist/team/shell-path.js +73 -0
- package/dist/team/shell-path.js.map +1 -0
- package/dist/team/state/tasks.d.ts +48 -0
- package/dist/team/state/tasks.d.ts.map +1 -0
- package/dist/team/state/tasks.js +184 -0
- package/dist/team/state/tasks.js.map +1 -0
- package/dist/team/state-paths.d.ts +20 -4
- package/dist/team/state-paths.d.ts.map +1 -1
- package/dist/team/state-paths.js +29 -6
- package/dist/team/state-paths.js.map +1 -1
- package/dist/team/task-file-ops.d.ts +2 -1
- package/dist/team/task-file-ops.d.ts.map +1 -1
- package/dist/team/task-file-ops.js +19 -0
- package/dist/team/task-file-ops.js.map +1 -1
- package/dist/team/team-ops.d.ts +44 -0
- package/dist/team/team-ops.d.ts.map +1 -0
- package/dist/team/team-ops.js +547 -0
- package/dist/team/team-ops.js.map +1 -0
- package/dist/team/tmux-comm.d.ts.map +1 -1
- package/dist/team/tmux-comm.js +107 -44
- package/dist/team/tmux-comm.js.map +1 -1
- package/dist/team/tmux-session.d.ts +5 -0
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +81 -10
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/team/types.d.ts +303 -8
- package/dist/team/types.d.ts.map +1 -1
- package/dist/team/types.js +2 -1
- package/dist/team/types.js.map +1 -1
- package/dist/team/worker-bootstrap.d.ts.map +1 -1
- package/dist/team/worker-bootstrap.js +73 -21
- package/dist/team/worker-bootstrap.js.map +1 -1
- package/dist/tools/__tests__/cancel-integration.test.d.ts +2 -0
- package/dist/tools/__tests__/cancel-integration.test.d.ts.map +1 -0
- package/dist/tools/__tests__/cancel-integration.test.js +248 -0
- package/dist/tools/__tests__/cancel-integration.test.js.map +1 -0
- package/dist/tools/__tests__/memory-tools.test.d.ts +2 -0
- package/dist/tools/__tests__/memory-tools.test.d.ts.map +1 -0
- package/dist/tools/__tests__/memory-tools.test.js +66 -0
- package/dist/tools/__tests__/memory-tools.test.js.map +1 -0
- package/dist/tools/__tests__/state-tools.test.js +73 -5
- package/dist/tools/__tests__/state-tools.test.js.map +1 -1
- package/dist/tools/lsp/__tests__/client-eviction.test.js +6 -6
- package/dist/tools/lsp/__tests__/client-eviction.test.js.map +1 -1
- package/dist/tools/lsp/__tests__/client-timeout-env.test.d.ts +2 -0
- package/dist/tools/lsp/__tests__/client-timeout-env.test.d.ts.map +1 -0
- package/dist/tools/lsp/__tests__/client-timeout-env.test.js +39 -0
- package/dist/tools/lsp/__tests__/client-timeout-env.test.js.map +1 -0
- package/dist/tools/lsp/client.d.ts +2 -0
- package/dist/tools/lsp/client.d.ts.map +1 -1
- package/dist/tools/lsp/client.js +11 -1
- package/dist/tools/lsp/client.js.map +1 -1
- package/dist/tools/lsp/index.d.ts +1 -1
- package/dist/tools/lsp/index.d.ts.map +1 -1
- package/dist/tools/lsp/index.js +1 -1
- package/dist/tools/lsp/index.js.map +1 -1
- package/dist/tools/memory-tools.d.ts.map +1 -1
- package/dist/tools/memory-tools.js +2 -1
- package/dist/tools/memory-tools.js.map +1 -1
- package/dist/tools/python-repl/__tests__/tcp-fallback.test.d.ts +2 -0
- package/dist/tools/python-repl/__tests__/tcp-fallback.test.d.ts.map +1 -0
- package/dist/tools/python-repl/__tests__/tcp-fallback.test.js +138 -0
- package/dist/tools/python-repl/__tests__/tcp-fallback.test.js.map +1 -0
- package/dist/tools/python-repl/bridge-manager.d.ts.map +1 -1
- package/dist/tools/python-repl/bridge-manager.js +104 -24
- package/dist/tools/python-repl/bridge-manager.js.map +1 -1
- package/dist/tools/python-repl/paths.d.ts +8 -0
- package/dist/tools/python-repl/paths.d.ts.map +1 -1
- package/dist/tools/python-repl/paths.js +10 -0
- package/dist/tools/python-repl/paths.js.map +1 -1
- package/dist/tools/python-repl/socket-client.d.ts.map +1 -1
- package/dist/tools/python-repl/socket-client.js +9 -2
- package/dist/tools/python-repl/socket-client.js.map +1 -1
- package/dist/tools/shared-memory-tools.d.ts +55 -0
- package/dist/tools/shared-memory-tools.d.ts.map +1 -0
- package/dist/tools/shared-memory-tools.js +250 -0
- package/dist/tools/shared-memory-tools.js.map +1 -0
- package/dist/tools/state-tools.d.ts.map +1 -1
- package/dist/tools/state-tools.js +126 -101
- package/dist/tools/state-tools.js.map +1 -1
- package/dist/utils/daemon-module-path.d.ts +9 -0
- package/dist/utils/daemon-module-path.d.ts.map +1 -0
- package/dist/utils/daemon-module-path.js +23 -0
- package/dist/utils/daemon-module-path.js.map +1 -0
- package/dist/utils/jsonc.d.ts +16 -0
- package/dist/utils/jsonc.d.ts.map +1 -0
- package/dist/utils/jsonc.js +64 -0
- package/dist/utils/jsonc.js.map +1 -0
- package/dist/utils/paths.js +1 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/ssrf-guard.d.ts +26 -0
- package/dist/utils/ssrf-guard.d.ts.map +1 -0
- package/dist/utils/ssrf-guard.js +103 -0
- package/dist/utils/ssrf-guard.js.map +1 -0
- package/dist/verification/tier-selector.d.ts +1 -1
- package/dist/verification/tier-selector.js +1 -1
- package/docs/ANALYTICS-SYSTEM.md +2 -5
- package/docs/CLAUDE.md +88 -212
- package/docs/MIGRATION.md +138 -161
- package/docs/PERFORMANCE-MONITORING.md +5 -5
- package/docs/REFERENCE.md +351 -286
- package/docs/fixes/agent-prefix-routing-fix.md +105 -0
- package/docs/ko/ARCHITECTURE.md +152 -0
- package/docs/ko/FEATURES.md +582 -0
- package/docs/ko/MIGRATION.md +1027 -0
- package/docs/ko/REFERENCE.md +745 -0
- package/docs/partials/mode-selection-guide.md +22 -12
- package/docs/shared/mode-selection-guide.md +22 -12
- package/package.json +11 -6
- package/scripts/ask-codex.sh +24 -0
- package/scripts/ask-gemini.sh +24 -0
- package/scripts/build-cli.mjs +47 -0
- package/scripts/build-runtime-cli.mjs +2 -0
- package/scripts/context-guard-stop.mjs +66 -3
- package/scripts/context-safety.mjs +67 -2
- package/scripts/keyword-detector.mjs +14 -36
- package/scripts/persistent-mode.cjs +106 -1
- package/scripts/persistent-mode.mjs +88 -2
- package/scripts/plugin-setup.mjs +46 -4
- package/scripts/pre-tool-enforcer.mjs +1 -0
- package/scripts/qa-tests/test-custom-integration.mjs +144 -0
- package/scripts/run-provider-advisor.js +220 -0
- package/scripts/session-start.mjs +42 -2
- package/skills/AGENTS.md +16 -20
- package/skills/ask-codex/SKILL.md +47 -0
- package/skills/ask-gemini/SKILL.md +47 -0
- package/skills/autopilot/SKILL.md +39 -5
- package/skills/cancel/SKILL.md +23 -105
- package/skills/ccg/SKILL.md +58 -75
- package/skills/configure-notifications/SKILL.md +276 -0
- package/skills/configure-openclaw/SKILL.md +63 -0
- package/skills/deep-interview/SKILL.md +551 -0
- package/skills/deepinit/SKILL.md +1 -1
- package/skills/hud/SKILL.md +35 -3
- package/skills/omc-doctor/SKILL.md +30 -13
- package/skills/omc-help/SKILL.md +1 -1
- package/skills/omc-setup/SKILL.md +20 -20
- package/skills/omc-teams/SKILL.md +60 -112
- package/skills/plan/SKILL.md +5 -5
- package/skills/quick-init-project/SKILL.md +333 -0
- package/skills/ralph/SKILL.md +96 -70
- package/skills/ralplan/SKILL.md +7 -7
- package/skills/security-review/SKILL.md +2 -2
- package/skills/team/SKILL.md +36 -2
- package/skills/ultrawork/SKILL.md +7 -7
- package/templates/hooks/keyword-detector.mjs +20 -28
- package/templates/hooks/persistent-mode.mjs +89 -2
- package/templates/hooks/pre-tool-use.mjs +79 -0
- package/templates/hooks/session-start.mjs +3 -3
- package/skills/pipeline/SKILL.md +0 -434
- package/skills/review/SKILL.md +0 -30
- package/skills/ultrapilot/SKILL.md +0 -632
package/bridge/team.js
ADDED
|
@@ -0,0 +1,1460 @@
|
|
|
1
|
+
// src/cli/team.ts
|
|
2
|
+
import { spawn } from "child_process";
|
|
3
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
4
|
+
import { appendFile as appendFile2, readFile as readFile2, readdir, rm as rm2 } from "fs/promises";
|
|
5
|
+
import { homedir as homedir2 } from "os";
|
|
6
|
+
import { dirname as dirname5, join as join9 } from "path";
|
|
7
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
8
|
+
|
|
9
|
+
// src/team/tmux-session.ts
|
|
10
|
+
import { exec, execFile, execSync, execFileSync } from "child_process";
|
|
11
|
+
import { join, basename, isAbsolute, win32 } from "path";
|
|
12
|
+
import { promisify } from "util";
|
|
13
|
+
import fs from "fs/promises";
|
|
14
|
+
|
|
15
|
+
// src/team/team-name.ts
|
|
16
|
+
var TEAM_NAME_PATTERN = /^[a-z0-9][a-z0-9-]{0,48}[a-z0-9]$/;
|
|
17
|
+
function validateTeamName(teamName) {
|
|
18
|
+
if (!TEAM_NAME_PATTERN.test(teamName)) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`Invalid team name: "${teamName}". Team name must match /^[a-z0-9][a-z0-9-]{0,48}[a-z0-9]$/.`
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
return teamName;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// src/team/tmux-session.ts
|
|
27
|
+
var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
28
|
+
var promisifiedExec = promisify(exec);
|
|
29
|
+
var promisifiedExecFile = promisify(execFile);
|
|
30
|
+
async function tmuxAsync(args) {
|
|
31
|
+
if (args.some((a) => a.includes("#{"))) {
|
|
32
|
+
const escaped = args.map((a) => `"${a.replace(/"/g, '\\"')}"`).join(" ");
|
|
33
|
+
return promisifiedExec(`tmux ${escaped}`);
|
|
34
|
+
}
|
|
35
|
+
return promisifiedExecFile("tmux", args);
|
|
36
|
+
}
|
|
37
|
+
async function isWorkerAlive(paneId) {
|
|
38
|
+
try {
|
|
39
|
+
const { execFile: execFile2 } = await import("child_process");
|
|
40
|
+
const { promisify: promisify2 } = await import("util");
|
|
41
|
+
const execFileAsync = promisify2(execFile2);
|
|
42
|
+
const result = await tmuxAsync([
|
|
43
|
+
"display-message",
|
|
44
|
+
"-t",
|
|
45
|
+
paneId,
|
|
46
|
+
"-p",
|
|
47
|
+
"#{pane_dead}"
|
|
48
|
+
]);
|
|
49
|
+
return result.stdout.trim() === "0";
|
|
50
|
+
} catch {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async function killWorkerPanes(opts) {
|
|
55
|
+
const { paneIds, leaderPaneId, teamName, cwd, graceMs = 1e4 } = opts;
|
|
56
|
+
if (!paneIds.length) return;
|
|
57
|
+
const shutdownPath = join(cwd, ".omc", "state", "team", teamName, "shutdown.json");
|
|
58
|
+
try {
|
|
59
|
+
await fs.writeFile(shutdownPath, JSON.stringify({ requestedAt: Date.now() }));
|
|
60
|
+
await sleep(graceMs);
|
|
61
|
+
} catch {
|
|
62
|
+
}
|
|
63
|
+
const { execFile: execFile2 } = await import("child_process");
|
|
64
|
+
const { promisify: promisify2 } = await import("util");
|
|
65
|
+
const execFileAsync = promisify2(execFile2);
|
|
66
|
+
for (const paneId of paneIds) {
|
|
67
|
+
if (paneId === leaderPaneId) continue;
|
|
68
|
+
try {
|
|
69
|
+
await execFileAsync("tmux", ["kill-pane", "-t", paneId]);
|
|
70
|
+
} catch {
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async function killTeamSession(sessionName, workerPaneIds, leaderPaneId) {
|
|
75
|
+
const { execFile: execFile2 } = await import("child_process");
|
|
76
|
+
const { promisify: promisify2 } = await import("util");
|
|
77
|
+
const execFileAsync = promisify2(execFile2);
|
|
78
|
+
if (sessionName.includes(":")) {
|
|
79
|
+
if (!workerPaneIds?.length) return;
|
|
80
|
+
for (const id of workerPaneIds) {
|
|
81
|
+
if (id === leaderPaneId) continue;
|
|
82
|
+
try {
|
|
83
|
+
await execFileAsync("tmux", ["kill-pane", "-t", id]);
|
|
84
|
+
} catch {
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (process.env.OMC_TEAM_ALLOW_KILL_CURRENT_SESSION !== "1" && process.env.TMUX) {
|
|
90
|
+
try {
|
|
91
|
+
const current = await tmuxAsync(["display-message", "-p", "#S"]);
|
|
92
|
+
const currentSessionName = current.stdout.trim();
|
|
93
|
+
if (currentSessionName && currentSessionName === sessionName) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
} catch {
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
await execFileAsync("tmux", ["kill-session", "-t", sessionName]);
|
|
101
|
+
} catch {
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/team/runtime.ts
|
|
106
|
+
import { mkdir as mkdir2, writeFile as writeFile2, readFile, rm, rename } from "fs/promises";
|
|
107
|
+
import { join as join8 } from "path";
|
|
108
|
+
import { existsSync as existsSync4 } from "fs";
|
|
109
|
+
|
|
110
|
+
// src/team/model-contract.ts
|
|
111
|
+
import { spawnSync } from "child_process";
|
|
112
|
+
import { isAbsolute as isAbsolute2, normalize, win32 as win32Path } from "path";
|
|
113
|
+
|
|
114
|
+
// src/team/worker-bootstrap.ts
|
|
115
|
+
import { mkdir, writeFile, appendFile } from "fs/promises";
|
|
116
|
+
import { join as join4, dirname as dirname3 } from "path";
|
|
117
|
+
|
|
118
|
+
// src/agents/prompt-helpers.ts
|
|
119
|
+
import { readdirSync } from "fs";
|
|
120
|
+
import { join as join3, dirname as dirname2, basename as basename3 } from "path";
|
|
121
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
122
|
+
|
|
123
|
+
// src/agents/utils.ts
|
|
124
|
+
import { readFileSync } from "fs";
|
|
125
|
+
import { join as join2, dirname, basename as basename2, resolve, relative, isAbsolute as isAbsolute3 } from "path";
|
|
126
|
+
import { fileURLToPath } from "url";
|
|
127
|
+
|
|
128
|
+
// src/agents/prompt-helpers.ts
|
|
129
|
+
function getPackageDir() {
|
|
130
|
+
if (typeof __dirname !== "undefined" && __dirname) {
|
|
131
|
+
const currentDirName = basename3(__dirname);
|
|
132
|
+
const parentDirName = basename3(dirname2(__dirname));
|
|
133
|
+
if (currentDirName === "bridge") {
|
|
134
|
+
return join3(__dirname, "..");
|
|
135
|
+
}
|
|
136
|
+
if (currentDirName === "agents" && (parentDirName === "src" || parentDirName === "dist")) {
|
|
137
|
+
return join3(__dirname, "..", "..");
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
const __filename = fileURLToPath2(import.meta.url);
|
|
142
|
+
const __dirname2 = dirname2(__filename);
|
|
143
|
+
return join3(__dirname2, "..", "..");
|
|
144
|
+
} catch {
|
|
145
|
+
}
|
|
146
|
+
return process.cwd();
|
|
147
|
+
}
|
|
148
|
+
var _cachedRoles = null;
|
|
149
|
+
function getValidAgentRoles() {
|
|
150
|
+
if (_cachedRoles) return _cachedRoles;
|
|
151
|
+
try {
|
|
152
|
+
if (typeof __AGENT_ROLES__ !== "undefined" && Array.isArray(__AGENT_ROLES__) && __AGENT_ROLES__.length > 0) {
|
|
153
|
+
_cachedRoles = __AGENT_ROLES__;
|
|
154
|
+
return _cachedRoles;
|
|
155
|
+
}
|
|
156
|
+
} catch {
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
const agentsDir = join3(getPackageDir(), "agents");
|
|
160
|
+
const files = readdirSync(agentsDir);
|
|
161
|
+
_cachedRoles = files.filter((f) => f.endsWith(".md")).map((f) => basename3(f, ".md")).sort();
|
|
162
|
+
} catch (err) {
|
|
163
|
+
console.error("[prompt-injection] CRITICAL: Could not scan agents/ directory for role discovery:", err);
|
|
164
|
+
_cachedRoles = [];
|
|
165
|
+
}
|
|
166
|
+
return _cachedRoles;
|
|
167
|
+
}
|
|
168
|
+
var VALID_AGENT_ROLES = getValidAgentRoles();
|
|
169
|
+
|
|
170
|
+
// src/team/task-file-ops.ts
|
|
171
|
+
import { readFileSync as readFileSync3, readdirSync as readdirSync3, existsSync as existsSync3, openSync as openSync2, closeSync as closeSync2, unlinkSync as unlinkSync2, writeSync as writeSync2, statSync as statSync2, constants as fsConstants } from "fs";
|
|
172
|
+
import { join as join7 } from "path";
|
|
173
|
+
|
|
174
|
+
// src/utils/paths.ts
|
|
175
|
+
import { join as join5 } from "path";
|
|
176
|
+
import { existsSync, readFileSync as readFileSync2, readdirSync as readdirSync2, statSync, unlinkSync, rmSync } from "fs";
|
|
177
|
+
import { homedir } from "os";
|
|
178
|
+
var STALE_THRESHOLD_MS = 24 * 60 * 60 * 1e3;
|
|
179
|
+
|
|
180
|
+
// src/team/fs-utils.ts
|
|
181
|
+
import { writeFileSync, existsSync as existsSync2, mkdirSync, renameSync, openSync, writeSync, closeSync, realpathSync, constants } from "fs";
|
|
182
|
+
import { dirname as dirname4, resolve as resolve2, relative as relative2, basename as basename4, isAbsolute as isAbsolute4 } from "path";
|
|
183
|
+
|
|
184
|
+
// src/team/state-paths.ts
|
|
185
|
+
import { join as join6 } from "path";
|
|
186
|
+
|
|
187
|
+
// src/team/runtime.ts
|
|
188
|
+
function stateRoot(cwd, teamName) {
|
|
189
|
+
validateTeamName(teamName);
|
|
190
|
+
return join8(cwd, `.omc/state/team/${teamName}`);
|
|
191
|
+
}
|
|
192
|
+
async function writeJson(filePath, data) {
|
|
193
|
+
await mkdir2(join8(filePath, ".."), { recursive: true });
|
|
194
|
+
await writeFile2(filePath, JSON.stringify(data, null, 2), "utf-8");
|
|
195
|
+
}
|
|
196
|
+
async function readJsonSafe(filePath) {
|
|
197
|
+
const isDoneSignalPath = filePath.endsWith("done.json");
|
|
198
|
+
const maxAttempts = isDoneSignalPath ? 4 : 1;
|
|
199
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
200
|
+
try {
|
|
201
|
+
const content = await readFile(filePath, "utf-8");
|
|
202
|
+
try {
|
|
203
|
+
return JSON.parse(content);
|
|
204
|
+
} catch {
|
|
205
|
+
if (!isDoneSignalPath || attempt === maxAttempts) {
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
} catch (error) {
|
|
210
|
+
const isMissingDoneSignal = isDoneSignalPath && typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
|
|
211
|
+
if (isMissingDoneSignal) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
if (!isDoneSignalPath || attempt === maxAttempts) {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
await new Promise((resolve3) => setTimeout(resolve3, 25));
|
|
219
|
+
}
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
222
|
+
function taskPath(root, taskId) {
|
|
223
|
+
return join8(root, "tasks", `${taskId}.json`);
|
|
224
|
+
}
|
|
225
|
+
async function readTask(root, taskId) {
|
|
226
|
+
return readJsonSafe(taskPath(root, taskId));
|
|
227
|
+
}
|
|
228
|
+
async function monitorTeam(teamName, cwd, workerPaneIds) {
|
|
229
|
+
validateTeamName(teamName);
|
|
230
|
+
const monitorStartedAt = Date.now();
|
|
231
|
+
const root = stateRoot(cwd, teamName);
|
|
232
|
+
const taskScanStartedAt = Date.now();
|
|
233
|
+
const taskCounts = { pending: 0, inProgress: 0, completed: 0, failed: 0 };
|
|
234
|
+
try {
|
|
235
|
+
const { readdir: readdir2 } = await import("fs/promises");
|
|
236
|
+
const taskFiles = await readdir2(join8(root, "tasks"));
|
|
237
|
+
for (const f of taskFiles.filter((f2) => f2.endsWith(".json"))) {
|
|
238
|
+
const task = await readJsonSafe(join8(root, "tasks", f));
|
|
239
|
+
if (task?.status === "pending") taskCounts.pending++;
|
|
240
|
+
else if (task?.status === "in_progress") taskCounts.inProgress++;
|
|
241
|
+
else if (task?.status === "completed") taskCounts.completed++;
|
|
242
|
+
else if (task?.status === "failed") taskCounts.failed++;
|
|
243
|
+
}
|
|
244
|
+
} catch {
|
|
245
|
+
}
|
|
246
|
+
const listTasksMs = Date.now() - taskScanStartedAt;
|
|
247
|
+
const workerScanStartedAt = Date.now();
|
|
248
|
+
const workers = [];
|
|
249
|
+
const deadWorkers = [];
|
|
250
|
+
for (let i = 0; i < workerPaneIds.length; i++) {
|
|
251
|
+
const wName = `worker-${i + 1}`;
|
|
252
|
+
const paneId = workerPaneIds[i];
|
|
253
|
+
const alive = await isWorkerAlive(paneId);
|
|
254
|
+
const heartbeatPath = join8(root, "workers", wName, "heartbeat.json");
|
|
255
|
+
const heartbeat = await readJsonSafe(heartbeatPath);
|
|
256
|
+
let stalled = false;
|
|
257
|
+
if (heartbeat?.updatedAt) {
|
|
258
|
+
const age = Date.now() - new Date(heartbeat.updatedAt).getTime();
|
|
259
|
+
stalled = age > 6e4;
|
|
260
|
+
}
|
|
261
|
+
const status = {
|
|
262
|
+
workerName: wName,
|
|
263
|
+
alive,
|
|
264
|
+
paneId,
|
|
265
|
+
currentTaskId: heartbeat?.currentTaskId,
|
|
266
|
+
lastHeartbeat: heartbeat?.updatedAt,
|
|
267
|
+
stalled
|
|
268
|
+
};
|
|
269
|
+
workers.push(status);
|
|
270
|
+
if (!alive) deadWorkers.push(wName);
|
|
271
|
+
}
|
|
272
|
+
const workerScanMs = Date.now() - workerScanStartedAt;
|
|
273
|
+
let phase = "executing";
|
|
274
|
+
if (taskCounts.inProgress === 0 && taskCounts.pending > 0 && taskCounts.completed === 0) {
|
|
275
|
+
phase = "planning";
|
|
276
|
+
} else if (taskCounts.failed > 0 && taskCounts.pending === 0 && taskCounts.inProgress === 0) {
|
|
277
|
+
phase = "fixing";
|
|
278
|
+
} else if (taskCounts.completed > 0 && taskCounts.pending === 0 && taskCounts.inProgress === 0 && taskCounts.failed === 0) {
|
|
279
|
+
phase = "completed";
|
|
280
|
+
}
|
|
281
|
+
return {
|
|
282
|
+
teamName,
|
|
283
|
+
phase,
|
|
284
|
+
workers,
|
|
285
|
+
taskCounts,
|
|
286
|
+
deadWorkers,
|
|
287
|
+
monitorPerformance: {
|
|
288
|
+
listTasksMs,
|
|
289
|
+
workerScanMs,
|
|
290
|
+
totalMs: Date.now() - monitorStartedAt
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
async function shutdownTeam(teamName, sessionName, cwd, timeoutMs = 3e4, workerPaneIds, leaderPaneId) {
|
|
295
|
+
const root = stateRoot(cwd, teamName);
|
|
296
|
+
await writeJson(join8(root, "shutdown.json"), {
|
|
297
|
+
requestedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
298
|
+
teamName
|
|
299
|
+
});
|
|
300
|
+
const configData = await readJsonSafe(join8(root, "config.json"));
|
|
301
|
+
const CLI_AGENT_TYPES = /* @__PURE__ */ new Set(["claude", "codex", "gemini"]);
|
|
302
|
+
const agentTypes = configData?.agentTypes ?? [];
|
|
303
|
+
const isCliWorkerTeam = agentTypes.length > 0 && agentTypes.every((t) => CLI_AGENT_TYPES.has(t));
|
|
304
|
+
if (!isCliWorkerTeam) {
|
|
305
|
+
const deadline = Date.now() + timeoutMs;
|
|
306
|
+
const workerCount = configData?.workerCount ?? 0;
|
|
307
|
+
const expectedAcks = Array.from({ length: workerCount }, (_, i) => `worker-${i + 1}`);
|
|
308
|
+
while (Date.now() < deadline && expectedAcks.length > 0) {
|
|
309
|
+
for (const wName of [...expectedAcks]) {
|
|
310
|
+
const ackPath = join8(root, "workers", wName, "shutdown-ack.json");
|
|
311
|
+
if (existsSync4(ackPath)) {
|
|
312
|
+
expectedAcks.splice(expectedAcks.indexOf(wName), 1);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (expectedAcks.length > 0) {
|
|
316
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
await killTeamSession(sessionName, workerPaneIds, leaderPaneId);
|
|
321
|
+
try {
|
|
322
|
+
await rm(root, { recursive: true, force: true });
|
|
323
|
+
} catch {
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
async function resumeTeam(teamName, cwd) {
|
|
327
|
+
const root = stateRoot(cwd, teamName);
|
|
328
|
+
const configData = await readJsonSafe(join8(root, "config.json"));
|
|
329
|
+
if (!configData) return null;
|
|
330
|
+
const { execFile: execFile2 } = await import("child_process");
|
|
331
|
+
const { promisify: promisify2 } = await import("util");
|
|
332
|
+
const execFileAsync = promisify2(execFile2);
|
|
333
|
+
const sName = `omc-team-${teamName}`;
|
|
334
|
+
try {
|
|
335
|
+
await execFileAsync("tmux", ["has-session", "-t", sName]);
|
|
336
|
+
} catch {
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
const panesResult = await execFileAsync("tmux", [
|
|
340
|
+
"list-panes",
|
|
341
|
+
"-t",
|
|
342
|
+
sName,
|
|
343
|
+
"-F",
|
|
344
|
+
"#{pane_id}"
|
|
345
|
+
]);
|
|
346
|
+
const allPanes = panesResult.stdout.trim().split("\n").filter(Boolean);
|
|
347
|
+
const workerPaneIds = allPanes.slice(1);
|
|
348
|
+
const workerNames = workerPaneIds.map((_, i) => `worker-${i + 1}`);
|
|
349
|
+
const paneByWorker = new Map(
|
|
350
|
+
workerNames.map((wName, i) => [wName, workerPaneIds[i] ?? ""])
|
|
351
|
+
);
|
|
352
|
+
const activeWorkers = /* @__PURE__ */ new Map();
|
|
353
|
+
for (let i = 0; i < configData.tasks.length; i++) {
|
|
354
|
+
const taskId = String(i + 1);
|
|
355
|
+
const task = await readTask(root, taskId);
|
|
356
|
+
if (task?.status === "in_progress" && task.owner) {
|
|
357
|
+
const paneId = paneByWorker.get(task.owner) ?? "";
|
|
358
|
+
activeWorkers.set(task.owner, {
|
|
359
|
+
paneId,
|
|
360
|
+
taskId,
|
|
361
|
+
spawnedAt: task.assignedAt ? new Date(task.assignedAt).getTime() : Date.now()
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return {
|
|
366
|
+
teamName,
|
|
367
|
+
sessionName: sName,
|
|
368
|
+
leaderPaneId: allPanes[0] ?? "",
|
|
369
|
+
config: configData,
|
|
370
|
+
workerNames,
|
|
371
|
+
workerPaneIds,
|
|
372
|
+
activeWorkers,
|
|
373
|
+
cwd
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// src/cli/team.ts
|
|
378
|
+
var JOB_ID_PATTERN = /^omc-[a-z0-9]{1,12}$/;
|
|
379
|
+
var VALID_CLI_AGENT_TYPES = /* @__PURE__ */ new Set(["claude", "codex", "gemini"]);
|
|
380
|
+
var SUBCOMMANDS = /* @__PURE__ */ new Set(["start", "status", "wait", "cleanup", "resume", "shutdown", "api", "help", "--help", "-h"]);
|
|
381
|
+
var SUPPORTED_API_OPERATIONS = /* @__PURE__ */ new Set([
|
|
382
|
+
"send-message",
|
|
383
|
+
"broadcast",
|
|
384
|
+
"mailbox-list",
|
|
385
|
+
"mailbox-mark-delivered",
|
|
386
|
+
"list-tasks",
|
|
387
|
+
"read-task",
|
|
388
|
+
"read-config",
|
|
389
|
+
"get-summary"
|
|
390
|
+
]);
|
|
391
|
+
var TEAM_API_USAGE = `
|
|
392
|
+
Usage:
|
|
393
|
+
omc team api <operation> --input '<json>' [--json] [--cwd DIR]
|
|
394
|
+
|
|
395
|
+
Supported operations:
|
|
396
|
+
${Array.from(SUPPORTED_API_OPERATIONS).join(", ")}
|
|
397
|
+
`.trim();
|
|
398
|
+
function getTeamWorkerIdentityFromEnv(env = process.env) {
|
|
399
|
+
const omc = typeof env.OMC_TEAM_WORKER === "string" ? env.OMC_TEAM_WORKER.trim() : "";
|
|
400
|
+
if (omc) return omc;
|
|
401
|
+
const omx = typeof env.OMX_TEAM_WORKER === "string" ? env.OMX_TEAM_WORKER.trim() : "";
|
|
402
|
+
return omx || null;
|
|
403
|
+
}
|
|
404
|
+
function assertTeamSpawnAllowed(env = process.env) {
|
|
405
|
+
const workerIdentity = getTeamWorkerIdentityFromEnv(env);
|
|
406
|
+
if (!workerIdentity) return;
|
|
407
|
+
throw new Error(
|
|
408
|
+
`Worker context (${workerIdentity}) cannot start/spawn new teams. Use only "omc team api ..." operations from worker sessions.`
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
function resolveJobsDir(env = process.env) {
|
|
412
|
+
return env.OMC_JOBS_DIR || join9(homedir2(), ".omc", "team-jobs");
|
|
413
|
+
}
|
|
414
|
+
function resolveRuntimeCliPath(env = process.env) {
|
|
415
|
+
if (env.OMC_RUNTIME_CLI_PATH) {
|
|
416
|
+
return env.OMC_RUNTIME_CLI_PATH;
|
|
417
|
+
}
|
|
418
|
+
const moduleDir = dirname5(fileURLToPath3(import.meta.url));
|
|
419
|
+
return join9(moduleDir, "../../bridge/runtime-cli.cjs");
|
|
420
|
+
}
|
|
421
|
+
function ensureJobsDir(jobsDir) {
|
|
422
|
+
if (!existsSync5(jobsDir)) {
|
|
423
|
+
mkdirSync2(jobsDir, { recursive: true });
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
function jobPath(jobsDir, jobId) {
|
|
427
|
+
return join9(jobsDir, `${jobId}.json`);
|
|
428
|
+
}
|
|
429
|
+
function resultArtifactPath(jobsDir, jobId) {
|
|
430
|
+
return join9(jobsDir, `${jobId}-result.json`);
|
|
431
|
+
}
|
|
432
|
+
function panesArtifactPath(jobsDir, jobId) {
|
|
433
|
+
return join9(jobsDir, `${jobId}-panes.json`);
|
|
434
|
+
}
|
|
435
|
+
function teamStateRoot(cwd, teamName) {
|
|
436
|
+
return join9(cwd, ".omc", "state", "team", teamName);
|
|
437
|
+
}
|
|
438
|
+
function validateJobId(jobId) {
|
|
439
|
+
if (!JOB_ID_PATTERN.test(jobId)) {
|
|
440
|
+
throw new Error(`Invalid job id: ${jobId}`);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
function parseJsonSafe(content) {
|
|
444
|
+
try {
|
|
445
|
+
return JSON.parse(content);
|
|
446
|
+
} catch {
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
function readJobFromDisk(jobId, jobsDir) {
|
|
451
|
+
try {
|
|
452
|
+
const content = readFileSync4(jobPath(jobsDir, jobId), "utf-8");
|
|
453
|
+
return parseJsonSafe(content);
|
|
454
|
+
} catch {
|
|
455
|
+
return null;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
function writeJobToDisk(jobId, job, jobsDir) {
|
|
459
|
+
ensureJobsDir(jobsDir);
|
|
460
|
+
writeFileSync2(jobPath(jobsDir, jobId), JSON.stringify(job), "utf-8");
|
|
461
|
+
}
|
|
462
|
+
function isPidAlive(pid) {
|
|
463
|
+
try {
|
|
464
|
+
process.kill(pid, 0);
|
|
465
|
+
return true;
|
|
466
|
+
} catch {
|
|
467
|
+
return false;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
function parseJobResult(raw) {
|
|
471
|
+
if (!raw) return void 0;
|
|
472
|
+
const parsed = parseJsonSafe(raw);
|
|
473
|
+
return parsed ?? raw;
|
|
474
|
+
}
|
|
475
|
+
function buildStatus(jobId, job) {
|
|
476
|
+
return {
|
|
477
|
+
jobId,
|
|
478
|
+
status: job.status,
|
|
479
|
+
elapsedSeconds: ((Date.now() - job.startedAt) / 1e3).toFixed(1),
|
|
480
|
+
result: parseJobResult(job.result),
|
|
481
|
+
stderr: job.stderr
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
function generateJobId(now = Date.now()) {
|
|
485
|
+
return `omc-${now.toString(36)}`;
|
|
486
|
+
}
|
|
487
|
+
function convergeWithResultArtifact(jobId, job, jobsDir) {
|
|
488
|
+
try {
|
|
489
|
+
const artifactRaw = readFileSync4(resultArtifactPath(jobsDir, jobId), "utf-8");
|
|
490
|
+
const artifactParsed = parseJsonSafe(artifactRaw);
|
|
491
|
+
if (artifactParsed?.status === "completed" || artifactParsed?.status === "failed") {
|
|
492
|
+
return {
|
|
493
|
+
...job,
|
|
494
|
+
status: artifactParsed.status,
|
|
495
|
+
result: artifactRaw
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
} catch {
|
|
499
|
+
}
|
|
500
|
+
if (job.status === "running" && job.pid != null && !isPidAlive(job.pid)) {
|
|
501
|
+
return {
|
|
502
|
+
...job,
|
|
503
|
+
status: "failed",
|
|
504
|
+
result: job.result ?? JSON.stringify({ error: "Process no longer alive" })
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
return job;
|
|
508
|
+
}
|
|
509
|
+
function output(value, asJson) {
|
|
510
|
+
if (asJson) {
|
|
511
|
+
console.log(JSON.stringify(value, null, 2));
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
console.log(value);
|
|
515
|
+
}
|
|
516
|
+
function toInt(value, flag) {
|
|
517
|
+
const parsed = Number.parseInt(value, 10);
|
|
518
|
+
if (!Number.isFinite(parsed)) {
|
|
519
|
+
throw new Error(`Invalid ${flag} value: ${value}`);
|
|
520
|
+
}
|
|
521
|
+
return parsed;
|
|
522
|
+
}
|
|
523
|
+
function normalizeAgentType(value) {
|
|
524
|
+
const normalized = value.trim().toLowerCase();
|
|
525
|
+
if (!normalized) throw new Error("Agent type cannot be empty");
|
|
526
|
+
if (!VALID_CLI_AGENT_TYPES.has(normalized)) {
|
|
527
|
+
throw new Error(`Unsupported agent type: ${value}`);
|
|
528
|
+
}
|
|
529
|
+
return normalized;
|
|
530
|
+
}
|
|
531
|
+
function autoTeamName(task) {
|
|
532
|
+
const slug = task.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 24) || "task";
|
|
533
|
+
return `omc-${slug}-${Date.now().toString(36).slice(-4)}`;
|
|
534
|
+
}
|
|
535
|
+
function parseJsonInput(inputRaw) {
|
|
536
|
+
if (!inputRaw || !inputRaw.trim()) return {};
|
|
537
|
+
const parsed = parseJsonSafe(inputRaw);
|
|
538
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
539
|
+
throw new Error("Invalid --input JSON payload");
|
|
540
|
+
}
|
|
541
|
+
return parsed;
|
|
542
|
+
}
|
|
543
|
+
function readInputString(input, ...keys) {
|
|
544
|
+
for (const key of keys) {
|
|
545
|
+
const value = input[key];
|
|
546
|
+
if (typeof value === "string" && value.trim()) {
|
|
547
|
+
return value.trim();
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return "";
|
|
551
|
+
}
|
|
552
|
+
function mailboxPath(cwd, teamName, workerName) {
|
|
553
|
+
return join9(teamStateRoot(cwd, teamName), "mailbox", `${workerName}.jsonl`);
|
|
554
|
+
}
|
|
555
|
+
async function readTaskFiles(cwd, teamName) {
|
|
556
|
+
const tasksDir = join9(teamStateRoot(cwd, teamName), "tasks");
|
|
557
|
+
let files = [];
|
|
558
|
+
try {
|
|
559
|
+
files = (await readdir(tasksDir)).filter((f) => f.endsWith(".json"));
|
|
560
|
+
} catch {
|
|
561
|
+
return [];
|
|
562
|
+
}
|
|
563
|
+
const loaded = await Promise.all(
|
|
564
|
+
files.map(async (file) => {
|
|
565
|
+
try {
|
|
566
|
+
const raw = await readFile2(join9(tasksDir, file), "utf-8");
|
|
567
|
+
const parsed = parseJsonSafe(raw);
|
|
568
|
+
return parsed ?? null;
|
|
569
|
+
} catch {
|
|
570
|
+
return null;
|
|
571
|
+
}
|
|
572
|
+
})
|
|
573
|
+
);
|
|
574
|
+
return loaded.filter((v) => v !== null);
|
|
575
|
+
}
|
|
576
|
+
async function startTeamJob(input) {
|
|
577
|
+
assertTeamSpawnAllowed();
|
|
578
|
+
validateTeamName(input.teamName);
|
|
579
|
+
if (!Array.isArray(input.agentTypes) || input.agentTypes.length === 0) {
|
|
580
|
+
throw new Error("agentTypes must be a non-empty array");
|
|
581
|
+
}
|
|
582
|
+
if (!Array.isArray(input.tasks) || input.tasks.length === 0) {
|
|
583
|
+
throw new Error("tasks must be a non-empty array");
|
|
584
|
+
}
|
|
585
|
+
const jobsDir = resolveJobsDir();
|
|
586
|
+
const runtimeCliPath = resolveRuntimeCliPath();
|
|
587
|
+
const jobId = generateJobId();
|
|
588
|
+
const job = {
|
|
589
|
+
status: "running",
|
|
590
|
+
startedAt: Date.now(),
|
|
591
|
+
teamName: input.teamName,
|
|
592
|
+
cwd: input.cwd
|
|
593
|
+
};
|
|
594
|
+
const child = spawn("node", [runtimeCliPath], {
|
|
595
|
+
env: {
|
|
596
|
+
...process.env,
|
|
597
|
+
OMC_JOB_ID: jobId,
|
|
598
|
+
OMC_JOBS_DIR: jobsDir
|
|
599
|
+
},
|
|
600
|
+
detached: true,
|
|
601
|
+
stdio: ["pipe", "ignore", "ignore"]
|
|
602
|
+
});
|
|
603
|
+
const payload = {
|
|
604
|
+
teamName: input.teamName,
|
|
605
|
+
workerCount: input.workerCount,
|
|
606
|
+
agentTypes: input.agentTypes,
|
|
607
|
+
tasks: input.tasks,
|
|
608
|
+
cwd: input.cwd,
|
|
609
|
+
pollIntervalMs: input.pollIntervalMs,
|
|
610
|
+
sentinelGateTimeoutMs: input.sentinelGateTimeoutMs,
|
|
611
|
+
sentinelGatePollIntervalMs: input.sentinelGatePollIntervalMs
|
|
612
|
+
};
|
|
613
|
+
child.stdin.write(JSON.stringify(payload));
|
|
614
|
+
child.stdin.end();
|
|
615
|
+
child.unref();
|
|
616
|
+
if (child.pid != null) {
|
|
617
|
+
job.pid = child.pid;
|
|
618
|
+
}
|
|
619
|
+
writeJobToDisk(jobId, job, jobsDir);
|
|
620
|
+
return {
|
|
621
|
+
jobId,
|
|
622
|
+
status: "running",
|
|
623
|
+
pid: child.pid
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
async function getTeamJobStatus(jobId) {
|
|
627
|
+
validateJobId(jobId);
|
|
628
|
+
const jobsDir = resolveJobsDir();
|
|
629
|
+
const job = readJobFromDisk(jobId, jobsDir);
|
|
630
|
+
if (!job) {
|
|
631
|
+
throw new Error(`No job found: ${jobId}`);
|
|
632
|
+
}
|
|
633
|
+
const converged = convergeWithResultArtifact(jobId, job, jobsDir);
|
|
634
|
+
if (JSON.stringify(converged) !== JSON.stringify(job)) {
|
|
635
|
+
writeJobToDisk(jobId, converged, jobsDir);
|
|
636
|
+
}
|
|
637
|
+
return buildStatus(jobId, converged);
|
|
638
|
+
}
|
|
639
|
+
async function waitForTeamJob(jobId, options = {}) {
|
|
640
|
+
const timeoutMs = Math.min(options.timeoutMs ?? 3e5, 36e5);
|
|
641
|
+
const deadline = Date.now() + timeoutMs;
|
|
642
|
+
let delayMs = 500;
|
|
643
|
+
while (Date.now() < deadline) {
|
|
644
|
+
const status2 = await getTeamJobStatus(jobId);
|
|
645
|
+
if (status2.status !== "running") {
|
|
646
|
+
return status2;
|
|
647
|
+
}
|
|
648
|
+
await new Promise((resolve3) => setTimeout(resolve3, delayMs));
|
|
649
|
+
delayMs = Math.min(Math.floor(delayMs * 1.5), 2e3);
|
|
650
|
+
}
|
|
651
|
+
const status = await getTeamJobStatus(jobId);
|
|
652
|
+
return {
|
|
653
|
+
...status,
|
|
654
|
+
timedOut: true,
|
|
655
|
+
error: `Timed out waiting for job ${jobId} after ${(timeoutMs / 1e3).toFixed(0)}s`
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
async function cleanupTeamJob(jobId, graceMs = 1e4) {
|
|
659
|
+
validateJobId(jobId);
|
|
660
|
+
const jobsDir = resolveJobsDir();
|
|
661
|
+
const job = readJobFromDisk(jobId, jobsDir);
|
|
662
|
+
if (!job) {
|
|
663
|
+
throw new Error(`No job found: ${jobId}`);
|
|
664
|
+
}
|
|
665
|
+
const paneArtifact = await readFile2(panesArtifactPath(jobsDir, jobId), "utf-8").then((content) => parseJsonSafe(content)).catch(() => null);
|
|
666
|
+
if (paneArtifact?.paneIds?.length) {
|
|
667
|
+
await killWorkerPanes({
|
|
668
|
+
paneIds: paneArtifact.paneIds,
|
|
669
|
+
leaderPaneId: paneArtifact.leaderPaneId,
|
|
670
|
+
teamName: job.teamName,
|
|
671
|
+
cwd: job.cwd,
|
|
672
|
+
graceMs
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
await rm2(teamStateRoot(job.cwd, job.teamName), {
|
|
676
|
+
recursive: true,
|
|
677
|
+
force: true
|
|
678
|
+
}).catch(() => void 0);
|
|
679
|
+
writeJobToDisk(jobId, {
|
|
680
|
+
...job,
|
|
681
|
+
cleanedUpAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
682
|
+
}, jobsDir);
|
|
683
|
+
return {
|
|
684
|
+
jobId,
|
|
685
|
+
message: paneArtifact?.paneIds?.length ? `Cleaned up ${paneArtifact.paneIds.length} worker pane(s)` : "No worker pane ids found for this job"
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
async function teamStatusByTeamName(teamName, cwd = process.cwd()) {
|
|
689
|
+
validateTeamName(teamName);
|
|
690
|
+
const runtime = await resumeTeam(teamName, cwd);
|
|
691
|
+
if (!runtime) {
|
|
692
|
+
return {
|
|
693
|
+
teamName,
|
|
694
|
+
running: false,
|
|
695
|
+
error: "Team session is not currently resumable"
|
|
696
|
+
};
|
|
697
|
+
}
|
|
698
|
+
const snapshot = await monitorTeam(teamName, cwd, runtime.workerPaneIds);
|
|
699
|
+
return {
|
|
700
|
+
teamName,
|
|
701
|
+
running: true,
|
|
702
|
+
sessionName: runtime.sessionName,
|
|
703
|
+
leaderPaneId: runtime.leaderPaneId,
|
|
704
|
+
workerPaneIds: runtime.workerPaneIds,
|
|
705
|
+
snapshot
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
async function teamResumeByName(teamName, cwd = process.cwd()) {
|
|
709
|
+
validateTeamName(teamName);
|
|
710
|
+
const runtime = await resumeTeam(teamName, cwd);
|
|
711
|
+
if (!runtime) {
|
|
712
|
+
return {
|
|
713
|
+
teamName,
|
|
714
|
+
resumed: false,
|
|
715
|
+
error: "Team session is not currently resumable"
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
return {
|
|
719
|
+
teamName,
|
|
720
|
+
resumed: true,
|
|
721
|
+
sessionName: runtime.sessionName,
|
|
722
|
+
leaderPaneId: runtime.leaderPaneId,
|
|
723
|
+
workerPaneIds: runtime.workerPaneIds,
|
|
724
|
+
activeWorkers: runtime.activeWorkers.size
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
async function teamShutdownByName(teamName, options = {}) {
|
|
728
|
+
validateTeamName(teamName);
|
|
729
|
+
const cwd = options.cwd ?? process.cwd();
|
|
730
|
+
const runtime = await resumeTeam(teamName, cwd);
|
|
731
|
+
if (!runtime) {
|
|
732
|
+
if (options.force) {
|
|
733
|
+
await rm2(teamStateRoot(cwd, teamName), { recursive: true, force: true }).catch(() => void 0);
|
|
734
|
+
return {
|
|
735
|
+
teamName,
|
|
736
|
+
shutdown: true,
|
|
737
|
+
forced: true,
|
|
738
|
+
sessionFound: false
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
throw new Error(`Team ${teamName} is not running. Use --force to clear stale state.`);
|
|
742
|
+
}
|
|
743
|
+
await shutdownTeam(
|
|
744
|
+
runtime.teamName,
|
|
745
|
+
runtime.sessionName,
|
|
746
|
+
runtime.cwd,
|
|
747
|
+
options.force ? 0 : 3e4,
|
|
748
|
+
runtime.workerPaneIds,
|
|
749
|
+
runtime.leaderPaneId
|
|
750
|
+
);
|
|
751
|
+
return {
|
|
752
|
+
teamName,
|
|
753
|
+
shutdown: true,
|
|
754
|
+
forced: Boolean(options.force),
|
|
755
|
+
sessionFound: true
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
async function executeTeamApiOperation(operation, input, cwd = process.cwd()) {
|
|
759
|
+
if (!SUPPORTED_API_OPERATIONS.has(operation)) {
|
|
760
|
+
return {
|
|
761
|
+
ok: false,
|
|
762
|
+
operation,
|
|
763
|
+
error: {
|
|
764
|
+
code: "UNSUPPORTED_OPERATION",
|
|
765
|
+
message: `Unsupported omc team api operation: ${operation}`
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
const teamName = readInputString(input, "teamName", "team_name");
|
|
770
|
+
if (!teamName) {
|
|
771
|
+
return {
|
|
772
|
+
ok: false,
|
|
773
|
+
operation,
|
|
774
|
+
error: {
|
|
775
|
+
code: "INVALID_INPUT",
|
|
776
|
+
message: "teamName is required in --input payload"
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
validateTeamName(teamName);
|
|
781
|
+
if (operation === "send-message") {
|
|
782
|
+
const toWorker = readInputString(input, "toWorker", "to_worker");
|
|
783
|
+
const body = readInputString(input, "body");
|
|
784
|
+
const fromWorker = readInputString(input, "fromWorker", "from_worker") || "leader";
|
|
785
|
+
if (!toWorker || !body) {
|
|
786
|
+
return {
|
|
787
|
+
ok: false,
|
|
788
|
+
operation,
|
|
789
|
+
error: {
|
|
790
|
+
code: "INVALID_INPUT",
|
|
791
|
+
message: "send-message requires toWorker and body"
|
|
792
|
+
}
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
mkdirSync2(dirname5(mailboxPath(cwd, teamName, toWorker)), { recursive: true });
|
|
796
|
+
await appendFile2(mailboxPath(cwd, teamName, toWorker), `${JSON.stringify({
|
|
797
|
+
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
798
|
+
from: fromWorker,
|
|
799
|
+
to: toWorker,
|
|
800
|
+
body,
|
|
801
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
802
|
+
notifiedAt: null
|
|
803
|
+
})}
|
|
804
|
+
`, "utf-8");
|
|
805
|
+
return {
|
|
806
|
+
ok: true,
|
|
807
|
+
operation,
|
|
808
|
+
data: { teamName, toWorker }
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
if (operation === "broadcast") {
|
|
812
|
+
const body = readInputString(input, "body");
|
|
813
|
+
const fromWorker = readInputString(input, "fromWorker", "from_worker") || "leader";
|
|
814
|
+
if (!body) {
|
|
815
|
+
return {
|
|
816
|
+
ok: false,
|
|
817
|
+
operation,
|
|
818
|
+
error: {
|
|
819
|
+
code: "INVALID_INPUT",
|
|
820
|
+
message: "broadcast requires body"
|
|
821
|
+
}
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
const mailboxDir = join9(teamStateRoot(cwd, teamName), "mailbox");
|
|
825
|
+
let workers = [];
|
|
826
|
+
try {
|
|
827
|
+
workers = (await readdir(mailboxDir)).filter((f) => f.endsWith(".jsonl")).map((f) => f.replace(/\.jsonl$/, ""));
|
|
828
|
+
} catch {
|
|
829
|
+
workers = [];
|
|
830
|
+
}
|
|
831
|
+
if (workers.length === 0) {
|
|
832
|
+
const configRaw = await readFile2(join9(teamStateRoot(cwd, teamName), "config.json"), "utf-8").catch(() => "");
|
|
833
|
+
const config = parseJsonSafe(configRaw);
|
|
834
|
+
const workerCount = Number.isFinite(config?.workerCount) && (config?.workerCount ?? 0) > 0 ? Number(config?.workerCount) : 0;
|
|
835
|
+
workers = Array.from({ length: workerCount }, (_, i) => `worker-${i + 1}`);
|
|
836
|
+
}
|
|
837
|
+
await Promise.all(workers.map(async (worker) => {
|
|
838
|
+
mkdirSync2(dirname5(mailboxPath(cwd, teamName, worker)), { recursive: true });
|
|
839
|
+
await appendFile2(mailboxPath(cwd, teamName, worker), `${JSON.stringify({
|
|
840
|
+
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
841
|
+
from: fromWorker,
|
|
842
|
+
to: worker,
|
|
843
|
+
body,
|
|
844
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
845
|
+
broadcast: true
|
|
846
|
+
})}
|
|
847
|
+
`, "utf-8");
|
|
848
|
+
}));
|
|
849
|
+
return {
|
|
850
|
+
ok: true,
|
|
851
|
+
operation,
|
|
852
|
+
data: { teamName, recipients: workers }
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
if (operation === "mailbox-list") {
|
|
856
|
+
const mailboxDir = join9(teamStateRoot(cwd, teamName), "mailbox");
|
|
857
|
+
const workerFilter = readInputString(input, "workerName", "worker");
|
|
858
|
+
let files = [];
|
|
859
|
+
try {
|
|
860
|
+
files = (await readdir(mailboxDir)).filter((f) => f.endsWith(".jsonl"));
|
|
861
|
+
} catch {
|
|
862
|
+
files = [];
|
|
863
|
+
}
|
|
864
|
+
const selected = workerFilter ? files.filter((f) => f === `${workerFilter}.jsonl`) : files;
|
|
865
|
+
const mailboxes = await Promise.all(selected.map(async (file) => {
|
|
866
|
+
const workerName = file.replace(/\.jsonl$/, "");
|
|
867
|
+
const raw = await readFile2(join9(mailboxDir, file), "utf-8").catch(() => "");
|
|
868
|
+
const lines = raw.split("\n").filter((line) => line.trim().length > 0);
|
|
869
|
+
return { workerName, count: lines.length };
|
|
870
|
+
}));
|
|
871
|
+
return {
|
|
872
|
+
ok: true,
|
|
873
|
+
operation,
|
|
874
|
+
data: { teamName, mailboxes }
|
|
875
|
+
};
|
|
876
|
+
}
|
|
877
|
+
if (operation === "mailbox-mark-delivered") {
|
|
878
|
+
const workerName = readInputString(input, "workerName", "worker");
|
|
879
|
+
const messageId = readInputString(input, "messageId", "message_id");
|
|
880
|
+
if (!workerName || !messageId) {
|
|
881
|
+
return {
|
|
882
|
+
ok: false,
|
|
883
|
+
operation,
|
|
884
|
+
error: {
|
|
885
|
+
code: "INVALID_INPUT",
|
|
886
|
+
message: "mailbox-mark-delivered requires workerName and messageId"
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
}
|
|
890
|
+
mkdirSync2(dirname5(mailboxPath(cwd, teamName, workerName)), { recursive: true });
|
|
891
|
+
await appendFile2(mailboxPath(cwd, teamName, workerName), `${JSON.stringify({
|
|
892
|
+
id: messageId,
|
|
893
|
+
type: "delivered",
|
|
894
|
+
deliveredAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
895
|
+
})}
|
|
896
|
+
`, "utf-8");
|
|
897
|
+
return {
|
|
898
|
+
ok: true,
|
|
899
|
+
operation,
|
|
900
|
+
data: { teamName, workerName, messageId }
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
if (operation === "list-tasks") {
|
|
904
|
+
const tasks2 = await readTaskFiles(cwd, teamName);
|
|
905
|
+
return {
|
|
906
|
+
ok: true,
|
|
907
|
+
operation,
|
|
908
|
+
data: { teamName, tasks: tasks2 }
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
if (operation === "read-task") {
|
|
912
|
+
const taskId = readInputString(input, "taskId", "task_id");
|
|
913
|
+
if (!taskId) {
|
|
914
|
+
return {
|
|
915
|
+
ok: false,
|
|
916
|
+
operation,
|
|
917
|
+
error: {
|
|
918
|
+
code: "INVALID_INPUT",
|
|
919
|
+
message: "read-task requires taskId"
|
|
920
|
+
}
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
const raw = await readFile2(join9(teamStateRoot(cwd, teamName), "tasks", `${taskId}.json`), "utf-8").catch(() => "");
|
|
924
|
+
const task = raw ? parseJsonSafe(raw) : null;
|
|
925
|
+
return {
|
|
926
|
+
ok: true,
|
|
927
|
+
operation,
|
|
928
|
+
data: { teamName, taskId, task }
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
if (operation === "read-config") {
|
|
932
|
+
const raw = await readFile2(join9(teamStateRoot(cwd, teamName), "config.json"), "utf-8").catch(() => "");
|
|
933
|
+
return {
|
|
934
|
+
ok: true,
|
|
935
|
+
operation,
|
|
936
|
+
data: { teamName, config: raw ? parseJsonSafe(raw) : null }
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
const tasks = await readTaskFiles(cwd, teamName);
|
|
940
|
+
const taskCounts = tasks.reduce(
|
|
941
|
+
(acc, task) => {
|
|
942
|
+
const status = String(task.status ?? "unknown");
|
|
943
|
+
if (status === "pending") acc.pending += 1;
|
|
944
|
+
else if (status === "in_progress") acc.inProgress += 1;
|
|
945
|
+
else if (status === "completed") acc.completed += 1;
|
|
946
|
+
else if (status === "failed") acc.failed += 1;
|
|
947
|
+
return acc;
|
|
948
|
+
},
|
|
949
|
+
{ pending: 0, inProgress: 0, completed: 0, failed: 0 }
|
|
950
|
+
);
|
|
951
|
+
const runtime = await resumeTeam(teamName, cwd);
|
|
952
|
+
const snapshot = runtime ? await monitorTeam(teamName, cwd, runtime.workerPaneIds) : null;
|
|
953
|
+
return {
|
|
954
|
+
ok: true,
|
|
955
|
+
operation,
|
|
956
|
+
data: {
|
|
957
|
+
teamName,
|
|
958
|
+
taskCounts,
|
|
959
|
+
workerCount: runtime?.workerPaneIds.length ?? 0,
|
|
960
|
+
phase: snapshot?.phase ?? null
|
|
961
|
+
}
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
async function teamStartCommand(input, options = {}) {
|
|
965
|
+
const result = await startTeamJob(input);
|
|
966
|
+
output(result, Boolean(options.json));
|
|
967
|
+
return result;
|
|
968
|
+
}
|
|
969
|
+
async function teamStatusCommand(jobId, options = {}) {
|
|
970
|
+
const result = await getTeamJobStatus(jobId);
|
|
971
|
+
output(result, Boolean(options.json));
|
|
972
|
+
return result;
|
|
973
|
+
}
|
|
974
|
+
async function teamWaitCommand(jobId, waitOptions = {}, options = {}) {
|
|
975
|
+
const result = await waitForTeamJob(jobId, waitOptions);
|
|
976
|
+
output(result, Boolean(options.json));
|
|
977
|
+
return result;
|
|
978
|
+
}
|
|
979
|
+
async function teamCleanupCommand(jobId, cleanupOptions = {}, options = {}) {
|
|
980
|
+
const result = await cleanupTeamJob(jobId, cleanupOptions.graceMs);
|
|
981
|
+
output(result, Boolean(options.json));
|
|
982
|
+
return result;
|
|
983
|
+
}
|
|
984
|
+
var TEAM_USAGE = `
|
|
985
|
+
Usage:
|
|
986
|
+
omc team start --agent <claude|codex|gemini>[,<agent>...] --task "<task>" [--count N] [--name TEAM] [--cwd DIR] [--json]
|
|
987
|
+
omc team status <job_id|team_name> [--json] [--cwd DIR]
|
|
988
|
+
omc team wait <job_id> [--timeout-ms MS] [--json]
|
|
989
|
+
omc team cleanup <job_id> [--grace-ms MS] [--json]
|
|
990
|
+
omc team resume <team_name> [--json] [--cwd DIR]
|
|
991
|
+
omc team shutdown <team_name> [--force] [--json] [--cwd DIR]
|
|
992
|
+
omc team api <operation> [--input '<json>'] [--json] [--cwd DIR]
|
|
993
|
+
omc team [ralph] <N:agent-type> "task" [--json] [--cwd DIR]
|
|
994
|
+
|
|
995
|
+
Examples:
|
|
996
|
+
omc team start --agent codex --count 2 --task "review auth flow"
|
|
997
|
+
omc team status omc-abc123
|
|
998
|
+
omc team status auth-review
|
|
999
|
+
omc team resume auth-review
|
|
1000
|
+
omc team shutdown auth-review --force
|
|
1001
|
+
omc team api list-tasks --input '{"teamName":"auth-review"}' --json
|
|
1002
|
+
omc team 3:codex "refactor launch command"
|
|
1003
|
+
`.trim();
|
|
1004
|
+
function parseStartArgs(args) {
|
|
1005
|
+
const agentValues = [];
|
|
1006
|
+
const taskValues = [];
|
|
1007
|
+
let teamName;
|
|
1008
|
+
let cwd = process.cwd();
|
|
1009
|
+
let count = 1;
|
|
1010
|
+
let json = false;
|
|
1011
|
+
let subjectPrefix = "Task";
|
|
1012
|
+
let pollIntervalMs;
|
|
1013
|
+
let sentinelGateTimeoutMs;
|
|
1014
|
+
let sentinelGatePollIntervalMs;
|
|
1015
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
1016
|
+
const token = args[i];
|
|
1017
|
+
const next = args[i + 1];
|
|
1018
|
+
if (token === "--json") {
|
|
1019
|
+
json = true;
|
|
1020
|
+
continue;
|
|
1021
|
+
}
|
|
1022
|
+
if (token === "--agent") {
|
|
1023
|
+
if (!next) throw new Error("Missing value after --agent");
|
|
1024
|
+
agentValues.push(...next.split(",").map(normalizeAgentType));
|
|
1025
|
+
i += 1;
|
|
1026
|
+
continue;
|
|
1027
|
+
}
|
|
1028
|
+
if (token.startsWith("--agent=")) {
|
|
1029
|
+
agentValues.push(...token.slice("--agent=".length).split(",").map(normalizeAgentType));
|
|
1030
|
+
continue;
|
|
1031
|
+
}
|
|
1032
|
+
if (token === "--task") {
|
|
1033
|
+
if (!next) throw new Error("Missing value after --task");
|
|
1034
|
+
taskValues.push(next);
|
|
1035
|
+
i += 1;
|
|
1036
|
+
continue;
|
|
1037
|
+
}
|
|
1038
|
+
if (token.startsWith("--task=")) {
|
|
1039
|
+
taskValues.push(token.slice("--task=".length));
|
|
1040
|
+
continue;
|
|
1041
|
+
}
|
|
1042
|
+
if (token === "--count") {
|
|
1043
|
+
if (!next) throw new Error("Missing value after --count");
|
|
1044
|
+
count = toInt(next, "--count");
|
|
1045
|
+
i += 1;
|
|
1046
|
+
continue;
|
|
1047
|
+
}
|
|
1048
|
+
if (token.startsWith("--count=")) {
|
|
1049
|
+
count = toInt(token.slice("--count=".length), "--count");
|
|
1050
|
+
continue;
|
|
1051
|
+
}
|
|
1052
|
+
if (token === "--name") {
|
|
1053
|
+
if (!next) throw new Error("Missing value after --name");
|
|
1054
|
+
teamName = next;
|
|
1055
|
+
i += 1;
|
|
1056
|
+
continue;
|
|
1057
|
+
}
|
|
1058
|
+
if (token.startsWith("--name=")) {
|
|
1059
|
+
teamName = token.slice("--name=".length);
|
|
1060
|
+
continue;
|
|
1061
|
+
}
|
|
1062
|
+
if (token === "--cwd") {
|
|
1063
|
+
if (!next) throw new Error("Missing value after --cwd");
|
|
1064
|
+
cwd = next;
|
|
1065
|
+
i += 1;
|
|
1066
|
+
continue;
|
|
1067
|
+
}
|
|
1068
|
+
if (token.startsWith("--cwd=")) {
|
|
1069
|
+
cwd = token.slice("--cwd=".length);
|
|
1070
|
+
continue;
|
|
1071
|
+
}
|
|
1072
|
+
if (token === "--subject") {
|
|
1073
|
+
if (!next) throw new Error("Missing value after --subject");
|
|
1074
|
+
subjectPrefix = next;
|
|
1075
|
+
i += 1;
|
|
1076
|
+
continue;
|
|
1077
|
+
}
|
|
1078
|
+
if (token.startsWith("--subject=")) {
|
|
1079
|
+
subjectPrefix = token.slice("--subject=".length);
|
|
1080
|
+
continue;
|
|
1081
|
+
}
|
|
1082
|
+
if (token === "--poll-interval-ms") {
|
|
1083
|
+
if (!next) throw new Error("Missing value after --poll-interval-ms");
|
|
1084
|
+
pollIntervalMs = toInt(next, "--poll-interval-ms");
|
|
1085
|
+
i += 1;
|
|
1086
|
+
continue;
|
|
1087
|
+
}
|
|
1088
|
+
if (token.startsWith("--poll-interval-ms=")) {
|
|
1089
|
+
pollIntervalMs = toInt(token.slice("--poll-interval-ms=".length), "--poll-interval-ms");
|
|
1090
|
+
continue;
|
|
1091
|
+
}
|
|
1092
|
+
if (token === "--sentinel-gate-timeout-ms") {
|
|
1093
|
+
if (!next) throw new Error("Missing value after --sentinel-gate-timeout-ms");
|
|
1094
|
+
sentinelGateTimeoutMs = toInt(next, "--sentinel-gate-timeout-ms");
|
|
1095
|
+
i += 1;
|
|
1096
|
+
continue;
|
|
1097
|
+
}
|
|
1098
|
+
if (token.startsWith("--sentinel-gate-timeout-ms=")) {
|
|
1099
|
+
sentinelGateTimeoutMs = toInt(token.slice("--sentinel-gate-timeout-ms=".length), "--sentinel-gate-timeout-ms");
|
|
1100
|
+
continue;
|
|
1101
|
+
}
|
|
1102
|
+
if (token === "--sentinel-gate-poll-interval-ms") {
|
|
1103
|
+
if (!next) throw new Error("Missing value after --sentinel-gate-poll-interval-ms");
|
|
1104
|
+
sentinelGatePollIntervalMs = toInt(next, "--sentinel-gate-poll-interval-ms");
|
|
1105
|
+
i += 1;
|
|
1106
|
+
continue;
|
|
1107
|
+
}
|
|
1108
|
+
if (token.startsWith("--sentinel-gate-poll-interval-ms=")) {
|
|
1109
|
+
sentinelGatePollIntervalMs = toInt(token.slice("--sentinel-gate-poll-interval-ms=".length), "--sentinel-gate-poll-interval-ms");
|
|
1110
|
+
continue;
|
|
1111
|
+
}
|
|
1112
|
+
throw new Error(`Unknown argument for "omc team start": ${token}`);
|
|
1113
|
+
}
|
|
1114
|
+
if (count < 1) throw new Error("--count must be >= 1");
|
|
1115
|
+
if (agentValues.length === 0) throw new Error("Missing required --agent");
|
|
1116
|
+
if (taskValues.length === 0) throw new Error("Missing required --task");
|
|
1117
|
+
const agentTypes = agentValues.length === 1 ? Array.from({ length: count }, () => agentValues[0]) : [...agentValues];
|
|
1118
|
+
if (agentValues.length > 1 && count !== 1) {
|
|
1119
|
+
throw new Error("Do not combine --count with multiple --agent values; either use one agent+count or explicit agent list.");
|
|
1120
|
+
}
|
|
1121
|
+
const taskDescriptions = taskValues.length === 1 ? Array.from({ length: agentTypes.length }, () => taskValues[0]) : [...taskValues];
|
|
1122
|
+
if (taskDescriptions.length !== agentTypes.length) {
|
|
1123
|
+
throw new Error(`Task count (${taskDescriptions.length}) must match worker count (${agentTypes.length}).`);
|
|
1124
|
+
}
|
|
1125
|
+
const resolvedTeamName = teamName && teamName.trim() ? teamName.trim() : autoTeamName(taskDescriptions[0]);
|
|
1126
|
+
const tasks = taskDescriptions.map((description, index) => ({
|
|
1127
|
+
subject: `${subjectPrefix} ${index + 1}`,
|
|
1128
|
+
description
|
|
1129
|
+
}));
|
|
1130
|
+
return {
|
|
1131
|
+
input: {
|
|
1132
|
+
teamName: resolvedTeamName,
|
|
1133
|
+
agentTypes,
|
|
1134
|
+
tasks,
|
|
1135
|
+
cwd,
|
|
1136
|
+
...pollIntervalMs != null ? { pollIntervalMs } : {},
|
|
1137
|
+
...sentinelGateTimeoutMs != null ? { sentinelGateTimeoutMs } : {},
|
|
1138
|
+
...sentinelGatePollIntervalMs != null ? { sentinelGatePollIntervalMs } : {}
|
|
1139
|
+
},
|
|
1140
|
+
json
|
|
1141
|
+
};
|
|
1142
|
+
}
|
|
1143
|
+
function parseCommonJobArgs(args, command) {
|
|
1144
|
+
let json = false;
|
|
1145
|
+
let target;
|
|
1146
|
+
let cwd;
|
|
1147
|
+
let timeoutMs;
|
|
1148
|
+
let graceMs;
|
|
1149
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
1150
|
+
const token = args[i];
|
|
1151
|
+
const next = args[i + 1];
|
|
1152
|
+
if (!token.startsWith("-") && !target) {
|
|
1153
|
+
target = token;
|
|
1154
|
+
continue;
|
|
1155
|
+
}
|
|
1156
|
+
if (token === "--json") {
|
|
1157
|
+
json = true;
|
|
1158
|
+
continue;
|
|
1159
|
+
}
|
|
1160
|
+
if (token === "--cwd") {
|
|
1161
|
+
if (!next) throw new Error("Missing value after --cwd");
|
|
1162
|
+
cwd = next;
|
|
1163
|
+
i += 1;
|
|
1164
|
+
continue;
|
|
1165
|
+
}
|
|
1166
|
+
if (token.startsWith("--cwd=")) {
|
|
1167
|
+
cwd = token.slice("--cwd=".length);
|
|
1168
|
+
continue;
|
|
1169
|
+
}
|
|
1170
|
+
if (token === "--job-id") {
|
|
1171
|
+
if (!next) throw new Error("Missing value after --job-id");
|
|
1172
|
+
target = next;
|
|
1173
|
+
i += 1;
|
|
1174
|
+
continue;
|
|
1175
|
+
}
|
|
1176
|
+
if (token.startsWith("--job-id=")) {
|
|
1177
|
+
target = token.slice("--job-id=".length);
|
|
1178
|
+
continue;
|
|
1179
|
+
}
|
|
1180
|
+
if (command === "wait") {
|
|
1181
|
+
if (token === "--timeout-ms") {
|
|
1182
|
+
if (!next) throw new Error("Missing value after --timeout-ms");
|
|
1183
|
+
timeoutMs = toInt(next, "--timeout-ms");
|
|
1184
|
+
i += 1;
|
|
1185
|
+
continue;
|
|
1186
|
+
}
|
|
1187
|
+
if (token.startsWith("--timeout-ms=")) {
|
|
1188
|
+
timeoutMs = toInt(token.slice("--timeout-ms=".length), "--timeout-ms");
|
|
1189
|
+
continue;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
if (command === "cleanup") {
|
|
1193
|
+
if (token === "--grace-ms") {
|
|
1194
|
+
if (!next) throw new Error("Missing value after --grace-ms");
|
|
1195
|
+
graceMs = toInt(next, "--grace-ms");
|
|
1196
|
+
i += 1;
|
|
1197
|
+
continue;
|
|
1198
|
+
}
|
|
1199
|
+
if (token.startsWith("--grace-ms=")) {
|
|
1200
|
+
graceMs = toInt(token.slice("--grace-ms=".length), "--grace-ms");
|
|
1201
|
+
continue;
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
throw new Error(`Unknown argument for "omc team ${command}": ${token}`);
|
|
1205
|
+
}
|
|
1206
|
+
if (!target) {
|
|
1207
|
+
throw new Error(`Missing required target for "omc team ${command}".`);
|
|
1208
|
+
}
|
|
1209
|
+
return {
|
|
1210
|
+
target,
|
|
1211
|
+
json,
|
|
1212
|
+
...cwd ? { cwd } : {},
|
|
1213
|
+
...timeoutMs != null ? { timeoutMs } : {},
|
|
1214
|
+
...graceMs != null ? { graceMs } : {}
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
function parseTeamTargetArgs(args, command) {
|
|
1218
|
+
let teamName;
|
|
1219
|
+
let json = false;
|
|
1220
|
+
let cwd;
|
|
1221
|
+
let force = false;
|
|
1222
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
1223
|
+
const token = args[i];
|
|
1224
|
+
const next = args[i + 1];
|
|
1225
|
+
if (!token.startsWith("-") && !teamName) {
|
|
1226
|
+
teamName = token;
|
|
1227
|
+
continue;
|
|
1228
|
+
}
|
|
1229
|
+
if (token === "--json") {
|
|
1230
|
+
json = true;
|
|
1231
|
+
continue;
|
|
1232
|
+
}
|
|
1233
|
+
if (token === "--cwd") {
|
|
1234
|
+
if (!next) throw new Error("Missing value after --cwd");
|
|
1235
|
+
cwd = next;
|
|
1236
|
+
i += 1;
|
|
1237
|
+
continue;
|
|
1238
|
+
}
|
|
1239
|
+
if (token.startsWith("--cwd=")) {
|
|
1240
|
+
cwd = token.slice("--cwd=".length);
|
|
1241
|
+
continue;
|
|
1242
|
+
}
|
|
1243
|
+
if (command === "shutdown" && token === "--force") {
|
|
1244
|
+
force = true;
|
|
1245
|
+
continue;
|
|
1246
|
+
}
|
|
1247
|
+
throw new Error(`Unknown argument for "omc team ${command}": ${token}`);
|
|
1248
|
+
}
|
|
1249
|
+
if (!teamName) {
|
|
1250
|
+
throw new Error(`Missing required <team_name> for "omc team ${command}".`);
|
|
1251
|
+
}
|
|
1252
|
+
return {
|
|
1253
|
+
teamName,
|
|
1254
|
+
json,
|
|
1255
|
+
...cwd ? { cwd } : {},
|
|
1256
|
+
...command === "shutdown" ? { force } : {}
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
function parseApiArgs(args) {
|
|
1260
|
+
let operation;
|
|
1261
|
+
let inputRaw;
|
|
1262
|
+
let json = false;
|
|
1263
|
+
let cwd;
|
|
1264
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
1265
|
+
const token = args[i];
|
|
1266
|
+
const next = args[i + 1];
|
|
1267
|
+
if (!token.startsWith("-") && !operation) {
|
|
1268
|
+
operation = token;
|
|
1269
|
+
continue;
|
|
1270
|
+
}
|
|
1271
|
+
if (token === "--json") {
|
|
1272
|
+
json = true;
|
|
1273
|
+
continue;
|
|
1274
|
+
}
|
|
1275
|
+
if (token === "--input") {
|
|
1276
|
+
if (!next) throw new Error("Missing value after --input");
|
|
1277
|
+
inputRaw = next;
|
|
1278
|
+
i += 1;
|
|
1279
|
+
continue;
|
|
1280
|
+
}
|
|
1281
|
+
if (token.startsWith("--input=")) {
|
|
1282
|
+
inputRaw = token.slice("--input=".length);
|
|
1283
|
+
continue;
|
|
1284
|
+
}
|
|
1285
|
+
if (token === "--cwd") {
|
|
1286
|
+
if (!next) throw new Error("Missing value after --cwd");
|
|
1287
|
+
cwd = next;
|
|
1288
|
+
i += 1;
|
|
1289
|
+
continue;
|
|
1290
|
+
}
|
|
1291
|
+
if (token.startsWith("--cwd=")) {
|
|
1292
|
+
cwd = token.slice("--cwd=".length);
|
|
1293
|
+
continue;
|
|
1294
|
+
}
|
|
1295
|
+
throw new Error(`Unknown argument for "omc team api": ${token}`);
|
|
1296
|
+
}
|
|
1297
|
+
if (!operation) {
|
|
1298
|
+
throw new Error(`Missing required <operation> for "omc team api"
|
|
1299
|
+
|
|
1300
|
+
${TEAM_API_USAGE}`);
|
|
1301
|
+
}
|
|
1302
|
+
return {
|
|
1303
|
+
operation,
|
|
1304
|
+
input: parseJsonInput(inputRaw),
|
|
1305
|
+
json,
|
|
1306
|
+
...cwd ? { cwd } : {}
|
|
1307
|
+
};
|
|
1308
|
+
}
|
|
1309
|
+
function parseLegacyStartAlias(args) {
|
|
1310
|
+
if (args.length < 2) return null;
|
|
1311
|
+
let index = 0;
|
|
1312
|
+
let ralph = false;
|
|
1313
|
+
if (args[index]?.toLowerCase() === "ralph") {
|
|
1314
|
+
ralph = true;
|
|
1315
|
+
index += 1;
|
|
1316
|
+
}
|
|
1317
|
+
const spec = args[index];
|
|
1318
|
+
if (!spec) return null;
|
|
1319
|
+
const match = spec.match(/^(\d+):([a-zA-Z0-9_-]+)$/);
|
|
1320
|
+
if (!match) return null;
|
|
1321
|
+
const workerCount = toInt(match[1], "worker-count");
|
|
1322
|
+
if (workerCount < 1) throw new Error("worker-count must be >= 1");
|
|
1323
|
+
const agentType = normalizeAgentType(match[2]);
|
|
1324
|
+
index += 1;
|
|
1325
|
+
let json = false;
|
|
1326
|
+
let cwd = process.cwd();
|
|
1327
|
+
const taskParts = [];
|
|
1328
|
+
for (let i = index; i < args.length; i += 1) {
|
|
1329
|
+
const token = args[i];
|
|
1330
|
+
const next = args[i + 1];
|
|
1331
|
+
if (token === "--json") {
|
|
1332
|
+
json = true;
|
|
1333
|
+
continue;
|
|
1334
|
+
}
|
|
1335
|
+
if (token === "--cwd") {
|
|
1336
|
+
if (!next) throw new Error("Missing value after --cwd");
|
|
1337
|
+
cwd = next;
|
|
1338
|
+
i += 1;
|
|
1339
|
+
continue;
|
|
1340
|
+
}
|
|
1341
|
+
if (token.startsWith("--cwd=")) {
|
|
1342
|
+
cwd = token.slice("--cwd=".length);
|
|
1343
|
+
continue;
|
|
1344
|
+
}
|
|
1345
|
+
taskParts.push(token);
|
|
1346
|
+
}
|
|
1347
|
+
const task = taskParts.join(" ").trim();
|
|
1348
|
+
if (!task) throw new Error("Legacy start alias requires a task string");
|
|
1349
|
+
return {
|
|
1350
|
+
workerCount,
|
|
1351
|
+
agentType,
|
|
1352
|
+
task,
|
|
1353
|
+
teamName: autoTeamName(task),
|
|
1354
|
+
ralph,
|
|
1355
|
+
json,
|
|
1356
|
+
cwd
|
|
1357
|
+
};
|
|
1358
|
+
}
|
|
1359
|
+
async function teamCommand(argv) {
|
|
1360
|
+
const [commandRaw, ...rest] = argv;
|
|
1361
|
+
const command = (commandRaw || "").toLowerCase();
|
|
1362
|
+
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
1363
|
+
console.log(TEAM_USAGE);
|
|
1364
|
+
return;
|
|
1365
|
+
}
|
|
1366
|
+
if (command === "start") {
|
|
1367
|
+
const parsed = parseStartArgs(rest);
|
|
1368
|
+
await teamStartCommand(parsed.input, { json: parsed.json });
|
|
1369
|
+
return;
|
|
1370
|
+
}
|
|
1371
|
+
if (command === "status") {
|
|
1372
|
+
const parsed = parseCommonJobArgs(rest, "status");
|
|
1373
|
+
if (JOB_ID_PATTERN.test(parsed.target)) {
|
|
1374
|
+
await teamStatusCommand(parsed.target, { json: parsed.json });
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
const byTeam = await teamStatusByTeamName(parsed.target, parsed.cwd ?? process.cwd());
|
|
1378
|
+
output(byTeam, parsed.json);
|
|
1379
|
+
return;
|
|
1380
|
+
}
|
|
1381
|
+
if (command === "wait") {
|
|
1382
|
+
const parsed = parseCommonJobArgs(rest, "wait");
|
|
1383
|
+
await teamWaitCommand(parsed.target, { ...parsed.timeoutMs != null ? { timeoutMs: parsed.timeoutMs } : {} }, { json: parsed.json });
|
|
1384
|
+
return;
|
|
1385
|
+
}
|
|
1386
|
+
if (command === "cleanup") {
|
|
1387
|
+
const parsed = parseCommonJobArgs(rest, "cleanup");
|
|
1388
|
+
await teamCleanupCommand(parsed.target, { ...parsed.graceMs != null ? { graceMs: parsed.graceMs } : {} }, { json: parsed.json });
|
|
1389
|
+
return;
|
|
1390
|
+
}
|
|
1391
|
+
if (command === "resume") {
|
|
1392
|
+
const parsed = parseTeamTargetArgs(rest, "resume");
|
|
1393
|
+
const result = await teamResumeByName(parsed.teamName, parsed.cwd ?? process.cwd());
|
|
1394
|
+
output(result, parsed.json);
|
|
1395
|
+
return;
|
|
1396
|
+
}
|
|
1397
|
+
if (command === "shutdown") {
|
|
1398
|
+
const parsed = parseTeamTargetArgs(rest, "shutdown");
|
|
1399
|
+
const result = await teamShutdownByName(parsed.teamName, {
|
|
1400
|
+
cwd: parsed.cwd ?? process.cwd(),
|
|
1401
|
+
force: Boolean(parsed.force)
|
|
1402
|
+
});
|
|
1403
|
+
output(result, parsed.json);
|
|
1404
|
+
return;
|
|
1405
|
+
}
|
|
1406
|
+
if (command === "api") {
|
|
1407
|
+
if (rest.length === 0 || rest[0] === "help" || rest[0] === "--help" || rest[0] === "-h") {
|
|
1408
|
+
console.log(TEAM_API_USAGE);
|
|
1409
|
+
return;
|
|
1410
|
+
}
|
|
1411
|
+
const parsed = parseApiArgs(rest);
|
|
1412
|
+
const result = await executeTeamApiOperation(parsed.operation, parsed.input, parsed.cwd ?? process.cwd());
|
|
1413
|
+
if (!result.ok && !parsed.json) {
|
|
1414
|
+
throw new Error(result.error?.message ?? "Team API operation failed");
|
|
1415
|
+
}
|
|
1416
|
+
output(result, parsed.json);
|
|
1417
|
+
return;
|
|
1418
|
+
}
|
|
1419
|
+
if (!SUBCOMMANDS.has(command)) {
|
|
1420
|
+
const legacy = parseLegacyStartAlias(argv);
|
|
1421
|
+
if (legacy) {
|
|
1422
|
+
const tasks = Array.from({ length: legacy.workerCount }, (_, idx) => ({
|
|
1423
|
+
subject: legacy.ralph ? `Ralph Task ${idx + 1}` : `Task ${idx + 1}`,
|
|
1424
|
+
description: legacy.task
|
|
1425
|
+
}));
|
|
1426
|
+
const result = await startTeamJob({
|
|
1427
|
+
teamName: legacy.teamName,
|
|
1428
|
+
workerCount: legacy.workerCount,
|
|
1429
|
+
agentTypes: Array.from({ length: legacy.workerCount }, () => legacy.agentType),
|
|
1430
|
+
tasks,
|
|
1431
|
+
cwd: legacy.cwd
|
|
1432
|
+
});
|
|
1433
|
+
output(result, legacy.json);
|
|
1434
|
+
return;
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
throw new Error(`Unknown team command: ${command}
|
|
1438
|
+
|
|
1439
|
+
${TEAM_USAGE}`);
|
|
1440
|
+
}
|
|
1441
|
+
async function main(argv) {
|
|
1442
|
+
await teamCommand(argv);
|
|
1443
|
+
}
|
|
1444
|
+
export {
|
|
1445
|
+
TEAM_USAGE,
|
|
1446
|
+
cleanupTeamJob,
|
|
1447
|
+
executeTeamApiOperation,
|
|
1448
|
+
getTeamJobStatus,
|
|
1449
|
+
main,
|
|
1450
|
+
startTeamJob,
|
|
1451
|
+
teamCleanupCommand,
|
|
1452
|
+
teamCommand,
|
|
1453
|
+
teamResumeByName,
|
|
1454
|
+
teamShutdownByName,
|
|
1455
|
+
teamStartCommand,
|
|
1456
|
+
teamStatusByTeamName,
|
|
1457
|
+
teamStatusCommand,
|
|
1458
|
+
teamWaitCommand,
|
|
1459
|
+
waitForTeamJob
|
|
1460
|
+
};
|