@ait-co/devtools 0.1.136 → 0.1.138

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 (126) hide show
  1. package/dist/{attach-orchestrator-Cjdhir2U.js → attach-orchestrator-6kz_ZdWL.js} +5 -3
  2. package/dist/{attach-orchestrator-Cjdhir2U.js.map → attach-orchestrator-6kz_ZdWL.js.map} +1 -1
  3. package/dist/{attach-orchestrator-CE0S09YU.js → attach-orchestrator-BEiz3wAx.js} +5 -3
  4. package/dist/{attach-orchestrator-CMoDuG2A.js.map → attach-orchestrator-BEiz3wAx.js.map} +1 -1
  5. package/dist/{attach-orchestrator-CMoDuG2A.js → attach-orchestrator-BG8TGJOZ.js} +5 -3
  6. package/dist/{attach-orchestrator-CE0S09YU.js.map → attach-orchestrator-BG8TGJOZ.js.map} +1 -1
  7. package/dist/{bundle-BKqyhEK9.d.ts → bundle-C796JIwG.d.ts} +65 -2
  8. package/dist/bundle-C796JIwG.d.ts.map +1 -0
  9. package/dist/{capture-ltuV0gZa.d.ts → capture-DsP525OZ.d.ts} +1 -1
  10. package/dist/{capture-ltuV0gZa.d.ts.map → capture-DsP525OZ.d.ts.map} +1 -1
  11. package/dist/{cdp-connection-BYE9meXe.d.ts → cdp-connection-rP1WdnH5.d.ts} +1 -1
  12. package/dist/{cdp-connection-BYE9meXe.d.ts.map → cdp-connection-rP1WdnH5.d.ts.map} +1 -1
  13. package/dist/{cell-D1y4shoV.js → cell-BMlFh08P.js} +2 -2
  14. package/dist/cell-BMlFh08P.js.map +1 -0
  15. package/dist/{cell-DHA578lX.js → cell-Dtgtusog.js} +90 -16
  16. package/dist/cell-Dtgtusog.js.map +1 -0
  17. package/dist/{cell-BIdSQb9T.js → cell-KsRXFdDs.js} +122 -16
  18. package/dist/cell-KsRXFdDs.js.map +1 -0
  19. package/dist/{debug-server-BZtH2Z5b.js → debug-server-6c22qSWa.js} +150 -9
  20. package/dist/debug-server-6c22qSWa.js.map +1 -0
  21. package/dist/{debug-server-DApo0o3t.js → debug-server-BQHbaKPT.js} +152 -11
  22. package/dist/debug-server-BQHbaKPT.js.map +1 -0
  23. package/dist/{debug-server-D2wpPK3_.js → debug-server-DWat7d-9.js} +82 -6
  24. package/dist/debug-server-DWat7d-9.js.map +1 -0
  25. package/dist/devtools-opener-3Drge_RJ.js +75 -0
  26. package/dist/devtools-opener-3Drge_RJ.js.map +1 -0
  27. package/dist/devtools-opener-CJpEsXXQ.js +76 -0
  28. package/dist/devtools-opener-CJpEsXXQ.js.map +1 -0
  29. package/dist/devtools-opener-CxtryS8c.js +75 -0
  30. package/dist/devtools-opener-CxtryS8c.js.map +1 -0
  31. package/dist/in-app/auto.js +59 -12
  32. package/dist/in-app/auto.js.map +1 -1
  33. package/dist/in-app/index.d.ts +21 -2
  34. package/dist/in-app/index.d.ts.map +1 -1
  35. package/dist/in-app/index.js +60 -13
  36. package/dist/in-app/index.js.map +1 -1
  37. package/dist/mcp/cli.js +363 -73
  38. package/dist/mcp/cli.js.map +1 -1
  39. package/dist/mcp/server.js +1 -1
  40. package/dist/mock/index.d.ts +64 -1
  41. package/dist/mock/index.d.ts.map +1 -1
  42. package/dist/mock/index.js +221 -14
  43. package/dist/mock/index.js.map +1 -1
  44. package/dist/panel/index.js +178 -23
  45. package/dist/panel/index.js.map +1 -1
  46. package/dist/{pool-C6TgrcyW.d.ts → pool-CrP5CPvU.d.ts} +3 -3
  47. package/dist/{pool-C6TgrcyW.d.ts.map → pool-CrP5CPvU.d.ts.map} +1 -1
  48. package/dist/{qr-http-server-ZkT6F7is.js → qr-http-server-D1hpoyBF.js} +1 -1
  49. package/dist/{qr-http-server-ZkT6F7is.js.map → qr-http-server-D1hpoyBF.js.map} +1 -1
  50. package/dist/qr-http-server-D4rGz8M7.js +1640 -0
  51. package/dist/qr-http-server-D4rGz8M7.js.map +1 -0
  52. package/dist/{qr-http-server-C7q8Gn04.js → qr-http-server-DIjCV7h_.js} +1 -1
  53. package/dist/{qr-http-server-C7q8Gn04.js.map → qr-http-server-DIjCV7h_.js.map} +1 -1
  54. package/dist/{relay-factory-DnuTH4v-.js → relay-factory-C1X3G3WY.js} +72 -15
  55. package/dist/relay-factory-C1X3G3WY.js.map +1 -0
  56. package/dist/{relay-secret-store-CLEGyHou.js → relay-secret-store-Bmyleu0A.js} +1 -1
  57. package/dist/{relay-secret-store-CLEGyHou.js.map → relay-secret-store-Bmyleu0A.js.map} +1 -1
  58. package/dist/{relay-secret-store-DhzAnnj-.js → relay-secret-store-CQenfcSL.js} +2 -2
  59. package/dist/{relay-secret-store-DhzAnnj-.js.map → relay-secret-store-CQenfcSL.js.map} +1 -1
  60. package/dist/{relay-secret-store-BcVrWwTq.js → relay-secret-store-DKxs7zwq.js} +1 -1
  61. package/dist/{relay-secret-store-DGduVJhs.js.map → relay-secret-store-DKxs7zwq.js.map} +1 -1
  62. package/dist/{relay-secret-store-DGduVJhs.js → relay-secret-store-WJ8EGkIl.js} +1 -1
  63. package/dist/{relay-secret-store-BcVrWwTq.js.map → relay-secret-store-WJ8EGkIl.js.map} +1 -1
  64. package/dist/{relay-url-store-CKW8RQzf.js → relay-url-store-BR2XodiO.js} +2 -2
  65. package/dist/{relay-url-store-CKW8RQzf.js.map → relay-url-store-BR2XodiO.js.map} +1 -1
  66. package/dist/{relay-url-store-CdA58fgw.js → relay-url-store-CH63fVCm.js} +2 -2
  67. package/dist/{relay-url-store-B0X8TsGr.js.map → relay-url-store-CH63fVCm.js.map} +1 -1
  68. package/dist/{relay-url-store-CwKT7i04.js → relay-url-store-DaY1QPes.js} +2 -2
  69. package/dist/{relay-url-store-CwKT7i04.js.map → relay-url-store-DaY1QPes.js.map} +1 -1
  70. package/dist/{relay-url-store-B0X8TsGr.js → relay-url-store-xmUuTjXA.js} +2 -2
  71. package/dist/{relay-url-store-CdA58fgw.js.map → relay-url-store-xmUuTjXA.js.map} +1 -1
  72. package/dist/{relay-worker-UK0nBfDX.js → relay-worker-BUXI0K0b.js} +13 -6
  73. package/dist/{relay-worker-UK0nBfDX.js.map → relay-worker-BUXI0K0b.js.map} +1 -1
  74. package/dist/{relay-worker-Dw3aIzIK.d.ts → relay-worker-DcyboK43.d.ts} +70 -11
  75. package/dist/relay-worker-DcyboK43.d.ts.map +1 -0
  76. package/dist/{runtime-DfHHZms2.d.ts → runtime-BiigOuvb.d.ts} +30 -3
  77. package/dist/runtime-BiigOuvb.d.ts.map +1 -0
  78. package/dist/test-runner/bin.js +481 -62
  79. package/dist/test-runner/bin.js.map +1 -1
  80. package/dist/test-runner/bridge-stub.d.ts +125 -0
  81. package/dist/test-runner/bridge-stub.d.ts.map +1 -0
  82. package/dist/test-runner/bridge-stub.js +92 -0
  83. package/dist/test-runner/bridge-stub.js.map +1 -0
  84. package/dist/test-runner/bundle.d.ts +2 -2
  85. package/dist/test-runner/bundle.js +107 -24
  86. package/dist/test-runner/bundle.js.map +1 -1
  87. package/dist/test-runner/capture.d.ts +1 -1
  88. package/dist/test-runner/config.d.ts +68 -5
  89. package/dist/test-runner/config.d.ts.map +1 -1
  90. package/dist/test-runner/config.js +1 -1
  91. package/dist/test-runner/method-pace.d.ts +82 -0
  92. package/dist/test-runner/method-pace.d.ts.map +1 -0
  93. package/dist/test-runner/method-pace.js +120 -0
  94. package/dist/test-runner/method-pace.js.map +1 -0
  95. package/dist/test-runner/pool.d.ts +1 -1
  96. package/dist/test-runner/pool.js +1 -1
  97. package/dist/test-runner/relay-factory.d.ts +67 -4
  98. package/dist/test-runner/relay-factory.d.ts.map +1 -1
  99. package/dist/test-runner/relay-factory.js +71 -14
  100. package/dist/test-runner/relay-factory.js.map +1 -1
  101. package/dist/test-runner/relay-worker.d.ts +1 -1
  102. package/dist/test-runner/relay-worker.js +1 -1
  103. package/dist/test-runner/report.d.ts +43 -17
  104. package/dist/test-runner/report.d.ts.map +1 -1
  105. package/dist/test-runner/report.js +33 -9
  106. package/dist/test-runner/report.js.map +1 -1
  107. package/dist/test-runner/rpc.d.ts +2 -2
  108. package/dist/test-runner/runtime.d.ts +2 -2
  109. package/dist/test-runner/runtime.js +83 -6
  110. package/dist/test-runner/runtime.js.map +1 -1
  111. package/dist/test-runner/task-graph.d.ts +1 -1
  112. package/dist/throttle-DKKzX1qC.js +59 -0
  113. package/dist/throttle-DKKzX1qC.js.map +1 -0
  114. package/dist/totp-Dwft0Kz7.js +3 -0
  115. package/package.json +1 -1
  116. package/dist/bundle-BKqyhEK9.d.ts.map +0 -1
  117. package/dist/cell-BIdSQb9T.js.map +0 -1
  118. package/dist/cell-D1y4shoV.js.map +0 -1
  119. package/dist/cell-DHA578lX.js.map +0 -1
  120. package/dist/debug-server-BZtH2Z5b.js.map +0 -1
  121. package/dist/debug-server-D2wpPK3_.js.map +0 -1
  122. package/dist/debug-server-DApo0o3t.js.map +0 -1
  123. package/dist/relay-factory-DnuTH4v-.js.map +0 -1
  124. package/dist/relay-worker-Dw3aIzIK.d.ts.map +0 -1
  125. package/dist/runtime-DfHHZms2.d.ts.map +0 -1
  126. package/dist/totp-D1pulXLa.js +0 -3
@@ -1,10 +1,10 @@
1
- import { a as ChiiCdpConnection, o as RELAY_AUTH_REJECT_CLOSE_CODE, s as RELAY_AUTH_REJECT_REASON } from "./relay-worker-UK0nBfDX.js";
2
- import { c as generateAttachToken, d as startQuickTunnel, f as startTunnelHealthProbe, l as makeTunnelStatus, m as logInfo, p as logError, u as printAttachBanner } from "./attach-orchestrator-CMoDuG2A.js";
1
+ import { a as ChiiCdpConnection, o as RELAY_AUTH_REJECT_CLOSE_CODE, s as RELAY_AUTH_REJECT_REASON } from "./relay-worker-BUXI0K0b.js";
2
+ import { c as generateAttachToken, d as startQuickTunnel, f as startTunnelHealthProbe, l as makeTunnelStatus, m as logInfo, p as logError, u as printAttachBanner } from "./attach-orchestrator-BG8TGJOZ.js";
3
3
  import { n as buildRelayVerifyAuth, t as assertRelayAuthConfigured } from "./totp-DAxys-r0.js";
4
- import "./cell-DHA578lX.js";
5
- import "./relay-factory-DnuTH4v-.js";
6
- import "./qr-http-server-ZkT6F7is.js";
7
- import "./relay-secret-store-DGduVJhs.js";
4
+ import "./cell-Dtgtusog.js";
5
+ import "./relay-factory-C1X3G3WY.js";
6
+ import "./qr-http-server-D4rGz8M7.js";
7
+ import "./relay-secret-store-WJ8EGkIl.js";
8
8
  import { createRequire } from "node:module";
9
9
  import "node:events";
10
10
  import { WebSocketServer } from "ws";
@@ -20,7 +20,21 @@ USAGE
20
20
 
21
21
  OPTIONS
22
22
  --scheme-url <url> intoss-private:// URL from \`ait deploy --scheme-only\`
23
- (required for standalone relay attach / env3)
23
+ (required for standalone relay attach / env3). Unused
24
+ and ignored when --attach-launcher is set.
25
+ --attach-launcher Attach over the env-2 AITC Sandbox PWA launcher
26
+ (real-device WebKit) instead of the env-3 intoss
27
+ scheme deep-link. The relay/QR/dashboard/attach-wait
28
+ are identical; only the QR is a launcher deep-link.
29
+ Requires --app-url. The SDK still hits the mock in
30
+ env 2, so this measures the mock + standard Web API
31
+ layer's engine-attributable behavior (env1↔env2
32
+ equivalence), NOT native-bridge fidelity (that is env3).
33
+ --app-url <url> The consumer dev server's HTTP tunnel URL (e.g. the
34
+ *.trycloudflare.com URL from \`pnpm dev:phone:cdp\`)
35
+ that the launcher PWA frames. REQUIRED with
36
+ --attach-launcher; ignored otherwise. SECRET: a tunnel
37
+ host — never printed; it rides only inside the QR.
24
38
  --timeout <ms> Per-file evaluate timeout in ms (default: 60000).
25
39
  Controls how long a single test file is allowed to run
26
40
  before it is considered hung. Does NOT affect how long
@@ -32,7 +46,10 @@ OPTIONS
32
46
  Pass a value to bound the wait for CI/headless runs.
33
47
  --cell-sdk-line <line> SDK line to inject as __AIT_CELL__.sdkLine (2.x|3.x)
34
48
  --cell-platform <plat> Platform to inject as __AIT_CELL__.platform
35
- (mock|ios|android, default: AIT_CELL_PLATFORM env)
49
+ (mock|ios|android|ios-pwa, default: AIT_CELL_PLATFORM
50
+ env). Use ios-pwa for env-2 (--attach-launcher) runs
51
+ so env1(mock@desktop) and env2(mock@WebKit) captures
52
+ stay distinguishable. An unknown value is rejected.
36
53
  --report-dir <dir> Persist a runner-agnostic report + captures to <dir>
37
54
  (report: <sdkLine>.<platform>.json; captures:
38
55
  <dir>/.ait-capture/<category>.<sdkLine>.<platform>.json).
@@ -47,6 +64,28 @@ OPTIONS
47
64
  --headless Disable browser auto-open (text QR only)
48
65
  --project-root <dir> Project root for .ait_relay secret lookup
49
66
  (default: current working directory)
67
+ --pace <ms> Minimum delay in ms between test-to-test AND
68
+ file-to-file bridge calls (default: 0, i.e. no
69
+ added delay — today's behavior byte-for-byte).
70
+ Falls back to the AIT_PACE env var when omitted
71
+ (--pace takes precedence over the env var when both
72
+ are given). Use on a 2.x cell scan when the native
73
+ per-method bridge rate limit (APP_BRIDGE_THROTTLED,
74
+ devtools#767) is rejecting rapid same-method calls —
75
+ 3.x cells are unaffected by that limiter and do not
76
+ need this flag.
77
+ --pace-method <ms> Minimum delay in ms BETWEEN calls to the SAME named
78
+ SDK function — paces a same-method burst WITHIN a
79
+ single test body (e.g. a clipboard happy-path loop
80
+ calling setClipboardText/getClipboardText 8 times
81
+ back to back), which --pace's test/file spacing
82
+ cannot reach (devtools#769). Falls back to the
83
+ AIT_PACE_METHOD env var when omitted (--pace-method
84
+ takes precedence over the env var when both are
85
+ given). Default: 250ms when --cell-sdk-line is 2.x
86
+ (unset --cell-sdk-line also defaults to 2.x — see
87
+ --cell-sdk-line), 0 (no added delay) otherwise. Pass
88
+ --pace-method 0 to opt out even on a 2.x cell.
50
89
  --manual-blocking Run manual-tagged test files (*.manual.ait.test.ts)
51
90
  LAST, after all regular files, with a human present.
52
91
  Before each manual file, the QR dashboard is pushed
@@ -65,6 +104,24 @@ OPTIONS
65
104
  each manual file's report entry is stamped
66
105
  mode: 'manual' — never diff a manual run against an
67
106
  unattended baseline as if they were equivalent.
107
+ --stub-blocking Run manual-tagged test files (*.manual.ait.test.ts)
108
+ UNATTENDED (devtools#740, DT-2) by intercepting a
109
+ fixed allowlist of blocking-UI SDK calls (ads
110
+ show*, openPermissionDialog/requestPermission,
111
+ saveBase64Data) in the page and answering them from
112
+ fixtures captured by a real --manual-blocking run,
113
+ instead of forwarding them to native UI. Implies
114
+ --manual-blocking (manual files are included in the
115
+ run); no human presence or QR-dashboard prompt is
116
+ needed for them. HYBRID cell, not pure env3 — every
117
+ other SDK call in the same run still hits the real
118
+ native bridge. With --report-dir, files that ran
119
+ under the stub are written to a SEPARATE
120
+ <sdkLine>.<platform>.stubbed.json artifact (never
121
+ merged into the standard or .manual.json report) and
122
+ the report body is stamped cell.bridgeStub: true —
123
+ never diff a stubbed run against a real device
124
+ baseline (manual or unattended) as if equivalent.
68
125
  --help, -h Show this help message
69
126
 
70
127
  DESCRIPTION
@@ -81,7 +138,7 @@ DESCRIPTION
81
138
  The test files run against the live relay connection started by this process;
82
139
  no separate MCP daemon is required.
83
140
 
84
- EXAMPLE
141
+ EXAMPLE (env 3 — intoss-private scheme)
85
142
  devtools-test 'src/**/*.ait.test.ts' \\
86
143
  --scheme-url "intoss-private://..." \\
87
144
  --cell-sdk-line 3.x \\
@@ -89,6 +146,14 @@ EXAMPLE
89
146
  --report-dir .ait-report \\
90
147
  --timeout 60000
91
148
 
149
+ EXAMPLE (env 2 — AITC Sandbox PWA launcher)
150
+ devtools-test 'src/**/*.ait.test.ts' \\
151
+ --attach-launcher \\
152
+ --app-url "https://<subdomain>.trycloudflare.com" \\
153
+ --cell-sdk-line 3.x \\
154
+ --cell-platform ios-pwa \\
155
+ --report-dir .ait-report
156
+
92
157
  `.trimStart();
93
158
  //#endregion
94
159
  //#region src/mcp/chii-relay.ts
@@ -350,6 +415,82 @@ async function startChiiRelay(options = {}) {
350
415
  //#endregion
351
416
  //#region src/mcp/debug-server.ts
352
417
  /**
418
+ * Starts a polling watcher that detects target-set changes on
419
+ * `connection.listTargets()` and sends a `notifications/tools/list_changed`
420
+ * notification on the given server.
421
+ *
422
+ * The watcher polls every `intervalMs` (default 1 000 ms). On each tick it
423
+ * calls `connection.refreshTargets?.()` first (fix #705-B) so that silent
424
+ * disconnects (no CDP event, phone backgrounded / tunnel quiet) are picked up
425
+ * before the signature is read. If `refreshTargets` throws — e.g. a transient
426
+ * relay error — the tick is skipped entirely to avoid a spurious detach signal.
427
+ *
428
+ * After the refresh, it fires `server.sendToolListChanged()` + `onAttach()`
429
+ * whenever the sorted target-id signature changes AND the new target set is
430
+ * non-empty. This covers:
431
+ * - 0→N first attach
432
+ * - 1→1 target replacement (same count, different id — e.g. rescan)
433
+ * - N→M any change where the result is still non-empty
434
+ *
435
+ * Full detach (→ empty) fires `onDetach()` (fix #705-A) on the exact
436
+ * non-empty→empty edge — i.e. only when the previous signature was non-empty.
437
+ * This lets callers push an immediate "disconnected" SSE update to the
438
+ * dashboard without waiting for the next periodic interval.
439
+ *
440
+ * The interval is **never cleared automatically** — it keeps running until
441
+ * `stop()` is called during shutdown. This ensures that a target replacement
442
+ * after the first attach is always detected.
443
+ *
444
+ * `onAttach` is called on every non-empty signature change (or immediately when
445
+ * already attached). Use this to trigger side-effects such as pushing a fresh
446
+ * SSE state to open dashboard tabs (issue #509). Both callbacks are optional;
447
+ * omitting them preserves the previous behaviour exactly.
448
+ *
449
+ * SECRET-HANDLING: target `id`/`title`/`url` are not written to any log here.
450
+ * Only an attach-detected stderr line is emitted (no target details).
451
+ *
452
+ * `server` is optional (devtools#772): the standalone test-runner path
453
+ * (`test-runner/relay-factory.ts`) has no MCP `Server` instance to notify —
454
+ * it only needs the `onAttach`/`onDetach` dashboard-push side effects. When
455
+ * omitted, `sendToolListChanged()` is simply skipped; the signature-diff and
456
+ * callback logic is byte-for-byte the same. Existing MCP daemon call sites
457
+ * always pass a real `Server`, so their behavior is unchanged.
458
+ *
459
+ * @returns `stop` — call this during shutdown to clear the interval.
460
+ */
461
+ function startAttachWatcher(connection, server, intervalMs = 1e3, onAttach, onDetach) {
462
+ /** Sorted, comma-joined target-id string — '' means no targets attached. */
463
+ function signature() {
464
+ return connection.listTargets().map((t) => t.id).sort().join(",");
465
+ }
466
+ let lastSignature = signature();
467
+ if (lastSignature !== "") {
468
+ server?.sendToolListChanged();
469
+ onAttach?.();
470
+ }
471
+ /** Compare current vs last signature and fire the appropriate callback. */
472
+ function tick() {
473
+ const current = signature();
474
+ if (current !== lastSignature) {
475
+ const wasNonEmpty = lastSignature !== "";
476
+ lastSignature = current;
477
+ if (current !== "") {
478
+ server?.sendToolListChanged();
479
+ onAttach?.();
480
+ } else if (wasNonEmpty) onDetach?.();
481
+ }
482
+ }
483
+ const handle = setInterval(() => {
484
+ if (connection.refreshTargets) connection.refreshTargets().then(() => {
485
+ tick();
486
+ }, (_err) => {});
487
+ else tick();
488
+ }, intervalMs);
489
+ return { stop() {
490
+ clearInterval(handle);
491
+ } };
492
+ }
493
+ /**
353
494
  * Factory that constructs a `ChiiCdpConnection` for the given relay base URL.
354
495
  *
355
496
  * Introduced as a named seam so PR-2 (dual-connection, #348) can defer
@@ -454,6 +595,6 @@ async function bootRelayFamily(options = {}) {
454
595
  };
455
596
  }
456
597
  //#endregion
457
- export { bootRelayFamily, buildRelayVerifyAuth };
598
+ export { bootRelayFamily, buildRelayVerifyAuth, startAttachWatcher };
458
599
 
459
- //# sourceMappingURL=debug-server-DApo0o3t.js.map
600
+ //# sourceMappingURL=debug-server-BQHbaKPT.js.map