Skip to content

One live console to monitor Claude Code and Codex agents across machines, track context and spend, and unblock sessions that need you.

Release 0.5.0

yuz2077aa46b544868
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..7162b45
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,58 @@
+# CI, on every push and pull request: lint, the protocol copy, the tests and the build, on Linux and macOS with Node 24;
+# and on Node 22.15, the oldest Node a machine that only reports may run, the install, the Codex reporter's build and its
+# start. Only in the published repository: a copy of it elsewhere runs nothing.
+name: ci
+on: [push, pull_request]
+permissions:
+ contents: read
+jobs:
+ test:
+ if: github.repository == 'IluvatarLabs/sitrep'
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, macos-latest]
+ runs-on: ${{ matrix.os }}
+ timeout-minutes: 15
+ steps:
+ - uses: actions/checkout@v7
+ with:
+ persist-credentials: false # no step needs the token
+ - uses: actions/setup-node@v7
+ with:
+ node-version: 24
+ cache: npm
+ - run: npm ci
+ - run: npm run lint
+ - run: npm run check:protocol
+ - run: npm test
+ - run: npm run build
+ reporter:
+ if: github.repository == 'IluvatarLabs/sitrep'
+ runs-on: ubuntu-latest
+ timeout-minutes: 15
+ steps:
+ - uses: actions/checkout@v7
+ with:
+ persist-credentials: false
+ - uses: actions/setup-node@v7
+ with:
+ node-version: 22.15.0
+ cache: npm
+ # npm warns that the repository asks for Node 24, and installs.
+ - run: npm ci
+ - run: npm run build -w codex-reporter
+ # In an empty home, with no server to reach: it says what it reports to, then keeps trying until the timeout ends it
+ # (status 124). One that stops by itself has failed, whatever it printed.
+ - name: The Codex reporter starts and keeps running
+ env:
+ CODEX_REPORTER_SERVER_URL: http://127.0.0.1:9
+ CODEX_REPORTER_TOKEN: ci
+ run: |
+ export HOME="$RUNNER_TEMP/home" CODEX_HOME="$RUNNER_TEMP/home/codex" CLAUDE_CONFIG_DIR="$RUNNER_TEMP/home/claude"
+ mkdir -p "$HOME"
+ status=0
+ timeout 10 node codex-reporter/dist/codex-reporter/src/main.js > "$RUNNER_TEMP/start.log" 2>&1 || status=$?
+ cat "$RUNNER_TEMP/start.log"
+ test "$status" -eq 124
+ grep -q 'codex-reporter [0-9.]*: reporting to http://127.0.0.1:9' "$RUNNER_TEMP/start.log"
diff --git a/codex-reporter/package.json b/codex-reporter/package.json
index 00bc46e..313a8ef 100644
--- a/codex-reporter/package.json
+++ b/codex-reporter/package.json
@@ -1,6 +1,6 @@
{
"name": "codex-reporter",
- "version": "0.4.1",
+ "version": "0.5.0",
"private": true,
"license": "MIT",
"type": "module",
diff --git a/codex-reporter/plugin/.codex-plugin/plugin.json b/codex-reporter/plugin/.codex-plugin/plugin.json
index 822877f..91f381c 100644
--- a/codex-reporter/plugin/.codex-plugin/plugin.json
+++ b/codex-reporter/plugin/.codex-plugin/plugin.json
@@ -1,5 +1,5 @@
{
"name": "sitrep-codex",
- "version": "0.4.1",
+ "version": "0.5.0",
"description": "SITREP: records bounded, redacted Codex hook events to a local spool for the codex-reporter. Never decides anything, never touches the network."
}
diff --git a/docs/HOW-IT-WORKS.md b/docs/HOW-IT-WORKS.md
index 8483c38..4f50c64 100644
--- a/docs/HOW-IT-WORKS.md
+++ b/docs/HOW-IT-WORKS.md
@@ -60,7 +60,7 @@ That is all SITREP does to a session. It never controls a terminal, and never st
## Usage and cost
- **Claude Code:** every API request is counted once, from Claude Code's own telemetry, so the figure covers its side
- requests too.
+ requests too. A fast-mode request is priced at the model's fast rate.
- **Codex:** from the usage Codex records for each response in its session files.
The server prices the tokens with LiteLLM's public price table, plus your own overrides. Every cost is an estimate and
diff --git a/docs/OPERATIONS.md b/docs/OPERATIONS.md
index df759c8..dccaa45 100644
--- a/docs/OPERATIONS.md
+++ b/docs/OPERATIONS.md
@@ -395,9 +395,8 @@ fetch failed. To refresh the shipped copy, download the file from LiteLLM's repo
## Codex hook trust
-Codex runs a plugin's hooks only once they are trusted, and ties that trust to a hash of the plugin's contents
-(`codex-rs/hooks/src/engine/plugin_trust.rs`), so every plugin update needs it again. `install.ts --codex` writes it
-as Codex's own `/hooks` screen does (`codex-rs/tui/src/hooks_rpc.rs`):
+Codex runs a plugin's hooks only once they are trusted, and ties that trust to a hash of the plugin's contents, so
+every plugin update needs it again. `install.ts --codex` writes it as Codex's own `/hooks` screen does:
1. `hooks/list`, for the hooks Codex finds;
2. for our plugin's hooks that it lists as untrusted or modified, and no other, one `config/batchWrite`: key path
@@ -407,8 +406,7 @@ as Codex's own `/hooks` screen does (`codex-rs/tui/src/hooks_rpc.rs`):
It reaches Codex's app-server the way Codex's own clients do: through the managed daemon's socket when the daemon
runs, else a private `codex app-server` over stdio. The dry run prints both requests. Our keys look like
`sitrep-codex@sitrep:hooks/hooks.json:<event>:<group>:<handler>` (for example
-`sitrep-codex@sitrep:hooks/hooks.json:pre_tool_use:0:0`; `codex-rs/hooks/src/lib.rs` `hook_key`,
-`declarations.rs`). Codex keeps them in `~/.codex/config.toml` under `[hooks.state]`, with a content baseline in
+`sitrep-codex@sitrep:hooks/hooks.json:pre_tool_use:0:0`). Codex keeps them in `~/.codex/config.toml` under `[hooks.state]`, with a content baseline in
`~/.codex/.hook-trust/`. If the install cannot reach Codex, it says so; then trust the `sitrep-codex` hooks in Codex's
`/hooks` instead.
diff --git a/docs/TUTORIAL.md b/docs/TUTORIAL.md
index 5fd6688..16bb7d0 100644
--- a/docs/TUTORIAL.md
+++ b/docs/TUTORIAL.md
@@ -77,9 +77,10 @@ amber needs you, blue idle, orange stuck, red failed.
At the top are its state and name; machine, model and effort, path, repo and git state; and Resume, Fork and the
session id to copy. Then its facts (cost, tokens, time, context, the last minute's trends), its plan as a checklist,
-and its agents as a Timeline or a tree with their files. At the foot is the message box (a message, `/clear` or
-`/compact`); a session the dashboard cannot answer, like the simulator's, reads "Answer in its terminal" instead. An
-open question, permission or plan shows first, with its answer.
+and its agents as a Timeline or a tree with their files. **Hide done** takes the done agents off the Timeline.
+At the foot is the message box (a message, `/clear` or `/compact`); a session the dashboard cannot answer, like the
+simulator's, reads "Answer in its terminal" instead. An open question, permission or plan shows first, with its
+answer.
## Machines
@@ -98,7 +99,7 @@ exports) and the commands that fix them. **Remove** and **Remove silent** take m
![Settings](tutorial/10-settings.png)
Server settings (answering, the activity feed, stuck thresholds, timers, retention) apply at once. Prices shows what
-each model costs, long-context lines included. This browser holds the theme, notifications, refresh rates, Animation
+each model costs, long-context and fast-mode lines included. This browser holds the theme, notifications, refresh rates, Animation
and the keys.
![History](tutorial/11-history.png)
diff --git a/docs/demo.gif b/docs/demo.gif
index a00b0f9..00a25e2 100644
Binary files a/docs/demo.gif and b/docs/demo.gif differ
diff --git a/docs/tutorial/01-fleet-cards.png b/docs/tutorial/01-fleet-cards.png
index 016ec54..890604e 100644
Binary files a/docs/tutorial/01-fleet-cards.png and b/docs/tutorial/01-fleet-cards.png differ
diff --git a/docs/tutorial/02-fleet-list.png b/docs/tutorial/02-fleet-list.png
index 67d73e2..ca292b4 100644
Binary files a/docs/tutorial/02-fleet-list.png and b/docs/tutorial/02-fleet-list.png differ
diff --git a/docs/tutorial/03-fleet-graph.png b/docs/tutorial/03-fleet-graph.png
index d72712e..a98a63d 100644
Binary files a/docs/tutorial/03-fleet-graph.png and b/docs/tutorial/03-fleet-graph.png differ
diff --git a/docs/tutorial/04-plans.png b/docs/tutorial/04-plans.png
index 2b9ad89..c914a19 100644
Binary files a/docs/tutorial/04-plans.png and b/docs/tutorial/04-plans.png differ
diff --git a/docs/tutorial/05-fleet-light.png b/docs/tutorial/05-fleet-light.png
index 5074362..a52cd5f 100644
Binary files a/docs/tutorial/05-fleet-light.png and b/docs/tutorial/05-fleet-light.png differ
diff --git a/docs/tutorial/07-session.png b/docs/tutorial/07-session.png
index 011ceb9..f1805e7 100644
Binary files a/docs/tutorial/07-session.png and b/docs/tutorial/07-session.png differ
diff --git a/docs/tutorial/08-machines.png b/docs/tutorial/08-machines.png
index c4e54da..c7c2c6b 100644
Binary files a/docs/tutorial/08-machines.png and b/docs/tutorial/08-machines.png differ
diff --git a/docs/tutorial/09-add-a-machine.png b/docs/tutorial/09-add-a-machine.png
index 77cc432..66138ce 100644
Binary files a/docs/tutorial/09-add-a-machine.png and b/docs/tutorial/09-add-a-machine.png differ
diff --git a/docs/tutorial/10-settings.png b/docs/tutorial/10-settings.png
index 2323f1b..5772725 100644
Binary files a/docs/tutorial/10-settings.png and b/docs/tutorial/10-settings.png differ
diff --git a/docs/tutorial/11-history.png b/docs/tutorial/11-history.png
index 0020102..1757c18 100644
Binary files a/docs/tutorial/11-history.png and b/docs/tutorial/11-history.png differ
diff --git a/frontend/package.json b/frontend/package.json
index d446a98..d8d72ef 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,6 +1,6 @@
{
"name": "frontend",
- "version": "0.4.1",
+ "version": "0.5.0",
"private": true,
"license": "MIT",
"type": "module",
diff --git a/frontend/src/fleet/views/graph/model.ts b/frontend/src/fleet/views/graph/model.ts
index 9679ae0..7f1f2c9 100644
--- a/frontend/src/fleet/views/graph/model.ts
+++ b/frontend/src/fleet/views/graph/model.ts
@@ -175,9 +175,14 @@ export function buildGraph(sessions: readonly SessionView[], group: GroupBy, lab
/** Text widths in em, generous for IBM Plex Sans: the page never measures text. */
const EM: Readonly<Record<string, number>> = { " ": 0.3, i: 0.27, l: 0.27, j: 0.29, ".": 0.3, ",": 0.3, ":": 0.3, ";": 0.3, "|": 0.3, "!": 0.3, "'": 0.25, f: 0.38, t: 0.38, r: 0.4, "(": 0.38, ")": 0.38, "[": 0.36, "]": 0.36, I: 0.3, m: 0.88, w: 0.8, M: 0.92, W: 1, "·": 0.34, "…": 0.94, "-": 0.44, _: 0.58, "/": 0.4 };
+/**
+ * A character drawn a full em wide, in the system's face (Plex has none): CJK ideographs, kana, hangul and the marks written
+ * with them (by script extension, so "ー" and "・" count), their punctuation and full-width forms.
+ */
+const WIDE = /[\p{scx=Han}\p{scx=Hiragana}\p{scx=Katakana}\p{scx=Hangul} -〿!-⦆¢-₩]/u;
export function textW(text: string, px: number, bold = false): number {
let em = 0;
- for (const c of text) em += EM[c] ?? (c >= "A" && c <= "Z" ? 0.69 : c >= "0" && c <= "9" ? 0.6 : c >= "a" && c <= "z" ? 0.555 : 0.7);
+ for (const c of text) em += EM[c] ?? (c >= "A" && c <= "Z" ? 0.69 : c >= "0" && c <= "9" ? 0.6 : c >= "a" && c <= "z" ? 0.555 : WIDE.test(c) ? 1 : 0.7);
return em * px * (bold ? 1.05 : 1.01) + 2;
}
/** The provider logo and its gap before a loop's second line, px. */
diff --git a/frontend/src/fleet/views/session/SessionHeader.tsx b/frontend/src/fleet/views/session/SessionHeader.tsx
index 31ef6bb..36ec68b 100644
--- a/frontend/src/fleet/views/session/SessionHeader.tsx
+++ b/frontend/src/fleet/views/session/SessionHeader.tsx
@@ -19,6 +19,7 @@ import { useRespond } from "../../useRespond";
import { clock, type Part } from "./bits";
import { endReasonWords } from "./endReason";
import { gitFacts } from "./GitFacts";
+import { agentName } from "./trace";
/** A pencil: the Rename control beside the name. */
const PENCIL = (
@@ -165,16 +166,35 @@ export function SessionHead({ s, now, readOnly }: HeadProps) {
);
}
-/** Files another loop edited within 5 minutes of this session editing them, each with who and when. */
-function Collisions({ s }: { s: SessionView }) {
+/**
+ * Files another loop edited within 5 minutes of this session editing them, each with who and when. An agent is named as
+ * the Timeline names it and, in another session the page holds, with that session. Loops that still read the same on one
+ * file (agents of one type in a session that has left the page) are one line with their count, at the latest of them.
+ */
+function Collisions({ s, sessions }: { s: SessionView; sessions: Readonly<Record<string, SessionView>> }) {
const fileName = (path: string) => path.split("/").filter(Boolean).pop() ?? path;
+ const who = (c: SessionView["collisions"][number]): string => {
+ const session = c.sessionId === s.id ? s : sessions[c.sessionId];
+ const agent = c.agentId === null ? undefined : session?.agents.find((a) => a.id === c.agentId);
+ const name = agent ? agentName(agent) : c.name;
+ if (c.sessionId === s.id) return `${name} in this session`;
+ return agent && session ? `${name} in ${session.name}` : name;
+ };
+ // Newest first, as the server lists them, so a line's first collision is its latest.
+ const lines = new Map<string, { who: string; path: string; at: number; loops: number }>();
+ for (const c of s.collisions) {
+ const name = who(c);
+ const line = lines.get(`${name}\n${c.path}`);
+ if (line) line.loops += 1;
+ else lines.set(`${name}\n${c.path}`, { who: name, path: c.path, at: c.at, loops: 1 });
+ }
return (
<ul className="sv-notice sv-coll" aria-label="Files also edited by another loop">
- {s.collisions.map((c) => (
- <li key={`${c.path}:${c.sessionId}:${c.agentId ?? ""}`} title={c.path}>
- {`Also edited by ${c.name}${c.sessionId === s.id ? " in this session" : ""}: `}
- <span className="sv-mono">{fileName(c.path)}</span>
- <span className="sv-muted">{` at ${clock(c.at)}`}</span>
+ {[...lines].map(([key, l]) => (
+ <li key={key} title={l.path}>
+ {`Also edited by ${l.who}${l.loops > 1 ? ` (${l.loops} loops)` : ""}: `}
+ <span className="sv-mono">{fileName(l.path)}</span>
+ <span className="sv-muted">{` at ${clock(l.at)}`}</span>
</li>
))}
</ul>
@@ -182,7 +202,7 @@ function Collisions({ s }: { s: SessionView }) {
}
/** What the owner should know about this session's reporting: a reporter out of range, Codex hooks off, files another loop edited. */
-export function SessionNotices({ s, readOnly }: { s: SessionView; readOnly: boolean }) {
+export function SessionNotices({ s, sessions, readOnly }: { s: SessionView; sessions: Readonly<Record<string, SessionView>>; readOnly: boolean }) {
const reporter = versionNote(s);
return (
<>
@@ -196,7 +216,7 @@ export function SessionNotices({ s, readOnly }: { s: SessionView; readOnly: bool
{hooksOffText(s)}
</p>
) : null}
- {!readOnly && s.collisions.length ? <Collisions s={s} /> : null}
+ {!readOnly && s.collisions.length ? <Collisions s={s} sessions={sessions} /> : null}
</>
);
}
diff --git a/frontend/src/fleet/views/session/SessionPage.tsx b/frontend/src/fleet/views/session/SessionPage.tsx
index 6eac44d..86bb7a6 100644
--- a/frontend/src/fleet/views/session/SessionPage.tsx
+++ b/frontend/src/fleet/views/session/SessionPage.tsx
@@ -182,7 +182,7 @@ export function SessionPage(props: SessionPageProps) {
return <Page key={props.session.id} {...props} />;
}
-function Page({ session: s, now, readOnly = false, back, events }: SessionPageProps) {
+function Page({ fleet, session: s, now, readOnly = false, back, events }: SessionPageProps) {
const [mode, setMode] = useState<Mode>("timeline");
const [order, setOrder] = useState<AgentSort>(LAUNCH_ORDER);
const [compactsOpen, setCompactsOpen] = useState(false);
@@ -211,7 +211,7 @@ function Page({ session: s, now, readOnly = false, back, events }: SessionPagePr
<div className="sv-page" ref={pageRef}>
{back}
<SessionHead s={s} now={now} readOnly={readOnly} />
- <SessionNotices s={s} readOnly={readOnly} />
+ <SessionNotices s={s} sessions={fleet.sessions} readOnly={readOnly} />
{!readOnly && needsYou(s) ? <AskCard s={s} now={now} /> : null}
<FactsBar s={s} now={now} readOnly={readOnly} onAgent={pickHere} compacts={{ open: compactsShown, onToggle: () => setCompactsOpen(!compactsOpen), controls: compactsId }} />
{compactsShown ? <BlowoutCallout s={s} onAgent={pickHere} id={compactsId} /> : null}
diff --git a/frontend/src/fleet/views/session/Timeline.tsx b/frontend/src/fleet/views/session/Timeline.tsx
index bab0b33..2993577 100644
--- a/frontend/src/fleet/views/session/Timeline.tsx
+++ b/frontend/src/fleet/views/session/Timeline.tsx
@@ -1,8 +1,8 @@
// The session page's Timeline: the delegation trace. The agent tree runs down the left, in launch order or the chosen order
// among siblings; each loop is a line on one shared time axis on the right, branching off the line that launched it with a
// 45-degree knee and ending in its station. Marks sit where something happened; one toolbar row over the drawing holds the
-// Timeline ⇄ Agents switch, the view's controls and the order among siblings, with the legend of every kind of mark it draws
-// on its own row under it. On a live page the inspector lists the same events in words (one source, useSessionEvents; `]`
+// Timeline ⇄ Agents switch, the view's controls, Hide done (the done agents off the drawing, for a session with many) and the
+// order among siblings, with the legend of every kind of mark it draws on its own row under it. On a live page the inspector lists the same events in words (one source, useSessionEvents; `]`
// reopens it) and each row is a button; a stored page from History has no live inspector list, so it lists them below the
// drawing. Either list is how a keyboard reaches what a mark says.
// The drawing pans and zooms in time only: drag, or scroll sideways, to pan; pinch, Ctrl or ⌘ with the wheel, or − and + to zoom;
@@ -14,9 +14,10 @@ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, typ
import { fmtClock, fmtSpan, plural } from "../../format";
import type { AgentSort } from "../../components/AgentTree";
import { defaultAgentDir, ORCHESTRATOR_ROW, type AgentSortKey } from "../../logic";
+import { readJson, writeJson } from "../../storage";
import type { ActivityView, SessionView } from "../../types";
import { Station, StationWord } from "../../ui/Station";
-import { AGENT_SORT_LABELS, axisTicks, buildTrace, eventWords, rowSeconds, type Mark, type MarkKind, type Trace, type TraceRow } from "./trace";
+import { AGENT_SORT_LABELS, agentName, axisTicks, buildTrace, eventWords, rowSeconds, type Mark, type MarkKind, type Trace, type TraceRow } from "./trace";
import { dotsText } from "../../ui/Dots";
import { clock, useWidth } from "./bits";
import type { SessionEvents } from "./useSessionEvents";
@@ -31,6 +32,8 @@ const TOP = 8;
const KNEE = 12;
/** Events listed at first and added per "Show more". */
const EVENTS_PAGE = 12;
+/** The owner's choice to hide done agents, one for every session; off until they make it. */
+const HIDE_DONE_KEY = "session.hideDone";
// ---- the time view -------------------------------------------------------------------------------------------------
@@ -646,7 +649,7 @@ interface DrawingProps {
selected: string | null;
flash: string | null;
onAgent: (id: string) => void;
- /** The toolbar row's first and last controls: the Timeline ⇄ Agents switch, and the order among siblings. */
+ /** The toolbar row's first and last controls: the Timeline ⇄ Agents switch, and which agents show and in what order. */
lead?: ReactNode;
order: ReactNode;
}
@@ -824,25 +827,37 @@ interface TimelineProps {
}
export function Timeline({ s, now, events, eventList, sort, onSort, selected, flash = null, onAgent, lead }: TimelineProps) {
- const trace = useMemo(() => buildTrace(s, now, sort, events.events), [s, now, sort, events.events]);
- const { rows } = trace;
- const rowNames = useMemo(() => new Map(rows.map((r) => [r.id, r.parent === null ? `${r.name} (main loop)` : r.name])), [rows]);
+ const [hideDone, setHideDone] = useState(() => readJson<unknown>(HIDE_DONE_KEY, false) === true);
+ const trace = useMemo(() => buildTrace(s, now, sort, events.events, hideDone), [s, now, sort, events.events, hideDone]);
+ // Every loop's name, the hidden ones' too: the event list names them all.
+ const rowNames = useMemo(() => new Map([[ORCHESTRATOR_ROW, `${s.name} (main loop)`], ...s.agents.map((a): [string, string] => [a.id, agentName(a)])]), [s.name, s.agents]);
const pickSort = (value: string) => {
if (value === "launch") onSort({ key: null, dir: 1 });
else onSort({ key: value as AgentSortKey, dir: defaultAgentDir(value as AgentSortKey) });
};
+ const toggleDone = () => {
+ writeJson(HIDE_DONE_KEY, !hideDone);
+ setHideDone(!hideDone);
+ };
const order = (
- <label className="sv-field sv-order">
- <span>Order siblings by</span>
- <select className="ui-select" value={sort.key ?? "launch"} onChange={(e) => pickSort(e.target.value)}>
- <option value="launch">Launch time</option>
- {(Object.keys(AGENT_SORT_LABELS) as AgentSortKey[]).map((k) => (
- <option key={k} value={k}>
- {AGENT_SORT_LABELS[k]}
- </option>
- ))}
- </select>
- </label>
+ <div className="sv-order">
+ {trace.done > 0 ? (
+ <button type="button" className="ui-button sv-hide" aria-pressed={hideDone} title="Take the done agents off the Timeline. One with an agent under it that is not done stays." onClick={toggleDone}>
+ Hide done <b>{trace.done}</b>
+ </button>
+ ) : null}
+ <label className="sv-field">
+ <span>Order siblings by</span>
+ <select className="ui-select" value={sort.key ?? "launch"} onChange={(e) => pickSort(e.target.value)}>
+ <option value="launch">Launch time</option>
+ {(Object.keys(AGENT_SORT_LABELS) as AgentSortKey[]).map((k) => (
+ <option key={k} value={k}>
+ {AGENT_SORT_LABELS[k]}
+ </option>
+ ))}
+ </select>
+ </label>
+ </div>
);
return (
diff --git a/frontend/src/fleet/views/session/session.css b/frontend/src/fleet/views/session/session.css
index d3d6226..5279769 100644
--- a/frontend/src/fleet/views/session/session.css
+++ b/frontend/src/fleet/views/session/session.css
@@ -289,7 +289,10 @@ td.sv-n { font-variant-numeric: tabular-nums; }
Fit, Now; how the drawing moves is their title), and the order among siblings. */
.sv-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); min-height: 32px; margin-bottom: var(--s2); }
.sv-bar > * { flex: none; }
-.sv-order { margin-left: auto; }
+.sv-order { display: flex; align-items: center; gap: var(--s4); margin-left: auto; }
+/* Hide done: pressed, it reads as selected, as the Fleet's Background chip does; its count in the mono face. */
+.ui-button.sv-hide[aria-pressed="true"] { font-weight: 600; background: var(--band); box-shadow: inset 0 -2px 0 var(--ink); }
+.sv-hide b { font-family: var(--font-mono); font-weight: 600; }
.sv-tl-view { display: flex; align-items: center; gap: var(--s1); }
.sv-tl-view .ui-button { min-width: 32px; }
diff --git a/frontend/src/fleet/views/session/trace.ts b/frontend/src/fleet/views/session/trace.ts
index 6d19b7b..b00bc61 100644
--- a/frontend/src/fleet/views/session/trace.ts
+++ b/frontend/src/fleet/views/session/trace.ts
@@ -3,7 +3,7 @@
// row is a line on one shared time axis from its start to its end (or now). Marks sit on the lines where something
// happened: an ask, a wait on the owner, a failure, an auto-compact, a message between loops, a file two loops edited.
// The drawing pans and zooms over one plain time scale; `axisTicks` labels whatever span is in view.
-import { agentElapsedSec, agentOrder, buildTree, familyName, ORCHESTRATOR_ROW, type AgentSortKey } from "../../logic";
+import { agentElapsedSec, agentOrder, buildTree, familyName, ORCHESTRATOR_ROW, type AgentSortKey, type TreeRow } from "../../logic";
import { readableEvent } from "../../eventText";
import { fmtClock, fmtDay, fmtTok, plural } from "../../format";
import { stateOf, waitingOnByRow } from "../../states";
@@ -70,6 +70,8 @@ export interface Trace {
t0: number;
t1: number;
live: boolean;
+ /** How many agents "Hide done" takes off the drawing, counted whether or not it is on. */
+ done: number;
}
const ASK_NOUN: Record<AskKind, string> = { question: "Question", permission: "Permission request", plan: "Plan approval" };
@@ -97,8 +99,23 @@ export function agentKindText(a: AgentView): string {
return a.kind === "fork" ? "fork" : a.type;
}
-/** The rows: the main loop first, then the agent tree in its order. */
-function traceRows(s: SessionView, now: number, sort: { key: AgentSortKey | null; dir: 1 | -1 }): TraceRow[] {
+/**
+ * The agents "Hide done" takes off the Timeline, by their place in `tree`: a done agent with nothing under it still running,
+ * queued, failed or stopped, so a line left on the drawing never loses the line it branched from. In buildTree's order an
+ * agent's descendants follow it, each deeper than it.
+ */
+function doneBranches(tree: readonly TreeRow[]): boolean[] {
+ const gone = new Array<boolean>(tree.length);
+ for (let i = tree.length - 1; i >= 0; i--) {
+ let all = tree[i]!.agent.status === "done";
+ for (let j = i + 1; all && j < tree.length && tree[j]!.guides.length > tree[i]!.guides.length; j++) all = gone[j]!;
+ gone[i] = all;
+ }
+ return gone;
+}
+
+/** The rows: the main loop first, then the agent tree in its order, without its done branches when they are hidden. */
+function traceRows(s: SessionView, now: number, sort: { key: AgentSortKey | null; dir: 1 | -1 }, hideDone: boolean): { rows: TraceRow[]; done: number } {
const live = s.status !== "done";
const end = sessionEnd(s, now);
const asking = new Set(s.asks.filter((a) => a.state !== "closed" && a.agentId !== null).map((a) => a.agentId!));
@@ -124,8 +141,10 @@ function traceRows(s: SessionView, now: number, sort: { key: AgentSortKey | null
},
];
const tree = buildTree(s.agents, sort.key ? agentOrder(sort.key, sort.dir, now) : undefined);
+ const gone = doneBranches(tree);
const index = new Map<string, number>();
- for (const { agent: a, guides } of tree) {
+ for (const [i, { agent: a, guides }] of tree.entries()) {
+ if (hideDone && gone[i]) continue;
const station = agentStationKind(a, live && asking.has(a.id), delegating.has(a.id));
const finished = a.status === "done" || a.status === "failed" || a.status === "aborted";
const start = Math.min(a.startedAt, end);
@@ -148,7 +167,7 @@ function traceRows(s: SessionView, now: number, sort: { key: AgentSortKey | null
queued: a.status === "queued",
});
}
- return rows;
+ return { rows, done: gone.filter(Boolean).length };
}
/** An auto-compact in words: the tokens before and after when the server saw them, and a request that overran the window. */
@@ -281,13 +300,14 @@ function traceMarks(s: SessionView, rows: readonly TraceRow[], events: readonly
return marks.sort((a, b) => a.t - b.t);
}
-export function buildTrace(s: SessionView, now: number, sort: { key: AgentSortKey | null; dir: 1 | -1 }, events: readonly ActivityView[]): Trace {
- const rows = traceRows(s, now, sort);
+export function buildTrace(s: SessionView, now: number, sort: { key: AgentSortKey | null; dir: 1 | -1 }, events: readonly ActivityView[], hideDone = false): Trace {
+ const { rows, done } = traceRows(s, now, sort, hideDone);
+ // A mark from or to a hidden agent is left off with its row, as for any loop not on the trace (traceMarks).
const marks = traceMarks(s, rows, events);
const t0 = Math.min(s.startedAt, ...rows.map((r) => r.start));
// How short a span the view fits is the Timeline's own floor (MIN_SPAN), not the trace's.
const t1 = Math.max(rows[0]!.end, ...rows.map((r) => r.end));
- return { rows, marks, t0, t1, live: s.status !== "done" };
+ return { rows, marks, t0, t1, live: s.status !== "done", done };
}
// ---- the axis ------------------------------------------------------------------------------------------------------
diff --git a/frontend/src/fleet/views/settings/SettingsView.tsx b/frontend/src/fleet/views/settings/SettingsView.tsx
index a92ee3b..db0f2e2 100644
--- a/frontend/src/fleet/views/settings/SettingsView.tsx
+++ b/frontend/src/fleet/views/settings/SettingsView.tsx
@@ -2,8 +2,8 @@
// server keeps in its settings table with server.env as the defaults and applies at once, Require sign-in to view among
// them; a change needs the sign-in, goes out as a partial PUT, and Reset sends null, which drops the stored value so
// server.env's applies again; a timer below its minimum is refused here as the server refuses it. Prices: where the table came
-// from (LiteLLM at start, or the built-in snapshot and why), the table, read-only, a row's long-request prices on a second line
-// under it, and the models seen with no price. This browser: theme, animation, notifications, refresh rates, and the console's
+// from (LiteLLM at start, or the built-in snapshot and why), the table, read-only, a row's long-request and fast-mode prices on
+// lines of their own under it, and the models seen with no price. This browser: theme, animation, notifications, refresh rates, and the console's
// keys with a button that hides or shows the top bar. About: what only server.env and a restart change, the server's commands,
// and the backup.
import { Fragment, useCallback, useEffect, useId, useState, type ReactNode } from "react";
@@ -289,9 +289,9 @@ function Prices({ body }: { body: SettingsBody }) {
</tr>
</thead>
<tbody>
- {body.prices.rows.map(({ model, label, std, long }) => (
+ {body.prices.rows.map(({ model, label, std, long, fast }) => (
<Fragment key={model}>
- <tr className={long ? "st-has-long" : undefined}>
+ <tr className={long || fast ? "st-has-long" : undefined}>
{/* The label shows only when it differs from the id (an override's name, or the priced row's key for an alias or a
`[1m]` id); the id always shows, once. */}
<th scope="row">
@@ -304,18 +304,21 @@ function Prices({ body }: { body: SettingsBody }) {
</td>
))}
</tr>
- {long ? (
- <tr className="st-long">
- <th scope="row" aria-label={`${label}, ${long.when}`}>
- {long.when}
- </th>
- {PRICE_COLUMNS.map(([key]) => (
- <td key={key} className="st-n">
- {fmtPrice(long.prices[key])}
- </td>
- ))}
- </tr>
- ) : null}
+ {/* A row's other prices, each on its own line under it: a long request's, then a fast-mode one's. */}
+ {[long, fast].map((other, i, all) =>
+ other ? (
+ <tr key={other.when} className={all.slice(i + 1).some(Boolean) ? "st-long st-has-long" : "st-long"}>
+ <th scope="row" aria-label={`${label}, ${other.when}`}>
+ {other.when}
+ </th>
+ {PRICE_COLUMNS.map(([key]) => (
+ <td key={key} className="st-n">
+ {fmtPrice(other.prices[key])}
+ </td>
+ ))}
+ </tr>
+ ) : null,
+ )}
</Fragment>
))}
</tbody>
diff --git a/hermes-reporter/package.json b/hermes-reporter/package.json
index 9b74b17..db79383 100644
--- a/hermes-reporter/package.json
+++ b/hermes-reporter/package.json
@@ -1,6 +1,6 @@
{
"name": "hermes-reporter",
- "version": "0.4.1",
+ "version": "0.5.0",
"private": true,
"license": "MIT",
"type": "module",
diff --git a/mod/claude-reporter/.claude-plugin/plugin.json b/mod/claude-reporter/.claude-plugin/plugin.json
index cd6b1d2..e0f9891 100644
--- a/mod/claude-reporter/.claude-plugin/plugin.json
+++ b/mod/claude-reporter/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "sitrep-reporter",
- "version": "0.4.1",
+ "version": "0.5.0",
"description": "Reports this Claude Code session (model, effort, plan, agents, context, git, failures) to a SITREP server, and takes answers sent from it.",
"userConfig": {
"serverUrl": {
diff --git a/mod/claude-reporter/hooks/protocol.ts b/mod/claude-reporter/hooks/protocol.ts
index 7f26f4a..25c7c37 100644
--- a/mod/claude-reporter/hooks/protocol.ts
+++ b/mod/claude-reporter/hooks/protocol.ts
@@ -81,9 +81,10 @@ export type UsageTokens = TokenCounts & { cacheWrite1h: number };
/**
* What one model used, for the server to price against its table. `tier: 'long'` marks a long-context request: for
* Claude, a prompt (input, cache reads and cache writes together) over 100,000 tokens; for Codex, input over 272,000 tokens,
- * where OpenAI's long-context pricing starts.
+ * where OpenAI's long-context pricing starts. `tier: 'fast'` marks a request made in Claude's fast mode, whose price is one
+ * rate at any prompt length.
*/
-const USAGE_TIERS = ['std', 'long'] as const;
+const USAGE_TIERS = ['std', 'long', 'fast'] as const;
export interface ModelUsage {
model: string;
tier: (typeof USAGE_TIERS)[number];
@@ -1025,6 +1026,8 @@ export interface PriceRowView {
std: ModelPriceSet;
/** The row's prices for a long request, when it has them, and when they apply ("over 272K input tokens"). */
long?: { when: string; prices: ModelPriceSet };
+ /** The row's prices for a fast-mode request, when it has them, and when they apply ("in fast mode"). */
+ fast?: { when: string; prices: ModelPriceSet };
}
/** GET /api/fleet/settings (a browser read), and the reply to PUT /api/fleet/admin/settings. */
diff --git a/package-lock.json b/package-lock.json
index 9736d2e..0cbc2f9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "sitrep",
- "version": "0.4.1",
+ "version": "0.5.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sitrep",
- "version": "0.4.1",
+ "version": "0.5.0",
"license": "MIT",
"workspaces": [
"server",
@@ -25,7 +25,7 @@
}
},
"codex-reporter": {
- "version": "0.4.1",
+ "version": "0.5.0",
"license": "MIT",
"dependencies": {
"ws": "^8.22.0"
@@ -41,7 +41,7 @@
}
},
"frontend": {
- "version": "0.4.1",
+ "version": "0.5.0",
"license": "MIT",
"dependencies": {
"d3-force": "^3.0.0",
@@ -62,7 +62,7 @@
}
},
"hermes-reporter": {
- "version": "0.4.1",
+ "version": "0.5.0",
"license": "MIT",
"devDependencies": {
"@types/node": "^24.19.2",
@@ -4815,7 +4815,7 @@
}
},
"server": {
- "version": "0.4.1",
+ "version": "0.5.0",
"license": "MIT",
"dependencies": {
"dotenv": "^18.0.9",
diff --git a/package.json b/package.json
index a532380..c7cd285 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "sitrep",
- "version": "0.4.1",
+ "version": "0.5.0",
"private": true,
"license": "MIT",
"type": "module",
diff --git a/server/package.json b/server/package.json
index a48eaf8..a59b095 100644
--- a/server/package.json
+++ b/server/package.json
@@ -1,6 +1,6 @@
{
"name": "server",
- "version": "0.4.1",
+ "version": "0.5.0",
"private": true,
"license": "MIT",
"type": "module",
diff --git a/server/prices.json b/server/prices.json
index babc4d7..257c398 100644
--- a/server/prices.json
+++ b/server/prices.json
@@ -2,7 +2,7 @@
"notes": [
"Overrides laid over the price table. The table is LiteLLM's model_prices_and_context_window.json: a copy ships with the server (server/model_prices_and_context_window.json), and the server refreshes it from LiteLLM once at start. Every cost the dashboard shows is an estimate; a model priced by neither reads n/a, never $0.",
"A row here prices the model id it is keyed by (lower case), in place of LiteLLM's row for that id. USD per million tokens.",
- "Fields per tier: input, output, cacheRead, cacheWrite (Anthropic: 5-minute write; OpenAI: 30-minute write), cacheWrite1h (Anthropic: 1-hour write; OpenAI: 12-hour write). 'long' is the price for a long request: Claude, a prompt (input + cache reads + cache writes) over 100,000 tokens; Codex, a request over 272,000 input tokens."
+ "Fields per tier: input, output, cacheRead, cacheWrite (Anthropic: 5-minute write; OpenAI: 30-minute write), cacheWrite1h (Anthropic: 1-hour write; OpenAI: 12-hour write). 'long' is the price for a long request: Claude, a prompt (input + cache reads + cache writes) over 100,000 tokens; Codex, a request over 272,000 input tokens. 'fast' is the price for a request made in Claude's fast mode."
],
"models": {}
}
diff --git a/server/src/fleet/ingest.ts b/server/src/fleet/ingest.ts
index 1ca670f..bcdeeb0 100644
--- a/server/src/fleet/ingest.ts
+++ b/server/src/fleet/ingest.ts
@@ -338,7 +338,7 @@ export function ingestReport(f: FleetDb, report: Report, serverTime: number, own
/**
* Stores a batch of Claude Code's API requests from one machine, in one transaction. A request already counted (its id
* noted) is skipped, so an exporter's resend counts nothing. Each new one adds its tokens to its session's sums, and books its price,
- * at the long tier when its own prompt is long, to the spend record on its own day: every request is spend as it happens, with no
+ * at the fast tier when it was made in fast mode, else at the long tier when its own prompt is long, to the spend record on its own day: every request is spend as it happens, with no
* mark and no first figure. A session not reported yet keeps its sums until its first report reads them. Each stored session the
* batch touched then takes its usage, and its agents theirs, from the sums, and this second's sample with what the batch booked for
* it; a report in the same second writes the same sample again with the same figures (storeSample), so nothing counts twice.
diff --git a/server/src/fleet/pricing.ts b/server/src/fleet/pricing.ts
index fad0389..2a072e3 100644
--- a/server/src/fleet/pricing.ts
+++ b/server/src/fleet/pricing.ts
@@ -21,6 +21,8 @@ export interface ModelPrice {
std: ModelPriceSet;
/** Higher prices for a long request (the reporters' `long` tier: Claude over 100,000 prompt tokens, Codex over 272,000 input tokens); only some models have them. */
long?: ModelPriceSet;
+ /** The prices of a request made in Claude's fast mode (the `fast` tier); only the models that have a fast mode. */
+ fast?: ModelPriceSet;
}
/** Where a start's price table came from (Settings). */
@@ -72,7 +74,9 @@ const tidy = (n: number): number => Number(n.toPrecision(12));
* One LiteLLM entry as a price row, or null when it has no input and output price per token. A cache rate it leaves out is, for
* Claude, its usual multiple of the input price (reads 0.1×, 5-minute writes 1.25×, 1-hour writes 2×), and the input price for
* any other model, as OpenAI bills cache use it lists no price for. The 1-hour write is LiteLLM's `_above_1hr` rate (Anthropic)
- * or `_above_12hr` (OpenAI's 12-hour write).
+ * or `_above_12hr` (OpenAI's 12-hour write). A model with a fast mode carries LiteLLM's multiple for it
+ * (`provider_specific_entry.fast`), which LiteLLM applies to a fast request's whole cost, cache reads and writes included
+ * (its `llms/anthropic/cost_calculation.py`); the fast prices here are the standard ones times it.
*/
function litellmRow(id: string, e: Record<string, unknown>): ModelPrice | null {
const rate = (field: string): number | null => {
@@ -98,7 +102,9 @@ function litellmRow(id: string, e: Record<string, unknown>): ModelPrice | null {
const std = set('');
if (std === null) return null;
const long = set(longSuffix(id));
- return { label: id, std, ...(long ? { long } : {}) };
+ const times = (e.provider_specific_entry as { fast?: unknown } | null | undefined)?.fast;
+ const fast = typeof times === 'number' && Number.isFinite(times) && times > 0 ? (Object.fromEntries(PRICE_FIELDS.map((field) => [field, tidy(std[field] * times)])) as unknown as ModelPriceSet) : null;
+ return { label: id, std, ...(long ? { long } : {}), ...(fast && priceFault(fast) === null ? { fast } : {}) };
}
/**
@@ -123,13 +129,13 @@ export function parsePrices(json: unknown, where = 'prices'): Record<string, Mod
if (!models || typeof models !== 'object' || Array.isArray(models)) throw new Error(`${where}: expected an object "models"`);
const out: Record<string, ModelPrice> = {};
for (const [key, row] of Object.entries(models as Record<string, unknown>)) {
- const r = (row ?? {}) as { label?: unknown; std?: unknown; long?: unknown };
- for (const tier of ['std', 'long'] as const) {
- const problem = tier === 'long' && r.long === undefined ? null : priceFault(r[tier]);
+ const r = (row ?? {}) as { label?: unknown; std?: unknown; long?: unknown; fast?: unknown };
+ for (const tier of ['std', 'long', 'fast'] as const) {
+ const problem = tier !== 'std' && r[tier] === undefined ? null : priceFault(r[tier]);
if (problem) throw new Error(`${where}: models.${key}.${tier}: ${problem}`);
}
const label = typeof r.label === 'string' ? r.label : key;
- out[key.toLowerCase()] = { label, std: r.std as ModelPriceSet, ...(r.long === undefined ? {} : { long: r.long as ModelPriceSet }) };
+ out[key.toLowerCase()] = { label, std: r.std as ModelPriceSet, ...(r.long === undefined ? {} : { long: r.long as ModelPriceSet }), ...(r.fast === undefined ? {} : { fast: r.fast as ModelPriceSet }) };
}
return out;
}
@@ -180,13 +186,13 @@ export class Pricing {
return key !== undefined && Object.hasOwn(this.table, key) ? this.table[key]! : null;
}
- /** The rows that price `models`, one per model, in its order, each with its long prices and when they apply; unpriced models are left out. */
+ /** The rows that price `models`, one per model, in its order, each with its long and fast prices and when they apply; unpriced models are left out. */
rowsFor(models: readonly string[]): PriceRowView[] {
return models.flatMap((model) => {
const row = this.rowFor(model);
if (!row) return [];
const when = isClaude(keyOf(model)) ? 'over 100K prompt tokens' : 'over 272K input tokens';
- return [{ model, label: row.label, std: row.std, ...(row.long ? { long: { when, prices: row.long } } : {}) }];
+ return [{ model, label: row.label, std: row.std, ...(row.long ? { long: { when, prices: row.long } } : {}), ...(row.fast ? { fast: { when: 'in fast mode', prices: row.fast } } : {}) }];
});
}
@@ -205,7 +211,7 @@ export class Pricing {
if (row === null) unpriced = true;
else {
priced = true;
- total += usdAt(tokens, tier === 'long' && row.long ? row.long : row.std);
+ total += usdAt(tokens, (tier === 'std' ? undefined : row[tier]) ?? row.std);
}
}
return unpriced && !priced ? null : total;
diff --git a/server/src/fleet/protocol.ts b/server/src/fleet/protocol.ts
index 7f26f4a..25c7c37 100644
--- a/server/src/fleet/protocol.ts
+++ b/server/src/fleet/protocol.ts
@@ -81,9 +81,10 @@ export type UsageTokens = TokenCounts & { cacheWrite1h: number };
/**
* What one model used, for the server to price against its table. `tier: 'long'` marks a long-context request: for
* Claude, a prompt (input, cache reads and cache writes together) over 100,000 tokens; for Codex, input over 272,000 tokens,
- * where OpenAI's long-context pricing starts.
+ * where OpenAI's long-context pricing starts. `tier: 'fast'` marks a request made in Claude's fast mode, whose price is one
+ * rate at any prompt length.
*/
-const USAGE_TIERS = ['std', 'long'] as const;
+const USAGE_TIERS = ['std', 'long', 'fast'] as const;
export interface ModelUsage {
model: string;
tier: (typeof USAGE_TIERS)[number];
@@ -1025,6 +1026,8 @@ export interface PriceRowView {
std: ModelPriceSet;
/** The row's prices for a long request, when it has them, and when they apply ("over 272K input tokens"). */
long?: { when: string; prices: ModelPriceSet };
+ /** The row's prices for a fast-mode request, when it has them, and when they apply ("in fast mode"). */
+ fast?: { when: string; prices: ModelPriceSet };
}
/** GET /api/fleet/settings (a browser read), and the reply to PUT /api/fleet/admin/settings. */
diff --git a/server/src/fleet/telemetry.ts b/server/src/fleet/telemetry.ts
index d481253..b0a33fc 100644
--- a/server/src/fleet/telemetry.ts
+++ b/server/src/fleet/telemetry.ts
@@ -1,5 +1,5 @@
// Claude Code's own telemetry (code.claude.com/docs/en/monitoring-usage): one OTLP log event, `api_request`, per model API request,
-// naming its request id, session, agent, model and token counts. Claude usage comes from these. This reads one OTLP/HTTP
+// naming its request id, session, agent, model, speed and token counts. Claude usage comes from these. This reads one OTLP/HTTP
// JSON logs export (opentelemetry.io/docs/specs/otlp, "JSON Protobuf Encoding": lowerCamelCase keys, 64-bit integers as decimal
// strings or numbers) and keeps only those events, and of each only the attributes usage needs. Every other event and attribute
// (the account, email and prompt fields among them) is dropped here and never stored or logged.
@@ -21,7 +21,7 @@ export interface ApiRequest {
const LONG_PROMPT = 100_000;
/** The only attributes read. */
-const WANTED = new Set(['event.name', 'request_id', 'session.id', 'agent_id', 'model', 'input_tokens', 'output_tokens', 'cache_read_tokens', 'cache_creation_tokens', 'cache_creation_5m_tokens', 'cache_creation_1h_tokens']);
+const WANTED = new Set(['event.name', 'request_id', 'session.id', 'agent_id', 'model', 'speed', 'input_tokens', 'output_tokens', 'cache_read_tokens', 'cache_creation_tokens', 'cache_creation_5m_tokens', 'cache_creation_1h_tokens']);
/** An OTLP AnyValue, of the kinds read here. */
interface AnyValue {
@@ -58,7 +58,8 @@ function ms(nanos: unknown): number | null {
/**
* One `api_request` record as a request; null when it lacks what counting it needs: its request id, session id, model and four token
* counts. Cache writes are split by lifetime as Claude Code reports them; writes it gives no lifetime for (both splits 0, as when
- * the API reports none) are 5-minute writes, the API's default lifetime.
+ * the API reports none) are 5-minute writes, the API's default lifetime. A request Claude Code marks `speed: "fast"` is of the
+ * fast tier at any prompt length, as fast mode is billed; one it marks "normal", or does not mark, is long or standard.
*/
function requestOf(attrs: ReadonlyMap<string, AnyValue>, t: number): ApiRequest | null {
const requestId = str(attrs.get('request_id'), LIMITS.id);
@@ -68,7 +69,7 @@ function requestOf(attrs: ReadonlyMap<string, AnyValue>, t: number): ApiRequest
if (!requestId || !sessionId || !model || input === null || output === null || cacheRead === null || written === null) return null;
const oneHour = count(attrs.get('cache_creation_1h_tokens')) ?? 0;
const tokens: UsageTokens = { input, output, cacheRead, cacheWrite: Math.max(count(attrs.get('cache_creation_5m_tokens')) ?? 0, written - oneHour), cacheWrite1h: oneHour };
- const tier = input + cacheRead + written > LONG_PROMPT ? 'long' : 'std';
+ const tier = str(attrs.get('speed'), LIMITS.short) === 'fast' ? 'fast' : input + cacheRead + written > LONG_PROMPT ? 'long' : 'std';
return { requestId, sessionId, agentId: str(attrs.get('agent_id'), LIMITS.id), t, usage: { model, tier, tokens } };
}