agent-inspect 6.19.0 → 6.20.0

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 (57) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +3 -1
  3. package/SECURITY.md +2 -0
  4. package/docs/ARCHITECTURE.md +28 -16
  5. package/docs/KNOWN-ISSUES.md +3 -3
  6. package/docs/LIMITATIONS.md +5 -4
  7. package/docs/PERFORMANCE.md +1 -1
  8. package/docs/SUPPORT-LEVELS.md +2 -1
  9. package/docs/TRACE-CONTRACTS.md +64 -52
  10. package/package.json +3 -2
  11. package/packages/cli/dist/{chunk-R7Y5SGH5.mjs → chunk-QPRJUVLH.mjs} +57 -17
  12. package/packages/cli/dist/chunk-QPRJUVLH.mjs.map +1 -0
  13. package/packages/cli/dist/index.cjs +69 -18
  14. package/packages/cli/dist/index.cjs.map +1 -1
  15. package/packages/cli/dist/index.mjs +9 -6
  16. package/packages/cli/dist/index.mjs.map +1 -1
  17. package/packages/cli/dist/{src-T4EZERCX.mjs → src-6W5ZR3I7.mjs} +3 -3
  18. package/packages/cli/dist/{src-T4EZERCX.mjs.map → src-6W5ZR3I7.mjs.map} +1 -1
  19. package/packages/core/dist/advanced.cjs +118 -18
  20. package/packages/core/dist/advanced.cjs.map +1 -1
  21. package/packages/core/dist/advanced.d.cts +2 -2
  22. package/packages/core/dist/advanced.d.ts +2 -2
  23. package/packages/core/dist/advanced.mjs +8 -8
  24. package/packages/core/dist/checks.cjs +443 -9
  25. package/packages/core/dist/checks.cjs.map +1 -1
  26. package/packages/core/dist/checks.d.cts +78 -16
  27. package/packages/core/dist/checks.d.ts +78 -16
  28. package/packages/core/dist/checks.mjs +3 -3
  29. package/packages/core/dist/{chunk-VFO76UH3.mjs → chunk-3XS5O4JI.mjs} +3 -3
  30. package/packages/core/dist/{chunk-VFO76UH3.mjs.map → chunk-3XS5O4JI.mjs.map} +1 -1
  31. package/packages/core/dist/{chunk-ZWA5RWMV.mjs → chunk-5YFJJFXU.mjs} +4 -4
  32. package/packages/core/dist/{chunk-ZWA5RWMV.mjs.map → chunk-5YFJJFXU.mjs.map} +1 -1
  33. package/packages/core/dist/{chunk-NABMW5DX.mjs → chunk-G47KQB42.mjs} +445 -13
  34. package/packages/core/dist/chunk-G47KQB42.mjs.map +1 -0
  35. package/packages/core/dist/{chunk-SGL4JGCD.mjs → chunk-JBNRJLIV.mjs} +58 -18
  36. package/packages/core/dist/chunk-JBNRJLIV.mjs.map +1 -0
  37. package/packages/core/dist/{chunk-ULCGIRTC.mjs → chunk-U25RHRSU.mjs} +65 -5
  38. package/packages/core/dist/chunk-U25RHRSU.mjs.map +1 -0
  39. package/packages/core/dist/{context-Ca5yK8Cs.d.cts → context-C5ye_xcS.d.cts} +0 -4
  40. package/packages/core/dist/{context-D6cS4XIL.d.ts → context-CNsNSgE2.d.ts} +0 -4
  41. package/packages/core/dist/exporters.cjs +55 -15
  42. package/packages/core/dist/exporters.cjs.map +1 -1
  43. package/packages/core/dist/exporters.mjs +3 -3
  44. package/packages/core/dist/{index-DKwuGSe-.d.ts → index-Bg9ZdsdS.d.ts} +10 -0
  45. package/packages/core/dist/{index-DCR816Yt.d.cts → index-rVpX5PPh.d.cts} +10 -0
  46. package/packages/core/dist/index.cjs +63 -3
  47. package/packages/core/dist/index.cjs.map +1 -1
  48. package/packages/core/dist/index.d.cts +1 -1
  49. package/packages/core/dist/index.d.ts +1 -1
  50. package/packages/core/dist/index.mjs +4 -4
  51. package/packages/core/dist/writers.cjs +33 -2
  52. package/packages/core/dist/writers.cjs.map +1 -1
  53. package/packages/core/dist/writers.mjs +1 -1
  54. package/packages/cli/dist/chunk-R7Y5SGH5.mjs.map +0 -1
  55. package/packages/core/dist/chunk-NABMW5DX.mjs.map +0 -1
  56. package/packages/core/dist/chunk-SGL4JGCD.mjs.map +0 -1
  57. package/packages/core/dist/chunk-ULCGIRTC.mjs.map +0 -1
@@ -164,6 +164,12 @@ var init_redactor = __esm({
164
164
  }
165
165
  });
166
166
 
167
+ // packages/core/src/safety/credential-value-patterns.ts
168
+ var init_credential_value_patterns = __esm({
169
+ "packages/core/src/safety/credential-value-patterns.ts"() {
170
+ }
171
+ });
172
+
167
173
  // packages/core/src/redaction-profiles.ts
168
174
  function resolveRedactionProfile(profile = "local") {
169
175
  switch (profile) {
@@ -1110,6 +1116,7 @@ var init_storage = __esm({
1110
1116
  var init_trace_event_safety = __esm({
1111
1117
  "packages/core/src/trace-event-safety.ts"() {
1112
1118
  init_redactor();
1119
+ init_credential_value_patterns();
1113
1120
  init_redaction_profiles();
1114
1121
  init_storage();
1115
1122
  init_persisted_inspect_event();
@@ -2041,6 +2048,58 @@ async function extractMetadata(filePath, _quickScan) {
2041
2048
  function isNonNegativeFiniteNumber(value) {
2042
2049
  return typeof value === "number" && Number.isFinite(value) && value >= 0;
2043
2050
  }
2051
+ function resolveParentStepId(step, steps) {
2052
+ const parentId = step.parentId;
2053
+ if (typeof parentId !== "string" || parentId.trim() === "") {
2054
+ return void 0;
2055
+ }
2056
+ return steps.has(parentId) ? parentId : void 0;
2057
+ }
2058
+ function computeStepDepth(stepId, steps, depthCache) {
2059
+ const cached2 = depthCache.get(stepId);
2060
+ if (cached2 !== void 0) return cached2;
2061
+ const ancestry = [];
2062
+ const ancestryIndexes = /* @__PURE__ */ new Map();
2063
+ let currentStepId = stepId;
2064
+ let resolvedDepth;
2065
+ while (resolvedDepth === void 0) {
2066
+ const cachedDepth = depthCache.get(currentStepId);
2067
+ if (cachedDepth !== void 0) {
2068
+ resolvedDepth = cachedDepth;
2069
+ continue;
2070
+ }
2071
+ const cycleStart = ancestryIndexes.get(currentStepId);
2072
+ if (cycleStart !== void 0) {
2073
+ const cycleStepIds = ancestry.splice(cycleStart);
2074
+ for (const cycleStepId of cycleStepIds) {
2075
+ depthCache.set(cycleStepId, ROOT_STEP_DEPTH);
2076
+ }
2077
+ resolvedDepth = ROOT_STEP_DEPTH;
2078
+ continue;
2079
+ }
2080
+ const currentStep = steps.get(currentStepId);
2081
+ if (!currentStep) {
2082
+ resolvedDepth = ROOT_STEP_DEPTH;
2083
+ continue;
2084
+ }
2085
+ ancestryIndexes.set(currentStepId, ancestry.length);
2086
+ ancestry.push(currentStepId);
2087
+ const parentStepId = resolveParentStepId(currentStep, steps);
2088
+ if (parentStepId === void 0) {
2089
+ ancestry.pop();
2090
+ depthCache.set(currentStepId, ROOT_STEP_DEPTH);
2091
+ resolvedDepth = ROOT_STEP_DEPTH;
2092
+ continue;
2093
+ }
2094
+ currentStepId = parentStepId;
2095
+ }
2096
+ ancestry.reverse();
2097
+ for (const ancestorStepId of ancestry) {
2098
+ resolvedDepth = Math.min(MAX_RUN_SUMMARY_DEPTH, resolvedDepth + 1);
2099
+ depthCache.set(ancestorStepId, resolvedDepth);
2100
+ }
2101
+ return depthCache.get(stepId) ?? ROOT_STEP_DEPTH;
2102
+ }
2044
2103
  function buildRunSummary(events) {
2045
2104
  const started = events.find(
2046
2105
  (e) => e.event === "run_started"
@@ -2094,27 +2153,13 @@ function buildRunSummary(events) {
2094
2153
  let stepsWithKnownTotal = 0;
2095
2154
  let hasCachedTokens = false;
2096
2155
  const depthCache = /* @__PURE__ */ new Map();
2097
- const computeDepth = (stepId) => {
2098
- const cached2 = depthCache.get(stepId);
2099
- if (cached2 !== void 0) return cached2;
2100
- const node = steps.get(stepId);
2101
- if (!node) return 0;
2102
- const parent = node.parentId;
2103
- if (typeof parent !== "string" || parent.trim() === "" || !steps.has(parent)) {
2104
- depthCache.set(stepId, 0);
2105
- return 0;
2106
- }
2107
- const d = Math.min(1e3, computeDepth(parent) + 1);
2108
- depthCache.set(stepId, d);
2109
- return d;
2110
- };
2111
2156
  for (const [id, s] of steps.entries()) {
2112
2157
  totalSteps += 1;
2113
2158
  if (s.type === "llm") llmSteps += 1;
2114
2159
  else if (s.type === "tool") toolSteps2 += 1;
2115
2160
  else logicSteps += 1;
2116
2161
  if (s.status === "error") errorSteps += 1;
2117
- const depth = computeDepth(id);
2162
+ const depth = computeStepDepth(id, steps, depthCache);
2118
2163
  if (depth > maxDepth) maxDepth = depth;
2119
2164
  if (typeof s.durationMs === "number" && Number.isFinite(s.durationMs)) {
2120
2165
  if (!longestStep || s.durationMs > longestStep.durationMs) {
@@ -2161,9 +2206,12 @@ function buildRunSummary(events) {
2161
2206
  };
2162
2207
  return summary;
2163
2208
  }
2209
+ var ROOT_STEP_DEPTH, MAX_RUN_SUMMARY_DEPTH;
2164
2210
  var init_trace_metadata = __esm({
2165
2211
  "packages/core/src/trace-metadata.ts"() {
2166
2212
  init_read_trace();
2213
+ ROOT_STEP_DEPTH = 0;
2214
+ MAX_RUN_SUMMARY_DEPTH = 1e3;
2167
2215
  }
2168
2216
  });
2169
2217
 
@@ -12923,7 +12971,7 @@ var init_src = __esm({
12923
12971
  });
12924
12972
 
12925
12973
  // package.json
12926
- var version = "6.19.0";
12974
+ var version = "6.20.0";
12927
12975
 
12928
12976
  // packages/cli/src/list.ts
12929
12977
  init_advanced();
@@ -24991,8 +25039,11 @@ async function readSnapshot(indexPath2) {
24991
25039
  try {
24992
25040
  const raw = await promises.readFile(indexPath2, "utf8");
24993
25041
  return JSON.parse(raw);
24994
- } catch {
24995
- return void 0;
25042
+ } catch (error) {
25043
+ if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT") {
25044
+ return void 0;
25045
+ }
25046
+ throw error;
24996
25047
  }
24997
25048
  }
24998
25049
  async function indexBuildCommand(options = {}) {