agent-inspect 6.17.5 → 6.17.6

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.
@@ -7,12 +7,13 @@ import { Command, Option } from 'commander';
7
7
  import { readFile, stat, mkdir, writeFile, unlink, appendFile, access, rm, open, readdir, constants } from 'fs/promises';
8
8
  import process2, { stdin, stdout } from 'process';
9
9
  import crypto, { createHash } from 'crypto';
10
+ import { execFile, spawn } from 'child_process';
11
+ import { promisify } from 'util';
10
12
  import { createServer } from 'http';
11
- import { spawn } from 'child_process';
12
13
  import { createRequire } from 'module';
13
14
 
14
15
  // package.json
15
- var version = "6.17.5";
16
+ var version = "6.17.6";
16
17
 
17
18
  // packages/cli/src/trace-dir-scale.ts
18
19
  var TRACE_COUNT_WARN = 1e3;
@@ -5786,6 +5787,7 @@ function mergeSafetyExtensions(result, read, options) {
5786
5787
  }
5787
5788
 
5788
5789
  // packages/cli/src/check.ts
5790
+ var execFileAsync = promisify(execFile);
5789
5791
  var DEFAULT_SELECT = ["run.status"];
5790
5792
  function uniqueSelectIds(ids) {
5791
5793
  const seen = /* @__PURE__ */ new Set();
@@ -6232,8 +6234,7 @@ async function loadConfig(configPath) {
6232
6234
  const raw = await readFile(absolute, "utf-8");
6233
6235
  return parseCheckConfig(JSON.parse(raw));
6234
6236
  }
6235
- const mod = await import(pathToFileURL(absolute).href);
6236
- return parseCheckConfig("default" in mod ? mod.default : mod);
6237
+ return parseCheckConfig(await importJsCheckConfig(absolute));
6237
6238
  } catch (error) {
6238
6239
  if (error instanceof CheckConfigError) throw error;
6239
6240
  const message = error instanceof Error ? error.message : String(error);
@@ -6243,6 +6244,46 @@ async function loadConfig(configPath) {
6243
6244
  );
6244
6245
  }
6245
6246
  }
6247
+ async function importJsCheckConfig(absolute) {
6248
+ const href = pathToFileURL(absolute).href;
6249
+ if (!process.env.VITEST) {
6250
+ const mod = await import(
6251
+ /* @vite-ignore */
6252
+ href
6253
+ );
6254
+ return "default" in mod ? mod.default : mod;
6255
+ }
6256
+ const script = `
6257
+ const mod = await import(${JSON.stringify(href)});
6258
+ const value = "default" in mod ? mod.default : mod;
6259
+ process.stdout.write(JSON.stringify({ ok: true, value }));
6260
+ `;
6261
+ const env = { ...process.env };
6262
+ delete env.NODE_OPTIONS;
6263
+ delete env.VITEST;
6264
+ delete env.VITEST_WORKER_ID;
6265
+ const { stdout, stderr } = await execFileAsync(
6266
+ process.execPath,
6267
+ ["--input-type=module", "--eval", script],
6268
+ {
6269
+ encoding: "utf8",
6270
+ maxBuffer: 4 * 1024 * 1024,
6271
+ env
6272
+ }
6273
+ );
6274
+ try {
6275
+ const parsed = JSON.parse(stdout);
6276
+ if (parsed.ok !== true) {
6277
+ throw new Error(stderr.trim() || "Check config module did not return a value");
6278
+ }
6279
+ return parsed.value;
6280
+ } catch (error) {
6281
+ if (stderr.trim()) {
6282
+ throw new Error(stderr.trim());
6283
+ }
6284
+ throw error instanceof Error ? error : new Error(String(error));
6285
+ }
6286
+ }
6246
6287
  function normalizeConfig(config) {
6247
6288
  if (config.checks === void 0) return {};
6248
6289
  if (typeof config.checks !== "object" || Array.isArray(config.checks)) {