@agent-inspect/mcp-server 6.7.0 → 6.7.2
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/README.md +13 -3
- package/dist/index.cjs +41 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +40 -34
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import readline from 'readline';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
2
3
|
import path from 'path';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
3
5
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
4
6
|
import crypto from 'crypto';
|
|
5
7
|
import { readdir, stat, readFile } from 'fs/promises';
|
|
6
8
|
import os from 'os';
|
|
7
9
|
import 'nanoid';
|
|
8
10
|
import 'chalk';
|
|
9
|
-
import 'fs';
|
|
10
|
-
import 'url';
|
|
11
11
|
|
|
12
12
|
// packages/mcp-server/src/index.ts
|
|
13
13
|
|
|
@@ -2059,7 +2059,7 @@ function summarize(findings, diagnostics) {
|
|
|
2059
2059
|
errors: diagnostics.filter((item) => item.severity === "error").length
|
|
2060
2060
|
};
|
|
2061
2061
|
}
|
|
2062
|
-
function eventEvidence(event,
|
|
2062
|
+
function eventEvidence(event, path14) {
|
|
2063
2063
|
return {
|
|
2064
2064
|
runId: event.runId,
|
|
2065
2065
|
eventId: event.eventId,
|
|
@@ -2069,7 +2069,7 @@ function eventEvidence(event, path13) {
|
|
|
2069
2069
|
kind: event.kind,
|
|
2070
2070
|
name: event.name,
|
|
2071
2071
|
status: event.status,
|
|
2072
|
-
...
|
|
2072
|
+
...path14 ? { path: path14 } : {}
|
|
2073
2073
|
};
|
|
2074
2074
|
}
|
|
2075
2075
|
function runEvidence(run) {
|
|
@@ -2092,9 +2092,9 @@ function isRecord6(value) {
|
|
|
2092
2092
|
function normalizedKey(value) {
|
|
2093
2093
|
return value.toLowerCase().replace(/[^a-z0-9_]/g, "");
|
|
2094
2094
|
}
|
|
2095
|
-
function lastPathSegment(
|
|
2096
|
-
const parts =
|
|
2097
|
-
return parts[parts.length - 1] ??
|
|
2095
|
+
function lastPathSegment(path14) {
|
|
2096
|
+
const parts = path14.split(".");
|
|
2097
|
+
return parts[parts.length - 1] ?? path14;
|
|
2098
2098
|
}
|
|
2099
2099
|
function valueType(value) {
|
|
2100
2100
|
if (Array.isArray(value)) return "array";
|
|
@@ -2108,12 +2108,12 @@ function serializedByteLength(value) {
|
|
|
2108
2108
|
return void 0;
|
|
2109
2109
|
}
|
|
2110
2110
|
}
|
|
2111
|
-
function pushValueEntries(entries, event, value,
|
|
2112
|
-
entries.push({ event, path:
|
|
2111
|
+
function pushValueEntries(entries, event, value, path14, key, depth = 0) {
|
|
2112
|
+
entries.push({ event, path: path14, key, value });
|
|
2113
2113
|
if (depth >= 8) return;
|
|
2114
2114
|
if (Array.isArray(value)) {
|
|
2115
2115
|
for (const [index, item] of value.entries()) {
|
|
2116
|
-
pushValueEntries(entries, event, item, `${
|
|
2116
|
+
pushValueEntries(entries, event, item, `${path14}.${index}`, String(index), depth + 1);
|
|
2117
2117
|
}
|
|
2118
2118
|
return;
|
|
2119
2119
|
}
|
|
@@ -2123,7 +2123,7 @@ function pushValueEntries(entries, event, value, path13, key, depth = 0) {
|
|
|
2123
2123
|
entries,
|
|
2124
2124
|
event,
|
|
2125
2125
|
value[nestedKey],
|
|
2126
|
-
`${
|
|
2126
|
+
`${path14}.${nestedKey}`,
|
|
2127
2127
|
nestedKey,
|
|
2128
2128
|
depth + 1
|
|
2129
2129
|
);
|
|
@@ -4698,13 +4698,13 @@ function pairSteps(left, right) {
|
|
|
4698
4698
|
return pairs;
|
|
4699
4699
|
}
|
|
4700
4700
|
function compareLeafSteps(L, R, segments, opts, out) {
|
|
4701
|
-
const
|
|
4701
|
+
const path14 = buildPath(segments);
|
|
4702
4702
|
if (L.name !== R.name) {
|
|
4703
4703
|
out.push({
|
|
4704
4704
|
kind: "structure",
|
|
4705
4705
|
severity: "warning",
|
|
4706
4706
|
message: "Step name differs",
|
|
4707
|
-
path:
|
|
4707
|
+
path: path14,
|
|
4708
4708
|
left: L.name,
|
|
4709
4709
|
right: R.name
|
|
4710
4710
|
});
|
|
@@ -4714,7 +4714,7 @@ function compareLeafSteps(L, R, segments, opts, out) {
|
|
|
4714
4714
|
kind: "step-type",
|
|
4715
4715
|
severity: "warning",
|
|
4716
4716
|
message: "Step type differs",
|
|
4717
|
-
path:
|
|
4717
|
+
path: path14,
|
|
4718
4718
|
left: L.type,
|
|
4719
4719
|
right: R.type
|
|
4720
4720
|
});
|
|
@@ -4724,7 +4724,7 @@ function compareLeafSteps(L, R, segments, opts, out) {
|
|
|
4724
4724
|
kind: "step-status",
|
|
4725
4725
|
severity: "warning",
|
|
4726
4726
|
message: "Step status differs",
|
|
4727
|
-
path:
|
|
4727
|
+
path: path14,
|
|
4728
4728
|
left: L.status,
|
|
4729
4729
|
right: R.status
|
|
4730
4730
|
});
|
|
@@ -4736,7 +4736,7 @@ function compareLeafSteps(L, R, segments, opts, out) {
|
|
|
4736
4736
|
kind: "error",
|
|
4737
4737
|
severity: "error",
|
|
4738
4738
|
message: "Step error message differs",
|
|
4739
|
-
path:
|
|
4739
|
+
path: path14,
|
|
4740
4740
|
left: le || void 0,
|
|
4741
4741
|
right: re || void 0
|
|
4742
4742
|
});
|
|
@@ -4754,7 +4754,7 @@ function compareLeafSteps(L, R, segments, opts, out) {
|
|
|
4754
4754
|
kind: "duration",
|
|
4755
4755
|
severity: "info",
|
|
4756
4756
|
message: "Step duration differs",
|
|
4757
|
-
path:
|
|
4757
|
+
path: path14,
|
|
4758
4758
|
left: ld,
|
|
4759
4759
|
right: rd
|
|
4760
4760
|
});
|
|
@@ -4767,7 +4767,7 @@ function compareLeafSteps(L, R, segments, opts, out) {
|
|
|
4767
4767
|
kind: "metadata",
|
|
4768
4768
|
severity: "info",
|
|
4769
4769
|
message: "Step metadata differs",
|
|
4770
|
-
path:
|
|
4770
|
+
path: path14,
|
|
4771
4771
|
left: L.metadata,
|
|
4772
4772
|
right: R.metadata
|
|
4773
4773
|
});
|
|
@@ -4779,7 +4779,7 @@ function compareLeafSteps(L, R, segments, opts, out) {
|
|
|
4779
4779
|
kind: "output",
|
|
4780
4780
|
severity: "info",
|
|
4781
4781
|
message: "Output preview differs",
|
|
4782
|
-
path:
|
|
4782
|
+
path: path14,
|
|
4783
4783
|
left: L.outputPreview,
|
|
4784
4784
|
right: R.outputPreview
|
|
4785
4785
|
});
|
|
@@ -5861,17 +5861,17 @@ function applyRule(rule, value, replacement) {
|
|
|
5861
5861
|
}
|
|
5862
5862
|
return value;
|
|
5863
5863
|
}
|
|
5864
|
-
function childPath(
|
|
5864
|
+
function childPath(path14, key) {
|
|
5865
5865
|
if (/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key)) {
|
|
5866
|
-
return
|
|
5866
|
+
return path14 ? `${path14}.${key}` : key;
|
|
5867
5867
|
}
|
|
5868
|
-
return `${
|
|
5868
|
+
return `${path14 || "$"}[${JSON.stringify(key)}]`;
|
|
5869
5869
|
}
|
|
5870
|
-
function indexPath(
|
|
5871
|
-
return `${
|
|
5870
|
+
function indexPath(path14, index) {
|
|
5871
|
+
return `${path14 || "$"}[${index}]`;
|
|
5872
5872
|
}
|
|
5873
|
-
function makeFinding(
|
|
5874
|
-
return preview === void 0 ? { path:
|
|
5873
|
+
function makeFinding(path14, detector, action, matchKind, severity = "warning", preview) {
|
|
5874
|
+
return preview === void 0 ? { path: path14, detector, action, severity, matchKind } : { path: path14, detector, action, severity, matchKind, preview };
|
|
5875
5875
|
}
|
|
5876
5876
|
function createRedactionProfile(profile = "local") {
|
|
5877
5877
|
switch (profile) {
|
|
@@ -5940,11 +5940,11 @@ var Redactor2 = class {
|
|
|
5940
5940
|
#recordFinding(state, finding) {
|
|
5941
5941
|
if (this.#collectFindings) state.findings.push(finding);
|
|
5942
5942
|
}
|
|
5943
|
-
#redactValue(value, key,
|
|
5943
|
+
#redactValue(value, key, path14, depth, state) {
|
|
5944
5944
|
if (depth > this.#maxDepth) {
|
|
5945
5945
|
this.#recordFinding(
|
|
5946
5946
|
state,
|
|
5947
|
-
makeFinding(
|
|
5947
|
+
makeFinding(path14, "structure.maxDepth", "truncate", "value", "warning")
|
|
5948
5948
|
);
|
|
5949
5949
|
return "[Truncated]";
|
|
5950
5950
|
}
|
|
@@ -5953,19 +5953,19 @@ var Redactor2 = class {
|
|
|
5953
5953
|
if (rule) {
|
|
5954
5954
|
this.#recordFinding(
|
|
5955
5955
|
state,
|
|
5956
|
-
makeFinding(
|
|
5956
|
+
makeFinding(path14, `key.${rule.key}`, actionForRule(rule), "key", "warning")
|
|
5957
5957
|
);
|
|
5958
5958
|
return applyRule(rule, value, this.#replacement);
|
|
5959
5959
|
}
|
|
5960
5960
|
}
|
|
5961
5961
|
for (const detector of this.#detectors) {
|
|
5962
|
-
const detections = detector.detect({ path:
|
|
5962
|
+
const detections = detector.detect({ path: path14, key, value });
|
|
5963
5963
|
for (const detection of detections) {
|
|
5964
5964
|
const action = detection.action ?? "replace";
|
|
5965
5965
|
this.#recordFinding(
|
|
5966
5966
|
state,
|
|
5967
5967
|
makeFinding(
|
|
5968
|
-
|
|
5968
|
+
path14,
|
|
5969
5969
|
detector.id,
|
|
5970
5970
|
action,
|
|
5971
5971
|
detection.matchKind ?? detector.matchKind ?? "custom",
|
|
@@ -5983,7 +5983,7 @@ var Redactor2 = class {
|
|
|
5983
5983
|
const out = [];
|
|
5984
5984
|
state.seen.set(value, out);
|
|
5985
5985
|
value.forEach((item, index) => {
|
|
5986
|
-
out[index] = this.#redactValue(item, void 0, indexPath(
|
|
5986
|
+
out[index] = this.#redactValue(item, void 0, indexPath(path14, index), depth + 1, state);
|
|
5987
5987
|
});
|
|
5988
5988
|
return out;
|
|
5989
5989
|
}
|
|
@@ -5995,7 +5995,7 @@ var Redactor2 = class {
|
|
|
5995
5995
|
out[entryKey] = this.#redactValue(
|
|
5996
5996
|
entryValue,
|
|
5997
5997
|
entryKey,
|
|
5998
|
-
childPath(
|
|
5998
|
+
childPath(path14 === "$" ? "" : path14, entryKey),
|
|
5999
5999
|
depth + 1,
|
|
6000
6000
|
state
|
|
6001
6001
|
);
|
|
@@ -6431,6 +6431,12 @@ function createMcpServerContext(options = {}) {
|
|
|
6431
6431
|
}
|
|
6432
6432
|
|
|
6433
6433
|
// packages/mcp-server/src/index.ts
|
|
6434
|
+
var packageVersion = JSON.parse(
|
|
6435
|
+
readFileSync(
|
|
6436
|
+
path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "package.json"),
|
|
6437
|
+
"utf8"
|
|
6438
|
+
)
|
|
6439
|
+
).version;
|
|
6434
6440
|
async function runReadOnlyMcpServer(options = {}) {
|
|
6435
6441
|
const context = createMcpServerContext(options);
|
|
6436
6442
|
const input = options.input ?? process.stdin;
|
|
@@ -6473,7 +6479,7 @@ async function runReadOnlyMcpServer(options = {}) {
|
|
|
6473
6479
|
id,
|
|
6474
6480
|
result: {
|
|
6475
6481
|
protocolVersion: "2024-11-05",
|
|
6476
|
-
serverInfo: { name: "@agent-inspect/mcp-server", version:
|
|
6482
|
+
serverInfo: { name: "@agent-inspect/mcp-server", version: packageVersion },
|
|
6477
6483
|
capabilities: { tools: {} }
|
|
6478
6484
|
}
|
|
6479
6485
|
})
|