@ait-co/devtools 0.1.117 → 0.1.119

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.
Files changed (103) hide show
  1. package/dist/attach-orchestrator-CFotueL3.js +1749 -0
  2. package/dist/attach-orchestrator-CFotueL3.js.map +1 -0
  3. package/dist/attach-orchestrator-CII9Gl5m.js +2797 -0
  4. package/dist/attach-orchestrator-CII9Gl5m.js.map +1 -0
  5. package/dist/attach-orchestrator-C_6xb_L5.js +3 -0
  6. package/dist/attach-orchestrator-DEJfLm7V.js +1749 -0
  7. package/dist/attach-orchestrator-DEJfLm7V.js.map +1 -0
  8. package/dist/{cli-CvUNQKqw.js → attach-orchestrator-qFEMBUwb.js} +3 -805
  9. package/dist/attach-orchestrator-qFEMBUwb.js.map +1 -0
  10. package/dist/{bundle-KFs4t-wc.d.ts → bundle-CA1TCXED.d.ts} +1 -1
  11. package/dist/bundle-CA1TCXED.d.ts.map +1 -0
  12. package/dist/capture-BmK_cBqQ.d.ts +58 -0
  13. package/dist/capture-BmK_cBqQ.d.ts.map +1 -0
  14. package/dist/{cdp-connection-C0AP0tH2.d.ts → cdp-connection-DB2zgthr.d.ts} +1 -1
  15. package/dist/{cdp-connection-C0AP0tH2.d.ts.map → cdp-connection-DB2zgthr.d.ts.map} +1 -1
  16. package/dist/cell-BJiaGlVu.js +3 -0
  17. package/dist/cell-BPWZUm_X.js +85 -0
  18. package/dist/cell-BPWZUm_X.js.map +1 -0
  19. package/dist/cell-Cv3e_qwn.js +84 -0
  20. package/dist/cell-Cv3e_qwn.js.map +1 -0
  21. package/dist/cell-bLwQ4gTq.js +85 -0
  22. package/dist/cell-bLwQ4gTq.js.map +1 -0
  23. package/dist/cell-nrWFeqvG.js +84 -0
  24. package/dist/cell-nrWFeqvG.js.map +1 -0
  25. package/dist/cli-RhzASQef.js +1057 -0
  26. package/dist/cli-RhzASQef.js.map +1 -0
  27. package/dist/debug-server-BhHVy3XT.js +1191 -0
  28. package/dist/debug-server-BhHVy3XT.js.map +1 -0
  29. package/dist/{debug-server-jrI9U_f4.js → debug-server-Bi6jLuY6.js} +467 -2989
  30. package/dist/debug-server-Bi6jLuY6.js.map +1 -0
  31. package/dist/debug-server-Buc8yoa7.js +1909 -0
  32. package/dist/debug-server-Buc8yoa7.js.map +1 -0
  33. package/dist/{debug-server-BvrESnaV.js → debug-server-C_5ag9jj.js} +5 -3
  34. package/dist/debug-server-C_5ag9jj.js.map +1 -0
  35. package/dist/mcp/cli.js +3 -2
  36. package/dist/mcp/cli.js.map +1 -1
  37. package/dist/mcp/server.js +1 -1
  38. package/dist/panel/index.js +1 -1
  39. package/dist/{pool-htlVnEFl.d.ts → pool-U9FrxEuR.d.ts} +5 -5
  40. package/dist/{pool-htlVnEFl.d.ts.map → pool-U9FrxEuR.d.ts.map} +1 -1
  41. package/dist/relay-factory-DVI7TrX4.js +69 -0
  42. package/dist/relay-factory-DVI7TrX4.js.map +1 -0
  43. package/dist/relay-secret-store-BcVrWwTq.js +153 -0
  44. package/dist/relay-secret-store-BcVrWwTq.js.map +1 -0
  45. package/dist/{relay-secret-store-BHcOmaNK.js → relay-secret-store-BlFEhqwb.js} +1 -1
  46. package/dist/{relay-secret-store-CmqchhR5.js → relay-secret-store-CFc9n0OA.js} +1 -1
  47. package/dist/{relay-secret-store-CmqchhR5.js.map → relay-secret-store-CFc9n0OA.js.map} +1 -1
  48. package/dist/{relay-secret-store-CkA7KNUb.js → relay-secret-store-CmDDfZMh.js} +2 -2
  49. package/dist/{relay-secret-store-CkA7KNUb.js.map → relay-secret-store-CmDDfZMh.js.map} +1 -1
  50. package/dist/relay-secret-store-DNPJKHNs.js +153 -0
  51. package/dist/relay-secret-store-DNPJKHNs.js.map +1 -0
  52. package/dist/relay-url-store-CdA58fgw.js +122 -0
  53. package/dist/relay-url-store-CdA58fgw.js.map +1 -0
  54. package/dist/{relay-url-store-C0qukm3R.js → relay-url-store-CnL2zwbH.js} +2 -2
  55. package/dist/{relay-url-store-C0qukm3R.js.map → relay-url-store-CnL2zwbH.js.map} +1 -1
  56. package/dist/{relay-url-store-NDtEcOE-.js → relay-url-store-DGQ-HPQC.js} +2 -2
  57. package/dist/{relay-url-store-NDtEcOE-.js.map → relay-url-store-DGQ-HPQC.js.map} +1 -1
  58. package/dist/relay-url-store-Dv5HSzwb.js +122 -0
  59. package/dist/relay-url-store-Dv5HSzwb.js.map +1 -0
  60. package/dist/{relay-worker-DWW4vZxU.d.ts → relay-worker-D-3aAyDO.d.ts} +28 -4
  61. package/dist/relay-worker-D-3aAyDO.d.ts.map +1 -0
  62. package/dist/{runtime-BU-iMHz6.d.ts → runtime-D57Rtnsd.d.ts} +1 -1
  63. package/dist/{runtime-BU-iMHz6.d.ts.map → runtime-D57Rtnsd.d.ts.map} +1 -1
  64. package/dist/test-runner/bundle.d.ts +1 -1
  65. package/dist/test-runner/bundle.js +45 -27
  66. package/dist/test-runner/bundle.js.map +1 -1
  67. package/dist/test-runner/capture.d.ts +2 -0
  68. package/dist/test-runner/capture.js +44 -0
  69. package/dist/test-runner/capture.js.map +1 -0
  70. package/dist/test-runner/cli.d.ts +85 -12
  71. package/dist/test-runner/cli.d.ts.map +1 -1
  72. package/dist/test-runner/cli.js +2 -2
  73. package/dist/test-runner/config.d.ts +76 -2
  74. package/dist/test-runner/config.d.ts.map +1 -1
  75. package/dist/test-runner/config.js +4 -2
  76. package/dist/test-runner/config.js.map +1 -1
  77. package/dist/test-runner/pool.d.ts +1 -1
  78. package/dist/test-runner/relay-factory.d.ts +11136 -0
  79. package/dist/test-runner/relay-factory.d.ts.map +1 -0
  80. package/dist/test-runner/relay-factory.js +69 -0
  81. package/dist/test-runner/relay-factory.js.map +1 -0
  82. package/dist/test-runner/relay-worker.d.ts +1 -1
  83. package/dist/test-runner/relay-worker.js +66 -20
  84. package/dist/test-runner/relay-worker.js.map +1 -1
  85. package/dist/test-runner/report.d.ts +106 -0
  86. package/dist/test-runner/report.d.ts.map +1 -0
  87. package/dist/test-runner/report.js +139 -0
  88. package/dist/test-runner/report.js.map +1 -0
  89. package/dist/test-runner/rpc.d.ts +2 -2
  90. package/dist/test-runner/runtime.d.ts +1 -1
  91. package/dist/test-runner/task-graph.d.ts +1 -1
  92. package/dist/{totp-D70zD5tJ.js → totp-0bvlo9Yb.js} +1 -1
  93. package/dist/{totp-D70zD5tJ.js.map → totp-0bvlo9Yb.js.map} +1 -1
  94. package/dist/totp-DfekTBk3.js +211 -0
  95. package/dist/totp-DfekTBk3.js.map +1 -0
  96. package/dist/totp-zGIlDsZS.js +3 -0
  97. package/package.json +1 -1
  98. package/dist/bundle-KFs4t-wc.d.ts.map +0 -1
  99. package/dist/cli-CvUNQKqw.js.map +0 -1
  100. package/dist/debug-server-BvrESnaV.js.map +0 -1
  101. package/dist/debug-server-jrI9U_f4.js.map +0 -1
  102. package/dist/relay-worker-DWW4vZxU.d.ts.map +0 -1
  103. package/dist/totp-D104cJQN.js +0 -3
@@ -345,6 +345,44 @@ interface BundleOptions {
345
345
  globalName?: string;
346
346
  }
347
347
  //#endregion
348
+ //#region src/test-runner/capture.d.ts
349
+ /**
350
+ * `__AIT_CAPTURE__` console-line parser (devtools#696).
351
+ *
352
+ * env3 test runs inject sdk-example's `aitCapture.ts`, which — when running in a
353
+ * WebView (no filesystem) — emits one `console.log` line per category in the
354
+ * stable form:
355
+ *
356
+ * __AIT_CAPTURE__ <category> <json>
357
+ *
358
+ * The relay-worker harvests `Runtime.consoleAPICalled` events as plain text
359
+ * lines (see `relay-worker.ts`) and hands them here. This module's only job is
360
+ * to recognise the allowlisted prefix, split off the category, and keep the
361
+ * remaining JSON string OPAQUE — devtools does NOT own or interpret the
362
+ * `__AIT_CAPTURE__` record shape (that lives in sdk-example). We carry
363
+ * `{ category, json }` through untouched so the 2.x↔3.0 line comparison stays a
364
+ * downstream concern.
365
+ *
366
+ * Why a strict allowlist prefix (SECRET-HANDLING): the raw console stream may
367
+ * also contain wss/scheme/relay noise lines. Only lines that EXACTLY start with
368
+ * `'__AIT_CAPTURE__ '` pass; everything else is discarded, so a stray relay URL
369
+ * can never be serialised into a capture artifact.
370
+ *
371
+ * react-free, dependency-free — safe to import from any test-runner entry
372
+ * without dragging in the chii/cloudflared Node graph.
373
+ */
374
+ /**
375
+ * One parsed capture line. `json` is the raw JSON string exactly as the page
376
+ * emitted it (an array of sdk-example capture records). devtools treats it as
377
+ * opaque — it is validated as parseable JSON but never inspected.
378
+ */
379
+ interface AitCaptureLine {
380
+ /** The capture category (first whitespace-delimited token after the prefix). */
381
+ category: string;
382
+ /** The remaining JSON payload, verbatim. Opaque to devtools. */
383
+ json: string;
384
+ }
385
+ //#endregion
348
386
  //#region src/test-runner/runtime.d.ts
349
387
  /**
350
388
  * Thin test runtime for WebView execution.
@@ -418,6 +456,17 @@ interface RelayRunReport {
418
456
  skipped: number;
419
457
  total: number;
420
458
  };
459
+ /**
460
+ * `__AIT_CAPTURE__` lines harvested from the page console during the run
461
+ * (additive field, devtools#696). Empty unless `collectCaptures` was set.
462
+ * Each entry is opaque (`{ category, json }`) — devtools does not interpret
463
+ * the record shape, only forwards it for downstream 2.x↔3.0 diffing.
464
+ *
465
+ * SECRET-HANDLING: only lines matching the `__AIT_CAPTURE__ ` allowlist
466
+ * prefix reach here; relay/wss/scheme noise lines are dropped in
467
+ * `parseCaptureLines`.
468
+ */
469
+ captures: AitCaptureLine[];
421
470
  }
422
471
  /** Options for `runTestFilesOverRelay`. */
423
472
  interface RelayRunOptions {
@@ -430,6 +479,18 @@ interface RelayRunOptions {
430
479
  * Increase for long-running suites or split the file.
431
480
  */
432
481
  timeoutMs?: number;
482
+ /**
483
+ * When `true`, registers a live `Runtime.consoleAPICalled` listener for the
484
+ * duration of the run and harvests `__AIT_CAPTURE__` lines into
485
+ * `RelayRunReport.captures`. Defaults to **false** so the build-only
486
+ * eval/e2e path (and the Vitest pool) pay no listener/state overhead —
487
+ * `captures` is then an empty array.
488
+ *
489
+ * The listener is registered just BEFORE the first file runs and removed in a
490
+ * `finally` so it never accumulates across runs (no ring-buffer drain — the
491
+ * default 500-entry buffer would silently drop lines via `shift`).
492
+ */
493
+ collectCaptures?: boolean;
433
494
  }
434
495
  //#endregion
435
496
  //#region src/test-runner/cli.d.ts
@@ -445,30 +506,42 @@ interface RunWithConnectionOptions extends RelayRunOptions {
445
506
  * separate from `main()` so tests can call it without spawning a subprocess.
446
507
  */
447
508
  declare function runWithConnection(connection: CdpConnection, files: string[], opts?: RunWithConnectionOptions): Promise<RelayRunReport>;
509
+ /**
510
+ * Decides whether to suppress the QR/attach block on stdout.
511
+ *
512
+ * Suppress when EITHER the user passed `--no-qr-stdout`, OR stdout is not a TTY
513
+ * / `CI` is set / `AIT_NO_QR_STDOUT` is set (non-interactive — a captured stdout
514
+ * must not leak the relay wss + TOTP `at=` code that the QR block encodes). The
515
+ * suppression is whole-chunk: `attachUrl` AND `relayUrl` ride in the same block.
516
+ *
517
+ * Exported for unit testing.
518
+ */
519
+ declare function shouldSuppressQr(noQrFlag: boolean): boolean;
448
520
  /**
449
521
  * CLI entry point.
450
522
  *
451
- * Performs a standalone relay attach → run lifecycle:
523
+ * Performs a standalone relay attach → run lifecycle, sharing the attach
524
+ * assembly with the Vitest pool via `createRelayConnectionFactory` (single
525
+ * source — no drift):
452
526
  *
453
527
  * 1. Parse args: globs, --timeout, --cell-sdk-line, --cell-platform,
454
- * --scheme-url (required for env3), --headless, --project-root.
528
+ * --scheme-url (required for env3), --report-dir, --no-qr-stdout,
529
+ * --headless, --project-root.
455
530
  * 2. Discover test files; exit 1 if none.
456
- * 3. Load .ait_relay secret into AIT_DEBUG_TOTP_SECRET, then boot relay family.
457
- * 4. Assemble AttachDeps (no qrHttpServertext QR).
458
- * 5. prepareAttach(deps, 'relay-dev', { scheme_url }, conn).
459
- * 6. renderAndMaybeWait(deps, prep, true, timeoutMs, conn) text QR + wait.
460
- * 7. If cell flags present, injectGlobals({ __AIT_CELL__: cell }) before run.
461
- * 8. runWithConnection(conn, files, { timeoutMs, printSummary: true }).
462
- * 9. family.stop(); process.exitCode = failed > 0 ? 1 : 0.
531
+ * 3. factory.open() boot relay render QR (suppressed on non-interactive
532
+ * stdout) wait for phone inject cell enableDomains. Returns the conn.
533
+ * 4. runWithConnection(conn, files, { timeoutMs, collectCaptures, printSummary }).
534
+ * 5. With --report-dir: write the runner-agnostic report + capture files.
535
+ * 6. factory.close(); process.exitCode = failed > 0 ? 1 : 0.
463
536
  *
464
537
  * The CLI is not a daemon — no lock, router, SSE, or tools_list is needed.
465
538
  * Attach timeout exits with code 1; test failures exit with code 1.
466
539
  *
467
540
  * SECRET-HANDLING: scheme_url / relay wssUrl / TOTP codes are never written to
468
- * stdout/stderr directly. text QR renders via renderAndMaybeWait which encodes
469
- * the TOTP `at=` code inside the QR payload (not in plain log lines).
541
+ * stdout/stderr directly. The QR block (which encodes the TOTP `at=` code) is
542
+ * printed only when stdout is interactive AND not suppressed.
470
543
  */
471
544
  declare function main(argv?: string[]): Promise<void>;
472
545
  //#endregion
473
- export { RunWithConnectionOptions, main, runWithConnection };
546
+ export { RunWithConnectionOptions, main, runWithConnection, shouldSuppressQr };
474
547
  //# sourceMappingURL=cli.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","names":[],"sources":["../../src/mcp/cdp-connection.ts","../../src/test-runner/bundle.ts","../../src/test-runner/runtime.ts","../../src/test-runner/relay-worker.ts","../../src/test-runner/cli.ts"],"mappings":";;;AAwBA;;;;;;;;;AAUA;;;;;;;;;;;AASA;;UAnBiB,SAAA;EA2BI;EAzBnB,EAAA;EAoBA;EAlBA,KAAA;EAoBA;EAlBA,GAAA;AAAA;;UAIe,eAAA;EACf,IAAA;EACA,OAAA;EACA,KAAA;EACA,WAAA;EACA,SAAA;AAAA;AAsBF;AAAA,UAlBiB,qBAAA;;EAEf,IAAA;EACA,IAAA,EAAM,eAAA;EAiBN;EAfA,SAAA;EACA,kBAAA;EACA,UAAA;IACE,UAAA,EAAY,KAAA;MACV,YAAA;MACA,GAAA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AAUA;;;;;;;;;;;AASA;;;;AAAA,UEbiB,UAAA;EFgBf;EEdA,IAAA;EFgBA;EEdA,MAAA;EFgBA;EEdA,QAAA;EFec;EEbd,KAAA;AAAA;;UAIe,SAAA;EFaC;EEXhB,SAAA;EFiBe;EEff,QAAA;EACA,MAAA;EACA,MAAA;EACA,OAAA;EACA,KAAA,EAAO,UAAA;AAAA;;;;UC3BQ,UAAA;EHoBA;EGlBf,IAAA;;EAEA,MAAA,EAAQ,SAAA;IAAc,KAAA;EAAA;AAAA;;UAIP,cAAA;EHmBf;EGjBA,SAAA;EHkBc;EGhBd,QAAA;EHkBI;EGhBJ,KAAA,EAAO,UAAA;EHkBH;EGhBJ,MAAA;IACE,MAAA;IACA,MAAA;IACA,OAAA;IACA,KAAA;EAAA;AAAA;;UAKa,eAAA;EHiBb;;;EGbF,aAAA,GAAgB,aAAA;EHmBhB;;;;EGdA,SAAA;AAAA;;;;UCUe,wBAAA,SAAiC,eAAA;EJ9BhD;EIgCA,YAAA;AAAA;;;AJ1BF;;;;iBImCsB,iBAAA,CACpB,UAAA,EAAY,aAAA,EACZ,KAAA,YACA,IAAA,GAAO,wBAAA,GACN,OAAA,CAAQ,cAAA;;;;;;;;;;;;;;AJrBX;;;;;;;;;;iBI6DsB,IAAA,CAAK,IAAA,cAAyC,OAAA"}
1
+ {"version":3,"file":"cli.d.ts","names":[],"sources":["../../src/mcp/cdp-connection.ts","../../src/test-runner/bundle.ts","../../src/test-runner/capture.ts","../../src/test-runner/runtime.ts","../../src/test-runner/relay-worker.ts","../../src/test-runner/cli.ts"],"mappings":";;;AAwBA;;;;;;;;;AAUA;;;;;;;;;;;AASA;;UAnBiB,SAAA;EA2BI;EAzBnB,EAAA;EAoBA;EAlBA,KAAA;EAoBA;EAlBA,GAAA;AAAA;;UAIe,eAAA;EACf,IAAA;EACA,OAAA;EACA,KAAA;EACA,WAAA;EACA,SAAA;AAAA;AAsBF;AAAA,UAlBiB,qBAAA;;EAEf,IAAA;EACA,I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../cli-CvUNQKqw.js";
3
- export { main, runWithConnection };
2
+ import { n as runWithConnection, r as shouldSuppressQr, t as main } from "../cli-RhzASQef.js";
3
+ export { main, runWithConnection, shouldSuppressQr };
@@ -1,5 +1,71 @@
1
- import { i as createRelayPool, n as RelayConnectionFactory, t as RELAY_POOL_NAME } from "../pool-htlVnEFl.js";
1
+ import { i as createRelayPool, n as RelayConnectionFactory, t as RELAY_POOL_NAME } from "../pool-U9FrxEuR.js";
2
2
 
3
+ //#region src/test-runner/relay-factory.d.ts
4
+ /** Options for {@link createRelayConnectionFactory}. */
5
+ interface RelayConnectionFactoryOptions {
6
+ /**
7
+ * intoss-private:// scheme URL from `ait deploy --scheme-only` (env3). The
8
+ * phone cold-loads the candidate bundle this URL points at. SECRET-HANDLING:
9
+ * never logged.
10
+ */
11
+ schemeUrl: string;
12
+ /**
13
+ * Project root for the `.ait_relay` secret lookup (read-only). Defaults to
14
+ * `process.cwd()`.
15
+ */
16
+ projectRoot?: string;
17
+ /**
18
+ * Attach wait timeout in ms — how long `open()` waits for the phone to scan
19
+ * the QR and attach. Defaults to 600 000 (10 min) to give time for a manual
20
+ * scan. (The per-file evaluate timeout is separate, passed via the pool's
21
+ * `run` options.)
22
+ */
23
+ timeoutMs?: number;
24
+ /** Disable browser auto-open of the QR dashboard (text QR only). */
25
+ headless?: boolean;
26
+ /**
27
+ * Cell axes injected as `__AIT_CELL__` before the first test bundle runs, so
28
+ * sdk-example's capture picks up the correct sdkLine/platform. Optional — when
29
+ * omitted no cell is injected. The values are not secrets.
30
+ */
31
+ cell?: {
32
+ sdkLine: string;
33
+ platform: string;
34
+ };
35
+ /**
36
+ * Receives the QR/attach render content (text chunks) from
37
+ * `renderAndMaybeWait`, so the caller decides whether to print them — e.g.
38
+ * suppress on non-interactive stdout.
39
+ *
40
+ * REQUIRED (not optional) on purpose: these chunks contain the QR payload
41
+ * (which encodes the relay wss + TOTP `at=` code) and the attach JSON block.
42
+ * Making the hook mandatory means the factory never falls back to printing
43
+ * them itself — a downstream `vitest.config.ts` consumer that wires this via
44
+ * the `@ait-co/devtools/test-runner` barrel is forced to make an explicit
45
+ * stdout decision rather than silently leaking the secret-bearing block.
46
+ *
47
+ * SECRET-HANDLING: when a non-interactive caller is detected the hook MUST
48
+ * suppress the WHOLE chunk (not just `attachUrl`), since `relayUrl` rides in
49
+ * the same block.
50
+ */
51
+ onQrContent: (textChunks: string[]) => void;
52
+ }
53
+ /**
54
+ * Builds a {@link RelayConnectionFactory} that opens a standalone env3 relay
55
+ * connection.
56
+ *
57
+ * `open()` performs the full attach lifecycle and BLOCKS for tens of seconds (up
58
+ * to `timeoutMs`) while a human scans the rendered QR with their phone — there
59
+ * is no way around the manual scan for env3. It resolves with the live
60
+ * `CdpConnection` once a matching page attaches; `close()` tears the relay
61
+ * family down.
62
+ *
63
+ * The factory holds the booted relay family in a closure so `close()` can stop
64
+ * it. A second `open()` on the same factory boots a fresh family (the previous
65
+ * one should have been `close()`d first).
66
+ */
67
+ declare function createRelayConnectionFactory(opts: RelayConnectionFactoryOptions): RelayConnectionFactory;
68
+ //#endregion
3
69
  //#region src/test-runner/config.d.ts
4
70
  /**
5
71
  * Resolved phone-test configuration returned by `definePhoneTestConfig`.
@@ -58,6 +124,14 @@ interface PhoneVitestUserConfig extends PhoneTestUserConfig {
58
124
  * never stores or logs those values.
59
125
  */
60
126
  connection: RelayConnectionFactory;
127
+ /**
128
+ * When `true`, the relay pool harvests `__AIT_CAPTURE__` console lines during
129
+ * the run (forwarded as `collectCaptures` to `runTestFilesOverRelay`), so
130
+ * `RelayRunReport.captures` is populated; a downstream consumer persists the
131
+ * artifacts (pool-side artifact writing + cell-meta wiring lands in PR-S1).
132
+ * Omitted/`false` = no capture harvest (build-only, zero listener overhead).
133
+ */
134
+ collectCaptures?: boolean;
61
135
  }
62
136
  /**
63
137
  * Build the Vitest `test` config slice for running tests on a device over the
@@ -76,5 +150,5 @@ interface PhoneVitestUserConfig extends PhoneTestUserConfig {
76
150
  */
77
151
  declare function definePhoneVitestConfig(userConfig: PhoneVitestUserConfig): PhoneVitestTestConfig;
78
152
  //#endregion
79
- export { PhoneTestConfig, PhoneTestUserConfig, PhoneVitestTestConfig, PhoneVitestUserConfig, RELAY_POOL_NAME, type RelayConnectionFactory, createRelayPool, definePhoneTestConfig, definePhoneVitestConfig };
153
+ export { PhoneTestConfig, PhoneTestUserConfig, PhoneVitestTestConfig, PhoneVitestUserConfig, RELAY_POOL_NAME, type RelayConnectionFactory, type RelayConnectionFactoryOptions, createRelayConnectionFactory, createRelayPool, definePhoneTestConfig, definePhoneVitestConfig };
80
154
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","names":[],"sources":["../../src/test-runner/config.ts"],"mappings":";;;;;AA6DA;UArCiB,eAAA;;;;;EAKf,OAAA;EAgCsF;;AAcxF;EA1CE,SAAA;;;;;EAKA,cAAA;AAAA;;UAIe,mBAAA;EACf,OAAA;EACA,SAAA;EACA,cAAA;AAAA;;;;;;;AAkEF;iBAlDgB,qBAAA,CAAsB,UAAA,GAAa,mBAAA,GAAsB,eAAA;;;;;;;UAcxD,qBAAA;;EAEf,IAAA,EAAM,UAAA,QAAkB,eAAA;;EAExB,OAAA;;EAEA,WAAA;AAAA;;UAIe,qBAAA,SAA8B,mBAAA;;;;;;;;EAQ7C,UAAA,EAAY,sBAAA;AAAA;;;;;;;;;;;;;;;;iBAkBE,uBAAA,CAAwB,UAAA,EAAY,qBAAA,GAAwB,qBAAA"}
1
+ {"version":3,"file":"config.d.ts","names":[],"sources":["../../src/test-runner/relay-factory.ts","../../src/test-runner/config.ts"],"mappings":";;;;UAgDiB,6BAAA;ECFA;;;;;EDQf,SAAA;ECLA;;;AAgBF;EDNE,WAAA;;;;;;;EAOA,SAAA;ECae;EDXf,QAAA;;;;;;EAMA,IAAA;IAAS,OAAA;IAAiB,QAAA;EAAA;ECeX;;;;;;;;;;AAkCjB;;;;;;EDhCE,WAAA,GAAc,UAAA;AAAA;;;;;;;;;;;;;;;iBAiBA,4BAAA,CACd,IAAA,EAAM,6BAAA,GACL,sBAAA;;;;;;UClFc,eAAA;EDkFd;;;;EC7ED,OAAA;;AALF;;EASE,SAAA;EAT8B;;;;EAc9B,cAAA;AAAA;AAIF;AAAA,UAAiB,mBAAA;EACf,OAAA;EACA,SAAA;EACA,cAAA;AAAA;;;;AAgBF;;;;iBAAgB,qBAAA,CAAsB,UAAA,GAAa,mBAAA,GAAsB,eAAA;;;;;AAczE;;UAAiB,qBAAA;EAEC;EAAhB,IAAA,EAAM,UAAA,QAAkB,eAAA;EAAlB;EAEN,OAAA;EAAA;EAEA,WAAA;AAAA;;UAIe,qBAAA,SAA8B,mBAAA;EAAR;;;;;;;EAQrC,UAAA,EAAY,sBAAA;EAQG;AAkBjB;;;;;;EAlBE,eAAA;AAAA;;;;;;;;;;;;;;;;iBAkBc,uBAAA,CAAwB,UAAA,EAAY,qBAAA,GAAwB,qBAAA"}
@@ -1,4 +1,5 @@
1
1
  import { RELAY_POOL_NAME, createRelayPool } from "./pool.js";
2
+ import { t as createRelayConnectionFactory } from "../relay-factory-DVI7TrX4.js";
2
3
  //#region src/test-runner/config.ts
3
4
  const DEFAULT_CONFIG = {
4
5
  include: ["**/*.ait.test.ts"],
@@ -41,7 +42,8 @@ function definePhoneVitestConfig(userConfig) {
41
42
  connection: userConfig.connection,
42
43
  run: {
43
44
  timeoutMs: resolved.timeoutMs,
44
- bundleOptions: { extraExternals: resolved.extraExternals }
45
+ bundleOptions: { extraExternals: resolved.extraExternals },
46
+ collectCaptures: userConfig.collectCaptures === true
45
47
  }
46
48
  }),
47
49
  include: resolved.include,
@@ -49,6 +51,6 @@ function definePhoneVitestConfig(userConfig) {
49
51
  };
50
52
  }
51
53
  //#endregion
52
- export { RELAY_POOL_NAME, createRelayPool, definePhoneTestConfig, definePhoneVitestConfig };
54
+ export { RELAY_POOL_NAME, createRelayConnectionFactory, createRelayPool, definePhoneTestConfig, definePhoneVitestConfig };
53
55
 
54
56
  //# sourceMappingURL=config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","names":[],"sources":["../../src/test-runner/config.ts"],"sourcesContent":["/**\n * Configuration helper for phone-relay test runs.\n *\n * `definePhoneTestConfig` is the user-facing entry point for configuring the\n * relay test runner. It mirrors the pattern of Vitest's `defineConfig` so\n * users can write:\n *\n * // ait-test.config.ts\n * import { definePhoneTestConfig } from '@ait-co/devtools/test-runner';\n * export default definePhoneTestConfig({ ... });\n *\n * The helper resolves user config and, when given a relay connection factory,\n * builds the Vitest `pool` (`createRelayPool`) so Vitest's own config\n * resolution routes matching files to the device over the relay (#645). Without\n * a connection factory it still returns the resolved config for use with the\n * lower-level `runTestFilesOverRelay` transport (#644).\n */\n\nimport type { RelayConnectionFactory } from './pool.js';\nimport { createRelayPool, RELAY_POOL_NAME } from './pool.js';\n\n/**\n * Resolved phone-test configuration returned by `definePhoneTestConfig`.\n */\nexport interface PhoneTestConfig {\n /**\n * Glob patterns (relative to cwd) for test files to run on the device.\n * Defaults to `['**\\/*.ait.test.ts']`.\n */\n include: string[];\n /**\n * Per-file evaluate timeout in milliseconds. Defaults to 30 000.\n */\n timeoutMs: number;\n /**\n * Additional esbuild `external` patterns for bundling.\n * The SDK package is always external; add more here if needed.\n */\n extraExternals: string[];\n}\n\n/** User-facing config shape accepted by `definePhoneTestConfig`. */\nexport interface PhoneTestUserConfig {\n include?: string[];\n timeoutMs?: number;\n extraExternals?: string[];\n}\n\nconst DEFAULT_CONFIG: PhoneTestConfig = {\n include: ['**/*.ait.test.ts'],\n timeoutMs: 30_000,\n extraExternals: [],\n};\n\n/**\n * Define a phone-relay test configuration.\n *\n * Merges user overrides with sensible defaults and returns a resolved\n * `PhoneTestConfig`. This object can be passed to `runTestFilesOverRelay`\n * (via the CLI or custom scripts) to run tests on a real device WebView.\n */\nexport function definePhoneTestConfig(userConfig?: PhoneTestUserConfig): PhoneTestConfig {\n return {\n include: userConfig?.include ?? DEFAULT_CONFIG.include,\n timeoutMs: userConfig?.timeoutMs ?? DEFAULT_CONFIG.timeoutMs,\n extraExternals: userConfig?.extraExternals ?? DEFAULT_CONFIG.extraExternals,\n };\n}\n\n/**\n * The slice of a Vitest `test` config this helper produces — `pool`,\n * `include`, and `testTimeout`. Typed structurally (not against Vitest's\n * `InlineConfig`) so consumers can spread it into their own `defineConfig`\n * without this module taking a value dependency on `vitest`.\n */\nexport interface PhoneVitestTestConfig {\n /** The relay `PoolRunnerInitializer`, matched by `getFilePoolName`. */\n pool: ReturnType<typeof createRelayPool>;\n /** Glob patterns for device test files. */\n include: string[];\n /** Per-test timeout in ms (mirrors the relay per-file evaluate timeout). */\n testTimeout: number;\n}\n\n/** User config accepted by {@link definePhoneVitestConfig}. */\nexport interface PhoneVitestUserConfig extends PhoneTestUserConfig {\n /**\n * Opens/closes the CDP relay connection that tests run over. Required —\n * without it there is no device to dispatch files to.\n *\n * SECRET-HANDLING: the factory owns the relay wss/TOTP; this config object\n * never stores or logs those values.\n */\n connection: RelayConnectionFactory;\n}\n\n/**\n * Build the Vitest `test` config slice for running tests on a device over the\n * relay. Spread the result into your Vitest config:\n *\n * @example\n * // vitest.config.ts\n * import { defineConfig } from 'vitest/config';\n * import { definePhoneVitestConfig } from '@ait-co/devtools/test-runner';\n * export default defineConfig({\n * test: definePhoneVitestConfig({ connection: myRelayFactory }),\n * });\n *\n * Files matching `include` are dispatched to the relay pool (named\n * {@link RELAY_POOL_NAME}); everything else runs in Vitest's default pool.\n */\nexport function definePhoneVitestConfig(userConfig: PhoneVitestUserConfig): PhoneVitestTestConfig {\n const resolved = definePhoneTestConfig(userConfig);\n return {\n pool: createRelayPool({\n connection: userConfig.connection,\n run: {\n timeoutMs: resolved.timeoutMs,\n bundleOptions: { extraExternals: resolved.extraExternals },\n },\n }),\n include: resolved.include,\n testTimeout: resolved.timeoutMs,\n };\n}\n\nexport type { RelayConnectionFactory };\nexport { createRelayPool, RELAY_POOL_NAME };\n"],"mappings":";;AAgDA,MAAM,iBAAkC;CACtC,SAAS,CAAC,mBAAmB;CAC7B,WAAW;CACX,gBAAgB,EAAE;CACnB;;;;;;;;AASD,SAAgB,sBAAsB,YAAmD;AACvF,QAAO;EACL,SAAS,YAAY,WAAW,eAAe;EAC/C,WAAW,YAAY,aAAa,eAAe;EACnD,gBAAgB,YAAY,kBAAkB,eAAe;EAC9D;;;;;;;;;;;;;;;;;AA6CH,SAAgB,wBAAwB,YAA0D;CAChG,MAAM,WAAW,sBAAsB,WAAW;AAClD,QAAO;EACL,MAAM,gBAAgB;GACpB,YAAY,WAAW;GACvB,KAAK;IACH,WAAW,SAAS;IACpB,eAAe,EAAE,gBAAgB,SAAS,gBAAgB;IAC3D;GACF,CAAC;EACF,SAAS,SAAS;EAClB,aAAa,SAAS;EACvB"}
1
+ {"version":3,"file":"config.js","names":[],"sources":["../../src/test-runner/config.ts"],"sourcesContent":["/**\n * Configuration helper for phone-relay test runs.\n *\n * `definePhoneTestConfig` is the user-facing entry point for configuring the\n * relay test runner. It mirrors the pattern of Vitest's `defineConfig` so\n * users can write:\n *\n * // ait-test.config.ts\n * import { definePhoneTestConfig } from '@ait-co/devtools/test-runner';\n * export default definePhoneTestConfig({ ... });\n *\n * The helper resolves user config and, when given a relay connection factory,\n * builds the Vitest `pool` (`createRelayPool`) so Vitest's own config\n * resolution routes matching files to the device over the relay (#645). Without\n * a connection factory it still returns the resolved config for use with the\n * lower-level `runTestFilesOverRelay` transport (#644).\n */\n\nimport type { RelayConnectionFactory } from './pool.js';\nimport { createRelayPool, RELAY_POOL_NAME } from './pool.js';\nimport {\n createRelayConnectionFactory,\n type RelayConnectionFactoryOptions,\n} from './relay-factory.js';\n\n/**\n * Resolved phone-test configuration returned by `definePhoneTestConfig`.\n */\nexport interface PhoneTestConfig {\n /**\n * Glob patterns (relative to cwd) for test files to run on the device.\n * Defaults to `['**\\/*.ait.test.ts']`.\n */\n include: string[];\n /**\n * Per-file evaluate timeout in milliseconds. Defaults to 30 000.\n */\n timeoutMs: number;\n /**\n * Additional esbuild `external` patterns for bundling.\n * The SDK package is always external; add more here if needed.\n */\n extraExternals: string[];\n}\n\n/** User-facing config shape accepted by `definePhoneTestConfig`. */\nexport interface PhoneTestUserConfig {\n include?: string[];\n timeoutMs?: number;\n extraExternals?: string[];\n}\n\nconst DEFAULT_CONFIG: PhoneTestConfig = {\n include: ['**/*.ait.test.ts'],\n timeoutMs: 30_000,\n extraExternals: [],\n};\n\n/**\n * Define a phone-relay test configuration.\n *\n * Merges user overrides with sensible defaults and returns a resolved\n * `PhoneTestConfig`. This object can be passed to `runTestFilesOverRelay`\n * (via the CLI or custom scripts) to run tests on a real device WebView.\n */\nexport function definePhoneTestConfig(userConfig?: PhoneTestUserConfig): PhoneTestConfig {\n return {\n include: userConfig?.include ?? DEFAULT_CONFIG.include,\n timeoutMs: userConfig?.timeoutMs ?? DEFAULT_CONFIG.timeoutMs,\n extraExternals: userConfig?.extraExternals ?? DEFAULT_CONFIG.extraExternals,\n };\n}\n\n/**\n * The slice of a Vitest `test` config this helper produces — `pool`,\n * `include`, and `testTimeout`. Typed structurally (not against Vitest's\n * `InlineConfig`) so consumers can spread it into their own `defineConfig`\n * without this module taking a value dependency on `vitest`.\n */\nexport interface PhoneVitestTestConfig {\n /** The relay `PoolRunnerInitializer`, matched by `getFilePoolName`. */\n pool: ReturnType<typeof createRelayPool>;\n /** Glob patterns for device test files. */\n include: string[];\n /** Per-test timeout in ms (mirrors the relay per-file evaluate timeout). */\n testTimeout: number;\n}\n\n/** User config accepted by {@link definePhoneVitestConfig}. */\nexport interface PhoneVitestUserConfig extends PhoneTestUserConfig {\n /**\n * Opens/closes the CDP relay connection that tests run over. Required —\n * without it there is no device to dispatch files to.\n *\n * SECRET-HANDLING: the factory owns the relay wss/TOTP; this config object\n * never stores or logs those values.\n */\n connection: RelayConnectionFactory;\n /**\n * When `true`, the relay pool harvests `__AIT_CAPTURE__` console lines during\n * the run (forwarded as `collectCaptures` to `runTestFilesOverRelay`), so\n * `RelayRunReport.captures` is populated; a downstream consumer persists the\n * artifacts (pool-side artifact writing + cell-meta wiring lands in PR-S1).\n * Omitted/`false` = no capture harvest (build-only, zero listener overhead).\n */\n collectCaptures?: boolean;\n}\n\n/**\n * Build the Vitest `test` config slice for running tests on a device over the\n * relay. Spread the result into your Vitest config:\n *\n * @example\n * // vitest.config.ts\n * import { defineConfig } from 'vitest/config';\n * import { definePhoneVitestConfig } from '@ait-co/devtools/test-runner';\n * export default defineConfig({\n * test: definePhoneVitestConfig({ connection: myRelayFactory }),\n * });\n *\n * Files matching `include` are dispatched to the relay pool (named\n * {@link RELAY_POOL_NAME}); everything else runs in Vitest's default pool.\n */\nexport function definePhoneVitestConfig(userConfig: PhoneVitestUserConfig): PhoneVitestTestConfig {\n const resolved = definePhoneTestConfig(userConfig);\n return {\n pool: createRelayPool({\n connection: userConfig.connection,\n run: {\n timeoutMs: resolved.timeoutMs,\n bundleOptions: { extraExternals: resolved.extraExternals },\n // Harvest captures only when explicitly opted in — keeps the build-only\n // path free of the live console listener (#696).\n collectCaptures: userConfig.collectCaptures === true,\n },\n }),\n include: resolved.include,\n testTimeout: resolved.timeoutMs,\n };\n}\n\nexport type { RelayConnectionFactory, RelayConnectionFactoryOptions };\n// Re-exported so a downstream `vitest.config.ts` can build the connection\n// factory straight from the `@ait-co/devtools/test-runner` barrel. relay-factory\n// keeps its heavy MCP graph behind dynamic imports, so this static re-export does\n// NOT drag chii/cloudflared/tools onto this Node-config entry (verified by\n// scripts/check-test-runner-dist.sh).\nexport { createRelayConnectionFactory, createRelayPool, RELAY_POOL_NAME };\n"],"mappings":";;;AAoDA,MAAM,iBAAkC;CACtC,SAAS,CAAC,mBAAmB;CAC7B,WAAW;CACX,gBAAgB,EAAE;CACnB;;;;;;;;AASD,SAAgB,sBAAsB,YAAmD;AACvF,QAAO;EACL,SAAS,YAAY,WAAW,eAAe;EAC/C,WAAW,YAAY,aAAa,eAAe;EACnD,gBAAgB,YAAY,kBAAkB,eAAe;EAC9D;;;;;;;;;;;;;;;;;AAqDH,SAAgB,wBAAwB,YAA0D;CAChG,MAAM,WAAW,sBAAsB,WAAW;AAClD,QAAO;EACL,MAAM,gBAAgB;GACpB,YAAY,WAAW;GACvB,KAAK;IACH,WAAW,SAAS;IACpB,eAAe,EAAE,gBAAgB,SAAS,gBAAgB;IAG1D,iBAAiB,WAAW,oBAAoB;IACjD;GACF,CAAC;EACF,SAAS,SAAS;EAClB,aAAa,SAAS;EACvB"}
@@ -1,2 +1,2 @@
1
- import { i as createRelayPool, n as RelayConnectionFactory, r as RelayPoolOptions, t as RELAY_POOL_NAME } from "../pool-htlVnEFl.js";
1
+ import { i as createRelayPool, n as RelayConnectionFactory, r as RelayPoolOptions, t as RELAY_POOL_NAME } from "../pool-U9FrxEuR.js";
2
2
  export { RELAY_POOL_NAME, RelayConnectionFactory, RelayPoolOptions, createRelayPool };