@agent-inspect/mcp-server 6.17.4 → 6.17.5
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-PPA3VJQG.mjs → chunk-GMXH2CU3.mjs} +56 -12
- package/dist/chunk-GMXH2CU3.mjs.map +1 -0
- package/dist/cli.cjs +54 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +54 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-PPA3VJQG.mjs.map +0 -1
|
@@ -3173,10 +3173,11 @@ function emptySummary() {
|
|
|
3173
3173
|
passed: 0,
|
|
3174
3174
|
failed: 0,
|
|
3175
3175
|
warnings: 0,
|
|
3176
|
-
errors: 0
|
|
3176
|
+
errors: 0,
|
|
3177
|
+
rulesEvaluated: 0
|
|
3177
3178
|
};
|
|
3178
3179
|
}
|
|
3179
|
-
function errorResult(input, diagnostics, selectedRun) {
|
|
3180
|
+
function errorResult(input, diagnostics, selectedRun, ruleExecutions = []) {
|
|
3180
3181
|
return {
|
|
3181
3182
|
ok: false,
|
|
3182
3183
|
status: "error",
|
|
@@ -3184,10 +3185,12 @@ function errorResult(input, diagnostics, selectedRun) {
|
|
|
3184
3185
|
...selectedRun ? { runId: selectedRun.runId } : {},
|
|
3185
3186
|
summary: {
|
|
3186
3187
|
...emptySummary(),
|
|
3187
|
-
errors: diagnostics.filter((item) => item.severity === "error").length
|
|
3188
|
+
errors: diagnostics.filter((item) => item.severity === "error").length,
|
|
3189
|
+
rulesEvaluated: ruleExecutions.length
|
|
3188
3190
|
},
|
|
3189
3191
|
findings: [],
|
|
3190
|
-
diagnostics: [...diagnostics]
|
|
3192
|
+
diagnostics: [...diagnostics],
|
|
3193
|
+
ruleExecutions: [...ruleExecutions]
|
|
3191
3194
|
};
|
|
3192
3195
|
}
|
|
3193
3196
|
function flattenNodes(nodes) {
|
|
@@ -3343,7 +3346,7 @@ function normalizeFinding(rule, finding) {
|
|
|
3343
3346
|
...finding.action !== void 0 ? { action: finding.action } : {}
|
|
3344
3347
|
};
|
|
3345
3348
|
}
|
|
3346
|
-
function summarize(findings, diagnostics) {
|
|
3349
|
+
function summarize(findings, diagnostics, rulesEvaluated) {
|
|
3347
3350
|
return {
|
|
3348
3351
|
passed: findings.filter((finding) => finding.status === "pass").length,
|
|
3349
3352
|
failed: findings.filter(
|
|
@@ -3352,9 +3355,21 @@ function summarize(findings, diagnostics) {
|
|
|
3352
3355
|
warnings: findings.filter(
|
|
3353
3356
|
(finding) => finding.status === "warning" || finding.severity === "warning"
|
|
3354
3357
|
).length,
|
|
3355
|
-
errors: diagnostics.filter((item) => item.severity === "error").length
|
|
3358
|
+
errors: diagnostics.filter((item) => item.severity === "error").length,
|
|
3359
|
+
rulesEvaluated
|
|
3356
3360
|
};
|
|
3357
3361
|
}
|
|
3362
|
+
function classifyRuleExecution(findings, threw) {
|
|
3363
|
+
if (findings.some((finding) => finding.status === "fail" && finding.severity === "error")) {
|
|
3364
|
+
return "fail";
|
|
3365
|
+
}
|
|
3366
|
+
if (findings.some(
|
|
3367
|
+
(finding) => finding.status === "warning" || finding.severity === "warning"
|
|
3368
|
+
)) {
|
|
3369
|
+
return "warning";
|
|
3370
|
+
}
|
|
3371
|
+
return "pass";
|
|
3372
|
+
}
|
|
3358
3373
|
function eventEvidence(event, path16) {
|
|
3359
3374
|
return {
|
|
3360
3375
|
runId: event.runId,
|
|
@@ -3720,6 +3735,18 @@ function runTraceChecks(input, options = {}) {
|
|
|
3720
3735
|
if (rules.diagnostics.length > 0) {
|
|
3721
3736
|
return errorResult(input, rules.diagnostics, selected.run);
|
|
3722
3737
|
}
|
|
3738
|
+
if (rules.rules.length === 0) {
|
|
3739
|
+
return errorResult(
|
|
3740
|
+
input,
|
|
3741
|
+
[
|
|
3742
|
+
diagnostic(
|
|
3743
|
+
"AI_CHECK_NO_RULES_EVALUATED",
|
|
3744
|
+
"No trace check rules were evaluated. Configure at least one rule, contract, or CLI check option."
|
|
3745
|
+
)
|
|
3746
|
+
],
|
|
3747
|
+
selected.run
|
|
3748
|
+
);
|
|
3749
|
+
}
|
|
3723
3750
|
const facts = buildFacts(input, selected.run);
|
|
3724
3751
|
const context = {
|
|
3725
3752
|
...facts,
|
|
@@ -3728,22 +3755,38 @@ function runTraceChecks(input, options = {}) {
|
|
|
3728
3755
|
};
|
|
3729
3756
|
const diagnostics = [];
|
|
3730
3757
|
const findings = [];
|
|
3758
|
+
const ruleExecutions = [];
|
|
3731
3759
|
for (const rule of rules.rules) {
|
|
3732
3760
|
try {
|
|
3733
|
-
|
|
3761
|
+
const ruleFindings = rule.evaluate(context).map((finding) => normalizeFinding(rule, finding));
|
|
3762
|
+
findings.push(...ruleFindings);
|
|
3763
|
+
ruleExecutions.push({
|
|
3764
|
+
ruleId: rule.id,
|
|
3765
|
+
category: rule.category,
|
|
3766
|
+
status: classifyRuleExecution(ruleFindings, false),
|
|
3767
|
+
findingCount: ruleFindings.length,
|
|
3768
|
+
...selected.run ? { runId: selected.run.runId } : {}
|
|
3769
|
+
});
|
|
3734
3770
|
} catch (error) {
|
|
3735
3771
|
const message = error instanceof Error ? error.message : String(error);
|
|
3736
3772
|
diagnostics.push(
|
|
3737
3773
|
diagnostic("AI_CHECK_INTERNAL_ERROR", `Rule ${rule.id} failed: ${message}`, rule.id)
|
|
3738
3774
|
);
|
|
3775
|
+
ruleExecutions.push({
|
|
3776
|
+
ruleId: rule.id,
|
|
3777
|
+
category: rule.category,
|
|
3778
|
+
status: "error",
|
|
3779
|
+
findingCount: 0,
|
|
3780
|
+
...selected.run ? { runId: selected.run.runId } : {}
|
|
3781
|
+
});
|
|
3739
3782
|
}
|
|
3740
3783
|
}
|
|
3741
3784
|
if (diagnostics.length > 0) {
|
|
3742
|
-
return errorResult(input, diagnostics, selected.run);
|
|
3785
|
+
return errorResult(input, diagnostics, selected.run, ruleExecutions);
|
|
3743
3786
|
}
|
|
3744
3787
|
const eventById = new Map(input.read.events.map((event) => [event.eventId, event]));
|
|
3745
3788
|
const sortedFindings = findings.sort(compareFindings(eventById));
|
|
3746
|
-
const summary = summarize(sortedFindings, diagnostics);
|
|
3789
|
+
const summary = summarize(sortedFindings, diagnostics, ruleExecutions.length);
|
|
3747
3790
|
const status = summary.failed > 0 ? "fail" : "pass";
|
|
3748
3791
|
return {
|
|
3749
3792
|
ok: status === "pass",
|
|
@@ -3752,7 +3795,8 @@ function runTraceChecks(input, options = {}) {
|
|
|
3752
3795
|
...selected.run ? { runId: selected.run.runId } : {},
|
|
3753
3796
|
summary,
|
|
3754
3797
|
findings: sortedFindings,
|
|
3755
|
-
diagnostics
|
|
3798
|
+
diagnostics,
|
|
3799
|
+
ruleExecutions
|
|
3756
3800
|
};
|
|
3757
3801
|
}
|
|
3758
3802
|
|
|
@@ -7959,5 +8003,5 @@ async function runReadOnlyMcpServer(options = {}) {
|
|
|
7959
8003
|
}
|
|
7960
8004
|
|
|
7961
8005
|
export { MCP_MAX_REQUEST_BYTES, MCP_PROTOCOL_VERSION, READ_ONLY_TOOLS, callReadOnlyTool, createMcpServerContext, handleMcpProtocolLine, runReadOnlyMcpServer };
|
|
7962
|
-
//# sourceMappingURL=chunk-
|
|
7963
|
-
//# sourceMappingURL=chunk-
|
|
8006
|
+
//# sourceMappingURL=chunk-GMXH2CU3.mjs.map
|
|
8007
|
+
//# sourceMappingURL=chunk-GMXH2CU3.mjs.map
|