triflux 6.1.0 → 6.1.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/hub/team/headless.mjs +20 -16
- package/package.json +1 -1
- package/scripts/setup.mjs +31 -7
package/hub/team/headless.mjs
CHANGED
|
@@ -452,12 +452,10 @@ export function autoAttachTerminal(sessionName, opts = {}, workerCount = 2) {
|
|
|
452
452
|
} catch { /* fallthrough to window */ }
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
-
// v6.0
|
|
456
|
-
// 1. 현재 HWND 캡처 → 2. WT 열기(읽기전용 뷰어) → 3. 새 창 즉시 최소화
|
|
457
|
-
// → Windows가 자동으로 이전 창에 포커스 복원. 사용자는 작업표시줄에서 확인.
|
|
455
|
+
// v6.1.0: 읽기전용 뷰어 + 포커스 복원 + 윈도우 배치
|
|
458
456
|
const logDir = join(tmpdir(), "psmux-steering", sessionName).replace(/\\/g, "/");
|
|
459
|
-
const cols = Math.max(100, 60 + workerCount * 15);
|
|
460
|
-
const rows = Math.max(25, 15 + workerCount * 4);
|
|
457
|
+
const cols = opts.cols || Math.max(100, 60 + workerCount * 15);
|
|
458
|
+
const rows = opts.rows || Math.max(25, 15 + workerCount * 4);
|
|
461
459
|
|
|
462
460
|
// 읽기전용 뷰어 스크립트 생성
|
|
463
461
|
const viewerScript = join(tmpdir(), "tfx-viewer-" + sessionName + ".ps1").replace(/\\/g, "/");
|
|
@@ -471,25 +469,31 @@ export function autoAttachTerminal(sessionName, opts = {}, workerCount = 2) {
|
|
|
471
469
|
"Get-Content -Path '" + logDir + "\\*.log' -Wait -Tail 50",
|
|
472
470
|
].join("\n"), "utf8");
|
|
473
471
|
|
|
474
|
-
//
|
|
475
|
-
//
|
|
472
|
+
// T1 fix: 현재 HWND를 먼저 저장 → 탭 추가 → 즉시 원래 탭으로 복귀
|
|
473
|
+
// 2단계 포커스 복원: (1) 탭 추가 전 HWND 캡처 (2) 탭 추가 후 150ms+SendKeys
|
|
474
|
+
const saveHwndScript = [
|
|
475
|
+
"Add-Type -AssemblyName System.Windows.Forms",
|
|
476
|
+
"$before = [System.Windows.Forms.Form]::ActiveForm",
|
|
477
|
+
// 150ms로 단축 (300ms → 150ms) — WT 탭 생성은 ~100ms
|
|
478
|
+
"Start-Sleep -Milliseconds 150",
|
|
479
|
+
"[System.Windows.Forms.SendKeys]::SendWait('^+{TAB}')",
|
|
480
|
+
].join("; ");
|
|
481
|
+
|
|
482
|
+
// WT new-tab은 --size 미지원 (window-level only). 기존 창(-w 0)에 탭 추가만.
|
|
483
|
+
const wtArgs = ["-w", "0", "nt", "--profile", "triflux", "--title", sessionName];
|
|
484
|
+
wtArgs.push("--", "pwsh.exe", "-NoProfile", "-NoLogo", "-File", viewerScript);
|
|
485
|
+
|
|
476
486
|
try {
|
|
477
|
-
const child = spawn("wt.exe",
|
|
478
|
-
"-w", "0", "nt",
|
|
479
|
-
"--profile", "triflux",
|
|
480
|
-
"--title", sessionName,
|
|
481
|
-
"--", "pwsh.exe", "-NoProfile", "-NoLogo", "-File", viewerScript,
|
|
482
|
-
], { detached: true, stdio: "ignore" });
|
|
487
|
+
const child = spawn("wt.exe", wtArgs, { detached: true, stdio: "ignore" });
|
|
483
488
|
child.unref();
|
|
484
489
|
} catch {
|
|
485
490
|
return false;
|
|
486
491
|
}
|
|
487
492
|
|
|
488
|
-
//
|
|
489
|
-
const prevTabScript = "Start-Sleep -Milliseconds 300; Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SendKeys]::SendWait('^+{TAB}')";
|
|
493
|
+
// T1: 포커스 복원 (150ms — 기존 300ms에서 단축)
|
|
490
494
|
for (const shell of ["pwsh.exe", "powershell.exe"]) {
|
|
491
495
|
try {
|
|
492
|
-
spawn(shell, ["-NoProfile", "-NonInteractive", "-Command",
|
|
496
|
+
spawn(shell, ["-NoProfile", "-NonInteractive", "-Command", saveHwndScript], {
|
|
493
497
|
detached: true, stdio: "ignore",
|
|
494
498
|
}).unref();
|
|
495
499
|
break;
|
package/package.json
CHANGED
package/scripts/setup.mjs
CHANGED
|
@@ -15,6 +15,19 @@ const CLAUDE_DIR = join(homedir(), ".claude");
|
|
|
15
15
|
const CODEX_DIR = join(homedir(), ".codex");
|
|
16
16
|
const CODEX_CONFIG_PATH = join(CODEX_DIR, "config.toml");
|
|
17
17
|
|
|
18
|
+
// ── 로컬 개발 모드 감지 ──
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* PLUGIN_ROOT에 .git 디렉토리가 존재하면 dev mode (git clone 직접 사용)로 판정.
|
|
22
|
+
* @param {string} [root] - 검사할 루트 경로 (기본: PLUGIN_ROOT)
|
|
23
|
+
* @returns {boolean}
|
|
24
|
+
*/
|
|
25
|
+
function detectDevMode(root = PLUGIN_ROOT) {
|
|
26
|
+
return existsSync(join(root, ".git"));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const BREADCRUMB_PATH = join(CLAUDE_DIR, "scripts", ".tfx-pkg-root");
|
|
30
|
+
|
|
18
31
|
const REQUIRED_CODEX_PROFILES = [
|
|
19
32
|
{
|
|
20
33
|
name: "high",
|
|
@@ -200,9 +213,20 @@ function ensureCodexProfiles() {
|
|
|
200
213
|
}
|
|
201
214
|
}
|
|
202
215
|
|
|
203
|
-
export { replaceProfileSection, hasProfileSection };
|
|
216
|
+
export { replaceProfileSection, hasProfileSection, detectDevMode, SYNC_MAP, BREADCRUMB_PATH, PLUGIN_ROOT, CLAUDE_DIR };
|
|
204
217
|
|
|
205
218
|
async function main() {
|
|
219
|
+
const isSync = process.argv.includes("--sync");
|
|
220
|
+
const isDev = detectDevMode();
|
|
221
|
+
|
|
222
|
+
if (isDev) {
|
|
223
|
+
console.log(" [dev] \uB85C\uCEEC \uAC1C\uBC1C \uBAA8\uB4DC \uAC10\uC9C0");
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (isSync) {
|
|
227
|
+
console.log(" [sync] \uBA85\uC2DC\uC801 \uC7AC\uB3D9\uAE30\uD654 \uC2E4\uD589");
|
|
228
|
+
}
|
|
229
|
+
|
|
206
230
|
let synced = 0;
|
|
207
231
|
|
|
208
232
|
for (const { src, dst, label } of SYNC_MAP) {
|
|
@@ -257,16 +281,16 @@ if (!existsSync(mcpSdkPath) && existsSync(srcNodeModules)) {
|
|
|
257
281
|
// ── 패키지 루트 breadcrumb 기록 ──
|
|
258
282
|
// tfx-route.sh가 hub/server.mjs, hub/bridge.mjs를 찾을 수 있도록
|
|
259
283
|
// 패키지 루트 경로를 ~/.claude/scripts/.tfx-pkg-root에 기록한다.
|
|
284
|
+
// dev mode에서는 항상 최신 경로를 기록 (--sync 시 강제 갱신).
|
|
260
285
|
{
|
|
261
|
-
const breadcrumbPath = join(CLAUDE_DIR, "scripts", ".tfx-pkg-root");
|
|
262
286
|
const pkgRootForward = PLUGIN_ROOT.replace(/\\/g, "/");
|
|
263
|
-
const currentBreadcrumb = existsSync(
|
|
264
|
-
? readFileSync(
|
|
287
|
+
const currentBreadcrumb = existsSync(BREADCRUMB_PATH)
|
|
288
|
+
? readFileSync(BREADCRUMB_PATH, "utf8").trim()
|
|
265
289
|
: "";
|
|
266
|
-
if (currentBreadcrumb !== pkgRootForward) {
|
|
267
|
-
const breadcrumbDir = dirname(
|
|
290
|
+
if (currentBreadcrumb !== pkgRootForward || isSync) {
|
|
291
|
+
const breadcrumbDir = dirname(BREADCRUMB_PATH);
|
|
268
292
|
if (!existsSync(breadcrumbDir)) mkdirSync(breadcrumbDir, { recursive: true });
|
|
269
|
-
writeFileSync(
|
|
293
|
+
writeFileSync(BREADCRUMB_PATH, pkgRootForward + "\n", "utf8");
|
|
270
294
|
synced++;
|
|
271
295
|
}
|
|
272
296
|
}
|