agent-inspect 6.31.0 → 6.31.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.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/docs/COMPARE.md +1 -1
- package/docs/FIRST-TRACE-IN-5-MINUTES.md +21 -17
- package/docs/GETTING-STARTED.md +1 -1
- package/package.json +4 -2
- package/packages/cli/dist/{chunk-Y5Z4BXUO.mjs → chunk-SJ6FRNOE.mjs} +37 -6
- package/packages/cli/dist/chunk-SJ6FRNOE.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +49 -7
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +16 -5
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-WTTH5G33.mjs → src-YNEJOPRA.mjs} +3 -3
- package/packages/cli/dist/{src-WTTH5G33.mjs.map → src-YNEJOPRA.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +27 -0
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.mjs +2 -2
- package/packages/core/dist/checks.cjs +35 -4
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.mjs +1 -1
- package/packages/core/dist/{chunk-VEQKLWGJ.mjs → chunk-CBPWLHNQ.mjs} +37 -6
- package/packages/core/dist/chunk-CBPWLHNQ.mjs.map +1 -0
- package/packages/cli/dist/chunk-Y5Z4BXUO.mjs.map +0 -1
- package/packages/core/dist/chunk-VEQKLWGJ.mjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { extractSessionWorkflowMetadata, sessionKeyForRun, defineTraceContract, runTraceChecks, createRunStatusRule, createToolUsageRule, createRunDurationRule, createLlmUsageRule, createObservedOutcomeRule } from './chunk-
|
|
2
|
-
export { extractSessionWorkflowMetadata, sessionKeyForRun } from './chunk-
|
|
1
|
+
import { extractSessionWorkflowMetadata, sessionKeyForRun, defineTraceContract, runTraceChecks, createRunStatusRule, createToolUsageRule, createRunDurationRule, createLlmUsageRule, createObservedOutcomeRule } from './chunk-CBPWLHNQ.mjs';
|
|
2
|
+
export { extractSessionWorkflowMetadata, sessionKeyForRun } from './chunk-CBPWLHNQ.mjs';
|
|
3
3
|
export { MAX_TERMINAL_DEPTH, MAX_TERMINAL_NAME_LENGTH, TERMINAL_INDENT, TraceDirectory, createInspector, createInspectorRuntime, formatTerminalName, getCurrentContext, getCurrentCorrelationMetadata, getCurrentDepth, getCurrentRunId, getCurrentRunName, getCurrentStepId, getIndent, getParentStepId, getTraceDirFromContext, getTraceSafetyFromContext, hasActiveContext, isAgentInspectEnabled, isSilentContext, maybeInspectRun, printError, printFailedAt, printRunComplete, printRunStart, printStepComplete, printStepStart, renderErrorLine, renderRunSummary, renderStepLine, resolveTraceDir, runWithContext, runWithStepContext } from './chunk-ZFJ2ICTC.mjs';
|
|
4
4
|
import { buildRunTimeline, filterTraces, extractMetadata, buildRunSummary } from './chunk-KWBO36PH.mjs';
|
|
5
5
|
export { buildRunSummary, buildRunTimeline, buildRunWhatSummary, buildTraceStats, extractMetadata, filterTraces, formatStepLabel, renderRunWhat, renderTimeline, renderTraceStats } from './chunk-KWBO36PH.mjs';
|
|
@@ -2490,11 +2490,40 @@ function contractFailFinding(ruleId, message, evidence, expected, actual) {
|
|
|
2490
2490
|
evidence: [...evidence]
|
|
2491
2491
|
};
|
|
2492
2492
|
}
|
|
2493
|
+
var ALLOWED_STATUS_ALIASES = {
|
|
2494
|
+
ok: "ok",
|
|
2495
|
+
error: "error",
|
|
2496
|
+
running: "running",
|
|
2497
|
+
success: "ok",
|
|
2498
|
+
failed: "error"
|
|
2499
|
+
};
|
|
2500
|
+
function parseAllowedStatus(status) {
|
|
2501
|
+
return ALLOWED_STATUS_ALIASES[status];
|
|
2502
|
+
}
|
|
2493
2503
|
function normalizeStatus(status) {
|
|
2494
|
-
|
|
2495
|
-
if (
|
|
2496
|
-
|
|
2497
|
-
|
|
2504
|
+
const parsed = parseAllowedStatus(status);
|
|
2505
|
+
if (parsed === void 0) {
|
|
2506
|
+
throw new TypeError(
|
|
2507
|
+
`Unknown run status ${JSON.stringify(status)}. Allowed: ok, error, running (aliases: success, failed).`
|
|
2508
|
+
);
|
|
2509
|
+
}
|
|
2510
|
+
return parsed;
|
|
2511
|
+
}
|
|
2512
|
+
function validateAllowedStatusesShape(allowedStatuses, pathPrefix = "run.allowedStatuses") {
|
|
2513
|
+
if (!allowedStatuses?.length) return [];
|
|
2514
|
+
const out = [];
|
|
2515
|
+
for (let i = 0; i < allowedStatuses.length; i++) {
|
|
2516
|
+
const status = allowedStatuses[i];
|
|
2517
|
+
if (parseAllowedStatus(status) === void 0) {
|
|
2518
|
+
out.push({
|
|
2519
|
+
code: "contract.run.allowedStatuses.unknown",
|
|
2520
|
+
severity: "error",
|
|
2521
|
+
message: `${pathPrefix}[${i}] has unknown status ${JSON.stringify(status)}. Allowed: ok, error, running (aliases: success, failed).`,
|
|
2522
|
+
path: `${pathPrefix}[${i}]`
|
|
2523
|
+
});
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
return out;
|
|
2498
2527
|
}
|
|
2499
2528
|
function cloneBody(body) {
|
|
2500
2529
|
return {
|
|
@@ -3161,6 +3190,7 @@ function evaluateBody(input, body, options = {}) {
|
|
|
3161
3190
|
}
|
|
3162
3191
|
function defineTraceContract(input) {
|
|
3163
3192
|
const shapeErrors = [
|
|
3193
|
+
...validateAllowedStatusesShape(input.run?.allowedStatuses),
|
|
3164
3194
|
...validateAlternativesShape(input.alternatives),
|
|
3165
3195
|
...validateScopeShape(input.scope),
|
|
3166
3196
|
...validateProvenanceShape(input.observations)
|
|
@@ -3191,6 +3221,7 @@ function defineTraceContract(input) {
|
|
|
3191
3221
|
}
|
|
3192
3222
|
function evaluateTraceContract(input, contract, options = {}) {
|
|
3193
3223
|
const shapeErrors = [
|
|
3224
|
+
...validateAllowedStatusesShape(contract.run?.allowedStatuses),
|
|
3194
3225
|
...validateAlternativesShape(contract.alternatives),
|
|
3195
3226
|
...validateScopeShape(contract.scope),
|
|
3196
3227
|
...validateProvenanceShape(contract.observations)
|