triflux 10.46.0 → 10.48.0

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.
@@ -0,0 +1,306 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { randomUUID } from "node:crypto";
3
+ import {
4
+ mkdirSync,
5
+ readdirSync,
6
+ readFileSync,
7
+ renameSync,
8
+ unlinkSync,
9
+ writeFileSync,
10
+ } from "node:fs";
11
+ import { homedir } from "node:os";
12
+ import { basename, join } from "node:path";
13
+
14
+ export function registryDir(env = process.env) {
15
+ if (env.TFX_CODEX_SESSION_REGISTRY_DIR) {
16
+ return env.TFX_CODEX_SESSION_REGISTRY_DIR;
17
+ }
18
+ return join(
19
+ env.XDG_STATE_HOME || join(env.HOME || homedir(), ".local", "state"),
20
+ "triflux",
21
+ "codex-sessions",
22
+ );
23
+ }
24
+
25
+ function defaultPsFn(pid) {
26
+ try {
27
+ const output = execFileSync(
28
+ "ps",
29
+ ["-o", "ppid=,comm=", "-p", String(pid)],
30
+ {
31
+ encoding: "utf8",
32
+ timeout: 1000,
33
+ },
34
+ );
35
+ const match = output.match(/^\s*(\d+)\s+(.+?)\s*$/);
36
+ return match ? { ppid: Number(match[1]), comm: match[2] } : null;
37
+ } catch {
38
+ return null;
39
+ }
40
+ }
41
+
42
+ export function findCodexAncestorPid({
43
+ startPid = process.ppid,
44
+ psFn = defaultPsFn,
45
+ maxDepth = 8,
46
+ } = {}) {
47
+ const seen = new Set();
48
+ let pid = startPid;
49
+ for (let depth = 0; depth < maxDepth; depth += 1) {
50
+ if (!Number.isInteger(pid) || pid <= 0 || seen.has(pid)) return null;
51
+ seen.add(pid);
52
+ let processInfo;
53
+ try {
54
+ processInfo = psFn(pid);
55
+ } catch {
56
+ return null;
57
+ }
58
+ if (!processInfo) return null;
59
+ if (basename(String(processInfo.comm || "")) === "codex") return pid;
60
+ pid = Number(processInfo.ppid);
61
+ }
62
+ return null;
63
+ }
64
+
65
+ function defaultTmuxFn(paneId) {
66
+ return execFileSync(
67
+ "tmux",
68
+ [
69
+ "display-message",
70
+ "-p",
71
+ "-t",
72
+ paneId,
73
+ "#{session_name}:#{window_id}.#{pane_id}",
74
+ ],
75
+ { encoding: "utf8", timeout: 1000 },
76
+ );
77
+ }
78
+
79
+ function defaultPanePidFn(paneId) {
80
+ return execFileSync(
81
+ "tmux",
82
+ ["display-message", "-p", "-t", paneId, "#{pane_pid}"],
83
+ { encoding: "utf8", timeout: 1000 },
84
+ );
85
+ }
86
+
87
+ function defaultCommandFn(pid) {
88
+ return execFileSync("ps", ["-o", "command=", "-p", String(pid)], {
89
+ encoding: "utf8",
90
+ timeout: 1000,
91
+ });
92
+ }
93
+
94
+ export function resolveTmuxCoordinate({ paneId, tmuxFn = defaultTmuxFn } = {}) {
95
+ if (typeof paneId !== "string" || !paneId.trim()) return null;
96
+ try {
97
+ const coordinate = tmuxFn(paneId).trim();
98
+ return /^.+:@\d+\.%\d+$/.test(coordinate) ? coordinate : null;
99
+ } catch {
100
+ return null;
101
+ }
102
+ }
103
+
104
+ function aliveFromPid(pid) {
105
+ try {
106
+ process.kill(pid, 0);
107
+ return true;
108
+ } catch (error) {
109
+ return error?.code !== "ESRCH";
110
+ }
111
+ }
112
+
113
+ function pruneDeadRecords(dir) {
114
+ try {
115
+ for (const fileName of readdirSync(dir)) {
116
+ if (!/^\d+\.json$/.test(fileName)) continue;
117
+ const pid = Number(fileName.slice(0, -5));
118
+ if (Number.isSafeInteger(pid) && pid > 0 && !aliveFromPid(pid)) {
119
+ try {
120
+ unlinkSync(join(dir, fileName));
121
+ } catch {
122
+ // Registry upkeep must never affect the hook response.
123
+ }
124
+ }
125
+ }
126
+ } catch {
127
+ // A concurrent removal or permission change must not affect the write.
128
+ }
129
+ }
130
+
131
+ export function writeCodexSessionRecord(
132
+ payload,
133
+ {
134
+ env = process.env,
135
+ now = Date.now,
136
+ psFn = defaultPsFn,
137
+ tmuxFn,
138
+ panePidFn = defaultPanePidFn,
139
+ commandFn = defaultCommandFn,
140
+ dir = registryDir(env),
141
+ } = {},
142
+ ) {
143
+ if (typeof payload?.session_id !== "string" || !payload.session_id.trim()) {
144
+ return false;
145
+ }
146
+ const paneId = typeof env.TMUX_PANE === "string" ? env.TMUX_PANE.trim() : "";
147
+ if (!paneId) return false;
148
+ const pid = findCodexAncestorPid({ psFn });
149
+ if (pid === null) return false;
150
+
151
+ try {
152
+ const command = commandFn(pid);
153
+ if (
154
+ typeof command !== "string" ||
155
+ !command.trim() ||
156
+ command.includes("app-server")
157
+ ) {
158
+ return false;
159
+ }
160
+ // Split ps argv on whitespace; the first non-option after the binary is the subcommand.
161
+ const subcommand = command
162
+ .trim()
163
+ .split(/\s+/)
164
+ .slice(1)
165
+ .find((arg) => !arg.startsWith("-"));
166
+ if (subcommand === "exec") return false;
167
+ const panePidOutput = String(panePidFn(paneId)).trim();
168
+ const panePid = Number(panePidOutput);
169
+ if (
170
+ !/^\d+$/.test(panePidOutput) ||
171
+ !Number.isSafeInteger(panePid) ||
172
+ panePid <= 0
173
+ ) {
174
+ return false;
175
+ }
176
+ const seen = new Set();
177
+ let ancestor = pid;
178
+ for (let depth = 0; depth < 8 && ancestor !== panePid; depth += 1) {
179
+ if (
180
+ !Number.isSafeInteger(ancestor) ||
181
+ ancestor <= 0 ||
182
+ seen.has(ancestor)
183
+ ) {
184
+ return false;
185
+ }
186
+ seen.add(ancestor);
187
+ ancestor = Number(psFn(ancestor)?.ppid);
188
+ }
189
+ if (ancestor !== panePid) return false;
190
+ } catch {
191
+ // Daemons and stale panes cannot prove which TUI owns this thread.
192
+ return false;
193
+ }
194
+
195
+ const timestamp = typeof now === "function" ? now() : now;
196
+ const targetDir = dir;
197
+ const target = join(targetDir, `${pid}.json`);
198
+ let startedAt = timestamp;
199
+ let source = payload.source || null;
200
+ try {
201
+ const existing = JSON.parse(readFileSync(target, "utf8"));
202
+ if (existing.pid === pid && existing.sessionId === payload.session_id) {
203
+ if (Number.isFinite(existing.startedAt)) startedAt = existing.startedAt;
204
+ if (payload.source === undefined) source = existing.source || null;
205
+ }
206
+ } catch {
207
+ // New record, or an invalid previous record.
208
+ }
209
+
210
+ const record = {
211
+ version: 1,
212
+ writer: "triflux",
213
+ pid,
214
+ sessionId: payload.session_id,
215
+ cwd: payload.cwd || process.cwd(),
216
+ tmux: resolveTmuxCoordinate({ paneId, tmuxFn }),
217
+ tmuxPane: paneId,
218
+ source,
219
+ startedAt,
220
+ updatedAt: timestamp,
221
+ };
222
+
223
+ mkdirSync(targetDir, { recursive: true, mode: 0o700 });
224
+ const temporary = join(
225
+ targetDir,
226
+ `.${pid}.${process.pid}.${randomUUID()}.tmp`,
227
+ );
228
+ try {
229
+ writeFileSync(temporary, `${JSON.stringify(record)}\n`, {
230
+ mode: 0o600,
231
+ flag: "wx",
232
+ });
233
+ renameSync(temporary, target);
234
+ } catch (error) {
235
+ try {
236
+ unlinkSync(temporary);
237
+ } catch {
238
+ // Keep the original write error.
239
+ }
240
+ throw error;
241
+ }
242
+ pruneDeadRecords(targetDir);
243
+ return true;
244
+ }
245
+
246
+ export function readCodexSessionRecords({
247
+ dir = registryDir(),
248
+ isAlive = aliveFromPid,
249
+ } = {}) {
250
+ let fileNames;
251
+ try {
252
+ fileNames = readdirSync(dir);
253
+ } catch {
254
+ return [];
255
+ }
256
+ const records = [];
257
+ for (const fileName of fileNames) {
258
+ if (!fileName.endsWith(".json")) continue;
259
+ try {
260
+ const record = JSON.parse(readFileSync(join(dir, fileName), "utf8"));
261
+ if (
262
+ record &&
263
+ Number.isSafeInteger(record.pid) &&
264
+ record.pid > 0 &&
265
+ typeof record.sessionId === "string" &&
266
+ record.sessionId &&
267
+ isAlive(record.pid)
268
+ ) {
269
+ records.push(record);
270
+ }
271
+ } catch {
272
+ // Ignore a malformed or concurrently removed record.
273
+ }
274
+ }
275
+ return records;
276
+ }
277
+
278
+ export function codexThreadNames({ indexPath } = {}) {
279
+ const path =
280
+ indexPath ||
281
+ join(
282
+ process.env.CODEX_HOME || join(process.env.HOME || homedir(), ".codex"),
283
+ "session_index.jsonl",
284
+ );
285
+ let data;
286
+ try {
287
+ data = readFileSync(path, "utf8");
288
+ } catch {
289
+ return new Map();
290
+ }
291
+ const names = new Map();
292
+ for (const line of data.split("\n")) {
293
+ try {
294
+ const entry = JSON.parse(line);
295
+ if (
296
+ typeof entry.id === "string" &&
297
+ typeof entry.thread_name === "string"
298
+ ) {
299
+ names.set(entry.id, entry.thread_name);
300
+ }
301
+ } catch {
302
+ // Ignore malformed or incomplete lines.
303
+ }
304
+ }
305
+ return names;
306
+ }
@@ -38,10 +38,9 @@ export function resolveRoleControlSnapshot(env = process.env, options = {}) {
38
38
  const ctoManagerEnabled = masterEnabled && isEnvOn(env, "TFX_CTO_MANAGER");
39
39
  const leadManagerEnabled =
40
40
  ctoManagerEnabled && isEnvOn(env, "TFX_LEAD_MANAGER");
41
- const northStarEnabled =
42
- masterEnabled && !isEnvOff(env, "TFX_CTO_NORTH_STAR");
41
+ const northStarEnabled = masterEnabled && isEnvOn(env, "TFX_CTO_NORTH_STAR");
43
42
  const autoCollectEnabled =
44
- masterEnabled && !isEnvOff(env, "TFX_CTO_AUTO_COLLECT");
43
+ masterEnabled && isEnvOn(env, "TFX_CTO_AUTO_COLLECT");
45
44
  const values = {
46
45
  master_enabled: masterEnabled,
47
46
  cto_manager_enabled: ctoManagerEnabled,
package/hub/server.mjs CHANGED
@@ -72,9 +72,7 @@ import {
72
72
  } from "./state.mjs";
73
73
  import { createStoreAdapter } from "./store-adapter.mjs";
74
74
  import { createCtoAutoCollector } from "./team/cto-auto-collect.mjs";
75
- import { createGitPreflight } from "./team/git-preflight.mjs";
76
75
  import { nativeProxy } from "./team/nativeProxy.mjs";
77
- import { createSwarmLocks } from "./team/swarm-locks.mjs";
78
76
  import {
79
77
  createSynapseRegistry,
80
78
  projectPeer,
@@ -119,14 +117,6 @@ const AIMD_WINDOW_MS = 30 * 60 * 1000;
119
117
  const AIMD_INITIAL_BATCH_SIZE = 3;
120
118
  const AIMD_MIN_BATCH_SIZE = 1;
121
119
  const AIMD_MAX_BATCH_SIZE = 10;
122
- const SYNAPSE_VALID_OPS = new Set([
123
- "checkout",
124
- "rebase",
125
- "cherry-pick",
126
- "reset",
127
- "stash-pop",
128
- "worktree-remove",
129
- ]);
130
120
  const HUB_IDLE_TIMEOUT_DEFAULT_MS = 30 * 60 * 1000;
131
121
  const HUB_IDLE_SWEEP_DEFAULT_MS = 60 * 1000;
132
122
  const STATIC_CONTENT_TYPES = Object.freeze({
@@ -1124,21 +1114,13 @@ export async function startHub({
1124
1114
  }
1125
1115
  const delegatorService = new DelegatorService({ worker: delegatorWorker });
1126
1116
 
1127
- // Synapse Layer 4: session registry + git preflight + swarm locks
1117
+ // Synapse Layer 4: session registry
1128
1118
  const synapseEmitter = new EventEmitter();
1129
1119
  synapseEmitter.setMaxListeners(50);
1130
1120
  const synapseRegistry = createSynapseRegistry({
1131
1121
  persistPath: join(CACHE_DIR, "tfx-hub", "synapse-sessions.json"),
1132
1122
  emitter: synapseEmitter,
1133
1123
  });
1134
- const swarmLocks = createSwarmLocks({
1135
- repoRoot: PROJECT_ROOT,
1136
- persistPath: join(CACHE_DIR, "tfx-hub", "swarm-locks.json"),
1137
- });
1138
- const gitPreflight = createGitPreflight({
1139
- registry: synapseRegistry,
1140
- locks: swarmLocks,
1141
- });
1142
1124
  const ctoAutoCollector = createCtoAutoCollector({
1143
1125
  registry: synapseRegistry,
1144
1126
  runCollect,
@@ -1437,7 +1419,7 @@ export async function startHub({
1437
1419
  });
1438
1420
  }
1439
1421
 
1440
- // ── Synapse Layer 5: session registry + locks + preflight routes ──
1422
+ // ── Synapse Layer 5: session registry routes ──
1441
1423
  // Admin/raw snapshot (loopback-only). Returns raw cwd/pid for local
1442
1424
  // admin/HUD use; the redacted peer surface is GET /synapse/peers.
1443
1425
  if (path === "/synapse/sessions" && req.method === "GET") {
@@ -1642,37 +1624,6 @@ export async function startHub({
1642
1624
  }
1643
1625
  }
1644
1626
 
1645
- if (path === "/synapse/locks" && req.method === "GET") {
1646
- return writeJson(res, 200, {
1647
- ok: true,
1648
- locks: swarmLocks.snapshot(),
1649
- ts: Date.now(),
1650
- });
1651
- }
1652
-
1653
- if (path === "/synapse/preflight" && req.method === "POST") {
1654
- try {
1655
- const body = await parseBody(req);
1656
- const { op, args = {}, sessionContext = {} } = body;
1657
- if (!op || typeof op !== "string") {
1658
- return writeJson(res, 400, { ok: false, error: "op 필수" });
1659
- }
1660
- if (!SYNAPSE_VALID_OPS.has(op)) {
1661
- return writeJson(res, 400, {
1662
- ok: false,
1663
- error: `invalid op: ${op}`,
1664
- });
1665
- }
1666
- const result = gitPreflight.check(op, args, sessionContext);
1667
- return writeJson(res, 200, { ok: true, ...result });
1668
- } catch (err) {
1669
- return writeJson(res, 400, {
1670
- ok: false,
1671
- error: String(err?.message || err),
1672
- });
1673
- }
1674
- }
1675
-
1676
1627
  if (path.startsWith("/bridge")) {
1677
1628
  const isBridgeStatusGet =
1678
1629
  path === "/bridge/status" && req.method === "GET";
@@ -1,6 +1,6 @@
1
1
  // hub/team/recovery-store.mjs — Best-effort preservation of worker changes
2
2
  // before a dirty worktree is removed. Uses file-based `.patch` + JSON manifest
3
- // instead of git stash (git-preflight flags stash-pop/worktree-remove as risky).
3
+ // instead of git stash, which is risky to pop under concurrent worktree use.
4
4
 
5
5
  import { execFile } from "node:child_process";
6
6
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
@@ -48,9 +48,9 @@ function hasDirtyFiles(session) {
48
48
  // A session is "live" while active OR idle. Idle is an interactive session that
49
49
  // missed its heartbeat interval but is still under the TTL — alive but inactive,
50
50
  // not presumed dead. getActive() and querySessions() share this single predicate
51
- // so the liveness contract can't drift: getActive() feeds git-preflight's
52
- // dirty-file conflict guard, so dropping idle there would hide a still-live
53
- // interactive session's claimed paths from that safety check.
51
+ // so the liveness contract can't drift: getActive() feeds peer discovery,
52
+ // CTO status/hygiene and log retention, so dropping idle there would hide a
53
+ // still-live interactive session from every one of those consumers.
54
54
  function isLiveStatus(status) {
55
55
  return status === "active" || status === "idle";
56
56
  }
@@ -337,7 +337,7 @@ export function createSynapseRegistry(opts = {}) {
337
337
  // session resuming: Claude Code re-fires SessionStart with the same
338
338
  // session_id on resume/clear/compact, so fall through and re-register
339
339
  // (revive) it. Otherwise the resumed-but-live session stays stale forever
340
- // and vanishes from peer-discovery AND git-preflight's dirty-file guard.
340
+ // and vanishes from peer-discovery.
341
341
  const existing = sessions.get(sessionId);
342
342
  if (existing && isLiveStatus(existing.status)) {
343
343
  console.warn(
@@ -381,10 +381,13 @@ export function createSynapseRegistry(opts = {}) {
381
381
  }
382
382
 
383
383
  // stale/expired 세션이 cutoff 넘게 누적되면 Map에서 제거.
384
- // live(active/idle)는 lastHeartbeat가 오래돼도 보존 — git-preflight dirty-file 가드가 의존.
385
- // Dirty stale rows keep the historical 24h window because same-id resume
386
- // revives their dirty-file guard; clean stale rows expire quickly to avoid
387
- // daily dummy rows after overnight operator gaps.
384
+ // live(active/idle) rows survive a long-stale lastHeartbeat because peer
385
+ // discovery and CTO status/hygiene still read them.
386
+ // Dirty stale rows keep the historical 24h window. Its original consumer,
387
+ // the git-preflight dirty-file guard, is gone and nothing populates
388
+ // dirtyFiles today, so this split is a candidate for collapsing into one
389
+ // window. Clean stale rows expire quickly to avoid daily dummy rows after
390
+ // overnight operator gaps.
388
391
  function pruneExpired(opts2 = {}) {
389
392
  if (destroyed) return { removed: [], count: 0 };
390
393
 
@@ -510,9 +513,9 @@ export function createSynapseRegistry(opts = {}) {
510
513
  }
511
514
 
512
515
  function getActive() {
513
- // Live = active or idle. git-preflight uses this to detect other live
514
- // sessions whose dirty files would conflict; an idle interactive session is
515
- // still live (process alive, dirty files on disk) and must stay visible.
516
+ // Live = active or idle. Peer discovery, CTO status/hygiene and log
517
+ // retention read this list; an idle interactive session is still live
518
+ // (process alive) and must stay visible to them.
516
519
  return [...sessions.values()]
517
520
  .filter((session) => isLiveStatus(session.status))
518
521
  .map((session) => cloneSession(session));
@@ -273,6 +273,8 @@ export async function ensureWorktree({
273
273
  * @param {string} opts.baseBranch
274
274
  * @param {string} [opts.rootDir=process.cwd()]
275
275
  * @returns {Promise<{ integrationBranch: string, baseCommit: string }>}
276
+ * @throws {Error} when the integration branch is checked out by another
277
+ * worktree; this is an intentional NO-GO and leaves that worktree untouched.
276
278
  */
277
279
  export async function prepareIntegrationBranch({
278
280
  runId,
@@ -299,42 +301,17 @@ export async function prepareIntegrationBranch({
299
301
  * Rebase a shard branch onto the integration branch.
300
302
  * Uses rebase + fast-forward only (no merge commits).
301
303
  *
302
- * Synapse v1: when a `preflight` checker + `sessionContext` are provided,
303
- * the rebase is pre-flighted against active sessions' dirty files/leases.
304
- * Blocked rebases return `{ ok: false, preflight: decision }` without touching
305
- * any branch. If preflight is omitted, behavior is unchanged.
306
- *
307
304
  * @param {object} opts
308
305
  * @param {string} opts.shardBranch — the shard's branch name
309
306
  * @param {string} opts.integrationBranch — target integration branch
310
307
  * @param {string} [opts.rootDir=process.cwd()]
311
- * @param {{ checkRebase: Function } | null} [opts.preflight=null] — git-preflight instance
312
- * @param {{ sessionId: string, workerId?: string } | null} [opts.sessionContext=null]
313
- * @returns {Promise<{ ok: boolean, headCommit?: string, strategy?: string, commits?: number, notes?: string, fallbackReason?: string, error?: string, preflight?: object }>}
308
+ * @returns {Promise<{ ok: boolean, headCommit?: string, strategy?: string, commits?: number, notes?: string, fallbackReason?: string, error?: string }>}
314
309
  */
315
310
  export async function rebaseShardOntoIntegration({
316
311
  shardBranch,
317
312
  integrationBranch,
318
313
  rootDir = process.cwd(),
319
- preflight = null,
320
- sessionContext = null,
321
314
  }) {
322
- // Synapse v1 pre-flight: bail out before mutating branches when another
323
- // session claims overlapping files.
324
- if (preflight && sessionContext) {
325
- const decision = preflight.checkRebase(
326
- { branch: integrationBranch },
327
- sessionContext,
328
- );
329
- if (!decision.allowed) {
330
- return {
331
- ok: false,
332
- error: `git-preflight blocked rebase: ${decision.reason || "overlap"}`,
333
- preflight: decision,
334
- };
335
- }
336
- }
337
-
338
315
  // #127 BUG-E accident history: this function used to checkout the
339
316
  // integration branch in rootDir, leak rootDir HEAD, and redirect later user
340
317
  // edits/commits into swarm/.../merge. Integration now happens exclusively in
@@ -458,6 +435,11 @@ export async function rebaseShardOntoIntegration({
458
435
  }
459
436
  } else {
460
437
  await rm(integrationWorktree, { recursive: true, force: true });
438
+ try {
439
+ await git(["worktree", "prune"], rootDir);
440
+ } catch {
441
+ /* best-effort metadata cleanup after a partial worktree add */
442
+ }
461
443
  }
462
444
  }
463
445
  }
@@ -524,40 +506,18 @@ export async function cleanupWorktree({
524
506
  * Remove a worktree and its branch.
525
507
  * Follows WT race-guard: sleep between operations.
526
508
  *
527
- * Synapse v1: when `preflight` + `sessionContext` are provided, the removal
528
- * is pre-flighted against active sessions — blocked if another session is
529
- * still registered to this worktree path.
530
- *
531
509
  * @param {object} opts
532
510
  * @param {string} opts.worktreePath
533
511
  * @param {string} [opts.branchName] — optional branch to delete
534
512
  * @param {string} [opts.rootDir=process.cwd()]
535
513
  * @param {boolean} [opts.force=false]
536
- * @param {{ checkWorktreeRemove: Function } | null} [opts.preflight=null]
537
- * @param {{ sessionId: string, workerId?: string } | null} [opts.sessionContext=null]
538
514
  */
539
515
  export async function pruneWorktree({
540
516
  worktreePath,
541
517
  branchName,
542
518
  rootDir = process.cwd(),
543
519
  force = false,
544
- preflight = null,
545
- sessionContext = null,
546
520
  }) {
547
- if (preflight && sessionContext) {
548
- const decision = preflight.checkWorktreeRemove(
549
- { worktreePath },
550
- sessionContext,
551
- );
552
- if (!decision.allowed) {
553
- return {
554
- ok: false,
555
- error: `git-preflight blocked worktree-remove: ${decision.reason || "active_worktree"}`,
556
- preflight: decision,
557
- };
558
- }
559
- }
560
-
561
521
  const cleanupResult = await cleanupWorktree({
562
522
  worktreePath,
563
523
  branchName,
@@ -120,7 +120,7 @@ export function spawnTrayForHub({
120
120
  cwd = process.cwd(),
121
121
  spawnFn = spawn,
122
122
  } = {}) {
123
- if (env?.TFX_HUB_AUTO_TRAY === "0") return { status: "disabled" };
123
+ if (env?.TFX_HUB_AUTO_TRAY !== "1") return { status: "disabled" };
124
124
  if (isWorktreeOrEphemeralHubContext({ cwd, env })) {
125
125
  return { status: "disabled", reason: "ephemeral-or-worktree-context" };
126
126
  }
@@ -120,7 +120,7 @@ function readTomlScalar(raw, key) {
120
120
  }
121
121
 
122
122
  /**
123
- * Resolve a Codex effort profile name (e.g. "gpt6_sol_high") to its concrete
123
+ * Resolve a Codex effort profile name (e.g. "gpt61_sol_high") to its concrete
124
124
  * `model` + reasoning effort. SSOT = the per-profile file written by
125
125
  * `tfx setup` at `~/.codex/<profile>.config.toml`. Falls back to deriving the
126
126
  * effort from the `<...>_<effort>` naming convention when the file is absent.
@@ -15,7 +15,7 @@ const MAX_CAPTURE_BYTES = 256 * 1024;
15
15
  const MAX_TOP_KEYS = 20;
16
16
 
17
17
  // stdin 이 context_window_size 를 제공하지 않을 때 모델 ID 로 한도를 추정한다.
18
- // Anthropic 공식 문서(2026-09-22 기준): Opus 4.6 이상, Sonnet 4.6/5,
18
+ // Anthropic 공식 문서(2026-09-30 기준): Opus 4.6 이상, Sonnet 4.6/5/5.5,
19
19
  // Fable 5/5.1 = 1M. Sonnet 4.5 / Haiku 4.5 = 200K이며 [1m]도 유지한다.
20
20
  const MODEL_HINT_1M_PREFIXES = [
21
21
  "claude-sonnet-4-6",