agent-inspect 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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/docs/LIMITATIONS.md +22 -0
- package/docs/SAFE-TRACE-SHARING.md +1 -1
- package/package.json +1 -1
- package/packages/cli/dist/{chunk-6TXW53UR.mjs → chunk-RLFYFWIZ.mjs} +46 -7
- package/packages/cli/dist/chunk-RLFYFWIZ.mjs.map +1 -0
- package/packages/cli/dist/index.cjs +46 -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-S23RCPL2.mjs} +3 -3
- package/packages/cli/dist/{src-GCLC4DIC.mjs.map → src-S23RCPL2.mjs.map} +1 -1
- package/packages/core/dist/advanced.cjs +44 -5
- package/packages/core/dist/advanced.cjs.map +1 -1
- package/packages/core/dist/advanced.mjs +2 -2
- package/packages/core/dist/checks.cjs +44 -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-3OMB34E6.mjs} +46 -7
- package/packages/core/dist/chunk-3OMB34E6.mjs.map +1 -0
- package/packages/cli/dist/chunk-6TXW53UR.mjs.map +0 -1
- package/packages/core/dist/chunk-CXC7L4PY.mjs.map +0 -1
|
@@ -5729,11 +5729,27 @@ function eventTimestamp(finding, eventById) {
|
|
|
5729
5729
|
const eventId = finding.evidence[0]?.eventId;
|
|
5730
5730
|
return eventId ? eventById.get(eventId)?.timestamp ?? "" : "";
|
|
5731
5731
|
}
|
|
5732
|
+
function isObservedToolPolicyFinding(finding) {
|
|
5733
|
+
return finding.ruleId === "tool.usage" && finding.evidence[0]?.eventId !== void 0;
|
|
5734
|
+
}
|
|
5735
|
+
function isMissingToolConsequenceFinding(finding) {
|
|
5736
|
+
if (finding.evidence[0]?.eventId !== void 0) return false;
|
|
5737
|
+
if (finding.ruleId === "tool.usage" && /did not appear/.test(finding.message)) {
|
|
5738
|
+
return true;
|
|
5739
|
+
}
|
|
5740
|
+
return finding.ruleId.startsWith("contract.tool.arguments") && /^No finished tool named /.test(finding.message);
|
|
5741
|
+
}
|
|
5732
5742
|
function compareFindings(eventById) {
|
|
5733
5743
|
return (a, b) => {
|
|
5734
5744
|
if (SEVERITY_RANK[a.severity] !== SEVERITY_RANK[b.severity]) {
|
|
5735
5745
|
return SEVERITY_RANK[a.severity] - SEVERITY_RANK[b.severity];
|
|
5736
5746
|
}
|
|
5747
|
+
const aPolicy = isObservedToolPolicyFinding(a);
|
|
5748
|
+
const bPolicy = isObservedToolPolicyFinding(b);
|
|
5749
|
+
const aMissing = isMissingToolConsequenceFinding(a);
|
|
5750
|
+
const bMissing = isMissingToolConsequenceFinding(b);
|
|
5751
|
+
if (aPolicy && bMissing) return -1;
|
|
5752
|
+
if (bPolicy && aMissing) return 1;
|
|
5737
5753
|
const byRule = a.ruleId.localeCompare(b.ruleId);
|
|
5738
5754
|
if (byRule !== 0) return byRule;
|
|
5739
5755
|
if (STATUS_RANK[a.status] !== STATUS_RANK[b.status]) {
|
|
@@ -5869,20 +5885,42 @@ function failFinding(ruleId, message, evidence, expected, actual, meta2) {
|
|
|
5869
5885
|
function toolName(event) {
|
|
5870
5886
|
return resolveCanonicalToolName(event);
|
|
5871
5887
|
}
|
|
5888
|
+
function isAsciiLetterCodePoint(codePoint) {
|
|
5889
|
+
return codePoint >= 65 && codePoint <= 90 || codePoint >= 97 && codePoint <= 122;
|
|
5890
|
+
}
|
|
5891
|
+
function isRiskyToolNameCodePoint(codePoint) {
|
|
5892
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) return true;
|
|
5893
|
+
return codePoint === 1564 || codePoint === 8203 || codePoint === 8204 || codePoint === 8205 || codePoint === 8206 || codePoint === 8207 || codePoint >= 8234 && codePoint <= 8238 || codePoint >= 8294 && codePoint <= 8297 || codePoint === 65279;
|
|
5894
|
+
}
|
|
5895
|
+
function formatCodePointDetail(codePoint, index) {
|
|
5896
|
+
return `U+${codePoint.toString(16).toUpperCase().padStart(4, "0")} at index ${index}`;
|
|
5897
|
+
}
|
|
5872
5898
|
function formatToolNameForMessage(name) {
|
|
5899
|
+
let hasAsciiLetter = false;
|
|
5900
|
+
let hasNonAscii = false;
|
|
5901
|
+
let hasRisky = false;
|
|
5873
5902
|
const details = [];
|
|
5874
5903
|
for (let index = 0; index < name.length; ) {
|
|
5875
5904
|
const codePoint = name.codePointAt(index);
|
|
5876
5905
|
const width = codePoint > 65535 ? 2 : 1;
|
|
5906
|
+
if (isAsciiLetterCodePoint(codePoint)) hasAsciiLetter = true;
|
|
5907
|
+
const risky = isRiskyToolNameCodePoint(codePoint);
|
|
5908
|
+
if (risky) hasRisky = true;
|
|
5877
5909
|
if (codePoint > 127) {
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5910
|
+
hasNonAscii = true;
|
|
5911
|
+
details.push(formatCodePointDetail(codePoint, index));
|
|
5912
|
+
} else if (risky) {
|
|
5913
|
+
details.push(formatCodePointDetail(codePoint, index));
|
|
5881
5914
|
}
|
|
5882
5915
|
index += width;
|
|
5883
5916
|
}
|
|
5884
|
-
if (details.length === 0)
|
|
5885
|
-
|
|
5917
|
+
if (!hasRisky && !(hasAsciiLetter && hasNonAscii) || details.length === 0) {
|
|
5918
|
+
return name;
|
|
5919
|
+
}
|
|
5920
|
+
const shown = details.slice(0, MAX_TOOL_NAME_CODEPOINT_DETAILS);
|
|
5921
|
+
const remaining = details.length - shown.length;
|
|
5922
|
+
const detailText = remaining > 0 ? `${shown.join("; ")}; and ${remaining} more` : shown.join("; ");
|
|
5923
|
+
return `"${name}" (contains ${detailText})`;
|
|
5886
5924
|
}
|
|
5887
5925
|
function describeRunningEvent(event) {
|
|
5888
5926
|
if (event.kind === "TOOL") {
|
|
@@ -7609,7 +7647,7 @@ function runTraceChecks(input3, options = {}) {
|
|
|
7609
7647
|
ruleExecutions
|
|
7610
7648
|
};
|
|
7611
7649
|
}
|
|
7612
|
-
var SEVERITY_RANK, STATUS_RANK, CONFIDENCE_RANK, DEFAULT_SENSITIVE_KEYS, DEFAULT_RAW_CONTENT_KEYS, DEFAULT_SAFE_RAW_CONTENT_PATH_PREFIXES, SAFE_USAGE_LEAF_KEYS, DEFAULT_SECRET_PATTERNS;
|
|
7650
|
+
var SEVERITY_RANK, STATUS_RANK, CONFIDENCE_RANK, DEFAULT_SENSITIVE_KEYS, DEFAULT_RAW_CONTENT_KEYS, DEFAULT_SAFE_RAW_CONTENT_PATH_PREFIXES, SAFE_USAGE_LEAF_KEYS, DEFAULT_SECRET_PATTERNS, MAX_TOOL_NAME_CODEPOINT_DETAILS;
|
|
7613
7651
|
var init_checks2 = __esm({
|
|
7614
7652
|
"packages/core/src/checks/index.ts"() {
|
|
7615
7653
|
init_inspect_event();
|
|
@@ -7713,6 +7751,7 @@ var init_checks2 = __esm({
|
|
|
7713
7751
|
pattern: /\b(?:api[_-]?key|internal[_-]?token|access[_-]?token|auth[_-]?token|password|secret|token)=(?!\[(?:REDACTED|HASH:(?:[0-9a-f]{8}|unknown))\](?![^\s"'\\&#?]))([^\s"'\\]{8,})/i
|
|
7714
7752
|
}
|
|
7715
7753
|
];
|
|
7754
|
+
MAX_TOOL_NAME_CODEPOINT_DETAILS = 3;
|
|
7716
7755
|
}
|
|
7717
7756
|
});
|
|
7718
7757
|
|
|
@@ -17479,7 +17518,7 @@ var init_src = __esm({
|
|
|
17479
17518
|
});
|
|
17480
17519
|
|
|
17481
17520
|
// package.json
|
|
17482
|
-
var version = "6.31.
|
|
17521
|
+
var version = "6.31.35";
|
|
17483
17522
|
|
|
17484
17523
|
// packages/cli/src/list.ts
|
|
17485
17524
|
init_advanced();
|