triflux 10.0.0 → 10.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +171 -0
- package/README.md +32 -15
- package/bin/triflux.mjs +62 -5
- package/hooks/agent-route-guard.mjs +109 -0
- package/hooks/cross-review-tracker.mjs +122 -0
- package/hooks/error-context.mjs +148 -0
- package/hooks/hook-adaptive-collector.mjs +86 -0
- package/hooks/hook-manager.mjs +365 -0
- package/hooks/hook-orchestrator.mjs +312 -0
- package/hooks/hook-registry.json +246 -0
- package/hooks/hooks.json +89 -0
- package/hooks/keyword-rules.json +574 -0
- package/hooks/lib/resolve-root.mjs +59 -0
- package/hooks/mcp-config-watcher.mjs +80 -0
- package/hooks/pipeline-stop.mjs +76 -0
- package/hooks/safety-guard.mjs +169 -0
- package/hooks/subagent-verifier.mjs +80 -0
- package/hub/account-broker.mjs +251 -0
- package/hub/adaptive-diagnostic.mjs +323 -0
- package/hub/adaptive-inject.mjs +186 -0
- package/hub/adaptive-memory.mjs +163 -0
- package/hub/adaptive.mjs +143 -0
- package/hub/assign-callbacks.mjs +133 -0
- package/hub/bridge.mjs +799 -0
- package/hub/cli-adapter-base.mjs +280 -0
- package/hub/codex-adapter.mjs +199 -0
- package/hub/codex-compat.mjs +11 -0
- package/hub/codex-preflight.mjs +166 -0
- package/hub/delegator/contracts.mjs +37 -0
- package/hub/delegator/index.mjs +14 -0
- package/hub/delegator/schema/delegator-tools.schema.json +250 -0
- package/hub/delegator/service.mjs +307 -0
- package/hub/delegator/tool-definitions.mjs +35 -0
- package/hub/fullcycle.mjs +96 -0
- package/hub/gemini-adapter.mjs +180 -0
- package/hub/hitl.mjs +143 -0
- package/hub/intent.mjs +193 -0
- package/hub/lib/cache-guard.mjs +114 -0
- package/hub/lib/known-errors.json +72 -0
- package/hub/lib/memory-store.mjs +748 -0
- package/hub/lib/process-utils.mjs +361 -0
- package/hub/lib/ssh-command.mjs +211 -0
- package/hub/lib/ssh-retry.mjs +59 -0
- package/hub/lib/uuidv7.mjs +44 -0
- package/hub/memory-doctor.mjs +480 -0
- package/hub/middleware/request-logger.mjs +161 -0
- package/hub/paths.mjs +30 -0
- package/hub/pipe.mjs +664 -0
- package/hub/pipeline/gates/confidence.mjs +56 -0
- package/hub/pipeline/gates/consensus.mjs +94 -0
- package/hub/pipeline/gates/index.mjs +5 -0
- package/hub/pipeline/gates/selfcheck.mjs +82 -0
- package/hub/pipeline/index.mjs +318 -0
- package/hub/pipeline/state.mjs +191 -0
- package/hub/pipeline/transitions.mjs +124 -0
- package/hub/platform.mjs +225 -0
- package/hub/public/dashboard.html +355 -0
- package/hub/public/tray-icon.ico +0 -0
- package/hub/public/tray-icon.png +0 -0
- package/hub/quality/deslop.mjs +253 -0
- package/hub/reflexion.mjs +372 -0
- package/hub/research.mjs +146 -0
- package/hub/router.mjs +791 -0
- package/hub/routing/complexity.mjs +166 -0
- package/hub/routing/index.mjs +117 -0
- package/hub/routing/q-learning.mjs +336 -0
- package/hub/schema.sql +148 -0
- package/hub/server.mjs +1264 -0
- package/hub/session-fingerprint.mjs +352 -0
- package/hub/state.mjs +258 -0
- package/hub/store-adapter.mjs +118 -0
- package/hub/store.mjs +857 -0
- package/hub/team/agent-map.json +11 -0
- package/hub/team/ansi.mjs +379 -0
- package/hub/team/backend.mjs +90 -0
- package/hub/team/cli/commands/attach.mjs +37 -0
- package/hub/team/cli/commands/control.mjs +43 -0
- package/hub/team/cli/commands/debug.mjs +74 -0
- package/hub/team/cli/commands/focus.mjs +53 -0
- package/hub/team/cli/commands/interrupt.mjs +36 -0
- package/hub/team/cli/commands/kill.mjs +37 -0
- package/hub/team/cli/commands/list.mjs +24 -0
- package/hub/team/cli/commands/send.mjs +37 -0
- package/hub/team/cli/commands/start/index.mjs +106 -0
- package/hub/team/cli/commands/start/parse-args.mjs +130 -0
- package/hub/team/cli/commands/start/start-headless.mjs +109 -0
- package/hub/team/cli/commands/start/start-in-process.mjs +40 -0
- package/hub/team/cli/commands/start/start-mux.mjs +73 -0
- package/hub/team/cli/commands/start/start-wt.mjs +69 -0
- package/hub/team/cli/commands/status.mjs +87 -0
- package/hub/team/cli/commands/stop.mjs +31 -0
- package/hub/team/cli/commands/task.mjs +30 -0
- package/hub/team/cli/commands/tasks.mjs +13 -0
- package/hub/team/cli/help.mjs +42 -0
- package/hub/team/cli/index.mjs +41 -0
- package/hub/team/cli/manifest.mjs +29 -0
- package/hub/team/cli/render.mjs +30 -0
- package/hub/team/cli/services/attach-fallback.mjs +54 -0
- package/hub/team/cli/services/hub-client.mjs +227 -0
- package/hub/team/cli/services/member-selector.mjs +30 -0
- package/hub/team/cli/services/native-control.mjs +117 -0
- package/hub/team/cli/services/runtime-mode.mjs +62 -0
- package/hub/team/cli/services/state-store.mjs +48 -0
- package/hub/team/cli/services/task-model.mjs +30 -0
- package/hub/team/conductor-mesh-bridge.mjs +121 -0
- package/hub/team/conductor.mjs +671 -0
- package/hub/team/dashboard-anchor.mjs +14 -0
- package/hub/team/dashboard-layout.mjs +33 -0
- package/hub/team/dashboard-open.mjs +153 -0
- package/hub/team/dashboard.mjs +274 -0
- package/hub/team/event-log.mjs +76 -0
- package/hub/team/handoff.mjs +303 -0
- package/hub/team/headless.mjs +1156 -0
- package/hub/team/health-probe.mjs +272 -0
- package/hub/team/launcher-template.mjs +95 -0
- package/hub/team/lead-control.mjs +104 -0
- package/hub/team/native-supervisor.mjs +392 -0
- package/hub/team/native.mjs +649 -0
- package/hub/team/nativeProxy.mjs +688 -0
- package/hub/team/notify.mjs +293 -0
- package/hub/team/orchestrator.mjs +161 -0
- package/hub/team/pane.mjs +153 -0
- package/hub/team/process-cleanup.mjs +342 -0
- package/hub/team/psmux.mjs +1354 -0
- package/hub/team/remote-probe.mjs +276 -0
- package/hub/team/remote-session.mjs +299 -0
- package/hub/team/remote-watcher.mjs +478 -0
- package/hub/team/routing.mjs +223 -0
- package/hub/team/session-sync.mjs +169 -0
- package/hub/team/session.mjs +611 -0
- package/hub/team/shared.mjs +13 -0
- package/hub/team/staleState.mjs +361 -0
- package/hub/team/swarm-hypervisor.mjs +589 -0
- package/hub/team/swarm-locks.mjs +204 -0
- package/hub/team/swarm-planner.mjs +260 -0
- package/hub/team/swarm-reconciler.mjs +137 -0
- package/hub/team/tui-lite.mjs +380 -0
- package/hub/team/tui-remote-adapter.mjs +393 -0
- package/hub/team/tui-viewer.mjs +463 -0
- package/hub/team/tui.mjs +1449 -0
- package/hub/team/worktree-lifecycle.mjs +193 -0
- package/hub/team/wt-manager.mjs +407 -0
- package/hub/team/wt-templates.json +43 -0
- package/hub/team-bridge.mjs +27 -0
- package/hub/token-mode.mjs +224 -0
- package/hub/tools.mjs +636 -0
- package/hub/tray.mjs +376 -0
- package/hub/workers/claude-worker.mjs +475 -0
- package/hub/workers/codex-mcp.mjs +507 -0
- package/hub/workers/delegator-mcp.mjs +1076 -0
- package/hub/workers/factory.mjs +21 -0
- package/hub/workers/gemini-worker.mjs +374 -0
- package/hub/workers/interface.mjs +52 -0
- package/hub/workers/worker-utils.mjs +104 -0
- package/hud/colors.mjs +88 -0
- package/hud/constants.mjs +88 -0
- package/hud/context-monitor.mjs +403 -0
- package/hud/hud-qos-status.mjs +210 -0
- package/hud/providers/claude.mjs +314 -0
- package/hud/providers/codex.mjs +151 -0
- package/hud/providers/gemini.mjs +320 -0
- package/hud/renderers.mjs +442 -0
- package/hud/terminal.mjs +140 -0
- package/hud/utils.mjs +313 -0
- package/mesh/index.mjs +63 -0
- package/mesh/mesh-budget.mjs +128 -0
- package/mesh/mesh-heartbeat.mjs +100 -0
- package/mesh/mesh-protocol.mjs +96 -0
- package/mesh/mesh-queue.mjs +165 -0
- package/mesh/mesh-registry.mjs +78 -0
- package/mesh/mesh-router.mjs +76 -0
- package/package.json +8 -1
- package/references/hosts.json +33 -0
- package/scripts/__tests__/gen-skill-docs.test.mjs +87 -0
- package/scripts/__tests__/keyword-detector.test.mjs +234 -0
- package/scripts/__tests__/mcp-guard-engine.test.mjs +118 -0
- package/scripts/__tests__/remote-spawn-transfer.test.mjs +117 -0
- package/scripts/__tests__/remote-spawn.test.mjs +92 -0
- package/scripts/__tests__/skill-template.test.mjs +193 -0
- package/scripts/__tests__/smoke.test.mjs +34 -0
- package/scripts/cache-buildup.mjs +30 -0
- package/scripts/cache-doctor.mjs +149 -0
- package/scripts/cache-warmup.mjs +557 -0
- package/scripts/claudemd-sync.mjs +148 -0
- package/scripts/cli-route.sh +3 -0
- package/scripts/completions/tfx.bash +47 -0
- package/scripts/completions/tfx.fish +44 -0
- package/scripts/completions/tfx.zsh +83 -0
- package/scripts/cross-review-gate.mjs +126 -0
- package/scripts/cross-review-tracker.mjs +238 -0
- package/scripts/gen-skill-docs.mjs +111 -0
- package/scripts/headless-guard-fast.sh +21 -0
- package/scripts/headless-guard.mjs +360 -0
- package/scripts/hub-ensure.mjs +120 -0
- package/scripts/keyword-detector.mjs +272 -0
- package/scripts/keyword-rules-expander.mjs +521 -0
- package/scripts/lib/claudemd-scanner.mjs +218 -0
- package/scripts/lib/context.mjs +67 -0
- package/scripts/lib/cross-review-utils.mjs +51 -0
- package/scripts/lib/env-probe.mjs +241 -0
- package/scripts/lib/gemini-profiles.mjs +85 -0
- package/scripts/lib/handoff.mjs +171 -0
- package/scripts/lib/hook-utils.mjs +14 -0
- package/scripts/lib/keyword-rules.mjs +166 -0
- package/scripts/lib/logger.mjs +105 -0
- package/scripts/lib/mcp-filter.mjs +739 -0
- package/scripts/lib/mcp-guard-engine.mjs +954 -0
- package/scripts/lib/mcp-manifest.mjs +79 -0
- package/scripts/lib/mcp-server-catalog.mjs +118 -0
- package/scripts/lib/psmux-info.mjs +119 -0
- package/scripts/lib/remote-spawn-transfer.mjs +196 -0
- package/scripts/lib/skill-template.mjs +326 -0
- package/scripts/mcp-check.mjs +237 -0
- package/scripts/mcp-cleanup.ps1 +17 -0
- package/scripts/mcp-gateway-config.mjs +207 -0
- package/scripts/mcp-gateway-ensure.mjs +85 -0
- package/scripts/mcp-gateway-integration-test.mjs +228 -0
- package/scripts/mcp-gateway-start.mjs +226 -0
- package/scripts/mcp-gateway-start.ps1 +141 -0
- package/scripts/mcp-gateway-verify.mjs +77 -0
- package/scripts/mcp-safety-guard.mjs +44 -0
- package/scripts/notion-read.mjs +556 -0
- package/scripts/pack.mjs +295 -0
- package/scripts/preflight-cache.mjs +69 -0
- package/scripts/preinstall.mjs +96 -0
- package/scripts/remote-spawn.mjs +1376 -0
- package/scripts/run.cjs +79 -0
- package/scripts/session-spawn-helper.mjs +185 -0
- package/scripts/setup.mjs +1178 -0
- package/scripts/test-lock.mjs +71 -0
- package/scripts/test-tfx-route-no-claude-native.mjs +57 -0
- package/scripts/tfx-batch-stats.mjs +96 -0
- package/scripts/tfx-gate-activate.mjs +89 -0
- package/scripts/tfx-route-post.mjs +505 -0
- package/scripts/tfx-route-worker.mjs +223 -0
- package/scripts/tfx-route.sh +2014 -0
- package/scripts/tmp-cleanup.mjs +103 -0
- package/scripts/token-snapshot.mjs +575 -0
- package/skills/tfx-auto/SKILL.md.tmpl +2 -3
- package/skills/tfx-autoresearch/SKILL.md +6 -5
- package/skills/tfx-codex/SKILL.md.tmpl +2 -3
- package/skills/tfx-codex-swarm-workspace/iteration-1/benchmark.json +33 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/eval_metadata.json +42 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/grading.json +11 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/analysis.md +87 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/classification.md +35 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/commands.sh +275 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/routing.md +56 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/timing.json +5 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/grading.json +11 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/analysis.md +92 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/classification.md +71 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/commands.sh +264 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/routing.md +113 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/timing.json +5 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/eval_metadata.json +32 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/grading.json +9 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/analysis.md +96 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/classification.md +38 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/commands.sh +151 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/routing.md +51 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/timing.json +5 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/grading.json +9 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/analysis.md +127 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/classification.md +57 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/commands.sh +129 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/routing.md +84 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/timing.json +5 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/eval_metadata.json +27 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/grading.json +8 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/analysis.md +98 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/classification.md +65 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/commands.sh +123 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/routing.md +66 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/timing.json +5 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/grading.json +8 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/analysis.md +88 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/classification.md +40 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/commands.sh +130 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/routing.md +61 -0
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/timing.json +5 -0
- package/skills/tfx-deep-interview/SKILL.md +1 -2
- package/skills/tfx-plan/SKILL.md.tmpl +2 -3
- package/skills/tfx-psmux-rules/SKILL.md +11 -2
- package/skills/tfx-qa/SKILL.md.tmpl +2 -3
- package/skills/tfx-remote-spawn/SKILL.md +8 -11
- package/skills/tfx-research/SKILL.md.tmpl +2 -3
- package/skills/tfx-review/SKILL.md.tmpl +2 -3
- package/skills/tfx-workspace/async-tests/run-tests.sh +203 -0
- package/skills/tfx-workspace/evals/evals.json +79 -0
- package/skills/tfx-workspace/iteration-1/benchmark.json +162 -0
- package/skills/tfx-workspace/iteration-1/codex-gemini-remap/eval_metadata.json +11 -0
- package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/grading.json +9 -0
- package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/outputs/analysis.md +154 -0
- package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/grading.json +9 -0
- package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/outputs/analysis.md +126 -0
- package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/doctor-diagnosis/eval_metadata.json +11 -0
- package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/grading.json +9 -0
- package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/outputs/analysis.md +119 -0
- package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/grading.json +9 -0
- package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/outputs/analysis.md +115 -0
- package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/hub-start-sequence/eval_metadata.json +10 -0
- package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/grading.json +8 -0
- package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/outputs/analysis.md +86 -0
- package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/grading.json +8 -0
- package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/outputs/analysis.md +81 -0
- package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/multi-team-creation/eval_metadata.json +12 -0
- package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/grading.json +10 -0
- package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/outputs/analysis.md +316 -0
- package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/grading.json +10 -0
- package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/outputs/analysis.md +352 -0
- package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/review.html +1325 -0
- package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/eval_metadata.json +12 -0
- package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/grading.json +10 -0
- package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/outputs/analysis.md +97 -0
- package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/grading.json +10 -0
- package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/outputs/analysis.md +94 -0
- package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/eval_metadata.json +12 -0
- package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/grading.json +10 -0
- package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/outputs/analysis.md +209 -0
- package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/grading.json +10 -0
- package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/outputs/analysis.md +193 -0
- package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-2/benchmark.json +62 -0
- package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/eval_metadata.json +13 -0
- package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/grading.json +11 -0
- package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/outputs/analysis.md +382 -0
- package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/grading.json +11 -0
- package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/outputs/analysis.md +333 -0
- package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/timing.json +5 -0
- package/skills/tfx-workspace/iteration-2/review.html +1325 -0
- package/skills/tfx-workspace/skill-snapshot/tfx-auto/SKILL.md +217 -0
- package/skills/{tfx-auto-codex/SKILL.md.tmpl → tfx-workspace/skill-snapshot/tfx-auto-codex/SKILL.md} +3 -31
- package/skills/tfx-workspace/skill-snapshot/tfx-codex/SKILL.md +65 -0
- package/skills/tfx-workspace/skill-snapshot/tfx-doctor/SKILL.md +94 -0
- package/skills/{tfx-gemini/SKILL.md.tmpl → tfx-workspace/skill-snapshot/tfx-gemini/SKILL.md} +6 -14
- package/skills/tfx-workspace/skill-snapshot/tfx-hub/SKILL.md +133 -0
- package/skills/tfx-workspace/skill-snapshot/tfx-multi/SKILL.md +426 -0
- package/skills/tfx-workspace/skill-snapshot/tfx-setup/SKILL.md +101 -0
- package/skills/merge-worktree/SKILL.md.tmpl +0 -144
- package/skills/shared/arguments-processing.md +0 -2
- package/skills/shared/mandatory-rules.md +0 -6
- package/skills/shared/telemetry-segment.md +0 -6
- package/skills/star-prompt/SKILL.md.tmpl +0 -122
- package/skills/tfx-analysis/SKILL.md.tmpl +0 -106
- package/skills/tfx-analysis/skill.json +0 -11
- package/skills/tfx-auto/skill.json +0 -26
- package/skills/tfx-auto-codex/skill.json +0 -8
- package/skills/tfx-autopilot/SKILL.md.tmpl +0 -115
- package/skills/tfx-autopilot/skill.json +0 -10
- package/skills/tfx-autoresearch/SKILL.md.tmpl +0 -135
- package/skills/tfx-autoresearch/skill.json +0 -14
- package/skills/tfx-autoroute/SKILL.md.tmpl +0 -188
- package/skills/tfx-autoroute/skill.json +0 -12
- package/skills/tfx-codex/skill.json +0 -8
- package/skills/tfx-codex-swarm/SKILL.md.tmpl +0 -16
- package/skills/tfx-codex-swarm/skill.json +0 -5
- package/skills/tfx-consensus/SKILL.md.tmpl +0 -145
- package/skills/tfx-consensus/skill.json +0 -8
- package/skills/tfx-debate/SKILL.md.tmpl +0 -191
- package/skills/tfx-debate/skill.json +0 -12
- package/skills/tfx-deep-analysis/SKILL.md.tmpl +0 -227
- package/skills/tfx-deep-analysis/skill.json +0 -10
- package/skills/tfx-deep-interview/SKILL.md.tmpl +0 -203
- package/skills/tfx-deep-interview/skill.json +0 -12
- package/skills/tfx-deep-plan/SKILL.md.tmpl +0 -281
- package/skills/tfx-deep-plan/skill.json +0 -13
- package/skills/tfx-deep-qa/SKILL.md.tmpl +0 -164
- package/skills/tfx-deep-qa/skill.json +0 -11
- package/skills/tfx-deep-research/SKILL.md.tmpl +0 -216
- package/skills/tfx-deep-research/skill.json +0 -14
- package/skills/tfx-deep-review/SKILL.md.tmpl +0 -178
- package/skills/tfx-deep-review/skill.json +0 -12
- package/skills/tfx-doctor/SKILL.md.tmpl +0 -172
- package/skills/tfx-doctor/skill.json +0 -8
- package/skills/tfx-find/skill.json +0 -12
- package/skills/tfx-forge/SKILL.md.tmpl +0 -187
- package/skills/tfx-forge/skill.json +0 -12
- package/skills/tfx-fullcycle/SKILL.md.tmpl +0 -285
- package/skills/tfx-fullcycle/skill.json +0 -11
- package/skills/tfx-gemini/skill.json +0 -8
- package/skills/tfx-hooks/SKILL.md.tmpl +0 -216
- package/skills/tfx-hooks/skill.json +0 -8
- package/skills/tfx-hub/SKILL.md.tmpl +0 -212
- package/skills/tfx-hub/skill.json +0 -8
- package/skills/tfx-index/skill.json +0 -11
- package/skills/tfx-interview/SKILL.md.tmpl +0 -284
- package/skills/tfx-interview/skill.json +0 -12
- package/skills/tfx-multi/SKILL.md.tmpl +0 -183
- package/skills/tfx-multi/skill.json +0 -8
- package/skills/tfx-panel/SKILL.md.tmpl +0 -188
- package/skills/tfx-panel/skill.json +0 -12
- package/skills/tfx-persist/SKILL.md.tmpl +0 -269
- package/skills/tfx-persist/skill.json +0 -12
- package/skills/tfx-plan/skill.json +0 -11
- package/skills/tfx-profile/SKILL.md.tmpl +0 -239
- package/skills/tfx-profile/skill.json +0 -8
- package/skills/tfx-prune/SKILL.md.tmpl +0 -199
- package/skills/tfx-prune/skill.json +0 -12
- package/skills/tfx-psmux-rules/SKILL.md.tmpl +0 -317
- package/skills/tfx-psmux-rules/skill.json +0 -8
- package/skills/tfx-qa/skill.json +0 -11
- package/skills/tfx-ralph/SKILL.md.tmpl +0 -27
- package/skills/tfx-ralph/skill.json +0 -8
- package/skills/tfx-remote-setup/SKILL.md.tmpl +0 -576
- package/skills/tfx-remote-setup/skill.json +0 -8
- package/skills/tfx-remote-spawn/SKILL.md.tmpl +0 -263
- package/skills/tfx-remote-spawn/skill.json +0 -9
- package/skills/tfx-research/skill.json +0 -13
- package/skills/tfx-review/skill.json +0 -11
- package/skills/tfx-setup/SKILL.md.tmpl +0 -380
- package/skills/tfx-setup/skill.json +0 -8
- package/skills/tfx-swarm/SKILL.md.tmpl +0 -154
- package/skills/tfx-swarm/skill.json +0 -5
package/hub/bridge.mjs
ADDED
|
@@ -0,0 +1,799 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// hub/bridge.mjs — tfx-route.sh ↔ tfx-hub 브릿지 CLI
|
|
3
|
+
//
|
|
4
|
+
// Named Pipe/Unix Socket 제어 채널을 우선 사용하고,
|
|
5
|
+
// 연결이 없을 때만 HTTP /bridge/* 엔드포인트로 내려간다.
|
|
6
|
+
|
|
7
|
+
import net from 'node:net';
|
|
8
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, openSync } from 'node:fs';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import { homedir } from 'node:os';
|
|
11
|
+
import { spawn } from 'node:child_process';
|
|
12
|
+
import { parseArgs as nodeParseArgs } from 'node:util';
|
|
13
|
+
import { randomUUID } from 'node:crypto';
|
|
14
|
+
import { fileURLToPath } from 'node:url';
|
|
15
|
+
|
|
16
|
+
import { getPipelineStateDbPath } from './pipeline/state.mjs';
|
|
17
|
+
|
|
18
|
+
const HUB_PID_FILE = join(homedir(), '.claude', 'cache', 'tfx-hub', 'hub.pid');
|
|
19
|
+
const HUB_TOKEN_FILE = join(homedir(), '.claude', '.tfx-hub-token');
|
|
20
|
+
const PROJECT_ROOT = fileURLToPath(new URL('..', import.meta.url));
|
|
21
|
+
|
|
22
|
+
function normalizeToken(raw) {
|
|
23
|
+
if (raw == null) return null;
|
|
24
|
+
const token = String(raw).trim();
|
|
25
|
+
return token || null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Hub 인증 토큰 읽기 (파일 없으면 null → 하위 호환)
|
|
29
|
+
function readHubToken() {
|
|
30
|
+
const envToken = normalizeToken(process.env.TFX_HUB_TOKEN);
|
|
31
|
+
if (envToken) return envToken;
|
|
32
|
+
try {
|
|
33
|
+
return normalizeToken(readFileSync(HUB_TOKEN_FILE, 'utf8'));
|
|
34
|
+
} catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function getHubUrl() {
|
|
40
|
+
if (process.env.TFX_HUB_URL) return process.env.TFX_HUB_URL.replace(/\/mcp$/, '');
|
|
41
|
+
|
|
42
|
+
if (existsSync(HUB_PID_FILE)) {
|
|
43
|
+
try {
|
|
44
|
+
const info = JSON.parse(readFileSync(HUB_PID_FILE, 'utf8'));
|
|
45
|
+
return `http://${info.host || '127.0.0.1'}:${info.port || 27888}`;
|
|
46
|
+
} catch {
|
|
47
|
+
// 무시
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const port = process.env.TFX_HUB_PORT || '27888';
|
|
52
|
+
return `http://127.0.0.1:${port}`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function getHubPipePath() {
|
|
56
|
+
if (process.env.TFX_HUB_PIPE) return process.env.TFX_HUB_PIPE;
|
|
57
|
+
|
|
58
|
+
if (!existsSync(HUB_PID_FILE)) return null;
|
|
59
|
+
try {
|
|
60
|
+
const info = JSON.parse(readFileSync(HUB_PID_FILE, 'utf8'));
|
|
61
|
+
return info.pipe_path || info.pipePath || null;
|
|
62
|
+
} catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const HUB_OPERATIONS = Object.freeze({
|
|
68
|
+
register: { transport: 'command', action: 'register', httpPath: '/bridge/register' },
|
|
69
|
+
result: { transport: 'command', action: 'result', httpPath: '/bridge/result' },
|
|
70
|
+
control: { transport: 'command', action: 'control', httpPath: '/bridge/control' },
|
|
71
|
+
context: { transport: 'query', action: 'drain', httpPath: '/bridge/context' },
|
|
72
|
+
deregister: { transport: 'command', action: 'deregister', httpPath: '/bridge/deregister' },
|
|
73
|
+
assignAsync: { transport: 'command', action: 'assign', httpPath: '/bridge/assign/async' },
|
|
74
|
+
assignResult: { transport: 'command', action: 'assign_result', httpPath: '/bridge/assign/result' },
|
|
75
|
+
assignStatus: { transport: 'query', action: 'assign_status', httpPath: '/bridge/assign/status' },
|
|
76
|
+
assignRetry: { transport: 'command', action: 'assign_retry', httpPath: '/bridge/assign/retry' },
|
|
77
|
+
teamInfo: { transport: 'query', action: 'team_info', httpPath: '/bridge/team/info' },
|
|
78
|
+
teamTaskList: { transport: 'query', action: 'team_task_list', httpPath: '/bridge/team/task-list' },
|
|
79
|
+
teamTaskUpdate: { transport: 'command', action: 'team_task_update', httpPath: '/bridge/team/task-update' },
|
|
80
|
+
teamSendMessage: { transport: 'command', action: 'team_send_message', httpPath: '/bridge/team/send-message' },
|
|
81
|
+
pipelineState: { transport: 'query', action: 'pipeline_state', httpPath: '/bridge/pipeline/state' },
|
|
82
|
+
pipelineAdvance: { transport: 'command', action: 'pipeline_advance', httpPath: '/bridge/pipeline/advance' },
|
|
83
|
+
pipelineInit: { transport: 'command', action: 'pipeline_init', httpPath: '/bridge/pipeline/init' },
|
|
84
|
+
pipelineList: { transport: 'query', action: 'pipeline_list', httpPath: '/bridge/pipeline/list' },
|
|
85
|
+
hubStatus: { transport: 'query', action: 'status', httpPath: '/status', httpMethod: 'GET' },
|
|
86
|
+
delegatorDelegate: { transport: 'command', action: 'delegator_delegate', httpPath: '/bridge/delegator/delegate' },
|
|
87
|
+
delegatorReply: { transport: 'command', action: 'delegator_reply', httpPath: '/bridge/delegator/reply' },
|
|
88
|
+
delegatorStatus: { transport: 'query', action: 'delegator_status', httpPath: '/bridge/delegator/status' },
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export async function requestJson(path, { method = 'POST', body, timeoutMs = 5000 } = {}) {
|
|
92
|
+
const controller = new AbortController();
|
|
93
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
const headers = {};
|
|
97
|
+
const token = readHubToken();
|
|
98
|
+
if (token) {
|
|
99
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
100
|
+
}
|
|
101
|
+
if (body !== undefined) {
|
|
102
|
+
headers['Content-Type'] = 'application/json';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const res = await fetch(`${getHubUrl()}${path}`, {
|
|
106
|
+
method,
|
|
107
|
+
headers,
|
|
108
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
109
|
+
signal: controller.signal,
|
|
110
|
+
});
|
|
111
|
+
clearTimeout(timer);
|
|
112
|
+
return await res.json();
|
|
113
|
+
} catch {
|
|
114
|
+
clearTimeout(timer);
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export async function post(path, body, timeoutMs = 5000) {
|
|
120
|
+
return await requestJson(path, { method: 'POST', body, timeoutMs });
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export async function connectPipe(timeoutMs = 1200) {
|
|
124
|
+
const pipePath = getHubPipePath();
|
|
125
|
+
if (!pipePath) return null;
|
|
126
|
+
|
|
127
|
+
return await new Promise((resolve) => {
|
|
128
|
+
const socket = net.createConnection(pipePath);
|
|
129
|
+
const timer = setTimeout(() => {
|
|
130
|
+
try { socket.destroy(); } catch {}
|
|
131
|
+
resolve(null);
|
|
132
|
+
}, timeoutMs);
|
|
133
|
+
|
|
134
|
+
socket.once('connect', () => {
|
|
135
|
+
clearTimeout(timer);
|
|
136
|
+
socket.setEncoding('utf8');
|
|
137
|
+
resolve(socket);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
socket.once('error', () => {
|
|
141
|
+
clearTimeout(timer);
|
|
142
|
+
try { socket.destroy(); } catch {}
|
|
143
|
+
resolve(null);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
async function pipeRequest(type, action, payload, timeoutMs = 3000) {
|
|
149
|
+
const socket = await connectPipe(Math.min(timeoutMs, 1500));
|
|
150
|
+
if (!socket) return null;
|
|
151
|
+
|
|
152
|
+
return await new Promise((resolve) => {
|
|
153
|
+
const requestId = randomUUID();
|
|
154
|
+
let buffer = '';
|
|
155
|
+
let settled = false;
|
|
156
|
+
const timer = setTimeout(() => {
|
|
157
|
+
finish(null);
|
|
158
|
+
}, timeoutMs);
|
|
159
|
+
|
|
160
|
+
const finish = (result) => {
|
|
161
|
+
if (settled) return;
|
|
162
|
+
settled = true;
|
|
163
|
+
clearTimeout(timer);
|
|
164
|
+
try { socket.end(); } catch {}
|
|
165
|
+
resolve(result);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
socket.on('data', (chunk) => {
|
|
169
|
+
buffer += chunk;
|
|
170
|
+
let newlineIndex = buffer.indexOf('\n');
|
|
171
|
+
while (newlineIndex >= 0) {
|
|
172
|
+
const line = buffer.slice(0, newlineIndex).trim();
|
|
173
|
+
buffer = buffer.slice(newlineIndex + 1);
|
|
174
|
+
newlineIndex = buffer.indexOf('\n');
|
|
175
|
+
if (!line) continue;
|
|
176
|
+
|
|
177
|
+
let frame;
|
|
178
|
+
try {
|
|
179
|
+
frame = JSON.parse(line);
|
|
180
|
+
} catch {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (frame?.type !== 'response' || frame.request_id !== requestId) continue;
|
|
185
|
+
finish({
|
|
186
|
+
ok: frame.ok,
|
|
187
|
+
error: frame.error,
|
|
188
|
+
data: frame.data,
|
|
189
|
+
});
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
socket.on('error', () => finish(null));
|
|
195
|
+
socket.write(JSON.stringify({
|
|
196
|
+
type,
|
|
197
|
+
request_id: requestId,
|
|
198
|
+
payload: { action, ...payload },
|
|
199
|
+
}) + '\n');
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
async function pipeCommand(action, payload, timeoutMs = 3000) {
|
|
204
|
+
return await pipeRequest('command', action, payload, timeoutMs);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
async function pipeQuery(action, payload, timeoutMs = 3000) {
|
|
208
|
+
return await pipeRequest('query', action, payload, timeoutMs);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export function parseArgs(argv) {
|
|
212
|
+
const { values } = nodeParseArgs({
|
|
213
|
+
args: argv,
|
|
214
|
+
options: {
|
|
215
|
+
agent: { type: 'string' },
|
|
216
|
+
cli: { type: 'string' },
|
|
217
|
+
timeout: { type: 'string' },
|
|
218
|
+
topics: { type: 'string' },
|
|
219
|
+
capabilities: { type: 'string' },
|
|
220
|
+
file: { type: 'string' },
|
|
221
|
+
payload: { type: 'string' },
|
|
222
|
+
topic: { type: 'string' },
|
|
223
|
+
trace: { type: 'string' },
|
|
224
|
+
correlation: { type: 'string' },
|
|
225
|
+
'exit-code': { type: 'string' },
|
|
226
|
+
max: { type: 'string' },
|
|
227
|
+
out: { type: 'string' },
|
|
228
|
+
team: { type: 'string' },
|
|
229
|
+
'task-id': { type: 'string' },
|
|
230
|
+
'job-id': { type: 'string' },
|
|
231
|
+
owner: { type: 'string' },
|
|
232
|
+
status: { type: 'string' },
|
|
233
|
+
statuses: { type: 'string' },
|
|
234
|
+
claim: { type: 'boolean' },
|
|
235
|
+
actor: { type: 'string' },
|
|
236
|
+
command: { type: 'string' },
|
|
237
|
+
reason: { type: 'string' },
|
|
238
|
+
from: { type: 'string' },
|
|
239
|
+
to: { type: 'string' },
|
|
240
|
+
text: { type: 'string' },
|
|
241
|
+
task: { type: 'string' },
|
|
242
|
+
'supervisor-agent': { type: 'string' },
|
|
243
|
+
'worker-agent': { type: 'string' },
|
|
244
|
+
priority: { type: 'string' },
|
|
245
|
+
'ttl-ms': { type: 'string' },
|
|
246
|
+
'timeout-ms': { type: 'string' },
|
|
247
|
+
'max-retries': { type: 'string' },
|
|
248
|
+
attempt: { type: 'string' },
|
|
249
|
+
result: { type: 'string' },
|
|
250
|
+
error: { type: 'string' },
|
|
251
|
+
metadata: { type: 'string' },
|
|
252
|
+
'requested-by': { type: 'string' },
|
|
253
|
+
summary: { type: 'string' },
|
|
254
|
+
color: { type: 'string' },
|
|
255
|
+
limit: { type: 'string' },
|
|
256
|
+
'include-internal': { type: 'boolean' },
|
|
257
|
+
subject: { type: 'string' },
|
|
258
|
+
description: { type: 'string' },
|
|
259
|
+
'fix-max': { type: 'string' },
|
|
260
|
+
'ralph-max': { type: 'string' },
|
|
261
|
+
'active-form': { type: 'string' },
|
|
262
|
+
'add-blocks': { type: 'string' },
|
|
263
|
+
'add-blocked-by': { type: 'string' },
|
|
264
|
+
'metadata-patch': { type: 'string' },
|
|
265
|
+
'if-match-mtime-ms': { type: 'string' },
|
|
266
|
+
provider: { type: 'string' },
|
|
267
|
+
mode: { type: 'string' },
|
|
268
|
+
prompt: { type: 'string' },
|
|
269
|
+
reply: { type: 'string' },
|
|
270
|
+
done: { type: 'boolean' },
|
|
271
|
+
'mcp-profile': { type: 'string' },
|
|
272
|
+
'session-key': { type: 'string' },
|
|
273
|
+
},
|
|
274
|
+
strict: false,
|
|
275
|
+
});
|
|
276
|
+
return values;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export function parseJsonSafe(raw, fallback = null) {
|
|
280
|
+
if (!raw) return fallback;
|
|
281
|
+
try {
|
|
282
|
+
return JSON.parse(raw);
|
|
283
|
+
} catch {
|
|
284
|
+
return fallback;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// Hub 자동 재시작 (Pipe+HTTP 모두 실패 시 1회 시도, 최대 4초 대기)
|
|
289
|
+
async function tryRestartHub() {
|
|
290
|
+
const serverPath = join(PROJECT_ROOT, 'hub', 'server.mjs');
|
|
291
|
+
if (!existsSync(serverPath)) return false;
|
|
292
|
+
|
|
293
|
+
if (existsSync(HUB_PID_FILE)) {
|
|
294
|
+
try {
|
|
295
|
+
const info = JSON.parse(readFileSync(HUB_PID_FILE, 'utf8'));
|
|
296
|
+
if (info.pid) {
|
|
297
|
+
try { process.kill(info.pid, 0); return false; } // still alive
|
|
298
|
+
catch (e) { if (e.code === 'EPERM') return false; } // alive, no permission
|
|
299
|
+
}
|
|
300
|
+
} catch {} // corrupt PID file, proceed with restart
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
try {
|
|
304
|
+
const logDir = join(process.cwd(), '.tfx', 'logs');
|
|
305
|
+
if (!existsSync(logDir)) mkdirSync(logDir, { recursive: true });
|
|
306
|
+
const logFile = join(logDir, 'hub-restart.log');
|
|
307
|
+
const logFd = openSync(logFile, 'a');
|
|
308
|
+
const child = spawn(process.execPath, [serverPath], {
|
|
309
|
+
detached: true,
|
|
310
|
+
stdio: ['ignore', 'ignore', logFd],
|
|
311
|
+
windowsHide: true,
|
|
312
|
+
});
|
|
313
|
+
child.unref();
|
|
314
|
+
} catch {
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
for (let i = 0; i < 8; i++) {
|
|
319
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
320
|
+
try {
|
|
321
|
+
const res = await fetch(`${getHubUrl()}/status`, {
|
|
322
|
+
signal: AbortSignal.timeout(1000),
|
|
323
|
+
});
|
|
324
|
+
if (res.ok) {
|
|
325
|
+
const data = await res.json();
|
|
326
|
+
if (data?.hub?.state === 'healthy') return true;
|
|
327
|
+
}
|
|
328
|
+
} catch {}
|
|
329
|
+
}
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
async function requestHub(operation, body, timeoutMs = 3000, fallback = null) {
|
|
334
|
+
const viaPipe = operation.transport === 'command'
|
|
335
|
+
? await pipeCommand(operation.action, body, timeoutMs)
|
|
336
|
+
: await pipeQuery(operation.action, body, timeoutMs);
|
|
337
|
+
if (viaPipe) {
|
|
338
|
+
return { transport: 'pipe', result: viaPipe };
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const viaHttp = operation.httpPath
|
|
342
|
+
? await requestJson(operation.httpPath, {
|
|
343
|
+
method: operation.httpMethod || 'POST',
|
|
344
|
+
body: operation.httpMethod === 'GET' ? undefined : body,
|
|
345
|
+
timeoutMs: Math.max(timeoutMs, 5000),
|
|
346
|
+
})
|
|
347
|
+
: null;
|
|
348
|
+
if (viaHttp) {
|
|
349
|
+
return { transport: 'http', result: viaHttp };
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Hub 재시작 시도 → Pipe/HTTP 재시도
|
|
353
|
+
if (await tryRestartHub()) {
|
|
354
|
+
const retryPipe = operation.transport === 'command'
|
|
355
|
+
? await pipeCommand(operation.action, body, timeoutMs)
|
|
356
|
+
: await pipeQuery(operation.action, body, timeoutMs);
|
|
357
|
+
if (retryPipe) {
|
|
358
|
+
return { transport: 'pipe', result: retryPipe };
|
|
359
|
+
}
|
|
360
|
+
const retryHttp = operation.httpPath
|
|
361
|
+
? await requestJson(operation.httpPath, {
|
|
362
|
+
method: operation.httpMethod || 'POST',
|
|
363
|
+
body: operation.httpMethod === 'GET' ? undefined : body,
|
|
364
|
+
timeoutMs: Math.max(timeoutMs, 5000),
|
|
365
|
+
})
|
|
366
|
+
: null;
|
|
367
|
+
if (retryHttp) {
|
|
368
|
+
return { transport: 'http', result: retryHttp };
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (!fallback) return null;
|
|
373
|
+
const viaFallback = await fallback();
|
|
374
|
+
if (!viaFallback) return null;
|
|
375
|
+
return { transport: 'fallback', result: viaFallback };
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function unavailableResult() {
|
|
379
|
+
return { ok: false, reason: 'hub_unavailable' };
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function emitJson(payload) {
|
|
383
|
+
if (payload !== undefined) {
|
|
384
|
+
console.log(JSON.stringify(payload));
|
|
385
|
+
}
|
|
386
|
+
return payload?.ok !== false;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
async function cmdRegister(args) {
|
|
390
|
+
const agentId = args.agent;
|
|
391
|
+
const timeoutSec = parseInt(args.timeout || '600', 10);
|
|
392
|
+
const outcome = await requestHub(HUB_OPERATIONS.register, {
|
|
393
|
+
agent_id: agentId,
|
|
394
|
+
cli: args.cli || 'other',
|
|
395
|
+
timeout_sec: timeoutSec,
|
|
396
|
+
heartbeat_ttl_ms: (timeoutSec + 120) * 1000,
|
|
397
|
+
topics: args.topics ? args.topics.split(',') : [],
|
|
398
|
+
capabilities: args.capabilities ? args.capabilities.split(',') : ['code'],
|
|
399
|
+
metadata: {
|
|
400
|
+
pid: process.ppid,
|
|
401
|
+
registered_at: Date.now(),
|
|
402
|
+
},
|
|
403
|
+
});
|
|
404
|
+
const result = outcome?.result;
|
|
405
|
+
|
|
406
|
+
if (result?.ok) {
|
|
407
|
+
return emitJson({
|
|
408
|
+
ok: true,
|
|
409
|
+
agent_id: agentId,
|
|
410
|
+
lease_expires_ms: result.data?.lease_expires_ms,
|
|
411
|
+
pipe_path: result.data?.pipe_path || getHubPipePath(),
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
return emitJson(result || unavailableResult());
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
async function cmdResult(args) {
|
|
419
|
+
let output = '';
|
|
420
|
+
if (args.file && existsSync(args.file)) {
|
|
421
|
+
output = readFileSync(args.file, 'utf8').slice(0, 49152);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const defaultPayload = {
|
|
425
|
+
agent_id: args.agent,
|
|
426
|
+
exit_code: parseInt(args['exit-code'] || '0', 10),
|
|
427
|
+
output_length: output.length,
|
|
428
|
+
output_preview: output.slice(0, 4096),
|
|
429
|
+
output_file: args.file || null,
|
|
430
|
+
completed_at: Date.now(),
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
const outcome = await requestHub(HUB_OPERATIONS.result, {
|
|
434
|
+
agent_id: args.agent,
|
|
435
|
+
topic: args.topic || 'task.result',
|
|
436
|
+
payload: args.payload ? parseJsonSafe(args.payload, defaultPayload) : defaultPayload,
|
|
437
|
+
trace_id: args.trace || undefined,
|
|
438
|
+
correlation_id: args.correlation || undefined,
|
|
439
|
+
});
|
|
440
|
+
const result = outcome?.result;
|
|
441
|
+
|
|
442
|
+
if (result?.ok) {
|
|
443
|
+
return emitJson({ ok: true, message_id: result.data?.message_id });
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
return emitJson(result || unavailableResult());
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
async function cmdControl(args) {
|
|
450
|
+
const outcome = await requestHub(HUB_OPERATIONS.control, {
|
|
451
|
+
from_agent: args.from || 'lead',
|
|
452
|
+
to_agent: args.to,
|
|
453
|
+
command: args.command,
|
|
454
|
+
reason: args.reason || '',
|
|
455
|
+
payload: args.payload ? parseJsonSafe(args.payload, {}) : {},
|
|
456
|
+
trace_id: args.trace || undefined,
|
|
457
|
+
correlation_id: args.correlation || undefined,
|
|
458
|
+
ttl_ms: args['ttl-ms'] != null ? Number(args['ttl-ms']) : undefined,
|
|
459
|
+
});
|
|
460
|
+
const result = outcome?.result;
|
|
461
|
+
return emitJson(result || unavailableResult());
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
async function cmdContext(args) {
|
|
465
|
+
const outcome = await requestHub(HUB_OPERATIONS.context, {
|
|
466
|
+
agent_id: args.agent,
|
|
467
|
+
topics: args.topics ? args.topics.split(',') : undefined,
|
|
468
|
+
max_messages: parseInt(args.max || '10', 10),
|
|
469
|
+
auto_ack: true,
|
|
470
|
+
});
|
|
471
|
+
const result = outcome?.result;
|
|
472
|
+
|
|
473
|
+
if (result?.ok && result.data?.messages?.length) {
|
|
474
|
+
const parts = result.data.messages.map((message, index) => {
|
|
475
|
+
const payload = typeof message.payload === 'string'
|
|
476
|
+
? message.payload
|
|
477
|
+
: JSON.stringify(message.payload, null, 2);
|
|
478
|
+
return `=== Context ${index + 1}: ${message.from_agent || 'unknown'} (${message.topic || 'unknown'}) ===\n${payload}`;
|
|
479
|
+
});
|
|
480
|
+
const combined = parts.join('\n\n');
|
|
481
|
+
|
|
482
|
+
if (args.out) {
|
|
483
|
+
writeFileSync(args.out, combined, 'utf8');
|
|
484
|
+
return emitJson({ ok: true, count: result.data.messages.length, file: args.out });
|
|
485
|
+
} else {
|
|
486
|
+
return emitJson({ ok: true, count: result.data.messages.length, context: combined });
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
if (result?.ok) {
|
|
491
|
+
if (args.out) {
|
|
492
|
+
return emitJson({ ok: true, count: 0 });
|
|
493
|
+
}
|
|
494
|
+
return emitJson({ ok: true, count: 0, context: '' });
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
return emitJson(result || unavailableResult());
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
async function cmdDeregister(args) {
|
|
501
|
+
const outcome = await requestHub(HUB_OPERATIONS.deregister, {
|
|
502
|
+
agent_id: args.agent,
|
|
503
|
+
});
|
|
504
|
+
const result = outcome?.result;
|
|
505
|
+
|
|
506
|
+
if (result?.ok) {
|
|
507
|
+
return emitJson({ ok: true, agent_id: args.agent, status: 'offline' });
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
return emitJson(result || unavailableResult());
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
async function cmdAssignAsync(args) {
|
|
514
|
+
const outcome = await requestHub(HUB_OPERATIONS.assignAsync, {
|
|
515
|
+
supervisor_agent: args['supervisor-agent'],
|
|
516
|
+
worker_agent: args['worker-agent'],
|
|
517
|
+
task: args.task,
|
|
518
|
+
topic: args.topic || 'assign.job',
|
|
519
|
+
payload: args.payload ? parseJsonSafe(args.payload, {}) : {},
|
|
520
|
+
priority: args.priority != null ? Number(args.priority) : undefined,
|
|
521
|
+
ttl_ms: args['ttl-ms'] != null ? Number(args['ttl-ms']) : undefined,
|
|
522
|
+
timeout_ms: args['timeout-ms'] != null ? Number(args['timeout-ms']) : undefined,
|
|
523
|
+
max_retries: args['max-retries'] != null ? Number(args['max-retries']) : undefined,
|
|
524
|
+
trace_id: args.trace || undefined,
|
|
525
|
+
correlation_id: args.correlation || undefined,
|
|
526
|
+
});
|
|
527
|
+
const result = outcome?.result;
|
|
528
|
+
return emitJson(result || unavailableResult());
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
async function cmdAssignResult(args) {
|
|
532
|
+
const outcome = await requestHub(HUB_OPERATIONS.assignResult, {
|
|
533
|
+
job_id: args['job-id'],
|
|
534
|
+
worker_agent: args['worker-agent'],
|
|
535
|
+
status: args.status,
|
|
536
|
+
attempt: args.attempt != null ? Number(args.attempt) : undefined,
|
|
537
|
+
result: args.result ? parseJsonSafe(args.result, null) : undefined,
|
|
538
|
+
error: args.error ? parseJsonSafe(args.error, null) : undefined,
|
|
539
|
+
payload: args.payload ? parseJsonSafe(args.payload, {}) : {},
|
|
540
|
+
metadata: args.metadata ? parseJsonSafe(args.metadata, {}) : {},
|
|
541
|
+
});
|
|
542
|
+
const result = outcome?.result;
|
|
543
|
+
return emitJson(result || unavailableResult());
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
async function cmdAssignStatus(args) {
|
|
547
|
+
const outcome = await requestHub(HUB_OPERATIONS.assignStatus, {
|
|
548
|
+
job_id: args['job-id'],
|
|
549
|
+
});
|
|
550
|
+
const result = outcome?.result;
|
|
551
|
+
return emitJson(result || unavailableResult());
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
async function cmdAssignRetry(args) {
|
|
555
|
+
const outcome = await requestHub(HUB_OPERATIONS.assignRetry, {
|
|
556
|
+
job_id: args['job-id'],
|
|
557
|
+
reason: args.reason,
|
|
558
|
+
requested_by: args['requested-by'],
|
|
559
|
+
});
|
|
560
|
+
const result = outcome?.result;
|
|
561
|
+
return emitJson(result || unavailableResult());
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
async function cmdTeamInfo(args) {
|
|
565
|
+
const body = {
|
|
566
|
+
team_name: args.team,
|
|
567
|
+
include_members: true,
|
|
568
|
+
include_paths: true,
|
|
569
|
+
};
|
|
570
|
+
const outcome = await requestHub(HUB_OPERATIONS.teamInfo, body, 3000, async () => {
|
|
571
|
+
const { teamInfo } = await import('./team/nativeProxy.mjs');
|
|
572
|
+
return await teamInfo(body);
|
|
573
|
+
});
|
|
574
|
+
const result = outcome?.result;
|
|
575
|
+
return emitJson(result || unavailableResult());
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
async function cmdTeamTaskList(args) {
|
|
579
|
+
const body = {
|
|
580
|
+
team_name: args.team,
|
|
581
|
+
owner: args.owner,
|
|
582
|
+
statuses: args.statuses ? args.statuses.split(',').map((status) => status.trim()).filter(Boolean) : [],
|
|
583
|
+
include_internal: !!args['include-internal'],
|
|
584
|
+
limit: parseInt(args.limit || '200', 10),
|
|
585
|
+
};
|
|
586
|
+
const outcome = await requestHub(HUB_OPERATIONS.teamTaskList, body, 3000, async () => {
|
|
587
|
+
const { teamTaskList } = await import('./team/nativeProxy.mjs');
|
|
588
|
+
return await teamTaskList(body);
|
|
589
|
+
});
|
|
590
|
+
const result = outcome?.result;
|
|
591
|
+
return emitJson(result || unavailableResult());
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
async function cmdTeamTaskUpdate(args) {
|
|
595
|
+
const body = {
|
|
596
|
+
team_name: args.team,
|
|
597
|
+
task_id: args['task-id'],
|
|
598
|
+
claim: !!args.claim,
|
|
599
|
+
owner: args.owner,
|
|
600
|
+
status: args.status,
|
|
601
|
+
subject: args.subject,
|
|
602
|
+
description: args.description,
|
|
603
|
+
activeForm: args['active-form'],
|
|
604
|
+
add_blocks: args['add-blocks'] ? args['add-blocks'].split(',').map((value) => value.trim()).filter(Boolean) : undefined,
|
|
605
|
+
add_blocked_by: args['add-blocked-by'] ? args['add-blocked-by'].split(',').map((value) => value.trim()).filter(Boolean) : undefined,
|
|
606
|
+
metadata_patch: args['metadata-patch'] ? parseJsonSafe(args['metadata-patch'], null) : undefined,
|
|
607
|
+
if_match_mtime_ms: args['if-match-mtime-ms'] != null ? Number(args['if-match-mtime-ms']) : undefined,
|
|
608
|
+
actor: args.actor,
|
|
609
|
+
};
|
|
610
|
+
const outcome = await requestHub(HUB_OPERATIONS.teamTaskUpdate, body, 3000, async () => {
|
|
611
|
+
const { teamTaskUpdate } = await import('./team/nativeProxy.mjs');
|
|
612
|
+
return await teamTaskUpdate(body);
|
|
613
|
+
});
|
|
614
|
+
const result = outcome?.result;
|
|
615
|
+
return emitJson(result || unavailableResult());
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
async function cmdTeamSendMessage(args) {
|
|
619
|
+
const body = {
|
|
620
|
+
team_name: args.team,
|
|
621
|
+
from: args.from,
|
|
622
|
+
to: args.to || 'team-lead',
|
|
623
|
+
text: args.text,
|
|
624
|
+
summary: args.summary,
|
|
625
|
+
color: args.color || 'blue',
|
|
626
|
+
};
|
|
627
|
+
const outcome = await requestHub(HUB_OPERATIONS.teamSendMessage, body, 3000, async () => {
|
|
628
|
+
const { teamSendMessage } = await import('./team/nativeProxy.mjs');
|
|
629
|
+
return await teamSendMessage(body);
|
|
630
|
+
});
|
|
631
|
+
const result = outcome?.result;
|
|
632
|
+
return emitJson(result || unavailableResult());
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
function getHubDbPath() {
|
|
636
|
+
return getPipelineStateDbPath(PROJECT_ROOT);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
async function cmdPipelineState(args) {
|
|
640
|
+
const outcome = await requestHub(HUB_OPERATIONS.pipelineState, { team_name: args.team }, 3000, async () => {
|
|
641
|
+
try {
|
|
642
|
+
const { default: Database } = await import('better-sqlite3');
|
|
643
|
+
const { ensurePipelineTable, readPipelineState } = await import('./pipeline/state.mjs');
|
|
644
|
+
const dbPath = getHubDbPath();
|
|
645
|
+
if (!existsSync(dbPath)) {
|
|
646
|
+
return { ok: false, error: 'hub_db_not_found' };
|
|
647
|
+
}
|
|
648
|
+
const db = new Database(dbPath, { readonly: true });
|
|
649
|
+
ensurePipelineTable(db);
|
|
650
|
+
const state = readPipelineState(db, args.team);
|
|
651
|
+
db.close();
|
|
652
|
+
return state
|
|
653
|
+
? { ok: true, data: state }
|
|
654
|
+
: { ok: false, error: 'pipeline_not_found' };
|
|
655
|
+
} catch (e) {
|
|
656
|
+
return { ok: false, error: e.message };
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
const result = outcome?.result;
|
|
660
|
+
return emitJson(result || unavailableResult());
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
async function cmdPipelineAdvance(args) {
|
|
664
|
+
const body = {
|
|
665
|
+
team_name: args.team,
|
|
666
|
+
phase: args.status, // --status를 phase로 재활용
|
|
667
|
+
};
|
|
668
|
+
const outcome = await requestHub(HUB_OPERATIONS.pipelineAdvance, body, 3000, async () => {
|
|
669
|
+
try {
|
|
670
|
+
const { default: Database } = await import('better-sqlite3');
|
|
671
|
+
const { createPipeline } = await import('./pipeline/index.mjs');
|
|
672
|
+
const dbPath = getHubDbPath();
|
|
673
|
+
if (!existsSync(dbPath)) {
|
|
674
|
+
return { ok: false, error: 'hub_db_not_found' };
|
|
675
|
+
}
|
|
676
|
+
const db = new Database(dbPath);
|
|
677
|
+
const pipeline = createPipeline(db, args.team);
|
|
678
|
+
const advanceResult = pipeline.advance(args.status);
|
|
679
|
+
db.close();
|
|
680
|
+
return advanceResult;
|
|
681
|
+
} catch (e) {
|
|
682
|
+
return { ok: false, error: e.message };
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
const result = outcome?.result;
|
|
686
|
+
return emitJson(result || unavailableResult());
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
async function cmdPipelineInit(args) {
|
|
690
|
+
const outcome = await requestHub(HUB_OPERATIONS.pipelineInit, {
|
|
691
|
+
team_name: args.team,
|
|
692
|
+
fix_max: args['fix-max'] != null ? Number(args['fix-max']) : undefined,
|
|
693
|
+
ralph_max: args['ralph-max'] != null ? Number(args['ralph-max']) : undefined,
|
|
694
|
+
});
|
|
695
|
+
const result = outcome?.result;
|
|
696
|
+
return emitJson(result || unavailableResult());
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
async function cmdPipelineList() {
|
|
700
|
+
const outcome = await requestHub(HUB_OPERATIONS.pipelineList, {});
|
|
701
|
+
const result = outcome?.result;
|
|
702
|
+
return emitJson(result || unavailableResult());
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
async function cmdPing() {
|
|
706
|
+
const outcome = await requestHub(HUB_OPERATIONS.hubStatus, { scope: 'hub' }, 2000);
|
|
707
|
+
|
|
708
|
+
if (outcome?.transport === 'pipe' && outcome.result?.ok) {
|
|
709
|
+
return emitJson({
|
|
710
|
+
ok: true,
|
|
711
|
+
hub: outcome.result.data?.hub?.state || 'healthy',
|
|
712
|
+
pipe_path: getHubPipePath(),
|
|
713
|
+
transport: 'pipe',
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
if (outcome?.transport === 'http' && outcome.result) {
|
|
718
|
+
const data = outcome.result;
|
|
719
|
+
return emitJson({
|
|
720
|
+
ok: true,
|
|
721
|
+
hub: data.hub?.state,
|
|
722
|
+
sessions: data.sessions,
|
|
723
|
+
pipe_path: data.pipe?.path || data.pipe_path || null,
|
|
724
|
+
transport: 'http',
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
return emitJson(unavailableResult());
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
async function cmdDelegatorDelegate(args) {
|
|
732
|
+
const body = {
|
|
733
|
+
prompt: args.text || args.prompt,
|
|
734
|
+
provider: args.provider || 'auto',
|
|
735
|
+
mode: args.mode || 'sync',
|
|
736
|
+
agent_type: args.agent || 'executor',
|
|
737
|
+
mcp_profile: args['mcp-profile'] || 'auto',
|
|
738
|
+
session_key: args['session-key'] || undefined,
|
|
739
|
+
timeout_ms: args['timeout-ms'] != null ? Number(args['timeout-ms']) : undefined,
|
|
740
|
+
};
|
|
741
|
+
const timeoutMs = body.mode === 'async' ? 10000 : 120000;
|
|
742
|
+
const outcome = await requestHub(HUB_OPERATIONS.delegatorDelegate, body, timeoutMs);
|
|
743
|
+
return emitJson(outcome?.result || unavailableResult());
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
async function cmdDelegatorReply(args) {
|
|
747
|
+
const body = {
|
|
748
|
+
job_id: args['job-id'],
|
|
749
|
+
reply: args.text || args.reply,
|
|
750
|
+
done: !!args.done,
|
|
751
|
+
};
|
|
752
|
+
const outcome = await requestHub(HUB_OPERATIONS.delegatorReply, body, 120000);
|
|
753
|
+
return emitJson(outcome?.result || unavailableResult());
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
async function cmdDelegatorStatus(args) {
|
|
757
|
+
const body = {
|
|
758
|
+
job_id: args['job-id'],
|
|
759
|
+
};
|
|
760
|
+
const outcome = await requestHub(HUB_OPERATIONS.delegatorStatus, body, 5000);
|
|
761
|
+
return emitJson(outcome?.result || unavailableResult());
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
export async function main(argv = process.argv.slice(2)) {
|
|
765
|
+
const cmd = argv[0];
|
|
766
|
+
const args = parseArgs(argv.slice(1));
|
|
767
|
+
|
|
768
|
+
switch (cmd) {
|
|
769
|
+
case 'register': return await cmdRegister(args);
|
|
770
|
+
case 'result': return await cmdResult(args);
|
|
771
|
+
case 'control': return await cmdControl(args);
|
|
772
|
+
case 'context': return await cmdContext(args);
|
|
773
|
+
case 'deregister': return await cmdDeregister(args);
|
|
774
|
+
case 'assign-async': return await cmdAssignAsync(args);
|
|
775
|
+
case 'assign-result': return await cmdAssignResult(args);
|
|
776
|
+
case 'assign-status': return await cmdAssignStatus(args);
|
|
777
|
+
case 'assign-retry': return await cmdAssignRetry(args);
|
|
778
|
+
case 'team-info': return await cmdTeamInfo(args);
|
|
779
|
+
case 'team-task-list': return await cmdTeamTaskList(args);
|
|
780
|
+
case 'team-task-update': return await cmdTeamTaskUpdate(args);
|
|
781
|
+
case 'team-send-message': return await cmdTeamSendMessage(args);
|
|
782
|
+
case 'pipeline-state': return await cmdPipelineState(args);
|
|
783
|
+
case 'pipeline-advance': return await cmdPipelineAdvance(args);
|
|
784
|
+
case 'pipeline-init': return await cmdPipelineInit(args);
|
|
785
|
+
case 'pipeline-list': return await cmdPipelineList(args);
|
|
786
|
+
case 'ping': return await cmdPing(args);
|
|
787
|
+
case 'delegator-delegate': return await cmdDelegatorDelegate(args);
|
|
788
|
+
case 'delegator-reply': return await cmdDelegatorReply(args);
|
|
789
|
+
case 'delegator-status': return await cmdDelegatorStatus(args);
|
|
790
|
+
default:
|
|
791
|
+
console.error('사용법: bridge.mjs <register|result|control|context|deregister|assign-async|assign-result|assign-status|assign-retry|team-info|team-task-list|team-task-update|team-send-message|pipeline-state|pipeline-advance|pipeline-init|pipeline-list|ping|delegator-delegate|delegator-reply|delegator-status> [--옵션]');
|
|
792
|
+
process.exit(1);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
const selfRun = process.argv[1]?.replace(/\\/g, '/').endsWith('hub/bridge.mjs');
|
|
797
|
+
if (selfRun) {
|
|
798
|
+
process.exitCode = await main() ? 0 : 1;
|
|
799
|
+
}
|