@sejuneoh/aitop 0.27.0 → 0.28.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 +4 -2
- package/package.json +5 -4
- package/src/cache.mjs +3 -1
- package/src/config.mjs +5 -4
- package/src/doctor.mjs +3 -1
- package/src/log.mjs +5 -4
- package/src/order.mjs +2 -1
- package/src/paths.mjs +61 -0
- package/src/procs.mjs +7 -2
- package/src/sources/antigravity.mjs +3 -1
- package/src/sources/codex.mjs +18 -8
- package/src/sources/patch.mjs +5 -2
- package/src/ui/draw.mjs +3 -1
package/README.md
CHANGED
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
|
|
18
18
|
## Install
|
|
19
19
|
|
|
20
|
-
Requires Node.js 22+ on Linux, macOS or
|
|
20
|
+
Requires Node.js 22+ on Linux, macOS, WSL or Windows.
|
|
21
|
+
|
|
22
|
+
Native Windows support is early (Windows Terminal recommended): Claude Code and Codex sessions, `--once`, `--json`, `--report` and `--doctor` work, but process detection, desktop notifications and `--on-waiting` are not there yet ([#195](https://github.com/SejuneOh/aitop/issues/195)-[#197](https://github.com/SejuneOh/aitop/issues/197)). Until then a Codex session counts as running while its log was written in the last 10 minutes, so it drops out during a long step that writes nothing for over 10 minutes, and a crashed session can stay up to 10 minutes. Cache, log and config live in `%LOCALAPPDATA%\aitop\cache`, `%LOCALAPPDATA%\aitop\state` and `%APPDATA%\aitop` unless `XDG_*` is set.
|
|
21
23
|
|
|
22
24
|
```bash
|
|
23
25
|
npm install -g @sejuneoh/aitop
|
|
@@ -68,7 +70,7 @@ set -g status-interval 15
|
|
|
68
70
|
|
|
69
71
|
Keys: `↑↓` select · `n` next session to check · `/` search · `s` sort · `g` group · `p` pin · `f` changed files · `?` help · `q` quit
|
|
70
72
|
|
|
71
|
-
Settings can also go in `~/.config/aitop/config.json
|
|
73
|
+
Settings can also go in `~/.config/aitop/config.json` (`%APPDATA%\aitop\config.json` on Windows). See `aitop --help` or the [detailed manual (Korean)](https://github.com/SejuneOh/aitop/blob/main/docs/README.ko.md).
|
|
72
74
|
|
|
73
75
|
## License
|
|
74
76
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sejuneoh/aitop",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "터미널에서 Claude Code · Codex · Antigravity · Gemini 세션과 토큰을 실시간으로 보는 읽기 전용 모니터",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
},
|
|
19
19
|
"os": [
|
|
20
20
|
"linux",
|
|
21
|
-
"darwin"
|
|
21
|
+
"darwin",
|
|
22
|
+
"win32"
|
|
22
23
|
],
|
|
23
24
|
"homepage": "https://github.com/SejuneOh/aitop#readme",
|
|
24
25
|
"bugs": "https://github.com/SejuneOh/aitop/issues",
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
},
|
|
33
34
|
"scripts": {
|
|
34
35
|
"start": "node bin/aitop.mjs",
|
|
35
|
-
"test": "
|
|
36
|
-
"test:e2e": "
|
|
36
|
+
"test": "node --import ./test/lang-ko.mjs --test test/*.test.mjs",
|
|
37
|
+
"test:e2e": "node --import ./test/lang-ko.mjs --test test/e2e/*.e2e.mjs"
|
|
37
38
|
}
|
|
38
39
|
}
|
package/src/cache.mjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { readFileSync, writeFileSync, mkdirSync, renameSync, statSync, readdirSync, rmSync } from 'node:fs';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
5
|
import { homedir } from 'node:os';
|
|
6
|
+
import { appDir } from './paths.mjs';
|
|
6
7
|
import { createHash } from 'node:crypto';
|
|
7
8
|
import { PRICE_TAG } from './pricing.mjs';
|
|
8
9
|
import { debug, debugIo } from './log.mjs';
|
|
@@ -11,7 +12,8 @@ import { debug, debugIo } from './log.mjs';
|
|
|
11
12
|
// 14: 장부의 하루 합계에 모델별 몫(models)을 더하고, 날짜를 10일이 아니라 30일 남긴다 (#128).
|
|
12
13
|
// 장부(ledger)만 형식이 바뀔 때는 VERSION 대신 장부의 kind 이름을 바꿔 장부만 다시 센다 (세션 화면 캐시는 그대로).
|
|
13
14
|
const VERSION = 14;
|
|
14
|
-
|
|
15
|
+
// Windows 는 XDG_CACHE_HOME 이 없으면 %LOCALAPPDATA%\aitop\cache (paths.mjs).
|
|
16
|
+
const ROOT = appDir('cache', { home: homedir() });
|
|
15
17
|
export const CACHE_ROOT = ROOT;
|
|
16
18
|
const NAME = `v${VERSION}-${PRICE_TAG}`;
|
|
17
19
|
const DIR = join(ROOT, NAME);
|
package/src/config.mjs
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
// 화면 모듈은 불러올 때 테마·아이콘을 고르므로, 이 모듈은 다른 aitop 모듈을 불러오지 않는다.
|
|
5
5
|
import { closeSync, constants, fstatSync, openSync, readSync, statSync } from 'node:fs';
|
|
6
6
|
import { homedir } from 'node:os';
|
|
7
|
-
import {
|
|
7
|
+
import { posix, win32 } from 'node:path';
|
|
8
|
+
import { appDir } from './paths.mjs';
|
|
8
9
|
import { stripControl } from './text.mjs';
|
|
9
10
|
import { langValue, localeLang, t } from './i18n.mjs';
|
|
10
11
|
|
|
@@ -71,9 +72,9 @@ export const KEYS = {
|
|
|
71
72
|
lang: { ok: oneOf('ko', 'en'), expect: ['ko', 'en'], def: localeLang, env: ['AITOP_LANG', langValue], envProblem: true },
|
|
72
73
|
};
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return
|
|
75
|
+
// Windows 는 XDG_CONFIG_HOME 이 없으면 %APPDATA%\aitop\config.json.
|
|
76
|
+
export function configPath(env = process.env, home = homedir(), platform = process.platform) {
|
|
77
|
+
return (platform === 'win32' ? win32 : posix).join(appDir('config', { env, home, platform }), 'config.json');
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
// 설정 파일은 작다. 이보다 크면 읽지 않는다.
|
package/src/doctor.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import { AGY_ROOT } from './sources/antigravity.mjs';
|
|
|
9
9
|
import { loadSqlite, openReadOnly } from './sqlite.mjs';
|
|
10
10
|
import { fmtAgo, pad, stripControl } from './text.mjs';
|
|
11
11
|
import { BRAND } from './brand.mjs';
|
|
12
|
+
import { tildeIn } from './paths.mjs';
|
|
12
13
|
import { findNotifier, isWsl } from './notify.mjs';
|
|
13
14
|
import { getLang, t as tr } from './i18n.mjs';
|
|
14
15
|
|
|
@@ -20,7 +21,8 @@ const CLAUDE = process.env.CLAUDE_CONFIG_DIR ?? join(HOME, '.claude');
|
|
|
20
21
|
const CODEX = join(process.env.CODEX_HOME ?? join(HOME, '.codex'), 'sessions');
|
|
21
22
|
const GEMINI = join(process.env.GEMINI_HOME ?? join(HOME, '.gemini'), 'tmp');
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
// Windows 는 \ 와 대소문자를 무시하고 줄인다 (paths.mjs).
|
|
25
|
+
const tilde = (p) => tildeIn(p, HOME);
|
|
24
26
|
const ls = (dir) => {
|
|
25
27
|
try {
|
|
26
28
|
return readdirSync(dir, { withFileTypes: true });
|
package/src/log.mjs
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
// 꺼져 있으면 파일을 만들지 않고 debug() 는 바로 돌아간다.
|
|
5
5
|
import { closeSync, constants, fchmodSync, fstatSync, mkdirSync, openSync, renameSync, statSync, writeSync } from 'node:fs';
|
|
6
6
|
import { homedir } from 'node:os';
|
|
7
|
-
import { basename, dirname,
|
|
7
|
+
import { basename, dirname, posix, win32 } from 'node:path';
|
|
8
|
+
import { appDir } from './paths.mjs';
|
|
8
9
|
import { mask, stripControl } from './text.mjs';
|
|
9
10
|
|
|
10
11
|
// 이 크기를 넘으면 aitop.log.1 로 옮기고 새로 쓴다 (이전 것 하나만 남긴다).
|
|
@@ -14,9 +15,9 @@ export const MAX_BYTES = 1024 * 1024;
|
|
|
14
15
|
export const REPEAT_MS = 60_000;
|
|
15
16
|
const MAX_KEYS = 1000;
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return
|
|
18
|
+
// Windows 는 XDG_STATE_HOME 이 없으면 %LOCALAPPDATA%\aitop\state\aitop.log.
|
|
19
|
+
export function logPath(env = process.env, home = homedir(), platform = process.platform) {
|
|
20
|
+
return (platform === 'win32' ? win32 : posix).join(appDir('state', { env, home, platform }), 'aitop.log');
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
let state = { on: false, path: null };
|
package/src/order.mjs
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
// 고정(p)한 세션은 응답 대기 바로 아래에 고정한 순서대로 둔다. 정렬을 바꿔도 그 순서는 바뀌지 않고, 묶을 때는 '고정' 묶음 하나로 모은다.
|
|
6
6
|
// 응답 대기를 고정보다 위에 두는 것은 사람이 할 일이 고정 목록에 가려지지 않게 하려는 것이다. 고정한 세션이 응답 대기가 되면 대기 쪽으로 올라간다.
|
|
7
7
|
import { costOf } from './ui/draw.mjs';
|
|
8
|
+
import { lastName } from './paths.mjs';
|
|
8
9
|
|
|
9
10
|
export const SORTS = ['default', 'cost', 'context', 'recent'];
|
|
10
11
|
export const GROUPS = ['none', 'project', 'tool'];
|
|
@@ -41,7 +42,7 @@ export function compare(sort, costMode = 'api', ready = true) {
|
|
|
41
42
|
return (a, b) => ended(a) - ended(b) || key(b, costMode) - key(a, costMode);
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
const projectOf = (s) => s.project ||
|
|
45
|
+
const projectOf = (s) => s.project || lastName(s.cwd) || NO_FOLDER;
|
|
45
46
|
const GROUP_KEY = { project: projectOf, tool: (s) => s.tool ?? '?' };
|
|
46
47
|
|
|
47
48
|
// 돌려주는 sessions 는 화면에 그리는 순서 그대로다 (↑↓·n 도 이 순서를 따른다).
|
package/src/paths.mjs
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// OS 마다 다른 경로 규칙을 한곳에 모은다. platform 과 env 를 받아서 테스트가 win32 를 흉내 낼 수 있다.
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
|
|
5
|
+
const pathFor = (plat) => (plat === 'win32' ? path.win32 : path.posix);
|
|
6
|
+
|
|
7
|
+
// 경로의 마지막 이름. win32 는 / 와 \ 를 모두 나누고, 그 밖의 OS 는 예전처럼 / 만 나눈다.
|
|
8
|
+
export const lastName = (p, plat = process.platform) =>
|
|
9
|
+
String(p ?? '')
|
|
10
|
+
.split(plat === 'win32' ? /[\\/]+/ : '/')
|
|
11
|
+
.filter(Boolean)
|
|
12
|
+
.at(-1) ?? '';
|
|
13
|
+
|
|
14
|
+
// 실행 파일 이름. win32 는 마지막 이름에서 .exe·.cmd·.bat·.ps1 을 떼고, 그 밖의 OS 는 예전처럼 마지막 / 뒤 그대로.
|
|
15
|
+
export const exeName = (p, plat = process.platform) =>
|
|
16
|
+
plat === 'win32' ? lastName(p, plat).replace(/\.(exe|cmd|bat|ps1)$/i, '') : String(p).split('/').pop();
|
|
17
|
+
|
|
18
|
+
// home 아래 경로를 ~ 로 줄인다. win32 는 드라이브 문자·대소문자를 무시하고 \ 와 / 를 같게 본다.
|
|
19
|
+
export function tildeIn(p, home = homedir(), plat = process.platform) {
|
|
20
|
+
const s = String(p ?? '');
|
|
21
|
+
const win = plat === 'win32';
|
|
22
|
+
const norm = (x) => (win ? x.replace(/\//g, '\\').toLowerCase() : x);
|
|
23
|
+
const h = String(home ?? '').replace(win ? /[\\/]+$/ : /\/+$/, '');
|
|
24
|
+
if (!h || s.length < h.length) return s;
|
|
25
|
+
if (norm(s.slice(0, h.length)) !== norm(h)) return s;
|
|
26
|
+
const rest = s.slice(h.length);
|
|
27
|
+
if (rest === '') return '~';
|
|
28
|
+
const sepOk = win ? /^[\\/]/.test(rest) : rest.startsWith('/');
|
|
29
|
+
return sepOk ? '~' + rest : s;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 절대 경로인 환경 변수 값만 쓴다.
|
|
33
|
+
const absEnv = (env, key, plat) => {
|
|
34
|
+
const v = env[key];
|
|
35
|
+
return v && pathFor(plat).isAbsolute(v) ? v : null;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// aitop 이 쓰는 폴더(끝이 aitop 또는 aitop\<종류>). XDG_* 가 있으면 어느 OS 든 그것을 쓴다.
|
|
39
|
+
// Linux·macOS: ~/.cache/aitop, ~/.local/state/aitop, ~/.config/aitop
|
|
40
|
+
// Windows: %LOCALAPPDATA%\aitop\cache, %LOCALAPPDATA%\aitop\state, %APPDATA%\aitop
|
|
41
|
+
export function appDir(kind, { env = process.env, home = homedir(), platform = process.platform } = {}) {
|
|
42
|
+
const { join } = pathFor(platform);
|
|
43
|
+
const win = platform === 'win32';
|
|
44
|
+
const local = () => absEnv(env, 'LOCALAPPDATA', platform) ?? join(home, 'AppData', 'Local');
|
|
45
|
+
if (kind === 'cache') {
|
|
46
|
+
// 캐시는 예전부터 XDG_CACHE_HOME 을 절대 경로인지 보지 않고 썼다. 그대로 둔다.
|
|
47
|
+
if (env.XDG_CACHE_HOME != null) return join(env.XDG_CACHE_HOME, 'aitop');
|
|
48
|
+
return win ? join(local(), 'aitop', 'cache') : join(home, '.cache', 'aitop');
|
|
49
|
+
}
|
|
50
|
+
if (kind === 'state') {
|
|
51
|
+
const xdg = absEnv(env, 'XDG_STATE_HOME', platform);
|
|
52
|
+
if (xdg) return join(xdg, 'aitop');
|
|
53
|
+
return win ? join(local(), 'aitop', 'state') : join(home, '.local', 'state', 'aitop');
|
|
54
|
+
}
|
|
55
|
+
if (kind === 'config') {
|
|
56
|
+
const xdg = absEnv(env, 'XDG_CONFIG_HOME', platform);
|
|
57
|
+
if (xdg) return join(xdg, 'aitop');
|
|
58
|
+
return win ? join(absEnv(env, 'APPDATA', platform) ?? join(home, 'AppData', 'Roaming'), 'aitop') : join(home, '.config', 'aitop');
|
|
59
|
+
}
|
|
60
|
+
throw new Error(`unknown dir kind: ${kind}`);
|
|
61
|
+
}
|
package/src/procs.mjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { readdirSync, readFileSync, readlinkSync, existsSync } from 'node:fs';
|
|
4
4
|
import { execFileSync } from 'node:child_process';
|
|
5
5
|
import { platform } from 'node:os';
|
|
6
|
+
import { exeName } from './paths.mjs';
|
|
6
7
|
|
|
7
8
|
const OS = platform();
|
|
8
9
|
const HAS_PROC = existsSync('/proc/self');
|
|
@@ -24,12 +25,15 @@ export function isAlive(pid) {
|
|
|
24
25
|
|
|
25
26
|
// ps 는 인자를 공백으로만 이어 보여 준다. 앞 두 칸(실행 파일, node 스크립트)이 없는 절대 경로면
|
|
26
27
|
// 실제로 있는 경로가 될 때까지 뒤 토큰을 이어 붙인다 (예: ~/Library/Application Support/…/codex.js).
|
|
28
|
+
// 절대 경로: /… 또는 드라이브 문자(C:\…, C:/…).
|
|
29
|
+
const isAbs = (p) => p.startsWith('/') || /^[A-Za-z]:[\\/]/.test(p);
|
|
30
|
+
|
|
27
31
|
export function joinPaths(tokens, exists = existsSync) {
|
|
28
32
|
const out = [];
|
|
29
33
|
let i = 0;
|
|
30
34
|
while (i < tokens.length) {
|
|
31
35
|
let cur = tokens[i++];
|
|
32
|
-
if (out.length < 2 && cur
|
|
36
|
+
if (out.length < 2 && isAbs(cur) && !exists(cur)) {
|
|
33
37
|
let j = i;
|
|
34
38
|
let joined = cur;
|
|
35
39
|
while (j < tokens.length && j - i < 8) {
|
|
@@ -133,7 +137,8 @@ export function findProcesses(match) {
|
|
|
133
137
|
return found.map((p) => ({ ...p, cwd: cwdOf(p.pid) }));
|
|
134
138
|
}
|
|
135
139
|
|
|
136
|
-
|
|
140
|
+
// 실행 파일 이름 (paths.mjs exeName). Windows 에서만 \ 도 나누고 .exe·.cmd 등을 뗀다 (codex.cmd, agy.exe).
|
|
141
|
+
const base = (p) => exeName(p);
|
|
137
142
|
|
|
138
143
|
// `codex` 는 node 스크립트(…/bin/codex.js)이거나 네이티브 바이너리(codex-*)로 뜬다.
|
|
139
144
|
export function isCodex(argv) {
|
|
@@ -522,7 +522,9 @@ export function cwdOf(workspaceUris) {
|
|
|
522
522
|
try {
|
|
523
523
|
const first = JSON.parse(workspaceUris || '[]')[0];
|
|
524
524
|
if (!first) return null;
|
|
525
|
-
|
|
525
|
+
const p = first.startsWith('file:') ? fileURLToPath(first) : first;
|
|
526
|
+
// Windows 의 file:///c%3A/… 는 c:\… 가 되므로 드라이브 문자를 대문자로 맞춘다 (Claude·Codex 의 C:\ 와 같은 프로젝트로 묶이게).
|
|
527
|
+
return process.platform === 'win32' ? p.replace(/^[a-z](?=:)/, (d) => d.toUpperCase()) : p;
|
|
526
528
|
} catch (e) {
|
|
527
529
|
debug('agy', 'workspace_uris parse failed', e);
|
|
528
530
|
return null;
|
package/src/sources/codex.mjs
CHANGED
|
@@ -4,18 +4,23 @@ import { join, basename } from 'node:path';
|
|
|
4
4
|
import { homedir } from 'node:os';
|
|
5
5
|
import { JsonlTail } from '../tail.mjs';
|
|
6
6
|
import { loadCache, markDirty } from '../cache.mjs';
|
|
7
|
-
import { findProcesses, isCodex, openFiles, processStart } from '../procs.mjs';
|
|
7
|
+
import { canListProcesses, findProcesses, isCodex, openFiles, processStart } from '../procs.mjs';
|
|
8
8
|
import { addActivity, emptyTokens, parseTs, pushEvent, describeTool, isNoisePrompt } 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
|
+
import { lastName } from '../paths.mjs';
|
|
13
14
|
|
|
14
15
|
// 지시 탭에 쓰는 지시 목록은 최근 것만 남긴다.
|
|
15
16
|
const MAX_TURNS = 50;
|
|
16
17
|
|
|
17
18
|
const ROOT = join(process.env.CODEX_HOME ?? join(homedir(), '.codex'), 'sessions');
|
|
18
19
|
const RECENT_MS = 24 * 3600 * 1000;
|
|
20
|
+
// 프로세스 목록을 못 얻는 OS(지금은 Windows)에서는 이 시간 안에 바뀐 기록을 실행 중으로 본다.
|
|
21
|
+
// codex 는 답할 때마다 기록에 쓰므로, 답을 읽고 다음 지시를 쓰는 동안(대개 몇 분)은 남고 닫은 세션은 곧 빠진다.
|
|
22
|
+
// Claude 팀원의 MEMBER_STALE_MS(15분)보다 짧게 둔다. 실제 프로세스가 없으니 끝난 세션이 오래 남는 쪽이 더 헷갈린다.
|
|
23
|
+
export const NO_PROC_LIVE_MS = 10 * 60_000;
|
|
19
24
|
|
|
20
25
|
const states = new Map();
|
|
21
26
|
|
|
@@ -280,11 +285,14 @@ function applyLine(st, x) {
|
|
|
280
285
|
|
|
281
286
|
export const _test = { newState, applyLine, phaseOf, snapshot };
|
|
282
287
|
|
|
283
|
-
export function collectCodex({ showEnded, budget, filesOf = openFiles, startOf = processStart }) {
|
|
284
|
-
|
|
285
|
-
|
|
288
|
+
export function collectCodex({ showEnded, budget, filesOf = openFiles, startOf = processStart, canList = canListProcesses }) {
|
|
289
|
+
// 프로세스를 못 세면 숨기지 않고 최근에 바뀐 기록으로 판정한다 (pid 는 null).
|
|
290
|
+
const blind = !canList();
|
|
291
|
+
const procs = blind ? [] : findProcesses(isCodex);
|
|
292
|
+
if (!procs.length && !showEnded && !blind) return [];
|
|
286
293
|
|
|
287
|
-
const
|
|
294
|
+
const fresh = (f) => Date.now() - f.mtime <= NO_PROC_LIVE_MS;
|
|
295
|
+
const files = blind && !showEnded ? recentFiles().filter(fresh) : recentFiles();
|
|
288
296
|
const read = (path) => {
|
|
289
297
|
let st = states.get(path);
|
|
290
298
|
if (!st) states.set(path, (st = newState(path)));
|
|
@@ -336,6 +344,8 @@ export function collectCodex({ showEnded, budget, filesOf = openFiles, startOf =
|
|
|
336
344
|
}
|
|
337
345
|
}
|
|
338
346
|
|
|
347
|
+
if (blind) for (const f of files) if (fresh(f)) liveByPath.set(f.path, null);
|
|
348
|
+
|
|
339
349
|
const seen = new Set(files.map((f) => f.path));
|
|
340
350
|
for (const path of states.keys()) if (!seen.has(path)) states.delete(path);
|
|
341
351
|
|
|
@@ -353,9 +363,9 @@ export function collectCodex({ showEnded, budget, filesOf = openFiles, startOf =
|
|
|
353
363
|
id: st.id,
|
|
354
364
|
pid: pid ?? null,
|
|
355
365
|
kind: 'interactive',
|
|
356
|
-
name:
|
|
366
|
+
name: lastName(st.cwd) || 'codex',
|
|
357
367
|
cwd: st.cwd,
|
|
358
|
-
project:
|
|
368
|
+
project: lastName(st.cwd),
|
|
359
369
|
branch: st.branch,
|
|
360
370
|
model: st.model,
|
|
361
371
|
live,
|
|
@@ -381,7 +391,7 @@ export function collectCodex({ showEnded, budget, filesOf = openFiles, startOf =
|
|
|
381
391
|
// 아직 세션 파일을 만들지 않은(첫 입력 전) codex 프로세스도 보여 준다.
|
|
382
392
|
for (const [cwd, pids] of slots) {
|
|
383
393
|
for (const pid of pids) {
|
|
384
|
-
out.push({ tool: 'codex', id: `pid-${pid}`, pid, kind: 'interactive', name:
|
|
394
|
+
out.push({ tool: 'codex', id: `pid-${pid}`, pid, kind: 'interactive', name: lastName(cwd) || 'codex', cwd, project: lastName(cwd), live: true, status: 'idle', phase: { kind: 'idle', msg: 'firstInput' }, cost: null, now: '', updatedAt: Date.now(), tokens: emptyTokens(), context: { used: 0, window: 0 }, events: [], members: [] });
|
|
385
395
|
}
|
|
386
396
|
}
|
|
387
397
|
return out;
|
package/src/sources/patch.mjs
CHANGED
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
// *** Add File: src/new.mjs (+ 줄이 본문)
|
|
7
7
|
// *** Delete File: src/old.mjs
|
|
8
8
|
// *** End Patch
|
|
9
|
-
import { isAbsolute, join } from 'node:path';
|
|
9
|
+
import { isAbsolute, join, normalize } from 'node:path';
|
|
10
|
+
|
|
11
|
+
// Windows 는 패치의 절대 경로(C:/x/y)도 \ 로 맞춰 화면에서 섞이지 않게 한다. 그 밖의 OS 는 그대로 둔다.
|
|
12
|
+
const WIN = process.platform === 'win32';
|
|
10
13
|
|
|
11
14
|
// 글 안에서 패치 부분만 꺼낸다 (예전 shell 호출은 명령 인자 안에 들어 있다).
|
|
12
15
|
// 시작·끝 표시는 줄 전체가 그 표시일 때만 본다. 본문 글에 '*** End Patch' 가 들어 있어도 끊기지 않게 한다.
|
|
@@ -22,7 +25,7 @@ export function extractPatch(text) {
|
|
|
22
25
|
export function parsePatch(text, cwd) {
|
|
23
26
|
const patch = extractPatch(text);
|
|
24
27
|
if (!patch) return [];
|
|
25
|
-
const abs = (p) => (isAbsolute(p) || !cwd ? p : join(cwd, p));
|
|
28
|
+
const abs = (p) => (isAbsolute(p) || !cwd ? (WIN ? normalize(p) : p) : join(cwd, p));
|
|
26
29
|
const out = [];
|
|
27
30
|
let cur = null;
|
|
28
31
|
let hunk = null;
|
package/src/ui/draw.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// 그리기 기본: 조각(segment) 줄 만들기·자르기·채우기, 상자, 가로줄, 게이지, 시각·금액 표기.
|
|
2
2
|
import { pad, stripControl, truncate, width } from '../text.mjs';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
|
+
import { tildeIn } from '../paths.mjs';
|
|
4
5
|
import { NO_COLOR, PALETTE, PHASE_COLOR, RESET, style } from './theme.mjs';
|
|
5
6
|
import { glyphs } from './glyphs.mjs';
|
|
6
7
|
|
|
@@ -85,7 +86,8 @@ export function money(usd, unknown = false) {
|
|
|
85
86
|
return dollars(usd);
|
|
86
87
|
}
|
|
87
88
|
|
|
88
|
-
|
|
89
|
+
// 홈 폴더로 시작하는 경로만 줄인다. Windows 는 \ 와 대소문자를 무시한다 (paths.mjs).
|
|
90
|
+
export const tilde = (p) => tildeIn(p, homedir());
|
|
89
91
|
|
|
90
92
|
export const two = (n) => String(n).padStart(2, '0');
|
|
91
93
|
|