@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 +76 -4
- package/bin/aitop.mjs +56 -16
- package/package.json +1 -1
- package/src/collect.mjs +2 -1
- package/src/config.mjs +13 -1
- package/src/doctor.mjs +73 -27
- package/src/help.mjs +1 -0
- package/src/i18n.mjs +56 -9
- package/src/json.mjs +3 -1
- package/src/keys.mjs +2 -0
- package/src/line.mjs +6 -1
- package/src/notify.mjs +62 -4
- package/src/resume.mjs +2 -1
- package/src/sources/agy-ledger.mjs +48 -20
- package/src/sources/antigravity.mjs +172 -25
- package/src/sources/claude-ledger.mjs +8 -0
- package/src/sources/claude.mjs +16 -12
- package/src/sources/cowork.mjs +562 -0
- package/src/sources/dirs.mjs +42 -2
- package/src/sources/projects.mjs +9 -3
- package/src/suggest.mjs +31 -0
- package/src/summary.mjs +1 -1
- package/src/trace.mjs +6 -4
- package/src/ui/chrome.mjs +20 -3
- package/src/ui/detail.mjs +127 -11
- package/src/ui/draw.mjs +7 -4
- package/src/ui/glyphs.mjs +2 -1
- package/src/ui/table.mjs +40 -16
- package/src/ui/theme.mjs +2 -0
- package/src/ui.mjs +28 -0
package/src/i18n.mjs
CHANGED
|
@@ -196,6 +196,7 @@ export const STRINGS = {
|
|
|
196
196
|
'key.sort': '정렬',
|
|
197
197
|
'key.group': '묶기',
|
|
198
198
|
'key.costMode': '비용 기준',
|
|
199
|
+
'key.notify': '알림',
|
|
199
200
|
'key.pin': '고정',
|
|
200
201
|
'key.files': '변경 파일',
|
|
201
202
|
'key.detail': '상세',
|
|
@@ -220,7 +221,10 @@ export const STRINGS = {
|
|
|
220
221
|
'key.help': '도움말',
|
|
221
222
|
'key.quit': '나가기',
|
|
222
223
|
|
|
223
|
-
'cli.unknown': '
|
|
224
|
+
'cli.unknown': '알 수 없는 옵션 {opts}',
|
|
225
|
+
'cli.didYouMean': '(혹시 {opt}?)',
|
|
226
|
+
'cli.themeValues': '(light 또는 dark)',
|
|
227
|
+
'cli.seeHelp': '전체 옵션은 aitop --help',
|
|
224
228
|
'cli.themeMissing': '--theme 값이 없습니다 (light 또는 dark)',
|
|
225
229
|
'cli.unhandled': '처리되지 않은 오류로 끝냅니다 ({why})',
|
|
226
230
|
'cli.logOff': '디버그 로그를 열 수 없어 끕니다 ({path})',
|
|
@@ -336,6 +340,10 @@ export const STRINGS = {
|
|
|
336
340
|
'cfg.notify': 'true, false 또는 waiting·done·context 배열',
|
|
337
341
|
'cfg.positive': '0 보다 큰 수',
|
|
338
342
|
'cfg.paths': '절대 경로(또는 ~/...) 문자열 배열, 1~16개',
|
|
343
|
+
'cfg.agyApp': 'true, false 또는 절대 경로(또는 ~/...) 배열',
|
|
344
|
+
'cfg.cowork': 'true, false 또는 Claude 앱 폴더 절대 경로(또는 ~/...) 배열',
|
|
345
|
+
'cfg.agyAppEnv': 'off 또는 절대 경로(또는 ~/...) 목록',
|
|
346
|
+
'cfg.masked': '설정 파일의 {key} 는 {name} 이 있어 무시합니다',
|
|
339
347
|
'cfg.file': '설정 파일: {path} ({state})',
|
|
340
348
|
'cfg.exists': '있음',
|
|
341
349
|
'cfg.missing': '없음',
|
|
@@ -353,6 +361,10 @@ export const STRINGS = {
|
|
|
353
361
|
'doctor.noFolder': '기록 폴더 없음',
|
|
354
362
|
'doctor.records': '기록 {n}개',
|
|
355
363
|
'doctor.dirMissing': '폴더 없음',
|
|
364
|
+
'doctor.agyApp': 'Antigravity 앱',
|
|
365
|
+
'doctor.coworkApp': 'Claude 앱',
|
|
366
|
+
'doctor.coworkSessions': '세션 {n}개',
|
|
367
|
+
'doctor.hint.coworkUnread': '세션 목록을 읽지 못했습니다. 앱 업데이트로 형식이 바뀌었을 수 있습니다',
|
|
356
368
|
'doctor.candidate': '읽지 않는 기록 폴더 {path} (기록 {n}개)',
|
|
357
369
|
'doctor.candidateHintClaude': '읽으려면 설정 파일 claudeDirs 배열에 넣거나 AITOP_CLAUDE_DIRS 로 주세요 (예: ["~/.claude", "~/.claude-work"])',
|
|
358
370
|
'doctor.candidateHintCodex': '읽으려면 설정 파일 codexHomes 배열에 넣거나 AITOP_CODEX_HOMES 로 주세요 (예: ["~/.codex", "~/.codex-alt"])',
|
|
@@ -445,7 +457,8 @@ export const STRINGS = {
|
|
|
445
457
|
'hdr.netShort': '캐시제외',
|
|
446
458
|
|
|
447
459
|
'tools.missing': '미설치',
|
|
448
|
-
'tools.
|
|
460
|
+
'tools.hiddenMissing': '미설치: {list}',
|
|
461
|
+
'tools.hiddenIdle': '7일 미사용: {list}',
|
|
449
462
|
'tools.ended': '종료된 세션 포함 (24시간)',
|
|
450
463
|
'table.title': '세션 {n}',
|
|
451
464
|
'member.stalled': '멈춘 듯',
|
|
@@ -464,12 +477,12 @@ export const STRINGS = {
|
|
|
464
477
|
'groupBy.tool': '도구',
|
|
465
478
|
'empty.none': '실행 중인 AI 세션이 없습니다.',
|
|
466
479
|
'empty.none24': '지난 24시간 안에 AI 세션이 없습니다.',
|
|
480
|
+
'empty.procs': '{list} 실행 중이지만 읽을 세션 기록이 아직 없습니다.',
|
|
481
|
+
'empty.procsHint': '그 도구에 요청을 보내면 여기에 나옵니다. 점검: aitop --doctor',
|
|
467
482
|
'empty.show': '지난 24시간 세션 보기: ',
|
|
468
483
|
'empty.or': ' 또는 ',
|
|
469
484
|
|
|
470
485
|
'foot.help': '도움',
|
|
471
|
-
// 폭이 모자라 키 안내가 빠졌을 때 ? 칩 라벨.
|
|
472
|
-
'foot.helpAll': '키 전체',
|
|
473
486
|
'foot.closeHelp': '도움 닫기',
|
|
474
487
|
'foot.readOnly': '⊘ 읽기전용',
|
|
475
488
|
'foot.count': '{n}개',
|
|
@@ -489,6 +502,11 @@ export const STRINGS = {
|
|
|
489
502
|
'foot.costMode': '비용 기준',
|
|
490
503
|
'foot.copied': '이어 여는 명령을 클립보드로 보냄 (OSC 52)',
|
|
491
504
|
'foot.copyNone': '이 세션은 이어 여는 명령이 없다',
|
|
505
|
+
'foot.notify': '알림:{v}',
|
|
506
|
+
'foot.notifyHint': '응답 대기 알림 켜기: a',
|
|
507
|
+
'foot.notifyOn': '응답 대기 알림 켬 (이번 실행만)',
|
|
508
|
+
'foot.notifyOff': '응답 대기 알림 끔 (이번 실행만)',
|
|
509
|
+
'foot.notifyNone': '알림 도구를 찾지 못함. aitop --doctor 로 확인',
|
|
492
510
|
'foot.clearSearch': '검색 지우기',
|
|
493
511
|
|
|
494
512
|
'help.title': '도움말 · ? 또는 Esc 로 닫기',
|
|
@@ -521,12 +539,15 @@ export const STRINGS = {
|
|
|
521
539
|
'legend.stalled': '팀원 기록이 3분(느린 도구 10분) 그대로. 짐작',
|
|
522
540
|
'legend.sdk': '팀원 행: 이 세션이 띄운 claude -p 실행',
|
|
523
541
|
'legend.auto': '부모 없는 claude -p 실행. 대기 알림 없음',
|
|
542
|
+
'legend.cowork': 'TOOL 칸: Claude Desktop 에이전트 모드 세션',
|
|
524
543
|
'legend.status': '지금 단계. 큰 기록을 처음 읽는 동안은 기록 읽는 중 N%',
|
|
525
544
|
'legend.tokens': '세션 누적 토큰 (서브에이전트 포함, 캐시 읽기 포함)',
|
|
526
545
|
'legend.cost': 'API 정가로 환산한 비용 (Codex 는 OpenAI 정가 추정). 가격표에 없는 모델은 빼고 센다',
|
|
527
546
|
'legend.context': '마지막 요청의 컨텍스트 사용률 (모델별 창 크기 기준)',
|
|
528
547
|
'legend.idleCol': '마지막 활동 후 지난 시간. 작업 중이면 now',
|
|
529
|
-
'legend.
|
|
548
|
+
'legend.missingKey': '미설치: N',
|
|
549
|
+
'legend.missing': '도구 줄 끝: 기록 폴더가 없어 숨긴 도구',
|
|
550
|
+
'legend.hiddenKey': '7일 미사용: N',
|
|
530
551
|
'legend.hidden': '도구 줄 끝: 7일 동안 안 쓴 도구를 숨김. 다시 보려면 설정 파일에 "hideIdleTools": false',
|
|
531
552
|
'legend.folded': '도구 줄 끝: 화면이 좁아 접은 도구 수 (넓히면 보인다)',
|
|
532
553
|
'legend.periodKey': '오늘 / 7일',
|
|
@@ -541,6 +562,7 @@ export const STRINGS = {
|
|
|
541
562
|
'hk.table.sort': '정렬: 기본 → 비용순 → 컨텍스트순 → 최근순. 응답 대기는 늘 맨 위',
|
|
542
563
|
'hk.table.group': '묶기: 없음 → 프로젝트 → 도구. 묶음 머리에 세션 수·비용',
|
|
543
564
|
'hk.table.costMode': '비용 기준: API 환산 ↔ 캐시 제외. 표·헤더·상세가 같이 바뀐다 (예산은 늘 API 환산)',
|
|
565
|
+
'hk.table.notify': '응답 대기 데스크톱 알림 켜기·끄기. 이번 실행에만, 설정 파일은 그대로',
|
|
544
566
|
'hk.table.pin': '고른 세션을 맨 위(응답 대기 아래)에 고정·해제. 여러 개는 고정한 순서, 이번 실행에만',
|
|
545
567
|
'hk.table.files': '고른 세션의 변경 파일 목록으로',
|
|
546
568
|
'hk.table.detail': '상세 패널 열기·닫기',
|
|
@@ -625,6 +647,7 @@ export const STRINGS = {
|
|
|
625
647
|
'detail.folder': '폴더',
|
|
626
648
|
'detail.branch': '브랜치',
|
|
627
649
|
'detail.model': '모델',
|
|
650
|
+
'detail.app': '앱',
|
|
628
651
|
'detail.kind': '종류',
|
|
629
652
|
'detail.started': '시작',
|
|
630
653
|
'detail.ago': '{at} ({ago} 전)',
|
|
@@ -670,6 +693,7 @@ export const STRINGS = {
|
|
|
670
693
|
'key.sort': 'sort',
|
|
671
694
|
'key.group': 'group',
|
|
672
695
|
'key.costMode': 'cost basis',
|
|
696
|
+
'key.notify': 'alerts',
|
|
673
697
|
'key.pin': 'pin',
|
|
674
698
|
'key.files': 'changed files',
|
|
675
699
|
'key.detail': 'detail',
|
|
@@ -695,6 +719,9 @@ export const STRINGS = {
|
|
|
695
719
|
'key.quit': 'quit',
|
|
696
720
|
|
|
697
721
|
'cli.unknown': 'unknown option {opts}',
|
|
722
|
+
'cli.didYouMean': '(did you mean {opt}?)',
|
|
723
|
+
'cli.themeValues': '(light or dark)',
|
|
724
|
+
'cli.seeHelp': 'all options: aitop --help',
|
|
698
725
|
'cli.themeMissing': '--theme needs a value (light or dark)',
|
|
699
726
|
'cli.unhandled': 'stopping on an unhandled error ({why})',
|
|
700
727
|
'cli.logOff': 'cannot open the debug log, turning it off ({path})',
|
|
@@ -808,6 +835,10 @@ export const STRINGS = {
|
|
|
808
835
|
'cfg.notify': 'true, false or a list of waiting, done, context',
|
|
809
836
|
'cfg.positive': 'a number above 0',
|
|
810
837
|
'cfg.paths': 'a list of 1 to 16 absolute paths (or ~/...)',
|
|
838
|
+
'cfg.agyApp': 'true, false, or a list of absolute paths (or ~/...)',
|
|
839
|
+
'cfg.cowork': 'true, false, or a list of absolute Claude app folder paths (or ~/...)',
|
|
840
|
+
'cfg.agyAppEnv': 'off or a list of absolute paths (or ~/...)',
|
|
841
|
+
'cfg.masked': 'ignoring {key} in the config file because {name} is set',
|
|
811
842
|
'cfg.file': 'Config file: {path} ({state})',
|
|
812
843
|
'cfg.exists': 'found',
|
|
813
844
|
'cfg.missing': 'not found',
|
|
@@ -825,6 +856,10 @@ export const STRINGS = {
|
|
|
825
856
|
'doctor.noFolder': 'no log folder',
|
|
826
857
|
'doctor.records': { one: '{n} log', other: '{n} logs' },
|
|
827
858
|
'doctor.dirMissing': 'folder not found',
|
|
859
|
+
'doctor.agyApp': 'Antigravity app',
|
|
860
|
+
'doctor.coworkApp': 'Claude app',
|
|
861
|
+
'doctor.coworkSessions': { one: '{n} session', other: '{n} sessions' },
|
|
862
|
+
'doctor.hint.coworkUnread': 'could not read the session list. An app update may have changed the format',
|
|
828
863
|
'doctor.candidate': { one: 'not read: {path} ({n} log)', other: 'not read: {path} ({n} logs)' },
|
|
829
864
|
'doctor.candidateHintClaude': 'to read it, add it to claudeDirs in the config file or AITOP_CLAUDE_DIRS (e.g. ["~/.claude", "~/.claude-work"])',
|
|
830
865
|
'doctor.candidateHintCodex': 'to read it, add it to codexHomes in the config file or AITOP_CODEX_HOMES (e.g. ["~/.codex", "~/.codex-alt"])',
|
|
@@ -849,7 +884,7 @@ export const STRINGS = {
|
|
|
849
884
|
'doctor.legacyConsoleHint': 'Windows Terminal is recommended. In this console, run with AITOP_AMBIGUOUS=wide (ASCII tables and bars) or NO_COLOR (progress bar as [#.])',
|
|
850
885
|
'doctor.config': '{mark} config {state}{path}',
|
|
851
886
|
'doctor.configExists': 'found',
|
|
852
|
-
'doctor.configMissing': 'not found',
|
|
887
|
+
'doctor.configMissing': 'not found (defaults)',
|
|
853
888
|
'doctor.debug': '{mark} debug {state}{path}{tail}',
|
|
854
889
|
'doctor.debugOn': 'on',
|
|
855
890
|
'doctor.debugOff': 'off',
|
|
@@ -910,7 +945,8 @@ export const STRINGS = {
|
|
|
910
945
|
'hdr.netShort': 'no cache',
|
|
911
946
|
|
|
912
947
|
'tools.missing': 'not installed',
|
|
913
|
-
'tools.
|
|
948
|
+
'tools.hiddenMissing': 'not installed: {list}',
|
|
949
|
+
'tools.hiddenIdle': 'unused 7d: {list}',
|
|
914
950
|
'tools.ended': 'with ended sessions (24h)',
|
|
915
951
|
'table.title': 'Sessions {n}',
|
|
916
952
|
'member.stalled': 'stalled?',
|
|
@@ -929,11 +965,12 @@ export const STRINGS = {
|
|
|
929
965
|
'groupBy.tool': 'tool',
|
|
930
966
|
'empty.none': 'No AI sessions running.',
|
|
931
967
|
'empty.none24': 'No AI sessions in the last 24 hours.',
|
|
968
|
+
'empty.procs': '{list} running, but no session records to read yet.',
|
|
969
|
+
'empty.procsHint': 'Send it a request to see it here. Check: aitop --doctor',
|
|
932
970
|
'empty.show': 'Show the last 24 hours: ',
|
|
933
971
|
'empty.or': ' or ',
|
|
934
972
|
|
|
935
973
|
'foot.help': 'help',
|
|
936
|
-
'foot.helpAll': 'all keys',
|
|
937
974
|
'foot.closeHelp': 'close help',
|
|
938
975
|
'foot.readOnly': '⊘ read-only',
|
|
939
976
|
'foot.count': '{n} found',
|
|
@@ -953,6 +990,11 @@ export const STRINGS = {
|
|
|
953
990
|
'foot.costMode': 'cost',
|
|
954
991
|
'foot.copied': 'resume command sent to clipboard (OSC 52)',
|
|
955
992
|
'foot.copyNone': 'no resume command for this session',
|
|
993
|
+
'foot.notify': 'alerts:{v}',
|
|
994
|
+
'foot.notifyHint': 'turn on waiting alerts: a',
|
|
995
|
+
'foot.notifyOn': 'waiting alerts on (this run only)',
|
|
996
|
+
'foot.notifyOff': 'waiting alerts off (this run only)',
|
|
997
|
+
'foot.notifyNone': 'no alert tool found. Check with aitop --doctor',
|
|
956
998
|
'foot.clearSearch': 'clear search',
|
|
957
999
|
|
|
958
1000
|
'help.title': 'Help · ? or Esc to close',
|
|
@@ -985,12 +1027,15 @@ export const STRINGS = {
|
|
|
985
1027
|
'legend.stalled': 'No log change 3 min (slow tools 10). A guess',
|
|
986
1028
|
'legend.sdk': 'Member row: claude -p run of this session',
|
|
987
1029
|
'legend.auto': 'claude -p run with no parent. No wait alerts',
|
|
1030
|
+
'legend.cowork': 'TOOL column: Claude Desktop agent mode session',
|
|
988
1031
|
'legend.status': 'Current step (Reading log N% on first load)',
|
|
989
1032
|
'legend.tokens': 'Tokens incl. subagents and cache reads',
|
|
990
1033
|
'legend.cost': 'API cost (Codex estimated). Unpriced models not counted',
|
|
991
1034
|
'legend.context': 'Context used by the last request',
|
|
992
1035
|
'legend.idleCol': 'Time since last activity. now while working',
|
|
993
|
-
'legend.
|
|
1036
|
+
'legend.missingKey': 'not installed: N',
|
|
1037
|
+
'legend.missing': 'Tools hidden because their log folder is missing',
|
|
1038
|
+
'legend.hiddenKey': 'unused 7d: N',
|
|
994
1039
|
'legend.hidden': 'Tools unused for 7 days (hideIdleTools)',
|
|
995
1040
|
'legend.folded': 'Tools folded on a narrow screen',
|
|
996
1041
|
'legend.periodKey': 'today / 7d',
|
|
@@ -1004,6 +1049,7 @@ export const STRINGS = {
|
|
|
1004
1049
|
'hk.table.sort': 'Sort: cost, context, recent. Waiting on top',
|
|
1005
1050
|
'hk.table.group': 'Group by project or tool, with cost',
|
|
1006
1051
|
'hk.table.costMode': 'Cost basis: API cost or no cache',
|
|
1052
|
+
'hk.table.notify': 'Turn waiting alerts on or off (this run only)',
|
|
1007
1053
|
'hk.table.pin': 'Pin on top, below waiting (this run only)',
|
|
1008
1054
|
'hk.table.files': 'Changed files of the session',
|
|
1009
1055
|
'hk.table.detail': 'Show or hide the detail panel',
|
|
@@ -1086,6 +1132,7 @@ export const STRINGS = {
|
|
|
1086
1132
|
'detail.folder': 'Folder',
|
|
1087
1133
|
'detail.branch': 'Branch',
|
|
1088
1134
|
'detail.model': 'Model',
|
|
1135
|
+
'detail.app': 'app',
|
|
1089
1136
|
'detail.kind': 'Kind',
|
|
1090
1137
|
'detail.started': 'Started',
|
|
1091
1138
|
'detail.ago': '{at} ({ago} ago)',
|
package/src/json.mjs
CHANGED
|
@@ -40,9 +40,11 @@ export function toJson(data, version = null, opts = {}) {
|
|
|
40
40
|
branch: s.branch ?? null,
|
|
41
41
|
model: s.model ?? null,
|
|
42
42
|
kind: s.kind ?? null,
|
|
43
|
-
// 실행 방식 (Claude 기록의 entrypoint: 'cli', 'sdk-cli' 등, 모르면 null). auto 는 부모 세션을 못 찾은 claude -p 실행 (#286).
|
|
43
|
+
// 실행 방식 (Claude 기록의 entrypoint: 'cli', 'sdk-cli', Cowork 는 'local-agent' 등, 모르면 null). auto 는 부모 세션을 못 찾은 claude -p 실행 (#286).
|
|
44
44
|
// 부모를 찾은 claude -p 실행은 여기 없고 부모의 members 에 entrypoint·parentId 와 함께 들어간다 (합계도 부모에 더해져 있다).
|
|
45
45
|
entrypoint: s.entrypoint ?? null,
|
|
46
|
+
// 기록이 온 곳. Antigravity(tool 'gemini' 이고 기록이 있는 세션)만 'cli'(agy CLI) 또는 'app'(데스크톱 앱), 나머지는 null (#303).
|
|
47
|
+
source: s.source ?? null,
|
|
46
48
|
auto: Boolean(s.auto),
|
|
47
49
|
pid: s.pid ?? null,
|
|
48
50
|
live: Boolean(s.live),
|
package/src/keys.mjs
CHANGED
|
@@ -144,6 +144,8 @@ export function onKey(view, key, act) {
|
|
|
144
144
|
}
|
|
145
145
|
// y: 고른 세션을 이어 여는 명령을 복사한다 (bin 이 OSC 52 로 쓴다). 세션에는 아무것도 보내지 않는다.
|
|
146
146
|
else if (key === 'y') act.copy?.(selectedSession(view));
|
|
147
|
+
// a: 응답 대기 데스크톱 알림을 켜고 끈다 (#294). 이번 실행에만, 설정 파일은 바꾸지 않는다. 실제 켜기·끄기는 bin 이 한다.
|
|
148
|
+
else if (key === 'a') act.toggleNotify?.();
|
|
147
149
|
else if (key === 'c') view.costMode = view.costMode === 'net' ? 'api' : 'net';
|
|
148
150
|
else if (key === 'd') {
|
|
149
151
|
// view.rows: 마지막으로 그린 화면 높이. 'auto' 일 때 지금 보이는 상태를 뒤집는 데 쓴다.
|
package/src/line.mjs
CHANGED
|
@@ -14,6 +14,8 @@ export const CAP_MS = 1500;
|
|
|
14
14
|
export const STOP_MIN_MS = 300;
|
|
15
15
|
// 캐시가 없거나 시간 상한을 넘었을 때 내는 글.
|
|
16
16
|
export const PENDING = '...';
|
|
17
|
+
// 오늘 비용·대기·작업 중 등 보일 항목이 하나도 없을 때 내는 글.
|
|
18
|
+
export const IDLE = 'aitop idle';
|
|
17
19
|
// 기다리는 세션 이름의 최대 폭 (칸). 기본 폭 40 에 오늘 비용·예산·대기(이름과 시간)·작업 중이 함께 들어가는 길이.
|
|
18
20
|
export const NAME_WIDTH = 12;
|
|
19
21
|
// 이름을 자른 자리 표시. … 는 ASCII 가 아니다.
|
|
@@ -22,7 +24,8 @@ const CUT = '~';
|
|
|
22
24
|
// tmux 256색 번호. 응답 대기는 눈에 띄는 주황, 돈은 화면 헤더와 같은 연두. 색약용은 노랑·파랑 계열로 가른다.
|
|
23
25
|
// 작업 중은 눈에 덜 띄는 회색 계열로 둔다 (주목할 것은 대기다).
|
|
24
26
|
// 멈춤(오류로 멈춘 세션)은 화면의 경고색과 같은 빨강, 색약용은 주홍. 색이 없어도 'stop' 글자로 갈린다.
|
|
25
|
-
|
|
27
|
+
// 쉬는 중(aitop idle)은 작업 중보다 더 흐린 회색.
|
|
28
|
+
const COLOURS = { normal: { waiting: 'colour214', stopped: 'colour203', money: 'colour154', running: 'colour250', idle: 'colour242' }, colorBlind: { waiting: 'colour226', stopped: 'colour209', money: 'colour75', running: 'colour250', idle: 'colour242' } };
|
|
26
29
|
|
|
27
30
|
// --line, --line=plain|tmux, --line-width <N>, --line-width=<N> 를 꺼낸다. line 은 켜지 않았으면 null.
|
|
28
31
|
export function lineOption(argv) {
|
|
@@ -98,6 +101,8 @@ export function formatLine({ today = 0, budgetDay = null, waiting = 0, longest =
|
|
|
98
101
|
if (stopped > 0) parts.push({ texts: [`stop ${stopped}`], fg: c.stopped });
|
|
99
102
|
if (running > 0) parts.push({ texts: [`run ${running}`], fg: c.running });
|
|
100
103
|
if (!zero(perHour)) parts.push({ texts: [`${rate(perHour)}/h`], fg: c.money });
|
|
104
|
+
// 보일 항목이 하나도 없으면 빈 줄 대신 IDLE 을 낸다 (고장과 구분되게). 폭이 모자라면 짧은 글, 그래도 모자라면 - (#292).
|
|
105
|
+
if (!parts.length) parts.push({ texts: [IDLE, 'idle', '-'], fg: c.idle });
|
|
101
106
|
while (parts.length && width(parts.map((p) => p.texts[0]).join(' ')) > max) {
|
|
102
107
|
if (parts.at(-1).texts.length > 1) parts.at(-1).texts.shift();
|
|
103
108
|
else parts.pop();
|
package/src/notify.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { accessSync, constants, existsSync, readFileSync } from 'node:fs';
|
|
|
5
5
|
import { join, delimiter, posix, win32 } from 'node:path';
|
|
6
6
|
import { mask, stripControl } from './text.mjs';
|
|
7
7
|
import { getLang, phaseText, t } from './i18n.mjs';
|
|
8
|
+
import { callsYou } from './attention.mjs';
|
|
8
9
|
|
|
9
10
|
export const HOOK_TIMEOUT_MS = 10_000;
|
|
10
11
|
const LABEL_MAX = 120;
|
|
@@ -388,20 +389,36 @@ export function createRunner({ timeoutMs = HOOK_TIMEOUT_MS, spawnFn = spawn, pla
|
|
|
388
389
|
|
|
389
390
|
// --notify, --on-waiting 을 묶은 알리미. 알릴 세션 목록과 종류(waiting·done·context)를 받는다.
|
|
390
391
|
// --on-waiting 명령에는 AITOP_EVENT 로 종류를 넘긴다 (예전 명령은 waiting 만 받으므로 그대로 동작한다).
|
|
391
|
-
|
|
392
|
+
// setNotify(on): 실행 중 a 키로 데스크톱 알림을 켜고 끈다 (#294). 처음 켤 때 알림 도구를 찾고(find), 없으면 false 를 돌려준다.
|
|
393
|
+
export function createNotifier({ notify = false, onWaiting = null, platform = process.platform, find = findNotifier, notifier = notify ? find({ platform }) : null, env = process.env, timeoutMs = HOOK_TIMEOUT_MS, spawnFn = spawn, spawnSyncFn = spawnSync } = {}) {
|
|
392
394
|
const hook = onWaiting ? createRunner({ timeoutMs, spawnFn, platform, spawnSyncFn }) : null;
|
|
393
|
-
|
|
395
|
+
let desk = notify && notifier ? createRunner({ timeoutMs, spawnFn, platform, spawnSyncFn }) : null;
|
|
396
|
+
let deskOn = notify;
|
|
397
|
+
let searched = notify;
|
|
394
398
|
const [shell, shellArgs, shellOpts] = onWaiting ? hookCommand(onWaiting, { platform, env }) : [];
|
|
395
399
|
return {
|
|
396
400
|
hook,
|
|
397
|
-
desk
|
|
401
|
+
get desk() {
|
|
402
|
+
return desk;
|
|
403
|
+
},
|
|
404
|
+
setNotify(on) {
|
|
405
|
+
deskOn = Boolean(on);
|
|
406
|
+
if (deskOn && !desk && !searched) {
|
|
407
|
+
searched = true;
|
|
408
|
+
notifier = find({ platform });
|
|
409
|
+
if (notifier) desk = createRunner({ timeoutMs, spawnFn, platform, spawnSyncFn });
|
|
410
|
+
}
|
|
411
|
+
// 끌 때는 대기열만 비운다. 이미 뜬 알림 도구는 HOOK_TIMEOUT_MS 안에 끝난다.
|
|
412
|
+
if (!deskOn) desk?.killAll();
|
|
413
|
+
return Boolean(deskOn && desk);
|
|
414
|
+
},
|
|
398
415
|
killAll() {
|
|
399
416
|
hook?.killAll();
|
|
400
417
|
desk?.killAll();
|
|
401
418
|
},
|
|
402
419
|
fire(fresh, kind = 'waiting') {
|
|
403
420
|
if (!fresh.length) return;
|
|
404
|
-
if (desk) {
|
|
421
|
+
if (desk && deskOn) {
|
|
405
422
|
const { title, body } = notifyText(fresh, getLang(), kind);
|
|
406
423
|
const [file, args] = notifierCommand(notifier, title, body);
|
|
407
424
|
desk.run({ file, args, env });
|
|
@@ -410,3 +427,44 @@ export function createNotifier({ notify = false, onWaiting = null, platform = pr
|
|
|
410
427
|
},
|
|
411
428
|
};
|
|
412
429
|
}
|
|
430
|
+
|
|
431
|
+
// 실행 중 알림 켜기·끄기 상태 (#294). 이번 실행에만 쓰고 설정 파일은 바꾸지 않는다.
|
|
432
|
+
// explicitOff: 설정 파일이나 --no-notify 로 직접 끈 경우. 그때는 켜기 힌트를 띄우지 않는다.
|
|
433
|
+
// hinted: 힌트를 이미 띄웠거나 사용자가 a 를 눌러 본 적이 있는지 (실행당 한 번).
|
|
434
|
+
// available: 알림 도구를 찾았는지. --notify 로 켰어도 도구가 없으면 꺼짐으로 보인다 (설정은 건드리지 않는다).
|
|
435
|
+
// 이때는 사용자가 직접 켠 것이라 켜기 힌트도 띄우지 않는다.
|
|
436
|
+
export function createNotifyToggle({ on = false, explicitOff = false, available = true } = {}) {
|
|
437
|
+
const missing = Boolean(on) && !available;
|
|
438
|
+
return { on: Boolean(on) && !missing, explicitOff: Boolean(explicitOff), hinted: missing };
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// 설정 값(resolveConfig 의 values.notify)으로 직접 껐는지 본다. 기본값(source: 'default')으로 꺼진 것만 직접 끄지 않은 것이다.
|
|
442
|
+
export const notifyExplicitOff = (entry, on) => !on && entry != null && entry.source !== 'default';
|
|
443
|
+
|
|
444
|
+
export function toggleNotify(state) {
|
|
445
|
+
state.on = !state.on;
|
|
446
|
+
state.hinted = true;
|
|
447
|
+
return state.on;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// a 키: 상태를 뒤집고 알리미(setNotify)에 반영한다. 켜려 했는데 알림 도구가 없으면 꺼짐으로 되돌린다.
|
|
451
|
+
// 돌려주는 값은 키 줄에 잠깐 보일 문구의 i18n 키.
|
|
452
|
+
export function applyNotifyToggle(state, notifier) {
|
|
453
|
+
const want = toggleNotify(state);
|
|
454
|
+
const ok = notifier.setNotify(want);
|
|
455
|
+
if (want && !ok) {
|
|
456
|
+
state.on = false;
|
|
457
|
+
notifier.setNotify(false);
|
|
458
|
+
return 'foot.notifyNone';
|
|
459
|
+
}
|
|
460
|
+
return want ? 'foot.notifyOn' : 'foot.notifyOff';
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// 알림이 꺼져 있고 직접 끄지 않았을 때, 실행 중인 응답 대기 세션이 처음 보이면 한 번만 true (시작 때 이미 대기 중인 세션 포함).
|
|
464
|
+
// visible: 키 줄에 힌트를 그릴 수 있는지 (도움말·검색 중에는 키 줄이 힌트를 그리지 않는다). false 면 소비하지 않고 다음 갱신에 다시 본다.
|
|
465
|
+
export function notifyHintDue(state, sessions = [], { visible = true } = {}) {
|
|
466
|
+
if (state.on || state.explicitOff || state.hinted || !visible) return false;
|
|
467
|
+
if (!sessions.some((s) => s.live && callsYou(s))) return false;
|
|
468
|
+
state.hinted = true;
|
|
469
|
+
return true;
|
|
470
|
+
}
|
package/src/resume.mjs
CHANGED
|
@@ -36,7 +36,8 @@ function resumeArgs(s) {
|
|
|
36
36
|
const u = codexId(id);
|
|
37
37
|
return u ? ['codex', 'resume', u] : null;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
// Antigravity 데스크톱 앱의 대화(source 'app')는 agy CLI 로 이어 열 수 없어 만들지 않는다 (#303).
|
|
40
|
+
if (s.tool === 'gemini') return isUuid(id) && s.source !== 'app' ? ['agy', '--conversation', id] : null;
|
|
40
41
|
return null;
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// 세션 화면과 상관없이 끝난 대화까지 세야 해서 토큰만 가볍게 따로 읽고(진행 기록은 읽지 않는다), 어디까지 읽었는지는 캐시에 둔다.
|
|
4
4
|
// 기록은 늘 immutable 로 열어 agy 폴더에 아무것도 만들거나 고치지 않는다.
|
|
5
5
|
import { readdirSync, statSync, existsSync } from 'node:fs';
|
|
6
|
-
import { join } from 'node:path';
|
|
7
|
-
import {
|
|
6
|
+
import { dirname, join } from 'node:path';
|
|
7
|
+
import { agyRoots, readCalls, sigOf, maxIdx, APP_TTL_MS } from './antigravity.mjs';
|
|
8
8
|
import { openReadOnly, loadSqlite } from '../sqlite.mjs';
|
|
9
9
|
import { loadCache, markDirty } from '../cache.mjs';
|
|
10
10
|
import { dayKey, addSlot, addModel, recentDays } from './common.mjs';
|
|
@@ -73,6 +73,8 @@ export class AgyBook {
|
|
|
73
73
|
|
|
74
74
|
update(budget) {
|
|
75
75
|
const sig = sigOf(this.path);
|
|
76
|
+
// 이번에 본 서명. 끝까지 읽었는지(sig) 또는 실패로 멈춰 둔 것인지(failSig) 판단에 쓴다 (앱 폴더 TTL, #303).
|
|
77
|
+
this.seenSig = sig;
|
|
76
78
|
if (sig === null || sig === this.sig || sig === this.failSig) return;
|
|
77
79
|
if (outOf(budget)) {
|
|
78
80
|
budget.exhausted = true;
|
|
@@ -147,25 +149,35 @@ export class AgyBook {
|
|
|
147
149
|
}
|
|
148
150
|
|
|
149
151
|
let listed = { at: 0, files: [], days: 0 };
|
|
152
|
+
// 앱 폴더의 conversations/ 경로들 (#303). 이 아래 기록은 APP_TTL_MS 마다 한 번만 서명을 본다.
|
|
153
|
+
let apps = new Set();
|
|
154
|
+
const inApp = (p) => apps.has(dirname(p));
|
|
150
155
|
|
|
151
|
-
// 최근 days 일(평소 7일, 리포트는 더 길게) 안에 바뀐 대화 기록.
|
|
152
|
-
|
|
156
|
+
// 최근 days 일(평소 7일, 리포트는 더 길게) 안에 바뀐 대화 기록. CLI 폴더와 앱 폴더를 모두 본다 (#303).
|
|
157
|
+
// 장부·캐시는 파일 경로로 나뉘어 폴더끼리 섞이지 않는다. 같은 대화 id 가 두 폴더에 있으면 앞 폴더 것만 센다.
|
|
158
|
+
function recentFiles(days = DAYS, roots = agyRoots()) {
|
|
153
159
|
if (listed.days === days && Date.now() - listed.at < LIST_TTL_MS) return listed.files;
|
|
154
|
-
|
|
160
|
+
apps = new Set(roots.filter((r) => r.source === 'app').map((r) => join(r.dir, 'conversations')));
|
|
155
161
|
const cutoff = Date.now() - days * 86400_000;
|
|
156
162
|
const files = [];
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
for (const f of names) {
|
|
164
|
-
if (!f.endsWith('.db')) continue;
|
|
165
|
-
const p = join(dir, f);
|
|
163
|
+
const seen = new Set();
|
|
164
|
+
for (const r of roots) {
|
|
165
|
+
const dir = join(r.dir, 'conversations');
|
|
166
|
+
if (!existsSync(dir)) continue;
|
|
167
|
+
let names = [];
|
|
166
168
|
try {
|
|
167
|
-
|
|
168
|
-
} catch {
|
|
169
|
+
names = readdirSync(dir);
|
|
170
|
+
} catch (e) {
|
|
171
|
+
debugIo('ledger', 'agy conversations read failed', e);
|
|
172
|
+
}
|
|
173
|
+
for (const f of names) {
|
|
174
|
+
if (!f.endsWith('.db') || seen.has(f)) continue;
|
|
175
|
+
seen.add(f);
|
|
176
|
+
const p = join(dir, f);
|
|
177
|
+
try {
|
|
178
|
+
if (statSync(p).mtimeMs >= cutoff) files.push(p);
|
|
179
|
+
} catch {}
|
|
180
|
+
}
|
|
169
181
|
}
|
|
170
182
|
listed = { at: Date.now(), files, days };
|
|
171
183
|
return files;
|
|
@@ -178,15 +190,23 @@ const books = new Map();
|
|
|
178
190
|
// node:sqlite 를 못 쓰는 Node 에서는 비어 있다 (agy 는 프로세스만 보인다).
|
|
179
191
|
export function collectAgyLedger({ budget, days = DAYS } = {}) {
|
|
180
192
|
const out = { days: [], slots: [], paths: [], stale: [], pending: 0, size: 0 };
|
|
181
|
-
if (!loadSqlite() || !existsSync(join(
|
|
193
|
+
if (!loadSqlite() || !agyRoots().some((r) => existsSync(join(r.dir, 'conversations')))) return out;
|
|
182
194
|
const files = recentFiles(days);
|
|
183
195
|
const keep = new Set(files);
|
|
184
196
|
for (const p of books.keys()) if (!keep.has(p)) books.delete(p);
|
|
185
197
|
for (const p of files) {
|
|
186
198
|
let b = books.get(p);
|
|
187
199
|
if (!b) books.set(p, (b = new AgyBook(p)));
|
|
188
|
-
|
|
189
|
-
|
|
200
|
+
// 앱 폴더(/mnt/c 일 수 있음)의 기록은 지금 서명까지 다 읽었거나(sig), 실패로 멈춰 둔 서명(failSig)이면
|
|
201
|
+
// TTL 안에서는 다시 stat·열기를 하지 않고 지난 값을 쓴다. 읽기 한도에 걸려 덜 읽었으면 다음 갱신에 바로 이어 읽는다.
|
|
202
|
+
const app = inApp(p);
|
|
203
|
+
const fresh = app && b.checkedAt != null && Date.now() - b.checkedAt < APP_TTL_MS;
|
|
204
|
+
if (!fresh) {
|
|
205
|
+
b.update(budget);
|
|
206
|
+
if (app) b.checkedAt = b.seenSig != null && (b.seenSig === b.sig || b.seenSig === b.failSig) ? Date.now() : null;
|
|
207
|
+
}
|
|
208
|
+
const size = fresh ? b.lastSize : b.size;
|
|
209
|
+
b.lastSize = size;
|
|
190
210
|
out.size += size;
|
|
191
211
|
if (!b.complete) out.pending += size;
|
|
192
212
|
// 실패한 기록은 빠졌을 수 있는 첫날, 아니면 null.
|
|
@@ -200,4 +220,12 @@ export function collectAgyLedger({ budget, days = DAYS } = {}) {
|
|
|
200
220
|
|
|
201
221
|
// 테스트용: 기록을 연 횟수.
|
|
202
222
|
let opens = 0;
|
|
203
|
-
export const _test = {
|
|
223
|
+
export const _test = {
|
|
224
|
+
reset: () => ((listed = { at: 0, files: [], days: 0 }), books.clear()),
|
|
225
|
+
opens: () => opens,
|
|
226
|
+
// 앱 폴더 기록의 TTL 이 지난 것을 흉내 낸다.
|
|
227
|
+
age: (ms) => {
|
|
228
|
+
listed.at -= ms;
|
|
229
|
+
for (const b of books.values()) if (b.checkedAt != null) b.checkedAt -= ms;
|
|
230
|
+
},
|
|
231
|
+
};
|