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
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
// hub/team/notify.mjs — team notifier (bell / Windows toast / webhook)
|
|
2
|
+
|
|
3
|
+
import { execFile } from 'node:child_process';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
|
|
6
|
+
export const NOTIFY_EVENT_TYPES = Object.freeze(['completed', 'failed', 'inputWait']);
|
|
7
|
+
export const NOTIFY_CHANNELS = Object.freeze(['bell', 'toast', 'webhook']);
|
|
8
|
+
|
|
9
|
+
function freezeRecord(record) {
|
|
10
|
+
return Object.freeze({ ...record });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function escapePowerShellSingleQuoted(value) {
|
|
14
|
+
return String(value ?? '').replaceAll("'", "''");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function normalizeTimestamp(value) {
|
|
18
|
+
if (value instanceof Date) return value.toISOString();
|
|
19
|
+
if (value == null || value === '') return new Date().toISOString();
|
|
20
|
+
return String(value);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function normalizeEvent(event, defaults = {}) {
|
|
24
|
+
if (!event || typeof event !== 'object') {
|
|
25
|
+
throw new TypeError('notify(event) requires an event object');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const type = String(event.type || '').trim();
|
|
29
|
+
if (!NOTIFY_EVENT_TYPES.includes(type)) {
|
|
30
|
+
throw new TypeError(`Unsupported notify event type: ${type || '<empty>'}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return freezeRecord({
|
|
34
|
+
type,
|
|
35
|
+
sessionId: event.sessionId == null ? '' : String(event.sessionId),
|
|
36
|
+
host: event.host == null || event.host === '' ? String(defaults.host || os.hostname()) : String(event.host),
|
|
37
|
+
summary: event.summary == null ? '' : String(event.summary),
|
|
38
|
+
timestamp: normalizeTimestamp(event.timestamp),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function defaultChannelConfig(name, env) {
|
|
43
|
+
switch (name) {
|
|
44
|
+
case 'bell':
|
|
45
|
+
return { enabled: true };
|
|
46
|
+
case 'toast':
|
|
47
|
+
return { enabled: true };
|
|
48
|
+
case 'webhook': {
|
|
49
|
+
const url = String(env?.TRIFLUX_NOTIFY_WEBHOOK || '');
|
|
50
|
+
return { enabled: Boolean(url), url };
|
|
51
|
+
}
|
|
52
|
+
default:
|
|
53
|
+
throw new TypeError(`Unknown notify channel: ${name}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function normalizeChannelConfig(name, value, env) {
|
|
58
|
+
const base = defaultChannelConfig(name, env);
|
|
59
|
+
const patch = typeof value === 'boolean'
|
|
60
|
+
? { enabled: value }
|
|
61
|
+
: (value && typeof value === 'object' ? value : {});
|
|
62
|
+
|
|
63
|
+
const next = {
|
|
64
|
+
...base,
|
|
65
|
+
...patch,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
if ('enabled' in next) {
|
|
69
|
+
next.enabled = Boolean(next.enabled);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (name === 'webhook') {
|
|
73
|
+
next.url = String(next.url || env?.TRIFLUX_NOTIFY_WEBHOOK || '');
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (name === 'toast') {
|
|
77
|
+
if (next.command != null) next.command = String(next.command);
|
|
78
|
+
if (next.timeoutMs != null) next.timeoutMs = Math.max(1, Number.parseInt(String(next.timeoutMs), 10) || 5000);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return freezeRecord(next);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function normalizeChannels(channels, env) {
|
|
85
|
+
const source = channels && typeof channels === 'object' ? channels : {};
|
|
86
|
+
const normalized = {};
|
|
87
|
+
for (const name of NOTIFY_CHANNELS) {
|
|
88
|
+
normalized[name] = normalizeChannelConfig(name, source[name], env);
|
|
89
|
+
}
|
|
90
|
+
return Object.freeze(normalized);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function updateChannelConfig(channels, channel, config, env) {
|
|
94
|
+
if (!NOTIFY_CHANNELS.includes(channel)) {
|
|
95
|
+
throw new TypeError(`Unknown notify channel: ${channel}`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return Object.freeze({
|
|
99
|
+
...channels,
|
|
100
|
+
[channel]: normalizeChannelConfig(channel, { ...channels[channel], ...(typeof config === 'boolean' ? { enabled: config } : (config || {})) }, env),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function formatEventTitle(event) {
|
|
105
|
+
switch (event.type) {
|
|
106
|
+
case 'completed':
|
|
107
|
+
return 'Triflux completed';
|
|
108
|
+
case 'failed':
|
|
109
|
+
return 'Triflux failed';
|
|
110
|
+
case 'inputWait':
|
|
111
|
+
return 'Triflux waiting for input';
|
|
112
|
+
default:
|
|
113
|
+
return 'Triflux notification';
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function formatEventBody(event) {
|
|
118
|
+
const parts = [];
|
|
119
|
+
if (event.summary) parts.push(event.summary);
|
|
120
|
+
|
|
121
|
+
const meta = [event.sessionId ? `session ${event.sessionId}` : '', event.host ? `host ${event.host}` : '']
|
|
122
|
+
.filter(Boolean)
|
|
123
|
+
.join(' · ');
|
|
124
|
+
if (meta) parts.push(meta);
|
|
125
|
+
|
|
126
|
+
return parts.join('\n') || event.timestamp;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function createResult(channel, status, extra = {}) {
|
|
130
|
+
return freezeRecord({ channel, status, ...extra });
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function execFileAsync(command, args, options, execFileFn) {
|
|
134
|
+
return new Promise((resolve, reject) => {
|
|
135
|
+
execFileFn(command, args, options, (error, stdout, stderr) => {
|
|
136
|
+
if (error) {
|
|
137
|
+
error.stdout = stdout;
|
|
138
|
+
error.stderr = stderr;
|
|
139
|
+
reject(error);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
resolve({ stdout, stderr });
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function sendBell(config, deps) {
|
|
148
|
+
if (!config.enabled) return createResult('bell', 'skipped', { reason: 'disabled' });
|
|
149
|
+
const stream = deps.stdout;
|
|
150
|
+
if (!stream || typeof stream.write !== 'function') {
|
|
151
|
+
return createResult('bell', 'skipped', { reason: 'stdout-unavailable' });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
try {
|
|
155
|
+
stream.write('\u0007');
|
|
156
|
+
return createResult('bell', 'sent');
|
|
157
|
+
} catch (error) {
|
|
158
|
+
return createResult('bell', 'failed', { error: error.message });
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function buildToastScript(title, body) {
|
|
163
|
+
const safeTitle = escapePowerShellSingleQuoted(title);
|
|
164
|
+
const safeBody = escapePowerShellSingleQuoted(body);
|
|
165
|
+
return [
|
|
166
|
+
"$ErrorActionPreference = 'Stop'",
|
|
167
|
+
`$Title = '${safeTitle}'`,
|
|
168
|
+
`$Body = '${safeBody}'`,
|
|
169
|
+
"if (Get-Command New-BurntToastNotification -ErrorAction SilentlyContinue) {",
|
|
170
|
+
' New-BurntToastNotification -Text @($Title, $Body) | Out-Null',
|
|
171
|
+
' return',
|
|
172
|
+
'}',
|
|
173
|
+
'[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null',
|
|
174
|
+
'[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] > $null',
|
|
175
|
+
'$escapedTitle = [System.Security.SecurityElement]::Escape($Title)',
|
|
176
|
+
'$escapedBody = [System.Security.SecurityElement]::Escape($Body)',
|
|
177
|
+
'$xml = New-Object Windows.Data.Xml.Dom.XmlDocument',
|
|
178
|
+
'$xml.LoadXml("<toast><visual><binding template=\'ToastGeneric\'><text>$escapedTitle</text><text>$escapedBody</text></binding></visual></toast>")',
|
|
179
|
+
'$toast = [Windows.UI.Notifications.ToastNotification]::new($xml)',
|
|
180
|
+
"[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('Triflux').Show($toast)",
|
|
181
|
+
].join('; ');
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
async function sendToast(event, config, deps) {
|
|
185
|
+
if (!config.enabled) return createResult('toast', 'skipped', { reason: 'disabled' });
|
|
186
|
+
if ((deps.platform || process.platform) !== 'win32') {
|
|
187
|
+
return createResult('toast', 'skipped', { reason: 'unsupported-platform' });
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const execFileFn = deps.execFile || execFile;
|
|
191
|
+
const candidates = config.command
|
|
192
|
+
? [config.command]
|
|
193
|
+
: Array.isArray(deps.powerShellCandidates) && deps.powerShellCandidates.length > 0
|
|
194
|
+
? deps.powerShellCandidates
|
|
195
|
+
: ['pwsh', 'powershell.exe'];
|
|
196
|
+
|
|
197
|
+
const title = formatEventTitle(event);
|
|
198
|
+
const body = formatEventBody(event);
|
|
199
|
+
const script = buildToastScript(title, body);
|
|
200
|
+
const failures = [];
|
|
201
|
+
|
|
202
|
+
for (const command of candidates) {
|
|
203
|
+
try {
|
|
204
|
+
await execFileAsync(command, ['-NoLogo', '-NoProfile', '-Command', script], {
|
|
205
|
+
windowsHide: true,
|
|
206
|
+
timeout: config.timeoutMs || 5000,
|
|
207
|
+
}, execFileFn);
|
|
208
|
+
return createResult('toast', 'sent', { command });
|
|
209
|
+
} catch (error) {
|
|
210
|
+
failures.push(`${command}: ${error.message}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return createResult('toast', 'failed', { error: failures.join(' | ') || 'toast-send-failed' });
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
async function sendWebhook(event, config, deps) {
|
|
218
|
+
if (!config.enabled) return createResult('webhook', 'skipped', { reason: 'disabled' });
|
|
219
|
+
if (!config.url) return createResult('webhook', 'skipped', { reason: 'missing-url' });
|
|
220
|
+
if (typeof deps.fetch !== 'function') {
|
|
221
|
+
return createResult('webhook', 'failed', { error: 'fetch-unavailable' });
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
try {
|
|
225
|
+
const response = await deps.fetch(config.url, {
|
|
226
|
+
method: 'POST',
|
|
227
|
+
headers: { 'content-type': 'application/json' },
|
|
228
|
+
body: JSON.stringify(event),
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
if (!response?.ok) {
|
|
232
|
+
return createResult('webhook', 'failed', { error: `HTTP ${response?.status ?? 'unknown'}` });
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return createResult('webhook', 'sent', { statusCode: response.status });
|
|
236
|
+
} catch (error) {
|
|
237
|
+
return createResult('webhook', 'failed', { error: error.message });
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function createNotifierInstance(channels, deps) {
|
|
242
|
+
async function notify(event) {
|
|
243
|
+
const normalizedEvent = normalizeEvent(event, { host: deps.hostname });
|
|
244
|
+
const results = {
|
|
245
|
+
bell: await sendBell(channels.bell, deps),
|
|
246
|
+
toast: await sendToast(normalizedEvent, channels.toast, deps),
|
|
247
|
+
webhook: await sendWebhook(normalizedEvent, channels.webhook, deps),
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
return freezeRecord({
|
|
251
|
+
event: normalizedEvent,
|
|
252
|
+
results: Object.freeze(results),
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function setChannel(channel, config) {
|
|
257
|
+
return createNotifierInstance(updateChannelConfig(channels, channel, config, deps.env), deps);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return Object.freeze({ notify, setChannel });
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* 팀 세션 알림기 팩토리.
|
|
265
|
+
* - bell: 터미널 BEL 문자
|
|
266
|
+
* - toast: Windows PowerShell 기반 toast (BurntToast 우선, WinRT fallback)
|
|
267
|
+
* - webhook: TRIFLUX_NOTIFY_WEBHOOK JSON POST
|
|
268
|
+
*
|
|
269
|
+
* Immutable pattern: setChannel()은 기존 notifier를 수정하지 않고 새 notifier를 반환한다.
|
|
270
|
+
*
|
|
271
|
+
* @param {object} [opts]
|
|
272
|
+
* @param {object} [opts.channels] — 채널별 초기 설정
|
|
273
|
+
* @param {object} [opts.env=process.env] — 환경 변수 소스
|
|
274
|
+
* @param {NodeJS.WriteStream|{write:function}} [opts.stdout=process.stdout] — bell 출력 대상
|
|
275
|
+
* @param {string} [opts.platform=process.platform] — 플랫폼 override (test 용)
|
|
276
|
+
* @param {string} [opts.hostname=os.hostname()] — 기본 host override
|
|
277
|
+
* @param {object} [opts.deps] — 테스트용 의존성 주입
|
|
278
|
+
* @returns {{ notify(event: object): Promise<object>, setChannel(channel: string, config: object|boolean): object }}
|
|
279
|
+
*/
|
|
280
|
+
export function createNotifier(opts = {}) {
|
|
281
|
+
const env = opts.env || process.env;
|
|
282
|
+
const deps = Object.freeze({
|
|
283
|
+
env,
|
|
284
|
+
stdout: opts.stdout || process.stdout,
|
|
285
|
+
execFile: opts.deps?.execFile || execFile,
|
|
286
|
+
fetch: opts.deps?.fetch || globalThis.fetch?.bind(globalThis),
|
|
287
|
+
platform: opts.platform || process.platform,
|
|
288
|
+
hostname: opts.hostname || os.hostname(),
|
|
289
|
+
powerShellCandidates: Object.freeze(opts.deps?.powerShellCandidates || ['pwsh', 'powershell.exe']),
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
return createNotifierInstance(normalizeChannels(opts.channels, env), deps);
|
|
293
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// hub/team/orchestrator.mjs — 작업 분배 + 프롬프트 구성
|
|
2
|
+
// 의존성: pane.mjs만 사용
|
|
3
|
+
import { injectPrompt } from "./pane.mjs";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 작업 분해 (LLM 없이 구분자 기반)
|
|
7
|
+
* @param {string} taskDescription — 전체 작업 설명
|
|
8
|
+
* @param {number} agentCount — 에이전트 수
|
|
9
|
+
* @returns {string[]} 각 에이전트의 서브태스크
|
|
10
|
+
*/
|
|
11
|
+
export function decomposeTask(taskDescription, agentCount) {
|
|
12
|
+
if (agentCount <= 0) return [];
|
|
13
|
+
if (agentCount === 1) return [taskDescription];
|
|
14
|
+
|
|
15
|
+
// '+', ',', '\n' 기준으로 분리
|
|
16
|
+
const parts = taskDescription
|
|
17
|
+
.split(/[+,\n]+/)
|
|
18
|
+
.map((s) => s.trim())
|
|
19
|
+
.filter(Boolean);
|
|
20
|
+
|
|
21
|
+
if (parts.length === 0) return [taskDescription];
|
|
22
|
+
|
|
23
|
+
// 에이전트보다 서브태스크가 적으면 마지막 에이전트에 전체 태스크 부여
|
|
24
|
+
if (parts.length < agentCount) {
|
|
25
|
+
const result = [...parts];
|
|
26
|
+
while (result.length < agentCount) {
|
|
27
|
+
result.push(taskDescription);
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 에이전트보다 서브태스크가 많으면 앞에서부터 N개, 나머지는 마지막에 합침
|
|
33
|
+
if (parts.length > agentCount) {
|
|
34
|
+
const result = parts.slice(0, agentCount - 1);
|
|
35
|
+
result.push(parts.slice(agentCount - 1).join(" + "));
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return parts;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 리드(보통 claude) 초기 프롬프트 생성
|
|
44
|
+
* @param {string} taskDescription
|
|
45
|
+
* @param {object} config
|
|
46
|
+
* @param {string} config.agentId
|
|
47
|
+
* @param {string} config.hubUrl
|
|
48
|
+
* @param {string} config.teammateMode
|
|
49
|
+
* @param {Array<{agentId:string, cli:string, subtask:string}>} config.workers
|
|
50
|
+
* @returns {string}
|
|
51
|
+
*/
|
|
52
|
+
export function buildLeadPrompt(taskDescription, config) {
|
|
53
|
+
const { agentId, hubUrl, teammateMode = "tmux", workers = [] } = config;
|
|
54
|
+
|
|
55
|
+
const roster = workers
|
|
56
|
+
.map((w, i) => `${i + 1}. ${w.agentId} (${w.cli}) — ${w.subtask}`)
|
|
57
|
+
.join("\n") || "- (워커 없음)";
|
|
58
|
+
|
|
59
|
+
const workerIds = workers.map((w) => w.agentId).join(", ");
|
|
60
|
+
|
|
61
|
+
const bridgePath = "node hub/bridge.mjs";
|
|
62
|
+
|
|
63
|
+
return `리드 에이전트: ${agentId}
|
|
64
|
+
|
|
65
|
+
목표: ${taskDescription}
|
|
66
|
+
모드: ${teammateMode}
|
|
67
|
+
|
|
68
|
+
워커:
|
|
69
|
+
${roster}
|
|
70
|
+
|
|
71
|
+
규칙:
|
|
72
|
+
- 가능한 짧고 핵심만 지시/요약(토큰 절약)
|
|
73
|
+
- 워커 제어:
|
|
74
|
+
${bridgePath} result --agent ${agentId} --topic lead.control
|
|
75
|
+
- 워커 결과 수집:
|
|
76
|
+
${bridgePath} context --agent ${agentId} --max 20
|
|
77
|
+
- 최종 결과는 topic="task.result"를 모아 통합
|
|
78
|
+
|
|
79
|
+
워커 ID: ${workerIds || "(없음)"}
|
|
80
|
+
지금 즉시 워커를 배정하고 병렬 진행을 관리하라.`;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 워커 초기 프롬프트 생성
|
|
85
|
+
* @param {string} subtask — 이 에이전트의 서브태스크
|
|
86
|
+
* @param {object} config
|
|
87
|
+
* @param {string} config.cli — codex/gemini/claude
|
|
88
|
+
* @param {string} config.agentId — 에이전트 식별자
|
|
89
|
+
* @param {string} config.hubUrl — Hub URL
|
|
90
|
+
* @returns {string}
|
|
91
|
+
*/
|
|
92
|
+
export function buildPrompt(subtask, config) {
|
|
93
|
+
const { cli, agentId, hubUrl } = config;
|
|
94
|
+
|
|
95
|
+
const hubBase = hubUrl.replace("/mcp", "");
|
|
96
|
+
|
|
97
|
+
const bridgePath = "node hub/bridge.mjs";
|
|
98
|
+
|
|
99
|
+
return `워커: ${agentId} (${cli})
|
|
100
|
+
작업: ${subtask}
|
|
101
|
+
|
|
102
|
+
필수 규칙:
|
|
103
|
+
1) 간결하게 작업(불필요한 장문 설명 금지)
|
|
104
|
+
2) 시작 즉시 등록:
|
|
105
|
+
${bridgePath} register --agent ${agentId} --cli ${cli} --topics lead.control,task.result
|
|
106
|
+
3) 주기적으로 수신함 확인:
|
|
107
|
+
${bridgePath} context --agent ${agentId} --max 10
|
|
108
|
+
4) lead.control 수신 시 즉시 반응 (interrupt/stop/pause/resume)
|
|
109
|
+
5) 완료 시 결과 발행:
|
|
110
|
+
${bridgePath} result --agent ${agentId} --topic task.result --file <출력파일>
|
|
111
|
+
|
|
112
|
+
지금 작업을 시작하라.`;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* 팀 오케스트레이션 실행 — 각 pane에 프롬프트 주입
|
|
117
|
+
* @param {string} sessionName — tmux 세션 이름
|
|
118
|
+
* @param {Array<{target: string, cli: string, subtask: string}>} assignments
|
|
119
|
+
* @param {object} opts
|
|
120
|
+
* @param {string} opts.hubUrl — Hub URL
|
|
121
|
+
* @param {{target:string, cli:string, task:string}|null} opts.lead
|
|
122
|
+
* @param {string} opts.teammateMode
|
|
123
|
+
* @returns {Promise<void>}
|
|
124
|
+
*/
|
|
125
|
+
export async function orchestrate(sessionName, assignments, opts = {}) {
|
|
126
|
+
const {
|
|
127
|
+
hubUrl = "http://127.0.0.1:27888/mcp",
|
|
128
|
+
lead = null,
|
|
129
|
+
teammateMode = "tmux",
|
|
130
|
+
} = opts;
|
|
131
|
+
|
|
132
|
+
const workers = assignments.map(({ target, cli, subtask }) => ({
|
|
133
|
+
target,
|
|
134
|
+
cli,
|
|
135
|
+
subtask,
|
|
136
|
+
agentId: `${cli}-${target.split(".").pop()}`,
|
|
137
|
+
}));
|
|
138
|
+
|
|
139
|
+
if (lead?.target) {
|
|
140
|
+
const leadAgentId = `${lead.cli || "claude"}-${lead.target.split(".").pop()}`;
|
|
141
|
+
const leadPrompt = buildLeadPrompt(lead.task || "팀 작업 조율", {
|
|
142
|
+
agentId: leadAgentId,
|
|
143
|
+
hubUrl,
|
|
144
|
+
teammateMode,
|
|
145
|
+
workers: workers.map((w) => ({ agentId: w.agentId, cli: w.cli, subtask: w.subtask })),
|
|
146
|
+
});
|
|
147
|
+
injectPrompt(lead.target, leadPrompt, { useFileRef: true });
|
|
148
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
for (const worker of workers) {
|
|
152
|
+
const prompt = buildPrompt(worker.subtask, {
|
|
153
|
+
cli: worker.cli,
|
|
154
|
+
agentId: worker.agentId,
|
|
155
|
+
hubUrl,
|
|
156
|
+
sessionName,
|
|
157
|
+
});
|
|
158
|
+
injectPrompt(worker.target, prompt, { useFileRef: true });
|
|
159
|
+
await new Promise((r) => setTimeout(r, 100));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// hub/team/pane.mjs — pane별 CLI 실행 + stdin 주입
|
|
2
|
+
// 의존성: child_process, fs, os, path (Node.js 내장)만 사용
|
|
3
|
+
import { writeFileSync, unlinkSync, mkdirSync } from "node:fs";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { detectMultiplexer, tmuxExec } from "./session.mjs";
|
|
7
|
+
import { psmuxExec } from "./psmux.mjs";
|
|
8
|
+
|
|
9
|
+
import { buildExecArgs } from "../codex-adapter.mjs";
|
|
10
|
+
|
|
11
|
+
function quoteArg(value) {
|
|
12
|
+
return `"${String(value).replace(/"/g, '\\"')}"`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function getPsmuxSessionName(target) {
|
|
16
|
+
return String(target).split(":")[0]?.trim() || "";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Windows 경로를 멀티플렉서용 경로로 변환 */
|
|
20
|
+
function toMuxPath(p) {
|
|
21
|
+
if (process.platform !== "win32") return p;
|
|
22
|
+
|
|
23
|
+
const mux = detectMultiplexer();
|
|
24
|
+
|
|
25
|
+
// psmux는 Windows 네이티브 경로 그대로 사용
|
|
26
|
+
if (mux === "psmux") return p;
|
|
27
|
+
|
|
28
|
+
const normalized = p.replace(/\\/g, "/");
|
|
29
|
+
const m = normalized.match(/^([A-Za-z]):\/(.*)$/);
|
|
30
|
+
if (!m) return normalized;
|
|
31
|
+
|
|
32
|
+
const drive = m[1].toLowerCase();
|
|
33
|
+
const rest = m[2];
|
|
34
|
+
|
|
35
|
+
// wsl tmux는 /mnt/c/... 경로를 사용
|
|
36
|
+
if (mux === "wsl-tmux") {
|
|
37
|
+
return `/mnt/${drive}/${rest}`;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Git Bash/MSYS tmux는 /c/... 경로를 사용
|
|
41
|
+
return `/${drive}/${rest}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** 멀티플렉서 커맨드 실행 (session.mjs와 동일 패턴) */
|
|
45
|
+
function muxExec(args, opts = {}) {
|
|
46
|
+
const exec = detectMultiplexer() === "psmux" ? psmuxExec : tmuxExec;
|
|
47
|
+
return exec(args, {
|
|
48
|
+
encoding: "utf8",
|
|
49
|
+
timeout: 10000,
|
|
50
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
51
|
+
windowsHide: true,
|
|
52
|
+
...opts,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* CLI 에이전트 시작 커맨드 생성
|
|
58
|
+
* @param {'codex'|'gemini'|'claude'} cli
|
|
59
|
+
* @param {{ trustMode?: boolean }} [options]
|
|
60
|
+
* @returns {string} 실행할 셸 커맨드
|
|
61
|
+
*/
|
|
62
|
+
export function buildCliCommand(cli, options = {}) {
|
|
63
|
+
const { trustMode = false } = options;
|
|
64
|
+
|
|
65
|
+
switch (cli) {
|
|
66
|
+
case "codex":
|
|
67
|
+
// trust 모드에서는 exec 서브커맨드 기반 명령을 사용
|
|
68
|
+
if (trustMode) {
|
|
69
|
+
return buildExecArgs({});
|
|
70
|
+
}
|
|
71
|
+
return "codex";
|
|
72
|
+
case "gemini":
|
|
73
|
+
// interactive 모드 — MCP는 ~/.gemini/settings.json에 사전 등록
|
|
74
|
+
return "gemini";
|
|
75
|
+
case "claude":
|
|
76
|
+
// interactive 모드
|
|
77
|
+
return "claude";
|
|
78
|
+
default:
|
|
79
|
+
return cli; // 커스텀 CLI 허용
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* pane에 CLI 시작
|
|
85
|
+
* @param {string} target — 예: tfx-multi-abc:0.1
|
|
86
|
+
* @param {string} command — 실행할 커맨드
|
|
87
|
+
*/
|
|
88
|
+
export function startCliInPane(target, command) {
|
|
89
|
+
// CLI 시작도 buffer paste를 재사용해 셸/플랫폼별 quoting 차이를 제거한다.
|
|
90
|
+
injectPrompt(target, command);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* pane에 프롬프트 주입 (load-buffer + paste-buffer 방식)
|
|
95
|
+
* 멀티라인 + 특수문자 안전, 크기 제한 없음
|
|
96
|
+
* @param {string} target — 예: tfx-multi-abc:0.1
|
|
97
|
+
* @param {string} prompt — 주입할 텍스트
|
|
98
|
+
*/
|
|
99
|
+
/**
|
|
100
|
+
* pane에 프롬프트 주입
|
|
101
|
+
* @param {string} target — 예: tfx-multi-abc:0.1
|
|
102
|
+
* @param {string} prompt — 주입할 텍스트
|
|
103
|
+
* @param {object} [opts]
|
|
104
|
+
* @param {boolean} [opts.useFileRef] — true면 TUI용 @file 참조 방식 (psmux 전용)
|
|
105
|
+
*/
|
|
106
|
+
export function injectPrompt(target, prompt, { useFileRef = false } = {}) {
|
|
107
|
+
const tmpDir = join(tmpdir(), "tfx-multi");
|
|
108
|
+
mkdirSync(tmpDir, { recursive: true });
|
|
109
|
+
|
|
110
|
+
const safeTarget = target.replace(/[:.]/g, "-");
|
|
111
|
+
const tmpFile = join(tmpDir, `prompt-${safeTarget}-${Date.now()}.txt`);
|
|
112
|
+
|
|
113
|
+
// psmux + TUI 앱: @file 참조로 주입 (paste-buffer는 TUI와 호환 안 됨)
|
|
114
|
+
if (detectMultiplexer() === "psmux" && useFileRef) {
|
|
115
|
+
writeFileSync(tmpFile, prompt, "utf8");
|
|
116
|
+
const filePath = tmpFile.replace(/\\/g, "/");
|
|
117
|
+
psmuxExec(["select-pane", "-t", target]);
|
|
118
|
+
psmuxExec(["send-keys", "-t", target, "-l", `@${filePath}`]);
|
|
119
|
+
psmuxExec(["send-keys", "-t", target, "Enter"]);
|
|
120
|
+
// TUI가 파일을 읽을 시간을 주고 정리
|
|
121
|
+
setTimeout(() => { try { unlinkSync(tmpFile); } catch {} }, 10000);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
try {
|
|
126
|
+
writeFileSync(tmpFile, prompt, "utf8");
|
|
127
|
+
|
|
128
|
+
if (detectMultiplexer() === "psmux") {
|
|
129
|
+
const sessionName = getPsmuxSessionName(target);
|
|
130
|
+
psmuxExec(["load-buffer", "-t", sessionName, toMuxPath(tmpFile)]);
|
|
131
|
+
psmuxExec(["select-pane", "-t", target]);
|
|
132
|
+
psmuxExec(["paste-buffer", "-t", target]);
|
|
133
|
+
psmuxExec(["send-keys", "-t", target, "Enter"]);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// tmux load-buffer → paste-buffer → Enter
|
|
138
|
+
muxExec(`load-buffer ${quoteArg(toMuxPath(tmpFile))}`);
|
|
139
|
+
muxExec(`paste-buffer -t ${target}`);
|
|
140
|
+
muxExec(`send-keys -t ${target} Enter`);
|
|
141
|
+
} finally {
|
|
142
|
+
try { unlinkSync(tmpFile); } catch {}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* pane에 키 입력 전송
|
|
148
|
+
* @param {string} target — 예: tfx-multi-abc:0.1
|
|
149
|
+
* @param {string} keys — tmux 키 표현 (예: 'C-c', 'Enter')
|
|
150
|
+
*/
|
|
151
|
+
export function sendKeys(target, keys) {
|
|
152
|
+
muxExec(`send-keys -t ${target} ${keys}`);
|
|
153
|
+
}
|