@sejuneoh/aitop 0.29.0 → 0.31.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 +19 -1
- package/bin/aitop.mjs +48 -1
- package/package.json +1 -1
- package/src/config.mjs +14 -5
- package/src/doctor.mjs +52 -19
- package/src/help.mjs +2 -1
- package/src/i18n.mjs +98 -6
- package/src/json.mjs +3 -0
- package/src/keys.mjs +2 -0
- package/src/notify.mjs +5 -2
- package/src/report.mjs +64 -6
- package/src/resume.mjs +57 -0
- package/src/sessions-report.mjs +377 -0
- package/src/sources/agy-ledger.mjs +8 -0
- package/src/sources/claude-ledger.mjs +55 -45
- package/src/sources/claude-tracker.mjs +45 -2
- package/src/sources/claude.mjs +138 -64
- package/src/sources/codex-ledger.mjs +6 -2
- package/src/sources/codex.mjs +89 -20
- package/src/sources/common.mjs +10 -0
- package/src/sources/dirs.mjs +140 -0
- package/src/sources/projects.mjs +23 -12
- package/src/sources/sheets.mjs +170 -0
- package/src/ui/chrome.mjs +14 -2
- package/src/ui/detail.mjs +36 -1
package/src/sources/codex.mjs
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// Codex CLI: 실행 중인 codex 프로세스의 작업 폴더와 ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl 을 짝지어 읽는다.
|
|
2
|
+
// Codex 홈이 여럿이면(dirs.mjs) 모두 보고, 같은 rollout 파일 이름은 하나로 센다.
|
|
2
3
|
import { readdirSync, statSync, existsSync, realpathSync, openSync, readSync, closeSync } from 'node:fs';
|
|
3
4
|
import { join, basename } from 'node:path';
|
|
4
|
-
import { homedir } from 'node:os';
|
|
5
5
|
import { JsonlTail } from '../tail.mjs';
|
|
6
6
|
import { loadCache, markDirty } from '../cache.mjs';
|
|
7
7
|
import { canListProcesses, findProcesses, isCodex, openFiles, processStart } from '../procs.mjs';
|
|
8
|
-
import { addActivity, emptyTokens, parseTs, pushEvent, describeTool, isNoisePrompt } from './common.mjs';
|
|
8
|
+
import { addActivity, emptyTokens, parseTs, pushEvent, describeTool, isNoisePrompt, sessionName } from './common.mjs';
|
|
9
9
|
import { addChange, mergeFiles } from './files.mjs';
|
|
10
10
|
import { codexCost } from '../pricing.mjs';
|
|
11
11
|
import { parsePatch, extractPatch, patchSucceeded } from './patch.mjs';
|
|
12
12
|
import { debug, debugIo } from '../log.mjs';
|
|
13
13
|
import { lastName } from '../paths.mjs';
|
|
14
|
+
import { codexHomes, codexSessionRoots, dedupeBy, homeOf } from './dirs.mjs';
|
|
14
15
|
|
|
15
16
|
// 지시 탭에 쓰는 지시 목록은 최근 것만 남긴다.
|
|
16
17
|
const MAX_TURNS = 50;
|
|
17
18
|
|
|
18
|
-
const ROOT = join(process.env.CODEX_HOME ?? join(homedir(), '.codex'), 'sessions');
|
|
19
19
|
const RECENT_MS = 24 * 3600 * 1000;
|
|
20
20
|
// 프로세스 목록을 못 얻는 OS(지금은 Windows)에서는 이 시간 안에 바뀐 기록을 실행 중으로 본다.
|
|
21
21
|
// codex 는 답할 때마다 기록에 쓰므로, 답을 읽고 다음 지시를 쓰는 동안(대개 몇 분)은 남고 닫은 세션은 곧 빠진다.
|
|
@@ -27,10 +27,14 @@ const states = new Map();
|
|
|
27
27
|
export function dayDirs(days = 7) {
|
|
28
28
|
const dirs = [];
|
|
29
29
|
// 며칠 동안 켜 둔 세션도 시작한 날짜 폴더에 기록하므로 일주일치 폴더를 본다.
|
|
30
|
+
const roots = codexSessionRoots();
|
|
30
31
|
for (let back = 0; back < days; back++) {
|
|
31
32
|
const d = new Date(Date.now() - back * 86400_000);
|
|
32
|
-
const
|
|
33
|
-
|
|
33
|
+
const ymd = [String(d.getFullYear()), String(d.getMonth() + 1).padStart(2, '0'), String(d.getDate()).padStart(2, '0')];
|
|
34
|
+
for (const root of roots) {
|
|
35
|
+
const p = join(root, ...ymd);
|
|
36
|
+
if (existsSync(p)) dirs.push(p);
|
|
37
|
+
}
|
|
34
38
|
}
|
|
35
39
|
return dirs;
|
|
36
40
|
}
|
|
@@ -45,7 +49,7 @@ export function allDayDirs() {
|
|
|
45
49
|
return [];
|
|
46
50
|
}
|
|
47
51
|
};
|
|
48
|
-
for (const y of sub(
|
|
52
|
+
for (const root of codexSessionRoots()) for (const y of sub(root)) for (const m of sub(y)) dirs.push(...sub(m));
|
|
49
53
|
return dirs;
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -56,7 +60,13 @@ let listed = { at: 0, paths: [] };
|
|
|
56
60
|
function recentFiles() {
|
|
57
61
|
if (Date.now() - listed.at >= LIST_TTL_MS) {
|
|
58
62
|
const paths = [];
|
|
59
|
-
for (const dir of dayDirs())
|
|
63
|
+
for (const dir of dayDirs()) {
|
|
64
|
+
try {
|
|
65
|
+
for (const n of readdirSync(dir)) if (n.endsWith('.jsonl')) paths.push(join(dir, n));
|
|
66
|
+
} catch (e) {
|
|
67
|
+
debugIo('codex', 'day folder read failed', e, dir);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
60
70
|
listed = { at: Date.now(), paths };
|
|
61
71
|
}
|
|
62
72
|
const out = [];
|
|
@@ -67,9 +77,10 @@ function recentFiles() {
|
|
|
67
77
|
} catch {
|
|
68
78
|
continue;
|
|
69
79
|
}
|
|
70
|
-
if (Date.now() - m < RECENT_MS) out.push({ path: p, mtime: m });
|
|
80
|
+
if (Date.now() - m < RECENT_MS) out.push({ key: basename(p), path: p, mtime: m });
|
|
71
81
|
}
|
|
72
|
-
|
|
82
|
+
// 같은 rollout 이 두 홈에 있으면 더 최근 쪽 하나만.
|
|
83
|
+
return dedupeBy(out).sort((a, b) => b.mtime - a.mtime);
|
|
73
84
|
}
|
|
74
85
|
|
|
75
86
|
// 하루 넘게 쉰 세션은 최근 파일 목록에 없다. 짝을 못 찾은 codex 프로세스에만 같은 작업 폴더에서 가장 최근에
|
|
@@ -102,17 +113,22 @@ function headCwd(path) {
|
|
|
102
113
|
return cwd;
|
|
103
114
|
}
|
|
104
115
|
|
|
105
|
-
|
|
116
|
+
// 홈마다 sessions 경로와 그 실제 경로(realpath). 처음 쓸 때 한 번 만든다.
|
|
117
|
+
let prefixes = null;
|
|
106
118
|
|
|
107
119
|
function isRollout(p) {
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
120
|
+
if (prefixes === null) {
|
|
121
|
+
prefixes = [];
|
|
122
|
+
for (const root of codexSessionRoots()) {
|
|
123
|
+
prefixes.push(root + '/');
|
|
124
|
+
try {
|
|
125
|
+
prefixes.push(realpathSync(root) + '/');
|
|
126
|
+
} catch (e) {
|
|
127
|
+
debugIo('codex', 'sessions realpath failed', e, root);
|
|
128
|
+
}
|
|
113
129
|
}
|
|
114
130
|
}
|
|
115
|
-
return
|
|
131
|
+
return prefixes.some((x) => p.startsWith(x)) && /\/rollout-[^/]*\.jsonl$/.test(p);
|
|
116
132
|
}
|
|
117
133
|
|
|
118
134
|
// 날짜 폴더에 파일이 생기면 그 폴더의 수정 시각이 바뀐다.
|
|
@@ -170,10 +186,46 @@ function searchByCwd(pid, cwd, taken, startOf) {
|
|
|
170
186
|
return path;
|
|
171
187
|
}
|
|
172
188
|
|
|
173
|
-
|
|
189
|
+
// Codex 홈마다 session_index.jsonl(한 줄에 { id, thread_name, updated_at })을 따라 읽어 id → 이름.
|
|
190
|
+
// 이름을 바꿀 때마다 뒤에 붙으므로 같은 id 는 마지막 줄이 이긴다. 새로 붙은 줄만 읽는다.
|
|
191
|
+
// indexes: 홈 → { tail, names }. 홈끼리 이름을 섞지 않는다.
|
|
192
|
+
const indexes = new Map();
|
|
193
|
+
|
|
194
|
+
function readIndex(budget) {
|
|
195
|
+
for (const home of codexHomes()) {
|
|
196
|
+
let ix = indexes.get(home);
|
|
197
|
+
if (!ix) {
|
|
198
|
+
const names = new Map();
|
|
199
|
+
ix = { tail: new JsonlTail(join(home, 'session_index.jsonl')), names };
|
|
200
|
+
ix.tail.onReset = () => names.clear();
|
|
201
|
+
indexes.set(home, ix);
|
|
202
|
+
}
|
|
203
|
+
ix.tail.read((x) => {
|
|
204
|
+
if (typeof x?.id !== 'string') return;
|
|
205
|
+
const name = sessionName(x.thread_name);
|
|
206
|
+
if (name) ix.names.set(x.id, name);
|
|
207
|
+
else ix.names.delete(x.id);
|
|
208
|
+
}, budget);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// rollout 이 든 홈의 이름을 먼저, 없으면 다른 홈의 이름 (같은 세션을 다른 홈으로 옮긴 경우).
|
|
213
|
+
function indexName(path, id) {
|
|
214
|
+
const homes = codexHomes();
|
|
215
|
+
const own = homeOf(path, homes);
|
|
216
|
+
const first = own ? indexes.get(own)?.names.get(id) : undefined;
|
|
217
|
+
if (first) return first;
|
|
218
|
+
for (const h of homes) {
|
|
219
|
+
const n = indexes.get(h)?.names.get(id);
|
|
220
|
+
if (n) return n;
|
|
221
|
+
}
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const SAVED = ['id', 'threadName', 'cwd', 'branch', 'model', 'busy', 'tokens', 'context', 'window', 'events', 'lastTool', 'startedAt', 'lastKind', 'files', 'turns', 'turnCount', 'activity'];
|
|
174
226
|
|
|
175
227
|
function newState(path) {
|
|
176
|
-
const st = { tail: new JsonlTail(path), id: basename(path), cwd: null, branch: null, model: null, busy: false, tokens: emptyTokens(), context: 0, window: 0, events: [], lastTool: null, startedAt: null, pending: new Map(), lastKind: null, files: [], turns: [], turnCount: 0, patches: {}, activity: {} };
|
|
228
|
+
const st = { tail: new JsonlTail(path), id: basename(path), threadName: null, cwd: null, branch: null, model: null, busy: false, tokens: emptyTokens(), context: 0, window: 0, events: [], lastTool: null, startedAt: null, pending: new Map(), lastKind: null, files: [], turns: [], turnCount: 0, patches: {}, activity: {} };
|
|
177
229
|
const c = loadCache(path);
|
|
178
230
|
if (c) {
|
|
179
231
|
st.tail.offset = c.offset;
|
|
@@ -241,6 +293,10 @@ function applyLine(st, x) {
|
|
|
241
293
|
}
|
|
242
294
|
st.lastKind = 'prompt';
|
|
243
295
|
break;
|
|
296
|
+
// 이름 바꾸기 이벤트 (Codex /rename 등). 빈 이름이면 지운다.
|
|
297
|
+
case 'thread_name_updated':
|
|
298
|
+
st.threadName = sessionName(p.thread_name);
|
|
299
|
+
break;
|
|
244
300
|
case 'agent_message':
|
|
245
301
|
pushEvent(st, x.timestamp, 'reply', p.message);
|
|
246
302
|
st.lastKind = 'reply';
|
|
@@ -283,7 +339,14 @@ function applyLine(st, x) {
|
|
|
283
339
|
}
|
|
284
340
|
}
|
|
285
341
|
|
|
286
|
-
|
|
342
|
+
// 세션 리포트용: rollout(path)·세션 id 의 session_index.jsonl 이름 (없으면 null). 색인은 새로 붙은 줄만 읽는다.
|
|
343
|
+
export function codexIndexName(path, id) {
|
|
344
|
+
if (!id) return null;
|
|
345
|
+
readIndex(undefined);
|
|
346
|
+
return indexName(path, id);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export const _test = { newState, applyLine, phaseOf, snapshot, readIndex, indexName };
|
|
287
350
|
|
|
288
351
|
export function collectCodex({ showEnded, budget, filesOf = openFiles, startOf = processStart, canList = canListProcesses }) {
|
|
289
352
|
// 프로세스를 못 세면 숨기지 않고 최근에 바뀐 기록으로 판정한다 (pid 는 null).
|
|
@@ -299,6 +362,7 @@ export function collectCodex({ showEnded, budget, filesOf = openFiles, startOf =
|
|
|
299
362
|
if (st.tail.read((x) => applyLine(st, x), budget)) markDirty(path, () => snapshot(st));
|
|
300
363
|
};
|
|
301
364
|
for (const f of files) read(f.path);
|
|
365
|
+
readIndex(budget);
|
|
302
366
|
|
|
303
367
|
const liveByPath = new Map();
|
|
304
368
|
const claim = (path, pid) => {
|
|
@@ -358,12 +422,17 @@ export function collectCodex({ showEnded, budget, filesOf = openFiles, startOf =
|
|
|
358
422
|
// 가격표에 없는 모델은 비용을 ? 로 보인다.
|
|
359
423
|
const cost = codexCost(st.model, st.tokens);
|
|
360
424
|
const used = st.tokens.total > 0;
|
|
425
|
+
// 기록 안의 이름 바꾸기 이벤트가 먼저, 없으면 session_index.jsonl 의 thread_name.
|
|
426
|
+
const customName = st.threadName ?? indexName(f.path, st.id);
|
|
361
427
|
out.push({
|
|
362
428
|
tool: 'codex',
|
|
363
429
|
id: st.id,
|
|
364
430
|
pid: pid ?? null,
|
|
365
431
|
kind: 'interactive',
|
|
366
|
-
name: lastName(st.cwd) || 'codex',
|
|
432
|
+
name: customName ?? (lastName(st.cwd) || 'codex'),
|
|
433
|
+
customName,
|
|
434
|
+
// rollout 이 든 Codex 홈. 기본 홈이 아니면 이어 열기 명령에 CODEX_HOME 을 붙인다.
|
|
435
|
+
home: homeOf(f.path, codexHomes()),
|
|
367
436
|
cwd: st.cwd,
|
|
368
437
|
project: lastName(st.cwd),
|
|
369
438
|
branch: st.branch,
|
package/src/sources/common.mjs
CHANGED
|
@@ -192,6 +192,16 @@ function rawDescribeTool(name, input) {
|
|
|
192
192
|
export const DETAIL_MAX = 2048;
|
|
193
193
|
const ANSI = /\x1b(?:\[[0-?]*[ -/]*[@-~]|\][^\x07\x1b]*(?:\x07|\x1b\\)|[@-Z\\-_])/g;
|
|
194
194
|
|
|
195
|
+
// 사용자가 붙인 세션 이름 (Claude /rename 의 custom-title, Codex thread_name). 사용자·모델이 쓴 글이라
|
|
196
|
+
// 색 순서·제어문자를 지우고 한 줄로 줄인 뒤 비밀값을 가리고 NAME_MAX 자에서 자른다. 비었으면 null.
|
|
197
|
+
export const NAME_MAX = 80;
|
|
198
|
+
export function sessionName(raw) {
|
|
199
|
+
if (typeof raw !== 'string') return null;
|
|
200
|
+
const one = mask(oneLine(raw.replace(ANSI, '')));
|
|
201
|
+
if (!one) return null;
|
|
202
|
+
return one.length > NAME_MAX ? one.slice(0, NAME_MAX - 1) + '…' : one;
|
|
203
|
+
}
|
|
204
|
+
|
|
195
205
|
export function toolDetail(name, input = {}) {
|
|
196
206
|
const raw = rawToolDetail(name, input);
|
|
197
207
|
if (!raw) return null;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// Claude 설정 폴더와 Codex 홈 폴더 목록 (#212). 프로필을 여러 개 쓰면 폴더도 여럿이다.
|
|
2
|
+
// 순서: AITOP_CLAUDE_DIRS·AITOP_CODEX_HOMES(aitop 전용, 구분자 path.delimiter) > 설정 파일(claudeDirs, codexHomes)
|
|
3
|
+
// > 물려받은 CLAUDE_CONFIG_DIR·CODEX_HOME (Claude Code·Codex 가 쓰는 변수라 설정 파일보다 낮다) > 기본(~/.claude, ~/.codex).
|
|
4
|
+
// 설정 파일까지 본 결과는 bin/aitop.mjs 가 setDataDirs 로 넘긴다. 넘기지 않으면(테스트) 환경 변수와 기본값만 본다.
|
|
5
|
+
// 비슷한 이름의 폴더를 저절로 읽지는 않는다. --doctor 가 후보로 안내만 한다 (candidateDirs).
|
|
6
|
+
import { readdirSync, realpathSync, statSync } from 'node:fs';
|
|
7
|
+
import { homedir } from 'node:os';
|
|
8
|
+
import { delimiter, join, resolve } from 'node:path';
|
|
9
|
+
|
|
10
|
+
const isDir = (p) => {
|
|
11
|
+
try {
|
|
12
|
+
return statSync(p).isDirectory();
|
|
13
|
+
} catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
// 'a:b' 를 경로 배열로. 빈 칸은 버린다. 남는 것이 없으면 undefined (정하지 않은 것으로 본다).
|
|
19
|
+
// 값 전체가 있는 폴더면 나누지 않는다 (예전처럼 경로 하나를 준 사용자의 경로에 : 가 들어 있어도 그대로).
|
|
20
|
+
export function splitPaths(v, delim = delimiter, exists = isDir) {
|
|
21
|
+
if (typeof v !== 'string') return undefined;
|
|
22
|
+
if (v.includes(delim) && v.trim() && exists(expandHome(v.trim()))) return [v.trim()];
|
|
23
|
+
const out = v.split(delim).map((s) => s.trim()).filter(Boolean);
|
|
24
|
+
return out.length ? out : undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 맨 앞 ~ 를 홈 폴더로 바꾼다.
|
|
28
|
+
export function expandHome(p, home = homedir()) {
|
|
29
|
+
return p === '~' ? home : /^~[\\/]/.test(p) ? join(home, p.slice(2)) : p;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 설정 파일에 쓸 수 있는 경로: 절대 경로이거나 ~ 로 시작.
|
|
33
|
+
export const pathLike = (p) => typeof p === 'string' && p.trim() !== '' && (/^~(?:$|[\\/])/.test(p) || /^(?:\/|[A-Za-z]:[\\/]|\\\\)/.test(p));
|
|
34
|
+
|
|
35
|
+
const realOf = (p) => {
|
|
36
|
+
try {
|
|
37
|
+
return realpathSync(p);
|
|
38
|
+
} catch {
|
|
39
|
+
return p;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// ~ 를 풀고 절대 경로로 바꾼 뒤, 실제 경로(realpath)가 같은 것은 처음 것만 남긴다.
|
|
44
|
+
export function uniqueDirs(list, home = homedir()) {
|
|
45
|
+
const seen = new Set();
|
|
46
|
+
const out = [];
|
|
47
|
+
for (const raw of list ?? []) {
|
|
48
|
+
const p = resolve(expandHome(String(raw), home));
|
|
49
|
+
const real = realOf(p);
|
|
50
|
+
if (seen.has(real)) continue;
|
|
51
|
+
seen.add(real);
|
|
52
|
+
out.push(p);
|
|
53
|
+
}
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 환경 변수 이름: aitop 전용(설정 파일보다 높음)과 물려받는 것(설정 파일보다 낮음).
|
|
58
|
+
export const DIR_ENV = {
|
|
59
|
+
claude: { own: 'AITOP_CLAUDE_DIRS', inherited: 'CLAUDE_CONFIG_DIR', home: '.claude' },
|
|
60
|
+
codex: { own: 'AITOP_CODEX_HOMES', inherited: 'CODEX_HOME', home: '.codex' },
|
|
61
|
+
};
|
|
62
|
+
// 설정 파일 없이 고른 목록 (테스트, setDataDirs 를 부르기 전).
|
|
63
|
+
const envDirs = (k, env, home) => splitPaths(env[DIR_ENV[k].own]) ?? splitPaths(env[DIR_ENV[k].inherited]) ?? [join(home, DIR_ENV[k].home)];
|
|
64
|
+
export const defaultClaudeDirs = (env = process.env, home = homedir()) => envDirs('claude', env, home);
|
|
65
|
+
export const defaultCodexHomes = (env = process.env, home = homedir()) => envDirs('codex', env, home);
|
|
66
|
+
|
|
67
|
+
let chosen = null;
|
|
68
|
+
|
|
69
|
+
// 설정까지 반영한 목록을 정한다. 소스 모듈이 처음 읽기 전에 불러야 한다.
|
|
70
|
+
export function setDataDirs({ claude, codex } = {}) {
|
|
71
|
+
chosen = { claude: uniqueDirs(claude ?? defaultClaudeDirs()), codex: uniqueDirs(codex ?? defaultCodexHomes()) };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const pick = () => (chosen ??= { claude: uniqueDirs(defaultClaudeDirs()), codex: uniqueDirs(defaultCodexHomes()) });
|
|
75
|
+
export const claudeDirs = () => pick().claude;
|
|
76
|
+
export const codexHomes = () => pick().codex;
|
|
77
|
+
export const claudeProjectRoots = () => claudeDirs().map((d) => join(d, 'projects'));
|
|
78
|
+
export const codexSessionRoots = () => codexHomes().map((h) => join(h, 'sessions'));
|
|
79
|
+
|
|
80
|
+
// 기록 파일이 든 홈 (roots 가운데 path 가 그 아래 sessions/ 에 있는 것). 없으면 null.
|
|
81
|
+
export const homeOf = (path, roots) => roots.find((h) => path.startsWith(join(h, 'sessions') + '/') || path.startsWith(join(h, 'sessions') + '\\')) ?? null;
|
|
82
|
+
|
|
83
|
+
// 이어 열기 명령 앞에 붙일 환경 변수 (#214). 도구가 스스로 고르는 폴더(물려받은 변수가 없으면 ~/.claude, ~/.codex)와
|
|
84
|
+
// 세션이 든 폴더가 같으면 null. 다르거나 셸에 물려받은 변수가 있으면 [변수 이름, 폴더] 로 그 폴더를 꼭 집어 준다.
|
|
85
|
+
export function homeEnv(kind, dir, env = process.env, home = homedir()) {
|
|
86
|
+
if (!dir) return null;
|
|
87
|
+
const { inherited, home: base } = DIR_ENV[kind];
|
|
88
|
+
if (!env[inherited] && resolve(dir) === resolve(home, base)) return null;
|
|
89
|
+
return [inherited, dir];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// 여러 폴더에 같은 기록이 있으면(복사본, 링크) 한 번만 센다. key 가 같으면 더 최근에 바뀐 쪽, 같으면 앞 폴더 것.
|
|
93
|
+
// items: [{ key, mtime, ... }]. 순서는 처음 나온 자리를 지킨다.
|
|
94
|
+
export function dedupeBy(items) {
|
|
95
|
+
const at = new Map();
|
|
96
|
+
const out = [];
|
|
97
|
+
for (const it of items) {
|
|
98
|
+
const i = at.get(it.key);
|
|
99
|
+
if (i === undefined) {
|
|
100
|
+
at.set(it.key, out.length);
|
|
101
|
+
out.push(it);
|
|
102
|
+
} else if (it.mtime > out[i].mtime) out[i] = it;
|
|
103
|
+
}
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// --doctor 용: 읽지 않는 폴더 중 기록이 있어 보이는 것. 홈 바로 아래 .claude 와 .claude-*·.claude.*·.claude_* (+ ~/.config/claude) 에
|
|
108
|
+
// projects/ 가 있거나, .codex-* 등에 sessions/ 가 있으면 후보다. 내 것(uid)이 아닌 폴더는 보지 않는다. 읽지는 않는다.
|
|
109
|
+
// 설정 파일 목록 때문에 쓰지 않게 된 CLAUDE_CONFIG_DIR·CODEX_HOME 의 폴더도 기록이 있으면 후보로 보인다.
|
|
110
|
+
export function candidateDirs({ home = homedir(), claude = claudeDirs(), codex = codexHomes(), uid = process.getuid?.(), env = process.env } = {}) {
|
|
111
|
+
let names = [];
|
|
112
|
+
try {
|
|
113
|
+
names = readdirSync(home);
|
|
114
|
+
} catch {}
|
|
115
|
+
const mine = (p) => {
|
|
116
|
+
try {
|
|
117
|
+
const st = statSync(p);
|
|
118
|
+
return st.isDirectory() && (uid == null || st.uid === uid);
|
|
119
|
+
} catch {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
const look = (paths, read, sub) => {
|
|
124
|
+
const known = new Set(read.map(realOf));
|
|
125
|
+
const out = [];
|
|
126
|
+
for (const p of paths) {
|
|
127
|
+
const real = realOf(p);
|
|
128
|
+
if (known.has(real) || !mine(p) || !mine(join(p, sub))) continue;
|
|
129
|
+
known.add(real);
|
|
130
|
+
out.push(p);
|
|
131
|
+
}
|
|
132
|
+
return out;
|
|
133
|
+
};
|
|
134
|
+
const inherited = (k) => uniqueDirs(splitPaths(env[DIR_ENV[k].inherited]) ?? [], home);
|
|
135
|
+
const near = (re) => names.filter((n) => re.test(n)).sort().map((n) => join(home, n));
|
|
136
|
+
return {
|
|
137
|
+
claude: look([...inherited('claude'), join(home, '.claude'), ...near(/^\.claude[-_.]./), join(home, '.config', 'claude')], claude, 'projects'),
|
|
138
|
+
codex: look([...inherited('codex'), join(home, '.codex'), ...near(/^\.codex[-_.]./)], codex, 'sessions'),
|
|
139
|
+
};
|
|
140
|
+
}
|
package/src/sources/projects.mjs
CHANGED
|
@@ -4,14 +4,12 @@
|
|
|
4
4
|
// agy 기록은 immutable 로 열어 -wal 에만 있는 막 생긴 대화는 아직 안 보이므로, 그 대화는 (unknown) 으로 나올 수 있다.
|
|
5
5
|
// 장부 캐시 모양은 그대로 두고, 리포트를 낼 때만 파일 앞부분을 조금 읽는다.
|
|
6
6
|
import { openSync, readSync, closeSync, statSync } from 'node:fs';
|
|
7
|
-
import { basename, join, relative, sep } from 'node:path';
|
|
8
|
-
import { homedir } from 'node:os';
|
|
7
|
+
import { basename, isAbsolute, join, relative, sep } from 'node:path';
|
|
9
8
|
import { AGY_ROOT, cwdOf } from './antigravity.mjs';
|
|
10
9
|
import { openReadOnly } from '../sqlite.mjs';
|
|
11
10
|
import { debugIo } from '../log.mjs';
|
|
11
|
+
import { claudeProjectRoots } from './dirs.mjs';
|
|
12
12
|
|
|
13
|
-
const HOME = process.env.CLAUDE_CONFIG_DIR ?? join(homedir(), '.claude');
|
|
14
|
-
const PROJECTS = join(HOME, 'projects');
|
|
15
13
|
// 앞부분에서 cwd 를 찾을 때 읽는 최대 크기. Codex 의 첫 줄(session_meta)은 지침 글이 들어 있어 길 수 있다.
|
|
16
14
|
const HEAD_BYTES = 256 * 1024;
|
|
17
15
|
const heads = new Map();
|
|
@@ -78,11 +76,15 @@ export function claudeProject(path) {
|
|
|
78
76
|
export const encodeFolder = (cwd) => cwd.replace(/[^A-Za-z0-9]/g, '-');
|
|
79
77
|
|
|
80
78
|
// cwd 를 못 찾았을 때 쓰는 projects/ 바로 아래 폴더 이름. 작업 트리 꼴(--claude-worktrees-<이름>)이면 그 부분을 뗀다.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
// root 를 주지 않으면 설정 폴더 전부의 projects/ 중 path 를 담은 것을 쓴다.
|
|
80
|
+
export function claudeFolder(path, root) {
|
|
81
|
+
for (const r of root ? [root] : claudeProjectRoots()) {
|
|
82
|
+
const rel = relative(r, path);
|
|
83
|
+
const dir = rel.split(sep)[0];
|
|
84
|
+
if (!dir || rel.startsWith('..') || isAbsolute(rel) || dir === rel) continue;
|
|
85
|
+
return dir.replace(/--claude-worktrees-.*$/, '') || dir;
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
export function codexProject(path) {
|
|
@@ -101,12 +103,19 @@ export function codexProject(path) {
|
|
|
101
103
|
|
|
102
104
|
// 대화 id → 작업 폴더. 서브에이전트는 작업 폴더가 비어 있으면 부모를 따라 올라간다. 리포트 한 번에 한 번만 읽는다.
|
|
103
105
|
export function agyWorkspaces(root = AGY_ROOT) {
|
|
106
|
+
return new Map([...agyConversations(root)].map(([id, c]) => [id, c.cwd]));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// 대화 id → { cwd, title, root }. root: 부모를 끝까지 따라간 맨 위 대화 id (서브에이전트를 그 세션에 묶을 때 쓴다).
|
|
110
|
+
// title 은 agy 가 붙인 대화 제목 (세션 리포트의 '그 밖 이름').
|
|
111
|
+
export function agyConversations(root = AGY_ROOT) {
|
|
104
112
|
const out = new Map();
|
|
105
113
|
let db;
|
|
106
114
|
try {
|
|
107
115
|
db = openReadOnly(join(root, 'conversation_summaries.db'));
|
|
108
116
|
if (!db) return out;
|
|
109
|
-
|
|
117
|
+
// title 열은 예전 기록에 없을 수 있어 * 로 읽는다.
|
|
118
|
+
const rows = db.prepare('select * from conversation_summaries').all().map((r) => ({ id: r.conversation_id, parent: r.parent_conversation_id, ws: r.workspace_uris, title: r.title }));
|
|
110
119
|
const byId = new Map(rows.map((r) => [r.id, r]));
|
|
111
120
|
for (const r of rows) {
|
|
112
121
|
let cur = r;
|
|
@@ -115,7 +124,9 @@ export function agyWorkspaces(root = AGY_ROOT) {
|
|
|
115
124
|
cur = byId.get(cur.parent);
|
|
116
125
|
cwd = cur ? cwdOf(cur.ws) : null;
|
|
117
126
|
}
|
|
118
|
-
|
|
127
|
+
let top = r;
|
|
128
|
+
for (let i = 0; top.parent && byId.has(top.parent) && i < 10; i++) top = byId.get(top.parent);
|
|
129
|
+
out.set(r.id, { cwd, title: typeof r.title === 'string' && r.title ? r.title : null, root: top.id });
|
|
119
130
|
}
|
|
120
131
|
} catch (e) {
|
|
121
132
|
debugIo('report', 'agy workspaces read failed', e);
|
|
@@ -135,7 +146,7 @@ export function projectRoot(cwd) {
|
|
|
135
146
|
|
|
136
147
|
// books: collectDaily 의 [{ tool, path, days }]. 각 장부에 project(작업 폴더 경로 또는 null)를 붙여 돌려준다.
|
|
137
148
|
// Claude 기록에서 cwd 를 못 찾으면 폴더 이름을 쓰되, 같은 폴더 이름이 되는 경로를 다른 기록에서 찾았으면 그 경로로 묶는다.
|
|
138
|
-
export function attachProjects(books, root
|
|
149
|
+
export function attachProjects(books, root) {
|
|
139
150
|
let agy = null;
|
|
140
151
|
const folder = new Map();
|
|
141
152
|
const out = books.map((b) => {
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// 세션 리포트(--report sessions)용 기록 요약: Claude·Codex 기록 파일 하나마다 날짜별 활동 시작·끝 시각, 고친 파일, 그날 첫 지시와
|
|
2
|
+
// 세션 이름(사용자 이름, 그 밖 이름)을 모은다. 사용량(토큰·비용)은 장부(claude-ledger.mjs 등)가 세고, 여기서는 세지 않는다.
|
|
3
|
+
// 장부 캐시 모양은 그대로 두고 따로 읽는다 (장부를 다시 세지 않게). 리포트가 기간 안에 사용량이 있는 기록만 부른다.
|
|
4
|
+
// 기록은 읽기만 하고, 어디까지 읽었는지는 aitop 캐시에 둔다.
|
|
5
|
+
import { JsonlTail } from '../tail.mjs';
|
|
6
|
+
import { loadCache, markDirty } from '../cache.mjs';
|
|
7
|
+
import { dayKey, isNoisePrompt, recentDays, sessionName } from './common.mjs';
|
|
8
|
+
import { readChange } from './files.mjs';
|
|
9
|
+
import { parsePatch, extractPatch, patchSucceeded } from './patch.mjs';
|
|
10
|
+
import { mask, oneLine } from '../text.mjs';
|
|
11
|
+
|
|
12
|
+
const KIND = 'sheet1';
|
|
13
|
+
// 하루에 남기는 고친 파일 수 상한 (캐시가 커지지 않게). 넘으면 more 에 표시해 '200+' 처럼 보인다.
|
|
14
|
+
export const FILES_MAX = 200;
|
|
15
|
+
// 캐시에 남기는 지시 글 길이. 화면에는 더 짧게 자른다.
|
|
16
|
+
const PROMPT_MAX = 200;
|
|
17
|
+
// 결과를 기다리는 Codex 패치 수 상한.
|
|
18
|
+
const PENDING_MAX = 50;
|
|
19
|
+
// 날짜를 남기는 일수 (리포트가 보는 30일보다 조금 길게).
|
|
20
|
+
const KEEP = 32;
|
|
21
|
+
|
|
22
|
+
const clip = (s) => {
|
|
23
|
+
const one = mask(oneLine(s));
|
|
24
|
+
return one ? one.slice(0, PROMPT_MAX) : null;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export class SessionSheet {
|
|
28
|
+
// tool: 'claude' 또는 'codex'. sub: Claude 서브에이전트 기록 (지시 글을 세션 첫 지시로 쓰지 않는다).
|
|
29
|
+
constructor(path, tool, { sub = false } = {}) {
|
|
30
|
+
this.tool = tool;
|
|
31
|
+
this.sub = sub;
|
|
32
|
+
this.tail = new JsonlTail(path);
|
|
33
|
+
this.tail.onReset = () => this.clear();
|
|
34
|
+
this.clear();
|
|
35
|
+
const c = loadCache(path, KIND);
|
|
36
|
+
if (c) {
|
|
37
|
+
this.tail.offset = c.offset;
|
|
38
|
+
this.days = c.days ?? {};
|
|
39
|
+
this.custom = c.custom ?? null;
|
|
40
|
+
this.title = c.title ?? null;
|
|
41
|
+
this.id = c.id ?? null;
|
|
42
|
+
this.cwd = c.cwd ?? null;
|
|
43
|
+
this.pending = c.pending ?? {};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
clear() {
|
|
48
|
+
// 날짜 → { a: 첫 활동 ms, z: 마지막 활동 ms, f: 고친 파일 경로들, more: 상한을 넘었는지, p: 그날 첫 지시 }
|
|
49
|
+
this.days = {};
|
|
50
|
+
// custom: 사용자가 붙인 이름 (Claude custom-title, Codex thread_name_updated). title: 그 밖 이름 (Claude ai-title).
|
|
51
|
+
this.custom = null;
|
|
52
|
+
this.title = null;
|
|
53
|
+
// Codex 세션 id (session_index.jsonl 이름을 찾을 때 쓴다)와 작업 폴더 (상대 경로 패치를 풀 때 쓴다).
|
|
54
|
+
this.id = null;
|
|
55
|
+
this.cwd = null;
|
|
56
|
+
// Codex: 결과를 기다리는 패치 호출 id → 고칠 파일 경로들.
|
|
57
|
+
this.pending = {};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// 아직 읽지 않은 크기.
|
|
61
|
+
get left() {
|
|
62
|
+
return Math.max(0, this.tail.size - this.tail.offset);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get path() {
|
|
66
|
+
return this.tail.path;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
update(budget) {
|
|
70
|
+
const n = this.tail.read((x) => this.apply(x), budget);
|
|
71
|
+
if (n) markDirty(this.tail.path, () => this.snapshot(), KIND);
|
|
72
|
+
return n;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
snapshot() {
|
|
76
|
+
return { offset: this.tail.lineOffset, days: recentDays(this.days, KEEP), custom: this.custom, title: this.title, id: this.id, cwd: this.cwd, pending: this.pending };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
day(at) {
|
|
80
|
+
const d = (this.days[dayKey(at)] ??= { a: at, z: at, f: [] });
|
|
81
|
+
if (at < d.a) d.a = at;
|
|
82
|
+
if (at > d.z) d.z = at;
|
|
83
|
+
return d;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
addFile(at, path) {
|
|
87
|
+
if (typeof path !== 'string' || !path) return;
|
|
88
|
+
const d = this.day(at);
|
|
89
|
+
if (d.f.includes(path)) return;
|
|
90
|
+
if (d.f.length >= FILES_MAX) d.more = true;
|
|
91
|
+
else d.f.push(path);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
prompt(at, text) {
|
|
95
|
+
if (this.sub || !text || isNoisePrompt(text)) return;
|
|
96
|
+
const d = this.day(at);
|
|
97
|
+
d.p ??= clip(text);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
apply(x) {
|
|
101
|
+
if (this.tool === 'codex') return this.applyCodex(x);
|
|
102
|
+
if (x.type === 'custom-title') this.custom = sessionName(x.customTitle);
|
|
103
|
+
if (x.type === 'ai-title' && x.aiTitle) this.title = sessionName(x.aiTitle);
|
|
104
|
+
if (x.type !== 'user' && x.type !== 'assistant') return;
|
|
105
|
+
const at = Date.parse(x.timestamp);
|
|
106
|
+
if (!Number.isFinite(at)) return;
|
|
107
|
+
this.day(at);
|
|
108
|
+
if (x.type !== 'user' || x.isMeta || !x.message) return;
|
|
109
|
+
if (x.toolUseResult) {
|
|
110
|
+
const c = readChange(x.toolUseResult, at);
|
|
111
|
+
if (c) this.addFile(at, c.path);
|
|
112
|
+
}
|
|
113
|
+
const c = x.message.content;
|
|
114
|
+
const text = typeof c === 'string' ? c : Array.isArray(c) ? c.filter((p) => p?.type === 'text').map((p) => p.text).join(' ') : '';
|
|
115
|
+
this.prompt(at, text);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
applyCodex(x) {
|
|
119
|
+
const p = x.payload ?? {};
|
|
120
|
+
if (x.type === 'session_meta') {
|
|
121
|
+
this.id = p.id ?? this.id;
|
|
122
|
+
this.cwd = p.cwd ?? this.cwd;
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (x.type === 'turn_context') this.cwd = p.cwd ?? this.cwd;
|
|
126
|
+
if (x.type !== 'event_msg' && x.type !== 'response_item') return;
|
|
127
|
+
const at = Date.parse(x.timestamp);
|
|
128
|
+
if (!Number.isFinite(at)) return;
|
|
129
|
+
this.day(at);
|
|
130
|
+
if (x.type === 'event_msg') {
|
|
131
|
+
if (p.type === 'thread_name_updated') this.custom = sessionName(p.thread_name);
|
|
132
|
+
if (p.type === 'user_message') this.prompt(at, p.message);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
// 패치는 결과가 성공일 때만 고친 파일로 센다 (codex.mjs 와 같다).
|
|
136
|
+
let text = null;
|
|
137
|
+
if (p.type === 'custom_tool_call' && p.name === 'apply_patch') text = String(p.input ?? '');
|
|
138
|
+
else if (p.type === 'function_call') {
|
|
139
|
+
let args = {};
|
|
140
|
+
try {
|
|
141
|
+
args = JSON.parse(p.arguments ?? '{}');
|
|
142
|
+
} catch {}
|
|
143
|
+
const cmd = Array.isArray(args.command) ? args.command.join('\n') : String(args.command ?? '');
|
|
144
|
+
if (/\bapply_patch\b/.test(cmd)) text = extractPatch(cmd);
|
|
145
|
+
} else if ((p.type === 'function_call_output' || p.type === 'custom_tool_call_output') && this.pending[p.call_id]) {
|
|
146
|
+
const paths = this.pending[p.call_id];
|
|
147
|
+
delete this.pending[p.call_id];
|
|
148
|
+
if (patchSucceeded(p.output)) for (const f of paths) this.addFile(at, f);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (text && p.call_id) {
|
|
152
|
+
const paths = parsePatch(text, this.cwd).map((r) => r.filePath);
|
|
153
|
+
if (!paths.length) return;
|
|
154
|
+
const keys = Object.keys(this.pending);
|
|
155
|
+
if (keys.length >= PENDING_MAX) delete this.pending[keys[0]];
|
|
156
|
+
this.pending[p.call_id] = paths;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const sheets = new Map();
|
|
162
|
+
|
|
163
|
+
// 기록 파일 하나의 요약. 처음이면 만들고(캐시가 있으면 이어 읽는다), 같은 실행 안에서는 다시 쓴다.
|
|
164
|
+
export function sheetOf(path, tool, opts) {
|
|
165
|
+
let s = sheets.get(path);
|
|
166
|
+
if (!s) sheets.set(path, (s = new SessionSheet(path, tool, opts)));
|
|
167
|
+
return s;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export const _test = { reset: () => sheets.clear() };
|
package/src/ui/chrome.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { box, line, segsWidth } from './draw.mjs';
|
|
|
5
5
|
import { glyphs, legendMark } from './glyphs.mjs';
|
|
6
6
|
import { COMMON, VIEWS, helpContext, keysLine, options, settingsLine, viewText } from '../help.mjs';
|
|
7
7
|
import { getLang, t } from '../i18n.mjs';
|
|
8
|
+
import { resumeCmd } from '../resume.mjs';
|
|
8
9
|
|
|
9
10
|
// 상세 패널을 기본으로 여는 최소 화면 높이. 이보다 낮으면 세션 표에 줄을 준다.
|
|
10
11
|
export const DETAIL_MIN_H = 24;
|
|
@@ -128,8 +129,16 @@ function orderHint(view) {
|
|
|
128
129
|
return { segs: [...segs, { t: ' ' }] };
|
|
129
130
|
}
|
|
130
131
|
|
|
132
|
+
// y 를 누른 뒤 잠깐 보이는 알림 (view.toast = { key, until }). 시간이 지나면 빠진다.
|
|
133
|
+
function toastItem(view, now = Date.now()) {
|
|
134
|
+
const x = view.toast;
|
|
135
|
+
if (!x || now >= x.until) return [];
|
|
136
|
+
return [{ segs: [{ t: t(x.key), fg: x.key === 'foot.copied' ? PALETTE.busy : PALETTE.waiting, bold: true }, { t: ' ' }], keep: true }];
|
|
137
|
+
}
|
|
138
|
+
|
|
131
139
|
export function footer(view, W, matched, sel) {
|
|
132
140
|
const RO = t('foot.readOnly');
|
|
141
|
+
const toast = toastItem(view);
|
|
133
142
|
const tail = [
|
|
134
143
|
{ k: '?', t: t('foot.help'), keep: true },
|
|
135
144
|
{ k: 'q', t: t('key.quit'), keep: true },
|
|
@@ -146,7 +155,7 @@ export function footer(view, W, matched, sel) {
|
|
|
146
155
|
view.focus === 'diff'
|
|
147
156
|
? [{ k: '↑↓', t: t('key.scroll') }, { k: 'space', t: t('key.page') }, { k: '[ ]', t: t('key.prevNext') }, { k: 'Esc', t: t('foot.toFiles'), keep: true }]
|
|
148
157
|
: [{ k: '←→', t: t('foot.prompts') }, { k: '↑↓', t: t('foot.pickFile') }, { k: '⏎', t: t('foot.viewDiff') }, { k: 'Esc', t: t('foot.toSessions'), keep: true }];
|
|
149
|
-
return hintBar([...keys, ...tail], W, RO);
|
|
158
|
+
return hintBar([...toast, ...keys, ...tail], W, RO);
|
|
150
159
|
}
|
|
151
160
|
// 세션이 하나도 없으면 쓸 수 있는 키만 남긴다.
|
|
152
161
|
if (!view.filter && !view.data?.sessions?.length) return hintBar([ended, ...tail], W, RO);
|
|
@@ -155,6 +164,7 @@ export function footer(view, W, matched, sel) {
|
|
|
155
164
|
? { segs: [{ t: ` /${view.filter} `, fg: PALETTE.chipText, bg: PALETTE.brand, bold: true }, { t: ` ${t('foot.count', { n: matched })} `, fg: PALETTE.muted }, keyChip('Esc'), keyLabel(t('foot.clearSearch'))], keep: true }
|
|
156
165
|
: { k: '/', t: t('key.search') };
|
|
157
166
|
const items = [
|
|
167
|
+
...toast,
|
|
158
168
|
search,
|
|
159
169
|
{ k: '↑↓', t: t('key.select') },
|
|
160
170
|
{ k: 'n', t: t('foot.next') },
|
|
@@ -163,8 +173,10 @@ export function footer(view, W, matched, sel) {
|
|
|
163
173
|
{ k: 'd', t: t(view.showDetail ? 'foot.hideDetail' : 'foot.showDetail') },
|
|
164
174
|
ended,
|
|
165
175
|
{ k: 'c', t: t('foot.costMode') },
|
|
166
|
-
// 고정은 폭이 모자라면
|
|
176
|
+
// 고정은 폭이 모자라면 복사 다음으로 빠진다.
|
|
167
177
|
...(sel ? [{ k: 'p', t: t(view.pins?.includes(sel.id) ? 'foot.unpin' : 'key.pin') }] : []),
|
|
178
|
+
// 복사(y)는 상세 패널에 이어 여는 명령이 보일 때만 안내하고, 폭이 모자라면 가장 먼저 빠진다.
|
|
179
|
+
...(view.showDetail && resumeCmd(sel) ? [{ k: 'y', t: t('key.copy') }] : []),
|
|
168
180
|
...tail,
|
|
169
181
|
];
|
|
170
182
|
return hintBar(items, W, RO);
|