@spatialwalk/avatarkit 1.0.0-beta.51 → 1.0.0-beta.52

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 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.0.0-beta.52] - 2025-01-05
9
+
10
+ ### 🔧 Performance Improvements
11
+ - **Telemetry Optimization** - Consolidated resource download telemetry: removed individual `resource_download` events and added cache information (`cache_hit`, `cache_type`) to total duration metrics (`template_resources_load_measure` and `download_avatar_assets_total_measure`). This enables analysis of download times for cache misses while reducing telemetry overhead.
12
+
8
13
  ## [1.0.0-beta.51] - 2025-01-05
9
14
 
10
15
  ### 🐛 Bugfix
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { A as APP_CONFIG, e as errorToMessage, l as logEvent, a as logger } from "./index-D2_q6K22.js";
4
+ import { A as APP_CONFIG, e as errorToMessage, l as logEvent, a as logger } from "./index-DmQOISG3.js";
5
5
  class StreamingAudioPlayer {
6
6
  constructor(options) {
7
7
  __publicField(this, "audioContext", null);
@@ -7579,7 +7579,7 @@ const _AnimationPlayer = class _AnimationPlayer {
7579
7579
  if (this.streamingPlayer) {
7580
7580
  return;
7581
7581
  }
7582
- const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-DXKLgGU3.js");
7582
+ const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-DZfQ6O5L.js");
7583
7583
  const { AvatarSDK: AvatarSDK2 } = await Promise.resolve().then(() => AvatarSDK$1);
7584
7584
  const audioFormat = AvatarSDK2.getAudioFormat();
7585
7585
  this.streamingPlayer = new StreamingAudioPlayer({
@@ -8969,7 +8969,7 @@ class AvatarSDK {
8969
8969
  }
8970
8970
  __publicField(AvatarSDK, "_isInitialized", false);
8971
8971
  __publicField(AvatarSDK, "_configuration", null);
8972
- __publicField(AvatarSDK, "_version", "1.0.0-beta.51");
8972
+ __publicField(AvatarSDK, "_version", "1.0.0-beta.52");
8973
8973
  __publicField(AvatarSDK, "_avatarCore", null);
8974
8974
  __publicField(AvatarSDK, "_dynamicSdkConfig", null);
8975
8975
  const AvatarSDK$1 = Object.freeze(Object.defineProperty({
@@ -11915,24 +11915,16 @@ class AvatarDownloader {
11915
11915
  }
11916
11916
  updateProgress(resourceName, false);
11917
11917
  logger.log(`📥 Loading ${key} from API CDN: ${url}`);
11918
- const { data: buffer, cacheInfo } = await downloadResource(url, { resourceType: "template" });
11918
+ const { data: buffer } = await downloadResource(url, { resourceType: "template" });
11919
11919
  logger.log(`✅ ${key} loaded: ${buffer.byteLength} bytes`);
11920
11920
  templateResources[key] = buffer;
11921
11921
  updateProgress(resourceName, true);
11922
- logEvent("resource_download", "info", {
11923
- resource_type: "template",
11924
- resource_name: resourceName,
11925
- cache_hit: cacheInfo.cacheHit,
11926
- cache_type: cacheInfo.cacheType,
11927
- pwa_cache_subtype: cacheInfo.pwaCacheSubtype,
11928
- transfer_size: cacheInfo.transferSize,
11929
- cdn_cache_status: cacheInfo.cdnCacheStatus
11930
- });
11931
11922
  });
11932
11923
  await Promise.all(promises);
11933
11924
  return templateResources;
11934
11925
  }
11935
11926
  async loadGlobalFlameResources(progressCallback = null) {
11927
+ var _a;
11936
11928
  await PwaCacheManager.checkTemplateCacheVersion();
11937
11929
  const startTime = Date.now();
11938
11930
  const { cdnBaseUrl, resources } = APP_CONFIG.flame;
@@ -11970,6 +11962,7 @@ class AvatarDownloader {
11970
11962
  }
11971
11963
  };
11972
11964
  const templateResources = {};
11965
+ const cacheInfos = [];
11973
11966
  try {
11974
11967
  const promises = Object.entries(templateFiles).map(async ([key, { url, resourceName }]) => {
11975
11968
  updateProgress(resourceName, false);
@@ -11977,22 +11970,18 @@ class AvatarDownloader {
11977
11970
  const { data: buffer, cacheInfo } = await downloadResource(url, { resourceType: "template" });
11978
11971
  logger.log(`✅ ${key} loaded: ${buffer.byteLength} bytes`);
11979
11972
  templateResources[key] = buffer;
11973
+ cacheInfos.push(cacheInfo);
11980
11974
  updateProgress(resourceName, true);
11981
- logEvent("resource_download", "info", {
11982
- resource_type: "template",
11983
- resource_name: resourceName,
11984
- cache_hit: cacheInfo.cacheHit,
11985
- cache_type: cacheInfo.cacheType,
11986
- pwa_cache_subtype: cacheInfo.pwaCacheSubtype,
11987
- transfer_size: cacheInfo.transferSize,
11988
- cdn_cache_status: cacheInfo.cdnCacheStatus
11989
- });
11990
11975
  });
11991
11976
  await Promise.all(promises);
11977
+ const cacheHit = cacheInfos.length > 0 && cacheInfos.every((info) => info.cacheHit);
11978
+ const cacheType = ((_a = cacheInfos[0]) == null ? void 0 : _a.cacheType) || "none";
11992
11979
  const duration = Date.now() - startTime;
11993
11980
  logEvent("template_resources_load_measure", "info", {
11994
11981
  duration,
11995
- file_count: totalFiles
11982
+ file_count: totalFiles,
11983
+ cache_hit: cacheHit,
11984
+ cache_type: cacheType
11996
11985
  });
11997
11986
  return templateResources;
11998
11987
  } catch (error) {
@@ -12008,21 +11997,12 @@ class AvatarDownloader {
12008
11997
  }
12009
11998
  try {
12010
11999
  logger.log(`📥 Loading camera info from: ${cameraUrl}`);
12011
- const { data: arrayBuffer, cacheInfo } = await downloadResource(cameraUrl, {
12000
+ const { data: arrayBuffer } = await downloadResource(cameraUrl, {
12012
12001
  characterId: characterMeta.characterId ?? void 0,
12013
12002
  resourceType: "character"
12014
12003
  });
12015
12004
  const text = new TextDecoder().decode(arrayBuffer);
12016
12005
  const cameraSettings = JSON.parse(text);
12017
- logEvent("resource_download", "info", {
12018
- resource_type: "camera_settings",
12019
- resource_name: "camera.json",
12020
- cache_hit: cacheInfo.cacheHit,
12021
- cache_type: cacheInfo.cacheType,
12022
- pwa_cache_subtype: cacheInfo.pwaCacheSubtype,
12023
- transfer_size: cacheInfo.transferSize,
12024
- cdn_cache_status: cacheInfo.cdnCacheStatus
12025
- });
12026
12006
  logger.log("✅ Camera info loaded:", cameraSettings);
12027
12007
  return cameraSettings;
12028
12008
  } catch (error) {
@@ -12031,7 +12011,7 @@ class AvatarDownloader {
12031
12011
  }
12032
12012
  }
12033
12013
  async loadCharacterData(characterMeta, options) {
12034
- var _a, _b, _c, _d, _e2, _f, _g, _h, _i2;
12014
+ var _a, _b, _c, _d, _e2, _f, _g, _h, _i2, _j;
12035
12015
  const { progressCallback = null } = options || {};
12036
12016
  const totalStartTime = Date.now();
12037
12017
  const shapeUrl = (_c = (_b = (_a = characterMeta.models) == null ? void 0 : _a.shape) == null ? void 0 : _b.resource) == null ? void 0 : _c.remote;
@@ -12068,6 +12048,7 @@ class AvatarDownloader {
12068
12048
  }
12069
12049
  };
12070
12050
  const characterData = {};
12051
+ const cacheInfos = [];
12071
12052
  const parallelStartTime = Date.now();
12072
12053
  const downloadPromises = filesToLoad.map(async ({ key, url, filename, optional }) => {
12073
12054
  updateProgress(filename, false);
@@ -12083,16 +12064,8 @@ class AvatarDownloader {
12083
12064
  } else if (key === "idleAnimation") {
12084
12065
  characterData.idleAnimation = arrayBuffer;
12085
12066
  }
12067
+ cacheInfos.push(cacheInfo);
12086
12068
  updateProgress(filename, true);
12087
- logEvent("resource_download", "info", {
12088
- resource_type: "character_asset",
12089
- resource_name: filename,
12090
- cache_hit: cacheInfo.cacheHit,
12091
- cache_type: cacheInfo.cacheType,
12092
- pwa_cache_subtype: cacheInfo.pwaCacheSubtype,
12093
- transfer_size: cacheInfo.transferSize,
12094
- cdn_cache_status: cacheInfo.cdnCacheStatus
12095
- });
12096
12069
  return { key, success: true, size: arrayBuffer.byteLength };
12097
12070
  } catch (error) {
12098
12071
  if (!optional) {
@@ -12114,6 +12087,8 @@ class AvatarDownloader {
12114
12087
  });
12115
12088
  throw new Error(reason);
12116
12089
  }
12090
+ const cacheHit = cacheInfos.length > 0 && cacheInfos.every((info) => info.cacheHit);
12091
+ const cacheType = ((_j = cacheInfos[0]) == null ? void 0 : _j.cacheType) || "none";
12117
12092
  const totalSize = Object.values(characterData).reduce((sum, buffer) => {
12118
12093
  return sum + (buffer ? buffer.byteLength : 0);
12119
12094
  }, 0);
@@ -12122,7 +12097,9 @@ class AvatarDownloader {
12122
12097
  total_duration: totalDuration,
12123
12098
  parallel_duration: parallelDuration,
12124
12099
  total_size: totalSize,
12125
- file_count: filesToLoad.length
12100
+ file_count: filesToLoad.length,
12101
+ cache_hit: cacheHit,
12102
+ cache_type: cacheType
12126
12103
  });
12127
12104
  return characterData;
12128
12105
  }
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b, c, f, d, j, g, C, i, D, E, k, h, L, R, S, m } from "./index-D2_q6K22.js";
1
+ import { b, c, f, d, j, g, C, i, D, E, k, h, L, R, S, m } from "./index-DmQOISG3.js";
2
2
  export {
3
3
  b as Avatar,
4
4
  c as AvatarController,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spatialwalk/avatarkit",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.51",
4
+ "version": "1.0.0-beta.52",
5
5
  "packageManager": "pnpm@10.18.2",
6
6
  "description": "SPAvatar SDK - 3D Gaussian Splatting Avatar Rendering SDK",
7
7
  "author": "SPAvatar Team",