@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.mjs
CHANGED
|
@@ -2806,10 +2806,24 @@ function encodeCanonicalStructured(value, limits) {
|
|
|
2806
2806
|
|
|
2807
2807
|
// packages/core/src/persisted/delivery-identity.ts
|
|
2808
2808
|
var DELIVERY_CONFLICT_ATTR = "agent_inspect.delivery_conflict";
|
|
2809
|
-
var
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
return eventId
|
|
2809
|
+
var DELIVERY_EVENT_BASE_ATTR = "agent_inspect.delivery_event_base";
|
|
2810
|
+
var MAX_DELIVERY_BASE_LEN = 500;
|
|
2811
|
+
function stripReaderDeliveryDiscriminator(eventId, attributes) {
|
|
2812
|
+
if (!eventId) return eventId;
|
|
2813
|
+
const rawBase = attributes?.[DELIVERY_EVENT_BASE_ATTR];
|
|
2814
|
+
if (typeof rawBase !== "string" || rawBase.trim() === "") return eventId;
|
|
2815
|
+
const base = rawBase.trim().slice(0, MAX_DELIVERY_BASE_LEN);
|
|
2816
|
+
if (eventId === base) return base;
|
|
2817
|
+
const prefix = `${base}:`;
|
|
2818
|
+
if (!eventId.startsWith(prefix)) return eventId;
|
|
2819
|
+
const suffix = eventId.slice(prefix.length);
|
|
2820
|
+
if (/^\d+$/.test(suffix)) return base;
|
|
2821
|
+
return eventId;
|
|
2822
|
+
}
|
|
2823
|
+
function deliveryEventBaseFromIndexedId(eventId) {
|
|
2824
|
+
if (!/:\d+$/.test(eventId)) return void 0;
|
|
2825
|
+
const base = eventId.replace(/:\d+$/, "");
|
|
2826
|
+
return base.length > 0 ? base.slice(0, MAX_DELIVERY_BASE_LEN) : void 0;
|
|
2813
2827
|
}
|
|
2814
2828
|
function canonicalDigest(value) {
|
|
2815
2829
|
if (value === void 0) return null;
|
|
@@ -2843,7 +2857,7 @@ function timeKey(fields) {
|
|
|
2843
2857
|
function deliverySemanticFingerprint(fields) {
|
|
2844
2858
|
const content = capturedContentDigest(fields.attributes);
|
|
2845
2859
|
return JSON.stringify({
|
|
2846
|
-
stableEventId: stripReaderDeliveryDiscriminator(fields.eventId),
|
|
2860
|
+
stableEventId: stripReaderDeliveryDiscriminator(fields.eventId, fields.attributes),
|
|
2847
2861
|
runId: fields.runId,
|
|
2848
2862
|
kind: fields.kind,
|
|
2849
2863
|
name: fields.name,
|
|
@@ -3797,6 +3811,11 @@ function compactAttributes(entries) {
|
|
|
3797
3811
|
}
|
|
3798
3812
|
return Object.keys(out).length > 0 ? out : void 0;
|
|
3799
3813
|
}
|
|
3814
|
+
function stampDeliveryEventBase(eventId, attributes) {
|
|
3815
|
+
const base = deliveryEventBaseFromIndexedId(eventId);
|
|
3816
|
+
if (!base) return attributes;
|
|
3817
|
+
return { ...attributes ?? {}, [DELIVERY_EVENT_BASE_ATTR]: base };
|
|
3818
|
+
}
|
|
3800
3819
|
function traceEventToPersistedInspectEvent(event, options) {
|
|
3801
3820
|
const eventIndex = options?.eventIndex ?? 0;
|
|
3802
3821
|
const eventId = createPersistedEventId(event, eventIndex);
|
|
@@ -3826,7 +3845,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
3826
3845
|
startedAt: tsStart.iso,
|
|
3827
3846
|
confidence: "explicit",
|
|
3828
3847
|
source,
|
|
3829
|
-
attributes
|
|
3848
|
+
attributes: stampDeliveryEventBase(eventId, attributes)
|
|
3830
3849
|
};
|
|
3831
3850
|
}
|
|
3832
3851
|
case "run_completed": {
|
|
@@ -3849,7 +3868,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
3849
3868
|
durationMs: event.durationMs,
|
|
3850
3869
|
confidence: "explicit",
|
|
3851
3870
|
source,
|
|
3852
|
-
attributes,
|
|
3871
|
+
attributes: stampDeliveryEventBase(eventId, attributes),
|
|
3853
3872
|
error
|
|
3854
3873
|
};
|
|
3855
3874
|
}
|
|
@@ -3874,7 +3893,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
3874
3893
|
startedAt: tsStart.iso,
|
|
3875
3894
|
confidence: "explicit",
|
|
3876
3895
|
source,
|
|
3877
|
-
attributes
|
|
3896
|
+
attributes: stampDeliveryEventBase(eventId, attributes)
|
|
3878
3897
|
};
|
|
3879
3898
|
if (event.parentId !== void 0) {
|
|
3880
3899
|
out.parentId = event.parentId;
|
|
@@ -3905,7 +3924,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
3905
3924
|
durationMs: event.durationMs,
|
|
3906
3925
|
confidence: "explicit",
|
|
3907
3926
|
source,
|
|
3908
|
-
attributes,
|
|
3927
|
+
attributes: stampDeliveryEventBase(eventId, attributes),
|
|
3909
3928
|
error
|
|
3910
3929
|
};
|
|
3911
3930
|
}
|
|
@@ -3932,7 +3951,7 @@ function traceEventToPersistedInspectEvent(event, options) {
|
|
|
3932
3951
|
timestamp: tsMain.iso,
|
|
3933
3952
|
confidence: "explicit",
|
|
3934
3953
|
source,
|
|
3935
|
-
attributes
|
|
3954
|
+
attributes: stampDeliveryEventBase(eventId, attributes)
|
|
3936
3955
|
};
|
|
3937
3956
|
if (event.parentId !== void 0) {
|
|
3938
3957
|
out.parentId = event.parentId;
|
|
@@ -5687,6 +5706,15 @@ function promoteAgentInspectWorkflowIdentity(attributes, pathPrefix) {
|
|
|
5687
5706
|
metadata[camel] = alternate;
|
|
5688
5707
|
}
|
|
5689
5708
|
}
|
|
5709
|
+
const conflictFields = attributes["agent_inspect.identity_conflict.fields"];
|
|
5710
|
+
if (typeof conflictFields === "string" && conflictFields.trim() !== "") {
|
|
5711
|
+
warnings.push({
|
|
5712
|
+
code: "otlp_identity_conflict",
|
|
5713
|
+
message: `Identity representation conflict fields retained after OTLP bounding: ${conflictFields.trim().slice(0, 200)}.`,
|
|
5714
|
+
severity: "warning",
|
|
5715
|
+
field: `${pathPrefix}.agent_inspect.identity_conflict.fields`
|
|
5716
|
+
});
|
|
5717
|
+
}
|
|
5690
5718
|
if (Object.keys(metadata).length > 0) {
|
|
5691
5719
|
attributes.metadata = metadata;
|
|
5692
5720
|
}
|