@vladar107/claudescope 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,61 +5,84 @@
5
5
  [![node](https://img.shields.io/node/v/@vladar107/claudescope)](https://nodejs.org)
6
6
  [![license](https://img.shields.io/npm/l/@vladar107/claudescope)](./LICENSE)
7
7
 
8
- *A scope for your Claude Code sessions.*
8
+ *A scope for your AI coding-agent sessions.*
9
9
 
10
- A local, **read-only** web app to browse, read, search, and analyze your
11
- [Claude Code](https://claude.com/claude-code) session transcripts
12
- (`~/.claude/projects/**/*.jsonl`).
10
+ A local, **read-only**, multi-agent viewer to browse, read, search, and analyze
11
+ your AI coding-agent transcripts in one place — both
12
+ [Claude Code](https://claude.com/claude-code) (`~/.claude/projects/**/*.jsonl`)
13
+ and [OpenAI Codex](https://openai.com/codex) (`~/.codex/sessions/**/rollout-*.jsonl`).
14
+ Sessions from every agent that worked in a directory are **merged under one
15
+ project**, each tagged with the agent that produced it.
13
16
 
17
+ - **Multi-agent** — Claude Code and Codex sessions side by side, each labeled with an **agent badge**. A project that several agents touched shows one card with all its agent tags; drill in and **filter the session list by agent**.
14
18
  - **Browse** every session grouped by project — titles, dates, message/tool counts, token totals, cost, git branch, PR links.
15
- - **Read** a session as a clean threaded conversation: markdown, syntax-highlighted code, collapsible thinking, paired tool calls + results, **syntax-highlighted red/green diffs** for `Edit`/`MultiEdit`, attachments, and sidechain/subagent turns. A built-in **find-in-session** bar (⌘/Ctrl+F) searches the whole transcript — including collapsed thinking, tool, and subagent content — auto-expanding and highlighting matches, with a user/assistant filter.
16
- - **Review changes** via a **Files changed** tab that aggregates every `Edit`/`MultiEdit`/`Write` in the session by file, with per-file diffs and +/− counts (diffs load lazily per file).
19
+ - **Read** a session as a clean threaded conversation: markdown, syntax-highlighted code, collapsible thinking, paired tool calls + results, **syntax-highlighted red/green diffs** for edits, attachments, and sidechain/subagent turns. A built-in **find-in-session** bar (⌘/Ctrl+F) searches the whole transcript — including collapsed thinking, tool, and subagent content — auto-expanding and highlighting matches, with a user/assistant filter.
20
+ - **Review changes** via a **Files changed** tab that aggregates every edit/write in the session by file, with per-file diffs and +/− counts (diffs load lazily per file).
17
21
  - **Export / share** a session to Markdown — download or copy it, with an optional toggle to **redact** home-dir paths and likely secrets.
18
- - **Search** full-text across all sessions (DuckDB BM25), with highlighted snippets that deep-link to the exact message.
19
- - **Analyze** token usage and cost over time, by project, and by model — including cache-hit ratio.
22
+ - **Search** full-text across all sessions, all agents (DuckDB BM25), with highlighted snippets that deep-link to the exact message.
23
+ - **Analyze** token usage and cost over time, by project, by model, and **by agent** — including cache-hit ratio.
24
+ - **Light & dark themes** — follows your system appearance, with a manual toggle.
20
25
 
21
26
  > **Privacy:** Everything runs locally on `127.0.0.1`. The app **never** writes to
22
- > `~/.claude`. Its only persistent state lives in `~/.claudescope/` a DuckDB
23
- > index and a copy of the pricing file, both safe to delete anytime. The sole
24
- > outbound request is an optional daily check for a newer published version
25
- > (`claudescope update`); nothing about your transcripts ever leaves your machine.
27
+ > `~/.claude` or `~/.codex` both are read-only sources. Its only persistent
28
+ > state lives in `~/.claudescope/` — a DuckDB index and a copy of the pricing
29
+ > file, both safe to delete anytime. The sole outbound request is an optional
30
+ > daily check for a newer published version (`claudescope update`); nothing about
31
+ > your transcripts ever leaves your machine.
26
32
 
27
33
  ---
28
34
 
29
35
  ## Screenshots
30
36
 
31
37
  > The screenshots below use **synthetic demo data** — every project name, path,
32
- > and message is fabricated. Reproduce it locally with:
33
- > `node scripts/demo-seed.mjs && CLAUDE_PROJECTS_DIR=.demo/projects npm start`.
38
+ > and message is fabricated (`acme-web` is a multi-agent project: Claude Code +
39
+ > Codex). They render light or dark to match your system. Regenerate them with
40
+ > **`npm run screenshots`** (seeds the demo data, boots the app, and captures
41
+ > every view in both themes via Playwright).
34
42
 
35
- **Browse** — every project and its sessions at a glance: titles, dates, message &
36
- tool counts, token totals, cost, git branch, and PR links.
43
+ **Browse** — every project and its sessions at a glance, each tagged with the
44
+ agents that worked in it: titles, dates, message & tool counts, token totals,
45
+ cost, git branch, and PR links.
37
46
 
38
- ![Browse projects and sessions](docs/screenshots/browse.png)
47
+ <picture>
48
+ <source media="(prefers-color-scheme: dark)" srcset="docs/screenshots/browse-dark.png">
49
+ <img alt="Browse projects and sessions" src="docs/screenshots/browse-light.png">
50
+ </picture>
39
51
 
40
52
  **Read** — a session as a clean threaded conversation: markdown, collapsible
41
- thinking, **syntax-highlighted red/green diffs** for `Edit`/`MultiEdit`, nested
42
- **subagent** runs, per-message token chips, and a **find-in-session** bar (⌘/Ctrl+F)
43
- that auto-expands and highlights matches. **Conversation / Files-changed** tabs and
44
- an **⤓ Export** (Markdown, optional redaction) sit in the header.
45
-
46
- ![Session reader: tabs, Export, the in-session finder, and a highlighted diff](docs/screenshots/session.png)
47
-
48
- **Search** — full-text across every session (DuckDB BM25) with highlighted
49
- snippets and user/assistant filters; each result deep-links to the exact message.
50
-
51
- ![Full-text search across sessions](docs/screenshots/search.png)
52
-
53
- **Analyze** token & cost analytics over time, by project, and by model, with a
54
- cache-read breakdown. Click a chart legend to toggle a series.
55
-
56
- ![Token and cost analytics dashboard](docs/screenshots/analytics.png)
53
+ thinking, **syntax-highlighted red/green diffs** for edits, nested **subagent**
54
+ runs, per-message token chips, and a **find-in-session** bar (⌘/Ctrl+F) that
55
+ auto-expands and highlights matches. The breadcrumb links back to the project's
56
+ session list; **Conversation / Files-changed** tabs and an **⤓ Export** (Markdown,
57
+ optional redaction) sit in the header.
58
+
59
+ <picture>
60
+ <source media="(prefers-color-scheme: dark)" srcset="docs/screenshots/session-dark.png">
61
+ <img alt="Session reader: breadcrumb, tabs, Export, the in-session finder, thinking, and a subagent run" src="docs/screenshots/session-light.png">
62
+ </picture>
63
+
64
+ **Search** — full-text across every session and agent (DuckDB BM25) with
65
+ highlighted snippets and user/assistant filters; each result deep-links to the
66
+ exact message.
67
+
68
+ <picture>
69
+ <source media="(prefers-color-scheme: dark)" srcset="docs/screenshots/search-dark.png">
70
+ <img alt="Full-text search across sessions" src="docs/screenshots/search-light.png">
71
+ </picture>
72
+
73
+ **Analyze** — token & cost analytics over time, by project, by model, and **by
74
+ agent**, with a cache-read breakdown. Click a chart legend to toggle a series.
75
+
76
+ <picture>
77
+ <source media="(prefers-color-scheme: dark)" srcset="docs/screenshots/analytics-dark.png">
78
+ <img alt="Token and cost analytics dashboard" src="docs/screenshots/analytics-light.png">
79
+ </picture>
57
80
 
58
81
  ---
59
82
 
60
83
  ## Quick start
61
84
 
62
- **Prerequisite:** [Node.js](https://nodejs.org) **20 or newer** (`node -v`).
85
+ **Prerequisite:** [Node.js](https://nodejs.org) **22 or newer** (`node -v`).
63
86
 
64
87
  ### Install (recommended)
65
88
 
@@ -116,19 +139,24 @@ All optional — set via environment variables.
116
139
  | Variable | Default | Description |
117
140
  | --------------------- | ---------------------- | ---------------------------------------------------------------------- |
118
141
  | `PORT` | `4317` | Port the app listens on (or `--port <n>`). |
119
- | `CLAUDE_PROJECTS_DIR` | `~/.claude/projects` | Where to read session transcripts from. A leading `~` is expanded. |
142
+ | `CLAUDE_PROJECTS_DIR` | `~/.claude/projects` | Where to read Claude Code transcripts from. A leading `~` is expanded. |
143
+ | `CODEX_SESSIONS_DIR` | `~/.codex/sessions` | Where to read OpenAI Codex transcripts from. A leading `~` is expanded.|
120
144
  | `CLAUDESCOPE_HOME` | `~/.claudescope` | Where the app keeps its own state (index, pricing copy, logs, PID). |
121
145
  | `REINDEX_INTERVAL_MS` | `15000` | How often to auto-pick-up new/updated sessions. Set `0` to disable. |
122
146
 
147
+ Each agent source is optional — if a directory doesn't exist it's simply skipped,
148
+ so the app works whether you use one agent or both.
149
+
123
150
  Examples:
124
151
 
125
152
  ```bash
126
153
  claudescope --port 8080 # custom port
127
154
  CLAUDE_PROJECTS_DIR=/path/to/exported/projects claudescope # view someone else's transcripts
155
+ CODEX_SESSIONS_DIR=/path/to/codex/sessions claudescope # point at Codex sessions elsewhere
128
156
  claudescope --no-open # don't pop a browser tab
129
157
  ```
130
158
 
131
- The startup banner prints the resolved URL and the sessions directory in use, so
159
+ The startup banner prints the resolved URL and the source directories in use, so
132
160
  you can always confirm what it's reading.
133
161
 
134
162
  ### Cost methodology
@@ -150,10 +178,10 @@ just a `SUM` over events; a project/session total is the sum of its events.
150
178
  Rates live in `~/.claudescope/pricing.json` (seeded on first run from the copy
151
179
  shipped with the package; when running from source, `packages/server/pricing.json`).
152
180
  A model id resolves in this order:
153
- exact `models` entry → **family** match (`opus` / `sonnet` / `haiku` substring)
154
- `default`. The family step means version- or date-suffixed ids (e.g.
155
- `claude-haiku-4-5-20251001`) still price correctly. Shipped rates (USD per 1M tokens,
156
- from Anthropic's published API pricing):
181
+ exact `models` entry → **family** match (`opus` / `sonnet` / `haiku` / `gpt`
182
+ substring) → `default`. The family step means version- or date-suffixed ids (e.g.
183
+ `claude-haiku-4-5-20251001`, or a Codex `gpt-5.x-codex` id) still price correctly.
184
+ Shipped rates (USD per 1M tokens, from Anthropic and OpenAI published API pricing):
157
185
 
158
186
  | family / model | input | output | cache write (5m) | cache read |
159
187
  | ------------------- | ----- | ------ | ---------------- | ---------- |
@@ -161,6 +189,9 @@ from Anthropic's published API pricing):
161
189
  | Opus 4.1 / 4 | $15 | $75 | $18.75 | $1.50 |
162
190
  | Sonnet 4.x | $3 | $15 | $3.75 | $0.30 |
163
191
  | Haiku 4.5 | $1 | $5 | $1.25 | $0.10 |
192
+ | GPT-5 | $0.63 | $5 | — | $0.13 |
193
+ | GPT-5.4 | $2.50 | $15 | — | $0.50 |
194
+ | GPT-5.5 | $5 | $30 | — | $0.50 |
164
195
  | `<synthetic>` | $0 | $0 | $0 | $0 |
165
196
 
166
197
  - Edit `~/.claudescope/pricing.json` to update prices or add models, then re-index
@@ -169,9 +200,9 @@ from Anthropic's published API pricing):
169
200
  published pricing page. There's no official pricing *API*, so this is a
170
201
  best-effort scrape (it validates what it parses and won't write garbage) —
171
202
  review the diff afterwards. Use `--dry-run` to preview without writing.
172
- - The `opus`/`sonnet`/`haiku` family rules use **current** pricing; the deprecated
173
- Opus 4 / 4.1 ($15/$75) are pinned via exact `models` entries. Add an exact entry
174
- to override any specific model.
203
+ - The `opus`/`sonnet`/`haiku`/`gpt` family rules use **current** pricing; the
204
+ deprecated Opus 4 / 4.1 ($15/$75) and specific GPT-5 versions are pinned via
205
+ exact `models` entries. Add an exact entry to override any specific model.
175
206
 
176
207
  > **Caveat:** these are **list-price estimates** — they ignore any discounts,
177
208
  > service tier, or batch pricing, and the cache-write rate assumes the 5-minute
@@ -195,8 +226,11 @@ served from cache (legitimately high for Claude Code, which re-reads cached cont
195
226
  restart. In an open session, hit **⟳ Refresh** (or ⌘R / Ctrl+R) to pull the
196
227
  latest messages in place without losing your scroll position. Each scan is
197
228
  near-free when nothing changed; you can also force one with `POST /api/reindex`.
198
- - **Thinking blocks** appear empty because Claude Code stores only a signature,
199
- not the reasoning text — the app notes this explicitly. (Not a bug.)
229
+ - **Thinking blocks** appear empty because Claude Code stores only a signature
230
+ (and Codex only encrypted reasoning), not the plaintext — the app notes this
231
+ explicitly. (Not a bug.)
232
+ - **Codex sessions have no stored title**, so the title falls back to the first
233
+ user message.
200
234
 
201
235
  ---
202
236
 
@@ -215,6 +249,12 @@ and analytics; a small TypeScript parser assembles the threaded view for a singl
215
249
  session. The index is a derived cache — if it's ever corrupted (e.g. the process
216
250
  is killed mid-write) the app discards and rebuilds it automatically.
217
251
 
252
+ Each agent is a **connector** (`packages/server/src/connectors/`). Claude Code
253
+ JSONL is projected per-row; Codex spreads a session across record types, so its
254
+ connector normalizes a rollout to canonical NDJSON first — after that the
255
+ indexing, search, cost, and threading paths are shared. Adding another agent is
256
+ adding another connector.
257
+
218
258
  ---
219
259
 
220
260
  ## Development
@@ -256,8 +296,8 @@ bundles, and publishes. Auth uses npm **Trusted Publishing** (OIDC) — no
256
296
 
257
297
  ## Security & privacy
258
298
 
259
- Claudescope runs entirely on your machine. It treats `~/.claude` as **read-only**,
260
- **binds to `127.0.0.1` only**, sends **no telemetry**, and its sole outbound
299
+ Claudescope runs entirely on your machine. It treats `~/.claude` and `~/.codex`
300
+ as **read-only**, **binds to `127.0.0.1` only**, sends **no telemetry**, and its sole outbound
261
301
  request is a cached npm-registry version check for the update notice. See
262
302
  [`SECURITY.md`](./SECURITY.md) for the full breakdown of filesystem, network,
263
303
  shell, and self-update behavior — and how to report a vulnerability.
@@ -267,9 +307,11 @@ shell, and self-update behavior — and how to report a vulnerability.
267
307
  ## Troubleshooting
268
308
 
269
309
  - **App is empty / "sessions directory not found"** — `CLAUDE_PROJECTS_DIR`
270
- doesn't point at real transcripts. Check the banner and set it correctly.
310
+ (and/or `CODEX_SESSIONS_DIR`) doesn't point at real transcripts. Check the
311
+ banner and set it correctly. Either source can be absent; only the present one
312
+ is indexed.
271
313
  - **`Error: listen EADDRINUSE :4317`** — the port is taken; run `claudescope --port <n>`.
272
- - **Node version errors** — you need Node ≥ 20 (`node -v`).
314
+ - **Node version errors** — you need Node ≥ 22 (`node -v`).
273
315
  - **Stale or wrong data** — delete `~/.claudescope/index.duckdb*` and
274
316
  `claudescope restart` to rebuild the index from scratch.
275
317
  - **`@duckdb/node-api` install issues** — it ships prebuilt native binaries;
package/cli.js CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __cr } from 'node:module';
3
3
  const require = __cr(import.meta.url);
4
- import{spawn as $,spawnSync as y}from"node:child_process";import{existsSync as R,mkdirSync as N,openSync as F,readFileSync as C,rmSync as S,writeFileSync as x}from"node:fs";import{dirname as M,join as g}from"node:path";import{createInterface as V}from"node:readline/promises";import{parseArgs as J}from"node:util";import{fileURLToPath as G}from"node:url";import{copyFileSync as re,existsSync as j,mkdirSync as se}from"node:fs";import{homedir as d}from"node:os";import{dirname as H,join as s}from"node:path";import{fileURLToPath as B}from"node:url";var v=H(B(import.meta.url));function D(e,t){return e.find(o=>j(o))??t}var w=Number(process.env.PORT??4317),f=s(v,"..");function A(e){return e==="~"?d():e.startsWith("~/")?s(d(),e.slice(2)):e}var E=A(process.env.CLAUDE_PROJECTS_DIR??s(d(),".claude","projects")),le=process.env.OPEN_BROWSER==="1",pe=Number(process.env.REINDEX_INTERVAL_MS??15e3),a=A(process.env.CLAUDESCOPE_HOME??s(d(),".claudescope")),ue=process.env.DUCKDB_PATH??s(a,"index.duckdb"),de=D([s(v,"pricing.default.json"),s(f,"pricing.json")],s(f,"pricing.json")),fe=process.env.PRICING_PATH??s(a,"pricing.json"),me=process.env.WEB_DIST_DIR??D([s(v,"web"),s(f,"..","web","dist")],s(f,"..","web","dist")),i="0.2.0";var W=M(G(import.meta.url)),K=g(W,"server.js"),c=g(a,"daemon.json"),m=g(a,"daemon.log"),_=g(a,"update-check.json"),p="@vladar107/claudescope",X=24*60*60*1e3;function h(){if(!R(c))return null;try{return JSON.parse(C(c,"utf8"))}catch{return null}}function u(e){try{return process.kill(e,0),!0}catch{return!1}}async function O(e){try{return(await fetch(`http://127.0.0.1:${e}/api/health`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}async function q(e,t){let o=Date.now()+t;for(;Date.now()<o;){if(await O(e))return!0;process.stdout.write("."),await new Promise(r=>setTimeout(r,500))}return!1}function b(e){let t=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";try{$(t,[e],{stdio:"ignore",detached:!0,shell:process.platform==="win32"}).unref()}catch{}}async function I(e,t){N(a,{recursive:!0});let o=h();if(o&&u(o.pid)&&await O(o.port)){console.log(`\u2713 claudescope is already running \u2192 ${o.url}`),t&&b(o.url);return}o&&!u(o.pid)&&S(c,{force:!0});let r=`http://localhost:${e}`,n=F(m,"a"),l=$(process.execPath,[K],{detached:!0,stdio:["ignore",n,n],env:{...process.env,PORT:String(e),OPEN_BROWSER:"0"}});if(l.unref(),x(c,JSON.stringify({pid:l.pid,port:e,url:r,version:i,startedAt:new Date().toISOString()},null,2)),process.stdout.write("\u203A Starting claudescope"),!await q(e,2e4)){console.error(`
4
+ import{spawn as N,spawnSync as y}from"node:child_process";import{existsSync as O,mkdirSync as $,openSync as F,readFileSync as C,rmSync as b,writeFileSync as x}from"node:fs";import{dirname as M,join as g}from"node:path";import{createInterface as V}from"node:readline/promises";import{parseArgs as J}from"node:util";import{fileURLToPath as G}from"node:url";import{copyFileSync as re,existsSync as j,mkdirSync as se}from"node:fs";import{homedir as p}from"node:os";import{dirname as H,join as s}from"node:path";import{fileURLToPath as B}from"node:url";var v=H(B(import.meta.url));function I(e,t){return e.find(o=>j(o))??t}var S=Number(process.env.PORT??4317),f=s(v,"..");function E(e){return e==="~"?p():e.startsWith("~/")?s(p(),e.slice(2)):e}var _=E(process.env.CLAUDE_PROJECTS_DIR??s(p(),".claude","projects")),le=E(process.env.CODEX_SESSIONS_DIR??s(p(),".codex","sessions")),pe=process.env.OPEN_BROWSER==="1",ue=Number(process.env.REINDEX_INTERVAL_MS??15e3),a=E(process.env.CLAUDESCOPE_HOME??s(p(),".claudescope")),de=process.env.DUCKDB_PATH??s(a,"index.duckdb"),fe=I([s(v,"pricing.default.json"),s(f,"pricing.json")],s(f,"pricing.json")),me=process.env.PRICING_PATH??s(a,"pricing.json"),ge=process.env.WEB_DIST_DIR??I([s(v,"web"),s(f,"..","web","dist")],s(f,"..","web","dist")),i="0.3.0";var W=M(G(import.meta.url)),K=g(W,"server.js"),c=g(a,"daemon.json"),m=g(a,"daemon.log"),w=g(a,"update-check.json"),u="@vladar107/claudescope",X=24*60*60*1e3;function h(){if(!O(c))return null;try{return JSON.parse(C(c,"utf8"))}catch{return null}}function d(e){try{return process.kill(e,0),!0}catch{return!1}}async function D(e){try{return(await fetch(`http://127.0.0.1:${e}/api/health`,{signal:AbortSignal.timeout(1500)})).ok}catch{return!1}}async function q(e,t){let o=Date.now()+t;for(;Date.now()<o;){if(await D(e))return!0;process.stdout.write("."),await new Promise(r=>setTimeout(r,500))}return!1}function P(e){let t=process.platform==="darwin"?"open":process.platform==="win32"?"start":"xdg-open";try{N(t,[e],{stdio:"ignore",detached:!0,shell:process.platform==="win32"}).unref()}catch{}}async function A(e,t){$(a,{recursive:!0});let o=h();if(o&&d(o.pid)&&await D(o.port)){console.log(`\u2713 claudescope is already running \u2192 ${o.url}`),t&&P(o.url);return}o&&!d(o.pid)&&b(c,{force:!0});let r=`http://localhost:${e}`,n=F(m,"a"),l=N(process.execPath,[K],{detached:!0,stdio:["ignore",n,n],env:{...process.env,PORT:String(e),OPEN_BROWSER:"0"}});if(l.unref(),x(c,JSON.stringify({pid:l.pid,port:e,url:r,version:i,startedAt:new Date().toISOString()},null,2)),process.stdout.write("\u203A Starting claudescope"),!await q(e,2e4)){console.error(`
5
5
  \u2717 Server did not become healthy in time. Inspect: claudescope logs`),process.exitCode=1;return}console.log(`
6
- \u2713 claudescope running \u2192 ${r}`),console.log(` Sessions: ${E} (read-only)`),t&&b(r),await L(!1)}function P(){let e=h();if(!e||!u(e.pid)){console.log("claudescope is not running."),S(c,{force:!0});return}try{process.kill(e.pid,"SIGTERM")}catch{}S(c,{force:!0}),console.log(`\u2713 Stopped claudescope (pid ${e.pid}).`)}async function Y(){let e=h();e&&u(e.pid)&&await O(e.port)?console.log(`\u25CF running ${e.url} (pid ${e.pid}, v${e.version})`):console.log(`\u25CB stopped (installed v${i})`),await L(!0)}function z(){let e=h();e&&u(e.pid)?b(e.url):console.log("claudescope is not running. Start it with: claudescope start")}function Q(e){if(!R(m)){console.log("No logs yet.");return}e&&process.platform!=="win32"?y("tail",["-f",m],{stdio:"inherit"}):process.stdout.write(C(m,"utf8"))}async function Z(e,t){if(!process.stdin.isTTY)return t;let o=V({input:process.stdin,output:process.stdout});try{let r=(await o.question(`${e} ${t?"[Y/n]":"[y/N]"} `)).trim().toLowerCase();return r?r==="y"||r==="yes":t}finally{o.close()}}async function ee(e){let t=await U(!0);if(t&&!k(t,i)){console.log(`\u2713 Already on the latest version (v${i}).`);return}t||console.log("\u26A0 Could not reach the npm registry to confirm the latest version.");let o=t?`v${i} \u2192 v${t}`:`v${i} \u2192 latest`;if(console.log(`\u203A Will run: npm install -g ${p}@latest (${o})`),!e&&!await Z("Proceed?",!0)){console.log("Aborted.");return}console.log(`\u203A Updating ${p}\u2026`);let r=process.platform==="win32"?"npm.cmd":"npm";if(y(r,["install","-g",`${p}@latest`],{stdio:"inherit"}).status!==0){console.error(`\u2717 Update failed. If you run via npx, just re-run \`npx ${p}\` to get the latest.`),process.exitCode=1;return}P(),console.log("\u2713 Updated. Restarting\u2026"),y("claudescope",["start"],{stdio:"inherit",shell:process.platform==="win32"})}function k(e,t){let o=e.split(".").map(n=>Number.parseInt(n,10)||0),r=t.split(".").map(n=>Number.parseInt(n,10)||0);for(let n=0;n<3;n++){if((o[n]??0)>(r[n]??0))return!0;if((o[n]??0)<(r[n]??0))return!1}return!1}async function U(e){let t=Date.now();if(!e&&R(_))try{let l=JSON.parse(C(_,"utf8"));if(t-l.lastCheck<X)return l.latest}catch{}let o=`https://registry.npmjs.org/${p.replace("/","%2f")}/latest`,r=await fetch(o,{signal:AbortSignal.timeout(2500)});if(!r.ok)return null;let n=await r.json();return n.version?(N(a,{recursive:!0}),x(_,JSON.stringify({lastCheck:t,latest:n.version})),n.version):null}async function L(e){try{let t=await U(e);t&&k(t,i)&&console.log(`
6
+ \u2713 claudescope running \u2192 ${r}`),console.log(` Sessions: ${_} (read-only)`),t&&P(r),await L(!1)}function R(){let e=h();if(!e||!d(e.pid)){console.log("claudescope is not running."),b(c,{force:!0});return}try{process.kill(e.pid,"SIGTERM")}catch{}b(c,{force:!0}),console.log(`\u2713 Stopped claudescope (pid ${e.pid}).`)}async function Y(){let e=h();e&&d(e.pid)&&await D(e.port)?console.log(`\u25CF running ${e.url} (pid ${e.pid}, v${e.version})`):console.log(`\u25CB stopped (installed v${i})`),await L(!0)}function z(){let e=h();e&&d(e.pid)?P(e.url):console.log("claudescope is not running. Start it with: claudescope start")}function Q(e){if(!O(m)){console.log("No logs yet.");return}e&&process.platform!=="win32"?y("tail",["-f",m],{stdio:"inherit"}):process.stdout.write(C(m,"utf8"))}async function Z(e,t){if(!process.stdin.isTTY)return t;let o=V({input:process.stdin,output:process.stdout});try{let r=(await o.question(`${e} ${t?"[Y/n]":"[y/N]"} `)).trim().toLowerCase();return r?r==="y"||r==="yes":t}finally{o.close()}}async function ee(e){let t=await U(!0);if(t&&!k(t,i)){console.log(`\u2713 Already on the latest version (v${i}).`);return}t||console.log("\u26A0 Could not reach the npm registry to confirm the latest version.");let o=t?`v${i} \u2192 v${t}`:`v${i} \u2192 latest`;if(console.log(`\u203A Will run: npm install -g ${u}@latest (${o})`),!e&&!await Z("Proceed?",!0)){console.log("Aborted.");return}console.log(`\u203A Updating ${u}\u2026`);let r=process.platform==="win32"?"npm.cmd":"npm";if(y(r,["install","-g",`${u}@latest`],{stdio:"inherit"}).status!==0){console.error(`\u2717 Update failed. If you run via npx, just re-run \`npx ${u}\` to get the latest.`),process.exitCode=1;return}R(),console.log("\u2713 Updated. Restarting\u2026"),y("claudescope",["start"],{stdio:"inherit",shell:process.platform==="win32"})}function k(e,t){let o=e.split(".").map(n=>Number.parseInt(n,10)||0),r=t.split(".").map(n=>Number.parseInt(n,10)||0);for(let n=0;n<3;n++){if((o[n]??0)>(r[n]??0))return!0;if((o[n]??0)<(r[n]??0))return!1}return!1}async function U(e){let t=Date.now();if(!e&&O(w))try{let l=JSON.parse(C(w,"utf8"));if(t-l.lastCheck<X)return l.latest}catch{}let o=`https://registry.npmjs.org/${u.replace("/","%2f")}/latest`,r=await fetch(o,{signal:AbortSignal.timeout(2500)});if(!r.ok)return null;let n=await r.json();return n.version?($(a,{recursive:!0}),x(w,JSON.stringify({lastCheck:t,latest:n.version})),n.version):null}async function L(e){try{let t=await U(e);t&&k(t,i)&&console.log(`
7
7
  \u2B06 Update available: v${i} \u2192 v${t}. Run: claudescope update`)}catch{}}function T(){console.log(`claudescope v${i} \u2014 local viewer for Claude Code transcripts
8
8
 
9
9
  Usage: claudescope [command] [options]
@@ -20,11 +20,11 @@ Commands:
20
20
  version Print the installed version
21
21
 
22
22
  Options:
23
- --port <n> Port to listen on (default ${w}, or $PORT)
23
+ --port <n> Port to listen on (default ${S}, or $PORT)
24
24
  --no-open Don't open the browser on start
25
25
  -y, --yes Skip the confirmation prompt (for \`update\`)
26
26
 
27
27
  State (index, pricing, logs, PID) lives in ${a}
28
28
  (override with $CLAUDESCOPE_HOME). Sessions are read from
29
- ${E} (override with $CLAUDE_PROJECTS_DIR).`)}async function te(){let{values:e,positionals:t}=J({allowPositionals:!0,options:{port:{type:"string"},follow:{type:"boolean",short:"f"},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"},yes:{type:"boolean",short:"y"},"no-open":{type:"boolean"}}}),o=e.port?Number(e.port):w,r=!e["no-open"],n=t[0];switch(n||(n=e.help?"help":e.version?"version":"start"),n){case"start":await I(o,r);break;case"stop":P();break;case"restart":P(),await I(o,r);break;case"status":await Y();break;case"open":z();break;case"logs":Q(!!e.follow);break;case"update":await ee(!!e.yes);break;case"version":console.log(i);break;case"help":T();break;default:console.error(`Unknown command: ${n}
29
+ ${_} (override with $CLAUDE_PROJECTS_DIR).`)}async function te(){let{values:e,positionals:t}=J({allowPositionals:!0,options:{port:{type:"string"},follow:{type:"boolean",short:"f"},help:{type:"boolean",short:"h"},version:{type:"boolean",short:"v"},yes:{type:"boolean",short:"y"},"no-open":{type:"boolean"}}}),o=e.port?Number(e.port):S,r=!e["no-open"],n=t[0];switch(n||(n=e.help?"help":e.version?"version":"start"),n){case"start":await A(o,r);break;case"stop":R();break;case"restart":R(),await A(o,r);break;case"status":await Y();break;case"open":z();break;case"logs":Q(!!e.follow);break;case"update":await ee(!!e.yes);break;case"version":console.log(i);break;case"help":T();break;default:console.error(`Unknown command: ${n}
30
30
  `),T(),process.exitCode=1}}te().catch(e=>{console.error(e),process.exit(1)});
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "@vladar107/claudescope",
3
- "version": "0.2.0",
4
- "description": "Local, read-only web app to browse, read, search, and analyze your Claude Code session transcripts.",
3
+ "version": "0.3.0",
4
+ "description": "Local, read-only web app to browse, read, search, and analyze your AI coding-agent transcripts — Claude Code and OpenAI Codex.",
5
5
  "keywords": [
6
6
  "claude",
7
7
  "claude-code",
8
8
  "anthropic",
9
+ "codex",
10
+ "openai",
9
11
  "transcripts",
10
12
  "sessions",
11
13
  "viewer",
@@ -32,7 +34,7 @@
32
34
  "README.md"
33
35
  ],
34
36
  "engines": {
35
- "node": ">=20"
37
+ "node": ">=22"
36
38
  },
37
39
  "dependencies": {
38
40
  "@duckdb/node-api": "^1.5.3-r.3"
@@ -2,12 +2,17 @@
2
2
  "models": {
3
3
  "claude-opus-4-1": { "input": 15, "output": 75, "cacheWrite": 18.75, "cacheRead": 1.5 },
4
4
  "claude-opus-4": { "input": 15, "output": 75, "cacheWrite": 18.75, "cacheRead": 1.5 },
5
- "<synthetic>": { "input": 0, "output": 0, "cacheWrite": 0, "cacheRead": 0 }
5
+ "<synthetic>": { "input": 0, "output": 0, "cacheWrite": 0, "cacheRead": 0 },
6
+ "gpt-5": { "input": 0.625, "output": 5, "cacheWrite": 0, "cacheRead": 0.125 },
7
+ "gpt-5.4": { "input": 2.5, "output": 15, "cacheWrite": 0, "cacheRead": 0.5 },
8
+ "gpt-5.5": { "input": 5, "output": 30, "cacheWrite": 0, "cacheRead": 0.5 },
9
+ "gpt-5.5-pro": { "input": 30, "output": 180, "cacheWrite": 0, "cacheRead": 30 }
6
10
  },
7
11
  "families": {
8
12
  "opus": { "input": 5, "output": 25, "cacheWrite": 6.25, "cacheRead": 0.5 },
9
13
  "sonnet": { "input": 3, "output": 15, "cacheWrite": 3.75, "cacheRead": 0.3 },
10
- "haiku": { "input": 1, "output": 5, "cacheWrite": 1.25, "cacheRead": 0.1 }
14
+ "haiku": { "input": 1, "output": 5, "cacheWrite": 1.25, "cacheRead": 0.1 },
15
+ "gpt": { "input": 2.5, "output": 15, "cacheWrite": 0, "cacheRead": 0.5 }
11
16
  },
12
17
  "default": { "input": 3, "output": 15, "cacheWrite": 3.75, "cacheRead": 0.3 }
13
18
  }