agent-inspect 4.3.0 → 4.4.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 (97) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/docs/API.md +3 -0
  3. package/docs/CLI.md +3 -0
  4. package/docs/SCHEMA.md +27 -1
  5. package/package.json +1 -1
  6. package/packages/cli/dist/{chunk-BS5LSKZ3.mjs → chunk-ORHDQUT6.mjs} +198 -7
  7. package/packages/cli/dist/chunk-ORHDQUT6.mjs.map +1 -0
  8. package/packages/cli/dist/index.cjs +409 -17
  9. package/packages/cli/dist/index.cjs.map +1 -1
  10. package/packages/cli/dist/index.mjs +176 -10
  11. package/packages/cli/dist/index.mjs.map +1 -1
  12. package/packages/cli/dist/{src-YFMPWEIS.mjs → src-FJOHPC4X.mjs} +3 -3
  13. package/packages/cli/dist/{src-YFMPWEIS.mjs.map → src-FJOHPC4X.mjs.map} +1 -1
  14. package/packages/core/dist/advanced.cjs +201 -9
  15. package/packages/core/dist/advanced.cjs.map +1 -1
  16. package/packages/core/dist/advanced.d.cts +12 -8
  17. package/packages/core/dist/advanced.d.ts +12 -8
  18. package/packages/core/dist/advanced.mjs +30 -13
  19. package/packages/core/dist/advanced.mjs.map +1 -1
  20. package/packages/core/dist/checks.cjs +117 -18
  21. package/packages/core/dist/checks.cjs.map +1 -1
  22. package/packages/core/dist/checks.d.cts +11 -3
  23. package/packages/core/dist/checks.d.ts +11 -3
  24. package/packages/core/dist/checks.mjs +42 -1
  25. package/packages/core/dist/checks.mjs.map +1 -1
  26. package/packages/core/dist/{chunk-2ZXEMWGK.mjs → chunk-3USJVBLA.mjs} +3 -3
  27. package/packages/core/dist/{chunk-2ZXEMWGK.mjs.map → chunk-3USJVBLA.mjs.map} +1 -1
  28. package/packages/core/dist/{chunk-HY7H3CQM.mjs → chunk-CAWPF22J.mjs} +4 -3
  29. package/packages/core/dist/chunk-CAWPF22J.mjs.map +1 -0
  30. package/packages/core/dist/{chunk-XUNJMAPD.mjs → chunk-KNYL56KZ.mjs} +38 -3
  31. package/packages/core/dist/chunk-KNYL56KZ.mjs.map +1 -0
  32. package/packages/core/dist/{chunk-IZBJAZGF.mjs → chunk-P366CCL2.mjs} +34 -3
  33. package/packages/core/dist/chunk-P366CCL2.mjs.map +1 -0
  34. package/packages/core/dist/{chunk-4JVGFNQH.mjs → chunk-ULCGIRTC.mjs} +95 -8
  35. package/packages/core/dist/chunk-ULCGIRTC.mjs.map +1 -0
  36. package/packages/core/dist/chunk-VFO76UH3.mjs +228 -0
  37. package/packages/core/dist/chunk-VFO76UH3.mjs.map +1 -0
  38. package/packages/core/dist/{chunk-NQZPZ2FN.mjs → chunk-WRE4CNPF.mjs} +6 -3
  39. package/packages/core/dist/chunk-WRE4CNPF.mjs.map +1 -0
  40. package/packages/core/dist/{chunk-A4V2H3YU.mjs → chunk-ZWA5RWMV.mjs} +40 -4
  41. package/packages/core/dist/chunk-ZWA5RWMV.mjs.map +1 -0
  42. package/packages/core/dist/{context-DjY-jvQk.d.cts → context-BbfkMYjz.d.cts} +5 -3
  43. package/packages/core/dist/{context-BDZmi53V.d.ts → context-Cp8NRbBX.d.ts} +5 -3
  44. package/packages/core/dist/diff.cjs.map +1 -1
  45. package/packages/core/dist/diff.d.cts +3 -3
  46. package/packages/core/dist/diff.d.ts +3 -3
  47. package/packages/core/dist/diff.mjs +1 -1
  48. package/packages/core/dist/exporters.cjs +137 -1
  49. package/packages/core/dist/exporters.cjs.map +1 -1
  50. package/packages/core/dist/exporters.d.cts +6 -3
  51. package/packages/core/dist/exporters.d.ts +6 -3
  52. package/packages/core/dist/exporters.mjs +71 -6
  53. package/packages/core/dist/exporters.mjs.map +1 -1
  54. package/packages/core/dist/index.cjs +181 -6
  55. package/packages/core/dist/index.cjs.map +1 -1
  56. package/packages/core/dist/index.d.cts +14 -7
  57. package/packages/core/dist/index.d.ts +14 -7
  58. package/packages/core/dist/index.mjs +51 -7
  59. package/packages/core/dist/index.mjs.map +1 -1
  60. package/packages/core/dist/{inspect-event-CYAV7Hxm.d.cts → inspect-event-IqwOHbGo.d.cts} +1 -1
  61. package/packages/core/dist/{inspect-event-CYAV7Hxm.d.ts → inspect-event-IqwOHbGo.d.ts} +1 -1
  62. package/packages/core/dist/{log-config-BNQ9UTmP.d.cts → log-config-CW8w5YQ9.d.cts} +1 -1
  63. package/packages/core/dist/{log-config-D3Yp1SZN.d.ts → log-config-SRA4xTp8.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-BLvb0jSX.d.ts → persisted-inspect-event-DruwqARZ.d.ts} +1 -1
  67. package/packages/core/dist/{persisted-inspect-event-D5SjBz9b.d.cts → persisted-inspect-event-Gd-W8vB7.d.cts} +1 -1
  68. package/packages/core/dist/persisted.cjs +67 -1
  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 +72 -3
  74. package/packages/core/dist/readers.cjs.map +1 -1
  75. package/packages/core/dist/readers.d.cts +2 -2
  76. package/packages/core/dist/readers.d.ts +2 -2
  77. package/packages/core/dist/readers.mjs +5 -5
  78. package/packages/core/dist/readers.mjs.map +1 -1
  79. package/packages/core/dist/{types-CQun9LW6.d.ts → types-B1X87dUW.d.cts} +16 -2
  80. package/packages/core/dist/{types-C-llnPH0.d.cts → types-BVkjSd0q.d.ts} +16 -2
  81. package/packages/core/dist/types-CvsKGweN.d.cts +12 -0
  82. package/packages/core/dist/types-CvsKGweN.d.ts +12 -0
  83. package/packages/core/dist/writers.cjs +2 -1
  84. package/packages/core/dist/writers.cjs.map +1 -1
  85. package/packages/core/dist/writers.d.cts +2 -2
  86. package/packages/core/dist/writers.d.ts +2 -2
  87. package/packages/core/dist/writers.mjs +3 -4
  88. package/packages/core/dist/writers.mjs.map +1 -1
  89. package/packages/cli/dist/chunk-BS5LSKZ3.mjs.map +0 -1
  90. package/packages/core/dist/chunk-4JVGFNQH.mjs.map +0 -1
  91. package/packages/core/dist/chunk-A4V2H3YU.mjs.map +0 -1
  92. package/packages/core/dist/chunk-EDTQHZPM.mjs +0 -88
  93. package/packages/core/dist/chunk-EDTQHZPM.mjs.map +0 -1
  94. package/packages/core/dist/chunk-HY7H3CQM.mjs.map +0 -1
  95. package/packages/core/dist/chunk-IZBJAZGF.mjs.map +0 -1
  96. package/packages/core/dist/chunk-NQZPZ2FN.mjs.map +0 -1
  97. package/packages/core/dist/chunk-XUNJMAPD.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
- import { b as InspectRunTree, c as InspectNode } from './inspect-event-CYAV7Hxm.cjs';
2
- import { R as RedactionProfile, h as TraceEvent } from './types-C-llnPH0.cjs';
3
- import './log-config-BNQ9UTmP.cjs';
1
+ import { b as InspectRunTree, c as InspectNode } from './inspect-event-IqwOHbGo.cjs';
2
+ import { R as RedactionProfile, h as TraceEvent } from './types-B1X87dUW.cjs';
3
+ import './log-config-CW8w5YQ9.cjs';
4
4
 
5
5
  /**
6
6
  * v0.7 local export formats. No sinks — string output only.
@@ -112,6 +112,7 @@ declare function exportRunTree(tree: InspectRunTree, options: ExportOptions): Ex
112
112
  declare function validateExport(result: ExportResult): ExportValidationResult;
113
113
 
114
114
  type ReportFormat = "markdown" | "html";
115
+ type ReportSection = "all" | "observations" | "what" | "timeline" | "tree";
115
116
  interface ReportOptions {
116
117
  format: ReportFormat;
117
118
  includeAttributes?: boolean;
@@ -119,6 +120,8 @@ interface ReportOptions {
119
120
  redactionProfile?: RedactionProfile;
120
121
  /** Include correlation ids in the what section (default true). */
121
122
  correlation?: boolean;
123
+ /** Limit output to one section (`observations` shows observed outcomes only). */
124
+ section?: ReportSection;
122
125
  }
123
126
  interface ReportResult {
124
127
  format: ReportFormat;
@@ -1,6 +1,6 @@
1
- import { b as InspectRunTree, c as InspectNode } from './inspect-event-CYAV7Hxm.js';
2
- import { R as RedactionProfile, h as TraceEvent } from './types-CQun9LW6.js';
3
- import './log-config-D3Yp1SZN.js';
1
+ import { b as InspectRunTree, c as InspectNode } from './inspect-event-IqwOHbGo.js';
2
+ import { R as RedactionProfile, h as TraceEvent } from './types-BVkjSd0q.js';
3
+ import './log-config-SRA4xTp8.js';
4
4
 
5
5
  /**
6
6
  * v0.7 local export formats. No sinks — string output only.
@@ -112,6 +112,7 @@ declare function exportRunTree(tree: InspectRunTree, options: ExportOptions): Ex
112
112
  declare function validateExport(result: ExportResult): ExportValidationResult;
113
113
 
114
114
  type ReportFormat = "markdown" | "html";
115
+ type ReportSection = "all" | "observations" | "what" | "timeline" | "tree";
115
116
  interface ReportOptions {
116
117
  format: ReportFormat;
117
118
  includeAttributes?: boolean;
@@ -119,6 +120,8 @@ interface ReportOptions {
119
120
  redactionProfile?: RedactionProfile;
120
121
  /** Include correlation ids in the what section (default true). */
121
122
  correlation?: boolean;
123
+ /** Limit output to one section (`observations` shows observed outcomes only). */
124
+ section?: ReportSection;
122
125
  }
123
126
  interface ReportResult {
124
127
  format: ReportFormat;
@@ -1,10 +1,11 @@
1
- import { buildRunWhatSummary, renderRunWhat, renderTimeline, buildRunTimeline } from './chunk-2ZXEMWGK.mjs';
2
- import { escapeHtml, flattenTree, safeString, compactAttributes, stableJson, escapeMarkdown, zeroKinds } from './chunk-HY7H3CQM.mjs';
3
- export { compactAttributes, escapeHtml, escapeMarkdown, flattenTree, safeString, stableJson, summarizeTree } from './chunk-HY7H3CQM.mjs';
4
- import { resolveRedactionProfile, applyProfileMetadataCaps, truncateStringForProfile } from './chunk-EDTQHZPM.mjs';
1
+ import { buildRunWhatSummary, renderRunWhat, renderTimeline, buildRunTimeline } from './chunk-3USJVBLA.mjs';
2
+ import { summarizeObservedOutcomes, extractOutcomesFromTraceEvents, renderObservedOutcomesMarkdown, renderObservedOutcomesHtml } from './chunk-VFO76UH3.mjs';
3
+ import { escapeHtml, flattenTree, safeString, compactAttributes, stableJson, escapeMarkdown, zeroKinds } from './chunk-CAWPF22J.mjs';
4
+ export { compactAttributes, escapeHtml, escapeMarkdown, flattenTree, safeString, stableJson, summarizeTree } from './chunk-CAWPF22J.mjs';
5
+ import { resolveRedactionProfile, applyProfileMetadataCaps, truncateStringForProfile } from './chunk-ULCGIRTC.mjs';
5
6
  import { Redactor } from './chunk-VU6O5QAH.mjs';
6
- import './chunk-NQZPZ2FN.mjs';
7
- import './chunk-IZBJAZGF.mjs';
7
+ import './chunk-WRE4CNPF.mjs';
8
+ import './chunk-P366CCL2.mjs';
8
9
  import './chunk-7TGZLWEE.mjs';
9
10
  import crypto from 'crypto';
10
11
 
@@ -187,6 +188,40 @@ function redactTraceEventsForReport(events, options) {
187
188
  )
188
189
  } : {}
189
190
  };
191
+ case "outcome_observed": {
192
+ const actualAttrs = event.actual !== void 0 ? redactEventAttributes(
193
+ { value: event.actual },
194
+ redactor,
195
+ maxMetadataValueLength,
196
+ maxPreviewLength
197
+ ) : void 0;
198
+ const redactedActual = actualAttrs !== void 0 && "value" in actualAttrs ? actualAttrs.value : void 0;
199
+ const redactedEvidence = event.evidence !== void 0 ? redactEventAttributes(
200
+ isRecord(event.evidence) ? event.evidence : { value: event.evidence },
201
+ redactor,
202
+ maxMetadataValueLength,
203
+ maxPreviewLength
204
+ ) : void 0;
205
+ return {
206
+ ...event,
207
+ name: truncateStringForProfile(
208
+ event.name,
209
+ "name",
210
+ maxMetadataValueLength,
211
+ maxPreviewLength
212
+ ),
213
+ expectation: truncateStringForProfile(
214
+ event.expectation,
215
+ "expectation",
216
+ maxMetadataValueLength,
217
+ maxPreviewLength
218
+ ),
219
+ ...redactedActual !== void 0 ? { actual: redactedActual } : {},
220
+ ...redactedEvidence !== void 0 ? { evidence: redactedEvidence } : {}
221
+ };
222
+ }
223
+ default:
224
+ return event;
190
225
  }
191
226
  });
192
227
  }
@@ -1021,9 +1056,34 @@ footer{margin-top:2rem;font-size:0.85rem;color:#555}
1021
1056
  `.trim();
1022
1057
  function buildRunReport(events, options) {
1023
1058
  const profile = options.redactionProfile ?? "local";
1059
+ const section = options.section ?? "all";
1024
1060
  const safeEvents = redactTraceEventsForReport(events, {
1025
1061
  redactionProfile: profile
1026
1062
  });
1063
+ const outcomes = summarizeObservedOutcomes(
1064
+ extractOutcomesFromTraceEvents(safeEvents)
1065
+ );
1066
+ const observationsMarkdown = renderObservedOutcomesMarkdown(outcomes);
1067
+ const observationsHtml = renderObservedOutcomesHtml(outcomes);
1068
+ if (section === "observations") {
1069
+ if (options.format === "markdown") {
1070
+ return {
1071
+ format: "markdown",
1072
+ content: `## Observed outcomes
1073
+
1074
+ ${observationsMarkdown}
1075
+ `,
1076
+ contentType: "text/markdown",
1077
+ fileExtension: ".md"
1078
+ };
1079
+ }
1080
+ return {
1081
+ format: "html",
1082
+ content: `<!doctype html><html lang="en"><head><meta charset="utf-8"/><title>Observed outcomes</title><style>${REPORT_HTML_CSS}</style></head><body><h1>Observed outcomes</h1>${observationsHtml}</body></html>`,
1083
+ contentType: "text/html",
1084
+ fileExtension: ".html"
1085
+ };
1086
+ }
1027
1087
  const whatSummary = buildRunWhatSummary(safeEvents);
1028
1088
  const whatText = renderRunWhat(whatSummary, {
1029
1089
  correlation: options.correlation !== false
@@ -1057,6 +1117,10 @@ function buildRunReport(events, options) {
1057
1117
  "```text",
1058
1118
  timelineText,
1059
1119
  "```",
1120
+ "",
1121
+ "## Observed outcomes",
1122
+ "",
1123
+ observationsMarkdown,
1060
1124
  ""
1061
1125
  ];
1062
1126
  if (tail) {
@@ -1100,6 +1164,7 @@ function buildRunReport(events, options) {
1100
1164
  <p class="note">Generated locally by AgentInspect. Review for sensitive data before sharing.</p>
1101
1165
  <section class="what"><h2>What happened</h2><pre>${escapeHtml(whatText)}</pre></section>
1102
1166
  <section class="timeline"><h2>Timeline</h2><pre>${escapeHtml(timelineText)}</pre></section>
1167
+ <section class="observations"><h2>Observed outcomes</h2>${observationsHtml}</section>
1103
1168
  ${treeSection || '<section class="tree"><h2>Execution tree</h2><p>No steps recorded.</p></section>'}
1104
1169
  ${errorsSection}
1105
1170
  ${attrsSection}