@ait-co/devtools 0.1.127 → 0.1.128

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/mcp/cli.js CHANGED
@@ -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.127";
2027
+ return "0.1.128";
2028
2028
  }
2029
2029
  /**
2030
2030
  * Derives the next recommended action from a completed diagnostics snapshot.
@@ -3395,7 +3395,7 @@ function parseCaptureLines(raw) {
3395
3395
  //#endregion
3396
3396
  //#region src/test-runner/rpc.ts
3397
3397
  /** Maximum milliseconds to wait for a single evaluate round-trip. */
3398
- const DEFAULT_TIMEOUT_MS = 3e4;
3398
+ const DEFAULT_TIMEOUT_MS = 6e4;
3399
3399
  /**
3400
3400
  * Wraps bundle code in a self-executing IIFE that:
3401
3401
  * 1. Evaluates the bundle (registering describe/it/test).
@@ -3454,13 +3454,22 @@ function parseRunTestsResult(rawValue) {
3454
3454
  */
3455
3455
  async function injectAndRunBundle(connection, bundleCode, timeoutMs = DEFAULT_TIMEOUT_MS) {
3456
3456
  const expression = buildRunTestsExpression(bundleCode);
3457
- const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error(`rpc: evaluate timed out after ${timeoutMs}ms`)), timeoutMs));
3457
+ const TIMEOUT_SENTINEL = Symbol("timeout");
3458
+ const timeoutPromise = new Promise((resolve) => setTimeout(() => resolve(TIMEOUT_SENTINEL), timeoutMs));
3458
3459
  const evalPromise = connection.send("Runtime.evaluate", {
3459
3460
  expression,
3460
3461
  returnByValue: true,
3461
3462
  awaitPromise: true
3462
3463
  });
3463
- const cdpResult = await Promise.race([evalPromise, timeoutPromise]);
3464
+ const raceResult = await Promise.race([evalPromise.then((v) => ({
3465
+ tag: "eval",
3466
+ v
3467
+ })), timeoutPromise.then(() => ({ tag: "timeout" }))]);
3468
+ if (raceResult.tag === "timeout") return {
3469
+ ok: false,
3470
+ error: `rpc: evaluate timed out after ${timeoutMs}ms`
3471
+ };
3472
+ const cdpResult = raceResult.v;
3464
3473
  if (cdpResult.exceptionDetails) {
3465
3474
  const msg = cdpResult.exceptionDetails.exception?.description ?? cdpResult.exceptionDetails.text ?? "Runtime.evaluate threw an exception";
3466
3475
  throw new Error(`rpc.injectAndRunBundle: ${msg}`);
@@ -3525,12 +3534,16 @@ async function runTestFilesOverRelay(connection, files, opts) {
3525
3534
  * result is a genuine timeout and the caller should retry.
3526
3535
  *
3527
3536
  * We need to distinguish:
3528
- * - `rpcResult.ok = false` + timeout error → retry candidate
3537
+ * - `rpcResult.ok = false` + timeout error → retry candidate (`return null`)
3529
3538
  * - `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)
3539
+ * - `injectAndRunBundle` throws → CDP exceptionDetails (page
3540
+ * engine threw); treated as a final (non-retryable) error.
3541
+ *
3542
+ * The Promise.race timeout in rpc.ts RETURNS `{ok:false, error: '…'}` (it
3543
+ * does NOT throw/reject). Only genuine CDP `exceptionDetails` cause a throw.
3544
+ * This distinction is what makes the EVALUATE_TIMEOUT_MARKER gate below
3545
+ * reachable — the timeout result surfaces as `rpcResult.ok=false` with the
3546
+ * marker string, not as a caught exception.
3534
3547
  */
3535
3548
  const attempt = async () => {
3536
3549
  let rpcResult;
@@ -6785,7 +6798,7 @@ function createDebugServer(deps) {
6785
6798
  };
6786
6799
  const server = new Server({
6787
6800
  name: "ait-debug",
6788
- version: "0.1.127"
6801
+ version: "0.1.128"
6789
6802
  }, { capabilities: { tools: { listChanged: true } } });
6790
6803
  server.setRequestHandler(ListToolsRequestSchema, () => {
6791
6804
  const conn = router.active;
@@ -8757,7 +8770,7 @@ function createDevServer(deps = {}) {
8757
8770
  const aitSource = deps.aitSource ?? new HttpAitSource({ stateEndpoint });
8758
8771
  const server = new Server({
8759
8772
  name: "ait-devtools",
8760
- version: "0.1.127"
8773
+ version: "0.1.128"
8761
8774
  }, { capabilities: { tools: {} } });
8762
8775
  server.setRequestHandler(ListToolsRequestSchema, () => ({ tools: DEV_TOOL_DEFINITIONS.map((tool) => ({ ...tool })) }));
8763
8776
  server.setRequestHandler(CallToolRequestSchema, async (request) => {