@agent-inspect/mcp-server 6.31.16 → 6.31.18
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-ITYQ6FXK.mjs → chunk-X4QXIQSR.mjs} +63 -11
- package/dist/chunk-X4QXIQSR.mjs.map +1 -0
- package/dist/cli.cjs +61 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +61 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-ITYQ6FXK.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -218,7 +218,7 @@ var Redactor = class {
|
|
|
218
218
|
};
|
|
219
219
|
|
|
220
220
|
// packages/core/src/safety/credential-value-patterns.ts
|
|
221
|
-
var KEY_VALUE_SECRET_PATTERN = /\b(?:api[_-]?key|internal[_-]?token|access[_-]?token|auth[_-]?token|password|secret|token)=(?!\[(?:REDACTED
|
|
221
|
+
var KEY_VALUE_SECRET_PATTERN = /\b(?:api[_-]?key|internal[_-]?token|access[_-]?token|auth[_-]?token|password|secret|token)=(?!\[(?:REDACTED|HASH:(?:[0-9a-f]{8}|unknown))\](?![^\s"'\\&#?]))([^\s"'\\]{8,})/i;
|
|
222
222
|
var HIGH_CONFIDENCE_CREDENTIAL_PATTERNS = [
|
|
223
223
|
/^(?:basic|bearer|digest|apikey)\s+[a-z0-9._~+/=-]+$/i,
|
|
224
224
|
/\bbearer\s+[a-z0-9._~+/=-]{12,}\b/i,
|
|
@@ -3421,7 +3421,7 @@ var DEFAULT_SECRET_PATTERNS = [
|
|
|
3421
3421
|
// Keep in sync with packages/redact/src/key-value-secret.ts (KEY_VALUE_SECRET_PATTERN_SOURCE).
|
|
3422
3422
|
{
|
|
3423
3423
|
id: "key-value-secret",
|
|
3424
|
-
pattern: /\b(?:api[_-]?key|internal[_-]?token|access[_-]?token|auth[_-]?token|password|secret|token)=(?!\[(?:REDACTED
|
|
3424
|
+
pattern: /\b(?:api[_-]?key|internal[_-]?token|access[_-]?token|auth[_-]?token|password|secret|token)=(?!\[(?:REDACTED|HASH:(?:[0-9a-f]{8}|unknown))\](?![^\s"'\\&#?]))([^\s"'\\]{8,})/i
|
|
3425
3425
|
}
|
|
3426
3426
|
];
|
|
3427
3427
|
function compareStrings(a, b) {
|
|
@@ -3752,8 +3752,8 @@ function isFullyRedactedValue(value, markers = ["[REDACTED]", "[REDACTED:"]) {
|
|
|
3752
3752
|
if (typeof value !== "string") return false;
|
|
3753
3753
|
const trimmed = value.trim();
|
|
3754
3754
|
if (trimmed.length === 0) return false;
|
|
3755
|
-
if (
|
|
3756
|
-
if (/^\[
|
|
3755
|
+
if (trimmed === "[HASH:unknown]") return true;
|
|
3756
|
+
if (/^\[HASH:[0-9a-f]{8}\]$/.test(trimmed)) return true;
|
|
3757
3757
|
for (const marker of markers) {
|
|
3758
3758
|
if (marker.endsWith(":")) continue;
|
|
3759
3759
|
if (trimmed === marker) return true;
|
|
@@ -7592,6 +7592,51 @@ function genAiOperationName(kind) {
|
|
|
7592
7592
|
return void 0;
|
|
7593
7593
|
}
|
|
7594
7594
|
}
|
|
7595
|
+
var STRUCTURAL_IDENTITY_KEYS = [
|
|
7596
|
+
"operationId",
|
|
7597
|
+
"attemptId",
|
|
7598
|
+
"retryOf",
|
|
7599
|
+
"attemptNumber",
|
|
7600
|
+
"attempt"
|
|
7601
|
+
];
|
|
7602
|
+
function pickBoundedIdentityString(bag, key, maxLen) {
|
|
7603
|
+
if (!bag || typeof bag !== "object") return void 0;
|
|
7604
|
+
const direct = bag[key];
|
|
7605
|
+
if (typeof direct === "string" && direct.trim() !== "") {
|
|
7606
|
+
return direct.trim().slice(0, maxLen);
|
|
7607
|
+
}
|
|
7608
|
+
const nested = bag.metadata && typeof bag.metadata === "object" ? bag.metadata[key] : void 0;
|
|
7609
|
+
if (typeof nested === "string" && nested.trim() !== "") {
|
|
7610
|
+
return nested.trim().slice(0, maxLen);
|
|
7611
|
+
}
|
|
7612
|
+
return void 0;
|
|
7613
|
+
}
|
|
7614
|
+
function pickBoundedIdentityNumber(bag, key) {
|
|
7615
|
+
if (!bag || typeof bag !== "object") return void 0;
|
|
7616
|
+
const direct = bag[key];
|
|
7617
|
+
if (typeof direct === "number" && Number.isFinite(direct)) return direct;
|
|
7618
|
+
const nested = bag.metadata && typeof bag.metadata === "object" ? bag.metadata[key] : void 0;
|
|
7619
|
+
if (typeof nested === "number" && Number.isFinite(nested)) return nested;
|
|
7620
|
+
return void 0;
|
|
7621
|
+
}
|
|
7622
|
+
function appendStructuralIdentityAttrs(attrs2, meta, maxLen) {
|
|
7623
|
+
const operationId = pickBoundedIdentityString(meta, "operationId", maxLen);
|
|
7624
|
+
if (operationId !== void 0) {
|
|
7625
|
+
attrs2.push(stringAttr2("agent_inspect.operation_id", operationId));
|
|
7626
|
+
}
|
|
7627
|
+
const attemptId = pickBoundedIdentityString(meta, "attemptId", maxLen);
|
|
7628
|
+
if (attemptId !== void 0) {
|
|
7629
|
+
attrs2.push(stringAttr2("agent_inspect.attempt_id", attemptId));
|
|
7630
|
+
}
|
|
7631
|
+
const retryOf = pickBoundedIdentityString(meta, "retryOf", maxLen);
|
|
7632
|
+
if (retryOf !== void 0) {
|
|
7633
|
+
attrs2.push(stringAttr2("agent_inspect.retry_of", retryOf));
|
|
7634
|
+
}
|
|
7635
|
+
const attemptNumber = pickBoundedIdentityNumber(meta, "attemptNumber") ?? pickBoundedIdentityNumber(meta, "attempt");
|
|
7636
|
+
if (attemptNumber !== void 0) {
|
|
7637
|
+
attrs2.push(intAttr("agent_inspect.attempt_number", attemptNumber));
|
|
7638
|
+
}
|
|
7639
|
+
}
|
|
7595
7640
|
function resolveSpanTimes(ev) {
|
|
7596
7641
|
const startedAtMs = typeof ev.attributes?.startedAtMs === "number" && Number.isFinite(ev.attributes.startedAtMs) ? ev.attributes.startedAtMs : void 0;
|
|
7597
7642
|
const endedAtMs = typeof ev.attributes?.endedAtMs === "number" && Number.isFinite(ev.attributes.endedAtMs) ? ev.attributes.endedAtMs : void 0;
|
|
@@ -7612,7 +7657,8 @@ function exportOtlpJson(tree, options) {
|
|
|
7612
7657
|
const warnings = [
|
|
7613
7658
|
"OTLP JSON export uses OTel GenAI-aligned attributes where applicable; experimental until verified against specific collectors.",
|
|
7614
7659
|
"Not OTLP gRPC/protobuf \u2014 JSON mapping only. Generated locally; no network upload.",
|
|
7615
|
-
"Status and span kind use OTLP numeric enums (StatusCode 0/1/2, SpanKind INTERNAL=1)."
|
|
7660
|
+
"Status and span kind use OTLP numeric enums (StatusCode 0/1/2, SpanKind INTERNAL=1).",
|
|
7661
|
+
"When present on source events, operationId/attemptId/retryOf/attemptNumber are emitted as bounded agent_inspect.* identity attributes (not a broad attribute dump)."
|
|
7616
7662
|
];
|
|
7617
7663
|
const traceId = hexFrom2(`trace:${tree.runId}`, 16);
|
|
7618
7664
|
const includeAttributes = options?.includeAttributes ?? false;
|
|
@@ -7660,6 +7706,11 @@ function exportOtlpJson(tree, options) {
|
|
|
7660
7706
|
if (typeof inp === "number") attrs2.push(intAttr("gen_ai.usage.input_tokens", inp));
|
|
7661
7707
|
if (typeof outp === "number") attrs2.push(intAttr("gen_ai.usage.output_tokens", outp));
|
|
7662
7708
|
}
|
|
7709
|
+
appendStructuralIdentityAttrs(
|
|
7710
|
+
attrs2,
|
|
7711
|
+
meta && typeof meta === "object" ? meta : void 0,
|
|
7712
|
+
maxLen
|
|
7713
|
+
);
|
|
7663
7714
|
if (includeAttributes && meta && typeof meta === "object") {
|
|
7664
7715
|
const skipKeys = /* @__PURE__ */ new Set([
|
|
7665
7716
|
"tokens",
|
|
@@ -7668,7 +7719,8 @@ function exportOtlpJson(tree, options) {
|
|
|
7668
7719
|
"responseModel",
|
|
7669
7720
|
"responseModelId",
|
|
7670
7721
|
"provider",
|
|
7671
|
-
"originalSourceType"
|
|
7722
|
+
"originalSourceType",
|
|
7723
|
+
...STRUCTURAL_IDENTITY_KEYS
|
|
7672
7724
|
]);
|
|
7673
7725
|
for (const [k, v] of Object.entries(meta)) {
|
|
7674
7726
|
if (skipKeys.has(k)) continue;
|
|
@@ -7816,7 +7868,7 @@ function isCredentialSensitiveKey2(key, sensitiveKeys) {
|
|
|
7816
7868
|
}
|
|
7817
7869
|
|
|
7818
7870
|
// packages/redact/src/key-value-secret.ts
|
|
7819
|
-
var KEY_VALUE_SECRET_PATTERN_SOURCE = String.raw`\b(?:api[_-]?key|internal[_-]?token|access[_-]?token|auth[_-]?token|password|secret|token)=(?!\[(?:REDACTED
|
|
7871
|
+
var KEY_VALUE_SECRET_PATTERN_SOURCE = String.raw`\b(?:api[_-]?key|internal[_-]?token|access[_-]?token|auth[_-]?token|password|secret|token)=(?!\[(?:REDACTED|HASH:(?:[0-9a-f]{8}|unknown))\](?![^\s"'\\&#?]))([^\s"'\\]{8,})`;
|
|
7820
7872
|
var KEY_VALUE_SECRET_PATTERN2 = new RegExp(
|
|
7821
7873
|
KEY_VALUE_SECRET_PATTERN_SOURCE,
|
|
7822
7874
|
"i"
|
|
@@ -8273,8 +8325,8 @@ function isCompleteRedactionMarker(value, replacement = "[REDACTED]") {
|
|
|
8273
8325
|
const trimmed = value.trim();
|
|
8274
8326
|
if (trimmed.length === 0) return false;
|
|
8275
8327
|
if (trimmed === replacement) return true;
|
|
8276
|
-
if (
|
|
8277
|
-
if (/^\[
|
|
8328
|
+
if (trimmed === "[HASH:unknown]") return true;
|
|
8329
|
+
if (/^\[HASH:[0-9a-f]{8}\]$/.test(trimmed)) return true;
|
|
8278
8330
|
return false;
|
|
8279
8331
|
}
|
|
8280
8332
|
function applyRule(rule, value, replacement) {
|