@sejuneoh/aitop 0.39.0 → 0.41.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
@@ -22,7 +22,7 @@
22
22
  - `y` copies a resume command, and `--report sessions` prints yesterday's sessions with cost for your standup.
23
23
  - **No hooks, nothing sent.**
24
24
  - Claude Code, Codex CLI and Antigravity CLI side by side, from [several history folders](#several-claude-or-codex-profiles) (`~/.claude`, `~/.claude-work`, ...).
25
- - aitop only reads the logs they already write. It changes no settings and needs no network, ports or dependencies.
25
+ - aitop only reads the logs they already write. It changes no settings and needs no network, ports or dependencies. The one exception is the opt-in [`--remote`](#remote-hosts-and-wsl-distros), which runs your own `ssh` or `wsl.exe`.
26
26
 
27
27
  **Contents**
28
28
 
@@ -30,7 +30,7 @@
30
30
  - [Features](#features)
31
31
  - [Subagents](#subagents) · [Daily and monthly reports](#daily-and-monthly-reports) · [Session report](#session-report) · [Call tree](#call-tree)
32
32
  - [Notifications](#notifications) · [tmux status line](#tmux-status-line) · [Several Claude or Codex profiles](#several-claude-or-codex-profiles)
33
- - [Resume a session elsewhere](#resume-a-session-elsewhere) · [JSON output](#json-output) · [Language](#language)
33
+ - [Resume a session elsewhere](#resume-a-session-elsewhere) · [Remote hosts and WSL distros](#remote-hosts-and-wsl-distros) · [JSON output](#json-output) · [Language](#language)
34
34
  - [How it differs from similar tools](#how-it-differs-from-similar-tools) · [Install](#install) · [License](#license)
35
35
 
36
36
  ## Quick start
@@ -72,7 +72,7 @@
72
72
  **Keys on the live screen**
73
73
 
74
74
  - `↑↓` select · `n` next session to check · `/` search · `s` sort · `g` group
75
- - `p` pin · `f` changed files · `a` waiting alerts on/off · `?` help · `q` quit
75
+ - `p` pin · `f` changed files · `v` artifacts (Enter views the source) · `a` waiting alerts on/off · `?` help · `q` quit
76
76
 
77
77
  **Config file**
78
78
 
@@ -90,7 +90,7 @@
90
90
  - **Tokens and cost** per session and for today / last 7 days, estimated at public API list prices. This is not your bill.
91
91
  - **Changed files and diffs** per session and per prompt.
92
92
  - **Artifacts** a Claude or Cowork session (or its subagents) published with the Artifact tool, with clickable links.
93
- - **Read-only**: no network, no ports, no dependencies. It only reads the session logs each CLI already writes.
93
+ - **Read-only**: no network, no ports, no dependencies. It only reads the session logs each CLI already writes. Only [`--remote`](#remote-hosts-and-wsl-distros), when you turn it on, uses the network (through your `ssh`).
94
94
 
95
95
  <details>
96
96
  <summary>Details: stopped sessions, cache countdown, tool run time, context gauge, artifacts, tool line</summary>
@@ -124,6 +124,7 @@
124
124
  - The detail panel shows `── Artifacts N ──` when a session published any: `title · v1→v3 · 14:02 · claude.ai/…`, plus `edited in place` for an `edits` publish `org` for an org-shared link and `public` for a public one (nothing for `owner`). The version range comes from the publish sequence number; without one it is left out. When space is short, the latest few and `+N`.
125
125
  - Only `https://claude.ai/` addresses become OSC 8 links. Under `NO_COLOR`, in piped output and in terminals not known to support links they are plain text; `FORCE_HYPERLINK=1` or `0` overrides. Only the title, address, publish sequence number, time, audience and whether `edits` was used are read (no file paths or edit contents).
126
126
  - `--json` has `artifacts` per session (`title`, `url`, `versionFrom`, `versionTo`, `updatedAt`, `audience`, `viaEdits`); `url` is `null` unless it is a `https://claude.ai/` address.
127
+ - `v` moves into the list, `↑↓` picks and `Enter` shows the source full screen (`↑↓` · `space` · `PgUp/PgDn` · `Home/End` scroll, `[ ]` previous/next, `Esc` back one step). The source is looked up only then: the local file at the published path (a regular file, not a symlink, first 2MB), else the last `Write` of that path in the same session's transcripts (subagents included, marked `may differ from the published version` when an `Edit` or an `edits` publish came after it), else `no source`. HTML is never run: scripts, styles, templates and comments are dropped and headings, paragraphs, lists, tables, code and quotes are shown as text, with `data:` images as `[image 120KB]`. Markdown gets simple headings, lists and code blocks.
127
128
 
128
129
  **Tool line and empty screen**
129
130
 
@@ -331,7 +332,7 @@ Alerts when a session starts waiting, finishes a long turn or fills its context.
331
332
 
332
333
  - The hook keeps its name (`--on-waiting`) for all kinds.
333
334
  - It gets `AITOP_EVENT` (`waiting`, `done` or `context`) in its environment.
334
- - It also gets `AITOP_TOOL`, `AITOP_PROJECT`, `AITOP_SESSION_ID`, `AITOP_CWD` and `AITOP_WAITING_FOR`.
335
+ - It also gets `AITOP_TOOL`, `AITOP_PROJECT`, `AITOP_SESSION_ID`, `AITOP_CWD` and `AITOP_WAITING_FOR`, plus `AITOP_HOST` (the [remote](#remote-hosts-and-wsl-distros) name, empty for local sessions).
335
336
 
336
337
  **Config file and switches**
337
338
 
@@ -535,6 +536,50 @@ Continue a session elsewhere, for example when you cannot jump to its tab, as in
535
536
 
536
537
  </details>
537
538
 
539
+ ## Remote hosts and WSL distros
540
+
541
+ See sessions on machines you manage (a VM, a dev server, another WSL distro) on the same screen.
542
+
543
+ > `aitop --remote dev,me@vm2,wsl:Ubuntu-22.04`
544
+ >
545
+ > config file: `"remotes": ["dev", "wsl:Ubuntu"]`
546
+
547
+ - aitop must be installed on each remote. Every 10 seconds aitop runs `ssh -o BatchMode=yes -o ConnectTimeout=5 -T -- <host> aitop --json --no-remote` (WSL: `wsl.exe -d <distro> -- aitop --json --no-remote`) for all remotes in parallel, 20 seconds per call.
548
+ - Auth and host trust are left to your ssh config and agent. aitop never asks for or stores passwords or keys, and never turns off host key checking.
549
+ - This is the only feature that uses the network, and only when you turn it on. `--no-remote` turns off the config file list for one run.
550
+ - The table keeps local sessions on top. Each remote follows under its own line: `── dev · 3 sessions · 10s ago ──`, or `── dev · not connected (timed out) ──`. Sorting, grouping and waiting-first work inside each block.
551
+ - Waiting bell and desktop alerts include remote sessions. `--on-waiting` gets `AITOP_HOST`.
552
+ - `y` copies a local command that reopens the session there: `ssh -t dev 'cd /repo && claude --resume <id>'` (WSL: `wsl.exe -d Ubuntu --cd /repo -- claude --resume <id>`).
553
+ - `--once` and `--json` wait for all remotes before printing.
554
+
555
+ <details>
556
+ <summary>Details: names, errors, what is not fetched</summary>
557
+
558
+ **Names**
559
+
560
+ - An ssh host alias or `user@host` (letters, digits, `.`, `_`, `-`), or `wsl:<distro>`. Up to 16.
561
+ - Values starting with `-`, ports (`host:22`), spaces and shell characters are refused at start (exit 2). Put a port or jump host in an `~/.ssh/config` alias.
562
+ - There is no automatic WSL distro discovery; name the distro.
563
+
564
+ **Errors on the remote line**
565
+
566
+ - auth failed, unreachable, no aitop on remote (exit 127), remote aitop too old (no `--no-remote` or no `schema` in its JSON), remote aitop newer (larger `schema`), timed out, bad response (broken JSON or over 8MB). Remote error output is not shown.
567
+ - A short connection drop keeps the remote's last sessions (the line shows the error and how old they are) and clears them after 3 failures in a row or 60 seconds. When a remote first connects, or comes back after being cleared, sessions already waiting are not alerted.
568
+ - So after a long drop (once the sessions were cleared), a session that started waiting during the drop is not alerted either: it becomes part of the new baseline.
569
+
570
+ **"no aitop on remote" although it is installed**
571
+
572
+ - `ssh host aitop` runs a non-login shell, so an aitop installed with nvm, fnm or a user npm prefix may not be on its `PATH`.
573
+ - Fix on the remote: put the `PATH` line (for example `export NVM_DIR=...` and `. "$NVM_DIR/nvm.sh"`) at the top of `~/.bashrc`, before the "If not running interactively, return" line, or link it once: `sudo ln -s "$(command -v aitop)" /usr/local/bin/aitop` (run it in a shell where `aitop` works; for nvm, link `node` the same way).
574
+
575
+ **Not fetched**
576
+
577
+ - Diffs (the detail panel shows file stats only), artifact sources (links still work), the remote usage totals (remote cost is not added to the header) and requests (`--show-requests`).
578
+ - `--report` and `--line` stay local.
579
+ - Remote output is treated as untrusted: only known fields are kept, text is stripped of control characters, masked and cut to 200 characters, and the counts are capped (500 sessions, 200 files, 50 members per remote).
580
+
581
+ </details>
582
+
538
583
  ## JSON output
539
584
 
540
585
  > `aitop --json`
@@ -544,6 +589,8 @@ Continue a session elsewhere, for example when you cannot jump to its tab, as in
544
589
  - `--json` prints a snapshot as JSON and exits.
545
590
  - For scripts, use `phaseKind`, a stable state name: `think`, `write`, `tool`, `team`, `waiting`, `idle`, `stopped`, `done`, `ended` (or `null`).
546
591
  - `stopReason` says why a session is `stopped`: `{ "kind": "auth" }` login needed, `network` connection lost, `api` any other API error. `null` otherwise.
592
+ - `schema` (top level) is the JSON shape version, now `1`. It goes up only when an existing field changes meaning or shape.
593
+ - With [`--remote`](#remote-hosts-and-wsl-distros): each session has `host` (`null` for local) and `remoteId` (its id on that host; `id` is `<host>:<id>`), and `remotes` lists each remote as `{ name, kind, ok, error, version, schema, at }` (`[]` when off). `usage` stays local.
547
594
 
548
595
  <details>
549
596
  <summary>Details: text fields and where other fields are described</summary>
package/bin/aitop.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { readFileSync } from 'node:fs';
3
- import { budgetDayOption, configJson, configPath, configText, readConfigFile, resolveConfig } from '../src/config.mjs';
3
+ import { budgetDayOption, configJson, configPath, configText, parseRemote, readConfigFile, remoteOption, resolveConfig } from '../src/config.mjs';
4
4
  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';
@@ -11,7 +11,7 @@ import { mask, setAmbiguous, stripControl } from '../src/text.mjs';
11
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']);
12
12
  const THEMES = ['light', 'dark'];
13
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'];
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', '--remote', '--no-remote'];
15
15
  const VERSION = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
16
16
 
17
17
  // 언어는 다른 옵션의 오류 문구보다 먼저 정한다: --lang > AITOP_LANG > 설정 파일 lang > LC_ALL > LC_MESSAGES > LANG.
@@ -50,10 +50,16 @@ if (report.error) {
50
50
  process.stderr.write(`aitop: ${report.error}\n`);
51
51
  process.exit(2);
52
52
  }
53
+ // --remote <목록>, --remote=<목록>, --no-remote 는 remoteOption 이 꺼낸다 (#308). 잘못된 호스트 이름은 여기서 끝낸다.
54
+ const remoteOpt = remoteOption(report.rest);
55
+ if (remoteOpt.error) {
56
+ process.stderr.write(`aitop: ${remoteOpt.error}\n`);
57
+ process.exit(2);
58
+ }
53
59
  // 사용자가 준 NO_COLOR. 아래에서 파이프 출력이면 NO_COLOR 를 켜므로 그 전에 읽어 둔다 (tmux 의 #() 는 TTY 가 아니다).
54
60
  const userNoColor = Boolean(process.env.NO_COLOR);
55
61
  // --theme light, --theme=light 처럼 값을 받는 옵션은 따로 꺼낸다.
56
- const argv = report.rest;
62
+ const argv = remoteOpt.rest;
57
63
  let theme = null;
58
64
  const rest = [];
59
65
  for (let i = 0; i < argv.length; i++) {
@@ -75,7 +81,7 @@ const flag = (name) => {
75
81
  const notifyFlag = cli.notify ? (cli.eventsSet ? cli.events : true) : notifyOptions(cliArgs, { notify: true }).notify ? undefined : false;
76
82
  // onWaiting 은 --on-waiting 이 뒤에 오면 그 명령, --no-on-waiting 이 뒤에 오면 null(끔), 둘 다 없으면 정하지 않은 것이다.
77
83
  const onWaitingFlag = cli.onWaiting ?? (notifyOptions(cliArgs, { onWaiting: 'x' }).onWaiting === null ? null : undefined);
78
- const config = resolveConfig({ flags: { theme: THEMES.includes(theme) ? theme : undefined, colorBlind: flag('color-blind'), bell: flag('bell'), showRequests: flag('show-requests'), all: flag('all'), debug: flag('debug'), notify: notifyFlag, onWaiting: onWaitingFlag, budgetDay: budget.value, lang: langOpt.value }, file: cfgFile });
84
+ const config = resolveConfig({ flags: { theme: THEMES.includes(theme) ? theme : undefined, colorBlind: flag('color-blind'), bell: flag('bell'), showRequests: flag('show-requests'), all: flag('all'), debug: flag('debug'), notify: notifyFlag, onWaiting: onWaitingFlag, budgetDay: budget.value, lang: langOpt.value, remotes: remoteOpt.value }, file: cfgFile });
79
85
  const opt = Object.fromEntries(Object.entries(config.values).map(([k, v]) => [k, v.value]));
80
86
  // 알림은 설정 파일 값(onWaiting 은 권한 검사를 통과한 것만)을 깔고 명령줄 옵션이 덮는다.
81
87
  const fromFile = (k) => (config.values[k].source === 'file' ? config.values[k].value : undefined);
@@ -270,7 +276,7 @@ if (args.has('--doctor')) {
270
276
  // 진단은 한 번 돌고 끝나므로 Windows 의 첫 PowerShell CIM 호출을 더 오래 기다린다 (procs.mjs WIN_DOCTOR_TIMEOUT_MS).
271
277
  const { setFirstScanTimeout, WIN_DOCTOR_TIMEOUT_MS } = await import('../src/procs.mjs');
272
278
  setFirstScanTimeout(WIN_DOCTOR_TIMEOUT_MS);
273
- const result = { ...checkTools(), config: configJson(config), log: { on: log.on, path: log.path } };
279
+ const result = { ...checkTools(), config: configJson(config), log: { on: log.on, path: log.path }, remotes: (opt.remotes ?? []).map((n) => parseRemote(n)?.name).filter(Boolean) };
274
280
  await printAndExit(args.has('--json') ? JSON.stringify({ version: VERSION, ...result, tools: toolsJson(result.tools) }, null, 2) : doctorText(result, VERSION));
275
281
  }
276
282
 
@@ -290,6 +296,16 @@ const { onKey, fixFocus } = await import('../src/keys.mjs');
290
296
  const { admit, createLoading, latchReady } = await import('../src/loading.mjs');
291
297
  const { osc52, resumeCmd } = await import('../src/resume.mjs');
292
298
 
299
+ // --remote (#308): 원격을 켰을 때만 remote.mjs 를 불러온다 (--report·--line 은 위에서 이미 끝났다).
300
+ // 폴러가 뒤에서 원격마다 aitop --json 을 부르고, refresh 가 그 마지막 결과를 로컬 세션 뒤에 붙인다.
301
+ let poller = null;
302
+ let mergeRemote = null;
303
+ if (opt.remotes?.length) {
304
+ const remote = await import('../src/remote.mjs');
305
+ poller = remote.createRemotePoller(remote.remoteTargets(opt.remotes));
306
+ mergeRemote = remote.mergeRemote;
307
+ }
308
+
293
309
  // 요청 전체 보기는 기본으로 꺼 둔다. 켜지 않으면 상세 패널에도 --json 에도 나가지 않는다.
294
310
  const showRequests = opt.showRequests;
295
311
  // settings: 도움말(?)에 보이는 지금 설정 값.
@@ -328,6 +344,8 @@ const eventWatch = notifier && eventKinds.length ? createEventWatch({ doneMs: op
328
344
  // 알림(벨·--notify·--on-waiting)은 화면에 올리지 않은 갱신에서도 그대로 돈다. 돌려주는 값은 화면 데이터를 바꿨는지.
329
345
  function refresh({ throttle = false } = {}) {
330
346
  const data = collect({ showEnded: view.showEnded, selectedId: view.selectedId, budgetBytes: once ? Infinity : TICK_BUDGET, budgetMs: once ? Infinity : TICK_MS });
347
+ // 원격 결과를 붙인다. 새로 붙은 원격의 세션은 응답 대기 알림의 기준선으로만 넣는다 (remote.mjs mergeRemote).
348
+ if (poller) mergeRemote(data, poller, waitWatch);
331
349
  // 준비 완료를 먼저 정해, 처음 고르는 세션도 이번 갱신의 정렬을 따르게 한다.
332
350
  if (!once) latchReady(loading, data.sessionsMore);
333
351
  if (!data.sessions.some((s) => s.id === view.selectedId)) {
@@ -388,10 +406,13 @@ function select(id) {
388
406
  }
389
407
 
390
408
  if (once) {
409
+ // --once·--json 은 모든 원격이 끝날 때(원격마다 최대 20초)까지 기다린 뒤 낸다.
410
+ if (poller) await poller.pollAll();
391
411
  refresh();
392
412
  flushCache();
393
413
  // --line 이 작업 중 수를 낼 수 있게 요약을 남긴다 (summary.mjs).
394
- writeSummary(summarize(view.data.sessions));
414
+ // 원격 세션(#308)은 --line 이 다루지 않으므로 요약에 넣지 않는다.
415
+ writeSummary(summarize(view.data.sessions.filter((s) => !s.host)));
395
416
  const size = (v) => (Number(v) > 0 ? Math.floor(Number(v)) : 0);
396
417
  const W = process.stdout.columns || size(process.env.COLUMNS) || 140;
397
418
  const H = process.stdout.rows || size(process.env.LINES) || 40;
@@ -445,12 +466,14 @@ function leaveScreen() {
445
466
  }
446
467
 
447
468
  restore = () => {
469
+ poller?.stop();
448
470
  notifier?.killAll();
449
471
  leaveScreen();
450
472
  flushCache();
451
473
  };
452
474
 
453
475
  function quit() {
476
+ poller?.stop();
454
477
  notifier?.killAll();
455
478
  leaveScreen();
456
479
  flushCache();
@@ -469,6 +492,7 @@ process.on('SIGCONT', () => {
469
492
  });
470
493
  process.on('uncaughtException', (err) => {
471
494
  debug('aitop', 'uncaughtException', err);
495
+ poller?.stop();
472
496
  notifier?.killAll();
473
497
  leaveScreen();
474
498
  try {
@@ -532,6 +556,10 @@ const act = {
532
556
  move,
533
557
  next: () => goTo(nextAttention(attention, visible(), view.selectedId)),
534
558
  keepVisible: keepSelectionVisible,
559
+ // 아티팩트 원본을 뒤에서 찾은 뒤 다시 그린다 (#307).
560
+ redraw: () => draw(),
561
+ // 키 줄에 잠깐 안내를 띄운다 (원격 세션의 아티팩트 원본 막힘, #308).
562
+ notice: (key) => toast(key),
535
563
  };
536
564
 
537
565
  stdin.on('data', (key) => {
@@ -544,7 +572,7 @@ let lastFlush = 0;
544
572
  const writeSummaryThrottled = createSummaryWriter();
545
573
  function tick() {
546
574
  const shown = refresh({ throttle: true });
547
- if (loading.ready && view.data) writeSummaryThrottled(view.data.sessions);
575
+ if (loading.ready && view.data) writeSummaryThrottled(view.data.sessions.filter((s) => !s.host));
548
576
  const more = lastMore;
549
577
  if (more ? Date.now() - lastFlush > LOADING_FLUSH_MS : Date.now() - lastFlush > 15_000) {
550
578
  flushCache();
@@ -555,3 +583,5 @@ function tick() {
555
583
  }
556
584
 
557
585
  setTimeout(tick, 30);
586
+ // 원격은 화면에 들어간 뒤 뒤에서 부른다. 결과는 다음 갱신(1초 안)에 붙는다.
587
+ poller?.start();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sejuneoh/aitop",
3
- "version": "0.39.0",
3
+ "version": "0.41.0",
4
4
  "description": "터미널에서 Claude Code · Codex · Antigravity · Gemini 세션과 토큰을 실시간으로 보는 읽기 전용 모니터",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/config.mjs CHANGED
@@ -47,6 +47,57 @@ export function budgetDayOption(argv) {
47
47
  return { value, rest, error };
48
48
  }
49
49
 
50
+ // 원격(#308): SSH 호스트(별칭, user@host) 또는 wsl:<배포판>. 원격 실행은 remote.mjs 가 하고, 여기는 이름만 확인한다
51
+ // (remote.mjs 는 원격을 켤 때만 불러오므로 확인 규칙은 늘 불러오는 이 모듈에 둔다).
52
+ // ssh 인자로 들어가므로 - 로 시작하는 값(-oProxyCommand=…), 포트(:22), 공백·셸 메타 문자는 받지 않는다. 포트는 ~/.ssh/config 별칭으로 준다.
53
+ export const REMOTE_MAX = 16;
54
+ const SSH_HOST = /^([A-Za-z0-9][A-Za-z0-9._-]{0,63}@)?[A-Za-z0-9][A-Za-z0-9._-]{0,252}$/;
55
+ const WSL_DISTRO = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
56
+ // 'dev' → { name: 'dev', kind: 'ssh', target: 'dev' }, 'wsl:Ubuntu' → { name: 'wsl:Ubuntu', kind: 'wsl', target: 'Ubuntu' }. 잘못되면 null.
57
+ export function parseRemote(v) {
58
+ if (typeof v !== 'string') return null;
59
+ const w = /^wsl:(.*)$/i.exec(v);
60
+ if (w) return WSL_DISTRO.test(w[1]) ? { name: `wsl:${w[1]}`, kind: 'wsl', target: w[1] } : null;
61
+ return SSH_HOST.test(v) ? { name: v, kind: 'ssh', target: v } : null;
62
+ }
63
+ // 같은 원격인지 가르는 열쇠. WSL 배포판 이름은 대소문자를 가리지 않으므로(wsl.exe -d) 작은 글자로 맞춘다. ssh 호스트는 그대로.
64
+ export const remoteKey = (r) => (r.kind === 'wsl' ? r.name.toLowerCase() : r.name);
65
+ const remoteList = (v) => Array.isArray(v) && v.length > 0 && v.length <= REMOTE_MAX && v.every((x) => parseRemote(x) != null);
66
+
67
+ // argv 에서 --remote <목록>, --remote=<목록>, --no-remote 를 꺼낸다. 목록은 쉼표로 잇는다. 뒤에 준 쪽을 따른다.
68
+ // value: 이름 배열, null(--no-remote, 설정 파일 remotes 도 끔), undefined(주지 않음).
69
+ export function remoteOption(argv) {
70
+ let value;
71
+ let error = null;
72
+ const rest = [];
73
+ for (let i = 0; i < argv.length; i++) {
74
+ const a = argv[i];
75
+ if (a === '--no-remote') {
76
+ value = null;
77
+ continue;
78
+ }
79
+ const m = /^--remote(?:=(.*))?$/.exec(a);
80
+ if (!m) {
81
+ rest.push(a);
82
+ continue;
83
+ }
84
+ const next = argv[i + 1];
85
+ const raw = m[1] ?? (next == null || next.startsWith('-') ? '' : argv[++i]);
86
+ const list = raw.split(',').map((x) => x.trim()).filter(Boolean);
87
+ const bad = list.find((x) => parseRemote(x) == null);
88
+ if (!list.length) error ??= t('opt.remoteMissing');
89
+ else if (bad != null) error ??= t('opt.remoteBad', { value: JSON.stringify(stripControl(bad).slice(0, 80)) });
90
+ else if (list.length > REMOTE_MAX) error ??= t('opt.remoteMany', { n: REMOTE_MAX });
91
+ // 같은 이름을 두 번 주면 한 번만 부른다 (WSL 배포판은 대소문자 무시, 처음 적은 표기).
92
+ else {
93
+ const seen = new Map();
94
+ for (const r of list.map(parseRemote)) if (!seen.has(remoteKey(r))) seen.set(remoteKey(r), r.name);
95
+ value = [...seen.values()];
96
+ }
97
+ }
98
+ return { value, rest, error };
99
+ }
100
+
50
101
  const BOOL = ['true', 'false'];
51
102
  // 기록 폴더 목록: 절대 경로(또는 ~ 로 시작) 문자열 배열, 1~16개.
52
103
  const pathList = (v) => Array.isArray(v) && v.length > 0 && v.length <= 16 && v.every(pathLike);
@@ -88,6 +139,8 @@ export const KEYS = {
88
139
  // Claude Desktop Cowork(에이전트 모드) 세션을 담은 앱 폴더 (#304, cowork.mjs findCoworkRoots). 모양은 agyApp 과 같다.
89
140
  // AITOP_COWORK_HOME(경로 또는 off) > 설정 파일 > 기본(true, 저절로 찾음).
90
141
  cowork: { ok: (v) => bool(v) || pathList(v), expect: 'cfg.cowork', def: true, env: ['AITOP_COWORK_HOME', coworkEnv], envProblem: true, envExpect: 'cfg.agyAppEnv' },
142
+ // 모아 볼 원격 (#308): SSH 호스트 또는 wsl:<배포판> 배열, 1~16개. --remote 가 덮고 --no-remote 는 끈다 (null).
143
+ remotes: { ok: remoteList, expect: 'cfg.remotes', def: null },
91
144
  };
92
145
 
93
146
  // Windows 는 XDG_CONFIG_HOME 이 없으면 %APPDATA%\aitop\config.json.
package/src/doctor.mjs CHANGED
@@ -357,5 +357,7 @@ export function doctorText(result, version, now = Date.now(), lang = getLang())
357
357
  const on = result.log.on;
358
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));
359
359
  }
360
+ // --remote(#308)로 정한 원격 목록. 점검은 접속하지 않는다 (네트워크를 쓰지 않음).
361
+ if (result.remotes?.length) out.push('', tr('doctor.remotes', { mark: '○', list: result.remotes.join(', ') }, o));
360
362
  return stripControl(out.join('\n'));
361
363
  }
package/src/help.mjs CHANGED
@@ -34,6 +34,7 @@ export const VIEWS = {
34
34
  keys: [
35
35
  k('detail.switch', '↑↓ j k', 'switchSession', '↑↓/jk'),
36
36
  k('detail.files', 'f Tab', 'files'),
37
+ k('detail.artifacts', 'v', 'artifacts'),
37
38
  k('detail.copy', 'y', 'copy'),
38
39
  k('detail.close', 'd', 'close'),
39
40
  ],
@@ -58,6 +59,26 @@ export const VIEWS = {
58
59
  k('diff.back', 'Esc h ← f Tab', 'back'),
59
60
  ],
60
61
  },
62
+ artifacts: {
63
+ name: 'artifacts',
64
+ title: ko('view.artifacts'),
65
+ keys: [
66
+ k('artifacts.pick', '↑↓ j k', 'pick', '↑↓/jk'),
67
+ k('artifacts.open', 'Enter l', 'source'),
68
+ k('artifacts.back', 'Esc h v', 'back'),
69
+ ],
70
+ },
71
+ artifact: {
72
+ name: 'artifact',
73
+ title: ko('view.artifact'),
74
+ keys: [
75
+ k('artifact.scroll', '↑↓ j k', 'scroll', '↑↓/jk'),
76
+ k('artifact.page', 'space PgDn PgUp', 'page', 'space'),
77
+ k('artifact.ends', 'Home End', 'ends', 'Home/End'),
78
+ k('artifact.prevNext', '[ ]', 'prevNextArt', '[ ]'),
79
+ k('artifact.back', 'Esc h ←', 'back'),
80
+ ],
81
+ },
61
82
  filtered: {
62
83
  name: 'filtered',
63
84
  title: ko('view.filtered'),
@@ -107,9 +128,9 @@ const OPTION_IDS = [
107
128
  export const options = (lang = getLang()) => OPTION_IDS.map(([o, d]) => [o.startsWith('hopt.') ? t(o, null, { lang }) : o, t(d, null, { lang })]);
108
129
  export const OPTIONS = options('ko');
109
130
 
110
- // 지금 보는 화면: 파일 목록·diff 에 들어가 있으면 그 화면, 아니면 세션 표. 검색어는 표에 붙는 것이라 helpSections 가 따로 본다.
131
+ // 지금 보는 화면: 파일 목록·diff·아티팩트 목록·원본에 들어가 있으면 그 화면, 아니면 세션 표. 검색어는 표에 붙는 것이라 helpSections 가 따로 본다.
111
132
  export function helpContext(view) {
112
- if (view.focus === 'diff' || view.focus === 'files') return view.focus;
133
+ if (['diff', 'files', 'artifacts', 'artifact'].includes(view.focus)) return view.focus;
113
134
  return 'table';
114
135
  }
115
136
 
@@ -130,7 +151,7 @@ export function viewText(v, lang = getLang()) {
130
151
  // aitop --help 끝의 키 안내. 지금 언어(bin 이 정한다)로 쓴다.
131
152
  export function keysText(lang = getLang()) {
132
153
  const title = (n) => t(`view.${n}`, null, { lang });
133
- return [`${t('help.keys', null, { lang })}: ${keysLine('table', lang)} · ${keysLine('common', lang)}`, ...['detail', 'files', 'diff', 'filtered', 'search'].map((n) => ` ${title(n)}: ${keysLine(n, lang)}`)].join('\n');
154
+ return [`${t('help.keys', null, { lang })}: ${keysLine('table', lang)} · ${keysLine('common', lang)}`, ...['detail', 'files', 'diff', 'artifacts', 'artifact', 'filtered', 'search'].map((n) => ` ${title(n)}: ${keysLine(n, lang)}`)].join('\n');
134
155
  }
135
156
 
136
157
  // 지금 설정 값 한 줄 (예: 예산 $50 · 알림 켜짐 · 디버그 꺼짐). settings 가 없으면 null.