@spatius/avatarkit 1.3.1-beta.7 → 1.3.2

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.
Files changed (22) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/{AvatarDownloader-B1tJTnIb.js → AvatarDownloader-BDKn8AjO.js} +98 -43
  3. package/dist/{AvatarSDK-CTprrfJk.js → AvatarSDK-DqP8n0ex.js} +162 -2560
  4. package/dist/{OpusCodec-PWv7ynPp.js → OpusCodec-B0YtpenN.js} +43 -9
  5. package/dist/{OpusDecoderProxy-m0fVN_M2.js → OpusDecoderProxy-vGagApTz.js} +19 -6
  6. package/dist/{OpusEncoderProxy-DiW21sBK.js → OpusEncoderProxy-sMAwGYqf.js} +42 -7
  7. package/dist/{StreamingAudioPlayer-C6hgkvbK.js → StreamingAudioPlayer-DXsCXseQ.js} +2 -2
  8. package/dist/assets/{AvatarDownloader-LO9uuYvm.js → AvatarDownloader-u-f7nYVa.js} +96 -41
  9. package/dist/assets/{AvatarSDK-CPEeTeLT.js → AvatarSDK-bSFhbb92.js} +149 -12
  10. package/dist/assets/{OpusDecoderWorker.worker-CSSWn75M.js → OpusDecoderWorker.worker-Cp7jmav3.js} +21 -5
  11. package/dist/assets/{OpusEncoderWorker.worker-q4TdCVDZ.js → OpusEncoderWorker.worker-CQct4FWr.js} +53 -11
  12. package/dist/assets/{logger-DCzHWd4N.js → logger-D7nCOkvy.js} +319 -126
  13. package/dist/core/AvatarController.d.ts +10 -0
  14. package/dist/{error-utils-BCZDCrc6.js → error-utils-D7aLxFrw.js} +1 -1
  15. package/dist/index.js +304 -44
  16. package/dist/internal-telemetry.d.ts +45 -20
  17. package/dist/internal-telemetry.js +27 -2
  18. package/dist/{logger-DdmfSEn-.js → logger-gpv4NaPj.js} +336 -126
  19. package/dist/otel-trace-M2fi3yoE.js +2611 -0
  20. package/dist/{pwa-cache-manager-BMKyJWXI.js → pwa-cache-manager-CcFR2ARt.js} +1 -1
  21. package/dist/types/index.d.ts +30 -4
  22. package/package.json +1 -1
@@ -1,23 +1,4 @@
1
- /**
2
- * Internal telemetry surface for the companion RTC SDK.
3
- *
4
- * `@spatius/avatarkit-rtc` reports into the same OpenObserve backend and shares
5
- * this SDK's OTel providers, so its spans must sit on the same calibrated
6
- * timeline. Without that, a client whose wall clock is off puts RTC spans at a
7
- * time that does not line up with the server-side records they need to be read
8
- * against.
9
- *
10
- * Deliberately NOT re-exported from the package root: this is a bridge between
11
- * two first-party packages, not API for integrators. It exposes conversion only
12
- * — nothing here can alter the clock baseline.
13
- *
14
- * NOTE: nothing in this file may be tagged `@internal`. The dts plugin runs with
15
- * `stripInternal: true`, which erases such declarations from the emitted `.d.ts`
16
- * — the entry would still export both functions at runtime while shipping an
17
- * empty `export {}` type file, leaving the RTC package with no types.
18
- *
19
- * @packageDocumentation
20
- */
1
+ import { Attributes } from '@opentelemetry/api';
21
2
  /**
22
3
  * Convert a `performance.now()` reading taken earlier into a timeline
23
4
  * timestamp (epoch ms), preferring the server-calibrated baseline and falling
@@ -35,3 +16,47 @@ export declare function resolveMonoTimestamp(mono: number): number;
35
16
  * resolve either way; this only reports whether they are server-aligned yet.
36
17
  */
37
18
  export declare function isClockCalibrated(): boolean;
19
+ /**
20
+ * Handle for one round's trace.
21
+ *
22
+ * Declared here rather than re-exported from `utils/otel-trace`: the dts build
23
+ * excludes `utils/**`, so a type imported from there resolves to a file absent
24
+ * from the published package — which fails the whole module's type resolution,
25
+ * not just that one name.
26
+ *
27
+ * Structurally identical to the internal `PlaybackTrace`; the compiler checks
28
+ * the two match at `startPlaybackTrace`'s return below.
29
+ */
30
+ export interface PlaybackTrace {
31
+ /** Add one interval span under the round's root. */
32
+ span(name: string, startMs: number, endMs: number, attrs?: Attributes, isError?: boolean): void;
33
+ /** Open a container span; spans added to the returned handle nest under it. */
34
+ group(name: string, startMs: number, attrs?: Attributes): SpanGroup;
35
+ /** Close the round's root span. */
36
+ end(ok?: boolean, endTimeMs?: number, attrs?: Attributes): void;
37
+ }
38
+ /** Sub-handle returned by {@link PlaybackTrace.group}. */
39
+ export interface SpanGroup {
40
+ span(name: string, startMs: number, endMs: number, attrs?: Attributes, isError?: boolean): void;
41
+ end(endTimeMs?: number, attrs?: Attributes): void;
42
+ }
43
+ /**
44
+ * Open one round's trace: `driven.request` → `playback` → the caller's spans.
45
+ *
46
+ * Shared with the RTC SDK rather than reimplemented there, so both packages
47
+ * emit the same tree. The root's ids derive from the conversation id, which is
48
+ * what lets the backend's spans join a round without threading state through;
49
+ * reproducing that separately would mean two definitions of one wire contract.
50
+ */
51
+ export declare function startPlaybackTrace(conversationId: string, startTimeMs?: number, attrs?: Attributes): PlaybackTrace;
52
+ /**
53
+ * Record one measurement onto avatarkit's metric pipeline.
54
+ *
55
+ * Must go through here rather than the RTC SDK reaching for the global meter
56
+ * itself: a metrics export is skipped entirely unless that round carried real
57
+ * business data, and the flag saying so lives in this module. A histogram
58
+ * written directly through the global provider lands in the same instrument but
59
+ * leaves the flag clear, so the whole batch — RTC's readings included — is
60
+ * dropped before it is sent.
61
+ */
62
+ export declare function recordMetric(name: string, value: number, attributes?: Attributes): void;
@@ -1,4 +1,5 @@
1
- import { h as clockSync } from "./logger-DdmfSEn-.js";
1
+ import { C as recordMetric$1, g as clockSync } from "./logger-gpv4NaPj.js";
2
+ import { o as startPlaybackTrace$1 } from "./otel-trace-M2fi3yoE.js";
2
3
  //#region internal-telemetry.ts
3
4
  /**
4
5
  * Internal telemetry surface for the companion RTC SDK.
@@ -41,5 +42,29 @@ function resolveMonoTimestamp(mono) {
41
42
  function isClockCalibrated() {
42
43
  return clockSync.isReady();
43
44
  }
45
+ /**
46
+ * Open one round's trace: `driven.request` → `playback` → the caller's spans.
47
+ *
48
+ * Shared with the RTC SDK rather than reimplemented there, so both packages
49
+ * emit the same tree. The root's ids derive from the conversation id, which is
50
+ * what lets the backend's spans join a round without threading state through;
51
+ * reproducing that separately would mean two definitions of one wire contract.
52
+ */
53
+ function startPlaybackTrace(conversationId, startTimeMs, attrs = {}) {
54
+ return startPlaybackTrace$1(conversationId, startTimeMs, attrs);
55
+ }
56
+ /**
57
+ * Record one measurement onto avatarkit's metric pipeline.
58
+ *
59
+ * Must go through here rather than the RTC SDK reaching for the global meter
60
+ * itself: a metrics export is skipped entirely unless that round carried real
61
+ * business data, and the flag saying so lives in this module. A histogram
62
+ * written directly through the global provider lands in the same instrument but
63
+ * leaves the flag clear, so the whole batch — RTC's readings included — is
64
+ * dropped before it is sent.
65
+ */
66
+ function recordMetric(name, value, attributes = {}) {
67
+ recordMetric$1(name, value, attributes);
68
+ }
44
69
  //#endregion
45
- export { isClockCalibrated, resolveMonoTimestamp };
70
+ export { isClockCalibrated, recordMetric, resolveMonoTimestamp, startPlaybackTrace };