Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

feat: agent-beacon browser collector (V0) + self-verifying test harness

shukieshah3b3859a91a4f
diff --git a/browser-extension/.gitignore b/browser-extension/.gitignore
new file mode 100644
index 00000000..fb5ae353
--- /dev/null
+++ b/browser-extension/.gitignore
@@ -0,0 +1,16 @@
+node_modules/
+dist/
+test-results/
+playwright-report/
+blob-report/
+.playwright/
+# Persistent authed browser profiles used for live smoke / fixture recording.
+# Contains real session cookies — must never be committed.
+.auth-profiles/
+# Raw fixture-recorder output may contain personal chat/account data. Only
+# hand-sanitized *.sse fixtures are committed.
+fixtures/**/*.page.html
+fixtures/**/*.meta.json
+fixtures/**/real-*.sse
+*.log
+.DS_Store
diff --git a/browser-extension/README.md b/browser-extension/README.md
index e5e5ac4e..52e77b25 100644
--- a/browser-extension/README.md
+++ b/browser-extension/README.md
@@ -1,2 +1,117 @@
# agent-beacon-browser-extension
-Chrome extension to relay AI telemetry from the browser (i.e. ChatGPT, Claude) to Agent Beacon
+
+Chrome (MV3) extension that relays LLM chat telemetry from the browser — Claude.ai and
+ChatGPT — into the **same local Agent Beacon pipeline** as the endpoint agent, normalized into
+the same schema. Browser chat activity (prompts, responses, tool calls) ends up in
+`runtime.jsonl` next to agent activity, and forwards onward via the same Vector shippers.
+
+It ships with a **fully automated, self-verifying build/test loop**: recorded chat streams are
+replayed through the real, loaded extension in headless Chromium and asserted against — no login,
+no API cost, deterministic.
+
+## How it reaches Beacon
+
+The extension never writes files (it can't — extensions are sandboxed). Instead its service
+worker POSTs **OTLP GenAI logs** to the beacon collector already listening on
+`http://127.0.0.1:4318/v1/logs`, which normalizes, redacts, rotates, and forwards them exactly
+like every other source.
+
+```
+claude.ai / chatgpt.com page
+ │ interceptor.js (MAIN world) — tees the streamed SSE via response.clone()
+ ▼
+content.js (ISOLATED world) — relays raw events to the service worker
+ ▼
+service worker — per-site adapter parses SSE → ChatTurn → normalize() → OTLP → batched POST
+ ▼
+http://127.0.0.1:4318/v1/logs → beacon-otelcol → runtime.jsonl → Vector → GCS/S3
+```
+
+## Setup
+
+```bash
+npm install
+npx playwright install chromium # one-time, for the e2e harness
+```
+
+## Commands
+
+```bash
+npm run build # bundle src/ → dist/ (esbuild)
+npm run build:watch # rebuild on change
+npm run typecheck # tsc --noEmit
+npm run test:unit # pure adapter + normalization tests (vitest, no browser)
+npm test # builds dist/, runs the Playwright replay e2e (THE autonomous loop)
+npm run test:headed # watch it drive a browser
+npm run test:integration # opt-in: route through the real beacon-otelcol binary (Phase 4)
+npm run test:live # opt-in: headed smoke vs the real sites in an authed profile (Phase 4)
+npm run report # open the last HTML report
+```
+
+## Loading the extension in your own browser
+
+`npm run build`, then in Chrome → Extensions → Developer mode → **Load unpacked** → select `dist/`.
+Make sure the beacon endpoint agent is running (it provides the `127.0.0.1:4318` collector).
+
+## Layout
+
+| Path | Purpose |
+|---|---|
+| `src/shared/` | Site-agnostic core. `normalize.ts` (pure `ChatTurn → OTLP`), `otlp.ts`, `vocab.ts`, `types.ts`, `ids.ts`. |
+| `src/adapters/` | The only site-specific code. `claude.ts` (done), `chatgpt.ts` (next). `sse.ts` shared SSE framing. |
+| `src/interceptor/` | MAIN-world `fetch`/stream tee. |
+| `src/content/` | ISOLATED-world relay + (future) DOM fallback. |
+| `src/background/` | Service worker: `assembler.ts`, `delivery.ts` (durable queue + backoff), `settings.ts`, `sw.ts`. |
+| `src/popup/`, `src/options/` | On/off, retention toggle, endpoint + per-site config. |
+| `e2e/` | Playwright fixtures + helpers (`mock-collector`, `sse-replay-server`, `otlp-assertions`) + specs. |
+| `test/unit/` | vitest unit tests. |
+| `fixtures/<site>/*.sse` | Recorded chat streams (currently **synthetic**, pending real capture). |
+
+## Testing model (layered by fidelity/cost)
+
+- **(a) unit** — recorded `.sse` → `ChatTurn` → golden OTLP. Milliseconds, no browser.
+- **(b) e2e replay** — a local HTTPS server impersonates the chat site (via `--host-resolver-rules`
+ mapping the real hostname to it + a throwaway self-signed cert), the real extension loads, and a
+ **mock collector** captures what it POSTs. Fully autonomous — **this is the loop run every iteration.**
+- **(c) integration** (opt-in) — route through the real `beacon-otelcol` binary into a temp
+ `runtime.jsonl`; assert the actual `Event` schema. *(Phase 4)*
+- **(d) live smoke** (opt-in, headed) — drive the real sites in a persistent authed profile; a
+ drift alarm that flags when recorded fixtures go stale. *(Phase 4)*
+
+## Status
+
+This is a **V0 MVP**: Claude.ai capture proven end-to-end against the real site and the real
+Beacon collector (prompt → response → tool calls → `runtime.jsonl` → S3 → dashboard).
+
+- ✅ Shared core + normalization (unit-tested)
+- ✅ Claude capture end-to-end + autonomous replay e2e
+- ✅ Resilience: multi-tab correlation + aborted/partial stream (e2e)
+- ✅ Content-script context-invalidation guard (survives extension reloads)
+- ⬜ ChatGPT adapter
+- ⬜ DOM-fallback capture, XHR transport
+- ⬜ Real-collector integration test + live-smoke/fixture-recorder as CI layers
+
+### Known limitations (V0 — intentionally deferred)
+
+- **Service-worker suspension mid-stream.** In-flight turn assembly lives in memory in the SW.
+ Active streaming keeps the SW alive (each chunk is activity), so normal turns are safe; a >30s
+ stall between chunks could drop a turn. The durable delivery queue (in `chrome.storage`) protects
+ everything *after* a turn is assembled, not during. Persisting partial assembler state is a
+ future item.
+- **Delivery retry cadence.** Retries use `chrome.alarms`, which MV3 clamps to a ~30s minimum, so
+ the first retry lands at ~30s rather than the computed sub-second backoff. Fine for a
+ local-loopback collector that is almost always reachable; the queue guarantees eventual delivery.
+- **Capture depends on `window.fetch`.** Confirmed correct for claude.ai. Sites using XHR or a page
+ service worker for streaming would need additional interception (deferred).
+- **Single capture path.** No DOM-scraping fallback yet; if a site changes its SSE wire format, the
+ adapter needs updating (the live-smoke drift alarm is designed to catch this).
+
+> **Fixtures.** `fixtures/claude/simple-turn.sse` is a **real, sanitized** claude.ai capture
+> (via `npm run record:fixtures`); the adapter is verified against it. `with-tool-call.sse` is
+> still synthetic (written to the documented Anthropic tool-use shape) pending a real tool-call
+> capture. Raw recorder output (`*.page.html`, `*.meta.json`, `real-*.sse`) is git-ignored because
+> it can contain personal chat/account data — only hand-sanitized `*.sse` fixtures are committed.
+>
+> Notable real-format findings: claude.ai emits a leading `conversation_ready` event, nests the
+> model in `message_start.message.model`, and does **not** stream token usage (so `gen_ai.usage.*`
+> is absent for `claude_web`).
diff --git a/browser-extension/e2e/claude.replay.spec.ts b/browser-extension/e2e/claude.replay.spec.ts
new file mode 100644
index 00000000..a3cac2d3
--- /dev/null
+++ b/browser-extension/e2e/claude.replay.spec.ts
@@ -0,0 +1,129 @@
+import { test, expect, seedSettings } from './fixtures.js';
+import { flatAttrs, recordByAction, resourceAttrs } from './helpers/otlp-assertions.js';
+
+const CONV = '11111111-2222-3333-4444-555555555555';
+const COMPLETION_PATH = '/api/organizations/org-test/chat_conversations/{conv}/completion';
+
+test.beforeEach(async ({ mockCollector }) => {
+ mockCollector.reset();
+});
+
+test('captures a simple Claude turn end-to-end into normalized OTLP', async ({
+ context,
+ serviceWorker,
+ replay,
+ mockCollector,
+}) => {
+ replay.setCase({
+ site: 'claude',
+ name: 'simple-turn',
+ conversationId: CONV,
+ prompt: 'What is the capital of France?',
+ completionPath: COMPLETION_PATH,
+ });
+ await seedSettings(serviceWorker, {
+ enabled: true,
+ retention: 'full',
+ endpoint: mockCollector.url,
+ sites: { claude_web: true, chatgpt_web: true },
+ });
+
+ const page = await context.newPage();
+ await page.goto('https://claude.ai/chat');
+ // Wait until the page finished consuming the stream.
+ await expect(page.locator('[data-testid="assistant-message"]')).toHaveAttribute(
+ 'data-complete',
+ '1',
+ );
+
+ await expect.poll(() => mockCollector.received.length, { timeout: 10_000 }).toBeGreaterThan(0);
+
+ const res = resourceAttrs(mockCollector.received[0]);
+ expect(res['beacon.harness.name']).toBe('claude_web');
+ expect(res['gen_ai.provider.name']).toBe('anthropic');
+
+ // The prompt lands on its own prompt.submitted record (category "prompt") so
+ // the collector lifts it into the queryable Event.prompt.text field.
+ const promptRec = recordByAction(mockCollector.received, 'prompt.submitted');
+ expect(promptRec, 'a prompt.submitted record should have been delivered').toBeTruthy();
+ const promptAttrs = flatAttrs(promptRec!.attributes);
+ expect(promptAttrs['beacon.event.category']).toBe('prompt');
+ expect(promptAttrs['beacon.prompt.text']).toBe('What is the capital of France?');
+ expect(promptAttrs['beacon.session.id']).toBe(CONV);
+
+ // The response lands on the agent.response.completed record.
+ const rec = recordByAction(mockCollector.received, 'agent.response.completed');
+ expect(rec, 'a completed-response record should have been delivered').toBeTruthy();
+ const attrs = flatAttrs(rec!.attributes);
+ expect(attrs['gen_ai.conversation.id']).toBe(CONV);
+ expect(attrs['gen_ai.response.model']).toBe('claude-opus-4-8');
+ expect(String(attrs['gen_ai.output.messages'])).toContain('Paris');
+});
+
+test('captures a Claude tool call as a tool.invoked record', async ({
+ context,
+ serviceWorker,
+ replay,
+ mockCollector,
+}) => {
+ replay.setCase({
+ site: 'claude',
+ name: 'with-tool-call',
+ conversationId: CONV,
+ prompt: 'What is the weather today?',
+ completionPath: COMPLETION_PATH,
+ });
+ await seedSettings(serviceWorker, {
+ enabled: true,
+ retention: 'full',
+ endpoint: mockCollector.url,
+ sites: { claude_web: true, chatgpt_web: true },
+ });
+
+ const page = await context.newPage();
+ await page.goto('https://claude.ai/chat');
+ await expect(page.locator('[data-testid="assistant-message"]')).toHaveAttribute(
+ 'data-complete',
+ '1',
+ );
+
+ await expect
+ .poll(() => recordByAction(mockCollector.received, 'tool.invoked'), { timeout: 10_000 })
+ .toBeTruthy();
+
+ const tool = flatAttrs(recordByAction(mockCollector.received, 'tool.invoked')!.attributes);
+ expect(tool['tool.name']).toBe('web_search');
+ expect(tool['gen_ai.tool.call.id']).toBe('toolu_abc');
+ expect(String(tool['gen_ai.tool.call.arguments'])).toContain('weather today');
+});
+
+test('respects the disabled toggle (no delivery)', async ({
+ context,
+ serviceWorker,
+ replay,
+ mockCollector,
+}) => {
+ replay.setCase({
+ site: 'claude',
+ name: 'simple-turn',
+ conversationId: CONV,
+ prompt: 'What is the capital of France?',
+ completionPath: COMPLETION_PATH,
+ });
+ await seedSettings(serviceWorker, {
+ enabled: false,
+ retention: 'full',
+ endpoint: mockCollector.url,
+ sites: { claude_web: true, chatgpt_web: true },
+ });
+
+ const page = await context.newPage();
+ await page.goto('https://claude.ai/chat');
+ await expect(page.locator('[data-testid="assistant-message"]')).toHaveAttribute(
+ 'data-complete',
+ '1',
+ );
+ // Give any (erroneous) delivery a chance to arrive, then assert none did.
+ await page.waitForTimeout(1000);
+ expect(mockCollector.received).toHaveLength(0);
+});
diff --git a/browser-extension/e2e/fixtures.ts b/browser-extension/e2e/fixtures.ts
new file mode 100644
index 00000000..d8ae82dd
--- /dev/null
+++ b/browser-extension/e2e/fixtures.ts
@@ -0,0 +1,91 @@
+import { test as base, chromium, type BrowserContext, type Worker } from '@playwright/test';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { startMockCollector, type MockCollector } from './helpers/mock-collector.js';
+import { startReplayServer, type ReplayServer } from './helpers/sse-replay-server.js';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+
+// Load the built extension from dist/ (npm's pretest builds it). Overridable.
+const pathToExtension = process.env.EXTENSION_PATH ?? path.join(__dirname, '..', 'dist');
+const headless = process.env.HEADED !== '1';
+
+interface Fixtures {
+ mockCollector: MockCollector;
+ replay: ReplayServer;
+ context: BrowserContext;
+ serviceWorker: Worker;
+ extensionId: string;
+}
+
+export const test = base.extend<Fixtures>({
+ // Stand-in beacon collector. Fresh per test (received reset in beforeEach via reset()).
+ mockCollector: async ({}, use) => {
+ const c = await startMockCollector();
+ await use(c);
+ await c.close();
+ },
+
+ // HTTPS server impersonating the chat sites; started before the browser so its
+ // port can feed --host-resolver-rules.
+ replay: async ({}, use) => {
+ const r = await startReplayServer();
+ await use(r);
+ await r.close();
+ },
+
+ context: async ({ replay }, use) => {
+ // Map the real chat hostnames (:443) to the local replay server so the
+ // extension's content-script matches fire on the genuine origins.
+ const map = [
+ `MAP claude.ai:443 127.0.0.1:${replay.port}`,
+ `MAP chatgpt.com:443 127.0.0.1:${replay.port}`,
+ `MAP chat.openai.com:443 127.0.0.1:${replay.port}`,
+ ].join(', ');
+
+ const context = await chromium.launchPersistentContext('', {
+ channel: 'chromium',
+ headless,
+ ignoreHTTPSErrors: true,
+ args: [
+ `--disable-extensions-except=${pathToExtension}`,
+ `--load-extension=${pathToExtension}`,
+ `--host-resolver-rules=${map}`,
+ '--ignore-certificate-errors',
+ ],
+ });
+ await use(context);
+ await context.close();
+ },
+
+ serviceWorker: async ({ context }, use) => {
+ let [worker] = context.serviceWorkers();
+ if (!worker) worker = await context.waitForEvent('serviceworker');
+ await use(worker);
+ },
+
+ extensionId: async ({ serviceWorker }, use) => {
+ await use(new URL(serviceWorker.url()).host);
+ },
+});
+
+export const expect = test.expect;
+
+/** Seed the extension's settings through the service worker. Waits for the
+ * SW's onInstalled default-write to land first so it can't clobber our seed. */
+export async function seedSettings(
+ worker: Worker,
+ patch: Record<string, unknown>,
+): Promise<void> {
+ await worker.evaluate(async (p) => {
+ for (let i = 0; i < 100; i++) {
+ const cur = (await chrome.storage.local.get('settings')).settings;
+ if (cur) {
+ await chrome.storage.local.set({ settings: { ...cur, ...p } });
+ return;
+ }
+ await new Promise((r) => setTimeout(r, 20));
+ }
+ await chrome.storage.local.set({ settings: p });
+ }, patch);
+}
diff --git a/browser-extension/e2e/helpers/cert.ts b/browser-extension/e2e/helpers/cert.ts
new file mode 100644
index 00000000..f0a83f0a
--- /dev/null
+++ b/browser-extension/e2e/helpers/cert.ts
@@ -0,0 +1,29 @@
+// Generates a throwaway self-signed cert (via openssl) covering the chat-site
+// hostnames, so the replay server can answer https://claude.ai / https://chatgpt.com
+// after --host-resolver-rules maps those hosts to it. Test-only; never trusted
+// beyond the automation Chromium launched with --ignore-certificate-errors.
+
+import { execFileSync } from 'node:child_process';
+import { mkdtempSync, readFileSync } from 'node:fs';
+import os from 'node:os';
+import path from 'node:path';
+
+let cached: { key: string; cert: string } | undefined;
+
+export function getTestCert(): { key: string; cert: string } {
+ if (cached) return cached;
+ const dir = mkdtempSync(path.join(os.tmpdir(), 'beacon-cert-'));
+ const keyPath = path.join(dir, 'key.pem');
+ const certPath = path.join(dir, 'cert.pem');
+ execFileSync('openssl', [
+ 'req', '-x509', '-newkey', 'rsa:2048', '-nodes',
+ '-keyout', keyPath,
+ '-out', certPath,
+ '-days', '3',
+ '-subj', '/CN=claude.ai',
+ '-addext',
+ 'subjectAltName=DNS:claude.ai,DNS:chatgpt.com,DNS:chat.openai.com,DNS:localhost,IP:127.0.0.1',
+ ]);
+ cached = { key: readFileSync(keyPath, 'utf8'), cert: readFileSync(certPath, 'utf8') };
+ return cached;
+}
diff --git a/browser-extension/e2e/helpers/mock-collector.ts b/browser-extension/e2e/helpers/mock-collector.ts
new file mode 100644
index 00000000..717613c8
--- /dev/null
+++ b/browser-extension/e2e/helpers/mock-collector.ts
@@ -0,0 +1,61 @@
+// A stand-in for the beacon OTLP collector. Listens on an ephemeral loopback
+// port, records every POST to /v1/logs (decoded OTLP JSON), and satisfies CORS
+// preflight so the extension service worker can post to it cross-origin.
+
+import http from 'node:http';
+import type { AddressInfo } from 'node:net';
+import type { LogsEnvelope } from '../../src/shared/otlp.js';
+
+export interface MockCollector {
+ url: string;
+ received: LogsEnvelope[];
+ reset(): void;
+ close(): Promise<void>;
+}
+
+export async function startMockCollector(): Promise<MockCollector> {
+ const received: LogsEnvelope[] = [];
+
+ const server = http.createServer((req, res) => {
+ // CORS preflight from the extension SW (content-type: application/json).
+ if (req.method === 'OPTIONS') {
+ res.writeHead(204, corsHeaders());
+ res.end();
+ return;
+ }
+ if (req.method === 'POST' && req.url === '/v1/logs') {
+ let body = '';
+ req.on('data', (c) => (body += c));
+ req.on('end', () => {
+ try {
+ received.push(JSON.parse(body) as LogsEnvelope);
+ } catch {
+ /* ignore malformed */
+ }
+ res.writeHead(200, { 'content-type': 'application/json', ...corsHeaders() });
+ res.end('{}');
+ });
+ return;
+ }
+ res.writeHead(404, corsHeaders());
+ res.end();
+ });
+
+ await new Promise<void>((resolve) => server.listen(0, '127.0.0.1', resolve));
+ const { port } = server.address() as AddressInfo;
+
+ return {
+ url: `http://127.0.0.1:${port}/v1/logs`,
+ received,
+ reset: () => (received.length = 0),
+ close: () => new Promise<void>((resolve) => server.close(() => resolve())),
+ };
+}
+
+function corsHeaders(): http.OutgoingHttpHeaders {
+ return {
+ 'access-control-allow-origin': '*',
+ 'access-control-allow-methods': 'POST, OPTIONS',
+ 'access-control-allow-headers': 'content-type',
+ };
+}
diff --git a/browser-extension/e2e/helpers/otlp-assertions.ts b/browser-extension/e2e/helpers/otlp-assertions.ts
new file mode 100644
index 00000000..eb6028b4
--- /dev/null
+++ b/browser-extension/e2e/helpers/otlp-assertions.ts
@@ -0,0 +1,27 @@
+// Helpers to read OTLP log envelopes captured by the mock collector.
+
+import type { KeyValue, LogRecord, LogsEnvelope } from '../../src/shared/otlp.js';
+import { attrValue } from '../../src/shared/otlp.js';
+
+export function flatAttrs(attrs: KeyValue[]): Record<string, string | number | boolean> {
+ const out: Record<string, string | number | boolean> = {};
+ for (const a of attrs) {
+ const v = attrValue(attrs, a.key);
+ if (v !== undefined) out[a.key] = v;
+ }
+ return out;
+}
+
+export function resourceAttrs(env: LogsEnvelope): Record<string, string | number | boolean> {
+ return flatAttrs(env.resourceLogs[0]?.resource.attributes ?? []);
+}
+
+/** All log records across all captured envelopes. */
+export function allRecords(envs: LogsEnvelope[]): LogRecord[] {
+ return envs.flatMap((e) => e.resourceLogs.flatMap((rl) => rl.scopeLogs.flatMap((sl) => sl.logRecords)));
+}
+
+/** Find the first record whose beacon.event.action matches. */
+export function recordByAction(envs: LogsEnvelope[], action: string): LogRecord | undefined {
+ return allRecords(envs).find((r) => flatAttrs(r.attributes)['beacon.event.action'] === action);
+}
diff --git a/browser-extension/e2e/helpers/sse-replay-server.ts b/browser-extension/e2e/helpers/sse-replay-server.ts
new file mode 100644
index 00000000..2f9f844c
--- /dev/null
+++ b/browser-extension/e2e/helpers/sse-replay-server.ts
@@ -0,0 +1,163 @@
+// HTTPS server that impersonates claude.ai / chatgpt.com for tests. It serves a
+// minimal chat page (whose DOM mirrors the real message list) that fires the
+// same completion fetch the real site would, and it streams a recorded .sse
+// fixture back with realistic chunking. Combined with --host-resolver-rules,
+// this lets the real extension content scripts (matched on the real hostnames)
+// run against deterministic recorded data — no login, no cost.
+//
+// Multiple cases can be registered (keyed by conversationId) so tests can drive
+// two concurrent tabs; a page selects its case via ?conv=<id> (defaulting to the
+// first-registered case for single-case tests).
+
+import https from 'node:https';
+import type { AddressInfo } from 'node:net';
+import { readFileSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { getTestCert } from './cert.js';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+const fixturesDir = path.join(__dirname, '..', '..', 'fixtures');
+
+export interface ReplayCase {
+ /** e.g. 'claude' */
+ site: string;
+ /** e.g. 'simple-turn' */
+ name: string;
+ /** conversation id embedded in the completion URL */
+ conversationId: string;
+ /** prompt the page will submit */
+ prompt: string;
+ /** completion path (must match the adapter's request matcher) */
+ completionPath: string;
+ /** optional CSP header to prove injection survives it */
+ csp?: string;
+}
+
+export interface ReplayServer {
+ port: number;
+ /** Register (or replace) a case, keyed by its conversationId. */
+ setCase(c: ReplayCase): void;
+ close(): Promise<void>;
+}
+
+export async function startReplayServer(): Promise<ReplayServer> {
+ const { key, cert } = getTestCert();
+ const cases = new Map<string, ReplayCase>();
+ let defaultConv: string | undefined;
+
+ const server = https.createServer({ key, cert }, (req, res) => {
+ const url = new URL(req.url ?? '/', 'https://claude.ai');
+
+ // The completion endpoint: stream the recorded SSE for that conversation.
+ if (req.method === 'POST' && url.pathname.includes('/chat_conversations/')) {
+ const convId = url.pathname.match(/chat_conversations\/([^/]+)\//)?.[1] ?? '';
+ const c = cases.get(convId);
+ if (!c) {
+ res.writeHead(404).end('no case for conversation');
+ return;
+ }
+ streamFixture(res, c);
+ return;
+ }
+
+ // Anything else → the chat page for the requested (or default) conversation.
+ const convId = url.searchParams.get('conv') ?? defaultConv;
+ const c = convId ? cases.get(convId) : undefined;
+ if (!c) {
+ res.writeHead(503).end('no case set');
+ return;
+ }
+ const headers: Record<string, string> = { 'content-type': 'text/html; charset=utf-8' };
+ if (c.csp) headers['content-security-policy'] = c.csp;
+ res.writeHead(200, headers).end(pageHtml(c));
+ });
+
+ await new Promise<void>((resolve) => server.listen(0, '127.0.0.1', resolve));
+ const { port } = server.address() as AddressInfo;
+
+ return {
+ port,
+ setCase: (c) => {
+ cases.set(c.conversationId, c);
+ defaultConv ??= c.conversationId;
+ },
+ close: () => new Promise<void>((resolve) => server.close(() => resolve())),
+ };
+}
+
+function readFixture(site: string, name: string): string {
+ return readFileSync(path.join(fixturesDir, site, `${name}.sse`), 'utf8');
+}
+
+function streamFixture(res: import('node:http').ServerResponse, c: ReplayCase): void {
+ res.writeHead(200, {
+ 'content-type': 'text/event-stream',
+ 'cache-control': 'no-cache',
+ connection: 'keep-alive',
+ });
+ const body = readFixture(c.site, c.name);
+ // Chunk on a coarse boundary that does NOT respect SSE frame boundaries, to
+ // exercise the parser's buffering; write with small delays to simulate streaming.
+ const pieces = chunkify(body);
+ let i = 0;
+ const tick = () => {
+ if (i >= pieces.length) {
+ res.end();
+ return;
+ }
+ res.write(pieces[i++]);
+ setTimeout(tick, 5);
+ };
+ tick();
+}
+
+/** Split into byte-ish pieces that don't respect SSE frame boundaries. */
+function chunkify(body: string): string[] {
+ const size = 24;
+ const out: string[] = [];
+ for (let i = 0; i < body.length; i += size) out.push(body.slice(i, i + size));
+ return out;
+}
+
+/** Minimal page that mirrors a chat message list and fires the completion fetch. */
+function pageHtml(c: ReplayCase): string {
+ const completionUrl = c.completionPath.replace('{conv}', c.conversationId);
+ return `<!doctype html>
+<html>
+ <head><meta charset="utf-8" /><title>${c.site} (replay)</title></head>
+ <body>
+ <main>
+ <div class="message-list" data-testid="message-list">
+ <div class="user-message">${escapeHtml(c.prompt)}</div>
+ <div class="assistant-message" data-testid="assistant-message"></div>
+ </div>
+ </main>
+ <script>
+ (async () => {
+ const res = await fetch(${JSON.stringify(completionUrl)}, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ prompt: ${JSON.stringify(c.prompt)}, conversation_id: ${JSON.stringify(
+ c.conversationId,
+ )} }),
+ });
+ // Consume the stream like the real site does.
+ const reader = res.body.getReader();
+ const dec = new TextDecoder();
+ const el = document.querySelector('[data-testid="assistant-message"]');
+ for (;;) {
+ const { done, value } = await reader.read();
+ if (done) break;
+ el.textContent += dec.decode(value, { stream: true });
+ }
+ el.setAttribute('data-complete', '1');
+ })();
+ </script>
+ </body>
+</html>`;
+}
+
+function escapeHtml(s: string): string {
+ return s.replace(/[&<>"]/g, (ch) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;' }[ch]!));
+}
diff --git a/browser-extension/e2e/resilience.spec.ts b/browser-extension/e2e/resilience.spec.ts
new file mode 100644
index 00000000..3676b04d
--- /dev/null
+++ b/browser-extension/e2e/resilience.spec.ts
@@ -0,0 +1,84 @@
+import { test, expect, seedSettings } from './fixtures.js';
+import { allRecords, flatAttrs, recordByAction } from './helpers/otlp-assertions.js';
+
+const COMPLETION = '/api/organizations/org-test/chat_conversations/{conv}/completion';
+
+const FULL_SETTINGS = (endpoint: string) => ({
+ enabled: true,
+ retention: 'full' as const,
+ endpoint,
+ sites: { claude_web: true, chatgpt_web: true },
+});
+
+test.beforeEach(async ({ mockCollector }) => {
+ mockCollector.reset();
+});
+
+test('two concurrent tabs stay correlated to their own conversations', async ({
+ context,
+ serviceWorker,
+ replay,
+ mockCollector,
+}) => {
+ const A = 'aaaaaaaa-1111-2222-3333-444444444444';
+ const B = 'bbbbbbbb-5555-6666-7777-888888888888';
+ replay.setCase({ site: 'claude', name: 'simple-turn', conversationId: A, prompt: 'capital of France?', completionPath: COMPLETION });
+ replay.setCase({ site: 'claude', name: 'with-tool-call', conversationId: B, prompt: 'weather in NYC?', completionPath: COMPLETION });
+ await seedSettings(serviceWorker, FULL_SETTINGS(mockCollector.url));
+
+ const [p1, p2] = [await context.newPage(), await context.newPage()];
+ await Promise.all([
+ p1.goto(`https://claude.ai/chat?conv=${A}`),
+ p2.goto(`https://claude.ai/chat?conv=${B}`),
+ ]);
+ await Promise.all([
+ expect(p1.locator('[data-testid="assistant-message"]')).toHaveAttribute('data-complete', '1'),
+ expect(p2.locator('[data-testid="assistant-message"]')).toHaveAttribute('data-complete', '1'),
+ ]);
+
+ // Wait until B's tool call (the last-arriving signal) has been delivered.
+ await expect
+ .poll(() => recordByAction(mockCollector.received, 'tool.invoked'), { timeout: 10_000 })
+ .toBeTruthy();
+
+ const recs = allRecords(mockCollector.received).map((r) => flatAttrs(r.attributes));
+ const promptFor = (sid: string) =>
+ recs.find((a) => a['beacon.session.id'] === sid && a['beacon.event.action'] === 'prompt.submitted');
+
+ // Prompts are attributed to the correct conversation (no cross-contamination).
+ expect(promptFor(A)?.['beacon.prompt.text']).toBe('capital of France?');
+ expect(promptFor(B)?.['beacon.prompt.text']).toBe('weather in NYC?');
+
+ // The tool call belongs only to conversation B (its fixture had one); A had none.
+ const toolSessions = recs
+ .filter((a) => a['beacon.event.action'] === 'tool.invoked')
+ .map((a) => a['beacon.session.id']);
+ expect(toolSessions).toContain(B);
+ expect(toolSessions).not.toContain(A);
+});
+
+test('aborted stream still delivers a best-effort agent.response (not completed)', async ({
+ context,
+ serviceWorker,
+ replay,
+ mockCollector,
+}) => {
+ const C = 'cccccccc-9999-0000-1111-222222222222';
+ replay.setCase({ site: 'claude', name: 'aborted', conversationId: C, prompt: 'tell me a story', completionPath: COMPLETION });
+ await seedSettings(serviceWorker, FULL_SETTINGS(mockCollector.url));
+
+ const page = await context.newPage();
+ await page.goto(`https://claude.ai/chat?conv=${C}`);
+ await expect(page.locator('[data-testid="assistant-message"]')).toHaveAttribute('data-complete', '1');
+
+ // A partial turn is emitted as agent.response (NOT agent.response.completed).
+ await expect
+ .poll(() => recordByAction(mockCollector.received, 'agent.response'), { timeout: 10_000 })
+ .toBeTruthy();
+ expect(recordByAction(mockCollector.received, 'agent.response.completed')).toBeFalsy();
+
+ const resp = flatAttrs(recordByAction(mockCollector.received, 'agent.response')!.attributes);
+ expect(resp['beacon.session.id']).toBe(C);
+ // The prompt was still captured for the aborted turn.
+ expect(recordByAction(mockCollector.received, 'prompt.submitted')).toBeTruthy();
+});
diff --git a/browser-extension/esbuild.config.mjs b/browser-extension/esbuild.config.mjs
new file mode 100644
index 00000000..324f6056
--- /dev/null
+++ b/browser-extension/esbuild.config.mjs
@@ -0,0 +1,63 @@
+import * as esbuild from 'esbuild';
+import { cp, mkdir, rm } from 'node:fs/promises';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+const src = path.join(__dirname, 'src');
+const dist = path.join(__dirname, 'dist');
+const watch = process.argv.includes('--watch');
+
+// Each extension surface is its own bundle. Content scripts and the MAIN-world
+// interceptor must be classic scripts (no ESM import in those worlds), so we
+// bundle everything into a single IIFE per entry.
+const entries = {
+ 'sw': 'background/sw.ts',
+ 'content': 'content/content.ts',
+ 'interceptor': 'interceptor/interceptor.ts',
+ 'popup': 'popup/popup.ts',
+ 'options': 'options/options.ts',
+};
+
+/** Copy static assets (manifest, html, icons) into dist/. */
+async function copyStatic() {
+ await cp(path.join(src, 'manifest.json'), path.join(dist, 'manifest.json'));
+ for (const surface of ['popup', 'options']) {
+ await cp(path.join(src, surface, `${surface}.html`), path.join(dist, `${surface}.html`));
+ }
+ // icons/ is optional; copy if present.
+ await cp(path.join(src, 'icons'), path.join(dist, 'icons'), { recursive: true }).catch(() => {});
+}
+
+const buildOptions = {
+ entryPoints: Object.fromEntries(
+ Object.entries(entries).map(([out, rel]) => [out, path.join(src, rel)]),
+ ),
+ outdir: dist,
+ bundle: true,
+ format: 'iife',
+ target: ['chrome120'],
+ sourcemap: true,
+ logLevel: 'info',
+};
+
+async function run() {
+ await rm(dist, { recursive: true, force: true });
+ await mkdir(dist, { recursive: true });
+
+ if (watch) {
+ const ctx = await esbuild.context(buildOptions);
+ await copyStatic();
+ await ctx.watch();
+ console.log('[esbuild] watching…');
+ } else {
+ await esbuild.build(buildOptions);
+ await copyStatic();
+ console.log('[esbuild] build complete → dist/');
+ }
+}
+
+run().catch((err) => {
+ console.error(err);
+ process.exit(1);
+});
diff --git a/browser-extension/fixtures/claude/aborted.sse b/browser-extension/fixtures/claude/aborted.sse
new file mode 100644
index 00000000..a98b9434
--- /dev/null
+++ b/browser-extension/fixtures/claude/aborted.sse
@@ -0,0 +1,12 @@
+event: conversation_ready
+data: {"type":"conversation_ready"}
+
+event: message_start
+data: {"type":"message_start","message":{"id":"chatcompl_REDACTED","type":"message","role":"assistant","model":"claude-opus-4-8","content":[],"stop_reason":null}}
+
+event: content_block_start
+data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":"","citations":[]}}
+
+event: content_block_delta
+data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Once upon a time"}}
+
diff --git a/browser-extension/fixtures/claude/simple-turn.sse b/browser-extension/fixtures/claude/simple-turn.sse
new file mode 100644
index 00000000..2a277cf4
--- /dev/null
+++ b/browser-extension/fixtures/claude/simple-turn.sse
@@ -0,0 +1,21 @@
+event: conversation_ready
+data: {"type":"conversation_ready"}
+
+event: message_start
+data: {"type":"message_start","message":{"id":"chatcompl_REDACTED","type":"message","role":"assistant","model":"claude-opus-4-8","content":[],"stop_reason":null,"stop_sequence":null}}
+
+event: content_block_start
+data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":"","citations":[]}}
+
+event: content_block_delta
+data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Paris."}}
+
+event: content_block_stop
+data: {"type":"content_block_stop","index":0}
+
+event: message_delta
+data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null}}
+
+event: message_stop
+data: {"type":"message_stop"}
+
diff --git a/browser-extension/fixtures/claude/with-tool-call.sse b/browser-extension/fixtures/claude/with-tool-call.sse
new file mode 100644
index 00000000..157154a7
--- /dev/null
+++ b/browser-extension/fixtures/claude/with-tool-call.sse
@@ -0,0 +1,33 @@
+event: conversation_ready
+data: {"type":"conversation_ready"}
+
+event: message_start
+data: {"type":"message_start","message":{"id":"chatcompl_REDACTED","type":"message","role":"assistant","model":"claude-opus-4-8","content":[],"stop_reason":null}}
+
+event: content_block_start
+data: {"type":"content_block_start","index":0,"content_block":{"type":"tool_use","id":"toolu_abc","name":"web_search","input":{}}}
+
+event: content_block_delta
+data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":"{\"query\":\"weather"}}
+
+event: content_block_delta
+data: {"type":"content_block_delta","index":0,"delta":{"type":"input_json_delta","partial_json":" today\"}"}}
+
+event: content_block_stop
+data: {"type":"content_block_stop","index":0}
+
+event: content_block_start
+data: {"type":"content_block_start","index":1,"content_block":{"type":"text","text":"","citations":[]}}
+
+event: content_block_delta
+data: {"type":"content_block_delta","index":1,"delta":{"type":"text_delta","text":"Let me check the weather."}}
+
+event: content_block_stop
+data: {"type":"content_block_stop","index":1}
+
+event: message_delta
+data: {"type":"message_delta","delta":{"stop_reason":"tool_use"}}
+
+event: message_stop
+data: {"type":"message_stop"}
+
diff --git a/browser-extension/package-lock.json b/browser-extension/package-lock.json
new file mode 100644
index 00000000..0e20f1c2
--- /dev/null
+++ b/browser-extension/package-lock.json
@@ -0,0 +1,2286 @@
+{
+ "name": "agent-beacon-browser-extension",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "agent-beacon-browser-extension",
+ "version": "0.1.0",
+ "devDependencies": {
+ "@playwright/test": "^1.55.0",
+ "@types/chrome": "^0.0.270",
+ "@types/node": "^22.0.0",
+ "esbuild": "^0.24.0",
+ "typescript": "^5.6.0",
+ "vitest": "^4.1.0"
+ }
+ },
+ "node_modules/@emnapi/wasi-threads": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz",
+ "integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "tslib": "^2.4.0"
+ }
+ },
+ "node_modules/@esbuild/aix-ppc64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.2.tgz",
+ "integrity": "sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.2.tgz",
+ "integrity": "sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.2.tgz",
+ "integrity": "sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-x64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.2.tgz",
+ "integrity": "sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-arm64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.2.tgz",
+ "integrity": "sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-x64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.2.tgz",
+ "integrity": "sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.2.tgz",
+ "integrity": "sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-x64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.2.tgz",
+ "integrity": "sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.2.tgz",
+ "integrity": "sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.2.tgz",
+ "integrity": "sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ia32": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.2.tgz",
+ "integrity": "sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-loong64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.2.tgz",
+ "integrity": "sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-mips64el": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.2.tgz",
+ "integrity": "sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ppc64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.2.tgz",
+ "integrity": "sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-riscv64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.2.tgz",
+ "integrity": "sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-s390x": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.2.tgz",
+ "integrity": "sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-x64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.2.tgz",
+ "integrity": "sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-arm64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.24.2.tgz",
+ "integrity": "sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-x64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.2.tgz",
+ "integrity": "sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-arm64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.2.tgz",
+ "integrity": "sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-x64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.2.tgz",
+ "integrity": "sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openharmony-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.1.tgz",
+ "integrity": "sha512-ge+Z7EXFNt2BO1oAMsVpiQ8EwndV9i1xXerAeTIK7AtPs3bKFXQM7nlRxDSIUIMeueR1CNXxqztLzdNeReKBJg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/sunos-x64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.2.tgz",
+ "integrity": "sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-arm64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.2.tgz",
+ "integrity": "sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-ia32": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.2.tgz",
+ "integrity": "sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-x64": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.2.tgz",
+ "integrity": "sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.5.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@napi-rs/wasm-runtime": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz",
+ "integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "@tybys/wasm-util": "^0.10.3"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/Brooooooklyn"
+ },
+ "peerDependencies": {
+ "@emnapi/core": "^1.7.1",
+ "@emnapi/runtime": "^1.7.1"
+ }
+ },
+ "node_modules/@oxc-project/types": {
+ "version": "0.139.0",
+ "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.139.0.tgz",
+ "integrity": "sha512-r9gHphtCs+1M7J0pw6Sn/hh/Wpa/iQrOOkrNAlVLF/gHq+/CJmHIWKKUUhdWjcD6CIa8idarspCsASiXCXvFUw==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/Boshen"
+ }
+ },
+ "node_modules/@playwright/test": {
+ "version": "1.61.1",
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.61.1.tgz",
+ "integrity": "sha512-8nKv6+0RJSL9FE4jYOEGXnPeM/Hg12qZpmqzZjRh3qM0Y7c3z1mrOTfFLids72RDQYVh9WpLEfR5WdpNX4fkig==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "playwright": "1.61.1"
+ },
+ "bin": {
+ "playwright": "cli.js"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@rolldown/binding-android-arm64": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.1.5.tgz",
+ "integrity": "sha512-lZg8fqIv2v7FF237bwMgzGZEJvGL79/s5knJ/i6FmsGF4XXlzccZ4jb+TrFIxtSSxFtIpdsgrPZeMk1I9AFcyQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-darwin-arm64": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.1.5.tgz",
+ "integrity": "sha512-51Bnx9pNiMRKSUNtBfySkNJ9vMU9Hh3I1ozDd6gyPPYzaXCfnptUcEZxXGYFn+ul2dtcMUiqGR1Yai2K10uoTw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-darwin-x64": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.1.5.tgz",
+ "integrity": "sha512-Tm+gbfC0aHu1tBA/JvKQh32S0K6YgCHkiAF4/W6xX0K0RmNuc94VeK419dJoE65R5aRxmo+noZQSWrAMF6yb6g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-freebsd-x64": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.1.5.tgz",
+ "integrity": "sha512-JMzDKCCXq93YccG5gz3hvOs1oXRKAf0XYpfOS88e+wZrC8Iugj6j68867vrYZkvpDDpKn/KoKORThmchMpF6TA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-arm-gnueabihf": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.1.5.tgz",
+ "integrity": "sha512-uML21j2K5TfPGutKxub+M+nLjZIrWjXQ5Grx4lCe/nimTj9B4L63zHpjXLl4y0L3mcm2htEQIb06oCG/szerNw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-arm64-gnu": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.1.5.tgz",
+ "integrity": "sha512-navSiuTMogvnQoZoM/v+l3ZWo50/NTwSHSzheABx/RCnmUPaKwq9qSo4Br2OYRs21+Fz8uFqITZM3H4opOB0/Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-arm64-musl": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.1.5.tgz",
+ "integrity": "sha512-lAryqH7IteztmCXQXk0etKj4wBQ7Gx5S6LjKhsgp9zb8I5bsuvU/2llH1hDQcjsFeqIsovMVN339/8pUDDBXxA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-ppc64-gnu": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.1.5.tgz",
+ "integrity": "sha512-fsK/sNBnxzBlL4O1JNrZakVQxPspqpED5dLtNsZS9oOKmtSpdNIzxH2kkol5HYTWJN47sE20ztMJPxfZ89qGOg==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-s390x-gnu": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.1.5.tgz",
+ "integrity": "sha512-gLYb4BIadlfTOYT5gO503n8zQjXflgzpD0FcyKh0Mzx3rqCZKnHoJWV9xe1KXUJ5lx2JfcSHr/mhzS0PC/McAA==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-x64-gnu": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.1.5.tgz",
+ "integrity": "sha512-FjcpEKUyJygHgs1o50VYNvkt5+7Le/VEdYt0AkRpkL33MnyQfwr8l5mXwMmfmTbyMPr5vJLC+8/Gd9gXnwU1QQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-linux-x64-musl": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.1.5.tgz",
+ "integrity": "sha512-Me+PfPI2TMeOQk0gYWfLQZtTktrmzbr8cDboqX83XKc7UrgAi55gF+2dUkWdxd19n55Essp2yeca+O9N5rBxHg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-openharmony-arm64": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.1.5.tgz",
+ "integrity": "sha512-yc5WrLzXks6zCQfn9Oxr8pORKyl/pF+QjHmW/Qx3qu0oyrrNC+y2JLTU1E2rcWYAmzlnqngWXHQjy51VzW70Vw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-wasm32-wasi": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.1.5.tgz",
+ "integrity": "sha512-VbQGPX2b4r48TAMIM2cjgluIM1HYutm4pcTEJsle7iEP7sB1dFqtPLBVbdLAZCxy1txCcPxf4QFf4v8uvltPqA==",
+ "cpu": [
+ "wasm32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "@emnapi/core": "1.11.1",
+ "@emnapi/runtime": "1.11.1",
+ "@napi-rs/wasm-runtime": "^1.1.6"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-win32-arm64-msvc": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.1.5.tgz",
+ "integrity": "sha512-gHv82k63z4qpV5+Q1y/12KrK0ltWBukVDI8nZcbT7Tt/ZlOIVwppazneq0F93oDxTo3IgAMEDIoQh3E2n6mVsw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/binding-win32-x64-msvc": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.1.5.tgz",
+ "integrity": "sha512-tTZuDBPw85tEN5PQi1pnEBzDy0Z49HtScLAbD5t6hyeU92A95pRWaSMw1GZZi/RwgSgUIl0xrSlXIT/9QzvYSA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ }
+ },
+ "node_modules/@rolldown/pluginutils": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz",
+ "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@standard-schema/spec": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",
+ "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@tybys/wasm-util": {
+ "version": "0.10.3",
+ "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz",
+ "integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "tslib": "^2.4.0"
+ }
+ },
+ "node_modules/@types/chai": {
+ "version": "5.2.3",
+ "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",
+ "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/deep-eql": "*",
+ "assertion-error": "^2.0.1"
+ }
+ },
+ "node_modules/@types/chrome": {
+ "version": "0.0.270",
+ "resolved": "https://registry.npmjs.org/@types/chrome/-/chrome-0.0.270.tgz",
+ "integrity": "sha512-ADvkowV7YnJfycZZxL2brluZ6STGW+9oKG37B422UePf2PCXuFA/XdERI0T18wtuWPx0tmFeZqq6MOXVk1IC+Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/filesystem": "*",
+ "@types/har-format": "*"
+ }
+ },
+ "node_modules/@types/deep-eql": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",
+ "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/estree": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",
+ "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/filesystem": {
+ "version": "0.0.36",
+ "resolved": "https://registry.npmjs.org/@types/filesystem/-/filesystem-0.0.36.tgz",
+ "integrity": "sha512-vPDXOZuannb9FZdxgHnqSwAG/jvdGM8Wq+6N4D/d80z+D4HWH+bItqsZaVRQykAn6WEVeEkLm2oQigyHtgb0RA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/filewriter": "*"
+ }
+ },
+ "node_modules/@types/filewriter": {
+ "version": "0.0.33",
+ "resolved": "https://registry.npmjs.org/@types/filewriter/-/filewriter-0.0.33.tgz",
+ "integrity": "sha512-xFU8ZXTw4gd358lb2jw25nxY9QAgqn2+bKKjKOYfNCzN4DKCFetK7sPtrlpg66Ywe3vWY9FNxprZawAh9wfJ3g==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/har-format": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@types/har-format/-/har-format-1.2.16.tgz",
+ "integrity": "sha512-fluxdy7ryD3MV6h8pTfTYpy/xQzCFC7m89nOH9y94cNqJ1mDIDPut7MnRHI3F6qRmh/cT2fUjG1MLdCNb4hE9A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/node": {
+ "version": "22.20.1",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.1.tgz",
+ "integrity": "sha512-EANqOCF9QFyra+4pfxUcX9STKJpCLjMbObVzljIJomAWSnuSIEAvyzEU53GaajbXJEgdh0iEcPL+DGvpUd4k1Q==",
+ "dev": true,
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "undici-types": "~6.21.0"
+ }
+ },
+ "node_modules/@vitest/expect": {
+ "version": "4.1.10",
+ "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.1.10.tgz",
+ "integrity": "sha512-YsCn+qAk1GWjQOWFEsEcL2gNQ0zmVmQu3T03qP6UyjhtmdtwtbuI+DASn/7iQB3HGTXkdBwGddzxPlmiql5vlA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@standard-schema/spec": "^1.1.0",
+ "@types/chai": "^5.2.2",
+ "@vitest/spy": "4.1.10",
+ "@vitest/utils": "4.1.10",
+ "chai": "^6.2.2",
+ "tinyrainbow": "^3.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/pretty-format": {
+ "version": "4.1.10",
+ "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.1.10.tgz",
+ "integrity": "sha512-W1HsjSH4MXQ9YfmmhLAoIYf1HRfekQCGngeIgcei6MP5QQGWUe0gkopdZQaVCFO+JDJMrAJGwa5pRpNpvy4P8Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "tinyrainbow": "^3.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/runner": {
+ "version": "4.1.10",
+ "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.1.10.tgz",
+ "integrity": "sha512-IKI6kpIH+LmpROplyLwBBaCfMgOZOMsygVa6BARD6ahA04VRuJSa6OaVG7kRvSEMD870Vd91rSSw0eegtWyLGg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/utils": "4.1.10",
+ "pathe": "^2.0.3"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/snapshot": {
+ "version": "4.1.10",
+ "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.1.10.tgz",
+ "integrity": "sha512-xRkfOT1qpTAi/Ti4Y1LtfRc3kEuqxGw59eN2jN9pRWMtS/XDevekhcFSqvQqjUNGksfjMJu3Y+oJ+4Ypn2OaJw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/pretty-format": "4.1.10",
+ "@vitest/utils": "4.1.10",
+ "magic-string": "^0.30.21",
+ "pathe": "^2.0.3"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/spy": {
+ "version": "4.1.10",
+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.1.10.tgz",
+ "integrity": "sha512-PLf/Ugvoq5wO/b4rwYCR1h2PSIdXz7wnkQFMiUpLdtM7l6pqVFcQIBEHyT1+l+cj7mNwAfZHzqXqDyjvOuwbDw==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/utils": {
+ "version": "4.1.10",
+ "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.1.10.tgz",
+ "integrity": "sha512-fy9am/HWxbaGt/Sawrp90vt6Y6jQwf1RX77cz3uwoJwJVMli/e1IEwRPnMNJ7vKfPTwo0diXifkpPvwH9v7nGA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/pretty-format": "4.1.10",
+ "convert-source-map": "^2.0.0",
+ "tinyrainbow": "^3.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/assertion-error": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
+ "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/chai": {
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz",
+ "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/convert-source-map": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
+ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/detect-libc": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/es-module-lexer": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.1.tgz",
+ "integrity": "sha512-shc1dbU90Yl/xq1QrC7QRtfcwURZuVRfPhZbDoldJ1cn1gzDvBaBWlv0eFolj5+0znnPJz5TXLxsN77X/12KTA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/esbuild": {
+ "version": "0.24.2",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz",
+ "integrity": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "@esbuild/aix-ppc64": "0.24.2",
+ "@esbuild/android-arm": "0.24.2",
+ "@esbuild/android-arm64": "0.24.2",
+ "@esbuild/android-x64": "0.24.2",
+ "@esbuild/darwin-arm64": "0.24.2",
+ "@esbuild/darwin-x64": "0.24.2",
+ "@esbuild/freebsd-arm64": "0.24.2",
+ "@esbuild/freebsd-x64": "0.24.2",
+ "@esbuild/linux-arm": "0.24.2",
+ "@esbuild/linux-arm64": "0.24.2",
+ "@esbuild/linux-ia32": "0.24.2",
+ "@esbuild/linux-loong64": "0.24.2",
+ "@esbuild/linux-mips64el": "0.24.2",
+ "@esbuild/linux-ppc64": "0.24.2",
+ "@esbuild/linux-riscv64": "0.24.2",
+ "@esbuild/linux-s390x": "0.24.2",
+ "@esbuild/linux-x64": "0.24.2",
+ "@esbuild/netbsd-arm64": "0.24.2",
+ "@esbuild/netbsd-x64": "0.24.2",
+ "@esbuild/openbsd-arm64": "0.24.2",
+ "@esbuild/openbsd-x64": "0.24.2",
+ "@esbuild/sunos-x64": "0.24.2",
+ "@esbuild/win32-arm64": "0.24.2",
+ "@esbuild/win32-ia32": "0.24.2",
+ "@esbuild/win32-x64": "0.24.2"
+ }
+ },
+ "node_modules/estree-walker": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "^1.0.0"
+ }
+ },
+ "node_modules/expect-type": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz",
+ "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
+ "node_modules/fdir": {
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
+ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/lightningcss": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz",
+ "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==",
+ "dev": true,
+ "license": "MPL-2.0",
+ "dependencies": {
+ "detect-libc": "^2.0.3"
+ },
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ },
+ "optionalDependencies": {
+ "lightningcss-android-arm64": "1.33.0",
+ "lightningcss-darwin-arm64": "1.33.0",
+ "lightningcss-darwin-x64": "1.33.0",
+ "lightningcss-freebsd-x64": "1.33.0",
+ "lightningcss-linux-arm-gnueabihf": "1.33.0",
+ "lightningcss-linux-arm64-gnu": "1.33.0",
+ "lightningcss-linux-arm64-musl": "1.33.0",
+ "lightningcss-linux-x64-gnu": "1.33.0",
+ "lightningcss-linux-x64-musl": "1.33.0",
+ "lightningcss-win32-arm64-msvc": "1.33.0",
+ "lightningcss-win32-x64-msvc": "1.33.0"
+ }
+ },
+ "node_modules/lightningcss-android-arm64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz",
+ "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-darwin-arm64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz",
+ "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-darwin-x64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz",
+ "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-freebsd-x64": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz",
+ "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-arm-gnueabihf": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz",
+ "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-arm64-gnu": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz",
+ "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-arm64-musl": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz",
+ "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-x64-gnu": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz",
+ "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-linux-x64-musl": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz",
+ "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-win32-arm64-msvc": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz",
+ "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/lightningcss-win32-x64-msvc": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz",
+ "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MPL-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 12.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/parcel"
+ }
+ },
+ "node_modules/magic-string": {
+ "version": "0.30.21",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
+ "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.5"
+ }
+ },
+ "node_modules/nanoid": {
+ "version": "3.3.16",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.16.tgz",
+ "integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
+ "node_modules/obug": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.4.tgz",
+ "integrity": "sha512-4a+OsYv9UktOJKE+l1A4OufDgdRF9PifWj+tJnHURo/P+WOxpG4GzUFL9qCalmWauao6ogiG+QvnCovwPoyAWA==",
+ "dev": true,
+ "funding": [
+ "https://github.com/sponsors/sxzz",
+ "https://opencollective.com/debug"
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.20.0"
+ }
+ },
+ "node_modules/pathe": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
+ "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/picocolors": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/picomatch": {
+ "version": "4.0.5",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz",
+ "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==",
+ "dev": true,
+ "license": "MIT",
+ "peer": true,
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/playwright": {
+ "version": "1.61.1",
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.61.1.tgz",
+ "integrity": "sha512-DWnY5o3YbLWK4GovuAVwpqL+1VwGNdUGrRr++8j8PtQQzvAVZUIMjKQ90fY689sEJZJBbZVw1rXaOKSTitkzPQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "playwright-core": "1.61.1"
+ },
+ "bin": {
+ "playwright": "cli.js"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "fsevents": "2.3.2"
+ }
+ },
+ "node_modules/playwright-core": {
+ "version": "1.61.1",
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.61.1.tgz",
+ "integrity": "sha512-h7Qlt6m4REp25qvIdvbDtVmD4LqVXfpRxhORv9L0jzETM05p4fuPJ3dKyuSXQxDSbXnmS79HAgi9589lGSpLkg==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "playwright-core": "cli.js"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/postcss": {
+ "version": "8.5.22",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.22.tgz",
+ "integrity": "sha512-KBDEIpLrvpv16pp3K0Fw+UCoZfopFjjgeB+0tA/aaThfEE74kKDLrgg603YvOWJyg3+WYtyq3xYsQWsIyZlPqQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "nanoid": "^3.3.16",
+ "picocolors": "^1.1.1",
+ "source-map-js": "^1.2.1"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ }
+ },
+ "node_modules/rolldown": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.1.5.tgz",
+ "integrity": "sha512-t9z29cJjXf/vxQ8dyhCSpt6H6aSwHTk8cT5I3iy6SMXuFpk5mB6PL6XfC8PCwrPTx93udwKUm9HRteAlTGBLiA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@oxc-project/types": "=0.139.0",
+ "@rolldown/pluginutils": "^1.0.0"
+ },
+ "bin": {
+ "rolldown": "bin/cli.mjs"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "optionalDependencies": {
+ "@rolldown/binding-android-arm64": "1.1.5",
+ "@rolldown/binding-darwin-arm64": "1.1.5",
+ "@rolldown/binding-darwin-x64": "1.1.5",
+ "@rolldown/binding-freebsd-x64": "1.1.5",
+ "@rolldown/binding-linux-arm-gnueabihf": "1.1.5",
+ "@rolldown/binding-linux-arm64-gnu": "1.1.5",
+ "@rolldown/binding-linux-arm64-musl": "1.1.5",
+ "@rolldown/binding-linux-ppc64-gnu": "1.1.5",
+ "@rolldown/binding-linux-s390x-gnu": "1.1.5",
+ "@rolldown/binding-linux-x64-gnu": "1.1.5",
+ "@rolldown/binding-linux-x64-musl": "1.1.5",
+ "@rolldown/binding-openharmony-arm64": "1.1.5",
+ "@rolldown/binding-wasm32-wasi": "1.1.5",
+ "@rolldown/binding-win32-arm64-msvc": "1.1.5",
+ "@rolldown/binding-win32-x64-msvc": "1.1.5"
+ }
+ },
+ "node_modules/siginfo": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",
+ "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/source-map-js": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/stackback": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz",
+ "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/std-env": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.2.0.tgz",
+ "integrity": "sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/tinybench": {
+ "version": "2.9.0",
+ "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz",
+ "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/tinyexec": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.2.4.tgz",
+ "integrity": "sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/tinyglobby": {
+ "version": "0.2.17",
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
+ "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fdir": "^6.5.0",
+ "picomatch": "^4.0.4"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/SuperchupuDev"
+ }
+ },
+ "node_modules/tinyrainbow": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.1.0.tgz",
+ "integrity": "sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
+ "node_modules/tslib": {
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
+ "dev": true,
+ "license": "0BSD",
+ "optional": true
+ },
+ "node_modules/typescript": {
+ "version": "5.9.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
+ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
+ "node_modules/undici-types": {
+ "version": "6.21.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
+ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/vitest": {
+ "version": "4.1.10",
+ "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.1.10.tgz",
+ "integrity": "sha512-R9jUTe5S4Qb0HCd4TNqpC7oGcrMssMRGXLW80ubjWsW9VH5GF8y1Y0SFLY9AbqSk6nt0PnOx4H4WNJYZ13GUPw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/expect": "4.1.10",
+ "@vitest/mocker": "4.1.10",
+ "@vitest/pretty-format": "4.1.10",
+ "@vitest/runner": "4.1.10",
+ "@vitest/snapshot": "4.1.10",
+ "@vitest/spy": "4.1.10",
+ "@vitest/utils": "4.1.10",
+ "es-module-lexer": "^2.0.0",
+ "expect-type": "^1.3.0",
+ "magic-string": "^0.30.21",
+ "obug": "^2.1.1",
+ "pathe": "^2.0.3",
+ "picomatch": "^4.0.3",
+ "std-env": "^4.0.0-rc.1",
+ "tinybench": "^2.9.0",
+ "tinyexec": "^1.0.2",
+ "tinyglobby": "^0.2.15",
+ "tinyrainbow": "^3.1.0",
+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
+ "why-is-node-running": "^2.3.0"
+ },
+ "bin": {
+ "vitest": "vitest.mjs"
+ },
+ "engines": {
+ "node": "^20.0.0 || ^22.0.0 || >=24.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "@edge-runtime/vm": "*",
+ "@opentelemetry/api": "^1.9.0",
+ "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0",
+ "@vitest/browser-playwright": "4.1.10",
+ "@vitest/browser-preview": "4.1.10",
+ "@vitest/browser-webdriverio": "4.1.10",
+ "@vitest/coverage-istanbul": "4.1.10",
+ "@vitest/coverage-v8": "4.1.10",
+ "@vitest/ui": "4.1.10",
+ "happy-dom": "*",
+ "jsdom": "*",
+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@edge-runtime/vm": {
+ "optional": true
+ },
+ "@opentelemetry/api": {
+ "optional": true
+ },
+ "@types/node": {
+ "optional": true
+ },
+ "@vitest/browser-playwright": {
+ "optional": true
+ },
+ "@vitest/browser-preview": {
+ "optional": true
+ },
+ "@vitest/browser-webdriverio": {
+ "optional": true
+ },
+ "@vitest/coverage-istanbul": {
+ "optional": true
+ },
+ "@vitest/coverage-v8": {
+ "optional": true
+ },
+ "@vitest/ui": {
+ "optional": true
+ },
+ "happy-dom": {
+ "optional": true
+ },
+ "jsdom": {
+ "optional": true
+ },
+ "vite": {
+ "optional": false
+ }
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/aix-ppc64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.1.tgz",
+ "integrity": "sha512-Svl7tq8k/08+p6CXPpRjQ1fKX+1odH/BQbb48fV6fj3CWHhsoIOoY87w1oHXm0qEpkIK3ZfVgp0hed3XBXzXMQ==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/android-arm": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.1.tgz",
+ "integrity": "sha512-0k2F129Xdio1TdJfzJ8sy1Q47vUD2NnwdhiAf7drUN1EBTfPf4hsFCtmMgu/6m8JSzsBrlmVjudMBQqOfG8usQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/android-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.1.tgz",
+ "integrity": "sha512-34EGEbCIAgosYz6goLcopX6Mo7NyGv9tfwEM2/7Ce2VcVRk568iSvniGWcUXIy7wEDR1wzolcxcriFVrWYcwBg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/android-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.1.tgz",
+ "integrity": "sha512-dbwY7ltSMDWsRatcRpCnES4F+im88OCUgGZjy52shC7GqHRE/cYlxNbB4Z4UpJswpcc4Qxd2oE/ufM0p61IKng==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/darwin-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.1.tgz",
+ "integrity": "sha512-TZbWkQY7kvTAXbXUT7uVACR5cMHsDiSz9z7ZKAX/RTq/WJEk3QyRr0wZpNhBDX+/0CtdqUIJlOiodQcta6tY3Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/darwin-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.1.tgz",
+ "integrity": "sha512-zfdzgK9ACBNZLI/CyHTOx81SyNbM6YXn7rxSgX97VjyiPl9W1i4Ka4fgKECEoFCKGpvBj5qArWIGgQjOwkgskQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.1.tgz",
+ "integrity": "sha512-wG2EA8ENdEI0qhkSZMjfqrdY+ziCYCPMmtZjjIwOmXFjmyzEHn+UUxk5of+SYsjtfs3VpnlC7QLzSI5hY/rOAw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/freebsd-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.1.tgz",
+ "integrity": "sha512-i7dZ9vQgnvSCzi/rYCXNgtF/U+eKZNJBzu3eTQbRgHnM7tNSizLOkRFAl3qzVc/Op/u5YkHHa4pf/3DOYHthLQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/linux-arm": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.1.tgz",
+ "integrity": "sha512-qVXBOHQS+d5Y722GwJzJUtOLlX7km3CraOaGormF1pDtPd2C/l1SHRPgjLunLGe51Sh5YYWKMFDyV4SxgMQYTQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/linux-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.1.tgz",
+ "integrity": "sha512-yHs+0uc8+nvEAfAfxrWQKK5peSNzBc4PegcMO0EJ2hT71uA7vB8Ihg2e77R2P7SG5uYjPbHlLLmve4LLLRCf0g==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/linux-ia32": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.1.tgz",
+ "integrity": "sha512-d1z4ZuP0ajrfz/FhGT4vv278rX8KnPPJx8i5+AtK7TYbx9Le9F1hyzurZpkEyjkGa9dUGhQow4C1NmeGvqxN2w==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/linux-loong64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.1.tgz",
+ "integrity": "sha512-M5sRjUVZrkm1OAPR3dlOYzNmN+loZKGVi1VUQGrwuqLcbR6qeAz+famMhjASeH3YVKvZz+zT1jlh/keC3Rj/lg==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/linux-mips64el": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.1.tgz",
+ "integrity": "sha512-mRObBZeHh2OxcBFPWE/FjylkRgZdYuiTR3vaTozquCGOH14iP9oN4x4Ge81CoIDYQrXmIxpFumJBu5MtZpnQJQ==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/linux-ppc64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.1.tgz",
+ "integrity": "sha512-slScBsMAb3GFDcdrCgLwZtPYRoH2H/youv10QiZyRjmsP48fznoveWytSgCI/R0ZcUgpc0ZhIUEx6LHts8yrfQ==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/linux-riscv64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.1.tgz",
+ "integrity": "sha512-kw0owk1o0GFETUJyW0jc0G4Yzs0BHZn0JDZ8JRT088vjJYX777BAs1fDGxAC+q831qOs2DTC96mNsG2opdfyyQ==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/linux-s390x": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.1.tgz",
+ "integrity": "sha512-/lAIjX8aYFRByhh6L5rYtPEDRqa9de/4V/juOXcta5frjvzXO4/sqEtyytse0g3zZFuWu5cDN0MkLz2qRDD2Ag==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/linux-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.1.tgz",
+ "integrity": "sha512-u/anNYF2mmVOEDwLtnQ1wOr3EZ9sTNGLWrsYGYwHWzGA3Si84IOkHXlbWTD1NB+9/1lcnweYKO54uhxZydNzfA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/netbsd-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.1.tgz",
+ "integrity": "sha512-oks0DYbLwWMmaakTsCb+zL4E+aHRVLom9IJZOAthMQEPiQmydXHkziYEsGYRx0uNV/IjEKGAV941JzH02pflqw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/netbsd-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.1.tgz",
+ "integrity": "sha512-aeL6lAnN89Hz43Mlh1G8ARasbuoYvSITDEx0tHh5b7jJnHcssqgjy9Yx430GDpmCa6OyrKoS0aNRjKundRizGg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/openbsd-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.1.tgz",
+ "integrity": "sha512-MEFJe5C3R8pwXdZ5Y21oo6m7ePiS0d9pWucn99O/wvyJZChoIQKrQDxKrGeW8F5+T0okTHesAmDeiHDTIq0V/Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/openbsd-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.1.tgz",
+ "integrity": "sha512-i/ZLIOafE0Z8cI/XANJAixoJL/uRAoS2xOA3rb0xN+KK0K177cMAsQYkzHtBrtMXAKuAc7HGgcWiZ/sRC1Nxgw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/sunos-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.1.tgz",
+ "integrity": "sha512-BEjgtECkL3vY+SaSQ6nzVfiALUeFxpawyp8Jmf5PtYhf1Ug40N1h/hxlhts+f1FvSvarEigdxS3BlSMI2PJLcQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/win32-arm64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.1.tgz",
+ "integrity": "sha512-lCv9eK/H6ZJWbE7bh2nw54CZ9M2nupBxJcTsdk/QQnWkdSjKGuxmmH8/GWrlT1eMmZfn4dGcCjRte397WqfQXA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/win32-ia32": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.1.tgz",
+ "integrity": "sha512-zvb/mB2bSCoJOpoCBgYKKpX6YM6mJBlBUVUtVj41DlZJVEB6/0CKlRYxP5wWl1C1ILiCoAU5wZZ4q1P3qeS6Eg==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/win32-x64": {
+ "version": "0.28.1",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.1.tgz",
+ "integrity": "sha512-bm4Mowrv+GXMlpWX++EcXw/iLyd1o3+bJkC2DkWXYVvgZCqD/bSj9ctZeAMC3cIxgjRVR2Dufaiu4YPxr5gW1A==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@vitest/mocker": {
+ "version": "4.1.10",
+ "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.1.10.tgz",
+ "integrity": "sha512-v0xaezt+DKEmKfaxg133ldzADrwLGd7Ze1MfQQTYfvs8OqZIwbxyxaYURivwV7sWy5fqn3rH5uOrSp07bp44Ow==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/spy": "4.1.10",
+ "estree-walker": "^3.0.3",
+ "magic-string": "^0.30.21"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "msw": "^2.4.9",
+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ },
+ "peerDependenciesMeta": {
+ "msw": {
+ "optional": true
+ },
+ "vite": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/vitest/node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/vitest/node_modules/vite": {
+ "version": "8.1.5",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-8.1.5.tgz",
+ "integrity": "sha512-7ULLwsCdYx/nRyrpiEwvqb5TFHrMVZyBt+rg/OAXT7rgj/z+DtTDyKFeLAdDkubDVDKD8jOsndmy7m55XcfUsw==",
+ "dev": true,
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "lightningcss": "^1.32.0",
+ "picomatch": "^4.0.5",
+ "postcss": "^8.5.17",
+ "rolldown": "~1.1.5",
+ "tinyglobby": "^0.2.17"
+ },
+ "bin": {
+ "vite": "bin/vite.js"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "funding": {
+ "url": "https://github.com/vitejs/vite?sponsor=1"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
+ },
+ "peerDependencies": {
+ "@types/node": "^20.19.0 || >=22.12.0",
+ "@vitejs/devtools": "^0.3.0",
+ "esbuild": "^0.27.0 || ^0.28.0",
+ "jiti": ">=1.21.0",
+ "less": "^4.0.0",
+ "sass": "^1.70.0",
+ "sass-embedded": "^1.70.0",
+ "stylus": ">=0.54.8",
+ "sugarss": "^5.0.0",
+ "terser": "^5.16.0",
+ "tsx": "^4.8.1",
+ "yaml": "^2.4.2"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ },
+ "@vitejs/devtools": {
+ "optional": true
+ },
+ "esbuild": {
+ "optional": true
+ },
+ "jiti": {
+ "optional": true
+ },
+ "less": {
+ "optional": true
+ },
+ "sass": {
+ "optional": true
+ },
+ "sass-embedded": {
+ "optional": true
+ },
+ "stylus": {
+ "optional": true
+ },
+ "sugarss": {
+ "optional": true
+ },
+ "terser": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/why-is-node-running": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz",
+ "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "siginfo": "^2.0.0",
+ "stackback": "0.0.2"
+ },
+ "bin": {
+ "why-is-node-running": "cli.js"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ }
+ }
+}
diff --git a/browser-extension/package.json b/browser-extension/package.json
new file mode 100644
index 00000000..07b165bc
--- /dev/null
+++ b/browser-extension/package.json
@@ -0,0 +1,30 @@
+{
+ "name": "agent-beacon-browser-extension",
+ "version": "0.1.0",
+ "private": true,
+ "type": "module",
+ "description": "Chrome extension that relays LLM chat telemetry (ChatGPT, Claude) into the local Agent Beacon pipeline, with a fully automated self-verifying build/test loop.",
+ "scripts": {
+ "build": "node esbuild.config.mjs",
+ "build:watch": "node esbuild.config.mjs --watch",
+ "typecheck": "tsc --noEmit",
+ "test:unit": "vitest run",
+ "test:unit:watch": "vitest",
+ "pretest": "npm run build",
+ "test": "playwright test",
+ "test:headed": "HEADED=1 playwright test --headed",
+ "test:ui": "playwright test --ui",
+ "test:integration": "RUN_INTEGRATION=1 playwright test integration",
+ "test:live": "RUN_LIVE=1 HEADED=1 playwright test smoke.live",
+ "record:fixtures": "node --experimental-strip-types tools/record-fixtures.ts",
+ "report": "playwright show-report"
+ },
+ "devDependencies": {
+ "@playwright/test": "^1.55.0",
+ "@types/chrome": "^0.0.270",
+ "@types/node": "^22.0.0",
+ "esbuild": "^0.24.0",
+ "typescript": "^5.6.0",
+ "vitest": "^4.1.0"
+ }
+}
diff --git a/browser-extension/playwright.config.ts b/browser-extension/playwright.config.ts
new file mode 100644
index 00000000..ef9329f8
--- /dev/null
+++ b/browser-extension/playwright.config.ts
@@ -0,0 +1,23 @@
+import { defineConfig } from '@playwright/test';
+
+/**
+ * Playwright config tuned for Manifest V3 extension testing.
+ *
+ * - No `projects` with the usual `devices` — extensions require a persistent
+ * context that we build by hand in e2e/fixtures.ts, so the browser launch
+ * lives there, not here.
+ * - `trace`/`video` on failure give me artifacts to self-diagnose without a human.
+ */
+export default defineConfig({
+ testDir: './e2e',
+ fullyParallel: false, // one persistent Chromium profile at a time keeps state clean
+ forbidOnly: !!process.env.CI,
+ retries: process.env.CI ? 1 : 0,
+ workers: 1,
+ reporter: [['list'], ['html', { open: 'never' }]],
+ use: {
+ trace: 'retain-on-failure',
+ video: 'retain-on-failure',
+ screenshot: 'only-on-failure',
+ },
+});
diff --git a/browser-extension/src/adapters/adapter.ts b/browser-extension/src/adapters/adapter.ts
new file mode 100644
index 00000000..aa537785
--- /dev/null
+++ b/browser-extension/src/adapters/adapter.ts
@@ -0,0 +1,42 @@
+// SiteAdapter interface + registry. This is the ONLY place site-specific
+// knowledge lives. Everything downstream consumes the canonical ChatTurn.
+
+import type { ChatTurn, SiteName } from '../shared/types.js';
+
+/** Stateful, per-request parser that turns raw SSE/request data into a ChatTurn. */
+export interface TurnParser {
+ /** Called once with the outbound request (prompt lives in the body). */
+ onRequest(url: string, method: string, body: string | null): void;
+ /** Called for each raw SSE chunk from the response stream. */
+ onChunk(chunk: string): void;
+ /** Called when the stream ends (cleanly or aborted). */
+ onDone(): void;
+ /** Best-effort snapshot of the turn so far (null if nothing captured yet). */
+ getTurn(): ChatTurn | null;
+}
+
+export interface SiteAdapter {
+ name: SiteName;
+ matchesHost(host: string): boolean;
+ /** Whether this request is a chat completion worth capturing. */
+ matchesRequest(url: string, method: string): boolean;
+ createParser(): TurnParser;
+}
+
+const registry: SiteAdapter[] = [];
+
+export function registerAdapter(a: SiteAdapter): void {
+ registry.push(a);
+}
+
+export function adapterForHost(host: string): SiteAdapter | undefined {
+ return registry.find((a) => a.matchesHost(host));
+}
+
+/** Permissive request predicate for the MAIN-world interceptor (which is
+ * site-agnostic). The SW's adapter makes the authoritative decision. */
+export function looksLikeChatRequest(url: string): boolean {
+ return /(\/backend-api\/conversation|\/backend-anon\/conversation|chat_conversations\/.+\/(completion|retry_completion)|\/completion\b)/.test(
+ url,
+ );
+}
diff --git a/browser-extension/src/adapters/claude.ts b/browser-extension/src/adapters/claude.ts
new file mode 100644
index 00000000..840cb1cf
--- /dev/null
+++ b/browser-extension/src/adapters/claude.ts
@@ -0,0 +1,208 @@
+// Claude (claude.ai) adapter. Parses the streamed response into a ChatTurn.
+//
+// claude.ai streams Server-Sent Events whose `data:` payloads are Anthropic
+// streaming objects keyed by `type`:
+// message_start { message: { model, usage:{input_tokens} } }
+// content_block_start { index, content_block:{ type:'text'|'tool_use', id?, name? } }
+// content_block_delta { index, delta:{ type:'text_delta', text } | { type:'input_json_delta', partial_json } }
+// content_block_stop { index }
+// message_delta { delta:{ stop_reason }, usage:{ output_tokens } }
+// message_stop
+// A legacy shape ({ completion: "…delta" }) is also tolerated.
+//
+// The exact claude.ai envelope must be confirmed against recorded live traffic
+// (the live-smoke drift alarm exists for exactly this); the parser is written
+// defensively so minor wrapping differences degrade gracefully.
+
+import type { ChatTurn, Msg, ToolCall } from '../shared/types.js';
+import { registerAdapter, type SiteAdapter, type TurnParser } from './adapter.js';
+import { SSEParser } from './sse.js';
+import { turnId } from '../shared/ids.js';
+
+class ClaudeParser implements TurnParser {
+ private sse = new SSEParser();
+ private sessionId = '';
+ private model?: string;
+ private promptText = '';
+ private inputMessages: Msg[] = [];
+ private responseText = '';
+ private inputTokens?: number;
+ private outputTokens?: number;
+ private startedAt = Date.now();
+ private completedAt?: number;
+ private reqId: number;
+ // tool_use blocks keyed by content-block index.
+ private blocks = new Map<number, { type: string; tool?: ToolCall; argBuf: string }>();
+
+ constructor(reqId: number) {
+ this.reqId = reqId;
+ }
+
+ onRequest(url: string, _method: string, body: string | null): void {
+ this.sessionId = conversationIdFromUrl(url) ?? this.sessionId;
+ if (!body) return;
+ try {
+ const parsed = JSON.parse(body);
+ const { text, messages } = extractPrompt(parsed);
+ this.promptText = text;
+ this.inputMessages = messages;
+ if (typeof parsed?.model === 'string') this.model = parsed.model;
+ if (typeof parsed?.conversation_id === 'string' && !this.sessionId)
+ this.sessionId = parsed.conversation_id;
+ } catch {
+ // Non-JSON body — leave prompt empty; DOM fallback may fill it later.
+ }
+ }
+
+ onChunk(chunk: string): void {
+ for (const evt of this.sse.push(chunk)) this.handle(evt.data);
+ }
+
+ onDone(): void {
+ for (const evt of this.sse.flush()) this.handle(evt.data);
+ if (this.completedAt == null) this.completedAt = undefined; // stayed partial
+ }
+
+ private handle(data: string): void {
+ if (!data || data === '[DONE]') return;
+ let obj: any;
+ try {
+ obj = JSON.parse(data);
+ } catch {
+ return;
+ }
+
+ // Legacy delta shape.
+ if (typeof obj.completion === 'string' && obj.type == null) {
+ this.responseText += obj.completion;
+ if (obj.stop_reason) this.completedAt = Date.now();
+ return;
+ }
+
+ switch (obj.type) {
+ case 'message_start': {
+ const m = obj.message ?? {};
+ if (typeof m.model === 'string') this.model = m.model;
+ if (typeof m.id === 'string' && !this.sessionId) this.sessionId = m.id;
+ if (typeof m.usage?.input_tokens === 'number') this.inputTokens = m.usage.input_tokens;
+ break;
+ }
+ case 'content_block_start': {
+ const cb = obj.content_block ?? {};
+ const entry = { type: cb.type ?? 'text', argBuf: '' } as {
+ type: string;
+ tool?: ToolCall;
+ argBuf: string;
+ };
+ if (cb.type === 'tool_use') {
+ entry.tool = { id: String(cb.id ?? ''), name: String(cb.name ?? '') };
+ }
+ this.blocks.set(obj.index ?? this.blocks.size, entry);
+ break;
+ }
+ case 'content_block_delta': {
+ const d = obj.delta ?? {};
+ if (d.type === 'text_delta' && typeof d.text === 'string') {
+ this.responseText += d.text;
+ } else if (d.type === 'input_json_delta' && typeof d.partial_json === 'string') {
+ const entry = this.blocks.get(obj.index);
+ if (entry) entry.argBuf += d.partial_json;
+ }
+ break;
+ }
+ case 'message_delta': {
+ if (typeof obj.usage?.output_tokens === 'number') this.outputTokens = obj.usage.output_tokens;
+ break;
+ }
+ case 'message_stop': {
+ this.completedAt = Date.now();
+ break;
+ }
+ }
+ }
+
+ getTurn(): ChatTurn | null {
+ if (!this.responseText && this.blocks.size === 0 && !this.promptText) return null;
+ const toolCalls: ToolCall[] = [];
+ for (const entry of this.blocks.values()) {
+ if (entry.tool) {
+ let args: unknown = entry.argBuf;
+ try {
+ args = entry.argBuf ? JSON.parse(entry.argBuf) : undefined;
+ } catch {
+ /* keep raw string */
+ }
+ toolCalls.push({ ...entry.tool, arguments: args });
+ }
+ }
+ const sessionId = this.sessionId || `claude-${this.reqId}`;
+ return {
+ site: 'claude_web',
+ sessionId,
+ turnId: turnId(sessionId, this.reqId),
+ requestModel: this.model,
+ responseModel: this.model,
+ promptText: this.promptText,
+ inputMessages: this.inputMessages,
+ outputMessages: [{ role: 'assistant', text: this.responseText }],
+ responseText: this.responseText,
+ toolCalls,
+ usage: { inputTokens: this.inputTokens, outputTokens: this.outputTokens },
+ startedAt: this.startedAt,
+ completedAt: this.completedAt,
+ captureMode: 'sse',
+ };
+ }
+}
+
+function conversationIdFromUrl(url: string): string | undefined {
+ const m = url.match(/chat_conversations\/([0-9a-f-]{16,})/i);
+ return m?.[1];
+}
+
+/** Pull prompt text + input messages from a variety of request-body shapes. */
+function extractPrompt(body: any): { text: string; messages: Msg[] } {
+ const messages: Msg[] = [];
+ let text = '';
+ if (typeof body?.prompt === 'string') {
+ text = body.prompt;
+ messages.push({ role: 'user', text });
+ } else if (Array.isArray(body?.messages)) {
+ for (const m of body.messages) {
+ const t = coerceContent(m?.content);
+ messages.push({ role: normalizeRole(m?.role), text: t });
+ if (m?.role === 'user') text = t;
+ }
+ }
+ return { text, messages };
+}
+
+function coerceContent(content: unknown): string {
+ if (typeof content === 'string') return content;
+ if (Array.isArray(content)) {
+ return content
+ .map((p: any) => (typeof p === 'string' ? p : typeof p?.text === 'string' ? p.text : ''))
+ .join('');
+ }
+ return '';
+}
+
+function normalizeRole(role: unknown): Msg['role'] {
+ return role === 'assistant' || role === 'system' || role === 'tool' ? role : 'user';
+}
+
+export const claudeAdapter: SiteAdapter = {
+ name: 'claude_web',
+ matchesHost: (host) => host === 'claude.ai' || host.endsWith('.claude.ai'),
+ matchesRequest: (url, method) =>
+ /chat_conversations\/.+\/(completion|retry_completion)/.test(url) &&
+ method.toUpperCase() === 'POST',
+ createParser: () => new ClaudeParser(nextReqId()),
+};
+
+let reqCounter = 0;
+function nextReqId(): number {
+ return ++reqCounter;
+}
+
+registerAdapter(claudeAdapter);
diff --git a/browser-extension/src/adapters/sse.ts b/browser-extension/src/adapters/sse.ts
new file mode 100644
index 00000000..10bb83ca
--- /dev/null
+++ b/browser-extension/src/adapters/sse.ts
@@ -0,0 +1,56 @@
+// Minimal, robust SSE frame parser. Handles chunks that split mid-line or
+// mid-event (the common source of streaming bugs), multi-line `data:` fields,
+// and CRLF. Site adapters feed raw chunks in; they get whole events out.
+
+export interface SSEEvent {
+ event: string; // the `event:` field, or 'message' if absent
+ data: string; // concatenated `data:` lines (newline-joined)
+}
+
+export class SSEParser {
+ private buffer = '';
+
+ /** Push a raw chunk; returns any complete events it produced. */
+ push(chunk: string): SSEEvent[] {
+ this.buffer += chunk;
+ const out: SSEEvent[] = [];
+ // Events are separated by a blank line. Normalize CRLF first.
+ const normalized = this.buffer.replace(/\r\n/g, '\n');
+ const frames = normalized.split('\n\n');
+ // The last element may be a partial frame — keep it buffered.
+ this.buffer = frames.pop() ?? '';
+ for (const frame of frames) {
+ const evt = parseFrame(frame);
+ if (evt) out.push(evt);
+ }
+ return out;
+ }
+
+ /** Flush any trailing buffered frame (call on stream end). */
+ flush(): SSEEvent[] {
+ if (!this.buffer.trim()) {
+ this.buffer = '';
+ return [];
+ }
+ const evt = parseFrame(this.buffer.replace(/\r\n/g, '\n'));
+ this.buffer = '';
+ return evt ? [evt] : [];
+ }
+}
+
+function parseFrame(frame: string): SSEEvent | null {
+ let event = 'message';
+ const dataLines: string[] = [];
+ for (const line of frame.split('\n')) {
+ if (line === '' || line.startsWith(':')) continue; // blank or comment
+ const idx = line.indexOf(':');
+ const field = idx === -1 ? line : line.slice(0, idx);
+ // Spec: strip one leading space after the colon.
+ let value = idx === -1 ? '' : line.slice(idx + 1);
+ if (value.startsWith(' ')) value = value.slice(1);
+ if (field === 'event') event = value;
+ else if (field === 'data') dataLines.push(value);
+ }
+ if (dataLines.length === 0 && event === 'message') return null;
+ return { event, data: dataLines.join('\n') };
+}
diff --git a/browser-extension/src/background/assembler.ts b/browser-extension/src/background/assembler.ts
new file mode 100644
index 00000000..2500c798
--- /dev/null
+++ b/browser-extension/src/background/assembler.ts
@@ -0,0 +1,57 @@
+// Accumulates raw intercept events into completed ChatTurns, one parser per
+// (tabId, reqId). No chrome.* — unit-testable. State is intentionally in-memory:
+// a stream lasts seconds and the SW is kept awake while one is active; the
+// DURABLE state (the delivery queue) lives in storage, not here.
+
+import type { ChatTurn } from '../shared/types.js';
+import type { InterceptEvent } from '../shared/types.js';
+import { adapterForHost, type SiteAdapter, type TurnParser } from '../adapters/adapter.js';
+
+interface Entry {
+ adapter: SiteAdapter;
+ parser: TurnParser;
+}
+
+export class Assembler {
+ private entries = new Map<string, Entry>();
+
+ private key(tabId: number | undefined, reqId: number): string {
+ return `${tabId ?? -1}:${reqId}`;
+ }
+
+ /** Feed one intercept event. Returns a finalized ChatTurn on 'done'/'error'. */
+ handle(host: string, tabId: number | undefined, event: InterceptEvent): ChatTurn | null {
+ const k = this.key(tabId, event.reqId);
+
+ if (event.kind === 'request') {
+ const adapter = adapterForHost(host);
+ if (!adapter || !adapter.matchesRequest(event.url, event.method)) return null;
+ const parser = adapter.createParser();
+ parser.onRequest(event.url, event.method, event.body);
+ this.entries.set(k, { adapter, parser });
+ return null;
+ }
+
+ const entry = this.entries.get(k);
+ if (!entry) return null;
+
+ switch (event.kind) {
+ case 'chunk':
+ entry.parser.onChunk(event.chunk);
+ return null;
+ case 'done':
+ case 'error': {
+ entry.parser.onDone();
+ const turn = entry.parser.getTurn();
+ this.entries.delete(k);
+ return turn;
+ }
+ }
+ return null;
+ }
+
+ /** Number of in-flight streams (used to decide SW keepalive). */
+ get active(): number {
+ return this.entries.size;
+ }
+}
diff --git a/browser-extension/src/background/delivery.ts b/browser-extension/src/background/delivery.ts
new file mode 100644
index 00000000..7c02ea33
--- /dev/null
+++ b/browser-extension/src/background/delivery.ts
@@ -0,0 +1,98 @@
+// Durable delivery queue. Normalized OTLP envelopes are persisted to
+// chrome.storage.local so nothing is lost if the SW is suspended, then POSTed
+// to the local beacon collector. Failed sends retry with exponential backoff
+// driven by chrome.alarms (which survives suspension, unlike setTimeout).
+
+import type { ChatTurn, Settings } from '../shared/types.js';
+import { turnToEnvelope } from '../shared/normalize.js';
+import type { LogsEnvelope } from '../shared/otlp.js';
+
+const QUEUE_KEY = 'delivery_queue';
+const ALARM = 'beacon_flush';
+const MAX_ATTEMPTS = 6;
+
+interface QueueItem {
+ id: string;
+ endpoint: string;
+ envelope: LogsEnvelope;
+ attempts: number;
+}
+
+async function readQueue(): Promise<QueueItem[]> {
+ const got = await chrome.storage.local.get(QUEUE_KEY);
+ return (got[QUEUE_KEY] as QueueItem[]) ?? [];
+}
+
+async function writeQueue(items: QueueItem[]): Promise<void> {
+ await chrome.storage.local.set({ [QUEUE_KEY]: items });
+}
+
+/** Normalize a turn and enqueue it for delivery, then kick a flush. */
+export async function enqueueTurn(turn: ChatTurn, settings: Settings): Promise<void> {
+ const envelope = turnToEnvelope(turn, settings.retention);
+ const item: QueueItem = {
+ id: turn.turnId,
+ endpoint: settings.endpoint,
+ envelope,
+ attempts: 0,
+ };
+ const queue = await readQueue();
+ queue.push(item);
+ await writeQueue(queue);
+ await flush();
+}
+
+/** Attempt to POST everything queued; requeue failures with backoff. */
+export async function flush(): Promise<void> {
+ const queue = await readQueue();
+ if (queue.length === 0) return;
+
+ const remaining: QueueItem[] = [];
+ let anyFailed = false;
+
+ for (const item of queue) {
+ const ok = await post(item);
+ if (!ok) {
+ item.attempts += 1;
+ if (item.attempts < MAX_ATTEMPTS) {
+ remaining.push(item);
+ anyFailed = true;
+ } // else: give up, drop it (avoid an unbounded queue)
+ }
+ }
+
+ await writeQueue(remaining);
+ if (anyFailed) scheduleRetry(remaining);
+}
+
+async function post(item: QueueItem): Promise<boolean> {
+ try {
+ const res = await fetch(item.endpoint, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify(item.envelope),
+ });
+ return res.ok;
+ } catch {
+ return false;
+ }
+}
+
+function scheduleRetry(queue: QueueItem[]): void {
+ const minAttempts = Math.min(...queue.map((i) => i.attempts));
+ // We compute an exponential backoff, but note MV3 clamps chrome.alarms to a
+ // ~30s minimum — so in practice the first retry lands at ~30s regardless of
+ // this value. That's acceptable here: the collector is a local loopback
+ // endpoint that is almost always reachable, so retries are the rare path and
+ // the durable queue (chrome.storage) guarantees eventual delivery. We use
+ // alarms rather than setTimeout because they survive service-worker suspension.
+ const backoffMs = Math.min(250 * 2 ** minAttempts, 60_000);
+ chrome.alarms.create(ALARM, { when: Date.now() + backoffMs });
+}
+
+/** Wire the alarm listener (called once from the SW entry). */
+export function installFlushAlarm(): void {
+ chrome.alarms.onAlarm.addListener((alarm) => {
+ if (alarm.name === ALARM) void flush();
+ });
+}
diff --git a/browser-extension/src/background/settings.ts b/browser-extension/src/background/settings.ts
new file mode 100644
index 00000000..d11ee626
--- /dev/null
+++ b/browser-extension/src/background/settings.ts
@@ -0,0 +1,31 @@
+// Storage-backed settings with defaults. Lives in chrome.storage.local so it
+// survives service-worker suspension.
+
+import { DEFAULT_SETTINGS, type Settings, type SiteName } from '../shared/types.js';
+
+const KEY = 'settings';
+
+export async function getSettings(): Promise<Settings> {
+ const got = await chrome.storage.local.get(KEY);
+ const stored = (got[KEY] ?? {}) as Partial<Settings>;
+ return {
+ ...DEFAULT_SETTINGS,
+ ...stored,
+ sites: { ...DEFAULT_SETTINGS.sites, ...(stored.sites ?? {}) },
+ };
+}
+
+export async function saveSettings(patch: Partial<Settings>): Promise<Settings> {
+ const current = await getSettings();
+ const next: Settings = {
+ ...current,
+ ...patch,
+ sites: { ...current.sites, ...(patch.sites ?? {}) },
+ };
+ await chrome.storage.local.set({ [KEY]: next });
+ return next;
+}
+
+export function siteEnabled(settings: Settings, site: SiteName): boolean {
+ return settings.enabled && settings.sites[site] !== false;
+}
diff --git a/browser-extension/src/background/sw.ts b/browser-extension/src/background/sw.ts
new file mode 100644
index 00000000..5d28274d
--- /dev/null
+++ b/browser-extension/src/background/sw.ts
@@ -0,0 +1,78 @@
+// Service-worker entry. Wires message handling, assembles turns, and hands
+// completed turns to the durable delivery queue.
+
+import '../adapters/claude.js'; // registers the Claude adapter (side effect)
+import type { RelayMessage, Settings } from '../shared/types.js';
+import { getSettings, saveSettings, siteEnabled } from './settings.js';
+import { Assembler } from './assembler.js';
+import { enqueueTurn, flush, installFlushAlarm } from './delivery.js';
+
+const assembler = new Assembler();
+
+// Keep the SW awake while any stream is active, so mid-stream suspension is
+// rare. Correctness never depends on this — durable state covers the rest.
+let keepAliveTimer: ReturnType<typeof setInterval> | undefined;
+function updateKeepAlive(): void {
+ if (assembler.active > 0 && keepAliveTimer == null) {
+ keepAliveTimer = setInterval(() => chrome.runtime.getPlatformInfo(() => {}), 20_000);
+ } else if (assembler.active === 0 && keepAliveTimer != null) {
+ clearInterval(keepAliveTimer);
+ keepAliveTimer = undefined;
+ }
+}
+
+chrome.runtime.onInstalled.addListener(() => {
+ void saveSettings({}); // materialize defaults
+});
+
+installFlushAlarm();
+
+chrome.runtime.onMessage.addListener((msg: RelayMessage | ControlMessage, sender, sendResponse) => {
+ if (isControl(msg)) {
+ handleControl(msg).then(sendResponse);
+ return true; // async response
+ }
+ if (msg?.type === 'BEACON_RAW') {
+ handleRaw(msg, sender.tab?.id);
+ return false;
+ }
+ return false;
+});
+
+async function handleRaw(msg: RelayMessage, tabId: number | undefined): Promise<void> {
+ const settings = await getSettings();
+ if (!settings.enabled) return;
+
+ const turn = assembler.handle(msg.host, tabId, msg.event);
+ updateKeepAlive();
+ if (!turn) return;
+ if (!siteEnabled(settings, turn.site)) return;
+
+ await enqueueTurn(turn, settings);
+}
+
+// ---- Control messages from popup/options ----
+
+type ControlMessage =
+ | { type: 'GET_STATUS' }
+ | { type: 'SET_SETTINGS'; patch: Partial<Settings> }
+ | { type: 'FLUSH_NOW' };
+
+function isControl(msg: any): msg is ControlMessage {
+ return msg?.type === 'GET_STATUS' || msg?.type === 'SET_SETTINGS' || msg?.type === 'FLUSH_NOW';
+}
+
+async function handleControl(msg: ControlMessage): Promise<unknown> {
+ switch (msg.type) {
+ case 'GET_STATUS': {
+ const settings = await getSettings();
+ const q = await chrome.storage.local.get('delivery_queue');
+ return { settings, queueDepth: (q.delivery_queue ?? []).length, active: assembler.active };
+ }
+ case 'SET_SETTINGS':
+ return { settings: await saveSettings(msg.patch) };
+ case 'FLUSH_NOW':
+ await flush();
+ return { ok: true };
+ }
+}
diff --git a/browser-extension/src/content/content.ts b/browser-extension/src/content/content.ts
new file mode 100644
index 00000000..f57f3947
--- /dev/null
+++ b/browser-extension/src/content/content.ts
@@ -0,0 +1,54 @@
+// ISOLATED-world content script. The bridge between the page (MAIN interceptor)
+// and the extension service worker. Deliberately thin: validate the message
+// origin, then forward raw intercept events to the SW. All parsing/normalizing
+// happens in the SW so this script stays resistant to page interference.
+
+import { BEACON_MSG, type BeaconWindowMessage, type RelayMessage } from '../shared/types.js';
+
+/**
+ * True only when the extension context this content script belongs to is still
+ * alive. After the extension is reloaded/updated, previously-injected content
+ * scripts in already-open tabs are orphaned: `chrome.runtime` is torn down and
+ * touching `.sendMessage` throws. Guarding here degrades gracefully (a tab
+ * refresh re-injects a fresh, connected content script).
+ */
+function extensionAlive(): boolean {
+ try {
+ return typeof chrome !== 'undefined' && !!chrome.runtime && !!chrome.runtime.id;
+ } catch {
+ return false;
+ }
+}
+
+let warnedInvalidated = false;
+
+window.addEventListener('message', (event: MessageEvent) => {
+ // Only trust messages from this same window/frame.
+ if (event.source !== window) return;
+ const data = event.data as BeaconWindowMessage | undefined;
+ if (!data || data.source !== BEACON_MSG) return;
+
+ if (!extensionAlive()) {
+ if (!warnedInvalidated) {
+ warnedInvalidated = true;
+ // eslint-disable-next-line no-console
+ console.debug('[agent-beacon] extension context invalidated; refresh this tab to resume capture.');
+ }
+ return;
+ }
+
+ const relay: RelayMessage = {
+ type: 'BEACON_RAW',
+ host: window.location.host,
+ event: data.event,
+ };
+ // Fire-and-forget; the SW may be asleep and will wake to handle it. Wrap in
+ // try/catch in case the context is invalidated between the check and the call.
+ try {
+ void chrome.runtime.sendMessage(relay).catch(() => {
+ /* SW not ready / extension reloading — safe to drop a single event */
+ });
+ } catch {
+ /* context invalidated mid-flight */
+ }
+});
diff --git a/browser-extension/src/interceptor/interceptor.ts b/browser-extension/src/interceptor/interceptor.ts
new file mode 100644
index 00000000..83d20ee9
--- /dev/null
+++ b/browser-extension/src/interceptor/interceptor.ts
@@ -0,0 +1,80 @@
+// MAIN-world interceptor. Runs in the page's own JS context (injected as a file
+// via a world:"MAIN" content script, which satisfies ChatGPT's CSP since it is
+// not inline). It monkeypatches window.fetch, clones matched streaming
+// responses so the page is completely unaffected, and posts raw SSE chunks to
+// the ISOLATED content script over window.postMessage.
+//
+// This layer is deliberately site-agnostic: it does NOT understand SSE
+// semantics. It only decides "is this a chat request worth teeing?" and relays
+// bytes. All parsing happens in the service worker via the site adapter.
+
+import { BEACON_MSG, type InterceptEvent } from '../shared/types.js';
+import { looksLikeChatRequest } from '../adapters/adapter.js';
+
+declare global {
+ interface Window {
+ __beaconInterceptorInstalled?: boolean;
+ }
+}
+
+(function install() {
+ if (window.__beaconInterceptorInstalled) return;
+ window.__beaconInterceptorInstalled = true;
+
+ let reqSeq = 0;
+ const originalFetch = window.fetch.bind(window);
+
+ function post(event: InterceptEvent): void {
+ window.postMessage({ source: BEACON_MSG, event }, window.location.origin);
+ }
+
+ window.fetch = async function beaconFetch(
+ input: RequestInfo | URL,
+ init?: RequestInit,
+ ): Promise<Response> {
+ const url =
+ typeof input === 'string' ? input : input instanceof URL ? input.href : input.url;
+ const method = (init?.method ?? (input instanceof Request ? input.method : 'GET')).toUpperCase();
+
+ const matched = looksLikeChatRequest(url);
+ const response = await originalFetch(input as RequestInfo, init);
+
+ if (matched && response.body) {
+ const reqId = ++reqSeq;
+ // Capture request body if it is a simple string (claude.ai/ChatGPT both
+ // send JSON string bodies for completions).
+ const body = typeof init?.body === 'string' ? init.body : null;
+ post({ kind: 'request', reqId, url, method, body });
+
+ // Tee the stream via a clone so the page's own reader is untouched.
+ const clone = response.clone();
+ teeStream(clone, reqId, post).catch((err) =>
+ post({ kind: 'error', reqId, message: String(err) }),
+ );
+ }
+
+ return response;
+ } as typeof window.fetch;
+})();
+
+async function teeStream(
+ response: Response,
+ reqId: number,
+ post: (e: InterceptEvent) => void,
+): Promise<void> {
+ const reader = response.body!.getReader();
+ const decoder = new TextDecoder();
+ try {
+ for (;;) {
+ const { done, value } = await reader.read();
+ if (done) break;
+ const chunk = decoder.decode(value, { stream: true });
+ if (chunk) post({ kind: 'chunk', reqId, chunk });
+ }
+ const tail = decoder.decode();
+ if (tail) post({ kind: 'chunk', reqId, chunk: tail });
+ post({ kind: 'done', reqId });
+ } finally {
+ reader.releaseLock();
+ }
+}
diff --git a/browser-extension/src/manifest.json b/browser-extension/src/manifest.json
new file mode 100644
index 00000000..254a78da
--- /dev/null
+++ b/browser-extension/src/manifest.json
@@ -0,0 +1,42 @@
+{
+ "manifest_version": 3,
+ "name": "Agent Beacon — Browser Collector",
+ "version": "0.1.0",
+ "description": "Relays LLM chat telemetry (Claude, ChatGPT) into the local Agent Beacon pipeline.",
+ "permissions": ["storage", "alarms", "scripting"],
+ "host_permissions": [
+ "*://claude.ai/*",
+ "*://chatgpt.com/*",
+ "*://chat.openai.com/*",
+ "http://127.0.0.1:4318/*",
+ "http://localhost:4318/*"
+ ],
+ "background": {
+ "service_worker": "sw.js"
+ },
+ "action": {
+ "default_popup": "popup.html",
+ "default_title": "Agent Beacon Collector"
+ },
+ "options_page": "options.html",
+ "content_scripts": [
+ {
+ "matches": ["*://claude.ai/*", "*://chatgpt.com/*", "*://chat.openai.com/*"],
+ "js": ["interceptor.js"],
+ "run_at": "document_start",
+ "world": "MAIN"
+ },
+ {
+ "matches": ["*://claude.ai/*", "*://chatgpt.com/*", "*://chat.openai.com/*"],
+ "js": ["content.js"],
+ "run_at": "document_start",
+ "world": "ISOLATED"
+ }
+ ],
+ "web_accessible_resources": [
+ {
+ "resources": ["interceptor.js"],
+ "matches": ["*://claude.ai/*", "*://chatgpt.com/*", "*://chat.openai.com/*"]
+ }
+ ]
+}
diff --git a/browser-extension/src/options/options.html b/browser-extension/src/options/options.html
new file mode 100644
index 00000000..c6bf9f17
--- /dev/null
+++ b/browser-extension/src/options/options.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <style>
+ body { max-width: 520px; margin: 24px auto; padding: 0 16px; font: 14px system-ui, sans-serif; color: #111; }
+ h1 { font-size: 18px; }
+ label { display: block; margin: 14px 0 4px; font-weight: 600; }
+ input[type="text"] { width: 100%; padding: 6px 8px; font: inherit; box-sizing: border-box; }
+ .site { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 6px 0; }
+ button { margin-top: 16px; padding: 8px 14px; font: inherit; }
+ .saved { color: #2a7; margin-left: 10px; }
+ </style>
+ </head>
+ <body>
+ <h1>Agent Beacon — Browser Collector</h1>
+
+ <label for="endpoint">OTLP logs endpoint</label>
+ <input type="text" id="endpoint" data-testid="endpoint" />
+
+ <label>Sites</label>
+ <div class="site"><input type="checkbox" id="site_claude_web" /><span>claude.ai</span></div>
+ <div class="site"><input type="checkbox" id="site_chatgpt_web" /><span>chatgpt.com</span></div>
+
+ <div>
+ <button id="save">Save</button>
+ <span class="saved" id="saved" hidden>Saved ✓</span>
+ </div>
+
+ <script src="options.js"></script>
+ </body>
+</html>
diff --git a/browser-extension/src/options/options.ts b/browser-extension/src/options/options.ts
new file mode 100644
index 00000000..5d925293
--- /dev/null
+++ b/browser-extension/src/options/options.ts
@@ -0,0 +1,29 @@
+// Options UI: endpoint override + per-site enable.
+import type { Settings } from '../shared/types.js';
+
+const $ = <T extends HTMLElement>(id: string) => document.getElementById(id) as T;
+
+async function load(): Promise<void> {
+ const { settings } = (await chrome.runtime.sendMessage({ type: 'GET_STATUS' })) as {
+ settings: Settings;
+ };
+ ($('endpoint') as HTMLInputElement).value = settings.endpoint;
+ ($('site_claude_web') as HTMLInputElement).checked = settings.sites.claude_web !== false;
+ ($('site_chatgpt_web') as HTMLInputElement).checked = settings.sites.chatgpt_web !== false;
+}
+
+$('save').addEventListener('click', async () => {
+ const patch: Partial<Settings> = {
+ endpoint: ($('endpoint') as HTMLInputElement).value.trim(),
+ sites: {
+ claude_web: ($('site_claude_web') as HTMLInputElement).checked,
+ chatgpt_web: ($('site_chatgpt_web') as HTMLInputElement).checked,
+ },
+ };
+ await chrome.runtime.sendMessage({ type: 'SET_SETTINGS', patch });
+ const saved = $('saved');
+ saved.hidden = false;
+ setTimeout(() => (saved.hidden = true), 1500);
+});
+
+void load();
diff --git a/browser-extension/src/popup/popup.html b/browser-extension/src/popup/popup.html
new file mode 100644
index 00000000..b6c4db4f
--- /dev/null
+++ b/browser-extension/src/popup/popup.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <style>
+ body { width: 260px; margin: 0; padding: 14px; font: 13px system-ui, sans-serif; color: #111; }
+ h1 { font-size: 14px; margin: 0 0 10px; }
+ .row { display: flex; align-items: center; justify-content: space-between; margin: 8px 0; }
+ .muted { color: #666; font-size: 12px; }
+ select, button { font: inherit; }
+ .status { margin-top: 10px; padding-top: 10px; border-top: 1px solid #eee; }
+ </style>
+ </head>
+ <body>
+ <h1>Agent Beacon — Browser Collector</h1>
+ <div class="row">
+ <label for="enabled">Capture enabled</label>
+ <input type="checkbox" id="enabled" />
+ </div>
+ <div class="row">
+ <label for="retention">Content retention</label>
+ <select id="retention">
+ <option value="full">Full</option>
+ <option value="redacted">Redacted</option>
+ <option value="metadata">Metadata only</option>
+ </select>
+ </div>
+ <div class="status muted">
+ <div>Endpoint: <span id="endpoint" data-testid="endpoint">…</span></div>
+ <div>Queue depth: <span id="queue" data-testid="queue">…</span></div>
+ <div>Active streams: <span id="active" data-testid="active">…</span></div>
+ </div>
+ <script src="popup.js"></script>
+ </body>
+</html>
diff --git a/browser-extension/src/popup/popup.ts b/browser-extension/src/popup/popup.ts
new file mode 100644
index 00000000..9ccdc1d5
--- /dev/null
+++ b/browser-extension/src/popup/popup.ts
@@ -0,0 +1,37 @@
+// Popup UI: toggle capture, choose retention, show live status.
+import type { Settings } from '../shared/types.js';
+
+interface Status {
+ settings: Settings;
+ queueDepth: number;
+ active: number;
+}
+
+const $ = <T extends HTMLElement>(id: string) => document.getElementById(id) as T;
+
+async function refresh(): Promise<void> {
+ const status = (await chrome.runtime.sendMessage({ type: 'GET_STATUS' })) as Status;
+ ($('enabled') as HTMLInputElement).checked = status.settings.enabled;
+ ($('retention') as HTMLSelectElement).value = status.settings.retention;
+ $('endpoint').textContent = status.settings.endpoint;
+ $('queue').textContent = String(status.queueDepth);
+ $('active').textContent = String(status.active);
+}
+
+$('enabled').addEventListener('change', async (e) => {
+ await chrome.runtime.sendMessage({
+ type: 'SET_SETTINGS',
+ patch: { enabled: (e.target as HTMLInputElement).checked },
+ });
+ await refresh();
+});
+
+$('retention').addEventListener('change', async (e) => {
+ await chrome.runtime.sendMessage({
+ type: 'SET_SETTINGS',
+ patch: { retention: (e.target as HTMLSelectElement).value as Settings['retention'] },
+ });
+ await refresh();
+});
+
+void refresh();
diff --git a/browser-extension/src/shared/ids.ts b/browser-extension/src/shared/ids.ts
new file mode 100644
index 00000000..1befc8b0
--- /dev/null
+++ b/browser-extension/src/shared/ids.ts
@@ -0,0 +1,15 @@
+// Correlation id helpers. Kept deterministic and dependency-free so both the
+// service worker and unit tests can use them without a DOM/crypto polyfill.
+
+/**
+ * Derive a stable turn id from a conversation id and the request sequence.
+ * Deterministic so retried/duplicate deliveries can be de-duped downstream.
+ */
+export function turnId(sessionId: string, reqId: number): string {
+ return `${sessionId}:${reqId}`;
+}
+
+/** A per-record idempotency key for dedupe across delivery retries. */
+export function recordId(turnId: string, action: string, index = 0): string {
+ return `${turnId}#${action}#${index}`;
+}
diff --git a/browser-extension/src/shared/normalize.ts b/browser-extension/src/shared/normalize.ts
new file mode 100644
index 00000000..c93f907c
--- /dev/null
+++ b/browser-extension/src/shared/normalize.ts
@@ -0,0 +1,211 @@
+// PURE: ChatTurn -> normalized OTLP log records for the beacon collector.
+// No I/O, no globals, no chrome.* — this is the primary unit-tested seam.
+//
+// The collector's beaconjson exporter fills vendor/product/schema_version/
+// endpoint/user/timestamp itself, so we MUST NOT emit those. We emit the
+// beacon.* + gen_ai.* attributes that converter.go maps into the Event schema.
+
+import type { ChatTurn, Retention, ToolCall } from './types.js';
+import {
+ type KeyValue,
+ type LogRecord,
+ buildLogsEnvelope,
+ bool,
+ int,
+ msToUnixNano,
+ str,
+} from './otlp.js';
+import {
+ type EventAction,
+ MAX_FIELD_BYTES,
+ ORIGIN,
+ SERVICE_NAME,
+ categoryFor,
+ providerFor,
+ severityNumber,
+} from './vocab.js';
+import { recordId, turnId } from './ids.js';
+
+export interface NormalizedTurn {
+ resourceAttributes: KeyValue[];
+ logRecords: LogRecord[];
+}
+
+const encoder = new TextEncoder();
+
+/** Truncate a string to a UTF-8 byte budget; returns [text, wasTruncated]. */
+function capBytes(text: string, max = MAX_FIELD_BYTES): [string, boolean] {
+ if (encoder.encode(text).length <= max) return [text, false];
+ // Binary-search the largest prefix that fits (chars ≠ bytes for multibyte).
+ let lo = 0;
+ let hi = text.length;
+ while (lo < hi) {
+ const mid = (lo + hi + 1) >> 1;
+ if (encoder.encode(text.slice(0, mid)).length <= max) lo = mid;
+ else hi = mid - 1;
+ }
+ return [text.slice(0, lo), true];
+}
+
+/** Light client-side scrubber for retention=redacted (defense in depth; the
+ * collector also redacts). Masks emails and long token-like strings. */
+function scrub(text: string): string {
+ return text
+ .replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g, '[email]')
+ .replace(/\b(sk|pk|ghp|xox[baprs]|AKIA)[A-Za-z0-9_-]{12,}\b/g, '[token]');
+}
+
+interface Shaped {
+ text: string;
+ truncated: boolean;
+}
+
+/** Apply retention + size cap to a text field. Returns null when the field
+ * must be dropped entirely (metadata retention). */
+function shapeText(text: string, retention: Retention): Shaped | null {
+ if (retention === 'metadata') return null;
+ const shown = retention === 'redacted' ? scrub(text) : text;
+ const [capped, truncated] = capBytes(shown);
+ return { text: capped, truncated };
+}
+
+/**
+ * Normalize a chat turn into 1..N OTLP log records:
+ * - one response record (agent.response.completed, or agent.response if partial)
+ * - one tool.invoked record per captured tool call
+ */
+export function normalizeTurn(turn: ChatTurn, retention: Retention): NormalizedTurn {
+ const resourceAttributes: KeyValue[] = [
+ str('beacon.origin', ORIGIN),
+ str('beacon.harness.name', turn.site),
+ str('service.name', SERVICE_NAME),
+ str('gen_ai.provider.name', providerFor(turn.site)),
+ ];
+
+ const tid = turn.turnId || turnId(turn.sessionId, 0);
+ const startNano = msToUnixNano(turn.startedAt);
+ const endNano = msToUnixNano(turn.completedAt ?? turn.startedAt);
+ const logRecords: LogRecord[] = [];
+
+ // Correlation attrs shared by every record in the turn.
+ const base = (action: EventAction, index = 0): KeyValue[] => [
+ str('beacon.event.action', action),
+ str('beacon.event.category', categoryFor(action)),
+ str('beacon.session.id', turn.sessionId),
+ str('gen_ai.conversation.id', turn.sessionId),
+ str('beacon.content.retention', retention),
+ str('beacon.record.id', recordId(tid, action, index)),
+ str('beacon.capture.mode', turn.captureMode),
+ ];
+
+ // ---- prompt.submitted ----
+ // Emitted as its own event with category "prompt" so the collector's
+ // converter lifts the text into the top-level Event.prompt.text field (it
+ // only does so for prompt-category events). Without this, the prompt stays
+ // buried in raw.attributes and never reaches the queryable prompt.text column.
+ const prompt = shapeText(turn.promptText, retention);
+ const inputMsgs = shapeText(JSON.stringify(turn.inputMessages), retention);
+ if (prompt || inputMsgs) {
+ const attrs = base('prompt.submitted');
+ if (turn.requestModel) attrs.push(str('gen_ai.request.model', turn.requestModel));
+ let truncated = false;
+ if (prompt) {
+ attrs.push(str('beacon.prompt.text', prompt.text));
+ truncated ||= prompt.truncated;
+ }
+ if (inputMsgs) {
+ attrs.push(str('gen_ai.input.messages', inputMsgs.text));
+ truncated ||= inputMsgs.truncated;
+ }
+ if (truncated) attrs.push(bool('beacon.field_truncated', true));
+ logRecords.push({
+ timeUnixNano: startNano,
+ severityNumber: severityNumber('info'),
+ severityText: 'INFO',
+ body: { stringValue: `${turn.site} prompt.submitted` },
+ attributes: attrs,
+ });
+ }
+
+ // ---- agent.response(.completed) ----
+ const completed = turn.completedAt != null;
+ const respAction: EventAction = completed ? 'agent.response.completed' : 'agent.response';
+ const respAttrs = base(respAction);
+ if (turn.requestModel) respAttrs.push(str('gen_ai.request.model', turn.requestModel));
+ if (turn.responseModel) respAttrs.push(str('gen_ai.response.model', turn.responseModel));
+ if (turn.usage?.inputTokens != null)
+ respAttrs.push(int('gen_ai.usage.input_tokens', turn.usage.inputTokens));
+ if (turn.usage?.outputTokens != null)
+ respAttrs.push(int('gen_ai.usage.output_tokens', turn.usage.outputTokens));
+
+ let respTrunc = false;
+ const outputMsgs = shapeText(JSON.stringify(turn.outputMessages), retention);
+ if (outputMsgs) {
+ respAttrs.push(str('gen_ai.output.messages', outputMsgs.text));
+ respTrunc ||= outputMsgs.truncated;
+ }
+ // Always-available metadata (survives metadata retention).
+ respAttrs.push(int('beacon.response.chars', turn.responseText.length));
+ respAttrs.push(int('beacon.tool_calls.count', turn.toolCalls.length));
+ if (respTrunc) respAttrs.push(bool('beacon.field_truncated', true));
+
+ logRecords.push({
+ timeUnixNano: endNano,
+ severityNumber: severityNumber('info'),
+ severityText: 'INFO',
+ body: { stringValue: `${turn.site} ${respAction}` },
+ attributes: respAttrs,
+ });
+
+ // ---- tool.invoked ----
+ turn.toolCalls.forEach((tool, i) => {
+ logRecords.push(toolRecord(turn, tool, i, retention, endNano));
+ });
+
+ return { resourceAttributes, logRecords };
+}
+
+function toolRecord(
+ turn: ChatTurn,
+ tool: ToolCall,
+ index: number,
+ retention: Retention,
+ when: string,
+): LogRecord {
+ const tid = turn.turnId || turnId(turn.sessionId, 0);
+ const action: EventAction = 'tool.invoked';
+ const attrs: KeyValue[] = [
+ str('beacon.event.action', action),
+ str('beacon.event.category', categoryFor(action)),
+ str('beacon.session.id', turn.sessionId),
+ str('gen_ai.conversation.id', turn.sessionId),
+ str('beacon.content.retention', retention),
+ str('beacon.record.id', recordId(tid, action, index)),
+ str('tool.name', tool.name),
+ str('gen_ai.tool.call.id', tool.id),
+ str('gen_ai.tool.call.name', tool.name),
+ ];
+ const args = shapeText(stringify(tool.arguments), retention);
+ if (args) attrs.push(str('gen_ai.tool.call.arguments', args.text));
+ if (tool.result !== undefined) {
+ const res = shapeText(stringify(tool.result), retention);
+ if (res) attrs.push(str('gen_ai.tool.call.result', res.text));
+ }
+ return {
+ timeUnixNano: when,
+ severityNumber: severityNumber('info'),
+ severityText: 'INFO',
+ body: { stringValue: `${turn.site} ${action} ${tool.name}` },
+ attributes: attrs,
+ };
+}
+
+function stringify(v: unknown): string {
+ return typeof v === 'string' ? v : JSON.stringify(v ?? null);
+}
+
+/** Convenience: normalize straight into a single OTLP logs envelope. */
+export function turnToEnvelope(turn: ChatTurn, retention: Retention) {
+ const { resourceAttributes, logRecords } = normalizeTurn(turn, retention);
+ return buildLogsEnvelope(resourceAttributes, logRecords, SERVICE_NAME);
+}
diff --git a/browser-extension/src/shared/otlp.ts b/browser-extension/src/shared/otlp.ts
new file mode 100644
index 00000000..9644ed29
--- /dev/null
+++ b/browser-extension/src/shared/otlp.ts
@@ -0,0 +1,78 @@
+// OTLP/HTTP JSON (logs) envelope builders + attribute coercion.
+// Reference: OpenTelemetry OTLP/JSON encoding. int64 values are encoded as
+// strings ("intValue": "42") per the proto3 JSON mapping — the collector and
+// our tests both rely on this.
+
+export type AnyValue =
+ | { stringValue: string }
+ | { intValue: string }
+ | { doubleValue: number }
+ | { boolValue: boolean };
+
+export interface KeyValue {
+ key: string;
+ value: AnyValue;
+}
+
+export interface LogRecord {
+ timeUnixNano: string;
+ severityNumber: number;
+ severityText: string;
+ body: AnyValue;
+ attributes: KeyValue[];
+}
+
+export interface LogsEnvelope {
+ resourceLogs: Array<{
+ resource: { attributes: KeyValue[] };
+ scopeLogs: Array<{
+ scope: { name: string };
+ logRecords: LogRecord[];
+ }>;
+ }>;
+}
+
+export function str(key: string, value: string): KeyValue {
+ return { key, value: { stringValue: value } };
+}
+
+/** int64 attribute — encoded as a string per OTLP/JSON. */
+export function int(key: string, value: number): KeyValue {
+ return { key, value: { intValue: String(Math.trunc(value)) } };
+}
+
+export function bool(key: string, value: boolean): KeyValue {
+ return { key, value: { boolValue: value } };
+}
+
+/** epoch milliseconds → OTLP nanosecond timestamp string. */
+export function msToUnixNano(ms: number): string {
+ return String(Math.trunc(ms)) + '000000';
+}
+
+/** Look up a single attribute's primitive value (used by tests/delivery). */
+export function attrValue(attrs: KeyValue[], key: string): string | number | boolean | undefined {
+ const kv = attrs.find((a) => a.key === key);
+ if (!kv) return undefined;
+ const v = kv.value;
+ if ('stringValue' in v) return v.stringValue;
+ if ('intValue' in v) return Number(v.intValue);
+ if ('doubleValue' in v) return v.doubleValue;
+ if ('boolValue' in v) return v.boolValue;
+ return undefined;
+}
+
+export function buildLogsEnvelope(
+ resourceAttributes: KeyValue[],
+ logRecords: LogRecord[],
+ scopeName: string,
+): LogsEnvelope {
+ return {
+ resourceLogs: [
+ {
+ resource: { attributes: resourceAttributes },
+ scopeLogs: [{ scope: { name: scopeName }, logRecords }],
+ },
+ ],
+ };
+}
diff --git a/browser-extension/src/shared/types.ts b/browser-extension/src/shared/types.ts
new file mode 100644
index 00000000..7123bd92
--- /dev/null
+++ b/browser-extension/src/shared/types.ts
@@ -0,0 +1,94 @@
+// Shared, site-agnostic types. Everything downstream of `ChatTurn` is generic;
+// only the per-site adapters know how ChatGPT vs Claude wire formats look.
+
+export type SiteName = 'claude_web' | 'chatgpt_web';
+
+export type Retention = 'metadata' | 'redacted' | 'full';
+
+/** A single chat message (user or assistant), provider-neutral. */
+export interface Msg {
+ role: 'system' | 'user' | 'assistant' | 'tool';
+ text: string;
+}
+
+export interface ToolCall {
+ id: string;
+ name: string;
+ /** Raw arguments as sent by the model (JSON string or object). */
+ arguments?: unknown;
+ /** Tool result, if the turn captured one. */
+ result?: unknown;
+}
+
+export interface Usage {
+ inputTokens?: number;
+ outputTokens?: number;
+}
+
+/**
+ * The canonical representation of one completed (or best-effort partial) chat
+ * turn. Produced by a SiteAdapter, consumed by the pure `normalizeTurn`.
+ */
+export interface ChatTurn {
+ site: SiteName;
+ /** Conversation id — becomes both beacon.session.id and gen_ai.conversation.id. */
+ sessionId: string;
+ /** Stable id for this request/response pair within the conversation. */
+ turnId: string;
+ requestModel?: string;
+ responseModel?: string;
+ promptText: string;
+ inputMessages: Msg[];
+ outputMessages: Msg[];
+ responseText: string;
+ toolCalls: ToolCall[];
+ usage?: Usage;
+ /** epoch ms */
+ startedAt: number;
+ /** epoch ms; undefined => stream never completed (aborted/partial). */
+ completedAt?: number;
+ captureMode: 'sse' | 'dom';
+ /** Trimmed raw payload for debugging; subject to the size cap. */
+ raw?: unknown;
+}
+
+export interface Settings {
+ enabled: boolean;
+ retention: Retention;
+ /** OTLP logs endpoint; defaults to the local beacon collector. */
+ endpoint: string;
+ /** Per-site enable toggles. */
+ sites: Record<SiteName, boolean>;
+}
+
+export const DEFAULT_SETTINGS: Settings = {
+ enabled: true,
+ retention: 'full',
+ endpoint: 'http://127.0.0.1:4318/v1/logs',
+ sites: { claude_web: true, chatgpt_web: true },
+};
+
+// ---- Messaging between MAIN interceptor → ISOLATED content → service worker ----
+
+/** Emitted by the MAIN-world interceptor via window.postMessage. */
+export type InterceptEvent =
+ | { kind: 'request'; reqId: number; url: string; method: string; body: string | null }
+ | { kind: 'chunk'; reqId: number; chunk: string }
+ | { kind: 'done'; reqId: number }
+ | { kind: 'error'; reqId: number; message: string };
+
+export const BEACON_MSG = '__beacon_intercept__' as const;
+
+/** Envelope posted on window by the interceptor. */
+export interface BeaconWindowMessage {
+ source: typeof BEACON_MSG;
+ event: InterceptEvent;
+}
+
+/** Sent from the content script to the service worker. */
+export interface RelayMessage {
+ type: 'BEACON_RAW';
+ host: string;
+ tabId?: number;
+ event: InterceptEvent;
+}
diff --git a/browser-extension/src/shared/vocab.ts b/browser-extension/src/shared/vocab.ts
new file mode 100644
index 00000000..d4007c3a
--- /dev/null
+++ b/browser-extension/src/shared/vocab.ts
@@ -0,0 +1,58 @@
+// The normalized event vocabulary, mirroring the beacon endpoint schema
+// (pkg/asymptoteobserve/event.go) and the actions the collector's converter.go
+// recognizes.
+
+import type { SiteName } from './types.js';
+
+export type EventAction =
+ | 'prompt.submitted'
+ | 'agent.response'
+ | 'agent.response.completed'
+ | 'tool.invoked'
+ | 'tool.completed';
+
+export type Severity = 'info' | 'low' | 'medium' | 'high' | 'critical';
+
+/** Map an action to its event.category (matches the collector's inference). */
+export function categoryFor(action: EventAction): string {
+ if (action.startsWith('prompt.')) return 'prompt';
+ if (action.startsWith('tool.')) return 'tool';
+ if (action.startsWith('agent.')) return 'agent';
+ return 'trace';
+}
+
+/** OTLP severity number for a severity text (INFO=9 per OTel spec). */
+export function severityNumber(sev: Severity): number {
+ switch (sev) {
+ case 'info':
+ return 9;
+ case 'low':
+ return 5;
+ case 'medium':
+ return 13;
+ case 'high':
+ return 17;
+ case 'critical':
+ return 21;
+ }
+}
+
+/** gen_ai.provider.name for a site. */
+export function providerFor(site: SiteName): string {
+ return site === 'claude_web' ? 'anthropic' : 'openai';
+}
+
+/** service.name reported to the collector. */
+export const SERVICE_NAME = 'agent-beacon-browser-collector';
+
+/** beacon.origin value identifying browser-sourced telemetry. */
+export const ORIGIN = 'browser-extension';
+
+/**
+ * Per-event byte cap matching the collector's max_event_bytes (64 KiB). We
+ * truncate oversized string fields client-side and flag it, mirroring the
+ * exporter's field_truncated contract.
+ */
+export const MAX_EVENT_BYTES = 65536;
+/** Leave headroom for envelope/attribute overhead when capping field text. */
+export const MAX_FIELD_BYTES = 48000;
diff --git a/browser-extension/test/unit/claude.adapter.test.ts b/browser-extension/test/unit/claude.adapter.test.ts
new file mode 100644
index 00000000..f2ea1a96
--- /dev/null
+++ b/browser-extension/test/unit/claude.adapter.test.ts
@@ -0,0 +1,71 @@
+import { describe, it, expect } from 'vitest';
+import { readFileSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { claudeAdapter } from '../../src/adapters/claude.js';
+import type { TurnParser } from '../../src/adapters/adapter.js';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+const fixture = (name: string) =>
+ readFileSync(path.join(__dirname, '..', '..', 'fixtures', 'claude', `${name}.sse`), 'utf8');
+
+const CONV = '11111111-2222-3333-4444-555555555555';
+const URL = `/api/organizations/org-x/chat_conversations/${CONV}/completion`;
+
+/** Feed a body through a fresh parser in tiny, boundary-crossing chunks. */
+function run(name: string, prompt: string, chunkSize = 7): TurnParser {
+ const parser = claudeAdapter.createParser();
+ parser.onRequest(URL, 'POST', JSON.stringify({ prompt, conversation_id: CONV }));
+ const body = fixture(name);
+ for (let i = 0; i < body.length; i += chunkSize) parser.onChunk(body.slice(i, i + chunkSize));
+ parser.onDone();
+ return parser;
+}
+
+describe('claude adapter — simple turn', () => {
+ const turn = run('simple-turn', 'What is the capital of France?')!.getTurn()!;
+
+ it('reconstructs the streamed response text across split chunks', () => {
+ expect(turn.responseText).toBe('Paris.');
+ });
+ it('captures the prompt from the request body', () => {
+ expect(turn.promptText).toBe('What is the capital of France?');
+ });
+ it('captures the conversation id from the URL', () => {
+ expect(turn.sessionId).toBe(CONV);
+ });
+ it('captures the model', () => {
+ expect(turn.responseModel).toBe('claude-opus-4-8');
+ });
+ it('leaves usage tokens undefined (claude.ai does not stream them)', () => {
+ expect(turn.usage?.inputTokens).toBeUndefined();
+ expect(turn.usage?.outputTokens).toBeUndefined();
+ });
+ it('marks the turn completed', () => {
+ expect(turn.completedAt).toBeTypeOf('number');
+ expect(turn.toolCalls).toHaveLength(0);
+ });
+});
+
+describe('claude adapter — tool call', () => {
+ const turn = run('with-tool-call', 'What is the weather today?')!.getTurn()!;
+
+ it('captures the tool call with assembled JSON arguments', () => {
+ expect(turn.toolCalls).toHaveLength(1);
+ expect(turn.toolCalls[0].name).toBe('web_search');
+ expect(turn.toolCalls[0].id).toBe('toolu_abc');
+ expect(turn.toolCalls[0].arguments).toEqual({ query: 'weather today' });
+ });
+ it('still captures the accompanying text', () => {
+ expect(turn.responseText).toBe('Let me check the weather.');
+ });
+});
+
+describe('claude adapter — chunk-size invariance', () => {
+ it('produces the same response text regardless of chunk boundaries', () => {
+ const texts = [1, 3, 13, 100, 5000].map(
+ (n) => run('simple-turn', 'x', n).getTurn()!.responseText,
+ );
+ for (const t of texts) expect(t).toBe('Paris.');
+ });
+});
diff --git a/browser-extension/test/unit/normalize.test.ts b/browser-extension/test/unit/normalize.test.ts
new file mode 100644
index 00000000..c2633b37
--- /dev/null
+++ b/browser-extension/test/unit/normalize.test.ts
@@ -0,0 +1,164 @@
+import { describe, it, expect } from 'vitest';
+import { normalizeTurn } from '../../src/shared/normalize.js';
+import { attrValue, type KeyValue, type LogRecord } from '../../src/shared/otlp.js';
+import type { ChatTurn, Retention } from '../../src/shared/types.js';
+
+function baseTurn(over: Partial<ChatTurn> = {}): ChatTurn {
+ return {
+ site: 'claude_web',
+ sessionId: 'conv-123',
+ turnId: 'conv-123:1',
+ requestModel: 'claude-opus-4-8',
+ responseModel: 'claude-opus-4-8',
+ promptText: 'What is 2+2?',
+ inputMessages: [{ role: 'user', text: 'What is 2+2?' }],
+ outputMessages: [{ role: 'assistant', text: '4' }],
+ responseText: '4',
+ toolCalls: [],
+ usage: { inputTokens: 10, outputTokens: 2 },
+ startedAt: 1_700_000_000_000,
+ completedAt: 1_700_000_002_000,
+ captureMode: 'sse',
+ ...over,
+ };
+}
+
+function flat(attrs: KeyValue[]): Record<string, string | number | boolean> {
+ const out: Record<string, string | number | boolean> = {};
+ for (const a of attrs) {
+ const v = attrValue(attrs, a.key);
+ if (v !== undefined) out[a.key] = v;
+ }
+ return out;
+}
+
+/** Find the record for a given beacon.event.action. */
+function byAction(recs: LogRecord[], action: string): LogRecord | undefined {
+ return recs.find((r) => flat(r.attributes)['beacon.event.action'] === action);
+}
+
+function normalize(turn: ChatTurn, retention: Retention = 'full') {
+ return normalizeTurn(turn, retention);
+}
+
+describe('normalizeTurn — full retention, simple completed turn', () => {
+ const { resourceAttributes, logRecords } = normalize(baseTurn());
+ const res = flat(resourceAttributes);
+ const promptRec = byAction(logRecords, 'prompt.submitted')!;
+ const respRec = byAction(logRecords, 'agent.response.completed')!;
+
+ it('emits a prompt.submitted AND an agent.response.completed record', () => {
+ expect(logRecords).toHaveLength(2);
+ expect(promptRec).toBeTruthy();
+ expect(respRec).toBeTruthy();
+ });
+
+ it('sets resource attrs identifying the browser source', () => {
+ expect(res['beacon.harness.name']).toBe('claude_web');
+ expect(res['beacon.origin']).toBe('browser-extension');
+ expect(res['gen_ai.provider.name']).toBe('anthropic');
+ expect(res['service.name']).toBe('agent-beacon-browser-collector');
+ });
+
+ it('puts prompt text on the prompt.submitted record (category prompt)', () => {
+ const p = flat(promptRec.attributes);
+ expect(p['beacon.event.category']).toBe('prompt');
+ expect(p['beacon.prompt.text']).toBe('What is 2+2?');
+ });
+
+ it('keeps the response record focused on the response (no prompt.text)', () => {
+ const r = flat(respRec.attributes);
+ expect(r['beacon.event.category']).toBe('agent');
+ expect(r['beacon.prompt.text']).toBeUndefined();
+ expect(String(r['gen_ai.output.messages'])).toContain('4');
+ });
+
+ it('uses the conversation id for both session and gen_ai.conversation', () => {
+ const r = flat(respRec.attributes);
+ expect(r['beacon.session.id']).toBe('conv-123');
+ expect(r['gen_ai.conversation.id']).toBe('conv-123');
+ });
+
+ it('encodes usage tokens as integers on the response', () => {
+ const r = flat(respRec.attributes);
+ expect(r['gen_ai.usage.input_tokens']).toBe(10);
+ expect(r['gen_ai.usage.output_tokens']).toBe(2);
+ });
+
+ it('does NOT set fields the exporter fills', () => {
+ for (const rec of logRecords) {
+ const a = flat(rec.attributes);
+ for (const forbidden of ['vendor', 'product', 'schema_version', 'timestamp']) {
+ expect(a[forbidden]).toBeUndefined();
+ expect(res[forbidden]).toBeUndefined();
+ }
+ }
+ });
+
+ it('timestamps prompt from startedAt and response from completedAt', () => {
+ expect(promptRec.timeUnixNano).toBe('1700000000000000000');
+ expect(respRec.timeUnixNano).toBe('1700000002000000000');
+ });
+});
+
+describe('normalizeTurn — retention modes', () => {
+ it('metadata retention drops the prompt.submitted record and all text', () => {
+ const { logRecords } = normalize(baseTurn(), 'metadata');
+ expect(byAction(logRecords, 'prompt.submitted')).toBeUndefined();
+ const r = flat(byAction(logRecords, 'agent.response.completed')!.attributes);
+ expect(r['beacon.prompt.text']).toBeUndefined();
+ expect(r['gen_ai.output.messages']).toBeUndefined();
+ expect(r['beacon.content.retention']).toBe('metadata');
+ // Metadata still present:
+ expect(r['gen_ai.request.model']).toBe('claude-opus-4-8');
+ expect(r['gen_ai.usage.output_tokens']).toBe(2);
+ expect(r['beacon.response.chars']).toBe(1);
+ });
+
+ it('redacted retention scrubs emails from the prompt.submitted text', () => {
+ const turn = baseTurn({ promptText: 'email me at [email protected] please' });
+ const p = flat(byAction(normalize(turn, 'redacted').logRecords, 'prompt.submitted')!.attributes);
+ expect(p['beacon.prompt.text']).toBe('email me at [email] please');
+ expect(p['beacon.content.retention']).toBe('redacted');
+ });
+});
+
+describe('normalizeTurn — tool calls', () => {
+ const turn = baseTurn({
+ toolCalls: [
+ { id: 'toolu_1', name: 'web_search', arguments: { q: 'weather' }, result: 'sunny' },
+ ],
+ });
+ const { logRecords } = normalize(turn);
+
+ it('emits prompt.submitted + agent.response.completed + tool.invoked', () => {
+ expect(logRecords).toHaveLength(3);
+ const tool = flat(byAction(logRecords, 'tool.invoked')!.attributes);
+ expect(tool['beacon.event.category']).toBe('tool');
+ expect(tool['tool.name']).toBe('web_search');
+ expect(tool['gen_ai.tool.call.name']).toBe('web_search');
+ expect(tool['gen_ai.tool.call.id']).toBe('toolu_1');
+ expect(tool['gen_ai.tool.call.arguments']).toBe('{"q":"weather"}');
+ expect(tool['gen_ai.tool.call.result']).toBe('sunny');
+ });
+});
+
+describe('normalizeTurn — partial/aborted stream', () => {
+ it('marks an incomplete response as agent.response (not completed)', () => {
+ const turn = baseTurn({ completedAt: undefined });
+ const { logRecords } = normalize(turn);
+ expect(byAction(logRecords, 'agent.response')).toBeTruthy();
+ expect(byAction(logRecords, 'agent.response.completed')).toBeUndefined();
+ // Prompt still captured.
+ expect(byAction(logRecords, 'prompt.submitted')).toBeTruthy();
+ });
+});
+
+describe('normalizeTurn — size cap', () => {
+ it('truncates oversized prompt text and flags it', () => {
+ const huge = 'x'.repeat(200_000);
+ const p = flat(byAction(normalize(baseTurn({ promptText: huge })).logRecords, 'prompt.submitted')!.attributes);
+ expect((p['beacon.prompt.text'] as string).length).toBeLessThan(huge.length);
+ expect(p['beacon.field_truncated']).toBe(true);
+ });
+});
diff --git a/browser-extension/tools/integration-otelcol/README.md b/browser-extension/tools/integration-otelcol/README.md
new file mode 100644
index 00000000..c73699b5
--- /dev/null
+++ b/browser-extension/tools/integration-otelcol/README.md
@@ -0,0 +1,14 @@
+# Integration collector (opt-in)
+
+`e2e/integration.beacon.spec.ts` (run via `npm run test:integration`, gated on `RUN_INTEGRATION=1`)
+spawns the **real** `/opt/beacon/bin/beacon-otelcol` with a generated test config that:
+
+- listens on isolated OTLP ports (so it never touches the live `127.0.0.1:4318` collector), and
+- writes via the `beaconjson` exporter to a **temp** `runtime.jsonl` (never `/var/log`).
+
+It then POSTs the exact OTLP envelope our `turnToEnvelope()` produces and asserts the written line
+deserializes to a valid beacon `Event` (schema_version, event.action, harness.name, session.id,
+gen_ai.*, prompt.text) with vendor/product/timestamp filled by the exporter.
+
+This is the only layer that proves our OTLP → real `converter.go` → `Event` contract. It is
+advisory (kept out of the default unattended loop) because it depends on the installed binary.
diff --git a/browser-extension/tools/record-fixtures.ts b/browser-extension/tools/record-fixtures.ts
new file mode 100644
index 00000000..86bc6e59
--- /dev/null
+++ b/browser-extension/tools/record-fixtures.ts
@@ -0,0 +1,133 @@
+// Fixture recorder. Opens a HEADED browser with a PERSISTENT profile you log
+// into once (the session is saved locally under .auth-profiles/, git-ignored —
+// no credentials are ever seen by the tooling). It watches for the chat
+// completion request via the Chrome DevTools Protocol, captures the raw SSE
+// response body + the request (prompt) + a DOM snapshot, and writes them to
+// fixtures/<site>/<name>.{sse,meta.json,page.html}.
+//
+// Usage:
+// npm run record:fixtures -- --site claude --name simple-turn
+//
+// Then: log in if prompted, send ONE message, and wait for the full reply.
+// The first captured completion is saved and the tool exits.
+
+import { chromium } from '@playwright/test';
+import { mkdirSync, writeFileSync } from 'node:fs';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+const ROOT = path.join(__dirname, '..');
+
+interface SiteConfig {
+ startUrl: string;
+ /** matches the completion request URL */
+ isCompletion: (url: string) => boolean;
+}
+
+const SITES: Record<string, SiteConfig> = {
+ claude: {
+ startUrl: 'https://claude.ai/',
+ isCompletion: (u) => /chat_conversations\/.+\/(completion|retry_completion)/.test(u),
+ },
+ chatgpt: {
+ startUrl: 'https://chatgpt.com/',
+ isCompletion: (u) => /\/backend-api\/(conversation|f\/conversation)\b/.test(u),
+ },
+};
+
+function arg(name: string, fallback?: string): string {
+ const i = process.argv.indexOf(`--${name}`);
+ const v = i >= 0 ? process.argv[i + 1] : undefined;
+ if (v == null && fallback == null) throw new Error(`missing --${name}`);
+ return v ?? fallback!;
+}
+
+async function main() {
+ const site = arg('site', 'claude');
+ const name = arg('name', 'live-capture');
+ const cfg = SITES[site];
+ if (!cfg) throw new Error(`unknown site: ${site} (known: ${Object.keys(SITES).join(', ')})`);
+
+ const profileDir = path.join(ROOT, '.auth-profiles', site);
+ mkdirSync(profileDir, { recursive: true });
+ const outDir = path.join(ROOT, 'fixtures', site);
+ mkdirSync(outDir, { recursive: true });
+
+ console.log(`\n▶ Opening ${cfg.startUrl} with profile ${profileDir}`);
+ console.log(' Log in if needed, then send ONE message and wait for the full reply.\n');
+
+ // Use the real installed Chrome and strip the automation fingerprint so
+ // bot-detection (Cloudflare et al.) treats it like a normal browser:
+ // - channel:'chrome' → genuine Chrome branding/UA, not "Chrome for Testing"
+ // - drop --enable-automation and the automation extension
+ // - --disable-blink-features=AutomationControlled → navigator.webdriver=false
+ const context = await chromium.launchPersistentContext(profileDir, {
+ channel: 'chrome',
+ headless: false,
+ viewport: null,
+ ignoreDefaultArgs: ['--enable-automation'],
+ args: ['--disable-blink-features=AutomationControlled', '--start-maximized'],
+ });
+ const page = context.pages()[0] ?? (await context.newPage());
+ const client = await context.newCDPSession(page);
+ await client.send('Network.enable');
+
+ const pending = new Map<string, { url: string; postData?: string }>();
+
+ client.on('Network.requestWillBeSent', (e: any) => {
+ if (cfg.isCompletion(e.request.url)) {
+ pending.set(e.requestId, { url: e.request.url, postData: e.request.postData });
+ }
+ });
+
+ let done = false;
+ client.on('Network.loadingFinished', async (e: any) => {
+ if (done) return;
+ const meta = pending.get(e.requestId);
+ if (!meta) return;
+ done = true;
+ try {
+ const { body, base64Encoded } = await client.send('Network.getResponseBody', {
+ requestId: e.requestId,
+ });
+ const sse = base64Encoded ? Buffer.from(body, 'base64').toString('utf8') : body;
+ const html = await page.content();
+
+ writeFileSync(path.join(outDir, `${name}.sse`), sse);
+ writeFileSync(path.join(outDir, `${name}.page.html`), html);
+ writeFileSync(
+ path.join(outDir, `${name}.meta.json`),
+ JSON.stringify({ url: meta.url, requestBody: safeJson(meta.postData) }, null, 2),
+ );
+
+ console.log(`\n✅ Captured ${site}/${name}:`);
+ console.log(` • ${name}.sse (${sse.length} bytes of SSE)`);
+ console.log(` • ${name}.meta.json (request URL + prompt body)`);
+ console.log(` • ${name}.page.html (DOM snapshot)`);
+ console.log('\n⚠ Review these for personal content before committing.\n');
+ } catch (err) {
+ console.error('capture failed:', err);
+ } finally {
+ await context.close();
+ process.exit(0);
+ }
+ });
+
+ await page.goto(cfg.startUrl);
+ // Stay open until a completion is captured (loadingFinished handler exits).
+}
+
+function safeJson(s?: string): unknown {
+ if (!s) return null;
+ try {
+ return JSON.parse(s);
+ } catch {
+ return s;
+ }
+}
+
+main().catch((err) => {
+ console.error(err);
+ process.exit(1);
+});
diff --git a/browser-extension/tsconfig.json b/browser-extension/tsconfig.json
new file mode 100644
index 00000000..1bd4ba58
--- /dev/null
+++ b/browser-extension/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "module": "ESNext",
+ "moduleResolution": "Bundler",
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
+ "types": ["node", "chrome"],
+ "strict": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "noEmit": true,
+ "verbatimModuleSyntax": true
+ },
+ "include": ["src/**/*.ts", "e2e/**/*.ts", "test/**/*.ts", "tools/**/*.ts", "playwright.config.ts", "vitest.config.ts", "esbuild.config.mjs"]
+}
diff --git a/browser-extension/vitest.config.ts b/browser-extension/vitest.config.ts
new file mode 100644
index 00000000..b5918a42
--- /dev/null
+++ b/browser-extension/vitest.config.ts
@@ -0,0 +1,11 @@
+import { defineConfig } from 'vitest/config';
+
+// Pure unit tests for the browser-free core (adapters + normalization).
+// Node environment: no DOM, no chrome.* — these tests exercise pure functions.
+export default defineConfig({
+ test: {
+ environment: 'node',
+ include: ['test/unit/**/*.test.ts'],
+ watch: false,
+ },
+});