@agent-inspect/viewer 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/index.cjs +38 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +38 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2813,10 +2813,24 @@ function encodeCanonicalStructured(value, limits) {
|
|
|
2813
2813
|
|
|
2814
2814
|
// packages/core/src/persisted/delivery-identity.ts
|
|
2815
2815
|
var DELIVERY_CONFLICT_ATTR = "agent_inspect.delivery_conflict";
|
|
2816
|
-
var
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
return eventId
|
|
2816
|
+
var DELIVERY_EVENT_BASE_ATTR = "agent_inspect.delivery_event_base";
|
|
2817
|
+
var MAX_DELIVERY_BASE_LEN = 500;
|
|
2818
|
+
function stripReaderDeliveryDiscriminator(eventId, attributes) {
|
|
2819
|
+
if (!eventId) return eventId;
|
|
2820
|
+
const rawBase = attributes?.[DELIVERY_EVENT_BASE_ATTR];
|
|
2821
|
+
if (typeof rawBase !== "string" || rawBase.trim() === "") return eventId;
|
|
2822
|
+
const base = rawBase.trim().slice(0, MAX_DELIVERY_BASE_LEN);
|
|
2823
|
+
if (eventId === base) return base;
|
|
2824
|
+
const prefix = `${base}:`;
|
|
2825
|
+
if (!eventId.startsWith(prefix)) return eventId;
|
|
2826
|
+
const suffix = eventId.slice(prefix.length);
|
|
2827
|
+
if (/^\d+$/.test(suffix)) return base;
|
|
2828
|
+
return eventId;
|
|
2829
|
+
}
|
|
2830
|
+
function deliveryEventBaseFromIndexedId(eventId) {
|
|
2831
|
+
if (!/:\d+$/.test(eventId)) return void 0;
|
|
2832
|
+
const base = eventId.replace(/:\d+$/, "");
|
|
2833
|
+
return base.length > 0 ? base.slice(0, MAX_DELIVERY_BASE_LEN) : void 0;
|
|
2820
2834
|
}
|
|
2821
2835
|
function canonicalDigest(value) {
|
|
2822
2836
|
if (value === void 0) return null;
|
|
@@ -2850,7 +2864,7 @@ function timeKey(fields) {
|
|
|
2850
2864
|
function deliverySemanticFingerprint(fields) {
|
|
2851
2865
|
const content = capturedContentDigest(fields.attributes);
|
|
2852
2866
|
return JSON.stringify({
|
|
2853
|
-
stableEventId: stripReaderDeliveryDiscriminator(fields.eventId),
|
|
2867
|
+
stableEventId: stripReaderDeliveryDiscriminator(fields.eventId, fields.attributes),
|
|
2854
2868
|
runId: fields.runId,
|
|
2855
2869
|
kind: fields.kind,
|
|
2856
2870
|
name: fields.name,
|
|
@@ -3804,6 +3818,11 @@ function compactAttributes(entries) {
|
|
|
3804
3818
|
}
|
|
3805
3819
|
return Object.keys(out).length > 0 ? out : void 0;
|
|
3806
3820
|
}
|
|
3821
|
+
function stampDeliveryEventBase(eventId, attributes) {
|
|
3822
|
+
const base = deliveryEventBaseFromIndexedId(eventId);
|
|
3823
|
+
if (!base) return attributes;
|
|
3824
|
+
return { ...attributes ?? {}, [DELIVERY_EVENT_BASE_ATTR]: base };
|
|
3825
|
+
}
|
|
3807
3826
|
function traceEventToPersistedInspectEvent(event, options) {
|
|
3808
3827
|
const eventIndex = options?.eventIndex ?? 0;
|
|
3809
3828
|
const eventId = createPersistedEventId(event, eventIndex);
|
|
@@ -3833,7 +3852,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
3833
3852
|
startedAt: tsStart.iso,
|
|
3834
3853
|
confidence: "explicit",
|
|
3835
3854
|
source,
|
|
3836
|
-
attributes
|
|
3855
|
+
attributes: stampDeliveryEventBase(eventId, attributes)
|
|
3837
3856
|
};
|
|
3838
3857
|
}
|
|
3839
3858
|
case "run_completed": {
|
|
@@ -3856,7 +3875,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
3856
3875
|
durationMs: event.durationMs,
|
|
3857
3876
|
confidence: "explicit",
|
|
3858
3877
|
source,
|
|
3859
|
-
attributes,
|
|
3878
|
+
attributes: stampDeliveryEventBase(eventId, attributes),
|
|
3860
3879
|
error
|
|
3861
3880
|
};
|
|
3862
3881
|
}
|
|
@@ -3881,7 +3900,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
3881
3900
|
startedAt: tsStart.iso,
|
|
3882
3901
|
confidence: "explicit",
|
|
3883
3902
|
source,
|
|
3884
|
-
attributes
|
|
3903
|
+
attributes: stampDeliveryEventBase(eventId, attributes)
|
|
3885
3904
|
};
|
|
3886
3905
|
if (event.parentId !== void 0) {
|
|
3887
3906
|
out.parentId = event.parentId;
|
|
@@ -3912,7 +3931,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
3912
3931
|
durationMs: event.durationMs,
|
|
3913
3932
|
confidence: "explicit",
|
|
3914
3933
|
source,
|
|
3915
|
-
attributes,
|
|
3934
|
+
attributes: stampDeliveryEventBase(eventId, attributes),
|
|
3916
3935
|
error
|
|
3917
3936
|
};
|
|
3918
3937
|
}
|
|
@@ -3939,7 +3958,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
3939
3958
|
timestamp: tsMain.iso,
|
|
3940
3959
|
confidence: "explicit",
|
|
3941
3960
|
source,
|
|
3942
|
-
attributes
|
|
3961
|
+
attributes: stampDeliveryEventBase(eventId, attributes)
|
|
3943
3962
|
};
|
|
3944
3963
|
if (event.parentId !== void 0) {
|
|
3945
3964
|
out.parentId = event.parentId;
|
|
@@ -5694,6 +5713,15 @@ function promoteAgentInspectWorkflowIdentity(attributes, pathPrefix) {
|
|
|
5694
5713
|
metadata[camel] = alternate;
|
|
5695
5714
|
}
|
|
5696
5715
|
}
|
|
5716
|
+
const conflictFields = attributes["agent_inspect.identity_conflict.fields"];
|
|
5717
|
+
if (typeof conflictFields === "string" && conflictFields.trim() !== "") {
|
|
5718
|
+
warnings.push({
|
|
5719
|
+
code: "otlp_identity_conflict",
|
|
5720
|
+
message: `Identity representation conflict fields retained after OTLP bounding: ${conflictFields.trim().slice(0, 200)}.`,
|
|
5721
|
+
severity: "warning",
|
|
5722
|
+
field: `${pathPrefix}.agent_inspect.identity_conflict.fields`
|
|
5723
|
+
});
|
|
5724
|
+
}
|
|
5697
5725
|
if (Object.keys(metadata).length > 0) {
|
|
5698
5726
|
attributes.metadata = metadata;
|
|
5699
5727
|
}
|