agent-inspect 6.28.0 → 6.29.1

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 (91) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/docs/CLI.md +19 -1
  4. package/docs/LIMITATIONS.md +2 -2
  5. package/docs/SAFE-TRACE-SHARING.md +1 -1
  6. package/docs/SCHEMA.md +1 -1
  7. package/docs/STANDARDS.md +1 -1
  8. package/package.json +2 -1
  9. package/packages/cli/dist/{chunk-JVQ4LTHR.mjs → chunk-UK4HD5M3.mjs} +181 -32
  10. package/packages/cli/dist/chunk-UK4HD5M3.mjs.map +1 -0
  11. package/packages/cli/dist/index.cjs +251 -103
  12. package/packages/cli/dist/index.cjs.map +1 -1
  13. package/packages/cli/dist/index.mjs +63 -72
  14. package/packages/cli/dist/index.mjs.map +1 -1
  15. package/packages/cli/dist/{src-M5J5YC5E.mjs → src-CMPIJGUE.mjs} +3 -3
  16. package/packages/cli/dist/{src-M5J5YC5E.mjs.map → src-CMPIJGUE.mjs.map} +1 -1
  17. package/packages/core/dist/advanced.cjs +153 -30
  18. package/packages/core/dist/advanced.cjs.map +1 -1
  19. package/packages/core/dist/advanced.d.cts +20 -7
  20. package/packages/core/dist/advanced.d.ts +20 -7
  21. package/packages/core/dist/advanced.mjs +114 -38
  22. package/packages/core/dist/advanced.mjs.map +1 -1
  23. package/packages/core/dist/checks.cjs +235 -34
  24. package/packages/core/dist/checks.cjs.map +1 -1
  25. package/packages/core/dist/checks.d.cts +5 -5
  26. package/packages/core/dist/checks.d.ts +5 -5
  27. package/packages/core/dist/checks.mjs +5 -5
  28. package/packages/core/dist/{chunk-NXQF73EC.mjs → chunk-5B4DNGFB.mjs} +9 -5
  29. package/packages/core/dist/chunk-5B4DNGFB.mjs.map +1 -0
  30. package/packages/core/dist/{chunk-JBNRJLIV.mjs → chunk-5RF7FYGL.mjs} +33 -7
  31. package/packages/core/dist/chunk-5RF7FYGL.mjs.map +1 -0
  32. package/packages/core/dist/{chunk-U25RHRSU.mjs → chunk-65LFRW2T.mjs} +13 -6
  33. package/packages/core/dist/chunk-65LFRW2T.mjs.map +1 -0
  34. package/packages/core/dist/{chunk-WGDSM37E.mjs → chunk-AQMJFKI6.mjs} +5 -5
  35. package/packages/core/dist/{chunk-WGDSM37E.mjs.map → chunk-AQMJFKI6.mjs.map} +1 -1
  36. package/packages/core/dist/{chunk-R4SSYU6D.mjs → chunk-COZPMOUF.mjs} +3 -3
  37. package/packages/core/dist/{chunk-R4SSYU6D.mjs.map → chunk-COZPMOUF.mjs.map} +1 -1
  38. package/packages/core/dist/{chunk-NDRMIL7Z.mjs → chunk-FKUTGUFG.mjs} +12 -4
  39. package/packages/core/dist/chunk-FKUTGUFG.mjs.map +1 -0
  40. package/packages/core/dist/{chunk-ME4WXYY3.mjs → chunk-GPGBKN7W.mjs} +238 -37
  41. package/packages/core/dist/chunk-GPGBKN7W.mjs.map +1 -0
  42. package/packages/core/dist/{chunk-P366CCL2.mjs → chunk-QJI52TH3.mjs} +4 -2
  43. package/packages/core/dist/chunk-QJI52TH3.mjs.map +1 -0
  44. package/packages/core/dist/{chunk-WRE4CNPF.mjs → chunk-SJ3C5RIS.mjs} +3 -3
  45. package/packages/core/dist/chunk-SJ3C5RIS.mjs.map +1 -0
  46. package/packages/core/dist/{context-DgcvkJ9t.d.ts → context-B8zzsmjX.d.ts} +2 -2
  47. package/packages/core/dist/{context-DGMqxFpz.d.cts → context-BhaVHtOT.d.cts} +2 -2
  48. package/packages/core/dist/diff.d.cts +1 -1
  49. package/packages/core/dist/diff.d.ts +1 -1
  50. package/packages/core/dist/exporters.cjs +39 -8
  51. package/packages/core/dist/exporters.cjs.map +1 -1
  52. package/packages/core/dist/exporters.d.cts +13 -3
  53. package/packages/core/dist/exporters.d.ts +13 -3
  54. package/packages/core/dist/exporters.mjs +15 -10
  55. package/packages/core/dist/exporters.mjs.map +1 -1
  56. package/packages/core/dist/{index-C6bCIbFO.d.cts → index-BT3KcO6-.d.cts} +1 -1
  57. package/packages/core/dist/{index-DVetZwGG.d.cts → index-C61p7wBR.d.cts} +3 -3
  58. package/packages/core/dist/{index-BOA1AeEU.d.ts → index-DTO2iGeq.d.ts} +3 -3
  59. package/packages/core/dist/{index-BzyNPfLm.d.ts → index-reskZCVW.d.ts} +1 -1
  60. package/packages/core/dist/index.cjs +10 -1
  61. package/packages/core/dist/index.cjs.map +1 -1
  62. package/packages/core/dist/index.d.cts +4 -4
  63. package/packages/core/dist/index.d.ts +4 -4
  64. package/packages/core/dist/index.mjs +6 -6
  65. package/packages/core/dist/{persisted-inspect-event-CbaRYpbw.d.ts → persisted-inspect-event-BMwvGIB8.d.ts} +5 -0
  66. package/packages/core/dist/{persisted-inspect-event-DiJ0I_vi.d.cts → persisted-inspect-event-DPaCiars.d.cts} +5 -0
  67. package/packages/core/dist/persisted.cjs +8 -2
  68. package/packages/core/dist/persisted.cjs.map +1 -1
  69. package/packages/core/dist/persisted.d.cts +3 -3
  70. package/packages/core/dist/persisted.d.ts +3 -3
  71. package/packages/core/dist/persisted.mjs +3 -3
  72. package/packages/core/dist/readers.cjs +16 -2
  73. package/packages/core/dist/readers.cjs.map +1 -1
  74. package/packages/core/dist/readers.d.cts +2 -2
  75. package/packages/core/dist/readers.d.ts +2 -2
  76. package/packages/core/dist/readers.mjs +4 -4
  77. package/packages/core/dist/{types-wXuxMUop.d.cts → types-BSzhK7Z1.d.cts} +9 -0
  78. package/packages/core/dist/{types-xv9bSgOK.d.ts → types-C5Y8Idle.d.ts} +9 -0
  79. package/packages/core/dist/writers.cjs +10 -1
  80. package/packages/core/dist/writers.cjs.map +1 -1
  81. package/packages/core/dist/writers.d.cts +1 -1
  82. package/packages/core/dist/writers.d.ts +1 -1
  83. package/packages/core/dist/writers.mjs +3 -3
  84. package/packages/cli/dist/chunk-JVQ4LTHR.mjs.map +0 -1
  85. package/packages/core/dist/chunk-JBNRJLIV.mjs.map +0 -1
  86. package/packages/core/dist/chunk-ME4WXYY3.mjs.map +0 -1
  87. package/packages/core/dist/chunk-NDRMIL7Z.mjs.map +0 -1
  88. package/packages/core/dist/chunk-NXQF73EC.mjs.map +0 -1
  89. package/packages/core/dist/chunk-P366CCL2.mjs.map +0 -1
  90. package/packages/core/dist/chunk-U25RHRSU.mjs.map +0 -1
  91. package/packages/core/dist/chunk-WRE4CNPF.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { OBSERVED_OUTCOME_METHODS, extractOutcomesFromPersistedEvents, outcomesMatchingStatus } from './chunk-R4SSYU6D.mjs';
1
+ import { OBSERVED_OUTCOME_METHODS, extractOutcomesFromPersistedEvents, outcomesMatchingStatus } from './chunk-COZPMOUF.mjs';
2
2
  import { formatProgrammaticDiagnostic } from './chunk-FWK3Q3OJ.mjs';
3
3
 
4
4
  // packages/core/src/sessions/metadata.ts
@@ -1342,6 +1342,76 @@ function evaluateControlRules(events, rules, runEvidence2, observationNames) {
1342
1342
  return findings;
1343
1343
  }
1344
1344
 
1345
+ // packages/core/src/checks/canonical-equality.ts
1346
+ var DEFAULT_MAX_DEPTH = 8;
1347
+ var DEFAULT_MAX_BYTES = 16384;
1348
+ function sortKeysDeep(input, depth, maxDepth) {
1349
+ if (depth > maxDepth) {
1350
+ throw new Error("AI_CHECK_CANONICAL_DEPTH_EXCEEDED");
1351
+ }
1352
+ if (input === null || typeof input !== "object") return input;
1353
+ if (Array.isArray(input)) {
1354
+ return input.map((item) => sortKeysDeep(item, depth + 1, maxDepth));
1355
+ }
1356
+ const record = input;
1357
+ const out = {};
1358
+ for (const key of Object.keys(record).sort()) {
1359
+ out[key] = sortKeysDeep(record[key], depth + 1, maxDepth);
1360
+ }
1361
+ return out;
1362
+ }
1363
+ function encodeCanonicalStructured(value, limits) {
1364
+ const maxDepth = DEFAULT_MAX_DEPTH;
1365
+ const maxBytes = DEFAULT_MAX_BYTES;
1366
+ try {
1367
+ const sorted = sortKeysDeep(value, 0, maxDepth);
1368
+ const encoded = JSON.stringify(sorted);
1369
+ if (encoded === void 0) {
1370
+ return {
1371
+ ok: false,
1372
+ reason: "Value is not JSON-serializable for canonical comparison.",
1373
+ code: "AI_CHECK_CANONICAL_UNSERIALIZABLE"
1374
+ };
1375
+ }
1376
+ if (Buffer.byteLength(encoded, "utf8") > maxBytes) {
1377
+ return {
1378
+ ok: false,
1379
+ reason: "Canonical structured value exceeds bounded size limit.",
1380
+ code: "AI_CHECK_CANONICAL_SIZE_EXCEEDED"
1381
+ };
1382
+ }
1383
+ return { ok: true, value: encoded };
1384
+ } catch (error) {
1385
+ const message = error instanceof Error ? error.message : String(error);
1386
+ if (message === "AI_CHECK_CANONICAL_DEPTH_EXCEEDED") {
1387
+ return {
1388
+ ok: false,
1389
+ reason: "Canonical structured value exceeds bounded depth limit.",
1390
+ code: "AI_CHECK_CANONICAL_DEPTH_EXCEEDED"
1391
+ };
1392
+ }
1393
+ return {
1394
+ ok: false,
1395
+ reason: "Canonical structured encoding failed.",
1396
+ code: "AI_CHECK_CANONICAL_UNSERIALIZABLE"
1397
+ };
1398
+ }
1399
+ }
1400
+ function canonicalStructuredEqual(left, right, limits) {
1401
+ const a = encodeCanonicalStructured(left);
1402
+ if (!a.ok) return { equal: false, reason: a.reason, code: a.code };
1403
+ const b = encodeCanonicalStructured(right);
1404
+ if (!b.ok) return { equal: false, reason: b.reason, code: b.code };
1405
+ if (a.value !== b.value) {
1406
+ return {
1407
+ equal: false,
1408
+ reason: "Canonical structured values differ.",
1409
+ code: "AI_CHECK_CANONICAL_NOT_EQUAL"
1410
+ };
1411
+ }
1412
+ return { equal: true };
1413
+ }
1414
+
1345
1415
  // packages/core/src/checks/tool-arguments.ts
1346
1416
  function decodeToken(token) {
1347
1417
  return token.replace(/~1/g, "/").replace(/~0/g, "~");
@@ -1387,7 +1457,7 @@ function jsonType(value) {
1387
1457
  return typeof value;
1388
1458
  }
1389
1459
  function valuesEqual(left, right) {
1390
- return JSON.stringify(left) === JSON.stringify(right);
1460
+ return canonicalStructuredEqual(left, right).equal === true;
1391
1461
  }
1392
1462
  function extractToolArgumentPayload(event) {
1393
1463
  const attrs2 = event.attributes ?? {};
@@ -1860,11 +1930,9 @@ function argumentDigestOf(event) {
1860
1930
  function argumentFingerprint(event) {
1861
1931
  const payload = extractToolArgumentPayload(event);
1862
1932
  if (payload.present) {
1863
- try {
1864
- return { kind: "structured", value: JSON.stringify(payload.value) };
1865
- } catch {
1866
- return { kind: "missing" };
1867
- }
1933
+ const encoded = encodeCanonicalStructured(payload.value);
1934
+ if (!encoded.ok) return { kind: "missing" };
1935
+ return { kind: "structured", value: encoded.value };
1868
1936
  }
1869
1937
  const digest = argumentDigestOf(event);
1870
1938
  if (digest) return { kind: "digest", value: digest };
@@ -1959,19 +2027,84 @@ function llmReferencesTool(llm, toolEvent, requireExplicit) {
1959
2027
  if (toolCallId && refs.has(toolCallId)) return true;
1960
2028
  return false;
1961
2029
  }
2030
+ function attemptIdOf2(event) {
2031
+ const value = workflowFor2(event).attemptId;
2032
+ return typeof value === "string" && value.trim() !== "" ? value.trim() : void 0;
2033
+ }
2034
+ function hasDuplicateAttemptIds2(members) {
2035
+ const seen = /* @__PURE__ */ new Set();
2036
+ for (const event of members) {
2037
+ const id = attemptIdOf2(event);
2038
+ if (!id) continue;
2039
+ if (seen.has(id)) return true;
2040
+ seen.add(id);
2041
+ }
2042
+ return false;
2043
+ }
2044
+ function findRetryTarget(members, retryOf) {
2045
+ return members.find(
2046
+ (candidate) => candidate.eventId === retryOf || attemptIdOf2(candidate) === retryOf || workflowFor2(candidate).operationId === retryOf
2047
+ );
2048
+ }
1962
2049
  function groupToolAttempts(events, toolName2) {
2050
+ const members = events.filter(
2051
+ (event) => event.kind === "TOOL" && resolveCanonicalToolName(event) === toolName2
2052
+ );
2053
+ const parent = /* @__PURE__ */ new Map();
2054
+ const ensure = (id) => {
2055
+ if (!parent.has(id)) parent.set(id, id);
2056
+ return id;
2057
+ };
2058
+ const find = (id) => {
2059
+ ensure(id);
2060
+ let cur = id;
2061
+ while (parent.get(cur) !== cur) {
2062
+ cur = parent.get(cur);
2063
+ }
2064
+ let walk = id;
2065
+ while (parent.get(walk) !== cur) {
2066
+ const next = parent.get(walk);
2067
+ parent.set(walk, cur);
2068
+ walk = next;
2069
+ }
2070
+ return cur;
2071
+ };
2072
+ const union = (a, b) => {
2073
+ const ra = find(a);
2074
+ const rb = find(b);
2075
+ if (ra !== rb) parent.set(ra, rb);
2076
+ };
2077
+ const nodeId = (event) => {
2078
+ const operationId = workflowFor2(event).operationId;
2079
+ if (typeof operationId === "string" && operationId.trim() !== "") {
2080
+ return `op:${operationId.trim()}`;
2081
+ }
2082
+ return `event:${event.eventId}`;
2083
+ };
2084
+ for (const event of members) {
2085
+ ensure(nodeId(event));
2086
+ }
2087
+ for (const event of members) {
2088
+ const retryOf = workflowFor2(event).retryOf;
2089
+ if (typeof retryOf !== "string" || retryOf.trim() === "") continue;
2090
+ const target = findRetryTarget(members, retryOf.trim());
2091
+ if (target) {
2092
+ union(nodeId(event), nodeId(target));
2093
+ }
2094
+ }
1963
2095
  const groups = /* @__PURE__ */ new Map();
1964
- for (const event of events) {
1965
- if (event.kind !== "TOOL") continue;
1966
- if (resolveCanonicalToolName(event) !== toolName2) continue;
1967
- const workflow = workflowFor2(event);
1968
- const key = workflow.operationId ?? `__tool__:${toolName2}`;
2096
+ for (const event of members) {
2097
+ const key = find(nodeId(event));
1969
2098
  const list = groups.get(key) ?? [];
1970
2099
  list.push(event);
1971
2100
  groups.set(key, list);
1972
2101
  }
1973
2102
  return groups;
1974
2103
  }
2104
+ function latestAttempt(ordered) {
2105
+ if (ordered.length === 0) return void 0;
2106
+ return ordered[ordered.length - 1];
2107
+ }
1975
2108
  function evaluateRecoveryOperations(events, operations) {
1976
2109
  const findings = [];
1977
2110
  const llmEvents = events.filter((event) => event.kind === "LLM");
@@ -1994,6 +2127,17 @@ function evaluateRecoveryOperations(events, operations) {
1994
2127
  }
1995
2128
  for (const [operationKey, members] of groups) {
1996
2129
  const ordered = sortByTime2(members);
2130
+ if (hasDuplicateAttemptIds2(members)) {
2131
+ findings.push(
2132
+ fail3(
2133
+ "contract.retry.operations.duplicate-attempt-id",
2134
+ `Tool ${operation.tool} operation ${operationKey} has duplicate attemptId values.`,
2135
+ members.slice(0, 4).map(eventEvidence2),
2136
+ "unique attemptId",
2137
+ "duplicate"
2138
+ )
2139
+ );
2140
+ }
1997
2141
  if (operation.maxAttempts !== void 0) {
1998
2142
  const count = countOperationAttempts(members);
1999
2143
  if (count > operation.maxAttempts) {
@@ -2030,8 +2174,21 @@ function evaluateRecoveryOperations(events, operations) {
2030
2174
  let sawEarlierError = false;
2031
2175
  let sawLaterOkAfterError = false;
2032
2176
  let lastOk;
2177
+ let identityUnavailable = false;
2033
2178
  for (const event of ordered) {
2034
2179
  const classification = classifyRetryAttempt(event, prior, members);
2180
+ if (classification.kind === "unknown") {
2181
+ identityUnavailable = true;
2182
+ findings.push(
2183
+ fail3(
2184
+ "contract.retry.operations.attempt-identity",
2185
+ `Tool ${operation.tool} operation ${operationKey} has ambiguous attempt identity (${classification.reason}).`,
2186
+ [eventEvidence2(event)],
2187
+ "explicit operationId/attemptId/retryOf chronology",
2188
+ { code: "AI_CHECK_RECOVERY_ATTEMPT_IDENTITY_UNAVAILABLE", reason: classification.reason }
2189
+ )
2190
+ );
2191
+ }
2035
2192
  const isRetry = classification.kind === "retry";
2036
2193
  if (isRetry && operation.requireFailureBeforeRetry) {
2037
2194
  const earlierFailure = prior.some(
@@ -2066,6 +2223,16 @@ function evaluateRecoveryOperations(events, operations) {
2066
2223
  )
2067
2224
  );
2068
2225
  }
2226
+ } else {
2227
+ findings.push(
2228
+ fail3(
2229
+ "contract.retry.operations.retryable-error",
2230
+ `Retry of tool ${operation.tool} has no prior error code evidence.`,
2231
+ [eventEvidence2(event)],
2232
+ [...allowed],
2233
+ null
2234
+ )
2235
+ );
2069
2236
  }
2070
2237
  }
2071
2238
  if (isRetry && (operation.requireSameArguments === true || operation.requireSameArguments === "structured-or-digest")) {
@@ -2083,6 +2250,16 @@ function evaluateRecoveryOperations(events, operations) {
2083
2250
  )
2084
2251
  );
2085
2252
  }
2253
+ } else {
2254
+ findings.push(
2255
+ fail3(
2256
+ "contract.retry.operations.same-arguments",
2257
+ "Structured or digest argument evidence unavailable for same-arguments check.",
2258
+ [eventEvidence2(event)],
2259
+ "matching structured args or digests",
2260
+ { code: "AI_CHECK_RECOVERY_ARGUMENT_EVIDENCE_UNAVAILABLE" }
2261
+ )
2262
+ );
2086
2263
  }
2087
2264
  }
2088
2265
  if (event.status === "error") {
@@ -2095,23 +2272,23 @@ function evaluateRecoveryOperations(events, operations) {
2095
2272
  }
2096
2273
  prior.push(event);
2097
2274
  }
2275
+ const latest = latestAttempt(ordered);
2098
2276
  if (operation.requireTerminalSuccess) {
2099
- const hasOk = ordered.some((event) => event.status === "ok");
2100
- if (!hasOk) {
2277
+ if (!latest || latest.status !== "ok") {
2101
2278
  findings.push(
2102
2279
  fail3(
2103
2280
  "contract.retry.operations.terminal-success",
2104
- `Tool ${operation.tool} operation ${operationKey} has no terminal ok success.`,
2281
+ `Tool ${operation.tool} operation ${operationKey} does not terminate with ok on the latest attempt.`,
2105
2282
  ordered.slice(0, 4).map(eventEvidence2),
2106
- "ok",
2107
- ordered.map((event) => event.status)
2283
+ "latest attempt ok",
2284
+ latest?.status ?? "missing"
2108
2285
  )
2109
2286
  );
2110
2287
  }
2111
2288
  }
2112
2289
  if (operation.requireRecoveredFailureVisible) {
2113
- const hasOk = ordered.some((event) => event.status === "ok");
2114
- if (ordered.length > 1 && hasOk && !sawLaterOkAfterError) {
2290
+ const latestOk = latest?.status === "ok";
2291
+ if (ordered.length > 1 && latestOk && !sawLaterOkAfterError) {
2115
2292
  findings.push(
2116
2293
  fail3(
2117
2294
  "contract.retry.operations.recovered-failure-visible",
@@ -2124,21 +2301,36 @@ function evaluateRecoveryOperations(events, operations) {
2124
2301
  }
2125
2302
  }
2126
2303
  const dependency = operation.successfulResultDependency;
2127
- if (dependency?.consumerKind === "LLM" && lastOk) {
2128
- const requireExplicit = dependency.requireExplicitReference === true;
2129
- const referenced = llmEvents.some(
2130
- (llmEvent) => llmReferencesTool(llmEvent, lastOk, requireExplicit)
2131
- );
2132
- if (!referenced) {
2133
- findings.push(
2134
- fail3(
2135
- "contract.retry.operations.successful-result-dependency",
2136
- requireExplicit ? `Successful ${operation.tool} result is not explicitly referenced by a later LLM event.` : `Successful ${operation.tool} result has no later LLM consumer.`,
2137
- [eventEvidence2(lastOk)],
2138
- "LLM reference to successful tool event",
2139
- { code: "AI_CHECK_RECOVERY_RESULT_DEPENDENCY_MISSING" }
2140
- )
2141
- );
2304
+ if (dependency?.consumerKind === "LLM") {
2305
+ const successForDependency = latest?.status === "ok" ? latest : identityUnavailable ? void 0 : lastOk;
2306
+ if (successForDependency) {
2307
+ if (sideEffectClass === "write" && isUnevaluableWriteCompletion(successForDependency) && !hasIdempotencyEvidence2(successForDependency)) {
2308
+ findings.push(
2309
+ fail3(
2310
+ "contract.retry.operations.successful-result-dependency",
2311
+ `Successful ${operation.tool} result dependency is unevaluable because write completion evidence is unavailable.`,
2312
+ [eventEvidence2(successForDependency)],
2313
+ "LLM reference to successful tool event",
2314
+ { code: "AI_CHECK_RECOVERY_WRITE_COMPLETION_UNAVAILABLE" }
2315
+ )
2316
+ );
2317
+ } else {
2318
+ const requireExplicit = dependency.requireExplicitReference === true;
2319
+ const referenced = llmEvents.some(
2320
+ (llmEvent) => llmReferencesTool(llmEvent, successForDependency, requireExplicit)
2321
+ );
2322
+ if (!referenced) {
2323
+ findings.push(
2324
+ fail3(
2325
+ "contract.retry.operations.successful-result-dependency",
2326
+ requireExplicit ? `Successful ${operation.tool} result is not explicitly referenced by a later LLM event.` : `Successful ${operation.tool} result has no later LLM consumer.`,
2327
+ [eventEvidence2(successForDependency)],
2328
+ "LLM reference to successful tool event",
2329
+ { code: "AI_CHECK_RECOVERY_RESULT_DEPENDENCY_MISSING" }
2330
+ )
2331
+ );
2332
+ }
2333
+ }
2142
2334
  }
2143
2335
  }
2144
2336
  }
@@ -3212,6 +3404,9 @@ var SAFE_USAGE_LEAF_KEYS = /* @__PURE__ */ new Set([
3212
3404
  "output",
3213
3405
  "total",
3214
3406
  "cached",
3407
+ "cachewrite",
3408
+ "cache_write",
3409
+ "reasoning",
3215
3410
  "input_tokens",
3216
3411
  "inputtokens",
3217
3412
  "output_tokens",
@@ -3221,7 +3416,13 @@ var SAFE_USAGE_LEAF_KEYS = /* @__PURE__ */ new Set([
3221
3416
  "prompt_tokens",
3222
3417
  "prompttokens",
3223
3418
  "completion_tokens",
3224
- "completiontokens"
3419
+ "completiontokens",
3420
+ "cache_read",
3421
+ "cacheread",
3422
+ "cache_creation",
3423
+ "cachecreation",
3424
+ "reasoning_tokens",
3425
+ "reasoningtokens"
3225
3426
  ]);
3226
3427
  var DEFAULT_SECRET_PATTERNS = [
3227
3428
  { id: "bearer-token", pattern: /Bearer\s+[A-Za-z0-9._~+/-]{12,}=*/ },
@@ -5120,5 +5321,5 @@ function runTraceChecks(input, options = {}) {
5120
5321
  }
5121
5322
 
5122
5323
  export { buildTraceFacts, createBaselineRegressionRule, createDecisionRule, createGuardrailRule, createLlmUsageRule, createMaxStepDurationRule, createObservedOutcomeRule, createRequireCompletedRule, createRetrievalRule, createRunDepthRule, createRunDurationRule, createRunEventCountRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStructureCycleRule, createStructureIncompleteRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolFailureRule, createToolOrderingRule, createToolUsageRule, defineTraceContract, deriveFailureFacts, deriveRelationshipFacts, evaluateToolArgumentValue, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, extractSessionWorkflowMetadata, extractToolArgumentPayload, lintTraceContract, projectLogicalEvents, resolveCanonicalToolName, resolveJsonPointer, resolveTraceContractScope, runTraceChecks, sessionKeyForRun, summarizeSemanticParity, workflowMetadataForRun };
5123
- //# sourceMappingURL=chunk-ME4WXYY3.mjs.map
5124
- //# sourceMappingURL=chunk-ME4WXYY3.mjs.map
5324
+ //# sourceMappingURL=chunk-GPGBKN7W.mjs.map
5325
+ //# sourceMappingURL=chunk-GPGBKN7W.mjs.map