@ait-co/devtools 0.1.116 → 0.1.118

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 (102) hide show
  1. package/dist/attach-orchestrator-BEMGBeWm.js +3 -0
  2. package/dist/attach-orchestrator-BZsqoFjB.js +2797 -0
  3. package/dist/attach-orchestrator-BZsqoFjB.js.map +1 -0
  4. package/dist/attach-orchestrator-CFotueL3.js +1749 -0
  5. package/dist/attach-orchestrator-CFotueL3.js.map +1 -0
  6. package/dist/attach-orchestrator-DEJfLm7V.js +1749 -0
  7. package/dist/attach-orchestrator-DEJfLm7V.js.map +1 -0
  8. package/dist/{cli-BLBo0lkP.js → attach-orchestrator-qFEMBUwb.js} +23 -739
  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-KFs4t-wc.d.ts.map → bundle-CA1TCXED.d.ts.map} +1 -1
  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-BDFMsPXV.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-Dp_pDs_j.js +85 -0
  22. package/dist/cell-Dp_pDs_j.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-BA1ynNNx.js +1039 -0
  26. package/dist/cli-BA1ynNNx.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-DcAKrbnq.js → debug-server-T8i9_iCc.js} +5 -3
  30. package/dist/debug-server-T8i9_iCc.js.map +1 -0
  31. package/dist/debug-server-krAOy6cl.js +1891 -0
  32. package/dist/debug-server-krAOy6cl.js.map +1 -0
  33. package/dist/{debug-server-DlXJARIC.js → debug-server-wo18jR4T.js} +432 -2884
  34. package/dist/debug-server-wo18jR4T.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 +9 -9
  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/cli-BLBo0lkP.js.map +0 -1
  99. package/dist/debug-server-DcAKrbnq.js.map +0 -1
  100. package/dist/debug-server-DlXJARIC.js.map +0 -1
  101. package/dist/relay-worker-DWW4vZxU.d.ts.map +0 -1
  102. package/dist/totp-D104cJQN.js +0 -3
@@ -1,14 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { r as generateTotp } from "./totp-DvOYkYim.js";
3
- import { parseArgs } from "node:util";
4
- import { accessSync } from "node:fs";
5
- import * as path from "node:path";
6
- import { isAbsolute, resolve } from "node:path";
7
3
  import { randomBytes } from "node:crypto";
8
4
  import { Tunnel, bin, install } from "cloudflared";
9
- import * as fs from "node:fs/promises";
10
- import { glob } from "node:fs/promises";
11
- import { fileURLToPath } from "node:url";
12
5
  //#region src/mcp/deeplink.ts
13
6
  /**
14
7
  * URL of the AITC Sandbox launcher PWA.
@@ -1477,7 +1470,7 @@ async function prepareAttach(deps, env, args, conn) {
1477
1470
  const buildProjectRoot = typeof rawProjectRoot === "string" ? rawProjectRoot : void 0;
1478
1471
  let tunnelHttpUrl = process.env.AIT_TUNNEL_BASE_URL?.trim() ?? "";
1479
1472
  if (tunnelHttpUrl === "" && buildProjectRoot !== void 0) {
1480
- const { readRelayUrls } = await import("./relay-url-store-NDtEcOE-.js");
1473
+ const { readRelayUrls } = await import("./relay-url-store-DGQ-HPQC.js");
1481
1474
  tunnelHttpUrl = (await readRelayUrls({ projectRoot: buildProjectRoot }))?.tunnelBaseUrl ?? "";
1482
1475
  }
1483
1476
  if (tunnelHttpUrl === "") return {
@@ -1723,744 +1716,35 @@ async function renderAndMaybeWait(deps, prep, waitForAttach, callTimeoutMs, conn
1723
1716
  ...totpResult() ? { totp: totpResult() } : {}
1724
1717
  }, null, 2)}\n\n${qr}`);
1725
1718
  }
1726
- //#endregion
1727
- //#region src/test-runner/cell.ts
1728
- /**
1729
- * Injects each key of `globals` into `globalThis` in the page via a single
1730
- * `Runtime.evaluate` call. Must be called BEFORE the first `bundleTestFile`
1731
- * inject — the cell is session-global and applies to all subsequent files.
1732
- *
1733
- * Throws if the CDP evaluate returns an exception.
1734
- *
1735
- * @param conn - The live CDP connection (relay-attached page).
1736
- * @param globals - Plain-JSON-serialisable key→value map to assign onto `globalThis`.
1737
- */
1738
- async function injectGlobals(conn, globals) {
1739
- const expr = `(() => { Object.assign(globalThis, ${JSON.stringify(globals)}); return true; })()`;
1740
- const result = await conn.send("Runtime.evaluate", {
1741
- expression: expr,
1742
- returnByValue: true
1743
- });
1744
- if (result.exceptionDetails) {
1745
- const msg = result.exceptionDetails.exception?.description ?? result.exceptionDetails.text ?? "unknown error";
1746
- throw new Error(`injectGlobals: Runtime.evaluate threw: ${msg}`);
1747
- }
1748
- }
1749
- //#endregion
1750
- //#region src/test-runner/discover.ts
1751
- /**
1752
- * Test-file discovery shared by the `devtools-test` CLI and the `run_tests`
1753
- * MCP tool, so both expand glob patterns with identical semantics.
1754
- *
1755
- * Uses Node's built-in `fs/promises` `glob` (Node 22+) — no extra dependency,
1756
- * which keeps the MCP daemon install graph lean (a plain glob lib would land in
1757
- * the `npx … devtools-mcp` path for no benefit).
1758
- *
1759
- * Pure Node IO only (`node:fs/promises` + `node:path`) — react-free, so it is
1760
- * safe to import from the MCP daemon graph.
1761
- */
1762
- /**
1763
- * Expands `patterns` (globs or plain paths) into a sorted, de-duplicated list of
1764
- * ABSOLUTE test file paths, resolved relative to `cwd`.
1765
- *
1766
- * A plain (non-glob) path passes through when it matches a real file; a glob
1767
- * expands against `cwd`. Absolute matches are kept as-is; relative matches are
1768
- * resolved against `cwd`. `bundleTestFile` requires an absolute path, so the
1769
- * absolute output feeds it directly.
1770
- *
1771
- * @param patterns Glob patterns or file paths (e.g. `['src/**\/*.ait.test.ts']`).
1772
- * @param cwd Base directory for relative patterns/results.
1773
- * @returns Sorted, de-duplicated absolute file paths. Empty when nothing matches.
1774
- */
1775
- async function discoverTestFiles(patterns, cwd) {
1776
- const out = /* @__PURE__ */ new Set();
1777
- for await (const match of glob(patterns, { cwd })) out.add(isAbsolute(match) ? match : resolve(cwd, match));
1778
- return [...out].sort();
1779
- }
1780
- //#endregion
1781
- //#region src/test-runner/bundle.ts
1782
- /**
1783
- * esbuild-based bundler for user test files.
1784
- *
1785
- * Bundles a single test file into a self-contained IIFE string that can be
1786
- * injected into a WebView via `Runtime.evaluate`. The bundle includes the
1787
- * test runtime (`runtime.ts`), which provides `describe/it/test/expect` and
1788
- * the `runTestModule(factory)` entry point.
1789
- *
1790
- * ## How the wiring works
1791
- *
1792
- * The bundle exposes two exports on `globalThis.__testBundle`:
1793
- * - `runTestModule` — the runtime's entry function.
1794
- * - `__userFactory` — an async function whose body is the user's top-level
1795
- * test registration code (describe/it/test calls).
1796
- *
1797
- * The Node-side RPC (`rpc.ts`) calls:
1798
- * `globalThis.__testBundle.runTestModule(globalThis.__testBundle.__userFactory)`
1799
- *
1800
- * `runTestModule` then installs `describe/it/test/expect` as globals, invokes
1801
- * the factory (which registers all tests), runs them, and returns a `RunReport`.
1802
- *
1803
- * ## Why a factory wrapper is needed
1804
- *
1805
- * Naively adding the runtime to `entryPoints` and bundling the user file would
1806
- * fail for two reasons:
1807
- * 1. `describe/it/test/expect` from the runtime are module-local in the IIFE
1808
- * scope. The user's top-level `describe(...)` calls expect them as globals —
1809
- * they are not globals until `runTestModule` installs them.
1810
- * 2. Even with globals pre-installed, the user file runs at IIFE-evaluation
1811
- * time, before the RPC layer calls `runTestModule` to reset state and start
1812
- * the test clock.
1813
- *
1814
- * The factory approach solves both: the user's registration code is deferred
1815
- * into a function that `runTestModule` calls AFTER installing the globals.
1816
- *
1817
- * ## Factory extraction algorithm
1818
- *
1819
- * The `userFactoryPlugin` reads the user file and splits lines into:
1820
- * - **top-level**: `import …` and re-export lines — kept at module scope
1821
- * (the only valid position for static `import` in ESM).
1822
- * - **body**: all other statements — moved into the body of the exported
1823
- * `__userFactory` async function.
1824
- *
1825
- * esbuild processes the re-generated module, following each static import
1826
- * through the normal dependency graph (including the SDK-redirect plugin).
1827
- *
1828
- * ## SDK redirect
1829
- *
1830
- * Imports of `@apps-in-toss/web-framework` (and sub-paths) are intercepted via
1831
- * the `sdkRedirectPlugin` and replaced with a virtual `window.__sdk` proxy that
1832
- * `src/in-app/auto.ts` installs at runtime. This works for both 2.x and 3.x SDK.
1833
- *
1834
- * SECRET-HANDLING: the returned bundle code is caller-managed; never log it.
1835
- */
1836
- /** The SDK package name that mini-app test code imports from. */
1837
- const SDK_PACKAGE = "@apps-in-toss/web-framework";
1838
- /**
1839
- * Names the runtime installs as globals before invoking the user factory.
1840
- * The `vitest` virtual module re-exports each as a lazy getter that reads from
1841
- * `globalThis` at access time. Keep in sync with the globals installed in
1842
- * `runtime.ts#runTestModule`.
1843
- */
1844
- const VITEST_GLOBAL_NAMES = [
1845
- "describe",
1846
- "it",
1847
- "test",
1848
- "expect",
1849
- "beforeAll",
1850
- "afterAll",
1851
- "beforeEach",
1852
- "afterEach",
1853
- "vi"
1854
- ];
1855
- /**
1856
- * Matches the bare SDK package and any sub-path import
1857
- * (`@apps-in-toss/web-framework`, `@apps-in-toss/web-framework/foo`).
1858
- * Built from {@link SDK_PACKAGE} so the package name has a single source.
1859
- */
1860
- const SDK_IMPORT_FILTER = new RegExp(`^${SDK_PACKAGE.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`);
1861
- /**
1862
- * esbuild plugin that intercepts SDK imports and redirects them to the
1863
- * `window.__sdk` proxy that `src/in-app/auto.ts` installs at runtime.
1864
- *
1865
- * Strategy: for every import of `@apps-in-toss/web-framework` (or sub-paths),
1866
- * esbuild resolves it to a virtual module that re-exports all named exports
1867
- * via `window.__sdk[name]`. This avoids bundling the real SDK (which may not
1868
- * be available in the test environment) while still making named imports work.
1869
- *
1870
- * If `window.__sdk` is absent (non-dog-food build), every access throws a
1871
- * descriptive error rather than returning `undefined` silently.
1872
- */
1873
- function sdkRedirectPlugin() {
1874
- return {
1875
- name: "sdk-redirect",
1876
- setup(build) {
1877
- build.onResolve({ filter: SDK_IMPORT_FILTER }, (args) => ({
1878
- path: args.path,
1879
- namespace: "sdk-redirect"
1880
- }));
1881
- build.onLoad({
1882
- filter: /.*/,
1883
- namespace: "sdk-redirect"
1884
- }, () => ({
1885
- contents: `
1886
- var __proxy = (typeof window !== 'undefined' && window.__sdk)
1887
- ? window.__sdk
1888
- : new Proxy({}, {
1889
- get: function(_t, p) {
1890
- throw new Error('window.__sdk is not installed — run in a dog-food build. Missing: ' + String(p));
1891
- }
1892
- });
1893
- module.exports = __proxy;
1894
- `,
1895
- loader: "js"
1896
- }));
1897
- }
1898
- };
1899
- }
1900
- /**
1901
- * esbuild plugin that intercepts `import … from 'vitest'` and replaces it with
1902
- * a virtual module that delegates every named import to `globalThis` at ACCESS
1903
- * time (not at bundle-evaluation time).
1904
- *
1905
- * The runtime installs `describe/it/test/expect/beforeAll/afterAll/beforeEach/
1906
- * afterEach/vi` as globals inside `runTestModule`, which runs AFTER the bundle
1907
- * IIFE is evaluated. A value-copy redirect (`export var describe =
1908
- * globalThis.describe`) would therefore capture `undefined` at evaluation time
1909
- * and the user's `describe(...)` calls would be no-ops — registering zero tests.
1910
- *
1911
- * The fix defers the lookup to call time using per-name **getter** exports.
1912
- * We emit a CommonJS module that:
1913
- * 1. sets `__esModule = true` so esbuild's `__toESM` interop maps each named
1914
- * import directly to a property access on the module (NOT wrapped under a
1915
- * `default` shim — which is what happens for a bare Proxy whose own-keys
1916
- * are empty, leaving every named import `undefined`);
1917
- * 2. defines each global name as a getter that reads `globalThis[name]` on
1918
- * every access. So `import { describe } from 'vitest'` compiles to
1919
- * `import_vitest.describe`, whose getter returns the real `describe` only
1920
- * when the factory calls it — after `runTestModule` installs the globals.
1921
- *
1922
- * A plain `module.exports = new Proxy(...)` does NOT work here: esbuild routes
1923
- * the virtual module through `__toESM`, which enumerates own-keys (none on an
1924
- * empty Proxy target) and therefore exposes zero named exports. Explicit getter
1925
- * properties give `__toESM` real keys to map while keeping access lazy.
1926
- */
1927
- function vitestRedirectPlugin() {
1928
- return {
1929
- name: "vitest-redirect",
1930
- setup(build) {
1931
- build.onResolve({ filter: /^vitest$/ }, () => ({
1932
- path: "vitest",
1933
- namespace: "vitest-redirect"
1934
- }));
1935
- build.onLoad({
1936
- filter: /^vitest$/,
1937
- namespace: "vitest-redirect"
1938
- }, () => {
1939
- return {
1940
- contents: `Object.defineProperty(exports, '__esModule', { value: true });\n${VITEST_GLOBAL_NAMES.map((name) => `Object.defineProperty(exports, ${JSON.stringify(name)}, { enumerable: true, get: function() { return globalThis[${JSON.stringify(name)}]; } });`).join("\n")}\n`,
1941
- loader: "js"
1942
- };
1943
- });
1944
- }
1945
- };
1946
- }
1947
- /**
1948
- * esbuild plugin that transforms the user test file into a module that exports
1949
- * an async `__userFactory` function. The factory defers the user's top-level
1950
- * test registration code (describe/it/test calls) so it only runs when
1951
- * `runTestModule(__userFactory)` explicitly invokes it — AFTER the runtime has
1952
- * installed describe/it/test/expect as globals.
1953
- *
1954
- * Algorithm:
1955
- * - Import declarations and re-export statements are kept at module top-level
1956
- * (the only valid ESM position for static `import`). A statement that spans
1957
- * multiple lines — e.g. a named import with one member per line:
1958
- * import {
1959
- * appLogin,
1960
- * getAnonymousKey,
1961
- * } from '@apps-in-toss/web-framework';
1962
- * is tracked as a single block: every line from the opening `import {` /
1963
- * `export {` through the closing `from '…'` (or side-effect `'…'`) line is
1964
- * kept together at top-level. This prevents the member lines and the
1965
- * closing `} from '…'` line from leaking into the factory body, which would
1966
- * leave an unterminated `import {` at module scope (the #678 env3 failure:
1967
- * esbuild threw `Expected "as" but found "{"` on multi-line SDK imports).
1968
- * - All other lines (describe/it/test calls, local declarations, etc.) are
1969
- * moved into the body of the exported async factory function.
1970
- *
1971
- * This preserves SDK import resolution (the sdk-redirect plugin processes
1972
- * top-level imports normally) while deferring test registration to the factory.
1973
- */
1974
- function userFactoryPlugin(absPath) {
1975
- const NAMESPACE = "user-test-factory";
1976
- return {
1977
- name: "user-test-factory",
1978
- setup(build) {
1979
- build.onResolve({ filter: /^user-test-factory$/ }, () => ({
1980
- path: absPath,
1981
- namespace: NAMESPACE
1982
- }));
1983
- build.onLoad({
1984
- filter: /.*/,
1985
- namespace: NAMESPACE
1986
- }, async (args) => {
1987
- const lines = (await fs.readFile(args.path, "utf8")).split("\n");
1988
- const topLevelLines = [];
1989
- const bodyLines = [];
1990
- const EXPORT_DECLARATION_RE = /^(export\s+)(default\s+|async\s+function\s+|function\s+|class\s+|const\s+|let\s+|var\s+)/;
1991
- const isImportStart = (trimmed) => trimmed.startsWith("import ") || trimmed.startsWith("import{") || trimmed.startsWith("import'") || trimmed.startsWith("import\"");
1992
- const endsStatement = (trimmed) => /['"]\s*;?\s*$/.test(trimmed.replace(/\/\/.*$/, "").trimEnd());
1993
- let inImportBlock = false;
1994
- for (const line of lines) {
1995
- const trimmed = line.trimStart();
1996
- const indent = line.slice(0, line.length - trimmed.length);
1997
- if (inImportBlock) {
1998
- topLevelLines.push(line);
1999
- if (endsStatement(trimmed)) inImportBlock = false;
2000
- continue;
2001
- }
2002
- if (isImportStart(trimmed)) {
2003
- topLevelLines.push(line);
2004
- if (!endsStatement(trimmed)) inImportBlock = true;
2005
- } else if (trimmed.startsWith("export ")) if (trimmed.match(EXPORT_DECLARATION_RE)) bodyLines.push(indent + trimmed.slice(7));
2006
- else {
2007
- topLevelLines.push(line);
2008
- if (/\bfrom\b/.test(trimmed) ? !endsStatement(trimmed) : trimmed.endsWith("{")) inImportBlock = true;
2009
- }
2010
- else bodyLines.push(line);
2011
- }
2012
- return {
2013
- contents: [
2014
- ...topLevelLines,
2015
- "",
2016
- "// biome-ignore lint: generated factory wrapper",
2017
- "export default async function __userFactory(): Promise<void> {",
2018
- ...bodyLines.map((l) => ` ${l}`),
2019
- "}"
2020
- ].join("\n"),
2021
- loader: "ts",
2022
- resolveDir: path.dirname(absPath)
2023
- };
2024
- });
2025
- }
2026
- };
2027
- }
2028
- /**
2029
- * Returns the absolute path to the test-runner runtime module.
2030
- *
2031
- * Searches candidates in priority order:
2032
- * 1. Co-located `runtime.ts` / `runtime.js` — covers the source tree
2033
- * (tsx / ts-node) and the `dist/test-runner/` entry.
2034
- * 2. `../test-runner/runtime.js` — covers the `dist/mcp/cli.js` entry,
2035
- * where `import.meta.url` resolves to `dist/mcp/` (a sibling directory
2036
- * of `dist/test-runner/`). Without this second candidate the MCP entry
2037
- * point would look for `dist/mcp/runtime.js`, which does not exist, and
2038
- * every `run_tests` call would fail with an esbuild "Could not resolve"
2039
- * error (#678).
2040
- *
2041
- * Returns the first candidate that exists on disk. Falls back to the
2042
- * co-located `runtime.js` path so esbuild produces a clear "file not found"
2043
- * error rather than a cryptic failure.
2044
- */
2045
- function getRuntimePath() {
2046
- const dir = path.dirname(fileURLToPath(import.meta.url));
2047
- const candidates = [
2048
- path.join(dir, "runtime.ts"),
2049
- path.join(dir, "runtime.js"),
2050
- path.join(dir, "..", "test-runner", "runtime.js")
2051
- ];
2052
- for (const candidate of candidates) try {
2053
- accessSync(candidate);
2054
- return candidate;
2055
- } catch {}
2056
- return path.join(dir, "runtime.js");
2057
- }
2058
- /**
2059
- * Bundles `absPath` into a single IIFE string suitable for `Runtime.evaluate`.
2060
- *
2061
- * The IIFE installs `window.__testBundle` (or the custom `globalName`) with:
2062
- * - `runTestModule` — the runtime entry (from `runtime.ts`).
2063
- * - `__userFactory` — an async function wrapping the user's test registration
2064
- * code so it runs AFTER `runTestModule` installs the globals.
2065
- *
2066
- * Callers (rpc.ts) invoke:
2067
- * `globalThis.__testBundle.runTestModule(globalThis.__testBundle.__userFactory)`
2068
- *
2069
- * @param absPath - Absolute path to the user test file.
2070
- * @param opts - Optional bundling overrides.
2071
- */
2072
- async function bundleTestFile(absPath, opts) {
2073
- const globalName = opts?.globalName ?? "__testBundle";
2074
- const extraExternals = opts?.extraExternals ?? [];
2075
- const esbuild = await import("esbuild");
2076
- const runtimePath = getRuntimePath();
2077
- const wrapperContent = [
2078
- `import { runTestModule } from ${JSON.stringify(runtimePath)};`,
2079
- `import __userFactory from "user-test-factory";`,
2080
- `export { runTestModule, __userFactory };`
2081
- ].join("\n");
2082
- const result = await esbuild.build({
2083
- stdin: {
2084
- contents: wrapperContent,
2085
- loader: "ts",
2086
- resolveDir: path.dirname(absPath)
2087
- },
2088
- bundle: true,
2089
- format: "iife",
2090
- globalName,
2091
- platform: "browser",
2092
- target: "es2022",
2093
- write: false,
2094
- plugins: [
2095
- userFactoryPlugin(absPath),
2096
- vitestRedirectPlugin(),
2097
- sdkRedirectPlugin()
2098
- ],
2099
- external: extraExternals,
2100
- treeShaking: true,
2101
- footer: { js: `globalThis[${JSON.stringify(globalName)}] = ${globalName};` }
2102
- });
2103
- const warnings = result.warnings.map((w) => `${path.relative(process.cwd(), w.location?.file ?? "")}:${w.location?.line ?? "?"}: ${w.text}`);
2104
- const outputFile = result.outputFiles?.[0];
2105
- if (!outputFile) throw new Error("bundleTestFile: esbuild produced no output — check entryPoints");
2106
- return {
2107
- code: outputFile.text,
2108
- warnings
2109
- };
2110
- }
2111
- //#endregion
2112
- //#region src/test-runner/rpc.ts
2113
- /** Maximum milliseconds to wait for a single evaluate round-trip. */
2114
- const DEFAULT_TIMEOUT_MS = 3e4;
2115
- /**
2116
- * Wraps bundle code in a self-executing IIFE that:
2117
- * 1. Evaluates the bundle (registering describe/it/test).
2118
- * 2. Calls `__testBundle.runTestModule(...)` — the entry the runtime exports.
2119
- * 3. Returns a JSON-serialised `RunReport` string.
2120
- *
2121
- * The double-serialisation (RunReport → JSON string → returnByValue string)
2122
- * is intentional: CDP `returnByValue` reliably transports strings; deeply
2123
- * nested objects can lose fidelity across the Chii relay.
2124
- *
2125
- * SECRET-HANDLING: `bundleCode` MUST NOT be logged by callers.
2126
- */
2127
- function buildRunTestsExpression(bundleCode) {
2128
- return `(async () => { try { ${bundleCode} } catch(e) { return JSON.stringify({ok:false,error:'bundle-eval: ' + String(e && e.message || e)}); } if (typeof globalThis.__testBundle !== 'object' || typeof globalThis.__testBundle.runTestModule !== 'function' || typeof globalThis.__testBundle.__userFactory !== 'function') { return JSON.stringify({ok:false,error:'bundle-missing-export: __testBundle.runTestModule or __userFactory is not a function'}); } try { const report = await globalThis.__testBundle.runTestModule(globalThis.__testBundle.__userFactory); return JSON.stringify({ok:true,value:report}); } catch(e) { return JSON.stringify({ok:false,error:'test-run: ' + String(e && e.message || e)}); }})()`;
2129
- }
2130
- /**
2131
- * Parses the raw CDP `returnByValue` result from a `buildRunTestsExpression`
2132
- * evaluate call into a typed `RpcRunResult`.
2133
- *
2134
- * Throws only on parse failure — an `ok:false` envelope is a normal result.
2135
- *
2136
- * SECRET-HANDLING: `rawValue` is not included in error messages.
2137
- */
2138
- function parseRunTestsResult(rawValue) {
2139
- if (typeof rawValue !== "string") throw new Error(`rpc.parseRunTestsResult: unexpected return type "${typeof rawValue}" — expected JSON string`);
2140
- let parsed;
2141
- try {
2142
- parsed = JSON.parse(rawValue);
2143
- } catch {
2144
- throw new Error("rpc.parseRunTestsResult: bridge returned non-JSON string");
2145
- }
2146
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) throw new Error("rpc.parseRunTestsResult: parsed result is not an object");
2147
- const obj = parsed;
2148
- if (obj.ok === true) return {
2149
- ok: true,
2150
- report: obj.value
2151
- };
2152
- if (obj.ok === false) return {
2153
- ok: false,
2154
- error: typeof obj.error === "string" ? obj.error : String(obj.error)
2155
- };
2156
- throw new Error("rpc.parseRunTestsResult: result missing \"ok\" field");
2157
- }
2158
- /**
2159
- * Injects `bundleCode` into the attached page and awaits test execution.
2160
- *
2161
- * Uses `Runtime.evaluate` with `awaitPromise: true` to wait for the
2162
- * async IIFE to settle. The 30-second CDP command timeout covers even
2163
- * long-running test suites; split into smaller files if you hit it.
2164
- *
2165
- * @param connection - Active CDP connection (relay or local).
2166
- * @param bundleCode - IIFE bundle string from `bundleTestFile`.
2167
- * @param timeoutMs - Override the default 30 s timeout.
2168
- *
2169
- * SECRET-HANDLING: `bundleCode` and the raw CDP result value are never logged.
2170
- */
2171
- async function injectAndRunBundle(connection, bundleCode, timeoutMs = DEFAULT_TIMEOUT_MS) {
2172
- const expression = buildRunTestsExpression(bundleCode);
2173
- const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error(`rpc: evaluate timed out after ${timeoutMs}ms`)), timeoutMs));
2174
- const evalPromise = connection.send("Runtime.evaluate", {
2175
- expression,
2176
- returnByValue: true,
2177
- awaitPromise: true
2178
- });
2179
- const cdpResult = await Promise.race([evalPromise, timeoutPromise]);
2180
- if (cdpResult.exceptionDetails) {
2181
- const msg = cdpResult.exceptionDetails.exception?.description ?? cdpResult.exceptionDetails.text ?? "Runtime.evaluate threw an exception";
2182
- throw new Error(`rpc.injectAndRunBundle: ${msg}`);
2183
- }
2184
- return parseRunTestsResult(cdpResult.result.value);
2185
- }
2186
- //#endregion
2187
- //#region src/test-runner/relay-worker.ts
2188
- /**
2189
- * Runs all `files` sequentially over the given CDP `connection`.
2190
- *
2191
- * For each file:
2192
- * 1. Bundle with esbuild (includes SDK shim + runtime).
2193
- * 2. Inject into the attached page via `Runtime.evaluate`.
2194
- * 3. Await the `RunReport` JSON response.
2195
- * 4. Accumulate results.
2196
- *
2197
- * Returns a `RelayRunReport` with per-file results and flattened totals.
2198
- *
2199
- * This function does NOT open or manage the relay connection — the caller
2200
- * is responsible for attaching and closing it.
2201
- *
2202
- * TODO (#645): implement the Vitest `PoolRunnerInitializer` interface here
2203
- * so that `runTestFilesOverRelay` can be used as a Vitest pool entry.
2204
- *
2205
- * @param connection - Active CDP connection (relay or local kind).
2206
- * @param files - Absolute paths to test files, run in order.
2207
- * @param opts - Optional per-run overrides.
2208
- */
2209
- async function runTestFilesOverRelay(connection, files, opts) {
2210
- const wallStart = Date.now();
2211
- const startedAt = new Date(wallStart).toISOString();
2212
- const fileResults = [];
2213
- for (const file of files) {
2214
- let fileEntry;
2215
- try {
2216
- const { code } = await bundleTestFile(file, opts?.bundleOptions);
2217
- const rpcResult = await injectAndRunBundle(connection, code, opts?.timeoutMs);
2218
- if (rpcResult.ok) fileEntry = {
2219
- file,
2220
- result: rpcResult.report
2221
- };
2222
- else fileEntry = {
2223
- file,
2224
- result: { error: rpcResult.error }
2225
- };
2226
- } catch (e) {
2227
- fileEntry = {
2228
- file,
2229
- result: { error: e instanceof Error ? e.message : String(e) }
2230
- };
2231
- }
2232
- fileResults.push(fileEntry);
2233
- }
2234
- const totals = fileResults.reduce((acc, { result }) => {
2235
- if ("error" in result) {
2236
- acc.failed += 1;
2237
- acc.total += 1;
2238
- } else {
2239
- acc.passed += result.passed;
2240
- acc.failed += result.failed;
2241
- acc.skipped += result.skipped;
2242
- acc.total += result.passed + result.failed + result.skipped;
2243
- }
2244
- return acc;
2245
- }, {
2246
- passed: 0,
2247
- failed: 0,
2248
- skipped: 0,
2249
- total: 0
2250
- });
2251
- return {
2252
- startedAt,
2253
- duration: Date.now() - wallStart,
2254
- files: fileResults,
2255
- totals
2256
- };
2257
- }
2258
- //#endregion
2259
- //#region src/test-runner/cli.ts
2260
1719
  /**
2261
- * `devtools-test` CLI.
1720
+ * Builds a self-contained IIFE DOM expression that renders a dismissible
1721
+ * "Debugger Connected" badge on the bottom-left of the phone screen.
2262
1722
  *
2263
- * Shares test-file discovery with the `run_tests` MCP tool (`discoverTestFiles`)
2264
- * and exposes `runWithConnection` the pure run core that bundles, injects, and
2265
- * collects each file over a CDP connection. The CLI's `main()` performs a
2266
- * standalone relay attach (boot relay → QR → phone scan → cell inject → run).
1723
+ * **Pure function** returns a JS expression string; does NOT inject it.
1724
+ * Injection is performed by {@link injectDebugIndicator} in `cell.ts`.
2267
1725
  *
2268
- * NOTE: no shebang in this source file the tsdown entry's `banner` option
2269
- * injects `#!/usr/bin/env node` into the compiled output (same pattern as
2270
- * `src/mcp/cli.ts`).
2271
- */
2272
- const USAGE = `
2273
- devtools-test run mini-app tests on a real device WebView over the CDP relay
2274
-
2275
- USAGE
2276
- devtools-test <glob> [<glob> ...] [options]
2277
-
2278
- OPTIONS
2279
- --scheme-url <url> intoss-private:// URL from \`ait deploy --scheme-only\`
2280
- (required for standalone relay attach / env3)
2281
- --timeout <ms> Per-file evaluate timeout in ms (default: 30000)
2282
- --cell-sdk-line <line> SDK line to inject as __AIT_CELL__.sdkLine (2.x|3.x)
2283
- --cell-platform <plat> Platform to inject as __AIT_CELL__.platform
2284
- (mock|ios|android, default: AIT_CELL_PLATFORM env)
2285
- --headless Disable browser auto-open (text QR only)
2286
- --project-root <dir> Project root for .ait_relay secret lookup
2287
- (default: current working directory)
2288
- --help, -h Show this help message
2289
-
2290
- DESCRIPTION
2291
- Boots a Chii relay + cloudflared tunnel, renders a QR code, waits for a real
2292
- device to scan and attach, injects the cell globals (__AIT_CELL__), bundles
2293
- each matched test file with esbuild (SDK imports redirected to window.__sdk),
2294
- injects the bundle into the attached WebView via Runtime.evaluate, and prints
2295
- a summary.
2296
-
2297
- The test files run against the live relay connection started by this process;
2298
- no separate MCP daemon is required.
2299
-
2300
- EXAMPLE
2301
- devtools-test 'src/**/*.ait.test.ts' \\
2302
- --scheme-url "intoss-private://..." \\
2303
- --cell-platform ios \\
2304
- --timeout 60000
2305
-
2306
- `.trimStart();
2307
- /**
2308
- * Runs `files` over `connection` and returns the aggregate report.
2309
- * This pure function is the testable core of the CLI (and is what the
2310
- * `run_tests` MCP tool calls against the daemon's attached connection); it is
2311
- * separate from `main()` so tests can call it without spawning a subprocess.
2312
- */
2313
- async function runWithConnection(connection, files, opts) {
2314
- const report = await runTestFilesOverRelay(connection, files, opts);
2315
- if (opts?.printSummary) {
2316
- const { totals } = report;
2317
- process.stdout.write(`\ndevtools-test: ${totals.passed} passed, ${totals.failed} failed, ${totals.skipped} skipped (${report.duration}ms)\n`);
2318
- }
2319
- return report;
2320
- }
2321
- /**
2322
- * CLI entry point.
1726
+ * The expression, when evaluated on the page, does the following:
1727
+ * 1. Early-returns if `#__ait_debug_indicator` already exists (idempotent
1728
+ * prevents duplicate badges on re-injection after page reload).
1729
+ * 2. Appends a fixed-position `<div id="__ait_debug_indicator">` at the
1730
+ * bottom-left, accounting for safe-area insets.
1731
+ * 3. Attaches a `{ once: true }` `pointerdown` listener that removes the
1732
+ * badge on first touch — one-tap dismiss.
2323
1733
  *
2324
- * Performs a standalone relay attach run lifecycle:
1734
+ * The expression intentionally contains NO relay URLs, wss addresses, TOTP
1735
+ * codes, or any other secrets. It is pure DOM UI text only.
2325
1736
  *
2326
- * 1. Parse args: globs, --timeout, --cell-sdk-line, --cell-platform,
2327
- * --scheme-url (required for env3), --headless, --project-root.
2328
- * 2. Discover test files; exit 1 if none.
2329
- * 3. Load .ait_relay secret into AIT_DEBUG_TOTP_SECRET, then boot relay family.
2330
- * 4. Assemble AttachDeps (no qrHttpServer → text QR).
2331
- * 5. prepareAttach(deps, 'relay-dev', { scheme_url }, conn).
2332
- * 6. renderAndMaybeWait(deps, prep, true, timeoutMs, conn) — text QR + wait.
2333
- * 7. If cell flags present, injectGlobals({ __AIT_CELL__: cell }) before run.
2334
- * 8. runWithConnection(conn, files, { timeoutMs, printSummary: true }).
2335
- * 9. family.stop(); process.exitCode = failed > 0 ? 1 : 0.
1737
+ * SECRET-HANDLING: this expression contains no secrets, relay URLs, wss
1738
+ * addresses, or TOTP codes whatsoever — DOM label text only.
2336
1739
  *
2337
- * The CLI is not a daemon no lock, router, SSE, or tools_list is needed.
2338
- * Attach timeout exits with code 1; test failures exit with code 1.
2339
- *
2340
- * SECRET-HANDLING: scheme_url / relay wssUrl / TOTP codes are never written to
2341
- * stdout/stderr directly. text QR renders via renderAndMaybeWait which encodes
2342
- * the TOTP `at=` code inside the QR payload (not in plain log lines).
1740
+ * @param opts.label - Badge text (default: `'Debugger Connected'`).
1741
+ * @returns A JS expression string suitable for `Runtime.evaluate`.
2343
1742
  */
2344
- async function main(argv = process.argv.slice(2)) {
2345
- let parsed;
2346
- try {
2347
- parsed = parseArgs({
2348
- args: argv,
2349
- options: {
2350
- help: {
2351
- type: "boolean",
2352
- short: "h"
2353
- },
2354
- timeout: { type: "string" },
2355
- "scheme-url": { type: "string" },
2356
- "cell-sdk-line": { type: "string" },
2357
- "cell-platform": { type: "string" },
2358
- headless: { type: "boolean" },
2359
- "project-root": { type: "string" }
2360
- },
2361
- allowPositionals: true
2362
- });
2363
- } catch (e) {
2364
- process.stderr.write(`devtools-test: ${e instanceof Error ? e.message : String(e)}\n`);
2365
- process.exitCode = 1;
2366
- return;
2367
- }
2368
- if (parsed.values.help || argv.length === 0) {
2369
- process.stdout.write(USAGE);
2370
- return;
2371
- }
2372
- const vals = parsed.values;
2373
- const rawTimeout = typeof vals.timeout === "string" ? vals.timeout : void 0;
2374
- const timeoutMs = rawTimeout !== void 0 ? parseInt(rawTimeout, 10) : 3e4;
2375
- if (Number.isNaN(timeoutMs) || timeoutMs <= 0) {
2376
- process.stderr.write(`devtools-test: --timeout must be a positive integer\n`);
2377
- process.exitCode = 1;
2378
- return;
2379
- }
2380
- const schemeUrl = typeof vals["scheme-url"] === "string" ? vals["scheme-url"] : "";
2381
- if (schemeUrl === "") {
2382
- process.stderr.write("devtools-test: --scheme-url is required for standalone relay attach.\n Pass the intoss-private:// URL from `ait deploy --scheme-only`.\n");
2383
- process.exitCode = 1;
2384
- return;
2385
- }
2386
- const headless = vals.headless === true;
2387
- const projectRoot = typeof vals["project-root"] === "string" ? vals["project-root"] : process.cwd();
2388
- const cellSdkLine = typeof vals["cell-sdk-line"] === "string" ? vals["cell-sdk-line"] : void 0;
2389
- const cellPlatform = typeof vals["cell-platform"] === "string" ? vals["cell-platform"] : process.env.AIT_CELL_PLATFORM;
2390
- const hasCell = cellSdkLine !== void 0 || cellPlatform !== void 0;
2391
- const globs = parsed.positionals;
2392
- if (globs.length === 0) {
2393
- process.stderr.write(`devtools-test: at least one glob pattern is required\n`);
2394
- process.stdout.write(USAGE);
2395
- process.exitCode = 1;
2396
- return;
2397
- }
2398
- const files = await discoverTestFiles(globs, process.cwd());
2399
- if (files.length === 0) {
2400
- process.stderr.write(`devtools-test: no test files matched ${globs.join(", ")}\n`);
2401
- process.exitCode = 1;
2402
- return;
2403
- }
2404
- process.stderr.write(`devtools-test: found ${files.length} test file(s)\n`);
2405
- const { loadRelaySecretReadOnly } = await import("./relay-secret-store-CmqchhR5.js");
2406
- await loadRelaySecretReadOnly({ projectRoot });
2407
- const { bootRelayFamily, buildRelayVerifyAuth } = await import("./debug-server-DcAKrbnq.js");
2408
- let family;
2409
- try {
2410
- family = await bootRelayFamily({ verifyAuth: buildRelayVerifyAuth() });
2411
- } catch (e) {
2412
- process.stderr.write(`devtools-test: failed to boot relay: ${e instanceof Error ? e.message : String(e)}\n`);
2413
- process.exitCode = 1;
2414
- return;
2415
- }
2416
- let exitCode = 0;
2417
- try {
2418
- const attachDeps = {
2419
- getTunnelStatus: family.getTunnelStatus ?? (() => ({
2420
- up: false,
2421
- wssUrl: null
2422
- })),
2423
- getTotpSecret: () => process.env.AIT_DEBUG_TOTP_SECRET,
2424
- qrHttpServer: void 0,
2425
- onAttachUrlBuilt: void 0,
2426
- canOpenBrowser: () => !headless
2427
- };
2428
- const prep = await prepareAttach(attachDeps, "relay-dev", { scheme_url: schemeUrl }, family.connection);
2429
- if (!prep.ok) {
2430
- const errText = prep.error.content.filter((c) => c.type === "text").map((c) => c.text).join("\n");
2431
- process.stderr.write(`devtools-test: attach preparation failed:\n${errText}\n`);
2432
- exitCode = 1;
2433
- return;
2434
- }
2435
- const waitResult = await renderAndMaybeWait(attachDeps, prep, true, timeoutMs, family.connection);
2436
- if (waitResult.isError) {
2437
- const errText = waitResult.content.filter((c) => c.type === "text").map((c) => c.text).join("\n");
2438
- process.stderr.write(`devtools-test: attach timed out or failed:\n${errText}\n`);
2439
- exitCode = 1;
2440
- return;
2441
- }
2442
- for (const chunk of waitResult.content) if (chunk.type === "text") process.stdout.write(`${chunk.text}\n`);
2443
- if (hasCell) {
2444
- const cell = {};
2445
- if (cellSdkLine !== void 0) cell.sdkLine = cellSdkLine;
2446
- if (cellPlatform !== void 0) cell.platform = cellPlatform;
2447
- process.stderr.write(`devtools-test: injecting __AIT_CELL__ = ${JSON.stringify(cell)}\n`);
2448
- await injectGlobals(family.connection, { __AIT_CELL__: cell });
2449
- }
2450
- exitCode = (await runWithConnection(family.connection, files, {
2451
- timeoutMs,
2452
- printSummary: true
2453
- })).totals.failed > 0 ? 1 : 0;
2454
- } finally {
2455
- family.stop();
2456
- process.exitCode = exitCode;
2457
- }
1743
+ function buildIndicatorExpression(opts) {
1744
+ const label = opts?.label ?? "Debugger Connected";
1745
+ return `(() => {if (document.getElementById('__ait_debug_indicator')) return;const el = document.createElement('div');el.id = '__ait_debug_indicator';el.style.cssText = ['position:fixed','left:max(12px,calc(env(safe-area-inset-left,0px) + 8px))','bottom:max(12px,calc(env(safe-area-inset-bottom,0px) + 8px))','z-index:2147483647','background:#e5484d','color:#fff','font:bold 11px/1 system-ui,sans-serif','padding:5px 9px','border-radius:6px','pointer-events:auto','user-select:none',].join(';');el.textContent = ${JSON.stringify(label)};el.addEventListener('pointerdown', () => el.remove(), { once: true });document.body.appendChild(el);})()`;
2458
1746
  }
2459
- if (import.meta.url === new URL(process.argv[1], "file://").href) main().catch((e) => {
2460
- process.stderr.write(`devtools-test: unexpected error: ${e instanceof Error ? e.message : String(e)}\n`);
2461
- process.exitCode = 1;
2462
- });
2463
1747
  //#endregion
2464
- export { START_ATTACH_SEGMENT_MS as a, generateAttachToken as c, startQuickTunnel as d, startTunnelHealthProbe as f, START_ATTACH_REMINT_THRESHOLD_MS as i, makeTunnelStatus as l, logInfo as m, runWithConnection as n, extractDeploymentId as o, logError as p, RELAY_SANDBOX_STALE_PAGE_MS as r, isSandboxPageFresh as s, main as t, printAttachBanner as u };
1748
+ export { RELAY_SANDBOX_STALE_PAGE_MS, START_ATTACH_REMINT_THRESHOLD_MS, START_ATTACH_SEGMENT_MS, startTunnelHealthProbe as a, buildIndicatorExpression, extractDeploymentId, startQuickTunnel as i, isSandboxPageFresh, makeTunnelStatus as n, logError as o, prepareAttach, printAttachBanner as r, renderAndMaybeWait, logInfo as s, generateAttachToken as t };
2465
1749
 
2466
- //# sourceMappingURL=cli-BLBo0lkP.js.map
1750
+ //# sourceMappingURL=attach-orchestrator-qFEMBUwb.js.map