@agent-inspect/mcp-server 6.31.32 → 6.31.34
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-RAPCVULK.mjs → chunk-LRBX7VWN.mjs} +88 -17
- package/dist/chunk-LRBX7VWN.mjs.map +1 -0
- package/dist/cli.cjs +86 -15
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +86 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-RAPCVULK.mjs.map +0 -1
package/dist/cli.cjs
CHANGED
|
@@ -226,8 +226,9 @@ var HIGH_CONFIDENCE_CREDENTIAL_PATTERNS = [
|
|
|
226
226
|
/\beyJ[a-zA-Z0-9_-]{8,}\.[a-zA-Z0-9_-]{8,}\.[a-zA-Z0-9_-]{8,}\b/,
|
|
227
227
|
/\b(?:sk-(?:proj-)?[a-zA-Z0-9_-]{16,}|sk-ant-[a-zA-Z0-9_-]{16,}|AIza[0-9A-Za-z_-]{20,})\b/,
|
|
228
228
|
// Stripe secret / restricted keys use underscores (not sk-). Keep in sync with
|
|
229
|
-
// packages/redact/src/index.ts + packages/core/src/checks DEFAULT_SECRET_PATTERNS (#520).
|
|
230
|
-
|
|
229
|
+
// packages/redact/src/index.ts + packages/core/src/checks DEFAULT_SECRET_PATTERNS (#520/#528).
|
|
230
|
+
// Use non-alnum lookarounds so underscore-adjacent forms (acct_sk_live_…, …_eu) match.
|
|
231
|
+
/(?<![A-Za-z0-9])(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}(?![A-Za-z0-9])/,
|
|
231
232
|
/\bxox[abposr]-[A-Za-z0-9-]{10,}\b/,
|
|
232
233
|
/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{20,}\b/,
|
|
233
234
|
/\b(?:AKIA|ASIA)[A-Z0-9]{16}\b/,
|
|
@@ -3425,10 +3426,11 @@ var SAFE_USAGE_LEAF_KEYS = /* @__PURE__ */ new Set([
|
|
|
3425
3426
|
var DEFAULT_SECRET_PATTERNS = [
|
|
3426
3427
|
{ id: "bearer-token", pattern: /Bearer\s+[A-Za-z0-9._~+/-]{12,}=*/ },
|
|
3427
3428
|
{ id: "openai-key", pattern: /sk-[A-Za-z0-9_-]{16,}/ },
|
|
3428
|
-
// Stripe + Slack: keep in sync with packages/redact + credential-value-patterns (#520).
|
|
3429
|
+
// Stripe + Slack: keep in sync with packages/redact + credential-value-patterns (#520/#528).
|
|
3430
|
+
// Non-alnum lookarounds so underscore-adjacent forms (acct_sk_live_…, …_eu) match.
|
|
3429
3431
|
{
|
|
3430
3432
|
id: "stripe-key",
|
|
3431
|
-
pattern:
|
|
3433
|
+
pattern: /(?<![A-Za-z0-9])(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}(?![A-Za-z0-9])/
|
|
3432
3434
|
},
|
|
3433
3435
|
{ id: "slack-token", pattern: /\bxox[abposr]-[A-Za-z0-9-]{10,}\b/ },
|
|
3434
3436
|
{ id: "aws-access-key", pattern: /AKIA[0-9A-Z]{16}/ },
|
|
@@ -3612,6 +3614,11 @@ function compareFindings(eventById) {
|
|
|
3612
3614
|
if (STATUS_RANK[a.status] !== STATUS_RANK[b.status]) {
|
|
3613
3615
|
return STATUS_RANK[a.status] - STATUS_RANK[b.status];
|
|
3614
3616
|
}
|
|
3617
|
+
if (a.ruleId === "tool.usage") {
|
|
3618
|
+
const aHasEvent = a.evidence[0]?.eventId !== void 0;
|
|
3619
|
+
const bHasEvent = b.evidence[0]?.eventId !== void 0;
|
|
3620
|
+
if (aHasEvent !== bHasEvent) return aHasEvent ? -1 : 1;
|
|
3621
|
+
}
|
|
3615
3622
|
const byRun = compareStrings(a.evidence[0]?.runId, b.evidence[0]?.runId);
|
|
3616
3623
|
if (byRun !== 0) return byRun;
|
|
3617
3624
|
const byTime = eventTimestamp(a, eventById).localeCompare(eventTimestamp(b, eventById));
|
|
@@ -3695,6 +3702,43 @@ function failFinding(ruleId, message, evidence, expected, actual, meta) {
|
|
|
3695
3702
|
...meta?.action !== void 0 ? { action: meta.action } : {}
|
|
3696
3703
|
};
|
|
3697
3704
|
}
|
|
3705
|
+
function formatToolNameForMessage(name) {
|
|
3706
|
+
const details = [];
|
|
3707
|
+
for (let index = 0; index < name.length; ) {
|
|
3708
|
+
const codePoint = name.codePointAt(index);
|
|
3709
|
+
const width = codePoint > 65535 ? 2 : 1;
|
|
3710
|
+
if (codePoint > 127) {
|
|
3711
|
+
details.push(
|
|
3712
|
+
`U+${codePoint.toString(16).toUpperCase().padStart(4, "0")} at index ${index}`
|
|
3713
|
+
);
|
|
3714
|
+
}
|
|
3715
|
+
index += width;
|
|
3716
|
+
}
|
|
3717
|
+
if (details.length === 0) return name;
|
|
3718
|
+
return `"${name}" (contains ${details.join("; ")})`;
|
|
3719
|
+
}
|
|
3720
|
+
function describeRunningEvent(event) {
|
|
3721
|
+
if (event.kind === "TOOL") {
|
|
3722
|
+
return `tool ${formatToolNameForMessage(resolveCanonicalToolName(event))}`;
|
|
3723
|
+
}
|
|
3724
|
+
if (event.kind === "LLM") {
|
|
3725
|
+
return `llm ${stepEndpointName(event)}`;
|
|
3726
|
+
}
|
|
3727
|
+
return `${event.kind} ${event.name}`;
|
|
3728
|
+
}
|
|
3729
|
+
function incompleteRunningMessage(prefix, running) {
|
|
3730
|
+
const labels = running.map(describeRunningEvent);
|
|
3731
|
+
if (labels.length === 1) {
|
|
3732
|
+
return `${prefix}: ${labels[0]} never completed.`;
|
|
3733
|
+
}
|
|
3734
|
+
return `${prefix}: ${labels.join("; ")}.`;
|
|
3735
|
+
}
|
|
3736
|
+
function stepEndpointName(event, kind) {
|
|
3737
|
+
for (const prefix of ["llm:", "generation:", "transcription:", "speech:"]) {
|
|
3738
|
+
if (event.name.startsWith(prefix)) return event.name.slice(prefix.length);
|
|
3739
|
+
}
|
|
3740
|
+
return event.name;
|
|
3741
|
+
}
|
|
3698
3742
|
function semanticEvents(context) {
|
|
3699
3743
|
return context.logicalEvents ?? context.events;
|
|
3700
3744
|
}
|
|
@@ -3823,10 +3867,13 @@ function createRunStatusRule(options = {}) {
|
|
|
3823
3867
|
findings.push(
|
|
3824
3868
|
failFinding(
|
|
3825
3869
|
"run.status",
|
|
3826
|
-
"Run contains incomplete running events
|
|
3870
|
+
incompleteRunningMessage("Run contains incomplete running events", running),
|
|
3827
3871
|
running.map((event) => eventEvidence(event)),
|
|
3828
3872
|
"no running events",
|
|
3829
|
-
|
|
3873
|
+
{
|
|
3874
|
+
count: running.length,
|
|
3875
|
+
unfinished: running.map(describeRunningEvent)
|
|
3876
|
+
}
|
|
3830
3877
|
)
|
|
3831
3878
|
);
|
|
3832
3879
|
}
|
|
@@ -7530,11 +7577,25 @@ function attemptIdOf(event) {
|
|
|
7530
7577
|
}
|
|
7531
7578
|
return void 0;
|
|
7532
7579
|
}
|
|
7580
|
+
function operationIdOf(event) {
|
|
7581
|
+
const direct = event.attributes?.operationId;
|
|
7582
|
+
if (typeof direct === "string" && direct.trim() !== "") return direct;
|
|
7583
|
+
const meta = event.attributes?.metadata;
|
|
7584
|
+
if (meta && typeof meta === "object" && !Array.isArray(meta)) {
|
|
7585
|
+
const nested = meta.operationId;
|
|
7586
|
+
if (typeof nested === "string" && nested.trim() !== "") return nested;
|
|
7587
|
+
}
|
|
7588
|
+
return void 0;
|
|
7589
|
+
}
|
|
7533
7590
|
function lifecycleKey(event) {
|
|
7534
7591
|
if (event.kind === "RUN") return `run:${event.runId}`;
|
|
7535
7592
|
const stepId = stepIdOf2(event);
|
|
7536
|
-
if (stepId
|
|
7537
|
-
|
|
7593
|
+
if (stepId === void 0) return `event:${event.eventId}`;
|
|
7594
|
+
const attemptId = attemptIdOf(event);
|
|
7595
|
+
if (attemptId !== void 0) return `step:${stepId}:attempt:${attemptId}`;
|
|
7596
|
+
const operationId = operationIdOf(event);
|
|
7597
|
+
if (operationId !== void 0) return `step:${stepId}:op:${operationId}`;
|
|
7598
|
+
return `step:${stepId}`;
|
|
7538
7599
|
}
|
|
7539
7600
|
function isTerminal(status) {
|
|
7540
7601
|
return status === "ok" || status === "error";
|
|
@@ -7585,6 +7646,12 @@ function joinSiblingGroup(group) {
|
|
|
7585
7646
|
const others = group.filter(
|
|
7586
7647
|
(n) => !isTerminal(n.event.status) && n.event.status !== "running"
|
|
7587
7648
|
);
|
|
7649
|
+
const operationIds = new Set(
|
|
7650
|
+
group.map((n) => operationIdOf(n.event)).filter((id) => id !== void 0)
|
|
7651
|
+
);
|
|
7652
|
+
if (operationIds.size > 1) {
|
|
7653
|
+
return group;
|
|
7654
|
+
}
|
|
7588
7655
|
const terminalStatuses = new Set(terminals.map((n) => n.event.status));
|
|
7589
7656
|
if (terminalStatuses.size > 1) {
|
|
7590
7657
|
return group;
|
|
@@ -7596,19 +7663,22 @@ function joinSiblingGroup(group) {
|
|
|
7596
7663
|
const out = [];
|
|
7597
7664
|
for (const terminal of terminals) {
|
|
7598
7665
|
const terminalAttempt = attemptIdOf(terminal.event);
|
|
7666
|
+
const terminalOp = operationIdOf(terminal.event);
|
|
7599
7667
|
const terminalTs = eventTime(terminal.event);
|
|
7600
|
-
const
|
|
7668
|
+
const candidates = runnings.filter((r) => {
|
|
7601
7669
|
if (usedRunning.has(r.event.eventId)) return false;
|
|
7602
7670
|
if (eventTime(r.event) > terminalTs) return false;
|
|
7671
|
+
const runningOp = operationIdOf(r.event);
|
|
7672
|
+
if (terminalOp !== void 0 && runningOp !== void 0 && terminalOp !== runningOp) {
|
|
7673
|
+
return false;
|
|
7674
|
+
}
|
|
7603
7675
|
const runningAttempt = attemptIdOf(r.event);
|
|
7604
7676
|
if (terminalAttempt !== void 0) {
|
|
7605
7677
|
return runningAttempt === terminalAttempt;
|
|
7606
7678
|
}
|
|
7607
|
-
|
|
7608
|
-
return true;
|
|
7609
|
-
}
|
|
7610
|
-
return true;
|
|
7679
|
+
return runningAttempt === void 0;
|
|
7611
7680
|
});
|
|
7681
|
+
const candidate = candidates.length === 1 ? candidates[0] : void 0;
|
|
7612
7682
|
if (candidate) {
|
|
7613
7683
|
usedRunning.add(candidate.event.eventId);
|
|
7614
7684
|
out.push(joinOnePair(candidate, terminal));
|
|
@@ -8781,10 +8851,11 @@ var credentialDetectors = [
|
|
|
8781
8851
|
severity: "error"
|
|
8782
8852
|
}),
|
|
8783
8853
|
// Stripe secret/restricted keys (underscore form). Keep in sync with
|
|
8784
|
-
// packages/core/src/safety/credential-value-patterns.ts + checks DEFAULT_SECRET_PATTERNS (#520).
|
|
8854
|
+
// packages/core/src/safety/credential-value-patterns.ts + checks DEFAULT_SECRET_PATTERNS (#520/#528).
|
|
8855
|
+
// Non-alnum lookarounds so underscore-adjacent forms (acct_sk_live_…, …_eu) match.
|
|
8785
8856
|
patternDetector({
|
|
8786
8857
|
id: "value.stripeSecretKey",
|
|
8787
|
-
pattern:
|
|
8858
|
+
pattern: /(?<![A-Za-z0-9])(?:sk|rk)_(?:live|test)_[A-Za-z0-9]{16,}(?![A-Za-z0-9])/,
|
|
8788
8859
|
severity: "error"
|
|
8789
8860
|
}),
|
|
8790
8861
|
patternDetector({
|