@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.
- package/dist/{chunk-VNZYYTP5.mjs → chunk-XLIQEKWB.mjs} +77 -43
- package/dist/chunk-XLIQEKWB.mjs.map +1 -0
- package/dist/cli.cjs +75 -41
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +75 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
- package/dist/chunk-VNZYYTP5.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -4150,16 +4150,32 @@ function encodeCanonicalStructured(value, limits) {
|
|
|
4150
4150
|
|
|
4151
4151
|
// packages/core/src/persisted/delivery-identity.ts
|
|
4152
4152
|
var DELIVERY_CONFLICT_ATTR = "agent_inspect.delivery_conflict";
|
|
4153
|
+
var DELIVERY_EVENT_BASE_ATTR = "agent_inspect.delivery_event_base";
|
|
4153
4154
|
var IDENTITY_CONFLICT_ATTR = {
|
|
4154
4155
|
operationId: "agent_inspect.identity_conflict.operation_id",
|
|
4155
4156
|
attemptId: "agent_inspect.identity_conflict.attempt_id",
|
|
4156
4157
|
retryOf: "agent_inspect.identity_conflict.retry_of",
|
|
4157
|
-
attemptNumber: "agent_inspect.identity_conflict.attempt_number"
|
|
4158
|
+
attemptNumber: "agent_inspect.identity_conflict.attempt_number",
|
|
4159
|
+
/** Comma-separated field names when a conflict survives lossy bounding. */
|
|
4160
|
+
fields: "agent_inspect.identity_conflict.fields"
|
|
4158
4161
|
};
|
|
4159
|
-
var
|
|
4160
|
-
function stripReaderDeliveryDiscriminator(eventId) {
|
|
4161
|
-
if (!
|
|
4162
|
-
|
|
4162
|
+
var MAX_DELIVERY_BASE_LEN = 500;
|
|
4163
|
+
function stripReaderDeliveryDiscriminator(eventId, attributes) {
|
|
4164
|
+
if (!eventId) return eventId;
|
|
4165
|
+
const rawBase = attributes?.[DELIVERY_EVENT_BASE_ATTR];
|
|
4166
|
+
if (typeof rawBase !== "string" || rawBase.trim() === "") return eventId;
|
|
4167
|
+
const base = rawBase.trim().slice(0, MAX_DELIVERY_BASE_LEN);
|
|
4168
|
+
if (eventId === base) return base;
|
|
4169
|
+
const prefix = `${base}:`;
|
|
4170
|
+
if (!eventId.startsWith(prefix)) return eventId;
|
|
4171
|
+
const suffix = eventId.slice(prefix.length);
|
|
4172
|
+
if (/^\d+$/.test(suffix)) return base;
|
|
4173
|
+
return eventId;
|
|
4174
|
+
}
|
|
4175
|
+
function deliveryEventBaseFromIndexedId(eventId) {
|
|
4176
|
+
if (!/:\d+$/.test(eventId)) return void 0;
|
|
4177
|
+
const base = eventId.replace(/:\d+$/, "");
|
|
4178
|
+
return base.length > 0 ? base.slice(0, MAX_DELIVERY_BASE_LEN) : void 0;
|
|
4163
4179
|
}
|
|
4164
4180
|
function canonicalDigest(value) {
|
|
4165
4181
|
if (value === void 0) return null;
|
|
@@ -4193,7 +4209,7 @@ function timeKey(fields) {
|
|
|
4193
4209
|
function deliverySemanticFingerprint(fields) {
|
|
4194
4210
|
const content = capturedContentDigest(fields.attributes);
|
|
4195
4211
|
return JSON.stringify({
|
|
4196
|
-
stableEventId: stripReaderDeliveryDiscriminator(fields.eventId),
|
|
4212
|
+
stableEventId: stripReaderDeliveryDiscriminator(fields.eventId, fields.attributes),
|
|
4197
4213
|
runId: fields.runId,
|
|
4198
4214
|
kind: fields.kind,
|
|
4199
4215
|
name: fields.name,
|
|
@@ -4839,6 +4855,11 @@ function compactAttributes2(entries) {
|
|
|
4839
4855
|
}
|
|
4840
4856
|
return Object.keys(out).length > 0 ? out : void 0;
|
|
4841
4857
|
}
|
|
4858
|
+
function stampDeliveryEventBase(eventId, attributes) {
|
|
4859
|
+
const base = deliveryEventBaseFromIndexedId(eventId);
|
|
4860
|
+
if (!base) return attributes;
|
|
4861
|
+
return { ...attributes ?? {}, [DELIVERY_EVENT_BASE_ATTR]: base };
|
|
4862
|
+
}
|
|
4842
4863
|
function traceEventToPersistedInspectEvent(event, options) {
|
|
4843
4864
|
const eventIndex = options?.eventIndex ?? 0;
|
|
4844
4865
|
const eventId = createPersistedEventId(event, eventIndex);
|
|
@@ -4868,7 +4889,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
4868
4889
|
startedAt: tsStart.iso,
|
|
4869
4890
|
confidence: "explicit",
|
|
4870
4891
|
source,
|
|
4871
|
-
attributes
|
|
4892
|
+
attributes: stampDeliveryEventBase(eventId, attributes)
|
|
4872
4893
|
};
|
|
4873
4894
|
}
|
|
4874
4895
|
case "run_completed": {
|
|
@@ -4891,7 +4912,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
4891
4912
|
durationMs: event.durationMs,
|
|
4892
4913
|
confidence: "explicit",
|
|
4893
4914
|
source,
|
|
4894
|
-
attributes,
|
|
4915
|
+
attributes: stampDeliveryEventBase(eventId, attributes),
|
|
4895
4916
|
error
|
|
4896
4917
|
};
|
|
4897
4918
|
}
|
|
@@ -4916,7 +4937,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
4916
4937
|
startedAt: tsStart.iso,
|
|
4917
4938
|
confidence: "explicit",
|
|
4918
4939
|
source,
|
|
4919
|
-
attributes
|
|
4940
|
+
attributes: stampDeliveryEventBase(eventId, attributes)
|
|
4920
4941
|
};
|
|
4921
4942
|
if (event.parentId !== void 0) {
|
|
4922
4943
|
out.parentId = event.parentId;
|
|
@@ -4947,7 +4968,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
4947
4968
|
durationMs: event.durationMs,
|
|
4948
4969
|
confidence: "explicit",
|
|
4949
4970
|
source,
|
|
4950
|
-
attributes,
|
|
4971
|
+
attributes: stampDeliveryEventBase(eventId, attributes),
|
|
4951
4972
|
error
|
|
4952
4973
|
};
|
|
4953
4974
|
}
|
|
@@ -4974,7 +4995,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
4974
4995
|
timestamp: tsMain.iso,
|
|
4975
4996
|
confidence: "explicit",
|
|
4976
4997
|
source,
|
|
4977
|
-
attributes
|
|
4998
|
+
attributes: stampDeliveryEventBase(eventId, attributes)
|
|
4978
4999
|
};
|
|
4979
5000
|
if (event.parentId !== void 0) {
|
|
4980
5001
|
out.parentId = event.parentId;
|
|
@@ -6729,6 +6750,15 @@ function promoteAgentInspectWorkflowIdentity(attributes, pathPrefix) {
|
|
|
6729
6750
|
metadata[camel] = alternate;
|
|
6730
6751
|
}
|
|
6731
6752
|
}
|
|
6753
|
+
const conflictFields = attributes["agent_inspect.identity_conflict.fields"];
|
|
6754
|
+
if (typeof conflictFields === "string" && conflictFields.trim() !== "") {
|
|
6755
|
+
warnings.push({
|
|
6756
|
+
code: "otlp_identity_conflict",
|
|
6757
|
+
message: `Identity representation conflict fields retained after OTLP bounding: ${conflictFields.trim().slice(0, 200)}.`,
|
|
6758
|
+
severity: "warning",
|
|
6759
|
+
field: `${pathPrefix}.agent_inspect.identity_conflict.fields`
|
|
6760
|
+
});
|
|
6761
|
+
}
|
|
6732
6762
|
if (Object.keys(metadata).length > 0) {
|
|
6733
6763
|
attributes.metadata = metadata;
|
|
6734
6764
|
}
|
|
@@ -7925,10 +7955,16 @@ function pickBoundedIdentityString(bag, key, maxLen) {
|
|
|
7925
7955
|
if (!bag || typeof bag !== "object") return {};
|
|
7926
7956
|
const directRaw = bag[key];
|
|
7927
7957
|
const nestedRaw = nestedBag(bag)?.[key];
|
|
7928
|
-
const
|
|
7929
|
-
const
|
|
7930
|
-
|
|
7931
|
-
|
|
7958
|
+
const directFull = typeof directRaw === "string" && directRaw.trim() !== "" ? directRaw.trim() : void 0;
|
|
7959
|
+
const nestedFull = typeof nestedRaw === "string" && nestedRaw.trim() !== "" ? nestedRaw.trim() : void 0;
|
|
7960
|
+
const direct = directFull !== void 0 ? directFull.slice(0, maxLen) : void 0;
|
|
7961
|
+
const nested = nestedFull !== void 0 ? nestedFull.slice(0, maxLen) : void 0;
|
|
7962
|
+
if (directFull !== void 0 && nestedFull !== void 0 && directFull !== nestedFull) {
|
|
7963
|
+
return {
|
|
7964
|
+
value: direct,
|
|
7965
|
+
conflictAlternate: nested,
|
|
7966
|
+
truncatedCollision: direct === nested
|
|
7967
|
+
};
|
|
7932
7968
|
}
|
|
7933
7969
|
if (direct !== void 0) return { value: direct };
|
|
7934
7970
|
if (nested !== void 0) return { value: nested };
|
|
@@ -7949,32 +7985,21 @@ function pickBoundedIdentityNumber(bag, key) {
|
|
|
7949
7985
|
}
|
|
7950
7986
|
function appendStructuralIdentityAttrs(attrs2, meta, maxLen) {
|
|
7951
7987
|
const conflicts = [];
|
|
7952
|
-
const
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
attrs2.push(stringAttr2(IDENTITY_CONFLICT_ATTR.attemptId, attemptId.conflictAlternate));
|
|
7968
|
-
conflicts.push("attemptId");
|
|
7969
|
-
}
|
|
7970
|
-
const retryOf = pickBoundedIdentityString(meta, "retryOf", maxLen);
|
|
7971
|
-
if (retryOf.value !== void 0) {
|
|
7972
|
-
attrs2.push(stringAttr2("agent_inspect.retry_of", retryOf.value));
|
|
7973
|
-
}
|
|
7974
|
-
if (retryOf.conflictAlternate !== void 0) {
|
|
7975
|
-
attrs2.push(stringAttr2(IDENTITY_CONFLICT_ATTR.retryOf, retryOf.conflictAlternate));
|
|
7976
|
-
conflicts.push("retryOf");
|
|
7977
|
-
}
|
|
7988
|
+
const emitString = (key, otlpKey, conflictKey) => {
|
|
7989
|
+
const picked = pickBoundedIdentityString(meta, key, maxLen);
|
|
7990
|
+
if (picked.value !== void 0) {
|
|
7991
|
+
attrs2.push(stringAttr2(otlpKey, picked.value));
|
|
7992
|
+
}
|
|
7993
|
+
if (picked.conflictAlternate !== void 0 || picked.truncatedCollision) {
|
|
7994
|
+
if (picked.conflictAlternate !== void 0) {
|
|
7995
|
+
attrs2.push(stringAttr2(conflictKey, picked.conflictAlternate));
|
|
7996
|
+
}
|
|
7997
|
+
conflicts.push(key);
|
|
7998
|
+
}
|
|
7999
|
+
};
|
|
8000
|
+
emitString("operationId", "agent_inspect.operation_id", IDENTITY_CONFLICT_ATTR.operationId);
|
|
8001
|
+
emitString("attemptId", "agent_inspect.attempt_id", IDENTITY_CONFLICT_ATTR.attemptId);
|
|
8002
|
+
emitString("retryOf", "agent_inspect.retry_of", IDENTITY_CONFLICT_ATTR.retryOf);
|
|
7978
8003
|
const attemptNumberPrimary = pickBoundedIdentityNumber(meta, "attemptNumber");
|
|
7979
8004
|
const attemptNumber = attemptNumberPrimary.value !== void 0 || attemptNumberPrimary.conflictAlternate !== void 0 ? attemptNumberPrimary : pickBoundedIdentityNumber(meta, "attempt");
|
|
7980
8005
|
if (attemptNumber.value !== void 0) {
|
|
@@ -7986,9 +8011,18 @@ function appendStructuralIdentityAttrs(attrs2, meta, maxLen) {
|
|
|
7986
8011
|
);
|
|
7987
8012
|
conflicts.push("attemptNumber");
|
|
7988
8013
|
}
|
|
8014
|
+
if (conflicts.length > 0) {
|
|
8015
|
+
attrs2.push(
|
|
8016
|
+
stringAttr2(IDENTITY_CONFLICT_ATTR.fields, conflicts.join(",").slice(0, maxLen))
|
|
8017
|
+
);
|
|
8018
|
+
}
|
|
7989
8019
|
if (meta?.[DELIVERY_CONFLICT_ATTR] === true) {
|
|
7990
8020
|
attrs2.push(boolAttr(DELIVERY_CONFLICT_ATTR, true));
|
|
7991
8021
|
}
|
|
8022
|
+
const deliveryBase = meta?.[DELIVERY_EVENT_BASE_ATTR];
|
|
8023
|
+
if (typeof deliveryBase === "string" && deliveryBase.trim() !== "") {
|
|
8024
|
+
attrs2.push(stringAttr2(DELIVERY_EVENT_BASE_ATTR, deliveryBase.trim().slice(0, maxLen)));
|
|
8025
|
+
}
|
|
7992
8026
|
return conflicts;
|
|
7993
8027
|
}
|
|
7994
8028
|
function resolveSpanTimes(ev) {
|