@spatius/avatarkit 1.3.1 → 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.
- package/CHANGELOG.md +5 -0
- package/dist/{AvatarDownloader-DyhenPKd.js → AvatarDownloader-BDKn8AjO.js} +4 -4
- package/dist/{AvatarSDK-DgPvHU4L.js → AvatarSDK-DqP8n0ex.js} +4 -4
- package/dist/{OpusCodec-CXU7ysrU.js → OpusCodec-B0YtpenN.js} +1 -1
- package/dist/{OpusDecoderProxy-Cq8Z_MZY.js → OpusDecoderProxy-vGagApTz.js} +3 -3
- package/dist/{OpusEncoderProxy-CzY-VckE.js → OpusEncoderProxy-sMAwGYqf.js} +3 -3
- package/dist/{StreamingAudioPlayer-CIJmBp3z.js → StreamingAudioPlayer-DXsCXseQ.js} +2 -2
- package/dist/assets/{AvatarDownloader-G5FO1bVl.js → AvatarDownloader-u-f7nYVa.js} +2 -2
- package/dist/assets/{AvatarSDK-C_Anluwp.js → AvatarSDK-bSFhbb92.js} +4 -4
- package/dist/assets/{OpusDecoderWorker.worker-C2T0afkj.js → OpusDecoderWorker.worker-Cp7jmav3.js} +1 -1
- package/dist/assets/{OpusEncoderWorker.worker-DLYO9vPK.js → OpusEncoderWorker.worker-CQct4FWr.js} +1 -1
- package/dist/assets/{logger-YPooEAbA.js → logger-D7nCOkvy.js} +1 -1
- package/dist/{error-utils-BogEllAd.js → error-utils-D7aLxFrw.js} +1 -1
- package/dist/index.js +50 -21
- package/dist/internal-telemetry.js +2 -2
- package/dist/{logger-BOpQ7u0w.js → logger-gpv4NaPj.js} +1 -1
- package/dist/{otel-trace-Ct4T48nC.js → otel-trace-M2fi3yoE.js} +51 -5
- package/dist/{pwa-cache-manager-C7NbU52Q.js → pwa-cache-manager-CcFR2ARt.js} +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.3.2] - 2026-08-08
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Internal telemetry only, no change to public API or runtime behaviour: fixed the diagnostics the SDK reports to Spatius. Connection setup is now reported as two separate steps (handshake and session confirmation) instead of a single total, steps faster than a millisecond no longer come back out of order, and cache lookups that complete instantly are no longer reported as loads.
|
|
12
|
+
|
|
8
13
|
## [1.3.1] - 2026-08-07
|
|
9
14
|
|
|
10
15
|
Rolls up everything from the 1.3.1 beta line.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-B-1-B7_t.js";
|
|
2
|
-
import { t as AvatarSDK } from "./AvatarSDK-
|
|
3
|
-
import { S as recordHttpClientDuration, c as logEvent, kt as ErrorCode, l as logMetric, t as logger, v as hostOf, xt as AvatarError, yt as generateTraceId } from "./logger-
|
|
4
|
-
import { n as APP_CONFIG, r as getFlameCdnBase, t as errorToMessage } from "./error-utils-
|
|
5
|
-
import { t as PwaCacheManager } from "./pwa-cache-manager-
|
|
2
|
+
import { t as AvatarSDK } from "./AvatarSDK-DqP8n0ex.js";
|
|
3
|
+
import { S as recordHttpClientDuration, c as logEvent, kt as ErrorCode, l as logMetric, t as logger, v as hostOf, xt as AvatarError, yt as generateTraceId } from "./logger-gpv4NaPj.js";
|
|
4
|
+
import { n as APP_CONFIG, r as getFlameCdnBase, t as errorToMessage } from "./error-utils-D7aLxFrw.js";
|
|
5
|
+
import { t as PwaCacheManager } from "./pwa-cache-manager-CcFR2ARt.js";
|
|
6
6
|
//#region core/AvatarDownloader.ts
|
|
7
7
|
var AvatarDownloader_exports = /* @__PURE__ */ __exportAll({ AvatarDownloader: () => AvatarDownloader });
|
|
8
8
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-B-1-B7_t.js";
|
|
2
|
-
import { Mt as LogLevel, Ot as DrivingServiceMode, _ as fetchBootstrap, a as clientContextFields, b as cleanupOtelMetrics, c as logEvent, d as cleanupOtel, dt as OTEL_LOGS_ENDPOINT, f as initializeOtel, ft as OTEL_PASSWORD, g as clockSync, gt as OTEL_USERNAME, i as cleanupPostHog, n as setLogLevel, o as getLogsFeatureFlag, pt as OTEL_STREAM_NAME, r as logSink, s as initializePostHog, t as logger, u as updatePostHogPersonPropertiesForFlags, vt as idManager, x as initializeOtelMetrics } from "./logger-
|
|
3
|
-
import {
|
|
2
|
+
import { Mt as LogLevel, Ot as DrivingServiceMode, _ as fetchBootstrap, a as clientContextFields, b as cleanupOtelMetrics, c as logEvent, d as cleanupOtel, dt as OTEL_LOGS_ENDPOINT, f as initializeOtel, ft as OTEL_PASSWORD, g as clockSync, gt as OTEL_USERNAME, i as cleanupPostHog, n as setLogLevel, o as getLogsFeatureFlag, pt as OTEL_STREAM_NAME, r as logSink, s as initializePostHog, t as logger, u as updatePostHogPersonPropertiesForFlags, vt as idManager, x as initializeOtelMetrics } from "./logger-gpv4NaPj.js";
|
|
3
|
+
import { i as startInitTrace, n as initializeOtelTrace, t as cleanupOtelTrace } from "./otel-trace-M2fi3yoE.js";
|
|
4
4
|
//#region node_modules/.pnpm/@bufbuild+protobuf@2.10.1/node_modules/@bufbuild/protobuf/dist/esm/wire/varint.js
|
|
5
5
|
/**
|
|
6
6
|
* Read a 64 bit varint as two JS numbers.
|
|
@@ -3900,7 +3900,7 @@ var AvatarSDK = class {
|
|
|
3900
3900
|
static _initializationState = "uninitialized";
|
|
3901
3901
|
static _initializingPromise = null;
|
|
3902
3902
|
static _configuration = null;
|
|
3903
|
-
static _version = "1.3.
|
|
3903
|
+
static _version = "1.3.2";
|
|
3904
3904
|
static _avatarCore = null;
|
|
3905
3905
|
static _cachedDeviceScore = null;
|
|
3906
3906
|
static _rendererBackend = null;
|
|
@@ -4089,7 +4089,7 @@ var AvatarSDK = class {
|
|
|
4089
4089
|
logger.log("[AvatarSDK] Loading template resources...");
|
|
4090
4090
|
logEvent("template_init_start", "info", { stage: "sdk_init" });
|
|
4091
4091
|
try {
|
|
4092
|
-
const { AvatarDownloader } = await import("./AvatarDownloader-
|
|
4092
|
+
const { AvatarDownloader } = await import("./AvatarDownloader-BDKn8AjO.js").then((n) => n.n);
|
|
4093
4093
|
const templateResources = await new AvatarDownloader().loadUnifiedTemplate();
|
|
4094
4094
|
if (await this._avatarCore.loadTemplateResourcesFromBuffers(templateResources)) logger.log("[AvatarSDK] Template resources initialized successfully");
|
|
4095
4095
|
else logger.log("[AvatarSDK] Template resources already initialized, skipping...");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-B-1-B7_t.js";
|
|
2
|
-
import { t as logger } from "./logger-
|
|
2
|
+
import { t as logger } from "./logger-gpv4NaPj.js";
|
|
3
3
|
/** Opus granule positions are always in 48 kHz samples, regardless of input rate. */
|
|
4
4
|
var OPUS_GRANULE_RATE = 48e3;
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as logger } from "./logger-
|
|
1
|
+
import { t as logger } from "./logger-gpv4NaPj.js";
|
|
2
2
|
//#region audio/OpusDecoderProxy.ts
|
|
3
3
|
var OpusDecoderProxy = class OpusDecoderProxy {
|
|
4
4
|
worker = null;
|
|
@@ -21,7 +21,7 @@ var OpusDecoderProxy = class OpusDecoderProxy {
|
|
|
21
21
|
} catch (err) {
|
|
22
22
|
logger.warn("[Opus][DecoderProxy] Worker unavailable, falling back to main-thread decode:", err instanceof Error ? err.message : String(err));
|
|
23
23
|
}
|
|
24
|
-
const { OggOpusDecoder } = await import("./OpusCodec-
|
|
24
|
+
const { OggOpusDecoder } = await import("./OpusCodec-B0YtpenN.js").then((n) => n.n);
|
|
25
25
|
proxy.fallbackDecoder = new OggOpusDecoder();
|
|
26
26
|
proxy.backend = "main-thread";
|
|
27
27
|
return proxy;
|
|
@@ -32,7 +32,7 @@ var OpusDecoderProxy = class OpusDecoderProxy {
|
|
|
32
32
|
try {
|
|
33
33
|
worker = new Worker(new URL(
|
|
34
34
|
/* @vite-ignore */
|
|
35
|
-
"/assets/OpusDecoderWorker.worker-
|
|
35
|
+
"/assets/OpusDecoderWorker.worker-Cp7jmav3.js",
|
|
36
36
|
"" + import.meta.url
|
|
37
37
|
), { type: "module" });
|
|
38
38
|
} catch (err) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-B-1-B7_t.js";
|
|
2
|
-
import { t as logger } from "./logger-
|
|
2
|
+
import { t as logger } from "./logger-gpv4NaPj.js";
|
|
3
3
|
//#region audio/OpusEncoderProxy.ts
|
|
4
4
|
var OpusEncoderProxy_exports = /* @__PURE__ */ __exportAll({
|
|
5
5
|
OpusEncoderProxy: () => OpusEncoderProxy,
|
|
@@ -43,7 +43,7 @@ var OpusEncoderProxy = class OpusEncoderProxy {
|
|
|
43
43
|
} catch (err) {
|
|
44
44
|
logger.warn("[Opus][Proxy] Worker unavailable, falling back to main-thread encode:", err instanceof Error ? err.message : String(err));
|
|
45
45
|
}
|
|
46
|
-
const { OggOpusEncoder } = await import("./OpusCodec-
|
|
46
|
+
const { OggOpusEncoder } = await import("./OpusCodec-B0YtpenN.js").then((n) => n.n);
|
|
47
47
|
proxy.fallbackEncoder = new OggOpusEncoder(sampleRate, bitrate);
|
|
48
48
|
proxy.backend = "main-thread";
|
|
49
49
|
return proxy;
|
|
@@ -54,7 +54,7 @@ var OpusEncoderProxy = class OpusEncoderProxy {
|
|
|
54
54
|
try {
|
|
55
55
|
worker = new Worker(new URL(
|
|
56
56
|
/* @vite-ignore */
|
|
57
|
-
"/assets/OpusEncoderWorker.worker-
|
|
57
|
+
"/assets/OpusEncoderWorker.worker-CQct4FWr.js",
|
|
58
58
|
"" + import.meta.url
|
|
59
59
|
), { type: "module" });
|
|
60
60
|
} catch (err) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as logEvent, t as logger } from "./logger-
|
|
2
|
-
import { n as APP_CONFIG, t as errorToMessage } from "./error-utils-
|
|
1
|
+
import { c as logEvent, t as logger } from "./logger-gpv4NaPj.js";
|
|
2
|
+
import { n as APP_CONFIG, t as errorToMessage } from "./error-utils-D7aLxFrw.js";
|
|
3
3
|
//#region audio/StreamingAudioPlayer.ts
|
|
4
4
|
/**
|
|
5
5
|
* Streaming Audio Player
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { bt as ErrorCode, c as logEvent, gt as AvatarError, h as hostOf, ht as generateTraceId, l as logMetric, pt as isDebugMode, t as logger, y as recordHttpClientDuration } from "./logger-
|
|
2
|
-
import { t as AvatarSDK } from "./AvatarSDK-
|
|
1
|
+
import { bt as ErrorCode, c as logEvent, gt as AvatarError, h as hostOf, ht as generateTraceId, l as logMetric, pt as isDebugMode, t as logger, y as recordHttpClientDuration } from "./logger-D7nCOkvy.js";
|
|
2
|
+
import { t as AvatarSDK } from "./AvatarSDK-bSFhbb92.js";
|
|
3
3
|
//#region config/app-config.ts
|
|
4
4
|
const GLOBAL_FLAME_CDN_BASE = "https://cdn.spatialwalk.cloud/public";
|
|
5
5
|
const CN_FLAME_CDN_BASE = "https://cdn.spatialwalk.top/public";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-B-1-B7_t.js";
|
|
2
|
-
import { $ as ContextAPI, A as addHrTimes, B as ATTR_SERVICE_NAME, C as createResource, D as resourceFromAttributes, E as defaultResource, F as millisToHrTime, G as suppressTracing, H as getStringFromEnv, I as otperformance, J as context, K as trace, L as ATTR_EXCEPTION_MESSAGE, M as hrTimeDuration, N as isTimeInput, O as BindOnceFuture, P as isTimeInputHrTime, Q as TraceFlags, R as ATTR_EXCEPTION_STACKTRACE, S as createInstrumentationScope, T as OTLPExporterBase, U as globalErrorHandler, V as getNumberFromEnv, W as isTracingSuppressed, X as isValidTraceId, Y as isSpanContextValid, Z as INVALID_SPAN_CONTEXT, _ as cleanupOtelMetrics, a as clientContextFields, at as registerGlobal, b as createLegacyOtlpBrowserExportDelegate, c as logEvent, ct as OTEL_PASSWORD, d as cleanupOtel, dt as OTEL_TRACES_STREAM_NAME, et as createNoopMeter, f as initializeOtel, ft as OTEL_USERNAME, g as observeExporter, i as cleanupPostHog, it as getGlobal, j as hrTime, k as ExportResultCode, lt as OTEL_STREAM_NAME, m as fetchBootstrap, mt as idManager, n as setLogLevel, nt as createContextKey, o as getLogsFeatureFlag, ot as unregisterGlobal, p as clockSync, q as diag$1, r as logSink, rt as DiagAPI, s as initializePostHog, st as OTEL_LOGS_ENDPOINT, t as logger, tt as ROOT_CONTEXT, u as updatePostHogPersonPropertiesForFlags, ut as OTEL_TRACES_ENDPOINT, v as initializeOtelMetrics, w as toAttributes, x as JSON_ENCODER, xt as LogLevel, yt as DrivingServiceMode, z as ATTR_EXCEPTION_TYPE } from "./logger-
|
|
2
|
+
import { $ as ContextAPI, A as addHrTimes, B as ATTR_SERVICE_NAME, C as createResource, D as resourceFromAttributes, E as defaultResource, F as millisToHrTime, G as suppressTracing, H as getStringFromEnv, I as otperformance, J as context, K as trace, L as ATTR_EXCEPTION_MESSAGE, M as hrTimeDuration, N as isTimeInput, O as BindOnceFuture, P as isTimeInputHrTime, Q as TraceFlags, R as ATTR_EXCEPTION_STACKTRACE, S as createInstrumentationScope, T as OTLPExporterBase, U as globalErrorHandler, V as getNumberFromEnv, W as isTracingSuppressed, X as isValidTraceId, Y as isSpanContextValid, Z as INVALID_SPAN_CONTEXT, _ as cleanupOtelMetrics, a as clientContextFields, at as registerGlobal, b as createLegacyOtlpBrowserExportDelegate, c as logEvent, ct as OTEL_PASSWORD, d as cleanupOtel, dt as OTEL_TRACES_STREAM_NAME, et as createNoopMeter, f as initializeOtel, ft as OTEL_USERNAME, g as observeExporter, i as cleanupPostHog, it as getGlobal, j as hrTime, k as ExportResultCode, lt as OTEL_STREAM_NAME, m as fetchBootstrap, mt as idManager, n as setLogLevel, nt as createContextKey, o as getLogsFeatureFlag, ot as unregisterGlobal, p as clockSync, q as diag$1, r as logSink, rt as DiagAPI, s as initializePostHog, st as OTEL_LOGS_ENDPOINT, t as logger, tt as ROOT_CONTEXT, u as updatePostHogPersonPropertiesForFlags, ut as OTEL_TRACES_ENDPOINT, v as initializeOtelMetrics, w as toAttributes, x as JSON_ENCODER, xt as LogLevel, yt as DrivingServiceMode, z as ATTR_EXCEPTION_TYPE } from "./logger-D7nCOkvy.js";
|
|
3
3
|
//#region node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js
|
|
4
4
|
var BaggageImpl = class BaggageImpl {
|
|
5
5
|
constructor(entries) {
|
|
@@ -2460,7 +2460,7 @@ function startInitTrace(sessionId, startTimeMs, attrs = {}) {
|
|
|
2460
2460
|
attributes: spanAttrs
|
|
2461
2461
|
}, rootCtx);
|
|
2462
2462
|
if (isError) sp.setStatus({ code: SpanStatusCode.ERROR });
|
|
2463
|
-
sp.end(endMs);
|
|
2463
|
+
sp.end(Math.max(endMs, startMs + 1));
|
|
2464
2464
|
} catch {}
|
|
2465
2465
|
},
|
|
2466
2466
|
group: () => NOOP_GROUP,
|
|
@@ -6223,7 +6223,7 @@ var AvatarSDK = class {
|
|
|
6223
6223
|
static _initializationState = "uninitialized";
|
|
6224
6224
|
static _initializingPromise = null;
|
|
6225
6225
|
static _configuration = null;
|
|
6226
|
-
static _version = "1.3.
|
|
6226
|
+
static _version = "1.3.2";
|
|
6227
6227
|
static _avatarCore = null;
|
|
6228
6228
|
static _cachedDeviceScore = null;
|
|
6229
6229
|
static _rendererBackend = null;
|
|
@@ -6412,7 +6412,7 @@ var AvatarSDK = class {
|
|
|
6412
6412
|
logger.log("[AvatarSDK] Loading template resources...");
|
|
6413
6413
|
logEvent("template_init_start", "info", { stage: "sdk_init" });
|
|
6414
6414
|
try {
|
|
6415
|
-
const { AvatarDownloader } = await import("./AvatarDownloader-
|
|
6415
|
+
const { AvatarDownloader } = await import("./AvatarDownloader-u-f7nYVa.js");
|
|
6416
6416
|
const templateResources = await new AvatarDownloader().loadUnifiedTemplate();
|
|
6417
6417
|
if (await this._avatarCore.loadTemplateResourcesFromBuffers(templateResources)) logger.log("[AvatarSDK] Template resources initialized successfully");
|
|
6418
6418
|
else logger.log("[AvatarSDK] Template resources already initialized, skipping...");
|
package/dist/assets/{OpusDecoderWorker.worker-C2T0afkj.js → OpusDecoderWorker.worker-Cp7jmav3.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "./rolldown-runtime-B-1-B7_t.js";
|
|
2
|
-
import { t as logger } from "./logger-
|
|
2
|
+
import { t as logger } from "./logger-D7nCOkvy.js";
|
|
3
3
|
//#region __vite-browser-external
|
|
4
4
|
var require___vite_browser_external = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
5
|
module.exports = {};
|
package/dist/assets/{OpusEncoderWorker.worker-DLYO9vPK.js → OpusEncoderWorker.worker-CQct4FWr.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as __toESM, t as __commonJSMin } from "./rolldown-runtime-B-1-B7_t.js";
|
|
2
|
-
import { t as logger } from "./logger-
|
|
2
|
+
import { t as logger } from "./logger-D7nCOkvy.js";
|
|
3
3
|
//#region __vite-browser-external
|
|
4
4
|
var require___vite_browser_external = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
5
|
module.exports = {};
|
|
@@ -15434,7 +15434,7 @@ async function writeToLocalLog(message, level, extra = {}) {
|
|
|
15434
15434
|
try {
|
|
15435
15435
|
const { shouldPersist, sanitized } = sanitizeForLocalLog(message);
|
|
15436
15436
|
if (!shouldPersist) return;
|
|
15437
|
-
const { AvatarSDK } = await import("./AvatarSDK-
|
|
15437
|
+
const { AvatarSDK } = await import("./AvatarSDK-bSFhbb92.js").then((n) => n.n);
|
|
15438
15438
|
const version = AvatarSDK.version;
|
|
15439
15439
|
const appId = idManager.getAppId();
|
|
15440
15440
|
const userId = idManager.getUserId();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _t as isDebugMode } from "./logger-
|
|
1
|
+
import { _t as isDebugMode } from "./logger-gpv4NaPj.js";
|
|
2
2
|
//#region config/app-config.ts
|
|
3
3
|
var GLOBAL_FLAME_CDN_BASE = "https://cdn.spatialwalk.cloud/public";
|
|
4
4
|
var CN_FLAME_CDN_BASE = "https://cdn.spatialwalk.top/public";
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as EgressType, c as TransportCompression, i as AudioFormat, l as BinaryReader, o as Message, r as avatarViewRegistry, s as MessageType, t as AvatarSDK, u as BinaryWriter } from "./AvatarSDK-
|
|
2
|
-
import { At as FrameStarvationMode, C as recordMetric, Ct as ConnectionState, Dt as DEFAULT_REGION_REQUEST, Et as DEFAULT_REGION, Ft as TransitionType, Mt as LogLevel, Nt as RENDER_QUALITY_PARAMS, Ot as DrivingServiceMode, Pt as RenderQuality, St as AvatarState, Tt as DEFAULT_OPUS_BITRATE, bt as AnimationType, c as logEvent, g as clockSync, h as resolveMarks, jt as LoadProgress, kt as ErrorCode, l as logMetric, m as monoTimestamp, p as monoMarkFrom, t as logger, vt as idManager, wt as ConversationState, xt as AvatarError } from "./logger-
|
|
3
|
-
import { a as startPlaybackTrace,
|
|
4
|
-
import { n as APP_CONFIG } from "./error-utils-
|
|
5
|
-
import { r as OggMuxer, t as OggPageSplitter } from "./OpusCodec-
|
|
6
|
-
import { n as setOpusEncodeFrameSink } from "./OpusEncoderProxy-
|
|
7
|
-
import { t as AvatarDownloader } from "./AvatarDownloader-
|
|
1
|
+
import { a as EgressType, c as TransportCompression, i as AudioFormat, l as BinaryReader, o as Message, r as avatarViewRegistry, s as MessageType, t as AvatarSDK, u as BinaryWriter } from "./AvatarSDK-DqP8n0ex.js";
|
|
2
|
+
import { At as FrameStarvationMode, C as recordMetric, Ct as ConnectionState, Dt as DEFAULT_REGION_REQUEST, Et as DEFAULT_REGION, Ft as TransitionType, Mt as LogLevel, Nt as RENDER_QUALITY_PARAMS, Ot as DrivingServiceMode, Pt as RenderQuality, St as AvatarState, Tt as DEFAULT_OPUS_BITRATE, bt as AnimationType, c as logEvent, g as clockSync, h as resolveMarks, jt as LoadProgress, kt as ErrorCode, l as logMetric, m as monoTimestamp, p as monoMarkFrom, t as logger, vt as idManager, wt as ConversationState, xt as AvatarError } from "./logger-gpv4NaPj.js";
|
|
3
|
+
import { a as startLoadTrace, o as startPlaybackTrace, r as startConnectTrace, s as buildTraceparent } from "./otel-trace-M2fi3yoE.js";
|
|
4
|
+
import { n as APP_CONFIG } from "./error-utils-D7aLxFrw.js";
|
|
5
|
+
import { r as OggMuxer, t as OggPageSplitter } from "./OpusCodec-B0YtpenN.js";
|
|
6
|
+
import { n as setOpusEncodeFrameSink } from "./OpusEncoderProxy-sMAwGYqf.js";
|
|
7
|
+
import { t as AvatarDownloader } from "./AvatarDownloader-BDKn8AjO.js";
|
|
8
8
|
//#region core/Avatar.ts
|
|
9
9
|
var Avatar = class {
|
|
10
10
|
id;
|
|
@@ -311,8 +311,8 @@ var AnimationPlayer = class AnimationPlayer {
|
|
|
311
311
|
*/
|
|
312
312
|
async createAndInitializeStreamingPlayer() {
|
|
313
313
|
if (this.streamingPlayer) return;
|
|
314
|
-
const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-
|
|
315
|
-
const { AvatarSDK } = await import("./AvatarSDK-
|
|
314
|
+
const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-DXsCXseQ.js");
|
|
315
|
+
const { AvatarSDK } = await import("./AvatarSDK-DqP8n0ex.js").then((n) => n.n);
|
|
316
316
|
const audioFormat = AvatarSDK.getAudioFormat();
|
|
317
317
|
this.streamingPlayer = new StreamingAudioPlayer({
|
|
318
318
|
sampleRate: audioFormat.sampleRate,
|
|
@@ -952,6 +952,15 @@ var AnimationWebSocketClient = class extends EventEmitter {
|
|
|
952
952
|
sessionConfigured = false;
|
|
953
953
|
connectionStartTime = 0;
|
|
954
954
|
/**
|
|
955
|
+
* 连接发起时刻(`new WebSocket()` 之前)。
|
|
956
|
+
*
|
|
957
|
+
* `ws_connect_latency` 与 connect trace 都以它为起点。与 `connectionStartTime`
|
|
958
|
+
* 分开:那个是「连接建立成功」的时刻,用来算 session 时长,语义不同。
|
|
959
|
+
*/
|
|
960
|
+
connectStartMs = 0;
|
|
961
|
+
/** 握手完成(onopen)时刻,用来把连接拆成握手 / 会话确认两段。 */
|
|
962
|
+
wsOpenMs = 0;
|
|
963
|
+
/**
|
|
955
964
|
* Opus encoder proxy, created only when the SDK-decided uplink is Opus. Null
|
|
956
965
|
* means audio is sent as raw PCM. Scoped to one connection: created
|
|
957
966
|
* on connect, destroyed on disconnect. Runs the encode off the main thread via
|
|
@@ -1343,7 +1352,7 @@ var AnimationWebSocketClient = class extends EventEmitter {
|
|
|
1343
1352
|
return;
|
|
1344
1353
|
}
|
|
1345
1354
|
try {
|
|
1346
|
-
const { OpusEncoderProxy } = await import("./OpusEncoderProxy-
|
|
1355
|
+
const { OpusEncoderProxy } = await import("./OpusEncoderProxy-sMAwGYqf.js").then((n) => n.t);
|
|
1347
1356
|
const bitrate = opusBitrate ?? 48e3;
|
|
1348
1357
|
this.opusEncoder = await OpusEncoderProxy.create(sampleRate, bitrate);
|
|
1349
1358
|
this.uplinkIsOpus = true;
|
|
@@ -1399,19 +1408,39 @@ var AnimationWebSocketClient = class extends EventEmitter {
|
|
|
1399
1408
|
if (connectionId) url.searchParams.set("connection_id", connectionId);
|
|
1400
1409
|
return url.toString();
|
|
1401
1410
|
}
|
|
1411
|
+
/**
|
|
1412
|
+
* 发一条建连 trace:`connect` 下挂 `ws_handshake` / `session_confirm` 两段。
|
|
1413
|
+
*
|
|
1414
|
+
* 在会话确认时一次性回填(两段的时刻都已知),而不是实时开 span——建连全程只有
|
|
1415
|
+
* 两个边界点,回填式更简单,也与 init / load trace 的做法一致。
|
|
1416
|
+
*/
|
|
1417
|
+
emitConnectTrace(confirmMs) {
|
|
1418
|
+
const start = this.connectStartMs;
|
|
1419
|
+
const open = this.wsOpenMs;
|
|
1420
|
+
if (start <= 0 || open <= 0) return;
|
|
1421
|
+
const t = startConnectTrace(start, {
|
|
1422
|
+
connection_id: idManager.getConnectionId() ?? "",
|
|
1423
|
+
region: AvatarSDK.configuration?.region ?? ""
|
|
1424
|
+
});
|
|
1425
|
+
t.span("ws_handshake", start, open, { dur_ms: open - start });
|
|
1426
|
+
t.span("session_confirm", open, confirmMs, { dur_ms: confirmMs - open });
|
|
1427
|
+
t.end(true, confirmMs, { dur_ms: confirmMs - start });
|
|
1428
|
+
this.wsOpenMs = 0;
|
|
1429
|
+
}
|
|
1402
1430
|
connectWebSocket(url) {
|
|
1403
1431
|
return new Promise((resolve, reject) => {
|
|
1404
1432
|
try {
|
|
1405
1433
|
const urlForLog = this.sanitizeUrlForLog(url);
|
|
1406
1434
|
logger.log(`[AnimationWebSocketClient] Connecting to WebSocket: ${urlForLog}`);
|
|
1407
|
-
|
|
1435
|
+
this.connectStartMs = Date.now();
|
|
1436
|
+
this.wsOpenMs = 0;
|
|
1408
1437
|
this.ws = new WebSocket(url);
|
|
1409
1438
|
this.ws.onopen = () => {
|
|
1410
1439
|
this.isConnecting = false;
|
|
1411
1440
|
this.currentRetryCount = 0;
|
|
1412
1441
|
this.isManuallyDisconnected = false;
|
|
1413
1442
|
this.connectionStartTime = Date.now();
|
|
1414
|
-
|
|
1443
|
+
this.wsOpenMs = this.connectionStartTime;
|
|
1415
1444
|
logger.log(`[AnimationWebSocketClient] WebSocket connected successfully`);
|
|
1416
1445
|
this.configureSession();
|
|
1417
1446
|
this.emit("connected");
|
|
@@ -1586,6 +1615,12 @@ var AnimationWebSocketClient = class extends EventEmitter {
|
|
|
1586
1615
|
idManager.setConnectionId(connectionId);
|
|
1587
1616
|
logger.log(`[AnimationWebSocketClient] Session confirmed, connection_id updated: ${connectionId}`);
|
|
1588
1617
|
} else logger.log("[AnimationWebSocketClient] Session confirmed by server");
|
|
1618
|
+
if (this.connectStartMs > 0) {
|
|
1619
|
+
const confirmMs = Date.now();
|
|
1620
|
+
logMetric("ws_connect_latency", confirmMs - this.connectStartMs, {}, { connection_id: idManager.getConnectionId() || "" });
|
|
1621
|
+
this.emitConnectTrace(confirmMs);
|
|
1622
|
+
this.connectStartMs = 0;
|
|
1623
|
+
}
|
|
1589
1624
|
this.flushPendingAudio();
|
|
1590
1625
|
this.emit("sessionConfirmed", connectionId);
|
|
1591
1626
|
return;
|
|
@@ -2759,7 +2794,7 @@ var AvatarController = class {
|
|
|
2759
2794
|
const { inputAudioFormat } = AvatarSDK.getAudioFormat();
|
|
2760
2795
|
if (inputAudioFormat !== "opus" || this.inputOpusDecoderProxy) return;
|
|
2761
2796
|
try {
|
|
2762
|
-
const { OpusDecoderProxy } = await import("./OpusDecoderProxy-
|
|
2797
|
+
const { OpusDecoderProxy } = await import("./OpusDecoderProxy-vGagApTz.js");
|
|
2763
2798
|
this.inputOpusDecoderProxy = await OpusDecoderProxy.create();
|
|
2764
2799
|
this.inputDecodeChain = Promise.resolve();
|
|
2765
2800
|
} catch (error) {
|
|
@@ -4059,7 +4094,7 @@ var AvatarManager = class AvatarManager {
|
|
|
4059
4094
|
} else {
|
|
4060
4095
|
logger.log(`[AvatarManager] Avatar ${id} cache invalid: updatedAt=${cachedUpdatedAt}->${newUpdatedAt}, modelType=${cachedModelType}->${requestedModelType}, reloading...`);
|
|
4061
4096
|
this.avatarCache.delete(id);
|
|
4062
|
-
const { PwaCacheManager } = await import("./pwa-cache-manager-
|
|
4097
|
+
const { PwaCacheManager } = await import("./pwa-cache-manager-CcFR2ARt.js").then((n) => n.n);
|
|
4063
4098
|
await PwaCacheManager.clearCharacterCache(id);
|
|
4064
4099
|
}
|
|
4065
4100
|
}
|
|
@@ -4138,13 +4173,7 @@ var AvatarManager = class AvatarManager {
|
|
|
4138
4173
|
* @returns Avatar instance, or undefined if not in cache
|
|
4139
4174
|
*/
|
|
4140
4175
|
retrieve(id) {
|
|
4141
|
-
|
|
4142
|
-
const cached = this.avatarCache.get(id);
|
|
4143
|
-
trace.end(true, Date.now(), {
|
|
4144
|
-
result: cached ? "hit" : "miss",
|
|
4145
|
-
cache_hit: cached !== void 0
|
|
4146
|
-
});
|
|
4147
|
-
return cached;
|
|
4176
|
+
return this.avatarCache.get(id);
|
|
4148
4177
|
}
|
|
4149
4178
|
/**
|
|
4150
4179
|
* Clear cached avatar for specified ID
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as recordMetric$1, g as clockSync } from "./logger-
|
|
2
|
-
import {
|
|
1
|
+
import { C as recordMetric$1, g as clockSync } from "./logger-gpv4NaPj.js";
|
|
2
|
+
import { o as startPlaybackTrace$1 } from "./otel-trace-M2fi3yoE.js";
|
|
3
3
|
//#region internal-telemetry.ts
|
|
4
4
|
/**
|
|
5
5
|
* Internal telemetry surface for the companion RTC SDK.
|
|
@@ -15539,7 +15539,7 @@ async function writeToLocalLog(message, level, extra = {}) {
|
|
|
15539
15539
|
try {
|
|
15540
15540
|
const { shouldPersist, sanitized } = sanitizeForLocalLog(message);
|
|
15541
15541
|
if (!shouldPersist) return;
|
|
15542
|
-
const { AvatarSDK } = await import("./AvatarSDK-
|
|
15542
|
+
const { AvatarSDK } = await import("./AvatarSDK-DqP8n0ex.js").then((n) => n.n);
|
|
15543
15543
|
const version = AvatarSDK.version;
|
|
15544
15544
|
const appId = idManager.getAppId();
|
|
15545
15545
|
const userId = idManager.getUserId();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as isSpanContextValid, A as defaultResource, B as otperformance, D as createResource, E as createInstrumentationScope, F as hrTime, G as getNumberFromEnv, H as ATTR_EXCEPTION_STACKTRACE, I as hrTimeDuration, J as isTracingSuppressed, K as getStringFromEnv, L as isTimeInput, M as BindOnceFuture, N as ExportResultCode, O as toAttributes, P as addHrTimes, Q as context, R as isTimeInputHrTime, T as JSON_ENCODER, U as ATTR_EXCEPTION_TYPE, V as ATTR_EXCEPTION_MESSAGE, W as ATTR_SERVICE_NAME, X as trace, Y as suppressTracing, Z as diag$1, a as clientContextFields, at as ROOT_CONTEXT, ct as getGlobal, et as isValidTraceId, ft as OTEL_PASSWORD, gt as OTEL_USERNAME, ht as OTEL_TRACES_STREAM_NAME, it as createNoopMeter, j as resourceFromAttributes, k as OTLPExporterBase, lt as registerGlobal, mt as OTEL_TRACES_ENDPOINT, nt as TraceFlags, ot as createContextKey, q as globalErrorHandler, rt as ContextAPI, st as DiagAPI, t as logger, tt as INVALID_SPAN_CONTEXT, ut as unregisterGlobal, vt as idManager, w as createLegacyOtlpBrowserExportDelegate, y as observeExporter, z as millisToHrTime } from "./logger-
|
|
1
|
+
import { $ as isSpanContextValid, A as defaultResource, B as otperformance, D as createResource, E as createInstrumentationScope, F as hrTime, G as getNumberFromEnv, H as ATTR_EXCEPTION_STACKTRACE, I as hrTimeDuration, J as isTracingSuppressed, K as getStringFromEnv, L as isTimeInput, M as BindOnceFuture, N as ExportResultCode, O as toAttributes, P as addHrTimes, Q as context, R as isTimeInputHrTime, T as JSON_ENCODER, U as ATTR_EXCEPTION_TYPE, V as ATTR_EXCEPTION_MESSAGE, W as ATTR_SERVICE_NAME, X as trace, Y as suppressTracing, Z as diag$1, a as clientContextFields, at as ROOT_CONTEXT, ct as getGlobal, et as isValidTraceId, ft as OTEL_PASSWORD, gt as OTEL_USERNAME, ht as OTEL_TRACES_STREAM_NAME, it as createNoopMeter, j as resourceFromAttributes, k as OTLPExporterBase, lt as registerGlobal, mt as OTEL_TRACES_ENDPOINT, nt as TraceFlags, ot as createContextKey, q as globalErrorHandler, rt as ContextAPI, st as DiagAPI, t as logger, tt as INVALID_SPAN_CONTEXT, ut as unregisterGlobal, vt as idManager, w as createLegacyOtlpBrowserExportDelegate, y as observeExporter, z as millisToHrTime } from "./logger-gpv4NaPj.js";
|
|
2
2
|
//#region node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js
|
|
3
3
|
var BaggageImpl = class BaggageImpl {
|
|
4
4
|
constructor(entries) {
|
|
@@ -2399,7 +2399,7 @@ function startInitTrace(sessionId, startTimeMs, attrs = {}) {
|
|
|
2399
2399
|
attributes: spanAttrs
|
|
2400
2400
|
}, rootCtx);
|
|
2401
2401
|
if (isError) sp.setStatus({ code: SpanStatusCode.ERROR });
|
|
2402
|
-
sp.end(endMs);
|
|
2402
|
+
sp.end(Math.max(endMs, startMs + 1));
|
|
2403
2403
|
} catch {}
|
|
2404
2404
|
},
|
|
2405
2405
|
group: () => NOOP_GROUP,
|
|
@@ -2436,7 +2436,7 @@ function startLoadTrace(avatarId, startTimeMs, attrs = {}) {
|
|
|
2436
2436
|
attributes: spanAttrs
|
|
2437
2437
|
}, rootCtx);
|
|
2438
2438
|
if (isError) s.setStatus({ code: SpanStatusCode.ERROR });
|
|
2439
|
-
s.end(endMs);
|
|
2439
|
+
s.end(Math.max(endMs, startMs + 1));
|
|
2440
2440
|
} catch {}
|
|
2441
2441
|
},
|
|
2442
2442
|
group: () => NOOP_GROUP,
|
|
@@ -2454,6 +2454,52 @@ function startLoadTrace(avatarId, startTimeMs, attrs = {}) {
|
|
|
2454
2454
|
}
|
|
2455
2455
|
}
|
|
2456
2456
|
/**
|
|
2457
|
+
* 开一条建连 trace。root span 名 `connect`,下挂 `ws_handshake` / `session_confirm` 两段。
|
|
2458
|
+
*
|
|
2459
|
+
* 与 `ws_connect_latency` 互补:那条 metric 只给出总耗时,而慢在哪一段——TLS/网络握手,
|
|
2460
|
+
* 还是服务端校验 token、分配资源——只有拆开才看得出。两段的边界就是 `onopen`。
|
|
2461
|
+
*
|
|
2462
|
+
* 与 load / playback 是三条独立 trace,靠 session_id 关联。
|
|
2463
|
+
* @param startTimeMs root span 起点(发起连接那一刻,epoch ms)。
|
|
2464
|
+
* @internal
|
|
2465
|
+
*/
|
|
2466
|
+
function startConnectTrace(startTimeMs, attrs = {}) {
|
|
2467
|
+
if (!tracer || !tracerProvider) return NOOP_TRACE;
|
|
2468
|
+
try {
|
|
2469
|
+
const root = tracer.startSpan("connect", {
|
|
2470
|
+
startTime: startTimeMs,
|
|
2471
|
+
attributes: {
|
|
2472
|
+
session_id: idManager.getSessionId(),
|
|
2473
|
+
...attrs
|
|
2474
|
+
}
|
|
2475
|
+
}, ROOT_CONTEXT);
|
|
2476
|
+
const rootCtx = trace.setSpan(ROOT_CONTEXT, root);
|
|
2477
|
+
return {
|
|
2478
|
+
span(name, startMs, endMs, spanAttrs = {}, isError = false) {
|
|
2479
|
+
try {
|
|
2480
|
+
const s = tracer.startSpan(name, {
|
|
2481
|
+
startTime: startMs,
|
|
2482
|
+
attributes: spanAttrs
|
|
2483
|
+
}, rootCtx);
|
|
2484
|
+
if (isError) s.setStatus({ code: SpanStatusCode.ERROR });
|
|
2485
|
+
s.end(Math.max(endMs, startMs + 1));
|
|
2486
|
+
} catch {}
|
|
2487
|
+
},
|
|
2488
|
+
group: () => NOOP_GROUP,
|
|
2489
|
+
end(ok = true, endTimeMs, endAttrs = {}) {
|
|
2490
|
+
try {
|
|
2491
|
+
for (const [k, v] of Object.entries(endAttrs)) root.setAttribute(k, v);
|
|
2492
|
+
root.setStatus({ code: ok ? SpanStatusCode.OK : SpanStatusCode.ERROR });
|
|
2493
|
+
root.end(endTimeMs);
|
|
2494
|
+
} catch {}
|
|
2495
|
+
}
|
|
2496
|
+
};
|
|
2497
|
+
} catch (error) {
|
|
2498
|
+
logger.warn("[OTel-Trace] Failed to start connect trace:", error instanceof Error ? error.message : String(error));
|
|
2499
|
+
return NOOP_TRACE;
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
/**
|
|
2457
2503
|
* 开一条播放 trace。root span 名 `playback`,trace_id 由 conversation_id 确定性派生,
|
|
2458
2504
|
* conversation_id 同时作为 span 属性(无论是否与后端串成一条 trace,都能按它关联查询)。
|
|
2459
2505
|
* @param startTimeMs root span 起点(首包音频 tap_0 的真实时刻,epoch ms);省略则用当前时刻。
|
|
@@ -2497,7 +2543,7 @@ function startPlaybackTrace(conversationId, startTimeMs, attrs = {}) {
|
|
|
2497
2543
|
startTime: startMs
|
|
2498
2544
|
}, ctx);
|
|
2499
2545
|
if (isError) s.setStatus({ code: SpanStatusCode.ERROR });
|
|
2500
|
-
s.end(endMs);
|
|
2546
|
+
s.end(Math.max(endMs, startMs + 1));
|
|
2501
2547
|
} catch {}
|
|
2502
2548
|
};
|
|
2503
2549
|
return {
|
|
@@ -2562,4 +2608,4 @@ function cleanupOtelTrace() {
|
|
|
2562
2608
|
}
|
|
2563
2609
|
}
|
|
2564
2610
|
//#endregion
|
|
2565
|
-
export {
|
|
2611
|
+
export { startLoadTrace as a, startInitTrace as i, initializeOtelTrace as n, startPlaybackTrace as o, startConnectTrace as r, buildTraceparent as s, cleanupOtelTrace as t };
|
package/package.json
CHANGED