@agent-inspect/mcp-server 6.31.22 → 6.31.23

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.
@@ -4140,16 +4140,32 @@ function encodeCanonicalStructured(value, limits) {
4140
4140
 
4141
4141
  // packages/core/src/persisted/delivery-identity.ts
4142
4142
  var DELIVERY_CONFLICT_ATTR = "agent_inspect.delivery_conflict";
4143
+ var DELIVERY_EVENT_BASE_ATTR = "agent_inspect.delivery_event_base";
4143
4144
  var IDENTITY_CONFLICT_ATTR = {
4144
4145
  operationId: "agent_inspect.identity_conflict.operation_id",
4145
4146
  attemptId: "agent_inspect.identity_conflict.attempt_id",
4146
4147
  retryOf: "agent_inspect.identity_conflict.retry_of",
4147
- attemptNumber: "agent_inspect.identity_conflict.attempt_number"
4148
+ attemptNumber: "agent_inspect.identity_conflict.attempt_number",
4149
+ /** Comma-separated field names when a conflict survives lossy bounding. */
4150
+ fields: "agent_inspect.identity_conflict.fields"
4148
4151
  };
4149
- var SYNTHETIC_DELIVERY_ID = /^(?:manual|inspect):[A-Za-z0-9_-]+:[A-Za-z0-9_-]+:[A-Za-z0-9_-]+:\d+$/;
4150
- function stripReaderDeliveryDiscriminator(eventId) {
4151
- if (!SYNTHETIC_DELIVERY_ID.test(eventId)) return eventId;
4152
- return eventId.replace(/:\d+$/, "");
4152
+ var MAX_DELIVERY_BASE_LEN = 500;
4153
+ function stripReaderDeliveryDiscriminator(eventId, attributes) {
4154
+ if (!eventId) return eventId;
4155
+ const rawBase = attributes?.[DELIVERY_EVENT_BASE_ATTR];
4156
+ if (typeof rawBase !== "string" || rawBase.trim() === "") return eventId;
4157
+ const base = rawBase.trim().slice(0, MAX_DELIVERY_BASE_LEN);
4158
+ if (eventId === base) return base;
4159
+ const prefix = `${base}:`;
4160
+ if (!eventId.startsWith(prefix)) return eventId;
4161
+ const suffix = eventId.slice(prefix.length);
4162
+ if (/^\d+$/.test(suffix)) return base;
4163
+ return eventId;
4164
+ }
4165
+ function deliveryEventBaseFromIndexedId(eventId) {
4166
+ if (!/:\d+$/.test(eventId)) return void 0;
4167
+ const base = eventId.replace(/:\d+$/, "");
4168
+ return base.length > 0 ? base.slice(0, MAX_DELIVERY_BASE_LEN) : void 0;
4153
4169
  }
4154
4170
  function canonicalDigest(value) {
4155
4171
  if (value === void 0) return null;
@@ -4183,7 +4199,7 @@ function timeKey(fields) {
4183
4199
  function deliverySemanticFingerprint(fields) {
4184
4200
  const content = capturedContentDigest(fields.attributes);
4185
4201
  return JSON.stringify({
4186
- stableEventId: stripReaderDeliveryDiscriminator(fields.eventId),
4202
+ stableEventId: stripReaderDeliveryDiscriminator(fields.eventId, fields.attributes),
4187
4203
  runId: fields.runId,
4188
4204
  kind: fields.kind,
4189
4205
  name: fields.name,
@@ -4829,6 +4845,11 @@ function compactAttributes2(entries) {
4829
4845
  }
4830
4846
  return Object.keys(out).length > 0 ? out : void 0;
4831
4847
  }
4848
+ function stampDeliveryEventBase(eventId, attributes) {
4849
+ const base = deliveryEventBaseFromIndexedId(eventId);
4850
+ if (!base) return attributes;
4851
+ return { ...attributes ?? {}, [DELIVERY_EVENT_BASE_ATTR]: base };
4852
+ }
4832
4853
  function traceEventToPersistedInspectEvent(event, options) {
4833
4854
  const eventIndex = options?.eventIndex ?? 0;
4834
4855
  const eventId = createPersistedEventId(event, eventIndex);
@@ -4858,7 +4879,7 @@ function traceEventToPersistedInspectEvent(event, options) {
4858
4879
  startedAt: tsStart.iso,
4859
4880
  confidence: "explicit",
4860
4881
  source,
4861
- attributes
4882
+ attributes: stampDeliveryEventBase(eventId, attributes)
4862
4883
  };
4863
4884
  }
4864
4885
  case "run_completed": {
@@ -4881,7 +4902,7 @@ function traceEventToPersistedInspectEvent(event, options) {
4881
4902
  durationMs: event.durationMs,
4882
4903
  confidence: "explicit",
4883
4904
  source,
4884
- attributes,
4905
+ attributes: stampDeliveryEventBase(eventId, attributes),
4885
4906
  error
4886
4907
  };
4887
4908
  }
@@ -4906,7 +4927,7 @@ function traceEventToPersistedInspectEvent(event, options) {
4906
4927
  startedAt: tsStart.iso,
4907
4928
  confidence: "explicit",
4908
4929
  source,
4909
- attributes
4930
+ attributes: stampDeliveryEventBase(eventId, attributes)
4910
4931
  };
4911
4932
  if (event.parentId !== void 0) {
4912
4933
  out.parentId = event.parentId;
@@ -4937,7 +4958,7 @@ function traceEventToPersistedInspectEvent(event, options) {
4937
4958
  durationMs: event.durationMs,
4938
4959
  confidence: "explicit",
4939
4960
  source,
4940
- attributes,
4961
+ attributes: stampDeliveryEventBase(eventId, attributes),
4941
4962
  error
4942
4963
  };
4943
4964
  }
@@ -4964,7 +4985,7 @@ function traceEventToPersistedInspectEvent(event, options) {
4964
4985
  timestamp: tsMain.iso,
4965
4986
  confidence: "explicit",
4966
4987
  source,
4967
- attributes
4988
+ attributes: stampDeliveryEventBase(eventId, attributes)
4968
4989
  };
4969
4990
  if (event.parentId !== void 0) {
4970
4991
  out.parentId = event.parentId;
@@ -6719,6 +6740,15 @@ function promoteAgentInspectWorkflowIdentity(attributes, pathPrefix) {
6719
6740
  metadata[camel] = alternate;
6720
6741
  }
6721
6742
  }
6743
+ const conflictFields = attributes["agent_inspect.identity_conflict.fields"];
6744
+ if (typeof conflictFields === "string" && conflictFields.trim() !== "") {
6745
+ warnings.push({
6746
+ code: "otlp_identity_conflict",
6747
+ message: `Identity representation conflict fields retained after OTLP bounding: ${conflictFields.trim().slice(0, 200)}.`,
6748
+ severity: "warning",
6749
+ field: `${pathPrefix}.agent_inspect.identity_conflict.fields`
6750
+ });
6751
+ }
6722
6752
  if (Object.keys(metadata).length > 0) {
6723
6753
  attributes.metadata = metadata;
6724
6754
  }
@@ -7915,10 +7945,16 @@ function pickBoundedIdentityString(bag, key, maxLen) {
7915
7945
  if (!bag || typeof bag !== "object") return {};
7916
7946
  const directRaw = bag[key];
7917
7947
  const nestedRaw = nestedBag(bag)?.[key];
7918
- const direct = typeof directRaw === "string" && directRaw.trim() !== "" ? directRaw.trim().slice(0, maxLen) : void 0;
7919
- const nested = typeof nestedRaw === "string" && nestedRaw.trim() !== "" ? nestedRaw.trim().slice(0, maxLen) : void 0;
7920
- if (direct !== void 0 && nested !== void 0 && direct !== nested) {
7921
- return { value: direct, conflictAlternate: nested };
7948
+ const directFull = typeof directRaw === "string" && directRaw.trim() !== "" ? directRaw.trim() : void 0;
7949
+ const nestedFull = typeof nestedRaw === "string" && nestedRaw.trim() !== "" ? nestedRaw.trim() : void 0;
7950
+ const direct = directFull !== void 0 ? directFull.slice(0, maxLen) : void 0;
7951
+ const nested = nestedFull !== void 0 ? nestedFull.slice(0, maxLen) : void 0;
7952
+ if (directFull !== void 0 && nestedFull !== void 0 && directFull !== nestedFull) {
7953
+ return {
7954
+ value: direct,
7955
+ conflictAlternate: nested,
7956
+ truncatedCollision: direct === nested
7957
+ };
7922
7958
  }
7923
7959
  if (direct !== void 0) return { value: direct };
7924
7960
  if (nested !== void 0) return { value: nested };
@@ -7939,32 +7975,21 @@ function pickBoundedIdentityNumber(bag, key) {
7939
7975
  }
7940
7976
  function appendStructuralIdentityAttrs(attrs2, meta, maxLen) {
7941
7977
  const conflicts = [];
7942
- const operationId = pickBoundedIdentityString(meta, "operationId", maxLen);
7943
- if (operationId.value !== void 0) {
7944
- attrs2.push(stringAttr2("agent_inspect.operation_id", operationId.value));
7945
- }
7946
- if (operationId.conflictAlternate !== void 0) {
7947
- attrs2.push(
7948
- stringAttr2(IDENTITY_CONFLICT_ATTR.operationId, operationId.conflictAlternate)
7949
- );
7950
- conflicts.push("operationId");
7951
- }
7952
- const attemptId = pickBoundedIdentityString(meta, "attemptId", maxLen);
7953
- if (attemptId.value !== void 0) {
7954
- attrs2.push(stringAttr2("agent_inspect.attempt_id", attemptId.value));
7955
- }
7956
- if (attemptId.conflictAlternate !== void 0) {
7957
- attrs2.push(stringAttr2(IDENTITY_CONFLICT_ATTR.attemptId, attemptId.conflictAlternate));
7958
- conflicts.push("attemptId");
7959
- }
7960
- const retryOf = pickBoundedIdentityString(meta, "retryOf", maxLen);
7961
- if (retryOf.value !== void 0) {
7962
- attrs2.push(stringAttr2("agent_inspect.retry_of", retryOf.value));
7963
- }
7964
- if (retryOf.conflictAlternate !== void 0) {
7965
- attrs2.push(stringAttr2(IDENTITY_CONFLICT_ATTR.retryOf, retryOf.conflictAlternate));
7966
- conflicts.push("retryOf");
7967
- }
7978
+ const emitString = (key, otlpKey, conflictKey) => {
7979
+ const picked = pickBoundedIdentityString(meta, key, maxLen);
7980
+ if (picked.value !== void 0) {
7981
+ attrs2.push(stringAttr2(otlpKey, picked.value));
7982
+ }
7983
+ if (picked.conflictAlternate !== void 0 || picked.truncatedCollision) {
7984
+ if (picked.conflictAlternate !== void 0) {
7985
+ attrs2.push(stringAttr2(conflictKey, picked.conflictAlternate));
7986
+ }
7987
+ conflicts.push(key);
7988
+ }
7989
+ };
7990
+ emitString("operationId", "agent_inspect.operation_id", IDENTITY_CONFLICT_ATTR.operationId);
7991
+ emitString("attemptId", "agent_inspect.attempt_id", IDENTITY_CONFLICT_ATTR.attemptId);
7992
+ emitString("retryOf", "agent_inspect.retry_of", IDENTITY_CONFLICT_ATTR.retryOf);
7968
7993
  const attemptNumberPrimary = pickBoundedIdentityNumber(meta, "attemptNumber");
7969
7994
  const attemptNumber = attemptNumberPrimary.value !== void 0 || attemptNumberPrimary.conflictAlternate !== void 0 ? attemptNumberPrimary : pickBoundedIdentityNumber(meta, "attempt");
7970
7995
  if (attemptNumber.value !== void 0) {
@@ -7976,9 +8001,18 @@ function appendStructuralIdentityAttrs(attrs2, meta, maxLen) {
7976
8001
  );
7977
8002
  conflicts.push("attemptNumber");
7978
8003
  }
8004
+ if (conflicts.length > 0) {
8005
+ attrs2.push(
8006
+ stringAttr2(IDENTITY_CONFLICT_ATTR.fields, conflicts.join(",").slice(0, maxLen))
8007
+ );
8008
+ }
7979
8009
  if (meta?.[DELIVERY_CONFLICT_ATTR] === true) {
7980
8010
  attrs2.push(boolAttr(DELIVERY_CONFLICT_ATTR, true));
7981
8011
  }
8012
+ const deliveryBase = meta?.[DELIVERY_EVENT_BASE_ATTR];
8013
+ if (typeof deliveryBase === "string" && deliveryBase.trim() !== "") {
8014
+ attrs2.push(stringAttr2(DELIVERY_EVENT_BASE_ATTR, deliveryBase.trim().slice(0, maxLen)));
8015
+ }
7982
8016
  return conflicts;
7983
8017
  }
7984
8018
  function resolveSpanTimes(ev) {
@@ -9772,5 +9806,5 @@ async function runReadOnlyMcpServer(options = {}) {
9772
9806
  }
9773
9807
 
9774
9808
  export { MCP_MAX_REQUEST_BYTES, MCP_PROTOCOL_VERSION, MCP_SERVER_INSTRUCTIONS, READ_ONLY_TOOLS, TRACE_DATA_UNTRUSTED_WARNING, callReadOnlyTool, createMcpServerContext, handleMcpProtocolLine, runReadOnlyMcpServer };
9775
- //# sourceMappingURL=chunk-VNZYYTP5.mjs.map
9776
- //# sourceMappingURL=chunk-VNZYYTP5.mjs.map
9809
+ //# sourceMappingURL=chunk-XLIQEKWB.mjs.map
9810
+ //# sourceMappingURL=chunk-XLIQEKWB.mjs.map