@spatius/avatarkit 1.3.4 → 1.3.5

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.
@@ -48,7 +48,26 @@ export interface SpanGroup {
48
48
  * what lets the backend's spans join a round without threading state through;
49
49
  * reproducing that separately would mean two definitions of one wire contract.
50
50
  */
51
- export declare function startPlaybackTrace(conversationId: string, startTimeMs?: number, attrs?: Attributes): PlaybackTrace;
51
+ export declare function startPlaybackTrace(conversationId: string, startTimeMs?: number, attrs?: Attributes, serverTraceparent?: string): PlaybackTrace;
52
+ /**
53
+ * Read the W3C traceparent the driving service stamped on an animation
54
+ * message, without decoding its frames. Undefined when the message carries
55
+ * none, or is not parseable.
56
+ *
57
+ * For transports that hand the SDK an opaque animation payload and never see a
58
+ * request id — RTC being the case this exists for. There the round's id is
59
+ * minted locally and never travels upstream, so a trace_id derived from it has
60
+ * nothing to do with the server's, and one round reports as two unrelated
61
+ * traces. The traceparent riding the animation is what joins them; pass the
62
+ * result to `startPlaybackTrace`.
63
+ *
64
+ * Kept separate from decoding rather than folded into it: callers need this
65
+ * once per round while frames are decoded continuously.
66
+ *
67
+ * @param rawMessage the same bytes handed to the renderer — a serialized
68
+ * `driveningress.v2.Message`.
69
+ */
70
+ export declare function peekTraceparent(rawMessage: Uint8Array): string | undefined;
52
71
  /**
53
72
  * Record one measurement onto avatarkit's metric pipeline.
54
73
  *
@@ -1,5 +1,4 @@
1
- import { C as recordMetric$1, E as setSdkIdentity$1, g as clockSync } from "./logger-B_tTFAYq.js";
2
- import { o as startPlaybackTrace$1 } from "./otel-trace-DmmQrXv-.js";
1
+ import { A as clockSync, I as recordMetric$1, o as startPlaybackTrace$1, u as Message, z as setSdkIdentity$1 } from "./otel-trace-CdspSqI0.js";
3
2
  //#region internal-telemetry.ts
4
3
  /**
5
4
  * Internal telemetry surface for the companion RTC SDK.
@@ -50,8 +49,33 @@ function isClockCalibrated() {
50
49
  * what lets the backend's spans join a round without threading state through;
51
50
  * reproducing that separately would mean two definitions of one wire contract.
52
51
  */
53
- function startPlaybackTrace(conversationId, startTimeMs, attrs = {}) {
54
- return startPlaybackTrace$1(conversationId, startTimeMs, attrs);
52
+ function startPlaybackTrace(conversationId, startTimeMs, attrs = {}, serverTraceparent) {
53
+ return startPlaybackTrace$1(conversationId, startTimeMs, attrs, serverTraceparent);
54
+ }
55
+ /**
56
+ * Read the W3C traceparent the driving service stamped on an animation
57
+ * message, without decoding its frames. Undefined when the message carries
58
+ * none, or is not parseable.
59
+ *
60
+ * For transports that hand the SDK an opaque animation payload and never see a
61
+ * request id — RTC being the case this exists for. There the round's id is
62
+ * minted locally and never travels upstream, so a trace_id derived from it has
63
+ * nothing to do with the server's, and one round reports as two unrelated
64
+ * traces. The traceparent riding the animation is what joins them; pass the
65
+ * result to `startPlaybackTrace`.
66
+ *
67
+ * Kept separate from decoding rather than folded into it: callers need this
68
+ * once per round while frames are decoded continuously.
69
+ *
70
+ * @param rawMessage the same bytes handed to the renderer — a serialized
71
+ * `driveningress.v2.Message`.
72
+ */
73
+ function peekTraceparent(rawMessage) {
74
+ try {
75
+ return Message.decode(rawMessage).serverResponseAnimation?.traceContext?.traceparent || void 0;
76
+ } catch {
77
+ return;
78
+ }
55
79
  }
56
80
  /**
57
81
  * Record one measurement onto avatarkit's metric pipeline.
@@ -93,4 +117,4 @@ function setSdkIdentity(identity) {
93
117
  setSdkIdentity$1(identity);
94
118
  }
95
119
  //#endregion
96
- export { isClockCalibrated, recordMetric, resolveMonoTimestamp, setSdkIdentity, startPlaybackTrace };
120
+ export { isClockCalibrated, peekTraceparent, recordMetric, resolveMonoTimestamp, setSdkIdentity, startPlaybackTrace };