@triflux/core 10.82.4 → 10.84.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/hud-qos-status.mjs +24 -13
- package/hud/renderers.mjs +25 -10
- package/package.json +1 -1
package/hud/hud-qos-status.mjs
CHANGED
|
@@ -71,11 +71,18 @@ async function main() {
|
|
|
71
71
|
|
|
72
72
|
// --band: triflux mods 가 입력창 위에 그릴 줄을 만든다. statusLine 은 band 가 다 그리는 세션에서 비운다.
|
|
73
73
|
const bandMode = process.argv.includes(BAND_FLAG);
|
|
74
|
-
// statusLine 은 엔진이 양옆에 2칸씩 여백을 두고, 첫 행 오른쪽에 알림을 띄운다(공식 문서). 그만큼 좁게 그린다.
|
|
75
|
-
// 알림 자리를 빼고 40칸이 안 남는 좁은 화면은 그대로 두어 원래 축소 단계를 따른다.
|
|
76
|
-
const reserved = Number(process.env.COLUMNS) - STATUSLINE_RESERVE_COLS;
|
|
77
|
-
if (!bandMode && reserved >= 40) process.env.COLUMNS = String(reserved);
|
|
78
74
|
const stdin = await readStdinJson();
|
|
75
|
+
// agy statusLine 은 같은 HUD 를 호출하되 product 로 자신을 밝히고 터미널 폭을 직접 넘긴다.
|
|
76
|
+
const agySession = stdin?.product === "antigravity";
|
|
77
|
+
if (agySession) {
|
|
78
|
+
if (stdin.terminal_width > 0)
|
|
79
|
+
process.env.COLUMNS = String(stdin.terminal_width);
|
|
80
|
+
} else {
|
|
81
|
+
// Claude statusLine 은 엔진이 양옆에 2칸씩 여백을 두고, 첫 행 오른쪽에 알림을 띄운다(공식 문서). 그만큼 좁게 그린다.
|
|
82
|
+
// 알림 자리를 빼고 40칸이 안 남는 좁은 화면은 그대로 두어 원래 축소 단계를 따른다.
|
|
83
|
+
const reserved = Number(process.env.COLUMNS) - STATUSLINE_RESERVE_COLS;
|
|
84
|
+
if (!bandMode && reserved >= 40) process.env.COLUMNS = String(reserved);
|
|
85
|
+
}
|
|
79
86
|
const bandState = bandMode ? "none" : readBandState(stdin?.session_id);
|
|
80
87
|
if (bandState === "all") return;
|
|
81
88
|
// Claude Code 가 넘긴 세션 사용량이 있으면 Claude API 를 따로 조회하지 않는다.
|
|
@@ -129,10 +136,15 @@ async function main() {
|
|
|
129
136
|
const rows =
|
|
130
137
|
bandState === "claude"
|
|
131
138
|
? []
|
|
132
|
-
: getClaudeRows(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
139
|
+
: getClaudeRows(
|
|
140
|
+
currentTier,
|
|
141
|
+
agySession ? null : contextView,
|
|
142
|
+
claudeUsage,
|
|
143
|
+
{
|
|
144
|
+
accountName: getClaudeEmail(),
|
|
145
|
+
promptCache: stdin?.prompt_cache,
|
|
146
|
+
},
|
|
147
|
+
);
|
|
136
148
|
let codexRowIndex = -1;
|
|
137
149
|
if (showCodex) {
|
|
138
150
|
codexRowIndex = rows.length;
|
|
@@ -157,6 +169,7 @@ async function main() {
|
|
|
157
169
|
geminiBlue,
|
|
158
170
|
antigravityQuota,
|
|
159
171
|
getAntigravityAccountLabel(),
|
|
172
|
+
{ contextView: agySession ? contextView : null },
|
|
160
173
|
),
|
|
161
174
|
);
|
|
162
175
|
}
|
|
@@ -166,11 +179,9 @@ async function main() {
|
|
|
166
179
|
outputLines[codexRowIndex] = `${DIM}${outputLines[codexRowIndex]}${RESET}`;
|
|
167
180
|
}
|
|
168
181
|
// 알림 배너와 TUI 스타일이 HUD 내용에 겹치지 않도록 한다. band 는 자기 자리에 그리니 띄우지 않는다.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
: contextView.percent >= 85
|
|
172
|
-
? "\n\n"
|
|
173
|
-
: "\n";
|
|
182
|
+
// agy 는 statusLine.padding 이 같은 역할을 한다.
|
|
183
|
+
const leadingBreaks =
|
|
184
|
+
bandMode || agySession ? "" : contextView.percent >= 85 ? "\n\n" : "\n";
|
|
174
185
|
const resetLines = outputLines.map((line) => `\x1b[0m${line}`);
|
|
175
186
|
// band 는 첫 줄 표지로 이 HUD 가 --band 를 아는지 확인한다.
|
|
176
187
|
const header = bandMode ? `${BAND_HEADER}\n` : "";
|
package/hud/renderers.mjs
CHANGED
|
@@ -167,6 +167,16 @@ function contextPercentText(ctxView) {
|
|
|
167
167
|
return colorByPercent(ctxView.percent, `${ctxView.percent}%`);
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
function contextCell(ctxView) {
|
|
171
|
+
return `${dim("ctx:")}${contextPercentText(ctxView)}`;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function contextWarning(ctxView) {
|
|
175
|
+
return ctxView?.warningTag
|
|
176
|
+
? ` ${dim("|")} ${yellow(ctxView.warningTag)}`
|
|
177
|
+
: "";
|
|
178
|
+
}
|
|
179
|
+
|
|
170
180
|
// gateway 세션은 5h, 1w 대신 spend_limit 창 하나만 받는다.
|
|
171
181
|
function spendOnlyPercent(claudeUsage) {
|
|
172
182
|
if (claudeUsage?.spendLimitPercent == null) return null;
|
|
@@ -184,14 +194,15 @@ export function getClaudeRows(
|
|
|
184
194
|
claudeUsage,
|
|
185
195
|
{ accountName, promptCache } = {},
|
|
186
196
|
) {
|
|
187
|
-
const ctxView = contextView || buildContextUsageView({});
|
|
188
197
|
const markerColor = claudeOrange;
|
|
189
198
|
const prefix = `${bold(markerColor("c"))}:`;
|
|
190
199
|
// 계정을 ctx 앞에 둬서 x, a 행의 계정 라벨과 같은 열에서 시작하게 한다.
|
|
191
200
|
const accountText = accountName
|
|
192
201
|
? `${markerColor(fitText(getAccountLabel("claude", accountName), ACCOUNT_LABEL_WIDTH))} `
|
|
193
202
|
: "";
|
|
194
|
-
|
|
203
|
+
// contextView 가 null 이면 이 세션은 Claude 가 아니라서 ctx 칸을 다른 행이 맡는다.
|
|
204
|
+
const contextSection = contextView ? contextCell(contextView) : "";
|
|
205
|
+
const warning = contextWarning(contextView);
|
|
195
206
|
const spend = spendOnlyPercent(claudeUsage);
|
|
196
207
|
if (spend != null) {
|
|
197
208
|
if (currentTier === "nano" || currentTier === "micro") {
|
|
@@ -266,9 +277,6 @@ export function getClaudeRows(
|
|
|
266
277
|
if (currentTier === "compact") {
|
|
267
278
|
const staleTag = claudeUsage?.stale ? ` ${dim("[stale]")}` : "";
|
|
268
279
|
const quotaSection = `${dim("5h:")}${fStr} ${dim(fTime)} ${dim("1w:")}${wStr} ${dim(wTime)}${staleTag}`;
|
|
269
|
-
const warning = ctxView.warningTag
|
|
270
|
-
? ` ${dim("|")} ${yellow(ctxView.warningTag)}`
|
|
271
|
-
: "";
|
|
272
280
|
return [
|
|
273
281
|
{
|
|
274
282
|
prefix,
|
|
@@ -281,9 +289,6 @@ export function getClaudeRows(
|
|
|
281
289
|
// full tier (>= 120 cols)
|
|
282
290
|
const staleTag = claudeUsage?.stale ? ` ${dim("[stale]")}` : "";
|
|
283
291
|
const quotaSection = `${dim("5h:")}${fBar}${fStr} ${dim(fTime)} ${dim("1w:")}${wBar}${wStr} ${dim(wTime)}${staleTag}`;
|
|
284
|
-
const warning = ctxView.warningTag
|
|
285
|
-
? ` ${dim("|")} ${yellow(ctxView.warningTag)}`
|
|
286
|
-
: "";
|
|
287
292
|
return [
|
|
288
293
|
{
|
|
289
294
|
prefix,
|
|
@@ -308,7 +313,7 @@ export function getProviderRow(
|
|
|
308
313
|
markerColor,
|
|
309
314
|
realQuota,
|
|
310
315
|
accountName,
|
|
311
|
-
{ promptCache, loggedOut = false } = {},
|
|
316
|
+
{ promptCache, loggedOut = false, contextView = null } = {},
|
|
312
317
|
) {
|
|
313
318
|
const accountLabel = fitText(
|
|
314
319
|
getAccountLabel(provider, accountName),
|
|
@@ -325,6 +330,7 @@ export function getProviderRow(
|
|
|
325
330
|
markerColor,
|
|
326
331
|
accountLabel,
|
|
327
332
|
realQuota,
|
|
333
|
+
contextView,
|
|
328
334
|
);
|
|
329
335
|
}
|
|
330
336
|
const provAnsi = CODEX_WHITE;
|
|
@@ -500,6 +506,7 @@ function getAntigravityRow(
|
|
|
500
506
|
markerColor,
|
|
501
507
|
accountLabel,
|
|
502
508
|
quota,
|
|
509
|
+
contextView,
|
|
503
510
|
) {
|
|
504
511
|
const usedPercent = quota?.usedPercent;
|
|
505
512
|
const hasValue = usedPercent != null;
|
|
@@ -515,6 +522,10 @@ function getAntigravityRow(
|
|
|
515
522
|
}
|
|
516
523
|
const isFull = currentTier === "full";
|
|
517
524
|
const showTime = isFull || currentTier === "compact";
|
|
525
|
+
// agy statusLine 세션이면 c 행 대신 이 행에 ctx 칸을 붙인다. 경고 표시는 Claude 행처럼 compact 이상에서만.
|
|
526
|
+
const contextRight = contextView
|
|
527
|
+
? ` ${contextCell(contextView)}${showTime ? contextWarning(contextView) : ""}`
|
|
528
|
+
: "";
|
|
518
529
|
const reset =
|
|
519
530
|
Date.parse(quota?.resetTime) - Date.now() >= ONE_DAY_MS
|
|
520
531
|
? formatResetRemainingDayHour(quota.resetTime)
|
|
@@ -539,5 +550,9 @@ function getAntigravityRow(
|
|
|
539
550
|
: tierDimBar(currentTier);
|
|
540
551
|
slot = `${dim("--:")}${bar}${percent}${timeCell}`;
|
|
541
552
|
}
|
|
542
|
-
return {
|
|
553
|
+
return {
|
|
554
|
+
prefix,
|
|
555
|
+
left: padAnsiRight(slot, windowWidth * 2 + 1),
|
|
556
|
+
right: `${right}${contextRight}`,
|
|
557
|
+
};
|
|
543
558
|
}
|