@sejuneoh/aitop 0.34.0 → 0.35.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 +485 -92
- package/package.json +1 -1
- package/src/i18n.mjs +7 -0
- package/src/line.mjs +9 -4
- package/src/pricing.mjs +40 -7
- package/src/sources/claude.mjs +54 -33
- package/src/text.mjs +29 -0
- package/src/ui/chrome.mjs +38 -12
- package/src/ui/glyphs.mjs +7 -2
- package/src/ui/table.mjs +2 -1
package/README.md
CHANGED
|
@@ -5,153 +5,546 @@
|
|
|
5
5
|
|
|
6
6
|
**`top` for your AI coding agents.** One live terminal screen for every Claude Code, Codex CLI and Antigravity CLI session on your machine. No hooks, read-only.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
npm i -g @sejuneoh/aitop
|
|
11
|
-
|
|
8
|
+
> `npx @sejuneoh/aitop`
|
|
9
|
+
>
|
|
10
|
+
> `npm i -g @sejuneoh/aitop`
|
|
11
|
+
|
|
12
|
+
- The first line tries it with no install.
|
|
13
|
+
- The second installs it. Then just run `aitop`.
|
|
12
14
|
|
|
13
15
|

|
|
14
16
|
|
|
15
|
-
- **See who needs you.**
|
|
16
|
-
-
|
|
17
|
-
-
|
|
17
|
+
- **See who needs you.**
|
|
18
|
+
- A waiting session jumps to the top and `n` takes you there.
|
|
19
|
+
- Add `--notify=waiting,done,context` for desktop alerts, or `aitop --line` for a tmux status line.
|
|
20
|
+
- **Know which session is which.**
|
|
21
|
+
- Every row shows the session name (your `/rename` or the tool's title).
|
|
22
|
+
- `y` copies a resume command, and `--report sessions` prints yesterday's sessions with cost for your standup.
|
|
23
|
+
- **No hooks, nothing sent.**
|
|
24
|
+
- Claude Code, Codex CLI and Antigravity CLI side by side, from [several history folders](#several-claude-or-codex-profiles) (`~/.claude`, `~/.claude-work`, ...).
|
|
25
|
+
- aitop only reads the logs they already write. It changes no settings and needs no network, ports or dependencies.
|
|
18
26
|
|
|
19
|
-
**
|
|
27
|
+
**Contents**
|
|
20
28
|
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
23
|
-
- [
|
|
24
|
-
- [
|
|
29
|
+
- [Quick start](#quick-start)
|
|
30
|
+
- [Features](#features)
|
|
31
|
+
- [Subagents](#subagents) · [Daily and monthly reports](#daily-and-monthly-reports) · [Session report](#session-report) · [Call tree](#call-tree)
|
|
32
|
+
- [Notifications](#notifications) · [tmux status line](#tmux-status-line) · [Several Claude or Codex profiles](#several-claude-or-codex-profiles)
|
|
33
|
+
- [Resume a session elsewhere](#resume-a-session-elsewhere) · [JSON output](#json-output) · [Language](#language)
|
|
34
|
+
- [How it differs from similar tools](#how-it-differs-from-similar-tools) · [Install](#install) · [License](#license)
|
|
25
35
|
|
|
26
|
-
##
|
|
36
|
+
## Quick start
|
|
27
37
|
|
|
28
|
-
|
|
38
|
+
> `aitop`
|
|
29
39
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
- Live screen.
|
|
41
|
+
|
|
42
|
+
> `aitop --all`
|
|
43
|
+
|
|
44
|
+
- Include sessions that ended in the last 24 hours.
|
|
45
|
+
|
|
46
|
+
> `aitop --once`
|
|
47
|
+
|
|
48
|
+
- Print the current state once and exit.
|
|
49
|
+
|
|
50
|
+
> `aitop --json`
|
|
51
|
+
|
|
52
|
+
- Print a snapshot as JSON and exit. See [JSON output](#json-output).
|
|
53
|
+
|
|
54
|
+
> `aitop --doctor`
|
|
55
|
+
|
|
56
|
+
- Check which tools and logs aitop can see.
|
|
57
|
+
|
|
58
|
+
> `aitop --line`
|
|
35
59
|
|
|
36
|
-
|
|
60
|
+
- Print one short status line and exit (for tmux, e.g. `$54.13 wait 2 fix-login 3m run 3 $3.1/h`). See [tmux status line](#tmux-status-line).
|
|
61
|
+
|
|
62
|
+
> `aitop --report sessions`
|
|
63
|
+
|
|
64
|
+
- Yesterday's sessions with cost, for standups (`--md`, `--json`). See [Session report](#session-report).
|
|
65
|
+
|
|
66
|
+
> `aitop --help`
|
|
67
|
+
|
|
68
|
+
- All options.
|
|
69
|
+
|
|
70
|
+
**Keys on the live screen**
|
|
71
|
+
|
|
72
|
+
- `↑↓` select · `n` next session to check · `/` search · `s` sort · `g` group
|
|
73
|
+
- `p` pin · `f` changed files · `?` help · `q` quit
|
|
74
|
+
|
|
75
|
+
**Config file**
|
|
76
|
+
|
|
77
|
+
- Settings can also go in `~/.config/aitop/config.json` (`%APPDATA%\aitop\config.json` on Windows).
|
|
78
|
+
- See `aitop --help` or the [detailed manual (Korean)](https://github.com/SejuneOh/aitop/blob/main/docs/README.ko.md).
|
|
37
79
|
|
|
38
80
|
## Features
|
|
39
81
|
|
|
40
|
-
- **Live status** of every session and its subagents: thinking, running a tool, waiting for you, idle, or stopped by an error
|
|
41
|
-
-
|
|
42
|
-
- **
|
|
43
|
-
- **
|
|
44
|
-
- **
|
|
45
|
-
- **
|
|
46
|
-
- **
|
|
82
|
+
- **Live status** of every session and its subagents: thinking, running a tool, waiting for you, idle, or stopped by an error.
|
|
83
|
+
- Subagent rows show how long they have run ([details](#subagents)).
|
|
84
|
+
- **Stopped by an error**: `! Login needed`, `! Connection lost`, read from the API error lines Claude Code already logs.
|
|
85
|
+
- **Prompt cache countdown** for Claude sessions waiting on you or idle: `cache 3:12` after the status text.
|
|
86
|
+
- **Tool run time** while a session runs a tool: `Tool · Bash · 4m12s`.
|
|
87
|
+
- **Waiting alerts**: blocked sessions jump to the top, with optional bell, desktop notification or hook command.
|
|
88
|
+
- **Tokens and cost** per session and for today / last 7 days, estimated at public API list prices. This is not your bill.
|
|
89
|
+
- **Changed files and diffs** per session and per prompt.
|
|
90
|
+
- **Read-only**: no network, no ports, no dependencies. It only reads the session logs each CLI already writes.
|
|
47
91
|
|
|
48
|
-
>
|
|
92
|
+
<details>
|
|
93
|
+
<summary>Details: stopped sessions, cache countdown, tool run time</summary>
|
|
49
94
|
|
|
50
|
-
|
|
95
|
+
**Stopped by an error**
|
|
51
96
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
aitop --json print a snapshot as JSON and exit
|
|
56
|
-
aitop --doctor check which tools and logs aitop can see
|
|
57
|
-
aitop --line print one short status line and exit (for tmux, e.g. $54.13 wait 2 fix-login 3m run 3 $3.1/h)
|
|
58
|
-
aitop --report daily daily cost table and exit
|
|
59
|
-
aitop --report monthly monthly cost table (last 12 months) and exit
|
|
60
|
-
aitop --report sessions yesterday's sessions with cost, for standups (--md, --json)
|
|
61
|
-
aitop --report trace <session> call tree of one Claude Code session with cost per tool call (--md, --json)
|
|
62
|
-
aitop --help all options
|
|
63
|
-
aitop --lang ko Korean screen, help, doctor and error messages (also AITOP_LANG=ko or "lang": "ko" in the config file)
|
|
64
|
-
```
|
|
97
|
+
- It sorts right under waiting and pinned sessions.
|
|
98
|
+
- It is counted on its own as `! 1 stopped` in the header, the window title (`(2◆ 1! 1●)`), `n` and `--line`.
|
|
99
|
+
- It never counts as done.
|
|
65
100
|
|
|
66
|
-
|
|
101
|
+
**Prompt cache countdown**
|
|
67
102
|
|
|
68
|
-
|
|
103
|
+
- Warning color under a minute, dim `cache expired` after.
|
|
104
|
+
- Estimated from the log's `cache_creation` 5m/1h tokens and the last request start, per the [prompt caching docs](https://platform.claude.com/docs/en/build-with-claude/prompt-caching).
|
|
105
|
+
- Dropped first on narrow screens, except under a minute, when the status text is shortened instead.
|
|
106
|
+
- `--json` has `cacheExpiresAt`.
|
|
69
107
|
|
|
70
|
-
|
|
108
|
+
**Tool run time**
|
|
71
109
|
|
|
72
|
-
|
|
110
|
+
- Measured from the open tool call's start (Claude `tool_use`, Codex `function_call`, Antigravity running step).
|
|
111
|
+
- Shown after one minute, in a dim warning color from ten minutes (Claude Code's Bash timeout max).
|
|
112
|
+
- Not counted while waiting for approval.
|
|
113
|
+
- Dropped first on narrow screens; `--json` has `toolStartedAt`.
|
|
73
114
|
|
|
74
|
-
|
|
115
|
+
</details>
|
|
75
116
|
|
|
76
|
-
|
|
117
|
+
## Subagents
|
|
77
118
|
|
|
78
|
-
|
|
119
|
+
Subagents show as `├─` rows under their session, on the live screen.
|
|
79
120
|
|
|
80
|
-
|
|
121
|
+
> `aitop`
|
|
81
122
|
|
|
82
|
-
|
|
123
|
+
- While one works, its row shows how long it has run, marked with `◷` so it is not read as IDLE (`◷42s`, `◷3m12s`, `◷1h05m`; `~3m12s` with `AITOP_AMBIGUOUS=wide`).
|
|
124
|
+
- A dim `stalled?` appears when a working subagent's log has not changed for 3 minutes. It is only a guess.
|
|
125
|
+
- While it runs a tool that can be slow, the limit is 10 minutes.
|
|
126
|
+
- When an Antigravity subagent waits for your approval, its parent row waits too, as `<agent>: <tool>`.
|
|
83
127
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
aitop --report daily --by project --days 7
|
|
87
|
-
```
|
|
128
|
+
<details>
|
|
129
|
+
<summary>Details: <code>stalled?</code> and Antigravity waits</summary>
|
|
88
130
|
|
|
89
|
-
|
|
131
|
+
**`stalled?`**
|
|
90
132
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
133
|
+
- Slow tools: Bash, PowerShell, a nested agent, web fetch or search, an MCP tool, agy `run_command`.
|
|
134
|
+
- It never shows while the session waits for you.
|
|
135
|
+
- It does not change sorting, alerts, the window title or `--line`.
|
|
136
|
+
- `--json` has it per member as `stalled`, with `startedAt` and `lastActivityAt`.
|
|
94
137
|
|
|
95
|
-
|
|
138
|
+
**Antigravity subagent waits**
|
|
96
139
|
|
|
97
|
-
|
|
140
|
+
- The session jumps to the top and counts for `n`, `--notify` and `--line`.
|
|
141
|
+
- If the parent waits itself, its own wait shows first.
|
|
142
|
+
- Other waiting subagents show on their own rows.
|
|
98
143
|
|
|
99
|
-
|
|
144
|
+
</details>
|
|
100
145
|
|
|
101
|
-
|
|
146
|
+
## Daily and monthly reports
|
|
102
147
|
|
|
103
|
-
|
|
104
|
-
aitop --report sessions --md --plan 200
|
|
105
|
-
aitop --report sessions --since 7d --json
|
|
106
|
-
```
|
|
148
|
+
Tokens and cost (API list price, like the header) per day or per month, newest first, with a total row, then exit.
|
|
107
149
|
|
|
108
|
-
|
|
150
|
+
> `aitop --report daily`
|
|
151
|
+
>
|
|
152
|
+
> `aitop --report daily --by model --days 14`
|
|
153
|
+
>
|
|
154
|
+
> `aitop --report daily --by project --days 7`
|
|
155
|
+
>
|
|
156
|
+
> `aitop --report monthly --by model --months 6`
|
|
109
157
|
|
|
110
|
-
`aitop --report
|
|
158
|
+
- `aitop --report daily`: daily cost table and exit.
|
|
159
|
+
- `aitop --report monthly [--by tool|model|project] [--months N] [--json]`: monthly cost table (last 12 months) and exit, for up to 12 months.
|
|
160
|
+
- `--by`: columns per tool by default, per model with `--by model`, or per project with `--by project`.
|
|
161
|
+
- `--days N`: goes back up to 30 days.
|
|
162
|
+
- `--json`: the same numbers for scripts.
|
|
111
163
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
aitop --report trace 1a2b3c4d --json
|
|
115
|
-
```
|
|
164
|
+
<details>
|
|
165
|
+
<summary>Details: projects, first run, monthly archive</summary>
|
|
116
166
|
|
|
117
|
-
|
|
167
|
+
**Project columns**
|
|
118
168
|
|
|
119
|
-
|
|
169
|
+
- A project is the last folder name of the working directory: Claude log `cwd`, Codex `turn_context.cwd`, agy workspace.
|
|
170
|
+
- Claude Code worktrees under `<repo>/.claude/worktrees/` count as the repo.
|
|
171
|
+
- `(unknown)` when missing.
|
|
172
|
+
- Extra columns beyond the terminal width are merged into `(others)`; `--json` lists all with a `paths` map.
|
|
173
|
+
|
|
174
|
+
**First run**
|
|
120
175
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
176
|
+
- The first daily run reads up to 30 days of logs, so it can take a while (progress shows on stderr).
|
|
177
|
+
- Later runs use the cache.
|
|
178
|
+
|
|
179
|
+
**Monthly archive**
|
|
180
|
+
|
|
181
|
+
- Past days are folded into `monthly.json` in the cache folder (`~/.cache/aitop`, outside the versioned cache) about two days later.
|
|
182
|
+
- So monthly totals survive cache rebuilds and Claude Code deleting old transcripts.
|
|
183
|
+
- The first monthly run reads up to a year of remaining logs once.
|
|
184
|
+
- `*` marks this month.
|
|
185
|
+
- `~` marks a month only partly counted (for example before the oldest remaining Claude log).
|
|
186
|
+
- `no data` marks a month with neither logs nor archive (unknown, not zero).
|
|
187
|
+
- The archive keeps token counts per type, so costs are recomputed when the price table changes.
|
|
188
|
+
- In `--json`, rows have `month`, `current` and `status` (`complete`, `partial` or `missing`).
|
|
189
|
+
- With several history folders, see the monthly rule in [Several Claude or Codex profiles](#several-claude-or-codex-profiles).
|
|
190
|
+
|
|
191
|
+
</details>
|
|
192
|
+
|
|
193
|
+
## Session report
|
|
194
|
+
|
|
195
|
+
Every session that used tokens in the period, highest cost first, for standups.
|
|
196
|
+
|
|
197
|
+
> `aitop --report sessions`
|
|
198
|
+
>
|
|
199
|
+
> `aitop --report sessions --md --plan 200`
|
|
200
|
+
>
|
|
201
|
+
> `aitop --report sessions --since 7d --json`
|
|
202
|
+
|
|
203
|
+
- Full form: `aitop --report sessions [--since yesterday|today|Nd|YYYY-MM-DD] [--plan USD] [--md|--json] [--show-prompts]`.
|
|
204
|
+
- `--since`: default is since midnight yesterday; at most 30 days back.
|
|
205
|
+
- `--plan 200`: adds how many times the period's share of a $200/month subscription (period days / 30) you used. Still in API list price and not your bill.
|
|
206
|
+
- `--md`: Markdown you can paste (`|` and line breaks escaped).
|
|
207
|
+
- `--json`: the same numbers for scripts.
|
|
208
|
+
- `--show-prompts`: first prompts are hidden unless you pass it, so they do not end up in shared output (session names still show).
|
|
209
|
+
- A summary card on top shows the total, the share per tool and the session count.
|
|
210
|
+
- The card's last line totals the waits (`Agents waited for you 1h12m (estimate)`).
|
|
211
|
+
|
|
212
|
+
<details>
|
|
213
|
+
<summary>Details: columns</summary>
|
|
214
|
+
|
|
215
|
+
- Tool.
|
|
216
|
+
- Main model (`+N` more).
|
|
217
|
+
- Project (same rule as `--by project`).
|
|
218
|
+
- Session name: your `/rename` name, then the tool's title, then the folder.
|
|
219
|
+
- Start and end of activity within the period.
|
|
220
|
+
- Time the agent waited for you (see below).
|
|
221
|
+
- Tokens.
|
|
222
|
+
- Cost (API list price). Unpriced models are left out, not guessed, and `--json` marks them with `unpriced`.
|
|
223
|
+
- Files changed (`-` when unknown, always for agy).
|
|
224
|
+
- Claude subagents are counted in their parent session.
|
|
225
|
+
|
|
226
|
+
</details>
|
|
227
|
+
|
|
228
|
+
<details>
|
|
229
|
+
<summary>Details: how "waited" is estimated</summary>
|
|
230
|
+
|
|
231
|
+
- Waited is an **estimate**: the sum of gaps from the agent's last line (reply or tool result) to your next input.
|
|
232
|
+
- Inputs for Claude: prompts you typed (slash commands included) and answers you picked in a permission dialog or AskUserQuestion.
|
|
233
|
+
- Inputs for Codex: `user_message`.
|
|
234
|
+
- Prompts queued while the agent worked and background task notifications do not count.
|
|
235
|
+
- An interrupt restarts the clock.
|
|
236
|
+
- The logs do not say whether you were at the screen, so **time away cannot be told apart** from waiting.
|
|
237
|
+
- Each gap counts for at most 2 hours, so a session left open overnight does not swamp the total.
|
|
238
|
+
- A Claude permission dialog's start time is not logged. The gap runs from the tool call to its result and includes the tool's run time after approval.
|
|
239
|
+
- Codex does not log approvals, so only prompts count there.
|
|
240
|
+
- Gaps crossing the period start count only the part inside.
|
|
241
|
+
- Subagents are not counted (parent session only).
|
|
242
|
+
- Each session is summed on its own, so with sessions running side by side the total can exceed wall-clock time.
|
|
243
|
+
- agy shows `-`.
|
|
244
|
+
- `--json` has `waitedMs` (milliseconds, `null` when unknown) per session and in `summary`.
|
|
245
|
+
|
|
246
|
+
</details>
|
|
247
|
+
|
|
248
|
+
## Call tree
|
|
249
|
+
|
|
250
|
+
The call tree of one Claude Code session with cost per tool call: each prompt, the tool calls under it and subagents under their `Agent`/`Task` call.
|
|
251
|
+
|
|
252
|
+
> `aitop --report trace fix-login`
|
|
253
|
+
>
|
|
254
|
+
> `aitop --report trace 1a2b3c4d --json`
|
|
255
|
+
|
|
256
|
+
- Full form: `aitop --report trace <session> [--md|--json] [--show-prompts]`.
|
|
257
|
+
- Each line has duration, tokens and estimated cost (API list price).
|
|
258
|
+
- `<session>`: the start of its id (as in `--json` and the resume command), a log file path, or a `/rename` name or title.
|
|
259
|
+
- `--md`, `--json`: Markdown or JSON output.
|
|
260
|
+
- `--show-prompts`: commands, paths and prompt text are hidden unless you pass it. Secrets are masked either way.
|
|
261
|
+
- It reads the log once and writes nothing.
|
|
262
|
+
- Codex and Antigravity sessions are not supported yet.
|
|
263
|
+
|
|
264
|
+
<details>
|
|
265
|
+
<summary>Details: cost split, folding, markers</summary>
|
|
266
|
+
|
|
267
|
+
- A tool line gets the cost of the reply that called it, split across the tools that reply called.
|
|
268
|
+
- Subagent and prompt lines total their whole branch.
|
|
269
|
+
- Totals can differ slightly from the session cost in other reports (subagent lines in very old logs are not placed in the tree).
|
|
270
|
+
- Repeated calls of one tool are grouped (`Grep ×38`).
|
|
271
|
+
- Branches deeper than a subagent's own steps are folded.
|
|
272
|
+
- Past 300 lines, the oldest prompts, and then the earliest steps inside a prompt or subagent, are left out and marked `N earlier steps left out`.
|
|
273
|
+
- Failed calls show `✗`, calls without a result yet `●`.
|
|
274
|
+
- `(no result)` shows when a later prompt came first or the log has not changed for over 15 minutes.
|
|
275
|
+
|
|
276
|
+
</details>
|
|
277
|
+
|
|
278
|
+
## Notifications
|
|
279
|
+
|
|
280
|
+
Alerts when a session starts waiting, finishes a long turn or fills its context. Off by default and only on the live screen.
|
|
281
|
+
|
|
282
|
+
> `aitop --notify`
|
|
283
|
+
>
|
|
284
|
+
> `aitop --notify=waiting,done,context`
|
|
285
|
+
>
|
|
286
|
+
> `aitop --on-waiting 'my-hook.sh'`
|
|
287
|
+
|
|
288
|
+
- `--notify`: desktop notification when a session starts waiting (notify-send on Linux, Windows notification on WSL, osascript on macOS).
|
|
289
|
+
- `--notify=waiting,done,context`: pick the kinds. Plain `--notify` uses the config file kinds, or waiting only when none are set.
|
|
290
|
+
- `--on-waiting`: run a command with `/bin/sh -c` for the same events (10 second limit, runs as you).
|
|
291
|
+
- Sessions already waiting (or already over 90% context) when aitop starts are not reported.
|
|
292
|
+
|
|
293
|
+
**Kinds**
|
|
126
294
|
|
|
127
295
|
- `waiting`: a session starts waiting for your approval or answer.
|
|
128
|
-
- `done`: a session that was busy for over 3 minutes in one turn (config `doneMinutes`; time spent waiting for approval does not count) goes idle and stays idle for 5 seconds.
|
|
129
|
-
- `context`: context use passes 90%, once
|
|
296
|
+
- `done`: a session that was busy for over 3 minutes in one turn (config `doneMinutes`; time spent waiting for approval does not count) goes idle and stays idle for 5 seconds. Once per turn.
|
|
297
|
+
- `context`: context use passes 90%, once. It re-arms after it drops below 85% (for example after compaction).
|
|
298
|
+
|
|
299
|
+
<details>
|
|
300
|
+
<summary>Details: <code>done</code> exceptions, hook, config file</summary>
|
|
301
|
+
|
|
302
|
+
**Not reported as `done`**
|
|
303
|
+
|
|
304
|
+
- Brief idle gaps between tool calls, approval waits, ended sessions and subagents.
|
|
305
|
+
- Sessions stopped by an API error and sessions whose status is guessed from file times.
|
|
306
|
+
|
|
307
|
+
**Hook**
|
|
130
308
|
|
|
131
|
-
The hook keeps its name
|
|
309
|
+
- The hook keeps its name (`--on-waiting`) for all kinds.
|
|
310
|
+
- It gets `AITOP_EVENT` (`waiting`, `done` or `context`) in its environment.
|
|
311
|
+
- It also gets `AITOP_TOOL`, `AITOP_PROJECT`, `AITOP_SESSION_ID`, `AITOP_CWD` and `AITOP_WAITING_FOR`.
|
|
132
312
|
|
|
133
|
-
|
|
313
|
+
**Config file and switches**
|
|
134
314
|
|
|
135
|
-
|
|
315
|
+
- `"notify": true` or `"notify": ["waiting", "done", "context"]`.
|
|
316
|
+
- `"onWaiting": "..."` (the file must be `chmod 600`).
|
|
317
|
+
- `"doneMinutes": 5`.
|
|
318
|
+
- Plain `--notify` keeps the kinds from the config `notify` list (waiting only when there is none).
|
|
319
|
+
- `--no-notify` turns off only the desktop notification: the hook still follows those kinds.
|
|
320
|
+
- `--bell` stays waiting only.
|
|
136
321
|
|
|
137
|
-
|
|
322
|
+
</details>
|
|
138
323
|
|
|
139
|
-
|
|
324
|
+
<details>
|
|
325
|
+
<summary>Details: WSL, D-Bus, notification text</summary>
|
|
140
326
|
|
|
141
|
-
|
|
327
|
+
- On WSL, aitop shows a Windows notification through `powershell.exe` (as Windows PowerShell, no setup needed).
|
|
328
|
+
- It falls back to notify-send when `powershell.exe` is not on the PATH.
|
|
329
|
+
- notify-send needs a D-Bus session bus. When `DBUS_SESSION_BUS_ADDRESS` is unset or its socket file is missing, notifications cannot show and `--doctor` marks the line with `!`.
|
|
330
|
+
- A missing tool or a failed notification is skipped quietly.
|
|
331
|
+
- The body shows the session's own name when it has one (Claude Code `/rename`, or a name given by a peer session; Codex `thread_name`), otherwise the project.
|
|
332
|
+
- Desktop notifications can appear on the lock screen, so the name is visible there too.
|
|
333
|
+
|
|
334
|
+
</details>
|
|
335
|
+
|
|
336
|
+
## tmux status line
|
|
337
|
+
|
|
338
|
+
One short status line for tmux, then exit.
|
|
339
|
+
|
|
340
|
+
> `aitop --line`
|
|
341
|
+
>
|
|
342
|
+
> `aitop --line=tmux`
|
|
142
343
|
|
|
143
344
|
```tmux
|
|
144
345
|
set -g status-right '#(aitop --line=tmux)'
|
|
145
346
|
set -g status-interval 15
|
|
146
347
|
```
|
|
147
348
|
|
|
148
|
-
|
|
349
|
+
**What it shows** (items that are 0 are left out)
|
|
350
|
+
|
|
351
|
+
- Today's cost (API list price, `/$<budget>` when a daily budget is set).
|
|
352
|
+
- The sessions waiting for you, with the longest waiting one's name and wait time: `wait fix-login 3m` for one, `wait 2 fix-login 3m` for more.
|
|
353
|
+
- The Claude Code sessions stopped by an API error (`stop 1`, read live).
|
|
354
|
+
- The number of sessions running (`run 3`).
|
|
355
|
+
- Spend over the last hour.
|
|
356
|
+
|
|
357
|
+
**Options**
|
|
358
|
+
|
|
359
|
+
- `--line=tmux`: adds tmux colors. `NO_COLOR` turns them off.
|
|
360
|
+
- `--line-width N` (default 40): drops items from the end.
|
|
361
|
+
- In tmux always use `--line=tmux`: it escapes `#` in session names.
|
|
362
|
+
|
|
363
|
+
<details>
|
|
364
|
+
<summary>Details: width, cache, escaping</summary>
|
|
365
|
+
|
|
366
|
+
**Waiting and width**
|
|
367
|
+
|
|
368
|
+
- Waiting sessions are read live for Claude Code. Names are cut to 12 columns with `~`.
|
|
369
|
+
- The waiting name goes before the waiting count, after `stop`.
|
|
370
|
+
- With a daily budget and a waiting name, `$/h` often does not fit in 40, so raise `--line-width` to keep it.
|
|
371
|
+
|
|
372
|
+
**Cache**
|
|
373
|
+
|
|
374
|
+
- It reads only aitop's cache, so it is fast once `aitop` has run before.
|
|
375
|
+
- With no cache yet it prints `...` after about 1.5 seconds.
|
|
376
|
+
- The running count (and waiting Antigravity sessions with their names) come from a small summary that the live screen, `--once` and `--json` write to the cache.
|
|
377
|
+
- When no summary is newer than 60 seconds, `run` is left out rather than shown wrong.
|
|
378
|
+
|
|
379
|
+
**Escaping**
|
|
380
|
+
|
|
381
|
+
- Session names come from your sessions. Plain output could let tmux expand a `#{...}` or `#(...)` inside a name.
|
|
382
|
+
- In a zsh prompt with `PROMPT_SUBST`, a `%` in a name can be expanded by zsh.
|
|
383
|
+
- So escape `%` (for example `${$(aitop --line)//\%/%%}`) or use the line only in tmux.
|
|
384
|
+
|
|
385
|
+
</details>
|
|
386
|
+
|
|
387
|
+
## Several Claude or Codex profiles
|
|
388
|
+
|
|
389
|
+
aitop reads `~/.claude` and `~/.codex` by default. List more profiles to read them too.
|
|
390
|
+
|
|
391
|
+
> `AITOP_CLAUDE_DIRS=~/.claude:~/.claude-work aitop`
|
|
392
|
+
>
|
|
393
|
+
> `aitop --print-config`
|
|
394
|
+
>
|
|
395
|
+
> `aitop --doctor`
|
|
396
|
+
|
|
397
|
+
- Config file: `"claudeDirs": ["~/.claude", "~/.claude-work"]` and `"codexHomes": ["~/.codex", "~/.codex-alt"]`.
|
|
398
|
+
- Or set `AITOP_CLAUDE_DIRS` / `AITOP_CODEX_HOMES` with paths joined by `:` (`;` on Windows).
|
|
399
|
+
- Order: `AITOP_*` > config file > an inherited `CLAUDE_CONFIG_DIR` / `CODEX_HOME` > default.
|
|
400
|
+
- `aitop --print-config` shows which source is used.
|
|
401
|
+
- `aitop --doctor` lists every folder it reads, plus folders that hold logs but are not read, with how to add them.
|
|
402
|
+
|
|
403
|
+
<details>
|
|
404
|
+
<summary>Details: paths, duplicates, monthly reports, look-alike folders</summary>
|
|
405
|
+
|
|
406
|
+
- Because of the order, a `CLAUDE_CONFIG_DIR` exported for Claude Code does not hide your config list.
|
|
407
|
+
- A value that is itself an existing folder is never split, so an old single path containing `:` keeps working.
|
|
408
|
+
- The same folder listed twice (also through a link) is read once.
|
|
409
|
+
- A session log copied into two folders is counted once.
|
|
410
|
+
- For monthly reports, a month counts as complete only from the day after the oldest remaining log of the folder that was cleaned most recently.
|
|
411
|
+
- So a folder with old logs cannot make a month look complete when another folder already lost logs for it.
|
|
412
|
+
- aitop does not read look-alike folders on its own.
|
|
413
|
+
- `--doctor` reports as not read: `~/.claude-*`, `~/.config/claude`, `~/.codex-*` and similar owned by you, and a `CLAUDE_CONFIG_DIR` / `CODEX_HOME` the config list left out.
|
|
414
|
+
|
|
415
|
+
</details>
|
|
416
|
+
|
|
417
|
+
## Resume a session elsewhere
|
|
418
|
+
|
|
419
|
+
Continue a session elsewhere, for example when you cannot jump to its tab, as in Windows Terminal with WSL. The detail panel shows a `Resume` command and `y` copies it.
|
|
420
|
+
|
|
421
|
+
> Claude: `cd <dir> && claude --resume <id>`
|
|
422
|
+
>
|
|
423
|
+
> Codex: `cd <dir> && codex resume <id>`
|
|
424
|
+
>
|
|
425
|
+
> Antigravity: `cd <dir> && agy --conversation <id>`
|
|
426
|
+
|
|
427
|
+
- None for Gemini CLI.
|
|
428
|
+
- `y` copies the command to the clipboard with OSC 52.
|
|
429
|
+
- `--json` has the same command as `resumeCmd` per session (`null` if none).
|
|
430
|
+
- Nothing is sent to the session.
|
|
431
|
+
|
|
432
|
+
<details>
|
|
433
|
+
<summary>Details: data folders, when no command is made, clipboard</summary>
|
|
434
|
+
|
|
435
|
+
**Data folders**
|
|
436
|
+
|
|
437
|
+
- A session from a data folder other than `~/.claude` / `~/.codex` gets `CLAUDE_CONFIG_DIR=<dir>` / `CODEX_HOME=<dir>` before the tool, so it finds the right history.
|
|
438
|
+
- The same happens for any session while `CLAUDE_CONFIG_DIR` / `CODEX_HOME` is set.
|
|
439
|
+
|
|
440
|
+
**When no command is made**
|
|
441
|
+
|
|
442
|
+
- Claude finds sessions per folder, so without a known folder no command is made.
|
|
443
|
+
- Ids that are not UUIDs make none either.
|
|
444
|
+
- A short detail panel leaves the command out; use `y` or `--json` then.
|
|
445
|
+
- Paths and ids are shell quoted and control characters are stripped.
|
|
446
|
+
|
|
447
|
+
**Clipboard (OSC 52)**
|
|
448
|
+
|
|
449
|
+
- Windows Terminal, WezTerm, iTerm2 and kitty accept OSC 52.
|
|
450
|
+
- tmux needs `set -g set-clipboard on`.
|
|
451
|
+
- Other terminals ignore it silently, so copy the command from the panel.
|
|
452
|
+
|
|
453
|
+
</details>
|
|
454
|
+
|
|
455
|
+
## JSON output
|
|
456
|
+
|
|
457
|
+
> `aitop --json`
|
|
458
|
+
>
|
|
459
|
+
> `aitop --doctor --json`
|
|
460
|
+
|
|
461
|
+
- `--json` prints a snapshot as JSON and exits.
|
|
462
|
+
- For scripts, use `phaseKind`, a stable state name: `think`, `write`, `tool`, `team`, `waiting`, `idle`, `stopped`, `done`, `ended` (or `null`).
|
|
463
|
+
- `stopReason` says why a session is `stopped`: `{ "kind": "auth" }` login needed, `network` connection lost, `api` any other API error. `null` otherwise.
|
|
464
|
+
|
|
465
|
+
<details>
|
|
466
|
+
<summary>Details: text fields and where other fields are described</summary>
|
|
467
|
+
|
|
468
|
+
**Text fields**
|
|
469
|
+
|
|
470
|
+
- `phase` stays the Korean status text in every language (as does `AITOP_WAITING_FOR` for `--on-waiting`).
|
|
471
|
+
- Session `name` uses the same user-given names as the table.
|
|
472
|
+
- A Codex session's `name` changes from the folder name to its `thread_name` once it has one.
|
|
473
|
+
- `stopped` is an idle Claude session whose last log entry is an API error.
|
|
474
|
+
- Other text fields follow their own rules: with English selected, `--doctor --json` has Korean `tools.*.hint` but English `config.problems`.
|
|
475
|
+
|
|
476
|
+
**Other fields**
|
|
477
|
+
|
|
478
|
+
- `cacheExpiresAt`, `toolStartedAt`: [Features](#features).
|
|
479
|
+
- `stalled`, `startedAt`, `lastActivityAt`: [Subagents](#subagents).
|
|
480
|
+
- `resumeCmd`: [Resume a session elsewhere](#resume-a-session-elsewhere).
|
|
481
|
+
- Report output (`month`, `current`, `status`, `paths`, `unpriced`, `waitedMs`): [Daily and monthly reports](#daily-and-monthly-reports), [Session report](#session-report).
|
|
482
|
+
|
|
483
|
+
</details>
|
|
484
|
+
|
|
485
|
+
## Language
|
|
486
|
+
|
|
487
|
+
The UI follows your locale: English by default, Korean when the locale starts with `ko`.
|
|
488
|
+
|
|
489
|
+
> `aitop --lang ko`
|
|
490
|
+
>
|
|
491
|
+
> `AITOP_LANG=ko aitop`
|
|
492
|
+
|
|
493
|
+
- `--lang ko`: Korean screen, help, doctor and error messages.
|
|
494
|
+
- Set `AITOP_LANG=ko|en` (or `--lang`) to pick one, or `"lang": "ko"` in the config file.
|
|
495
|
+
- It covers the live screen, `--once`, `--help`, `--doctor`, error messages and desktop notifications.
|
|
496
|
+
- Keys and options work the same in both.
|
|
497
|
+
|
|
498
|
+
<details>
|
|
499
|
+
<summary>Details: how the language is picked</summary>
|
|
500
|
+
|
|
501
|
+
- Order: `--lang`, then `AITOP_LANG`, then `lang` in the config file, then `LC_ALL`, `LC_MESSAGES` and `LANG`.
|
|
502
|
+
- Korean when the locale starts with `ko`, English otherwise (including `C.UTF-8` and unset).
|
|
503
|
+
- If you used aitop on a `C.UTF-8` or `en_US` locale before, the screen, help and doctor output are now in English.
|
|
504
|
+
- Set `AITOP_LANG=ko` to keep Korean.
|
|
505
|
+
|
|
506
|
+
</details>
|
|
507
|
+
|
|
508
|
+
## How it differs from similar tools
|
|
509
|
+
|
|
510
|
+
- [ccusage](https://github.com/ryoppippi/ccusage)
|
|
511
|
+
- Reports token usage and cost from local logs (daily, monthly, session, 5-hour blocks).
|
|
512
|
+
- aitop is a live session monitor first, with smaller cost reports on the side.
|
|
513
|
+
- [abtop](https://github.com/graykode/abtop)
|
|
514
|
+
- A Rust live dashboard for Claude Code, Codex CLI and OpenCode, with rate limits, ports and keys to kill sessions.
|
|
515
|
+
- aitop installs with npm, also covers Antigravity, and only watches.
|
|
516
|
+
- [claude-code-monitor](https://github.com/onikan27/claude-code-monitor)
|
|
517
|
+
- Watches Claude Code on macOS through hooks it adds to `~/.claude/settings.json`, with a phone web view.
|
|
518
|
+
- aitop adds no hooks and only reads existing logs, on Linux, macOS, WSL and Windows.
|
|
519
|
+
- [Agents Stack](https://marketplace.visualstudio.com/items?itemName=MykD.agents-stack)
|
|
520
|
+
- A VS Code extension for Claude Code, Antigravity, Codex and Gemini CLI.
|
|
521
|
+
- It adds hooks to each agent's config. Antigravity has no hook for approval waits, so those do not show.
|
|
522
|
+
- aitop runs in any terminal, adds no hooks and shows Antigravity sessions waiting for approval.
|
|
523
|
+
|
|
524
|
+
## Install
|
|
525
|
+
|
|
526
|
+
Requires Node.js 22+ on Linux, macOS, WSL or Windows.
|
|
527
|
+
|
|
528
|
+
> `npx @sejuneoh/aitop`
|
|
529
|
+
>
|
|
530
|
+
> `npm install -g @sejuneoh/aitop`
|
|
531
|
+
>
|
|
532
|
+
> `aitop`
|
|
533
|
+
|
|
534
|
+
- `npx` runs the latest version without installing.
|
|
535
|
+
- `npm install -g` installs it. Then run `aitop`.
|
|
149
536
|
|
|
150
|
-
|
|
537
|
+
<details>
|
|
538
|
+
<summary>Windows: what works and what does not yet</summary>
|
|
151
539
|
|
|
152
|
-
|
|
540
|
+
- Native Windows support is early (Windows Terminal recommended).
|
|
541
|
+
- Works: Claude Code and Codex sessions, `--once`, `--json`, `--report` and `--doctor`.
|
|
542
|
+
- Not there yet: process detection, desktop notifications and `--on-waiting` ([#195](https://github.com/SejuneOh/aitop/issues/195)-[#197](https://github.com/SejuneOh/aitop/issues/197)).
|
|
543
|
+
- Until then a Codex session counts as running while its log was written in the last 10 minutes.
|
|
544
|
+
- 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.
|
|
545
|
+
- Cache, log and config live in `%LOCALAPPDATA%\aitop\cache`, `%LOCALAPPDATA%\aitop\state` and `%APPDATA%\aitop` unless `XDG_*` is set.
|
|
153
546
|
|
|
154
|
-
|
|
547
|
+
</details>
|
|
155
548
|
|
|
156
549
|
## License
|
|
157
550
|
|
package/package.json
CHANGED
package/src/i18n.mjs
CHANGED
|
@@ -460,6 +460,8 @@ export const STRINGS = {
|
|
|
460
460
|
'empty.or': ' 또는 ',
|
|
461
461
|
|
|
462
462
|
'foot.help': '도움',
|
|
463
|
+
// 폭이 모자라 키 안내가 빠졌을 때 ? 칩 라벨.
|
|
464
|
+
'foot.helpAll': '키 전체',
|
|
463
465
|
'foot.closeHelp': '도움 닫기',
|
|
464
466
|
'foot.readOnly': '⊘ 읽기전용',
|
|
465
467
|
'foot.count': '{n}개',
|
|
@@ -505,6 +507,8 @@ export const STRINGS = {
|
|
|
505
507
|
'legend.cache': '캐시 남은 시간 (추정). 1분 미만은 굵은 경고색',
|
|
506
508
|
'legend.toolKey': '· 4m12s',
|
|
507
509
|
'legend.tool': '도구가 돈 시간 (1분부터). 10분 넘으면 경고색',
|
|
510
|
+
'legend.elapsedKey': '{g}3m12s',
|
|
511
|
+
'legend.elapsed': '팀원 행 끝: 팀원이 일을 시작한 뒤 지난 시간',
|
|
508
512
|
'legend.stalledKey': '멈춘 듯',
|
|
509
513
|
'legend.stalled': '팀원 기록이 3분(느린 도구 10분) 그대로. 짐작',
|
|
510
514
|
'legend.status': '지금 단계. 큰 기록을 처음 읽는 동안은 기록 읽는 중 N%',
|
|
@@ -911,6 +915,7 @@ export const STRINGS = {
|
|
|
911
915
|
'empty.or': ' or ',
|
|
912
916
|
|
|
913
917
|
'foot.help': 'help',
|
|
918
|
+
'foot.helpAll': 'all keys',
|
|
914
919
|
'foot.closeHelp': 'close help',
|
|
915
920
|
'foot.readOnly': '⊘ read-only',
|
|
916
921
|
'foot.count': '{n} found',
|
|
@@ -956,6 +961,8 @@ export const STRINGS = {
|
|
|
956
961
|
'legend.cache': 'Cache time left (estimate). Bold under 1 min',
|
|
957
962
|
'legend.toolKey': '· 4m12s',
|
|
958
963
|
'legend.tool': 'Tool run time (from 1 min). Warning at 10 min',
|
|
964
|
+
'legend.elapsedKey': '{g}3m12s',
|
|
965
|
+
'legend.elapsed': 'Subagent row end: time since it started',
|
|
959
966
|
'legend.stalledKey': 'stalled?',
|
|
960
967
|
'legend.stalled': 'No log change 3 min (slow tools 10). A guess',
|
|
961
968
|
'legend.status': 'Current step (Reading log N% on first load)',
|
package/src/line.mjs
CHANGED
|
@@ -10,6 +10,8 @@ export const MODES = ['plain', 'tmux'];
|
|
|
10
10
|
export const DEFAULT_WIDTH = 40;
|
|
11
11
|
// 캐시가 없을 때(처음 실행) 장부를 읽는 시간 상한. 넘으면 '...' 만 내고 끝낸다 (tmux 를 오래 막지 않게).
|
|
12
12
|
export const CAP_MS = 1500;
|
|
13
|
+
// 멈춤 수를 세는 데(지시 대기 세션의 기록 끝 읽기) 장부 뒤에 남겨 두는 최소 시간.
|
|
14
|
+
export const STOP_MIN_MS = 300;
|
|
13
15
|
// 캐시가 없거나 시간 상한을 넘었을 때 내는 글.
|
|
14
16
|
export const PENDING = '...';
|
|
15
17
|
// 기다리는 세션 이름의 최대 폭 (칸). 기본 폭 40 에 오늘 비용·예산·대기(이름과 시간)·작업 중이 함께 들어가는 길이.
|
|
@@ -82,7 +84,7 @@ function waitTexts(waiting, longest, now) {
|
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
// 값: today(오늘 비용, API 정가 환산), budgetDay(하루 예산, 없으면 null), waiting(응답 대기 수),
|
|
85
|
-
// longest(가장 오래 기다린 세션 { name, since }, 모르면 null), stopped(오류로 멈춘 세션
|
|
87
|
+
// longest(가장 오래 기다린 세션 { name, since }, 모르면 null), stopped(오류로 멈춘 세션 수, 시간 안에 다 세지 못했으면 null), running(작업 중 수, 요약이 없거나 오래됐으면 null), perHour(최근 1시간 지출).
|
|
86
88
|
// 0 인 항목은 뺀다. 오늘 비용이 0 이어도 예산이 있으면 $0.00/$50 으로 보인다.
|
|
87
89
|
// width 를 넘으면 뒤 항목부터 줄인다: 시간당 지출, 작업 중, 멈춤 수, 대기 세션 이름, 대기 수, 오늘 비용 차례.
|
|
88
90
|
// mode 가 tmux 이고 noColor 가 아니면 항목마다 tmux 서식을 씌운다. tmux 모드에서는 이름 속 # 을 ## 로 바꿔 서식으로 읽히지 않게 한다.
|
|
@@ -128,11 +130,14 @@ export function pickCounts(summary, claudeWaiting = []) {
|
|
|
128
130
|
export async function collectLine({ capMs = CAP_MS, now = Date.now() } = {}) {
|
|
129
131
|
const { createBudget } = await import('./tail.mjs');
|
|
130
132
|
const { collectLedger } = await import('./sources/claude-ledger.mjs');
|
|
131
|
-
const {
|
|
133
|
+
const { claudeLineCounts } = await import('./sources/claude.mjs');
|
|
132
134
|
const { readSummary } = await import('./summary.mjs');
|
|
133
135
|
const budget = createBudget(Infinity, capMs);
|
|
134
136
|
const usage = collectLedger({ budget, now });
|
|
135
137
|
if (budget.exhausted || usage.loading != null) return null;
|
|
136
|
-
// 멈춤은 Claude 만 있는 상태라 요약 없이 세션 파일과 기록 끝에서 바로 센다.
|
|
137
|
-
|
|
138
|
+
// 멈춤은 Claude 만 있는 상태라 요약 없이 세션 파일과 기록 끝에서 바로 센다. 대기 목록과 같은 세션 목록을 쓴다.
|
|
139
|
+
// 기록 끝 읽기도 장부와 같은 시간 상한 안에 둔다. 장부가 상한을 거의 다 쓴 경우에도 세어 볼 수 있게 최소 STOP_MIN_MS 는 준다.
|
|
140
|
+
// 그래도 다 세지 못하면 stopped 는 null 이고 줄에서 멈춤 칸만 빠진다.
|
|
141
|
+
const { waiting, stopped } = claudeLineCounts({ deadline: Math.max(budget.deadline, Date.now() + STOP_MIN_MS) });
|
|
142
|
+
return { today: usage.today.cost, ...pickCounts(readSummary({ now }), waiting), stopped, perHour: usage.lastHour.cost };
|
|
138
143
|
}
|
package/src/pricing.mjs
CHANGED
|
@@ -55,6 +55,8 @@ const GEMINI_PRICES = {
|
|
|
55
55
|
export const priceTag = (tables) => createHash('sha1').update(JSON.stringify(tables)).digest('hex').slice(0, 8);
|
|
56
56
|
|
|
57
57
|
// 모델별 컨텍스트 창 크기(토큰). 출처: Anthropic 모델 표 https://platform.claude.com/docs/en/about-claude/models/overview (2026-11-18 확인). 표에 없는 모델은 contextWindow 가 추측한다.
|
|
58
|
+
// 가격과 달리 창 크기는 틀려도 비용이 바뀌지 않고, 같은 계열이면 거의 같다. 그래서 표와 똑같은 이름이 없으면
|
|
59
|
+
// 앞부분이 같은 가장 긴 키(계열)의 값을 쓴다 (contextWindow 참고).
|
|
58
60
|
const WINDOWS = {
|
|
59
61
|
// Gemini 계열의 입력 한도(1,048,576 토큰). Antigravity 의 내부 모델 이름(gemini-4-argon 등)도 같다고 본다.
|
|
60
62
|
'gemini-': 1_048_576,
|
|
@@ -81,20 +83,47 @@ const WINDOWS = {
|
|
|
81
83
|
'claude-haiku-4-5': 200_000,
|
|
82
84
|
};
|
|
83
85
|
|
|
86
|
+
// Claude 모델 이름을 가격표 키 모양으로 맞춘다. 떼는 것은 클라우드·도구가 같은 모델에 붙이는 모양뿐이다:
|
|
87
|
+
// - 앞의 Bedrock 접두사: anthropic., global.anthropic., us.anthropic., us-gov.anthropic. 등 (모델 표의 Amazon Bedrock ID)
|
|
88
|
+
// - 끝의 Bedrock 판 번호: -v1:0 (bedrock-runtime 의 예전 ID 모양. 콜론까지 있을 때만 뗀다)
|
|
89
|
+
// - 끝의 [1m]: Claude Code 의 1M 창 모델 지정 (claude-opus-4-6[1m])
|
|
90
|
+
// - 끝의 -latest (Codex 와 같은 규칙)
|
|
91
|
+
// - 끝의 날짜: claude-opus-4-20250514 (4.6 이전 Claude API 의 날짜판 ID), claude-opus-4@20250514 (Vertex AI)
|
|
92
|
+
// - 끝의 -0: claude-opus-4-0, claude-sonnet-4-0 은 claude-opus-4, claude-sonnet-4 의 공식 별칭이다 (계열-주판-0 모양만)
|
|
93
|
+
// 그 밖의 꼬리(-preview, -v2, -9 등)는 다른 모델일 수 있어서 떼지 않는다.
|
|
94
|
+
const claudeKey = (model) =>
|
|
95
|
+
model
|
|
96
|
+
.replace(/^(?:[a-z][a-z0-9-]*\.)?anthropic\./, '')
|
|
97
|
+
.replace(/\[\d+[km]\]$/i, '')
|
|
98
|
+
.replace(/-v\d+:\d+$/, '')
|
|
99
|
+
.replace(/-latest$/, '')
|
|
100
|
+
.replace(/[-@]\d{8}$/, '')
|
|
101
|
+
.replace(/^(claude-[a-z]+-\d+)-0$/, '$1');
|
|
102
|
+
|
|
103
|
+
// 표에서 모델을 찾는다. 이름이 표와 똑같을 때, 또는 claudeKey 로 다듬은 이름이 표와 똑같을 때만 찾는다.
|
|
104
|
+
// 앞부분만 같은 다른 모델(claude-opus-4-9 와 claude-opus-4 등)에 엉뚱한 가격·창 크기를 매기지 않기 위해서다 (#255, #266).
|
|
84
105
|
function lookup(table, model) {
|
|
85
106
|
if (!model) return null;
|
|
86
|
-
|
|
87
|
-
|
|
107
|
+
return table[model] ?? table[claudeKey(model)] ?? null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// 창 크기 표 찾기. 정확히 맞는 키(claudeKey 로 다듬은 이름 포함)가 먼저이고, 없으면 다듬은 이름과 앞부분이 같은
|
|
111
|
+
// 가장 긴 키(계열 값)를 쓴다. 표에 없는 새 모델(claude-sonnet-5-6 등)이 200K 추측으로 떨어져 게이지가 부풀지 않게 하려는 것이다.
|
|
112
|
+
function windowOf(model) {
|
|
113
|
+
const exact = lookup(WINDOWS, model);
|
|
114
|
+
if (exact || !model) return exact;
|
|
115
|
+
const name = claudeKey(model);
|
|
116
|
+
const key = Object.keys(WINDOWS)
|
|
88
117
|
.sort((a, b) => b.length - a.length)
|
|
89
|
-
.find((k) =>
|
|
90
|
-
return key ?
|
|
118
|
+
.find((k) => name.startsWith(k));
|
|
119
|
+
return key ? WINDOWS[key] : null;
|
|
91
120
|
}
|
|
92
121
|
|
|
93
122
|
// 모르는 모델은 사용량으로 추측한다: 200k 를 넘었으면 1M 창, 아니면 200k 창.
|
|
94
123
|
// 표에 있어도 사용량이 표 값을 넘으면 추측 값을 쓴다: Sonnet 4/4.5 는 1M 베타로 200K 를 넘을 수 있는데, 기록의 모델 이름으로는 구분되지 않는다.
|
|
95
124
|
export function contextWindow(model, used = 0) {
|
|
96
125
|
const guess = used > 200_000 ? 1_000_000 : 200_000;
|
|
97
|
-
const w =
|
|
126
|
+
const w = windowOf(model);
|
|
98
127
|
return w ? Math.max(w, guess) : guess;
|
|
99
128
|
}
|
|
100
129
|
|
|
@@ -178,9 +207,13 @@ export function openaiPrice(model) {
|
|
|
178
207
|
return OPENAI_PRICES[model] ?? OPENAI_PRICES[model.replace(/-(latest|\d{4}-\d{2}-\d{2})$/, '')] ?? null;
|
|
179
208
|
}
|
|
180
209
|
|
|
181
|
-
// 가격표가 바뀌면 이 값이 바뀌고, 캐시 폴더도 바뀌어 예전 비용이 다시
|
|
210
|
+
// 가격표가 바뀌면 이 값이 바뀌고, 캐시 폴더도 바뀌어 예전 비용이 다시 계산된다 (월별 보관함도 다시 계산한다).
|
|
211
|
+
// 세 표(Claude, Gemini, Codex)와 찾는 규칙의 판 번호(LOOKUP_REV)를 함께 넣는다.
|
|
212
|
+
// 표의 값은 그대로여도 모델 이름으로 가격을 찾는 규칙(lookup, claudeKey, openaiPrice 등)이 바뀌면 LOOKUP_REV 를 올린다.
|
|
213
|
+
// lookup-2: Claude 가격을 앞부분 일치가 아니라 정규화 후 정확 일치로 찾는다 (#266).
|
|
182
214
|
export const PRICE_TABLES = [PRICES, GEMINI_PRICES, OPENAI_PRICES];
|
|
183
|
-
export const
|
|
215
|
+
export const LOOKUP_REV = 'lookup-2';
|
|
216
|
+
export const PRICE_TAG = priceTag([...PRICE_TABLES, LOOKUP_REV]);
|
|
184
217
|
|
|
185
218
|
// Codex 세션 누적 토큰(tokens: input 은 캐시 제외, cacheRead, output)의 환산 비용. 가격표에 없는 모델이면 null.
|
|
186
219
|
export function codexCost(model, t) {
|
package/src/sources/claude.mjs
CHANGED
|
@@ -29,30 +29,40 @@ function readJson(p) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
// projects/ 아래 프로젝트 폴더 이름 [[root, dirs]]. 읽지 못한 root 는 null 이다.
|
|
33
|
+
function projectDirs() {
|
|
34
|
+
return claudeProjectRoots().map((root) => {
|
|
35
|
+
try {
|
|
36
|
+
return [root, readdirSync(root)];
|
|
37
|
+
} catch (e) {
|
|
38
|
+
debugIo('claude', 'projects read failed', e, root);
|
|
39
|
+
return [root, null];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// listing: projectDirs() 결과. 여러 세션을 한 번에 찾을 때 넘기면 projects/ 를 세션마다 다시 읽지 않는다.
|
|
45
|
+
function findTranscript(sessionId, listing = null) {
|
|
33
46
|
const cached = pathCache.get(sessionId);
|
|
34
47
|
if (cached && (cached.path ? existsSync(cached.path) : Date.now() - cached.at < 5000)) return cached.path;
|
|
35
48
|
// 같은 세션 기록이 두 폴더에 있으면 더 최근에 바뀐 쪽 (끝난 세션 목록과 같은 기준). 폴더 하나에서는 처음 찾은 것.
|
|
36
49
|
let path = null;
|
|
37
50
|
let best = -Infinity;
|
|
38
|
-
for (const root of
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
if (m > best) {
|
|
49
|
-
path = p;
|
|
50
|
-
best = m;
|
|
51
|
-
}
|
|
52
|
-
break;
|
|
51
|
+
for (const [root, dirs] of listing ?? projectDirs()) {
|
|
52
|
+
if (!dirs) continue;
|
|
53
|
+
for (const dir of dirs) {
|
|
54
|
+
const p = join(root, dir, `${sessionId}.jsonl`);
|
|
55
|
+
let m;
|
|
56
|
+
try {
|
|
57
|
+
m = statSync(p).mtimeMs;
|
|
58
|
+
} catch {
|
|
59
|
+
continue;
|
|
53
60
|
}
|
|
54
|
-
|
|
55
|
-
|
|
61
|
+
if (m > best) {
|
|
62
|
+
path = p;
|
|
63
|
+
best = m;
|
|
64
|
+
}
|
|
65
|
+
break;
|
|
56
66
|
}
|
|
57
67
|
}
|
|
58
68
|
pathCache.set(sessionId, { path, at: Date.now() });
|
|
@@ -468,27 +478,38 @@ function sessionLabel(e, t) {
|
|
|
468
478
|
// 이름은 표와 같은 순서: 기록 끝부분의 /rename 이름, 세션 파일 이름, 자리표시 이름이면 작업 폴더 이름 (대화 제목은 기록을 다 읽어야 안다).
|
|
469
479
|
// 대기 시작은 상태가 바뀐 시각(statusUpdatedAt), 없으면 세션 파일이 바뀐 시각.
|
|
470
480
|
export function claudeWaiting() {
|
|
471
|
-
|
|
472
|
-
for (const e of sessionEntries()?.values() ?? []) {
|
|
473
|
-
if (!e.alive || !e.waitingFor) continue;
|
|
474
|
-
const transcript = findTranscript(e.sessionId);
|
|
475
|
-
const custom = transcript ? tailCustomTitle(transcript) : undefined;
|
|
476
|
-
const since = [e.statusUpdatedAt, e.updatedAt, e.startedAt].find(Number.isFinite) ?? null;
|
|
477
|
-
out.push({ tool: 'claude', name: givenName(e, custom) ?? (isAutoName(e) ? basename(e.cwd ?? '') : String(e.name)), since });
|
|
478
|
-
}
|
|
479
|
-
return out;
|
|
481
|
+
return claudeLineCounts().waiting;
|
|
480
482
|
}
|
|
481
483
|
|
|
482
484
|
// --line 용: 오류로 멈춘 살아 있는 Claude 세션 수. 화면과 같이 대기(idle) 세션의 마지막 대화 줄이 API 오류인지 기록 끝만 본다.
|
|
483
485
|
// 세션 파일에 상태가 없는 예전 Claude Code 는 기록 수정 시각으로 상태를 짐작해야 해서 세지 않는다.
|
|
484
486
|
export function claudeStopped() {
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
487
|
+
return claudeLineCounts().stopped;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// --line 이 쓰는 두 값(응답 대기 목록, 멈춤 수)을 세션 목록 한 번, projects/ 폴더 목록 한 번으로 모은다.
|
|
491
|
+
// 멈춤 수는 지시 대기 세션마다 기록 끝(최대 256KB)을 읽으므로 deadline(Date.now() 기준 ms) 안에서만 센다.
|
|
492
|
+
// 다 세기 전에 시간이 다 되면 stopped 는 null(모름)이고, 줄은 멈춤 칸을 뺀다 (모자라게 센 수를 보이지 않는다).
|
|
493
|
+
export function claudeLineCounts({ deadline = Infinity } = {}) {
|
|
494
|
+
const entries = [...(sessionEntries()?.values() ?? [])].filter((e) => e.alive);
|
|
495
|
+
let listing = null;
|
|
496
|
+
const find = (id) => findTranscript(id, (listing ??= projectDirs()));
|
|
497
|
+
const waiting = [];
|
|
498
|
+
for (const e of entries) {
|
|
499
|
+
if (!e.waitingFor) continue;
|
|
500
|
+
const transcript = find(e.sessionId);
|
|
501
|
+
const custom = transcript ? tailCustomTitle(transcript) : undefined;
|
|
502
|
+
const since = [e.statusUpdatedAt, e.updatedAt, e.startedAt].find(Number.isFinite) ?? null;
|
|
503
|
+
waiting.push({ tool: 'claude', name: givenName(e, custom) ?? (isAutoName(e) ? basename(e.cwd ?? '') : String(e.name)), since });
|
|
504
|
+
}
|
|
505
|
+
let stopped = 0;
|
|
506
|
+
for (const e of entries) {
|
|
507
|
+
if (e.waitingFor || e.status !== 'idle') continue;
|
|
508
|
+
if (Date.now() >= deadline) return { waiting, stopped: null };
|
|
509
|
+
const transcript = find(e.sessionId);
|
|
510
|
+
if (transcript && tailStopReason(transcript)) stopped++;
|
|
490
511
|
}
|
|
491
|
-
return
|
|
512
|
+
return { waiting, stopped };
|
|
492
513
|
}
|
|
493
514
|
|
|
494
515
|
export function collectClaude({ showEnded, budget, selectedId }) {
|
package/src/text.mjs
CHANGED
|
@@ -97,6 +97,35 @@ export function truncate(s, max, mark = ellipsis(max)) {
|
|
|
97
97
|
// 자른 자리 표시. 폭이 모호한 글자를 2칸으로 세는데 1칸만 남으면 … 대신 . 을 쓴다.
|
|
98
98
|
export const ellipsis = (room = 2) => (width('…') <= room ? '…' : '.');
|
|
99
99
|
|
|
100
|
+
// 글을 폭 w 칸 안의 줄들로 나눈다. 띄어쓰기에서 끊고, 한 낱말이 w 보다 길면 글자 단위로 끊는다.
|
|
101
|
+
// 한글처럼 2칸인 글자도 width 로 세어 어느 줄도 w 를 넘지 않는다. 줄 앞뒤 공백은 지운다.
|
|
102
|
+
export function wrapWords(s, w) {
|
|
103
|
+
const out = [];
|
|
104
|
+
let cur = '';
|
|
105
|
+
for (const word of String(s).split(/\s+/).filter(Boolean)) {
|
|
106
|
+
const joined = cur ? `${cur} ${word}` : word;
|
|
107
|
+
if (width(joined) <= w) {
|
|
108
|
+
cur = joined;
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (cur) out.push(cur);
|
|
112
|
+
cur = '';
|
|
113
|
+
let rest = word;
|
|
114
|
+
while (width(rest) > w) {
|
|
115
|
+
let head = '';
|
|
116
|
+
for (const ch of rest) {
|
|
117
|
+
if (head && width(head + ch) > w) break;
|
|
118
|
+
head += ch;
|
|
119
|
+
}
|
|
120
|
+
out.push(head);
|
|
121
|
+
rest = rest.slice(head.length);
|
|
122
|
+
}
|
|
123
|
+
cur = rest;
|
|
124
|
+
}
|
|
125
|
+
if (cur || !out.length) out.push(cur);
|
|
126
|
+
return out;
|
|
127
|
+
}
|
|
128
|
+
|
|
100
129
|
export function pad(s, n, align = 'left') {
|
|
101
130
|
const t = truncate(s, n);
|
|
102
131
|
const gap = ' '.repeat(Math.max(0, n - width(t)));
|
package/src/ui/chrome.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// 도움말 화면과 아래 키 안내 줄.
|
|
2
|
-
import { pad, width } from '../text.mjs';
|
|
2
|
+
import { pad, width, wrapWords } from '../text.mjs';
|
|
3
3
|
import { NO_COLOR, PALETTE } from './theme.mjs';
|
|
4
4
|
import { box, line, segsWidth } from './draw.mjs';
|
|
5
5
|
import { glyphs, legendMark } from './glyphs.mjs';
|
|
@@ -44,11 +44,12 @@ const LEGEND_IDS = [
|
|
|
44
44
|
['▲', 'legend.hot'],
|
|
45
45
|
['legend.cacheKey', 'legend.cache'],
|
|
46
46
|
['legend.toolKey', 'legend.tool'],
|
|
47
|
+
['legend.elapsedKey', 'legend.elapsed'],
|
|
47
48
|
['legend.stalledKey', 'legend.stalled'],
|
|
48
49
|
];
|
|
49
50
|
|
|
50
|
-
// 지금 언어의 상태 기호·열 설명. 제목 줄은 설명이 null 이다.
|
|
51
|
-
export const legend = () => LEGEND_IDS.map(([k, d]) => [/^(help|legend)\./.test(k) ? t(k) : k, d ? t(d) : d]);
|
|
51
|
+
// 지금 언어의 상태 기호·열 설명. 제목 줄은 설명이 null 이다. {g} 는 팀원 경과 시간 표시(glyphs().elapsed)로 바꾼다.
|
|
52
|
+
export const legend = () => LEGEND_IDS.map(([k, d]) => [/^(help|legend)\./.test(k) ? t(k, { g: glyphs().elapsed }) : k, d ? t(d) : d]);
|
|
52
53
|
|
|
53
54
|
// 도움말 줄 목록: 지금 화면의 키 → (표에 검색어가 걸려 있으면) 그 키 → (상세 패널이 열려 있으면) 상세 패널 키 → 어디서나 쓰는 키 → 다른 화면 한 줄씩 → 옵션 → 상태 기호·열.
|
|
54
55
|
// 넓으면(100칸 이상) 키는 왼쪽, 옵션·기호·열은 오른쪽 칸에 둔다.
|
|
@@ -70,7 +71,10 @@ export function helpSections(view = {}, open = false) {
|
|
|
70
71
|
|
|
71
72
|
// 키 칸 폭은 제목 줄 사이 묶음마다 그 묶음의 가장 긴 키에 맞춘다 (12~21칸).
|
|
72
73
|
// 영어는 키 이름(Typing a search, Changed files)이 길어 설명과 붙어 보이므로 사이를 2칸 둔다 (한국어는 예전대로 1칸).
|
|
73
|
-
|
|
74
|
+
// w: 칸 폭(주지 않으면 감싸지 않는다). 설명이 넘치면 "…" 로 자르지 않고 키 칸만큼 들여쓴 다음 줄로 감싼다 (#265, 80열 한국어 설명).
|
|
75
|
+
// 설명 칸이 HELP_WRAP_MIN 보다 좁으면 감싸도 읽기 어려우므로 예전처럼 한 줄로 두고 자른다.
|
|
76
|
+
const HELP_WRAP_MIN = 12;
|
|
77
|
+
function helpLines(list, w = Infinity) {
|
|
74
78
|
const out = [];
|
|
75
79
|
const gap = getLang() === 'ko' ? 1 : 2;
|
|
76
80
|
const cap = 20 + gap;
|
|
@@ -81,7 +85,13 @@ function helpLines(list) {
|
|
|
81
85
|
const block = next.slice(0, Math.max(0, next.findIndex((e) => e[1] == null)) || next.length);
|
|
82
86
|
kw = Math.min(cap, Math.max(12, ...block.filter((e) => e[1]).map((e) => width(e[0]) + gap)));
|
|
83
87
|
out.push([{ t: k, fg: PALETTE.brand, bold: true }]);
|
|
84
|
-
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const look = { fg: dim ? PALETTE.info : PALETTE.muted };
|
|
91
|
+
const room = w - kw;
|
|
92
|
+
const parts = v && room >= HELP_WRAP_MIN && width(v) > room ? wrapWords(v, room) : [v];
|
|
93
|
+
out.push([{ t: pad(k, kw), fg: PALETTE.text, bold: !dim }, { t: parts[0], ...look }]);
|
|
94
|
+
for (const p of parts.slice(1)) out.push([{ t: ' '.repeat(kw) }, { t: p, ...look }]);
|
|
85
95
|
});
|
|
86
96
|
return out;
|
|
87
97
|
}
|
|
@@ -100,14 +110,17 @@ export function help(W, H, view = {}, open = false) {
|
|
|
100
110
|
const title = t('help.title');
|
|
101
111
|
const rows = H - 2;
|
|
102
112
|
const wide = W >= 100;
|
|
103
|
-
const
|
|
113
|
+
const leftW = Math.min(64, Math.floor((W - 7) * 0.5));
|
|
114
|
+
// 한 칸(100칸 미만)일 때만 설명을 감싼다. 안쪽 폭은 W - 4 (box). 두 칸은 120x40 한 화면에 기호·열 설명까지 들어가도록
|
|
115
|
+
// 예전처럼 한 줄로 두고 자른다 (감싸면 오른쪽 칸이 길어져 범례가 스크롤 아래로 밀린다).
|
|
116
|
+
const cols = wide ? [helpLines(keys), helpLines(more)] : [helpLines([...keys, ['', ''], ...more], W - 4)];
|
|
104
117
|
const max = Math.max(0, ...cols.map((c) => c.length - rows));
|
|
105
118
|
const scroll = Math.min(max, Math.max(0, view.helpScroll ?? 0));
|
|
106
119
|
view.helpMax = max;
|
|
107
120
|
// PgUp·PgDn 한 번에 넘길 줄 수: 보이는 줄에서 한 줄을 겹쳐 남긴다.
|
|
108
121
|
view.helpPage = Math.max(1, rows - 1);
|
|
109
122
|
view.helpScroll = scroll;
|
|
110
|
-
if (wide) return box(title, W, H, windowOf(cols[0], rows, scroll), windowOf(cols[1], rows, scroll),
|
|
123
|
+
if (wide) return box(title, W, H, windowOf(cols[0], rows, scroll), windowOf(cols[1], rows, scroll), leftW, PALETTE.brand);
|
|
111
124
|
return box(title, W, H, null, windowOf(cols[0], rows, scroll), 0, PALETTE.brand);
|
|
112
125
|
}
|
|
113
126
|
|
|
@@ -116,15 +129,28 @@ export const keyChip = (k) => (NO_COLOR ? { t: `[${k}]` } : { t: ` ${k} `, fg: P
|
|
|
116
129
|
|
|
117
130
|
export const keyLabel = (v) => ({ t: ` ${v} `, fg: PALETTE.muted });
|
|
118
131
|
|
|
119
|
-
// items: { k, t, keep } 또는 { segs, keep }. 폭이 모자라면 keep 이 아닌 항목을 오른쪽부터 뺀다.
|
|
132
|
+
// items: { k, t, keep, cut } 또는 { segs, keep }. 폭이 모자라면 keep 이 아닌 항목을 오른쪽부터 뺀다.
|
|
133
|
+
// cut: 항목을 하나라도 뺐을 때 바꿔 쓸 라벨. ? 칩이 '키 전체' 로 바뀌어 빠진 키를 도움말에서 찾게 한다 (#265).
|
|
120
134
|
export function hintBar(items, W, right = '') {
|
|
121
135
|
const segsOf = (list) => [{ t: ' ' }, ...list.flatMap((i) => i.segs ?? [keyChip(i.k), keyLabel(i.t)])];
|
|
122
136
|
const wOf = (list) => segsWidth(segsOf(list));
|
|
123
|
-
const
|
|
124
|
-
|
|
137
|
+
const fit = (src) => {
|
|
138
|
+
const list = [...src];
|
|
139
|
+
while (wOf(list) > W && list.some((i) => !i.keep)) list.splice(list.findLastIndex((i) => !i.keep), 1);
|
|
140
|
+
return list;
|
|
141
|
+
};
|
|
142
|
+
let list = fit(items);
|
|
143
|
+
// 하나라도 빠졌으면 cut 라벨로 바꾼다. 다만 바꾼 라벨 때문에 보이던 항목이 하나라도 더 빠지거나 남길 항목만으로 넘치면 원래 라벨을 둔다
|
|
144
|
+
// (빠진 키를 알리려다 키를 더 숨기지 않게). 오른쪽 글(⊘ 읽기전용)이 보이던 폭이면 그 글이 밀려 사라지는 경우도 바꾸지 않는다.
|
|
145
|
+
// cut 라벨은 원래보다 몇 칸만 길게 짧게 둔다.
|
|
146
|
+
const rightFits = (l) => Boolean(right) && W - wOf(l) >= width(right) + 1;
|
|
147
|
+
if (list.length < items.length) {
|
|
148
|
+
const cut = fit(items.map((i) => (i.cut ? { ...i, t: i.cut } : i)));
|
|
149
|
+
if (cut.length === list.length && wOf(cut) <= W && rightFits(cut) === rightFits(list)) list = cut;
|
|
150
|
+
}
|
|
125
151
|
const segs = segsOf(list);
|
|
126
152
|
const used = wOf(list);
|
|
127
|
-
if (
|
|
153
|
+
if (rightFits(list)) segs.push({ t: ' '.repeat(W - used - width(right)) }, { t: right, fg: PALETTE.info });
|
|
128
154
|
return line(segs, W);
|
|
129
155
|
}
|
|
130
156
|
|
|
@@ -150,7 +176,7 @@ export function footer(view, W, matched, sel) {
|
|
|
150
176
|
const RO = t('foot.readOnly');
|
|
151
177
|
const toast = toastItem(view);
|
|
152
178
|
const tail = [
|
|
153
|
-
{ k: '?', t: t('foot.help'), keep: true },
|
|
179
|
+
{ k: '?', t: t('foot.help'), cut: t('foot.helpAll'), keep: true },
|
|
154
180
|
{ k: 'q', t: t('key.quit'), keep: true },
|
|
155
181
|
];
|
|
156
182
|
const ended = { k: 'e', t: t(view.showEnded ? 'foot.hideEnded' : 'foot.showEnded') };
|
package/src/ui/glyphs.mjs
CHANGED
|
@@ -37,6 +37,9 @@ const NORMAL = {
|
|
|
37
37
|
event: '•',
|
|
38
38
|
cursor: '▏',
|
|
39
39
|
pin: '★',
|
|
40
|
+
// 팀원 행의 작업 경과 시간 앞 표시 (◷3m12s). IDLE 칸 자리에 서서 '마지막 활동 후' 로 읽히지 않게 한다 (#265).
|
|
41
|
+
// ⏱ 는 이모지라 2칸으로 그리는 터미널이 있어 폭이 늘 1칸(N)인 시계 모양 ◷ 를 쓴다.
|
|
42
|
+
elapsed: '◷',
|
|
40
43
|
};
|
|
41
44
|
|
|
42
45
|
const SAFE = {
|
|
@@ -75,6 +78,8 @@ const SAFE = {
|
|
|
75
78
|
cursor: '|',
|
|
76
79
|
// 확인 전 * 와 겹치지 않게.
|
|
77
80
|
pin: '#',
|
|
81
|
+
// 응답 대기 ? 나 '멈춘 듯' 의 좁은 표시(3m12s?)와 겹치지 않게 ~ 로 둔다.
|
|
82
|
+
elapsed: '~',
|
|
78
83
|
};
|
|
79
84
|
|
|
80
85
|
export const glyphs = () => (ambiguousWide() ? SAFE : NORMAL);
|
|
@@ -82,7 +87,7 @@ export const glyphs = () => (ambiguousWide() ? SAFE : NORMAL);
|
|
|
82
87
|
// 도움말 범례처럼 기본 기호로 적어 둔 글을 지금 기호로 바꾼다.
|
|
83
88
|
const SWAP = { '◆': 'waiting', '●': 'unseen', '◐': 'live', '○': 'idle', '!': 'stopped', '✓': 'done', '·': 'ended', '★': 'pin', '▲': 'hot' };
|
|
84
89
|
|
|
85
|
-
// 표의 상태 칸과 그 앞뒤에 서는
|
|
86
|
-
export const STATUS_KEYS = ['waiting', 'unseen', 'live', 'idle', 'stopped', 'done', 'ended', 'select', 'pin'];
|
|
90
|
+
// 표의 상태 칸과 그 앞뒤에 서는 기호, 팀원 경과 시간 앞 표시(elapsed). 세트마다 서로 달라야 한다 (응답 대기 깜빡임은 응답 대기와 같아도 된다).
|
|
91
|
+
export const STATUS_KEYS = ['waiting', 'unseen', 'live', 'idle', 'stopped', 'done', 'ended', 'select', 'pin', 'elapsed'];
|
|
87
92
|
export const glyphSets = () => ({ NORMAL, SAFE });
|
|
88
93
|
export const legendMark = (t) => (SWAP[t] ? glyphs()[SWAP[t]] : t);
|
package/src/ui/table.mjs
CHANGED
|
@@ -435,8 +435,9 @@ export function memberRow(m, last, c, W, frame, parentModel, costMode = 'api', p
|
|
|
435
435
|
// 두 칸은 폭과 상관없이 늘 있는 열이라, 좁아지면 이름·STATUS 가 먼저 줄고 경과 시간은 남는다 (세션 행의 IDLE 과 같은 규칙).
|
|
436
436
|
// '멈춘 듯' 은 글자로 적어 색이 없어도 구분되고, 흐린 색으로만 둔다. 놓는 곳은 위에서부터 들어가는 첫 자리다:
|
|
437
437
|
// 끝 칸에 '멈춘 듯 3m12s' → STATUS 칸 앞 (CTX 5칸만 남는 폭) → STATUS 칸도 그보다 좁으면 경과 시간 뒤에 '?' 하나 (3m12s?).
|
|
438
|
+
// 경과 시간 앞에는 glyphs().elapsed(◷, SAFE 세트는 ~)를 붙여 세션 행 IDLE(마지막 활동 후)과 구분한다 (#265).
|
|
438
439
|
const tailW = c.ctx + 1 + c.age;
|
|
439
|
-
const elapsed = !done && Number.isFinite(m.startedAt) ? fmtElapsed(NOW - m.startedAt) : '';
|
|
440
|
+
const elapsed = !done && Number.isFinite(m.startedAt) ? glyphs().elapsed + fmtElapsed(NOW - m.startedAt) : '';
|
|
440
441
|
const stalled = !done && memberStalled(m, NOW, parentStatus) ? t('member.stalled') : '';
|
|
441
442
|
const both = stalled && elapsed ? width(stalled) + 1 + width(elapsed) <= tailW : Boolean(stalled);
|
|
442
443
|
const before = stalled && !both && c.status >= width(stalled) + 1;
|