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.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/docs/NESTJS.md +56 -18
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-SWUZRRDT.mjs → chunk-MQYHJL3W.mjs} +2216 -1938
- package/packages/cli/dist/chunk-MQYHJL3W.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +975 -671
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +32 -9
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-XFIPYODW.mjs → src-76R6E2LQ.mjs} +3 -3
- package/packages/cli/dist/{src-XFIPYODW.mjs.map → src-76R6E2LQ.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +2079 -1879
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.d.cts +56 -4
- package/packages/core/dist/advanced.d.ts +56 -4
- package/packages/core/dist/advanced.mjs +188 -23
- package/packages/core/dist/advanced.mjs.map +1 -1
- package/packages/core/dist/checks.cjs +126 -9
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.d.cts +3 -3
- package/packages/core/dist/checks.d.ts +3 -3
- package/packages/core/dist/checks.mjs +3 -2
- package/packages/core/dist/{chunk-L5WLVBW4.mjs → chunk-AHUZNHFI.mjs} +4 -55
- package/packages/core/dist/chunk-AHUZNHFI.mjs.map +1 -0
- package/packages/core/dist/{chunk-2CCRUI42.mjs → chunk-CCYKNAOD.mjs} +119 -12
- package/packages/core/dist/chunk-CCYKNAOD.mjs.map +1 -0
- package/packages/core/dist/{chunk-7YYS742B.mjs → chunk-M3RJD3BP.mjs} +5 -5
- package/packages/core/dist/{chunk-7YYS742B.mjs.map → chunk-M3RJD3BP.mjs.map} +1 -1
- package/packages/core/dist/{chunk-2IRRUNIN.mjs → chunk-OAUNS5CS.mjs} +3 -3
- package/packages/core/dist/{chunk-2IRRUNIN.mjs.map → chunk-OAUNS5CS.mjs.map} +1 -1
- package/packages/core/dist/{chunk-IJJSPJXV.mjs → chunk-QOC3PJO3.mjs} +4 -4
- package/packages/core/dist/{chunk-IJJSPJXV.mjs.map → chunk-QOC3PJO3.mjs.map} +1 -1
- package/packages/core/dist/chunk-S6LQBLX5.mjs +67 -0
- package/packages/core/dist/chunk-S6LQBLX5.mjs.map +1 -0
- package/packages/core/dist/{chunk-3SPBELJB.mjs → chunk-SSG3ICI4.mjs} +16 -2
- package/packages/core/dist/chunk-SSG3ICI4.mjs.map +1 -0
- package/packages/core/dist/exporters.cjs +3 -3
- package/packages/core/dist/exporters.cjs.map +1 -1
- package/packages/core/dist/exporters.mjs +1 -1
- package/packages/core/dist/{index-EQihlEei.d.cts → index-DACU4Dy1.d.cts} +12 -0
- package/packages/core/dist/{index-CgOAGuM5.d.ts → index-b4tIGrzq.d.ts} +12 -0
- package/packages/core/dist/index.cjs +77 -0
- package/packages/core/dist/index.cjs.map +1 -1
- package/packages/core/dist/index.mjs +3 -2
- package/packages/core/dist/index.mjs.map +1 -1
- package/packages/core/dist/persisted.cjs +11 -0
- package/packages/core/dist/persisted.cjs.map +1 -1
- package/packages/core/dist/persisted.mjs +4 -3
- package/packages/core/dist/persisted.mjs.map +1 -1
- package/packages/core/dist/{programmatic-gZTWLObB.d.cts → programmatic-BLlC7Ytq.d.cts} +1 -1
- package/packages/core/dist/{programmatic-gZTWLObB.d.ts → programmatic-BLlC7Ytq.d.ts} +1 -1
- package/packages/core/dist/readers.cjs +11 -0
- package/packages/core/dist/readers.cjs.map +1 -1
- package/packages/core/dist/readers.d.cts +1 -1
- package/packages/core/dist/readers.d.ts +1 -1
- package/packages/core/dist/readers.mjs +4 -3
- package/packages/cli/dist/chunk-SWUZRRDT.mjs.map +0 -1
- package/packages/core/dist/chunk-2CCRUI42.mjs.map +0 -1
- package/packages/core/dist/chunk-3SPBELJB.mjs.map +0 -1
- package/packages/core/dist/chunk-L5WLVBW4.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildRunWhatSummary, renderRunWhat, renderTimeline, buildRunTimeline } from './chunk-
|
|
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
|
}
|