@ait-co/devtools 0.1.122 → 0.1.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{attach-orchestrator-EnZEr4Uu.js → attach-orchestrator-CpE0dMew.js} +2 -2
- package/dist/{attach-orchestrator-EnZEr4Uu.js.map → attach-orchestrator-CpE0dMew.js.map} +1 -1
- package/dist/{cell-3bIG9538.js → cell-Ba9lCI3B.js} +2 -2
- package/dist/{cell-3bIG9538.js.map → cell-Ba9lCI3B.js.map} +1 -1
- package/dist/{cell-Cad-vi7X.js → cell-CX92lDI0.js} +3 -3
- package/dist/{cell-CgKUkDxY.js.map → cell-CX92lDI0.js.map} +1 -1
- package/dist/{cell-CgKUkDxY.js → cell-D0dJSGHi.js} +2 -2
- package/dist/{cell-Cad-vi7X.js.map → cell-D0dJSGHi.js.map} +1 -1
- package/dist/{debug-server-CF-1s3ks.js → debug-server-Bup2AJ5H.js} +5 -943
- package/dist/debug-server-Bup2AJ5H.js.map +1 -0
- package/dist/{debug-server-D79E3hTa.js → debug-server-C0A_Kujq.js} +5 -225
- package/dist/debug-server-C0A_Kujq.js.map +1 -0
- package/dist/{debug-server-D_28CxC1.js → debug-server-DywH5GU-.js} +6 -6
- package/dist/{debug-server-D_28CxC1.js.map → debug-server-DywH5GU-.js.map} +1 -1
- package/dist/mcp/cli.js +8204 -4
- package/dist/mcp/cli.js.map +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/panel/index.js +1 -1
- package/dist/{qr-http-server-BJjw0hDr.js → qr-http-server-DDmFS7fX.js} +1 -1
- package/dist/{qr-http-server-gHBd-z7T.js.map → qr-http-server-DDmFS7fX.js.map} +1 -1
- package/dist/{relay-factory-BBnZM-an.js → relay-factory-DnHMDxMA.js} +3 -3
- package/dist/{relay-factory-BBnZM-an.js.map → relay-factory-DnHMDxMA.js.map} +1 -1
- package/dist/{relay-secret-store-BJjoxes1.js → relay-secret-store-CFc9n0OA.js} +1 -1
- package/dist/{relay-secret-store-BJjoxes1.js.map → relay-secret-store-CFc9n0OA.js.map} +1 -1
- package/dist/{relay-secret-store-CtK1eqoV.js → relay-secret-store-DhzAnnj-.js} +3 -3
- package/dist/{relay-secret-store-CtK1eqoV.js.map → relay-secret-store-DhzAnnj-.js.map} +1 -1
- package/dist/{relay-url-store-D3H067u0.js → relay-url-store-CwKT7i04.js} +2 -2
- package/dist/{relay-url-store-D3H067u0.js.map → relay-url-store-CwKT7i04.js.map} +1 -1
- package/dist/{relay-url-store-uyVNe-Az.js → relay-url-store-DGQ-HPQC.js} +2 -2
- package/dist/{relay-url-store-uyVNe-Az.js.map → relay-url-store-DGQ-HPQC.js.map} +1 -1
- package/dist/test-runner/bin.d.ts +2 -0
- package/dist/{cli-CaJ-vnBj.js → test-runner/bin.js} +31 -8
- package/dist/test-runner/bin.js.map +1 -0
- package/dist/test-runner/config.js +1 -1
- package/dist/test-runner/relay-factory.js +2 -2
- package/dist/totp-D1pulXLa.js +3 -0
- package/dist/{totp-0bvlo9Yb.js → totp-WY6l0ysP.js} +1 -1
- package/dist/{totp-0bvlo9Yb.js.map → totp-WY6l0ysP.js.map} +1 -1
- package/package.json +2 -2
- package/dist/attach-orchestrator-BYMCSPjf.js +0 -2797
- package/dist/attach-orchestrator-BYMCSPjf.js.map +0 -1
- package/dist/attach-orchestrator-LOjvsE9R.js +0 -3
- package/dist/cell-Bfbke0cT.js +0 -3
- package/dist/cell-SKNUQTr8.js +0 -85
- package/dist/cell-SKNUQTr8.js.map +0 -1
- package/dist/cli-CaJ-vnBj.js.map +0 -1
- package/dist/debug-server-CF-1s3ks.js.map +0 -1
- package/dist/debug-server-D79E3hTa.js.map +0 -1
- package/dist/debug-server-IVaJ9vHH.js +0 -4278
- package/dist/debug-server-IVaJ9vHH.js.map +0 -1
- package/dist/qr-http-server-BJjw0hDr.js.map +0 -1
- package/dist/qr-http-server-BpcDt-cp.js +0 -3
- package/dist/qr-http-server-gHBd-z7T.js +0 -1506
- package/dist/relay-secret-store-BIM_0y18.js +0 -3
- package/dist/test-runner/cli.d.ts +0 -547
- package/dist/test-runner/cli.d.ts.map +0 -1
- package/dist/test-runner/cli.js +0 -3
- package/dist/totp-zGIlDsZS.js +0 -3
|
@@ -1,66 +1,18 @@
|
|
|
1
1
|
import { n as buildRelayVerifyAuth, r as generateTotp, t as assertRelayAuthConfigured } from "./totp-DfekTBk3.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { writeCaptureArtifacts, writeReportArtifact } from "./test-runner/report.js";
|
|
2
|
+
import "./test-runner/relay-worker.js";
|
|
3
|
+
import "./relay-factory-DnHMDxMA.js";
|
|
5
4
|
import { a as startTunnelHealthProbe, i as startQuickTunnel, n as makeTunnelStatus, o as logError, r as printAttachBanner, s as logInfo, t as generateAttachToken } from "./attach-orchestrator-CPMQWkGV.js";
|
|
6
|
-
import "./cell-
|
|
5
|
+
import "./cell-D0dJSGHi.js";
|
|
7
6
|
import "./qr-http-server-CKbtqvKy.js";
|
|
8
7
|
import "./relay-secret-store-DKxs7zwq.js";
|
|
9
8
|
import { createRequire } from "node:module";
|
|
10
|
-
import { glob } from "node:fs/promises";
|
|
11
|
-
import { isAbsolute, resolve } from "node:path";
|
|
12
9
|
import "@modelcontextprotocol/sdk/server/index.js";
|
|
13
10
|
import "@modelcontextprotocol/sdk/server/stdio.js";
|
|
14
11
|
import "@modelcontextprotocol/sdk/types.js";
|
|
15
|
-
import { parseArgs } from "node:util";
|
|
16
12
|
import { EventEmitter } from "node:events";
|
|
17
13
|
import { WebSocket, WebSocketServer } from "ws";
|
|
18
14
|
import { createServer } from "node:http";
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Test-file discovery shared by the `devtools-test` CLI and the `run_tests`
|
|
22
|
-
* MCP tool, so both expand glob patterns with identical semantics.
|
|
23
|
-
*
|
|
24
|
-
* Uses Node's built-in `fs/promises` `glob` (Node 22+) — no extra dependency,
|
|
25
|
-
* which keeps the MCP daemon install graph lean (a plain glob lib would land in
|
|
26
|
-
* the `npx … devtools-mcp` path for no benefit).
|
|
27
|
-
*
|
|
28
|
-
* Pure Node IO only (`node:fs/promises` + `node:path`) — react-free, so it is
|
|
29
|
-
* safe to import from the MCP daemon graph.
|
|
30
|
-
*/
|
|
31
|
-
/**
|
|
32
|
-
* Expands `patterns` (globs or plain paths) into a sorted, de-duplicated list of
|
|
33
|
-
* ABSOLUTE test file paths, resolved relative to `cwd`.
|
|
34
|
-
*
|
|
35
|
-
* A plain (non-glob) path passes through when it matches a real file; a glob
|
|
36
|
-
* expands against `cwd`. Absolute matches are kept as-is; relative matches are
|
|
37
|
-
* resolved against `cwd`. `bundleTestFile` requires an absolute path, so the
|
|
38
|
-
* absolute output feeds it directly.
|
|
39
|
-
*
|
|
40
|
-
* @param patterns Glob patterns or file paths (e.g. `['src/**\/*.ait.test.ts']`).
|
|
41
|
-
* @param cwd Base directory for relative patterns/results.
|
|
42
|
-
* @returns Sorted, de-duplicated absolute file paths. Empty when nothing matches.
|
|
43
|
-
*/
|
|
44
|
-
async function discoverTestFiles(patterns, cwd) {
|
|
45
|
-
const out = /* @__PURE__ */ new Set();
|
|
46
|
-
for await (const match of glob(patterns, { cwd })) out.add(isAbsolute(match) ? match : resolve(cwd, match));
|
|
47
|
-
return [...out].sort();
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region src/test-runner/cli.ts
|
|
51
|
-
/**
|
|
52
|
-
* `devtools-test` CLI.
|
|
53
|
-
*
|
|
54
|
-
* Shares test-file discovery with the `run_tests` MCP tool (`discoverTestFiles`)
|
|
55
|
-
* and exposes `runWithConnection` — the pure run core that bundles, injects, and
|
|
56
|
-
* collects each file over a CDP connection. The CLI's `main()` performs a
|
|
57
|
-
* standalone relay attach (boot relay → QR → phone scan → cell inject → run).
|
|
58
|
-
*
|
|
59
|
-
* NOTE: no shebang in this source file — the tsdown entry's `banner` option
|
|
60
|
-
* injects `#!/usr/bin/env node` into the compiled output (same pattern as
|
|
61
|
-
* `src/mcp/cli.ts`).
|
|
62
|
-
*/
|
|
63
|
-
const USAGE = `
|
|
15
|
+
`
|
|
64
16
|
devtools-test — run mini-app tests on a real device WebView over the CDP relay
|
|
65
17
|
|
|
66
18
|
USAGE
|
|
@@ -107,178 +59,6 @@ EXAMPLE
|
|
|
107
59
|
--timeout 60000
|
|
108
60
|
|
|
109
61
|
`.trimStart();
|
|
110
|
-
/**
|
|
111
|
-
* Runs `files` over `connection` and returns the aggregate report.
|
|
112
|
-
* This pure function is the testable core of the CLI (and is what the
|
|
113
|
-
* `run_tests` MCP tool calls against the daemon's attached connection); it is
|
|
114
|
-
* separate from `main()` so tests can call it without spawning a subprocess.
|
|
115
|
-
*/
|
|
116
|
-
async function runWithConnection(connection, files, opts) {
|
|
117
|
-
const report = await runTestFilesOverRelay(connection, files, opts);
|
|
118
|
-
if (opts?.printSummary) {
|
|
119
|
-
const { totals } = report;
|
|
120
|
-
process.stdout.write(`\ndevtools-test: ${totals.passed} passed, ${totals.failed} failed, ${totals.skipped} skipped (${report.duration}ms)\n`);
|
|
121
|
-
}
|
|
122
|
-
return report;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Decides whether to suppress the QR/attach block on stdout.
|
|
126
|
-
*
|
|
127
|
-
* Suppress when EITHER the user passed `--no-qr-stdout`, OR stdout is not a TTY
|
|
128
|
-
* / `CI` is set / `AIT_NO_QR_STDOUT` is set (non-interactive — a captured stdout
|
|
129
|
-
* must not leak the relay wss + TOTP `at=` code that the QR block encodes). The
|
|
130
|
-
* suppression is whole-chunk: `attachUrl` AND `relayUrl` ride in the same block.
|
|
131
|
-
*
|
|
132
|
-
* Exported for unit testing.
|
|
133
|
-
*/
|
|
134
|
-
function shouldSuppressQr(noQrFlag) {
|
|
135
|
-
return noQrFlag || !process.stdout.isTTY || process.env.CI !== void 0 || process.env.AIT_NO_QR_STDOUT !== void 0;
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* CLI entry point.
|
|
139
|
-
*
|
|
140
|
-
* Performs a standalone relay attach → run lifecycle, sharing the attach
|
|
141
|
-
* assembly with the Vitest pool via `createRelayConnectionFactory` (single
|
|
142
|
-
* source — no drift):
|
|
143
|
-
*
|
|
144
|
-
* 1. Parse args: globs, --timeout, --cell-sdk-line, --cell-platform,
|
|
145
|
-
* --scheme-url (required for env3), --report-dir, --no-qr-stdout,
|
|
146
|
-
* --headless, --project-root.
|
|
147
|
-
* 2. Discover test files; exit 1 if none.
|
|
148
|
-
* 3. factory.open() — boot relay → render QR (suppressed on non-interactive
|
|
149
|
-
* stdout) → wait for phone → inject cell → enableDomains. Returns the conn.
|
|
150
|
-
* 4. runWithConnection(conn, files, { timeoutMs, collectCaptures, printSummary }).
|
|
151
|
-
* 5. With --report-dir: write the runner-agnostic report + capture files.
|
|
152
|
-
* 6. factory.close(); process.exitCode = failed > 0 ? 1 : 0.
|
|
153
|
-
*
|
|
154
|
-
* The CLI is not a daemon — no lock, router, SSE, or tools_list is needed.
|
|
155
|
-
* Attach timeout exits with code 1; test failures exit with code 1.
|
|
156
|
-
*
|
|
157
|
-
* SECRET-HANDLING: scheme_url / relay wssUrl / TOTP codes are never written to
|
|
158
|
-
* stdout/stderr directly. The QR block (which encodes the TOTP `at=` code) is
|
|
159
|
-
* printed only when stdout is interactive AND not suppressed.
|
|
160
|
-
*/
|
|
161
|
-
async function main(argv = process.argv.slice(2)) {
|
|
162
|
-
let parsed;
|
|
163
|
-
try {
|
|
164
|
-
parsed = parseArgs({
|
|
165
|
-
args: argv,
|
|
166
|
-
options: {
|
|
167
|
-
help: {
|
|
168
|
-
type: "boolean",
|
|
169
|
-
short: "h"
|
|
170
|
-
},
|
|
171
|
-
timeout: { type: "string" },
|
|
172
|
-
"scheme-url": { type: "string" },
|
|
173
|
-
"cell-sdk-line": { type: "string" },
|
|
174
|
-
"cell-platform": { type: "string" },
|
|
175
|
-
"report-dir": { type: "string" },
|
|
176
|
-
"no-qr-stdout": { type: "boolean" },
|
|
177
|
-
headless: { type: "boolean" },
|
|
178
|
-
"project-root": { type: "string" }
|
|
179
|
-
},
|
|
180
|
-
allowPositionals: true
|
|
181
|
-
});
|
|
182
|
-
} catch (e) {
|
|
183
|
-
process.stderr.write(`devtools-test: ${e instanceof Error ? e.message : String(e)}\n`);
|
|
184
|
-
process.exitCode = 1;
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
if (parsed.values.help || argv.length === 0) {
|
|
188
|
-
process.stdout.write(USAGE);
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
const vals = parsed.values;
|
|
192
|
-
const rawTimeout = typeof vals.timeout === "string" ? vals.timeout : void 0;
|
|
193
|
-
const timeoutMs = rawTimeout !== void 0 ? parseInt(rawTimeout, 10) : 3e4;
|
|
194
|
-
if (Number.isNaN(timeoutMs) || timeoutMs <= 0) {
|
|
195
|
-
process.stderr.write(`devtools-test: --timeout must be a positive integer\n`);
|
|
196
|
-
process.exitCode = 1;
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
const schemeUrl = typeof vals["scheme-url"] === "string" ? vals["scheme-url"] : "";
|
|
200
|
-
if (schemeUrl === "") {
|
|
201
|
-
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");
|
|
202
|
-
process.exitCode = 1;
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
const headless = vals.headless === true;
|
|
206
|
-
const projectRoot = typeof vals["project-root"] === "string" ? vals["project-root"] : process.cwd();
|
|
207
|
-
const reportDir = typeof vals["report-dir"] === "string" ? vals["report-dir"] : void 0;
|
|
208
|
-
const suppressQr = shouldSuppressQr(vals["no-qr-stdout"] === true);
|
|
209
|
-
const cellSdkLine = typeof vals["cell-sdk-line"] === "string" ? vals["cell-sdk-line"] : void 0;
|
|
210
|
-
const cellPlatform = typeof vals["cell-platform"] === "string" ? vals["cell-platform"] : process.env.AIT_CELL_PLATFORM;
|
|
211
|
-
const hasCell = cellSdkLine !== void 0 || cellPlatform !== void 0;
|
|
212
|
-
const cell = {
|
|
213
|
-
sdkLine: cellSdkLine ?? "2.x",
|
|
214
|
-
platform: cellPlatform ?? "mock"
|
|
215
|
-
};
|
|
216
|
-
const globs = parsed.positionals;
|
|
217
|
-
if (globs.length === 0) {
|
|
218
|
-
process.stderr.write(`devtools-test: at least one glob pattern is required\n`);
|
|
219
|
-
process.stdout.write(USAGE);
|
|
220
|
-
process.exitCode = 1;
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
const files = await discoverTestFiles(globs, process.cwd());
|
|
224
|
-
if (files.length === 0) {
|
|
225
|
-
process.stderr.write(`devtools-test: no test files matched ${globs.join(", ")}\n`);
|
|
226
|
-
process.exitCode = 1;
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
process.stderr.write(`devtools-test: found ${files.length} test file(s)\n`);
|
|
230
|
-
if (hasCell) process.stderr.write(`devtools-test: injecting __AIT_CELL__ = ${JSON.stringify(cell)}\n`);
|
|
231
|
-
const factory = createRelayConnectionFactory({
|
|
232
|
-
schemeUrl,
|
|
233
|
-
projectRoot,
|
|
234
|
-
timeoutMs,
|
|
235
|
-
headless,
|
|
236
|
-
cell: hasCell ? cell : void 0,
|
|
237
|
-
onQrContent: (chunks) => {
|
|
238
|
-
if (suppressQr) {
|
|
239
|
-
process.stdout.write("QR suppressed (non-interactive)\n");
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
for (const chunk of chunks) process.stdout.write(`${chunk}\n`);
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
let connection;
|
|
246
|
-
try {
|
|
247
|
-
connection = await factory.open();
|
|
248
|
-
} catch (e) {
|
|
249
|
-
process.stderr.write(`devtools-test: ${e instanceof Error ? e.message : String(e)}\n`);
|
|
250
|
-
process.exitCode = 1;
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
let exitCode = 0;
|
|
254
|
-
try {
|
|
255
|
-
const report = await runWithConnection(connection, files, {
|
|
256
|
-
timeoutMs,
|
|
257
|
-
printSummary: true,
|
|
258
|
-
collectCaptures: reportDir !== void 0
|
|
259
|
-
});
|
|
260
|
-
if (reportDir !== void 0) try {
|
|
261
|
-
const reportPath = await writeReportArtifact(report, reportDir, {
|
|
262
|
-
sdkLine: cell.sdkLine,
|
|
263
|
-
platform: cell.platform,
|
|
264
|
-
projectRoot
|
|
265
|
-
});
|
|
266
|
-
process.stderr.write(`devtools-test: wrote report ${reportPath}\n`);
|
|
267
|
-
const capturePaths = await writeCaptureArtifacts(report.captures, `${reportDir}/.ait-capture`, cell);
|
|
268
|
-
if (capturePaths.length > 0) process.stderr.write(`devtools-test: wrote ${capturePaths.length} capture file(s)\n`);
|
|
269
|
-
} catch (e) {
|
|
270
|
-
process.stderr.write(`devtools-test: failed to write report artifacts: ${e instanceof Error ? e.message : String(e)}\n`);
|
|
271
|
-
}
|
|
272
|
-
exitCode = report.totals.failed > 0 ? 1 : 0;
|
|
273
|
-
} finally {
|
|
274
|
-
await factory.close(connection);
|
|
275
|
-
process.exitCode = exitCode;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
if (import.meta.url === new URL(process.argv[1], "file://").href) main().catch((e) => {
|
|
279
|
-
process.stderr.write(`devtools-test: unexpected error: ${e instanceof Error ? e.message : String(e)}\n`);
|
|
280
|
-
process.exitCode = 1;
|
|
281
|
-
});
|
|
282
62
|
//#endregion
|
|
283
63
|
//#region src/shared/relay-auth-close.ts
|
|
284
64
|
/**
|
|
@@ -1189,4 +969,4 @@ async function bootRelayFamily(options = {}) {
|
|
|
1189
969
|
//#endregion
|
|
1190
970
|
export { bootRelayFamily, buildRelayVerifyAuth };
|
|
1191
971
|
|
|
1192
|
-
//# sourceMappingURL=debug-server-
|
|
972
|
+
//# sourceMappingURL=debug-server-C0A_Kujq.js.map
|