@ait-co/devtools 0.1.131 → 0.1.133

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 (95) hide show
  1. package/dist/{attach-orchestrator-ca34r46y.js → attach-orchestrator-CE0S09YU.js} +110 -5
  2. package/dist/attach-orchestrator-CE0S09YU.js.map +1 -0
  3. package/dist/{attach-orchestrator-BiaYiNOr.js → attach-orchestrator-CMoDuG2A.js} +110 -5
  4. package/dist/attach-orchestrator-CMoDuG2A.js.map +1 -0
  5. package/dist/cell-BIdSQb9T.js +201 -0
  6. package/dist/cell-BIdSQb9T.js.map +1 -0
  7. package/dist/{cell-Cw4fVOl2.js → cell-D1y4shoV.js} +1 -21
  8. package/dist/cell-D1y4shoV.js.map +1 -0
  9. package/dist/cell-DHA578lX.js +200 -0
  10. package/dist/cell-DHA578lX.js.map +1 -0
  11. package/dist/{debug-server-qRSRG7YZ.js → debug-server-CS1BS2BX.js} +21 -3
  12. package/dist/debug-server-CS1BS2BX.js.map +1 -0
  13. package/dist/{debug-server-BSbfnFR5.js → debug-server-DmzuK2c6.js} +26 -9
  14. package/dist/debug-server-DmzuK2c6.js.map +1 -0
  15. package/dist/{debug-server-CD4zYBq4.js → debug-server-DnNCoNiR.js} +7 -7
  16. package/dist/{debug-server-CD4zYBq4.js.map → debug-server-DnNCoNiR.js.map} +1 -1
  17. package/dist/mcp/cli.js +180 -8
  18. package/dist/mcp/cli.js.map +1 -1
  19. package/dist/mcp/server.js +1 -1
  20. package/dist/panel/index.js +1 -1
  21. package/dist/{pool-BaSCZALv.d.ts → pool-x28Wv1ty.d.ts} +16 -2
  22. package/dist/{pool-BaSCZALv.d.ts.map → pool-x28Wv1ty.d.ts.map} +1 -1
  23. package/dist/{qr-http-server-DCbjORFa.js → qr-http-server-C_DTp9WU.js} +3 -2
  24. package/dist/{qr-http-server-DCbjORFa.js.map → qr-http-server-C_DTp9WU.js.map} +1 -1
  25. package/dist/{qr-http-server-BxoRp2w7.cjs → qr-http-server-DX_9UA-p.cjs} +3 -2
  26. package/dist/qr-http-server-DX_9UA-p.cjs.map +1 -0
  27. package/dist/{qr-http-server-BdNGPRoL.js → qr-http-server-DeRrKp_R.js} +3 -2
  28. package/dist/{qr-http-server-BdNGPRoL.js.map → qr-http-server-DeRrKp_R.js.map} +1 -1
  29. package/dist/{qr-http-server-cKbciY5k.js → qr-http-server-FVn61xAq.js} +3 -2
  30. package/dist/{qr-http-server-Bq9zR7-z.js.map → qr-http-server-FVn61xAq.js.map} +1 -1
  31. package/dist/{qr-http-server-Bq9zR7-z.js → qr-http-server-V0xuU5TJ.js} +3 -2
  32. package/dist/{qr-http-server-cKbciY5k.js.map → qr-http-server-V0xuU5TJ.js.map} +1 -1
  33. package/dist/{qr-http-server-CV6TA9ZN.cjs → qr-http-server-iH_Hh_si.cjs} +3 -2
  34. package/dist/qr-http-server-iH_Hh_si.cjs.map +1 -0
  35. package/dist/{relay-factory-Cloog1jb.js → relay-factory-BQfmK7RP.js} +14 -8
  36. package/dist/relay-factory-BQfmK7RP.js.map +1 -0
  37. package/dist/{relay-secret-store-CFc9n0OA.js → relay-secret-store-CLEGyHou.js} +2 -2
  38. package/dist/{relay-secret-store-CFc9n0OA.js.map → relay-secret-store-CLEGyHou.js.map} +1 -1
  39. package/dist/{relay-secret-store-DzxDsK6S.js → relay-secret-store-DGduVJhs.js} +2 -2
  40. package/dist/{relay-secret-store-DzxDsK6S.js.map → relay-secret-store-DGduVJhs.js.map} +1 -1
  41. package/dist/{relay-url-store-D3rY-GJJ.js → relay-url-store-B0X8TsGr.js} +2 -2
  42. package/dist/{relay-url-store-D3rY-GJJ.js.map → relay-url-store-B0X8TsGr.js.map} +1 -1
  43. package/dist/{relay-url-store-DGQ-HPQC.js → relay-url-store-CKW8RQzf.js} +2 -2
  44. package/dist/{relay-url-store-DGQ-HPQC.js.map → relay-url-store-CKW8RQzf.js.map} +1 -1
  45. package/dist/{relay-worker-o0M2ndyJ.d.ts → relay-worker-DtX_eszH.d.ts} +51 -2
  46. package/dist/relay-worker-DtX_eszH.d.ts.map +1 -0
  47. package/dist/{relay-worker-CCAHLC4a.js → relay-worker-MZq4fLv8.js} +27 -6
  48. package/dist/{relay-worker-CCAHLC4a.js.map → relay-worker-MZq4fLv8.js.map} +1 -1
  49. package/dist/rolldown-runtime-DGkTqVfb.js +15 -0
  50. package/dist/rolldown-runtime-DUslC3ob.js +14 -0
  51. package/dist/test-runner/bin.js +173 -119
  52. package/dist/test-runner/bin.js.map +1 -1
  53. package/dist/test-runner/config.d.ts +1 -1
  54. package/dist/test-runner/config.js +1 -1
  55. package/dist/test-runner/pool.d.ts +1 -1
  56. package/dist/test-runner/pool.js +1 -1
  57. package/dist/test-runner/pool.js.map +1 -1
  58. package/dist/test-runner/relay-factory.d.ts +14 -0
  59. package/dist/test-runner/relay-factory.d.ts.map +1 -1
  60. package/dist/test-runner/relay-factory.js +11 -5
  61. package/dist/test-runner/relay-factory.js.map +1 -1
  62. package/dist/test-runner/relay-worker.d.ts +2 -2
  63. package/dist/test-runner/relay-worker.js +2 -2
  64. package/dist/test-runner/report.d.ts +35 -4
  65. package/dist/test-runner/report.d.ts.map +1 -1
  66. package/dist/test-runner/report.js +42 -7
  67. package/dist/test-runner/report.js.map +1 -1
  68. package/dist/{totp-DvOYkYim.js → totp-CZLLKfOC.js} +2 -14
  69. package/dist/{totp-DvOYkYim.js.map → totp-CZLLKfOC.js.map} +1 -1
  70. package/dist/totp-DAxys-r0.js +199 -0
  71. package/dist/totp-DAxys-r0.js.map +1 -0
  72. package/dist/{tunnel-B2UCKAc7.cjs → tunnel-DP453L4e.cjs} +2 -2
  73. package/dist/{tunnel-B2UCKAc7.cjs.map → tunnel-DP453L4e.cjs.map} +1 -1
  74. package/dist/{tunnel-C-rQ34dM.js → tunnel-Djf-zmjJ.js} +2 -2
  75. package/dist/{tunnel-C-rQ34dM.js.map → tunnel-Djf-zmjJ.js.map} +1 -1
  76. package/dist/unplugin/index.cjs +1 -1
  77. package/dist/unplugin/index.js +1 -1
  78. package/dist/unplugin/tunnel.cjs +1 -1
  79. package/dist/unplugin/tunnel.js +1 -1
  80. package/package.json +1 -1
  81. package/dist/attach-orchestrator-BiaYiNOr.js.map +0 -1
  82. package/dist/attach-orchestrator-ca34r46y.js.map +0 -1
  83. package/dist/cell-Bi8MAPA8.js +0 -88
  84. package/dist/cell-Bi8MAPA8.js.map +0 -1
  85. package/dist/cell-Cw4fVOl2.js.map +0 -1
  86. package/dist/cell-rr6gL9AT.js +0 -89
  87. package/dist/cell-rr6gL9AT.js.map +0 -1
  88. package/dist/debug-server-BSbfnFR5.js.map +0 -1
  89. package/dist/debug-server-qRSRG7YZ.js.map +0 -1
  90. package/dist/log-CUik_tHp.js +0 -95
  91. package/dist/log-CUik_tHp.js.map +0 -1
  92. package/dist/qr-http-server-BxoRp2w7.cjs.map +0 -1
  93. package/dist/qr-http-server-CV6TA9ZN.cjs.map +0 -1
  94. package/dist/relay-factory-Cloog1jb.js.map +0 -1
  95. package/dist/relay-worker-o0M2ndyJ.d.ts.map +0 -1
@@ -1,88 +0,0 @@
1
- import { buildIndicatorExpression } from "./attach-orchestrator-BiaYiNOr.js";
2
- //#region src/test-runner/cell.ts
3
- /**
4
- * Cell injection utility for the `devtools-test` CLI (issue #684 §4.1).
5
- *
6
- * Injects arbitrary globals into the page via `Runtime.evaluate` BEFORE the
7
- * first test bundle is injected. The injected values are session-global — one
8
- * call covers all files in the run.
9
- *
10
- * The primary use-case is injecting `__AIT_CELL__` (sdkLine/platform) so
11
- * sdk-example's `aitCapture.ts` picks up the correct test-axis values instead
12
- * of falling back to `'2.x'`/`'mock'`.
13
- *
14
- * devtools does NOT know the shape of `__AIT_CELL__` — it only provides the
15
- * general injection mechanism. The caller (CLI or MCP auto-attach path) is
16
- * responsible for constructing the cell object.
17
- *
18
- * SECRET-HANDLING: cell values (sdkLine/platform) are not secrets and may be
19
- * logged at the caller's discretion. This module does NOT log them itself.
20
- *
21
- * Node-only. react-free. CdpConnection only.
22
- */
23
- /**
24
- * Injects each key of `globals` into `globalThis` in the page via a single
25
- * `Runtime.evaluate` call. Must be called BEFORE the first `bundleTestFile`
26
- * inject — the cell is session-global and applies to all subsequent files.
27
- *
28
- * Throws if the CDP evaluate returns an exception.
29
- *
30
- * @param conn - The live CDP connection (relay-attached page).
31
- * @param globals - Plain-JSON-serialisable key→value map to assign onto `globalThis`.
32
- */
33
- async function injectGlobals(conn, globals) {
34
- const expr = `(() => { Object.assign(globalThis, ${JSON.stringify(globals)}); return true; })()`;
35
- const result = await conn.send("Runtime.evaluate", {
36
- expression: expr,
37
- returnByValue: true
38
- });
39
- if (result.exceptionDetails) {
40
- const msg = result.exceptionDetails.exception?.description ?? result.exceptionDetails.text ?? "unknown error";
41
- throw new Error(`injectGlobals: Runtime.evaluate threw: ${msg}`);
42
- }
43
- }
44
- /**
45
- * Injects (or updates) the "Debugger Connected"/"Debugger Disconnected"
46
- * on-phone indicator via `Runtime.evaluate` (#730).
47
- *
48
- * Uses the same CDP mechanism as {@link injectGlobals} — a single
49
- * `Runtime.evaluate` round-trip with the expression built by
50
- * {@link buildIndicatorExpression}. The indicator is a LIVE badge rendered at
51
- * the bottom-left of the page (position:fixed, safe-area-aware): the badge's
52
- * controller is idempotent, so calling this again (e.g. right before
53
- * `close()` with `{ state: 'disconnected' }`) UPDATES the existing badge in
54
- * place instead of injecting a duplicate.
55
- *
56
- * **Isolation**: unlike {@link injectGlobals}, this function NEVER throws to
57
- * its caller. Injection failure (e.g. page detached during inject, CSS not
58
- * supported) is swallowed and logged as `console.debug` — the badge is
59
- * informational UI and must never block attach success or test execution.
60
- * This is the same fire-and-forget spirit as the in-page console mount in
61
- * `src/in-app/attach.ts`.
62
- *
63
- * Call this ONLY on the manual debug paths (start_attach MCP, devtools-test
64
- * CLI). Do NOT call on the `run_tests` auto-attach path — the badge
65
- * would contaminate screenshots, measure_safe_area probes, and DOM snapshots
66
- * taken during automated measurement runs.
67
- *
68
- * SECRET-HANDLING: the injected expression contains no secrets, relay URLs,
69
- * wss addresses, or TOTP codes — it is pure DOM UI text + enum state built by
70
- * {@link buildIndicatorExpression}.
71
- *
72
- * @param conn - The live CDP connection (relay-attached page).
73
- * @param opts - Optional overrides forwarded to {@link buildIndicatorExpression}.
74
- */
75
- async function injectDebugIndicator(conn, opts) {
76
- try {
77
- await conn.send("Runtime.evaluate", {
78
- expression: buildIndicatorExpression(opts),
79
- returnByValue: true
80
- });
81
- } catch (err) {
82
- console.debug("[@ait-co/devtools] debug indicator inject skipped:", err);
83
- }
84
- }
85
- //#endregion
86
- export { injectDebugIndicator, injectGlobals };
87
-
88
- //# sourceMappingURL=cell-Bi8MAPA8.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cell-Bi8MAPA8.js","names":[],"sources":["../src/test-runner/cell.ts"],"sourcesContent":["/**\n * Cell injection utility for the `devtools-test` CLI (issue #684 §4.1).\n *\n * Injects arbitrary globals into the page via `Runtime.evaluate` BEFORE the\n * first test bundle is injected. The injected values are session-global — one\n * call covers all files in the run.\n *\n * The primary use-case is injecting `__AIT_CELL__` (sdkLine/platform) so\n * sdk-example's `aitCapture.ts` picks up the correct test-axis values instead\n * of falling back to `'2.x'`/`'mock'`.\n *\n * devtools does NOT know the shape of `__AIT_CELL__` — it only provides the\n * general injection mechanism. The caller (CLI or MCP auto-attach path) is\n * responsible for constructing the cell object.\n *\n * SECRET-HANDLING: cell values (sdkLine/platform) are not secrets and may be\n * logged at the caller's discretion. This module does NOT log them itself.\n *\n * Node-only. react-free. CdpConnection only.\n */\n\nimport { buildIndicatorExpression } from '../mcp/attach-orchestrator.js';\nimport type { CdpConnection } from '../mcp/cdp-connection.js';\n\n/**\n * Injects each key of `globals` into `globalThis` in the page via a single\n * `Runtime.evaluate` call. Must be called BEFORE the first `bundleTestFile`\n * inject — the cell is session-global and applies to all subsequent files.\n *\n * Throws if the CDP evaluate returns an exception.\n *\n * @param conn - The live CDP connection (relay-attached page).\n * @param globals - Plain-JSON-serialisable key→value map to assign onto `globalThis`.\n */\nexport async function injectGlobals(\n conn: CdpConnection,\n globals: Record<string, unknown>,\n): Promise<void> {\n // JSON.stringify is safe here: globals values are plain data (sdkLine/platform\n // strings or simple objects). If a value is not JSON-serialisable this throws\n // at call time, which surfaces the error early and clearly.\n const expr = `(() => { Object.assign(globalThis, ${JSON.stringify(globals)}); return true; })()`;\n const result = await conn.send('Runtime.evaluate', { expression: expr, returnByValue: true });\n if (result.exceptionDetails) {\n const msg =\n result.exceptionDetails.exception?.description ??\n result.exceptionDetails.text ??\n 'unknown error';\n throw new Error(`injectGlobals: Runtime.evaluate threw: ${msg}`);\n }\n}\n\n/**\n * Injects (or updates) the \"Debugger Connected\"/\"Debugger Disconnected\"\n * on-phone indicator via `Runtime.evaluate` (#730).\n *\n * Uses the same CDP mechanism as {@link injectGlobals} — a single\n * `Runtime.evaluate` round-trip with the expression built by\n * {@link buildIndicatorExpression}. The indicator is a LIVE badge rendered at\n * the bottom-left of the page (position:fixed, safe-area-aware): the badge's\n * controller is idempotent, so calling this again (e.g. right before\n * `close()` with `{ state: 'disconnected' }`) UPDATES the existing badge in\n * place instead of injecting a duplicate.\n *\n * **Isolation**: unlike {@link injectGlobals}, this function NEVER throws to\n * its caller. Injection failure (e.g. page detached during inject, CSS not\n * supported) is swallowed and logged as `console.debug` — the badge is\n * informational UI and must never block attach success or test execution.\n * This is the same fire-and-forget spirit as the in-page console mount in\n * `src/in-app/attach.ts`.\n *\n * Call this ONLY on the manual debug paths (start_attach MCP, devtools-test\n * CLI). Do NOT call on the `run_tests` auto-attach path — the badge\n * would contaminate screenshots, measure_safe_area probes, and DOM snapshots\n * taken during automated measurement runs.\n *\n * SECRET-HANDLING: the injected expression contains no secrets, relay URLs,\n * wss addresses, or TOTP codes — it is pure DOM UI text + enum state built by\n * {@link buildIndicatorExpression}.\n *\n * @param conn - The live CDP connection (relay-attached page).\n * @param opts - Optional overrides forwarded to {@link buildIndicatorExpression}.\n */\nexport async function injectDebugIndicator(\n conn: CdpConnection,\n opts?: { label?: string; disconnectedLabel?: string; state?: 'attached' | 'disconnected' },\n): Promise<void> {\n try {\n await conn.send('Runtime.evaluate', {\n expression: buildIndicatorExpression(opts),\n returnByValue: true,\n });\n } catch (err) {\n // Badge injection is informational UI — swallow and log; never propagate.\n console.debug('[@ait-co/devtools] debug indicator inject skipped:', err);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,eAAsB,cACpB,MACA,SACe;CAIf,MAAM,OAAO,sCAAsC,KAAK,UAAU,QAAQ,CAAC;CAC3E,MAAM,SAAS,MAAM,KAAK,KAAK,oBAAoB;EAAE,YAAY;EAAM,eAAe;EAAM,CAAC;AAC7F,KAAI,OAAO,kBAAkB;EAC3B,MAAM,MACJ,OAAO,iBAAiB,WAAW,eACnC,OAAO,iBAAiB,QACxB;AACF,QAAM,IAAI,MAAM,0CAA0C,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCpE,eAAsB,qBACpB,MACA,MACe;AACf,KAAI;AACF,QAAM,KAAK,KAAK,oBAAoB;GAClC,YAAY,yBAAyB,KAAK;GAC1C,eAAe;GAChB,CAAC;UACK,KAAK;AAEZ,UAAQ,MAAM,sDAAsD,IAAI"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"cell-Cw4fVOl2.js","names":[],"sources":["../src/test-runner/cell.ts"],"sourcesContent":["/**\n * Cell injection utility for the `devtools-test` CLI (issue #684 §4.1).\n *\n * Injects arbitrary globals into the page via `Runtime.evaluate` BEFORE the\n * first test bundle is injected. The injected values are session-global — one\n * call covers all files in the run.\n *\n * The primary use-case is injecting `__AIT_CELL__` (sdkLine/platform) so\n * sdk-example's `aitCapture.ts` picks up the correct test-axis values instead\n * of falling back to `'2.x'`/`'mock'`.\n *\n * devtools does NOT know the shape of `__AIT_CELL__` — it only provides the\n * general injection mechanism. The caller (CLI or MCP auto-attach path) is\n * responsible for constructing the cell object.\n *\n * SECRET-HANDLING: cell values (sdkLine/platform) are not secrets and may be\n * logged at the caller's discretion. This module does NOT log them itself.\n *\n * Node-only. react-free. CdpConnection only.\n */\n\nimport { buildIndicatorExpression } from '../mcp/attach-orchestrator.js';\nimport type { CdpConnection } from '../mcp/cdp-connection.js';\n\n/**\n * Injects each key of `globals` into `globalThis` in the page via a single\n * `Runtime.evaluate` call. Must be called BEFORE the first `bundleTestFile`\n * inject — the cell is session-global and applies to all subsequent files.\n *\n * Throws if the CDP evaluate returns an exception.\n *\n * @param conn - The live CDP connection (relay-attached page).\n * @param globals - Plain-JSON-serialisable key→value map to assign onto `globalThis`.\n */\nexport async function injectGlobals(\n conn: CdpConnection,\n globals: Record<string, unknown>,\n): Promise<void> {\n // JSON.stringify is safe here: globals values are plain data (sdkLine/platform\n // strings or simple objects). If a value is not JSON-serialisable this throws\n // at call time, which surfaces the error early and clearly.\n const expr = `(() => { Object.assign(globalThis, ${JSON.stringify(globals)}); return true; })()`;\n const result = await conn.send('Runtime.evaluate', { expression: expr, returnByValue: true });\n if (result.exceptionDetails) {\n const msg =\n result.exceptionDetails.exception?.description ??\n result.exceptionDetails.text ??\n 'unknown error';\n throw new Error(`injectGlobals: Runtime.evaluate threw: ${msg}`);\n }\n}\n\n/**\n * Injects (or updates) the \"Debugger Connected\"/\"Debugger Disconnected\"\n * on-phone indicator via `Runtime.evaluate` (#730).\n *\n * Uses the same CDP mechanism as {@link injectGlobals} — a single\n * `Runtime.evaluate` round-trip with the expression built by\n * {@link buildIndicatorExpression}. The indicator is a LIVE badge rendered at\n * the bottom-left of the page (position:fixed, safe-area-aware): the badge's\n * controller is idempotent, so calling this again (e.g. right before\n * `close()` with `{ state: 'disconnected' }`) UPDATES the existing badge in\n * place instead of injecting a duplicate.\n *\n * **Isolation**: unlike {@link injectGlobals}, this function NEVER throws to\n * its caller. Injection failure (e.g. page detached during inject, CSS not\n * supported) is swallowed and logged as `console.debug` — the badge is\n * informational UI and must never block attach success or test execution.\n * This is the same fire-and-forget spirit as the in-page console mount in\n * `src/in-app/attach.ts`.\n *\n * Call this ONLY on the manual debug paths (start_attach MCP, devtools-test\n * CLI). Do NOT call on the `run_tests` auto-attach path — the badge\n * would contaminate screenshots, measure_safe_area probes, and DOM snapshots\n * taken during automated measurement runs.\n *\n * SECRET-HANDLING: the injected expression contains no secrets, relay URLs,\n * wss addresses, or TOTP codes — it is pure DOM UI text + enum state built by\n * {@link buildIndicatorExpression}.\n *\n * @param conn - The live CDP connection (relay-attached page).\n * @param opts - Optional overrides forwarded to {@link buildIndicatorExpression}.\n */\nexport async function injectDebugIndicator(\n conn: CdpConnection,\n opts?: { label?: string; disconnectedLabel?: string; state?: 'attached' | 'disconnected' },\n): Promise<void> {\n try {\n await conn.send('Runtime.evaluate', {\n expression: buildIndicatorExpression(opts),\n returnByValue: true,\n });\n } catch (err) {\n // Badge injection is informational UI — swallow and log; never propagate.\n console.debug('[@ait-co/devtools] debug indicator inject skipped:', err);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,eAAsB,cACpB,MACA,SACe;CAIf,MAAM,OAAO,sCAAsC,KAAK,UAAU,QAAQ,CAAC;CAC3E,MAAM,SAAS,MAAM,KAAK,KAAK,oBAAoB;EAAE,YAAY;EAAM,eAAe;EAAM,CAAC;AAC7F,KAAI,OAAO,kBAAkB;EAC3B,MAAM,MACJ,OAAO,iBAAiB,WAAW,eACnC,OAAO,iBAAiB,QACxB;AACF,QAAM,IAAI,MAAM,0CAA0C,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCpE,eAAsB,qBACpB,MACA,MACe;AACf,KAAI;AACF,QAAM,KAAK,KAAK,oBAAoB;GAClC,YAAY,yBAAyB,KAAK;GAC1C,eAAe;GAChB,CAAC;UACK,KAAK;AAEZ,UAAQ,MAAM,sDAAsD,IAAI"}
@@ -1,89 +0,0 @@
1
- #!/usr/bin/env node
2
- import { buildIndicatorExpression } from "./attach-orchestrator-ca34r46y.js";
3
- //#region src/test-runner/cell.ts
4
- /**
5
- * Cell injection utility for the `devtools-test` CLI (issue #684 §4.1).
6
- *
7
- * Injects arbitrary globals into the page via `Runtime.evaluate` BEFORE the
8
- * first test bundle is injected. The injected values are session-global — one
9
- * call covers all files in the run.
10
- *
11
- * The primary use-case is injecting `__AIT_CELL__` (sdkLine/platform) so
12
- * sdk-example's `aitCapture.ts` picks up the correct test-axis values instead
13
- * of falling back to `'2.x'`/`'mock'`.
14
- *
15
- * devtools does NOT know the shape of `__AIT_CELL__` — it only provides the
16
- * general injection mechanism. The caller (CLI or MCP auto-attach path) is
17
- * responsible for constructing the cell object.
18
- *
19
- * SECRET-HANDLING: cell values (sdkLine/platform) are not secrets and may be
20
- * logged at the caller's discretion. This module does NOT log them itself.
21
- *
22
- * Node-only. react-free. CdpConnection only.
23
- */
24
- /**
25
- * Injects each key of `globals` into `globalThis` in the page via a single
26
- * `Runtime.evaluate` call. Must be called BEFORE the first `bundleTestFile`
27
- * inject — the cell is session-global and applies to all subsequent files.
28
- *
29
- * Throws if the CDP evaluate returns an exception.
30
- *
31
- * @param conn - The live CDP connection (relay-attached page).
32
- * @param globals - Plain-JSON-serialisable key→value map to assign onto `globalThis`.
33
- */
34
- async function injectGlobals(conn, globals) {
35
- const expr = `(() => { Object.assign(globalThis, ${JSON.stringify(globals)}); return true; })()`;
36
- const result = await conn.send("Runtime.evaluate", {
37
- expression: expr,
38
- returnByValue: true
39
- });
40
- if (result.exceptionDetails) {
41
- const msg = result.exceptionDetails.exception?.description ?? result.exceptionDetails.text ?? "unknown error";
42
- throw new Error(`injectGlobals: Runtime.evaluate threw: ${msg}`);
43
- }
44
- }
45
- /**
46
- * Injects (or updates) the "Debugger Connected"/"Debugger Disconnected"
47
- * on-phone indicator via `Runtime.evaluate` (#730).
48
- *
49
- * Uses the same CDP mechanism as {@link injectGlobals} — a single
50
- * `Runtime.evaluate` round-trip with the expression built by
51
- * {@link buildIndicatorExpression}. The indicator is a LIVE badge rendered at
52
- * the bottom-left of the page (position:fixed, safe-area-aware): the badge's
53
- * controller is idempotent, so calling this again (e.g. right before
54
- * `close()` with `{ state: 'disconnected' }`) UPDATES the existing badge in
55
- * place instead of injecting a duplicate.
56
- *
57
- * **Isolation**: unlike {@link injectGlobals}, this function NEVER throws to
58
- * its caller. Injection failure (e.g. page detached during inject, CSS not
59
- * supported) is swallowed and logged as `console.debug` — the badge is
60
- * informational UI and must never block attach success or test execution.
61
- * This is the same fire-and-forget spirit as the in-page console mount in
62
- * `src/in-app/attach.ts`.
63
- *
64
- * Call this ONLY on the manual debug paths (start_attach MCP, devtools-test
65
- * CLI). Do NOT call on the `run_tests` auto-attach path — the badge
66
- * would contaminate screenshots, measure_safe_area probes, and DOM snapshots
67
- * taken during automated measurement runs.
68
- *
69
- * SECRET-HANDLING: the injected expression contains no secrets, relay URLs,
70
- * wss addresses, or TOTP codes — it is pure DOM UI text + enum state built by
71
- * {@link buildIndicatorExpression}.
72
- *
73
- * @param conn - The live CDP connection (relay-attached page).
74
- * @param opts - Optional overrides forwarded to {@link buildIndicatorExpression}.
75
- */
76
- async function injectDebugIndicator(conn, opts) {
77
- try {
78
- await conn.send("Runtime.evaluate", {
79
- expression: buildIndicatorExpression(opts),
80
- returnByValue: true
81
- });
82
- } catch (err) {
83
- console.debug("[@ait-co/devtools] debug indicator inject skipped:", err);
84
- }
85
- }
86
- //#endregion
87
- export { injectDebugIndicator, injectGlobals };
88
-
89
- //# sourceMappingURL=cell-rr6gL9AT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cell-rr6gL9AT.js","names":[],"sources":["../src/test-runner/cell.ts"],"sourcesContent":["/**\n * Cell injection utility for the `devtools-test` CLI (issue #684 §4.1).\n *\n * Injects arbitrary globals into the page via `Runtime.evaluate` BEFORE the\n * first test bundle is injected. The injected values are session-global — one\n * call covers all files in the run.\n *\n * The primary use-case is injecting `__AIT_CELL__` (sdkLine/platform) so\n * sdk-example's `aitCapture.ts` picks up the correct test-axis values instead\n * of falling back to `'2.x'`/`'mock'`.\n *\n * devtools does NOT know the shape of `__AIT_CELL__` — it only provides the\n * general injection mechanism. The caller (CLI or MCP auto-attach path) is\n * responsible for constructing the cell object.\n *\n * SECRET-HANDLING: cell values (sdkLine/platform) are not secrets and may be\n * logged at the caller's discretion. This module does NOT log them itself.\n *\n * Node-only. react-free. CdpConnection only.\n */\n\nimport { buildIndicatorExpression } from '../mcp/attach-orchestrator.js';\nimport type { CdpConnection } from '../mcp/cdp-connection.js';\n\n/**\n * Injects each key of `globals` into `globalThis` in the page via a single\n * `Runtime.evaluate` call. Must be called BEFORE the first `bundleTestFile`\n * inject — the cell is session-global and applies to all subsequent files.\n *\n * Throws if the CDP evaluate returns an exception.\n *\n * @param conn - The live CDP connection (relay-attached page).\n * @param globals - Plain-JSON-serialisable key→value map to assign onto `globalThis`.\n */\nexport async function injectGlobals(\n conn: CdpConnection,\n globals: Record<string, unknown>,\n): Promise<void> {\n // JSON.stringify is safe here: globals values are plain data (sdkLine/platform\n // strings or simple objects). If a value is not JSON-serialisable this throws\n // at call time, which surfaces the error early and clearly.\n const expr = `(() => { Object.assign(globalThis, ${JSON.stringify(globals)}); return true; })()`;\n const result = await conn.send('Runtime.evaluate', { expression: expr, returnByValue: true });\n if (result.exceptionDetails) {\n const msg =\n result.exceptionDetails.exception?.description ??\n result.exceptionDetails.text ??\n 'unknown error';\n throw new Error(`injectGlobals: Runtime.evaluate threw: ${msg}`);\n }\n}\n\n/**\n * Injects (or updates) the \"Debugger Connected\"/\"Debugger Disconnected\"\n * on-phone indicator via `Runtime.evaluate` (#730).\n *\n * Uses the same CDP mechanism as {@link injectGlobals} — a single\n * `Runtime.evaluate` round-trip with the expression built by\n * {@link buildIndicatorExpression}. The indicator is a LIVE badge rendered at\n * the bottom-left of the page (position:fixed, safe-area-aware): the badge's\n * controller is idempotent, so calling this again (e.g. right before\n * `close()` with `{ state: 'disconnected' }`) UPDATES the existing badge in\n * place instead of injecting a duplicate.\n *\n * **Isolation**: unlike {@link injectGlobals}, this function NEVER throws to\n * its caller. Injection failure (e.g. page detached during inject, CSS not\n * supported) is swallowed and logged as `console.debug` — the badge is\n * informational UI and must never block attach success or test execution.\n * This is the same fire-and-forget spirit as the in-page console mount in\n * `src/in-app/attach.ts`.\n *\n * Call this ONLY on the manual debug paths (start_attach MCP, devtools-test\n * CLI). Do NOT call on the `run_tests` auto-attach path — the badge\n * would contaminate screenshots, measure_safe_area probes, and DOM snapshots\n * taken during automated measurement runs.\n *\n * SECRET-HANDLING: the injected expression contains no secrets, relay URLs,\n * wss addresses, or TOTP codes — it is pure DOM UI text + enum state built by\n * {@link buildIndicatorExpression}.\n *\n * @param conn - The live CDP connection (relay-attached page).\n * @param opts - Optional overrides forwarded to {@link buildIndicatorExpression}.\n */\nexport async function injectDebugIndicator(\n conn: CdpConnection,\n opts?: { label?: string; disconnectedLabel?: string; state?: 'attached' | 'disconnected' },\n): Promise<void> {\n try {\n await conn.send('Runtime.evaluate', {\n expression: buildIndicatorExpression(opts),\n returnByValue: true,\n });\n } catch (err) {\n // Badge injection is informational UI — swallow and log; never propagate.\n console.debug('[@ait-co/devtools] debug indicator inject skipped:', err);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,eAAsB,cACpB,MACA,SACe;CAIf,MAAM,OAAO,sCAAsC,KAAK,UAAU,QAAQ,CAAC;CAC3E,MAAM,SAAS,MAAM,KAAK,KAAK,oBAAoB;EAAE,YAAY;EAAM,eAAe;EAAM,CAAC;AAC7F,KAAI,OAAO,kBAAkB;EAC3B,MAAM,MACJ,OAAO,iBAAiB,WAAW,eACnC,OAAO,iBAAiB,QACxB;AACF,QAAM,IAAI,MAAM,0CAA0C,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCpE,eAAsB,qBACpB,MACA,MACe;AACf,KAAI;AACF,QAAM,KAAK,KAAK,oBAAoB;GAClC,YAAY,yBAAyB,KAAK;GAC1C,eAAe;GAChB,CAAC;UACK,KAAK;AAEZ,UAAQ,MAAM,sDAAsD,IAAI"}