agent-inspect 3.2.0 → 3.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.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/docs/SCREENSHOTS.md +6 -1
- package/package.json +2 -2
- package/packages/cli/dist/index.cjs +435 -70
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +436 -71
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/core/dist/checks.cjs +105 -0
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.d.cts +26 -1
- package/packages/core/dist/checks.d.ts +26 -1
- package/packages/core/dist/checks.mjs +103 -1
- package/packages/core/dist/checks.mjs.map +1 -1
|
@@ -171,6 +171,19 @@ interface RunStatusRuleOptions {
|
|
|
171
171
|
interface RunDurationRuleOptions {
|
|
172
172
|
maxDurationMs: number;
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Experimental options for the built-in max step duration rule.
|
|
176
|
+
*/
|
|
177
|
+
interface MaxStepDurationRuleOptions {
|
|
178
|
+
maxDurationMs: number;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Experimental options for stall detection (running / incomplete events).
|
|
182
|
+
*/
|
|
183
|
+
interface StallDetectionRuleOptions {
|
|
184
|
+
/** When true, events with startedAt but no endedAt also fail. */
|
|
185
|
+
requireEndedAt?: boolean;
|
|
186
|
+
}
|
|
174
187
|
/**
|
|
175
188
|
* Experimental options for the built-in event count rule.
|
|
176
189
|
*
|
|
@@ -434,6 +447,18 @@ declare function createRunStatusRule(options?: RunStatusRuleOptions): TraceCheck
|
|
|
434
447
|
* evolve during the v1.x experimental period.
|
|
435
448
|
*/
|
|
436
449
|
declare function createRunDurationRule(options: RunDurationRuleOptions): TraceCheckRule;
|
|
450
|
+
/**
|
|
451
|
+
* Fail when any step duration exceeds the configured maximum.
|
|
452
|
+
*/
|
|
453
|
+
declare function createMaxStepDurationRule(options: MaxStepDurationRuleOptions): TraceCheckRule;
|
|
454
|
+
/**
|
|
455
|
+
* Detect stalled runs: running events and optionally started-but-unended events.
|
|
456
|
+
*/
|
|
457
|
+
declare function createStallDetectionRule(options?: StallDetectionRuleOptions): TraceCheckRule;
|
|
458
|
+
/**
|
|
459
|
+
* Require a completed run with no running events.
|
|
460
|
+
*/
|
|
461
|
+
declare function createRequireCompletedRule(): TraceCheckRule;
|
|
437
462
|
/**
|
|
438
463
|
* Create the experimental built-in event count rule.
|
|
439
464
|
*
|
|
@@ -582,4 +607,4 @@ declare function createBaselineRegressionRule(options: BaselineRegressionRuleOpt
|
|
|
582
607
|
*/
|
|
583
608
|
declare function runTraceChecks(input: TraceCheckInput, options?: RunTraceChecksOptions): TraceCheckResult;
|
|
584
609
|
|
|
585
|
-
export { type BaselineRegressionRuleOptions, type DecisionRuleOptions, type GuardrailRuleOptions, type LlmUsageRuleOptions, type RetrievalRuleOptions, type RunDepthRuleOptions, type RunDurationRuleOptions, type RunEventCountRuleOptions, type RunStatusRuleOptions, type RunTraceChecksOptions, type SafetyOversizedAttributeRuleOptions, type SafetyRawContentRuleOptions, type SafetyRedactionRuleOptions, type SafetySecretPattern, type SafetySecretPatternRuleOptions, type StructureIncompleteRuleOptions, type StructureOrphanRuleOptions, type StructureParallelWidthRuleOptions, type StructureRelationshipRuleOptions, type ToolFailureRuleOptions, type ToolOrderingRuleOptions, type ToolUsageRuleOptions, type TraceCheckContext, type TraceCheckDiagnostic, type TraceCheckDiagnosticCode, type TraceCheckEvidence, type TraceCheckFacts, type TraceCheckFinding, type TraceCheckFindingStatus, type TraceCheckInput, type TraceCheckResult, type TraceCheckRule, type TraceCheckRuleCategory, type TraceCheckSeverity, type TraceCheckStatus, type TraceCheckSummary, type TraceSignalRuleOptions, createBaselineRegressionRule, createDecisionRule, createGuardrailRule, createLlmUsageRule, createRetrievalRule, createRunDepthRule, createRunDurationRule, createRunEventCountRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStructureCycleRule, createStructureIncompleteRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolFailureRule, createToolOrderingRule, createToolUsageRule, runTraceChecks };
|
|
610
|
+
export { type BaselineRegressionRuleOptions, type DecisionRuleOptions, type GuardrailRuleOptions, type LlmUsageRuleOptions, type MaxStepDurationRuleOptions, type RetrievalRuleOptions, type RunDepthRuleOptions, type RunDurationRuleOptions, type RunEventCountRuleOptions, type RunStatusRuleOptions, type RunTraceChecksOptions, type SafetyOversizedAttributeRuleOptions, type SafetyRawContentRuleOptions, type SafetyRedactionRuleOptions, type SafetySecretPattern, type SafetySecretPatternRuleOptions, type StallDetectionRuleOptions, type StructureIncompleteRuleOptions, type StructureOrphanRuleOptions, type StructureParallelWidthRuleOptions, type StructureRelationshipRuleOptions, type ToolFailureRuleOptions, type ToolOrderingRuleOptions, type ToolUsageRuleOptions, type TraceCheckContext, type TraceCheckDiagnostic, type TraceCheckDiagnosticCode, type TraceCheckEvidence, type TraceCheckFacts, type TraceCheckFinding, type TraceCheckFindingStatus, type TraceCheckInput, type TraceCheckResult, type TraceCheckRule, type TraceCheckRuleCategory, type TraceCheckSeverity, type TraceCheckStatus, type TraceCheckSummary, type TraceSignalRuleOptions, createBaselineRegressionRule, createDecisionRule, createGuardrailRule, createLlmUsageRule, createMaxStepDurationRule, createRequireCompletedRule, createRetrievalRule, createRunDepthRule, createRunDurationRule, createRunEventCountRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStructureCycleRule, createStructureIncompleteRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolFailureRule, createToolOrderingRule, createToolUsageRule, runTraceChecks };
|
|
@@ -171,6 +171,19 @@ interface RunStatusRuleOptions {
|
|
|
171
171
|
interface RunDurationRuleOptions {
|
|
172
172
|
maxDurationMs: number;
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Experimental options for the built-in max step duration rule.
|
|
176
|
+
*/
|
|
177
|
+
interface MaxStepDurationRuleOptions {
|
|
178
|
+
maxDurationMs: number;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Experimental options for stall detection (running / incomplete events).
|
|
182
|
+
*/
|
|
183
|
+
interface StallDetectionRuleOptions {
|
|
184
|
+
/** When true, events with startedAt but no endedAt also fail. */
|
|
185
|
+
requireEndedAt?: boolean;
|
|
186
|
+
}
|
|
174
187
|
/**
|
|
175
188
|
* Experimental options for the built-in event count rule.
|
|
176
189
|
*
|
|
@@ -434,6 +447,18 @@ declare function createRunStatusRule(options?: RunStatusRuleOptions): TraceCheck
|
|
|
434
447
|
* evolve during the v1.x experimental period.
|
|
435
448
|
*/
|
|
436
449
|
declare function createRunDurationRule(options: RunDurationRuleOptions): TraceCheckRule;
|
|
450
|
+
/**
|
|
451
|
+
* Fail when any step duration exceeds the configured maximum.
|
|
452
|
+
*/
|
|
453
|
+
declare function createMaxStepDurationRule(options: MaxStepDurationRuleOptions): TraceCheckRule;
|
|
454
|
+
/**
|
|
455
|
+
* Detect stalled runs: running events and optionally started-but-unended events.
|
|
456
|
+
*/
|
|
457
|
+
declare function createStallDetectionRule(options?: StallDetectionRuleOptions): TraceCheckRule;
|
|
458
|
+
/**
|
|
459
|
+
* Require a completed run with no running events.
|
|
460
|
+
*/
|
|
461
|
+
declare function createRequireCompletedRule(): TraceCheckRule;
|
|
437
462
|
/**
|
|
438
463
|
* Create the experimental built-in event count rule.
|
|
439
464
|
*
|
|
@@ -582,4 +607,4 @@ declare function createBaselineRegressionRule(options: BaselineRegressionRuleOpt
|
|
|
582
607
|
*/
|
|
583
608
|
declare function runTraceChecks(input: TraceCheckInput, options?: RunTraceChecksOptions): TraceCheckResult;
|
|
584
609
|
|
|
585
|
-
export { type BaselineRegressionRuleOptions, type DecisionRuleOptions, type GuardrailRuleOptions, type LlmUsageRuleOptions, type RetrievalRuleOptions, type RunDepthRuleOptions, type RunDurationRuleOptions, type RunEventCountRuleOptions, type RunStatusRuleOptions, type RunTraceChecksOptions, type SafetyOversizedAttributeRuleOptions, type SafetyRawContentRuleOptions, type SafetyRedactionRuleOptions, type SafetySecretPattern, type SafetySecretPatternRuleOptions, type StructureIncompleteRuleOptions, type StructureOrphanRuleOptions, type StructureParallelWidthRuleOptions, type StructureRelationshipRuleOptions, type ToolFailureRuleOptions, type ToolOrderingRuleOptions, type ToolUsageRuleOptions, type TraceCheckContext, type TraceCheckDiagnostic, type TraceCheckDiagnosticCode, type TraceCheckEvidence, type TraceCheckFacts, type TraceCheckFinding, type TraceCheckFindingStatus, type TraceCheckInput, type TraceCheckResult, type TraceCheckRule, type TraceCheckRuleCategory, type TraceCheckSeverity, type TraceCheckStatus, type TraceCheckSummary, type TraceSignalRuleOptions, createBaselineRegressionRule, createDecisionRule, createGuardrailRule, createLlmUsageRule, createRetrievalRule, createRunDepthRule, createRunDurationRule, createRunEventCountRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStructureCycleRule, createStructureIncompleteRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolFailureRule, createToolOrderingRule, createToolUsageRule, runTraceChecks };
|
|
610
|
+
export { type BaselineRegressionRuleOptions, type DecisionRuleOptions, type GuardrailRuleOptions, type LlmUsageRuleOptions, type MaxStepDurationRuleOptions, type RetrievalRuleOptions, type RunDepthRuleOptions, type RunDurationRuleOptions, type RunEventCountRuleOptions, type RunStatusRuleOptions, type RunTraceChecksOptions, type SafetyOversizedAttributeRuleOptions, type SafetyRawContentRuleOptions, type SafetyRedactionRuleOptions, type SafetySecretPattern, type SafetySecretPatternRuleOptions, type StallDetectionRuleOptions, type StructureIncompleteRuleOptions, type StructureOrphanRuleOptions, type StructureParallelWidthRuleOptions, type StructureRelationshipRuleOptions, type ToolFailureRuleOptions, type ToolOrderingRuleOptions, type ToolUsageRuleOptions, type TraceCheckContext, type TraceCheckDiagnostic, type TraceCheckDiagnosticCode, type TraceCheckEvidence, type TraceCheckFacts, type TraceCheckFinding, type TraceCheckFindingStatus, type TraceCheckInput, type TraceCheckResult, type TraceCheckRule, type TraceCheckRuleCategory, type TraceCheckSeverity, type TraceCheckStatus, type TraceCheckSummary, type TraceSignalRuleOptions, createBaselineRegressionRule, createDecisionRule, createGuardrailRule, createLlmUsageRule, createMaxStepDurationRule, createRequireCompletedRule, createRetrievalRule, createRunDepthRule, createRunDurationRule, createRunEventCountRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStructureCycleRule, createStructureIncompleteRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolFailureRule, createToolOrderingRule, createToolUsageRule, runTraceChecks };
|
|
@@ -578,6 +578,108 @@ function createRunDurationRule(options) {
|
|
|
578
578
|
}
|
|
579
579
|
};
|
|
580
580
|
}
|
|
581
|
+
function createMaxStepDurationRule(options) {
|
|
582
|
+
return {
|
|
583
|
+
id: "run.maxStepDuration",
|
|
584
|
+
category: "run",
|
|
585
|
+
defaultSeverity: "error",
|
|
586
|
+
evaluate(context) {
|
|
587
|
+
const over = context.events.filter((event) => {
|
|
588
|
+
const duration = eventDurationMs(event);
|
|
589
|
+
return duration !== void 0 && duration > options.maxDurationMs;
|
|
590
|
+
});
|
|
591
|
+
if (over.length === 0) return [];
|
|
592
|
+
return [
|
|
593
|
+
failFinding(
|
|
594
|
+
"run.maxStepDuration",
|
|
595
|
+
`${over.length} step(s) exceeded max duration ${options.maxDurationMs}ms.`,
|
|
596
|
+
over.map((event) => eventEvidence(event, "durationMs")),
|
|
597
|
+
{ maxDurationMs: options.maxDurationMs },
|
|
598
|
+
over.map((event) => ({
|
|
599
|
+
eventId: event.eventId,
|
|
600
|
+
name: event.name,
|
|
601
|
+
durationMs: eventDurationMs(event)
|
|
602
|
+
}))
|
|
603
|
+
)
|
|
604
|
+
];
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
}
|
|
608
|
+
function createStallDetectionRule(options = {}) {
|
|
609
|
+
const requireEndedAt = options.requireEndedAt === true;
|
|
610
|
+
return {
|
|
611
|
+
id: "run.stall",
|
|
612
|
+
category: "run",
|
|
613
|
+
defaultSeverity: "warning",
|
|
614
|
+
evaluate(context) {
|
|
615
|
+
const findings = [];
|
|
616
|
+
const running = context.events.filter((event) => event.status === "running");
|
|
617
|
+
if (running.length > 0) {
|
|
618
|
+
findings.push(
|
|
619
|
+
failFinding(
|
|
620
|
+
"run.stall",
|
|
621
|
+
`Found ${running.length} event(s) still running (possible stall).`,
|
|
622
|
+
running.map((event) => eventEvidence(event, "status")),
|
|
623
|
+
"no running events",
|
|
624
|
+
running.length
|
|
625
|
+
)
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
if (requireEndedAt) {
|
|
629
|
+
const incomplete = context.events.filter(
|
|
630
|
+
(event) => event.startedAt !== void 0 && event.endedAt === void 0 && event.status !== "running"
|
|
631
|
+
);
|
|
632
|
+
if (incomplete.length > 0) {
|
|
633
|
+
findings.push(
|
|
634
|
+
failFinding(
|
|
635
|
+
"run.stall",
|
|
636
|
+
`Found ${incomplete.length} started event(s) without endedAt.`,
|
|
637
|
+
incomplete.map((event) => eventEvidence(event, "endedAt")),
|
|
638
|
+
"endedAt for started events",
|
|
639
|
+
incomplete.length
|
|
640
|
+
)
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return findings;
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
function createRequireCompletedRule() {
|
|
649
|
+
return {
|
|
650
|
+
id: "run.requireCompleted",
|
|
651
|
+
category: "run",
|
|
652
|
+
defaultSeverity: "error",
|
|
653
|
+
evaluate(context) {
|
|
654
|
+
const findings = [];
|
|
655
|
+
const runStatus = context.selectedRun?.status;
|
|
656
|
+
if (runStatus === "running") {
|
|
657
|
+
findings.push(
|
|
658
|
+
failFinding(
|
|
659
|
+
"run.requireCompleted",
|
|
660
|
+
"Run is still running.",
|
|
661
|
+
runEvidence(context.selectedRun),
|
|
662
|
+
"completed run",
|
|
663
|
+
runStatus
|
|
664
|
+
)
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
const running = context.events.filter((event) => event.status === "running");
|
|
668
|
+
if (running.length > 0) {
|
|
669
|
+
findings.push(
|
|
670
|
+
failFinding(
|
|
671
|
+
"run.requireCompleted",
|
|
672
|
+
`Run has ${running.length} incomplete running event(s).`,
|
|
673
|
+
running.map((event) => eventEvidence(event, "status")),
|
|
674
|
+
"no running events",
|
|
675
|
+
running.length
|
|
676
|
+
)
|
|
677
|
+
);
|
|
678
|
+
}
|
|
679
|
+
return findings;
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
}
|
|
581
683
|
function createRunEventCountRule(options) {
|
|
582
684
|
return {
|
|
583
685
|
id: "run.eventCount",
|
|
@@ -1507,6 +1609,6 @@ function runTraceChecks(input, options = {}) {
|
|
|
1507
1609
|
};
|
|
1508
1610
|
}
|
|
1509
1611
|
|
|
1510
|
-
export { createBaselineRegressionRule, createDecisionRule, createGuardrailRule, createLlmUsageRule, createRetrievalRule, createRunDepthRule, createRunDurationRule, createRunEventCountRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStructureCycleRule, createStructureIncompleteRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolFailureRule, createToolOrderingRule, createToolUsageRule, runTraceChecks };
|
|
1612
|
+
export { createBaselineRegressionRule, createDecisionRule, createGuardrailRule, createLlmUsageRule, createMaxStepDurationRule, createRequireCompletedRule, createRetrievalRule, createRunDepthRule, createRunDurationRule, createRunEventCountRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStructureCycleRule, createStructureIncompleteRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolFailureRule, createToolOrderingRule, createToolUsageRule, runTraceChecks };
|
|
1511
1613
|
//# sourceMappingURL=checks.mjs.map
|
|
1512
1614
|
//# sourceMappingURL=checks.mjs.map
|