@ait-co/devtools 0.1.121 → 0.1.122
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{attach-orchestrator-DPMBN06p.js → attach-orchestrator-BYMCSPjf.js} +3 -3
- package/dist/{attach-orchestrator-DPMBN06p.js.map → attach-orchestrator-BYMCSPjf.js.map} +1 -1
- package/dist/{attach-orchestrator-DEJfLm7V.js → attach-orchestrator-CPMQWkGV.js} +3 -3
- package/dist/{attach-orchestrator-DEJfLm7V.js.map → attach-orchestrator-CPMQWkGV.js.map} +1 -1
- package/dist/{attach-orchestrator-qFEMBUwb.js → attach-orchestrator-EnZEr4Uu.js} +3 -3
- package/dist/{attach-orchestrator-qFEMBUwb.js.map → attach-orchestrator-EnZEr4Uu.js.map} +1 -1
- package/dist/attach-orchestrator-LOjvsE9R.js +3 -0
- package/dist/{attach-orchestrator-CFotueL3.js → attach-orchestrator-RhOdO3DS.js} +2 -2
- package/dist/{attach-orchestrator-CFotueL3.js.map → attach-orchestrator-RhOdO3DS.js.map} +1 -1
- package/dist/{bundle-CA1TCXED.d.ts → bundle-Cb3GFuw6.d.ts} +1 -1
- package/dist/{bundle-CA1TCXED.d.ts.map → bundle-Cb3GFuw6.d.ts.map} +1 -1
- package/dist/{capture-BmK_cBqQ.d.ts → capture-B1zfGyTo.d.ts} +1 -1
- package/dist/{capture-BmK_cBqQ.d.ts.map → capture-B1zfGyTo.d.ts.map} +1 -1
- package/dist/{cdp-connection-DB2zgthr.d.ts → cdp-connection-Dxw_EY8s.d.ts} +1 -1
- package/dist/{cdp-connection-DB2zgthr.d.ts.map → cdp-connection-Dxw_EY8s.d.ts.map} +1 -1
- package/dist/{cell-Cv3e_qwn.js → cell-3bIG9538.js} +2 -2
- package/dist/{cell-Cv3e_qwn.js.map → cell-3bIG9538.js.map} +1 -1
- package/dist/{cell-Bca_k5ne.js → cell-Bfbke0cT.js} +1 -1
- package/dist/{cell-BPWZUm_X.js → cell-Cad-vi7X.js} +2 -2
- package/dist/{cell-BPWZUm_X.js.map → cell-Cad-vi7X.js.map} +1 -1
- package/dist/{cell-nrWFeqvG.js → cell-CgKUkDxY.js} +2 -2
- package/dist/{cell-nrWFeqvG.js.map → cell-CgKUkDxY.js.map} +1 -1
- package/dist/{cell-Cj-u6JTG.js → cell-SKNUQTr8.js} +2 -2
- package/dist/{cell-Cj-u6JTG.js.map → cell-SKNUQTr8.js.map} +1 -1
- package/dist/{cli-RhzASQef.js → cli-CaJ-vnBj.js} +25 -5
- package/dist/cli-CaJ-vnBj.js.map +1 -0
- package/dist/{debug-server-Buc8yoa7.js → debug-server-CF-1s3ks.js} +5 -4
- package/dist/{debug-server-Buc8yoa7.js.map → debug-server-CF-1s3ks.js.map} +1 -1
- package/dist/{debug-server-BhHVy3XT.js → debug-server-D79E3hTa.js} +6 -5
- package/dist/{debug-server-BhHVy3XT.js.map → debug-server-D79E3hTa.js.map} +1 -1
- package/dist/{debug-server-C_5ag9jj.js → debug-server-D_28CxC1.js} +6 -5
- package/dist/{debug-server-C_5ag9jj.js.map → debug-server-D_28CxC1.js.map} +1 -1
- package/dist/{debug-server-m9lIC9YW.js → debug-server-IVaJ9vHH.js} +31 -1511
- package/dist/debug-server-IVaJ9vHH.js.map +1 -0
- package/dist/mcp/cli.js +3 -3
- package/dist/mcp/server.js +1 -1
- package/dist/panel/index.js +1 -1
- package/dist/{pool-D5QH6Ydv.d.ts → pool-B9wSRPOU.d.ts} +3 -3
- package/dist/{pool-D5QH6Ydv.d.ts.map → pool-B9wSRPOU.d.ts.map} +1 -1
- package/dist/qr-http-server-BJjw0hDr.js +1506 -0
- package/dist/qr-http-server-BJjw0hDr.js.map +1 -0
- package/dist/qr-http-server-BpcDt-cp.js +3 -0
- package/dist/qr-http-server-CKbtqvKy.js +1505 -0
- package/dist/qr-http-server-CKbtqvKy.js.map +1 -0
- package/dist/qr-http-server-gHBd-z7T.js +1506 -0
- package/dist/qr-http-server-gHBd-z7T.js.map +1 -0
- package/dist/{relay-factory-DVI7TrX4.js → relay-factory-BBnZM-an.js} +25 -5
- package/dist/relay-factory-BBnZM-an.js.map +1 -0
- package/dist/{relay-secret-store-BlFEhqwb.js → relay-secret-store-BIM_0y18.js} +1 -1
- package/dist/{relay-secret-store-CFc9n0OA.js → relay-secret-store-BJjoxes1.js} +1 -1
- package/dist/{relay-secret-store-CFc9n0OA.js.map → relay-secret-store-BJjoxes1.js.map} +1 -1
- package/dist/{relay-secret-store-CmDDfZMh.js → relay-secret-store-CtK1eqoV.js} +1 -1
- package/dist/{relay-secret-store-CmDDfZMh.js.map → relay-secret-store-CtK1eqoV.js.map} +1 -1
- package/dist/{relay-secret-store-DNPJKHNs.js → relay-secret-store-DKxs7zwq.js} +1 -1
- package/dist/{relay-secret-store-DNPJKHNs.js.map → relay-secret-store-DKxs7zwq.js.map} +1 -1
- package/dist/{relay-url-store-CnL2zwbH.js → relay-url-store-D3H067u0.js} +2 -2
- package/dist/{relay-url-store-CnL2zwbH.js.map → relay-url-store-D3H067u0.js.map} +1 -1
- package/dist/{relay-url-store-DGQ-HPQC.js → relay-url-store-uyVNe-Az.js} +2 -2
- package/dist/{relay-url-store-DGQ-HPQC.js.map → relay-url-store-uyVNe-Az.js.map} +1 -1
- package/dist/{relay-url-store-Dv5HSzwb.js → relay-url-store-xmUuTjXA.js} +2 -2
- package/dist/{relay-url-store-Dv5HSzwb.js.map → relay-url-store-xmUuTjXA.js.map} +1 -1
- package/dist/{relay-worker-BBu1oEqC.d.ts → relay-worker-7biDlEjo.d.ts} +5 -5
- package/dist/{relay-worker-BBu1oEqC.d.ts.map → relay-worker-7biDlEjo.d.ts.map} +1 -1
- package/dist/{runtime-Bm_sT1C9.d.ts → runtime-ozyPnRbU.d.ts} +1 -1
- package/dist/{runtime-Bm_sT1C9.d.ts.map → runtime-ozyPnRbU.d.ts.map} +1 -1
- package/dist/test-runner/bundle.d.ts +1 -1
- package/dist/test-runner/capture.d.ts +1 -1
- package/dist/test-runner/cli.js +1 -1
- package/dist/test-runner/config.d.ts +1 -1
- package/dist/test-runner/config.d.ts.map +1 -1
- package/dist/test-runner/config.js +1 -1
- package/dist/test-runner/pool.d.ts +1 -1
- package/dist/test-runner/relay-factory.d.ts.map +1 -1
- package/dist/test-runner/relay-factory.js +24 -4
- package/dist/test-runner/relay-factory.js.map +1 -1
- package/dist/test-runner/relay-worker.d.ts +1 -1
- package/dist/test-runner/report.d.ts +3 -3
- package/dist/test-runner/rpc.d.ts +2 -2
- package/dist/test-runner/runtime.d.ts +1 -1
- package/dist/test-runner/task-graph.d.ts +1 -1
- package/package.json +1 -1
- package/dist/attach-orchestrator-BTsEHXfq.js +0 -3
- package/dist/cli-RhzASQef.js.map +0 -1
- package/dist/debug-server-m9lIC9YW.js.map +0 -1
- package/dist/relay-factory-DVI7TrX4.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relay-factory-DVI7TrX4.js","names":[],"sources":["../src/test-runner/relay-factory.ts"],"sourcesContent":["/**\n * Relay connection factory for the Vitest custom pool (devtools#696).\n *\n * The Vitest pool (`pool.ts`) takes a {@link RelayConnectionFactory} that knows\n * how to `open()` a live CDP relay connection (boot relay → QR → phone scan →\n * cell inject → enableDomains) and `close()` it. Before this module that exact\n * assembly lived only inside the `devtools-test` CLI's `main()`; the standalone\n * CLI and the Vitest pool would otherwise each hand-roll it and drift.\n *\n * This is the single source of that assembly. `cli.ts` is refactored to call\n * `createRelayConnectionFactory(...).open()`, and `definePhoneVitestConfig`\n * (config.ts) exposes it so a downstream `vitest.config.ts` can wire the pool:\n *\n * import { createRelayConnectionFactory } from '@ait-co/devtools/test-runner';\n * const connection = createRelayConnectionFactory({\n * schemeUrl,\n * cell,\n * // REQUIRED — own the stdout decision (the chunks carry the relay wss +\n * // TOTP code). Suppress on non-interactive stdout; print otherwise.\n * onQrContent: (chunks) => {\n * if (!process.stdout.isTTY) return;\n * for (const c of chunks) process.stdout.write(`${c}\\n`);\n * },\n * });\n * export default defineConfig({ test: definePhoneVitestConfig({ connection }) });\n *\n * The heavy boot graph (chii relay, cloudflared, ws, debug-server) is pulled via\n * DYNAMIC import inside `open()` — so merely importing this module (or the\n * `@ait-co/devtools/test-runner` barrel) does NOT statically drag that graph in.\n *\n * SECRET-HANDLING: relay wss URLs, scheme URLs, and the TOTP secret/code are\n * never logged. `open()` reads the project-local `.ait_relay` secret read-only\n * (never mints) and the minted TOTP code rides only inside the QR `at=` param.\n *\n * Node-only. react-free (CdpConnection + lazily-imported MCP boot helpers only).\n */\n\nimport type { AttachDeps } from '../mcp/attach-orchestrator.js';\nimport type { CdpConnection } from '../mcp/cdp-connection.js';\nimport type { RelayConnectionFactory } from './pool.js';\n\n// NOTE: every value import below is a DYNAMIC import inside `open()`. This module\n// keeps ONLY type-level static imports so that re-exporting it from the\n// `@ait-co/devtools/test-runner` barrel (config.ts) does NOT statically drag the\n// heavy MCP graph (cell.ts → attach-orchestrator.ts → tools.ts → server-lock,\n// plus chii/cloudflared via debug-server) onto that Node-config entry.\n\n/** Options for {@link createRelayConnectionFactory}. */\nexport interface RelayConnectionFactoryOptions {\n /**\n * intoss-private:// scheme URL from `ait deploy --scheme-only` (env3). The\n * phone cold-loads the candidate bundle this URL points at. SECRET-HANDLING:\n * never logged.\n */\n schemeUrl: string;\n /**\n * Project root for the `.ait_relay` secret lookup (read-only). Defaults to\n * `process.cwd()`.\n */\n projectRoot?: string;\n /**\n * Attach wait timeout in ms — how long `open()` waits for the phone to scan\n * the QR and attach. Defaults to 600 000 (10 min) to give time for a manual\n * scan. (The per-file evaluate timeout is separate, passed via the pool's\n * `run` options.)\n */\n timeoutMs?: number;\n /** Disable browser auto-open of the QR dashboard (text QR only). */\n headless?: boolean;\n /**\n * Cell axes injected as `__AIT_CELL__` before the first test bundle runs, so\n * sdk-example's capture picks up the correct sdkLine/platform. Optional — when\n * omitted no cell is injected. The values are not secrets.\n */\n cell?: { sdkLine: string; platform: string };\n /**\n * Receives the QR/attach render content (text chunks) from\n * `renderAndMaybeWait`, so the caller decides whether to print them — e.g.\n * suppress on non-interactive stdout.\n *\n * REQUIRED (not optional) on purpose: these chunks contain the QR payload\n * (which encodes the relay wss + TOTP `at=` code) and the attach JSON block.\n * Making the hook mandatory means the factory never falls back to printing\n * them itself — a downstream `vitest.config.ts` consumer that wires this via\n * the `@ait-co/devtools/test-runner` barrel is forced to make an explicit\n * stdout decision rather than silently leaking the secret-bearing block.\n *\n * SECRET-HANDLING: when a non-interactive caller is detected the hook MUST\n * suppress the WHOLE chunk (not just `attachUrl`), since `relayUrl` rides in\n * the same block.\n */\n onQrContent: (textChunks: string[]) => void;\n}\n\n/**\n * Builds a {@link RelayConnectionFactory} that opens a standalone env3 relay\n * connection.\n *\n * `open()` performs the full attach lifecycle and BLOCKS for tens of seconds (up\n * to `timeoutMs`) while a human scans the rendered QR with their phone — there\n * is no way around the manual scan for env3. It resolves with the live\n * `CdpConnection` once a matching page attaches; `close()` tears the relay\n * family down.\n *\n * The factory holds the booted relay family in a closure so `close()` can stop\n * it. A second `open()` on the same factory boots a fresh family (the previous\n * one should have been `close()`d first).\n */\nexport function createRelayConnectionFactory(\n opts: RelayConnectionFactoryOptions,\n): RelayConnectionFactory {\n const projectRoot = opts.projectRoot ?? process.cwd();\n const timeoutMs = opts.timeoutMs ?? 600_000;\n const headless = opts.headless === true;\n\n // Captured so close() can stop the family that open() booted.\n let family: { connection: CdpConnection; stop(): void } | undefined;\n\n return {\n async open(): Promise<CdpConnection> {\n // Dynamic imports: keep the chii/cloudflared/debug-server graph OFF the\n // static import graph of this module (and the test-runner config barrel).\n const { prepareAttach, renderAndMaybeWait } = await import('../mcp/attach-orchestrator.js');\n const { injectDebugIndicator, injectGlobals } = await import('./cell.js');\n const { loadRelaySecretReadOnly } = await import('../mcp/relay-secret-store.js');\n const { bootRelayFamily, buildRelayVerifyAuth } = await import('../mcp/debug-server.js');\n\n // Load the project-local .ait_relay secret into AIT_DEBUG_TOTP_SECRET\n // BEFORE booting the relay so assertRelayAuthConfigured()/buildRelayVerifyAuth()\n // at the boot site see it. Read-only — never mints. SECRET-HANDLING: the\n // value is never logged here.\n await loadRelaySecretReadOnly({ projectRoot });\n\n const booted = await bootRelayFamily({ verifyAuth: buildRelayVerifyAuth() });\n family = booted;\n\n // Assemble AttachDeps with no dashboard/SSE (CLI/pool is not the daemon).\n const attachDeps: AttachDeps = {\n getTunnelStatus: booted.getTunnelStatus ?? (() => ({ up: false, wssUrl: null })),\n getTotpSecret: () => process.env.AIT_DEBUG_TOTP_SECRET,\n qrHttpServer: undefined,\n onAttachUrlBuilt: undefined,\n canOpenBrowser: () => !headless,\n };\n\n const prep = await prepareAttach(\n attachDeps,\n 'relay-dev',\n { scheme_url: opts.schemeUrl },\n booted.connection,\n );\n if (!prep.ok) {\n booted.stop();\n family = undefined;\n // SECRET-HANDLING: do NOT surface `prep.error.content` in the thrown\n // message. Some prep error paths build their text from attach\n // components, and the CLI catch writes `e.message` to stderr — embedding\n // that text risks leaking the scheme/relay wss URL. The detailed\n // diagnostic is the daemon/dashboard's job; the factory throws a\n // secret-free message only.\n throw new Error(\n 'createRelayConnectionFactory: attach preparation failed — check the scheme_url and that the relay tunnel is up',\n );\n }\n\n // Render the QR + wait for the phone to attach. SECRET-HANDLING: this\n // function never logs scheme/wss/TOTP values.\n const waitResult = await renderAndMaybeWait(\n attachDeps,\n prep,\n true,\n timeoutMs,\n booted.connection,\n );\n if (waitResult.isError) {\n booted.stop();\n family = undefined;\n // SECRET-HANDLING (BLOCKER fix): `waitResult.content` is the timeout\n // result built from `buildTimeoutError(baseText, ...)`, and `baseText`\n // is `JSON.stringify({ attachUrl, relayUrl, ... })` — `attachUrl` carries\n // the TOTP `at=` code and `relayUrl` is the relay `wss://` URL. The CLI\n // catch writes `e.message` to stderr, so extracting that text here would\n // leak the relay wss + TOTP code on every timeout. Throw a secret-free\n // message with only the timeout duration.\n const timeoutSec = Math.round(timeoutMs / 1000);\n throw new Error(\n `createRelayConnectionFactory: attach timed out after ${timeoutSec}s — phone did not scan the QR within the timeout`,\n );\n }\n\n // Surface the QR/attach render content to the caller, which owns the\n // stdout decision (suppress on non-interactive stdout). There is no\n // fallback that prints here itself: `onQrContent` is a required option so\n // the secret-bearing block (attachUrl TOTP + relayUrl wss) can never be\n // emitted without an explicit caller decision. SECRET-HANDLING.\n const qrChunks = waitResult.content\n .filter((c): c is { type: 'text'; text: string } => c.type === 'text')\n .map((c) => c.text);\n opts.onQrContent(qrChunks);\n\n // Debugger attached — show the on-phone \"Debugger Connected\" badge.\n await injectDebugIndicator(booted.connection);\n\n // Inject the cell globals before any test bundle runs (session-global).\n if (opts.cell !== undefined) {\n await injectGlobals(booted.connection, { __AIT_CELL__: opts.cell });\n }\n\n // Open the CDP client websocket + enable domains so the first run's\n // Runtime.evaluate and console stream are live. enableDomains is\n // idempotent; runTestFilesOverRelay also calls it defensively.\n await booted.connection.enableDomains();\n\n return booted.connection;\n },\n\n async close(_connection: CdpConnection): Promise<void> {\n // family.stop() is synchronous best-effort: closes the CDP connection and\n // shuts down the relay + cloudflared child.\n family?.stop();\n family = undefined;\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4GA,SAAgB,6BACd,MACwB;CACxB,MAAM,cAAc,KAAK,eAAe,QAAQ,KAAK;CACrD,MAAM,YAAY,KAAK,aAAa;CACpC,MAAM,WAAW,KAAK,aAAa;CAGnC,IAAI;AAEJ,QAAO;EACL,MAAM,OAA+B;GAGnC,MAAM,EAAE,eAAe,uBAAuB,MAAM,OAAO;GAC3D,MAAM,EAAE,sBAAsB,kBAAkB,MAAM,OAAO;GAC7D,MAAM,EAAE,4BAA4B,MAAM,OAAO;GACjD,MAAM,EAAE,iBAAiB,yBAAyB,MAAM,OAAO;AAM/D,SAAM,wBAAwB,EAAE,aAAa,CAAC;GAE9C,MAAM,SAAS,MAAM,gBAAgB,EAAE,YAAY,sBAAsB,EAAE,CAAC;AAC5E,YAAS;GAGT,MAAM,aAAyB;IAC7B,iBAAiB,OAAO,2BAA2B;KAAE,IAAI;KAAO,QAAQ;KAAM;IAC9E,qBAAqB,QAAQ,IAAI;IACjC,cAAc,KAAA;IACd,kBAAkB,KAAA;IAClB,sBAAsB,CAAC;IACxB;GAED,MAAM,OAAO,MAAM,cACjB,YACA,aACA,EAAE,YAAY,KAAK,WAAW,EAC9B,OAAO,WACR;AACD,OAAI,CAAC,KAAK,IAAI;AACZ,WAAO,MAAM;AACb,aAAS,KAAA;AAOT,UAAM,IAAI,MACR,iHACD;;GAKH,MAAM,aAAa,MAAM,mBACvB,YACA,MACA,MACA,WACA,OAAO,WACR;AACD,OAAI,WAAW,SAAS;AACtB,WAAO,MAAM;AACb,aAAS,KAAA;IAQT,MAAM,aAAa,KAAK,MAAM,YAAY,IAAK;AAC/C,UAAM,IAAI,MACR,wDAAwD,WAAW,kDACpE;;GAQH,MAAM,WAAW,WAAW,QACzB,QAAQ,MAA2C,EAAE,SAAS,OAAO,CACrE,KAAK,MAAM,EAAE,KAAK;AACrB,QAAK,YAAY,SAAS;AAG1B,SAAM,qBAAqB,OAAO,WAAW;AAG7C,OAAI,KAAK,SAAS,KAAA,EAChB,OAAM,cAAc,OAAO,YAAY,EAAE,cAAc,KAAK,MAAM,CAAC;AAMrE,SAAM,OAAO,WAAW,eAAe;AAEvC,UAAO,OAAO;;EAGhB,MAAM,MAAM,aAA2C;AAGrD,WAAQ,MAAM;AACd,YAAS,KAAA;;EAEZ"}
|