triflux 3.2.0-dev.8 → 3.3.0-dev.1
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/bin/triflux.mjs +1296 -1055
- package/hooks/hooks.json +17 -0
- package/hooks/keyword-rules.json +20 -4
- package/hooks/pipeline-stop.mjs +54 -0
- package/hub/bridge.mjs +517 -318
- package/hub/hitl.mjs +45 -31
- package/hub/pipe.mjs +457 -0
- package/hub/pipeline/index.mjs +121 -0
- package/hub/pipeline/state.mjs +164 -0
- package/hub/pipeline/transitions.mjs +114 -0
- package/hub/router.mjs +422 -161
- package/hub/schema.sql +14 -0
- package/hub/server.mjs +499 -424
- package/hub/store.mjs +388 -314
- package/hub/team/cli-team-common.mjs +348 -0
- package/hub/team/cli-team-control.mjs +393 -0
- package/hub/team/cli-team-start.mjs +516 -0
- package/hub/team/cli-team-status.mjs +269 -0
- package/hub/team/cli.mjs +75 -1475
- package/hub/team/dashboard.mjs +1 -9
- package/hub/team/native.mjs +190 -130
- package/hub/team/nativeProxy.mjs +165 -78
- package/hub/team/orchestrator.mjs +15 -20
- package/hub/team/pane.mjs +137 -103
- package/hub/team/psmux.mjs +506 -0
- package/hub/team/session.mjs +393 -330
- package/hub/team/shared.mjs +13 -0
- package/hub/team/staleState.mjs +299 -0
- package/hub/tools.mjs +105 -31
- package/hub/workers/claude-worker.mjs +446 -0
- package/hub/workers/codex-mcp.mjs +414 -0
- package/hub/workers/factory.mjs +18 -0
- package/hub/workers/gemini-worker.mjs +349 -0
- package/hub/workers/interface.mjs +41 -0
- package/hud/hud-qos-status.mjs +1790 -1788
- package/package.json +4 -1
- package/scripts/__tests__/keyword-detector.test.mjs +8 -8
- package/scripts/keyword-detector.mjs +15 -0
- package/scripts/lib/keyword-rules.mjs +4 -1
- package/scripts/preflight-cache.mjs +72 -0
- package/scripts/psmux-steering-prototype.sh +368 -0
- package/scripts/setup.mjs +136 -71
- package/scripts/tfx-route-worker.mjs +161 -0
- package/scripts/tfx-route.sh +485 -91
- package/skills/tfx-auto/SKILL.md +90 -564
- package/skills/tfx-auto-codex/SKILL.md +1 -3
- package/skills/tfx-codex/SKILL.md +1 -4
- package/skills/tfx-doctor/SKILL.md +1 -0
- package/skills/tfx-gemini/SKILL.md +1 -4
- package/skills/tfx-multi/SKILL.md +378 -0
- package/skills/tfx-setup/SKILL.md +1 -4
- package/skills/tfx-team/SKILL.md +0 -304
package/hub/team/pane.mjs
CHANGED
|
@@ -1,44 +1,58 @@
|
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
+
function quoteArg(value) {
|
|
10
|
+
return `"${String(value).replace(/"/g, '\\"')}"`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getPsmuxSessionName(target) {
|
|
14
|
+
return String(target).split(":")[0]?.trim() || "";
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** Windows 경로를 멀티플렉서용 경로로 변환 */
|
|
18
|
+
function toMuxPath(p) {
|
|
19
|
+
if (process.platform !== "win32") return p;
|
|
20
|
+
|
|
21
|
+
const mux = detectMultiplexer();
|
|
22
|
+
|
|
23
|
+
// psmux는 Windows 네이티브 경로 그대로 사용
|
|
24
|
+
if (mux === "psmux") return p;
|
|
25
|
+
|
|
26
|
+
const normalized = p.replace(/\\/g, "/");
|
|
27
|
+
const m = normalized.match(/^([A-Za-z]):\/(.*)$/);
|
|
28
|
+
if (!m) return normalized;
|
|
29
|
+
|
|
30
|
+
const drive = m[1].toLowerCase();
|
|
31
|
+
const rest = m[2];
|
|
32
|
+
|
|
33
|
+
// wsl tmux는 /mnt/c/... 경로를 사용
|
|
34
|
+
if (mux === "wsl-tmux") {
|
|
35
|
+
return `/mnt/${drive}/${rest}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Git Bash/MSYS tmux는 /c/... 경로를 사용
|
|
39
|
+
return `/${drive}/${rest}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** 멀티플렉서 커맨드 실행 (session.mjs와 동일 패턴) */
|
|
43
|
+
function muxExec(args, opts = {}) {
|
|
44
|
+
const exec = detectMultiplexer() === "psmux" ? psmuxExec : tmuxExec;
|
|
45
|
+
return exec(args, {
|
|
46
|
+
encoding: "utf8",
|
|
47
|
+
timeout: 10000,
|
|
48
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
49
|
+
...opts,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* CLI 에이전트 시작 커맨드 생성
|
|
55
|
+
* @param {'codex'|'gemini'|'claude'} cli
|
|
42
56
|
* @param {{ trustMode?: boolean }} [options]
|
|
43
57
|
* @returns {string} 실행할 셸 커맨드
|
|
44
58
|
*/
|
|
@@ -51,65 +65,85 @@ export function buildCliCommand(cli, options = {}) {
|
|
|
51
65
|
return trustMode
|
|
52
66
|
? "codex --dangerously-bypass-approvals-and-sandbox --no-alt-screen"
|
|
53
67
|
: "codex";
|
|
54
|
-
case "gemini":
|
|
55
|
-
// interactive 모드 — MCP는 ~/.gemini/settings.json에 사전 등록
|
|
56
|
-
return "gemini";
|
|
57
|
-
case "claude":
|
|
58
|
-
// interactive 모드
|
|
59
|
-
return "claude";
|
|
60
|
-
default:
|
|
61
|
-
return cli; // 커스텀 CLI 허용
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
*
|
|
67
|
-
* @param {string} target — 예: tfx-
|
|
68
|
-
* @param {string} command — 실행할 커맨드
|
|
69
|
-
*/
|
|
70
|
-
export function startCliInPane(target, command) {
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* @param {string}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
68
|
+
case "gemini":
|
|
69
|
+
// interactive 모드 — MCP는 ~/.gemini/settings.json에 사전 등록
|
|
70
|
+
return "gemini";
|
|
71
|
+
case "claude":
|
|
72
|
+
// interactive 모드
|
|
73
|
+
return "claude";
|
|
74
|
+
default:
|
|
75
|
+
return cli; // 커스텀 CLI 허용
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* pane에 CLI 시작
|
|
81
|
+
* @param {string} target — 예: tfx-multi-abc:0.1
|
|
82
|
+
* @param {string} command — 실행할 커맨드
|
|
83
|
+
*/
|
|
84
|
+
export function startCliInPane(target, command) {
|
|
85
|
+
// CLI 시작도 buffer paste를 재사용해 셸/플랫폼별 quoting 차이를 제거한다.
|
|
86
|
+
injectPrompt(target, command);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* pane에 프롬프트 주입 (load-buffer + paste-buffer 방식)
|
|
91
|
+
* 멀티라인 + 특수문자 안전, 크기 제한 없음
|
|
92
|
+
* @param {string} target — 예: tfx-multi-abc:0.1
|
|
93
|
+
* @param {string} prompt — 주입할 텍스트
|
|
94
|
+
*/
|
|
95
|
+
/**
|
|
96
|
+
* pane에 프롬프트 주입
|
|
97
|
+
* @param {string} target — 예: tfx-multi-abc:0.1
|
|
98
|
+
* @param {string} prompt — 주입할 텍스트
|
|
99
|
+
* @param {object} [opts]
|
|
100
|
+
* @param {boolean} [opts.useFileRef] — true면 TUI용 @file 참조 방식 (psmux 전용)
|
|
101
|
+
*/
|
|
102
|
+
export function injectPrompt(target, prompt, { useFileRef = false } = {}) {
|
|
103
|
+
const tmpDir = join(tmpdir(), "tfx-multi");
|
|
104
|
+
mkdirSync(tmpDir, { recursive: true });
|
|
105
|
+
|
|
106
|
+
const safeTarget = target.replace(/[:.]/g, "-");
|
|
107
|
+
const tmpFile = join(tmpDir, `prompt-${safeTarget}-${Date.now()}.txt`);
|
|
108
|
+
|
|
109
|
+
// psmux + TUI 앱: @file 참조로 주입 (paste-buffer는 TUI와 호환 안 됨)
|
|
110
|
+
if (detectMultiplexer() === "psmux" && useFileRef) {
|
|
111
|
+
writeFileSync(tmpFile, prompt, "utf8");
|
|
112
|
+
const filePath = tmpFile.replace(/\\/g, "/");
|
|
113
|
+
psmuxExec(["select-pane", "-t", target]);
|
|
114
|
+
psmuxExec(["send-keys", "-t", target, "-l", `@${filePath}`]);
|
|
115
|
+
psmuxExec(["send-keys", "-t", target, "Enter"]);
|
|
116
|
+
// TUI가 파일을 읽을 시간을 주고 정리
|
|
117
|
+
setTimeout(() => { try { unlinkSync(tmpFile); } catch {} }, 10000);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
writeFileSync(tmpFile, prompt, "utf8");
|
|
123
|
+
|
|
124
|
+
if (detectMultiplexer() === "psmux") {
|
|
125
|
+
const sessionName = getPsmuxSessionName(target);
|
|
126
|
+
psmuxExec(["load-buffer", "-t", sessionName, toMuxPath(tmpFile)]);
|
|
127
|
+
psmuxExec(["select-pane", "-t", target]);
|
|
128
|
+
psmuxExec(["paste-buffer", "-t", target]);
|
|
129
|
+
psmuxExec(["send-keys", "-t", target, "Enter"]);
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// tmux load-buffer → paste-buffer → Enter
|
|
134
|
+
muxExec(`load-buffer ${quoteArg(toMuxPath(tmpFile))}`);
|
|
135
|
+
muxExec(`paste-buffer -t ${target}`);
|
|
136
|
+
muxExec(`send-keys -t ${target} Enter`);
|
|
137
|
+
} finally {
|
|
138
|
+
try { unlinkSync(tmpFile); } catch {}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* pane에 키 입력 전송
|
|
144
|
+
* @param {string} target — 예: tfx-multi-abc:0.1
|
|
145
|
+
* @param {string} keys — tmux 키 표현 (예: 'C-c', 'Enter')
|
|
146
|
+
*/
|
|
147
|
+
export function sendKeys(target, keys) {
|
|
148
|
+
muxExec(`send-keys -t ${target} ${keys}`);
|
|
149
|
+
}
|