@sejuneoh/aitop 0.36.0 → 0.37.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/README.md +22 -5
- package/bin/aitop.mjs +52 -15
- package/package.json +1 -1
- package/src/attention.mjs +9 -4
- package/src/cache.mjs +4 -1
- package/src/doctor.mjs +7 -4
- package/src/help.mjs +1 -0
- package/src/i18n.mjs +44 -9
- package/src/json.mjs +5 -1
- package/src/keys.mjs +2 -0
- package/src/line.mjs +6 -1
- package/src/notify.mjs +62 -4
- package/src/order.mjs +4 -3
- package/src/procs.mjs +44 -5
- package/src/sources/claude-tracker.mjs +37 -0
- package/src/sources/claude.mjs +303 -31
- package/src/suggest.mjs +31 -0
- package/src/summary.mjs +2 -1
- package/src/ui/chrome.mjs +21 -4
- package/src/ui/detail.mjs +123 -9
- package/src/ui/draw.mjs +7 -4
- package/src/ui/glyphs.mjs +2 -1
- package/src/ui/table.mjs +45 -19
- package/src/ui.mjs +30 -1
package/README.md
CHANGED
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
> `aitop --once`
|
|
47
47
|
|
|
48
48
|
- Print the current state once and exit.
|
|
49
|
+
- Piped or redirected to a file, it prints only the content: no padding lines to fill the screen height, no trailing spaces and no key bar.
|
|
49
50
|
|
|
50
51
|
> `aitop --json`
|
|
51
52
|
|
|
@@ -66,11 +67,12 @@
|
|
|
66
67
|
> `aitop --help`
|
|
67
68
|
|
|
68
69
|
- All options.
|
|
70
|
+
- A mistyped option prints the error with the closest match and a pointer to `aitop --help` (two lines, no full help), like `unknown option --notfy (did you mean --notify?)`, and exits with 2. A bad `--theme` value works the same way.
|
|
69
71
|
|
|
70
72
|
**Keys on the live screen**
|
|
71
73
|
|
|
72
74
|
- `↑↓` select · `n` next session to check · `/` search · `s` sort · `g` group
|
|
73
|
-
- `p` pin · `f` changed files · `?` help · `q` quit
|
|
75
|
+
- `p` pin · `f` changed files · `a` waiting alerts on/off · `?` help · `q` quit
|
|
74
76
|
|
|
75
77
|
**Config file**
|
|
76
78
|
|
|
@@ -90,7 +92,7 @@
|
|
|
90
92
|
- **Read-only**: no network, no ports, no dependencies. It only reads the session logs each CLI already writes.
|
|
91
93
|
|
|
92
94
|
<details>
|
|
93
|
-
<summary>Details: stopped sessions, cache countdown, tool run time</summary>
|
|
95
|
+
<summary>Details: stopped sessions, cache countdown, tool run time, context gauge, tool line</summary>
|
|
94
96
|
|
|
95
97
|
**Stopped by an error**
|
|
96
98
|
|
|
@@ -110,7 +112,17 @@
|
|
|
110
112
|
- Measured from the open tool call's start (Claude `tool_use`, Codex `function_call`, Antigravity running step).
|
|
111
113
|
- Shown after one minute, in a dim warning color from ten minutes (Claude Code's Bash timeout max).
|
|
112
114
|
- Not counted while waiting for approval.
|
|
113
|
-
- Dropped first on narrow screens
|
|
115
|
+
- Dropped first on narrow screens, after the verb: a narrow STATUS cell keeps the target and time (`Bash $ npm test · 9m55s`). `--json` has `toolStartedAt`.
|
|
116
|
+
|
|
117
|
+
**Context gauge**
|
|
118
|
+
|
|
119
|
+
- `~` marks 60% and up, `!` 85% and up, so the levels show without color. Under `NO_COLOR` the bar is `███░░`, and a gauge that reads 0% has no filled cell.
|
|
120
|
+
|
|
121
|
+
**Tool line and empty screen**
|
|
122
|
+
|
|
123
|
+
- Tools with no live session and no use for 7 days leave the tool line. Its end tells the two kinds apart: `not installed: codex unused 7d: gemini` (counts when space is short). Turn it off with `"hideIdleTools": false`.
|
|
124
|
+
- When a tool's process runs but it has no session records yet, the empty screen says so first (`agy running, but no session records to read yet.`) and what to do next.
|
|
125
|
+
- The `?` key is always labeled `help`, at any width.
|
|
114
126
|
|
|
115
127
|
</details>
|
|
116
128
|
|
|
@@ -124,6 +136,8 @@ Subagents show as `├─` rows under their session, on the live screen.
|
|
|
124
136
|
- A dim `stalled?` appears when a working subagent's log has not changed for 3 minutes. It is only a guess.
|
|
125
137
|
- While it runs a tool that can be slow, the limit is 10 minutes.
|
|
126
138
|
- When an Antigravity subagent waits for your approval, its parent row waits too, as `<agent>: <tool>`.
|
|
139
|
+
- A `claude -p` run started from a Claude session (by its process, or from `~/.claude/jobs/<id>/` once ended) shows as a `-p` row under that session, with its cost added; one with no parent (cron) stays on top marked `auto` and never counts as waiting for you.
|
|
140
|
+
- If the parent session stays open for more than 24 hours, `claude -p` runs that ended before that are left out of its total.
|
|
127
141
|
|
|
128
142
|
<details>
|
|
129
143
|
<summary>Details: <code>stalled?</code> and Antigravity waits</summary>
|
|
@@ -289,6 +303,8 @@ Alerts when a session starts waiting, finishes a long turn or fills its context.
|
|
|
289
303
|
- `--notify=waiting,done,context`: pick the kinds. Plain `--notify` uses the config file kinds, or waiting only when none are set.
|
|
290
304
|
- `--on-waiting`: run a command with `/bin/sh -c` (`cmd.exe /d /v:on /s /c` on Windows) for the same events (10 second limit, runs as you).
|
|
291
305
|
- Sessions already waiting (or already over 90% context) when aitop starts are not reported.
|
|
306
|
+
- Press `a` on the live screen to turn desktop alerts on or off for this run only. The config file is not changed. The state (`alerts:on` or `alerts:off`) shows on the key line when there is room, and always on the "now" line of the `?` help. If no alert tool is found, it shows off.
|
|
307
|
+
- When alerts are off and a waiting session first shows up (including one already waiting when aitop starts), the key line shows `turn on waiting alerts: a` once per run. If the help or search is open, it waits until you close it. It does not show when you turned alerts off yourself (config file `"notify": false` or `--no-notify`).
|
|
292
308
|
|
|
293
309
|
**Kinds**
|
|
294
310
|
|
|
@@ -353,6 +369,7 @@ set -g status-interval 15
|
|
|
353
369
|
- The Claude Code sessions stopped by an API error (`stop 1`, read live).
|
|
354
370
|
- The number of sessions running (`run 3`).
|
|
355
371
|
- Spend over the last hour.
|
|
372
|
+
- `aitop idle` when there is nothing to show (`idle` or `-` in a very narrow `--line-width`), so an empty line never looks like a broken setup.
|
|
356
373
|
|
|
357
374
|
**Options**
|
|
358
375
|
|
|
@@ -416,7 +433,7 @@ aitop reads `~/.claude` and `~/.codex` by default. List more profiles to read th
|
|
|
416
433
|
|
|
417
434
|
## Resume a session elsewhere
|
|
418
435
|
|
|
419
|
-
Continue a session elsewhere, for example when you cannot jump to its tab, as in Windows Terminal with WSL. The detail panel shows a `Resume` command and `y` copies it.
|
|
436
|
+
Continue a session elsewhere, for example when you cannot jump to its tab, as in Windows Terminal with WSL. The detail panel shows a `Resume` command and `y` copies it. The panel wraps it at spaces, `/` and `\`, keeps the resume part (`claude --resume <id>`) on the last line(s), and keeps the session id on one line when the width allows. A long `cd` part is shortened in the middle with `…`; `y` still copies the whole command.
|
|
420
437
|
|
|
421
438
|
> Claude: `cd <dir> && claude --resume <id>`
|
|
422
439
|
>
|
|
@@ -476,7 +493,7 @@ Continue a session elsewhere, for example when you cannot jump to its tab, as in
|
|
|
476
493
|
**Other fields**
|
|
477
494
|
|
|
478
495
|
- `cacheExpiresAt`, `toolStartedAt`: [Features](#features).
|
|
479
|
-
- `stalled`, `startedAt`, `lastActivityAt`: [Subagents](#subagents).
|
|
496
|
+
- `stalled`, `startedAt`, `lastActivityAt`, `entrypoint`, `auto`, `parentId`: [Subagents](#subagents).
|
|
480
497
|
- `resumeCmd`: [Resume a session elsewhere](#resume-a-session-elsewhere).
|
|
481
498
|
- Report output (`month`, `current`, `status`, `paths`, `unpriced`, `waitedMs`): [Daily and monthly reports](#daily-and-monthly-reports), [Session report](#session-report).
|
|
482
499
|
|
package/bin/aitop.mjs
CHANGED
|
@@ -5,10 +5,13 @@ import { langOption, pickLang, setLang, t } from '../src/i18n.mjs';
|
|
|
5
5
|
import { notifyOptions } from '../src/notify.mjs';
|
|
6
6
|
import { lineOption } from '../src/line.mjs';
|
|
7
7
|
import { reportOption } from '../src/report.mjs';
|
|
8
|
+
import { suggest } from '../src/suggest.mjs';
|
|
8
9
|
import { mask, setAmbiguous, stripControl } from '../src/text.mjs';
|
|
9
10
|
|
|
10
11
|
const KNOWN = new Set(['-h', '--help', '-v', '--version', '--once', '--all', '--json', '--doctor', '--bell', '--show-requests', '--print-config', '--no-bell', '--no-all', '--no-show-requests', '--debug', '--no-debug', '--color-blind', '--no-color-blind']);
|
|
11
12
|
const THEMES = ['light', 'dark'];
|
|
13
|
+
// 잘못 친 옵션에 제안할 후보. KNOWN 의 긴 옵션과, 다른 모듈이 먼저 꺼내는 값 옵션을 합친다.
|
|
14
|
+
const OPTIONS = [...[...KNOWN].filter((o) => o.startsWith('--')), '--theme', '--lang', '--notify', '--no-notify', '--on-waiting', '--no-on-waiting', '--budget-day', '--no-budget-day', '--line', '--line-width', '--report', '--by', '--days', '--months', '--since', '--plan', '--md', '--show-prompts'];
|
|
12
15
|
const VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
|
|
13
16
|
|
|
14
17
|
// 언어는 다른 옵션의 오류 문구보다 먼저 정한다: --lang > AITOP_LANG > 설정 파일 lang > LC_ALL > LC_MESSAGES > LANG.
|
|
@@ -109,10 +112,17 @@ if (theme === '') {
|
|
|
109
112
|
process.stderr.write(`aitop: ${t('cli.themeMissing')}\n`);
|
|
110
113
|
process.exit(2);
|
|
111
114
|
}
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
// 모르는 옵션은 도움말 전체 대신 가까운 옵션 제안과 --help 안내 한 줄만 낸다 (#291).
|
|
116
|
+
const unknown = [...args].filter((a) => !KNOWN.has(a)).map((a) => {
|
|
117
|
+
const near = a.startsWith('-') ? suggest(a, OPTIONS) : null;
|
|
118
|
+
return near ? `${a} ${t('cli.didYouMean', { opt: near })}` : a;
|
|
119
|
+
});
|
|
120
|
+
if (theme != null && !THEMES.includes(theme)) {
|
|
121
|
+
const near = suggest(theme, THEMES);
|
|
122
|
+
unknown.push(`--theme ${theme} ${near ? t('cli.didYouMean', { opt: `--theme ${near}` }) : t('cli.themeValues')}`);
|
|
123
|
+
}
|
|
114
124
|
if (unknown.length) {
|
|
115
|
-
process.stderr.write(`aitop: ${t('cli.unknown', { opts: unknown.join(' ') })}\
|
|
125
|
+
process.stderr.write(`aitop: ${t('cli.unknown', { opts: stripControl(unknown.join(', ')) })}\naitop: ${t('cli.seeHelp')}\n`);
|
|
116
126
|
process.exit(2);
|
|
117
127
|
}
|
|
118
128
|
if (args.has('-h') || args.has('--help')) {
|
|
@@ -265,14 +275,14 @@ if (args.has('--doctor')) {
|
|
|
265
275
|
if (cfgFile.onWaitingIgnored && !cli.onWaiting) process.stderr.write(`aitop: ${cfgFile.onWaitingIgnored}\n`);
|
|
266
276
|
|
|
267
277
|
const { collect } = await import('../src/collect.mjs');
|
|
268
|
-
const { render, filterSessions, animating } = await import('../src/ui.mjs');
|
|
278
|
+
const { render, pipeLines, filterSessions, animating } = await import('../src/ui.mjs');
|
|
269
279
|
const { arrange } = await import('../src/order.mjs');
|
|
270
280
|
const { frameTimer } = await import('../src/frames.mjs');
|
|
271
281
|
const { flushCache } = await import('../src/cache.mjs');
|
|
272
282
|
const { toJson } = await import('../src/json.mjs');
|
|
273
283
|
const { createSummaryWriter, summarize, writeSummary } = await import('../src/summary.mjs');
|
|
274
284
|
const { createAttention, updateAttention, markSeen, nextAttention, windowTitle, createWaitWatch, takeNewlyWaiting, attentionCounts, createEventWatch, takeEvents } = await import('../src/attention.mjs');
|
|
275
|
-
const { createNotifier } = await import('../src/notify.mjs');
|
|
285
|
+
const { applyNotifyToggle, createNotifier, createNotifyToggle, notifyExplicitOff, notifyHintDue } = await import('../src/notify.mjs');
|
|
276
286
|
const { onKey, fixFocus } = await import('../src/keys.mjs');
|
|
277
287
|
const { admit, createLoading, latchReady } = await import('../src/loading.mjs');
|
|
278
288
|
const { osc52, resumeCmd } = await import('../src/resume.mjs');
|
|
@@ -300,7 +310,13 @@ let tools = null;
|
|
|
300
310
|
// --bell · --notify · --on-waiting: 실시간 화면에서만, 첫 갱신에서 이미 응답 대기인 세션은 알리지 않는다.
|
|
301
311
|
const bell = opt.bell;
|
|
302
312
|
const waitWatch = createWaitWatch();
|
|
303
|
-
|
|
313
|
+
// 실시간 화면에서는 알림이 꺼져 있어도 알리미를 둔다. a 키로 데스크톱 알림을 이번 실행에만 켤 수 있게 (#294).
|
|
314
|
+
const notifier = !once ? createNotifier(alerts) : null;
|
|
315
|
+
// 켜기 힌트는 설정 파일이나 --no-notify 로 직접 끄지 않았을 때만 띄운다.
|
|
316
|
+
// --notify 로 켰어도 알림 도구가 없으면 키 줄·도움말에 꺼짐으로 보인다 (알리미에 desk 가 없다).
|
|
317
|
+
const notifyToggle = createNotifyToggle({ on: alerts.notify, explicitOff: notifyExplicitOff(config.values.notify, alerts.notify), available: once || Boolean(notifier?.desk) });
|
|
318
|
+
settings.notify = notifyToggle.on;
|
|
319
|
+
if (!once) view.notify = notifyToggle.on;
|
|
304
320
|
// 끝남(done)·context 경고는 켠 경우에만 센다 (#204). 벨은 늘 응답 대기만 울린다.
|
|
305
321
|
const eventKinds = alerts.events.filter((k) => k !== 'waiting');
|
|
306
322
|
const eventWatch = notifier && eventKinds.length ? createEventWatch({ doneMs: opt.doneMinutes * 60_000 }) : null;
|
|
@@ -326,6 +342,9 @@ function refresh({ throttle = false } = {}) {
|
|
|
326
342
|
if (fresh.length && bell) process.stdout.write('\x07');
|
|
327
343
|
if (alerts.events.includes('waiting')) notifier?.fire(fresh);
|
|
328
344
|
}
|
|
345
|
+
// 알림이 꺼진 채로 응답 대기 세션이 처음 보이면 키 줄에 켜기 힌트를 한 번 띄운다 (기록을 다 읽은 뒤).
|
|
346
|
+
// 도움말·검색 중에는 키 줄이 힌트를 그리지 않으므로 닫힐 때까지 미룬다.
|
|
347
|
+
if (!once && loading.ready && notifyHintDue(notifyToggle, data.sessions, { visible: !view.help && !view.searching })) toast('foot.notifyHint', HINT_MS);
|
|
329
348
|
if (eventWatch) {
|
|
330
349
|
const evs = takeEvents(eventWatch, data.sessions, { ready: loading.ready });
|
|
331
350
|
for (const kind of eventKinds) notifier.fire(evs.filter((e) => e.kind === kind).map((e) => e.session), kind);
|
|
@@ -343,6 +362,19 @@ function refresh({ throttle = false } = {}) {
|
|
|
343
362
|
}
|
|
344
363
|
let lastMore = false;
|
|
345
364
|
|
|
365
|
+
// 키 줄 왼쪽에 잠깐 보이는 알림 (y 복사 결과, 알림 켜기 힌트). ms 가 지나면 지운다.
|
|
366
|
+
const TOAST_MS = 2000;
|
|
367
|
+
const HINT_MS = 10_000;
|
|
368
|
+
let toastTimer = null;
|
|
369
|
+
function toast(key, ms = TOAST_MS) {
|
|
370
|
+
view.toast = { key, until: Date.now() + ms };
|
|
371
|
+
clearTimeout(toastTimer);
|
|
372
|
+
toastTimer = setTimeout(() => {
|
|
373
|
+
view.toast = null;
|
|
374
|
+
draw();
|
|
375
|
+
}, ms);
|
|
376
|
+
}
|
|
377
|
+
|
|
346
378
|
function select(id) {
|
|
347
379
|
if (id !== view.selectedId) {
|
|
348
380
|
view.focus = null;
|
|
@@ -360,7 +392,9 @@ if (once) {
|
|
|
360
392
|
const size = (v) => (Number(v) > 0 ? Math.floor(Number(v)) : 0);
|
|
361
393
|
const W = process.stdout.columns || size(process.env.COLUMNS) || 140;
|
|
362
394
|
const H = process.stdout.rows || size(process.env.LINES) || 40;
|
|
363
|
-
|
|
395
|
+
// 터미널이 아니면(파이프·파일) 높이 맞춤 빈 줄과 쓸 수 없는 키 안내를 빼고 내용만 낸다 (#292).
|
|
396
|
+
const screen = () => (process.stdout.isTTY ? render(view, W, H) : pipeLines(render(view, W, H)));
|
|
397
|
+
await printAndExit(args.has('--json') ? JSON.stringify(toJson(view.data, VERSION, { showRequests, budgetDay: opt.budgetDay }), null, 2) : screen().join('\n'));
|
|
364
398
|
}
|
|
365
399
|
|
|
366
400
|
const out = process.stdout;
|
|
@@ -470,23 +504,26 @@ function keepSelectionVisible() {
|
|
|
470
504
|
}
|
|
471
505
|
|
|
472
506
|
// y: 이어 여는 명령을 OSC 52 로 클립보드에 쓴다. 터미널이 아니면 아무것도 하지 않는다. 알림은 2초 보인다.
|
|
473
|
-
const TOAST_MS = 2000;
|
|
474
|
-
let toastTimer = null;
|
|
475
507
|
function copy(s) {
|
|
476
508
|
if (!out.isTTY) return;
|
|
477
509
|
const cmd = resumeCmd(s);
|
|
478
510
|
if (cmd) out.write(osc52(cmd));
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
511
|
+
toast(cmd ? 'foot.copied' : 'foot.copyNone');
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// a: 데스크톱 알림을 이번 실행에만 켜고 끈다. 설정 파일은 바꾸지 않는다 (#294).
|
|
515
|
+
// 알릴 종류는 시작할 때 정한 값(설정 파일·--notify=<종류>, 없으면 waiting)을 그대로 쓴다.
|
|
516
|
+
function flipNotify() {
|
|
517
|
+
const key = applyNotifyToggle(notifyToggle, notifier);
|
|
518
|
+
view.notify = notifyToggle.on;
|
|
519
|
+
settings.notify = notifyToggle.on;
|
|
520
|
+
toast(key);
|
|
485
521
|
}
|
|
486
522
|
|
|
487
523
|
stdin.setEncoding('utf8');
|
|
488
524
|
const act = {
|
|
489
525
|
copy,
|
|
526
|
+
toggleNotify: flipNotify,
|
|
490
527
|
quit,
|
|
491
528
|
refresh,
|
|
492
529
|
move,
|
package/package.json
CHANGED
package/src/attention.mjs
CHANGED
|
@@ -24,6 +24,10 @@ export function markSeen(state, id) {
|
|
|
24
24
|
state.unseen.delete(id);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
// 사람을 부르는 응답 대기인지. 부모 세션을 못 찾은 claude -p 실행(auto, cron 등)은 사람이 답할 수 없으므로
|
|
28
|
+
// 응답 대기여도 알림·n 이동·창 제목·헤더 수·맨 위 올림에서 뺀다 (#286). 행 자체의 ◆ 와 상태 글은 그대로 보인다.
|
|
29
|
+
export const callsYou = (s) => s.status === 'waiting' && !s.auto;
|
|
30
|
+
|
|
27
31
|
// 오류로 멈춘 세션 (로그인 필요·연결 끊김 등, phase stopped). status 는 idle 이지만 사람이 손대야 하므로 대기와 따로 센다 (#262).
|
|
28
32
|
export const isStopped = (s) => Boolean(s.live) && s.phase?.kind === 'stopped';
|
|
29
33
|
|
|
@@ -32,12 +36,12 @@ export const isStopped = (s) => Boolean(s.live) && s.phase?.kind === 'stopped';
|
|
|
32
36
|
export function nextAttention(state, sessions, selectedId) {
|
|
33
37
|
const at = sessions.findIndex((s) => s.id === selectedId);
|
|
34
38
|
const ordered = at < 0 ? sessions : [...sessions.slice(at + 1), ...sessions.slice(0, at)];
|
|
35
|
-
return ordered.find(
|
|
39
|
+
return ordered.find(callsYou) ?? ordered.find(isStopped) ?? ordered.find((s) => state.unseen.has(s.id)) ?? null;
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
// 응답 대기(◆), 멈춤(!), 확인 전(●) 수.
|
|
39
43
|
export function attentionCounts(sessions) {
|
|
40
|
-
return { waiting: sessions.filter((s) => s.live && s
|
|
44
|
+
return { waiting: sessions.filter((s) => s.live && callsYou(s)).length, stopped: sessions.filter(isStopped).length, unseen: sessions.filter((s) => s.unseen).length };
|
|
41
45
|
}
|
|
42
46
|
|
|
43
47
|
// 창 제목: 맨 앞 아이콘(탭 사이에서 aitop 을 찾게) + 응답 대기·멈춤·확인 전 수. 예: (2◆ 1! 1●) aitop
|
|
@@ -49,7 +53,7 @@ export function windowTitle(sessions, icon = '') {
|
|
|
49
53
|
|
|
50
54
|
// 새로 응답 대기가 된 세션 목록. seen 은 지난번 응답 대기 세션 id 집합이며 여기서 갱신한다.
|
|
51
55
|
export function freshWaiting(seen, sessions) {
|
|
52
|
-
const now = sessions.filter((s) => s.live && s
|
|
56
|
+
const now = sessions.filter((s) => s.live && callsYou(s));
|
|
53
57
|
const fresh = now.filter((s) => !seen.has(s.id));
|
|
54
58
|
seen.clear();
|
|
55
59
|
for (const s of now) seen.add(s.id);
|
|
@@ -99,7 +103,8 @@ export function takeEvents(watch, sessions, { now = Date.now(), ready = true } =
|
|
|
99
103
|
const out = [];
|
|
100
104
|
const ids = new Set();
|
|
101
105
|
for (const s of sessions) {
|
|
102
|
-
|
|
106
|
+
// 부모를 못 찾은 claude -p 실행(auto)은 사람이 지켜보는 작업이 아니므로 완료·컨텍스트도 알리지 않는다 (#286).
|
|
107
|
+
if (!s.live || s.status === 'ended' || isSub(s) || s.auto) continue;
|
|
103
108
|
ids.add(s.id);
|
|
104
109
|
let st = watch.per.get(s.id);
|
|
105
110
|
if (!st) watch.per.set(s.id, (st = { run: false, busyMs: 0, busyAt: null, idleSince: null, ctxArmed: true, first: true }));
|
package/src/cache.mjs
CHANGED
|
@@ -16,6 +16,8 @@ const VERSION = 14;
|
|
|
16
16
|
// Windows 는 XDG_CACHE_HOME 이 없으면 %LOCALAPPDATA%\aitop\cache (paths.mjs).
|
|
17
17
|
const ROOT = appDir('cache', { home: homedir() });
|
|
18
18
|
export const CACHE_ROOT = ROOT;
|
|
19
|
+
// claude -p 실행의 기억된 부모 (sources/claude.mjs knownParents). 버전 폴더 밖에 두고 removeOldDirs 가 지우지 않는다.
|
|
20
|
+
export const PARENTS_FILE = 'sdk-parents.json';
|
|
19
21
|
const NAME = `v${VERSION}-${PRICE_TAG}`;
|
|
20
22
|
const DIR = join(ROOT, NAME);
|
|
21
23
|
export const CACHE_DIR = DIR;
|
|
@@ -31,7 +33,8 @@ function removeOldDirs() {
|
|
|
31
33
|
for (const d of readdirSync(ROOT)) {
|
|
32
34
|
// summary.json(--line 용 요약, summary.mjs)은 버전 폴더 밖에 두고 여기서 지우지 않는다. 남은 임시 파일은 일주일 뒤 지운다.
|
|
33
35
|
// monthly.json(월별 보관함, monthly.mjs)과 깨져서 옆으로 옮긴 monthly.json.bad-* 도 사용자 기록이라 지우지 않는다.
|
|
34
|
-
|
|
36
|
+
// sdk-parents.json(claude -p 실행의 기억된 부모)도 형식 버전과 상관없이 남긴다.
|
|
37
|
+
if (d === NAME || d === 'summary.json' || d === 'monthly.json' || d === PARENTS_FILE || d.startsWith('monthly.json.bad-')) continue;
|
|
35
38
|
const p = join(ROOT, d);
|
|
36
39
|
// 이 버전보다 낮은 형식(v2, v6-… 등)은 더 이상 어떤 버전도 쓰지 않으므로 바로 지운다.
|
|
37
40
|
const ver = Number(/^v(\d+)(?:-|$)/.exec(d)?.[1]);
|
package/src/doctor.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { homedir, platform } from 'node:os';
|
|
|
7
7
|
import { findProcesses, isCodex, isGemini, isAgy, canListProcesses, isAlive, isSessionAlive, processMethod } from './procs.mjs';
|
|
8
8
|
import { AGY_ROOT } from './sources/antigravity.mjs';
|
|
9
9
|
import { loadSqlite, openReadOnly } from './sqlite.mjs';
|
|
10
|
-
import { fmtAgo, pad, stripControl } from './text.mjs';
|
|
10
|
+
import { fmtAgo, pad, stripControl, width } from './text.mjs';
|
|
11
11
|
import { BRAND } from './brand.mjs';
|
|
12
12
|
import { tildeIn } from './paths.mjs';
|
|
13
13
|
import { busProblem, findNotifier, isWsl } from './notify.mjs';
|
|
@@ -302,14 +302,17 @@ export function doctorText(result, version, now = Date.now(), lang = getLang())
|
|
|
302
302
|
if (result.console?.legacy) out.push('', tr('doctor.legacyConsole', null, o), ` → ${tr('doctor.legacyConsoleHint', null, o)}`);
|
|
303
303
|
// 설정 파일: 무시한 키와 값, 받지 않은 onWaiting 을 알린다.
|
|
304
304
|
const cfg = result.config;
|
|
305
|
+
// 설정·디버그 줄의 상태 칸 폭. 10칸보다 긴 상태 글("not found (defaults)")은 자르지 않고, 두 줄의 경로 열을 맞춘다.
|
|
306
|
+
const cfgWord = cfg && tr(cfg.exists ? 'doctor.configExists' : 'doctor.configMissing', null, o);
|
|
307
|
+
const logWord = result.log && tr(result.log.on ? 'doctor.debugOn' : 'doctor.debugOff', null, o);
|
|
308
|
+
const stateW = Math.max(10, ...[cfgWord, logWord].filter(Boolean).map((w) => width(w) + 1));
|
|
305
309
|
if (cfg) {
|
|
306
|
-
|
|
307
|
-
out.push('', tr('doctor.config', { mark: cfg.problems.length ? '!' : '✓', state, path: tilde(cfg.path) }, o));
|
|
310
|
+
out.push('', tr('doctor.config', { mark: cfg.problems.length ? '!' : '✓', state: pad(cfgWord, stateW), path: tilde(cfg.path) }, o));
|
|
308
311
|
for (const p of cfg.problems) out.push(` ! ${p}`);
|
|
309
312
|
}
|
|
310
313
|
if (result.log) {
|
|
311
314
|
const on = result.log.on;
|
|
312
|
-
out.push('', tr('doctor.debug', { mark: on ? '✓' : '○', state: pad(
|
|
315
|
+
out.push('', tr('doctor.debug', { mark: on ? '✓' : '○', state: pad(logWord, stateW), path: tilde(result.log.path), tail: on ? '' : tr('doctor.debugTail', null, o) }, o));
|
|
313
316
|
}
|
|
314
317
|
return stripControl(out.join('\n'));
|
|
315
318
|
}
|
package/src/help.mjs
CHANGED
|
@@ -20,6 +20,7 @@ export const VIEWS = {
|
|
|
20
20
|
k('table.sort', 's', 'sort'),
|
|
21
21
|
k('table.group', 'g', 'group'),
|
|
22
22
|
k('table.costMode', 'c', 'costMode'),
|
|
23
|
+
k('table.notify', 'a', 'notify'),
|
|
23
24
|
k('table.pin', 'p', 'pin'),
|
|
24
25
|
k('table.files', 'f Tab', 'files'),
|
|
25
26
|
k('table.detail', 'd', 'detail'),
|
package/src/i18n.mjs
CHANGED
|
@@ -196,6 +196,7 @@ export const STRINGS = {
|
|
|
196
196
|
'key.sort': '정렬',
|
|
197
197
|
'key.group': '묶기',
|
|
198
198
|
'key.costMode': '비용 기준',
|
|
199
|
+
'key.notify': '알림',
|
|
199
200
|
'key.pin': '고정',
|
|
200
201
|
'key.files': '변경 파일',
|
|
201
202
|
'key.detail': '상세',
|
|
@@ -220,7 +221,10 @@ export const STRINGS = {
|
|
|
220
221
|
'key.help': '도움말',
|
|
221
222
|
'key.quit': '나가기',
|
|
222
223
|
|
|
223
|
-
'cli.unknown': '
|
|
224
|
+
'cli.unknown': '알 수 없는 옵션 {opts}',
|
|
225
|
+
'cli.didYouMean': '(혹시 {opt}?)',
|
|
226
|
+
'cli.themeValues': '(light 또는 dark)',
|
|
227
|
+
'cli.seeHelp': '전체 옵션은 aitop --help',
|
|
224
228
|
'cli.themeMissing': '--theme 값이 없습니다 (light 또는 dark)',
|
|
225
229
|
'cli.unhandled': '처리되지 않은 오류로 끝냅니다 ({why})',
|
|
226
230
|
'cli.logOff': '디버그 로그를 열 수 없어 끕니다 ({path})',
|
|
@@ -445,10 +449,13 @@ export const STRINGS = {
|
|
|
445
449
|
'hdr.netShort': '캐시제외',
|
|
446
450
|
|
|
447
451
|
'tools.missing': '미설치',
|
|
448
|
-
'tools.
|
|
452
|
+
'tools.hiddenMissing': '미설치: {list}',
|
|
453
|
+
'tools.hiddenIdle': '7일 미사용: {list}',
|
|
449
454
|
'tools.ended': '종료된 세션 포함 (24시간)',
|
|
450
455
|
'table.title': '세션 {n}',
|
|
451
456
|
'member.stalled': '멈춘 듯',
|
|
457
|
+
'member.sdk': '-p',
|
|
458
|
+
'session.auto': '자동',
|
|
452
459
|
'group.count': '{n}개',
|
|
453
460
|
'group.waiting': '응답 대기',
|
|
454
461
|
'group.pinned': '고정',
|
|
@@ -462,12 +469,12 @@ export const STRINGS = {
|
|
|
462
469
|
'groupBy.tool': '도구',
|
|
463
470
|
'empty.none': '실행 중인 AI 세션이 없습니다.',
|
|
464
471
|
'empty.none24': '지난 24시간 안에 AI 세션이 없습니다.',
|
|
472
|
+
'empty.procs': '{list} 실행 중이지만 읽을 세션 기록이 아직 없습니다.',
|
|
473
|
+
'empty.procsHint': '그 도구에 요청을 보내면 여기에 나옵니다. 점검: aitop --doctor',
|
|
465
474
|
'empty.show': '지난 24시간 세션 보기: ',
|
|
466
475
|
'empty.or': ' 또는 ',
|
|
467
476
|
|
|
468
477
|
'foot.help': '도움',
|
|
469
|
-
// 폭이 모자라 키 안내가 빠졌을 때 ? 칩 라벨.
|
|
470
|
-
'foot.helpAll': '키 전체',
|
|
471
478
|
'foot.closeHelp': '도움 닫기',
|
|
472
479
|
'foot.readOnly': '⊘ 읽기전용',
|
|
473
480
|
'foot.count': '{n}개',
|
|
@@ -487,6 +494,11 @@ export const STRINGS = {
|
|
|
487
494
|
'foot.costMode': '비용 기준',
|
|
488
495
|
'foot.copied': '이어 여는 명령을 클립보드로 보냄 (OSC 52)',
|
|
489
496
|
'foot.copyNone': '이 세션은 이어 여는 명령이 없다',
|
|
497
|
+
'foot.notify': '알림:{v}',
|
|
498
|
+
'foot.notifyHint': '응답 대기 알림 켜기: a',
|
|
499
|
+
'foot.notifyOn': '응답 대기 알림 켬 (이번 실행만)',
|
|
500
|
+
'foot.notifyOff': '응답 대기 알림 끔 (이번 실행만)',
|
|
501
|
+
'foot.notifyNone': '알림 도구를 찾지 못함. aitop --doctor 로 확인',
|
|
490
502
|
'foot.clearSearch': '검색 지우기',
|
|
491
503
|
|
|
492
504
|
'help.title': '도움말 · ? 또는 Esc 로 닫기',
|
|
@@ -517,12 +529,16 @@ export const STRINGS = {
|
|
|
517
529
|
'legend.elapsed': '팀원 행 끝: 팀원이 일을 시작한 뒤 지난 시간',
|
|
518
530
|
'legend.stalledKey': '멈춘 듯',
|
|
519
531
|
'legend.stalled': '팀원 기록이 3분(느린 도구 10분) 그대로. 짐작',
|
|
532
|
+
'legend.sdk': '팀원 행: 이 세션이 띄운 claude -p 실행',
|
|
533
|
+
'legend.auto': '부모 없는 claude -p 실행. 대기 알림 없음',
|
|
520
534
|
'legend.status': '지금 단계. 큰 기록을 처음 읽는 동안은 기록 읽는 중 N%',
|
|
521
535
|
'legend.tokens': '세션 누적 토큰 (서브에이전트 포함, 캐시 읽기 포함)',
|
|
522
536
|
'legend.cost': 'API 정가로 환산한 비용 (Codex 는 OpenAI 정가 추정). 가격표에 없는 모델은 빼고 센다',
|
|
523
537
|
'legend.context': '마지막 요청의 컨텍스트 사용률 (모델별 창 크기 기준)',
|
|
524
538
|
'legend.idleCol': '마지막 활동 후 지난 시간. 작업 중이면 now',
|
|
525
|
-
'legend.
|
|
539
|
+
'legend.missingKey': '미설치: N',
|
|
540
|
+
'legend.missing': '도구 줄 끝: 기록 폴더가 없어 숨긴 도구',
|
|
541
|
+
'legend.hiddenKey': '7일 미사용: N',
|
|
526
542
|
'legend.hidden': '도구 줄 끝: 7일 동안 안 쓴 도구를 숨김. 다시 보려면 설정 파일에 "hideIdleTools": false',
|
|
527
543
|
'legend.folded': '도구 줄 끝: 화면이 좁아 접은 도구 수 (넓히면 보인다)',
|
|
528
544
|
'legend.periodKey': '오늘 / 7일',
|
|
@@ -537,6 +553,7 @@ export const STRINGS = {
|
|
|
537
553
|
'hk.table.sort': '정렬: 기본 → 비용순 → 컨텍스트순 → 최근순. 응답 대기는 늘 맨 위',
|
|
538
554
|
'hk.table.group': '묶기: 없음 → 프로젝트 → 도구. 묶음 머리에 세션 수·비용',
|
|
539
555
|
'hk.table.costMode': '비용 기준: API 환산 ↔ 캐시 제외. 표·헤더·상세가 같이 바뀐다 (예산은 늘 API 환산)',
|
|
556
|
+
'hk.table.notify': '응답 대기 데스크톱 알림 켜기·끄기. 이번 실행에만, 설정 파일은 그대로',
|
|
540
557
|
'hk.table.pin': '고른 세션을 맨 위(응답 대기 아래)에 고정·해제. 여러 개는 고정한 순서, 이번 실행에만',
|
|
541
558
|
'hk.table.files': '고른 세션의 변경 파일 목록으로',
|
|
542
559
|
'hk.table.detail': '상세 패널 열기·닫기',
|
|
@@ -666,6 +683,7 @@ export const STRINGS = {
|
|
|
666
683
|
'key.sort': 'sort',
|
|
667
684
|
'key.group': 'group',
|
|
668
685
|
'key.costMode': 'cost basis',
|
|
686
|
+
'key.notify': 'alerts',
|
|
669
687
|
'key.pin': 'pin',
|
|
670
688
|
'key.files': 'changed files',
|
|
671
689
|
'key.detail': 'detail',
|
|
@@ -691,6 +709,9 @@ export const STRINGS = {
|
|
|
691
709
|
'key.quit': 'quit',
|
|
692
710
|
|
|
693
711
|
'cli.unknown': 'unknown option {opts}',
|
|
712
|
+
'cli.didYouMean': '(did you mean {opt}?)',
|
|
713
|
+
'cli.themeValues': '(light or dark)',
|
|
714
|
+
'cli.seeHelp': 'all options: aitop --help',
|
|
694
715
|
'cli.themeMissing': '--theme needs a value (light or dark)',
|
|
695
716
|
'cli.unhandled': 'stopping on an unhandled error ({why})',
|
|
696
717
|
'cli.logOff': 'cannot open the debug log, turning it off ({path})',
|
|
@@ -845,7 +866,7 @@ export const STRINGS = {
|
|
|
845
866
|
'doctor.legacyConsoleHint': 'Windows Terminal is recommended. In this console, run with AITOP_AMBIGUOUS=wide (ASCII tables and bars) or NO_COLOR (progress bar as [#.])',
|
|
846
867
|
'doctor.config': '{mark} config {state}{path}',
|
|
847
868
|
'doctor.configExists': 'found',
|
|
848
|
-
'doctor.configMissing': 'not found',
|
|
869
|
+
'doctor.configMissing': 'not found (defaults)',
|
|
849
870
|
'doctor.debug': '{mark} debug {state}{path}{tail}',
|
|
850
871
|
'doctor.debugOn': 'on',
|
|
851
872
|
'doctor.debugOff': 'off',
|
|
@@ -906,10 +927,13 @@ export const STRINGS = {
|
|
|
906
927
|
'hdr.netShort': 'no cache',
|
|
907
928
|
|
|
908
929
|
'tools.missing': 'not installed',
|
|
909
|
-
'tools.
|
|
930
|
+
'tools.hiddenMissing': 'not installed: {list}',
|
|
931
|
+
'tools.hiddenIdle': 'unused 7d: {list}',
|
|
910
932
|
'tools.ended': 'with ended sessions (24h)',
|
|
911
933
|
'table.title': 'Sessions {n}',
|
|
912
934
|
'member.stalled': 'stalled?',
|
|
935
|
+
'member.sdk': '-p',
|
|
936
|
+
'session.auto': 'auto',
|
|
913
937
|
'group.count': '{n}',
|
|
914
938
|
'group.waiting': 'Waiting',
|
|
915
939
|
'group.pinned': 'Pinned',
|
|
@@ -923,11 +947,12 @@ export const STRINGS = {
|
|
|
923
947
|
'groupBy.tool': 'tool',
|
|
924
948
|
'empty.none': 'No AI sessions running.',
|
|
925
949
|
'empty.none24': 'No AI sessions in the last 24 hours.',
|
|
950
|
+
'empty.procs': '{list} running, but no session records to read yet.',
|
|
951
|
+
'empty.procsHint': 'Send it a request to see it here. Check: aitop --doctor',
|
|
926
952
|
'empty.show': 'Show the last 24 hours: ',
|
|
927
953
|
'empty.or': ' or ',
|
|
928
954
|
|
|
929
955
|
'foot.help': 'help',
|
|
930
|
-
'foot.helpAll': 'all keys',
|
|
931
956
|
'foot.closeHelp': 'close help',
|
|
932
957
|
'foot.readOnly': '⊘ read-only',
|
|
933
958
|
'foot.count': '{n} found',
|
|
@@ -947,6 +972,11 @@ export const STRINGS = {
|
|
|
947
972
|
'foot.costMode': 'cost',
|
|
948
973
|
'foot.copied': 'resume command sent to clipboard (OSC 52)',
|
|
949
974
|
'foot.copyNone': 'no resume command for this session',
|
|
975
|
+
'foot.notify': 'alerts:{v}',
|
|
976
|
+
'foot.notifyHint': 'turn on waiting alerts: a',
|
|
977
|
+
'foot.notifyOn': 'waiting alerts on (this run only)',
|
|
978
|
+
'foot.notifyOff': 'waiting alerts off (this run only)',
|
|
979
|
+
'foot.notifyNone': 'no alert tool found. Check with aitop --doctor',
|
|
950
980
|
'foot.clearSearch': 'clear search',
|
|
951
981
|
|
|
952
982
|
'help.title': 'Help · ? or Esc to close',
|
|
@@ -977,12 +1007,16 @@ export const STRINGS = {
|
|
|
977
1007
|
'legend.elapsed': 'Subagent row end: time since it started',
|
|
978
1008
|
'legend.stalledKey': 'stalled?',
|
|
979
1009
|
'legend.stalled': 'No log change 3 min (slow tools 10). A guess',
|
|
1010
|
+
'legend.sdk': 'Member row: claude -p run of this session',
|
|
1011
|
+
'legend.auto': 'claude -p run with no parent. No wait alerts',
|
|
980
1012
|
'legend.status': 'Current step (Reading log N% on first load)',
|
|
981
1013
|
'legend.tokens': 'Tokens incl. subagents and cache reads',
|
|
982
1014
|
'legend.cost': 'API cost (Codex estimated). Unpriced models not counted',
|
|
983
1015
|
'legend.context': 'Context used by the last request',
|
|
984
1016
|
'legend.idleCol': 'Time since last activity. now while working',
|
|
985
|
-
'legend.
|
|
1017
|
+
'legend.missingKey': 'not installed: N',
|
|
1018
|
+
'legend.missing': 'Tools hidden because their log folder is missing',
|
|
1019
|
+
'legend.hiddenKey': 'unused 7d: N',
|
|
986
1020
|
'legend.hidden': 'Tools unused for 7 days (hideIdleTools)',
|
|
987
1021
|
'legend.folded': 'Tools folded on a narrow screen',
|
|
988
1022
|
'legend.periodKey': 'today / 7d',
|
|
@@ -996,6 +1030,7 @@ export const STRINGS = {
|
|
|
996
1030
|
'hk.table.sort': 'Sort: cost, context, recent. Waiting on top',
|
|
997
1031
|
'hk.table.group': 'Group by project or tool, with cost',
|
|
998
1032
|
'hk.table.costMode': 'Cost basis: API cost or no cache',
|
|
1033
|
+
'hk.table.notify': 'Turn waiting alerts on or off (this run only)',
|
|
999
1034
|
'hk.table.pin': 'Pin on top, below waiting (this run only)',
|
|
1000
1035
|
'hk.table.files': 'Changed files of the session',
|
|
1001
1036
|
'hk.table.detail': 'Show or hide the detail panel',
|
package/src/json.mjs
CHANGED
|
@@ -40,6 +40,10 @@ export function toJson(data, version = null, opts = {}) {
|
|
|
40
40
|
branch: s.branch ?? null,
|
|
41
41
|
model: s.model ?? null,
|
|
42
42
|
kind: s.kind ?? null,
|
|
43
|
+
// 실행 방식 (Claude 기록의 entrypoint: 'cli', 'sdk-cli' 등, 모르면 null). auto 는 부모 세션을 못 찾은 claude -p 실행 (#286).
|
|
44
|
+
// 부모를 찾은 claude -p 실행은 여기 없고 부모의 members 에 entrypoint·parentId 와 함께 들어간다 (합계도 부모에 더해져 있다).
|
|
45
|
+
entrypoint: s.entrypoint ?? null,
|
|
46
|
+
auto: Boolean(s.auto),
|
|
43
47
|
pid: s.pid ?? null,
|
|
44
48
|
live: Boolean(s.live),
|
|
45
49
|
status: s.status,
|
|
@@ -69,7 +73,7 @@ export function toJson(data, version = null, opts = {}) {
|
|
|
69
73
|
files: (s.files ?? []).map((f) => ({ path: f.path, created: Boolean(f.created), edits: f.edits, writtenLines: f.add, deletedLines: f.del, updatedAt: iso(f.at), agents: f.agents ?? [] })),
|
|
70
74
|
// startedAt·lastActivityAt 은 세션의 startedAt·updatedAt 과 같은 ISO 시각이다 (모르면 null).
|
|
71
75
|
// stalled 는 화면의 '멈춘 듯' 과 같은 짐작(common.mjs memberStalled)을 data.at 기준으로 본 값이다.
|
|
72
|
-
members: (s.members ?? []).map((m) => ({ name: m.name, task: m.task ?? null, model: m.model ?? null, status: m.status, phase: koPhase(m.phase), phaseKind: m.phase?.kind ?? null, tokens: m.tokens ?? 0, cost: money(m.cost), startedAt: iso(m.startedAt), lastActivityAt: iso(m.lastActivityAt), stalled: memberStalled(m, data.at ?? Date.now(), s.status) })),
|
|
76
|
+
members: (s.members ?? []).map((m) => ({ ...(m.sdk ? { id: m.id, entrypoint: m.entrypoint ?? null, parentId: m.parentId ?? s.id } : {}), name: m.name, task: m.task ?? null, model: m.model ?? null, status: m.status, phase: koPhase(m.phase), phaseKind: m.phase?.kind ?? null, tokens: m.tokens ?? 0, cost: money(m.cost), startedAt: iso(m.startedAt), lastActivityAt: iso(m.lastActivityAt), stalled: memberStalled(m, data.at ?? Date.now(), s.status) })),
|
|
73
77
|
})),
|
|
74
78
|
};
|
|
75
79
|
}
|
package/src/keys.mjs
CHANGED
|
@@ -144,6 +144,8 @@ export function onKey(view, key, act) {
|
|
|
144
144
|
}
|
|
145
145
|
// y: 고른 세션을 이어 여는 명령을 복사한다 (bin 이 OSC 52 로 쓴다). 세션에는 아무것도 보내지 않는다.
|
|
146
146
|
else if (key === 'y') act.copy?.(selectedSession(view));
|
|
147
|
+
// a: 응답 대기 데스크톱 알림을 켜고 끈다 (#294). 이번 실행에만, 설정 파일은 바꾸지 않는다. 실제 켜기·끄기는 bin 이 한다.
|
|
148
|
+
else if (key === 'a') act.toggleNotify?.();
|
|
147
149
|
else if (key === 'c') view.costMode = view.costMode === 'net' ? 'api' : 'net';
|
|
148
150
|
else if (key === 'd') {
|
|
149
151
|
// view.rows: 마지막으로 그린 화면 높이. 'auto' 일 때 지금 보이는 상태를 뒤집는 데 쓴다.
|
package/src/line.mjs
CHANGED
|
@@ -14,6 +14,8 @@ export const CAP_MS = 1500;
|
|
|
14
14
|
export const STOP_MIN_MS = 300;
|
|
15
15
|
// 캐시가 없거나 시간 상한을 넘었을 때 내는 글.
|
|
16
16
|
export const PENDING = '...';
|
|
17
|
+
// 오늘 비용·대기·작업 중 등 보일 항목이 하나도 없을 때 내는 글.
|
|
18
|
+
export const IDLE = 'aitop idle';
|
|
17
19
|
// 기다리는 세션 이름의 최대 폭 (칸). 기본 폭 40 에 오늘 비용·예산·대기(이름과 시간)·작업 중이 함께 들어가는 길이.
|
|
18
20
|
export const NAME_WIDTH = 12;
|
|
19
21
|
// 이름을 자른 자리 표시. … 는 ASCII 가 아니다.
|
|
@@ -22,7 +24,8 @@ const CUT = '~';
|
|
|
22
24
|
// tmux 256색 번호. 응답 대기는 눈에 띄는 주황, 돈은 화면 헤더와 같은 연두. 색약용은 노랑·파랑 계열로 가른다.
|
|
23
25
|
// 작업 중은 눈에 덜 띄는 회색 계열로 둔다 (주목할 것은 대기다).
|
|
24
26
|
// 멈춤(오류로 멈춘 세션)은 화면의 경고색과 같은 빨강, 색약용은 주홍. 색이 없어도 'stop' 글자로 갈린다.
|
|
25
|
-
|
|
27
|
+
// 쉬는 중(aitop idle)은 작업 중보다 더 흐린 회색.
|
|
28
|
+
const COLOURS = { normal: { waiting: 'colour214', stopped: 'colour203', money: 'colour154', running: 'colour250', idle: 'colour242' }, colorBlind: { waiting: 'colour226', stopped: 'colour209', money: 'colour75', running: 'colour250', idle: 'colour242' } };
|
|
26
29
|
|
|
27
30
|
// --line, --line=plain|tmux, --line-width <N>, --line-width=<N> 를 꺼낸다. line 은 켜지 않았으면 null.
|
|
28
31
|
export function lineOption(argv) {
|
|
@@ -98,6 +101,8 @@ export function formatLine({ today = 0, budgetDay = null, waiting = 0, longest =
|
|
|
98
101
|
if (stopped > 0) parts.push({ texts: [`stop ${stopped}`], fg: c.stopped });
|
|
99
102
|
if (running > 0) parts.push({ texts: [`run ${running}`], fg: c.running });
|
|
100
103
|
if (!zero(perHour)) parts.push({ texts: [`${rate(perHour)}/h`], fg: c.money });
|
|
104
|
+
// 보일 항목이 하나도 없으면 빈 줄 대신 IDLE 을 낸다 (고장과 구분되게). 폭이 모자라면 짧은 글, 그래도 모자라면 - (#292).
|
|
105
|
+
if (!parts.length) parts.push({ texts: [IDLE, 'idle', '-'], fg: c.idle });
|
|
101
106
|
while (parts.length && width(parts.map((p) => p.texts[0]).join(' ')) > max) {
|
|
102
107
|
if (parts.at(-1).texts.length > 1) parts.at(-1).texts.shift();
|
|
103
108
|
else parts.pop();
|