agent-inspect 6.31.11 → 6.31.12

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.31.12
4
+
5
+ ### Patch Changes
6
+
7
+ - 31d187e: Stability C00–C03: reconcile release-state tables to 6.31.11; Promptfoo recipe/reviewer-kit verifier freshness and exact matrix identity; strict nested suite config (no string/typo coercion); OpenAI Node recipe runs SDK create inside inspector.llm with RequestOptions and distinct HTTP vs completion IDs.
8
+
3
9
  ## 6.31.11
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -213,7 +213,7 @@ The root package is enough for custom capture, the CLI, checks, and Evidence wor
213
213
 
214
214
  ## Status and documentation
215
215
 
216
- **Current published baseline:** **6.31.11** · persisted schema `1.0` · Node.js `>=20` · MIT.
216
+ **Current published baseline:** **6.31.12** · persisted schema `1.0` · Node.js `>=20` · MIT.
217
217
 
218
218
  Legacy v0.1 and v0.2 traces remain readable. Check the npm badge and [changelog](CHANGELOG.md) for the current published version.
219
219
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-inspect",
3
- "version": "6.31.11",
3
+ "version": "6.31.12",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Local evidence debugger and trajectory-test toolkit for TypeScript AI agents — execution trees, TraceContract checks, Evidence v2, and read-only MCP",
@@ -11324,25 +11324,86 @@ function asStringArray(value, label) {
11324
11324
  function asPositiveNumber(value, label) {
11325
11325
  if (value === void 0) return void 0;
11326
11326
  if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
11327
- throw new Error(`${label} must be a non-negative number.`);
11327
+ throw new Error(`${label} must be a non-negative finite number.`);
11328
11328
  }
11329
11329
  return value;
11330
11330
  }
11331
- function asExpectConfig(value, label) {
11331
+ function asBoolean(value, label) {
11332
11332
  if (value === void 0) return void 0;
11333
+ if (typeof value !== "boolean") {
11334
+ throw new Error(`${label} must be a boolean (not a string or other type).`);
11335
+ }
11336
+ return value;
11337
+ }
11338
+ function assertObject(value, label) {
11333
11339
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
11334
11340
  throw new Error(`${label} must be an object.`);
11335
11341
  }
11336
- const raw = value;
11342
+ return value;
11343
+ }
11344
+ function assertKnownKeys(raw, allowed, label) {
11345
+ const allowedSet = new Set(allowed);
11346
+ for (const key of Object.keys(raw)) {
11347
+ if (!allowedSet.has(key)) {
11348
+ throw new Error(`${label} has unknown key "${key}".`);
11349
+ }
11350
+ }
11351
+ }
11352
+ var CASE_KEYS = [
11353
+ "id",
11354
+ "trace",
11355
+ "runId",
11356
+ "input",
11357
+ "requireTools",
11358
+ "forbidTools",
11359
+ "maxDurationMs",
11360
+ "expectedObservations",
11361
+ "expect"
11362
+ ];
11363
+ var EXPECT_KEYS = [
11364
+ "checkStatus",
11365
+ "findingRuleIds",
11366
+ "rejectUnexpectedFindings",
11367
+ "minAssertions"
11368
+ ];
11369
+ var CHECKS_KEYS = ["select", "run", "tool", "llm"];
11370
+ var CHECKS_RUN_KEYS = ["maxDurationMs", "maxDepth"];
11371
+ var CHECKS_TOOL_KEYS = ["required", "forbidden"];
11372
+ var CHECKS_LLM_KEYS = ["allowedModels", "maxTotalTokens"];
11373
+ var EVAL_KEYS = [
11374
+ "requireSuccess",
11375
+ "requiredTools",
11376
+ "forbiddenTools",
11377
+ "maxDurationMs",
11378
+ "maxDepth",
11379
+ "maxRetries",
11380
+ "maxTotalTokens"
11381
+ ];
11382
+ var ROOT_KEYS = [
11383
+ "name",
11384
+ "traces",
11385
+ "cases",
11386
+ "checks",
11387
+ "eval",
11388
+ "redactionProfile",
11389
+ "artifacts",
11390
+ "baseline",
11391
+ "candidate"
11392
+ ];
11393
+ function asExpectConfig(value, label) {
11394
+ if (value === void 0) return void 0;
11395
+ const raw = assertObject(value, label);
11396
+ assertKnownKeys(raw, EXPECT_KEYS, label);
11337
11397
  const checkStatus = raw.checkStatus;
11338
11398
  if (checkStatus !== "pass" && checkStatus !== "fail" && checkStatus !== "error") {
11339
11399
  throw new Error(`${label}.checkStatus must be "pass", "fail", or "error".`);
11340
11400
  }
11341
11401
  const findingRuleIds = asStringArray(raw.findingRuleIds, `${label}.findingRuleIds`);
11342
11402
  const minAssertions = asPositiveNumber(raw.minAssertions, `${label}.minAssertions`);
11343
- const rejectUnexpectedFindings = raw.rejectUnexpectedFindings === void 0 ? void 0 : typeof raw.rejectUnexpectedFindings === "boolean" ? raw.rejectUnexpectedFindings : (() => {
11344
- throw new Error(`${label}.rejectUnexpectedFindings must be a boolean.`);
11345
- })();
11403
+ const rejectUnexpectedFindings = asBoolean(
11404
+ raw.rejectUnexpectedFindings,
11405
+ `${label}.rejectUnexpectedFindings`
11406
+ );
11346
11407
  return {
11347
11408
  checkStatus,
11348
11409
  ...findingRuleIds !== void 0 ? { findingRuleIds } : {},
@@ -11350,6 +11411,56 @@ function asExpectConfig(value, label) {
11350
11411
  ...minAssertions !== void 0 ? { minAssertions } : {}
11351
11412
  };
11352
11413
  }
11414
+ function asChecksConfig(value, label) {
11415
+ const raw = assertObject(value, label);
11416
+ assertKnownKeys(raw, CHECKS_KEYS, label);
11417
+ const checks = {};
11418
+ const select = asStringArray(raw.select, `${label}.select`);
11419
+ if (select !== void 0) checks.select = select;
11420
+ if (raw.run !== void 0) {
11421
+ const run = assertObject(raw.run, `${label}.run`);
11422
+ assertKnownKeys(run, CHECKS_RUN_KEYS, `${label}.run`);
11423
+ checks.run = {
11424
+ ...asPositiveNumber(run.maxDurationMs, `${label}.run.maxDurationMs`) !== void 0 ? { maxDurationMs: asPositiveNumber(run.maxDurationMs, `${label}.run.maxDurationMs`) } : {},
11425
+ ...asPositiveNumber(run.maxDepth, `${label}.run.maxDepth`) !== void 0 ? { maxDepth: asPositiveNumber(run.maxDepth, `${label}.run.maxDepth`) } : {}
11426
+ };
11427
+ }
11428
+ if (raw.tool !== void 0) {
11429
+ const tool = assertObject(raw.tool, `${label}.tool`);
11430
+ assertKnownKeys(tool, CHECKS_TOOL_KEYS, `${label}.tool`);
11431
+ checks.tool = {
11432
+ ...asStringArray(tool.required, `${label}.tool.required`) !== void 0 ? { required: asStringArray(tool.required, `${label}.tool.required`) } : {},
11433
+ ...asStringArray(tool.forbidden, `${label}.tool.forbidden`) !== void 0 ? { forbidden: asStringArray(tool.forbidden, `${label}.tool.forbidden`) } : {}
11434
+ };
11435
+ }
11436
+ if (raw.llm !== void 0) {
11437
+ const llm = assertObject(raw.llm, `${label}.llm`);
11438
+ assertKnownKeys(llm, CHECKS_LLM_KEYS, `${label}.llm`);
11439
+ checks.llm = {
11440
+ ...asStringArray(llm.allowedModels, `${label}.llm.allowedModels`) !== void 0 ? { allowedModels: asStringArray(llm.allowedModels, `${label}.llm.allowedModels`) } : {},
11441
+ ...asPositiveNumber(llm.maxTotalTokens, `${label}.llm.maxTotalTokens`) !== void 0 ? {
11442
+ maxTotalTokens: asPositiveNumber(
11443
+ llm.maxTotalTokens,
11444
+ `${label}.llm.maxTotalTokens`
11445
+ )
11446
+ } : {}
11447
+ };
11448
+ }
11449
+ return checks;
11450
+ }
11451
+ function asEvalConfig(value, label) {
11452
+ const raw = assertObject(value, label);
11453
+ assertKnownKeys(raw, EVAL_KEYS, label);
11454
+ return {
11455
+ ...asBoolean(raw.requireSuccess, `${label}.requireSuccess`) !== void 0 ? { requireSuccess: asBoolean(raw.requireSuccess, `${label}.requireSuccess`) } : {},
11456
+ ...asStringArray(raw.requiredTools, `${label}.requiredTools`) !== void 0 ? { requiredTools: asStringArray(raw.requiredTools, `${label}.requiredTools`) } : {},
11457
+ ...asStringArray(raw.forbiddenTools, `${label}.forbiddenTools`) !== void 0 ? { forbiddenTools: asStringArray(raw.forbiddenTools, `${label}.forbiddenTools`) } : {},
11458
+ ...asPositiveNumber(raw.maxDurationMs, `${label}.maxDurationMs`) !== void 0 ? { maxDurationMs: asPositiveNumber(raw.maxDurationMs, `${label}.maxDurationMs`) } : {},
11459
+ ...asPositiveNumber(raw.maxDepth, `${label}.maxDepth`) !== void 0 ? { maxDepth: asPositiveNumber(raw.maxDepth, `${label}.maxDepth`) } : {},
11460
+ ...asPositiveNumber(raw.maxRetries, `${label}.maxRetries`) !== void 0 ? { maxRetries: asPositiveNumber(raw.maxRetries, `${label}.maxRetries`) } : {},
11461
+ ...asPositiveNumber(raw.maxTotalTokens, `${label}.maxTotalTokens`) !== void 0 ? { maxTotalTokens: asPositiveNumber(raw.maxTotalTokens, `${label}.maxTotalTokens`) } : {}
11462
+ };
11463
+ }
11353
11464
  function validateCaseConfig(value, index) {
11354
11465
  const diagnostics = [];
11355
11466
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
@@ -11360,6 +11471,7 @@ function validateCaseConfig(value, index) {
11360
11471
  }
11361
11472
  const raw = value;
11362
11473
  try {
11474
+ assertKnownKeys(raw, CASE_KEYS, `cases[${index}]`);
11363
11475
  const id = asString(raw.id, `cases[${index}].id`);
11364
11476
  if (id === void 0) {
11365
11477
  diagnostics.push(
@@ -11408,6 +11520,7 @@ function normalizeSuiteConfig(value) {
11408
11520
  throw new Error("Suite config must export an object.");
11409
11521
  }
11410
11522
  const raw = value;
11523
+ assertKnownKeys(raw, ROOT_KEYS, "suite config");
11411
11524
  const name = asString(raw.name, "name");
11412
11525
  const traces = asString(raw.traces, "traces");
11413
11526
  if (name === void 0) throw new Error("name is required.");
@@ -11436,25 +11549,15 @@ function normalizeSuiteConfig(value) {
11436
11549
  }
11437
11550
  const config = { name, traces, cases };
11438
11551
  if (raw.checks !== void 0) {
11439
- if (typeof raw.checks !== "object" || Array.isArray(raw.checks)) {
11440
- throw new Error("checks must be an object.");
11441
- }
11442
- config.checks = raw.checks;
11552
+ config.checks = asChecksConfig(raw.checks, "checks");
11443
11553
  }
11444
11554
  if (raw.eval !== void 0) {
11445
- if (typeof raw.eval !== "object" || Array.isArray(raw.eval)) {
11446
- throw new Error("eval must be an object.");
11447
- }
11448
- config.eval = raw.eval;
11555
+ config.eval = asEvalConfig(raw.eval, "eval");
11449
11556
  }
11450
11557
  if (raw.artifacts !== void 0) {
11451
- if (typeof raw.artifacts !== "object" || Array.isArray(raw.artifacts)) {
11452
- throw new Error("artifacts must be an object.");
11453
- }
11454
- const outputDir = asString(
11455
- raw.artifacts.outputDir,
11456
- "artifacts.outputDir"
11457
- );
11558
+ const artifacts = assertObject(raw.artifacts, "artifacts");
11559
+ assertKnownKeys(artifacts, ["outputDir"], "artifacts");
11560
+ const outputDir = asString(artifacts.outputDir, "artifacts.outputDir");
11458
11561
  config.artifacts = outputDir !== void 0 ? { outputDir } : {};
11459
11562
  }
11460
11563
  if (raw.baseline !== void 0) {
@@ -15375,5 +15478,5 @@ function renderGateReport(result, options = {}) {
15375
15478
  }
15376
15479
 
15377
15480
  export { ATTRIBUTION_CONFIDENCES, COHORT_METRIC_IDS, DEFAULT_REDACT_KEYS, DEFAULT_SUITE_ARTIFACTS_DIR, EVIDENCE_FORMAT_VERSION, EVIDENCE_HTML_FILENAME, EVIDENCE_MANIFEST_FILENAME, Redactor, TraceDirectory, TraceReadError, TreeBuilder, aggregateBundleSafeStatus, aggregateSessionCheckResults, analyzeCohort, applyProfileMetadataCaps, assertBundlePathContained, assertEvidenceRelativePath, buildActivitySummary, buildBundleMetadata, buildBundleSummaryMarkdown, buildEvidenceCausalFailureViewHtml, buildEvidenceCiPackage, buildEvidenceCircuitViewHtml, buildEvidenceContractsViewHtml, buildEvidenceDiffViewHtml, buildEvidenceHtmlShell, buildEvidenceManifest, buildEvidenceOutcomesViewHtml, buildEvidenceProvenanceViewHtml, buildEvidenceSafetyViewHtml, buildEvidenceTimelineViewHtml, buildEvidenceToolsLlmViewHtml, buildEvidenceTreeViewHtml, buildLocalExplanation, buildPlaceholderArtifact, buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildSessionIndex, buildTraceStats, buildZipArchive, bundleFailsOnSafety, bundleRunAssetRelativePath, collectTraceSchemaVersions, compactAttributes, createBaselineRegressionRule, createLlmUsageRule, createMaxStepDurationRule, createObservedOutcomeRule, createRequireCompletedRule, createRunDepthRule, createRunDurationRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStructureCycleRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolUsageRule, defaultBundleOutputPath, defaultSuiteConfigTemplate, defineTraceContract, diffRuns, diffTraceEvents, enrichSessionRunRecord, escapeHtml, escapeMarkdown, evaluateTraceContract, extractMetadata, extractOutcomesFromTraceEvents, filterMetasBySessionScope, filterTraces, flattenTree, formatDuration2 as formatDuration, formatStepLabel, formatTimestamp, gateHasThresholds, getIndent, getTraceFilePath, inferEvidenceFileRole, isAgentInspectTrace, isAttributionConfidence, isCredentialSensitiveKey, isPersistedInspectEvent, loadSessionRunRecords, loadSuiteConfig, loadTraceMetadataList, manualTraceEventsToComparableRun, nanoid, normalizeBundleOutputPath, openTrace, parseCohortMetricList, parseDuration, parseDurationFilter, parseGateList, parseTraceJsonl, persistedInspectEventsToRunTrees, persistedInspectEventsToTraceEvents, projectLogicalEvents, renderActivitySummaryHuman, renderCohortReport, renderErrorLine, renderGateReport, renderObservedOutcomesHtml, renderObservedOutcomesMarkdown, renderRunDiff, renderRunWhat, renderStepLine, renderSuiteReport, renderTimeline, renderTraceStats, resolveBundleRunIds, resolveRedactionProfile, resolveSuiteTemplate, resolveTraceDir, runGate, runSuite, runTraceChecks, safeString, sanitizeBundleRunId, searchTraces, serializeEvidenceManifest, sha256Hex, stableJson, stringContainsHighConfidenceCredential, summarizeObservedOutcomes, summarizeSemanticParity, traceEventToPersistedInspectEvent, truncateName, truncateStringForProfile, validateEvent, validateSuiteConfig, verifyEvidenceDirectory, zeroKinds };
15378
- //# sourceMappingURL=chunk-MQYHJL3W.mjs.map
15379
- //# sourceMappingURL=chunk-MQYHJL3W.mjs.map
15481
+ //# sourceMappingURL=chunk-GBAGZVUX.mjs.map
15482
+ //# sourceMappingURL=chunk-GBAGZVUX.mjs.map