@agent-inspect/mcp-server 6.31.34 → 6.31.35
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/dist/{chunk-LRBX7VWN.mjs → chunk-4U73PORF.mjs} +46 -7
- package/dist/chunk-4U73PORF.mjs.map +1 -0
- package/dist/cli.cjs +44 -5
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +44 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-LRBX7VWN.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -3604,11 +3604,27 @@ function eventTimestamp(finding, eventById) {
|
|
|
3604
3604
|
const eventId = finding.evidence[0]?.eventId;
|
|
3605
3605
|
return eventId ? eventById.get(eventId)?.timestamp ?? "" : "";
|
|
3606
3606
|
}
|
|
3607
|
+
function isObservedToolPolicyFinding(finding) {
|
|
3608
|
+
return finding.ruleId === "tool.usage" && finding.evidence[0]?.eventId !== void 0;
|
|
3609
|
+
}
|
|
3610
|
+
function isMissingToolConsequenceFinding(finding) {
|
|
3611
|
+
if (finding.evidence[0]?.eventId !== void 0) return false;
|
|
3612
|
+
if (finding.ruleId === "tool.usage" && /did not appear/.test(finding.message)) {
|
|
3613
|
+
return true;
|
|
3614
|
+
}
|
|
3615
|
+
return finding.ruleId.startsWith("contract.tool.arguments") && /^No finished tool named /.test(finding.message);
|
|
3616
|
+
}
|
|
3607
3617
|
function compareFindings(eventById) {
|
|
3608
3618
|
return (a, b) => {
|
|
3609
3619
|
if (SEVERITY_RANK[a.severity] !== SEVERITY_RANK[b.severity]) {
|
|
3610
3620
|
return SEVERITY_RANK[a.severity] - SEVERITY_RANK[b.severity];
|
|
3611
3621
|
}
|
|
3622
|
+
const aPolicy = isObservedToolPolicyFinding(a);
|
|
3623
|
+
const bPolicy = isObservedToolPolicyFinding(b);
|
|
3624
|
+
const aMissing = isMissingToolConsequenceFinding(a);
|
|
3625
|
+
const bMissing = isMissingToolConsequenceFinding(b);
|
|
3626
|
+
if (aPolicy && bMissing) return -1;
|
|
3627
|
+
if (bPolicy && aMissing) return 1;
|
|
3612
3628
|
const byRule = a.ruleId.localeCompare(b.ruleId);
|
|
3613
3629
|
if (byRule !== 0) return byRule;
|
|
3614
3630
|
if (STATUS_RANK[a.status] !== STATUS_RANK[b.status]) {
|
|
@@ -3702,20 +3718,43 @@ function failFinding(ruleId, message, evidence, expected, actual, meta) {
|
|
|
3702
3718
|
...meta?.action !== void 0 ? { action: meta.action } : {}
|
|
3703
3719
|
};
|
|
3704
3720
|
}
|
|
3721
|
+
var MAX_TOOL_NAME_CODEPOINT_DETAILS = 3;
|
|
3722
|
+
function isAsciiLetterCodePoint(codePoint) {
|
|
3723
|
+
return codePoint >= 65 && codePoint <= 90 || codePoint >= 97 && codePoint <= 122;
|
|
3724
|
+
}
|
|
3725
|
+
function isRiskyToolNameCodePoint(codePoint) {
|
|
3726
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) return true;
|
|
3727
|
+
return codePoint === 1564 || codePoint === 8203 || codePoint === 8204 || codePoint === 8205 || codePoint === 8206 || codePoint === 8207 || codePoint >= 8234 && codePoint <= 8238 || codePoint >= 8294 && codePoint <= 8297 || codePoint === 65279;
|
|
3728
|
+
}
|
|
3729
|
+
function formatCodePointDetail(codePoint, index) {
|
|
3730
|
+
return `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")} at index ${index}`;
|
|
3731
|
+
}
|
|
3705
3732
|
function formatToolNameForMessage(name) {
|
|
3733
|
+
let hasAsciiLetter = false;
|
|
3734
|
+
let hasNonAscii = false;
|
|
3735
|
+
let hasRisky = false;
|
|
3706
3736
|
const details = [];
|
|
3707
3737
|
for (let index = 0; index < name.length; ) {
|
|
3708
3738
|
const codePoint = name.codePointAt(index);
|
|
3709
3739
|
const width = codePoint > 65535 ? 2 : 1;
|
|
3740
|
+
if (isAsciiLetterCodePoint(codePoint)) hasAsciiLetter = true;
|
|
3741
|
+
const risky = isRiskyToolNameCodePoint(codePoint);
|
|
3742
|
+
if (risky) hasRisky = true;
|
|
3710
3743
|
if (codePoint > 127) {
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3744
|
+
hasNonAscii = true;
|
|
3745
|
+
details.push(formatCodePointDetail(codePoint, index));
|
|
3746
|
+
} else if (risky) {
|
|
3747
|
+
details.push(formatCodePointDetail(codePoint, index));
|
|
3714
3748
|
}
|
|
3715
3749
|
index += width;
|
|
3716
3750
|
}
|
|
3717
|
-
if (details.length === 0)
|
|
3718
|
-
|
|
3751
|
+
if (!hasRisky && !(hasAsciiLetter && hasNonAscii) || details.length === 0) {
|
|
3752
|
+
return name;
|
|
3753
|
+
}
|
|
3754
|
+
const shown = details.slice(0, MAX_TOOL_NAME_CODEPOINT_DETAILS);
|
|
3755
|
+
const remaining = details.length - shown.length;
|
|
3756
|
+
const detailText = remaining > 0 ? `${shown.join("; ")}; and ${remaining} more` : shown.join("; ");
|
|
3757
|
+
return `"${name}" (contains ${detailText})`;
|
|
3719
3758
|
}
|
|
3720
3759
|
function describeRunningEvent(event) {
|
|
3721
3760
|
if (event.kind === "TOOL") {
|