@sejuneoh/aitop 0.36.1 → 0.38.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 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; `--json` has `toolStartedAt`.
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
 
@@ -291,6 +303,8 @@ Alerts when a session starts waiting, finishes a long turn or fills its context.
291
303
  - `--notify=waiting,done,context`: pick the kinds. Plain `--notify` uses the config file kinds, or waiting only when none are set.
292
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).
293
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`).
294
308
 
295
309
  **Kinds**
296
310
 
@@ -355,6 +369,7 @@ set -g status-interval 15
355
369
  - The Claude Code sessions stopped by an API error (`stop 1`, read live).
356
370
  - The number of sessions running (`run 3`).
357
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.
358
373
 
359
374
  **Options**
360
375
 
@@ -416,9 +431,66 @@ aitop reads `~/.claude` and `~/.codex` by default. List more profiles to read th
416
431
 
417
432
  </details>
418
433
 
434
+ ## Antigravity desktop app
435
+
436
+ Conversations from the Antigravity desktop app show in the Gemini tab next to agy CLI ones. aitop reads the app folder when it exists.
437
+
438
+ > `aitop --doctor`
439
+ >
440
+ > `AITOP_AGY_APP_HOME=off aitop`
441
+
442
+ - Folder: `~/.gemini/antigravity`. On WSL, also `.gemini/antigravity` in your Windows home.
443
+ - The Windows home is `USERPROFILE` when it is passed in, otherwise each user folder in `/mnt/c/Users` except shared ones (Public, Default, ...).
444
+ - Only folders with `conversations/` are read. `aitop --doctor` shows them as `+ … Antigravity app` under agy.
445
+ - Turn it off with `"agyApp": false` in the config file or `AITOP_AGY_APP_HOME=off`. Give absolute paths (joined by `:` on Linux and macOS, `;` on Windows) to read only those. Other values (`on`, `1`, relative paths) are ignored with a warning in `--doctor` and `--print-config`.
446
+ - The detail panel shows `interactive · app` and `--json` has `source: "app"` (`"cli"` for agy CLI). No new table column.
447
+ - The 7-day usage and monthly reports add both.
448
+
449
+ <details>
450
+ <summary>Details: running state, files read</summary>
451
+
452
+ - The app process is not visible from WSL, so an app conversation counts as running when its log (`conversations/<id>.db-wal`) or the conversation list changed in the last 2 minutes.
453
+ - So an app conversation quiet for over 2 minutes shows as ended, and a closed app stays running for up to 2 minutes.
454
+ - App conversations cannot be resumed with the agy CLI, so no resume command is made.
455
+ - The app folder also holds sign-in tokens and other files. aitop opens only `conversations/` and `conversation_summaries.db`, read-only (immutable).
456
+ - With `AITOP_AGY_HOME` set, the app folder is read only if `AITOP_AGY_APP_HOME` is set too (keeps tests away from real logs). `--print-config` then shows `agyApp false env (AITOP_AGY_HOME)`.
457
+ - To keep a slow `/mnt/c` cheap, the app folder's file list and log signatures are checked at most every 10 seconds. The 2-minute running check still uses the current time.
458
+ - If the same conversation id is in both folders, the agy CLI one wins.
459
+
460
+ </details>
461
+
462
+ ## Claude Desktop Cowork
463
+
464
+ Claude Desktop agent mode (Cowork) sessions show in the table as `cowork` in the TOOL column (Claude color), counted apart from claude in the tool row. aitop reads the app folder when it exists.
465
+
466
+ > `aitop --doctor`
467
+ >
468
+ > `AITOP_COWORK_HOME=off aitop`
469
+
470
+ - Folders: macOS `~/Library/Application Support/Claude`, Windows `%LOCALAPPDATA%\Packages\Claude_*\LocalCache\Roaming\Claude` (Store install) and `%APPDATA%\Claude`. On WSL, `AppData/Local/Packages/Claude_*/LocalCache/Roaming/Claude` and `AppData/Roaming/Claude` in your Windows home (same rule as the Antigravity app).
471
+ - Only folders with `local-agent-mode-sessions/` are read. `aitop --doctor` shows a `cowork` line (`Claude app · N sessions`), or no line when there is no app folder.
472
+ - Turn it off with `"cowork": false` in the config file or `AITOP_COWORK_HOME=off`. Give absolute app folder paths (joined by `:` on Linux and macOS, `;` on Windows) to read only those. Other values are ignored with a warning in `--doctor` and `--print-config`.
473
+ - The name is the app's session title. Tokens, cost, progress and subagents come from the same jsonl log Claude Code writes. The detail panel and `--json` `entrypoint` show `local-agent`.
474
+ - Header today and 7-day totals, the monthly archive and `--report` (daily, sessions, trace) add them to Claude. A log that is also in `~/.claude/projects` is counted once.
475
+ - A pending permission request shows as waiting (◆) and counts for `--notify`, `--on-waiting`, `n`, the header, the window title and `--line`.
476
+
477
+ <details>
478
+ <summary>Details: running and waiting, files read</summary>
479
+
480
+ - Cowork runs in a VM the app starts, so its process is not visible. A session is running when the later of its `lastActivityAt` and its log's modified time is within 2 minutes. Archived sessions (`isArchived`) are ended.
481
+ - Waiting: if no answer (`permission_response`, `permission_denied`, `permission_auto_approved`), turn end (`result`) or restart (`init`) line follows the last `permission_request` at the end of the session's `audit.jsonl`, the session waits for that `tool_name`. There is no id linking requests and answers, so only the order counts, and a session whose log has no open tool call is not waiting.
482
+ - Waiting lasts regardless of the 2-minute rule for up to 1 hour after the request. Older requests count as abandoned and the session as ended.
483
+ - Only three kinds of files are opened: the session meta `local_<id>.json` (only title, model, folder, times, archived flag and log id are used), logs under `.claude/projects/**/*.jsonl`, and `audit.jsonl`. Cookies, Local Storage, settings and subagent meta files in the same app folder are not opened.
484
+ - From `audit.jsonl` only the kind, tool name and time of permission lines are taken. Request contents (`tool_input`), signatures (`_audit_hmac`) and messages never reach the screen, the cache or `--json`. Cost comes from log usage, not `total_cost_usd`.
485
+ - To keep a slow `/mnt/c` cheap, the session list, meta, log list and `audit.jsonl` are checked at most every 10 seconds, so waiting can show up to 10 seconds late. The 2-minute running check still uses the current time.
486
+ - Sessions idle for over 7 days are known from their meta only; their log folders are not listed.
487
+ - No resume command is made. The format is private and may change with app updates; unreadable parts are skipped quietly.
488
+
489
+ </details>
490
+
419
491
  ## Resume a session elsewhere
420
492
 
421
- 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.
493
+ 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.
422
494
 
423
495
  > Claude: `cd <dir> && claude --resume <id>`
424
496
  >
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.
@@ -85,7 +88,10 @@ if (config.values.icons.source === 'file') process.env.AITOP_ICONS = opt.icons;
85
88
  setAmbiguous(opt.ambiguous);
86
89
  // 읽을 Claude·Codex 기록 폴더 목록. 기록을 읽는 모듈을 불러오기 전에 정한다 (#212).
87
90
  const { setDataDirs } = await import('../src/sources/dirs.mjs');
88
- setDataDirs({ claude: opt.claudeDirs, codex: opt.codexHomes });
91
+ // agyApp 은 정하지 않았으면(기본값) 넘기지 않아 AITOP_AGY_HOME 격리 규칙(antigravity.mjs findAgyRoots)을 그대로 따른다.
92
+ // cowork(#304)도 같다: 기본값이면 넘기지 않고 findCoworkRoots 가 AITOP_COWORK_HOME 과 저절로 찾기를 따른다.
93
+ const chosen = (k) => (config.values[k].source === 'default' ? undefined : opt[k]);
94
+ setDataDirs({ claude: opt.claudeDirs, codex: opt.codexHomes, agyApp: chosen('agyApp'), cowork: chosen('cowork') });
89
95
  const { BRAND, userVarsSeq } = await import('../src/brand.mjs');
90
96
  const { keysText } = await import('../src/help.mjs');
91
97
  const { debug, initLog, logPath } = await import('../src/log.mjs');
@@ -109,10 +115,17 @@ if (theme === '') {
109
115
  process.stderr.write(`aitop: ${t('cli.themeMissing')}\n`);
110
116
  process.exit(2);
111
117
  }
112
- const unknown = [...args].filter((a) => !KNOWN.has(a));
113
- if (theme != null && !THEMES.includes(theme)) unknown.push(`--theme ${theme}`);
118
+ // 모르는 옵션은 도움말 전체 대신 가까운 옵션 제안과 --help 안내 한 줄만 낸다 (#291).
119
+ const unknown = [...args].filter((a) => !KNOWN.has(a)).map((a) => {
120
+ const near = a.startsWith('-') ? suggest(a, OPTIONS) : null;
121
+ return near ? `${a} ${t('cli.didYouMean', { opt: near })}` : a;
122
+ });
123
+ if (theme != null && !THEMES.includes(theme)) {
124
+ const near = suggest(theme, THEMES);
125
+ unknown.push(`--theme ${theme} ${near ? t('cli.didYouMean', { opt: `--theme ${near}` }) : t('cli.themeValues')}`);
126
+ }
114
127
  if (unknown.length) {
115
- process.stderr.write(`aitop: ${t('cli.unknown', { opts: unknown.join(' ') })}\n\n${HELP}\n`);
128
+ process.stderr.write(`aitop: ${t('cli.unknown', { opts: stripControl(unknown.join(', ')) })}\naitop: ${t('cli.seeHelp')}\n`);
116
129
  process.exit(2);
117
130
  }
118
131
  if (args.has('-h') || args.has('--help')) {
@@ -265,14 +278,14 @@ if (args.has('--doctor')) {
265
278
  if (cfgFile.onWaitingIgnored && !cli.onWaiting) process.stderr.write(`aitop: ${cfgFile.onWaitingIgnored}\n`);
266
279
 
267
280
  const { collect } = await import('../src/collect.mjs');
268
- const { render, filterSessions, animating } = await import('../src/ui.mjs');
281
+ const { render, pipeLines, filterSessions, animating } = await import('../src/ui.mjs');
269
282
  const { arrange } = await import('../src/order.mjs');
270
283
  const { frameTimer } = await import('../src/frames.mjs');
271
284
  const { flushCache } = await import('../src/cache.mjs');
272
285
  const { toJson } = await import('../src/json.mjs');
273
286
  const { createSummaryWriter, summarize, writeSummary } = await import('../src/summary.mjs');
274
287
  const { createAttention, updateAttention, markSeen, nextAttention, windowTitle, createWaitWatch, takeNewlyWaiting, attentionCounts, createEventWatch, takeEvents } = await import('../src/attention.mjs');
275
- const { createNotifier } = await import('../src/notify.mjs');
288
+ const { applyNotifyToggle, createNotifier, createNotifyToggle, notifyExplicitOff, notifyHintDue } = await import('../src/notify.mjs');
276
289
  const { onKey, fixFocus } = await import('../src/keys.mjs');
277
290
  const { admit, createLoading, latchReady } = await import('../src/loading.mjs');
278
291
  const { osc52, resumeCmd } = await import('../src/resume.mjs');
@@ -300,7 +313,13 @@ let tools = null;
300
313
  // --bell · --notify · --on-waiting: 실시간 화면에서만, 첫 갱신에서 이미 응답 대기인 세션은 알리지 않는다.
301
314
  const bell = opt.bell;
302
315
  const waitWatch = createWaitWatch();
303
- const notifier = !once && (alerts.notify || alerts.onWaiting) ? createNotifier(alerts) : null;
316
+ // 실시간 화면에서는 알림이 꺼져 있어도 알리미를 둔다. a 키로 데스크톱 알림을 이번 실행에만 켤 수 있게 (#294).
317
+ const notifier = !once ? createNotifier(alerts) : null;
318
+ // 켜기 힌트는 설정 파일이나 --no-notify 로 직접 끄지 않았을 때만 띄운다.
319
+ // --notify 로 켰어도 알림 도구가 없으면 키 줄·도움말에 꺼짐으로 보인다 (알리미에 desk 가 없다).
320
+ const notifyToggle = createNotifyToggle({ on: alerts.notify, explicitOff: notifyExplicitOff(config.values.notify, alerts.notify), available: once || Boolean(notifier?.desk) });
321
+ settings.notify = notifyToggle.on;
322
+ if (!once) view.notify = notifyToggle.on;
304
323
  // 끝남(done)·context 경고는 켠 경우에만 센다 (#204). 벨은 늘 응답 대기만 울린다.
305
324
  const eventKinds = alerts.events.filter((k) => k !== 'waiting');
306
325
  const eventWatch = notifier && eventKinds.length ? createEventWatch({ doneMs: opt.doneMinutes * 60_000 }) : null;
@@ -326,6 +345,9 @@ function refresh({ throttle = false } = {}) {
326
345
  if (fresh.length && bell) process.stdout.write('\x07');
327
346
  if (alerts.events.includes('waiting')) notifier?.fire(fresh);
328
347
  }
348
+ // 알림이 꺼진 채로 응답 대기 세션이 처음 보이면 키 줄에 켜기 힌트를 한 번 띄운다 (기록을 다 읽은 뒤).
349
+ // 도움말·검색 중에는 키 줄이 힌트를 그리지 않으므로 닫힐 때까지 미룬다.
350
+ if (!once && loading.ready && notifyHintDue(notifyToggle, data.sessions, { visible: !view.help && !view.searching })) toast('foot.notifyHint', HINT_MS);
329
351
  if (eventWatch) {
330
352
  const evs = takeEvents(eventWatch, data.sessions, { ready: loading.ready });
331
353
  for (const kind of eventKinds) notifier.fire(evs.filter((e) => e.kind === kind).map((e) => e.session), kind);
@@ -343,6 +365,19 @@ function refresh({ throttle = false } = {}) {
343
365
  }
344
366
  let lastMore = false;
345
367
 
368
+ // 키 줄 왼쪽에 잠깐 보이는 알림 (y 복사 결과, 알림 켜기 힌트). ms 가 지나면 지운다.
369
+ const TOAST_MS = 2000;
370
+ const HINT_MS = 10_000;
371
+ let toastTimer = null;
372
+ function toast(key, ms = TOAST_MS) {
373
+ view.toast = { key, until: Date.now() + ms };
374
+ clearTimeout(toastTimer);
375
+ toastTimer = setTimeout(() => {
376
+ view.toast = null;
377
+ draw();
378
+ }, ms);
379
+ }
380
+
346
381
  function select(id) {
347
382
  if (id !== view.selectedId) {
348
383
  view.focus = null;
@@ -360,7 +395,9 @@ if (once) {
360
395
  const size = (v) => (Number(v) > 0 ? Math.floor(Number(v)) : 0);
361
396
  const W = process.stdout.columns || size(process.env.COLUMNS) || 140;
362
397
  const H = process.stdout.rows || size(process.env.LINES) || 40;
363
- await printAndExit(args.has('--json') ? JSON.stringify(toJson(view.data, VERSION, { showRequests, budgetDay: opt.budgetDay }), null, 2) : render(view, W, H).join('\n'));
398
+ // 터미널이 아니면(파이프·파일) 높이 맞춤 빈 줄과 쓸 수 없는 키 안내를 빼고 내용만 낸다 (#292).
399
+ const screen = () => (process.stdout.isTTY ? render(view, W, H) : pipeLines(render(view, W, H)));
400
+ await printAndExit(args.has('--json') ? JSON.stringify(toJson(view.data, VERSION, { showRequests, budgetDay: opt.budgetDay }), null, 2) : screen().join('\n'));
364
401
  }
365
402
 
366
403
  const out = process.stdout;
@@ -470,23 +507,26 @@ function keepSelectionVisible() {
470
507
  }
471
508
 
472
509
  // y: 이어 여는 명령을 OSC 52 로 클립보드에 쓴다. 터미널이 아니면 아무것도 하지 않는다. 알림은 2초 보인다.
473
- const TOAST_MS = 2000;
474
- let toastTimer = null;
475
510
  function copy(s) {
476
511
  if (!out.isTTY) return;
477
512
  const cmd = resumeCmd(s);
478
513
  if (cmd) out.write(osc52(cmd));
479
- view.toast = { key: cmd ? 'foot.copied' : 'foot.copyNone', until: Date.now() + TOAST_MS };
480
- clearTimeout(toastTimer);
481
- toastTimer = setTimeout(() => {
482
- view.toast = null;
483
- draw();
484
- }, TOAST_MS);
514
+ toast(cmd ? 'foot.copied' : 'foot.copyNone');
515
+ }
516
+
517
+ // a: 데스크톱 알림을 이번 실행에만 켜고 끈다. 설정 파일은 바꾸지 않는다 (#294).
518
+ // 알릴 종류는 시작할 때 정한 값(설정 파일·--notify=<종류>, 없으면 waiting)을 그대로 쓴다.
519
+ function flipNotify() {
520
+ const key = applyNotifyToggle(notifyToggle, notifier);
521
+ view.notify = notifyToggle.on;
522
+ settings.notify = notifyToggle.on;
523
+ toast(key);
485
524
  }
486
525
 
487
526
  stdin.setEncoding('utf8');
488
527
  const act = {
489
528
  copy,
529
+ toggleNotify: flipNotify,
490
530
  quit,
491
531
  refresh,
492
532
  move,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sejuneoh/aitop",
3
- "version": "0.36.1",
3
+ "version": "0.38.0",
4
4
  "description": "터미널에서 Claude Code · Codex · Antigravity · Gemini 세션과 토큰을 실시간으로 보는 읽기 전용 모니터",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/collect.mjs CHANGED
@@ -2,6 +2,7 @@ import { collectClaude } from './sources/claude.mjs';
2
2
  import { collectCodex } from './sources/codex.mjs';
3
3
  import { collectGemini } from './sources/gemini.mjs';
4
4
  import { collectAgy } from './sources/antigravity.mjs';
5
+ import { collectCowork } from './sources/cowork.mjs';
5
6
  import { collectLedger } from './sources/claude-ledger.mjs';
6
7
  import { createBudget } from './tail.mjs';
7
8
 
@@ -29,7 +30,7 @@ export function collect({ budgetBytes = Infinity, budgetMs = Infinity, ...opts }
29
30
  const budgetOf = (name, bytes, ms) => (budgets[name] = createBudget(bytes, ms));
30
31
  const sessions = [];
31
32
  const errors = [];
32
- for (const [tool, fn] of [['claude', collectClaude], ['codex', collectCodex], ['gemini', collectGemini], ['agy', collectAgy]]) {
33
+ for (const [tool, fn] of [['claude', collectClaude], ['cowork', collectCowork], ['codex', collectCodex], ['gemini', collectGemini], ['agy', collectAgy]]) {
33
34
  try {
34
35
  sessions.push(...fn({ ...opts, budget: budgetOf(tool, budgetBytes, budgetMs) }));
35
36
  } catch (err) {
package/src/config.mjs CHANGED
@@ -9,7 +9,7 @@ import { appDir } from './paths.mjs';
9
9
  import { stripControl } from './text.mjs';
10
10
  import { langValue, localeLang, t } from './i18n.mjs';
11
11
  import { EVENT_KINDS } from './notify.mjs';
12
- import { DIR_ENV, pathLike, splitPaths } from './sources/dirs.mjs';
12
+ import { DIR_ENV, agyAppEnv, coworkEnv, pathLike, splitPaths } from './sources/dirs.mjs';
13
13
 
14
14
  const bool = (v) => typeof v === 'boolean';
15
15
  const oneOf = (...xs) => (v) => xs.includes(v);
@@ -81,6 +81,13 @@ export const KEYS = {
81
81
  // AITOP_CLAUDE_DIRS > 설정 파일 > 물려받은 CLAUDE_CONFIG_DIR (inherit, Claude Code 용 변수라 설정 파일보다 낮다) > ~/.claude.
82
82
  claudeDirs: { ok: pathList, expect: 'cfg.paths', def: () => [join(homedir(), DIR_ENV.claude.home)], env: [DIR_ENV.claude.own, (v) => splitPaths(v)], inherit: [DIR_ENV.claude.inherited, (v) => splitPaths(v)] },
83
83
  codexHomes: { ok: pathList, expect: 'cfg.paths', def: () => [join(homedir(), DIR_ENV.codex.home)], env: [DIR_ENV.codex.own, (v) => splitPaths(v)], inherit: [DIR_ENV.codex.inherited, (v) => splitPaths(v)] },
84
+ // Antigravity 데스크톱 앱 폴더 (#303, antigravity.mjs findAgyRoots). true 면 저절로 찾고, false 면 읽지 않고, 경로 배열이면 그 폴더만.
85
+ // AITOP_AGY_APP_HOME(경로 또는 off) > 설정 파일 > 기본(true). AITOP_AGY_HOME 을 주고 AITOP_AGY_APP_HOME 을 주지 않으면 이 값과 상관없이 읽지 않는다.
86
+ // masked: 이 환경 변수가 있으면(그리고 자기 환경 변수가 없으면) 값을 false 로 두고 출처를 그 변수로 보인다. 설정 파일 값은 무시됨으로 알린다.
87
+ agyApp: { ok: (v) => bool(v) || pathList(v), expect: 'cfg.agyApp', def: true, env: ['AITOP_AGY_APP_HOME', agyAppEnv], envProblem: true, envExpect: 'cfg.agyAppEnv', masked: 'AITOP_AGY_HOME' },
88
+ // Claude Desktop Cowork(에이전트 모드) 세션을 담은 앱 폴더 (#304, cowork.mjs findCoworkRoots). 모양은 agyApp 과 같다.
89
+ // AITOP_COWORK_HOME(경로 또는 off) > 설정 파일 > 기본(true, 저절로 찾음).
90
+ cowork: { ok: (v) => bool(v) || pathList(v), expect: 'cfg.cowork', def: true, env: ['AITOP_COWORK_HOME', coworkEnv], envProblem: true, envExpect: 'cfg.agyAppEnv' },
84
91
  };
85
92
 
86
93
  // Windows 는 XDG_CONFIG_HOME 이 없으면 %APPDATA%\aitop\config.json.
@@ -196,6 +203,11 @@ export function resolveConfig({ flags = {}, env = process.env, file } = {}) {
196
203
  else if (spec.inherit && spec.inherit[1](env[spec.inherit[0]]) !== undefined) values[key] = { value: spec.inherit[1](env[spec.inherit[0]]), source: 'env', env: spec.inherit[0] };
197
204
  // 기본값이 함수면 환경에서 고른다 (lang 은 로캘).
198
205
  else values[key] = { value: typeof spec.def === 'function' ? spec.def(env) : spec.def, source: 'default' };
206
+ // 다른 환경 변수가 이 값을 덮는 경우 (agyApp 과 AITOP_AGY_HOME, antigravity.mjs findAgyRoots).
207
+ if (spec.masked && env[spec.masked] != null && (values[key].source === 'file' || values[key].source === 'default')) {
208
+ if (values[key].source === 'file') problems.push(t('cfg.masked', { key, name: spec.masked }));
209
+ values[key] = { value: false, source: 'env', env: spec.masked };
210
+ }
199
211
  }
200
212
  return { path: file.path, exists: file.exists, values, problems };
201
213
  }
package/src/doctor.mjs CHANGED
@@ -5,9 +5,10 @@ import { readdirSync, readFileSync, statSync, existsSync, openSync, readSync, cl
5
5
  import { basename, join } from 'node:path';
6
6
  import { homedir, platform } from 'node:os';
7
7
  import { findProcesses, isCodex, isGemini, isAgy, canListProcesses, isAlive, isSessionAlive, processMethod } from './procs.mjs';
8
- import { AGY_ROOT } from './sources/antigravity.mjs';
8
+ import { agyRoots } from './sources/antigravity.mjs';
9
+ import { coworkCheck } from './sources/cowork.mjs';
9
10
  import { loadSqlite, openReadOnly } from './sqlite.mjs';
10
- import { fmtAgo, pad, stripControl } from './text.mjs';
11
+ import { fmtAgo, pad, stripControl, width } from './text.mjs';
11
12
  import { BRAND } from './brand.mjs';
12
13
  import { tildeIn } from './paths.mjs';
13
14
  import { busProblem, findNotifier, isWsl } from './notify.mjs';
@@ -174,42 +175,70 @@ function gemini() {
174
175
  };
175
176
  }
176
177
 
177
- // Antigravity CLI: 요약 DB 를 열어 대화 목록을 읽을 수 있는지 본다. node:sqlite 가 없으면 프로세스만 센다.
178
- function agy() {
179
- const dir = join(AGY_ROOT, 'conversations');
178
+ // Antigravity CLI 와 데스크톱 앱(#303): 요약 DB 를 열어 대화 목록을 읽을 수 있는지 본다. node:sqlite 가 없으면 프로세스만 센다.
179
+ // path 는 CLI 폴더(예전 모양). 앱 폴더가 있으면 dirs 에 폴더마다 { path, found, records, source } 를 두고 둘째 줄부터 보인다.
180
+ // 앱 폴더는 있는 것만 목록에 들어오므로(findAgyRoots) 없으면 줄이 생기지 않는다. 앱 폴더에서도 conversations/ 와 요약 DB 만 본다.
181
+ function agy(roots = agyRoots()) {
180
182
  const running = canListProcesses() ? findProcesses(isAgy).length : null;
181
- const files = existsSync(dir) ? walk(dir, 0, (n) => n.endsWith('.db')) : null;
182
- if (!files) return { tool: 'agy', state: 'missing', path: tilde(AGY_ROOT), records: 0, lastAt: null, running, readable: null, hint: null };
183
+ const dirs = [];
184
+ const files = [];
185
+ for (const r of roots) {
186
+ const dir = join(r.dir, 'conversations');
187
+ const got = existsSync(dir) ? walk(dir, 0, (n) => n.endsWith('.db')) : null;
188
+ dirs.push({ path: tilde(r.dir), found: Boolean(got), records: got?.length ?? 0, source: r.source, root: r.dir });
189
+ files.push(...(got ?? []));
190
+ }
191
+ const path = dirs[0].path;
192
+ // 앱 폴더가 없으면 예전과 같은 모양 (dirs 없음).
193
+ const more = dirs.length > 1 ? { dirs: dirs.map(({ root, ...d }) => d) } : {};
194
+ if (!dirs.some((d) => d.found)) return { tool: 'agy', state: 'missing', path, ...more, records: 0, lastAt: null, running, readable: null, hint: null };
183
195
  const last = newest(files.flatMap((f) => [f, `${f}-wal`]).filter((f) => existsSync(f)));
184
- if (!loadSqlite()) return { tool: 'agy', state: 'limited', path: tilde(AGY_ROOT), records: files.length, lastAt: last?.mtime ?? null, running, readable: null, hint: null };
185
- let readable = false;
186
- let db;
187
- try {
188
- db = openReadOnly(join(AGY_ROOT, 'conversation_summaries.db'));
189
- db.prepare('select count(*) n from conversation_summaries').get();
190
- readable = true;
191
- } catch {
192
- } finally {
193
- db?.close();
196
+ if (!loadSqlite()) return { tool: 'agy', state: 'limited', path, ...more, records: files.length, lastAt: last?.mtime ?? null, running, readable: null, hint: null };
197
+ // 기록이 있는 폴더의 요약 DB 를 모두 읽을 수 있어야 읽을 수 있다고 본다.
198
+ let readable = true;
199
+ for (const d of dirs.filter((x) => x.found)) {
200
+ let db;
201
+ try {
202
+ db = openReadOnly(join(d.root, 'conversation_summaries.db'));
203
+ db.prepare('select count(*) n from conversation_summaries').get();
204
+ } catch {
205
+ readable = false;
206
+ } finally {
207
+ db?.close();
208
+ }
194
209
  }
195
- return { tool: 'agy', state: 'ok', path: tilde(AGY_ROOT), records: files.length, lastAt: last?.mtime ?? null, running, readable, hint: null };
210
+ return { tool: 'agy', state: 'ok', path, ...more, records: files.length, lastAt: last?.mtime ?? null, running, readable, hint: null };
211
+ }
212
+
213
+ // Claude Desktop Cowork(#304): 앱 폴더마다 세션 목록(메타)만 본다. 기록 내용·audit.jsonl 은 읽지 않는다.
214
+ // 앱 폴더를 하나도 찾지 못했으면(앱을 쓰지 않거나 끔) null 이고, --doctor 와 도구 줄에 cowork 가 보이지 않는다.
215
+ // path 는 첫 앱 폴더, 둘째부터는 dirs 로 한 줄씩. 세션 목록을 읽지 못한 폴더가 있으면 readable 이 false 다.
216
+ function cowork(roots) {
217
+ const list = roots ? coworkCheck(roots) : coworkCheck();
218
+ if (!list.length) return null;
219
+ const dirs = list.map((r) => ({ path: tilde(r.dir), found: r.ok, records: r.sessions, source: 'cowork' }));
220
+ const lastAt = Math.max(0, ...list.map((r) => r.lastAt ?? 0)) || null;
221
+ const records = list.reduce((a, r) => a + r.sessions, 0);
222
+ return { tool: 'cowork', state: 'ok', path: dirs[0].path, ...(dirs.length > 1 ? { dirs } : {}), records, lastAt, running: null, readable: list.every((r) => r.ok), hint: null };
196
223
  }
197
224
 
198
225
  // 도구별 안내 한 줄. 없으면 null. 점검 결과(--json 의 tools.*.hint)에는 예전처럼 한국어로 넣고, --doctor 글은 지금 언어로 다시 만든다.
199
226
  export function hintOf(r, lang = 'ko') {
200
227
  const o = { lang };
201
228
  if (r.tool === 'gemini') return tr('doctor.hint.gemini', null, o);
229
+ if (r.tool === 'cowork') return r.readable === false ? tr('doctor.hint.coworkUnread', null, o) : null;
202
230
  if (r.state === 'missing') return r.tool === 'agy' ? tr('doctor.hint.agyMissing', null, o) : tr('doctor.hint.missing', { tool: r.tool }, o);
203
231
  if (r.tool === 'agy' && r.state === 'limited') return tr('doctor.hint.agyNode', { node: process.versions.node }, o);
204
232
  return null;
205
233
  }
206
234
 
207
- // home: 후보 폴더를 찾을 홈 폴더 (테스트에서 바꿔 끼운다).
208
- export function checkTools({ home = HOME } = {}) {
235
+ // home: 후보 폴더를 찾을 홈 폴더 (테스트에서 바꿔 끼운다). coworkRoots: Cowork 앱 폴더 목록 (테스트용, 주지 않으면 찾은 것).
236
+ export function checkTools({ home = HOME, coworkRoots } = {}) {
209
237
  const cand = candidateDirs({ home });
210
238
  const tools = {};
211
- for (const fn of [claude, codex, gemini, agy]) {
212
- const r = fn === claude ? claude(cand.claude) : fn === codex ? codex(cand.codex) : fn();
239
+ for (const fn of [claude, cowork, codex, gemini, agy]) {
240
+ const r = fn === claude ? claude(cand.claude) : fn === codex ? codex(cand.codex) : fn === cowork ? cowork(coworkRoots) : fn();
241
+ if (!r) continue;
213
242
  r.hint = hintOf(r, 'ko');
214
243
  tools[r.tool] = r;
215
244
  }
@@ -275,7 +304,18 @@ export function describe(t, now = Date.now(), lang = getLang()) {
275
304
  if (t.keys?.length) parts.push(tr('doctor.keys', { keys: t.keys.join(', ') }, o));
276
305
  // 한국어 안내는 점검 결과에 든 그대로, 다른 언어는 같은 조건으로 다시 만든다.
277
306
  const hint = lang === 'ko' || !t.hint ? t.hint : (hintOf(t, lang) ?? t.hint);
278
- return { mark: MARK[t.state], state: lang === 'ko' ? STATE_TEXT[t.state] : tr(`doctor.state.${t.state}`, null, { lang, short: true }), path: t.path, detail: parts.join(' · '), hint };
307
+ // Cowork 는 기록 수 대신 세션 수를 보이고, 실행 중 수는 뺀다 (프로세스가 VM 안이라 보이지 않는다).
308
+ const detail = t.tool === 'cowork' ? coworkDetail(t, now, lang) : parts.join(' · ');
309
+ return { mark: MARK[t.state], state: lang === 'ko' ? STATE_TEXT[t.state] : tr(`doctor.state.${t.state}`, null, { lang, short: true }), path: t.path, detail, hint };
310
+ }
311
+
312
+ // Cowork 줄의 설명: 'Claude 앱 · 세션 N개 · 마지막 …'.
313
+ function coworkDetail(t, now, lang) {
314
+ const o = { lang };
315
+ const parts = [tr('doctor.coworkApp', null, o), tr('doctor.coworkSessions', { n: t.records.toLocaleString('en-US') }, o)];
316
+ if (t.lastAt) parts.push(tr('doctor.last', { ago: lang === 'ko' ? ago(now - t.lastAt) : fmtAgo(now - t.lastAt) }, o));
317
+ if (t.readable === false) parts.push(tr('doctor.unreadable', null, o));
318
+ return parts.join(' · ');
279
319
  }
280
320
 
281
321
  // aitop --doctor 의 사람용 출력.
@@ -290,7 +330,10 @@ export function doctorText(result, version, now = Date.now(), lang = getLang())
290
330
  const d = describe(t, now, lang);
291
331
  out.push(`${d.mark} ${pad(t.tool, 7)}${pad(d.state, 10)}${d.path}`);
292
332
  // 기록 폴더가 여럿이면 둘째부터 한 줄씩, 읽지 않는 후보 폴더는 넣는 방법과 함께 (#212).
293
- for (const x of t.dirs?.slice(1) ?? []) out.push(` + ${pad('', 15)}${x.path} ${x.found ? tr('doctor.records', { n: x.records.toLocaleString('en-US') }, o) : tr('doctor.dirMissing', null, o)}`);
333
+ // Antigravity 앱 폴더(source 'app', #303)는 기록 수 앞에 '앱' 을 붙인다.
334
+ const count = (x) => tr(x.source === 'cowork' ? 'doctor.coworkSessions' : 'doctor.records', { n: x.records.toLocaleString('en-US') }, o);
335
+ const tag = (x) => (x.source === 'app' ? `${tr('doctor.agyApp', null, o)} · ` : x.source === 'cowork' ? `${tr('doctor.coworkApp', null, o)} · ` : '');
336
+ for (const x of t.dirs?.slice(1) ?? []) out.push(` + ${pad('', 15)}${x.path} ${tag(x)}${x.found ? count(x) : tr('doctor.dirMissing', null, o)}`);
294
337
  out.push(` ${d.detail}`);
295
338
  if (d.hint) out.push(` → ${d.hint}`);
296
339
  if (t.candidates?.length) {
@@ -302,14 +345,17 @@ export function doctorText(result, version, now = Date.now(), lang = getLang())
302
345
  if (result.console?.legacy) out.push('', tr('doctor.legacyConsole', null, o), ` → ${tr('doctor.legacyConsoleHint', null, o)}`);
303
346
  // 설정 파일: 무시한 키와 값, 받지 않은 onWaiting 을 알린다.
304
347
  const cfg = result.config;
348
+ // 설정·디버그 줄의 상태 칸 폭. 10칸보다 긴 상태 글("not found (defaults)")은 자르지 않고, 두 줄의 경로 열을 맞춘다.
349
+ const cfgWord = cfg && tr(cfg.exists ? 'doctor.configExists' : 'doctor.configMissing', null, o);
350
+ const logWord = result.log && tr(result.log.on ? 'doctor.debugOn' : 'doctor.debugOff', null, o);
351
+ const stateW = Math.max(10, ...[cfgWord, logWord].filter(Boolean).map((w) => width(w) + 1));
305
352
  if (cfg) {
306
- const state = pad(tr(cfg.exists ? 'doctor.configExists' : 'doctor.configMissing', null, o), 10);
307
- out.push('', tr('doctor.config', { mark: cfg.problems.length ? '!' : '✓', state, path: tilde(cfg.path) }, o));
353
+ out.push('', tr('doctor.config', { mark: cfg.problems.length ? '!' : '✓', state: pad(cfgWord, stateW), path: tilde(cfg.path) }, o));
308
354
  for (const p of cfg.problems) out.push(` ! ${p}`);
309
355
  }
310
356
  if (result.log) {
311
357
  const on = result.log.on;
312
- out.push('', tr('doctor.debug', { mark: on ? '✓' : '○', state: pad(tr(on ? 'doctor.debugOn' : 'doctor.debugOff', null, o), 10), path: tilde(result.log.path), tail: on ? '' : tr('doctor.debugTail', null, o) }, o));
358
+ 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
359
  }
314
360
  return stripControl(out.join('\n'));
315
361
  }
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'),