agent-inspect 6.17.6 → 6.17.8

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.
@@ -3020,29 +3020,30 @@ async function searchTraces(metas, options) {
3020
3020
  }
3021
3021
  function matchRunLevel(m, opts) {
3022
3022
  if (opts.stepTypeFilter || opts.toolQuery) return [];
3023
- const out = [];
3023
+ if (opts.statusFilter && m.status !== opts.statusFilter) return [];
3024
+ if (opts.nameQuery && !nameMatches(m.name ?? m.runId, opts.nameQuery)) {
3025
+ return [];
3026
+ }
3027
+ if (opts.durationFilter && !durationMatches(m.durationMs, opts.durationFilter)) {
3028
+ return [];
3029
+ }
3024
3030
  const fields = [];
3025
- if (opts.statusFilter && m.status === opts.statusFilter) {
3026
- fields.push("run.status");
3027
- }
3028
- if (opts.nameQuery && nameMatches(m.name ?? m.runId, opts.nameQuery)) {
3029
- fields.push("run.name");
3030
- }
3031
- if (opts.durationFilter && durationMatches(m.durationMs, opts.durationFilter)) {
3032
- fields.push("run.durationMs");
3033
- }
3034
- if (fields.length === 0) return out;
3035
- out.push({
3036
- runId: m.runId,
3037
- runName: m.name,
3038
- runStatus: m.status,
3039
- timestamp: m.startedAt,
3040
- durationMs: m.durationMs,
3041
- matchReason: `run match: ${fields.join(", ")}`,
3042
- matchedFields: fields,
3043
- filePath: m.filePath
3044
- });
3045
- return out;
3031
+ if (opts.statusFilter) fields.push("run.status");
3032
+ if (opts.nameQuery) fields.push("run.name");
3033
+ if (opts.durationFilter) fields.push("run.durationMs");
3034
+ if (fields.length === 0) return [];
3035
+ return [
3036
+ {
3037
+ runId: m.runId,
3038
+ runName: m.name,
3039
+ runStatus: m.status,
3040
+ timestamp: m.startedAt,
3041
+ durationMs: m.durationMs,
3042
+ matchReason: `run match: ${fields.join(", ")}`,
3043
+ matchedFields: fields,
3044
+ filePath: m.filePath
3045
+ }
3046
+ ];
3046
3047
  }
3047
3048
  function matchStepLevel(m, events, opts) {
3048
3049
  const out = [];
@@ -8418,7 +8419,11 @@ var init_checks2 = __esm({
8418
8419
  { id: "openai-key", pattern: /sk-[A-Za-z0-9_-]{16,}/ },
8419
8420
  { id: "aws-access-key", pattern: /AKIA[0-9A-Z]{16}/ },
8420
8421
  { id: "github-token", pattern: /gh[opsu]_[A-Za-z0-9_]{20,}/ },
8421
- { id: "key-value-secret", pattern: /(api[_-]?key|token|password|secret)=\S{8,}/i }
8422
+ // Keep in sync with packages/redact/src/key-value-secret.ts (KEY_VALUE_SECRET_PATTERN_SOURCE).
8423
+ {
8424
+ id: "key-value-secret",
8425
+ pattern: /\b(?:api[_-]?key|internal[_-]?token|access[_-]?token|auth[_-]?token|password|secret|token)=([^\s"'\\]{8,})/i
8426
+ }
8422
8427
  ];
8423
8428
  }
8424
8429
  });
@@ -12581,7 +12586,7 @@ var init_src = __esm({
12581
12586
  });
12582
12587
 
12583
12588
  // package.json
12584
- var version = "6.17.6";
12589
+ var version = "6.17.8";
12585
12590
 
12586
12591
  // packages/cli/src/list.ts
12587
12592
  init_advanced();
@@ -12736,13 +12741,14 @@ async function list(options = {}) {
12736
12741
 
12737
12742
  // packages/cli/src/clean.ts
12738
12743
  init_advanced();
12744
+ var DECIMAL_INTEGER_PATTERN = /^\d+$/;
12739
12745
  function parseKeep(raw) {
12740
12746
  const trimmed = typeof raw === "string" ? raw.trim() : "";
12741
- if (trimmed === "") {
12747
+ if (!DECIMAL_INTEGER_PATTERN.test(trimmed)) {
12742
12748
  throw new Error(`Invalid --keep value: ${raw}. Provide a positive integer.`);
12743
12749
  }
12744
- const n = Number.parseInt(trimmed, 10);
12745
- if (!Number.isFinite(n) || n <= 0) {
12750
+ const n = Number(trimmed);
12751
+ if (!Number.isSafeInteger(n) || n <= 0) {
12746
12752
  throw new Error(`Invalid --keep value: ${raw}. Provide a positive integer.`);
12747
12753
  }
12748
12754
  return n;
@@ -16528,6 +16534,17 @@ function isCredentialSensitiveKey2(key, sensitiveKeys) {
16528
16534
  return false;
16529
16535
  }
16530
16536
 
16537
+ // packages/redact/src/key-value-secret.ts
16538
+ var KEY_VALUE_SECRET_PATTERN_SOURCE = String.raw`\b(?:api[_-]?key|internal[_-]?token|access[_-]?token|auth[_-]?token|password|secret|token)=([^\s"'\\]{8,})`;
16539
+ var KEY_VALUE_SECRET_PATTERN = new RegExp(
16540
+ KEY_VALUE_SECRET_PATTERN_SOURCE,
16541
+ "i"
16542
+ );
16543
+ function valueContainsKeyValueSecret(value) {
16544
+ KEY_VALUE_SECRET_PATTERN.lastIndex = 0;
16545
+ return KEY_VALUE_SECRET_PATTERN.test(value);
16546
+ }
16547
+
16531
16548
  // packages/redact/src/index.ts
16532
16549
  var DEFAULT_REDACT_KEYS2 = [
16533
16550
  "authorization",
@@ -16734,6 +16751,15 @@ var credentialDetectors = [
16734
16751
  pattern: /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*-----END [A-Z ]*PRIVATE KEY-----/,
16735
16752
  severity: "error"
16736
16753
  }),
16754
+ {
16755
+ id: "value.keyValueSecret",
16756
+ severity: "error",
16757
+ matchKind: "value",
16758
+ detect(input3) {
16759
+ if (typeof input3.value !== "string") return [];
16760
+ return valueContainsKeyValueSecret(input3.value) ? [{ action: "replace", severity: "error", matchKind: "value" }] : [];
16761
+ }
16762
+ },
16737
16763
  {
16738
16764
  id: "value.creditCard",
16739
16765
  severity: "error",
@@ -18470,12 +18496,30 @@ function uniqueSelectIds(ids) {
18470
18496
  }
18471
18497
  return out;
18472
18498
  }
18499
+ function resolveForbiddenToolOptions(options) {
18500
+ const merged = [...options.forbiddenTool ?? [], ...options.forbidTool ?? []];
18501
+ const seen = /* @__PURE__ */ new Set();
18502
+ const out = [];
18503
+ for (const name of merged) {
18504
+ if (seen.has(name)) continue;
18505
+ seen.add(name);
18506
+ out.push(name);
18507
+ }
18508
+ return out;
18509
+ }
18510
+ function withResolvedForbiddenTools(options) {
18511
+ return {
18512
+ ...options,
18513
+ forbiddenTool: resolveForbiddenToolOptions(options),
18514
+ forbidTool: void 0
18515
+ };
18516
+ }
18473
18517
  function cliShorthandSelectIds(options) {
18474
18518
  const ids = [];
18475
18519
  if (options.failOnObservation !== void 0 && options.failOnObservation.trim() !== "") {
18476
18520
  ids.push("outcome.status");
18477
18521
  }
18478
- if ((options.requiredTool?.length ?? 0) > 0 || (options.forbiddenTool?.length ?? 0) > 0) {
18522
+ if ((options.requiredTool?.length ?? 0) > 0 || (options.forbiddenTool?.length ?? 0) > 0 || (options.forbidTool?.length ?? 0) > 0) {
18479
18523
  ids.push("tool.usage");
18480
18524
  }
18481
18525
  if ((options.allowedModel?.length ?? 0) > 0 || options.maxTotalTokens !== void 0) {
@@ -19196,6 +19240,7 @@ function readErrorResult(error) {
19196
19240
  );
19197
19241
  }
19198
19242
  async function checkCommand(target, options = {}, stdin = process.stdin) {
19243
+ options = withResolvedForbiddenTools(options);
19199
19244
  let result;
19200
19245
  let phase = "config";
19201
19246
  let evidenceRead;
@@ -23603,6 +23648,9 @@ async function initCommand(options = {}) {
23603
23648
  process.exitCode = 1;
23604
23649
  }
23605
23650
  }
23651
+ var DOCS_BASE = "https://github.com/rajudandigam/agent-inspect/blob/main/docs";
23652
+ var AGENT_INSPECT_NOT_RESOLVABLE_MESSAGE = "agent-inspect does not resolve from this project. A global CLI install is not enough \u2014 the package must be a dependency here.";
23653
+ var AGENT_INSPECT_NOT_RESOLVABLE_REMEDIATION = `Install it in this project: npm install agent-inspect (or pnpm add agent-inspect). See ${DOCS_BASE}/FIRST-TRACE-IN-5-MINUTES.md`;
23606
23654
  var OPTIONAL_PACKAGES = {
23607
23655
  custom: [],
23608
23656
  "ai-sdk": ["@agent-inspect/ai-sdk"],
@@ -23617,7 +23665,7 @@ function nodeVersionCheck() {
23617
23665
  id: "node-version",
23618
23666
  status: "fail",
23619
23667
  message: `Node ${process3__default.default.versions.node} is below the supported minimum (20).`,
23620
- remediation: "Upgrade to Node 20 LTS or newer.",
23668
+ remediation: `Upgrade to Node 20 LTS or newer, then reinstall. See ${DOCS_BASE}/GETTING-STARTED.md`,
23621
23669
  evidence: process3__default.default.versions.node
23622
23670
  };
23623
23671
  }
@@ -23661,7 +23709,7 @@ async function traceDirWritable(traceDir) {
23661
23709
  id: "trace-dir-writable",
23662
23710
  status: "fail",
23663
23711
  message: `Trace directory is not writable: ${resolved}`,
23664
- remediation: "Create the directory or set AGENT_INSPECT_TRACE_DIR to a writable path.",
23712
+ remediation: `Create the directory or set AGENT_INSPECT_TRACE_DIR to a writable path. See ${DOCS_BASE}/GETTING-STARTED.md`,
23665
23713
  evidence: error instanceof Error ? error.message : String(error)
23666
23714
  };
23667
23715
  }
@@ -23724,8 +23772,8 @@ function importSmoke(cwd) {
23724
23772
  results.push({
23725
23773
  id: "import-agent-inspect",
23726
23774
  status: "warn",
23727
- message: "agent-inspect is not installed in the current project.",
23728
- remediation: "Run npm install agent-inspect (or pnpm add agent-inspect)."
23775
+ message: AGENT_INSPECT_NOT_RESOLVABLE_MESSAGE,
23776
+ remediation: AGENT_INSPECT_NOT_RESOLVABLE_REMEDIATION
23729
23777
  });
23730
23778
  results.push({
23731
23779
  id: "import-agent-inspect-cjs",
@@ -23774,8 +23822,8 @@ function versionMismatchCheck(cwd) {
23774
23822
  return {
23775
23823
  id: "version-alignment",
23776
23824
  status: "warn",
23777
- message: `CLI version ${version} differs from local agent-inspect@${root.version}.`,
23778
- remediation: "Align versions with npm install agent-inspect@latest",
23825
+ message: `CLI version ${version} differs from local agent-inspect@${root.version}. A packed consumer can hit this when npx uses a cached global CLI.`,
23826
+ remediation: `Align versions with npm install agent-inspect@${version}, or run via the local binary. See ${DOCS_BASE}/KNOWN-ISSUES.md`,
23779
23827
  evidence: `cli=${version};local=${root.version}`
23780
23828
  };
23781
23829
  }
@@ -25224,6 +25272,9 @@ function createCliProgram() {
25224
25272
  ]).option("--forbidden-tool <name>", "forbid a tool name (repeatable)", (value, previous = []) => [
25225
25273
  ...previous,
25226
25274
  value
25275
+ ]).option("--forbid-tool <name>", "alias for --forbidden-tool (repeatable)", (value, previous = []) => [
25276
+ ...previous,
25277
+ value
25227
25278
  ]).option("--allowed-model <model>", "allow an LLM model (repeatable)", (value, previous = []) => [
25228
25279
  ...previous,
25229
25280
  value