@triflux/core 10.44.0 → 10.45.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.
package/hud/renderers.mjs CHANGED
@@ -22,11 +22,9 @@ import {
22
22
  import {
23
23
  ACCOUNT_LABEL_WIDTH,
24
24
  FIVE_HOUR_MS,
25
- LEGACY_SV_ACCUMULATOR,
26
25
  ONE_DAY_MS,
27
26
  PROVIDER_PREFIX_WIDTH,
28
27
  SEVEN_DAY_MS,
29
- SV_ACCUMULATOR_PATH,
30
28
  TEAM_STATE_PATH,
31
29
  } from "./constants.mjs";
32
30
  import { buildContextUsageView } from "./context-monitor.mjs";
@@ -40,13 +38,11 @@ import {
40
38
  formatResetRemaining,
41
39
  formatResetRemainingDayHour,
42
40
  formatSavings,
43
- formatSvPct,
44
41
  formatTimeCell,
45
42
  formatTimeCellDH,
46
43
  formatTokenCount,
47
44
  padAnsiRight,
48
45
  readJson,
49
- readJsonMigrate,
50
46
  stripAnsi,
51
47
  truncateAnsi,
52
48
  } from "./utils.mjs";
@@ -88,25 +84,6 @@ export function readLatestBenchmarkDiff() {
88
84
  }
89
85
  }
90
86
 
91
- // 토큰 절약액 누적치 읽기 (tfx-auto token tracker)
92
- export function readTokenSavings() {
93
- const savingsPath = join(
94
- homedir(),
95
- ".omc",
96
- "state",
97
- "tfx-auto-tokens",
98
- "savings-total.json",
99
- );
100
- const data = readJson(savingsPath, null);
101
- if (!data || data.totalSaved === 0) return null;
102
- return data;
103
- }
104
-
105
- // sv-accumulator.json에서 누적 토큰/비용 읽기
106
- export function readSvAccumulator() {
107
- return readJsonMigrate(SV_ACCUMULATOR_PATH, LEGACY_SV_ACCUMULATOR, null);
108
- }
109
-
110
87
  /**
111
88
  * 파이프라인 벤치마크 diff 결과를 HUD 요약 문자열로 포맷
112
89
  */
@@ -279,9 +256,12 @@ export function getMicroLine(
279
256
  codexBuckets,
280
257
  geminiSession,
281
258
  geminiBucket,
282
- combinedSvPct,
283
259
  geminiMarker = "g",
260
+ options = {},
284
261
  ) {
262
+ // showCodex / showGemini 는 machine profile 의 TFX_DISABLE_* 게이트다. 기본값이
263
+ // true 라 8번째 인자를 주지 않는 기존 호출은 그대로 동작한다.
264
+ const { showCodex = true, showGemini = true } = options;
285
265
  const ctxView = contextView || buildContextUsageView({}, null);
286
266
  // Claude 5h/1w
287
267
  const cF =
@@ -325,34 +305,27 @@ export function getMicroLine(
325
305
  gVal = dim("--");
326
306
  }
327
307
 
328
- // sv
329
- const sv = formatSvPct(combinedSvPct).trim();
330
-
331
308
  const cols = getTerminalColumns() || 120;
332
- const line =
333
- `${bold(claudeOrange("c"))}${dim(":")}${cVal} ` +
334
- `${bold(codexWhite("x"))}${dim(":")}${xVal} ` +
335
- `${bold(geminiBlue(geminiMarker))}${dim(":")}${gVal} ` +
336
- `${dim("sv:")}${sv} ` +
337
- `${dim("CTX:")}${colorByPercent(ctxView.percent, ctxView.display)}`;
338
- return truncateAnsi(line, cols);
309
+ // 세그먼트를 모아 join 한다. 차단된 프로바이더를 뺄 때 공백이 겹치지 않는다.
310
+ const segments = [`${bold(claudeOrange("c"))}${dim(":")}${cVal}`];
311
+ if (showCodex) {
312
+ segments.push(`${bold(codexWhite("x"))}${dim(":")}${xVal}`);
313
+ }
314
+ if (showGemini) {
315
+ segments.push(`${bold(geminiBlue(geminiMarker))}${dim(":")}${gVal}`);
316
+ }
317
+ segments.push(
318
+ `${dim("CTX:")}${colorByPercent(ctxView.percent, ctxView.display)}`,
319
+ );
320
+ return truncateAnsi(segments.join(" "), cols);
339
321
  }
340
322
 
341
323
  // ============================================================================
342
324
  // Claude 행 렌더러
343
325
  // ============================================================================
344
- export function getClaudeRows(
345
- currentTier,
346
- contextView,
347
- claudeUsage,
348
- combinedSvPct,
349
- ) {
326
+ export function getClaudeRows(currentTier, contextView, claudeUsage) {
350
327
  const ctxView = contextView || buildContextUsageView({}, null);
351
328
  const prefix = `${bold(claudeOrange("c"))}:`;
352
- // 절약 퍼센트
353
- const svStr = formatSvPct(combinedSvPct);
354
- const svSuffix = `${dim("sv:")}${svStr}`;
355
-
356
329
  // API 실측 데이터
357
330
  const fiveHourPercent = claudeUsage?.fiveHourPercent ?? null;
358
331
  const weeklyPercent = claudeUsage?.weeklyPercent ?? null;
@@ -418,7 +391,7 @@ export function getClaudeRows(
418
391
  const warning = ctxView.warningTag
419
392
  ? ` ${dim("|")} ${yellow(ctxView.warningTag)}`
420
393
  : "";
421
- const contextSection = `${svSuffix} ${dim("|")} ${dim("CTX:")}${colorByPercent(ctxView.percent, ctxView.display)}${warning}`;
394
+ const contextSection = `${dim("CTX:")}${colorByPercent(ctxView.percent, ctxView.display)}${warning}`;
422
395
  return [{ prefix, left: quotaSection, right: contextSection }];
423
396
  }
424
397
 
@@ -428,7 +401,7 @@ export function getClaudeRows(
428
401
  const warning = ctxView.warningTag
429
402
  ? ` ${dim("|")} ${yellow(ctxView.warningTag)}`
430
403
  : "";
431
- const contextSection = `${svSuffix} ${dim("|")} ${dim("CTX:")}${colorByPercent(ctxView.percent, ctxView.display)}${warning}`;
404
+ const contextSection = `${dim("CTX:")}${colorByPercent(ctxView.percent, ctxView.display)}${warning}`;
432
405
  return [{ prefix, left: quotaSection, right: contextSection }];
433
406
  }
434
407
 
@@ -513,7 +486,6 @@ export function getProviderRow(
513
486
  accountsState,
514
487
  realQuota,
515
488
  codexEmail,
516
- savingsMultiplier,
517
489
  modelLabel,
518
490
  ) {
519
491
  const accountLabel = fitText(
@@ -521,10 +493,6 @@ export function getProviderRow(
521
493
  ACCOUNT_LABEL_WIDTH,
522
494
  );
523
495
 
524
- // 절약 퍼센트 섹션
525
- const svPct =
526
- savingsMultiplier != null ? Math.round(savingsMultiplier * 100) : null;
527
- const svStr = formatSvPct(svPct);
528
496
  const _modelLabelStr = modelLabel ? ` ${markerColor(modelLabel)}` : "";
529
497
 
530
498
  // 프로바이더별 색상 프로필
@@ -708,10 +676,7 @@ export function getProviderRow(
708
676
  quotaSection = `${dim("5h:")}${dim(formatPlaceholderPercentCell())} ${dim(formatTimeCell("n/a"))} ${dim("1w:")}${dim(formatPlaceholderPercentCell())} ${dim(formatTimeCellDH("--d--h"))}`;
709
677
  }
710
678
  const prefix = `${bold(markerColor(`${marker}`))}:`;
711
- const compactRight = [
712
- svStr ? `${dim("sv:")}${svStr}` : "",
713
- accountLabel ? markerColor(accountLabel) : "",
714
- ]
679
+ const compactRight = [accountLabel ? markerColor(accountLabel) : ""]
715
680
  .filter(Boolean)
716
681
  .join(" ");
717
682
  return { prefix, left: quotaSection, right: compactRight };
@@ -800,11 +765,8 @@ export function getProviderRow(
800
765
 
801
766
  const prefix = `${bold(markerColor(`${marker}`))}:`;
802
767
  const accountSection = `${markerColor(accountLabel)}`;
803
- const svSection = svStr ? `${dim("sv:")}${svStr}` : "";
804
768
  const modelLabelSection = modelLabel ? markerColor(modelLabel) : "";
805
- const rightParts = [svSection, accountSection, modelLabelSection].filter(
806
- Boolean,
807
- );
769
+ const rightParts = [accountSection, modelLabelSection].filter(Boolean);
808
770
  return {
809
771
  prefix,
810
772
  left: quotaSection,
package/hud/utils.mjs CHANGED
@@ -5,11 +5,7 @@
5
5
  import { createHash } from "node:crypto";
6
6
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
7
7
  import { dirname } from "node:path";
8
- import {
9
- PERCENT_CELL_WIDTH,
10
- SV_CELL_WIDTH,
11
- TIME_CELL_INNER_WIDTH,
12
- } from "./constants.mjs";
8
+ import { PERCENT_CELL_WIDTH, TIME_CELL_INNER_WIDTH } from "./constants.mjs";
13
9
 
14
10
  export async function readStdinJson() {
15
11
  if (process.stdin.isTTY) return {};
@@ -338,16 +334,6 @@ export function createHttpsPost(https, timeoutMs) {
338
334
  };
339
335
  }
340
336
 
341
- // sv 퍼센트 포맷 (1000+ → k 표기, 5자 고정폭)
342
- export function formatSvPct(value) {
343
- if (value == null) return "--%".padStart(SV_CELL_WIDTH);
344
- if (value >= 10000)
345
- return `${Math.round(value / 1000)}k%`.padStart(SV_CELL_WIDTH);
346
- if (value >= 1000)
347
- return `${(value / 1000).toFixed(1)}k%`.padStart(SV_CELL_WIDTH);
348
- return `${value}%`.padStart(SV_CELL_WIDTH);
349
- }
350
-
351
337
  export function formatSavings(dollars) {
352
338
  if (dollars >= 100) return `$${Math.round(dollars)}`;
353
339
  if (dollars >= 10) return `$${dollars.toFixed(1)}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triflux/core",
3
- "version": "10.44.0",
3
+ "version": "10.45.0",
4
4
  "description": "triflux core — CLI routing, pipeline, adapters. Zero native dependencies.",
5
5
  "type": "module",
6
6
  "main": "hub/index.mjs",
@@ -1,6 +1,9 @@
1
1
  // Canonical Codex role policy. Concrete model IDs stay in profile config files.
2
2
 
3
- import { resolveCodexProfileConfigValues } from "./codex-profile-config.mjs";
3
+ import {
4
+ normalizeCodexProfileName,
5
+ resolveCodexProfileConfigValues,
6
+ } from "./codex-profile-config.mjs";
4
7
 
5
8
  const policy = {
6
9
  executor: {
@@ -44,7 +47,7 @@ const policy = {
44
47
  subcommand: "exec",
45
48
  },
46
49
  debugger: {
47
- profile: "gpt56_sol_xhigh",
50
+ profile: "gpt6_astra_xhigh",
48
51
  timeoutSec: 900,
49
52
  runMode: "bg",
50
53
  opusOversight: false,
@@ -52,7 +55,7 @@ const policy = {
52
55
  subcommand: "exec",
53
56
  },
54
57
  "deep-executor": {
55
- profile: "gpt56_sol_xhigh",
58
+ profile: "gpt6_astra_xhigh",
56
59
  timeoutSec: 3600,
57
60
  runMode: "bg",
58
61
  opusOversight: true,
@@ -60,7 +63,7 @@ const policy = {
60
63
  subcommand: "exec",
61
64
  },
62
65
  architect: {
63
- profile: "gpt56_sol_xhigh",
66
+ profile: "gpt6_astra_xhigh",
64
67
  timeoutSec: 3600,
65
68
  runMode: "bg",
66
69
  opusOversight: true,
@@ -68,7 +71,7 @@ const policy = {
68
71
  subcommand: "exec",
69
72
  },
70
73
  critic: {
71
- profile: "gpt56_sol_xhigh",
74
+ profile: "gpt6_astra_xhigh",
72
75
  timeoutSec: 3600,
73
76
  runMode: "bg",
74
77
  opusOversight: true,
@@ -76,7 +79,7 @@ const policy = {
76
79
  subcommand: "exec",
77
80
  },
78
81
  planner: {
79
- profile: "gpt56_sol_xhigh",
82
+ profile: "gpt6_astra_xhigh",
80
83
  timeoutSec: 3600,
81
84
  runMode: "fg",
82
85
  opusOversight: true,
@@ -84,7 +87,7 @@ const policy = {
84
87
  subcommand: "exec",
85
88
  },
86
89
  analyst: {
87
- profile: "gpt56_sol_xhigh",
90
+ profile: "gpt6_astra_xhigh",
88
91
  timeoutSec: 3600,
89
92
  runMode: "fg",
90
93
  opusOversight: true,
@@ -108,7 +111,7 @@ const policy = {
108
111
  subcommand: "review",
109
112
  },
110
113
  "security-reviewer": {
111
- profile: "gpt56_sol_xhigh",
114
+ profile: "gpt6_astra_xhigh",
112
115
  timeoutSec: 1800,
113
116
  runMode: "bg",
114
117
  opusOversight: true,
@@ -132,7 +135,7 @@ const policy = {
132
135
  subcommand: "exec",
133
136
  },
134
137
  "scientist-deep": {
135
- profile: "gpt56_sol_xhigh",
138
+ profile: "gpt6_astra_xhigh",
136
139
  timeoutSec: 3600,
137
140
  runMode: "bg",
138
141
  opusOversight: false,
@@ -174,7 +177,7 @@ const policy = {
174
177
  // These entries are only for explicit direct-Codex overrides. agent-map.json
175
178
  // remains the provider-selection authority for their normal execution.
176
179
  designer: {
177
- profile: "gpt56_sol_xhigh",
180
+ profile: "gpt6_astra_xhigh",
178
181
  timeoutSec: 900,
179
182
  runMode: "bg",
180
183
  opusOversight: false,
@@ -210,9 +213,9 @@ export const CANONICAL_CODEX_PROFILE_OVERRIDES = Object.freeze(
210
213
  "gpt56_luna_low",
211
214
  "gpt56_terra_med",
212
215
  "gpt56_terra_high",
213
- "gpt56_sol_xhigh",
214
- "gpt56_sol_max",
215
- "gpt56_sol_ultra",
216
+ "gpt6_astra_xhigh",
217
+ "gpt6_astra_max",
218
+ "gpt6_astra_ultra",
216
219
  ]),
217
220
  );
218
221
  export const ULTRA_ELIGIBLE_CODEX_AGENTS = Object.freeze(
@@ -222,8 +225,8 @@ export const ULTRA_ELIGIBLE_CODEX_AGENTS = Object.freeze(
222
225
  const NESTED_GLOBAL_PROFILE_OVERRIDES = new Set([
223
226
  "max",
224
227
  "ultra",
225
- "gpt56_sol_max",
226
- "gpt56_sol_ultra",
228
+ "gpt6_astra_max",
229
+ "gpt6_astra_ultra",
227
230
  ]);
228
231
 
229
232
  export function resolveCodexAgentPolicy(agent) {
@@ -251,14 +254,16 @@ export function resolveCodexAgentProfile(
251
254
  ) {
252
255
  const defaultProfile = resolveCodexAgentPolicy(agent).profile;
253
256
  const retryRequested = String(retryProfile ?? "").trim();
254
- const requested = retryRequested || String(profileOverride || "auto").trim();
257
+ const requested = normalizeCodexProfileName(
258
+ retryRequested || String(profileOverride || "auto").trim(),
259
+ );
255
260
  if (!requested || requested === "auto") return defaultProfile;
256
261
 
257
262
  const canonical =
258
263
  requested === "max"
259
- ? "gpt56_sol_max"
264
+ ? "gpt6_astra_max"
260
265
  : requested === "ultra"
261
- ? "gpt56_sol_ultra"
266
+ ? "gpt6_astra_ultra"
262
267
  : requested;
263
268
  if (!CANONICAL_CODEX_PROFILE_OVERRIDES.has(canonical)) {
264
269
  if (allowCustom) return requested;
@@ -266,9 +271,9 @@ export function resolveCodexAgentProfile(
266
271
  `[agent-route-policy] unsupported profile override: ${requested}`,
267
272
  );
268
273
  }
269
- if (canonical !== "gpt56_sol_ultra") return canonical;
274
+ if (canonical !== "gpt6_astra_ultra") return canonical;
270
275
  return nested || !ULTRA_ELIGIBLE_CODEX_AGENTS.has(agent)
271
- ? "gpt56_sol_max"
276
+ ? "gpt6_astra_max"
272
277
  : canonical;
273
278
  }
274
279
 
@@ -287,7 +292,9 @@ export function resolveNestedCodexAgentProfile(
287
292
  } = {},
288
293
  ) {
289
294
  const explicitProfile = String(profileOverride || "auto").trim();
290
- const globalOverride = String(globalProfile || "auto").trim();
295
+ const globalOverride = normalizeCodexProfileName(
296
+ String(globalProfile || "auto").trim(),
297
+ );
291
298
  // Headless lanes must select their role policy explicitly. Only the max and
292
299
  // ultra exception lanes may cross the process environment boundary.
293
300
  const effectiveOverride =
@@ -305,7 +312,7 @@ export function resolveNestedCodexAgentProfile(
305
312
  });
306
313
  const { effort } = resolveCodexProfileConfigValues(candidate, { codexHome });
307
314
  if (!effort) return fallback;
308
- return effort.toLowerCase() === "ultra" ? "gpt56_sol_max" : candidate;
315
+ return effort.toLowerCase() === "ultra" ? "gpt6_astra_max" : candidate;
309
316
  }
310
317
 
311
318
  export function describeCodexAgentPolicy() {
@@ -1,12 +1,18 @@
1
1
  // cli-agy.mjs — Antigravity (agy) CLI adapter (Phase 0 PoC).
2
2
  //
3
- // 책임: agy --print 는 stdin-only 이므로 plan() 에서 stdinMode="pipe" 시그널을 반환한다.
4
- // positional prompt 패턴은 환영 메시지 폴백을 유발하므로 사용 금지.
3
+ // 책임: agy 1.1.27 부터 --print 는 값(프롬프트)이 필수이고 stdin 프롬프트는 거부되므로
4
+ // plan() 은 프롬프트를 args 의 --print 값으로 넣고 stdinMode="argv" 를 돌려준다.
5
+ // --print 뒤에 다른 플래그가 오면 그 플래그를 프롬프트로 삼키므로 항상 마지막에 둔다.
5
6
  //
6
7
  // 출처: scripts/tfx-route.sh route_agent() L1052-L1059, run_codex_exec() L2036-L2046.
7
8
  // .claude/rules/tfx-update-logic.md Antigravity CLI 1.0.0 정밀 sanity matrix.
8
9
  // timeoutSec은 lane 예상 소요 시간(advisory)이다. hard ceiling 집행은 Bash route가 소유한다.
9
10
 
11
+ import {
12
+ resolveGeminiModel,
13
+ resolveGeminiProfileForPurpose,
14
+ } from "./gemini-profiles.mjs";
15
+
10
16
  export const id = "agy";
11
17
  export const cliType = "antigravity";
12
18
  export const command = "agy";
@@ -38,6 +44,7 @@ export function plan({
38
44
  mcpProfile = "auto",
39
45
  timeoutSec,
40
46
  contextFile,
47
+ geminiProfilesPath,
41
48
  } = {}) {
42
49
  if (!agent) {
43
50
  throw new Error("[cli-agy] agent required");
@@ -49,8 +56,21 @@ export function plan({
49
56
  command,
50
57
  profile: cfg.profile,
51
58
  effort: cfg.profile,
52
- args: ["--print", "--dangerously-skip-permissions"],
53
- stdinMode: "pipe",
59
+ // effort 는 역할별 SSOT(gemini-profiles.mjs): designer → High, writer → Medium ...
60
+ geminiProfile: resolveGeminiProfileForPurpose(agent),
61
+ model: resolveGeminiModel(resolveGeminiProfileForPurpose(agent), {
62
+ profilesPath: geminiProfilesPath,
63
+ }),
64
+ args: [
65
+ "--dangerously-skip-permissions",
66
+ "--model",
67
+ resolveGeminiModel(resolveGeminiProfileForPurpose(agent), {
68
+ profilesPath: geminiProfilesPath,
69
+ }),
70
+ "--print",
71
+ prompt,
72
+ ],
73
+ stdinMode: "argv",
54
74
  timeoutMs: effectiveTimeoutSec * 1000,
55
75
  runMode: cfg.runMode,
56
76
  opusOversight: cfg.opusOversight,
@@ -22,11 +22,22 @@ const CANONICAL_PROFILE_VALUES = Object.freeze({
22
22
  gpt56_luna_low: { model: "gpt-5.6-luna", effort: "low" },
23
23
  gpt56_terra_med: { model: "gpt-5.6-terra", effort: "medium" },
24
24
  gpt56_terra_high: { model: "gpt-5.6-terra", effort: "high" },
25
- gpt56_sol_xhigh: { model: "gpt-5.6-sol", effort: "xhigh" },
26
- gpt56_sol_max: { model: "gpt-5.6-sol", effort: "max" },
27
- gpt56_sol_ultra: { model: "gpt-5.6-sol", effort: "ultra" },
25
+ gpt6_astra_xhigh: { model: "gpt-6-astra", effort: "xhigh" },
26
+ gpt6_astra_max: { model: "gpt-6-astra", effort: "max" },
27
+ gpt6_astra_ultra: { model: "gpt-6-astra", effort: "ultra" },
28
28
  });
29
29
 
30
+ const LEGACY_CANONICAL_PROFILE_ALIASES = Object.freeze({
31
+ gpt56_sol_xhigh: "gpt6_astra_xhigh",
32
+ gpt56_sol_max: "gpt6_astra_max",
33
+ gpt56_sol_ultra: "gpt6_astra_ultra",
34
+ });
35
+
36
+ export function normalizeCodexProfileName(profileName) {
37
+ const normalized = String(profileName ?? "").trim();
38
+ return LEGACY_CANONICAL_PROFILE_ALIASES[normalized] || normalized;
39
+ }
40
+
30
41
  function readProfileScalar(raw, key) {
31
42
  const match = String(raw).match(
32
43
  new RegExp(
@@ -64,32 +75,39 @@ export function resolveCodexProfileConfigValues(profileName, opts = {}) {
64
75
  if (typeof profileName !== "string" || !profileName) {
65
76
  return { model: null, effort: null };
66
77
  }
78
+ const normalizedProfileName = normalizeCodexProfileName(profileName);
67
79
  const codexHome =
68
80
  opts.codexHome || process.env.CODEX_HOME || join(homedir(), ".codex");
69
81
  let model = null;
70
82
  let effort = null;
71
83
  try {
72
84
  const raw = readFileSync(
73
- join(codexHome, `${profileName}.config.toml`),
85
+ join(codexHome, `${normalizedProfileName}.config.toml`),
74
86
  "utf8",
75
87
  );
76
88
  model = readProfileScalar(raw, "model");
77
89
  effort = readProfileScalar(raw, "model_reasoning_effort");
78
90
  } catch {
79
- const suffix = /_(ultra|max|xhigh|high|med|medium|low)$/.exec(profileName);
91
+ const suffix = /_(ultra|max|xhigh|high|med|medium|low)$/.exec(
92
+ normalizedProfileName,
93
+ );
80
94
  if (suffix) effort = EFFORT_BY_SUFFIX[suffix[1]] || null;
81
95
  }
82
96
  return { model, effort };
83
97
  }
84
98
 
85
99
  export function codexProfileConfigOverrides(profileName, opts = {}) {
86
- let { model, effort } = resolveCodexProfileConfigValues(profileName, opts);
100
+ const normalizedProfileName = normalizeCodexProfileName(profileName);
101
+ let { model, effort } = resolveCodexProfileConfigValues(
102
+ normalizedProfileName,
103
+ opts,
104
+ );
87
105
  if (opts.enforceCanonicalProfile === true) {
88
- const canonical = CANONICAL_PROFILE_VALUES[profileName];
106
+ const canonical = CANONICAL_PROFILE_VALUES[normalizedProfileName];
89
107
  if (canonical) ({ model, effort } = canonical);
90
108
  }
91
109
  if (opts.disallowUltra === true && effort?.toLowerCase() === "ultra") {
92
- model = "gpt-5.6-sol";
110
+ model = "gpt-6-astra";
93
111
  effort = "max";
94
112
  }
95
113
  const overrides = [];
@@ -8,48 +8,124 @@ import {
8
8
  import { homedir } from "node:os";
9
9
  import { join } from "node:path";
10
10
 
11
- // 모델명 SSOT. 값은 agy 1.0.x `agy models` 가 출력하는 display name 형식이다
11
+ // 모델명 SSOT. 값은 `agy models` 가 출력하는 display name 형식이다
12
12
  // (`--model` 인자가 이 문자열을 받는다). 옛 `gemini-*-preview` ID 형식이 아님.
13
+ // 카탈로그 확인: agy 1.1.27 `agy models` (2026-09-07). 운영 정책은 3.8 Flash 한 세대만
14
+ // 쓰고 effort(Low/Medium/High)로 차등한다. Pro 와 이전 세대 Flash 는 기본 프로필에서 뺐다.
13
15
  const DEFAULT_GEMINI_PROFILES = {
14
- model: "Gemini 3.5 Flash (Medium)",
16
+ model: "Gemini 3.8 Flash (Medium)",
15
17
  profiles: {
16
- flash35_low: {
17
- model: "Gemini 3.5 Flash (Low)",
18
- hint: "3.5 Flash (Low) — 경량·저비용",
18
+ flash38_low: {
19
+ model: "Gemini 3.8 Flash (Low)",
20
+ hint: "3.8 Flash (Low) — 경량·저비용",
19
21
  },
20
- flash35: {
21
- model: "Gemini 3.5 Flash (Medium)",
22
- hint: "3.5 Flash (Medium) — 기본, 비용·속도 균형",
22
+ flash38: {
23
+ model: "Gemini 3.8 Flash (Medium)",
24
+ hint: "3.8 Flash (Medium) — 기본, 비용·속도 균형",
23
25
  },
24
- flash35_high: {
25
- model: "Gemini 3.5 Flash (High)",
26
- hint: "3.5 Flash (High) — 코드/추론 강화",
27
- },
28
- pro31_low: {
29
- model: "Gemini 3.1 Pro (Low)",
30
- hint: "3.1 Pro (Low) — 플래그십 경량",
31
- },
32
- pro31: {
33
- model: "Gemini 3.1 Pro (High)",
34
- hint: "3.1 Pro (High) — 플래그십 최고 (긴 컨텍스트/복잡 추론)",
35
- },
36
- flash3: {
37
- model: "Gemini 3 Flash",
38
- hint: "3.0 Flash — 레거시 호환",
26
+ flash38_high: {
27
+ model: "Gemini 3.8 Flash (High)",
28
+ hint: "3.8 Flash (High) — 코드/추론 강화",
39
29
  },
40
30
  },
41
31
  };
42
32
 
43
33
  // 1회 마이그레이션 테이블: 옛 ID 형식 모델값 → agy display name.
44
- // null = deprecated(2.5 계열) → 해당 프로필 제거 대상.
34
+ // null = 카탈로그에서 빠진 모델(2.5 계열, 3 Flash) → 해당 프로필 제거 대상.
45
35
  const LEGACY_MODEL_MIGRATION = {
46
36
  "gemini-3.1-pro-preview": "Gemini 3.1 Pro (High)",
47
- "gemini-3-flash-preview": "Gemini 3 Flash",
37
+ "gemini-3-flash-preview": null,
38
+ "Gemini 3 Flash": null,
48
39
  "gemini-2.5-pro": null,
49
40
  "gemini-2.5-flash": null,
50
41
  "gemini-2.5-flash-lite": null,
51
42
  };
52
- const LEGACY_PROFILE_NAMES = ["pro25", "flash25", "lite25"];
43
+ // 과거 setup 이 자동 생성했던 프로필 이름. 정책상 더 쓰지 않으므로 제거한다.
44
+ // 사용자가 직접 이름 붙인 프로필은 건드리지 않는다.
45
+ const LEGACY_PROFILE_NAMES = [
46
+ "pro25",
47
+ "flash25",
48
+ "lite25",
49
+ "flash3",
50
+ "pro31",
51
+ "pro31_low",
52
+ "flash35",
53
+ "flash35_high",
54
+ "flash35_low",
55
+ ];
56
+ // 과거 setup 이 자동 생성한 기본 model 값. 사용자가 고른 값이 아니므로 새 기본으로 올린다.
57
+ const LEGACY_DEFAULT_MODELS = new Set(["Gemini 3.5 Flash (Medium)"]);
58
+
59
+ // ── 용도별 effort (SSOT) ──
60
+ // 한 세대(3.8 Flash)만 쓰고 역할에 따라 effort 를 나눈다. 키는 tfx 에이전트/역할 이름
61
+ // (agent-map.json 의 에이전트, tfx multi --assign 의 role). bash(tfx-route.sh)와
62
+ // node(execution-mode, gemini-adapter, cli-agy)가 모두 이 표를 읽는다.
63
+ // High : 판단이 결과를 좌우하는 역할 (검토, 설계, 디버깅, 분석)
64
+ // Medium : 생성/작성/실행 (기본값)
65
+ // Low : 분류, 요약, 추출, 번역처럼 짧고 기계적인 작업
66
+ const GEMINI_PROFILE_BY_PURPOSE = Object.freeze({
67
+ designer: "flash38_high",
68
+ reviewer: "flash38_high",
69
+ "code-reviewer": "flash38_high",
70
+ "security-reviewer": "flash38_high",
71
+ "quality-reviewer": "flash38_high",
72
+ critic: "flash38_high",
73
+ architect: "flash38_high",
74
+ verifier: "flash38_high",
75
+ analyst: "flash38_high",
76
+ debugger: "flash38_high",
77
+ planner: "flash38_high",
78
+ scientist: "flash38_high",
79
+ "test-engineer": "flash38_high",
80
+ writer: "flash38",
81
+ executor: "flash38",
82
+ worker: "flash38",
83
+ "document-specialist": "flash38",
84
+ researcher: "flash38",
85
+ antigravity: "flash38",
86
+ agy: "flash38",
87
+ gemini: "flash38",
88
+ summarizer: "flash38_low",
89
+ classifier: "flash38_low",
90
+ triage: "flash38_low",
91
+ translator: "flash38_low",
92
+ formatter: "flash38_low",
93
+ explore: "flash38_low",
94
+ });
95
+ const GEMINI_DEFAULT_PURPOSE_PROFILE = "flash38";
96
+
97
+ function resolveGeminiProfileForPurpose(name) {
98
+ const key = String(name ?? "")
99
+ .trim()
100
+ .toLowerCase();
101
+ return GEMINI_PROFILE_BY_PURPOSE[key] || GEMINI_DEFAULT_PURPOSE_PROFILE;
102
+ }
103
+
104
+ // 프로필 이름 → agy display name. 사용자 파일(~/.gemini/triflux-profiles.json)이
105
+ // 우선하고, 없으면 DEFAULT_GEMINI_PROFILES 로 떨어진다. 이미 모델명이면 그대로 돌려준다.
106
+ function resolveGeminiModel(profileOrModel, opts = {}) {
107
+ const raw = String(profileOrModel ?? "").trim();
108
+ if (!raw) return DEFAULT_GEMINI_PROFILES.model;
109
+ if (/^gemini[\s-]/i.test(raw)) return raw;
110
+ const profilesPath =
111
+ opts.profilesPath ||
112
+ process.env.GEMINI_PROFILES_PATH ||
113
+ join(homedir(), ".gemini", "triflux-profiles.json");
114
+ let cfg = null;
115
+ try {
116
+ cfg = JSON.parse(readFileSync(profilesPath, "utf8"));
117
+ } catch {
118
+ cfg = null;
119
+ }
120
+ const entry = cfg?.profiles?.[raw];
121
+ const fromFile = typeof entry === "string" ? entry : entry?.model;
122
+ if (typeof fromFile === "string" && fromFile.trim()) return fromFile.trim();
123
+ const fromDefault = DEFAULT_GEMINI_PROFILES.profiles[raw];
124
+ if (fromDefault) return fromDefault.model;
125
+ if (typeof cfg?.model === "string" && cfg.model.trim())
126
+ return cfg.model.trim();
127
+ return DEFAULT_GEMINI_PROFILES.model;
128
+ }
53
129
 
54
130
  const DEFAULT_PROFILE_COUNT = Object.keys(
55
131
  DEFAULT_GEMINI_PROFILES.profiles,
@@ -132,9 +208,10 @@ function ensureGeminiProfiles({
132
208
  }
133
209
  if (
134
210
  typeof cfg.model === "string" &&
135
- Object.hasOwn(LEGACY_MODEL_MIGRATION, cfg.model)
211
+ (Object.hasOwn(LEGACY_MODEL_MIGRATION, cfg.model) ||
212
+ LEGACY_DEFAULT_MODELS.has(cfg.model))
136
213
  ) {
137
- // 옛 ID 형식 기본값은 구버전 자동 생성값이므로 새 기본(DEFAULT)으로 정규화한다.
214
+ // 옛 ID 형식/이전 세대 자동 생성 기본값은 새 기본(DEFAULT)으로 정규화한다.
138
215
  cfg.model = DEFAULT_GEMINI_PROFILES.model;
139
216
  migrated = true;
140
217
  }
@@ -180,4 +257,11 @@ function ensureGeminiProfiles({
180
257
  }
181
258
  }
182
259
 
183
- export { DEFAULT_GEMINI_PROFILES, ensureGeminiProfiles };
260
+ export {
261
+ DEFAULT_GEMINI_PROFILES,
262
+ ensureGeminiProfiles,
263
+ GEMINI_DEFAULT_PURPOSE_PROFILE,
264
+ GEMINI_PROFILE_BY_PURPOSE,
265
+ resolveGeminiModel,
266
+ resolveGeminiProfileForPurpose,
267
+ };