agent-inspect 6.31.9 → 6.31.11

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 (61) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/docs/NESTJS.md +56 -18
  4. package/package.json +1 -1
  5. package/packages/cli/dist/{chunk-SWUZRRDT.mjs → chunk-MQYHJL3W.mjs} +2216 -1938
  6. package/packages/cli/dist/chunk-MQYHJL3W.mjs.map +1 -0
  7. package/packages/cli/dist/index.cjs +975 -671
  8. package/packages/cli/dist/index.cjs.map +1 -1
  9. package/packages/cli/dist/index.mjs +32 -9
  10. package/packages/cli/dist/index.mjs.map +1 -1
  11. package/packages/cli/dist/{src-XFIPYODW.mjs → src-76R6E2LQ.mjs} +3 -3
  12. package/packages/cli/dist/{src-XFIPYODW.mjs.map → src-76R6E2LQ.mjs.map} +1 -1
  13. package/packages/core/dist/advanced.cjs +2079 -1879
  14. package/packages/core/dist/advanced.cjs.map +1 -1
  15. package/packages/core/dist/advanced.d.cts +56 -4
  16. package/packages/core/dist/advanced.d.ts +56 -4
  17. package/packages/core/dist/advanced.mjs +188 -23
  18. package/packages/core/dist/advanced.mjs.map +1 -1
  19. package/packages/core/dist/checks.cjs +126 -9
  20. package/packages/core/dist/checks.cjs.map +1 -1
  21. package/packages/core/dist/checks.d.cts +3 -3
  22. package/packages/core/dist/checks.d.ts +3 -3
  23. package/packages/core/dist/checks.mjs +3 -2
  24. package/packages/core/dist/{chunk-L5WLVBW4.mjs → chunk-AHUZNHFI.mjs} +4 -55
  25. package/packages/core/dist/chunk-AHUZNHFI.mjs.map +1 -0
  26. package/packages/core/dist/{chunk-2CCRUI42.mjs → chunk-CCYKNAOD.mjs} +119 -12
  27. package/packages/core/dist/chunk-CCYKNAOD.mjs.map +1 -0
  28. package/packages/core/dist/{chunk-7YYS742B.mjs → chunk-M3RJD3BP.mjs} +5 -5
  29. package/packages/core/dist/{chunk-7YYS742B.mjs.map → chunk-M3RJD3BP.mjs.map} +1 -1
  30. package/packages/core/dist/{chunk-2IRRUNIN.mjs → chunk-OAUNS5CS.mjs} +3 -3
  31. package/packages/core/dist/{chunk-2IRRUNIN.mjs.map → chunk-OAUNS5CS.mjs.map} +1 -1
  32. package/packages/core/dist/{chunk-IJJSPJXV.mjs → chunk-QOC3PJO3.mjs} +4 -4
  33. package/packages/core/dist/{chunk-IJJSPJXV.mjs.map → chunk-QOC3PJO3.mjs.map} +1 -1
  34. package/packages/core/dist/chunk-S6LQBLX5.mjs +67 -0
  35. package/packages/core/dist/chunk-S6LQBLX5.mjs.map +1 -0
  36. package/packages/core/dist/{chunk-3SPBELJB.mjs → chunk-SSG3ICI4.mjs} +16 -2
  37. package/packages/core/dist/chunk-SSG3ICI4.mjs.map +1 -0
  38. package/packages/core/dist/exporters.cjs +3 -3
  39. package/packages/core/dist/exporters.cjs.map +1 -1
  40. package/packages/core/dist/exporters.mjs +1 -1
  41. package/packages/core/dist/{index-EQihlEei.d.cts → index-DACU4Dy1.d.cts} +12 -0
  42. package/packages/core/dist/{index-CgOAGuM5.d.ts → index-b4tIGrzq.d.ts} +12 -0
  43. package/packages/core/dist/index.cjs +77 -0
  44. package/packages/core/dist/index.cjs.map +1 -1
  45. package/packages/core/dist/index.mjs +3 -2
  46. package/packages/core/dist/index.mjs.map +1 -1
  47. package/packages/core/dist/persisted.cjs +11 -0
  48. package/packages/core/dist/persisted.cjs.map +1 -1
  49. package/packages/core/dist/persisted.mjs +4 -3
  50. package/packages/core/dist/persisted.mjs.map +1 -1
  51. package/packages/core/dist/{programmatic-gZTWLObB.d.cts → programmatic-BLlC7Ytq.d.cts} +1 -1
  52. package/packages/core/dist/{programmatic-gZTWLObB.d.ts → programmatic-BLlC7Ytq.d.ts} +1 -1
  53. package/packages/core/dist/readers.cjs +11 -0
  54. package/packages/core/dist/readers.cjs.map +1 -1
  55. package/packages/core/dist/readers.d.cts +1 -1
  56. package/packages/core/dist/readers.d.ts +1 -1
  57. package/packages/core/dist/readers.mjs +4 -3
  58. package/packages/cli/dist/chunk-SWUZRRDT.mjs.map +0 -1
  59. package/packages/core/dist/chunk-2CCRUI42.mjs.map +0 -1
  60. package/packages/core/dist/chunk-3SPBELJB.mjs.map +0 -1
  61. package/packages/core/dist/chunk-L5WLVBW4.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { buildRunWhatSummary, renderRunWhat, renderTimeline, buildRunTimeline } from './chunk-7YYS742B.mjs';
1
+ import { buildRunWhatSummary, renderRunWhat, renderTimeline, buildRunTimeline } from './chunk-M3RJD3BP.mjs';
2
2
  import { summarizeObservedOutcomes, extractOutcomesFromTraceEvents, renderObservedOutcomesMarkdown, renderObservedOutcomesHtml } from './chunk-N5PZAI6Q.mjs';
3
3
  import { escapeHtml, flattenTree, safeString, compactAttributes, stableJson, escapeMarkdown, zeroKinds } from './chunk-CAWPF22J.mjs';
4
4
  export { compactAttributes, escapeHtml, escapeMarkdown, flattenTree, safeString, stableJson, summarizeTree } from './chunk-CAWPF22J.mjs';
@@ -1260,11 +1260,23 @@ interface TraceCheckRuleExecution {
1260
1260
  * @experimental Available through `agent-inspect/checks`. Additive changes may ship in minor releases; breaking changes require a future major.
1261
1261
  */
1262
1262
  interface TraceCheckSummary {
1263
+ /** Finding count with status pass. */
1263
1264
  passed: number;
1265
+ /** Finding count with status fail and severity error. */
1264
1266
  failed: number;
1267
+ /** Finding count with warning status or severity. */
1265
1268
  warnings: number;
1269
+ /** Diagnostic count with severity error. */
1266
1270
  errors: number;
1267
1271
  rulesEvaluated: number;
1272
+ /**
1273
+ * Rule-status totals from `ruleExecutions` (independent of finding counts).
1274
+ * @experimental Additive; always populated by `runTraceChecks` / contract evaluation.
1275
+ */
1276
+ rulesPassed: number;
1277
+ rulesWarning: number;
1278
+ rulesFailed: number;
1279
+ rulesError: number;
1268
1280
  }
1269
1281
  /**
1270
1282
  * Experimental trace-check result.
@@ -1260,11 +1260,23 @@ interface TraceCheckRuleExecution {
1260
1260
  * @experimental Available through `agent-inspect/checks`. Additive changes may ship in minor releases; breaking changes require a future major.
1261
1261
  */
1262
1262
  interface TraceCheckSummary {
1263
+ /** Finding count with status pass. */
1263
1264
  passed: number;
1265
+ /** Finding count with status fail and severity error. */
1264
1266
  failed: number;
1267
+ /** Finding count with warning status or severity. */
1265
1268
  warnings: number;
1269
+ /** Diagnostic count with severity error. */
1266
1270
  errors: number;
1267
1271
  rulesEvaluated: number;
1272
+ /**
1273
+ * Rule-status totals from `ruleExecutions` (independent of finding counts).
1274
+ * @experimental Additive; always populated by `runTraceChecks` / contract evaluation.
1275
+ */
1276
+ rulesPassed: number;
1277
+ rulesWarning: number;
1278
+ rulesFailed: number;
1279
+ rulesError: number;
1268
1280
  }
1269
1281
  /**
1270
1282
  * Experimental trace-check result.
@@ -2072,6 +2072,70 @@ function runWithStepContext(stepId, fn) {
2072
2072
  });
2073
2073
  }
2074
2074
 
2075
+ // packages/core/src/diagnostics/programmatic.ts
2076
+ var PROGRAMMATIC_DIAGNOSTIC_SPECS = Object.freeze({
2077
+ AI_TRACE_INPUT_INVALID: {
2078
+ code: "AI_TRACE_INPUT_INVALID",
2079
+ summary: 'Expected { type: "file", path }, { type: "directory", path }, { type: "string", content }, { type: "buffer", content }, or { type: "stdin" }.',
2080
+ remediation: "For a file path, use openTraceFile(path).",
2081
+ relatedCodes: ["invalid_input"]
2082
+ },
2083
+ AI_TRACE_FORMAT_UNSUPPORTED: {
2084
+ code: "AI_TRACE_FORMAT_UNSUPPORTED",
2085
+ summary: "No trace reader could detect the input format.",
2086
+ remediation: "Pass an AgentInspect JSONL file via openTraceFile, or set options.format to a registered reader.",
2087
+ relatedCodes: ["unsupported_format"]
2088
+ },
2089
+ AI_TRACE_FORMAT_AMBIGUOUS: {
2090
+ code: "AI_TRACE_FORMAT_AMBIGUOUS",
2091
+ summary: "Multiple trace readers matched the input with equal confidence.",
2092
+ remediation: "Set options.format explicitly to disambiguate the reader.",
2093
+ relatedCodes: ["ambiguous_format"]
2094
+ },
2095
+ AI_TRACE_FACTS_INPUT_NOT_NORMALIZED: {
2096
+ code: "AI_TRACE_FACTS_INPUT_NOT_NORMALIZED",
2097
+ summary: "TraceFacts requires TraceReadResult or PersistedInspectEvent[].",
2098
+ remediation: "Use openTraceFile() to normalize a JSONL trace first."
2099
+ },
2100
+ AI_TRACE_CONTRACT_RUN_SELECTION_REQUIRED: {
2101
+ code: "AI_TRACE_CONTRACT_RUN_SELECTION_REQUIRED",
2102
+ summary: "Multiple runs are available; select a run before executing checks.",
2103
+ remediation: "Pass options.runId or TraceCheckInput.selectedRun.",
2104
+ relatedCodes: ["AI_CHECK_RUN_SELECTION_REQUIRED"]
2105
+ },
2106
+ AI_TRACE_RELATIONSHIP_SELF_PARENT: {
2107
+ code: "AI_TRACE_RELATIONSHIP_SELF_PARENT",
2108
+ summary: "A parentId equals its own event/step id.",
2109
+ remediation: "Reject at capture (AI_LANGGRAPH_SELF_PARENT_REJECTED) or drop via logical projection; do not invent replacement parents.",
2110
+ relatedCodes: [
2111
+ "AI_LANGGRAPH_SELF_PARENT_REJECTED",
2112
+ "AI_LOGICAL_SELF_PARENT_REMOVED"
2113
+ ]
2114
+ },
2115
+ AI_TRACE_RELATIONSHIP_CYCLE: {
2116
+ code: "AI_TRACE_RELATIONSHIP_CYCLE",
2117
+ summary: "Trace contains a parentId cycle.",
2118
+ remediation: "Use visibility-first tree linking for legacy fixtures; prefer acyclic capture for new adapter output.",
2119
+ relatedCodes: ["structure.cycle"]
2120
+ },
2121
+ AI_TRACE_CONTRACT_INPUT_INVALID: {
2122
+ code: "AI_TRACE_CONTRACT_INPUT_INVALID",
2123
+ summary: "evaluateTraceContract expects ({ read }, contract) or use evaluateTraceContractRead(read, contract).",
2124
+ remediation: "Pass TraceCheckInput as the first argument: evaluateTraceContract({ read }, contract).",
2125
+ relatedCodes: ["AI_CHECK_INVALID_ARGUMENTS"]
2126
+ },
2127
+ AI_INSPECT_RUN_UNSUPPORTED_OPTION: {
2128
+ code: "AI_INSPECT_RUN_UNSUPPORTED_OPTION",
2129
+ summary: 'inspectRun does not accept a "writer" option.',
2130
+ remediation: "Use createInspector({ writer }) then inspector.run(...). inspectRun persists via the global JSONL path (schema 0.1)."
2131
+ }
2132
+ });
2133
+ function formatProgrammaticDiagnostic(code, detail) {
2134
+ const spec = PROGRAMMATIC_DIAGNOSTIC_SPECS[code];
2135
+ const summary = spec.summary;
2136
+ return `${code}: ${summary} Remediation: ${spec.remediation}`;
2137
+ }
2138
+
2075
2139
  // node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js
2076
2140
  var ANSI_BACKGROUND_OFFSET = 10;
2077
2141
  var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
@@ -2702,6 +2766,18 @@ function resolveTraceDir(options = {}) {
2702
2766
  }
2703
2767
 
2704
2768
  // packages/core/src/inspect-run.ts
2769
+ var INSPECT_RUN_UNSUPPORTED_OPTION_KEYS = ["writer"];
2770
+ function warnUnsupportedInspectRunOptions(options) {
2771
+ if (typeof options !== "object" || options === null || Array.isArray(options)) {
2772
+ return;
2773
+ }
2774
+ const record = options;
2775
+ for (const key of INSPECT_RUN_UNSUPPORTED_OPTION_KEYS) {
2776
+ if (Object.prototype.hasOwnProperty.call(record, key) && record[key] !== void 0) {
2777
+ warn(formatProgrammaticDiagnostic("AI_INSPECT_RUN_UNSUPPORTED_OPTION"));
2778
+ }
2779
+ }
2780
+ }
2705
2781
  function normalizeRunName(name) {
2706
2782
  if (typeof name !== "string" || name.trim() === "") {
2707
2783
  return "unnamed-run";
@@ -2719,6 +2795,7 @@ async function inspectRun(name, fn, options) {
2719
2795
  if (typeof fn !== "function") {
2720
2796
  throw new TypeError("inspectRun requires `fn` to be a function");
2721
2797
  }
2798
+ warnUnsupportedInspectRunOptions(options);
2722
2799
  if (options?.enabled === false) {
2723
2800
  return Promise.resolve(fn());
2724
2801
  }