@sejuneoh/aitop 0.32.0 → 0.33.1

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/src/ui/table.mjs CHANGED
@@ -5,7 +5,7 @@ import { projectBudget } from '../budget.mjs';
5
5
  import { fmtAgo, fmtElapsed, fmtTokens, pad, truncate, width } from '../text.mjs';
6
6
  import { memberStalled } from '../sources/common.mjs';
7
7
  import { BUDGET_COLOR, PALETTE, PHASE_COLOR, RESET, style } from './theme.mjs';
8
- import { NOW, SPIN, clock, costOf, gauge, glyph, levelBar, line, money, segsWidth, shortModel } from './draw.mjs';
8
+ import { NOW, SPIN, cacheState, clock, toolElapsed, costOf, gauge, glyph, levelBar, line, money, segsWidth, shortModel } from './draw.mjs';
9
9
  import { glyphs } from './glyphs.mjs';
10
10
  import { phaseText, t } from '../i18n.mjs';
11
11
  import { NO_FOLDER } from '../order.mjs';
@@ -350,7 +350,7 @@ export function sessionRow(s, c, W, selected, frame, hot, costMode = 'api', pinn
350
350
  segs.push(...pin, { t: pad(s.name ?? '', c.name - segsWidth(pin)) + ' ', fg: ended ? PALETTE.ended : PALETTE.text, bold: selected });
351
351
  if (c.showProject) segs.push({ t: pad(s.project ?? '', c.project) + ' ', fg: ended ? PALETTE.ended : PALETTE.muted });
352
352
  segs.push(
353
- { t: pad(status, c.status) + ' ', fg: pc, bold: s.status === 'waiting' },
353
+ ...statusCell(status, cacheState(s) ?? toolElapsed(s), c.status, { fg: pc, bold: s.status === 'waiting' }),
354
354
  { t: pad(partial ? '…' : blank ? '' : fmtTokens(s.tokens.total), c.tokens, 'right') + ' ', fg: ended ? PALETTE.ended : partial ? PALETTE.info : PALETTE.muted },
355
355
  );
356
356
  if (c.showCost) segs.push(partial ? { t: pad('…', c.cost, 'right') + ' ', fg: PALETTE.info } : { t: pad(blank ? '' : (hot?.has(s.id) ? glyphs().hot : '') + money(costOf(s, costMode), s.costUnknown), c.cost, 'right') + ' ', fg: s.cost == null || ended ? PALETTE.info : hot?.has(s.id) ? PALETTE.money : PALETTE.muted, bold: Boolean(hot?.has(s.id)) });
@@ -359,6 +359,20 @@ export function sessionRow(s, c, W, selected, frame, hot, costMode = 'api', pinn
359
359
  return line(ended ? segs.map((x) => ({ ...x, italic: true })) : segs, W, bg);
360
360
  }
361
361
 
362
+ // 세션 행의 STATUS 칸 (뒤 공백 포함). 덧붙일 짧은 글(tag)이 있으면 상태 글 뒤에 ' · 캐시 3:12' 처럼 붙인다.
363
+ // tag 는 기다리는 세션의 캐시 남은 시간(cacheState) 또는 작업 중 세션의 도구 경과 시간(toolElapsed)이다. 두 상태가 달라 함께 붙지 않는다.
364
+ // 덧붙인 글이 먼저 빠지는 정보다: 다 들어가면 그대로, 상태 글을 TAG_STATUS_MIN 칸까지 줄여 들어가면 줄여서 붙이고, 아니면 뺀다.
365
+ const TAG_STATUS_MIN = 12;
366
+ export function statusCell(status, tag, w, look) {
367
+ const plain = [{ t: pad(status, w) + ' ', ...look }];
368
+ if (!tag) return plain;
369
+ const segs = [{ t: ' · ', fg: PALETTE.info }, { t: tag.text, fg: tag.fg, bold: tag.bold, dim: tag.dim }];
370
+ const room = w - segsWidth(segs);
371
+ if (room < Math.min(width(status), TAG_STATUS_MIN)) return plain;
372
+ const head = truncate(status, room);
373
+ return [{ t: head, ...look }, ...segs, { t: ' '.repeat(Math.max(0, room - width(head))) + ' ' }];
374
+ }
375
+
362
376
  // 기록을 읽는 중인 세션의 CONTEXT 칸: 빈 막대와 … (gauge 와 같은 폭).
363
377
  const pendingGauge = (cells) => [{ t: glyphs().bar.empty.repeat(cells), fg: PALETTE.faint }, { t: pad('…', 5, 'right'), fg: PALETTE.info }];
364
378
 
package/src/ui/theme.mjs CHANGED
@@ -128,7 +128,7 @@ export const RESET = NO_COLOR ? '' : '\x1b[0m';
128
128
  export const BUDGET_TOKEN = { caution: 'team', warn: 'alert' };
129
129
  export const BUDGET_COLOR = { caution: PALETTE[BUDGET_TOKEN.caution], warn: PALETTE[BUDGET_TOKEN.warn] };
130
130
 
131
- export const PHASE_COLOR = { tool: PALETTE.tool, team: PALETTE.team, think: PALETTE.busy, write: PALETTE.busy, waiting: PALETTE.waiting, idle: PALETTE.idle, ended: PALETTE.ended, done: PALETTE.info, unseen: PALETTE.busy };
131
+ export const PHASE_COLOR = { tool: PALETTE.tool, team: PALETTE.team, think: PALETTE.busy, write: PALETTE.busy, waiting: PALETTE.waiting, idle: PALETTE.idle, ended: PALETTE.ended, done: PALETTE.info, unseen: PALETTE.busy, stopped: PALETTE.alert };
132
132
 
133
133
  // 상자 테두리. 포커스가 있으면 강조색으로, 색이 없으면 굵은 선으로 구분한다.
134
134
  export const EDGE = {