@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/src/i18n.mjs CHANGED
@@ -68,6 +68,10 @@ const HELP_KO = `{logo} aitop - 터미널에서 Claude Code · Codex · Antigrav
68
68
  1분 안에 aitop 화면·--once·--json 이 남긴 요약이 있을 때만 보인다
69
69
  aitop --json 세션 목록과 사용량 합계를 JSON 으로 한 번 출력한다 (--all 과 함께 쓸 수 있다)
70
70
  세션마다 resumeCmd 에 그 세션을 이어 여는 명령을 넣는다 (예: cd /repo && claude --resume <id>, 없으면 null)
71
+ aitop --remote dev,me@vm2,wsl:Ubuntu-22.04 SSH 원격과 WSL 배포판의 세션을 함께 본다. 각 원격에서 aitop --json --no-remote 를
72
+ ssh -o BatchMode=yes(wsl.exe -d <배포판>)로 10초마다 실행한다 (원격에도 aitop 설치 필요, 한 번에 20초 제한).
73
+ 인증은 내 ssh 설정·agent 에 맡기고 비밀번호는 묻지 않는다. 표에는 로컬 세션 아래 호스트별 '── dev · 3 세션 ──' 줄로 나뉜다.
74
+ 원격 세션은 변경 내용(diff)·아티팩트 원본을 가져오지 않고, 비용은 헤더 합계에 더하지 않는다 (설정 파일 remotes, --no-remote 로 끔)
71
75
  aitop --report daily [--by tool|model|project] [--days N] [--json] 최근 N일(기본·최대 30)의 날짜별 토큰·비용(API 정가 환산)을
72
76
  도구별·모델별·프로젝트별 표로 내고 끝낸다. 최근 날짜가 위, 맨 아래는 합계. 처음 실행은 30일치 기록을 읽느라 오래 걸릴 수 있다
73
77
  프로젝트는 작업 폴더의 마지막 이름이고, 열이 터미널 폭을 넘으면 비용이 작은 쪽을 (그 외) 로 합친다
@@ -86,14 +90,14 @@ const HELP_KO = `{logo} aitop - 터미널에서 Claude Code · Codex · Antigrav
86
90
  aitop --notify=waiting,done,context 알릴 종류를 고른다 (--notify 만 주면 설정 파일 notify 배열, 없으면 waiting). done: 3분(설정 파일 doneMinutes, 응답 대기 시간 빼고) 넘게 작업하던 세션이 다음 지시를
87
91
  기다리면 한 번. context: 컨텍스트가 90% 를 넘으면 한 번 (85% 아래로 내려가면 다시)
88
92
  aitop --on-waiting <명령> 알릴 일이 생기면 /bin/sh -c (Windows 는 cmd.exe /c) 로 명령을 실행한다 (내 권한으로 실행, 10초 제한). 종류는 --notify 를 따른다 (--no-notify 여도)
89
- 세션 정보는 환경변수로만: AITOP_EVENT(waiting|done|context) AITOP_TOOL AITOP_PROJECT AITOP_SESSION_ID AITOP_CWD AITOP_WAITING_FOR
93
+ 세션 정보는 환경변수로만: AITOP_EVENT(waiting|done|context) AITOP_TOOL AITOP_PROJECT AITOP_SESSION_ID AITOP_CWD AITOP_WAITING_FOR AITOP_HOST(원격 세션만)
90
94
  aitop --show-requests 응답 대기 요청 전체를 상세 패널·--json 에 보인다 (AITOP_SHOW_REQUESTS=1). 비밀값 가림은 최선일 뿐이라 명령 속 비밀값이 보일 수 있다
91
95
  aitop --budget-day <달러> 하루 예산. 헤더에 오늘 $12.30/$50 처럼 보이고, 오늘 끝 예상 비용(오늘 + 최근 속도 × 자정까지, 늘 API 환산)이
92
96
  80% 를 넘으면 '예상 $45', 100% 를 넘으면 '예상 $60!' 로 알린다 (AITOP_BUDGET_DAY, 설정 파일 budgetDay)
93
97
  aitop --theme light|dark 밝은 배경 / 어두운 배경 색 (없으면 COLORFGBG 로 고른다)
94
98
  aitop --color-blind 적록 색약용 색. 응답 대기·돈·경고·diff 를 노랑·파랑 계열로 가른다 (AITOP_COLOR_BLIND=1, 설정 파일 colorBlind). --theme 과 함께 쓴다
95
99
  aitop --lang ko|en 화면·--help·--doctor·오류 문구의 언어 (AITOP_LANG, 설정 파일 lang, 없으면 LC_ALL·LC_MESSAGES·LANG 이 ko 로 시작할 때 한국어)
96
- aitop --no-bell · --no-all · --no-show-requests · --no-notify · --no-on-waiting · --no-budget-day · --no-debug · --no-color-blind 설정 파일에서 켠 값을 이번 실행만 끈다
100
+ aitop --no-bell · --no-all · --no-show-requests · --no-notify · --no-on-waiting · --no-budget-day · --no-debug · --no-color-blind · --no-remote 설정 파일에서 켠 값을 이번 실행만 끈다
97
101
  aitop --debug 디버그 로그를 남긴다 (AITOP_DEBUG=1, 설정 파일 debug). 기록 형식이 바뀌어 값이 빌 때 원인 확인용
98
102
  {logPath} (1MB 넘으면 .1 로 하나만 남김, 오류 이름·파일 이름만 쓰고 비밀값은 가림)
99
103
  aitop --print-config 설정 값마다 값과 출처(flag/env/file/default), 설정 파일 위치를 보인다 (--json 과 함께 쓸 수 있다)
@@ -109,6 +113,7 @@ const HELP_KO = `{logo} aitop - 터미널에서 Claude Code · Codex · Antigrav
109
113
  claudeDirs, codexHomes: 읽을 Claude 설정 폴더·Codex 홈 목록 (예: ["~/.claude", "~/.claude-work"], 기본 ~/.claude, ~/.codex).
110
114
  AITOP_CLAUDE_DIRS, AITOP_CODEX_HOMES 에 경로를 : (Windows 는 ;) 로 이어 주면 설정 파일보다 먼저 쓴다.
111
115
  설정 파일 목록이 있으면 물려받은 CLAUDE_CONFIG_DIR, CODEX_HOME 은 쓰지 않는다 (없으면 그 경로를 읽는다)
116
+ remotes: 모아 볼 원격 목록 (예: ["dev", "wsl:Ubuntu"]). --remote 가 덮는다
112
117
  onWaiting 은 파일 소유자가 나이고 그룹·다른 사용자가 쓸 수 없을 때(chmod 600)만 받는다.
113
118
  옵션 > 환경 변수 > 설정 파일 순서로 정한다. 잘못된 값은 무시하고 --doctor 에 알린다.
114
119
 
@@ -128,6 +133,10 @@ const HELP_EN = `{logo} aitop - watch Claude Code, Codex, Antigravity and Gemini
128
133
  show only when the live screen, --once or --json left a summary in the last minute
129
134
  aitop --json print the session list and usage totals as JSON once (works with --all)
130
135
  Each session has resumeCmd, the command that reopens it (e.g. cd /repo && claude --resume <id>, null if none)
136
+ aitop --remote dev,me@vm2,wsl:Ubuntu-22.04 also show sessions on SSH hosts and WSL distros. Runs aitop --json --no-remote on each one
137
+ with ssh -o BatchMode=yes (wsl.exe -d <distro>) every 10 seconds (aitop must be installed there, 20 second limit per call).
138
+ Auth is left to your ssh config and agent; no password prompts. The table splits them below local sessions with '── dev · 3 sessions ──' lines.
139
+ Remote diffs and artifact sources are not fetched, and remote cost is not added to the header (config remotes, off with --no-remote)
131
140
  aitop --report daily [--by tool|model|project] [--days N] [--json] print daily tokens and cost (API list price) for the last N days
132
141
  (default and max 30) by tool, model or project, then exit. Newest day first, total at the bottom. The first run reads 30 days of logs and may take a while
133
142
  A project is the last folder name of the working directory. Columns beyond the terminal width are merged into (others)
@@ -148,14 +157,14 @@ const HELP_EN = `{logo} aitop - watch Claude Code, Codex, Antigravity and Gemini
148
157
  aitop --notify=waiting,done,context pick what to notify about (plain --notify: the config notify list, else waiting). done: once when a session that worked for
149
158
  over 3 minutes (config doneMinutes, approval waits not counted) waits for its next instruction. context: once when context passes 90% (again after it drops below 85%)
150
159
  aitop --on-waiting <cmd> run a command with /bin/sh -c (cmd.exe /c on Windows) when there is something to notify (runs as you, 10 second limit). Follows the --notify kinds (even with --no-notify)
151
- Session info is passed only in env vars: AITOP_EVENT(waiting|done|context) AITOP_TOOL AITOP_PROJECT AITOP_SESSION_ID AITOP_CWD AITOP_WAITING_FOR
160
+ Session info is passed only in env vars: AITOP_EVENT(waiting|done|context) AITOP_TOOL AITOP_PROJECT AITOP_SESSION_ID AITOP_CWD AITOP_WAITING_FOR AITOP_HOST(remote sessions only)
152
161
  aitop --show-requests show full waiting requests in the detail panel and --json (AITOP_SHOW_REQUESTS=1). Secret masking is best effort, so secrets in commands may show
153
162
  aitop --budget-day <usd> daily budget. The header shows today $12.30/$50, and it warns when the projected end-of-day cost (today + recent rate until midnight, always API cost)
154
163
  passes 80%, and in the warning color with ! past 100% (AITOP_BUDGET_DAY, config budgetDay)
155
164
  aitop --theme light|dark colors for a light or dark background (picked from COLORFGBG if not set)
156
165
  aitop --color-blind red-green color blind palette. Waiting, money, warnings and diffs use yellow and blue (AITOP_COLOR_BLIND=1, config colorBlind). Works with --theme
157
166
  aitop --lang ko|en language for the screen, --help, --doctor and error messages (AITOP_LANG, config lang, else Korean when LC_ALL, LC_MESSAGES or LANG starts with ko)
158
- aitop --no-bell · --no-all · --no-show-requests · --no-notify · --no-on-waiting · --no-budget-day · --no-debug · --no-color-blind turn off a config file setting for this run
167
+ aitop --no-bell · --no-all · --no-show-requests · --no-notify · --no-on-waiting · --no-budget-day · --no-debug · --no-color-blind · --no-remote turn off a config file setting for this run
159
168
  aitop --debug write a debug log (AITOP_DEBUG=1, config debug). Useful when a log format changes and values go blank
160
169
  {logPath} (keeps one .1 file past 1MB, writes only error and file names, masks secrets)
161
170
  aitop --print-config show each setting with its value, source (flag/env/file/default) and the config file path (works with --json)
@@ -171,6 +180,7 @@ const HELP_EN = `{logo} aitop - watch Claude Code, Codex, Antigravity and Gemini
171
180
  claudeDirs, codexHomes: Claude config folders and Codex homes to read (e.g. ["~/.claude", "~/.claude-work"], default ~/.claude, ~/.codex).
172
181
  AITOP_CLAUDE_DIRS and AITOP_CODEX_HOMES take paths joined with : (; on Windows) and win over the config file.
173
182
  With a config list, an inherited CLAUDE_CONFIG_DIR or CODEX_HOME is not used (without one, that path is read)
183
+ remotes: remote hosts to show (e.g. ["dev", "wsl:Ubuntu"]). --remote overrides it
174
184
  onWaiting is accepted only when you own the file and no group or other user can write it (chmod 600).
175
185
  Order: option > env var > config file. Bad values are ignored and reported by --doctor.
176
186
 
@@ -187,6 +197,8 @@ export const STRINGS = {
187
197
  'view.detail': '상세 패널',
188
198
  'view.files': '변경 파일 목록',
189
199
  'view.diff': 'diff',
200
+ 'view.artifacts': '아티팩트 목록',
201
+ 'view.artifact': '아티팩트 원본',
190
202
  'view.filtered': '검색어가 걸린 표',
191
203
  'view.search': '검색 입력 중',
192
204
  'view.common': '어디서나',
@@ -211,6 +223,10 @@ export const STRINGS = {
211
223
  'key.scroll': '스크롤',
212
224
  'key.page': '페이지',
213
225
  'key.prevNext': '이전·다음 파일',
226
+ 'key.artifacts': '아티팩트',
227
+ 'key.source': '원본 보기',
228
+ 'key.ends': '처음·끝',
229
+ 'key.prevNextArt': '이전·다음 아티팩트',
214
230
  'key.clearSearch': '검색어 지우기',
215
231
  'key.newSearch': '새 검색',
216
232
  'key.type': '입력',
@@ -261,6 +277,9 @@ export const STRINGS = {
261
277
  'opt.daysDaily': '--days 는 --report daily 와 함께 쓴다 (monthly 는 --months)',
262
278
  'opt.monthsMonthly': '--months 는 --report monthly 와 함께 쓴다 (daily 는 --days)',
263
279
  'opt.reportOnly': '--by, --days, --months 는 --report 와 함께 쓴다',
280
+ 'opt.remoteMissing': '--remote 값이 없습니다 (쉼표로 이은 SSH 호스트 또는 wsl:<배포판>)',
281
+ 'opt.remoteBad': '--remote 값 {value} 이 잘못되었습니다 (SSH 호스트 별칭·user@host 또는 wsl:<배포판>. - 로 시작하는 값·포트(:22)·공백은 받지 않는다. 포트는 ~/.ssh/config 별칭으로 준다)',
282
+ 'opt.remoteMany': '--remote 는 {n}개까지 준다',
264
283
 
265
284
  // 기간 리포트 (--report daily). 도구·모델 이름은 번역하지 않는다.
266
285
  'report.title': '날짜별 사용량 · 최근 {n}일 ({from} ~ {to}) · {by} · API 정가 환산',
@@ -342,6 +361,7 @@ export const STRINGS = {
342
361
  'cfg.paths': '절대 경로(또는 ~/...) 문자열 배열, 1~16개',
343
362
  'cfg.agyApp': 'true, false 또는 절대 경로(또는 ~/...) 배열',
344
363
  'cfg.cowork': 'true, false 또는 Claude 앱 폴더 절대 경로(또는 ~/...) 배열',
364
+ 'cfg.remotes': 'SSH 호스트(별칭·user@host) 또는 "wsl:<배포판>" 문자열 배열, 1~16개',
345
365
  'cfg.agyAppEnv': 'off 또는 절대 경로(또는 ~/...) 목록',
346
366
  'cfg.masked': '설정 파일의 {key} 는 {name} 이 있어 무시합니다',
347
367
  'cfg.file': '설정 파일: {path} ({state})',
@@ -394,6 +414,7 @@ export const STRINGS = {
394
414
  'doctor.debugOn': '켬',
395
415
  'doctor.debugOff': '꺼짐',
396
416
  'doctor.debugTail': ' · --debug 로 켬',
417
+ 'doctor.remotes': '{mark} 원격 {list} (점검에서는 접속하지 않는다)',
397
418
 
398
419
  // 상태 문구 (phaseText 가 phase.msg ?? phase.kind 로 고른다). --json 의 phase 는 늘 이 한국어 표로 만든다.
399
420
  'phase.ended': '종료',
@@ -465,6 +486,19 @@ export const STRINGS = {
465
486
  'member.sdk': '-p',
466
487
  'session.auto': '자동',
467
488
  'group.count': '{n}개',
489
+ // 원격 호스트 구분 줄 (#308): '── dev · 3 세션 · 10초 전 ──', 실패하면 '── dev · 연결 안 됨 (시간 초과) ──'.
490
+ 'remote.count': '{n} 세션',
491
+ 'remote.secAgo': '{n}초 전',
492
+ 'remote.minAgo': '{n}분 전',
493
+ 'remote.pending': '연결 중…',
494
+ 'remote.down': '연결 안 됨 ({why})',
495
+ 'remote.err.auth': '인증 실패',
496
+ 'remote.err.unreachable': '접속 실패',
497
+ 'remote.err.notFound': '원격에 aitop 없음',
498
+ 'remote.err.old': '원격 aitop 이 옛 버전',
499
+ 'remote.err.newer': '원격 aitop 이 더 새 버전',
500
+ 'remote.err.timeout': '시간 초과',
501
+ 'remote.err.bad': '잘못된 응답',
468
502
  'group.waiting': '응답 대기',
469
503
  'group.pinned': '고정',
470
504
  'group.noFolder': '(폴더 없음)',
@@ -492,6 +526,10 @@ export const STRINGS = {
492
526
  'foot.pickFile': '파일 선택',
493
527
  'foot.viewDiff': 'diff 보기',
494
528
  'foot.toSessions': '세션으로',
529
+ 'foot.artifacts': '아티팩트',
530
+ 'foot.pickArtifact': '아티팩트 선택',
531
+ 'foot.viewSource': '원본 보기',
532
+ 'foot.toArtifacts': '목록으로',
495
533
  'foot.hideEnded': '종료 숨김',
496
534
  'foot.showEnded': '종료 포함',
497
535
  'foot.next': '다음',
@@ -502,6 +540,7 @@ export const STRINGS = {
502
540
  'foot.costMode': '비용 기준',
503
541
  'foot.copied': '이어 여는 명령을 클립보드로 보냄 (OSC 52)',
504
542
  'foot.copyNone': '이 세션은 이어 여는 명령이 없다',
543
+ 'foot.remoteNoSource': '원격 세션은 아티팩트 원본을 열 수 없다 (링크만)',
505
544
  'foot.notify': '알림:{v}',
506
545
  'foot.notifyHint': '응답 대기 알림 켜기: a',
507
546
  'foot.notifyOn': '응답 대기 알림 켬 (이번 실행만)',
@@ -580,6 +619,15 @@ export const STRINGS = {
580
619
  'hk.diff.page': '한 페이지씩',
581
620
  'hk.diff.prevNext': '이전·다음 파일',
582
621
  'hk.diff.back': '파일 목록으로',
622
+ 'hk.detail.artifacts': '아티팩트 목록으로 (게시한 것이 있을 때)',
623
+ 'hk.artifacts.pick': '아티팩트 고르기',
624
+ 'hk.artifacts.open': '고른 아티팩트의 원본을 전체 화면으로 (로컬 파일 → 기록의 Write 본문 순으로 찾는다)',
625
+ 'hk.artifacts.back': '세션 표로',
626
+ 'hk.artifact.scroll': '한 줄씩 스크롤',
627
+ 'hk.artifact.page': '한 페이지씩',
628
+ 'hk.artifact.ends': '처음·끝으로',
629
+ 'hk.artifact.prevNext': '이전·다음 아티팩트',
630
+ 'hk.artifact.back': '아티팩트 목록으로',
583
631
  'hk.filtered.select': '검색 결과 안에서 세션 선택',
584
632
  'hk.filtered.clear': '검색어 지우기 (표 전체로)',
585
633
  'hk.filtered.new': '지금 검색어를 지우고 새로 입력',
@@ -616,6 +664,8 @@ export const STRINGS = {
616
664
  'detail.hidden': '비밀값이 있을 수 있는 파일이라 변경 내용을 숨겼습니다',
617
665
  'detail.deleted': '이 파일을 삭제했습니다',
618
666
  'detail.noHunks': '보관된 변경 내용이 없습니다',
667
+ 'detail.remoteDiff': '원격 세션은 변경 내용 없음 (파일 통계만 받는다)',
668
+ 'detail.host': '호스트',
619
669
  // 소스(claude·codex)가 메인 세션의 변경에 붙이는 이름. 화면에서만 바꾼다.
620
670
  'detail.main': '메인',
621
671
  'detail.cut': '… {n}줄 생략',
@@ -633,6 +683,17 @@ export const STRINGS = {
633
683
  'detail.artEdits': '바로 수정',
634
684
  'detail.artPublic': '공개',
635
685
  'detail.artOrg': '조직 공유',
686
+ 'art.srcLocal': '로컬 파일',
687
+ 'art.srcRecord': '기록 본문',
688
+ 'art.srcNone': '원본 없음',
689
+ 'art.srcLoading': '찾는 중…',
690
+ 'art.loading': '기록에서 원본을 찾는 중…',
691
+ 'art.noneNote': '원본 없음 (임시 파일이 지워졌고 기록에도 본문이 없다)',
692
+ 'art.mayDiffer': '게시본과 다를 수 있음',
693
+ 'art.cut': '앞 {n}만',
694
+ 'art.empty': '(보일 글이 없음)',
695
+ 'art.image': '[이미지 {size}]',
696
+ 'art.imageAlt': '[이미지: {alt}]',
636
697
  'detail.activity': '최근 활동',
637
698
  'detail.files': '변경 파일',
638
699
  'detail.tabNone': ' · {tab} 0개',
@@ -688,6 +749,8 @@ export const STRINGS = {
688
749
  'view.detail': 'Detail panel',
689
750
  'view.files': 'Changed files',
690
751
  'view.diff': 'diff',
752
+ 'view.artifacts': 'Artifact list',
753
+ 'view.artifact': 'Artifact source',
691
754
  'view.filtered': 'Filtered table',
692
755
  'view.search': 'Typing a search',
693
756
  'view.common': 'Anywhere',
@@ -712,6 +775,10 @@ export const STRINGS = {
712
775
  'key.scroll': 'scroll',
713
776
  'key.page': 'page',
714
777
  'key.prevNext': 'prev/next file',
778
+ 'key.artifacts': 'artifacts',
779
+ 'key.source': 'view source',
780
+ 'key.ends': 'top/bottom',
781
+ 'key.prevNextArt': 'prev/next artifact',
715
782
  'key.clearSearch': 'clear search',
716
783
  'key.newSearch': 'new search',
717
784
  'key.type': 'to search',
@@ -762,6 +829,9 @@ export const STRINGS = {
762
829
  'opt.daysDaily': '--days only works with --report daily (use --months for monthly)',
763
830
  'opt.monthsMonthly': '--months only works with --report monthly (use --days for daily)',
764
831
  'opt.reportOnly': '--by, --days and --months only work with --report',
832
+ 'opt.remoteMissing': '--remote needs a value (SSH hosts or wsl:<distro>, joined with commas)',
833
+ 'opt.remoteBad': 'bad --remote value {value} (an SSH host alias, user@host or wsl:<distro>. Values starting with -, ports (:22) and spaces are not accepted. Set a port with an alias in ~/.ssh/config)',
834
+ 'opt.remoteMany': '--remote takes at most {n} hosts',
765
835
 
766
836
  'report.title': 'Daily usage, last {n} days ({from} to {to}), {by}, API list price',
767
837
  'report.by.tool': 'by tool',
@@ -841,6 +911,7 @@ export const STRINGS = {
841
911
  'cfg.paths': 'a list of 1 to 16 absolute paths (or ~/...)',
842
912
  'cfg.agyApp': 'true, false, or a list of absolute paths (or ~/...)',
843
913
  'cfg.cowork': 'true, false, or a list of absolute Claude app folder paths (or ~/...)',
914
+ 'cfg.remotes': 'a list of 1 to 16 SSH hosts (alias or user@host) or "wsl:<distro>" strings',
844
915
  'cfg.agyAppEnv': 'off or a list of absolute paths (or ~/...)',
845
916
  'cfg.masked': 'ignoring {key} in the config file because {name} is set',
846
917
  'cfg.file': 'Config file: {path} ({state})',
@@ -893,6 +964,7 @@ export const STRINGS = {
893
964
  'doctor.debugOn': 'on',
894
965
  'doctor.debugOff': 'off',
895
966
  'doctor.debugTail': ' · turn on with --debug',
967
+ 'doctor.remotes': '{mark} remote {list} (not contacted by the check)',
896
968
 
897
969
  'phase.ended': 'Ended',
898
970
  'phase.done': 'Done',
@@ -957,6 +1029,18 @@ export const STRINGS = {
957
1029
  'member.sdk': '-p',
958
1030
  'session.auto': 'auto',
959
1031
  'group.count': '{n}',
1032
+ 'remote.count': '{n} sessions',
1033
+ 'remote.secAgo': '{n}s ago',
1034
+ 'remote.minAgo': '{n}m ago',
1035
+ 'remote.pending': 'connecting…',
1036
+ 'remote.down': 'not connected ({why})',
1037
+ 'remote.err.auth': 'auth failed',
1038
+ 'remote.err.unreachable': 'unreachable',
1039
+ 'remote.err.notFound': 'no aitop on remote',
1040
+ 'remote.err.old': 'remote aitop too old',
1041
+ 'remote.err.newer': 'remote aitop newer',
1042
+ 'remote.err.timeout': 'timed out',
1043
+ 'remote.err.bad': 'bad response',
960
1044
  'group.waiting': 'Waiting',
961
1045
  'group.pinned': 'Pinned',
962
1046
  'group.noFolder': '(no folder)',
@@ -984,6 +1068,10 @@ export const STRINGS = {
984
1068
  'foot.pickFile': 'pick file',
985
1069
  'foot.viewDiff': 'view diff',
986
1070
  'foot.toSessions': 'to sessions',
1071
+ 'foot.artifacts': 'artifacts',
1072
+ 'foot.pickArtifact': 'pick artifact',
1073
+ 'foot.viewSource': 'view source',
1074
+ 'foot.toArtifacts': 'to list',
987
1075
  'foot.hideEnded': 'hide ended',
988
1076
  'foot.showEnded': 'show ended',
989
1077
  'foot.next': 'next',
@@ -994,6 +1082,7 @@ export const STRINGS = {
994
1082
  'foot.costMode': 'cost',
995
1083
  'foot.copied': 'resume command sent to clipboard (OSC 52)',
996
1084
  'foot.copyNone': 'no resume command for this session',
1085
+ 'foot.remoteNoSource': 'remote sessions cannot open artifact sources (link only)',
997
1086
  'foot.notify': 'alerts:{v}',
998
1087
  'foot.notifyHint': 'turn on waiting alerts: a',
999
1088
  'foot.notifyOn': 'waiting alerts on (this run only)',
@@ -1071,6 +1160,15 @@ export const STRINGS = {
1071
1160
  'hk.diff.page': 'Scroll one page',
1072
1161
  'hk.diff.prevNext': 'Previous or next file',
1073
1162
  'hk.diff.back': 'Back to the file list',
1163
+ 'hk.detail.artifacts': 'Open the artifact list (when something was published)',
1164
+ 'hk.artifacts.pick': 'Pick an artifact',
1165
+ 'hk.artifacts.open': 'View the source full screen (local file first, then the Write body in the transcript)',
1166
+ 'hk.artifacts.back': 'Back to the session table',
1167
+ 'hk.artifact.scroll': 'Scroll one line',
1168
+ 'hk.artifact.page': 'Scroll one page',
1169
+ 'hk.artifact.ends': 'Jump to top or bottom',
1170
+ 'hk.artifact.prevNext': 'Previous or next artifact',
1171
+ 'hk.artifact.back': 'Back to the artifact list',
1074
1172
  'hk.filtered.select': 'Select a session in the results',
1075
1173
  'hk.filtered.clear': 'Clear the search (full table)',
1076
1174
  'hk.filtered.new': 'Clear the search and type a new one',
@@ -1106,6 +1204,8 @@ export const STRINGS = {
1106
1204
  'detail.hidden': 'Changes hidden because this file may hold secrets',
1107
1205
  'detail.deleted': 'This file was deleted',
1108
1206
  'detail.noHunks': 'No saved changes',
1207
+ 'detail.remoteDiff': 'No changes for remote sessions (file stats only)',
1208
+ 'detail.host': 'Host',
1109
1209
  'detail.main': 'main',
1110
1210
  'detail.cut': { one: '… {n} line cut', other: '… {n} lines cut' },
1111
1211
  'detail.dropped': { one: '… {n} older change cut (over the limit)', other: '… {n} older changes cut (over the limit)' },
@@ -1122,6 +1222,17 @@ export const STRINGS = {
1122
1222
  'detail.artEdits': 'edited in place',
1123
1223
  'detail.artPublic': 'public',
1124
1224
  'detail.artOrg': 'org',
1225
+ 'art.srcLocal': 'local file',
1226
+ 'art.srcRecord': 'transcript body',
1227
+ 'art.srcNone': 'no source',
1228
+ 'art.srcLoading': 'searching…',
1229
+ 'art.loading': 'Searching the transcript for the source…',
1230
+ 'art.noneNote': 'No source (the temp file is gone and the transcript has no body)',
1231
+ 'art.mayDiffer': 'may differ from the published version',
1232
+ 'art.cut': 'first {n} only',
1233
+ 'art.empty': '(nothing to show)',
1234
+ 'art.image': '[image {size}]',
1235
+ 'art.imageAlt': '[image: {alt}]',
1125
1236
  'detail.activity': 'Recent activity',
1126
1237
  'detail.files': 'Changed files',
1127
1238
  'detail.tabNone': ' · {tab}: none',
package/src/json.mjs CHANGED
@@ -21,20 +21,32 @@ const usageOf = (u) => (u ? { ...u, ...('cost' in u ? { cost: money(u.cost) } :
21
21
 
22
22
  // version 은 aitop 버전, tools 는 aitop --doctor 와 같은 도구별 점검 결과다.
23
23
  // opts.showRequests: 응답 대기 요청 전체(waitDetail)를 넣는다. 기본은 꺼져 있다.
24
+ // opts.platform: 원격 세션(#308) resumeCmd 의 로컬 셸 따옴표를 고르는 플랫폼 (기본 process.platform, 테스트에서 바꿔 끼운다).
24
25
  // opts.budgetDay: 하루 예산. 있으면 usage.budget 에 예산, 오늘 끝 예상 비용(API 정가 환산, 화면과 같은 기준), 단계를 넣는다.
25
26
  // --json 의 phase 문구. 한국어 표로 만든다 (영어 화면 1/3 의 계약).
26
27
  const koPhase = (p) => (p?.kind ? phaseText(p, { lang: 'ko' }) : null);
27
28
 
29
+ // --json 모양의 버전 (#308). 다른 aitop 이 --remote 로 이 출력을 읽을 때 모양이 맞는지 본다.
30
+ // 필드를 더하기만 하면 그대로 두고, 있던 필드의 뜻이나 모양을 바꿀 때 올린다.
31
+ export const SCHEMA = 1;
32
+ const remoteOf = (r) => ({ name: r.name, kind: r.kind, ok: Boolean(r.ok), error: r.error ?? null, version: r.version ?? null, schema: r.schema ?? null, at: iso(r.at) });
33
+
28
34
  export function toJson(data, version = null, opts = {}) {
29
35
  const b = data.usage ? projectBudget(data.usage, opts.budgetDay, { now: data.at ?? Date.now() }) : null;
30
36
  return {
31
37
  version,
38
+ schema: SCHEMA,
32
39
  at: iso(data.at),
33
40
  tools: toolsJson(data.tools?.tools),
34
41
  usage: data.usage ? { today: usageOf(data.usage.today), last7days: { ...usageOf(data.usage.week), ...dailyOf(data.usage.days7) }, lastHour: lastHourOf(data.usage.lastHour), complete: data.usage.loading == null, ...(b ? { budget: { day: b.day, projected: money(b.projected), unknown: b.unknown, level: b.level } } : {}) } : null,
42
+ // --remote 로 모은 원격마다 마지막 결과 (#308). 원격을 켜지 않으면 빈 배열. at 은 마지막으로 성공한 시각.
43
+ remotes: (data.remotes ?? []).map(remoteOf),
35
44
  sessions: data.sessions.map((s) => ({
36
45
  tool: s.tool,
46
+ // 원격 세션의 id 는 '<host>:<원래 id>' 이고 원래 id 는 remoteId 에 있다. 로컬 세션은 host·remoteId 가 null.
37
47
  id: s.id,
48
+ host: s.host ?? null,
49
+ remoteId: s.host ? (s.remoteId ?? null) : null,
38
50
  name: s.name ?? null,
39
51
  project: s.project ?? null,
40
52
  cwd: s.cwd ?? null,
@@ -61,7 +73,7 @@ export function toJson(data, version = null, opts = {}) {
61
73
  toolStartedAt: iso(s.toolStartedAt),
62
74
  waitingFor: s.waitingFor ?? null,
63
75
  // 이 세션을 이어 여는 셸 명령 (resume.mjs). 만들 수 없으면 null.
64
- resumeCmd: resumeCmd(s),
76
+ resumeCmd: resumeCmd(s, { platform: opts.platform }),
65
77
  // 허락을 기다리는 요청의 전체 내용 (Bash 명령, 파일 경로 등). --show-requests 를 켰을 때만 넣는다. 비밀값 가림은 최선을 다할 뿐이다.
66
78
  ...(opts.showRequests ? { waitDetail: s.waitDetail ?? null } : {}),
67
79
  now: s.now || null,
package/src/keys.mjs CHANGED
@@ -1,15 +1,21 @@
1
1
  // 키 입력 처리. 화면 상태(view)를 바꾸고, 종료·갱신·세션 이동처럼 밖에서 해야 할 일은 act 로 부른다.
2
2
  // view.focus: null(세션 선택) → 'files'(변경 파일 목록) → 'diff'(고른 파일의 변경 내용). Esc 는 한 단계씩 뒤로 가고 종료하지 않는다.
3
+ // 아티팩트(#307): v 로 상세 패널의 아티팩트 목록에 들어가 'artifacts'(목록) → Enter 'artifact'(원본 전체 화면). Esc 로 한 단계씩 돌아온다.
4
+ // view.artifactId: 고른 아티팩트, view.artDoc: 연 원본 (Enter 때만 artifact-source.mjs 가 찾는다), view.artScroll: 원본 스크롤 위치.
3
5
  // view.tab: 변경 파일을 보는 지시 탭 ('now' 이번 지시, 지시 번호, 'all' 전체). turns.mjs 참고.
4
6
  import { turnTabs, visibleFiles } from './turns.mjs';
5
7
  import { detailOpen } from './ui/chrome.mjs';
6
8
  import { nextGroup, nextSort, togglePin } from './order.mjs';
9
+ import { openArtifactSource } from './sources/artifact-source.mjs';
7
10
 
8
- export const KEY = { up: '\x1b[A', down: '\x1b[B', right: '\x1b[C', left: '\x1b[D', pageUp: '\x1b[5~', pageDown: '\x1b[6~', esc: '\x1b', enter: '\r', tab: '\t', ctrlC: '\x03', backspace: '\x7f' };
11
+ export const KEY = { up: '\x1b[A', down: '\x1b[B', right: '\x1b[C', left: '\x1b[D', pageUp: '\x1b[5~', pageDown: '\x1b[6~', home: '\x1b[H', end: '\x1b[F', esc: '\x1b', enter: '\r', tab: '\t', ctrlC: '\x03', backspace: '\x7f' };
9
12
 
10
13
  const isUp = (k) => k === KEY.up || k === 'k';
11
14
  const isDown = (k) => k === KEY.down || k === 'j';
12
15
  const isBack = (k) => k === KEY.esc || k === 'h';
16
+ // 터미널마다 Home·End 를 보내는 모양이 다르다.
17
+ const isHome = (k) => k === KEY.home || k === '\x1b[1~' || k === '\x1b[7~' || k === '\x1bOH';
18
+ const isEnd = (k) => k === KEY.end || k === '\x1b[4~' || k === '\x1b[8~' || k === '\x1bOF';
13
19
 
14
20
  export function selectedSession(view) {
15
21
  return view.data?.sessions.find((s) => s.id === view.selectedId) ?? null;
@@ -19,9 +25,23 @@ const hasFiles = (view) => Boolean(selectedSession(view)?.files?.length);
19
25
  // 지금 탭에 보이는 파일
20
26
  const filesOf = (view) => visibleFiles(selectedSession(view), view.tab);
21
27
 
28
+ const artsOf = (view) => selectedSession(view)?.artifacts ?? [];
29
+ const pickedArtifact = (view) => artsOf(view).find((a) => a.id === view.artifactId) ?? null;
30
+
22
31
  // 갱신 뒤에 고른 파일이 탭에서 빠졌거나 세션에 고친 파일이 없어졌으면 포커스를 맞춘다.
23
32
  export function fixFocus(view) {
24
33
  if (!view.focus) return;
34
+ // 원본 화면은 연 원본(artDoc)이 있는 동안 그대로 둔다. 목록은 아티팩트가 없어지면 닫는다.
35
+ if (view.focus === 'artifact') {
36
+ if (!view.artDoc) view.focus = artsOf(view).length ? 'artifacts' : null;
37
+ return;
38
+ }
39
+ if (view.focus === 'artifacts') {
40
+ const arts = artsOf(view);
41
+ if (!arts.length || !view.showDetail) view.focus = null;
42
+ else if (!pickedArtifact(view)) view.artifactId = arts[0].id;
43
+ return;
44
+ }
25
45
  if (!hasFiles(view) || !view.showDetail) {
26
46
  view.focus = null;
27
47
  return;
@@ -87,6 +107,81 @@ function diffKey(view, key) {
87
107
  return true;
88
108
  }
89
109
 
110
+ function enterArtifacts(view) {
111
+ const arts = artsOf(view);
112
+ if (!arts.length) return;
113
+ view.showDetail = true;
114
+ view.focus = 'artifacts';
115
+ if (!pickedArtifact(view)) view.artifactId = arts[0].id;
116
+ }
117
+
118
+ function stepArtifact(view, delta) {
119
+ const arts = artsOf(view);
120
+ const i = Math.max(0, arts.findIndex((a) => a.id === view.artifactId));
121
+ view.artifactId = arts[Math.min(arts.length - 1, Math.max(0, i + delta))]?.id ?? null;
122
+ }
123
+
124
+ // 원본은 화면을 열 때만 찾는다 (act.loadArtifact 는 테스트가 바꿔 끼운다).
125
+ // 기억한 위치로 바로 찾지 못하면 '찾는 중…' 을 먼저 보이고, 기록 훑기가 끝나면 바꾼 뒤 act.redraw 로 다시 그린다.
126
+ // 그 사이 다른 원본을 열거나 목록으로 돌아가면(view.artDoc 가 바뀜) 훑기를 그만둔다.
127
+ function openArtifact(view, act) {
128
+ const a = pickedArtifact(view);
129
+ if (!a) return;
130
+ // 원격 세션(#308)의 원본은 원격 기록에 있어 열지 않는다. 목록에 남고 키 줄에 안내만 띄운다.
131
+ if (selectedSession(view)?.host) {
132
+ act?.notice?.('foot.remoteNoSource');
133
+ return;
134
+ }
135
+ view.focus = 'artifact';
136
+ view.artScroll = 0;
137
+ if (act?.loadArtifact) {
138
+ view.artDoc = act.loadArtifact(selectedSession(view), a);
139
+ return;
140
+ }
141
+ const wait = { kind: 'loading', path: null, text: '', cut: false, changed: false };
142
+ view.artDoc = wait;
143
+ const doc = openArtifactSource(selectedSession(view), a, {
144
+ cancelled: () => view.artDoc !== wait,
145
+ done: (d) => {
146
+ if (view.artDoc !== wait) return;
147
+ view.artDoc = d;
148
+ act?.redraw?.();
149
+ },
150
+ });
151
+ if (doc) view.artDoc = doc;
152
+ }
153
+
154
+ function artifactsKey(view, key, act) {
155
+ if (isUp(key)) stepArtifact(view, -1);
156
+ else if (isDown(key)) stepArtifact(view, 1);
157
+ else if (key === KEY.enter || key === 'l') openArtifact(view, act);
158
+ else if (isBack(key) || key === 'v') view.focus = null;
159
+ else return false;
160
+ return true;
161
+ }
162
+
163
+ // 원본 화면은 모달이다: 스크롤·이전/다음·뒤로 말고는 받지 않는다 (? 와 q 는 onKey 가 먼저 본다).
164
+ function artifactKey(view, key, act) {
165
+ const page = view.artPage ?? 10;
166
+ const at = view.artScroll ?? 0;
167
+ if (isUp(key)) view.artScroll = Math.max(0, at - 1);
168
+ else if (isDown(key)) view.artScroll = at + 1;
169
+ else if (key === ' ' || key === KEY.pageDown) view.artScroll = at + page;
170
+ else if (key === KEY.pageUp) view.artScroll = Math.max(0, at - page);
171
+ else if (isHome(key)) view.artScroll = 0;
172
+ // 끝은 그릴 때 본문 길이에 맞춘다 (artifact-view.mjs artifactScreen).
173
+ else if (isEnd(key)) view.artScroll = Infinity;
174
+ else if (key === '[' || key === ']') {
175
+ const before = view.artifactId;
176
+ stepArtifact(view, key === '[' ? -1 : 1);
177
+ if (view.artifactId !== before) openArtifact(view, act);
178
+ } else if (isBack(key) || key === KEY.left) {
179
+ view.focus = 'artifacts';
180
+ view.artDoc = null;
181
+ }
182
+ return true;
183
+ }
184
+
90
185
  // 검색 중에는 글자를 검색어로 받는다. Enter 는 검색어를 남기고 목록으로, Esc 는 검색을 지운다.
91
186
  function searchKey(view, key, act) {
92
187
  if (key === KEY.enter) view.searching = false;
@@ -120,6 +215,8 @@ export function onKey(view, key, act) {
120
215
  return;
121
216
  }
122
217
  if (key === 'q') return act.quit();
218
+ if (view.focus === 'artifact' && artifactKey(view, key, act)) return;
219
+ if (view.focus === 'artifacts' && artifactsKey(view, key, act)) return;
123
220
  if (view.focus === 'diff' && diffKey(view, key)) return;
124
221
  if (view.focus === 'files' && filesKey(view, key)) return;
125
222
  if (key === KEY.esc) {
@@ -127,6 +224,7 @@ export function onKey(view, key, act) {
127
224
  return;
128
225
  }
129
226
  if (key === 'f' || key === KEY.tab) return enterFiles(view);
227
+ if (key === 'v') return enterArtifacts(view);
130
228
  if (key === '/') {
131
229
  view.searching = true;
132
230
  view.filter = '';
package/src/notify.mjs CHANGED
@@ -224,11 +224,14 @@ export function waitingEnv(s) {
224
224
  AITOP_SESSION_ID: String(s.id ?? ''),
225
225
  AITOP_CWD: String(s.cwd ?? ''),
226
226
  AITOP_WAITING_FOR: waitingLabel(s),
227
+ // --remote 로 본 원격 세션이면 그 호스트 이름 (#308). 로컬 세션은 빈 값.
228
+ AITOP_HOST: String(s.host ?? ''),
227
229
  };
228
230
  }
229
231
 
230
232
  // 알림 본문의 세션 이름: 사용자가 붙인 이름(/rename, thread_name)이 있으면 그것, 없으면 예전처럼 프로젝트.
231
- const whoOf = (s) => s.customName || s.project || s.id || '';
233
+ // 원격 세션(#308)은 앞에 호스트를 붙인다 (dev · aitop).
234
+ const whoOf = (s) => (s.host ? `${s.host} · ` : '') + (s.customName || s.project || s.id || '');
232
235
 
233
236
  // 알림 제목·본문은 화면 언어를 따른다 (AITOP_WAITING_FOR 와 달리 사람이 읽는 글이라).
234
237
  // kind 가 done·context 면 그 종류의 문구를 쓴다. context 본문에는 사용률(%)을 붙인다.
package/src/order.mjs CHANGED
@@ -53,7 +53,18 @@ const GROUP_KEY = { project: projectOf, tool: (s) => s.tool ?? '?' };
53
53
  // groups 는 묶을 때만 있다: { name, count, cost, unknown, waiting, pinned, sessions }. 묶음은 그 안의 첫 세션이 정렬에서 앞선 순으로 놓인다.
54
54
  // pins: 고정한 세션 id (고정한 순서). 화면에 없는 id 는 건너뛴다.
55
55
  // ready: false 면 준비 완료 전이다 (compare 참고). 응답 대기 세션은 그동안에도 맨 위로 올린다.
56
- export function arrange(sessions, { sort = 'default', group = 'none', costMode = 'api', pins = [], ready = true } = {}) {
56
+ // --remote(#308)로 받은 원격 세션(host 가 있는 세션)은 로컬 세션 아래에 호스트별 구획으로 둔다. 구획 안의 정렬·묶기·대기 우선은 위 규칙 그대로다.
57
+ // 그때 hosts 는 [{ host, sessions, groups }] (원격 순서는 remotes 에 준 이름 순서, 없으면 처음 나온 순서), sessions·groups 는 로컬 몫과 구획을 차례로 이은 것이다.
58
+ // 원격 세션이 없으면 hosts 는 null 이고 결과는 예전과 같다.
59
+ export function arrange(sessions, opts = {}) {
60
+ if (!sessions.some((s) => s.host)) return { ...arrangeOne(sessions, opts), hosts: null };
61
+ const local = arrangeOne(sessions.filter((s) => !s.host), opts);
62
+ const names = [...new Set([...(opts.remotes ?? []).map((r) => r.name), ...sessions.filter((s) => s.host).map((s) => s.host)])];
63
+ const hosts = names.map((host) => ({ host, ...arrangeOne(sessions.filter((s) => s.host === host), opts) }));
64
+ return { sessions: [...local.sessions, ...hosts.flatMap((h) => h.sessions)], groups: local.groups, hosts };
65
+ }
66
+
67
+ function arrangeOne(sessions, { sort = 'default', group = 'none', costMode = 'api', pins = [], ready = true } = {}) {
57
68
  const cmp = compare(sort, costMode, ready);
58
69
  const rank = new Map((pins ?? []).map((id, i) => [id, i]));
59
70
  const waiting = sessions.filter(callsYou).sort(cmp);