agent-run-inspector 0.9.4 → 0.10.1
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.ko.md +16 -4
- package/README.md +16 -4
- package/package.json +1 -1
- package/src/adapters/claude-code/agents.js +37 -24
- package/src/adapters/claude-code/orca.js +76 -0
- package/src/index/scan.js +109 -1
- package/src/index/summary.js +17 -2
- package/src/model/roles.js +3 -2
- package/src/model/types.js +4 -1
- package/web/app.css +16 -0
- package/web/app.js +25 -0
- package/web/card.js +3 -1
- package/web/mini.js +2 -2
- package/web/run-header.js +1 -1
- package/web/session-list.js +3 -1
- package/web/strings.js +8 -1
package/README.ko.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://www.npmjs.com/package/agent-run-inspector)
|
|
8
8
|
[](package.json)
|
|
9
9
|
|
|
10
|
-
Claude Code 와 Codex CLI 의 에이전트
|
|
10
|
+
Claude Code 와 Codex CLI 의 에이전트 실행(Orca 봇 포함)을 로컬 브라우저에서 실시간으로 보는 읽기 전용 도구입니다. 누가 누구를 불렀는지, 호출마다 비용이 얼마인지, 어디서 실패했는지 한눈에 봅니다.
|
|
11
11
|
|
|
12
12
|

|
|
13
13
|
|
|
@@ -34,12 +34,24 @@ npx agent-run-inspector
|
|
|
34
34
|
|
|
35
35
|
## What you see
|
|
36
36
|
|
|
37
|
-
- **세션 목록**: 실행 중인 세션이 위, 최근 세션이 아래에 나옵니다(최근 목록은 눌러서 접기). 도구(Claude Code, Codex CLI)·기간(기본 Today)으로 거르거나 제목·프로젝트로 찾습니다. **그룹**: "+ New group" 으로 만들고 세션을 끌어다 놓거나 세션을 우클릭해 넣습니다. 그룹을 고르면 그 그룹의 세션만 보입니다. 그룹은 `~/.config/agent-run-inspector/groups.json` 에 저장됩니다. 에이전트 팀의 팀원(teammate)
|
|
37
|
+
- **세션 목록**: 실행 중인 세션이 위, 최근 세션이 아래에 나옵니다(최근 목록은 눌러서 접기). 도구(Claude Code, Codex CLI)·기간(기본 Today)으로 거르거나 제목·프로젝트로 찾습니다. **그룹**: "+ New group" 으로 만들고 세션을 끌어다 놓거나 세션을 우클릭해 넣습니다. 그룹을 고르면 그 그룹의 세션만 보입니다. 그룹은 `~/.config/agent-run-inspector/groups.json` 에 저장됩니다. 에이전트 팀의 팀원(teammate)과 [Orca 작업자](#orca-bots)는 따로 나오지 않고, 자신을 띄운 실행 안에 묶여 보입니다.
|
|
38
38
|
- **그래프**: orchestrator 부터 에이전트마다 카드 하나. 카드에는 최근 호출, 상태, 비용, 시간, 호출 수가 보입니다. 카드를 누르면 그 에이전트만의 합계가 나오고, "Hide finished agents" 로 아직 일하는 에이전트만 남길 수 있습니다.
|
|
39
39
|
- **타임라인**: 모든 에이전트와 호출을 한 시간 축에 놓고 턴·컨텍스트 압축 시점도 표시합니다. 호출을 열면 자세한 내용이 보입니다.
|
|
40
40
|
- **합계**: 실행 전체나 고른 에이전트의 시간, 비용, 토큰, 모델 호출, 도구 호출, 오류.
|
|
41
41
|
- **실시간**: 기록에 새 줄이 생기면 새로 고침 없이 1초 안팎에 화면에 반영됩니다.
|
|
42
42
|
|
|
43
|
+
## Orca bots
|
|
44
|
+
|
|
45
|
+
Orca 봇은 오래 살아 있는 Claude Code 세션으로, 자기 워크트리에 작업자를 띄우고 다른 봇에게 일을 넘깁니다. 인스펙터는 봇과 그 작업자를 실행 하나로 보여 줍니다.
|
|
46
|
+
|
|
47
|
+
- **Bot 배지**: 봇 세션(`~/.orca/bots/<이름>` 에서 도는 세션)은 세션 목록에 골드 **Bot** 배지로 표시되고 봇 이름으로 나옵니다. 그래프 맨 위 카드는 골드 테두리로 감싸이고 Orchestrator 대신 "Bot · <이름>" 으로 나옵니다.
|
|
48
|
+
- **봇 아래 작업자**: `orca orchestration worker-start` 로 띄운 작업자마다 봇 아래 카드가 하나씩 생깁니다. 이름은 `--name`(없으면 워크스페이스 폴더 이름), 작업 내용은 `--task-title` 이고, 작업자 자신의 호출·비용·상태가 보입니다. 작업자 세션은 목록에 따로 나오지 않습니다.
|
|
49
|
+
- **합계 하나**: 실행의 시간·비용·토큰에 작업자 몫이 들어갑니다. 작업자가 일하는 동안 봇도 실행 중으로 나옵니다.
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
작업자는 `worker-start` 결과에 찍힌 task id 로 봇에 묶이므로, id 를 인용만 한 세션은 아무것도 묶지 않습니다. 봇이 아니어도 이 방법으로 작업자를 띄운 세션이면 작업자가 그 안에 묶입니다. 아직 그리지 않는 것: Codex 작업자, 봇끼리 주고받는 메시지, 봇이 깨어날 때마다 실행을 나눠 보기.
|
|
54
|
+
|
|
43
55
|
## Options
|
|
44
56
|
|
|
45
57
|
| 옵션 | 하는 일 |
|
|
@@ -125,11 +137,11 @@ Orca 안에서는 주소가 Orca 브라우저 새 탭으로 열립니다(`orca t
|
|
|
125
137
|
|
|
126
138
|
## Cost
|
|
127
139
|
|
|
128
|
-
비용은 청구서가 아닌 추정치입니다. 모델 호출마다 내장 `prices.json`(100만 토큰당 USD, 기준일 `asOf` 2026-11-13, 모델마다 출처 주소: Anthropic·OpenAI 공개 가격 페이지)으로 값을 매기고, 모르는 모델의 호출은 토큰만 보이며 합계에 부분 표시가 붙습니다. Claude Code 실행은 Claude Code 가 직접 기록한 세션 합계("Reported")가 있으면 그것을 씁니다. 단,
|
|
140
|
+
비용은 청구서가 아닌 추정치입니다. 모델 호출마다 내장 `prices.json`(100만 토큰당 USD, 기준일 `asOf` 2026-11-13, 모델마다 출처 주소: Anthropic·OpenAI 공개 가격 페이지)으로 값을 매기고, 모르는 모델의 호출은 토큰만 보이며 합계에 부분 표시가 붙습니다. Claude Code 실행은 Claude Code 가 직접 기록한 세션 합계("Reported")가 있으면 그것을 씁니다. 단, 팀원이나 Orca 작업자 세션이 들어 있는 실행은 그 합계에 팀원 몫이 빠져 있으므로 쓰지 않습니다. `--prices <file>` 로 모델을 덮어쓰거나 더할 수 있고, 내장 표 위에 필드 단위로 합쳐집니다.
|
|
129
141
|
|
|
130
142
|
## Supported scope
|
|
131
143
|
|
|
132
|
-
Claude Code(메인 세션, 하위 에이전트, 에이전트 팀의
|
|
144
|
+
Claude Code(메인 세션, 하위 에이전트, 에이전트 팀의 팀원, Orca 봇과 그 작업자)와 Codex CLI(0.40 ~ 0.166 롤아웃 파일). 넣지 않는 것: 에이전트 조작, 훅·프록시, 원격 접속·계정, Cursor·Gemini CLI 같은 다른 도구, 본문 검색, 내보내기, 알림.
|
|
133
145
|
|
|
134
146
|
### Known limits
|
|
135
147
|
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ English | [한국어](README.ko.md)
|
|
|
7
7
|
[](https://www.npmjs.com/package/agent-run-inspector)
|
|
8
8
|
[](package.json)
|
|
9
9
|
|
|
10
|
-
A local, read-only inspector for Claude Code and Codex CLI agent runs: see who called whom, what each call cost and where it failed, live, in your browser.
|
|
10
|
+
A local, read-only inspector for Claude Code and Codex CLI agent runs, Orca bots included: see who called whom, what each call cost and where it failed, live, in your browser.
|
|
11
11
|
|
|
12
12
|

|
|
13
13
|
|
|
@@ -34,12 +34,24 @@ It opens the inspector in your browser and runs until you press Ctrl+C.
|
|
|
34
34
|
|
|
35
35
|
## What you see
|
|
36
36
|
|
|
37
|
-
- **Session list**: running sessions on top, then recent ones (fold them with a click). Filter by tool (Claude Code, Codex CLI) and period (Today by default), or search by title or project. **Groups**: make one with "+ New group", then drag sessions onto it or right-click a session; pick a group to see only its sessions. Groups are kept in `~/.config/agent-run-inspector/groups.json`. Agent-team teammates are folded into the run that started them instead of being listed on their own.
|
|
37
|
+
- **Session list**: running sessions on top, then recent ones (fold them with a click). Filter by tool (Claude Code, Codex CLI) and period (Today by default), or search by title or project. **Groups**: make one with "+ New group", then drag sessions onto it or right-click a session; pick a group to see only its sessions. Groups are kept in `~/.config/agent-run-inspector/groups.json`. Agent-team teammates and [Orca workers](#orca-bots) are folded into the run that started them instead of being listed on their own.
|
|
38
38
|
- **Graph**: one card per agent, from the orchestrator down. Each card shows its latest calls, status, cost, time and call count. Click a card to total that agent; "Hide finished agents" keeps only the ones still working.
|
|
39
39
|
- **Timeline**: every agent and call on one time axis, with turns and context compactions. Open a call to see its details.
|
|
40
40
|
- **Totals**: time, cost, tokens, model calls, tool calls and errors for the whole run or the selected agent.
|
|
41
41
|
- **Live**: new lines in the logs show up within about a second, with no reload.
|
|
42
42
|
|
|
43
|
+
## Orca bots
|
|
44
|
+
|
|
45
|
+
Orca bots are long-lived Claude Code sessions that start workers in their own worktrees and hand work to other bots. The inspector shows a bot and its workers as one run:
|
|
46
|
+
|
|
47
|
+
- **Bot badge**: a bot's session (run from `~/.orca/bots/<name>`) is marked with a gold **Bot** badge in the session list and named after the bot, and its top card in the graph is framed in gold and reads "Bot · <name>" instead of Orchestrator.
|
|
48
|
+
- **Workers under their bot**: each worker started with `orca orchestration worker-start` is a card under the bot, named by `--name` (or its workspace folder) with its `--task-title` as the task, and shows its own calls, cost and status. Its session is not listed on its own.
|
|
49
|
+
- **One total**: the run's time, cost and tokens include the workers. The bot keeps running while a worker does.
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
A worker is joined to its bot by the task id in `worker-start`'s result, so a session that only quotes the ids links nothing. Any session that starts workers this way, not only a bot, gets them folded in. Not drawn yet: Codex workers, messages between bots, and a bot's wake-ups as separate runs.
|
|
54
|
+
|
|
43
55
|
## Options
|
|
44
56
|
|
|
45
57
|
| Option | What it does |
|
|
@@ -125,11 +137,11 @@ Run logs can hold customer data and secrets, so nothing leaves your machine exce
|
|
|
125
137
|
|
|
126
138
|
## Cost
|
|
127
139
|
|
|
128
|
-
Costs are estimates, not bills. Each model call is priced from the built-in `prices.json` (USD per 1M tokens, with an `asOf` date of 2026-11-13 and a source URL per model: the Anthropic and OpenAI public pricing pages); a call on an unknown model shows tokens only and the total is marked partial. For a Claude Code run, the session total that Claude Code itself recorded ("Reported") replaces the sum when it is there, except when teammate sessions are part of the run, since that total leaves them out. Override or add models with `--prices <file>`, which is merged field by field over the built-in table.
|
|
140
|
+
Costs are estimates, not bills. Each model call is priced from the built-in `prices.json` (USD per 1M tokens, with an `asOf` date of 2026-11-13 and a source URL per model: the Anthropic and OpenAI public pricing pages); a call on an unknown model shows tokens only and the total is marked partial. For a Claude Code run, the session total that Claude Code itself recorded ("Reported") replaces the sum when it is there, except when teammate or Orca worker sessions are part of the run, since that total leaves them out. Override or add models with `--prices <file>`, which is merged field by field over the built-in table.
|
|
129
141
|
|
|
130
142
|
## Supported scope
|
|
131
143
|
|
|
132
|
-
Claude Code (main sessions, sub-agents, agent-team teammates) and Codex CLI (rollout files from 0.40 to 0.166). Not included: controlling agents, hooks or proxies, remote access or accounts, other tools such as Cursor or Gemini CLI, full-text search, exporting, and alerts.
|
|
144
|
+
Claude Code (main sessions, sub-agents, agent-team teammates, Orca bots and their workers) and Codex CLI (rollout files from 0.40 to 0.166). Not included: controlling agents, hooks or proxies, remote access or accounts, other tools such as Cursor or Gemini CLI, full-text search, exporting, and alerts.
|
|
133
145
|
|
|
134
146
|
### Known limits
|
|
135
147
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { providerOf } from '../../model/provider.js';
|
|
2
2
|
import { ClaudeCodeSession } from './index.js';
|
|
3
3
|
import { AGENT_TOOLS } from './tools.js';
|
|
4
|
+
import { OrcaDispatches } from './orca.js';
|
|
4
5
|
import { MSG } from '../../strings.js';
|
|
5
6
|
|
|
6
7
|
const RECENT_MS = 10 * 60 * 1000;
|
|
@@ -26,6 +27,7 @@ export class AgentCollector {
|
|
|
26
27
|
this.notes = []; // task-notification lines: { ts, text } (matched against ids only)
|
|
27
28
|
this.stopCalls = new Map(); // TaskStop tool_use id -> task_id
|
|
28
29
|
this.stopped = new Map(); // teammate name -> when the lead stopped it or learned it shut down
|
|
30
|
+
this.orca = new OrcaDispatches(); // Orca workers this file started (keyed by task id, like teammates)
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
#stop(name, ts) {
|
|
@@ -35,6 +37,7 @@ export class AgentCollector {
|
|
|
35
37
|
onAssistant(rec, ts, line) {
|
|
36
38
|
const content = rec.message?.content;
|
|
37
39
|
if (!Array.isArray(content)) return;
|
|
40
|
+
this.orca.onAssistant(rec, ts, line);
|
|
38
41
|
for (const b of content) {
|
|
39
42
|
if (!b || b.type !== 'tool_use' || typeof b.id !== 'string' || typeof b.name !== 'string') continue;
|
|
40
43
|
if (b.name === 'TaskStop') { const t = str(b.input?.task_id); if (t) this.stopCalls.set(b.id, t); continue; }
|
|
@@ -69,6 +72,9 @@ export class AgentCollector {
|
|
|
69
72
|
return;
|
|
70
73
|
}
|
|
71
74
|
const content = rec.message?.content;
|
|
75
|
+
const known = this.orca.tasks.size;
|
|
76
|
+
this.orca.onUser(rec);
|
|
77
|
+
for (const c of [...this.orca.tasks.values()].slice(known)) c.seq ??= this.ctx.nextSeq();
|
|
72
78
|
// teammate messages relayed to the lead: "<name> has shut down." / the teammate approving its shutdown
|
|
73
79
|
if (typeof content === 'string' && content.includes('teammate-message')) {
|
|
74
80
|
for (const m of content.matchAll(/"type":"teammate_terminated","message":"([^"]+?) has shut down\./g)) this.#stop(m[1], ts);
|
|
@@ -127,30 +133,7 @@ export class AgentCollector {
|
|
|
127
133
|
const ref = { fileId: this.ctx.fileId, line: c.line };
|
|
128
134
|
if (c.status === 'teammate_spawned') {
|
|
129
135
|
const key = c.teammateId ?? c.id;
|
|
130
|
-
|
|
131
|
-
if (mate?.mate) {
|
|
132
|
-
mate.claimed = true;
|
|
133
|
-
const last = mate.mtime ?? mate.lastTs;
|
|
134
|
-
// a teammate is done once its turn ended, it shut down, or the lead stopped it after this spawn
|
|
135
|
-
const stoppedAt = this.stopped.get(key.split('@')[0]);
|
|
136
|
-
const live = isLive(last, now) && !mate.turnEnded && !mate.shutDown && !(stoppedAt >= c.start);
|
|
137
|
-
const end = live ? null : (mate.lastTs ?? c.start);
|
|
138
|
-
const model = c.model ?? mate.model;
|
|
139
|
-
out.push({
|
|
140
|
-
...base, id: externalSpanId(key), name: c.name ?? key.split('@')[0], status: live ? 'running' : 'ok',
|
|
141
|
-
start: c.start, end, ref: { fileId: mate.fileId, line: 1 }, depth: this.ctx.depth + 1, role: 'worker',
|
|
142
|
-
...(c.agentType ? { agentType: c.agentType } : {}), ...(c.task ? { task: c.task } : {}),
|
|
143
|
-
...(model ? { model, provider: providerOf(model) } : {}),
|
|
144
|
-
lastActivity: end ?? last ?? c.start, seq: c.seq,
|
|
145
|
-
});
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
const name = c.name ?? c.teammateId?.split('@')[0] ?? c.agentType ?? 'teammate';
|
|
149
|
-
out.push({
|
|
150
|
-
...base, id: externalSpanId(key), name, status: 'unknown', start: c.start, end: null, ref,
|
|
151
|
-
depth: this.ctx.depth + 1, role: 'worker', external: true,
|
|
152
|
-
...(c.agentType ? { agentType: c.agentType } : {}), lastActivity: c.start, seq: c.seq,
|
|
153
|
-
});
|
|
136
|
+
out.push(this.#mateSpan(key, c, c.name ?? c.teammateId?.split('@')[0] ?? c.agentType ?? 'teammate', { lookup, now, base, ref }));
|
|
154
137
|
continue;
|
|
155
138
|
}
|
|
156
139
|
const entry = lookup?.find(c.id, c.agentId);
|
|
@@ -186,8 +169,38 @@ export class AgentCollector {
|
|
|
186
169
|
lastActivity, seq: c.seq,
|
|
187
170
|
});
|
|
188
171
|
}
|
|
172
|
+
for (const [task, c] of this.orca.tasks) {
|
|
173
|
+
out.push(this.#mateSpan(task, c, c.name ?? task, { lookup, now, base, ref: { fileId: this.ctx.fileId, line: c.line }, orca: true }));
|
|
174
|
+
}
|
|
189
175
|
return out;
|
|
190
176
|
}
|
|
177
|
+
|
|
178
|
+
// A teammate or Orca worker: another session file, linked by `key` (name@team / task id). Found: a full
|
|
179
|
+
// agent node over that file; not found: a bare external node.
|
|
180
|
+
#mateSpan(key, c, fallbackName, { lookup, now, base, ref, orca }) {
|
|
181
|
+
const mate = lookup?.find(undefined, key);
|
|
182
|
+
const extra = { ...(c.agentType ? { agentType: c.agentType } : {}), ...(orca ? { orca: true } : {}) };
|
|
183
|
+
if (mate?.mate) {
|
|
184
|
+
mate.claimed = true;
|
|
185
|
+
const last = mate.mtime ?? mate.lastTs;
|
|
186
|
+
// done once its turn ended, it shut down, or the lead stopped it after this spawn
|
|
187
|
+
const stoppedAt = this.stopped.get(key.split('@')[0]);
|
|
188
|
+
const live = isLive(last, now) && !mate.turnEnded && !mate.shutDown && !(stoppedAt >= c.start);
|
|
189
|
+
const end = live ? null : (mate.lastTs ?? c.start);
|
|
190
|
+
const model = c.model ?? mate.model;
|
|
191
|
+
return {
|
|
192
|
+
...base, id: externalSpanId(key), name: c.name ?? str(mate.meta?.name) ?? key.split('@')[0], status: live ? 'running' : 'ok',
|
|
193
|
+
start: c.start, end, ref: { fileId: mate.fileId, line: 1 }, depth: this.ctx.depth + 1, role: 'worker',
|
|
194
|
+
...extra, ...(c.task ? { task: c.task } : {}),
|
|
195
|
+
...(model ? { model, provider: providerOf(model) } : {}),
|
|
196
|
+
lastActivity: end ?? last ?? c.start, seq: c.seq,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
...base, id: externalSpanId(key), name: fallbackName, status: 'unknown', start: c.start, end: null, ref,
|
|
201
|
+
depth: this.ctx.depth + 1, role: 'worker', external: true, ...extra, lastActivity: c.start, seq: c.seq,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
191
204
|
}
|
|
192
205
|
|
|
193
206
|
/**
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Orca (a multi-agent IDE) bots and dispatched workers, as seen in Claude Code logs. All Orca-specific
|
|
2
|
+
// rules live here so a format change is one edit. Only ids and names are taken from prompts and results.
|
|
3
|
+
// - A bot is a long-lived session whose cwd is `~/.orca/bots/<slug>`.
|
|
4
|
+
// - A coordinator (a bot or any session) starts workers with `orca orchestration worker-start`; that
|
|
5
|
+
// Bash call's result prints `dispatchId=ctx_… taskId=task_…` per worker (bots often grep it down to
|
|
6
|
+
// the dispatch id alone).
|
|
7
|
+
// - A worker's own file opens with Orca's dispatch prompt, which names its task and dispatch ids.
|
|
8
|
+
// A session that only quotes these strings (a tool output, a pasted log) claims nothing: the ids count
|
|
9
|
+
// only from a worker-start call's own result, or from a file's first user message.
|
|
10
|
+
|
|
11
|
+
const BOT_CWD = /[\\/]\.orca[\\/]bots[\\/]([^\\/]+)(?:[\\/]|$)/; // its folder or one below
|
|
12
|
+
const WORKER_START = /\borchestration\s+worker-start\b/;
|
|
13
|
+
// one line per worker: `dispatchId=ctx_… taskId=task_… … workspace=<id>::<path>`, or only `dispatchId=ctx_…`
|
|
14
|
+
const DISPATCHED = /\bdispatchId=(ctx_[0-9a-z]+)(?:\s+taskId=(task_[0-9a-z]+))?(?:[^\n]*?\sworkspace=\S*::(\S+))?/g;
|
|
15
|
+
const WORKER_PROMPT = 'You are a dispatched worker';
|
|
16
|
+
const PROMPT_START = 'You are working inside Orca'; // the prompt opens the message; helpers that quote it do not
|
|
17
|
+
const TASK_LINE = /Your task ID is:\s*(task_[0-9a-z]+)/;
|
|
18
|
+
const DISPATCH_FLAG = /--dispatch-id\s+(ctx_[0-9a-z]+)/;
|
|
19
|
+
const flag = (name) => new RegExp(`--${name}\\s+(?:"([^"]+)"|'([^']+)'|(\\S+))`);
|
|
20
|
+
const NAME_FLAG = flag('name');
|
|
21
|
+
const TITLE_FLAG = flag('task-title');
|
|
22
|
+
const valueOf = (m) => (m ? m[1] ?? m[2] ?? m[3] : undefined);
|
|
23
|
+
|
|
24
|
+
const textOf = (c) => (typeof c === 'string' ? c : Array.isArray(c) ? c.map((b) => (typeof b?.text === 'string' ? b.text : '')).join('\n') : '');
|
|
25
|
+
|
|
26
|
+
/** The bot's slug when `cwd` is an Orca bot's home folder, else undefined. */
|
|
27
|
+
export const botOf = (cwd) => (typeof cwd === 'string' ? BOT_CWD.exec(cwd)?.[1] : undefined);
|
|
28
|
+
|
|
29
|
+
/** { task, dispatch } when this user record is Orca's dispatch prompt (call it on a file's first user record only). */
|
|
30
|
+
export function workerOf(rec) {
|
|
31
|
+
if (rec?.type !== 'user') return undefined;
|
|
32
|
+
const t = textOf(rec.message?.content).trimStart();
|
|
33
|
+
const task = t.startsWith(PROMPT_START) && t.includes(WORKER_PROMPT) ? TASK_LINE.exec(t)?.[1] : undefined;
|
|
34
|
+
return task ? { task, dispatch: DISPATCH_FLAG.exec(t)?.[1] } : undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Workers a file started: feed records in order; `tasks` maps task id (dispatch id when the result shows
|
|
38
|
+
* only that) -> { name, task, start, line }. */
|
|
39
|
+
export class OrcaDispatches {
|
|
40
|
+
constructor() {
|
|
41
|
+
this.calls = new Map(); // worker-start tool_use id -> { name, start, line }
|
|
42
|
+
this.tasks = new Map();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
onAssistant(rec, ts, line) {
|
|
46
|
+
const content = rec.message?.content;
|
|
47
|
+
if (!Array.isArray(content)) return;
|
|
48
|
+
for (const b of content) {
|
|
49
|
+
const cmd = b?.type === 'tool_use' && b.name === 'Bash' ? b.input?.command : undefined;
|
|
50
|
+
if (typeof cmd !== 'string' || !WORKER_START.test(cmd)) continue;
|
|
51
|
+
this.calls.set(b.id, { name: valueOf(NAME_FLAG.exec(cmd)), task: valueOf(TITLE_FLAG.exec(cmd)), start: ts ?? 0, line });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
onUser(rec) {
|
|
56
|
+
const content = rec.message?.content;
|
|
57
|
+
if (!this.calls.size || !Array.isArray(content)) return;
|
|
58
|
+
for (const b of content) {
|
|
59
|
+
const call = b?.type === 'tool_result' ? this.calls.get(b.tool_use_id) : undefined;
|
|
60
|
+
if (!call) continue;
|
|
61
|
+
// one call can start several workers (a shell loop): each result line names one
|
|
62
|
+
for (const m of textOf(b.content).matchAll(DISPATCHED)) {
|
|
63
|
+
// no --name: the worker's workspace folder names it
|
|
64
|
+
const folder = m[3]?.split(/[\\/]/).filter(Boolean).at(-1);
|
|
65
|
+
const key = m[2] ?? m[1];
|
|
66
|
+
if (!this.tasks.has(key)) this.tasks.set(key, { ...call, name: call.name ?? folder });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** Raw-byte prefilter for lines worth parsing with OrcaDispatches. */
|
|
73
|
+
export const DISPATCH_MARKS = [Buffer.from('worker-start'), Buffer.from('dispatchId=ctx_')];
|
|
74
|
+
export const WORKER_MARK = Buffer.from(WORKER_PROMPT);
|
|
75
|
+
/** Worker files are started by Orca, not the claude CLI: their head says so (prefilter for a wider read). */
|
|
76
|
+
export const WORKER_HEAD_MARKS = ['"entrypoint":"orca"', '"entrypoint":"sdk-cli"'].map((s) => Buffer.from(s));
|
package/src/index/scan.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { readdirSync, statSync } from 'node:fs';
|
|
5
5
|
import { dirname, join } from 'node:path';
|
|
6
6
|
import { createFileStore } from '../files.js';
|
|
7
|
+
import { OrcaDispatches, workerOf, DISPATCH_MARKS, WORKER_MARK, WORKER_HEAD_MARKS } from '../adapters/claude-code/orca.js';
|
|
7
8
|
|
|
8
9
|
export const HEAD_BYTES = 16 * 1024;
|
|
9
10
|
export const TAIL_BYTES = 16 * 1024;
|
|
@@ -201,6 +202,113 @@ function linkTeammates(list, store, cache) {
|
|
|
201
202
|
return out;
|
|
202
203
|
}
|
|
203
204
|
|
|
205
|
+
// An Orca worker's task id (and start time), from its file's first user record: Orca's dispatch prompt,
|
|
206
|
+
// often ~60 KB in, after attachment records. Only the first user record counts: a later quote of the prompt
|
|
207
|
+
// is not a worker. Most files settle within the first 16 KB; a file is read again only when it grew.
|
|
208
|
+
const WORKER_SCAN = 256 * 1024;
|
|
209
|
+
const ORCA_HEAD = 8 * 1024;
|
|
210
|
+
const USER_MARK = Buffer.from('"type":"user"');
|
|
211
|
+
function firstUser(buf) {
|
|
212
|
+
for (let at = 0; at < buf.length;) {
|
|
213
|
+
const nl = buf.indexOf(10, at);
|
|
214
|
+
if (nl === -1) break; // the line may still be being written
|
|
215
|
+
const line = buf.subarray(at, nl);
|
|
216
|
+
at = nl + 1;
|
|
217
|
+
if (!line.includes(USER_MARK)) continue;
|
|
218
|
+
let r = null;
|
|
219
|
+
try { r = JSON.parse(line.toString('utf8')); } catch { /* not a record */ }
|
|
220
|
+
if (r?.type !== 'user') continue;
|
|
221
|
+
const w = line.includes(WORKER_MARK) ? workerOf(r) : undefined;
|
|
222
|
+
const t = Date.parse(r.timestamp);
|
|
223
|
+
// the worker's folder names it when its coordinator's result did not
|
|
224
|
+
const folder = typeof r.cwd === 'string' ? r.cwd.split(/[\\/]/).filter(Boolean).at(-1) : undefined;
|
|
225
|
+
return { found: true, key: w ? { ...w, folder, ts: Number.isFinite(t) ? t : 0 } : null };
|
|
226
|
+
}
|
|
227
|
+
return { found: false, key: null };
|
|
228
|
+
}
|
|
229
|
+
function workerKey(store, file, cache) {
|
|
230
|
+
const k = `ow:${file.fileId}`;
|
|
231
|
+
const hit = cache.get(k);
|
|
232
|
+
if (hit && (hit.settled || hit.size === file.size)) return hit.key;
|
|
233
|
+
// Orca starts its workers itself (not the claude CLI), and the first records say so: any other file is
|
|
234
|
+
// settled from a small head with a byte search, no line walk
|
|
235
|
+
const head = store.readRange(file.fileId, 0, Math.min(file.size, ORCA_HEAD));
|
|
236
|
+
let res = { found: false, key: null };
|
|
237
|
+
let n = head.length;
|
|
238
|
+
if (WORKER_HEAD_MARKS.some((m) => head.includes(m))) {
|
|
239
|
+
n = Math.min(file.size, WORKER_SCAN);
|
|
240
|
+
const buf = n > head.length ? store.readRange(file.fileId, 0, n) : head;
|
|
241
|
+
res = buf.includes(WORKER_MARK) ? firstUser(buf) : { found: n >= WORKER_SCAN, key: null };
|
|
242
|
+
}
|
|
243
|
+
const orca = WORKER_HEAD_MARKS.some((m) => head.includes(m));
|
|
244
|
+
const settled = res.found || n >= WORKER_SCAN || (!orca && n < file.size);
|
|
245
|
+
cache.set(k, { size: file.size, key: res.key, settled });
|
|
246
|
+
return res.key;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Orca task ids a file started (worker-start results), with when; reads only bytes appended since the last call.
|
|
250
|
+
export function dispatchedTasks(store, file, cache) {
|
|
251
|
+
const k = `od:${file.fileId}`;
|
|
252
|
+
let c = cache.get(k);
|
|
253
|
+
if (!c || file.size < c.offset) c = { offset: 0, d: new OrcaDispatches() };
|
|
254
|
+
let size = SCAN_CHUNK;
|
|
255
|
+
while (file.size > c.offset) {
|
|
256
|
+
const buf = store.readRange(file.fileId, c.offset, Math.min(size, file.size - c.offset));
|
|
257
|
+
const end = buf.lastIndexOf(0x0a) + 1;
|
|
258
|
+
if (end === 0) {
|
|
259
|
+
if (c.offset + buf.length >= file.size) break;
|
|
260
|
+
size *= 2;
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
size = SCAN_CHUNK;
|
|
264
|
+
// only lines holding a mark are parsed: a worker-start call, or a result naming a task
|
|
265
|
+
const hits = new Set();
|
|
266
|
+
for (const m of DISPATCH_MARKS) for (let i = buf.indexOf(m); i !== -1 && i < end; i = buf.indexOf(m, i + 1)) hits.add(buf.lastIndexOf(10, i) + 1);
|
|
267
|
+
for (const from of [...hits].sort((a, b) => a - b)) {
|
|
268
|
+
let r = null;
|
|
269
|
+
try { r = JSON.parse(buf.toString('utf8', from, buf.indexOf(10, from))); } catch { /* cut line */ }
|
|
270
|
+
const t = typeof r?.timestamp === 'string' ? Date.parse(r.timestamp) : NaN;
|
|
271
|
+
if (r?.type === 'assistant') c.d.onAssistant(r, Number.isFinite(t) ? t : null, 0);
|
|
272
|
+
else if (r?.type === 'user') c.d.onUser(r);
|
|
273
|
+
}
|
|
274
|
+
c.offset += end;
|
|
275
|
+
}
|
|
276
|
+
cache.set(k, c);
|
|
277
|
+
return c.d.tasks;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Moves Orca worker entries under the session that started them (as subs, like teammates). A task named
|
|
281
|
+
// by two sessions goes to the earlier worker-start.
|
|
282
|
+
function linkOrcaWorkers(list, store, cache) {
|
|
283
|
+
const workers = [];
|
|
284
|
+
const rest = [];
|
|
285
|
+
for (const e of list) {
|
|
286
|
+
const key = workerKey(store, e.main, cache);
|
|
287
|
+
if (key) workers.push({ e, key });
|
|
288
|
+
else rest.push(e);
|
|
289
|
+
}
|
|
290
|
+
if (!workers.length) return list;
|
|
291
|
+
const owner = new Map(); // task or dispatch id -> { lead, start }
|
|
292
|
+
// a coordinator writes after its workers start: older sessions are not read
|
|
293
|
+
const since = Math.min(...workers.map((w) => w.key.ts));
|
|
294
|
+
for (const l of rest) {
|
|
295
|
+
if (l.lastWrite < since) continue;
|
|
296
|
+
for (const [task, call] of dispatchedTasks(store, l.main, cache)) {
|
|
297
|
+
const o = owner.get(task);
|
|
298
|
+
if (!o || call.start < o.start) owner.set(task, { lead: l, start: call.start });
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
for (const { e, key: { task, dispatch, folder } } of workers) {
|
|
302
|
+
const key = owner.has(task) ? task : dispatch;
|
|
303
|
+
const o = owner.get(key);
|
|
304
|
+
if (!o) { rest.push(e); continue; }
|
|
305
|
+
// the worker's own sub-agents come along (linked to its Agent calls by tool_use id)
|
|
306
|
+
o.lead.subs.push({ ...e.main, agentId: key, metaFileId: null, mate: true, name: folder }, ...e.subs);
|
|
307
|
+
o.lead.lastWrite = Math.max(o.lead.lastWrite, e.lastWrite);
|
|
308
|
+
}
|
|
309
|
+
return rest;
|
|
310
|
+
}
|
|
311
|
+
|
|
204
312
|
function scanClaude(roots, store, accept, cache = new Map()) {
|
|
205
313
|
const found = [];
|
|
206
314
|
const labels = roots.length > 1 ? rootLabels(roots.map((r) => r.path)) : [];
|
|
@@ -255,7 +363,7 @@ function scanClaude(roots, store, accept, cache = new Map()) {
|
|
|
255
363
|
}
|
|
256
364
|
}
|
|
257
365
|
});
|
|
258
|
-
return linkTeammates(found, store, cache).filter((e) => accept(e.lastWrite));
|
|
366
|
+
return linkOrcaWorkers(linkTeammates(found, store, cache), store, cache).filter((e) => accept(e.lastWrite));
|
|
259
367
|
}
|
|
260
368
|
|
|
261
369
|
function codexHead(store, file, cache) {
|
package/src/index/summary.js
CHANGED
|
@@ -12,6 +12,7 @@ import { linkCodexAgents } from '../adapters/codex/agents.js';
|
|
|
12
12
|
import { AgentCollector, buildSessionTree } from '../adapters/claude-code/agents.js';
|
|
13
13
|
import { ENDS_TURN, isLocalCommand, shutdownSignal } from '../adapters/claude-code/index.js';
|
|
14
14
|
import { BackgroundTasks } from '../adapters/claude-code/tools.js';
|
|
15
|
+
import { botOf } from '../adapters/claude-code/orca.js';
|
|
15
16
|
import { mapUsage } from '../adapters/codex/llm.js';
|
|
16
17
|
import { MSG } from '../strings.js';
|
|
17
18
|
|
|
@@ -119,15 +120,18 @@ function quickClaude(entry, store, now) {
|
|
|
119
120
|
for (const r of readTail(store, entry.main.fileId, entry.main.size, TITLE_SCAN_BYTES)) if (r.type === 'assistant') bg.onAssistant(r); else if (r.type === 'user') bg.onUser(r);
|
|
120
121
|
}
|
|
121
122
|
const running = (recent(last) && (!turnEnded || bg.open.size > 0)) || childRunning;
|
|
123
|
+
const bot = botOf(cwd);
|
|
122
124
|
return base(entry, {
|
|
123
125
|
...(title ? { title } : {}),
|
|
126
|
+
...(bot ? { bot } : {}),
|
|
124
127
|
project: lastSeg(cwd) || entry.project || '',
|
|
125
128
|
...(cwd ? { cwd } : {}),
|
|
126
129
|
...(branch ? { branch } : {}),
|
|
127
130
|
start: first ?? entry.main.mtimeMs,
|
|
128
131
|
end: running ? null : last,
|
|
129
132
|
status: running ? 'running' : 'ok',
|
|
130
|
-
|
|
133
|
+
// a bot waiting on its workers is the bot at work: Running, not Background
|
|
134
|
+
...(running && turnEnded && !bot ? { background: true } : {}),
|
|
131
135
|
agentCount: 1 + entry.subs.length,
|
|
132
136
|
totals, models,
|
|
133
137
|
});
|
|
@@ -203,7 +207,7 @@ export function openEntry(entry, store, now) {
|
|
|
203
207
|
if (entry.source === 'claude-code') {
|
|
204
208
|
const subagents = entry.subs.map((s) => ({
|
|
205
209
|
fileId: String(s.fileId), agentId: s.agentId, text: readText(store, s.fileId, s.size),
|
|
206
|
-
meta: readMeta(store, s), mtime: s.mtimeMs, ...(s.mate ? { mate: true } : {}),
|
|
210
|
+
meta: s.name ? { name: s.name } : readMeta(store, s), mtime: s.mtimeMs, ...(s.mate ? { mate: true } : {}),
|
|
207
211
|
}));
|
|
208
212
|
const snap = buildSessionTree({
|
|
209
213
|
main: { fileId: String(entry.main.fileId), text: readText(store, entry.main.fileId, entry.main.size) },
|
|
@@ -211,6 +215,15 @@ export function openEntry(entry, store, now) {
|
|
|
211
215
|
});
|
|
212
216
|
spans = snap.spans; markers = snap.markers; turns = normTurns(entry.source, snap.turns);
|
|
213
217
|
meta = snap.session;
|
|
218
|
+
// an Orca bot's own session: its root agent is the bot, not an orchestrator (see roles.js)
|
|
219
|
+
const bot = botOf(meta.cwd);
|
|
220
|
+
if (bot) {
|
|
221
|
+
// waiting on its workers is the bot at work: Running, not Background (as in the list)
|
|
222
|
+
for (const s of spans) {
|
|
223
|
+
if (s.kind === 'session') delete s.background;
|
|
224
|
+
if (s.kind === 'agent' && (s.depth ?? 0) === 0 && !s.external) { s.bot = bot; delete s.background; }
|
|
225
|
+
}
|
|
226
|
+
}
|
|
214
227
|
} else {
|
|
215
228
|
const mk = (f) => {
|
|
216
229
|
const p = createCodexParser({ fileId: String(f.fileId), now: () => now });
|
|
@@ -263,8 +276,10 @@ export function fullSummary(entry, spans, meta) {
|
|
|
263
276
|
}
|
|
264
277
|
totals.usd = llmCount > 0 && usdKnown ? usd : null;
|
|
265
278
|
const title = meta.title;
|
|
279
|
+
const bot = entry.source === 'claude-code' ? botOf(meta.cwd) : undefined;
|
|
266
280
|
return base(entry, {
|
|
267
281
|
...(title ? { title } : {}),
|
|
282
|
+
...(bot ? { bot } : {}),
|
|
268
283
|
project: meta.project ?? '',
|
|
269
284
|
...(meta.cwd ? { cwd: meta.cwd } : {}),
|
|
270
285
|
...(meta.branch ? { branch: meta.branch } : {}),
|
package/src/model/roles.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Agent roles. `watcher` is never in the records, so it only comes from the config's name patterns
|
|
2
|
-
// (watcherNamePatterns, default empty = off). Root agent -> orchestrator
|
|
2
|
+
// (watcherNamePatterns, default empty = off). Root agent -> orchestrator (bot when it is an Orca bot's
|
|
3
|
+
// session, `bot` set by the parse), everything else -> worker.
|
|
3
4
|
|
|
4
5
|
const escapeRe = (s) => s.replace(/[.+?^${}()|[\]\\]/g, '\\$&');
|
|
5
6
|
|
|
@@ -17,7 +18,7 @@ export function applyRoles(spans, watcherNamePatterns = []) {
|
|
|
17
18
|
if (s.kind !== 'agent') continue;
|
|
18
19
|
const names = [s.name, s.agentType].filter((n) => typeof n === 'string' && n);
|
|
19
20
|
if (res.some((re) => names.some((n) => re.test(n)))) s.role = 'watcher';
|
|
20
|
-
else s.role = (s.depth ?? 0) === 0 && !s.external ? 'orchestrator' : 'worker';
|
|
21
|
+
else s.role = (s.depth ?? 0) === 0 && !s.external ? (s.bot ? 'bot' : 'orchestrator') : 'worker';
|
|
21
22
|
}
|
|
22
23
|
return spans;
|
|
23
24
|
}
|
package/src/model/types.js
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* @property {{ message: string, code?: string | number }} [error]
|
|
40
40
|
* @property {{ fileId: string, line: number }} ref
|
|
41
41
|
* @property {number} [depth]
|
|
42
|
-
* @property {'orchestrator' | 'worker' | 'watcher'} [role]
|
|
42
|
+
* @property {'orchestrator' | 'bot' | 'worker' | 'watcher'} [role]
|
|
43
43
|
* @property {string} [task]
|
|
44
44
|
* @property {Provider} [provider]
|
|
45
45
|
* @property {ToolCategory} [toolCategory]
|
|
@@ -47,6 +47,8 @@
|
|
|
47
47
|
* @property {string} [command]
|
|
48
48
|
* @property {string} [spawnsAgentId]
|
|
49
49
|
* @property {boolean} [external] agent: another session (teammate), shown as a bare node.
|
|
50
|
+
* @property {boolean} [orca] agent: an Orca worker this run started (its own session, linked by task id).
|
|
51
|
+
* @property {string} [bot] root agent: the Orca bot (folder name) whose session this is.
|
|
50
52
|
* @property {number} lastActivity
|
|
51
53
|
* @property {number} seq
|
|
52
54
|
*/
|
|
@@ -68,6 +70,7 @@
|
|
|
68
70
|
* @property {number} errorCount
|
|
69
71
|
* @property {Tokens & { usd: number | null }} totals
|
|
70
72
|
* @property {string[]} models
|
|
73
|
+
* @property {string} [bot] An Orca bot's session: the bot's folder name.
|
|
71
74
|
*/
|
|
72
75
|
|
|
73
76
|
export {};
|
package/web/app.css
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
--llm: #4c6ef5; --llm-soft: #dbe3ff; --tool: #0c8599; --tool-soft: #d3f0f3;
|
|
7
7
|
--err: #d6336c; --err-soft: #fde5ee; --ok: #2b8a3e; --run: #e8590c; --run-soft: #fff0e6;
|
|
8
8
|
--sel: #eef2ff; --flow: #8b5cf6; --edge: #4c6ef5;
|
|
9
|
+
--bot: #b08400; --bot-soft: #fff3c4; /* Orca bots: gold, a hue no status uses */
|
|
9
10
|
--brand-anthropic: #D97757; --brand-anthropic-bg: #fbeee8; --brand-google: #8E75B2;
|
|
10
11
|
--badge-cc-bg: #f3e8dd; --badge-cc: #9a4f16; --badge-cx-bg: #e3eefc; --badge-cx: #1f5fa8;
|
|
11
12
|
--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
--llm: #7c93ff; --llm-soft: #26305a; --tool: #3bc9db; --tool-soft: #143a40;
|
|
20
21
|
--err: #ff6b9a; --err-soft: #3d1a27; --ok: #69db7c; --run: #ff922b; --run-soft: #3a2614;
|
|
21
22
|
--sel: #1f2540; --flow: #b197fc; --edge: #7c93ff;
|
|
23
|
+
--bot: #ffd43b; --bot-soft: #3a3214;
|
|
22
24
|
--brand-anthropic: #E08A6C; --brand-anthropic-bg: #3a2620; --brand-google: #a993cf;
|
|
23
25
|
--badge-cc-bg: #3a2a1c; --badge-cc: #f0b27a; --badge-cx-bg: #1a2b40; --badge-cx: #8cc0ff;
|
|
24
26
|
color-scheme: dark;
|
|
@@ -31,6 +33,7 @@
|
|
|
31
33
|
--llm: #7c93ff; --llm-soft: #26305a; --tool: #3bc9db; --tool-soft: #143a40;
|
|
32
34
|
--err: #ff6b9a; --err-soft: #3d1a27; --ok: #69db7c; --run: #ff922b; --run-soft: #3a2614;
|
|
33
35
|
--sel: #1f2540; --flow: #b197fc; --edge: #7c93ff;
|
|
36
|
+
--bot: #ffd43b; --bot-soft: #3a3214;
|
|
34
37
|
--brand-anthropic: #E08A6C; --brand-anthropic-bg: #3a2620; --brand-google: #a993cf;
|
|
35
38
|
--badge-cc-bg: #3a2a1c; --badge-cc: #f0b27a; --badge-cx-bg: #1a2b40; --badge-cx: #8cc0ff;
|
|
36
39
|
color-scheme: dark;
|
|
@@ -52,6 +55,13 @@ button:focus-visible, .sess:focus-visible { outline: 2px solid var(--accent); ou
|
|
|
52
55
|
.ver { color: var(--muted); font-size: 11px; font-weight: 400; }
|
|
53
56
|
.upd { font-size: 11px; font-weight: 500; color: var(--llm); background: var(--llm-soft); border-radius: 999px; padding: 1px 8px; cursor: help; }
|
|
54
57
|
.upd.act { cursor: pointer; }
|
|
58
|
+
.upd-pop { position: fixed; right: 20px; bottom: 20px; z-index: 20; width: 320px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--panel); color: var(--text); border: 1px solid var(--llm); border-radius: 12px; box-shadow: 0 12px 32px -8px rgba(0,0,0,.35); font-size: 13px; }
|
|
59
|
+
.upd-pop b { font-size: 15px; }
|
|
60
|
+
.upd-pop p { margin: 0; color: var(--muted); }
|
|
61
|
+
.upd-pop code { font-family: var(--mono); font-size: 12px; background: var(--panel-2); border-radius: 6px; padding: 6px 8px; user-select: all; }
|
|
62
|
+
.upd-pop div { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
|
|
63
|
+
.upd-pop button { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
|
|
64
|
+
.upd-pop button.primary { background: var(--llm); border-color: var(--llm); color: #fff; }
|
|
55
65
|
.upd.act:hover { filter: brightness(0.95); text-decoration: underline; }
|
|
56
66
|
.spacer { flex: 1; }
|
|
57
67
|
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
|
|
@@ -126,6 +136,7 @@ body.resizing { cursor: col-resize; user-select: none; }
|
|
|
126
136
|
.badge { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; letter-spacing: .02em; flex: none; }
|
|
127
137
|
.badge.cc { background: var(--badge-cc-bg); color: var(--badge-cc); }
|
|
128
138
|
.badge.cx { background: var(--badge-cx-bg); color: var(--badge-cx); }
|
|
139
|
+
.badge.bot { background: var(--bot-soft); color: var(--bot); }
|
|
129
140
|
.st-err { color: var(--err); } .st-run { color: var(--run); } .st-run.bg { color: var(--flow); }
|
|
130
141
|
.note { padding: 16px 14px; color: var(--muted); }
|
|
131
142
|
|
|
@@ -285,6 +296,11 @@ body.resizing { cursor: col-resize; user-select: none; }
|
|
|
285
296
|
.g-card.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
|
|
286
297
|
.g-card[data-status="failed"] { border-color: color-mix(in srgb, var(--err) 55%, var(--line)); }
|
|
287
298
|
.g-card.watch { border-style: dashed; }
|
|
299
|
+
/* an Orca bot: gold frame and wash, so it never reads as an ordinary orchestrator (or the selection) */
|
|
300
|
+
.g-card.bot { border-color: var(--bot); box-shadow: 0 0 0 1.5px var(--bot), 0 8px 24px -10px var(--bot);
|
|
301
|
+
background: linear-gradient(180deg, var(--bot-soft), var(--panel) 72px); }
|
|
302
|
+
.g-card.bot.sel { box-shadow: 0 0 0 1.5px var(--bot), 0 0 0 5px var(--bot-soft); }
|
|
303
|
+
.g-card.bot .g-name { color: var(--bot); }
|
|
288
304
|
.g-card.external { cursor: default; }
|
|
289
305
|
.g-h { display: flex; align-items: center; gap: 7px; min-width: 0; height: 24px; }
|
|
290
306
|
.g-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
|
package/web/app.js
CHANGED
|
@@ -264,7 +264,32 @@ if (state.mini) {
|
|
|
264
264
|
const upd = $('upd');
|
|
265
265
|
upd.hidden = !m.latest;
|
|
266
266
|
if (m.latest) { upd.textContent = S.meta.update(m.latest); upd.title = bridge ? S.meta.click(m.latest) : S.meta.how(m.latest); }
|
|
267
|
+
if (m.latest) showUpdatePop(m.latest);
|
|
267
268
|
}, () => {});
|
|
269
|
+
// A newer version: a card once per version (Later remembers it); the header badge stays either way.
|
|
270
|
+
const showUpdatePop = (v) => {
|
|
271
|
+
let seen = null;
|
|
272
|
+
try { seen = localStorage.getItem('ari.updSeen'); } catch { /* storage blocked */ }
|
|
273
|
+
if (seen === v || document.querySelector('.upd-pop')) return;
|
|
274
|
+
const pop = document.createElement('div');
|
|
275
|
+
pop.className = 'upd-pop';
|
|
276
|
+
pop.setAttribute('role', 'dialog');
|
|
277
|
+
const close = () => { pop.remove(); try { localStorage.setItem('ari.updSeen', v); } catch { /* storage blocked */ } };
|
|
278
|
+
const h = document.createElement('b'); h.textContent = S.meta.popTitle(v);
|
|
279
|
+
const p = document.createElement('p'); p.textContent = bridge ? S.meta.popApp : S.meta.popCli;
|
|
280
|
+
pop.append(h, p);
|
|
281
|
+
if (!bridge) { const c = document.createElement('code'); c.textContent = 'npm i -g agent-run-inspector'; pop.append(c); }
|
|
282
|
+
const row = document.createElement('div');
|
|
283
|
+
const later = document.createElement('button'); later.textContent = S.meta.popLater; later.addEventListener('click', close);
|
|
284
|
+
row.append(later);
|
|
285
|
+
if (bridge) {
|
|
286
|
+
const now = document.createElement('button'); now.className = 'primary'; now.textContent = S.meta.popNow;
|
|
287
|
+
now.addEventListener('click', () => { close(); bridge.postMessage({ update: true }); });
|
|
288
|
+
row.append(now);
|
|
289
|
+
}
|
|
290
|
+
pop.append(row);
|
|
291
|
+
document.body.append(pop);
|
|
292
|
+
};
|
|
268
293
|
const bridge = window.webkit?.messageHandlers?.ari; // inside the Mac app: the badge starts the update
|
|
269
294
|
if (bridge) {
|
|
270
295
|
$('upd').classList.add('act');
|
package/web/card.js
CHANGED
|
@@ -33,7 +33,7 @@ export function cardInfo(agent, calls, now) {
|
|
|
33
33
|
const priced = llms.filter((c) => known(c.cost?.usd));
|
|
34
34
|
const end = known(agent.end) ? agent.end : agent.status === 'running' ? now : null;
|
|
35
35
|
// The root agent's own name can be a model id; the card says what it is and keeps the model beside it.
|
|
36
|
-
const name = agent.role === 'orchestrator' && !agent.external ? S.graph.orchestrator : agent.name;
|
|
36
|
+
const name = agent.role === 'bot' ? S.graph.bot(agent.bot) : agent.role === 'orchestrator' && !agent.external ? S.graph.orchestrator : agent.name;
|
|
37
37
|
return {
|
|
38
38
|
name,
|
|
39
39
|
model: model && model !== name ? model : null,
|
|
@@ -45,6 +45,7 @@ export function cardInfo(agent, calls, now) {
|
|
|
45
45
|
callCount: calls.length,
|
|
46
46
|
external: Boolean(agent.external),
|
|
47
47
|
watcher: agent.role === 'watcher',
|
|
48
|
+
bot: agent.role === 'bot',
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
51
|
|
|
@@ -250,6 +251,7 @@ export function updateCard(c, d) {
|
|
|
250
251
|
root.dataset.status = info.status;
|
|
251
252
|
root.classList.toggle('watch', info.watcher);
|
|
252
253
|
root.classList.toggle('external', info.external);
|
|
254
|
+
root.classList.toggle('bot', info.bot);
|
|
253
255
|
root.classList.toggle('folded', folded);
|
|
254
256
|
root.classList.toggle('sel', selected);
|
|
255
257
|
root.setAttribute('aria-pressed', String(selected));
|
package/web/mini.js
CHANGED
|
@@ -41,7 +41,7 @@ export function fmtAgo(ms) {
|
|
|
41
41
|
return S.mini.ago(`${Math.round(s / 3600)}h`);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
const agentName = (a) => (a.depth === 0 ? S.graph.orchestrator : a.name);
|
|
44
|
+
const agentName = (a) => (a.depth === 0 ? (a.role === 'bot' ? S.list.bot : S.graph.orchestrator) : a.name);
|
|
45
45
|
const dot = (status) => el('span', status === 'running' ? 'dot pulse' : status === 'error' ? 'dot err' : 'dot off');
|
|
46
46
|
|
|
47
47
|
function nowLine(s, now) {
|
|
@@ -71,7 +71,7 @@ export function miniCard(s, now = Date.now()) {
|
|
|
71
71
|
const head = el('div', 'mini-head');
|
|
72
72
|
const slug = providerSlugs(s.models)[0];
|
|
73
73
|
head.append(slug ? iconEl(slug) : el('span', `badge ${s.source === 'codex' ? 'cx' : 'cc'}`, S.sourceBadge[s.source] ?? '?'));
|
|
74
|
-
head.append(el('span', 'mini-title', s.title || S.list.untitled), el('span', 'mini-ago num', fmtAgo(now - s.lastWrite)));
|
|
74
|
+
head.append(el('span', 'mini-title', s.title || s.bot || S.list.untitled), el('span', 'mini-ago num', fmtAgo(now - s.lastWrite)));
|
|
75
75
|
const t = s.totals ?? {};
|
|
76
76
|
const tokens = (t.input ?? 0) + (t.output ?? 0) + (t.cacheRead ?? 0);
|
|
77
77
|
const meta = el('div', 'mini-meta');
|
package/web/run-header.js
CHANGED
|
@@ -173,7 +173,7 @@ export function createRunHeader({ onBack, onTab, onShowAll, onHide }) {
|
|
|
173
173
|
badge.textContent = S.sourceBadge[source] ?? '';
|
|
174
174
|
badge.hidden = !source;
|
|
175
175
|
badge.title = source ? S.sourceTip(S.source[source] ?? source) : '';
|
|
176
|
-
name.textContent = s ? s.title || S.list.untitled : '';
|
|
176
|
+
name.textContent = s ? s.title || s.bot || S.list.untitled : '';
|
|
177
177
|
const running = s?.status === 'running';
|
|
178
178
|
dot.hidden = !running;
|
|
179
179
|
dot.classList.toggle('bg', Boolean(s?.background));
|
package/web/session-list.js
CHANGED
|
@@ -120,7 +120,9 @@ export function sessionRow(s, { selected = false, now = Date.now(), group = null
|
|
|
120
120
|
const t = el('div', 't');
|
|
121
121
|
const badge = el('span', `badge ${s.source === 'codex' ? 'cx' : 'cc'}`, S.sourceBadge[s.source] ?? '?');
|
|
122
122
|
badge.title = S.sourceTip(S.source[s.source] ?? s.source);
|
|
123
|
-
t.append(badge
|
|
123
|
+
t.append(badge);
|
|
124
|
+
if (s.bot) { const b = el('span', 'badge bot', S.list.bot); b.title = S.list.botTip(s.bot); t.append(b); }
|
|
125
|
+
t.append(el('span', 'name', s.title || s.bot || S.list.untitled));
|
|
124
126
|
if (group) t.append(el('span', 'grp-tag', group));
|
|
125
127
|
if (s.status === 'running') {
|
|
126
128
|
const dot = el('span', s.background ? 'dot pulse bg' : 'dot pulse');
|
package/web/strings.js
CHANGED
|
@@ -20,7 +20,11 @@ export const S = {
|
|
|
20
20
|
add: '+ New group', addTo: 'Add to group', remove: 'Remove from group', del: 'Delete group',
|
|
21
21
|
dropHint: 'Drop a session here to add it to this group',
|
|
22
22
|
},
|
|
23
|
-
meta: {
|
|
23
|
+
meta: {
|
|
24
|
+
popTitle: (v) => `Version ${v} is out`, popApp: 'Update now and the app reopens on the new version.',
|
|
25
|
+
popCli: 'Run this, then "ari service install" if you use the app or the service:', popNow: 'Update now', popLater: 'Later',
|
|
26
|
+
update: (v) => `Update ${v}`, click: (v) => `Click to update to ${v}. The app reopens when it is done.`, how: (v) => `Version ${v} is out. In the Mac app: right-click the menu bar item, then "Update to ${v}". Or run "npm i -g agent-run-inspector", then "ari service install" if you use the app or the service.`,
|
|
27
|
+
},
|
|
24
28
|
auth: { restarted: 'Signed out. Open the new address printed in the terminal, or run "ari open" if the inspector runs as a service.', detail: 'The server was restarted or this tab lost its sign-in, so the server no longer accepts it.' },
|
|
25
29
|
list: {
|
|
26
30
|
heading: 'Sessions',
|
|
@@ -28,6 +32,8 @@ export const S = {
|
|
|
28
32
|
loadFailed: 'Could not load sessions.',
|
|
29
33
|
none: 'No sessions to show yet.',
|
|
30
34
|
untitled: 'Untitled session',
|
|
35
|
+
bot: 'Bot',
|
|
36
|
+
botTip: (name) => `Orca bot "${name}": its workers are folded into this run`,
|
|
31
37
|
searchPlaceholder: 'Search title or project',
|
|
32
38
|
sourceLabel: 'Tool',
|
|
33
39
|
periodLabel: 'Period',
|
|
@@ -127,6 +133,7 @@ export const S = {
|
|
|
127
133
|
modelResponse: 'Model response',
|
|
128
134
|
modelShort: 'Model',
|
|
129
135
|
orchestrator: 'Orchestrator',
|
|
136
|
+
bot: (name) => `Bot · ${name}`,
|
|
130
137
|
earlier: (n) => `+${n} earlier ${n === 1 ? 'call' : 'calls'}`,
|
|
131
138
|
calls: (n) => `${n} ${n === 1 ? 'call' : 'calls'}`,
|
|
132
139
|
external: 'Another session',
|