agent-inspect 6.29.1 → 6.29.2
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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/docs/API.md +4 -0
- package/docs/CLI.md +2 -0
- package/docs/LIMITATIONS.md +1 -0
- package/docs/NETWORK-BEHAVIOR.md +8 -0
- package/docs/TRACE-CONTRACTS.md +11 -0
- package/package.json +2 -2
- package/packages/cli/dist/index.cjs +45 -10
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +46 -11
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/core/dist/advanced.cjs +38 -1
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +2 -2
- package/packages/core/dist/advanced.d.ts +2 -2
- package/packages/core/dist/advanced.mjs +3 -3
- package/packages/core/dist/checks.cjs +15 -2
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.d.cts +2 -2
- package/packages/core/dist/checks.d.ts +2 -2
- package/packages/core/dist/checks.mjs +1 -1
- package/packages/core/dist/{chunk-GPGBKN7W.mjs → chunk-QZIXYP7U.mjs} +17 -4
- package/packages/core/dist/{chunk-GPGBKN7W.mjs.map → chunk-QZIXYP7U.mjs.map} +1 -1
- package/packages/core/dist/{chunk-AQMJFKI6.mjs → chunk-XRI3GB6I.mjs} +40 -3
- package/packages/core/dist/chunk-XRI3GB6I.mjs.map +1 -0
- package/packages/core/dist/{index-C61p7wBR.d.cts → index-BaQ48jrq.d.cts} +9 -1
- package/packages/core/dist/{index-DTO2iGeq.d.ts → index-CrnEOoRu.d.ts} +9 -1
- package/packages/core/dist/index.cjs +38 -1
- package/packages/core/dist/index.cjs.map +1 -1
- package/packages/core/dist/index.mjs +2 -2
- package/packages/core/dist/chunk-AQMJFKI6.mjs.map +0 -1
|
@@ -4,7 +4,7 @@ import { realpathSync, constants as constants$1, existsSync, readFileSync } from
|
|
|
4
4
|
import path19 from 'path';
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
6
6
|
import { Command, Option } from 'commander';
|
|
7
|
-
import { readFile, stat, mkdir, writeFile, unlink, appendFile, access, rm, open, readdir, constants } from 'fs/promises';
|
|
7
|
+
import { readFile, stat, mkdir, writeFile, unlink, appendFile, access, rm, open, readdir, lstat, constants } from 'fs/promises';
|
|
8
8
|
import process2, { stdin, stdout } from 'process';
|
|
9
9
|
import crypto, { createHash } from 'crypto';
|
|
10
10
|
import { execFile, spawn } from 'child_process';
|
|
@@ -13,7 +13,7 @@ import { createServer } from 'http';
|
|
|
13
13
|
import { createRequire } from 'module';
|
|
14
14
|
|
|
15
15
|
// package.json
|
|
16
|
-
var version = "6.29.
|
|
16
|
+
var version = "6.29.2";
|
|
17
17
|
|
|
18
18
|
// packages/cli/src/trace-dir-scale.ts
|
|
19
19
|
var TRACE_COUNT_WARN = 1e3;
|
|
@@ -12348,18 +12348,56 @@ async function workspacePathCommand(options = {}) {
|
|
|
12348
12348
|
console.log(location.workspaceDir);
|
|
12349
12349
|
}
|
|
12350
12350
|
var DEFAULT_CONFIG_FILENAME = "agent-inspect.suite.json";
|
|
12351
|
+
var CONFIG_EXISTS_ERROR = `${DEFAULT_CONFIG_FILENAME} already exists; refusing to overwrite it.`;
|
|
12351
12352
|
function printJson5(value) {
|
|
12352
12353
|
console.log(JSON.stringify(value, null, 2));
|
|
12353
12354
|
}
|
|
12354
12355
|
function resolveCwd(options) {
|
|
12355
12356
|
return path19.resolve(options.cwd ?? process.cwd());
|
|
12356
12357
|
}
|
|
12358
|
+
function getErrorCode(error) {
|
|
12359
|
+
if (typeof error !== "object" || error === null || !("code" in error)) {
|
|
12360
|
+
return void 0;
|
|
12361
|
+
}
|
|
12362
|
+
return typeof error.code === "string" ? error.code : void 0;
|
|
12363
|
+
}
|
|
12364
|
+
function getErrorMessage(error) {
|
|
12365
|
+
return error instanceof Error ? error.message : String(error);
|
|
12366
|
+
}
|
|
12367
|
+
function failInit(options, message) {
|
|
12368
|
+
if (options.json) {
|
|
12369
|
+
printJson5({ ok: false, error: message });
|
|
12370
|
+
} else {
|
|
12371
|
+
console.error(`[AgentInspect] suite init failed: ${message}`);
|
|
12372
|
+
}
|
|
12373
|
+
process.exitCode = 1;
|
|
12374
|
+
}
|
|
12375
|
+
async function pathExists2(filePath) {
|
|
12376
|
+
try {
|
|
12377
|
+
await lstat(filePath);
|
|
12378
|
+
return true;
|
|
12379
|
+
} catch (error) {
|
|
12380
|
+
if (getErrorCode(error) === "ENOENT") return false;
|
|
12381
|
+
throw error;
|
|
12382
|
+
}
|
|
12383
|
+
}
|
|
12357
12384
|
async function suiteInitCommand(options = {}) {
|
|
12358
12385
|
const cwd = resolveCwd(options);
|
|
12359
12386
|
const configPath = path19.join(cwd, DEFAULT_CONFIG_FILENAME);
|
|
12360
12387
|
const template = options.template?.trim();
|
|
12361
12388
|
const suiteConfig = template !== void 0 && template !== "" ? resolveSuiteTemplate(template) : defaultSuiteConfigTemplate();
|
|
12389
|
+
const content = `${JSON.stringify(suiteConfig, null, 2)}
|
|
12390
|
+
`;
|
|
12362
12391
|
if (options.dryRun) {
|
|
12392
|
+
try {
|
|
12393
|
+
if (await pathExists2(configPath)) {
|
|
12394
|
+
failInit(options, CONFIG_EXISTS_ERROR);
|
|
12395
|
+
return;
|
|
12396
|
+
}
|
|
12397
|
+
} catch (error) {
|
|
12398
|
+
failInit(options, getErrorMessage(error));
|
|
12399
|
+
return;
|
|
12400
|
+
}
|
|
12363
12401
|
if (options.json) {
|
|
12364
12402
|
printJson5({
|
|
12365
12403
|
ok: true,
|
|
@@ -12376,8 +12414,10 @@ async function suiteInitCommand(options = {}) {
|
|
|
12376
12414
|
return;
|
|
12377
12415
|
}
|
|
12378
12416
|
try {
|
|
12379
|
-
await writeFile(configPath,
|
|
12380
|
-
|
|
12417
|
+
await writeFile(configPath, content, {
|
|
12418
|
+
encoding: "utf-8",
|
|
12419
|
+
flag: "wx"
|
|
12420
|
+
});
|
|
12381
12421
|
if (options.json) {
|
|
12382
12422
|
printJson5({
|
|
12383
12423
|
ok: true,
|
|
@@ -12394,13 +12434,8 @@ async function suiteInitCommand(options = {}) {
|
|
|
12394
12434
|
console.log(" npx agent-inspect suite validate");
|
|
12395
12435
|
console.log(" npx agent-inspect suite run --json");
|
|
12396
12436
|
} catch (error) {
|
|
12397
|
-
const message = error
|
|
12398
|
-
|
|
12399
|
-
printJson5({ ok: false, error: message });
|
|
12400
|
-
} else {
|
|
12401
|
-
console.error(`[AgentInspect] suite init failed: ${message}`);
|
|
12402
|
-
}
|
|
12403
|
-
process.exitCode = 1;
|
|
12437
|
+
const message = getErrorCode(error) === "EEXIST" ? CONFIG_EXISTS_ERROR : getErrorMessage(error);
|
|
12438
|
+
failInit(options, message);
|
|
12404
12439
|
}
|
|
12405
12440
|
}
|
|
12406
12441
|
async function suiteValidateCommand(options = {}) {
|