@sejuneoh/aitop 0.31.1 → 0.31.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/README.md CHANGED
@@ -82,7 +82,7 @@ aitop --report monthly --by model --months 6
82
82
 
83
83
  ### Session report
84
84
 
85
- `aitop --report sessions [--since yesterday|today|Nd|YYYY-MM-DD] [--plan USD] [--md|--json] [--show-prompts]` lists every session that used tokens in the period (default: since midnight yesterday; at most 30 days back), highest cost first: tool, main model (`+N` more), project (same rule as `--by project`), session name (your `/rename` name, then the tool's title, then the folder), start and end of activity within the period, tokens, cost (API list price, `?` for unpriced models) and files changed (`-` when unknown, always for agy). A summary card on top shows the total, the share per tool and the session count; `--plan 200` adds how many times the period's share of a $200/month subscription (period days / 30) you used, still in API list price and not your bill. Claude subagents are counted in their parent session. `--md` prints Markdown you can paste (`|` and line breaks escaped), `--json` the same numbers for scripts. First prompts are hidden unless you pass `--show-prompts`, so they do not end up in shared output (session names still show).
85
+ `aitop --report sessions [--since yesterday|today|Nd|YYYY-MM-DD] [--plan USD] [--md|--json] [--show-prompts]` lists every session that used tokens in the period (default: since midnight yesterday; at most 30 days back), highest cost first: tool, main model (`+N` more), project (same rule as `--by project`), session name (your `/rename` name, then the tool's title, then the folder), start and end of activity within the period, tokens, cost (API list price; unpriced models are left out, not guessed, and `--json` marks them with `unpriced`) and files changed (`-` when unknown, always for agy). A summary card on top shows the total, the share per tool and the session count; `--plan 200` adds how many times the period's share of a $200/month subscription (period days / 30) you used, still in API list price and not your bill. Claude subagents are counted in their parent session. `--md` prints Markdown you can paste (`|` and line breaks escaped), `--json` the same numbers for scripts. First prompts are hidden unless you pass `--show-prompts`, so they do not end up in shared output (session names still show).
86
86
 
87
87
  ```
88
88
  aitop --report sessions --md --plan 200
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sejuneoh/aitop",
3
- "version": "0.31.1",
3
+ "version": "0.31.2",
4
4
  "description": "터미널에서 Claude Code · Codex · Antigravity · Gemini 세션과 토큰을 실시간으로 보는 읽기 전용 모니터",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/i18n.mjs CHANGED
@@ -259,7 +259,7 @@ export const STRINGS = {
259
259
  'report.date': '날짜',
260
260
  'report.total': '합계',
261
261
  'report.empty': '이 기간에 기록된 사용량이 없습니다',
262
- 'report.unpriced': '? 가격표에 없는 모델이 있어 비용이 실제보다 적게 잡혔을 수 있습니다',
262
+ 'report.unpriced': '가격표에 없는 모델이 있어 비용이 실제보다 적게 잡혔을 수 있습니다',
263
263
  'report.partial': '시간 상한 안에 기록을 다 읽지 못해 일부만 셌습니다. 다시 실행하면 이어 읽습니다',
264
264
  'report.progress': '사용량 장부 읽는 중 {pct}% ({s}초)',
265
265
  'report.capped': '--days 는 장부가 남기는 {n}일까지만 볼 수 있어 {n}일로 줄입니다',
@@ -446,7 +446,7 @@ export const STRINGS = {
446
446
  'legend.pin': '고정한 세션 (p). SESSION 칸 앞에 붙는다',
447
447
  'legend.status': '지금 단계. 큰 기록을 처음 읽는 동안은 기록 읽는 중 N%',
448
448
  'legend.tokens': '세션 누적 토큰 (서브에이전트 포함, 캐시 읽기 포함)',
449
- 'legend.cost': 'API 정가로 환산한 비용 (Codex 는 OpenAI 정가 추정). ? 는 가격표에 없는 모델 포함',
449
+ 'legend.cost': 'API 정가로 환산한 비용 (Codex 는 OpenAI 정가 추정). 가격표에 없는 모델은 빼고 센다',
450
450
  'legend.context': '마지막 요청의 컨텍스트 사용률 (모델별 창 크기 기준)',
451
451
  'legend.idleCol': '마지막 활동 후 지난 시간. 작업 중이면 now',
452
452
  'legend.hiddenKey': '숨김 N',
@@ -562,7 +562,7 @@ export const STRINGS = {
562
562
  'detail.netLabel': '캐시제외',
563
563
  'detail.apiValue': 'API 환산 {v}',
564
564
  'detail.netValue': '캐시 제외 {v}',
565
- 'detail.unpriced': ' ? 가격표에 없는 모델 포함',
565
+ 'detail.unpriced': ' 가격표에 없는 모델은 빼고 셈',
566
566
 
567
567
  // 데스크톱 알림 (--notify). 화면 언어를 따른다.
568
568
  'notify.one': 'aitop: 응답 대기 ({tool})',
@@ -661,7 +661,7 @@ export const STRINGS = {
661
661
  'report.date': 'Date',
662
662
  'report.total': 'Total',
663
663
  'report.empty': 'No usage recorded in this period',
664
- 'report.unpriced': '? includes unpriced models, so the cost may be lower than actual',
664
+ 'report.unpriced': 'Includes unpriced models, so the cost may be lower than actual',
665
665
  'report.partial': 'Could not read all logs within the time limit, so this is partial. Run again to continue',
666
666
  'report.progress': 'Reading usage logs {pct}% ({s}s)',
667
667
  'report.capped': '--days is limited to the {n} days the ledger keeps, using {n}',
@@ -845,7 +845,7 @@ export const STRINGS = {
845
845
  'legend.pin': 'Pinned session (p), before SESSION',
846
846
  'legend.status': 'Current step (Reading log N% on first load)',
847
847
  'legend.tokens': 'Tokens incl. subagents and cache reads',
848
- 'legend.cost': 'API cost (Codex estimated). ? = unpriced',
848
+ 'legend.cost': 'API cost (Codex estimated). Unpriced models not counted',
849
849
  'legend.context': 'Context used by the last request',
850
850
  'legend.idleCol': 'Time since last activity. now while working',
851
851
  'legend.hiddenKey': 'hidden N',
@@ -958,7 +958,7 @@ export const STRINGS = {
958
958
  'detail.netLabel': 'No cache',
959
959
  'detail.apiValue': 'API cost {v}',
960
960
  'detail.netValue': 'no cache {v}',
961
- 'detail.unpriced': ' ? includes unpriced models',
961
+ 'detail.unpriced': ' unpriced models not counted',
962
962
 
963
963
  'notify.one': 'aitop: waiting ({tool})',
964
964
  'notify.title': 'aitop: waiting',
package/src/report.mjs CHANGED
@@ -289,7 +289,7 @@ function foldOthers(columns, keep, lines) {
289
289
  }
290
290
 
291
291
  // --json 모양: 키는 영어, 값은 숫자만 (날짜·이름은 문자열). partial: 시간 상한 때문에 덜 읽었는지.
292
- // 칸마다 unpriced(가격표에 없는 모델이 끼었는지)를 참·거짓으로 둔다. 화면의 ? 와 같은 뜻이다.
292
+ // 칸마다 unpriced(가격표에 없는 모델이 끼었는지)를 참·거짓으로 둔다. 그 몫은 비용에서 빠져 있다.
293
293
  export function reportJson(r, version, { partial = false } = {}) {
294
294
  const items = (o) => Object.fromEntries(r.columns.map((c) => [c, { tokens: o.items[c]?.tokens ?? 0, cost: o.items[c]?.cost ?? 0, unpriced: Boolean(o.items[c]?.unpriced) }]));
295
295
  const monthly = r.report === 'monthly';
@@ -312,7 +312,7 @@ export function reportJson(r, version, { partial = false } = {}) {
312
312
  }
313
313
 
314
314
  // 칸 하나: '1.2M $3.40'. 토큰이 없으면 '-'. 가격표에 없는 모델이 끼었으면 화면 헤더처럼 비용 뒤에 ? 를 붙인다 ('$12.30?').
315
- const cell = (x) => (x && (x.tokens > 0 || x.cost > 0) ? `${fmtTokens(Math.round(x.tokens))} ${money(x.cost)}${x.unpriced ? '?' : ''}` : '-');
315
+ const cell = (x) => (x && (x.tokens > 0 || x.cost > 0) ? `${fmtTokens(Math.round(x.tokens))} ${x.unpriced && !(x.cost > 0) ? '-' : money(x.cost)}` : '-');
316
316
 
317
317
  // 사람이 읽는 표. 머리글·합계 줄 문구는 화면 언어(t)를 따른다. 도구·모델·프로젝트 이름은 그대로 쓴다.
318
318
  const colName = (c) => (c === UNKNOWN ? t('report.unknown') : c === OTHERS ? t('report.others') : truncate(stripControl(c), HEAD_MAX));
@@ -288,7 +288,7 @@ const mdhm = (ms) => {
288
288
  // 끝 시각: 시작과 같은 날이면 시:분만.
289
289
  const endText = (x) => (x.end == null ? '-' : x.start != null && dayKey(x.start) === dayKey(x.end) ? hm(new Date(x.end)) : mdhm(x.end));
290
290
  const startText = (x) => (x.start == null ? '-' : mdhm(x.start));
291
- const costText = (x) => (used(x) ? `${money(x.cost)}${x.unpriced ? '?' : ''}` : '-');
291
+ const costText = (x) => (used(x) && !(x.unpriced && !(x.cost > 0)) ? money(x.cost) : '-');
292
292
  const filesText = (x) => (x.files == null ? '-' : `${x.files}${x.filesMore ? '+' : ''}`);
293
293
  const modelText = (x) => (x.model ? `${x.model}${x.models.length > 1 ? ` +${x.models.length - 1}` : ''}` : '-');
294
294
  const projectText = (x) => (x.project === UNKNOWN ? t('report.unknown') : x.project);
@@ -304,7 +304,7 @@ const daysText = (n) => (n >= 10 ? String(Math.round(n)) : n.toFixed(1));
304
304
  function cardLines(r, md = false) {
305
305
  const s = r.summary;
306
306
  const b = (x) => (md ? `**${x}**` : x);
307
- const out = [t('sessions.cardTotal', { cost: b(`${money(s.cost)}${s.unpriced ? '?' : ''}`), tokens: fmtTokens(Math.round(s.tokens)), n: s.sessions })];
307
+ const out = [t('sessions.cardTotal', { cost: b(s.unpriced && !(s.cost > 0) ? '-' : money(s.cost)), tokens: fmtTokens(Math.round(s.tokens)), n: s.sessions })];
308
308
  const tools = Object.entries(s.tools).map(([tool, o]) => `${tool} ${pct(o.share)}`);
309
309
  if (tools.length) out.push(t(s.shareBy === 'cost' ? 'sessions.cardTools' : 'sessions.cardToolsTokens', { tools: tools.join(' · ') }));
310
310
  if (s.plan) {
@@ -74,7 +74,7 @@ export class ClaudeTracker {
74
74
  this.tokens = emptyTokens();
75
75
  this.cost = 0;
76
76
  this.costNoCache = 0;
77
- // 가격표에 없는 모델의 사용량이 섞였는지. 그 몫은 비용에 넣지 않고 화면에 '?' 로 알린다.
77
+ // 가격표에 없는 모델의 사용량이 섞였는지. 그 몫은 비용에 넣지 않는다 (--json 의 costUnknown, 상세 패널 안내 줄).
78
78
  this.costUnknown = false;
79
79
  this.context = 0;
80
80
  this.model = null;
package/src/ui/draw.mjs CHANGED
@@ -76,13 +76,14 @@ export function gauge(used, total, cells) {
76
76
 
77
77
  export const dollars = (usd) => (usd >= 1000 ? `$${Math.round(usd).toLocaleString('en-US')}` : usd >= 100 ? `$${usd.toFixed(0)}` : `$${usd.toFixed(2)}`);
78
78
 
79
- // 비용을 모르는 도구는 '-'. 가격표에 없는 모델이 섞이면 아는 몫 뒤에 '?' 를 붙이고, 아는 몫이 없으면 '?' 만 보인다.
79
+ // 비용을 모르는 도구는 '-'. 가격표에 없는 모델이 섞이면 아는 몫만 보이고(표시는 붙이지 않는다), 아는 몫이 없으면 '-'.
80
+ // 가격표에 없는 모델이 섞였는지는 --json 의 unpriced·costUnknown 과 상세 패널 안내 줄로 알린다.
80
81
  // 비용 표시 기준: 'api' 는 API 정가 환산(캐시 포함), 'net' 은 캐시 읽기·쓰기를 뺀 입력·출력만.
81
82
  export const costOf = (x, mode = 'api') => (mode === 'net' ? x?.costNoCache ?? null : x?.cost ?? null);
82
83
 
83
84
  export function money(usd, unknown = false) {
84
85
  if (usd == null) return '-';
85
- if (unknown) return usd > 0 ? `${dollars(usd)}?` : '?';
86
+ if (unknown && !(usd > 0)) return '-';
86
87
  return dollars(usd);
87
88
  }
88
89
 
package/src/ui/table.mjs CHANGED
@@ -52,10 +52,10 @@ export function columns(W) {
52
52
 
53
53
  // 헤더의 7일 비용 막대. days: usage.days7 (오래된 날 → 오늘). 7일 중 가장 큰 날을 █ 로 맞춘다.
54
54
  // 비용이 0 인 날은 ▁ 를 장식 색(faint)으로, 쓴 날은 ▂~█ 로 그린다. 색이 없어도 쓴 날(▂ 이상)과 안 쓴 날(▁)이 갈린다.
55
- // 가격표에 없는 모델만 쓴 날(아는 비용 0)은 쓰지 않은 날과 헷갈리지 않게 ? 로 둔다.
55
+ // 가격표에 없는 모델만 쓴 날(아는 비용 0)은 쓰지 않은 날과 헷갈리지 않게 가장 낮은 '쓴 날' 막대(▂)를 흐린 색으로 둔다.
56
56
  export function weekBar(days, costMode = 'api') {
57
57
  const bar = levelBar(days.map((d) => costOf(d, costMode)));
58
- return bar.map((x, i) => (x.t === glyphs().week[0] && days[i].unknown ? { t: '?', fg: PALETTE.muted } : x));
58
+ return bar.map((x, i) => (x.t === glyphs().week[0] && days[i].unknown ? { t: glyphs().week[1], fg: PALETTE.muted } : x));
59
59
  }
60
60
 
61
61
  export function header(view, W) {
@@ -109,7 +109,7 @@ export function header(view, W) {
109
109
  const bud = u ? projectBudget(u, view.budgetDay, { now: view.data.at ?? Date.now() }) : null;
110
110
  const ofBudget = bud ? [{ t: `/${Number.isInteger(bud.day) ? `$${bud.day.toLocaleString('en-US')}` : `$${bud.day.toFixed(2)}`}`, fg: PALETTE.muted, bg: B }] : [];
111
111
  // 캐시 제외 화면에서 예산 칸 없이 예상만 남으면 캐시 제외 금액으로 읽히지 않게 'API 예상' 이라고 적는다.
112
- const projOf = (label) => (bud && bud.level !== 'ok' ? { t: `${label} ${usd(bud.projected)}${bud.unknown ? '?' : ''}${bud.level === 'warn' ? '!' : ''}`, fg: BUDGET_COLOR[bud.level], bg: B, bold: true } : null);
112
+ const projOf = (label) => (bud && bud.level !== 'ok' ? { t: `${label} ${usd(bud.projected)}${bud.level === 'warn' ? '!' : ''}`, fg: BUDGET_COLOR[bud.level], bg: B, bold: true } : null);
113
113
  const projSeg = projOf(t('hdr.proj'));
114
114
  const projApi = net ? projOf(t('hdr.projApi')) : projSeg;
115
115
  // budget: 'full' | 'proj' (아래 right 참고). 오늘 칸 뒤에 붙는 예산 칸.
@@ -126,9 +126,8 @@ export function header(view, W) {
126
126
  ...(tok ? [{ t: ` ${fmtTokens(p.tokens)}`, fg: PALETTE.info, bg: B }] : []),
127
127
  ];
128
128
  // 지출 속도: 최근 1시간 비용(5분 칸 근사)을 시간당으로. 0 이거나 아직 집계 중이면 숨기고, 폭이 모자라면 가장 먼저 뺀다.
129
- // 아는 몫이 0 인데 가격표에 없는 모델이 섞였으면 금액 없이 (?/h) 만 보인다.
130
129
  const hour = u?.lastHour && u.loading == null ? (net ? u.lastHour.costNoCache : u.lastHour.cost) : null;
131
- const rateText = hour >= 0.005 ? `${usd(hour)}${u.lastHour.unknown ? '?' : ''}` : hour != null && u.lastHour.unknown ? '?' : null;
130
+ const rateText = hour >= 0.005 ? usd(hour) : null;
132
131
  const rate = rateText ? [{ t: ` (${rateText}/h)`, fg: PALETTE.muted, bg: B }] : null;
133
132
  // bar: 7일 금액 뒤의 날짜별 막대. 집계 중이거나 날짜별 값이 없으면 넣지 않는다.
134
133
  const bar = u?.loading == null && u?.days7?.length ? [{ t: ' ', bg: B }, ...weekBar(u.days7, view.costMode).map((x) => ({ ...x, bg: B }))] : null;