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.
Files changed (426) hide show
  1. package/CLAUDE.md +171 -0
  2. package/README.md +32 -15
  3. package/bin/triflux.mjs +62 -5
  4. package/hooks/agent-route-guard.mjs +109 -0
  5. package/hooks/cross-review-tracker.mjs +122 -0
  6. package/hooks/error-context.mjs +148 -0
  7. package/hooks/hook-adaptive-collector.mjs +86 -0
  8. package/hooks/hook-manager.mjs +365 -0
  9. package/hooks/hook-orchestrator.mjs +312 -0
  10. package/hooks/hook-registry.json +246 -0
  11. package/hooks/hooks.json +89 -0
  12. package/hooks/keyword-rules.json +574 -0
  13. package/hooks/lib/resolve-root.mjs +59 -0
  14. package/hooks/mcp-config-watcher.mjs +80 -0
  15. package/hooks/pipeline-stop.mjs +76 -0
  16. package/hooks/safety-guard.mjs +169 -0
  17. package/hooks/subagent-verifier.mjs +80 -0
  18. package/hub/account-broker.mjs +251 -0
  19. package/hub/adaptive-diagnostic.mjs +323 -0
  20. package/hub/adaptive-inject.mjs +186 -0
  21. package/hub/adaptive-memory.mjs +163 -0
  22. package/hub/adaptive.mjs +143 -0
  23. package/hub/assign-callbacks.mjs +133 -0
  24. package/hub/bridge.mjs +799 -0
  25. package/hub/cli-adapter-base.mjs +280 -0
  26. package/hub/codex-adapter.mjs +199 -0
  27. package/hub/codex-compat.mjs +11 -0
  28. package/hub/codex-preflight.mjs +166 -0
  29. package/hub/delegator/contracts.mjs +37 -0
  30. package/hub/delegator/index.mjs +14 -0
  31. package/hub/delegator/schema/delegator-tools.schema.json +250 -0
  32. package/hub/delegator/service.mjs +307 -0
  33. package/hub/delegator/tool-definitions.mjs +35 -0
  34. package/hub/fullcycle.mjs +96 -0
  35. package/hub/gemini-adapter.mjs +180 -0
  36. package/hub/hitl.mjs +143 -0
  37. package/hub/intent.mjs +193 -0
  38. package/hub/lib/cache-guard.mjs +114 -0
  39. package/hub/lib/known-errors.json +72 -0
  40. package/hub/lib/memory-store.mjs +748 -0
  41. package/hub/lib/process-utils.mjs +361 -0
  42. package/hub/lib/ssh-command.mjs +211 -0
  43. package/hub/lib/ssh-retry.mjs +59 -0
  44. package/hub/lib/uuidv7.mjs +44 -0
  45. package/hub/memory-doctor.mjs +480 -0
  46. package/hub/middleware/request-logger.mjs +161 -0
  47. package/hub/paths.mjs +30 -0
  48. package/hub/pipe.mjs +664 -0
  49. package/hub/pipeline/gates/confidence.mjs +56 -0
  50. package/hub/pipeline/gates/consensus.mjs +94 -0
  51. package/hub/pipeline/gates/index.mjs +5 -0
  52. package/hub/pipeline/gates/selfcheck.mjs +82 -0
  53. package/hub/pipeline/index.mjs +318 -0
  54. package/hub/pipeline/state.mjs +191 -0
  55. package/hub/pipeline/transitions.mjs +124 -0
  56. package/hub/platform.mjs +225 -0
  57. package/hub/public/dashboard.html +355 -0
  58. package/hub/public/tray-icon.ico +0 -0
  59. package/hub/public/tray-icon.png +0 -0
  60. package/hub/quality/deslop.mjs +253 -0
  61. package/hub/reflexion.mjs +372 -0
  62. package/hub/research.mjs +146 -0
  63. package/hub/router.mjs +791 -0
  64. package/hub/routing/complexity.mjs +166 -0
  65. package/hub/routing/index.mjs +117 -0
  66. package/hub/routing/q-learning.mjs +336 -0
  67. package/hub/schema.sql +148 -0
  68. package/hub/server.mjs +1264 -0
  69. package/hub/session-fingerprint.mjs +352 -0
  70. package/hub/state.mjs +258 -0
  71. package/hub/store-adapter.mjs +118 -0
  72. package/hub/store.mjs +857 -0
  73. package/hub/team/agent-map.json +11 -0
  74. package/hub/team/ansi.mjs +379 -0
  75. package/hub/team/backend.mjs +90 -0
  76. package/hub/team/cli/commands/attach.mjs +37 -0
  77. package/hub/team/cli/commands/control.mjs +43 -0
  78. package/hub/team/cli/commands/debug.mjs +74 -0
  79. package/hub/team/cli/commands/focus.mjs +53 -0
  80. package/hub/team/cli/commands/interrupt.mjs +36 -0
  81. package/hub/team/cli/commands/kill.mjs +37 -0
  82. package/hub/team/cli/commands/list.mjs +24 -0
  83. package/hub/team/cli/commands/send.mjs +37 -0
  84. package/hub/team/cli/commands/start/index.mjs +106 -0
  85. package/hub/team/cli/commands/start/parse-args.mjs +130 -0
  86. package/hub/team/cli/commands/start/start-headless.mjs +109 -0
  87. package/hub/team/cli/commands/start/start-in-process.mjs +40 -0
  88. package/hub/team/cli/commands/start/start-mux.mjs +73 -0
  89. package/hub/team/cli/commands/start/start-wt.mjs +69 -0
  90. package/hub/team/cli/commands/status.mjs +87 -0
  91. package/hub/team/cli/commands/stop.mjs +31 -0
  92. package/hub/team/cli/commands/task.mjs +30 -0
  93. package/hub/team/cli/commands/tasks.mjs +13 -0
  94. package/hub/team/cli/help.mjs +42 -0
  95. package/hub/team/cli/index.mjs +41 -0
  96. package/hub/team/cli/manifest.mjs +29 -0
  97. package/hub/team/cli/render.mjs +30 -0
  98. package/hub/team/cli/services/attach-fallback.mjs +54 -0
  99. package/hub/team/cli/services/hub-client.mjs +227 -0
  100. package/hub/team/cli/services/member-selector.mjs +30 -0
  101. package/hub/team/cli/services/native-control.mjs +117 -0
  102. package/hub/team/cli/services/runtime-mode.mjs +62 -0
  103. package/hub/team/cli/services/state-store.mjs +48 -0
  104. package/hub/team/cli/services/task-model.mjs +30 -0
  105. package/hub/team/conductor-mesh-bridge.mjs +121 -0
  106. package/hub/team/conductor.mjs +671 -0
  107. package/hub/team/dashboard-anchor.mjs +14 -0
  108. package/hub/team/dashboard-layout.mjs +33 -0
  109. package/hub/team/dashboard-open.mjs +153 -0
  110. package/hub/team/dashboard.mjs +274 -0
  111. package/hub/team/event-log.mjs +76 -0
  112. package/hub/team/handoff.mjs +303 -0
  113. package/hub/team/headless.mjs +1156 -0
  114. package/hub/team/health-probe.mjs +272 -0
  115. package/hub/team/launcher-template.mjs +95 -0
  116. package/hub/team/lead-control.mjs +104 -0
  117. package/hub/team/native-supervisor.mjs +392 -0
  118. package/hub/team/native.mjs +649 -0
  119. package/hub/team/nativeProxy.mjs +688 -0
  120. package/hub/team/notify.mjs +293 -0
  121. package/hub/team/orchestrator.mjs +161 -0
  122. package/hub/team/pane.mjs +153 -0
  123. package/hub/team/process-cleanup.mjs +342 -0
  124. package/hub/team/psmux.mjs +1354 -0
  125. package/hub/team/remote-probe.mjs +276 -0
  126. package/hub/team/remote-session.mjs +299 -0
  127. package/hub/team/remote-watcher.mjs +478 -0
  128. package/hub/team/routing.mjs +223 -0
  129. package/hub/team/session-sync.mjs +169 -0
  130. package/hub/team/session.mjs +611 -0
  131. package/hub/team/shared.mjs +13 -0
  132. package/hub/team/staleState.mjs +361 -0
  133. package/hub/team/swarm-hypervisor.mjs +589 -0
  134. package/hub/team/swarm-locks.mjs +204 -0
  135. package/hub/team/swarm-planner.mjs +260 -0
  136. package/hub/team/swarm-reconciler.mjs +137 -0
  137. package/hub/team/tui-lite.mjs +380 -0
  138. package/hub/team/tui-remote-adapter.mjs +393 -0
  139. package/hub/team/tui-viewer.mjs +463 -0
  140. package/hub/team/tui.mjs +1449 -0
  141. package/hub/team/worktree-lifecycle.mjs +193 -0
  142. package/hub/team/wt-manager.mjs +407 -0
  143. package/hub/team/wt-templates.json +43 -0
  144. package/hub/team-bridge.mjs +27 -0
  145. package/hub/token-mode.mjs +224 -0
  146. package/hub/tools.mjs +636 -0
  147. package/hub/tray.mjs +376 -0
  148. package/hub/workers/claude-worker.mjs +475 -0
  149. package/hub/workers/codex-mcp.mjs +507 -0
  150. package/hub/workers/delegator-mcp.mjs +1076 -0
  151. package/hub/workers/factory.mjs +21 -0
  152. package/hub/workers/gemini-worker.mjs +374 -0
  153. package/hub/workers/interface.mjs +52 -0
  154. package/hub/workers/worker-utils.mjs +104 -0
  155. package/hud/colors.mjs +88 -0
  156. package/hud/constants.mjs +88 -0
  157. package/hud/context-monitor.mjs +403 -0
  158. package/hud/hud-qos-status.mjs +210 -0
  159. package/hud/providers/claude.mjs +314 -0
  160. package/hud/providers/codex.mjs +151 -0
  161. package/hud/providers/gemini.mjs +320 -0
  162. package/hud/renderers.mjs +442 -0
  163. package/hud/terminal.mjs +140 -0
  164. package/hud/utils.mjs +313 -0
  165. package/mesh/index.mjs +63 -0
  166. package/mesh/mesh-budget.mjs +128 -0
  167. package/mesh/mesh-heartbeat.mjs +100 -0
  168. package/mesh/mesh-protocol.mjs +96 -0
  169. package/mesh/mesh-queue.mjs +165 -0
  170. package/mesh/mesh-registry.mjs +78 -0
  171. package/mesh/mesh-router.mjs +76 -0
  172. package/package.json +8 -1
  173. package/references/hosts.json +33 -0
  174. package/scripts/__tests__/gen-skill-docs.test.mjs +87 -0
  175. package/scripts/__tests__/keyword-detector.test.mjs +234 -0
  176. package/scripts/__tests__/mcp-guard-engine.test.mjs +118 -0
  177. package/scripts/__tests__/remote-spawn-transfer.test.mjs +117 -0
  178. package/scripts/__tests__/remote-spawn.test.mjs +92 -0
  179. package/scripts/__tests__/skill-template.test.mjs +193 -0
  180. package/scripts/__tests__/smoke.test.mjs +34 -0
  181. package/scripts/cache-buildup.mjs +30 -0
  182. package/scripts/cache-doctor.mjs +149 -0
  183. package/scripts/cache-warmup.mjs +557 -0
  184. package/scripts/claudemd-sync.mjs +148 -0
  185. package/scripts/cli-route.sh +3 -0
  186. package/scripts/completions/tfx.bash +47 -0
  187. package/scripts/completions/tfx.fish +44 -0
  188. package/scripts/completions/tfx.zsh +83 -0
  189. package/scripts/cross-review-gate.mjs +126 -0
  190. package/scripts/cross-review-tracker.mjs +238 -0
  191. package/scripts/gen-skill-docs.mjs +111 -0
  192. package/scripts/headless-guard-fast.sh +21 -0
  193. package/scripts/headless-guard.mjs +360 -0
  194. package/scripts/hub-ensure.mjs +120 -0
  195. package/scripts/keyword-detector.mjs +272 -0
  196. package/scripts/keyword-rules-expander.mjs +521 -0
  197. package/scripts/lib/claudemd-scanner.mjs +218 -0
  198. package/scripts/lib/context.mjs +67 -0
  199. package/scripts/lib/cross-review-utils.mjs +51 -0
  200. package/scripts/lib/env-probe.mjs +241 -0
  201. package/scripts/lib/gemini-profiles.mjs +85 -0
  202. package/scripts/lib/handoff.mjs +171 -0
  203. package/scripts/lib/hook-utils.mjs +14 -0
  204. package/scripts/lib/keyword-rules.mjs +166 -0
  205. package/scripts/lib/logger.mjs +105 -0
  206. package/scripts/lib/mcp-filter.mjs +739 -0
  207. package/scripts/lib/mcp-guard-engine.mjs +954 -0
  208. package/scripts/lib/mcp-manifest.mjs +79 -0
  209. package/scripts/lib/mcp-server-catalog.mjs +118 -0
  210. package/scripts/lib/psmux-info.mjs +119 -0
  211. package/scripts/lib/remote-spawn-transfer.mjs +196 -0
  212. package/scripts/lib/skill-template.mjs +326 -0
  213. package/scripts/mcp-check.mjs +237 -0
  214. package/scripts/mcp-cleanup.ps1 +17 -0
  215. package/scripts/mcp-gateway-config.mjs +207 -0
  216. package/scripts/mcp-gateway-ensure.mjs +85 -0
  217. package/scripts/mcp-gateway-integration-test.mjs +228 -0
  218. package/scripts/mcp-gateway-start.mjs +226 -0
  219. package/scripts/mcp-gateway-start.ps1 +141 -0
  220. package/scripts/mcp-gateway-verify.mjs +77 -0
  221. package/scripts/mcp-safety-guard.mjs +44 -0
  222. package/scripts/notion-read.mjs +556 -0
  223. package/scripts/pack.mjs +295 -0
  224. package/scripts/preflight-cache.mjs +69 -0
  225. package/scripts/preinstall.mjs +96 -0
  226. package/scripts/remote-spawn.mjs +1376 -0
  227. package/scripts/run.cjs +79 -0
  228. package/scripts/session-spawn-helper.mjs +185 -0
  229. package/scripts/setup.mjs +1178 -0
  230. package/scripts/test-lock.mjs +71 -0
  231. package/scripts/test-tfx-route-no-claude-native.mjs +57 -0
  232. package/scripts/tfx-batch-stats.mjs +96 -0
  233. package/scripts/tfx-gate-activate.mjs +89 -0
  234. package/scripts/tfx-route-post.mjs +505 -0
  235. package/scripts/tfx-route-worker.mjs +223 -0
  236. package/scripts/tfx-route.sh +2014 -0
  237. package/scripts/tmp-cleanup.mjs +103 -0
  238. package/scripts/token-snapshot.mjs +575 -0
  239. package/skills/tfx-auto/SKILL.md.tmpl +2 -3
  240. package/skills/tfx-autoresearch/SKILL.md +6 -5
  241. package/skills/tfx-codex/SKILL.md.tmpl +2 -3
  242. package/skills/tfx-codex-swarm-workspace/iteration-1/benchmark.json +33 -0
  243. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/eval_metadata.json +42 -0
  244. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/grading.json +11 -0
  245. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/analysis.md +87 -0
  246. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/classification.md +35 -0
  247. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/commands.sh +275 -0
  248. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/routing.md +56 -0
  249. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/timing.json +5 -0
  250. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/grading.json +11 -0
  251. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/analysis.md +92 -0
  252. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/classification.md +71 -0
  253. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/commands.sh +264 -0
  254. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/routing.md +113 -0
  255. package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/timing.json +5 -0
  256. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/eval_metadata.json +32 -0
  257. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/grading.json +9 -0
  258. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/analysis.md +96 -0
  259. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/classification.md +38 -0
  260. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/commands.sh +151 -0
  261. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/routing.md +51 -0
  262. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/timing.json +5 -0
  263. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/grading.json +9 -0
  264. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/analysis.md +127 -0
  265. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/classification.md +57 -0
  266. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/commands.sh +129 -0
  267. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/routing.md +84 -0
  268. package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/timing.json +5 -0
  269. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/eval_metadata.json +27 -0
  270. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/grading.json +8 -0
  271. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/analysis.md +98 -0
  272. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/classification.md +65 -0
  273. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/commands.sh +123 -0
  274. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/routing.md +66 -0
  275. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/timing.json +5 -0
  276. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/grading.json +8 -0
  277. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/analysis.md +88 -0
  278. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/classification.md +40 -0
  279. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/commands.sh +130 -0
  280. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/routing.md +61 -0
  281. package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/timing.json +5 -0
  282. package/skills/tfx-deep-interview/SKILL.md +1 -2
  283. package/skills/tfx-plan/SKILL.md.tmpl +2 -3
  284. package/skills/tfx-psmux-rules/SKILL.md +11 -2
  285. package/skills/tfx-qa/SKILL.md.tmpl +2 -3
  286. package/skills/tfx-remote-spawn/SKILL.md +8 -11
  287. package/skills/tfx-research/SKILL.md.tmpl +2 -3
  288. package/skills/tfx-review/SKILL.md.tmpl +2 -3
  289. package/skills/tfx-workspace/async-tests/run-tests.sh +203 -0
  290. package/skills/tfx-workspace/evals/evals.json +79 -0
  291. package/skills/tfx-workspace/iteration-1/benchmark.json +162 -0
  292. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/eval_metadata.json +11 -0
  293. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/grading.json +9 -0
  294. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/outputs/analysis.md +154 -0
  295. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/old_skill/timing.json +5 -0
  296. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/grading.json +9 -0
  297. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/outputs/analysis.md +126 -0
  298. package/skills/tfx-workspace/iteration-1/codex-gemini-remap/with_skill/timing.json +5 -0
  299. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/eval_metadata.json +11 -0
  300. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/grading.json +9 -0
  301. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/outputs/analysis.md +119 -0
  302. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/old_skill/timing.json +5 -0
  303. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/grading.json +9 -0
  304. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/outputs/analysis.md +115 -0
  305. package/skills/tfx-workspace/iteration-1/doctor-diagnosis/with_skill/timing.json +5 -0
  306. package/skills/tfx-workspace/iteration-1/hub-start-sequence/eval_metadata.json +10 -0
  307. package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/grading.json +8 -0
  308. package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/outputs/analysis.md +86 -0
  309. package/skills/tfx-workspace/iteration-1/hub-start-sequence/old_skill/timing.json +5 -0
  310. package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/grading.json +8 -0
  311. package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/outputs/analysis.md +81 -0
  312. package/skills/tfx-workspace/iteration-1/hub-start-sequence/with_skill/timing.json +5 -0
  313. package/skills/tfx-workspace/iteration-1/multi-team-creation/eval_metadata.json +12 -0
  314. package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/grading.json +10 -0
  315. package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/outputs/analysis.md +316 -0
  316. package/skills/tfx-workspace/iteration-1/multi-team-creation/old_skill/timing.json +5 -0
  317. package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/grading.json +10 -0
  318. package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/outputs/analysis.md +352 -0
  319. package/skills/tfx-workspace/iteration-1/multi-team-creation/with_skill/timing.json +5 -0
  320. package/skills/tfx-workspace/iteration-1/review.html +1325 -0
  321. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/eval_metadata.json +12 -0
  322. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/grading.json +10 -0
  323. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/outputs/analysis.md +97 -0
  324. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/old_skill/timing.json +5 -0
  325. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/grading.json +10 -0
  326. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/outputs/analysis.md +94 -0
  327. package/skills/tfx-workspace/iteration-1/routing-implement-shortcut/with_skill/timing.json +5 -0
  328. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/eval_metadata.json +12 -0
  329. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/grading.json +10 -0
  330. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/outputs/analysis.md +209 -0
  331. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/old_skill/timing.json +5 -0
  332. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/grading.json +10 -0
  333. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/outputs/analysis.md +193 -0
  334. package/skills/tfx-workspace/iteration-1/routing-multi-task-triage/with_skill/timing.json +5 -0
  335. package/skills/tfx-workspace/iteration-2/benchmark.json +62 -0
  336. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/eval_metadata.json +13 -0
  337. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/grading.json +11 -0
  338. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/outputs/analysis.md +382 -0
  339. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/old_skill/timing.json +5 -0
  340. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/grading.json +11 -0
  341. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/outputs/analysis.md +333 -0
  342. package/skills/tfx-workspace/iteration-2/multi-team-creation-refactored/with_skill/timing.json +5 -0
  343. package/skills/tfx-workspace/iteration-2/review.html +1325 -0
  344. package/skills/tfx-workspace/skill-snapshot/tfx-auto/SKILL.md +217 -0
  345. package/skills/{tfx-auto-codex/SKILL.md.tmpl → tfx-workspace/skill-snapshot/tfx-auto-codex/SKILL.md} +3 -31
  346. package/skills/tfx-workspace/skill-snapshot/tfx-codex/SKILL.md +65 -0
  347. package/skills/tfx-workspace/skill-snapshot/tfx-doctor/SKILL.md +94 -0
  348. package/skills/{tfx-gemini/SKILL.md.tmpl → tfx-workspace/skill-snapshot/tfx-gemini/SKILL.md} +6 -14
  349. package/skills/tfx-workspace/skill-snapshot/tfx-hub/SKILL.md +133 -0
  350. package/skills/tfx-workspace/skill-snapshot/tfx-multi/SKILL.md +426 -0
  351. package/skills/tfx-workspace/skill-snapshot/tfx-setup/SKILL.md +101 -0
  352. package/skills/merge-worktree/SKILL.md.tmpl +0 -144
  353. package/skills/shared/arguments-processing.md +0 -2
  354. package/skills/shared/mandatory-rules.md +0 -6
  355. package/skills/shared/telemetry-segment.md +0 -6
  356. package/skills/star-prompt/SKILL.md.tmpl +0 -122
  357. package/skills/tfx-analysis/SKILL.md.tmpl +0 -106
  358. package/skills/tfx-analysis/skill.json +0 -11
  359. package/skills/tfx-auto/skill.json +0 -26
  360. package/skills/tfx-auto-codex/skill.json +0 -8
  361. package/skills/tfx-autopilot/SKILL.md.tmpl +0 -115
  362. package/skills/tfx-autopilot/skill.json +0 -10
  363. package/skills/tfx-autoresearch/SKILL.md.tmpl +0 -135
  364. package/skills/tfx-autoresearch/skill.json +0 -14
  365. package/skills/tfx-autoroute/SKILL.md.tmpl +0 -188
  366. package/skills/tfx-autoroute/skill.json +0 -12
  367. package/skills/tfx-codex/skill.json +0 -8
  368. package/skills/tfx-codex-swarm/SKILL.md.tmpl +0 -16
  369. package/skills/tfx-codex-swarm/skill.json +0 -5
  370. package/skills/tfx-consensus/SKILL.md.tmpl +0 -145
  371. package/skills/tfx-consensus/skill.json +0 -8
  372. package/skills/tfx-debate/SKILL.md.tmpl +0 -191
  373. package/skills/tfx-debate/skill.json +0 -12
  374. package/skills/tfx-deep-analysis/SKILL.md.tmpl +0 -227
  375. package/skills/tfx-deep-analysis/skill.json +0 -10
  376. package/skills/tfx-deep-interview/SKILL.md.tmpl +0 -203
  377. package/skills/tfx-deep-interview/skill.json +0 -12
  378. package/skills/tfx-deep-plan/SKILL.md.tmpl +0 -281
  379. package/skills/tfx-deep-plan/skill.json +0 -13
  380. package/skills/tfx-deep-qa/SKILL.md.tmpl +0 -164
  381. package/skills/tfx-deep-qa/skill.json +0 -11
  382. package/skills/tfx-deep-research/SKILL.md.tmpl +0 -216
  383. package/skills/tfx-deep-research/skill.json +0 -14
  384. package/skills/tfx-deep-review/SKILL.md.tmpl +0 -178
  385. package/skills/tfx-deep-review/skill.json +0 -12
  386. package/skills/tfx-doctor/SKILL.md.tmpl +0 -172
  387. package/skills/tfx-doctor/skill.json +0 -8
  388. package/skills/tfx-find/skill.json +0 -12
  389. package/skills/tfx-forge/SKILL.md.tmpl +0 -187
  390. package/skills/tfx-forge/skill.json +0 -12
  391. package/skills/tfx-fullcycle/SKILL.md.tmpl +0 -285
  392. package/skills/tfx-fullcycle/skill.json +0 -11
  393. package/skills/tfx-gemini/skill.json +0 -8
  394. package/skills/tfx-hooks/SKILL.md.tmpl +0 -216
  395. package/skills/tfx-hooks/skill.json +0 -8
  396. package/skills/tfx-hub/SKILL.md.tmpl +0 -212
  397. package/skills/tfx-hub/skill.json +0 -8
  398. package/skills/tfx-index/skill.json +0 -11
  399. package/skills/tfx-interview/SKILL.md.tmpl +0 -284
  400. package/skills/tfx-interview/skill.json +0 -12
  401. package/skills/tfx-multi/SKILL.md.tmpl +0 -183
  402. package/skills/tfx-multi/skill.json +0 -8
  403. package/skills/tfx-panel/SKILL.md.tmpl +0 -188
  404. package/skills/tfx-panel/skill.json +0 -12
  405. package/skills/tfx-persist/SKILL.md.tmpl +0 -269
  406. package/skills/tfx-persist/skill.json +0 -12
  407. package/skills/tfx-plan/skill.json +0 -11
  408. package/skills/tfx-profile/SKILL.md.tmpl +0 -239
  409. package/skills/tfx-profile/skill.json +0 -8
  410. package/skills/tfx-prune/SKILL.md.tmpl +0 -199
  411. package/skills/tfx-prune/skill.json +0 -12
  412. package/skills/tfx-psmux-rules/SKILL.md.tmpl +0 -317
  413. package/skills/tfx-psmux-rules/skill.json +0 -8
  414. package/skills/tfx-qa/skill.json +0 -11
  415. package/skills/tfx-ralph/SKILL.md.tmpl +0 -27
  416. package/skills/tfx-ralph/skill.json +0 -8
  417. package/skills/tfx-remote-setup/SKILL.md.tmpl +0 -576
  418. package/skills/tfx-remote-setup/skill.json +0 -8
  419. package/skills/tfx-remote-spawn/SKILL.md.tmpl +0 -263
  420. package/skills/tfx-remote-spawn/skill.json +0 -9
  421. package/skills/tfx-research/skill.json +0 -13
  422. package/skills/tfx-review/skill.json +0 -11
  423. package/skills/tfx-setup/SKILL.md.tmpl +0 -380
  424. package/skills/tfx-setup/skill.json +0 -8
  425. package/skills/tfx-swarm/SKILL.md.tmpl +0 -154
  426. package/skills/tfx-swarm/skill.json +0 -5
@@ -0,0 +1,69 @@
1
+ import { createWtSession } from "../../../session.mjs";
2
+ import { buildCliCommand } from "../../../pane.mjs";
3
+ import { toAgentId } from "../../services/member-selector.mjs";
4
+ import { buildTasks } from "../../services/task-model.mjs";
5
+ import { warn } from "../../render.mjs";
6
+
7
+ export async function startWtTeam({ sessionId, task, lead, agents, subtasks, layout, hubUrl }) {
8
+ const paneCount = agents.length + 1;
9
+ const effectiveLayout = layout === "Nx1" ? "Nx1" : "1xN";
10
+ if (layout !== effectiveLayout) warn(`wt 모드에서 ${layout} 레이아웃은 미지원 — ${effectiveLayout}로 대체`);
11
+ console.log(` 레이아웃: ${effectiveLayout} (${paneCount} panes)`);
12
+
13
+ const session = createWtSession(sessionId, {
14
+ layout: effectiveLayout,
15
+ paneCommands: [
16
+ { title: `${sessionId}-lead`, command: buildCliCommand(lead) },
17
+ ...agents.map((cli, index) => ({
18
+ title: `${sessionId}-${cli}-${index + 1}`,
19
+ command: buildCliCommand(cli),
20
+ })),
21
+ ],
22
+ });
23
+
24
+ const members = [
25
+ {
26
+ role: "lead",
27
+ name: "lead",
28
+ cli: lead,
29
+ pane: session.panes[0] || "wt:0",
30
+ agentId: toAgentId(lead, session.panes[0] || "wt:0"),
31
+ },
32
+ ...agents.map((cli, index) => {
33
+ const pane = session.panes[index + 1] || `wt:${index + 1}`;
34
+ return {
35
+ role: "worker",
36
+ name: `${cli}-${index + 1}`,
37
+ cli,
38
+ pane,
39
+ subtask: subtasks[index],
40
+ agentId: toAgentId(cli, pane),
41
+ };
42
+ }),
43
+ ];
44
+
45
+ return {
46
+ sessionName: sessionId,
47
+ task,
48
+ lead,
49
+ agents,
50
+ layout: effectiveLayout,
51
+ teammateMode: "wt",
52
+ startedAt: Date.now(),
53
+ hubUrl,
54
+ members,
55
+ panes: Object.fromEntries(members.map((member) => [member.pane, {
56
+ role: member.role,
57
+ name: member.name,
58
+ cli: member.cli,
59
+ agentId: member.agentId,
60
+ subtask: member.subtask || null,
61
+ }])),
62
+ tasks: buildTasks(subtasks, members.filter((member) => member.role === "worker")),
63
+ wt: {
64
+ windowId: 0,
65
+ layout: effectiveLayout,
66
+ paneCount: session.paneCount,
67
+ },
68
+ };
69
+ }
@@ -0,0 +1,87 @@
1
+ import { AMBER, BOLD, DIM, GRAY, GREEN, RED, RESET } from "../../shared.mjs";
2
+ import { hasWindowsTerminalSession } from "../../session.mjs";
3
+ import { fetchHubTaskList, nativeGetStatus } from "../services/hub-client.mjs";
4
+ import { isNativeMode, isTeamAlive, isWtMode } from "../services/runtime-mode.mjs";
5
+ import { loadTeamState } from "../services/state-store.mjs";
6
+ import { formatCompletionSuffix } from "../render.mjs";
7
+
8
+ export async function teamStatus(args = []) {
9
+ const json = process.env.TFX_OUTPUT_JSON === "1" || args.includes("--json");
10
+ const state = loadTeamState();
11
+ if (!state) {
12
+ if (json) {
13
+ process.stdout.write(`${JSON.stringify({ status: "offline", sessionName: null, alive: false }, null, 2)}\n`);
14
+ return;
15
+ }
16
+ console.log(`\n ${DIM}활성 팀 세션 없음${RESET}\n`);
17
+ return;
18
+ }
19
+
20
+ const alive = isTeamAlive(state);
21
+ const payload = {
22
+ status: alive ? "active" : "dead",
23
+ alive,
24
+ sessionName: state.sessionName,
25
+ teammateMode: state.teammateMode || "tmux",
26
+ lead: state.lead || "claude",
27
+ agents: state.agents || [],
28
+ startedAt: state.startedAt || null,
29
+ taskCount: (state.tasks || []).length,
30
+ members: (state.members || []).map((member) => ({
31
+ name: member.name,
32
+ cli: member.cli,
33
+ role: member.role,
34
+ pane: member.pane,
35
+ })),
36
+ };
37
+
38
+ if (isNativeMode(state) && alive) {
39
+ payload.nativeMembers = (await nativeGetStatus(state))?.data?.members || [];
40
+ }
41
+
42
+ if (alive) {
43
+ payload.hubTasks = await fetchHubTaskList(state);
44
+ }
45
+
46
+ if (json) {
47
+ process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
48
+ return;
49
+ }
50
+
51
+ console.log(`\n ${AMBER}${BOLD}⬡ tfx multi${RESET} ${alive ? `${GREEN}● active${RESET}` : `${RED}● dead${RESET}`}\n`);
52
+ console.log(` 세션: ${state.sessionName}`);
53
+ console.log(` 모드: ${state.teammateMode || "tmux"}`);
54
+ console.log(` 리드: ${state.lead || "claude"}`);
55
+ console.log(` 워커: ${(state.agents || []).join(", ")}`);
56
+ console.log(` Uptime: ${alive ? `${Math.round((Date.now() - state.startedAt) / 60000)}분` : "-"}`);
57
+ console.log(` 태스크: ${(state.tasks || []).length}`);
58
+ if (isWtMode(state) && !hasWindowsTerminalSession()) {
59
+ console.log(` ${DIM}WT_SESSION 미감지: 생존성은 heuristics로 판정됨${RESET}`);
60
+ }
61
+
62
+ for (const member of state.members || []) {
63
+ console.log(` - ${member.name} (${member.cli}) ${DIM}${member.role}${RESET} ${DIM}${member.pane}${RESET}`);
64
+ }
65
+
66
+ if (isNativeMode(state) && alive) {
67
+ for (const member of payload.nativeMembers) {
68
+ console.log(` • ${member.name}: ${member.status}${formatCompletionSuffix(member)}${member.lastPreview ? ` ${DIM}${member.lastPreview}${RESET}` : ""}`);
69
+ }
70
+ }
71
+
72
+ if (alive) {
73
+ const hubTasks = payload.hubTasks || await fetchHubTaskList(state);
74
+ if (hubTasks.length) {
75
+ const completed = hubTasks.filter((task) => task.status === "completed").length;
76
+ const failed = hubTasks.filter((task) => task.status === "failed").length;
77
+ console.log(`\n ${BOLD}Hub Tasks${RESET} ${DIM}(${completed}/${hubTasks.length} done)${RESET}`);
78
+ for (const task of hubTasks) {
79
+ const icon = task.status === "completed" ? `${GREEN}✓${RESET}` : task.status === "in_progress" ? `${AMBER}●${RESET}` : task.status === "failed" ? `${RED}✗${RESET}` : `${GRAY}○${RESET}`;
80
+ const owner = task.owner ? ` ${GRAY}[${task.owner}]${RESET}` : "";
81
+ console.log(` ${icon} ${task.subject || task.description?.slice(0, 50) || ""}${owner}`);
82
+ }
83
+ if (failed > 0) console.log(` ${RED}⚠ ${failed}건 실패${RESET}`);
84
+ }
85
+ }
86
+ console.log("");
87
+ }
@@ -0,0 +1,31 @@
1
+ import { closeWtSession, killSession, sessionExists } from "../../session.mjs";
2
+ import { DIM, RESET } from "../../shared.mjs";
3
+ import { nativeRequest } from "../services/native-control.mjs";
4
+ import { isNativeMode, isWtMode } from "../services/runtime-mode.mjs";
5
+ import { clearTeamState, loadTeamState } from "../services/state-store.mjs";
6
+ import { ok } from "../render.mjs";
7
+
8
+ export async function teamStop() {
9
+ const state = loadTeamState();
10
+ if (!state) {
11
+ console.log(`\n ${DIM}활성 팀 세션 없음${RESET}\n`);
12
+ return;
13
+ }
14
+
15
+ if (isNativeMode(state)) {
16
+ await nativeRequest(state, "/stop", {});
17
+ try { process.kill(state.native.supervisorPid, "SIGTERM"); } catch {}
18
+ ok(`세션 종료: ${state.sessionName}`);
19
+ } else if (isWtMode(state)) {
20
+ const closed = closeWtSession({ layout: state?.wt?.layout || state?.layout || "1xN", paneCount: state?.wt?.paneCount ?? (state.members || []).length });
21
+ ok(`세션 종료: ${state.sessionName}${closed ? ` (${closed} panes closed)` : ""}`);
22
+ } else if (sessionExists(state.sessionName)) {
23
+ killSession(state.sessionName);
24
+ ok(`세션 종료: ${state.sessionName}`);
25
+ } else {
26
+ console.log(` ${DIM}세션 이미 종료됨${RESET}`);
27
+ }
28
+
29
+ clearTeamState(state.sessionId);
30
+ console.log("");
31
+ }
@@ -0,0 +1,30 @@
1
+ import { DIM, RESET, WHITE } from "../../shared.mjs";
2
+ import { isTeamAlive } from "../services/runtime-mode.mjs";
3
+ import { loadTeamState, saveTeamState } from "../services/state-store.mjs";
4
+ import { normalizeTaskStatus, updateTaskStatus } from "../services/task-model.mjs";
5
+ import { ok } from "../render.mjs";
6
+
7
+ export function teamTaskUpdate(args = []) {
8
+ const state = loadTeamState();
9
+ if (!state || !isTeamAlive(state)) {
10
+ console.log(`\n ${DIM}활성 팀 세션 없음${RESET}\n`);
11
+ return;
12
+ }
13
+
14
+ const nextStatus = normalizeTaskStatus(args[0]);
15
+ const taskId = String(args[1] || "").toUpperCase();
16
+ if (!nextStatus || !taskId) {
17
+ console.log(`\n 사용법: ${WHITE}tfx multi task <pending|progress|done> <T1>${RESET}\n`);
18
+ return;
19
+ }
20
+
21
+ const updated = updateTaskStatus(state.tasks || [], taskId, nextStatus);
22
+ if (!updated.target) {
23
+ console.log(`\n ${DIM}태스크를 찾을 수 없음: ${taskId}${RESET}\n`);
24
+ return;
25
+ }
26
+
27
+ saveTeamState({ ...state, tasks: updated.tasks }, state.sessionId);
28
+ ok(`${updated.target.id} 상태 갱신: ${nextStatus}`);
29
+ console.log("");
30
+ }
@@ -0,0 +1,13 @@
1
+ import { DIM, RESET } from "../../shared.mjs";
2
+ import { isTeamAlive } from "../services/runtime-mode.mjs";
3
+ import { loadTeamState } from "../services/state-store.mjs";
4
+ import { renderTasks } from "../render.mjs";
5
+
6
+ export function teamTasks() {
7
+ const state = loadTeamState();
8
+ if (!state || !isTeamAlive(state)) {
9
+ console.log(`\n ${DIM}활성 팀 세션 없음${RESET}\n`);
10
+ return;
11
+ }
12
+ renderTasks(state.tasks || []);
13
+ }
@@ -0,0 +1,42 @@
1
+ import { AMBER, BOLD, DIM, GRAY, RESET, WHITE } from "../shared.mjs";
2
+
3
+ export function renderTeamHelp() {
4
+ console.log(`
5
+ ${AMBER}${BOLD}⬡ tfx multi${RESET} ${DIM}멀티-CLI 팀 모드 (Lead + Teammates)${RESET}
6
+
7
+ ${BOLD}시작${RESET}
8
+ ${WHITE}tfx multi "작업 설명"${RESET}
9
+ ${WHITE}tfx multi --agents codex,gemini --lead claude "작업"${RESET}
10
+ ${WHITE}tfx multi --teammate-mode tmux "작업"${RESET}
11
+ ${WHITE}tfx multi --teammate-mode wt "작업"${RESET} ${DIM}(Windows Terminal split-pane)${RESET}
12
+ ${WHITE}tfx multi --layout 1xN "작업"${RESET} ${DIM}(세로 분할 컬럼)${RESET}
13
+ ${WHITE}tfx multi --layout Nx1 "작업"${RESET} ${DIM}(가로 분할 스택)${RESET}
14
+ ${WHITE}tfx multi --dashboard-layout lite "작업"${RESET} ${DIM}(dashboard-lite 기본 뷰)${RESET}
15
+ ${WHITE}tfx multi --dashboard-layout auto "작업"${RESET} ${DIM}(dashboard viewer 레이아웃 자동 결정)${RESET}
16
+ ${WHITE}tfx multi --dashboard-size 0.4 "작업"${RESET} ${DIM}(대시보드 분할 비율 0.2~0.8, 기본 0.50)${RESET}
17
+ ${WHITE}tfx multi --dashboard-anchor window "작업"${RESET} ${DIM}(대시보드 고정 위치: window|tab, 기본 window)${RESET}
18
+ ${WHITE}tfx multi --teammate-mode in-process "작업"${RESET} ${DIM}(tmux 불필요)${RESET}
19
+
20
+ ${BOLD}제어${RESET}
21
+ ${WHITE}tfx multi status${RESET} ${GRAY}현재 팀 상태${RESET}
22
+ ${WHITE}tfx multi debug${RESET} ${DIM}[--lines 30]${RESET} ${GRAY}강화 디버그 출력(환경/세션/pane tail)${RESET}
23
+ ${WHITE}tfx multi tasks${RESET} ${GRAY}공유 태스크 목록${RESET}
24
+ ${WHITE}tfx multi task${RESET} ${DIM}<pending|progress|done> <T1>${RESET} ${GRAY}태스크 상태 갱신${RESET}
25
+ ${WHITE}tfx multi attach${RESET} ${DIM}[--wt]${RESET} ${GRAY}세션 재연결 (WT 분할은 opt-in)${RESET}
26
+ ${WHITE}tfx multi focus${RESET} ${DIM}<lead|이름|번호> [--wt]${RESET} ${GRAY}특정 팀메이트 포커스${RESET}
27
+ ${WHITE}tfx multi send${RESET} ${DIM}<lead|이름|번호> "msg"${RESET} ${GRAY}팀메이트에 메시지 주입${RESET}
28
+ ${WHITE}tfx multi interrupt${RESET} ${DIM}<대상>${RESET} ${GRAY}팀메이트 인터럽트(C-c)${RESET}
29
+ ${WHITE}tfx multi control${RESET} ${DIM}<대상> <cmd>${RESET} ${GRAY}리드 제어명령(interrupt|stop|pause|resume)${RESET}
30
+ ${WHITE}tfx multi stop${RESET} ${GRAY}graceful 종료${RESET}
31
+ ${WHITE}tfx multi kill${RESET} ${GRAY}모든 팀 세션 강제 종료${RESET}
32
+ ${WHITE}tfx multi list${RESET} ${GRAY}활성 세션 목록${RESET}
33
+
34
+ ${BOLD}키 조작(Claude teammate 스타일, tmux 모드)${RESET}
35
+ ${WHITE}Shift+Down${RESET} ${GRAY}다음 팀메이트${RESET}
36
+ ${WHITE}Shift+Tab${RESET} ${GRAY}이전 팀메이트 (권장)${RESET}
37
+ ${WHITE}Shift+Left${RESET} ${GRAY}이전 팀메이트 (대체)${RESET}
38
+ ${WHITE}Shift+Up${RESET} ${GRAY}미지원 (Claude Code가 캡처 불가, scroll-up 충돌)${RESET}
39
+ ${WHITE}Escape${RESET} ${GRAY}현재 팀메이트 인터럽트${RESET}
40
+ ${WHITE}Ctrl+T${RESET} ${GRAY}태스크 목록 토글${RESET}
41
+ `);
42
+ }
@@ -0,0 +1,41 @@
1
+ import { renderTeamHelp } from "./help.mjs";
2
+ import { resolveTeamCommand } from "./manifest.mjs";
3
+ import { teamAttach } from "./commands/attach.mjs";
4
+ import { teamControl } from "./commands/control.mjs";
5
+ import { teamDebug } from "./commands/debug.mjs";
6
+ import { teamFocus } from "./commands/focus.mjs";
7
+ import { teamInterrupt } from "./commands/interrupt.mjs";
8
+ import { teamKill } from "./commands/kill.mjs";
9
+ import { teamList } from "./commands/list.mjs";
10
+ import { teamSend } from "./commands/send.mjs";
11
+ import { teamStart } from "./commands/start/index.mjs";
12
+ import { teamStatus } from "./commands/status.mjs";
13
+ import { teamStop } from "./commands/stop.mjs";
14
+ import { teamTaskUpdate } from "./commands/task.mjs";
15
+ import { teamTasks } from "./commands/tasks.mjs";
16
+
17
+ const handlers = {
18
+ attach: teamAttach,
19
+ control: teamControl,
20
+ debug: teamDebug,
21
+ focus: teamFocus,
22
+ help: renderTeamHelp,
23
+ interrupt: teamInterrupt,
24
+ kill: teamKill,
25
+ list: teamList,
26
+ send: teamSend,
27
+ start: teamStart,
28
+ status: teamStatus,
29
+ stop: teamStop,
30
+ task: teamTaskUpdate,
31
+ tasks: teamTasks,
32
+ };
33
+
34
+ export async function cmdTeam() {
35
+ const args = process.argv.slice(3);
36
+ const command = resolveTeamCommand(args[0]);
37
+ if (!args.length) return renderTeamHelp();
38
+ // 미등록 커맨드는 teamStart로 fallthrough (팀 생성 기본값)
39
+ if (!command) return teamStart(args);
40
+ return handlers[command](args.slice(1));
41
+ }
@@ -0,0 +1,29 @@
1
+ export const TEAM_COMMANDS = [
2
+ { name: "status", usage: "tfx multi status", desc: "현재 팀 상태" },
3
+ { name: "debug", usage: "tfx multi debug [--lines 30]", desc: "강화 디버그 출력" },
4
+ { name: "tasks", usage: "tfx multi tasks", desc: "공유 태스크 목록" },
5
+ { name: "task", usage: "tfx multi task <pending|progress|done> <T1>", desc: "태스크 상태 갱신" },
6
+ { name: "attach", usage: "tfx multi attach [--wt]", desc: "세션 재연결" },
7
+ { name: "focus", usage: "tfx multi focus <lead|이름|번호> [--wt]", desc: "특정 팀메이트 포커스" },
8
+ { name: "send", usage: "tfx multi send <lead|이름|번호> \"msg\"", desc: "팀메이트에 메시지 주입" },
9
+ { name: "interrupt", usage: "tfx multi interrupt <대상>", desc: "팀메이트 인터럽트(C-c)" },
10
+ { name: "control", usage: "tfx multi control <대상> <cmd> [사유]", desc: "리드 제어명령 전송" },
11
+ { name: "stop", usage: "tfx multi stop", desc: "graceful 종료" },
12
+ { name: "kill", usage: "tfx multi kill", desc: "모든 팀 세션 강제 종료" },
13
+ { name: "list", usage: "tfx multi list", desc: "활성 세션 목록" },
14
+ { name: "help", usage: "tfx multi help", desc: "도움말" },
15
+ { name: "start", usage: "tfx multi start [options]", desc: "새 팀 세션 시작 (기본 커맨드)" },
16
+ ];
17
+
18
+ export const TEAM_COMMAND_ALIASES = new Map([
19
+ ["-h", "help"],
20
+ ["--help", "help"],
21
+ ]);
22
+
23
+ export const TEAM_SUBCOMMANDS = new Set(TEAM_COMMANDS.map(({ name }) => name));
24
+
25
+ export function resolveTeamCommand(raw) {
26
+ if (typeof raw !== "string") return null;
27
+ const command = raw.toLowerCase();
28
+ return TEAM_SUBCOMMANDS.has(command) ? command : (TEAM_COMMAND_ALIASES.get(command) || null);
29
+ }
@@ -0,0 +1,30 @@
1
+ import { AMBER, BOLD, DIM, GRAY, GREEN, RED, RESET, WHITE, YELLOW } from "../shared.mjs";
2
+
3
+ export function ok(msg) { console.log(` ${GREEN}✓${RESET} ${msg}`); }
4
+ export function warn(msg) { console.log(` ${YELLOW}⚠${RESET} ${msg}`); }
5
+ export function fail(msg) { console.log(` ${RED}✗${RESET} ${msg}`); }
6
+
7
+ export function renderTasks(tasks = []) {
8
+ if (!tasks.length) {
9
+ console.log(`\n ${DIM}태스크 없음${RESET}\n`);
10
+ return;
11
+ }
12
+
13
+ console.log(`\n ${AMBER}${BOLD}⬡ Team Tasks${RESET}\n`);
14
+ for (const task of tasks) {
15
+ const dep = task.depends_on?.length ? ` ${DIM}(deps: ${task.depends_on.join(",")})${RESET}` : "";
16
+ const owner = task.owner ? ` ${GRAY}[${task.owner}]${RESET}` : "";
17
+ console.log(` ${WHITE}${task.id}${RESET} ${String(task.status || "").padEnd(11)} ${task.title}${owner}${dep}`);
18
+ }
19
+ console.log("");
20
+ }
21
+
22
+ export function formatCompletionSuffix(member) {
23
+ if (!member?.completionStatus) return "";
24
+ if (member.completionStatus === "abnormal") {
25
+ return ` ${RED}[abnormal:${member.completionReason || "unknown"}]${RESET}`;
26
+ }
27
+ if (member.completionStatus === "normal") return ` ${GREEN}[route-ok]${RESET}`;
28
+ if (member.completionStatus === "unchecked") return ` ${GRAY}[route-unchecked]${RESET}`;
29
+ return "";
30
+ }
@@ -0,0 +1,54 @@
1
+ import { spawn } from "node:child_process";
2
+
3
+ import {
4
+ getSessionAttachedCount,
5
+ hasWindowsTerminal,
6
+ resolveAttachCommand,
7
+ } from "../../session.mjs";
8
+ import { PKG_ROOT } from "./state-store.mjs";
9
+
10
+ export async function launchAttachInWindowsTerminal(sessionName) {
11
+ if (!hasWindowsTerminal()) return false;
12
+
13
+ let attachSpec;
14
+ try {
15
+ attachSpec = resolveAttachCommand(sessionName);
16
+ } catch {
17
+ return false;
18
+ }
19
+
20
+ const beforeAttached = getSessionAttachedCount(sessionName);
21
+ try {
22
+ const child = spawn("wt", ["-w", "0", "split-pane", "-V", "-d", PKG_ROOT, attachSpec.command, ...attachSpec.args], {
23
+ detached: true,
24
+ stdio: "ignore",
25
+ windowsHide: false,
26
+ });
27
+ child.unref();
28
+
29
+ if (beforeAttached == null) return true;
30
+ const deadline = Date.now() + 3500;
31
+ while (Date.now() < deadline) {
32
+ await new Promise((resolve) => setTimeout(resolve, 120));
33
+ const nowAttached = getSessionAttachedCount(sessionName);
34
+ if (typeof nowAttached === "number" && nowAttached > beforeAttached) return true;
35
+ }
36
+ } catch {}
37
+ return false;
38
+ }
39
+
40
+ export function buildManualAttachCommand(sessionName) {
41
+ try {
42
+ const spec = resolveAttachCommand(sessionName);
43
+ return [spec.command, ...spec.args].map((value) => {
44
+ const text = String(value);
45
+ return /\s/.test(text) ? `"${text.replace(/"/g, '\\"')}"` : text;
46
+ }).join(" ");
47
+ } catch {
48
+ return `tmux attach-session -t ${sessionName}`;
49
+ }
50
+ }
51
+
52
+ export function wantsWtAttachFallback(args = [], env = process.env) {
53
+ return args.includes("--wt") || args.includes("--spawn-wt") || env.TFX_ATTACH_WT_AUTO === "1";
54
+ }
@@ -0,0 +1,227 @@
1
+ import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { spawn } from "node:child_process";
4
+
5
+ import { publishLeadControl as publishLeadControlBridge } from "../../lead-control.mjs";
6
+ import { getTeamStatus as fetchTeamStatus, subscribeToLeadCommands as pullLeadCommands } from "../../session-sync.mjs";
7
+ import { HUB_PID_DIR, PKG_ROOT } from "./state-store.mjs";
8
+ export { nativeGetStatus } from "./native-control.mjs";
9
+
10
+ const HUB_PID_FILE = join(HUB_PID_DIR, "hub.pid");
11
+ const LOOPBACK_HOSTS = new Set(["127.0.0.1", "localhost", "::1"]);
12
+
13
+ export function formatHostForUrl(host) {
14
+ return host.includes(":") ? `[${host}]` : host;
15
+ }
16
+
17
+ export function buildHubBaseUrl(host, port) {
18
+ return `http://${formatHostForUrl(host)}:${port}`;
19
+ }
20
+
21
+ export function getDefaultHubPort() {
22
+ const envPortRaw = Number(process.env.TFX_HUB_PORT || "27888");
23
+ return Number.isFinite(envPortRaw) && envPortRaw > 0 ? envPortRaw : 27888;
24
+ }
25
+
26
+ export function getDefaultHubUrl() {
27
+ return `${buildHubBaseUrl("127.0.0.1", getDefaultHubPort())}/mcp`;
28
+ }
29
+
30
+ function normalizeLoopbackHost(host) {
31
+ if (typeof host !== "string") return "127.0.0.1";
32
+ const candidate = host.trim();
33
+ return LOOPBACK_HOSTS.has(candidate) ? candidate : "127.0.0.1";
34
+ }
35
+
36
+ async function probeHubStatus(host, port, timeoutMs = 1500) {
37
+ try {
38
+ const res = await fetch(`${buildHubBaseUrl(host, port)}/status`, {
39
+ signal: AbortSignal.timeout(timeoutMs),
40
+ });
41
+ if (!res.ok) return null;
42
+ const data = await res.json();
43
+ return data?.hub ? data : null;
44
+ } catch {
45
+ return null;
46
+ }
47
+ }
48
+
49
+ export async function getHubInfo() {
50
+ const probePort = getDefaultHubPort();
51
+
52
+ if (existsSync(HUB_PID_FILE)) {
53
+ try {
54
+ const raw = JSON.parse(readFileSync(HUB_PID_FILE, "utf8"));
55
+ const pid = Number(raw?.pid);
56
+ if (!Number.isFinite(pid) || pid <= 0) throw new Error("invalid pid");
57
+ process.kill(pid, 0);
58
+ const host = normalizeLoopbackHost(raw?.host);
59
+ const port = Number(raw?.port) || 27888;
60
+ const status = await probeHubStatus(host, port, 1200);
61
+ return {
62
+ ...raw,
63
+ pid,
64
+ host,
65
+ port,
66
+ url: `${buildHubBaseUrl(host, port)}/mcp`,
67
+ ...(status ? {} : { degraded: true }),
68
+ };
69
+ } catch {
70
+ try { unlinkSync(HUB_PID_FILE); } catch {}
71
+ }
72
+ }
73
+
74
+ for (const portCandidate of Array.from(new Set([probePort, 27888]))) {
75
+ const data = await probeHubStatus("127.0.0.1", portCandidate, 1200);
76
+ if (!data) continue;
77
+ const port = Number(data.port) || portCandidate;
78
+ const pid = Number(data.pid);
79
+ const recovered = {
80
+ pid: Number.isFinite(pid) ? pid : null,
81
+ host: "127.0.0.1",
82
+ port,
83
+ url: `${buildHubBaseUrl("127.0.0.1", port)}/mcp`,
84
+ discovered: true,
85
+ };
86
+ if (Number.isFinite(recovered.pid) && recovered.pid > 0) {
87
+ try {
88
+ mkdirSync(HUB_PID_DIR, { recursive: true });
89
+ writeFileSync(HUB_PID_FILE, JSON.stringify({ ...recovered, started: Date.now() }));
90
+ } catch {}
91
+ }
92
+ return recovered;
93
+ }
94
+ return null;
95
+ }
96
+
97
+ export async function startHubDaemon() {
98
+ const serverPath = join(PKG_ROOT, "hub", "server.mjs");
99
+ if (!existsSync(serverPath)) {
100
+ const error = new Error("hub/server.mjs 없음");
101
+ error.code = "HUB_SERVER_MISSING";
102
+ throw error;
103
+ }
104
+
105
+ const child = spawn(process.execPath, [serverPath], {
106
+ env: { ...process.env },
107
+ stdio: "ignore",
108
+ detached: true,
109
+ windowsHide: true,
110
+ });
111
+ child.unref();
112
+
113
+ const expectedPort = getDefaultHubPort();
114
+ const deadline = Date.now() + 3000;
115
+ while (Date.now() < deadline) {
116
+ const status = await probeHubStatus("127.0.0.1", expectedPort, 500);
117
+ if (status?.hub) {
118
+ return {
119
+ pid: Number(status.pid) || child.pid,
120
+ host: "127.0.0.1",
121
+ port: expectedPort,
122
+ url: `${buildHubBaseUrl("127.0.0.1", expectedPort)}/mcp`,
123
+ };
124
+ }
125
+ await new Promise((resolve) => setTimeout(resolve, 100));
126
+ }
127
+
128
+ return null;
129
+ }
130
+
131
+ /**
132
+ * Hub가 살아있는지 확인하고, 죽어있으면 재시작을 시도한다.
133
+ * exponential backoff: 1초, 2초, 4초
134
+ * 모든 재시작 실패 시 에러를 throw한다 (silent fail 아님).
135
+ * @param {number} [maxRetries=3]
136
+ * @returns {Promise<object>} Hub 정보
137
+ * @throws {Error} 모든 재시작 시도 실패 시
138
+ */
139
+ export async function ensureHubAlive(maxRetries = 3) {
140
+ const hub = await getHubInfo();
141
+ if (hub && !hub.degraded) return hub;
142
+
143
+ let lastError = null;
144
+ for (let i = 0; i < maxRetries; i++) {
145
+ try {
146
+ const restarted = await startHubDaemon();
147
+ if (restarted) {
148
+ // 재시작 후 연결 복구 확인
149
+ const recovered = await getHubInfo();
150
+ if (recovered) return recovered;
151
+ }
152
+ } catch (err) {
153
+ lastError = err;
154
+ }
155
+ // 다음 재시도 전 대기: 1초, 2초, 4초 (마지막 시도 후에는 대기 없음)
156
+ if (i < maxRetries - 1) {
157
+ const backoffMs = Math.pow(2, i) * 1000; // i=0: 1초, i=1: 2초, i=2: 4초
158
+ await new Promise((resolve) => setTimeout(resolve, backoffMs));
159
+ }
160
+ }
161
+
162
+ const error = new Error(`Hub 재시작 ${maxRetries}회 모두 실패${lastError ? `: ${lastError.message}` : ""}`);
163
+ error.code = "HUB_RESTART_FAILED";
164
+ error.cause = lastError;
165
+ throw error;
166
+ }
167
+
168
+ export async function fetchHubTaskList(state) {
169
+ const hubBase = (state?.hubUrl || getDefaultHubUrl()).replace(/\/mcp$/, "");
170
+ const teamName = state?.native?.teamName || state?.sessionName || null;
171
+ if (!teamName) return [];
172
+
173
+ try {
174
+ const res = await fetch(`${hubBase}/bridge/team/task-list`, {
175
+ method: "POST",
176
+ headers: { "Content-Type": "application/json" },
177
+ body: JSON.stringify({ team_name: teamName }),
178
+ signal: AbortSignal.timeout(2000),
179
+ });
180
+ const data = await res.json();
181
+ return data?.ok ? (data.data?.tasks || []) : [];
182
+ } catch {
183
+ return [];
184
+ }
185
+ }
186
+
187
+ export async function publishLeadControl(state, targetMember, command, reason = "") {
188
+ const hubBase = (state?.hubUrl || getDefaultHubUrl()).replace(/\/mcp$/, "");
189
+ const leadAgent = (state?.members || []).find((member) => member.role === "lead")?.agentId || "lead";
190
+ const targetAgent = typeof targetMember === "string" ? targetMember : targetMember?.agentId;
191
+
192
+ const result = await publishLeadControlBridge({
193
+ hubUrl: hubBase,
194
+ fromAgent: leadAgent,
195
+ toAgent: targetAgent,
196
+ command,
197
+ reason,
198
+ payload: {
199
+ issued_by: leadAgent,
200
+ issued_at: Date.now(),
201
+ },
202
+ });
203
+
204
+ return !!result?.ok;
205
+ }
206
+
207
+ export async function subscribeToLeadCommands(state, member, options = {}) {
208
+ const hubBase = (state?.hubUrl || getDefaultHubUrl()).replace(/\/mcp$/, "");
209
+ const fallbackAgentId = (state?.members || []).find((candidate) => candidate.role === "lead")?.agentId || null;
210
+ const agentId = typeof member === "string"
211
+ ? member
212
+ : member?.agentId || options?.agentId || fallbackAgentId;
213
+
214
+ return await pullLeadCommands({
215
+ hubUrl: hubBase,
216
+ agentId,
217
+ ...options,
218
+ });
219
+ }
220
+
221
+ export async function getTeamStatus(state, options = {}) {
222
+ const hubBase = (state?.hubUrl || getDefaultHubUrl()).replace(/\/mcp$/, "");
223
+ return await fetchTeamStatus({
224
+ hubUrl: hubBase,
225
+ ...options,
226
+ });
227
+ }