agent-inspect 5.3.0 → 5.4.0

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.
@@ -8263,6 +8263,120 @@ var init_report = __esm({
8263
8263
  }
8264
8264
  });
8265
8265
 
8266
+ // packages/core/src/suite/templates.ts
8267
+ function baseTemplate(name, cases) {
8268
+ return {
8269
+ name,
8270
+ traces: "./.agent-inspect",
8271
+ cases,
8272
+ checks: {
8273
+ select: ["run.status", "outcome.status"],
8274
+ run: { maxDurationMs: 6e4 }
8275
+ },
8276
+ redactionProfile: "local",
8277
+ artifacts: { outputDir: ".agent-inspect/suite-runs" }
8278
+ };
8279
+ }
8280
+ function getSuiteTemplate(id) {
8281
+ if (!SUITE_TEMPLATE_IDS.includes(id)) return void 0;
8282
+ return structuredClone(TEMPLATES[id]);
8283
+ }
8284
+ function resolveSuiteTemplate(id) {
8285
+ const template = getSuiteTemplate(id);
8286
+ if (template === void 0) {
8287
+ throw new Error(
8288
+ `Unknown suite template "${id}". Available: ${SUITE_TEMPLATE_IDS.join(", ")}`
8289
+ );
8290
+ }
8291
+ return template;
8292
+ }
8293
+ var SUITE_TEMPLATE_IDS, TEMPLATES;
8294
+ var init_templates = __esm({
8295
+ "packages/core/src/suite/templates.ts"() {
8296
+ SUITE_TEMPLATE_IDS = [
8297
+ "customer-support-agent",
8298
+ "refund-agent",
8299
+ "sales-assistant",
8300
+ "browser-task-agent",
8301
+ "mcp-tool-agent",
8302
+ "workflow-agent",
8303
+ "rag-answer-agent",
8304
+ "human-approval-agent"
8305
+ ];
8306
+ TEMPLATES = {
8307
+ "customer-support-agent": baseTemplate("customer-support-agent", [
8308
+ {
8309
+ id: "support-ticket",
8310
+ runId: "support-ticket",
8311
+ requireTools: ["searchDocs"],
8312
+ forbidTools: ["deleteAccount"],
8313
+ expectedObservations: ["answerReady"],
8314
+ maxDurationMs: 45e3
8315
+ }
8316
+ ]),
8317
+ "refund-agent": baseTemplate("refund-agent", [
8318
+ {
8319
+ id: "refund-flow",
8320
+ runId: "refund-flow",
8321
+ requireTools: ["searchDocs"],
8322
+ forbidTools: ["deleteAccount"],
8323
+ expectedObservations: ["policyShown"],
8324
+ maxDurationMs: 3e4
8325
+ }
8326
+ ]),
8327
+ "sales-assistant": baseTemplate("sales-assistant", [
8328
+ {
8329
+ id: "quote-request",
8330
+ runId: "quote-request",
8331
+ requireTools: ["lookupPricing"],
8332
+ maxDurationMs: 3e4
8333
+ }
8334
+ ]),
8335
+ "browser-task-agent": baseTemplate("browser-task-agent", [
8336
+ {
8337
+ id: "browser-nav",
8338
+ runId: "browser-nav",
8339
+ requireTools: ["browserNavigate"],
8340
+ maxDurationMs: 12e4
8341
+ }
8342
+ ]),
8343
+ "mcp-tool-agent": baseTemplate("mcp-tool-agent", [
8344
+ {
8345
+ id: "mcp-call",
8346
+ runId: "mcp-call",
8347
+ requireTools: ["mcp:tools/list"],
8348
+ maxDurationMs: 3e4
8349
+ }
8350
+ ]),
8351
+ "workflow-agent": baseTemplate("workflow-agent", [
8352
+ {
8353
+ id: "workflow-handoff",
8354
+ runId: "workflow-handoff",
8355
+ requireTools: ["handoff"],
8356
+ maxDurationMs: 6e4
8357
+ }
8358
+ ]),
8359
+ "rag-answer-agent": baseTemplate("rag-answer-agent", [
8360
+ {
8361
+ id: "rag-answer",
8362
+ runId: "rag-answer",
8363
+ requireTools: ["retrieve", "answer"],
8364
+ expectedObservations: ["citationShown"],
8365
+ maxDurationMs: 45e3
8366
+ }
8367
+ ]),
8368
+ "human-approval-agent": baseTemplate("human-approval-agent", [
8369
+ {
8370
+ id: "approval-gate",
8371
+ runId: "approval-gate",
8372
+ expectedObservations: ["approvalRequested", "approvalGranted"],
8373
+ maxDurationMs: 6e4
8374
+ }
8375
+ ])
8376
+ };
8377
+ }
8378
+ });
8379
+
8266
8380
  // packages/core/src/suite/index.ts
8267
8381
  var init_suite = __esm({
8268
8382
  "packages/core/src/suite/index.ts"() {
@@ -8272,6 +8386,7 @@ var init_suite = __esm({
8272
8386
  init_resolve2();
8273
8387
  init_run();
8274
8388
  init_report();
8389
+ init_templates();
8275
8390
  }
8276
8391
  });
8277
8392
 
@@ -9416,6 +9531,7 @@ var init_advanced = __esm({
9416
9531
  init_duration();
9417
9532
  init_bundle();
9418
9533
  init_suite();
9534
+ init_templates();
9419
9535
  init_extract();
9420
9536
  init_cohort2();
9421
9537
  init_gate();
@@ -10613,7 +10729,7 @@ var init_src = __esm({
10613
10729
  });
10614
10730
 
10615
10731
  // package.json
10616
- var version = "5.3.0";
10732
+ var version = "5.4.0";
10617
10733
 
10618
10734
  // packages/cli/src/list.ts
10619
10735
  init_advanced();
@@ -20881,30 +20997,39 @@ function resolveCwd(options) {
20881
20997
  async function suiteInitCommand(options = {}) {
20882
20998
  const cwd = resolveCwd(options);
20883
20999
  const configPath = path26__default.default.join(cwd, DEFAULT_CONFIG_FILENAME);
20884
- const template = defaultSuiteConfigTemplate();
21000
+ const template = options.template?.trim();
21001
+ const suiteConfig = template !== void 0 && template !== "" ? resolveSuiteTemplate(template) : defaultSuiteConfigTemplate();
20885
21002
  if (options.dryRun) {
20886
21003
  if (options.json) {
20887
21004
  printJson5({
20888
21005
  ok: true,
20889
21006
  dryRun: true,
20890
21007
  wouldWrite: [DEFAULT_CONFIG_FILENAME],
20891
- config: template
21008
+ config: suiteConfig,
21009
+ ...template ? { template } : {}
20892
21010
  });
20893
21011
  return;
20894
21012
  }
20895
21013
  console.log("Dry run \u2014 would create:");
20896
21014
  console.log(`- ${DEFAULT_CONFIG_FILENAME}`);
21015
+ if (template) console.log(` template: ${template}`);
20897
21016
  return;
20898
21017
  }
20899
21018
  try {
20900
- await promises.writeFile(configPath, `${JSON.stringify(template, null, 2)}
21019
+ await promises.writeFile(configPath, `${JSON.stringify(suiteConfig, null, 2)}
20901
21020
  `, "utf-8");
20902
21021
  if (options.json) {
20903
- printJson5({ ok: true, created: [DEFAULT_CONFIG_FILENAME], configPath });
21022
+ printJson5({
21023
+ ok: true,
21024
+ created: [DEFAULT_CONFIG_FILENAME],
21025
+ configPath,
21026
+ ...template ? { template } : {}
21027
+ });
20904
21028
  return;
20905
21029
  }
20906
21030
  console.log("Created suite config:");
20907
21031
  console.log(`- ${DEFAULT_CONFIG_FILENAME}`);
21032
+ if (template) console.log(` template: ${template}`);
20908
21033
  console.log("\nNext:");
20909
21034
  console.log(" npx agent-inspect suite validate");
20910
21035
  console.log(" npx agent-inspect suite run --json");
@@ -21711,7 +21836,7 @@ function createCliProgram() {
21711
21836
  runCommand(() => workspacePathCommand(opts));
21712
21837
  });
21713
21838
  const suiteCmd = program.command("suite").description("Define and run local trace suites for CI (v5.0+)");
21714
- suiteCmd.command("init").description("Create a starter agent-inspect.suite.json").option("--dry-run", "show planned files without writing").option("--json", "print deterministic JSON result").action((opts) => {
21839
+ suiteCmd.command("init").description("Create a starter agent-inspect.suite.json").option("--template <name>", "PM/QA template id (v5.4+)").option("--dry-run", "show planned files without writing").option("--json", "print deterministic JSON result").action((opts) => {
21715
21840
  runCommand(() => suiteInitCommand(opts));
21716
21841
  });
21717
21842
  suiteCmd.command("validate").description("Validate suite config shape and trace paths").option("--config <path>", "suite config path").option("--json", "print deterministic JSON result").action((opts) => {