agent-inspect 6.29.4 → 6.29.6

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.
Files changed (87) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +1 -1
  3. package/docs/CLI.md +1 -1
  4. package/docs/LIMITATIONS.md +1 -1
  5. package/docs/TRACE-CONTRACTS.md +11 -8
  6. package/package.json +1 -1
  7. package/packages/cli/dist/{chunk-FJRUJSST.mjs → chunk-DBRMI7TC.mjs} +74 -30
  8. package/packages/cli/dist/chunk-DBRMI7TC.mjs.map +1 -0
  9. package/packages/cli/dist/index.cjs +229 -73
  10. package/packages/cli/dist/index.cjs.map +1 -1
  11. package/packages/cli/dist/index.mjs +148 -45
  12. package/packages/cli/dist/index.mjs.map +1 -1
  13. package/packages/cli/dist/{src-GZQVDREP.mjs → src-6CET2GW2.mjs} +3 -3
  14. package/packages/cli/dist/{src-GZQVDREP.mjs.map → src-6CET2GW2.mjs.map} +1 -1
  15. package/packages/core/dist/advanced.cjs +39 -10
  16. package/packages/core/dist/advanced.cjs.map +1 -1
  17. package/packages/core/dist/advanced.d.cts +10 -10
  18. package/packages/core/dist/advanced.d.ts +10 -10
  19. package/packages/core/dist/advanced.mjs +15 -14
  20. package/packages/core/dist/advanced.mjs.map +1 -1
  21. package/packages/core/dist/checks.cjs +78 -32
  22. package/packages/core/dist/checks.cjs.map +1 -1
  23. package/packages/core/dist/checks.d.cts +7 -7
  24. package/packages/core/dist/checks.d.ts +7 -7
  25. package/packages/core/dist/checks.mjs +5 -5
  26. package/packages/core/dist/{chunk-7LSVGXCN.mjs → chunk-26YJSETN.mjs} +3 -3
  27. package/packages/core/dist/{chunk-7LSVGXCN.mjs.map → chunk-26YJSETN.mjs.map} +1 -1
  28. package/packages/core/dist/{chunk-5M4QUYFH.mjs → chunk-BGF5JDJN.mjs} +3 -3
  29. package/packages/core/dist/{chunk-5M4QUYFH.mjs.map → chunk-BGF5JDJN.mjs.map} +1 -1
  30. package/packages/core/dist/{chunk-3I6KX32E.mjs → chunk-EE5Z2GQ3.mjs} +20 -12
  31. package/packages/core/dist/chunk-EE5Z2GQ3.mjs.map +1 -0
  32. package/packages/core/dist/{chunk-FKVCTIP6.mjs → chunk-KWBO36PH.mjs} +4 -4
  33. package/packages/core/dist/{chunk-FKVCTIP6.mjs.map → chunk-KWBO36PH.mjs.map} +1 -1
  34. package/packages/core/dist/{chunk-XPDNO3KH.mjs → chunk-OOX25GTH.mjs} +62 -35
  35. package/packages/core/dist/chunk-OOX25GTH.mjs.map +1 -0
  36. package/packages/core/dist/{chunk-BMRK6XHO.mjs → chunk-PBNBQRXV.mjs} +4 -4
  37. package/packages/core/dist/{chunk-BMRK6XHO.mjs.map → chunk-PBNBQRXV.mjs.map} +1 -1
  38. package/packages/core/dist/{chunk-KNRY24RS.mjs → chunk-Q5SLKV2Y.mjs} +3 -3
  39. package/packages/core/dist/{chunk-KNRY24RS.mjs.map → chunk-Q5SLKV2Y.mjs.map} +1 -1
  40. package/packages/core/dist/{chunk-AT7TICCQ.mjs → chunk-WN5PT4GV.mjs} +4 -4
  41. package/packages/core/dist/{chunk-AT7TICCQ.mjs.map → chunk-WN5PT4GV.mjs.map} +1 -1
  42. package/packages/core/dist/{chunk-DZBNXCLA.mjs → chunk-ZFJ2ICTC.mjs} +5 -5
  43. package/packages/core/dist/{chunk-DZBNXCLA.mjs.map → chunk-ZFJ2ICTC.mjs.map} +1 -1
  44. package/packages/core/dist/{context-B8zzsmjX.d.ts → context-B7DqUmsJ.d.ts} +3 -3
  45. package/packages/core/dist/{context-BhaVHtOT.d.cts → context-rR_jW9TH.d.cts} +3 -3
  46. package/packages/core/dist/diff.d.cts +3 -3
  47. package/packages/core/dist/diff.d.ts +3 -3
  48. package/packages/core/dist/exporters.d.cts +3 -3
  49. package/packages/core/dist/exporters.d.ts +3 -3
  50. package/packages/core/dist/exporters.mjs +5 -5
  51. package/packages/core/dist/{index-CrnEOoRu.d.ts → index-7hG_qggp.d.ts} +9 -4
  52. package/packages/core/dist/{index-BaQ48jrq.d.cts → index-CQJUNPPe.d.cts} +9 -4
  53. package/packages/core/dist/{index-BT3KcO6-.d.cts → index-Cdww9h50.d.cts} +2 -2
  54. package/packages/core/dist/{index-reskZCVW.d.ts → index-xUbdpcrP.d.ts} +2 -2
  55. package/packages/core/dist/index.cjs +11 -9
  56. package/packages/core/dist/index.cjs.map +1 -1
  57. package/packages/core/dist/index.d.cts +6 -6
  58. package/packages/core/dist/index.d.ts +6 -6
  59. package/packages/core/dist/index.mjs +6 -6
  60. package/packages/core/dist/{inspect-event-CDqjcrG_.d.cts → inspect-event-ClM5Z8om.d.cts} +6 -1
  61. package/packages/core/dist/{inspect-event-CDqjcrG_.d.ts → inspect-event-ClM5Z8om.d.ts} +6 -1
  62. package/packages/core/dist/{log-config-DcjV8ZjF.d.cts → log-config-CyRGaaWd.d.cts} +1 -1
  63. package/packages/core/dist/{log-config-N_c5AE09.d.ts → log-config-DAV_sR9A.d.ts} +1 -1
  64. package/packages/core/dist/logs.d.cts +3 -3
  65. package/packages/core/dist/logs.d.ts +3 -3
  66. package/packages/core/dist/{persisted-inspect-event-BMwvGIB8.d.ts → persisted-inspect-event-DG02LhEP.d.ts} +1 -1
  67. package/packages/core/dist/{persisted-inspect-event-DPaCiars.d.cts → persisted-inspect-event-q2ViiBW6.d.cts} +1 -1
  68. package/packages/core/dist/persisted.cjs +11 -9
  69. package/packages/core/dist/persisted.cjs.map +1 -1
  70. package/packages/core/dist/persisted.d.cts +5 -5
  71. package/packages/core/dist/persisted.d.ts +5 -5
  72. package/packages/core/dist/persisted.mjs +3 -3
  73. package/packages/core/dist/readers.cjs +11 -9
  74. package/packages/core/dist/readers.cjs.map +1 -1
  75. package/packages/core/dist/readers.d.cts +3 -3
  76. package/packages/core/dist/readers.d.ts +3 -3
  77. package/packages/core/dist/readers.mjs +4 -4
  78. package/packages/core/dist/{types-C5Y8Idle.d.ts → types-BX1EPji1.d.ts} +1 -1
  79. package/packages/core/dist/{types-BSzhK7Z1.d.cts → types-bwL8cBv5.d.cts} +1 -1
  80. package/packages/core/dist/writers.cjs +11 -9
  81. package/packages/core/dist/writers.cjs.map +1 -1
  82. package/packages/core/dist/writers.d.cts +2 -2
  83. package/packages/core/dist/writers.d.ts +2 -2
  84. package/packages/core/dist/writers.mjs +3 -3
  85. package/packages/cli/dist/chunk-FJRUJSST.mjs.map +0 -1
  86. package/packages/core/dist/chunk-3I6KX32E.mjs.map +0 -1
  87. package/packages/core/dist/chunk-XPDNO3KH.mjs.map +0 -1
@@ -10,6 +10,23 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
10
  var path__default = /*#__PURE__*/_interopDefault(path);
11
11
  var os__default = /*#__PURE__*/_interopDefault(os);
12
12
 
13
+ // packages/core/src/types/inspect-event.ts
14
+ var ATTRIBUTION_CONFIDENCES = [
15
+ "unknown",
16
+ "heuristic",
17
+ "correlated",
18
+ "explicit"
19
+ ];
20
+ function isAttributionConfidence(value) {
21
+ return typeof value === "string" && ATTRIBUTION_CONFIDENCES.includes(value);
22
+ }
23
+ var ATTRIBUTION_CONFIDENCE_RANK = {
24
+ unknown: 0,
25
+ heuristic: 1,
26
+ correlated: 2,
27
+ explicit: 3
28
+ };
29
+
13
30
  // packages/core/src/diagnostics/programmatic.ts
14
31
  var PROGRAMMATIC_DIAGNOSTIC_SPECS = Object.freeze({
15
32
  AI_TRACE_INPUT_INVALID: {
@@ -2021,16 +2038,6 @@ function eventTime2(event) {
2021
2038
  function sortByTime2(events) {
2022
2039
  return [...events].sort((a, b) => eventTime2(a).localeCompare(eventTime2(b)));
2023
2040
  }
2024
- function hasIdempotencyEvidence2(event) {
2025
- const workflow = workflowFor2(event);
2026
- if (typeof workflow.idempotencyKey === "string" && workflow.idempotencyKey.trim() !== "") {
2027
- return true;
2028
- }
2029
- const attrs2 = event.attributes ?? {};
2030
- if (attrs2.noSideEffect === true) return true;
2031
- if (attrs2.sideEffect === false) return true;
2032
- return false;
2033
- }
2034
2041
  function errorCodeOf(event) {
2035
2042
  if (typeof event.error?.code === "string" && event.error.code.trim() !== "") {
2036
2043
  return event.error.code.trim();
@@ -2287,13 +2294,13 @@ function evaluateRecoveryOperations(events, operations) {
2287
2294
  }
2288
2295
  if (sideEffectClass === "write") {
2289
2296
  for (const event of ordered) {
2290
- if (isUnevaluableWriteCompletion(event) && !hasIdempotencyEvidence2(event)) {
2297
+ if (isUnevaluableWriteCompletion(event)) {
2291
2298
  findings.push(
2292
2299
  fail3(
2293
2300
  "contract.retry.operations.write-completion-unevaluable",
2294
- `Write tool ${operation.tool} has timeout/unknown completion without authoritative idempotency evidence.`,
2301
+ `Write tool ${operation.tool} has timeout/unknown/running completion that cannot be verified as an authoritative write result.`,
2295
2302
  [eventEvidence2(event)],
2296
- "idempotencyKey|authoritative completion",
2303
+ "authoritative write completion observation",
2297
2304
  {
2298
2305
  code: "AI_CHECK_RECOVERY_WRITE_COMPLETION_UNAVAILABLE",
2299
2306
  status: event.status
@@ -2437,7 +2444,7 @@ function evaluateRecoveryOperations(events, operations) {
2437
2444
  if (dependency?.consumerKind === "LLM") {
2438
2445
  const successForDependency = latest?.status === "ok" ? latest : identityUnavailable ? void 0 : lastOk;
2439
2446
  if (successForDependency) {
2440
- if (sideEffectClass === "write" && isUnevaluableWriteCompletion(successForDependency) && !hasIdempotencyEvidence2(successForDependency)) {
2447
+ if (sideEffectClass === "write" && isUnevaluableWriteCompletion(successForDependency)) {
2441
2448
  findings.push(
2442
2449
  fail3(
2443
2450
  "contract.retry.operations.successful-result-dependency",
@@ -3489,12 +3496,7 @@ var STATUS_RANK = {
3489
3496
  warning: 1,
3490
3497
  pass: 2
3491
3498
  };
3492
- var CONFIDENCE_RANK = {
3493
- unknown: 0,
3494
- heuristic: 1,
3495
- correlated: 2,
3496
- explicit: 3
3497
- };
3499
+ var CONFIDENCE_RANK = ATTRIBUTION_CONFIDENCE_RANK;
3498
3500
  var DEFAULT_SENSITIVE_KEYS = DEFAULT_CREDENTIAL_SENSITIVE_KEYS;
3499
3501
  var DEFAULT_RAW_CONTENT_KEYS = [
3500
3502
  "body",
@@ -3979,6 +3981,18 @@ function limitFindings(findings, maxFindings) {
3979
3981
  function hasRedactionMarker(value, markers) {
3980
3982
  return markers.some((marker) => value.includes(marker)) || /^\[HASH:[A-Za-z0-9_-]+\]$/.test(value);
3981
3983
  }
3984
+ function isFullyRedactedValue(value, markers = ["[REDACTED]", "[REDACTED:"]) {
3985
+ if (typeof value !== "string") return false;
3986
+ const trimmed = value.trim();
3987
+ if (trimmed.length === 0) return false;
3988
+ if (/^\[HASH:[A-Za-z0-9_-]+\]$/.test(trimmed)) return true;
3989
+ if (/^\[REDACTED:[^\]]*\]$/.test(trimmed)) return true;
3990
+ for (const marker of markers) {
3991
+ if (marker.endsWith(":")) continue;
3992
+ if (trimmed === marker) return true;
3993
+ }
3994
+ return false;
3995
+ }
3982
3996
  function isSensitiveKey(key, sensitiveKeys) {
3983
3997
  return isCredentialSensitiveKey(key, sensitiveKeys);
3984
3998
  }
@@ -4333,8 +4347,26 @@ function createToolUsageRule(options) {
4333
4347
  const findings = [];
4334
4348
  for (const required of options.required ?? []) {
4335
4349
  if (!nameSet.has(required)) {
4350
+ const otherKinds = [
4351
+ ...new Set(
4352
+ context.events.filter((event) => {
4353
+ const kind = typeof event.kind === "string" ? event.kind.toUpperCase() : "";
4354
+ if (kind === "TOOL") return false;
4355
+ return resolveCanonicalToolName(event) === required || event.name === required || event.name === `tool:${required}` || event.name.endsWith(`:${required}`);
4356
+ }).map(
4357
+ (event) => typeof event.kind === "string" ? event.kind.toUpperCase() : "UNKNOWN"
4358
+ )
4359
+ )
4360
+ ].sort();
4361
+ const hint = otherKinds.length > 0 ? ` Required name appears under non-TOOL kind(s): ${otherKinds.join(", ")}. tools.required / requiredOrder match TOOL events only.` : "";
4336
4362
  findings.push(
4337
- failFinding("tool.usage", `Required tool ${required} did not appear.`, runEvidence(context.selectedRun), required, names)
4363
+ failFinding(
4364
+ "tool.usage",
4365
+ `Required tool ${required} did not appear.${hint}`,
4366
+ runEvidence(context.selectedRun),
4367
+ required,
4368
+ names
4369
+ )
4338
4370
  );
4339
4371
  }
4340
4372
  }
@@ -4763,6 +4795,12 @@ function createStructureCycleRule() {
4763
4795
  };
4764
4796
  }
4765
4797
  function createStructureRelationshipRule(options = {}) {
4798
+ if (options.minConfidence !== void 0 && !isAttributionConfidence(options.minConfidence)) {
4799
+ throw new TypeError(
4800
+ `createStructureRelationshipRule: minConfidence must be one of: ${ATTRIBUTION_CONFIDENCES.join(", ")}.`
4801
+ );
4802
+ }
4803
+ const minConfidence = options.minConfidence;
4766
4804
  return {
4767
4805
  id: "structure.relationship",
4768
4806
  category: "structure",
@@ -4770,18 +4808,21 @@ function createStructureRelationshipRule(options = {}) {
4770
4808
  evaluate(context) {
4771
4809
  const byId = eventMap(semanticEvents(context));
4772
4810
  const findings = [];
4773
- const minConfidence = options.minConfidence;
4774
4811
  for (const event of semanticEvents(context)) {
4775
- if (minConfidence && CONFIDENCE_RANK[event.confidence] < CONFIDENCE_RANK[minConfidence]) {
4776
- findings.push(
4777
- failFinding(
4778
- "structure.relationship",
4779
- `Event confidence ${event.confidence} is below ${minConfidence}.`,
4780
- [eventEvidence3(event, "confidence")],
4781
- { minConfidence },
4782
- event.confidence
4783
- )
4784
- );
4812
+ if (minConfidence) {
4813
+ const eventRank = CONFIDENCE_RANK[event.confidence] ?? CONFIDENCE_RANK.unknown;
4814
+ const minRank = CONFIDENCE_RANK[minConfidence];
4815
+ if (eventRank < minRank) {
4816
+ findings.push(
4817
+ failFinding(
4818
+ "structure.relationship",
4819
+ `Event confidence ${event.confidence} is below ${minConfidence}.`,
4820
+ [eventEvidence3(event, "confidence")],
4821
+ { minConfidence },
4822
+ event.confidence
4823
+ )
4824
+ );
4825
+ }
4785
4826
  }
4786
4827
  if (!event.parentId) continue;
4787
4828
  if (event.parentId === event.eventId) {
@@ -5048,6 +5089,7 @@ function createSafetyRedactionRule(options = {}) {
5048
5089
  function createSafetyRawContentRule(options = {}) {
5049
5090
  const forbiddenKeys = options.forbiddenKeys ?? DEFAULT_RAW_CONTENT_KEYS;
5050
5091
  const safePathPrefixes = options.safePathPrefixes ?? DEFAULT_SAFE_RAW_CONTENT_PATH_PREFIXES;
5092
+ const markers = options.redactedMarkers ?? ["[REDACTED]", "[REDACTED:"];
5051
5093
  return {
5052
5094
  id: "safety.rawPrompt",
5053
5095
  category: "safety",
@@ -5058,6 +5100,7 @@ function createSafetyRawContentRule(options = {}) {
5058
5100
  for (const entry of eventValueEntries(event, { includeSummaries: options.includeSummaries })) {
5059
5101
  const key = entry.key ?? lastPathSegment(entry.path);
5060
5102
  if (!isRawContentPath(entry.path, key, forbiddenKeys, safePathPrefixes)) continue;
5103
+ if (isFullyRedactedValue(entry.value, markers)) continue;
5061
5104
  findings.push(
5062
5105
  failFinding(
5063
5106
  "safety.rawPrompt",
@@ -5453,6 +5496,8 @@ function runTraceChecks(input, options = {}) {
5453
5496
  };
5454
5497
  }
5455
5498
 
5499
+ exports.ATTRIBUTION_CONFIDENCES = ATTRIBUTION_CONFIDENCES;
5500
+ exports.ATTRIBUTION_CONFIDENCE_RANK = ATTRIBUTION_CONFIDENCE_RANK;
5456
5501
  exports.PROGRAMMATIC_DIAGNOSTIC_SPECS = PROGRAMMATIC_DIAGNOSTIC_SPECS;
5457
5502
  exports.buildTraceFacts = buildTraceFacts;
5458
5503
  exports.createBaselineRegressionRule = createBaselineRegressionRule;
@@ -5489,6 +5534,7 @@ exports.evaluateTraceContractRead = evaluateTraceContractRead;
5489
5534
  exports.explainTraceContract = explainTraceContract;
5490
5535
  exports.extractToolArgumentPayload = extractToolArgumentPayload;
5491
5536
  exports.formatProgrammaticDiagnostic = formatProgrammaticDiagnostic;
5537
+ exports.isAttributionConfidence = isAttributionConfidence;
5492
5538
  exports.lintTraceContract = lintTraceContract;
5493
5539
  exports.projectLogicalEvents = projectLogicalEvents;
5494
5540
  exports.resolveCanonicalToolName = resolveCanonicalToolName;