@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.
@@ -208,7 +208,7 @@ var Redactor = class {
208
208
  };
209
209
 
210
210
  // packages/core/src/safety/credential-value-patterns.ts
211
- var KEY_VALUE_SECRET_PATTERN = /\b(?:api[_-]?key|internal[_-]?token|access[_-]?token|auth[_-]?token|password|secret|token)=(?!\[(?:REDACTED(?::[^\]]*)?|HASH:[0-9a-f]{8})\](?![^\s"'\\&#?]))([^\s"'\\]{8,})/i;
211
+ 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;
212
212
  var HIGH_CONFIDENCE_CREDENTIAL_PATTERNS = [
213
213
  /^(?:basic|bearer|digest|apikey)\s+[a-z0-9._~+/=-]+$/i,
214
214
  /\bbearer\s+[a-z0-9._~+/=-]{12,}\b/i,
@@ -3411,7 +3411,7 @@ var DEFAULT_SECRET_PATTERNS = [
3411
3411
  // Keep in sync with packages/redact/src/key-value-secret.ts (KEY_VALUE_SECRET_PATTERN_SOURCE).
3412
3412
  {
3413
3413
  id: "key-value-secret",
3414
- pattern: /\b(?:api[_-]?key|internal[_-]?token|access[_-]?token|auth[_-]?token|password|secret|token)=(?!\[(?:REDACTED(?::[^\]]*)?|HASH:[0-9a-f]{8})\](?![^\s"'\\&#?]))([^\s"'\\]{8,})/i
3414
+ pattern: /\b(?:api[_-]?key|internal[_-]?token|access[_-]?token|auth[_-]?token|password|secret|token)=(?!\[(?:REDACTED|HASH:(?:[0-9a-f]{8}|unknown))\](?![^\s"'\\&#?]))([^\s"'\\]{8,})/i
3415
3415
  }
3416
3416
  ];
3417
3417
  function compareStrings(a, b) {
@@ -3742,8 +3742,8 @@ function isFullyRedactedValue(value, markers = ["[REDACTED]", "[REDACTED:"]) {
3742
3742
  if (typeof value !== "string") return false;
3743
3743
  const trimmed = value.trim();
3744
3744
  if (trimmed.length === 0) return false;
3745
- if (/^\[HASH:[A-Za-z0-9_-]+\]$/.test(trimmed)) return true;
3746
- if (/^\[REDACTED:[^\]]*\]$/.test(trimmed)) return true;
3745
+ if (trimmed === "[HASH:unknown]") return true;
3746
+ if (/^\[HASH:[0-9a-f]{8}\]$/.test(trimmed)) return true;
3747
3747
  for (const marker of markers) {
3748
3748
  if (marker.endsWith(":")) continue;
3749
3749
  if (trimmed === marker) return true;
@@ -7582,6 +7582,51 @@ function genAiOperationName(kind) {
7582
7582
  return void 0;
7583
7583
  }
7584
7584
  }
7585
+ var STRUCTURAL_IDENTITY_KEYS = [
7586
+ "operationId",
7587
+ "attemptId",
7588
+ "retryOf",
7589
+ "attemptNumber",
7590
+ "attempt"
7591
+ ];
7592
+ function pickBoundedIdentityString(bag, key, maxLen) {
7593
+ if (!bag || typeof bag !== "object") return void 0;
7594
+ const direct = bag[key];
7595
+ if (typeof direct === "string" && direct.trim() !== "") {
7596
+ return direct.trim().slice(0, maxLen);
7597
+ }
7598
+ const nested = bag.metadata && typeof bag.metadata === "object" ? bag.metadata[key] : void 0;
7599
+ if (typeof nested === "string" && nested.trim() !== "") {
7600
+ return nested.trim().slice(0, maxLen);
7601
+ }
7602
+ return void 0;
7603
+ }
7604
+ function pickBoundedIdentityNumber(bag, key) {
7605
+ if (!bag || typeof bag !== "object") return void 0;
7606
+ const direct = bag[key];
7607
+ if (typeof direct === "number" && Number.isFinite(direct)) return direct;
7608
+ const nested = bag.metadata && typeof bag.metadata === "object" ? bag.metadata[key] : void 0;
7609
+ if (typeof nested === "number" && Number.isFinite(nested)) return nested;
7610
+ return void 0;
7611
+ }
7612
+ function appendStructuralIdentityAttrs(attrs2, meta, maxLen) {
7613
+ const operationId = pickBoundedIdentityString(meta, "operationId", maxLen);
7614
+ if (operationId !== void 0) {
7615
+ attrs2.push(stringAttr2("agent_inspect.operation_id", operationId));
7616
+ }
7617
+ const attemptId = pickBoundedIdentityString(meta, "attemptId", maxLen);
7618
+ if (attemptId !== void 0) {
7619
+ attrs2.push(stringAttr2("agent_inspect.attempt_id", attemptId));
7620
+ }
7621
+ const retryOf = pickBoundedIdentityString(meta, "retryOf", maxLen);
7622
+ if (retryOf !== void 0) {
7623
+ attrs2.push(stringAttr2("agent_inspect.retry_of", retryOf));
7624
+ }
7625
+ const attemptNumber = pickBoundedIdentityNumber(meta, "attemptNumber") ?? pickBoundedIdentityNumber(meta, "attempt");
7626
+ if (attemptNumber !== void 0) {
7627
+ attrs2.push(intAttr("agent_inspect.attempt_number", attemptNumber));
7628
+ }
7629
+ }
7585
7630
  function resolveSpanTimes(ev) {
7586
7631
  const startedAtMs = typeof ev.attributes?.startedAtMs === "number" && Number.isFinite(ev.attributes.startedAtMs) ? ev.attributes.startedAtMs : void 0;
7587
7632
  const endedAtMs = typeof ev.attributes?.endedAtMs === "number" && Number.isFinite(ev.attributes.endedAtMs) ? ev.attributes.endedAtMs : void 0;
@@ -7602,7 +7647,8 @@ function exportOtlpJson(tree, options) {
7602
7647
  const warnings = [
7603
7648
  "OTLP JSON export uses OTel GenAI-aligned attributes where applicable; experimental until verified against specific collectors.",
7604
7649
  "Not OTLP gRPC/protobuf \u2014 JSON mapping only. Generated locally; no network upload.",
7605
- "Status and span kind use OTLP numeric enums (StatusCode 0/1/2, SpanKind INTERNAL=1)."
7650
+ "Status and span kind use OTLP numeric enums (StatusCode 0/1/2, SpanKind INTERNAL=1).",
7651
+ "When present on source events, operationId/attemptId/retryOf/attemptNumber are emitted as bounded agent_inspect.* identity attributes (not a broad attribute dump)."
7606
7652
  ];
7607
7653
  const traceId = hexFrom2(`trace:${tree.runId}`, 16);
7608
7654
  const includeAttributes = options?.includeAttributes ?? false;
@@ -7650,6 +7696,11 @@ function exportOtlpJson(tree, options) {
7650
7696
  if (typeof inp === "number") attrs2.push(intAttr("gen_ai.usage.input_tokens", inp));
7651
7697
  if (typeof outp === "number") attrs2.push(intAttr("gen_ai.usage.output_tokens", outp));
7652
7698
  }
7699
+ appendStructuralIdentityAttrs(
7700
+ attrs2,
7701
+ meta && typeof meta === "object" ? meta : void 0,
7702
+ maxLen
7703
+ );
7653
7704
  if (includeAttributes && meta && typeof meta === "object") {
7654
7705
  const skipKeys = /* @__PURE__ */ new Set([
7655
7706
  "tokens",
@@ -7658,7 +7709,8 @@ function exportOtlpJson(tree, options) {
7658
7709
  "responseModel",
7659
7710
  "responseModelId",
7660
7711
  "provider",
7661
- "originalSourceType"
7712
+ "originalSourceType",
7713
+ ...STRUCTURAL_IDENTITY_KEYS
7662
7714
  ]);
7663
7715
  for (const [k, v] of Object.entries(meta)) {
7664
7716
  if (skipKeys.has(k)) continue;
@@ -7806,7 +7858,7 @@ function isCredentialSensitiveKey2(key, sensitiveKeys) {
7806
7858
  }
7807
7859
 
7808
7860
  // packages/redact/src/key-value-secret.ts
7809
- 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})\](?![^\s"'\\&#?]))([^\s"'\\]{8,})`;
7861
+ 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,})`;
7810
7862
  var KEY_VALUE_SECRET_PATTERN2 = new RegExp(
7811
7863
  KEY_VALUE_SECRET_PATTERN_SOURCE,
7812
7864
  "i"
@@ -8263,8 +8315,8 @@ function isCompleteRedactionMarker(value, replacement = "[REDACTED]") {
8263
8315
  const trimmed = value.trim();
8264
8316
  if (trimmed.length === 0) return false;
8265
8317
  if (trimmed === replacement) return true;
8266
- if (/^\[HASH:[A-Za-z0-9_-]+\]$/.test(trimmed)) return true;
8267
- if (/^\[REDACTED:[^\]]*\]$/.test(trimmed)) return true;
8318
+ if (trimmed === "[HASH:unknown]") return true;
8319
+ if (/^\[HASH:[0-9a-f]{8}\]$/.test(trimmed)) return true;
8268
8320
  return false;
8269
8321
  }
8270
8322
  function applyRule(rule, value, replacement) {
@@ -9360,5 +9412,5 @@ async function runReadOnlyMcpServer(options = {}) {
9360
9412
  }
9361
9413
 
9362
9414
  export { MCP_MAX_REQUEST_BYTES, MCP_PROTOCOL_VERSION, MCP_SERVER_INSTRUCTIONS, READ_ONLY_TOOLS, TRACE_DATA_UNTRUSTED_WARNING, callReadOnlyTool, createMcpServerContext, handleMcpProtocolLine, runReadOnlyMcpServer };
9363
- //# sourceMappingURL=chunk-ITYQ6FXK.mjs.map
9364
- //# sourceMappingURL=chunk-ITYQ6FXK.mjs.map
9415
+ //# sourceMappingURL=chunk-X4QXIQSR.mjs.map
9416
+ //# sourceMappingURL=chunk-X4QXIQSR.mjs.map