@ait-co/devtools 0.1.126 → 0.1.127
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/debug-server-1dhDA3aw.js.map +1 -1
- package/dist/debug-server-Dctc9GAh.js.map +1 -1
- package/dist/mcp/cli.js +91 -16
- package/dist/mcp/cli.js.map +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/panel/index.js +1 -1
- package/dist/{pool-B9wSRPOU.d.ts → pool-DBLKNeRC.d.ts} +2 -2
- package/dist/{pool-B9wSRPOU.d.ts.map → pool-DBLKNeRC.d.ts.map} +1 -1
- package/dist/{relay-worker-7biDlEjo.d.ts → relay-worker-TReZtzGl.d.ts} +10 -2
- package/dist/relay-worker-TReZtzGl.d.ts.map +1 -0
- package/dist/test-runner/bin.js +89 -14
- package/dist/test-runner/bin.js.map +1 -1
- package/dist/test-runner/config.d.ts +1 -1
- package/dist/test-runner/pool.d.ts +1 -1
- package/dist/test-runner/relay-worker.d.ts +2 -2
- package/dist/test-runner/relay-worker.js +51 -9
- package/dist/test-runner/relay-worker.js.map +1 -1
- package/dist/test-runner/report.d.ts +1 -1
- package/package.json +1 -1
- package/dist/relay-worker-7biDlEjo.d.ts.map +0 -1
package/dist/mcp/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
10
10
|
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
11
11
|
import { homedir, platform } from "node:os";
|
|
12
12
|
import * as path from "node:path";
|
|
13
|
-
import { isAbsolute, join, resolve } from "node:path";
|
|
13
|
+
import { basename, isAbsolute, join, resolve } from "node:path";
|
|
14
14
|
import { randomBytes } from "node:crypto";
|
|
15
15
|
import { Tunnel, bin, install } from "cloudflared";
|
|
16
16
|
import * as fs from "node:fs/promises";
|
|
@@ -2024,7 +2024,7 @@ async function readMcpSdkVersion() {
|
|
|
2024
2024
|
* some test environments that skip the build step).
|
|
2025
2025
|
*/
|
|
2026
2026
|
function readDevtoolsVersion() {
|
|
2027
|
-
return "0.1.
|
|
2027
|
+
return "0.1.127";
|
|
2028
2028
|
}
|
|
2029
2029
|
/**
|
|
2030
2030
|
* Derives the next recommended action from a completed diagnostics snapshot.
|
|
@@ -3470,6 +3470,14 @@ async function injectAndRunBundle(connection, bundleCode, timeoutMs = DEFAULT_TI
|
|
|
3470
3470
|
//#endregion
|
|
3471
3471
|
//#region src/test-runner/relay-worker.ts
|
|
3472
3472
|
/**
|
|
3473
|
+
* Sentinel string embedded in the error message by `injectAndRunBundle` when
|
|
3474
|
+
* the per-file evaluate race hits the timeout. Used by the retry guard so only
|
|
3475
|
+
* genuine timeouts get a second attempt — not bundle errors or parse failures.
|
|
3476
|
+
*
|
|
3477
|
+
* Exported for unit tests that assert the retry path is taken.
|
|
3478
|
+
*/
|
|
3479
|
+
const EVALUATE_TIMEOUT_MARKER = "rpc: evaluate timed out after";
|
|
3480
|
+
/**
|
|
3473
3481
|
* Runs all `files` sequentially over the given CDP `connection`.
|
|
3474
3482
|
*
|
|
3475
3483
|
* For each file:
|
|
@@ -3512,15 +3520,49 @@ async function runTestFilesOverRelay(connection, files, opts) {
|
|
|
3512
3520
|
let fileEntry;
|
|
3513
3521
|
try {
|
|
3514
3522
|
const { code } = await bundleTestFile(file, opts?.bundleOptions);
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
+
/**
|
|
3524
|
+
* Runs one evaluate attempt and returns a FileResult, or `null` when the
|
|
3525
|
+
* result is a genuine timeout and the caller should retry.
|
|
3526
|
+
*
|
|
3527
|
+
* We need to distinguish:
|
|
3528
|
+
* - `rpcResult.ok = false` + timeout error → retry candidate
|
|
3529
|
+
* - `rpcResult.ok = false` + other error → final error, no retry
|
|
3530
|
+
* - `injectAndRunBundle` throws → treated like a final error
|
|
3531
|
+
* (throws happen on CDP exceptionDetails, not on the Promise.race
|
|
3532
|
+
* timeout — the timeout produces `rpcResult.ok=false` with the
|
|
3533
|
+
* EVALUATE_TIMEOUT_MARKER message)
|
|
3534
|
+
*/
|
|
3535
|
+
const attempt = async () => {
|
|
3536
|
+
let rpcResult;
|
|
3537
|
+
try {
|
|
3538
|
+
rpcResult = await injectAndRunBundle(connection, code, opts?.timeoutMs);
|
|
3539
|
+
} catch (e) {
|
|
3540
|
+
return {
|
|
3541
|
+
file,
|
|
3542
|
+
result: { error: e instanceof Error ? e.message : String(e) }
|
|
3543
|
+
};
|
|
3544
|
+
}
|
|
3545
|
+
if (rpcResult.ok) return {
|
|
3546
|
+
file,
|
|
3547
|
+
result: rpcResult.report
|
|
3548
|
+
};
|
|
3549
|
+
if (rpcResult.error.includes("rpc: evaluate timed out after")) return null;
|
|
3550
|
+
return {
|
|
3551
|
+
file,
|
|
3552
|
+
result: { error: rpcResult.error }
|
|
3553
|
+
};
|
|
3523
3554
|
};
|
|
3555
|
+
const firstResult = await attempt();
|
|
3556
|
+
if (firstResult !== null) fileEntry = firstResult;
|
|
3557
|
+
else {
|
|
3558
|
+
process.stderr.write(`relay-worker: evaluate timed out for ${file} — retrying once\n`);
|
|
3559
|
+
const retryResult = await attempt();
|
|
3560
|
+
if (retryResult !== null) fileEntry = retryResult;
|
|
3561
|
+
else fileEntry = {
|
|
3562
|
+
file,
|
|
3563
|
+
result: { error: `${EVALUATE_TIMEOUT_MARKER} ${opts?.timeoutMs ?? 3e4}ms (after retry)` }
|
|
3564
|
+
};
|
|
3565
|
+
}
|
|
3524
3566
|
} catch (e) {
|
|
3525
3567
|
fileEntry = {
|
|
3526
3568
|
file,
|
|
@@ -3640,6 +3682,42 @@ EXAMPLE
|
|
|
3640
3682
|
|
|
3641
3683
|
`.trimStart();
|
|
3642
3684
|
/**
|
|
3685
|
+
* Renders per-file result lines and the aggregate totals line to a string.
|
|
3686
|
+
*
|
|
3687
|
+
* Each file gets one line:
|
|
3688
|
+
* - Error/timeout: `FAIL <basename>: <error-class>`
|
|
3689
|
+
* - Pass (0 tests): `OK <basename>: 0 passed (empty file)`
|
|
3690
|
+
* - Pass: `OK <basename>: N passed[, M failed][, K skipped]`
|
|
3691
|
+
*
|
|
3692
|
+
* The aggregate totals line always follows.
|
|
3693
|
+
*
|
|
3694
|
+
* SECRET-HANDLING: only `basename(file)` is used — no absolute paths, relay
|
|
3695
|
+
* URLs, wss URLs, scheme URLs, or TOTP codes appear in the output. The error
|
|
3696
|
+
* string comes from `result.error` which is already secret-free (relay-worker
|
|
3697
|
+
* produces only error-class messages like "rpc: evaluate timed out after
|
|
3698
|
+
* 30000ms").
|
|
3699
|
+
*
|
|
3700
|
+
* Exported so unit tests can assert the per-file lines without spawning a
|
|
3701
|
+
* subprocess or going through the full relay attach flow.
|
|
3702
|
+
*/
|
|
3703
|
+
function renderSummary(report) {
|
|
3704
|
+
const lines = [];
|
|
3705
|
+
for (const { file, result } of report.files) {
|
|
3706
|
+
const name = basename(file);
|
|
3707
|
+
if ("error" in result) lines.push(`FAIL ${name}: ${result.error}`);
|
|
3708
|
+
else {
|
|
3709
|
+
const parts = [`${result.passed} passed`];
|
|
3710
|
+
if (result.failed > 0) parts.push(`${result.failed} failed`);
|
|
3711
|
+
if (result.skipped > 0) parts.push(`${result.skipped} skipped`);
|
|
3712
|
+
const suffix = result.passed + result.failed + result.skipped === 0 ? " (empty file)" : "";
|
|
3713
|
+
lines.push(`OK ${name}: ${parts.join(", ")}${suffix}`);
|
|
3714
|
+
}
|
|
3715
|
+
}
|
|
3716
|
+
const { totals, duration } = report;
|
|
3717
|
+
lines.push(`\ndevtools-test: ${totals.passed} passed, ${totals.failed} failed, ${totals.skipped} skipped (${duration}ms)`);
|
|
3718
|
+
return lines.join("\n");
|
|
3719
|
+
}
|
|
3720
|
+
/**
|
|
3643
3721
|
* Runs `files` over `connection` and returns the aggregate report.
|
|
3644
3722
|
* This pure function is the testable core of the CLI (and is what the
|
|
3645
3723
|
* `run_tests` MCP tool calls against the daemon's attached connection); it is
|
|
@@ -3647,10 +3725,7 @@ EXAMPLE
|
|
|
3647
3725
|
*/
|
|
3648
3726
|
async function runWithConnection(connection, files, opts) {
|
|
3649
3727
|
const report = await runTestFilesOverRelay(connection, files, opts);
|
|
3650
|
-
if (opts?.printSummary) {
|
|
3651
|
-
const { totals } = report;
|
|
3652
|
-
process.stdout.write(`\ndevtools-test: ${totals.passed} passed, ${totals.failed} failed, ${totals.skipped} skipped (${report.duration}ms)\n`);
|
|
3653
|
-
}
|
|
3728
|
+
if (opts?.printSummary) process.stdout.write(`\n${renderSummary(report)}\n`);
|
|
3654
3729
|
return report;
|
|
3655
3730
|
}
|
|
3656
3731
|
//#endregion
|
|
@@ -6710,7 +6785,7 @@ function createDebugServer(deps) {
|
|
|
6710
6785
|
};
|
|
6711
6786
|
const server = new Server({
|
|
6712
6787
|
name: "ait-debug",
|
|
6713
|
-
version: "0.1.
|
|
6788
|
+
version: "0.1.127"
|
|
6714
6789
|
}, { capabilities: { tools: { listChanged: true } } });
|
|
6715
6790
|
server.setRequestHandler(ListToolsRequestSchema, () => {
|
|
6716
6791
|
const conn = router.active;
|
|
@@ -8682,7 +8757,7 @@ function createDevServer(deps = {}) {
|
|
|
8682
8757
|
const aitSource = deps.aitSource ?? new HttpAitSource({ stateEndpoint });
|
|
8683
8758
|
const server = new Server({
|
|
8684
8759
|
name: "ait-devtools",
|
|
8685
|
-
version: "0.1.
|
|
8760
|
+
version: "0.1.127"
|
|
8686
8761
|
}, { capabilities: { tools: {} } });
|
|
8687
8762
|
server.setRequestHandler(ListToolsRequestSchema, () => ({ tools: DEV_TOOL_DEFINITIONS.map((tool) => ({ ...tool })) }));
|
|
8688
8763
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|