triflux 6.0.6 → 6.0.7

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.
@@ -20,6 +20,15 @@ import {
20
20
 
21
21
  const RESULT_DIR = join(tmpdir(), "tfx-headless");
22
22
 
23
+ /** CLI별 브랜드 — 이모지 + ANSI 색상 (시각적 구분) */
24
+ const CLI_BRAND = {
25
+ codex: { emoji: "\u{1F7E2}", label: "Codex", ansi: "\x1b[32m" }, // 🟢 green
26
+ gemini: { emoji: "\u{1F535}", label: "Gemini", ansi: "\x1b[34m" }, // 🔵 blue
27
+ claude: { emoji: "\u{1F7E0}", label: "Claude", ansi: "\x1b[33m" }, // 🟠 yellow/orange
28
+ };
29
+ const ANSI_RESET = "\x1b[0m";
30
+ const ANSI_DIM = "\x1b[2m";
31
+
23
32
  /**
24
33
  * CLI별 헤드리스 명령 빌더
25
34
  * @param {'codex'|'gemini'|'claude'} cli
@@ -96,25 +105,34 @@ export async function runHeadless(sessionName, assignments, opts = {}) {
96
105
 
97
106
  dispatches = assignments.map((assignment, i) => {
98
107
  const paneName = `worker-${i + 1}`;
108
+ const brand = CLI_BRAND[assignment.cli] || { emoji: "\u{25CF}", label: assignment.cli, ansi: "" };
99
109
  const paneTitle = assignment.role
100
- ? `${assignment.cli} (${assignment.role})`
101
- : `${assignment.cli}-${i + 1}`;
102
-
103
- // split-window로 새 pane 추가 — paneId 직접 획득
104
- const newPaneId = psmuxExec([
105
- "split-window", "-t", sessionName, "-P", "-F",
106
- "#{session_name}:#{window_index}.#{pane_index}",
107
- ]);
110
+ ? `${brand.emoji} ${assignment.cli} (${assignment.role})`
111
+ : `${brand.emoji} ${assignment.cli}-${i + 1}`;
112
+
113
+ let newPaneId;
114
+ if (i === 0) {
115
+ // 번째 워커: 빈 lead pane을 직접 사용 (빈 pane 제거)
116
+ newPaneId = `${sessionName}:0.0`;
117
+ } else {
118
+ // 2번째+: split-window로 추가
119
+ newPaneId = psmuxExec([
120
+ "split-window", "-t", sessionName, "-P", "-F",
121
+ "#{session_name}:#{window_index}.#{pane_index}",
122
+ ]);
123
+ }
108
124
 
109
- // 타이틀 설정
125
+ // 타이틀 설정 (이모지 포함)
110
126
  try { psmuxExec(["select-pane", "-t", newPaneId, "-T", paneTitle]); } catch { /* 무시 */ }
111
127
 
112
128
  if (safeProgress) safeProgress({ type: "worker_added", paneName, cli: assignment.cli, paneTitle });
113
129
 
114
- // 캡처 시작 + 명령 dispatch (paneId 직접 사용 — resolvePane race 회피)
130
+ // 캡처 시작 + 컬러 배너 + 명령 dispatch
115
131
  const resultFile = join(RESULT_DIR, `${sessionName}-${paneName}.txt`).replace(/\\/g, "/");
116
132
  const cmd = buildHeadlessCommand(assignment.cli, assignment.prompt, resultFile);
117
133
  startCapture(sessionName, newPaneId);
134
+ // pane 간 pipe-pane EBUSY 방지 — capture 스크립트 파일 잠금 해제 대기
135
+ if (i > 0) { try { Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 300); } catch {} }
118
136
  const dispatch = dispatchCommand(sessionName, newPaneId, cmd);
119
137
 
120
138
  if (safeProgress) safeProgress({ type: "dispatched", paneName, cli: assignment.cli });
@@ -276,17 +294,16 @@ export function autoAttachTerminal(sessionName, opts = {}) {
276
294
  return false; // wt.exe 미설치 — 사용자에게 수동 attach 안내 필요
277
295
  }
278
296
 
279
- // PowerShell 래핑 wt가 psmux를 파일로 인식하는 문제 방지
280
- // "--" 구분자 필수: -NoExit 등이 wt 옵션으로 해석되는 것 방지
297
+ // PowerShell 래핑 + "--" 구분자 + 포커스 비탈취
281
298
  // pwsh.exe (PS7) 우선, 없으면 powershell.exe (PS5.1) fallback
282
299
  const shells = ["pwsh.exe", "powershell.exe"];
283
300
  for (const shell of shells) {
284
301
  try {
285
- execFileSync("wt.exe", [
286
- "nt", "--title", "triflux", "--",
287
- shell, "-NoExit", "-Command",
288
- `psmux attach -t ${sessionName}`,
289
- ], { stdio: "ignore" });
302
+ // start "" /b — 포커스를 현재 창에 유지 (사용자 타이핑 보호)
303
+ execSync(
304
+ `start "" /b wt.exe nt --title triflux -- ${shell} -NoExit -Command "psmux attach -t ${sessionName}"`,
305
+ { stdio: "ignore", shell: true, timeout: 5000 },
306
+ );
290
307
  return true;
291
308
  } catch { /* 다음 shell 시도 */ }
292
309
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triflux",
3
- "version": "6.0.6",
3
+ "version": "6.0.7",
4
4
  "description": "CLI-first multi-model orchestrator for Claude Code — route tasks to Codex, Gemini, and Claude",
5
5
  "type": "module",
6
6
  "bin": {