agent-inspect 6.31.34 → 6.31.36
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/API.md +2 -2
- package/docs/CLI.md +1 -0
- package/docs/KNOWN-ISSUES.md +1 -0
- package/docs/LIMITATIONS.md +23 -0
- package/docs/SAFE-TRACE-SHARING.md +1 -1
- package/docs/SCHEMA.md +10 -1
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-6TXW53UR.mjs → chunk-Z3WXP44D.mjs} +64 -7
- package/packages/cli/dist/chunk-Z3WXP44D.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +64 -7
- package/packages/cli/dist/index.cjs.map +1 -1
- package/packages/cli/dist/index.mjs +4 -4
- package/packages/cli/dist/index.mjs.map +1 -1
- package/packages/cli/dist/{src-GCLC4DIC.mjs → src-LCUTRLRQ.mjs} +3 -3
- package/packages/cli/dist/{src-GCLC4DIC.mjs.map → src-LCUTRLRQ.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +62 -5
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.mjs +2 -2
- package/packages/core/dist/checks.cjs +62 -5
- package/packages/core/dist/checks.cjs.map +1 -1
- package/packages/core/dist/checks.mjs +1 -1
- package/packages/core/dist/{chunk-CXC7L4PY.mjs → chunk-KQX3Z4DH.mjs} +64 -7
- package/packages/core/dist/chunk-KQX3Z4DH.mjs.map +1 -0
- package/packages/cli/dist/chunk-6TXW53UR.mjs.map +0 -1
- package/packages/core/dist/chunk-CXC7L4PY.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { buildTraceFacts, createBaselineRegressionRule, createDecisionRule, createGuardrailRule, createLlmUsageRule, createMaxStepDurationRule, createObservedOutcomeRule, createRequireCompletedRule, createRetrievalRule, createRunDepthRule, createRunDurationRule, createRunEventCountRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStepOrderingRule, createStructureCycleRule, createStructureIncompleteRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolFailureRule, createToolOrderingRule, createToolUsageRule, defineTraceContract, deriveFailureFacts, deriveRelationshipFacts, evaluateToolArgumentValue, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, extractToolArgumentPayload, lintTraceContract, resolveJsonPointer, resolveTraceContractScope, runTraceChecks, summarizeSemanticParity, workflowMetadataForRun } from './chunk-
|
|
1
|
+
export { buildTraceFacts, createBaselineRegressionRule, createDecisionRule, createGuardrailRule, createLlmUsageRule, createMaxStepDurationRule, createObservedOutcomeRule, createRequireCompletedRule, createRetrievalRule, createRunDepthRule, createRunDurationRule, createRunEventCountRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStepOrderingRule, createStructureCycleRule, createStructureIncompleteRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolFailureRule, createToolOrderingRule, createToolUsageRule, defineTraceContract, deriveFailureFacts, deriveRelationshipFacts, evaluateToolArgumentValue, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, extractToolArgumentPayload, lintTraceContract, resolveJsonPointer, resolveTraceContractScope, runTraceChecks, summarizeSemanticParity, workflowMetadataForRun } from './chunk-KQX3Z4DH.mjs';
|
|
2
2
|
import './chunk-6F6KLGCR.mjs';
|
|
3
3
|
import './chunk-PU3FF5AP.mjs';
|
|
4
4
|
import './chunk-VLVCLAPB.mjs';
|
|
@@ -3495,11 +3495,27 @@ function eventTimestamp(finding, eventById) {
|
|
|
3495
3495
|
const eventId = finding.evidence[0]?.eventId;
|
|
3496
3496
|
return eventId ? eventById.get(eventId)?.timestamp ?? "" : "";
|
|
3497
3497
|
}
|
|
3498
|
+
function isObservedToolPolicyFinding(finding) {
|
|
3499
|
+
return finding.ruleId === "tool.usage" && finding.evidence[0]?.eventId !== void 0;
|
|
3500
|
+
}
|
|
3501
|
+
function isMissingToolConsequenceFinding(finding) {
|
|
3502
|
+
if (finding.evidence[0]?.eventId !== void 0) return false;
|
|
3503
|
+
if (finding.ruleId === "tool.usage" && /did not appear/.test(finding.message)) {
|
|
3504
|
+
return true;
|
|
3505
|
+
}
|
|
3506
|
+
return finding.ruleId.startsWith("contract.tool.arguments") && /^No finished tool named /.test(finding.message);
|
|
3507
|
+
}
|
|
3498
3508
|
function compareFindings(eventById) {
|
|
3499
3509
|
return (a, b) => {
|
|
3500
3510
|
if (SEVERITY_RANK[a.severity] !== SEVERITY_RANK[b.severity]) {
|
|
3501
3511
|
return SEVERITY_RANK[a.severity] - SEVERITY_RANK[b.severity];
|
|
3502
3512
|
}
|
|
3513
|
+
const aPolicy = isObservedToolPolicyFinding(a);
|
|
3514
|
+
const bPolicy = isObservedToolPolicyFinding(b);
|
|
3515
|
+
const aMissing = isMissingToolConsequenceFinding(a);
|
|
3516
|
+
const bMissing = isMissingToolConsequenceFinding(b);
|
|
3517
|
+
if (aPolicy && bMissing) return -1;
|
|
3518
|
+
if (bPolicy && aMissing) return 1;
|
|
3503
3519
|
const byRule = a.ruleId.localeCompare(b.ruleId);
|
|
3504
3520
|
if (byRule !== 0) return byRule;
|
|
3505
3521
|
if (STATUS_RANK[a.status] !== STATUS_RANK[b.status]) {
|
|
@@ -3635,20 +3651,43 @@ function failFinding(ruleId, message, evidence, expected, actual, meta) {
|
|
|
3635
3651
|
function toolName(event) {
|
|
3636
3652
|
return resolveCanonicalToolName(event);
|
|
3637
3653
|
}
|
|
3654
|
+
var MAX_TOOL_NAME_CODEPOINT_DETAILS = 3;
|
|
3655
|
+
function isAsciiLetterCodePoint(codePoint) {
|
|
3656
|
+
return codePoint >= 65 && codePoint <= 90 || codePoint >= 97 && codePoint <= 122;
|
|
3657
|
+
}
|
|
3658
|
+
function isRiskyToolNameCodePoint(codePoint) {
|
|
3659
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) return true;
|
|
3660
|
+
return codePoint === 1564 || codePoint === 8203 || codePoint === 8204 || codePoint === 8205 || codePoint === 8206 || codePoint === 8207 || codePoint >= 8234 && codePoint <= 8238 || codePoint >= 8294 && codePoint <= 8297 || codePoint === 65279;
|
|
3661
|
+
}
|
|
3662
|
+
function formatCodePointDetail(codePoint, index) {
|
|
3663
|
+
return `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")} at index ${index}`;
|
|
3664
|
+
}
|
|
3638
3665
|
function formatToolNameForMessage(name) {
|
|
3666
|
+
let hasAsciiLetter = false;
|
|
3667
|
+
let hasNonAscii = false;
|
|
3668
|
+
let hasRisky = false;
|
|
3639
3669
|
const details = [];
|
|
3640
3670
|
for (let index = 0; index < name.length; ) {
|
|
3641
3671
|
const codePoint = name.codePointAt(index);
|
|
3642
3672
|
const width = codePoint > 65535 ? 2 : 1;
|
|
3673
|
+
if (isAsciiLetterCodePoint(codePoint)) hasAsciiLetter = true;
|
|
3674
|
+
const risky = isRiskyToolNameCodePoint(codePoint);
|
|
3675
|
+
if (risky) hasRisky = true;
|
|
3643
3676
|
if (codePoint > 127) {
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3677
|
+
hasNonAscii = true;
|
|
3678
|
+
details.push(formatCodePointDetail(codePoint, index));
|
|
3679
|
+
} else if (risky) {
|
|
3680
|
+
details.push(formatCodePointDetail(codePoint, index));
|
|
3647
3681
|
}
|
|
3648
3682
|
index += width;
|
|
3649
3683
|
}
|
|
3650
|
-
if (details.length === 0)
|
|
3651
|
-
|
|
3684
|
+
if (!hasRisky && !(hasAsciiLetter && hasNonAscii) || details.length === 0) {
|
|
3685
|
+
return name;
|
|
3686
|
+
}
|
|
3687
|
+
const shown = details.slice(0, MAX_TOOL_NAME_CODEPOINT_DETAILS);
|
|
3688
|
+
const remaining = details.length - shown.length;
|
|
3689
|
+
const detailText = remaining > 0 ? `${shown.join("; ")}; and ${remaining} more` : shown.join("; ");
|
|
3690
|
+
return `"${name}" (contains ${detailText})`;
|
|
3652
3691
|
}
|
|
3653
3692
|
function describeRunningEvent(event) {
|
|
3654
3693
|
if (event.kind === "TOOL") {
|
|
@@ -4632,6 +4671,9 @@ function createToolFailureRule(options) {
|
|
|
4632
4671
|
}
|
|
4633
4672
|
};
|
|
4634
4673
|
}
|
|
4674
|
+
function recordsTokenUsage(event) {
|
|
4675
|
+
return Object.values(event.tokenUsage ?? {}).some((count) => typeof count === "number");
|
|
4676
|
+
}
|
|
4635
4677
|
function createLlmUsageRule(options) {
|
|
4636
4678
|
return {
|
|
4637
4679
|
id: "llm.usage",
|
|
@@ -4689,6 +4731,21 @@ function createLlmUsageRule(options) {
|
|
|
4689
4731
|
["total", options.maxTotalTokens],
|
|
4690
4732
|
["cached", options.maxCachedTokens]
|
|
4691
4733
|
];
|
|
4734
|
+
const hasTokenLimit = tokenLimits.some(([, limit]) => limit !== void 0);
|
|
4735
|
+
const callsWithoutUsage = llms.filter(
|
|
4736
|
+
(event) => event.status !== "error" && !recordsTokenUsage(event)
|
|
4737
|
+
);
|
|
4738
|
+
if (hasTokenLimit && callsWithoutUsage.length > 0) {
|
|
4739
|
+
findings.push(
|
|
4740
|
+
failFinding(
|
|
4741
|
+
"llm.usage",
|
|
4742
|
+
`No token usage was read for ${callsWithoutUsage.length} of ${llms.length} LLM call(s), so the token limit cannot be verified.`,
|
|
4743
|
+
callsWithoutUsage.map((event) => eventEvidence3(event, "tokenUsage")),
|
|
4744
|
+
"token usage on every completed LLM call",
|
|
4745
|
+
{ callsWithoutUsage: callsWithoutUsage.length, calls: llms.length }
|
|
4746
|
+
)
|
|
4747
|
+
);
|
|
4748
|
+
}
|
|
4692
4749
|
for (const [key, limit] of tokenLimits) {
|
|
4693
4750
|
if (limit !== void 0 && tokenTotals[key] > limit) {
|
|
4694
4751
|
findings.push(
|
|
@@ -5519,5 +5576,5 @@ function runTraceChecks(input, options = {}) {
|
|
|
5519
5576
|
}
|
|
5520
5577
|
|
|
5521
5578
|
export { buildTraceFacts, createBaselineRegressionRule, createDecisionRule, createGuardrailRule, createLlmUsageRule, createMaxStepDurationRule, createObservedOutcomeRule, createRequireCompletedRule, createRetrievalRule, createRunDepthRule, createRunDurationRule, createRunEventCountRule, createRunStatusRule, createSafetyOversizedAttributeRule, createSafetyRawContentRule, createSafetyRedactionRule, createSafetySecretPatternRule, createStallDetectionRule, createStepOrderingRule, createStructureCycleRule, createStructureIncompleteRule, createStructureOrphanRule, createStructureParallelWidthRule, createStructureRelationshipRule, createToolFailureRule, createToolOrderingRule, createToolUsageRule, defineTraceContract, deriveFailureFacts, deriveRelationshipFacts, evaluateToolArgumentValue, evaluateTraceContract, evaluateTraceContractRead, explainTraceContract, extractSessionWorkflowMetadata, extractToolArgumentPayload, lintTraceContract, resolveJsonPointer, resolveTraceContractScope, runTraceChecks, sessionKeyForRun, summarizeSemanticParity, workflowMetadataForRun };
|
|
5522
|
-
//# sourceMappingURL=chunk-
|
|
5523
|
-
//# sourceMappingURL=chunk-
|
|
5579
|
+
//# sourceMappingURL=chunk-KQX3Z4DH.mjs.map
|
|
5580
|
+
//# sourceMappingURL=chunk-KQX3Z4DH.mjs.map
|