@sejuneoh/aitop 0.22.0 → 0.24.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.
@@ -175,9 +175,9 @@ export class ClaudeTracker {
175
175
  const open = [...this.pending.values()];
176
176
  const agents = open.filter((p) => p.name === 'Agent' || p.name === 'Task');
177
177
  const tools = open.filter((p) => p.name !== 'Agent' && p.name !== 'Task');
178
- if (tools.length) return { kind: 'tool', text: `도구 실행 · ${tools.at(-1).name}` };
179
- if (agents.length) return { kind: 'team', text: `팀원 ${agents.length}명 작업 중` };
180
- if (this.lastKind === 'prompt' || this.lastKind === 'result') return { kind: 'think', text: '생각 중' };
181
- return { kind: 'write', text: '답변 작성 중' };
178
+ if (tools.length) return { kind: 'tool', args: { what: tools.at(-1).name } };
179
+ if (agents.length) return { kind: 'team', args: { n: agents.length } };
180
+ if (this.lastKind === 'prompt' || this.lastKind === 'result') return { kind: 'think' };
181
+ return { kind: 'write' };
182
182
  }
183
183
  }
@@ -70,7 +70,7 @@ export function _stats() {
70
70
  }
71
71
 
72
72
  function loadingPhase(t) {
73
- return t?.loading != null ? { kind: 'think', text: `기록 읽는 중 ${Math.floor(t.loading * 100)}%` } : null;
73
+ return t?.loading != null ? { kind: 'think', msg: 'loading', args: { pct: Math.floor(t.loading * 100) } } : null;
74
74
  }
75
75
 
76
76
  // 서브에이전트 전체(끝난 것 포함)의 토큰·비용 합계. 메인 세션 합계에 더해 화면에 보인다.
@@ -128,7 +128,7 @@ function readMembers(transcript, parent, budget) {
128
128
  task: meta.description ?? '',
129
129
  status: finished ? 'done' : 'busy',
130
130
  started,
131
- phase: finished ? { kind: 'done', text: '완료' } : !started ? { kind: 'idle', text: '시작 중' } : loadingPhase(t) ?? t.phase(),
131
+ phase: finished ? { kind: 'done' } : !started ? { kind: 'idle', msg: 'starting' } : loadingPhase(t) ?? t.phase(),
132
132
  now: t.lastTool,
133
133
  tokens: t.tokens.total,
134
134
  cost: t.cost,
@@ -148,25 +148,25 @@ function statusOf(entry, alive, mtime) {
148
148
  return Date.now() - mtime < 5000 ? 'busy' : 'idle';
149
149
  }
150
150
 
151
- // 응답 대기는 Claude Code 가 세션 파일에 적은 값이다. 그동안 서브에이전트가 돌고 있으면 함께 적어 구분되게 한다.
151
+ // 응답 대기는 Claude Code 가 세션 파일에 적은 값이다. 그동안 서브에이전트가 돌고 있으면 수를 args.agents 로 함께 보내 구분되게 한다.
152
152
  function withRunningMembers(phase, status, members) {
153
153
  if (status !== 'waiting') return phase;
154
154
  const running = members.filter((m) => m.status !== 'done' && m.phase?.kind !== 'done').length;
155
- return running ? { ...phase, text: `${phase.text} · 에이전트 ${running}개 실행 중` } : phase;
155
+ return running ? { ...phase, args: { ...phase.args, agents: running } } : phase;
156
156
  }
157
157
 
158
158
  function phaseOf(status, entry, t) {
159
159
  switch (status) {
160
160
  case 'ended':
161
- return { kind: 'ended', text: '종료' };
161
+ return { kind: 'ended' };
162
162
  case 'waiting':
163
- return { kind: 'waiting', text: entry.waitingFor ? `응답 대기 · ${entry.waitingFor}` : '응답 대기' };
163
+ return entry.waitingFor ? { kind: 'waiting', args: { what: entry.waitingFor } } : { kind: 'waiting' };
164
164
  case 'shell':
165
- return { kind: 'tool', text: '쉘 명령 실행 중' };
165
+ return { kind: 'tool', msg: 'shell' };
166
166
  case 'idle':
167
- return { kind: 'idle', text: '다음 지시 대기' };
167
+ return { kind: 'idle' };
168
168
  default:
169
- return loadingPhase(t) ?? (t ? t.phase() : { kind: 'think', text: '작업 중' });
169
+ return loadingPhase(t) ?? (t ? t.phase() : { kind: 'think', msg: 'working' });
170
170
  }
171
171
  }
172
172
 
@@ -276,7 +276,7 @@ function endedFromTranscripts(known, selectedId, budget) {
276
276
  live: false,
277
277
  lazy: !t,
278
278
  status: 'ended',
279
- phase: loadingPhase(t) ?? { kind: 'ended', text: '종료' },
279
+ phase: loadingPhase(t) ?? { kind: 'ended' },
280
280
  waitingFor: null,
281
281
  now: '',
282
282
  startedAt: head.startedAt,
@@ -8,12 +8,11 @@ import { JsonlTail } from '../tail.mjs';
8
8
  import { loadCache, markDirty } from '../cache.mjs';
9
9
  import { codexCost } from '../pricing.mjs';
10
10
  import { dayDirs } from './codex.mjs';
11
- import { dayKey, lastDays, addSlot } from './common.mjs';
11
+ import { dayKey, lastDays, addSlot, addModel, KEEP_DAYS } from './common.mjs';
12
12
  import { debugIo } from '../log.mjs';
13
13
 
14
14
  const KIND = 'codex-ledger';
15
15
  const DAYS = 7;
16
- const KEEP_DAYS = 10;
17
16
  const LIST_TTL_MS = 30_000;
18
17
  const SCAN_DAYS = 30;
19
18
 
@@ -86,20 +85,21 @@ export class CodexBook {
86
85
  day.tokens += tokens;
87
86
  day.cost += cost?.total ?? 0;
88
87
  day.costNoCache += cost?.noCache ?? 0;
88
+ addModel(day, this.model, tokens, cost?.total ?? 0, !cost);
89
89
  if (!cost) day.unknown = true;
90
90
  addSlot(this.slots, at, cost?.total ?? 0, cost?.noCache ?? 0, !cost);
91
91
  }
92
92
  }
93
93
 
94
- let listed = { at: 0, files: [] };
94
+ let listed = { at: 0, files: [], days: 0 };
95
95
 
96
96
  // 며칠 전에 시작했거나 다시 이어 쓴 세션도 시작한 날짜 폴더에 쓰므로, 30일치 폴더에서 7일 안에 바뀐 기록을 고른다.
97
- // 7일보다 오래된 줄은 날짜 키로 걸러진다.
98
- function recentFiles() {
99
- if (Date.now() - listed.at < LIST_TTL_MS) return listed.files;
100
- const cutoff = Date.now() - DAYS * 86400_000;
97
+ // 7일보다 오래된 줄은 날짜 키로 걸러진다. 리포트처럼 days 를 늘리면 폴더도 그만큼 더 거슬러 본다 (30일 리포트면 53일치).
98
+ function recentFiles(days = DAYS) {
99
+ if (listed.days === days && Date.now() - listed.at < LIST_TTL_MS) return listed.files;
100
+ const cutoff = Date.now() - days * 86400_000;
101
101
  const files = [];
102
- for (const dir of dayDirs(SCAN_DAYS)) {
102
+ for (const dir of dayDirs(SCAN_DAYS + days - DAYS)) {
103
103
  let names = [];
104
104
  try {
105
105
  names = readdirSync(dir);
@@ -114,16 +114,17 @@ function recentFiles() {
114
114
  } catch {}
115
115
  }
116
116
  }
117
- listed = { at: Date.now(), files };
117
+ listed = { at: Date.now(), files, days };
118
118
  return files;
119
119
  }
120
120
 
121
121
  const books = new Map();
122
122
 
123
123
  // 기록마다 날짜별 합계(days)와 5분 칸(slots), 아직 읽지 않은 크기(pending)·전체 크기(size).
124
- export function collectCodexLedger({ budget } = {}) {
124
+ // days: 최근 며칠 안에 바뀐 기록을 볼지 (평소 7일, 리포트는 더 길게).
125
+ export function collectCodexLedger({ budget, days = DAYS } = {}) {
125
126
  const out = { days: [], slots: [], pending: 0, size: 0 };
126
- const files = recentFiles();
127
+ const files = recentFiles(days);
127
128
  const keep = new Set(files);
128
129
  for (const p of books.keys()) if (!keep.has(p)) books.delete(p);
129
130
  for (const p of files) {
@@ -138,4 +139,4 @@ export function collectCodexLedger({ budget } = {}) {
138
139
  return out;
139
140
  }
140
141
 
141
- export const _test = { reset: () => ((listed = { at: 0, files: [] }), books.clear()) };
142
+ export const _test = { reset: () => ((listed = { at: 0, files: [], days: 0 }), books.clear()) };
@@ -171,11 +171,11 @@ function snapshot(st) {
171
171
  }
172
172
 
173
173
  function phaseOf(st, live) {
174
- if (!live) return { kind: 'ended', text: '종료' };
175
- if (!st.busy) return { kind: 'idle', text: '다음 지시 대기' };
174
+ if (!live) return { kind: 'ended' };
175
+ if (!st.busy) return { kind: 'idle' };
176
176
  const open = [...st.pending.values()];
177
- if (open.length) return { kind: 'tool', text: `도구 실행 · ${open.at(-1)}` };
178
- return st.lastKind === 'reply' ? { kind: 'write', text: '답변 작성 중' } : { kind: 'think', text: '생각 중' };
177
+ if (open.length) return { kind: 'tool', args: { what: open.at(-1) } };
178
+ return st.lastKind === 'reply' ? { kind: 'write' } : { kind: 'think' };
179
179
  }
180
180
 
181
181
  function applyLine(st, x) {
@@ -367,7 +367,7 @@ export function collectCodex({ showEnded, budget, filesOf = openFiles, startOf =
367
367
  // 아직 세션 파일을 만들지 않은(첫 입력 전) codex 프로세스도 보여 준다.
368
368
  for (const [cwd, pids] of slots) {
369
369
  for (const pid of pids) {
370
- out.push({ tool: 'codex', id: `pid-${pid}`, pid, kind: 'interactive', name: basename(cwd ?? '') || 'codex', cwd, project: basename(cwd ?? ''), live: true, status: 'idle', phase: { kind: 'idle', text: '첫 입력 대기' }, cost: null, now: '', updatedAt: Date.now(), tokens: emptyTokens(), context: { used: 0, window: 0 }, events: [], members: [] });
370
+ out.push({ tool: 'codex', id: `pid-${pid}`, pid, kind: 'interactive', name: basename(cwd ?? '') || 'codex', cwd, project: basename(cwd ?? ''), live: true, status: 'idle', phase: { kind: 'idle', msg: 'firstInput' }, cost: null, now: '', updatedAt: Date.now(), tokens: emptyTokens(), context: { used: 0, window: 0 }, events: [], members: [] });
371
371
  }
372
372
  }
373
373
  return out;
@@ -27,6 +27,19 @@ export function lastDays(n, now = Date.now()) {
27
27
  return keys;
28
28
  }
29
29
 
30
+ // 장부가 날짜별로 남기는 일수. 기간 리포트(--report)가 볼 수 있는 가장 긴 기간이기도 하다.
31
+ // 평소 실행은 최근 7일 안에 바뀐 기록만 읽지만, 그 기록 안의 30일치 날짜 합계는 캐시에 남겨 리포트가 다시 읽지 않게 한다.
32
+ export const KEEP_DAYS = 30;
33
+
34
+ // 하루 합계(day)에 모델별 몫 { tokens, cost } 를 더한다. 모델 이름을 모르면 'unknown' 으로 센다.
35
+ // unknown: 가격표에 없는 모델이라 비용을 0 으로 셌을 때. 그 모델 몫에 unknown 을 남겨 리포트가 ? 를 붙인다.
36
+ export function addModel(day, model, tokens, cost, unknown = false) {
37
+ const m = ((day.models ??= {})[String(model || 'unknown')] ??= { tokens: 0, cost: 0 });
38
+ m.tokens += tokens;
39
+ m.cost += cost;
40
+ if (unknown) m.unknown = true;
41
+ }
42
+
30
43
  // 지출 속도용 짧은 구간 장부. 비용을 5분 칸(키 = 칸 시작 시각 ms)에 모으고, 그 장부에서 가장 새 칸부터
31
44
  // 2시간 안의 칸만 남긴다. 기준이 시계가 아니라 기록 안의 시각이라 처음 읽기 중에도 칸 수가 일정하다.
32
45
  export const SLOT_MS = 5 * 60_000;
@@ -14,7 +14,7 @@ export function collectGemini() {
14
14
  project: basename(p.cwd ?? ''),
15
15
  live: true,
16
16
  status: 'live',
17
- phase: { kind: 'idle', text: '실행 중 (세부 정보 미지원)' },
17
+ phase: { kind: 'idle', msg: 'geminiLimited' },
18
18
  cost: null,
19
19
  now: '',
20
20
  updatedAt: Date.now(),
package/src/ui/chrome.mjs CHANGED
@@ -3,8 +3,8 @@ import { pad, width } from '../text.mjs';
3
3
  import { NO_COLOR, PALETTE } from './theme.mjs';
4
4
  import { box, line, segsWidth } from './draw.mjs';
5
5
  import { glyphs, legendMark } from './glyphs.mjs';
6
- import { GROUP_LABEL, SORT_LABEL } from '../order.mjs';
7
- import { COMMON, OPTIONS, VIEWS, helpContext, keysLine, settingsLine } from '../help.mjs';
6
+ import { COMMON, VIEWS, helpContext, keysLine, options, settingsLine, viewText } from '../help.mjs';
7
+ import { getLang, t } from '../i18n.mjs';
8
8
 
9
9
  // 상세 패널을 기본으로 여는 최소 화면 높이. 이보다 낮으면 세션 표에 줄을 준다.
10
10
  export const DETAIL_MIN_H = 24;
@@ -14,55 +14,61 @@ export function detailOpen(view, H) {
14
14
  return view.showDetail === 'auto' ? H >= DETAIL_MIN_H : Boolean(view.showDetail);
15
15
  }
16
16
 
17
- // 상태 기호와 열 설명. 키는 help.mjs 의 VIEWS 에서 화면별로 고른다.
18
- export const LEGEND = [
19
- ['상태 기호', null],
20
- ['⠋', '작업 중 (STATUS 칸에 생각·답변, 도구 실행, 팀원 작업. 색으로도 나뉜다)'],
21
- ['◆', '응답 대기 (권한·질문). 행 배경이 강조된다'],
22
- ['●', '완료 · 확인 전 (작업이 끝났는데 아직 선택해 보지 않음)'],
23
- ['○', '다음 지시 대기'],
24
- ['·', '종료'],
25
- ['★', '고정한 세션 (p). SESSION 칸 앞에 붙는다'],
17
+ // 상태 기호와 열 설명 [기호·열 이름, i18n 키]. 키는 help.mjs 의 VIEWS 에서 화면별로 고른다.
18
+ const LEGEND_IDS = [
19
+ ['help.legend', null],
20
+ ['⠋', 'legend.busy'],
21
+ ['◆', 'legend.waiting'],
22
+ ['●', 'legend.unseen'],
23
+ ['○', 'legend.idle'],
24
+ ['·', 'legend.ended'],
25
+ ['★', 'legend.pin'],
26
26
  ['', ''],
27
- ['열', null],
28
- ['STATUS', '지금 단계. 큰 기록을 처음 읽는 동안은 기록 읽는 중 N%'],
29
- ['TOKENS', '세션 누적 토큰 (서브에이전트 포함, 캐시 읽기 포함)'],
30
- ['COST', 'API 정가로 환산한 비용 (Codex 는 OpenAI 정가 추정). ? 는 가격표에 없는 모델 포함'],
31
- ['CONTEXT', '마지막 요청의 컨텍스트 사용률 (모델별 창 크기 기준)'],
32
- ['IDLE', '마지막 활동 후 지난 시간. 작업 중이면 now'],
33
- ['숨김 N', '도구 줄 끝: 7일 동안 안 쓴 도구를 숨김. 다시 보려면 설정 파일에 "hideIdleTools": false'],
34
- ['+N', '도구 줄 끝: 화면이 좁아 접은 도구 수 (넓히면 보인다)'],
35
- ['오늘 / 7일', '헤더 오른쪽. 날짜별 합계, API 정가 환산이며 구독 요금제의 청구액이 아니다'],
36
- ['변경 파일', 'Edit/Write(Codex 는 apply_patch) 로 고친 파일과 편집 횟수. git diff 가 아니다'],
27
+ ['help.columns', null],
28
+ ['STATUS', 'legend.status'],
29
+ ['TOKENS', 'legend.tokens'],
30
+ ['COST', 'legend.cost'],
31
+ ['CONTEXT', 'legend.context'],
32
+ ['IDLE', 'legend.idleCol'],
33
+ ['legend.hiddenKey', 'legend.hidden'],
34
+ ['+N', 'legend.folded'],
35
+ ['legend.periodKey', 'legend.period'],
36
+ ['legend.filesKey', 'legend.files'],
37
37
  ];
38
38
 
39
+ // 지금 언어의 상태 기호·열 설명. 제목 줄은 설명이 null 이다.
40
+ export const legend = () => LEGEND_IDS.map(([k, d]) => [/^(help|legend)\./.test(k) ? t(k) : k, d ? t(d) : d]);
41
+
39
42
  // 도움말 줄 목록: 지금 화면의 키 → (표에 검색어가 걸려 있으면) 그 키 → (상세 패널이 열려 있으면) 상세 패널 키 → 어디서나 쓰는 키 → 다른 화면 한 줄씩 → 옵션 → 상태 기호·열.
40
43
  // 넓으면(100칸 이상) 키는 왼쪽, 옵션·기호·열은 오른쪽 칸에 둔다.
41
44
  export function helpSections(view = {}, open = false) {
42
45
  const ctx = helpContext(view);
43
46
  const here = ctx === 'table' ? ['table', ...(view.filter ? ['filtered'] : []), ...(open ? ['detail'] : [])] : [ctx];
44
- const keys = [...here.map((n) => VIEWS[n]), COMMON].flatMap((v, i) => [...(i ? [['', '']] : []), [`${v.title}${i ? '' : ' (지금 화면)'}`, null], ...v.keys.map(([k, t]) => [k, t])]);
47
+ const keys = [...here.map((n) => VIEWS[n]), COMMON].map((v) => viewText(v)).flatMap((v, i) => [...(i ? [['', '']] : []), [`${v.title}${i ? '' : t('help.here')}`, null], ...v.keys]);
45
48
  const others = Object.keys(VIEWS).filter((n) => !here.includes(n));
46
- const rest = [['', ''], ['다른 화면', null], ...others.map((n) => [VIEWS[n].title, keysLine(n), 'dim'])];
49
+ const rest = [['', ''], [t('help.others'), null], ...others.map((n) => [viewText(VIEWS[n]).title, keysLine(n), 'dim'])];
47
50
  const now = settingsLine(view.settings);
48
- const options = [
49
- ['옵션', null],
50
- ...OPTIONS,
51
- ...(view.settings?.configPath ? [['설정 파일', view.settings.configPath, 'dim']] : []),
52
- ...(now ? [['지금', now]] : []),
51
+ const opts = [
52
+ [t('help.options'), null],
53
+ ...options(),
54
+ ...(view.settings?.configPath ? [[t('help.config'), view.settings.configPath, 'dim']] : []),
55
+ ...(now ? [[t('help.now'), now]] : []),
53
56
  ];
54
- return { keys: [...keys, ...rest], more: [...options, ['', ''], ...LEGEND.map(([k, t]) => [legendMark(k), t])] };
57
+ return { keys: [...keys, ...rest], more: [...opts, ['', ''], ...legend().map(([k, d]) => [legendMark(k), d])] };
55
58
  }
56
59
 
57
60
  // 키 칸 폭은 제목 줄 사이 묶음마다 그 묶음의 가장 긴 키에 맞춘다 (12~21칸).
61
+ // 영어는 키 이름(Typing a search, Changed files)이 길어 설명과 붙어 보이므로 사이를 2칸 둔다 (한국어는 예전대로 1칸).
58
62
  function helpLines(list) {
59
63
  const out = [];
64
+ const gap = getLang() === 'ko' ? 1 : 2;
65
+ const cap = 20 + gap;
60
66
  let kw = 12;
61
67
  list.forEach(([k, v, dim], i) => {
62
68
  if (v == null) {
63
69
  const next = list.slice(i + 1);
64
70
  const block = next.slice(0, Math.max(0, next.findIndex((e) => e[1] == null)) || next.length);
65
- kw = Math.min(21, Math.max(12, ...block.filter((e) => e[1]).map((e) => width(e[0]) + 1)));
71
+ kw = Math.min(cap, Math.max(12, ...block.filter((e) => e[1]).map((e) => width(e[0]) + gap)));
66
72
  out.push([{ t: k, fg: PALETTE.brand, bold: true }]);
67
73
  } else out.push([{ t: pad(k, kw), fg: PALETTE.text, bold: !dim }, { t: v, fg: dim ? PALETTE.info : PALETTE.muted }]);
68
74
  });
@@ -71,7 +77,7 @@ function helpLines(list) {
71
77
 
72
78
  // 줄이 넘치면 scroll 만큼 내려 보이고, 아래에 남은 줄이 있으면 마지막 줄에 알린다.
73
79
  function windowOf(lines, n, scroll) {
74
- const more = (k) => [{ t: `… ${k}줄 더 · ↑↓ 로 스크롤`, fg: PALETTE.info, italic: true }];
80
+ const more = (k) => [{ t: t('help.more', { n: k }), fg: PALETTE.info, italic: true }];
75
81
  const part = lines.slice(scroll, scroll + n);
76
82
  const left = lines.length - scroll - n;
77
83
  return left > 0 ? [...part.slice(0, n - 1), more(left + 1)] : part;
@@ -80,7 +86,7 @@ function windowOf(lines, n, scroll) {
80
86
  // view.helpScroll: ↑↓ 로 내린 줄 수. 넘치지 않으면 0. 내릴 수 있는 끝은 view.helpMax 에 남긴다 (keys.mjs 가 쓴다).
81
87
  export function help(W, H, view = {}, open = false) {
82
88
  const { keys, more } = helpSections(view, open);
83
- const title = '도움말 · ? 또는 Esc 로 닫기';
89
+ const title = t('help.title');
84
90
  const rows = H - 2;
85
91
  const wide = W >= 100;
86
92
  const cols = wide ? [helpLines(keys), helpLines(more)] : [helpLines([...keys, ['', ''], ...more])];
@@ -97,7 +103,7 @@ export function help(W, H, view = {}, open = false) {
97
103
  // 키 칩. 색이 없으면 [f] 처럼 괄호로 보인다.
98
104
  export const keyChip = (k) => (NO_COLOR ? { t: `[${k}]` } : { t: ` ${k} `, fg: PALETTE.chipText, bg: PALETTE.muted, bold: true });
99
105
 
100
- export const keyLabel = (t) => ({ t: ` ${t} `, fg: PALETTE.muted });
106
+ export const keyLabel = (v) => ({ t: ` ${v} `, fg: PALETTE.muted });
101
107
 
102
108
  // items: { k, t, keep } 또는 { segs, keep }. 폭이 모자라면 keep 이 아닌 항목을 오른쪽부터 뺀다.
103
109
  export function hintBar(items, W, right = '') {
@@ -114,50 +120,52 @@ export function hintBar(items, W, right = '') {
114
120
  // 정렬·묶기가 기본이 아닐 때만 지금 상태를 짧게 보인다 (예: s:비용 g:프로젝트). 표 순서를 읽는 데 필요하므로 d·e·c 안내보다 늦게 빠진다.
115
121
  function orderHint(view) {
116
122
  const parts = [
117
- ...(view.sort && view.sort !== 'default' ? [['s', SORT_LABEL[view.sort]]] : []),
118
- ...(view.group && view.group !== 'none' ? [['g', GROUP_LABEL[view.group]]] : []),
123
+ ...(view.sort && view.sort !== 'default' ? [['s', t(`sort.${view.sort}`)]] : []),
124
+ ...(view.group && view.group !== 'none' ? [['g', t(`groupBy.${view.group}`)]] : []),
119
125
  ];
120
126
  if (!parts.length) return null;
121
- const segs = parts.flatMap(([k, t], i) => [{ t: i ? ' ' : '', fg: PALETTE.info }, { t: k, fg: PALETTE.muted, bold: true }, { t: `:${t}`, fg: PALETTE.info }]);
127
+ const segs = parts.flatMap(([k, v], i) => [{ t: i ? ' ' : '', fg: PALETTE.info }, { t: k, fg: PALETTE.muted, bold: true }, { t: `:${v}`, fg: PALETTE.info }]);
122
128
  return { segs: [...segs, { t: ' ' }] };
123
129
  }
124
130
 
125
131
  export function footer(view, W, matched, sel) {
132
+ const RO = t('foot.readOnly');
126
133
  const tail = [
127
- { k: '?', t: '도움', keep: true },
128
- { k: 'q', t: '나가기', keep: true },
134
+ { k: '?', t: t('foot.help'), keep: true },
135
+ { k: 'q', t: t('key.quit'), keep: true },
129
136
  ];
137
+ const ended = { k: 'e', t: t(view.showEnded ? 'foot.hideEnded' : 'foot.showEnded') };
130
138
  // 도움말이 열려 있으면 ↑↓ 는 도움말을 스크롤하고 ? · Esc 는 닫는다.
131
- if (view.help) return hintBar([{ k: '↑↓', t: '스크롤' }, { k: '?', t: '도움 닫기', keep: true }, { k: 'Esc', t: '닫기' }, { k: 'q', t: '나가기', keep: true }], W, '⊘ 읽기전용');
139
+ if (view.help) return hintBar([{ k: '↑↓', t: t('key.scroll') }, { k: '?', t: t('foot.closeHelp'), keep: true }, { k: 'Esc', t: t('key.close') }, { k: 'q', t: t('key.quit'), keep: true }], W, RO);
132
140
  if (view.searching) {
133
141
  const input = NO_COLOR ? [{ t: '[/]' }] : [{ t: ' / ', fg: PALETTE.chipText, bg: PALETTE.brand, bold: true }];
134
- return hintBar([{ segs: [...input, { t: ` ${view.filter ?? ''}`, fg: PALETTE.text, bold: true }, { t: glyphs().cursor, fg: PALETTE.brand }, { t: ` ${matched}개 `, fg: PALETTE.muted }], keep: true }, { k: '⏎', t: '적용', keep: true }, { k: 'Esc', t: '지우기', keep: true }], W);
142
+ return hintBar([{ segs: [...input, { t: ` ${view.filter ?? ''}`, fg: PALETTE.text, bold: true }, { t: glyphs().cursor, fg: PALETTE.brand }, { t: ` ${t('foot.count', { n: matched })} `, fg: PALETTE.muted }], keep: true }, { k: '⏎', t: t('key.apply'), keep: true }, { k: 'Esc', t: t('foot.clear'), keep: true }], W);
135
143
  }
136
144
  if (view.focus) {
137
145
  const keys =
138
146
  view.focus === 'diff'
139
- ? [{ k: '↑↓', t: '스크롤' }, { k: 'space', t: '페이지' }, { k: '[ ]', t: '이전·다음 파일' }, { k: 'Esc', t: '파일 목록으로', keep: true }]
140
- : [{ k: '←→', t: '지시' }, { k: '↑↓', t: '파일 선택' }, { k: '⏎', t: 'diff 보기' }, { k: 'Esc', t: '세션으로', keep: true }];
141
- return hintBar([...keys, ...tail], W, '⊘ 읽기전용');
147
+ ? [{ k: '↑↓', t: t('key.scroll') }, { k: 'space', t: t('key.page') }, { k: '[ ]', t: t('key.prevNext') }, { k: 'Esc', t: t('foot.toFiles'), keep: true }]
148
+ : [{ k: '←→', t: t('foot.prompts') }, { k: '↑↓', t: t('foot.pickFile') }, { k: '⏎', t: t('foot.viewDiff') }, { k: 'Esc', t: t('foot.toSessions'), keep: true }];
149
+ return hintBar([...keys, ...tail], W, RO);
142
150
  }
143
151
  // 세션이 하나도 없으면 쓸 수 있는 키만 남긴다.
144
- if (!view.filter && !view.data?.sessions?.length) return hintBar([{ k: 'e', t: view.showEnded ? '종료 숨김' : '종료 포함' }, ...tail], W, '⊘ 읽기전용');
152
+ if (!view.filter && !view.data?.sessions?.length) return hintBar([ended, ...tail], W, RO);
145
153
  const order = orderHint(view);
146
154
  const search = view.filter
147
- ? { segs: [{ t: ` /${view.filter} `, fg: PALETTE.chipText, bg: PALETTE.brand, bold: true }, { t: ` ${matched}개 `, fg: PALETTE.muted }, keyChip('Esc'), keyLabel('검색 지우기')], keep: true }
148
- : { k: '/', t: '검색' };
155
+ ? { segs: [{ t: ` /${view.filter} `, fg: PALETTE.chipText, bg: PALETTE.brand, bold: true }, { t: ` ${t('foot.count', { n: matched })} `, fg: PALETTE.muted }, keyChip('Esc'), keyLabel(t('foot.clearSearch'))], keep: true }
156
+ : { k: '/', t: t('key.search') };
149
157
  const items = [
150
158
  search,
151
- { k: '↑↓', t: '선택' },
152
- { k: 'n', t: '다음' },
159
+ { k: '↑↓', t: t('key.select') },
160
+ { k: 'n', t: t('foot.next') },
153
161
  ...(order ? [order] : []),
154
- ...(sel?.files?.length ? [{ k: 'f', t: '파일' }] : []),
155
- { k: 'd', t: view.showDetail ? '상세 닫기' : '상세 열기' },
156
- { k: 'e', t: view.showEnded ? '종료 숨김' : '종료 포함' },
157
- { k: 'c', t: '비용 기준' },
162
+ ...(sel?.files?.length ? [{ k: 'f', t: t('foot.files') }] : []),
163
+ { k: 'd', t: t(view.showDetail ? 'foot.hideDetail' : 'foot.showDetail') },
164
+ ended,
165
+ { k: 'c', t: t('foot.costMode') },
158
166
  // 고정은 폭이 모자라면 가장 먼저 빠진다.
159
- ...(sel ? [{ k: 'p', t: view.pins?.includes(sel.id) ? '고정 해제' : '고정' }] : []),
167
+ ...(sel ? [{ k: 'p', t: t(view.pins?.includes(sel.id) ? 'foot.unpin' : 'key.pin') }] : []),
160
168
  ...tail,
161
169
  ];
162
- return hintBar(items, W, '⊘ 읽기전용');
170
+ return hintBar(items, W, RO);
163
171
  }