llmspy 0.6.0 → 0.7.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
@@ -9,130 +9,35 @@
9
9
 
10
10
  A lightweight local developer tool that shows LLM API traffic in real time, with next to no setup: to you in a web UI, and to coding agents through a small local API.
11
11
 
12
- - **Live capture**: every call to Anthropic, OpenAI or any other upstream you add shows up as soon as it is sent and is filled in when the reply ends; streamed replies still stream to the app
13
- - **Conversation view**: system prompt, tools, messages, tool calls matched to their results, and the reply with its stop reason and token use
14
- - **Raw view**: headers and bodies exactly as sent and received, with API keys masked
15
- - **Compare**: diff a call against the one before it, or any other, to see what an agent changed between turns
16
- - **Projects**: tag each app's base URL to give its calls their own tab
17
- - **Three formats**: Anthropic Messages, OpenAI Chat Completions and OpenAI Responses, streamed or not
18
- - **Kept across restarts**: the last 7 days of calls, in one file on your machine, listed by day with older days folded away; one click narrows today's calls to the last 5 to 90 minutes, another to the failed ones
19
- - **Agent friendly**: coding agents and scripts can list, search and read the captured calls as JSON, or one call as Markdown, count their tokens, failures and latency, and wait for a running call to end, all on the same port; [llms.txt](llms.txt) tells them how
20
- - **Lightweight**: one command to start, one base URL to set in your app; no certificates or accounts
21
- - **No runtime dependencies**: the npm package installs nothing else; the proxy uses only Node.js's own modules, and the UI's two libraries (Svelte and jsdiff) are built into its files
22
-
23
- ![LLMSpy showing a coding agent's call as a conversation: the user's question, the assistant's tool calls and the tool results](docs/screenshots/conversation.png)
24
-
25
- ## Contents
26
-
27
- - [Why](#why)
28
- - [What you see](#what-you-see)
29
- - [Quick start](#quick-start)
30
- - [Start LLMSpy](#start-llmspy)
31
- - [Point an app at it](#point-an-app-at-it)
32
- - [Keep apps apart with projects](#keep-apps-apart-with-projects)
33
- - [Commands](#commands)
34
- - [Upstreams](#upstreams)
35
- - [Adding an upstream](#adding-an-upstream)
36
- - [Setting upstreams for a local run](#setting-upstreams-for-a-local-run)
37
- - [Setting upstreams in Docker](#setting-upstreams-in-docker)
38
- - [Checking your upstreams](#checking-your-upstreams)
39
- - [Apps without a base-URL setting](#apps-without-a-base-url-setting)
40
- - [Configuration](#configuration)
41
- - [Storage](#storage)
42
- - [Testing with mock data](#testing-with-mock-data)
43
- - [How it works](#how-it-works)
44
- - [Troubleshooting](#troubleshooting)
45
- - [License](#license)
46
-
47
- ## Why
48
-
49
- Apps and agents built on LLMs hide most of what they send. SDKs, frameworks and coding agents add their own system prompts, tool definitions, retries and parameters, and the actual request and response are rarely logged anywhere you can read them. When an agent misbehaves, burns tokens or gives a strange answer, the first question is "what did it actually send to the model, and what came back?", and that is usually the hardest one to answer.
50
-
51
- LLMSpy answers it without changing any code. It runs on your machine as a small reverse proxy: point an app's base URL at it (most LLM SDKs and tools read one from an environment variable, such as `ANTHROPIC_BASE_URL` or `OPENAI_BASE_URL`), and every call shows up live in a web UI with the full headers, prompt, parameters, response, status and timing. Streamed responses still stream to the app; LLMSpy keeps a copy as they pass.
52
-
53
- Use it to:
54
-
55
- - see the real prompts, system messages and tool schemas a library or agent sends
56
- - debug failing or odd requests: errors, status codes, latency
57
- - understand token-heavy calls and why they cost what they do
58
- - compare what different tools send for the same task
59
- - let a coding agent check what an app it is building or debugging really sent and got back, without you copying anything across
60
-
61
- It is deliberately small, and quick to set up:
62
-
63
- - one command starts it, and one environment variable in your app points the app at it
64
- - no certificates to install, no accounts, no API keys of its own and no config file
65
- - the proxy has no runtime dependencies beyond Node.js (it stores calls with the SQLite built into Node), and the UI is plain static files it serves itself, on the same port
66
-
67
- It is for local development only. It listens on `127.0.0.1`, masks API keys in what it records, and keeps the last 7 days of calls in a file on your machine (see [Storage](#storage)).
68
-
69
- ## What you see
70
-
71
- Every call appears in the list on the left as soon as it is sent, newest first, with its status, time taken and token counts. A call still running is marked `waiting` or `replying` with a running timer; its reply shows once it ends.
72
-
73
- The list is grouped by day, with older days folded away. The chips under Today show only the calls from the last 5 to 90 minutes, such as one run of an agent, and the Today heading counts how many are shown.
12
+ **📖 Documentation: [llmspy.piyook.com](https://llmspy.piyook.com/)**
74
13
 
75
- <img src="docs/screenshots/days.png" width="300" alt="The call list narrowed to the last 15 minutes: Today shows 3 of 15 calls, with Yesterday and Thu 12 Nov folded below">
14
+ ![LLMSpy showing a coding agent's call as a conversation: the user's question, the assistant's tool calls and the tool results](https://raw.githubusercontent.com/piyook/llmspy/main/docs/public/screenshots/conversation.png)
76
15
 
77
- When a project has calls that went wrong, a red **Failed** chip above the list counts them; press it to see only those, on every day. A call has failed when the upstream could not be reached or its reply broke off, when its status is 400 or above, or when the provider sent an error inside the reply. Agents get the same calls from `GET /api/requests?failed=1`.
16
+ ## Why LLMSpy?
78
17
 
79
- <img src="docs/screenshots/failed.png" width="300" alt="The Failed chip pressed: the list shows only the failed calls, two 429s, two errors in the stream and two dropped streams">
18
+ SDKs, frameworks and coding agents add their own system prompts, tool definitions, retries and parameters, and the actual request and response are rarely logged anywhere you can read them. LLMSpy shows you what an app really sent to the model and what came back, without changing any code.
80
19
 
81
- Cards above the panes sum up the calls in the list as it is narrowed (by project, search, the Failed chip and the minutes chips): how many there are and how many are running, how many failed, their tokens in, out and cached, and their p50 and p95 latency. They update live, and agree with `GET /api/stats`.
82
-
83
- <img src="docs/screenshots/cards.png" alt="The cards above the panes for the general project: 54 calls, 18 failed (33%, in red), 990 tokens in and 996 out, latency p50 16ms and p95 801ms">
84
-
85
- Select a call to look at it in three ways.
86
-
87
- **Conversation** (shown at the top) reads the call as the model sees it: the system prompt and tools, then each message by role, with tool calls matched to their results, and the reply at the end with its stop reason and token use. Streamed replies are put back together.
88
-
89
- **Raw** shows the request and response exactly as they went over the wire: method and URL, headers (with API keys masked) and both bodies.
90
-
91
- ![The Raw tab: request headers with the API key masked, and the request body as JSON](docs/screenshots/raw.png)
92
-
93
- **Compare** sets the selected call (green) against another (red): by default the previous call to the same upstream, which in an agent loop is the turn before; "Compare with another call" picks any other. It sums up what changed (model, stop reason, system prompt, tools, messages and tokens) and shows only the messages that are new.
94
-
95
- ![The Compare tab: the system prompt's one changed line, token counts for both calls, and the two messages the later call added](docs/screenshots/compare.png)
96
-
97
- Under the summary, a line diff of the two request bodies shows everything else that changed, such as `max_tokens`, `temperature` or a tool's schema, with unchanged stretches folded away.
98
-
99
- ![The request body diff in the Compare tab, with the messages the later call added in green](docs/screenshots/compare-body.png)
100
-
101
- The traffic in these screenshots is made up, sent to the mock servers described under [Testing with mock data](#testing-with-mock-data).
20
+ - **Live capture**: every call to Anthropic, OpenAI or [any other upstream](https://llmspy.piyook.com/guide/upstreams) shows up as soon as it is sent; streamed replies still stream to the app
21
+ - **Conversation view**: system prompt, tools, messages, tool calls matched to their results, and the reply with its stop reason and token use ([more](https://llmspy.piyook.com/guide/reading-a-call))
22
+ - **Raw view**: headers and bodies exactly as sent and received, with API keys masked
23
+ - **Compare**: [diff a call](https://llmspy.piyook.com/guide/compare) against the one before it to see what an agent changed between turns
24
+ - **Projects**: [tag each app's base URL](https://llmspy.piyook.com/guide/projects) to give its calls their own tab
25
+ - **Three formats**: Anthropic Messages, OpenAI Chat Completions and OpenAI Responses, streamed or not
26
+ - **Kept across restarts**: the last 7 days of calls, in one file on your machine, with chips for recent minutes and failed calls ([more](https://llmspy.piyook.com/guide/call-list))
27
+ - **Agent friendly**: coding agents and scripts [list, search and read the calls](https://llmspy.piyook.com/guide/agents) as JSON or Markdown, and wait for a running call to end
28
+ - **Lightweight**: one command to start, one base URL to set; no certificates, accounts or runtime dependencies
102
29
 
103
30
  ## Quick start
104
31
 
105
- ### Start LLMSpy
106
-
107
- With **Node.js 26 or later** (`node --version`), from any folder:
32
+ With **Node.js 26 or later**, from any folder:
108
33
 
109
34
  ```bash
110
35
  npx llmspy
111
36
  ```
112
37
 
113
- This serves the proxy and the UI on `http://127.0.0.1:8080`, in the foreground. Stop it with Ctrl+C, or with `npx llmspy stop` from any terminal. To run it in the background instead, use `npx llmspy --background` (`-b`): it returns once LLMSpy is ready, its output goes to `~/.llmspy/llmspy.log`, and `npx llmspy stop` stops it. To keep the `llmspy` command to hand, install it once with `npm install -g llmspy`; `llmspy --help` lists its commands and settings. `npx` runs the version it has cached, and `npx llmspy@latest` the newest.
38
+ This serves the proxy and the UI on `http://127.0.0.1:8080`. Stop it with Ctrl+C, or `npx llmspy stop` from any terminal; `npx llmspy -b` runs it in the background. To run it in Docker or from source, see [Installation](https://llmspy.piyook.com/guide/installation).
114
39
 
115
- With Docker, from a clone of the repo:
116
-
117
- ```bash
118
- npm run start:docker
119
- ```
120
-
121
- LLMSpy then runs in the background, restarts with Docker, and serves the same proxy and UI on `http://127.0.0.1:8080`. `npm run stop:docker` stops it. Captured calls are kept in the `llmspy-data` volume, so they are there again at the next start.
122
-
123
- From source, in a clone of the repo, with Node.js 26 or later:
124
-
125
- ```bash
126
- npm install
127
- npm run build
128
- npm start
129
- ```
130
-
131
- Stop it with Ctrl+C, or with `npm run stop` from any terminal. Use one way at a time, as they all use port 8080.
132
-
133
- Whichever way you run it, the port is open on the loopback interface only, so nothing outside your machine can reach it. Captured traffic (`/api/*`, `/events`, `/ping`) is only served to requests addressed to `localhost`, `127.0.0.1` or `[::1]`, and not to other web sites open in your browser.
134
-
135
- ### Point an app at it
40
+ ## Point an app at it
136
41
 
137
42
  Set the app's base URL to LLMSpy plus the provider's path prefix:
138
43
 
@@ -141,230 +46,28 @@ Set the app's base URL to LLMSpy plus the provider's path prefix:
141
46
  | `/anthropic` | `https://api.anthropic.com` | `ANTHROPIC_BASE_URL=http://127.0.0.1:8080/anthropic` |
142
47
  | `/openai` | `https://api.openai.com` | `OPENAI_BASE_URL=http://127.0.0.1:8080/openai/v1` |
143
48
 
144
- For example, to watch Claude Code, in PowerShell:
145
-
146
- ```powershell
147
- $env:ANTHROPIC_BASE_URL = "http://127.0.0.1:8080/anthropic"
148
- claude
149
- ```
150
-
151
- Each request then appears in the UI at `http://127.0.0.1:8080`. The app keeps its own API key, which LLMSpy passes on to the provider.
152
-
153
- For coding agents and scripts, [llms.txt](llms.txt) is a compact reference: how to run LLMSpy, point an app at it, read the captured traffic as JSON or one call as Markdown, and wait for a call that is still running. A running LLMSpy serves it too, for its own version, at `http://127.0.0.1:8080/llms.txt`.
154
-
155
- ### Keep apps apart with projects
156
-
157
- Put `/@<project>` in front of the prefix to give an app's calls their own tab in the UI. The tag is not forwarded:
158
-
159
- ```powershell
160
- $env:ANTHROPIC_BASE_URL = "http://127.0.0.1:8080/@my-app/anthropic"
161
- ```
162
-
163
- Calls without a tag go to `general`. A project name is lowercase letters, digits and dashes. The tabs appear once there is a project besides `general`, and a tab you are not viewing counts its new calls. A search looks in every project; while it is on, each tab counts its matches instead. Clear All empties only the project you are viewing.
164
-
165
- ![Project tabs under the header: general, site-agent (selected, its calls listed) and support-bot with a badge for two new calls](docs/screenshots/projects.png)
166
-
167
- ## Commands
168
-
169
- The `llmspy` command, from npm (`npx llmspy`, or `llmspy` once installed with `npm install -g llmspy`), works in any folder:
170
-
171
- | Command | What it does |
172
- | ------------------ | ------------------------------------------------------------------- |
173
- | `llmspy` | Start LLMSpy in the foreground |
174
- | `llmspy -b` | Start LLMSpy in the background (`--background`) |
175
- | `llmspy stop` | Stop LLMSpy started with `llmspy` or `npm start`, from any terminal |
176
- | `llmspy --help` | List the commands and the settings |
177
- | `llmspy --version` | Print the version |
178
-
179
- The rest run from the root of a clone of the repo:
180
-
181
- | Command | What it does |
182
- | ------------------------------- | -------------------------------------------------------------------------- |
183
- | `npm run start:docker` | Build the image and start LLMSpy in Docker, in the background |
184
- | `npm run stop:docker` | Stop and remove the container; captured calls stay in the `llmspy-data` volume |
185
- | `docker compose logs -f` | Follow the container's output: its upstreams, storage and errors |
186
- | `docker compose down -v` | Stop the container and delete its captured calls |
187
- | `npm install` | Install the packages, for running without Docker |
188
- | `npm run build` | Build the proxy and the UI (again after each update) |
189
- | `npm start` | Start LLMSpy in the foreground |
190
- | `npm run stop` | Stop LLMSpy started with `npm start`, from any terminal |
191
- | `npm run mock` | Start the mock Anthropic and OpenAI APIs (see [Testing with mock data](#testing-with-mock-data)) |
192
- | `node scripts/mock-traffic.mjs` | Send a set of sample calls through LLMSpy to the mocks |
193
-
194
- ## Upstreams
195
-
196
- An upstream is an API that LLMSpy forwards to, reached through its own path prefix. The real Anthropic and OpenAI APIs are built in (`/anthropic` and `/openai`, see [Point an app at it](#point-an-app-at-it)) and need no setup. The ChatGPT app itself can't be pointed anywhere; `/openai` is for code and tools that call the OpenAI API.
197
-
198
- ### Adding an upstream
199
-
200
- Set `LLMSPY_UPSTREAMS` to a comma-separated list of `name=url` before starting LLMSpy. Each entry adds the prefix `/<name>`, and a name that is already there is replaced. Giving the same name twice is an error. A path in the URL is kept and the rest of the request path is appended to it, so the app's base URL is LLMSpy's address plus the prefix:
201
-
202
- ```
203
- LLMSPY_UPSTREAMS=openrouter=https://openrouter.ai/api/v1
204
- app's base URL: http://127.0.0.1:8080/openrouter
205
- app calls: http://127.0.0.1:8080/openrouter/chat/completions
206
- LLMSpy sends to: https://openrouter.ai/api/v1/chat/completions
207
- ```
208
-
209
- Names are lowercase letters, digits and dashes; `api`, `assets`, `events` and `ping` are taken by LLMSpy itself. LLMSpy reads the conversation from any upstream that speaks the Anthropic Messages, OpenAI Chat Completions or OpenAI Responses API, whatever its name; calls to other APIs are still captured and shown in Raw.
210
-
211
- Examples, with the base URL to give the app:
212
-
213
- | `LLMSPY_UPSTREAMS` entry | App's base URL |
214
- | ---------------------------------------------------------------- | ------------------------------------------------------------- |
215
- | `openrouter=https://openrouter.ai/api/v1` | `http://127.0.0.1:8080/openrouter` |
216
- | `gemini=https://generativelanguage.googleapis.com/v1beta/openai` | `http://127.0.0.1:8080/gemini` (OpenAI SDK) |
217
- | `ollama=http://localhost:11434` | `http://127.0.0.1:8080/ollama/v1` (OpenAI SDK) |
218
- | `anthropic=https://llm-gateway.example.com/anthropic` | `http://127.0.0.1:8080/anthropic` (replaces the built-in one) |
219
-
220
- ### Setting upstreams for a local run
221
-
222
- Set the variable in the shell that starts LLMSpy. In PowerShell:
223
-
224
- ```powershell
225
- $env:LLMSPY_UPSTREAMS = "openrouter=https://openrouter.ai/api/v1,ollama=http://localhost:11434"
226
- npx llmspy
227
- ```
228
-
229
- In bash:
230
-
231
- ```bash
232
- LLMSPY_UPSTREAMS=openrouter=https://openrouter.ai/api/v1,ollama=http://localhost:11434 npx llmspy
233
- ```
234
-
235
- To keep the same settings every time, put them in `~/.llmspy/.env` (the folder that also holds the captured calls) instead, one per line, and `llmspy` reads them whenever it starts:
236
-
237
- ```bash
238
- # ~/.llmspy/.env
239
- LLMSPY_UPSTREAMS=openrouter=https://openrouter.ai/api/v1,ollama=http://localhost:11434
240
- ```
241
-
242
- A variable set in the shell wins over the file, so a one-off value doesn't need the file changed. LLMSpy says `Settings read from …` when it starts if it found the file. It doesn't read a `.env` in the folder you start it from, which is usually an app's own, with its API keys.
243
-
244
- In a clone of the repo, `npm start` reads a `.env` file at the root of the repo instead (copy `.env.example` to start), and here too the shell wins.
245
-
246
- ### Setting upstreams in Docker
247
-
248
- Put the variable in a `.env` file next to `compose.yaml` (copy `.env.example` to start). Compose reads it and passes `LLMSPY_UPSTREAMS` and `LLMSPY_RETENTION_DAYS`, and nothing else from it, into the container:
249
-
250
- ```bash
251
- # .env
252
- LLMSPY_UPSTREAMS=openrouter=https://openrouter.ai/api/v1,ollama=http://host.docker.internal:11434
253
- ```
254
-
255
- Then run `npm run start:docker`, which recreates the container if the value has changed.
256
-
257
- Inside the container, `localhost` is the container itself, so an upstream running on your machine, such as Ollama or the [mocks](#testing-with-mock-data), is at `host.docker.internal`. External URLs are the same as for a local run.
258
-
259
- The same goes for an app that runs in a container: its `localhost` is its own container, so point it at `http://host.docker.internal:8080/<name>`. An app running directly on your machine uses `http://127.0.0.1:8080/<name>`. If the upstream also runs in a container (a mock server, say), LLMSpy reaches it at `http://host.docker.internal:<published port>`.
260
-
261
- This works as it is with Docker Desktop. On Linux, `host.docker.internal` doesn't reach a port bound only to `127.0.0.1`, which includes LLMSpy's own port and Ollama's default. Put the containers on one Docker network instead, and address them by container name: `http://llmspy:8080/<name>` from the app, and the upstream's name and its container port in `LLMSPY_UPSTREAMS`.
262
-
263
- The repo's `.env` serves both `npm start` and Docker, except for upstreams on your machine: a local run reaches them at `localhost`, Docker at `host.docker.internal`. If you switch between the two, override the variable in the shell for local runs. The `llmspy` command never reads this file, only `~/.llmspy/.env`.
264
-
265
- ### Checking your upstreams
266
-
267
- LLMSpy prints every upstream and its base URL when it starts (`docker compose logs` with Docker), lists them under **Base URLs** in the UI's header, and returns them at `GET /api/upstreams`. A name that isn't allowed or a URL that isn't valid stops it at startup, with the reason.
268
-
269
- ### Apps without a base-URL setting
270
-
271
- LLMSpy only sees apps that let you set their base URL. For one that doesn't, an intercepting proxy such as [mitmproxy](https://mitmproxy.org) can catch its calls and hand them to LLMSpy, so you still get LLMSpy's views. A small mitmproxy add-on is enough as a starting point:
272
-
273
- ```python
274
- # llmspy.py: send intercepted LLM API calls on to LLMSpy
275
- from mitmproxy import http
276
-
277
- LLMSPY = "http://127.0.0.1:8080"
278
- ROUTES = {
279
- "api.anthropic.com": "anthropic",
280
- "api.openai.com": "openai",
281
- }
282
-
283
-
284
- def request(flow: http.HTTPFlow) -> None:
285
- name = ROUTES.get(flow.request.pretty_host)
286
- if name:
287
- flow.request.url = f"{LLMSPY}/{name}{flow.request.path}"
288
- ```
289
-
290
- Run it on another port, as mitmproxy also defaults to 8080: `mitmdump --listen-port 8081 -s llmspy.py`. Then start the app with `HTTPS_PROXY=http://127.0.0.1:8081` and with mitmproxy's CA certificate trusted (see mitmproxy's docs on certificates). Calls to other hosts pass through mitmproxy untouched. Put `@<project>/` before the name in the URL to give the app its own [project](#keep-apps-apart-with-projects). Don't set `HTTPS_PROXY` for LLMSpy itself.
291
-
292
- mitmproxy's CA can stand in for any web site, so trust it only in the app you are watching (for Node, `NODE_EXTRA_CA_CERTS`), not in your system's certificate store. Only intercept apps on your own machine, or with the informed consent of whoever uses them.
293
-
294
- ## Configuration
295
-
296
- LLMSpy reads these environment variables when it starts: from the shell, and from a `.env` file, which is `~/.llmspy/.env` for the `llmspy` command and the one at the root of the repo for `npm start` and Docker (see [Setting upstreams for a local run](#setting-upstreams-for-a-local-run)).
297
-
298
- | Variable | Default | Meaning |
299
- | ----------------------- | ----------- | ------------------------------------------------------------ |
300
- | `PROXY_PORT` | `8080` | Port for the proxy and the UI |
301
- | `LLMSPY_HOST` | `127.0.0.1` | Interface to listen on; the Docker image sets `0.0.0.0` |
302
- | `LLMSPY_UPSTREAMS` | | Extra or replacement upstreams, see [Upstreams](#upstreams) |
303
- | `LLMSPY_RETENTION_DAYS` | `7` | Days to keep captured calls; `0` keeps them until cleared |
304
-
305
- ### Storage
306
-
307
- Captured calls are kept in `~/.llmspy/llmspy.db` (with Docker, in the `llmspy-data` volume), so they are still there after a restart. LLMSpy prints where, and for how long, when it starts. Calls older than `LLMSPY_RETENTION_DAYS` are removed at startup and every hour after. Clear All and the delete button remove calls from the file too. A call still running when LLMSpy stopped is shown as interrupted.
308
-
309
- The file holds whole prompts and replies (API keys are masked), so treat it like the traffic itself: it stays on your machine, and deleting it while LLMSpy is stopped removes every call.
310
-
311
- ## Testing with mock data
312
-
313
- To try LLMSpy without an API key or network, `npm run mock` starts two [llmock](https://www.npmjs.com/package/llmock) servers, with their config in `mock/.llmockrc.json`: the Anthropic Messages API on `http://127.0.0.1:8001` and OpenAI Chat Completions on `http://127.0.0.1:8002`. They reply with generated text. It needs `npm install` first, even if you run LLMSpy in Docker.
314
-
315
- Start the mocks in one terminal and leave them running:
316
-
317
- ```bash
318
- npm run mock
319
- ```
320
-
321
- In a second terminal, start LLMSpy with the mocks as upstreams (after `npm run build`):
49
+ For example, to watch Claude Code:
322
50
 
323
51
  ```bash
324
- LLMSPY_UPSTREAMS=llmock=http://127.0.0.1:8001,llmock-openai=http://127.0.0.1:8002 npm start
52
+ ANTHROPIC_BASE_URL=http://127.0.0.1:8080/anthropic claude
325
53
  ```
326
54
 
327
- With Docker, put `LLMSPY_UPSTREAMS=llmock=http://host.docker.internal:8001,llmock-openai=http://host.docker.internal:8002` in `.env` and run `npm run start:docker` instead.
328
-
329
- Then, in a third terminal, send the sample calls:
330
-
331
- ```bash
332
- node scripts/mock-traffic.mjs
333
- ```
334
-
335
- The script sends one call of each kind below. To use the mocks from your own client, set its base URL to `http://127.0.0.1:8080/llmock` (Anthropic) or `http://127.0.0.1:8080/llmock-openai/v1` (OpenAI), with any non-empty key. A marker in the last message picks the reply:
336
-
337
- | Marker | Reply |
338
- | --------------- | --------------------------------------------------------------------------------------------- |
339
- | `#tools` | A `get_weather` tool call (Anthropic); a tool result containing `sunny` gets the final answer |
340
- | `#max-tokens` | A reply cut off at the token limit |
341
- | `#refusal` | A refusal |
342
- | `#rate-limit` | HTTP 429 |
343
- | `#stream-error` | A stream that sends an error event part-way through |
344
- | `#stream-drop` | A stream whose connection is cut part-way through |
345
-
346
- Anything else gets random lorem ipsum. Both mocks stream when the request sets `"stream": true`.
55
+ Each call then appears in the UI at `http://127.0.0.1:8080`. The app keeps its own API key, which LLMSpy passes on to the provider. To add OpenRouter, Gemini, Ollama or a gateway, see [Upstreams](https://llmspy.piyook.com/guide/upstreams).
347
56
 
348
- ## How it works
57
+ ## Documentation
349
58
 
350
- - `proxy/`: one Node HTTP server. `/<prefix>/...` (or `/@<project>/<prefix>/...`) is forwarded to the upstream with the bytes unchanged, chunk by chunk, while a copy of each body is kept, decompressed (gzip, deflate, br, zstd) and decoded for display. Calls are stored with `node:sqlite`; a running call is held in memory and written when it starts, when its response headers arrive and when it ends. Any path that is not an upstream or the API below is a file from the built UI (`ui/dist`).
351
- - The UI and agents read the captured calls from a small API on the same port:
352
- - `GET /events`: Server-Sent Events of call summaries
353
- - `GET /api/requests`: summaries, filtered with `?project=`, `?q=` (search), `?since=`, `?model=`, `?status=`, `?failed=1` and `?limit=`; `?full=1` returns full records
354
- - `GET /api/stats`: calls, failures, tokens and latency over the same filters, per model and project
355
- - `GET` and `DELETE /api/requests/<id>`: one full record
356
- - `GET /api/requests/<id>/conversation`: the call as Markdown (both reads of one call take `?wait=<seconds>` to answer once a running call ends)
357
- - `GET /api/upstreams`: each prefix and where it forwards to
358
- - `POST /api/clear`: Clear All
359
- - `ui/`: Svelte and Vite.
59
+ | | |
60
+ |---|---|
61
+ | **Start here** | [Getting started](https://llmspy.piyook.com/guide/getting-started) · [Installation](https://llmspy.piyook.com/guide/installation) |
62
+ | **Using the UI** | [The call list](https://llmspy.piyook.com/guide/call-list) · [Reading a call](https://llmspy.piyook.com/guide/reading-a-call) · [Comparing calls](https://llmspy.piyook.com/guide/compare) · [Projects](https://llmspy.piyook.com/guide/projects) |
63
+ | **Connect your apps** | [Upstreams](https://llmspy.piyook.com/guide/upstreams) · [Docker](https://llmspy.piyook.com/guide/docker) · [Apps without a base URL](https://llmspy.piyook.com/guide/without-base-url) |
64
+ | **Agents and scripts** | [Reading calls from code](https://llmspy.piyook.com/guide/agents) |
65
+ | **Reference** | [CLI](https://llmspy.piyook.com/reference/cli) · [Configuration](https://llmspy.piyook.com/reference/configuration) · [HTTP API](https://llmspy.piyook.com/reference/api) · [How it works](https://llmspy.piyook.com/reference/how-it-works) |
66
+ | **Help** | [Troubleshooting](https://llmspy.piyook.com/troubleshooting) · [Testing with mock data](https://llmspy.piyook.com/guide/mock-data) · [Releases](https://github.com/piyook/llmspy/releases) |
360
67
 
361
- ## Troubleshooting
68
+ > **Using a coding agent?** Point it at [`llms.txt`](llms.txt) (shipped in the npm package, and served by a running LLMSpy at `http://127.0.0.1:8080/llms.txt`): how to run LLMSpy, point an app at it, and read the captured traffic.
362
69
 
363
- - **The app still calls the provider directly.** Check that it reads the base URL variable you set, and that it was started after you set it.
364
- - **404 from LLMSpy.** The path prefix doesn't match an upstream; the response lists the known ones.
365
- - **The app reports a connection error and nothing appears in LLMSpy.** The app can't reach LLMSpy. Check that LLMSpy is running; if the app runs in a container, `localhost` is that container (see [Setting upstreams in Docker](#setting-upstreams-in-docker)).
366
- - **502 from LLMSpy.** The upstream could not be reached; the request in the UI shows the error. With Docker, an upstream on your machine or in another container is not at `localhost` (see [Setting upstreams in Docker](#setting-upstreams-in-docker)).
367
- - **LLMSpy won't start: `EADDRINUSE`, or Docker's "port is already allocated".** Something else has port 8080, often LLMSpy started another way. Stop it with `llmspy stop` (or `npm run stop`), or `npm run stop:docker`.
70
+ > **Note:** LLMSpy is for local development only. It listens on `127.0.0.1`, masks API keys in what it records, and keeps the last 7 days of calls in a file on your machine. See [Storage](https://llmspy.piyook.com/reference/configuration#storage).
368
71
 
369
72
  ## License
370
73
 
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # LLMSpy
2
2
 
3
- > A local reverse proxy that records the LLM API calls an app makes and shows each one in a web UI: the prompt, the system message, the tools, the reply and the token counts. An app is pointed at it by its base URL setting (`ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL`); requests are forwarded unchanged and a copy is kept. This file is the reference for AI agents and scripts; it ships in the repository and in the npm package `llmspy`, a running LLMSpy serves it at `/llms.txt` (`http://127.0.0.1:8080/llms.txt` by default) for the version that is running, and `README.md` is the human guide.
3
+ > A local reverse proxy that records the LLM API calls an app makes and shows each one in a web UI: the prompt, the system message, the tools, the reply and the token counts. An app is pointed at it by its base URL setting (`ANTHROPIC_BASE_URL`, `OPENAI_BASE_URL`); requests are forwarded unchanged and a copy is kept. This file is the reference for AI agents and scripts; it ships in the repository and in the npm package `llmspy`, a running LLMSpy serves it at `/llms.txt` (`http://127.0.0.1:8080/llms.txt` by default) for the version that is running, and the human guide is at https://llmspy.piyook.com/.
4
4
 
5
5
  ## What it does and does not do
6
6
 
@@ -44,7 +44,7 @@ Set the app's base URL to LLMSpy plus the upstream's path prefix, then start the
44
44
  - The app's API key is sent through to the provider as usual. LLMSpy needs no key.
45
45
  - An app in another container reaches the proxy at `http://host.docker.internal:8080/<prefix>`, or by service name in the same compose project. Forwarding answers any `Host`; only the traffic endpoints below are limited to loopback.
46
46
  - To group an app's calls into a project, put `/@<project>` in front of the prefix: `ANTHROPIC_BASE_URL=http://127.0.0.1:8080/@my-app/anthropic`. It is not forwarded, and sets the record's `project`; without it the project is `general`. Project names follow the same rule as upstream names (below); any other name gets the `404` for an unknown prefix.
47
- - An app with no base-URL setting can't be pointed at LLMSpy directly. LLMSpy has no intercepting mode; the README section "Apps without a base-URL setting" has a mitmproxy add-on (an untested starting point) that rewrites `https://api.anthropic.com/...` to `http://127.0.0.1:8080/anthropic/...`. Run mitmproxy on another port (`--listen-port 8081`), as LLMSpy uses 8080. Ask the user before installing mitmproxy or trusting its CA.
47
+ - An app with no base-URL setting can't be pointed at LLMSpy directly. LLMSpy has no intercepting mode; the docs page https://llmspy.piyook.com/guide/without-base-url has a mitmproxy add-on (an untested starting point) that rewrites `https://api.anthropic.com/...` to `http://127.0.0.1:8080/anthropic/...`. Run mitmproxy on another port (`--listen-port 8081`), as LLMSpy uses 8080. Ask the user before installing mitmproxy or trusting its CA.
48
48
 
49
49
  ## Configuration
50
50
 
@@ -180,7 +180,7 @@ Check what an app sends for one task, without clearing anyone's calls: note the
180
180
 
181
181
  Wait for a call to end: find its `id` (`GET /api/requests?since=<when you started>&limit=1`, or the first summary on `/events`), then `curl -s "http://127.0.0.1:8080/api/requests/$id/conversation?wait=120"` answers once it ends; use `/api/requests/$id?wait=120` for the record. If the answer still has no `timings.end` (or the Markdown header says `running`), the wait ran out: ask again. Waiting for a call that has not been sent yet is not built in: poll `GET /api/requests?since=<when you started>` until a summary shows up.
182
182
 
183
- Without an API key, in a clone of the repository: `npm run mock` starts mock LLM APIs (Anthropic Messages on `127.0.0.1:8001`, OpenAI Chat Completions on `127.0.0.1:8002`). Start LLMSpy with `LLMSPY_UPSTREAMS=llmock=http://127.0.0.1:8001,llmock-openai=http://127.0.0.1:8002`, then `node scripts/mock-traffic.mjs` sends one call of each kind (tool call, `max_tokens`, refusal, `429`, stream error, dropped stream). The README lists the prompt markers that pick each reply.
183
+ Without an API key, in a clone of the repository: `npm run mock` starts mock LLM APIs (Anthropic Messages on `127.0.0.1:8001`, OpenAI Chat Completions on `127.0.0.1:8002`). Start LLMSpy with `LLMSPY_UPSTREAMS=llmock=http://127.0.0.1:8001,llmock-openai=http://127.0.0.1:8002`, then `node scripts/mock-traffic.mjs` sends one call of each kind (tool call, `max_tokens`, refusal, `429`, stream error, dropped stream). https://llmspy.piyook.com/guide/mock-data lists the prompt markers that pick each reply.
184
184
 
185
185
  ## Do not
186
186
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "llmspy",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Local developer tool for intercepting and displaying LLM API traffic",
5
5
  "license": "MIT",
6
6
  "author": "piyook",
7
- "homepage": "https://github.com/piyook/llmspy#readme",
7
+ "homepage": "https://llmspy.piyook.com/",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/piyook/llmspy.git"
@@ -51,5 +51,5 @@ Settings are environment variables, set in the shell or in ~/.llmspy/.env
51
51
  LLMSPY_UPSTREAMS extra upstreams, as name=url,...
52
52
  LLMSPY_RETENTION_DAYS days to keep captured calls, 0 for ever (7)
53
53
 
54
- Docs: https://github.com/piyook/llmspy`;
54
+ Docs: https://llmspy.piyook.com/`;
55
55
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llmspy-proxy",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "private": true,
5
5
  "type": "module"
6
6
  }
@@ -21,4 +21,4 @@
21
21
  failed, their tokens and their latency.</li> <li>Coding agents and scripts can read the captured calls too; point them
22
22
  at the reference: <code class="help-code"> </code></li> <li>API keys are masked. Prompts and replies are shown in full.</li> <li>Calls are kept in a file on your machine, so they survive a restart:
23
23
  the last 7 days unless <code>LLMSPY_RETENTION_DAYS</code> says
24
- otherwise. Clear All empties the project you are viewing.</li></ul> <p class="help-more">More in the <a target="_blank" rel="noreferrer">README</a>.</p></div>`);function Zs(e,t){let n=M(()=>`${location.protocol}//${t.address??`127.0.0.1:8080`}`);Js(e,{id:`help-popover`,label:`Help`,buttonClass:`icon-btn`,buttonLabel:`Help`,trigger:e=>{J(e,Ys())},children:(e,t)=>{var r=Xs(),i=z(I(r),2),a=I(i),o=z(I(a)),s=R(o),c=R(z(o,2));we(),D(a),we(4),D(i);var l=z(i,4),u=z(I(l),2),d=R(z(I(u),3));we(3),D(u);var f=z(u,10),p=R(z(I(f)));D(f),we(4),D(l);var m=z(l,2);$(z(I(m)),`href`,`https://github.com/piyook/llmspy#readme`),we(),D(m),D(r),B(()=>{Y(s,`ANTHROPIC_BASE_URL=${U(n)??``}/anthropic`),Y(c,`OPENAI_BASE_URL=${U(n)??``}/openai/v1`),Y(d,`ANTHROPIC_BASE_URL=${U(n)??``}/@my-app/anthropic`),Y(p,`${U(n)??``}/llms.txt`)}),J(e,r)},$$slots:{trigger:!0,default:!0}})}var Qs=[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}],$s=`llmspy-theme`;function ec(){try{let e=localStorage.getItem($s);if(e===`light`||e===`dark`)return e}catch{}return`system`}function tc(e){let t=document.documentElement;e===`system`?delete t.dataset.theme:t.dataset.theme=e;try{e===`system`?localStorage.removeItem($s):localStorage.setItem($s,e)}catch{}}var nc=xr(`<svg viewBox="0 0 24 24" width="28" height="28" fill="none" stroke="currentColor" aria-hidden="true"><circle cx="12" cy="12" r="6.5" stroke-width="2"></circle><circle cx="12" cy="12" r="2.5" stroke-width="2"></circle><path stroke-width="3" d="M19 12h3M12 19v3M5 12H2M12 5V2M16.95 16.95l2.12 2.12M7.05 16.95l-2.12 2.12M7.05 7.05 4.93 4.93M16.95 7.05l2.12-2.12"></path></svg>`),rc=K(`<label><input type="radio" name="theme"/> </label>`),ic=K(`<p class="setting-version"> </p>`),ac=K(`<fieldset class="setting"><legend>Theme</legend> <div class="setting-options"></div></fieldset> <!>`,1);function oc(e,t){k(t,!0);let n=[],r=P(Wt(ec()));Js(e,{id:`settings-popover`,label:`Settings`,buttonClass:`icon-btn`,buttonLabel:`Settings`,trigger:e=>{J(e,nc())},children:(e,i)=>{var a=ac(),o=L(a),s=z(I(o),2);Z(s,21,()=>Qs,e=>e.value,(e,t)=>{var i=rc(),a=I(i);ri(a);var o,s=z(a);D(i),B(()=>{o!==(o=U(t).value)&&(a.value=(a.__value=o)??``),Y(s,` ${U(t).label??``}`)}),W(`change`,a,()=>tc(U(r))),li(n,[],a,()=>(U(t).value,U(r)),e=>F(r,e)),J(e,i)}),D(s),D(o);var c=z(o,2),l=e=>{var n=ic(),r=R(n);B(()=>Y(r,`LLMSpy ${t.version??``}`)),J(e,n)};X(c,e=>{t.version&&e(l)}),J(e,a)},$$slots:{trigger:!0,default:!0}}),A()}G([`change`]);var sc=xr(`<path class="wave wave-far" d="M26 4.5a10 10 0 0 1 0 15"></path><path class="wave wave-mid" d="M22.5 7a7 7 0 0 1 0 10"></path><path class="wave wave-near" d="M19.5 9.5a3.5 3.5 0 0 1 0 5"></path>`,1),cc=xr(`<line x1="3" y1="4" x2="18" y2="21"></line>`),lc=K(`<span role="status"><svg viewBox="0 0 30 24" width="45" height="36" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 9.5A6.5 6.5 0 0 1 17 9.5C17 14 12.5 15 12.5 18.5A3.5 3.5 0 0 1 5.5 18.5"></path><path d="M13.5 9.5A3 3 0 0 0 7.5 9.5v1a2 2 0 0 1 0 4"></path><!></svg> <span class="visually-hidden"> </span></span>`);function uc(e,t){let n=M(()=>t.connected?`Listening${t.address?` on ${t.address}`:``}`:`Not connected to the proxy`);var r=lc();let i;var a=I(r),o=z(I(a),2),s=e=>{var t=sc();we(2),J(e,t)},c=e=>{J(e,cc())};X(o,e=>{t.connected?e(s):e(c,-1)}),D(a);var l=R(z(a,2),!0);D(r),B(()=>{i=Q(r,1,`status-icon`,null,i,{connected:t.connected}),$(r,`title`,U(n)),Y(l,U(n))}),J(e,r)}var dc=K(`<p class="popover-error">Not connected to the proxy.</p>`),fc=K(`<p class="popover-error">Couldn't load the list from the proxy.</p>`),pc=K(`<p class="popover-hint">Loading...</p>`),mc=K(`<li class="upstream"><span class="upstream-name"> </span> <code class="upstream-url"> </code> <button type="button" class="small-btn"> </button> <span class="upstream-target"> </span></li>`),hc=K(`<ul class="upstream-list"></ul>`),gc=K(`<p class="popover-hint">Point an app's base URL at one of these.</p> <!>`,1);function _c(e,t){k(t,!0);let n=P(void 0),r=P(!1),i=P(void 0),a;function o(e){return`${location.protocol}//${t.address}/${e}`}async function s(){F(r,!1);try{let e=await fetch(`/api/upstreams`);if(!e.ok)throw Error(`HTTP ${e.status}`);F(n,await e.json(),!0)}catch{F(n,void 0),F(r,!0)}}async function c(e){let t=`Copied`;try{await navigator.clipboard.writeText(o(e))}catch{t=`Failed`}F(i,{name:e,label:t},!0),clearTimeout(a),a=setTimeout(()=>F(i,void 0),1500)}Js(e,{id:`upstream-popover`,label:`Base URLs`,align:`center`,onopen:s,trigger:e=>{we(),J(e,Sr(`Base URLs`))},children:(e,a)=>{var s=gc(),l=z(L(s),2),u=e=>{J(e,dc())},d=e=>{J(e,fc())},f=e=>{J(e,pc())},p=e=>{var t=hc();Z(t,21,()=>U(n),e=>e.name,(e,t)=>{var n=mc(),r=I(n),a=R(r,!0),s=z(r,2),l=R(s,!0),u=z(s,2),d=R(u,!0),f=R(z(u,2));D(n),B(e=>{Y(a,U(t).name),Y(l,e),$(u,`aria-label`,`Copy the ${U(t).name} base URL`),Y(d,U(i)?.name===U(t).name?U(i).label:`Copy`),Y(f,`to ${U(t).target??``}`)},[()=>o(U(t).name)]),W(`click`,u,()=>c(U(t).name)),J(e,n)}),D(t),J(e,t)};X(l,e=>{t.address?U(r)?e(d,1):U(n)?e(p,-1):e(f,2):e(u)}),J(e,s)},$$slots:{trigger:!0,default:!0}}),A()}G([`click`]);var vc=K(`<div class="header"><div class="title"><h1>LLMSpy</h1> <!></div> <div class="controls"><!> <input type="search" placeholder="Search requests..." aria-label="Search requests" class="search"/> <button type="button" class="clear-btn">Clear All</button> <!> <!></div></div>`);function yc(e,t){k(t,!0);let n=vi(t,`search`,15,``);var r=vc(),i=I(r);uc(z(I(i),2),{get connected(){return t.connected},get address(){return t.address}}),D(i);var a=z(i,2),o=I(a);{let e=M(()=>t.connected?t.address:void 0);_c(o,{get address(){return U(e)}})}var s=z(o,2);ri(s);var c=z(s,2),l=z(c,2);{let e=M(()=>t.connected?t.address:void 0);Zs(l,{get address(){return U(e)}})}oc(z(l,2),{get version(){return t.version}}),D(a),D(r),si(s,n),W(`click`,c,function(...e){t.onclear?.apply(this,e)}),J(e,r),A()}G([`click`]);var bc=K(`<p class="pick-hint" role="status">Click the call to compare with. <button type="button" class="small-btn">Cancel</button></p>`),xc=K(`<div class="day"><!> <!> <!></div>`),Sc=K(`<div class="no-requests">Loading…</div>`),Cc=K(`<div class="no-requests">Select a request to see it here.</div>`),wc=K(`<!> <!> <!> <div class="panes"><section aria-label="Captured requests"><!> <!> <!></section> <section class="detail" aria-label="Selected request"><!></section></div>`,1);function Tc(e,t){k(t,!0);let n=new bi,r=P(``),i=P(void 0),a=P(!1),o=P(void 0),s=P(void 0);async function c(){try{let e=await(await fetch(`/ping`)).json();typeof e.port==`number`&&F(o,`${location.hostname}:${e.port}`),typeof e.version==`string`&&F(s,e.version,!0)}catch{}}let l=M(()=>hs(n.values())),u=P(Wt(ms)),d=M(()=>U(l).includes(U(u))?U(u):ms),f=Date.now(),p=new bi,m=e=>vs(n.values(),e,p.get(e)??f);function h(e){if(e===U(d))return;let t=Date.now();p.set(U(d),t),p.set(e,t),F(u,e,!0),F(i,void 0),F(y,void 0),F(b,!1)}let g=M(()=>U(i)?n.get(U(i)):void 0),_=bs(()=>U(g)),v=P(`conversation`),y=P(void 0),b=P(!1),x=M(()=>{if(U(g))return(U(y)?n.get(U(y)):void 0)??ta(n.values(),U(g))}),S=M(()=>U(g)!==void 0&&U(v)===`compare`),ee=bs(()=>U(S)?U(x):void 0),te=M(()=>!_.current||U(S)&&U(x)!==void 0&&!ee.current);function ne(e){U(b)?(F(b,!1),e!==U(i)&&F(y,e,!0)):(F(i,e,!0),F(y,void 0))}function re(e){e.key===`Escape`&&F(b,!1)}let ie=P(void 0),ae=M(()=>U(ie)?.filter(({id:e})=>n.has(e))),oe=M(()=>U(ae)&&new Set(U(ae).map(({id:e})=>e))),se=M(()=>U(ae)&&gs(U(ae))),ce=M(()=>[...n.values()].filter(e=>Ho(e)===`done`).length);pn(()=>{let e=U(r);if(U(ce),!e){F(ie,void 0);return}let t=!1,n=setTimeout(async()=>{try{let n=await fetch(`/api/requests?${new URLSearchParams({q:e})}`);if(!n.ok)return;let r=await n.json();t||F(ie,r)}catch(e){console.error(`Failed to search requests:`,e)}},250);return()=>{t=!0,clearTimeout(n)}});let le=M(()=>U(l).flatMap(e=>{let t=U(se)?.get(e)??0;return e!==U(d)&&t>0?[[e,t]]:[]})),ue=P(!1),de=M(()=>[...n.values()].filter(e=>zo(e,{project:U(d),matches:U(r)?U(oe):void 0})).sort(Go)),fe=M(()=>U(ue)?Bo(U(de)):U(de)),pe=P(Wt(Date.now())),me=M(()=>cs(U(pe))),he=new bi;pn(()=>{let e=setInterval(()=>{let e=Date.now(),t=cs(U(pe));cs(e)!==t&&!he.has(t)&&he.set(t,!0),F(pe,e,!0)},6e4);return()=>clearInterval(e)});let ge=M(()=>ps(U(fe))),_e=e=>!!U(r)||U(ue)||(he.get(e)??e===U(me)),C=P(void 0),ve=M(()=>U(C)!==void 0&&!U(r)),ye=P(Wt(Date.now()));pn(()=>{if(!U(ve))return;F(ye,Date.now(),!0);let e=setInterval(()=>F(ye,Date.now(),!0),5e3);return()=>clearInterval(e)});let be=e=>e===U(me)&&!U(r)&&_e(e),xe=e=>U(ve)&&U(C)!==void 0&&e.key===U(me)?fs(e.calls,U(C),U(ye)):e.calls,w=M(()=>U(ge).flatMap(xe)),Se=M(()=>xs(Si(U(w)))),T=M(()=>Vo(ps(U(de)).flatMap(xe)));yi(()=>{let e,t;function r(){e=new EventSource(`/events`),e.onopen=()=>{F(a,!0),n.clear(),c()},e.onmessage=e=>{let t=JSON.parse(e.data);n.set(t.id,t)},e.addEventListener(`clear`,e=>{let{project:t}=JSON.parse(e.data);we(typeof t==`string`?t:void 0)}),e.addEventListener(`delete`,e=>{let{id:t}=JSON.parse(e.data);typeof t==`string`&&E(t)}),e.onerror=()=>{F(a,!1),e?.readyState===EventSource.CLOSED&&(t=setTimeout(r,3e3))}}return r(),()=>{clearTimeout(t),e?.close()}});function E(e){n.delete(e),U(i)===e&&(F(i,void 0),F(b,!1)),U(y)===e&&F(y,void 0)}async function Ce(e){try{let t=await fetch(`/api/requests/${e}`,{method:`DELETE`});(t.ok||t.status===404)&&E(e)}catch(e){console.error(`Failed to delete request:`,e)}}function we(e){for(let t of[...n.values()])(e===void 0||t.project===e)&&E(t.id)}async function Te(){let e=U(d);try{await fetch(`/api/clear?project=${encodeURIComponent(e)}`,{method:`POST`}),we(e)}catch(e){console.error(`Failed to clear requests:`,e)}}var Ee=wc();fr(`keydown`,qt,re);var De=L(Ee);yc(De,{get connected(){return U(a)},get address(){return U(o)},get version(){return U(s)},onclear:Te,get search(){return U(r)},set search(e){F(r,e,!0)}});var Oe=z(De,2);{let e=M(()=>U(r)?U(se):void 0);Es(Oe,{get projects(){return U(l)},get current(){return U(d)},unseen:m,get matches(){return U(e)},onchoose:h})}var ke=z(Oe,2);{let e=M(()=>U(w).length>0);Gs(ke,{get shown(){return U(e)},get cards(){return U(Se)}})}var Ae=z(ke,2),je=I(Ae);let Me;var Ne=I(je),Pe=e=>{var t=bc(),n=z(I(t));D(t),W(`click`,n,()=>F(b,!1)),J(e,t)};X(Ne,e=>{U(b)&&e(Pe)});var Fe=z(Ne,2);ss(Fe,{get pressed(){return U(ue)},get count(){return U(T)},ontoggle:()=>F(ue,!U(ue))}),Z(z(Fe,2),17,()=>U(ge),e=>e.key,(e,t)=>{let n=M(()=>_e(U(t).key)),r=M(()=>xe(U(t)));var a=xc(),o=I(a);{let e=M(()=>us(U(t).key,U(pe)));Ei(o,{get label(){return U(e)},get count(){return U(r).length},get total(){return U(t).calls.length},get open(){return U(n)},ontoggle:()=>he.set(U(t).key,!U(n))})}var s=z(o,2);{let e=M(()=>be(U(t).key));As(s,{get shown(){return U(e)},get minutes(){return U(C)},get count(){return U(r).length},onchoose:e=>F(C,e,!0)})}var c=z(s,2),l=e=>{var t=q();Z(L(t),17,()=>U(r),e=>e.id,(e,t)=>{{let n=M(()=>U(t).id===U(i)),r=M(()=>U(S)&&U(t).id===U(x)?.id);Vs(e,{get request(){return U(t)},get selected(){return U(n)},get comparing(){return U(S)},get compared(){return U(r)},onselect:()=>ne(U(t).id),ondelete:()=>Ce(U(t).id)})}}),J(e,t)};X(c,e=>{U(n)&&e(l)}),D(a),J(e,a)},e=>{as(e,{get project(){return U(d)},get search(){return U(r)},get failedOnly(){return U(ue)},get elsewhere(){return U(le)},onchoose:h})}),D(je);var Ie=z(je,2),Le=I(Ie),Re=e=>{J(e,Sc())},ze=e=>{ts(e,{get request(){return _.current},get other(){return ee.current},get picking(){return U(b)},onpick:()=>F(b,!U(b)),get chosen(){return U(v)},set chosen(e){F(v,e,!0)}})},Be=e=>{J(e,Cc())};X(Le,e=>{U(g)&&U(te)?e(Re):_.current?e(ze,1):e(Be,-1)}),D(Ie),D(Ae),B(()=>Me=Q(je,1,`list`,null,Me,{picking:U(b)})),J(e,Ee),A()}G([`click`]);var Ec=document.getElementById(`app`);if(!Ec)throw Error(`#app element not found in index.html`);Dr(Tc,{target:Ec});
24
+ otherwise. Clear All empties the project you are viewing.</li></ul> <p class="help-more">More in the <a target="_blank" rel="noreferrer">docs</a>.</p></div>`);function Zs(e,t){let n=M(()=>`${location.protocol}//${t.address??`127.0.0.1:8080`}`);Js(e,{id:`help-popover`,label:`Help`,buttonClass:`icon-btn`,buttonLabel:`Help`,trigger:e=>{J(e,Ys())},children:(e,t)=>{var r=Xs(),i=z(I(r),2),a=I(i),o=z(I(a)),s=R(o),c=R(z(o,2));we(),D(a),we(4),D(i);var l=z(i,4),u=z(I(l),2),d=R(z(I(u),3));we(3),D(u);var f=z(u,10),p=R(z(I(f)));D(f),we(4),D(l);var m=z(l,2);$(z(I(m)),`href`,`https://llmspy.piyook.com/`),we(),D(m),D(r),B(()=>{Y(s,`ANTHROPIC_BASE_URL=${U(n)??``}/anthropic`),Y(c,`OPENAI_BASE_URL=${U(n)??``}/openai/v1`),Y(d,`ANTHROPIC_BASE_URL=${U(n)??``}/@my-app/anthropic`),Y(p,`${U(n)??``}/llms.txt`)}),J(e,r)},$$slots:{trigger:!0,default:!0}})}var Qs=[{value:`system`,label:`System`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`}],$s=`llmspy-theme`;function ec(){try{let e=localStorage.getItem($s);if(e===`light`||e===`dark`)return e}catch{}return`system`}function tc(e){let t=document.documentElement;e===`system`?delete t.dataset.theme:t.dataset.theme=e;try{e===`system`?localStorage.removeItem($s):localStorage.setItem($s,e)}catch{}}var nc=xr(`<svg viewBox="0 0 24 24" width="28" height="28" fill="none" stroke="currentColor" aria-hidden="true"><circle cx="12" cy="12" r="6.5" stroke-width="2"></circle><circle cx="12" cy="12" r="2.5" stroke-width="2"></circle><path stroke-width="3" d="M19 12h3M12 19v3M5 12H2M12 5V2M16.95 16.95l2.12 2.12M7.05 16.95l-2.12 2.12M7.05 7.05 4.93 4.93M16.95 7.05l2.12-2.12"></path></svg>`),rc=K(`<label><input type="radio" name="theme"/> </label>`),ic=K(`<p class="setting-version"> </p>`),ac=K(`<fieldset class="setting"><legend>Theme</legend> <div class="setting-options"></div></fieldset> <!>`,1);function oc(e,t){k(t,!0);let n=[],r=P(Wt(ec()));Js(e,{id:`settings-popover`,label:`Settings`,buttonClass:`icon-btn`,buttonLabel:`Settings`,trigger:e=>{J(e,nc())},children:(e,i)=>{var a=ac(),o=L(a),s=z(I(o),2);Z(s,21,()=>Qs,e=>e.value,(e,t)=>{var i=rc(),a=I(i);ri(a);var o,s=z(a);D(i),B(()=>{o!==(o=U(t).value)&&(a.value=(a.__value=o)??``),Y(s,` ${U(t).label??``}`)}),W(`change`,a,()=>tc(U(r))),li(n,[],a,()=>(U(t).value,U(r)),e=>F(r,e)),J(e,i)}),D(s),D(o);var c=z(o,2),l=e=>{var n=ic(),r=R(n);B(()=>Y(r,`LLMSpy ${t.version??``}`)),J(e,n)};X(c,e=>{t.version&&e(l)}),J(e,a)},$$slots:{trigger:!0,default:!0}}),A()}G([`change`]);var sc=xr(`<path class="wave wave-far" d="M26 4.5a10 10 0 0 1 0 15"></path><path class="wave wave-mid" d="M22.5 7a7 7 0 0 1 0 10"></path><path class="wave wave-near" d="M19.5 9.5a3.5 3.5 0 0 1 0 5"></path>`,1),cc=xr(`<line x1="3" y1="4" x2="18" y2="21"></line>`),lc=K(`<span role="status"><svg viewBox="0 0 30 24" width="45" height="36" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 9.5A6.5 6.5 0 0 1 17 9.5C17 14 12.5 15 12.5 18.5A3.5 3.5 0 0 1 5.5 18.5"></path><path d="M13.5 9.5A3 3 0 0 0 7.5 9.5v1a2 2 0 0 1 0 4"></path><!></svg> <span class="visually-hidden"> </span></span>`);function uc(e,t){let n=M(()=>t.connected?`Listening${t.address?` on ${t.address}`:``}`:`Not connected to the proxy`);var r=lc();let i;var a=I(r),o=z(I(a),2),s=e=>{var t=sc();we(2),J(e,t)},c=e=>{J(e,cc())};X(o,e=>{t.connected?e(s):e(c,-1)}),D(a);var l=R(z(a,2),!0);D(r),B(()=>{i=Q(r,1,`status-icon`,null,i,{connected:t.connected}),$(r,`title`,U(n)),Y(l,U(n))}),J(e,r)}var dc=K(`<p class="popover-error">Not connected to the proxy.</p>`),fc=K(`<p class="popover-error">Couldn't load the list from the proxy.</p>`),pc=K(`<p class="popover-hint">Loading...</p>`),mc=K(`<li class="upstream"><span class="upstream-name"> </span> <code class="upstream-url"> </code> <button type="button" class="small-btn"> </button> <span class="upstream-target"> </span></li>`),hc=K(`<ul class="upstream-list"></ul>`),gc=K(`<p class="popover-hint">Point an app's base URL at one of these.</p> <!>`,1);function _c(e,t){k(t,!0);let n=P(void 0),r=P(!1),i=P(void 0),a;function o(e){return`${location.protocol}//${t.address}/${e}`}async function s(){F(r,!1);try{let e=await fetch(`/api/upstreams`);if(!e.ok)throw Error(`HTTP ${e.status}`);F(n,await e.json(),!0)}catch{F(n,void 0),F(r,!0)}}async function c(e){let t=`Copied`;try{await navigator.clipboard.writeText(o(e))}catch{t=`Failed`}F(i,{name:e,label:t},!0),clearTimeout(a),a=setTimeout(()=>F(i,void 0),1500)}Js(e,{id:`upstream-popover`,label:`Base URLs`,align:`center`,onopen:s,trigger:e=>{we(),J(e,Sr(`Base URLs`))},children:(e,a)=>{var s=gc(),l=z(L(s),2),u=e=>{J(e,dc())},d=e=>{J(e,fc())},f=e=>{J(e,pc())},p=e=>{var t=hc();Z(t,21,()=>U(n),e=>e.name,(e,t)=>{var n=mc(),r=I(n),a=R(r,!0),s=z(r,2),l=R(s,!0),u=z(s,2),d=R(u,!0),f=R(z(u,2));D(n),B(e=>{Y(a,U(t).name),Y(l,e),$(u,`aria-label`,`Copy the ${U(t).name} base URL`),Y(d,U(i)?.name===U(t).name?U(i).label:`Copy`),Y(f,`to ${U(t).target??``}`)},[()=>o(U(t).name)]),W(`click`,u,()=>c(U(t).name)),J(e,n)}),D(t),J(e,t)};X(l,e=>{t.address?U(r)?e(d,1):U(n)?e(p,-1):e(f,2):e(u)}),J(e,s)},$$slots:{trigger:!0,default:!0}}),A()}G([`click`]);var vc=K(`<div class="header"><div class="title"><img class="logo" src="/logo.svg" alt="" width="40" height="40"/> <h1>LLMSpy</h1> <!></div> <div class="controls"><!> <input type="search" placeholder="Search requests..." aria-label="Search requests" class="search"/> <button type="button" class="clear-btn">Clear All</button> <!> <!></div></div>`);function yc(e,t){k(t,!0);let n=vi(t,`search`,15,``);var r=vc(),i=I(r);uc(z(I(i),4),{get connected(){return t.connected},get address(){return t.address}}),D(i);var a=z(i,2),o=I(a);{let e=M(()=>t.connected?t.address:void 0);_c(o,{get address(){return U(e)}})}var s=z(o,2);ri(s);var c=z(s,2),l=z(c,2);{let e=M(()=>t.connected?t.address:void 0);Zs(l,{get address(){return U(e)}})}oc(z(l,2),{get version(){return t.version}}),D(a),D(r),si(s,n),W(`click`,c,function(...e){t.onclear?.apply(this,e)}),J(e,r),A()}G([`click`]);var bc=K(`<p class="pick-hint" role="status">Click the call to compare with. <button type="button" class="small-btn">Cancel</button></p>`),xc=K(`<div class="day"><!> <!> <!></div>`),Sc=K(`<div class="no-requests">Loading…</div>`),Cc=K(`<div class="no-requests">Select a request to see it here.</div>`),wc=K(`<!> <!> <!> <div class="panes"><section aria-label="Captured requests"><!> <!> <!></section> <section class="detail" aria-label="Selected request"><!></section></div>`,1);function Tc(e,t){k(t,!0);let n=new bi,r=P(``),i=P(void 0),a=P(!1),o=P(void 0),s=P(void 0);async function c(){try{let e=await(await fetch(`/ping`)).json();typeof e.port==`number`&&F(o,`${location.hostname}:${e.port}`),typeof e.version==`string`&&F(s,e.version,!0)}catch{}}let l=M(()=>hs(n.values())),u=P(Wt(ms)),d=M(()=>U(l).includes(U(u))?U(u):ms),f=Date.now(),p=new bi,m=e=>vs(n.values(),e,p.get(e)??f);function h(e){if(e===U(d))return;let t=Date.now();p.set(U(d),t),p.set(e,t),F(u,e,!0),F(i,void 0),F(y,void 0),F(b,!1)}let g=M(()=>U(i)?n.get(U(i)):void 0),_=bs(()=>U(g)),v=P(`conversation`),y=P(void 0),b=P(!1),x=M(()=>{if(U(g))return(U(y)?n.get(U(y)):void 0)??ta(n.values(),U(g))}),S=M(()=>U(g)!==void 0&&U(v)===`compare`),ee=bs(()=>U(S)?U(x):void 0),te=M(()=>!_.current||U(S)&&U(x)!==void 0&&!ee.current);function ne(e){U(b)?(F(b,!1),e!==U(i)&&F(y,e,!0)):(F(i,e,!0),F(y,void 0))}function re(e){e.key===`Escape`&&F(b,!1)}let ie=P(void 0),ae=M(()=>U(ie)?.filter(({id:e})=>n.has(e))),oe=M(()=>U(ae)&&new Set(U(ae).map(({id:e})=>e))),se=M(()=>U(ae)&&gs(U(ae))),ce=M(()=>[...n.values()].filter(e=>Ho(e)===`done`).length);pn(()=>{let e=U(r);if(U(ce),!e){F(ie,void 0);return}let t=!1,n=setTimeout(async()=>{try{let n=await fetch(`/api/requests?${new URLSearchParams({q:e})}`);if(!n.ok)return;let r=await n.json();t||F(ie,r)}catch(e){console.error(`Failed to search requests:`,e)}},250);return()=>{t=!0,clearTimeout(n)}});let le=M(()=>U(l).flatMap(e=>{let t=U(se)?.get(e)??0;return e!==U(d)&&t>0?[[e,t]]:[]})),ue=P(!1),de=M(()=>[...n.values()].filter(e=>zo(e,{project:U(d),matches:U(r)?U(oe):void 0})).sort(Go)),fe=M(()=>U(ue)?Bo(U(de)):U(de)),pe=P(Wt(Date.now())),me=M(()=>cs(U(pe))),he=new bi;pn(()=>{let e=setInterval(()=>{let e=Date.now(),t=cs(U(pe));cs(e)!==t&&!he.has(t)&&he.set(t,!0),F(pe,e,!0)},6e4);return()=>clearInterval(e)});let ge=M(()=>ps(U(fe))),_e=e=>!!U(r)||U(ue)||(he.get(e)??e===U(me)),C=P(void 0),ve=M(()=>U(C)!==void 0&&!U(r)),ye=P(Wt(Date.now()));pn(()=>{if(!U(ve))return;F(ye,Date.now(),!0);let e=setInterval(()=>F(ye,Date.now(),!0),5e3);return()=>clearInterval(e)});let be=e=>e===U(me)&&!U(r)&&_e(e),xe=e=>U(ve)&&U(C)!==void 0&&e.key===U(me)?fs(e.calls,U(C),U(ye)):e.calls,w=M(()=>U(ge).flatMap(xe)),Se=M(()=>xs(Si(U(w)))),T=M(()=>Vo(ps(U(de)).flatMap(xe)));yi(()=>{let e,t;function r(){e=new EventSource(`/events`),e.onopen=()=>{F(a,!0),n.clear(),c()},e.onmessage=e=>{let t=JSON.parse(e.data);n.set(t.id,t)},e.addEventListener(`clear`,e=>{let{project:t}=JSON.parse(e.data);we(typeof t==`string`?t:void 0)}),e.addEventListener(`delete`,e=>{let{id:t}=JSON.parse(e.data);typeof t==`string`&&E(t)}),e.onerror=()=>{F(a,!1),e?.readyState===EventSource.CLOSED&&(t=setTimeout(r,3e3))}}return r(),()=>{clearTimeout(t),e?.close()}});function E(e){n.delete(e),U(i)===e&&(F(i,void 0),F(b,!1)),U(y)===e&&F(y,void 0)}async function Ce(e){try{let t=await fetch(`/api/requests/${e}`,{method:`DELETE`});(t.ok||t.status===404)&&E(e)}catch(e){console.error(`Failed to delete request:`,e)}}function we(e){for(let t of[...n.values()])(e===void 0||t.project===e)&&E(t.id)}async function Te(){let e=U(d);try{await fetch(`/api/clear?project=${encodeURIComponent(e)}`,{method:`POST`}),we(e)}catch(e){console.error(`Failed to clear requests:`,e)}}var Ee=wc();fr(`keydown`,qt,re);var De=L(Ee);yc(De,{get connected(){return U(a)},get address(){return U(o)},get version(){return U(s)},onclear:Te,get search(){return U(r)},set search(e){F(r,e,!0)}});var Oe=z(De,2);{let e=M(()=>U(r)?U(se):void 0);Es(Oe,{get projects(){return U(l)},get current(){return U(d)},unseen:m,get matches(){return U(e)},onchoose:h})}var ke=z(Oe,2);{let e=M(()=>U(w).length>0);Gs(ke,{get shown(){return U(e)},get cards(){return U(Se)}})}var Ae=z(ke,2),je=I(Ae);let Me;var Ne=I(je),Pe=e=>{var t=bc(),n=z(I(t));D(t),W(`click`,n,()=>F(b,!1)),J(e,t)};X(Ne,e=>{U(b)&&e(Pe)});var Fe=z(Ne,2);ss(Fe,{get pressed(){return U(ue)},get count(){return U(T)},ontoggle:()=>F(ue,!U(ue))}),Z(z(Fe,2),17,()=>U(ge),e=>e.key,(e,t)=>{let n=M(()=>_e(U(t).key)),r=M(()=>xe(U(t)));var a=xc(),o=I(a);{let e=M(()=>us(U(t).key,U(pe)));Ei(o,{get label(){return U(e)},get count(){return U(r).length},get total(){return U(t).calls.length},get open(){return U(n)},ontoggle:()=>he.set(U(t).key,!U(n))})}var s=z(o,2);{let e=M(()=>be(U(t).key));As(s,{get shown(){return U(e)},get minutes(){return U(C)},get count(){return U(r).length},onchoose:e=>F(C,e,!0)})}var c=z(s,2),l=e=>{var t=q();Z(L(t),17,()=>U(r),e=>e.id,(e,t)=>{{let n=M(()=>U(t).id===U(i)),r=M(()=>U(S)&&U(t).id===U(x)?.id);Vs(e,{get request(){return U(t)},get selected(){return U(n)},get comparing(){return U(S)},get compared(){return U(r)},onselect:()=>ne(U(t).id),ondelete:()=>Ce(U(t).id)})}}),J(e,t)};X(c,e=>{U(n)&&e(l)}),D(a),J(e,a)},e=>{as(e,{get project(){return U(d)},get search(){return U(r)},get failedOnly(){return U(ue)},get elsewhere(){return U(le)},onchoose:h})}),D(je);var Ie=z(je,2),Le=I(Ie),Re=e=>{J(e,Sc())},ze=e=>{ts(e,{get request(){return _.current},get other(){return ee.current},get picking(){return U(b)},onpick:()=>F(b,!U(b)),get chosen(){return U(v)},set chosen(e){F(v,e,!0)}})},Be=e=>{J(e,Cc())};X(Le,e=>{U(g)&&U(te)?e(Re):_.current?e(ze,1):e(Be,-1)}),D(Ie),D(Ae),B(()=>Me=Q(je,1,`list`,null,Me,{picking:U(b)})),J(e,Ee),A()}G([`click`]);var Ec=document.getElementById(`app`);if(!Ec)throw Error(`#app element not found in index.html`);Dr(Tc,{target:Ec});
@@ -0,0 +1 @@
1
+ :root{--bg:#fff;--surface:#f6f6f8;--surface-sunken:#eeeef2;--surface-selected:#e6e7ff;--border:#d0d0d8;--shadow:#00000026;--text:#213547;--text-strong:#000;--text-muted:#555;--text-faint:#666;--text-dim:#888;--accent:#535bf2;--success:#2e7d32;--warning:#b26a00;--danger:#d32f2f;--danger-fill:#d32f2f;--danger-button:#e53935;--danger-button-hover:#c62828;--on-danger:white;--surface-current:#e3f4e4;--surface-compared:#fde8e8;--diff-added-bg:#e3f4e4;--diff-removed-bg:#fbe4e4;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;color:var(--text);background-color:var(--bg);font-synthesis:none;text-rendering:optimizelegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%;font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;font-weight:400;line-height:1.5}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--bg:#242424;--surface:#2a2a2a;--surface-sunken:#1a1a1a;--surface-selected:#30304a;--border:#444;--shadow:#00000080;--text:#ffffffde;--text-strong:#fff;--text-muted:#aaa;--text-faint:#888;--text-dim:#666;--accent:#646cff;--success:#4caf50;--warning:#ff9800;--danger:#f44336;--danger-fill:#c62828;--danger-button:#f44;--danger-button-hover:#f66;--on-danger:white;--surface-current:#2c4a2e;--surface-compared:#4a2c2c;--diff-added-bg:#4caf502e;--diff-removed-bg:#f443362e;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}}:root[data-theme=dark]{--bg:#242424;--surface:#2a2a2a;--surface-sunken:#1a1a1a;--surface-selected:#30304a;--border:#444;--shadow:#00000080;--text:#ffffffde;--text-strong:#fff;--text-muted:#aaa;--text-faint:#888;--text-dim:#666;--accent:#646cff;--success:#4caf50;--warning:#ff9800;--danger:#f44336;--danger-fill:#c62828;--danger-button:#f44;--danger-button-hover:#f66;--on-danger:white;--surface-current:#2c4a2e;--surface-compared:#4a2c2c;--diff-added-bg:#4caf502e;--diff-removed-bg:#f443362e;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}*{box-sizing:border-box}body{min-width:320px;margin:0}#app{text-align:left;flex-direction:column;height:100vh;padding:0 1.5rem;display:flex}.header{border-bottom:1px solid var(--border);justify-content:space-between;align-items:center;padding:1rem 0;display:flex}.header h1{color:var(--accent);margin:0;font-size:2rem}.title{align-items:center;gap:.75rem;display:flex}.title .logo{margin-right:-.25rem;display:block}.status-icon{color:var(--danger);display:inline-flex}.status-icon.connected{color:var(--accent)}.wave{animation:1.5s ease-in-out infinite listen}.wave-mid{animation-delay:.25s}.wave-near{animation-delay:.5s}@keyframes listen{0%,to{opacity:.15}30%{opacity:1}}@media (prefers-reduced-motion:reduce){.wave{animation:none}}.visually-hidden{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.controls{align-items:center;gap:1rem;display:flex}.search{border:1px solid var(--border);background:var(--surface);color:var(--text-strong);border-radius:4px;padding:.5rem 1rem;font-size:.9rem}.search:focus{border-color:var(--accent);outline:none}.clear-btn{background:var(--danger-button);color:var(--on-danger);cursor:pointer;border:none;border-radius:4px;padding:.5rem 1rem;font-size:.9rem}.clear-btn:hover{background:var(--danger-button-hover)}.header-btn{border:1px solid var(--accent);color:var(--text-strong);font:inherit;cursor:pointer;background:0 0;border-radius:4px;padding:.5rem 1rem;font-size:.9rem}.header-btn:hover,.header-btn[aria-expanded=true]{background:var(--surface-selected)}.icon-btn{color:var(--accent);cursor:pointer;background:0 0;border:none;border-radius:4px;padding:.25rem;display:inline-flex}.icon-btn:hover,.icon-btn[aria-expanded=true]{background:var(--surface-selected)}.setting{border:none;margin:0;padding:0}.setting legend{color:var(--text-muted);margin-bottom:.35rem;padding:0;font-size:.85rem}.setting-options{gap:1rem;display:flex}.setting-options label{cursor:pointer;align-items:center;gap:.35rem;display:inline-flex}.setting-options input{accent-color:var(--accent);margin:0}.setting-version{color:var(--text-muted);margin:.75rem 0 0;font-size:.85rem}.popover-wrapper{position:relative}.popover{z-index:10;border:1px solid var(--accent);background:var(--surface);width:max-content;max-width:min(100vw - 2rem,44rem);max-height:calc(100vh - 6rem);box-shadow:0 8px 24px var(--shadow);border-radius:8px;padding:.75rem 1rem;position:absolute;top:calc(100% + .5rem);right:0;overflow-y:auto}.popover-center{left:50%;right:auto;transform:translate(-50%)}.help{max-width:34rem;font-size:.9rem}.help h2{color:var(--accent);margin:0 0 .35rem;font-size:.95rem}.help h2+*{margin-top:0}.help ol,.help ul{margin-bottom:1rem;padding-left:1.25rem}.help li+li{margin-top:.35rem}.help code{overflow-wrap:anywhere;font-family:Courier New,monospace;font-size:.85rem}.help-code{background:var(--surface-sunken);border-radius:4px;margin:.25rem 0;padding:.25rem .5rem;display:block}.help-more{color:var(--text-muted);margin:0}.help a{color:var(--accent)}.popover:focus{outline:none}.popover-hint,.popover-error{color:var(--text-muted);margin:0 0 .5rem;font-size:.85rem}.popover-error{color:var(--danger);margin:0}.upstream-list{grid-template-columns:auto auto auto;align-items:center;gap:.35rem .75rem;margin:0;padding:0;list-style:none;display:grid}.upstream{display:contents}.upstream-name{color:var(--accent);font-weight:700}.upstream-url{overflow-wrap:anywhere;font-family:Courier New,monospace;font-size:.85rem}.upstream-target{color:var(--text-faint);overflow-wrap:anywhere;grid-column:2/-1;margin-top:-.3rem;font-size:.75rem}.panes{flex:1;grid-template-columns:minmax(260px,340px) minmax(0,1fr);gap:1.5rem;min-height:0;display:grid}.list,.detail{padding:1rem 0;overflow-y:auto}.list{flex-direction:column;gap:.5rem;padding-right:.25rem;display:flex}.row{border:1px solid var(--border);background:var(--surface);width:100%;color:inherit;font:inherit;text-align:left;cursor:pointer;border-radius:8px;flex-direction:column;gap:.15rem;padding:.6rem .75rem;transition:border-color .2s;display:flex}.row:hover{border-color:var(--accent)}.row-wrap{position:relative}.row-wrap .row{padding-left:2rem}.row-delete{z-index:1;color:var(--text-faint);cursor:pointer;opacity:0;background:0 0;border:none;border-radius:4px;padding:.2rem;display:flex;position:absolute;top:50%;left:.35rem;transform:translateY(-50%)}.row-wrap:hover .row-delete,.row-wrap:focus-within .row-delete{opacity:1}.row-delete:hover{color:var(--danger)}.row-delete:focus-visible{opacity:1;outline:2px solid var(--accent)}.row.selected{border-color:var(--accent);background:var(--surface-selected)}.row.current{border-color:var(--success);background:var(--surface-current)}.row.compared{border-color:var(--danger);background:var(--surface-compared)}.day{flex-direction:column;gap:.5rem;display:flex}.day-header{z-index:2;border:none;border-bottom:1px solid var(--border);background:var(--bg);width:100%;color:var(--text-muted);font:inherit;text-align:left;cursor:pointer;align-items:center;gap:.4rem;padding:.3rem .25rem;font-size:.85rem;display:flex;position:sticky;top:0}.day-header:hover{color:var(--text-strong)}.day-header:focus-visible{outline:2px solid var(--accent)}.day-chevron{flex:none;transition:transform .15s}.day-chevron.open{transform:rotate(90deg)}.day-label{font-weight:600}.day-count{color:var(--text-faint);margin-left:auto}.recent-chips{flex-wrap:wrap;gap:.25rem;padding:0 .25rem;display:flex}.chip{border:1px solid var(--border);color:var(--text-muted);font:inherit;cursor:pointer;background:0 0;border-radius:999px;padding:.05rem .45rem;font-size:.75rem}.chip:hover{border-color:var(--accent);color:var(--text-strong)}.chip:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.chip[aria-pressed=true]{border-color:var(--accent);background:var(--accent);color:var(--bg)}.failed-bar{padding:.25rem .25rem 0;display:flex}.failed-chip{border-color:var(--danger);color:var(--danger)}.failed-chip:hover{border-color:var(--danger);color:var(--danger);background:var(--surface-compared)}.failed-chip[aria-pressed=true],.failed-chip[aria-pressed=true]:hover{border-color:var(--danger-fill);background:var(--danger-fill);color:var(--on-danger)}.recent-empty{color:var(--text-faint);margin:0;padding:0 .25rem;font-size:.85rem}.list.picking .row{cursor:crosshair}.pick-hint{border:1px solid var(--accent);border-radius:8px;justify-content:space-between;align-items:center;gap:.5rem;margin:0;padding:.4rem .75rem;font-size:.85rem;display:flex}.row:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.row-line{align-items:baseline;gap:.75rem;min-width:0;font-size:.85rem;display:flex}.row-time{color:var(--text-faint)}.row-provider{color:var(--accent);font-weight:700}.row-model{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.row-tokens{color:var(--text-muted)}.status-success{color:var(--success)}.status-error{color:var(--danger)}.latency{color:var(--warning)}.status-running{color:var(--accent)}.status-quiet{color:var(--text-muted);font-style:italic}.row-running{color:var(--warning);flex:none;align-self:center;margin-left:auto}.row-running.flashing{animation:1s step-end infinite flash}@keyframes flash{50%{opacity:0}}@media (prefers-reduced-motion:reduce){.row-running.flashing{animation:none}}.raw-target{word-break:break-all;margin:0 0 1rem;font-family:Courier New,monospace}.section{margin-bottom:1rem}.section>summary{color:var(--text-muted);cursor:pointer;margin-bottom:.5rem;font-weight:700}.section>summary:hover{color:var(--text-strong)}.json-viewer{background:var(--surface-sunken);border:1px solid var(--border);white-space:pre-wrap;word-break:break-all;border-radius:4px;margin:0;padding:1rem;font-family:Courier New,monospace;font-size:.8rem}.tabs{border-bottom:1px solid var(--border);gap:.25rem;margin-bottom:1rem;display:flex}.tab{color:var(--text-muted);font:inherit;cursor:pointer;background:0 0;border:none;border-bottom:2px solid #0000;padding:.4rem 1rem}.tab:hover{color:var(--text-strong)}.tab.active{border-bottom-color:var(--accent);color:var(--text-strong)}.project-tabs{scrollbar-width:thin;margin:0;padding-top:.5rem;overflow-x:auto}.project-tabs .tab{white-space:nowrap}.stats-cards{grid-template-columns:repeat(auto-fit,minmax(10rem,1fr));gap:.75rem;padding-top:.75rem;display:grid}.stats-card{border:1px solid var(--border);background:var(--surface);border-radius:6px;flex-direction:column;gap:.15rem;padding:.5rem .75rem;display:flex}.stats-label{color:var(--text-muted);font-size:.75rem}.stats-value{color:var(--text-strong);font-variant-numeric:tabular-nums;font-size:1.1rem;font-weight:600}.stats-detail{color:var(--text-faint);font-variant-numeric:tabular-nums;font-size:.8rem}.stats-card.alert{border-color:var(--danger)}.stats-card.alert .stats-value{color:var(--danger)}.tab-badge{background:var(--accent);min-width:1.2em;color:var(--bg);text-align:center;border-radius:999px;margin-left:.35rem;padding:0 .35em;font-size:.75em;line-height:1.5;display:inline-block}.match-badge{border:1px solid var(--accent);color:var(--accent);background:0 0}.project-tabs .tab.no-match{opacity:.5}.found-in{flex-wrap:wrap;justify-content:center;gap:.4rem;margin-top:.5rem;font-style:normal;display:flex}.small-btn{border:1px solid var(--border);background:var(--surface);color:inherit;font:inherit;cursor:pointer;border-radius:4px;padding:.2rem .6rem;font-size:.8rem}.small-btn:hover{border-color:var(--accent)}.copyable{position:relative}.copy-btn{opacity:0;position:absolute;top:.25rem;right:.25rem}.copyable:hover>.copy-btn,.copy-btn:focus-visible,.copy-btn.shown{opacity:1}@media (hover:none){.copy-btn{opacity:1}}.notice{border:1px solid var(--warning);color:var(--warning);border-radius:4px;padding:.5rem .75rem}.error-notice{border-color:var(--danger);color:var(--danger);flex-direction:column;gap:.25rem;margin:1rem 0 0;display:flex}.error-hint{color:var(--text-muted)}.conv-meta,.conv-footer,.conv-actions{color:var(--text-muted);flex-wrap:wrap;align-items:center;gap:.75rem;margin:0 0 1rem;font-size:.85rem;display:flex}.conv-footer{border-top:1px solid var(--border);margin-top:1rem;padding-top:.5rem}.tool-list{margin:0;padding-left:1.25rem;font-size:.85rem}.tool-description{color:var(--text-muted);margin-left:.5rem}.part-thinking>summary{color:var(--text-muted);cursor:pointer;font-style:italic}.message{border-left:3px solid var(--text-faint);background:var(--surface);border-radius:4px;margin-bottom:.75rem;padding:.5rem .75rem}.message.role-user{border-left-color:var(--accent)}.message.role-assistant{border-left-color:var(--success)}.message.role-tool{border-left-color:var(--warning)}.message>summary{cursor:pointer}.message[open]>summary{margin-bottom:.5rem}.role{text-transform:uppercase;color:var(--text-muted);font-size:.75rem;font-weight:700}.preview{color:var(--text-faint);margin-left:.75rem}.reply-heading{color:var(--success);margin:1.5rem 0 .5rem;font-size:1rem}.part-text{white-space:pre-wrap;overflow-wrap:anywhere}.message>*+:not(summary){margin-top:.5rem}.part-thinking .part-text{color:var(--text-muted)}.part-tool{border:1px solid var(--border);border-radius:4px;padding:.5rem}.part-tool.part-error{border-color:var(--danger)}.part-label{color:var(--text-muted);margin-bottom:.25rem;font-size:.85rem}.part-id{color:var(--text-dim);margin-left:.5rem;font-size:.75rem}.part-result{font-family:Courier New,monospace;font-size:.8rem}.compare-head{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:.75rem;margin-bottom:1rem;display:flex}.compare-calls{grid-template-columns:auto 1fr;gap:.15rem .75rem;font-size:.85rem;display:grid}.compare-role{color:var(--text-muted);border-left:3px solid;padding-left:.4rem}.compare-this{border-left-color:var(--success)}.compare-other{border-left-color:var(--danger)}.compare-call{flex-wrap:wrap;gap:.75rem;display:flex}.compare-summary{grid-template-columns:max-content 1fr;gap:.35rem 1rem;margin:0 0 1rem;font-size:.9rem;display:grid}.compare-summary dt{color:var(--text-muted)}.compare-summary dd{overflow-wrap:anywhere;margin:0}.compare-old{color:var(--danger)}.compare-new{color:var(--success)}.compare-note{color:var(--text-muted);font-size:.85rem}.compare-usage{border-collapse:collapse;margin-bottom:1rem;font-size:.85rem}.compare-usage th,.compare-usage td{text-align:right;padding:.15rem 1rem .15rem 0}.compare-usage th:first-child{text-align:left;color:var(--text-muted);font-weight:400}.compare-usage thead th{color:var(--text-muted);font-weight:400}.diff{border:1px solid var(--border);background:var(--surface-sunken);border-radius:4px;padding:.5rem 0;font-family:Courier New,monospace;font-size:.8rem}.diff-line{white-space:pre-wrap;overflow-wrap:anywhere;padding:0 .75rem}.diff-sign{width:1.25rem;color:var(--text-dim);-webkit-user-select:none;user-select:none;display:inline-block}.diff-added{background:var(--diff-added-bg)}.diff-removed{background:var(--diff-removed-bg)}.diff-fold{width:100%;color:var(--text-muted);font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;padding:.1rem .75rem;display:block}.diff-fold:hover{color:var(--text-strong);background:var(--surface)}.no-requests{text-align:center;color:var(--text-faint);overflow-wrap:anywhere;margin:2rem 0;font-style:italic}
@@ -2,7 +2,7 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
- <link rel="icon" href="/favicon.ico" />
5
+ <link rel="icon" type="image/svg+xml" href="/logo.svg" />
6
6
  <meta name="viewport" content="width=device-width" />
7
7
  <title>LLMSpy - LLM API Traffic Inspector</title>
8
8
  <script>
@@ -12,8 +12,8 @@
12
12
  if (theme === 'light' || theme === 'dark') document.documentElement.dataset.theme = theme;
13
13
  } catch {}
14
14
  </script>
15
- <script type="module" crossorigin src="/assets/index-B9XIilZJ.js"></script>
16
- <link rel="stylesheet" crossorigin href="/assets/index-moM-ONoJ.css">
15
+ <script type="module" crossorigin src="/assets/index-D-QlAWB3.js"></script>
16
+ <link rel="stylesheet" crossorigin href="/assets/index-kkB61WQl.css">
17
17
  </head>
18
18
  <body>
19
19
  <div id="app"></div>
@@ -0,0 +1,7 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64" fill="none">
2
+ <title>LLMSpy</title>
3
+ <rect x="6" y="6" width="52" height="52" rx="14" fill="#2D333B" />
4
+ <path d="M16 21h22v4H16v-4Zm0 9h16v4H16v-4Zm0 9h10v4H16v-4Z" fill="#646CFF" />
5
+ <circle cx="41" cy="40" r="8" stroke="#22B8CF" stroke-width="4" />
6
+ <path d="m47 46 5 5" stroke="#22B8CF" stroke-width="4" stroke-linecap="round" />
7
+ </svg>
@@ -1 +0,0 @@
1
- :root{--bg:#fff;--surface:#f6f6f8;--surface-sunken:#eeeef2;--surface-selected:#e6e7ff;--border:#d0d0d8;--shadow:#00000026;--text:#213547;--text-strong:#000;--text-muted:#555;--text-faint:#666;--text-dim:#888;--accent:#535bf2;--success:#2e7d32;--warning:#b26a00;--danger:#d32f2f;--danger-fill:#d32f2f;--danger-button:#e53935;--danger-button-hover:#c62828;--on-danger:white;--surface-current:#e3f4e4;--surface-compared:#fde8e8;--diff-added-bg:#e3f4e4;--diff-removed-bg:#fbe4e4;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;color:var(--text);background-color:var(--bg);font-synthesis:none;text-rendering:optimizelegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%;font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;font-weight:400;line-height:1.5}@media (prefers-color-scheme:dark){:root:not([data-theme=light]){--bg:#242424;--surface:#2a2a2a;--surface-sunken:#1a1a1a;--surface-selected:#30304a;--border:#444;--shadow:#00000080;--text:#ffffffde;--text-strong:#fff;--text-muted:#aaa;--text-faint:#888;--text-dim:#666;--accent:#646cff;--success:#4caf50;--warning:#ff9800;--danger:#f44336;--danger-fill:#c62828;--danger-button:#f44;--danger-button-hover:#f66;--on-danger:white;--surface-current:#2c4a2e;--surface-compared:#4a2c2c;--diff-added-bg:#4caf502e;--diff-removed-bg:#f443362e;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}}:root[data-theme=dark]{--bg:#242424;--surface:#2a2a2a;--surface-sunken:#1a1a1a;--surface-selected:#30304a;--border:#444;--shadow:#00000080;--text:#ffffffde;--text-strong:#fff;--text-muted:#aaa;--text-faint:#888;--text-dim:#666;--accent:#646cff;--success:#4caf50;--warning:#ff9800;--danger:#f44336;--danger-fill:#c62828;--danger-button:#f44;--danger-button-hover:#f66;--on-danger:white;--surface-current:#2c4a2e;--surface-compared:#4a2c2c;--diff-added-bg:#4caf502e;--diff-removed-bg:#f443362e;--lightningcss-light: ;--lightningcss-dark:initial;color-scheme:dark}*{box-sizing:border-box}body{min-width:320px;margin:0}#app{text-align:left;flex-direction:column;height:100vh;padding:0 1.5rem;display:flex}.header{border-bottom:1px solid var(--border);justify-content:space-between;align-items:center;padding:1rem 0;display:flex}.header h1{color:var(--accent);margin:0;font-size:2rem}.title{align-items:center;gap:.75rem;display:flex}.status-icon{color:var(--danger);display:inline-flex}.status-icon.connected{color:var(--accent)}.wave{animation:1.5s ease-in-out infinite listen}.wave-mid{animation-delay:.25s}.wave-near{animation-delay:.5s}@keyframes listen{0%,to{opacity:.15}30%{opacity:1}}@media (prefers-reduced-motion:reduce){.wave{animation:none}}.visually-hidden{clip-path:inset(50%);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}.controls{align-items:center;gap:1rem;display:flex}.search{border:1px solid var(--border);background:var(--surface);color:var(--text-strong);border-radius:4px;padding:.5rem 1rem;font-size:.9rem}.search:focus{border-color:var(--accent);outline:none}.clear-btn{background:var(--danger-button);color:var(--on-danger);cursor:pointer;border:none;border-radius:4px;padding:.5rem 1rem;font-size:.9rem}.clear-btn:hover{background:var(--danger-button-hover)}.header-btn{border:1px solid var(--accent);color:var(--text-strong);font:inherit;cursor:pointer;background:0 0;border-radius:4px;padding:.5rem 1rem;font-size:.9rem}.header-btn:hover,.header-btn[aria-expanded=true]{background:var(--surface-selected)}.icon-btn{color:var(--accent);cursor:pointer;background:0 0;border:none;border-radius:4px;padding:.25rem;display:inline-flex}.icon-btn:hover,.icon-btn[aria-expanded=true]{background:var(--surface-selected)}.setting{border:none;margin:0;padding:0}.setting legend{color:var(--text-muted);margin-bottom:.35rem;padding:0;font-size:.85rem}.setting-options{gap:1rem;display:flex}.setting-options label{cursor:pointer;align-items:center;gap:.35rem;display:inline-flex}.setting-options input{accent-color:var(--accent);margin:0}.setting-version{color:var(--text-muted);margin:.75rem 0 0;font-size:.85rem}.popover-wrapper{position:relative}.popover{z-index:10;border:1px solid var(--accent);background:var(--surface);width:max-content;max-width:min(100vw - 2rem,44rem);max-height:calc(100vh - 6rem);box-shadow:0 8px 24px var(--shadow);border-radius:8px;padding:.75rem 1rem;position:absolute;top:calc(100% + .5rem);right:0;overflow-y:auto}.popover-center{left:50%;right:auto;transform:translate(-50%)}.help{max-width:34rem;font-size:.9rem}.help h2{color:var(--accent);margin:0 0 .35rem;font-size:.95rem}.help h2+*{margin-top:0}.help ol,.help ul{margin-bottom:1rem;padding-left:1.25rem}.help li+li{margin-top:.35rem}.help code{overflow-wrap:anywhere;font-family:Courier New,monospace;font-size:.85rem}.help-code{background:var(--surface-sunken);border-radius:4px;margin:.25rem 0;padding:.25rem .5rem;display:block}.help-more{color:var(--text-muted);margin:0}.help a{color:var(--accent)}.popover:focus{outline:none}.popover-hint,.popover-error{color:var(--text-muted);margin:0 0 .5rem;font-size:.85rem}.popover-error{color:var(--danger);margin:0}.upstream-list{grid-template-columns:auto auto auto;align-items:center;gap:.35rem .75rem;margin:0;padding:0;list-style:none;display:grid}.upstream{display:contents}.upstream-name{color:var(--accent);font-weight:700}.upstream-url{overflow-wrap:anywhere;font-family:Courier New,monospace;font-size:.85rem}.upstream-target{color:var(--text-faint);overflow-wrap:anywhere;grid-column:2/-1;margin-top:-.3rem;font-size:.75rem}.panes{flex:1;grid-template-columns:minmax(260px,340px) minmax(0,1fr);gap:1.5rem;min-height:0;display:grid}.list,.detail{padding:1rem 0;overflow-y:auto}.list{flex-direction:column;gap:.5rem;padding-right:.25rem;display:flex}.row{border:1px solid var(--border);background:var(--surface);width:100%;color:inherit;font:inherit;text-align:left;cursor:pointer;border-radius:8px;flex-direction:column;gap:.15rem;padding:.6rem .75rem;transition:border-color .2s;display:flex}.row:hover{border-color:var(--accent)}.row-wrap{position:relative}.row-wrap .row{padding-left:2rem}.row-delete{z-index:1;color:var(--text-faint);cursor:pointer;opacity:0;background:0 0;border:none;border-radius:4px;padding:.2rem;display:flex;position:absolute;top:50%;left:.35rem;transform:translateY(-50%)}.row-wrap:hover .row-delete,.row-wrap:focus-within .row-delete{opacity:1}.row-delete:hover{color:var(--danger)}.row-delete:focus-visible{opacity:1;outline:2px solid var(--accent)}.row.selected{border-color:var(--accent);background:var(--surface-selected)}.row.current{border-color:var(--success);background:var(--surface-current)}.row.compared{border-color:var(--danger);background:var(--surface-compared)}.day{flex-direction:column;gap:.5rem;display:flex}.day-header{z-index:2;border:none;border-bottom:1px solid var(--border);background:var(--bg);width:100%;color:var(--text-muted);font:inherit;text-align:left;cursor:pointer;align-items:center;gap:.4rem;padding:.3rem .25rem;font-size:.85rem;display:flex;position:sticky;top:0}.day-header:hover{color:var(--text-strong)}.day-header:focus-visible{outline:2px solid var(--accent)}.day-chevron{flex:none;transition:transform .15s}.day-chevron.open{transform:rotate(90deg)}.day-label{font-weight:600}.day-count{color:var(--text-faint);margin-left:auto}.recent-chips{flex-wrap:wrap;gap:.25rem;padding:0 .25rem;display:flex}.chip{border:1px solid var(--border);color:var(--text-muted);font:inherit;cursor:pointer;background:0 0;border-radius:999px;padding:.05rem .45rem;font-size:.75rem}.chip:hover{border-color:var(--accent);color:var(--text-strong)}.chip:focus-visible{outline:2px solid var(--accent);outline-offset:1px}.chip[aria-pressed=true]{border-color:var(--accent);background:var(--accent);color:var(--bg)}.failed-bar{padding:.25rem .25rem 0;display:flex}.failed-chip{border-color:var(--danger);color:var(--danger)}.failed-chip:hover{border-color:var(--danger);color:var(--danger);background:var(--surface-compared)}.failed-chip[aria-pressed=true],.failed-chip[aria-pressed=true]:hover{border-color:var(--danger-fill);background:var(--danger-fill);color:var(--on-danger)}.recent-empty{color:var(--text-faint);margin:0;padding:0 .25rem;font-size:.85rem}.list.picking .row{cursor:crosshair}.pick-hint{border:1px solid var(--accent);border-radius:8px;justify-content:space-between;align-items:center;gap:.5rem;margin:0;padding:.4rem .75rem;font-size:.85rem;display:flex}.row:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.row-line{align-items:baseline;gap:.75rem;min-width:0;font-size:.85rem;display:flex}.row-time{color:var(--text-faint)}.row-provider{color:var(--accent);font-weight:700}.row-model{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.row-tokens{color:var(--text-muted)}.status-success{color:var(--success)}.status-error{color:var(--danger)}.latency{color:var(--warning)}.status-running{color:var(--accent)}.status-quiet{color:var(--text-muted);font-style:italic}.row-running{color:var(--warning);flex:none;align-self:center;margin-left:auto}.row-running.flashing{animation:1s step-end infinite flash}@keyframes flash{50%{opacity:0}}@media (prefers-reduced-motion:reduce){.row-running.flashing{animation:none}}.raw-target{word-break:break-all;margin:0 0 1rem;font-family:Courier New,monospace}.section{margin-bottom:1rem}.section>summary{color:var(--text-muted);cursor:pointer;margin-bottom:.5rem;font-weight:700}.section>summary:hover{color:var(--text-strong)}.json-viewer{background:var(--surface-sunken);border:1px solid var(--border);white-space:pre-wrap;word-break:break-all;border-radius:4px;margin:0;padding:1rem;font-family:Courier New,monospace;font-size:.8rem}.tabs{border-bottom:1px solid var(--border);gap:.25rem;margin-bottom:1rem;display:flex}.tab{color:var(--text-muted);font:inherit;cursor:pointer;background:0 0;border:none;border-bottom:2px solid #0000;padding:.4rem 1rem}.tab:hover{color:var(--text-strong)}.tab.active{border-bottom-color:var(--accent);color:var(--text-strong)}.project-tabs{scrollbar-width:thin;margin:0;padding-top:.5rem;overflow-x:auto}.project-tabs .tab{white-space:nowrap}.stats-cards{grid-template-columns:repeat(auto-fit,minmax(10rem,1fr));gap:.75rem;padding-top:.75rem;display:grid}.stats-card{border:1px solid var(--border);background:var(--surface);border-radius:6px;flex-direction:column;gap:.15rem;padding:.5rem .75rem;display:flex}.stats-label{color:var(--text-muted);font-size:.75rem}.stats-value{color:var(--text-strong);font-variant-numeric:tabular-nums;font-size:1.1rem;font-weight:600}.stats-detail{color:var(--text-faint);font-variant-numeric:tabular-nums;font-size:.8rem}.stats-card.alert{border-color:var(--danger)}.stats-card.alert .stats-value{color:var(--danger)}.tab-badge{background:var(--accent);min-width:1.2em;color:var(--bg);text-align:center;border-radius:999px;margin-left:.35rem;padding:0 .35em;font-size:.75em;line-height:1.5;display:inline-block}.match-badge{border:1px solid var(--accent);color:var(--accent);background:0 0}.project-tabs .tab.no-match{opacity:.5}.found-in{flex-wrap:wrap;justify-content:center;gap:.4rem;margin-top:.5rem;font-style:normal;display:flex}.small-btn{border:1px solid var(--border);background:var(--surface);color:inherit;font:inherit;cursor:pointer;border-radius:4px;padding:.2rem .6rem;font-size:.8rem}.small-btn:hover{border-color:var(--accent)}.copyable{position:relative}.copy-btn{opacity:0;position:absolute;top:.25rem;right:.25rem}.copyable:hover>.copy-btn,.copy-btn:focus-visible,.copy-btn.shown{opacity:1}@media (hover:none){.copy-btn{opacity:1}}.notice{border:1px solid var(--warning);color:var(--warning);border-radius:4px;padding:.5rem .75rem}.error-notice{border-color:var(--danger);color:var(--danger);flex-direction:column;gap:.25rem;margin:1rem 0 0;display:flex}.error-hint{color:var(--text-muted)}.conv-meta,.conv-footer,.conv-actions{color:var(--text-muted);flex-wrap:wrap;align-items:center;gap:.75rem;margin:0 0 1rem;font-size:.85rem;display:flex}.conv-footer{border-top:1px solid var(--border);margin-top:1rem;padding-top:.5rem}.tool-list{margin:0;padding-left:1.25rem;font-size:.85rem}.tool-description{color:var(--text-muted);margin-left:.5rem}.part-thinking>summary{color:var(--text-muted);cursor:pointer;font-style:italic}.message{border-left:3px solid var(--text-faint);background:var(--surface);border-radius:4px;margin-bottom:.75rem;padding:.5rem .75rem}.message.role-user{border-left-color:var(--accent)}.message.role-assistant{border-left-color:var(--success)}.message.role-tool{border-left-color:var(--warning)}.message>summary{cursor:pointer}.message[open]>summary{margin-bottom:.5rem}.role{text-transform:uppercase;color:var(--text-muted);font-size:.75rem;font-weight:700}.preview{color:var(--text-faint);margin-left:.75rem}.reply-heading{color:var(--success);margin:1.5rem 0 .5rem;font-size:1rem}.part-text{white-space:pre-wrap;overflow-wrap:anywhere}.message>*+:not(summary){margin-top:.5rem}.part-thinking .part-text{color:var(--text-muted)}.part-tool{border:1px solid var(--border);border-radius:4px;padding:.5rem}.part-tool.part-error{border-color:var(--danger)}.part-label{color:var(--text-muted);margin-bottom:.25rem;font-size:.85rem}.part-id{color:var(--text-dim);margin-left:.5rem;font-size:.75rem}.part-result{font-family:Courier New,monospace;font-size:.8rem}.compare-head{flex-wrap:wrap;justify-content:space-between;align-items:flex-start;gap:.75rem;margin-bottom:1rem;display:flex}.compare-calls{grid-template-columns:auto 1fr;gap:.15rem .75rem;font-size:.85rem;display:grid}.compare-role{color:var(--text-muted);border-left:3px solid;padding-left:.4rem}.compare-this{border-left-color:var(--success)}.compare-other{border-left-color:var(--danger)}.compare-call{flex-wrap:wrap;gap:.75rem;display:flex}.compare-summary{grid-template-columns:max-content 1fr;gap:.35rem 1rem;margin:0 0 1rem;font-size:.9rem;display:grid}.compare-summary dt{color:var(--text-muted)}.compare-summary dd{overflow-wrap:anywhere;margin:0}.compare-old{color:var(--danger)}.compare-new{color:var(--success)}.compare-note{color:var(--text-muted);font-size:.85rem}.compare-usage{border-collapse:collapse;margin-bottom:1rem;font-size:.85rem}.compare-usage th,.compare-usage td{text-align:right;padding:.15rem 1rem .15rem 0}.compare-usage th:first-child{text-align:left;color:var(--text-muted);font-weight:400}.compare-usage thead th{color:var(--text-muted);font-weight:400}.diff{border:1px solid var(--border);background:var(--surface-sunken);border-radius:4px;padding:.5rem 0;font-family:Courier New,monospace;font-size:.8rem}.diff-line{white-space:pre-wrap;overflow-wrap:anywhere;padding:0 .75rem}.diff-sign{width:1.25rem;color:var(--text-dim);-webkit-user-select:none;user-select:none;display:inline-block}.diff-added{background:var(--diff-added-bg)}.diff-removed{background:var(--diff-removed-bg)}.diff-fold{width:100%;color:var(--text-muted);font:inherit;text-align:left;cursor:pointer;background:0 0;border:none;padding:.1rem .75rem;display:block}.diff-fold:hover{color:var(--text-strong);background:var(--surface)}.no-requests{text-align:center;color:var(--text-faint);overflow-wrap:anywhere;margin:2rem 0;font-style:italic}