agent-inspect 6.17.3 → 6.17.4

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.
@@ -6419,8 +6419,11 @@ var init_programmatic = __esm({
6419
6419
  });
6420
6420
 
6421
6421
  // packages/core/src/safety/sensitive-key.ts
6422
+ function keyHasExplicitSeparator(value) {
6423
+ return /[_\-.]/.test(value);
6424
+ }
6422
6425
  function normalizeSensitiveKey(value) {
6423
- return value.toLowerCase().replace(/[^a-z0-9_]/g, "");
6426
+ return value.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
6424
6427
  }
6425
6428
  function isTokenCredentialKey(normalized) {
6426
6429
  if (NON_CREDENTIAL_TOKEN_CONFIG_KEYS.has(normalized)) return false;
@@ -6433,6 +6436,7 @@ function isCredentialSensitiveKey(key, sensitiveKeys = DEFAULT_CREDENTIAL_SENSIT
6433
6436
  const normalized = normalizeSensitiveKey(key);
6434
6437
  if (!normalized) return false;
6435
6438
  if (NON_CREDENTIAL_TOKEN_CONFIG_KEYS.has(normalized)) return false;
6439
+ const allowPrefixCompound = keyHasExplicitSeparator(key);
6436
6440
  for (const sensitive of sensitiveKeys) {
6437
6441
  const s = normalizeSensitiveKey(sensitive);
6438
6442
  if (!s) continue;
@@ -6441,7 +6445,8 @@ function isCredentialSensitiveKey(key, sensitiveKeys = DEFAULT_CREDENTIAL_SENSIT
6441
6445
  continue;
6442
6446
  }
6443
6447
  if (normalized === s) return true;
6444
- if (normalized.endsWith(`_${s}`) || normalized.startsWith(`${s}_`)) return true;
6448
+ if (normalized.endsWith(`_${s}`)) return true;
6449
+ if (allowPrefixCompound && normalized.startsWith(`${s}_`)) return true;
6445
6450
  }
6446
6451
  return false;
6447
6452
  }
@@ -12506,7 +12511,7 @@ var init_src = __esm({
12506
12511
  });
12507
12512
 
12508
12513
  // package.json
12509
- var version = "6.17.3";
12514
+ var version = "6.17.4";
12510
12515
 
12511
12516
  // packages/cli/src/list.ts
12512
12517
  init_advanced();
@@ -16399,8 +16404,11 @@ async function reportCommand(runId, options = {}) {
16399
16404
  init_advanced();
16400
16405
 
16401
16406
  // packages/redact/src/sensitive-key.ts
16407
+ function keyHasExplicitSeparator2(value) {
16408
+ return /[_\-.]/.test(value);
16409
+ }
16402
16410
  function normalizeSensitiveKey2(value) {
16403
- return value.toLowerCase().replace(/[^a-z0-9_]/g, "");
16411
+ return value.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
16404
16412
  }
16405
16413
  var NON_CREDENTIAL_TOKEN_CONFIG_KEYS2 = new Set(
16406
16414
  [
@@ -16430,6 +16438,7 @@ function isCredentialSensitiveKey2(key, sensitiveKeys) {
16430
16438
  const normalized = normalizeSensitiveKey2(key);
16431
16439
  if (!normalized) return false;
16432
16440
  if (NON_CREDENTIAL_TOKEN_CONFIG_KEYS2.has(normalized)) return false;
16441
+ const allowPrefixCompound = keyHasExplicitSeparator2(key);
16433
16442
  for (const sensitive of sensitiveKeys) {
16434
16443
  const s = normalizeSensitiveKey2(sensitive);
16435
16444
  if (!s) continue;
@@ -16438,7 +16447,8 @@ function isCredentialSensitiveKey2(key, sensitiveKeys) {
16438
16447
  continue;
16439
16448
  }
16440
16449
  if (normalized === s) return true;
16441
- if (normalized.endsWith(`_${s}`) || normalized.startsWith(`${s}_`)) return true;
16450
+ if (normalized.endsWith(`_${s}`)) return true;
16451
+ if (allowPrefixCompound && normalized.startsWith(`${s}_`)) return true;
16442
16452
  }
16443
16453
  return false;
16444
16454
  }
@@ -24378,9 +24388,15 @@ function normalizeMetrics2(raw) {
24378
24388
  const parsed = parseCohortMetricList(raw);
24379
24389
  if (parsed.length === 0) return void 0;
24380
24390
  const allowed = new Set(COHORT_METRIC_IDS);
24381
- return parsed.filter(
24382
- (item) => allowed.has(item)
24383
- );
24391
+ const invalid = parsed.filter((metric) => !allowed.has(metric));
24392
+ if (invalid.length > 0) {
24393
+ const valueLabel = invalid.length === 1 ? "value" : "values";
24394
+ const invalidList = invalid.map((metric) => `"${metric}"`).join(", ");
24395
+ throw new Error(
24396
+ `Unsupported cohort --metric ${valueLabel}: ${invalidList}. Valid metrics: ${COHORT_METRIC_IDS.join(", ")}.`
24397
+ );
24398
+ }
24399
+ return parsed;
24384
24400
  }
24385
24401
  async function writeArtifacts(result, outputDir) {
24386
24402
  await promises.mkdir(outputDir, { recursive: true });
@@ -24401,6 +24417,7 @@ async function writeArtifacts(result, outputDir) {
24401
24417
  }
24402
24418
  async function cohortCommand(options = {}) {
24403
24419
  try {
24420
+ const metrics = normalizeMetrics2(options.metric);
24404
24421
  const traceDir = resolveTraceDir({ dir: options.dir });
24405
24422
  const { runs } = await loadSessionRuns(traceDir);
24406
24423
  const result = await analyzeCohort(runs, {
@@ -24409,7 +24426,7 @@ async function cohortCommand(options = {}) {
24409
24426
  candidate: options.candidate,
24410
24427
  cohortKey: options.cohortKey,
24411
24428
  groupBy: options.groupBy,
24412
- metrics: normalizeMetrics2(options.metric)
24429
+ metrics
24413
24430
  });
24414
24431
  const format = options.format ?? (options.json ? "json" : "markdown");
24415
24432
  let artifacts;