@spatialwalk/avatarkit 1.0.0-beta.35 → 1.0.0-beta.37
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 +13 -0
- package/README.md +39 -8
- package/dist/{StreamingAudioPlayer-eWy8xl8G.js → StreamingAudioPlayer-gV0axCZe.js} +54 -7
- package/dist/admin/eslint.config.d.ts +2 -0
- package/dist/admin/generated/buf/validate/validate.d.ts +397 -0
- package/dist/admin/generated/common/v1/models.d.ts +29 -0
- package/dist/admin/generated/console/v1/admin_app.d.ts +77 -0
- package/dist/admin/generated/console/v1/admin_auth.d.ts +69 -0
- package/dist/admin/generated/console/v1/admin_config.d.ts +157 -0
- package/dist/admin/generated/console/v1/admin_user.d.ts +84 -0
- package/dist/admin/generated/console/v1/admin_user_character.d.ts +107 -0
- package/dist/admin/generated/console/v1/app.d.ts +116 -0
- package/dist/admin/generated/console/v1/auth.d.ts +199 -0
- package/dist/admin/generated/console/v1/character.d.ts +74 -0
- package/dist/admin/generated/console/v1/collection_task.d.ts +183 -0
- package/dist/admin/generated/console/v1/console.d.ts +163 -0
- package/dist/admin/generated/console/v1/instance_management.d.ts +156 -0
- package/dist/admin/generated/console/v1/material.d.ts +180 -0
- package/dist/admin/generated/console/v1/pipetemplate.d.ts +106 -0
- package/dist/admin/generated/console/v1/task.d.ts +292 -0
- package/dist/admin/generated/console/v2/async_processing.d.ts +85 -0
- package/dist/admin/generated/google/api/annotations.d.ts +1 -0
- package/dist/admin/generated/google/api/http.d.ts +47 -0
- package/dist/admin/generated/google/protobuf/any.d.ts +27 -0
- package/dist/admin/generated/google/protobuf/descriptor.d.ts +552 -0
- package/dist/admin/generated/google/protobuf/duration.d.ts +27 -0
- package/dist/admin/generated/google/protobuf/empty.d.ts +25 -0
- package/dist/admin/generated/google/protobuf/struct.d.ts +74 -0
- package/dist/admin/generated/google/protobuf/timestamp.d.ts +27 -0
- package/dist/admin/generated/jsonapi/v1/base.d.ts +108 -0
- package/dist/admin/generated/platform/v1/asset_groups.d.ts +204 -0
- package/dist/admin/generated/platform/v1/assets.d.ts +141 -0
- package/dist/admin/generated/platform/v1/auth.d.ts +79 -0
- package/dist/admin/generated/platform/v1/character.d.ts +382 -0
- package/dist/admin/generated/platform/v1/character_template.d.ts +124 -0
- package/dist/admin/generated/platform/v1/christmas_characters.d.ts +118 -0
- package/dist/admin/generated/platform/v1/collection_task.d.ts +60 -0
- package/dist/admin/generated/platform/v1/config.d.ts +130 -0
- package/dist/admin/generated/platform/v1/configkv.d.ts +105 -0
- package/dist/admin/generated/platform/v1/console.d.ts +29 -0
- package/dist/admin/generated/platform/v1/instance_management.d.ts +156 -0
- package/dist/admin/generated/platform/v1/joi_model_apply.d.ts +100 -0
- package/dist/admin/generated/platform/v1/material.d.ts +29 -0
- package/dist/admin/generated/platform/v1/model_evaluation.d.ts +100 -0
- package/dist/admin/generated/platform/v1/oss.d.ts +53 -0
- package/dist/admin/generated/platform/v1/pipetemplate.d.ts +106 -0
- package/dist/admin/generated/platform/v1/provider.d.ts +141 -0
- package/dist/admin/generated/platform/v1/redeem.d.ts +83 -0
- package/dist/admin/generated/platform/v1/sms_send_log.d.ts +95 -0
- package/dist/admin/generated/platform/v1/task.d.ts +39 -0
- package/dist/admin/generated/platform/v1/user.d.ts +142 -0
- package/dist/admin/generated/platform/v1/voice.d.ts +141 -0
- package/dist/admin/generated/realtime/v1/auth.d.ts +77 -0
- package/dist/admin/generated/realtime/v1/customized.d.ts +60 -0
- package/dist/admin/generated/realtime/v1/messages.d.ts +156 -0
- package/dist/admin/generated/realtime/v1/realtime.d.ts +67 -0
- package/dist/admin/generated/realtime/v1/redeem.d.ts +44 -0
- package/dist/admin/generated/realtime/v1/user.d.ts +150 -0
- package/dist/admin/generated/realtime/v2/auth.d.ts +68 -0
- package/dist/admin/generated/realtime/v2/callback.d.ts +56 -0
- package/dist/admin/generated/realtime/v2/joi_avatar.d.ts +204 -0
- package/dist/admin/generated/realtime/v2/model_apply.d.ts +138 -0
- package/dist/admin/generated/realtime/v2/realtime.d.ts +70 -0
- package/dist/admin/generated/realtime/v2/user.d.ts +96 -0
- package/dist/admin/openapi-ts.config.d.ts +8 -0
- package/dist/admin/src/apis/useAssetApi.d.ts +17 -0
- package/dist/admin/src/apis/useAssetGroupApi.d.ts +26 -0
- package/dist/admin/src/apis/useCharacterApi.d.ts +21 -0
- package/dist/admin/src/apis/useCharacterTemplateApi.d.ts +20 -0
- package/dist/admin/src/apis/useChristmasCharactersApi.d.ts +40 -0
- package/dist/admin/src/apis/useCollectionTaskApi.d.ts +64 -0
- package/dist/admin/src/apis/useConfigApi.d.ts +16 -0
- package/dist/admin/src/apis/useConsoleApi.d.ts +24 -0
- package/dist/admin/src/apis/useInstanceManagementApi.d.ts +19 -0
- package/dist/admin/src/apis/useJoiModelApplyApi.d.ts +11 -0
- package/dist/admin/src/apis/useMaterialApi.d.ts +1 -0
- package/dist/admin/src/apis/useOssApi.d.ts +15 -0
- package/dist/admin/src/apis/usePipelineTemplateApi.d.ts +8 -0
- package/dist/admin/src/apis/useProviderApi.d.ts +16 -0
- package/dist/admin/src/apis/useRedeemApi.d.ts +5 -0
- package/dist/admin/src/apis/useSmsSendLogApi.d.ts +14 -0
- package/dist/admin/src/apis/useTaskApi.d.ts +66 -0
- package/dist/admin/src/apis/useUserApi.d.ts +17 -0
- package/dist/admin/src/apis/useVoiceApi.d.ts +15 -0
- package/dist/admin/src/client/client/client.gen.d.ts +2 -0
- package/dist/admin/src/client/client/index.d.ts +8 -0
- package/dist/admin/src/client/client/types.gen.d.ts +70 -0
- package/dist/admin/src/client/client/utils.gen.d.ts +31 -0
- package/dist/admin/src/client/client.gen.d.ts +5 -0
- package/dist/admin/src/client/core/auth.gen.d.ts +8 -0
- package/dist/admin/src/client/core/bodySerializer.gen.d.ts +21 -0
- package/dist/admin/src/client/core/params.gen.d.ts +27 -0
- package/dist/admin/src/client/core/pathSerializer.gen.d.ts +30 -0
- package/dist/admin/src/client/core/queryKeySerializer.gen.d.ts +9 -0
- package/dist/admin/src/client/core/serverSentEvents.gen.d.ts +23 -0
- package/dist/admin/src/client/core/types.gen.d.ts +32 -0
- package/dist/admin/src/client/core/utils.gen.d.ts +19 -0
- package/dist/admin/src/client/index.d.ts +2 -0
- package/dist/admin/src/client/sdk.gen.d.ts +245 -0
- package/dist/admin/src/client/types.gen.d.ts +4009 -0
- package/dist/admin/src/client/valibot.gen.d.ts +7814 -0
- package/dist/admin/src/components/ui/alert/index.d.ts +8 -0
- package/dist/admin/src/components/ui/alert-dialog/index.d.ts +9 -0
- package/dist/admin/src/components/ui/avatar/index.d.ts +9 -0
- package/dist/admin/src/components/ui/badge/index.d.ts +6 -0
- package/dist/admin/src/components/ui/breadcrumb/index.d.ts +7 -0
- package/dist/admin/src/components/ui/button/index.d.ts +7 -0
- package/dist/admin/src/components/ui/card/index.d.ts +6 -0
- package/dist/admin/src/components/ui/checkbox/index.d.ts +1 -0
- package/dist/admin/src/components/ui/collapsible/index.d.ts +3 -0
- package/dist/admin/src/components/ui/combobox/index.d.ts +9 -0
- package/dist/admin/src/components/ui/dialog/index.d.ts +9 -0
- package/dist/admin/src/components/ui/dropdown-menu/index.d.ts +15 -0
- package/dist/admin/src/components/ui/filter-popover/index.d.ts +1 -0
- package/dist/admin/src/components/ui/form/index.d.ts +7 -0
- package/dist/admin/src/components/ui/form/injectionKeys.d.ts +2 -0
- package/dist/admin/src/components/ui/form/useFormField.d.ts +11 -0
- package/dist/admin/src/components/ui/input/index.d.ts +1 -0
- package/dist/admin/src/components/ui/label/index.d.ts +1 -0
- package/dist/admin/src/components/ui/popover/index.d.ts +4 -0
- package/dist/admin/src/components/ui/progress/index.d.ts +1 -0
- package/dist/admin/src/components/ui/select/index.d.ts +11 -0
- package/dist/admin/src/components/ui/separator/index.d.ts +1 -0
- package/dist/admin/src/components/ui/sheet/index.d.ts +13 -0
- package/dist/admin/src/components/ui/sidebar/index.d.ts +37 -0
- package/dist/admin/src/components/ui/sidebar/utils.d.ts +54 -0
- package/dist/admin/src/components/ui/skeleton/index.d.ts +1 -0
- package/dist/admin/src/components/ui/slider/index.d.ts +1 -0
- package/dist/admin/src/components/ui/switch/index.d.ts +1 -0
- package/dist/admin/src/components/ui/tabs/index.d.ts +4 -0
- package/dist/admin/src/components/ui/tags-input/index.d.ts +5 -0
- package/dist/admin/src/components/ui/textarea/index.d.ts +1 -0
- package/dist/admin/src/components/ui/tooltip/index.d.ts +4 -0
- package/dist/admin/src/composables/useApi.d.ts +21 -0
- package/dist/admin/src/composables/useAppStorage.d.ts +9 -0
- package/dist/admin/src/composables/useAssetUpload.d.ts +31 -0
- package/dist/admin/src/composables/useCharacterForm.d.ts +139 -0
- package/dist/admin/src/composables/useCharacterSettings.d.ts +27 -0
- package/dist/admin/src/composables/useCharacterTemplateForm.d.ts +47 -0
- package/dist/admin/src/composables/useCollectionTaskFilters.d.ts +12 -0
- package/dist/admin/src/composables/useFileUpload.d.ts +26 -0
- package/dist/admin/src/composables/useMaterialFilters.d.ts +14 -0
- package/dist/admin/src/composables/useModelEvaluation.d.ts +22 -0
- package/dist/admin/src/composables/useModelEvaluationWebSocket.d.ts +111 -0
- package/dist/admin/src/composables/useModelSettings.d.ts +12 -0
- package/dist/admin/src/composables/usePageScrollLock.d.ts +6 -0
- package/dist/admin/src/composables/useTaskFilters.d.ts +11 -0
- package/dist/admin/src/composables/useTestGroundProviders.d.ts +51 -0
- package/dist/admin/src/constants/character.d.ts +4 -0
- package/dist/admin/src/constants/collection-task.d.ts +5 -0
- package/dist/admin/src/constants/config-previews.d.ts +8 -0
- package/dist/admin/src/constants/container.d.ts +1 -0
- package/dist/admin/src/constants/links.d.ts +7 -0
- package/dist/admin/src/constants/nav.d.ts +17 -0
- package/dist/admin/src/constants/providers.d.ts +17 -0
- package/dist/admin/src/constants/regions.d.ts +10 -0
- package/dist/admin/src/constants/test-ground-voices.d.ts +19 -0
- package/dist/admin/src/constants/ui.d.ts +4 -0
- package/dist/admin/src/constants/voice.d.ts +12 -0
- package/dist/admin/src/constants/volc.d.ts +135 -0
- package/dist/admin/src/lib/cos/constants.d.ts +6 -0
- package/dist/admin/src/lib/cos/useCosDownload.d.ts +39 -0
- package/dist/admin/src/lib/cos/useCosUpload.d.ts +47 -0
- package/dist/admin/src/lib/cos/useVideoInfoExtractor.d.ts +12 -0
- package/dist/admin/src/lib/cos/utils.d.ts +4 -0
- package/dist/admin/src/lib/utils.d.ts +49 -0
- package/dist/admin/src/main.d.ts +0 -0
- package/dist/admin/src/renderSystem/animation/utils/eventEmitter.d.ts +9 -0
- package/dist/admin/src/renderSystem/animation/utils/flameConverter.d.ts +18 -0
- package/dist/admin/src/renderSystem/audio/AnimationPlayer.d.ts +31 -0
- package/dist/admin/src/renderSystem/audio/StreamingAudioPlayer.d.ts +66 -0
- package/dist/admin/src/renderSystem/config/app-config.d.ts +39 -0
- package/dist/admin/src/renderSystem/config/constants.d.ts +3 -0
- package/dist/admin/src/renderSystem/config/sdk-config-loader.d.ts +5 -0
- package/dist/admin/src/renderSystem/core/Avatar.d.ts +8 -0
- package/dist/admin/src/renderSystem/core/AvatarController.d.ts +65 -0
- package/dist/admin/src/renderSystem/core/AvatarDownloader.d.ts +38 -0
- package/dist/admin/src/renderSystem/core/AvatarKit.d.ts +10 -0
- package/dist/admin/src/renderSystem/core/AvatarView.d.ts +67 -0
- package/dist/admin/src/renderSystem/generated/driveningress/v1/driveningress.d.ts +68 -0
- package/dist/admin/src/renderSystem/generated/driveningress/v2/driveningress.d.ts +3 -0
- package/dist/admin/src/renderSystem/generated/google/protobuf/struct.d.ts +74 -0
- package/dist/admin/src/renderSystem/generated/google/protobuf/timestamp.d.ts +27 -0
- package/dist/admin/src/renderSystem/renderer/RenderSystem.d.ts +1 -0
- package/dist/admin/src/renderSystem/renderer/covariance.d.ts +1 -0
- package/dist/admin/src/renderSystem/renderer/renderer.d.ts +7 -0
- package/dist/admin/src/renderSystem/renderer/sortSplats.d.ts +1 -0
- package/dist/admin/src/renderSystem/renderer/webgl/reorderData.d.ts +1 -0
- package/dist/admin/src/renderSystem/renderer/webgl/webglRenderer.d.ts +27 -0
- package/dist/admin/src/renderSystem/renderer/webgpu/webgpuRenderer.d.ts +27 -0
- package/dist/admin/src/renderSystem/types/character-settings.d.ts +18 -0
- package/dist/admin/src/renderSystem/types/character.d.ts +22 -0
- package/dist/admin/src/renderSystem/types/index.d.ts +62 -0
- package/dist/admin/src/renderSystem/utils/animation-interpolation.d.ts +7 -0
- package/dist/admin/src/renderSystem/utils/conversationId.d.ts +1 -0
- package/dist/admin/src/renderSystem/utils/error-utils.d.ts +3 -0
- package/dist/admin/src/renderSystem/utils/id-manager.d.ts +12 -0
- package/dist/admin/src/renderSystem/utils/logger.d.ts +14 -0
- package/dist/admin/src/renderSystem/wasm/avatarCoreAdapter.d.ts +101 -0
- package/dist/admin/src/renderSystem/wasm/avatarCoreMemory.d.ts +92 -0
- package/dist/admin/src/stores/providers.d.ts +336 -0
- package/dist/admin/src/stores/region.d.ts +19 -0
- package/dist/admin/src/stores/user.d.ts +112 -0
- package/dist/admin/src/types/character-settings.d.ts +18 -0
- package/dist/admin/src/types/character.d.ts +117 -0
- package/dist/admin/src/types/collection-task.d.ts +11 -0
- package/dist/admin/src/types/config.d.ts +36 -0
- package/dist/admin/src/types/doubao-voice.d.ts +42 -0
- package/dist/admin/src/types/error.d.ts +5 -0
- package/dist/admin/src/types/model-settings.d.ts +41 -0
- package/dist/admin/src/types/task.d.ts +45 -0
- package/dist/admin/src/types/test-ground.d.ts +36 -0
- package/dist/admin/src/types/video-material.d.ts +130 -0
- package/dist/admin/src/types/voice.d.ts +58 -0
- package/dist/admin/src/utils/asset-config-loader.d.ts +10 -0
- package/dist/admin/src/utils/collection-task.d.ts +3 -0
- package/dist/admin/src/utils/error.d.ts +1 -0
- package/dist/admin/src/utils/hash.d.ts +20 -0
- package/dist/admin/src/utils/model-settings.d.ts +9 -0
- package/dist/admin/src/utils/monad.d.ts +13 -0
- package/dist/admin/src/utils/task.d.ts +8 -0
- package/dist/admin/unocss.config.d.ts +2 -0
- package/dist/admin/vite.config.d.ts +2 -0
- package/dist/admin/vue-macros.config.d.ts +2 -0
- package/dist/animation/AnimationWebSocketClient.d.ts +3 -0
- package/dist/audio/StreamingAudioPlayer.d.ts +4 -0
- package/dist/core/AvatarController.d.ts +2 -0
- package/dist/generated/common/v1/models.d.ts +29 -0
- package/dist/generated/driveningress/v2/driveningress.d.ts +81 -0
- package/dist/{index-DgkjYDp2.js → index-DxIr4cus.js} +1355 -215
- package/dist/index.js +1 -1
- package/dist/renderer/webgpu/webgpuRenderer.d.ts +0 -1
- package/dist/types/index.d.ts +10 -1
- package/dist/utils/id-manager.d.ts +1 -0
- package/package.json +1 -1
|
@@ -605,15 +605,7 @@ function assertFloat32(arg) {
|
|
|
605
605
|
if (Number.isFinite(arg) && (arg > FLOAT32_MAX || arg < FLOAT32_MIN))
|
|
606
606
|
throw new Error("invalid float32: " + arg);
|
|
607
607
|
}
|
|
608
|
-
|
|
609
|
-
MessageType2[MessageType2["MESSAGE_UNSPECIFIED"] = 0] = "MESSAGE_UNSPECIFIED";
|
|
610
|
-
MessageType2[MessageType2["MESSAGE_ERROR"] = 2] = "MESSAGE_ERROR";
|
|
611
|
-
MessageType2[MessageType2["MESSAGE_SERVER_RESPONSE_ANIMATION"] = 1004] = "MESSAGE_SERVER_RESPONSE_ANIMATION";
|
|
612
|
-
MessageType2[MessageType2["MESSAGE_CLIENT_AUDIO_INPUT"] = 2003] = "MESSAGE_CLIENT_AUDIO_INPUT";
|
|
613
|
-
MessageType2[MessageType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
614
|
-
return MessageType2;
|
|
615
|
-
})(MessageType || {});
|
|
616
|
-
function messageTypeFromJSON(object) {
|
|
608
|
+
function messageTypeFromJSON$1(object) {
|
|
617
609
|
switch (object) {
|
|
618
610
|
case 0:
|
|
619
611
|
case "MESSAGE_UNSPECIFIED":
|
|
@@ -633,7 +625,7 @@ function messageTypeFromJSON(object) {
|
|
|
633
625
|
return -1;
|
|
634
626
|
}
|
|
635
627
|
}
|
|
636
|
-
function messageTypeToJSON(object) {
|
|
628
|
+
function messageTypeToJSON$1(object) {
|
|
637
629
|
switch (object) {
|
|
638
630
|
case 0:
|
|
639
631
|
return "MESSAGE_UNSPECIFIED";
|
|
@@ -702,9 +694,9 @@ const ClientAudioInputData = {
|
|
|
702
694
|
},
|
|
703
695
|
fromJSON(object) {
|
|
704
696
|
return {
|
|
705
|
-
reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "",
|
|
706
|
-
audio: isSet(object.audio) ? bytesFromBase64(object.audio) : new Uint8Array(0),
|
|
707
|
-
end: isSet(object.end) ? globalThis.Boolean(object.end) : false
|
|
697
|
+
reqId: isSet$1(object.reqId) ? globalThis.String(object.reqId) : "",
|
|
698
|
+
audio: isSet$1(object.audio) ? bytesFromBase64$1(object.audio) : new Uint8Array(0),
|
|
699
|
+
end: isSet$1(object.end) ? globalThis.Boolean(object.end) : false
|
|
708
700
|
};
|
|
709
701
|
},
|
|
710
702
|
toJSON(message) {
|
|
@@ -713,7 +705,7 @@ const ClientAudioInputData = {
|
|
|
713
705
|
obj.reqId = message.reqId;
|
|
714
706
|
}
|
|
715
707
|
if (message.audio.length !== 0) {
|
|
716
|
-
obj.audio = base64FromBytes(message.audio);
|
|
708
|
+
obj.audio = base64FromBytes$1(message.audio);
|
|
717
709
|
}
|
|
718
710
|
if (message.end !== false) {
|
|
719
711
|
obj.end = message.end;
|
|
@@ -731,10 +723,10 @@ const ClientAudioInputData = {
|
|
|
731
723
|
return message;
|
|
732
724
|
}
|
|
733
725
|
};
|
|
734
|
-
function createBaseFlame() {
|
|
726
|
+
function createBaseFlame$1() {
|
|
735
727
|
return { translation: [], rotation: [], neckPose: [], jawPose: [], eyePose: [], eyeLid: [], expression: [] };
|
|
736
728
|
}
|
|
737
|
-
const Flame = {
|
|
729
|
+
const Flame$1 = {
|
|
738
730
|
encode(message, writer = new BinaryWriter()) {
|
|
739
731
|
writer.uint32(18).fork();
|
|
740
732
|
for (const v of message.translation) {
|
|
@@ -776,7 +768,7 @@ const Flame = {
|
|
|
776
768
|
decode(input, length) {
|
|
777
769
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
778
770
|
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
779
|
-
const message = createBaseFlame();
|
|
771
|
+
const message = createBaseFlame$1();
|
|
780
772
|
while (reader.pos < end) {
|
|
781
773
|
const tag = reader.uint32();
|
|
782
774
|
switch (tag >>> 3) {
|
|
@@ -924,11 +916,11 @@ const Flame = {
|
|
|
924
916
|
return obj;
|
|
925
917
|
},
|
|
926
918
|
create(base) {
|
|
927
|
-
return Flame.fromPartial(base ?? {});
|
|
919
|
+
return Flame$1.fromPartial(base ?? {});
|
|
928
920
|
},
|
|
929
921
|
fromPartial(object) {
|
|
930
922
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
931
|
-
const message = createBaseFlame();
|
|
923
|
+
const message = createBaseFlame$1();
|
|
932
924
|
message.translation = ((_a = object.translation) == null ? void 0 : _a.map((e) => e)) || [];
|
|
933
925
|
message.rotation = ((_b = object.rotation) == null ? void 0 : _b.map((e) => e)) || [];
|
|
934
926
|
message.neckPose = ((_c = object.neckPose) == null ? void 0 : _c.map((e) => e)) || [];
|
|
@@ -939,20 +931,20 @@ const Flame = {
|
|
|
939
931
|
return message;
|
|
940
932
|
}
|
|
941
933
|
};
|
|
942
|
-
function createBaseFlameAnimation() {
|
|
934
|
+
function createBaseFlameAnimation$1() {
|
|
943
935
|
return { keyframes: [] };
|
|
944
936
|
}
|
|
945
|
-
const FlameAnimation = {
|
|
937
|
+
const FlameAnimation$1 = {
|
|
946
938
|
encode(message, writer = new BinaryWriter()) {
|
|
947
939
|
for (const v of message.keyframes) {
|
|
948
|
-
Flame.encode(v, writer.uint32(10).fork()).join();
|
|
940
|
+
Flame$1.encode(v, writer.uint32(10).fork()).join();
|
|
949
941
|
}
|
|
950
942
|
return writer;
|
|
951
943
|
},
|
|
952
944
|
decode(input, length) {
|
|
953
945
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
954
946
|
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
955
|
-
const message = createBaseFlameAnimation();
|
|
947
|
+
const message = createBaseFlameAnimation$1();
|
|
956
948
|
while (reader.pos < end) {
|
|
957
949
|
const tag = reader.uint32();
|
|
958
950
|
switch (tag >>> 3) {
|
|
@@ -960,7 +952,7 @@ const FlameAnimation = {
|
|
|
960
952
|
if (tag !== 10) {
|
|
961
953
|
break;
|
|
962
954
|
}
|
|
963
|
-
message.keyframes.push(Flame.decode(reader, reader.uint32()));
|
|
955
|
+
message.keyframes.push(Flame$1.decode(reader, reader.uint32()));
|
|
964
956
|
continue;
|
|
965
957
|
}
|
|
966
958
|
}
|
|
@@ -973,24 +965,24 @@ const FlameAnimation = {
|
|
|
973
965
|
},
|
|
974
966
|
fromJSON(object) {
|
|
975
967
|
return {
|
|
976
|
-
keyframes: globalThis.Array.isArray(object == null ? void 0 : object.keyframes) ? object.keyframes.map((e) => Flame.fromJSON(e)) : []
|
|
968
|
+
keyframes: globalThis.Array.isArray(object == null ? void 0 : object.keyframes) ? object.keyframes.map((e) => Flame$1.fromJSON(e)) : []
|
|
977
969
|
};
|
|
978
970
|
},
|
|
979
971
|
toJSON(message) {
|
|
980
972
|
var _a;
|
|
981
973
|
const obj = {};
|
|
982
974
|
if ((_a = message.keyframes) == null ? void 0 : _a.length) {
|
|
983
|
-
obj.keyframes = message.keyframes.map((e) => Flame.toJSON(e));
|
|
975
|
+
obj.keyframes = message.keyframes.map((e) => Flame$1.toJSON(e));
|
|
984
976
|
}
|
|
985
977
|
return obj;
|
|
986
978
|
},
|
|
987
979
|
create(base) {
|
|
988
|
-
return FlameAnimation.fromPartial(base ?? {});
|
|
980
|
+
return FlameAnimation$1.fromPartial(base ?? {});
|
|
989
981
|
},
|
|
990
982
|
fromPartial(object) {
|
|
991
983
|
var _a;
|
|
992
|
-
const message = createBaseFlameAnimation();
|
|
993
|
-
message.keyframes = ((_a = object.keyframes) == null ? void 0 : _a.map((e) => Flame.fromPartial(e))) || [];
|
|
984
|
+
const message = createBaseFlameAnimation$1();
|
|
985
|
+
message.keyframes = ((_a = object.keyframes) == null ? void 0 : _a.map((e) => Flame$1.fromPartial(e))) || [];
|
|
994
986
|
return message;
|
|
995
987
|
}
|
|
996
988
|
};
|
|
@@ -1003,7 +995,7 @@ const ServerResponseAnimationData = {
|
|
|
1003
995
|
writer.uint32(10).string(message.reqId);
|
|
1004
996
|
}
|
|
1005
997
|
if (message.animation !== void 0) {
|
|
1006
|
-
FlameAnimation.encode(message.animation, writer.uint32(18).fork()).join();
|
|
998
|
+
FlameAnimation$1.encode(message.animation, writer.uint32(18).fork()).join();
|
|
1007
999
|
}
|
|
1008
1000
|
return writer;
|
|
1009
1001
|
},
|
|
@@ -1025,7 +1017,7 @@ const ServerResponseAnimationData = {
|
|
|
1025
1017
|
if (tag !== 18) {
|
|
1026
1018
|
break;
|
|
1027
1019
|
}
|
|
1028
|
-
message.animation = FlameAnimation.decode(reader, reader.uint32());
|
|
1020
|
+
message.animation = FlameAnimation$1.decode(reader, reader.uint32());
|
|
1029
1021
|
continue;
|
|
1030
1022
|
}
|
|
1031
1023
|
}
|
|
@@ -1038,8 +1030,8 @@ const ServerResponseAnimationData = {
|
|
|
1038
1030
|
},
|
|
1039
1031
|
fromJSON(object) {
|
|
1040
1032
|
return {
|
|
1041
|
-
reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "",
|
|
1042
|
-
animation: isSet(object.animation) ? FlameAnimation.fromJSON(object.animation) : void 0
|
|
1033
|
+
reqId: isSet$1(object.reqId) ? globalThis.String(object.reqId) : "",
|
|
1034
|
+
animation: isSet$1(object.animation) ? FlameAnimation$1.fromJSON(object.animation) : void 0
|
|
1043
1035
|
};
|
|
1044
1036
|
},
|
|
1045
1037
|
toJSON(message) {
|
|
@@ -1048,7 +1040,7 @@ const ServerResponseAnimationData = {
|
|
|
1048
1040
|
obj.reqId = message.reqId;
|
|
1049
1041
|
}
|
|
1050
1042
|
if (message.animation !== void 0) {
|
|
1051
|
-
obj.animation = FlameAnimation.toJSON(message.animation);
|
|
1043
|
+
obj.animation = FlameAnimation$1.toJSON(message.animation);
|
|
1052
1044
|
}
|
|
1053
1045
|
return obj;
|
|
1054
1046
|
},
|
|
@@ -1058,7 +1050,7 @@ const ServerResponseAnimationData = {
|
|
|
1058
1050
|
fromPartial(object) {
|
|
1059
1051
|
const message = createBaseServerResponseAnimationData();
|
|
1060
1052
|
message.reqId = object.reqId ?? "";
|
|
1061
|
-
message.animation = object.animation !== void 0 && object.animation !== null ? FlameAnimation.fromPartial(object.animation) : void 0;
|
|
1053
|
+
message.animation = object.animation !== void 0 && object.animation !== null ? FlameAnimation$1.fromPartial(object.animation) : void 0;
|
|
1062
1054
|
return message;
|
|
1063
1055
|
}
|
|
1064
1056
|
};
|
|
@@ -1116,9 +1108,9 @@ const ErrorInfo = {
|
|
|
1116
1108
|
},
|
|
1117
1109
|
fromJSON(object) {
|
|
1118
1110
|
return {
|
|
1119
|
-
reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "",
|
|
1120
|
-
code: isSet(object.code) ? globalThis.Number(object.code) : 0,
|
|
1121
|
-
reason: isSet(object.reason) ? globalThis.String(object.reason) : ""
|
|
1111
|
+
reqId: isSet$1(object.reqId) ? globalThis.String(object.reqId) : "",
|
|
1112
|
+
code: isSet$1(object.code) ? globalThis.Number(object.code) : 0,
|
|
1113
|
+
reason: isSet$1(object.reason) ? globalThis.String(object.reason) : ""
|
|
1122
1114
|
};
|
|
1123
1115
|
},
|
|
1124
1116
|
toJSON(message) {
|
|
@@ -1145,10 +1137,10 @@ const ErrorInfo = {
|
|
|
1145
1137
|
return message;
|
|
1146
1138
|
}
|
|
1147
1139
|
};
|
|
1148
|
-
function createBaseMessage() {
|
|
1140
|
+
function createBaseMessage$1() {
|
|
1149
1141
|
return { type: 0, error: void 0, serverResponseAnimation: void 0, clientAudioInput: void 0 };
|
|
1150
1142
|
}
|
|
1151
|
-
const Message = {
|
|
1143
|
+
const Message$1 = {
|
|
1152
1144
|
encode(message, writer = new BinaryWriter()) {
|
|
1153
1145
|
if (message.type !== 0) {
|
|
1154
1146
|
writer.uint32(8).int32(message.type);
|
|
@@ -1167,7 +1159,7 @@ const Message = {
|
|
|
1167
1159
|
decode(input, length) {
|
|
1168
1160
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
1169
1161
|
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
1170
|
-
const message = createBaseMessage();
|
|
1162
|
+
const message = createBaseMessage$1();
|
|
1171
1163
|
while (reader.pos < end) {
|
|
1172
1164
|
const tag = reader.uint32();
|
|
1173
1165
|
switch (tag >>> 3) {
|
|
@@ -1209,16 +1201,16 @@ const Message = {
|
|
|
1209
1201
|
},
|
|
1210
1202
|
fromJSON(object) {
|
|
1211
1203
|
return {
|
|
1212
|
-
type: isSet(object.type) ? messageTypeFromJSON(object.type) : 0,
|
|
1213
|
-
error: isSet(object.error) ? ErrorInfo.fromJSON(object.error) : void 0,
|
|
1214
|
-
serverResponseAnimation: isSet(object.serverResponseAnimation) ? ServerResponseAnimationData.fromJSON(object.serverResponseAnimation) : void 0,
|
|
1215
|
-
clientAudioInput: isSet(object.clientAudioInput) ? ClientAudioInputData.fromJSON(object.clientAudioInput) : void 0
|
|
1204
|
+
type: isSet$1(object.type) ? messageTypeFromJSON$1(object.type) : 0,
|
|
1205
|
+
error: isSet$1(object.error) ? ErrorInfo.fromJSON(object.error) : void 0,
|
|
1206
|
+
serverResponseAnimation: isSet$1(object.serverResponseAnimation) ? ServerResponseAnimationData.fromJSON(object.serverResponseAnimation) : void 0,
|
|
1207
|
+
clientAudioInput: isSet$1(object.clientAudioInput) ? ClientAudioInputData.fromJSON(object.clientAudioInput) : void 0
|
|
1216
1208
|
};
|
|
1217
1209
|
},
|
|
1218
1210
|
toJSON(message) {
|
|
1219
1211
|
const obj = {};
|
|
1220
1212
|
if (message.type !== 0) {
|
|
1221
|
-
obj.type = messageTypeToJSON(message.type);
|
|
1213
|
+
obj.type = messageTypeToJSON$1(message.type);
|
|
1222
1214
|
}
|
|
1223
1215
|
if (message.error !== void 0) {
|
|
1224
1216
|
obj.error = ErrorInfo.toJSON(message.error);
|
|
@@ -1232,10 +1224,10 @@ const Message = {
|
|
|
1232
1224
|
return obj;
|
|
1233
1225
|
},
|
|
1234
1226
|
create(base) {
|
|
1235
|
-
return Message.fromPartial(base ?? {});
|
|
1227
|
+
return Message$1.fromPartial(base ?? {});
|
|
1236
1228
|
},
|
|
1237
1229
|
fromPartial(object) {
|
|
1238
|
-
const message = createBaseMessage();
|
|
1230
|
+
const message = createBaseMessage$1();
|
|
1239
1231
|
message.type = object.type ?? 0;
|
|
1240
1232
|
message.error = object.error !== void 0 && object.error !== null ? ErrorInfo.fromPartial(object.error) : void 0;
|
|
1241
1233
|
message.serverResponseAnimation = object.serverResponseAnimation !== void 0 && object.serverResponseAnimation !== null ? ServerResponseAnimationData.fromPartial(object.serverResponseAnimation) : void 0;
|
|
@@ -1243,7 +1235,7 @@ const Message = {
|
|
|
1243
1235
|
return message;
|
|
1244
1236
|
}
|
|
1245
1237
|
};
|
|
1246
|
-
function bytesFromBase64(b64) {
|
|
1238
|
+
function bytesFromBase64$1(b64) {
|
|
1247
1239
|
const bin = globalThis.atob(b64);
|
|
1248
1240
|
const arr = new Uint8Array(bin.length);
|
|
1249
1241
|
for (let i = 0; i < bin.length; ++i) {
|
|
@@ -1251,14 +1243,14 @@ function bytesFromBase64(b64) {
|
|
|
1251
1243
|
}
|
|
1252
1244
|
return arr;
|
|
1253
1245
|
}
|
|
1254
|
-
function base64FromBytes(arr) {
|
|
1246
|
+
function base64FromBytes$1(arr) {
|
|
1255
1247
|
const bin = [];
|
|
1256
1248
|
arr.forEach((byte) => {
|
|
1257
1249
|
bin.push(globalThis.String.fromCharCode(byte));
|
|
1258
1250
|
});
|
|
1259
1251
|
return globalThis.btoa(bin.join(""));
|
|
1260
1252
|
}
|
|
1261
|
-
function isSet(value) {
|
|
1253
|
+
function isSet$1(value) {
|
|
1262
1254
|
return value !== null && value !== void 0;
|
|
1263
1255
|
}
|
|
1264
1256
|
var ResourceType = /* @__PURE__ */ ((ResourceType2) => {
|
|
@@ -1310,6 +1302,7 @@ var ConnectionState = /* @__PURE__ */ ((ConnectionState2) => {
|
|
|
1310
1302
|
var ConversationState = /* @__PURE__ */ ((ConversationState2) => {
|
|
1311
1303
|
ConversationState2["idle"] = "idle";
|
|
1312
1304
|
ConversationState2["playing"] = "playing";
|
|
1305
|
+
ConversationState2["pausing"] = "pausing";
|
|
1313
1306
|
return ConversationState2;
|
|
1314
1307
|
})(ConversationState || {});
|
|
1315
1308
|
var AvatarState = /* @__PURE__ */ ((AvatarState2) => {
|
|
@@ -1321,6 +1314,7 @@ var AvatarState = /* @__PURE__ */ ((AvatarState2) => {
|
|
|
1321
1314
|
})(AvatarState || {});
|
|
1322
1315
|
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
1323
1316
|
ErrorCode2["appIDUnrecognized"] = "appIDUnrecognized";
|
|
1317
|
+
ErrorCode2["avatarIDUnrecognized"] = "avatarIDUnrecognized";
|
|
1324
1318
|
ErrorCode2["sessionTokenInvalid"] = "sessionTokenInvalid";
|
|
1325
1319
|
ErrorCode2["sessionTokenExpired"] = "sessionTokenExpired";
|
|
1326
1320
|
ErrorCode2["failedToFetchAvatarMetadata"] = "failedToFetchAvatarMetadata";
|
|
@@ -2826,6 +2820,9 @@ class IdManager {
|
|
|
2826
2820
|
this.ids.connectionId = generateConversationId();
|
|
2827
2821
|
return this.ids.connectionId;
|
|
2828
2822
|
}
|
|
2823
|
+
setConnectionId(connectionId) {
|
|
2824
|
+
this.ids.connectionId = connectionId;
|
|
2825
|
+
}
|
|
2829
2826
|
getConnectionId() {
|
|
2830
2827
|
return this.ids.connectionId;
|
|
2831
2828
|
}
|
|
@@ -2977,10 +2974,12 @@ const _AnimationPlayer = class _AnimationPlayer {
|
|
|
2977
2974
|
if (this.streamingPlayer) {
|
|
2978
2975
|
return;
|
|
2979
2976
|
}
|
|
2980
|
-
const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-
|
|
2977
|
+
const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-gV0axCZe.js");
|
|
2978
|
+
const { AvatarSDK: AvatarSDK2 } = await Promise.resolve().then(() => AvatarSDK$1);
|
|
2979
|
+
const audioFormat = AvatarSDK2.getAudioFormat();
|
|
2981
2980
|
this.streamingPlayer = new StreamingAudioPlayer({
|
|
2982
|
-
sampleRate:
|
|
2983
|
-
channelCount:
|
|
2981
|
+
sampleRate: audioFormat.sampleRate,
|
|
2982
|
+
channelCount: audioFormat.channelCount,
|
|
2984
2983
|
debug: false
|
|
2985
2984
|
});
|
|
2986
2985
|
try {
|
|
@@ -4322,6 +4321,10 @@ class AvatarSDK {
|
|
|
4322
4321
|
var _a;
|
|
4323
4322
|
return ((_a = this._configuration) == null ? void 0 : _a.drivingServiceMode) ?? DrivingServiceMode.sdk;
|
|
4324
4323
|
}
|
|
4324
|
+
static getAudioFormat() {
|
|
4325
|
+
var _a;
|
|
4326
|
+
return ((_a = this._configuration) == null ? void 0 : _a.audioFormat) ?? { channelCount: 1, sampleRate: 16e3 };
|
|
4327
|
+
}
|
|
4325
4328
|
static getAvatarCore() {
|
|
4326
4329
|
return this._avatarCore;
|
|
4327
4330
|
}
|
|
@@ -4369,7 +4372,10 @@ class AvatarSDK {
|
|
|
4369
4372
|
throw new Error(`No configuration found for environment: ${this._configuration.environment}`);
|
|
4370
4373
|
}
|
|
4371
4374
|
const sdkApiBaseUrl = dynamicConfig;
|
|
4372
|
-
const
|
|
4375
|
+
const wsBaseUrl = dynamicConfig.replace(/^https?:\/\//, (match) => {
|
|
4376
|
+
return match === "https://" ? "wss://" : "ws://";
|
|
4377
|
+
});
|
|
4378
|
+
const driveningressWsUrl = `${wsBaseUrl}/v2/driveningress/websocket`;
|
|
4373
4379
|
return {
|
|
4374
4380
|
sdkApiBaseUrl,
|
|
4375
4381
|
driveningressWsUrl
|
|
@@ -4378,116 +4384,1076 @@ class AvatarSDK {
|
|
|
4378
4384
|
}
|
|
4379
4385
|
__publicField(AvatarSDK, "_isInitialized", false);
|
|
4380
4386
|
__publicField(AvatarSDK, "_configuration", null);
|
|
4381
|
-
__publicField(AvatarSDK, "_version", "1.0.0-beta.
|
|
4387
|
+
__publicField(AvatarSDK, "_version", "1.0.0-beta.37");
|
|
4382
4388
|
__publicField(AvatarSDK, "_avatarCore", null);
|
|
4383
4389
|
__publicField(AvatarSDK, "_dynamicSdkConfig", null);
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4390
|
+
const AvatarSDK$1 = Object.freeze(Object.defineProperty({
|
|
4391
|
+
__proto__: null,
|
|
4392
|
+
AvatarSDK
|
|
4393
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
4394
|
+
var MessageType = /* @__PURE__ */ ((MessageType2) => {
|
|
4395
|
+
MessageType2[MessageType2["MESSAGE_UNSPECIFIED"] = 0] = "MESSAGE_UNSPECIFIED";
|
|
4396
|
+
MessageType2[MessageType2["MESSAGE_CLIENT_CONFIGURE_SESSION"] = 1] = "MESSAGE_CLIENT_CONFIGURE_SESSION";
|
|
4397
|
+
MessageType2[MessageType2["MESSAGE_SERVER_CONFIRM_SESSION"] = 2] = "MESSAGE_SERVER_CONFIRM_SESSION";
|
|
4398
|
+
MessageType2[MessageType2["MESSAGE_CLIENT_AUDIO_INPUT"] = 3] = "MESSAGE_CLIENT_AUDIO_INPUT";
|
|
4399
|
+
MessageType2[MessageType2["MESSAGE_SERVER_ERROR"] = 4] = "MESSAGE_SERVER_ERROR";
|
|
4400
|
+
MessageType2[MessageType2["MESSAGE_SERVER_RESPONSE_ANIMATION"] = 5] = "MESSAGE_SERVER_RESPONSE_ANIMATION";
|
|
4401
|
+
MessageType2[MessageType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
4402
|
+
return MessageType2;
|
|
4403
|
+
})(MessageType || {});
|
|
4404
|
+
function messageTypeFromJSON(object) {
|
|
4405
|
+
switch (object) {
|
|
4406
|
+
case 0:
|
|
4407
|
+
case "MESSAGE_UNSPECIFIED":
|
|
4408
|
+
return 0;
|
|
4409
|
+
case 1:
|
|
4410
|
+
case "MESSAGE_CLIENT_CONFIGURE_SESSION":
|
|
4411
|
+
return 1;
|
|
4412
|
+
case 2:
|
|
4413
|
+
case "MESSAGE_SERVER_CONFIRM_SESSION":
|
|
4414
|
+
return 2;
|
|
4415
|
+
case 3:
|
|
4416
|
+
case "MESSAGE_CLIENT_AUDIO_INPUT":
|
|
4417
|
+
return 3;
|
|
4418
|
+
case 4:
|
|
4419
|
+
case "MESSAGE_SERVER_ERROR":
|
|
4420
|
+
return 4;
|
|
4421
|
+
case 5:
|
|
4422
|
+
case "MESSAGE_SERVER_RESPONSE_ANIMATION":
|
|
4423
|
+
return 5;
|
|
4424
|
+
case -1:
|
|
4425
|
+
case "UNRECOGNIZED":
|
|
4426
|
+
default:
|
|
4427
|
+
return -1;
|
|
4387
4428
|
}
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4429
|
+
}
|
|
4430
|
+
function messageTypeToJSON(object) {
|
|
4431
|
+
switch (object) {
|
|
4432
|
+
case 0:
|
|
4433
|
+
return "MESSAGE_UNSPECIFIED";
|
|
4434
|
+
case 1:
|
|
4435
|
+
return "MESSAGE_CLIENT_CONFIGURE_SESSION";
|
|
4436
|
+
case 2:
|
|
4437
|
+
return "MESSAGE_SERVER_CONFIRM_SESSION";
|
|
4438
|
+
case 3:
|
|
4439
|
+
return "MESSAGE_CLIENT_AUDIO_INPUT";
|
|
4440
|
+
case 4:
|
|
4441
|
+
return "MESSAGE_SERVER_ERROR";
|
|
4442
|
+
case 5:
|
|
4443
|
+
return "MESSAGE_SERVER_RESPONSE_ANIMATION";
|
|
4444
|
+
case -1:
|
|
4445
|
+
default:
|
|
4446
|
+
return "UNRECOGNIZED";
|
|
4393
4447
|
}
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4448
|
+
}
|
|
4449
|
+
var AudioFormat = /* @__PURE__ */ ((AudioFormat2) => {
|
|
4450
|
+
AudioFormat2[AudioFormat2["AUDIO_FORMAT_PCM_S16LE"] = 0] = "AUDIO_FORMAT_PCM_S16LE";
|
|
4451
|
+
AudioFormat2[AudioFormat2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
4452
|
+
return AudioFormat2;
|
|
4453
|
+
})(AudioFormat || {});
|
|
4454
|
+
function audioFormatFromJSON(object) {
|
|
4455
|
+
switch (object) {
|
|
4456
|
+
case 0:
|
|
4457
|
+
case "AUDIO_FORMAT_PCM_S16LE":
|
|
4458
|
+
return 0;
|
|
4459
|
+
case -1:
|
|
4460
|
+
case "UNRECOGNIZED":
|
|
4461
|
+
default:
|
|
4462
|
+
return -1;
|
|
4402
4463
|
}
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4464
|
+
}
|
|
4465
|
+
function audioFormatToJSON(object) {
|
|
4466
|
+
switch (object) {
|
|
4467
|
+
case 0:
|
|
4468
|
+
return "AUDIO_FORMAT_PCM_S16LE";
|
|
4469
|
+
case -1:
|
|
4470
|
+
default:
|
|
4471
|
+
return "UNRECOGNIZED";
|
|
4408
4472
|
}
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4473
|
+
}
|
|
4474
|
+
var TransportCompression = /* @__PURE__ */ ((TransportCompression2) => {
|
|
4475
|
+
TransportCompression2[TransportCompression2["TRANSPORT_COMPRESSION_NONE"] = 0] = "TRANSPORT_COMPRESSION_NONE";
|
|
4476
|
+
TransportCompression2[TransportCompression2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
4477
|
+
return TransportCompression2;
|
|
4478
|
+
})(TransportCompression || {});
|
|
4479
|
+
function transportCompressionFromJSON(object) {
|
|
4480
|
+
switch (object) {
|
|
4481
|
+
case 0:
|
|
4482
|
+
case "TRANSPORT_COMPRESSION_NONE":
|
|
4483
|
+
return 0;
|
|
4484
|
+
case -1:
|
|
4485
|
+
case "UNRECOGNIZED":
|
|
4486
|
+
default:
|
|
4487
|
+
return -1;
|
|
4415
4488
|
}
|
|
4416
4489
|
}
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
__publicField(this, "clientId");
|
|
4425
|
-
__publicField(this, "ws", null);
|
|
4426
|
-
__publicField(this, "currentCharacterId", "");
|
|
4427
|
-
__publicField(this, "currentRetryCount", 0);
|
|
4428
|
-
__publicField(this, "isConnecting", false);
|
|
4429
|
-
__publicField(this, "isManuallyDisconnected", false);
|
|
4430
|
-
__publicField(this, "reconnectTimer", null);
|
|
4431
|
-
this.wsUrl = options.wsUrl;
|
|
4432
|
-
this.reconnectAttempts = options.reconnectAttempts ?? 5;
|
|
4433
|
-
this.jwtToken = options.jwtToken;
|
|
4434
|
-
this.appId = options.appId;
|
|
4435
|
-
this.clientId = options.clientId;
|
|
4490
|
+
function transportCompressionToJSON(object) {
|
|
4491
|
+
switch (object) {
|
|
4492
|
+
case 0:
|
|
4493
|
+
return "TRANSPORT_COMPRESSION_NONE";
|
|
4494
|
+
case -1:
|
|
4495
|
+
default:
|
|
4496
|
+
return "UNRECOGNIZED";
|
|
4436
4497
|
}
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4498
|
+
}
|
|
4499
|
+
function createBaseClientConfigureSession() {
|
|
4500
|
+
return { sampleRate: 0, bitrate: 0, audioFormat: 0, transportCompression: 0 };
|
|
4501
|
+
}
|
|
4502
|
+
const ClientConfigureSession = {
|
|
4503
|
+
encode(message, writer = new BinaryWriter()) {
|
|
4504
|
+
if (message.sampleRate !== 0) {
|
|
4505
|
+
writer.uint32(8).int32(message.sampleRate);
|
|
4441
4506
|
}
|
|
4442
|
-
if (
|
|
4443
|
-
|
|
4444
|
-
return;
|
|
4507
|
+
if (message.bitrate !== 0) {
|
|
4508
|
+
writer.uint32(16).int32(message.bitrate);
|
|
4445
4509
|
}
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
this.currentCharacterId = characterId;
|
|
4449
|
-
idManager.generateConnectionId();
|
|
4450
|
-
const url = this.buildWebSocketUrl(characterId);
|
|
4451
|
-
logger.log("[AnimationWebSocketClient] Connecting to:", url);
|
|
4452
|
-
await this.connectWebSocket(url);
|
|
4453
|
-
logger.log("[AnimationWebSocketClient] Connected successfully");
|
|
4454
|
-
} catch (error) {
|
|
4455
|
-
this.isConnecting = false;
|
|
4456
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
4457
|
-
logger.error("[AnimationWebSocketClient] Connection failed:", message);
|
|
4458
|
-
logEvent("character_animation_service", "error", {
|
|
4459
|
-
characterId,
|
|
4460
|
-
event: "connect_failed",
|
|
4461
|
-
reason: message
|
|
4462
|
-
});
|
|
4463
|
-
throw error;
|
|
4510
|
+
if (message.audioFormat !== 0) {
|
|
4511
|
+
writer.uint32(24).int32(message.audioFormat);
|
|
4464
4512
|
}
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
if (this.ws) {
|
|
4468
|
-
this.ws.close(1e3, "Normal closure");
|
|
4469
|
-
this.ws = null;
|
|
4513
|
+
if (message.transportCompression !== 0) {
|
|
4514
|
+
writer.uint32(32).int32(message.transportCompression);
|
|
4470
4515
|
}
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4516
|
+
return writer;
|
|
4517
|
+
},
|
|
4518
|
+
decode(input, length) {
|
|
4519
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4520
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
4521
|
+
const message = createBaseClientConfigureSession();
|
|
4522
|
+
while (reader.pos < end) {
|
|
4523
|
+
const tag = reader.uint32();
|
|
4524
|
+
switch (tag >>> 3) {
|
|
4525
|
+
case 1: {
|
|
4526
|
+
if (tag !== 8) {
|
|
4527
|
+
break;
|
|
4528
|
+
}
|
|
4529
|
+
message.sampleRate = reader.int32();
|
|
4530
|
+
continue;
|
|
4531
|
+
}
|
|
4532
|
+
case 2: {
|
|
4533
|
+
if (tag !== 16) {
|
|
4534
|
+
break;
|
|
4535
|
+
}
|
|
4536
|
+
message.bitrate = reader.int32();
|
|
4537
|
+
continue;
|
|
4538
|
+
}
|
|
4539
|
+
case 3: {
|
|
4540
|
+
if (tag !== 24) {
|
|
4541
|
+
break;
|
|
4542
|
+
}
|
|
4543
|
+
message.audioFormat = reader.int32();
|
|
4544
|
+
continue;
|
|
4545
|
+
}
|
|
4546
|
+
case 4: {
|
|
4547
|
+
if (tag !== 32) {
|
|
4548
|
+
break;
|
|
4549
|
+
}
|
|
4550
|
+
message.transportCompression = reader.int32();
|
|
4551
|
+
continue;
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4555
|
+
break;
|
|
4556
|
+
}
|
|
4557
|
+
reader.skip(tag & 7);
|
|
4479
4558
|
}
|
|
4480
|
-
|
|
4559
|
+
return message;
|
|
4560
|
+
},
|
|
4561
|
+
fromJSON(object) {
|
|
4562
|
+
return {
|
|
4563
|
+
sampleRate: isSet(object.sampleRate) ? globalThis.Number(object.sampleRate) : 0,
|
|
4564
|
+
bitrate: isSet(object.bitrate) ? globalThis.Number(object.bitrate) : 0,
|
|
4565
|
+
audioFormat: isSet(object.audioFormat) ? audioFormatFromJSON(object.audioFormat) : 0,
|
|
4566
|
+
transportCompression: isSet(object.transportCompression) ? transportCompressionFromJSON(object.transportCompression) : 0
|
|
4567
|
+
};
|
|
4568
|
+
},
|
|
4569
|
+
toJSON(message) {
|
|
4570
|
+
const obj = {};
|
|
4571
|
+
if (message.sampleRate !== 0) {
|
|
4572
|
+
obj.sampleRate = Math.round(message.sampleRate);
|
|
4573
|
+
}
|
|
4574
|
+
if (message.bitrate !== 0) {
|
|
4575
|
+
obj.bitrate = Math.round(message.bitrate);
|
|
4576
|
+
}
|
|
4577
|
+
if (message.audioFormat !== 0) {
|
|
4578
|
+
obj.audioFormat = audioFormatToJSON(message.audioFormat);
|
|
4579
|
+
}
|
|
4580
|
+
if (message.transportCompression !== 0) {
|
|
4581
|
+
obj.transportCompression = transportCompressionToJSON(message.transportCompression);
|
|
4582
|
+
}
|
|
4583
|
+
return obj;
|
|
4584
|
+
},
|
|
4585
|
+
create(base) {
|
|
4586
|
+
return ClientConfigureSession.fromPartial(base ?? {});
|
|
4587
|
+
},
|
|
4588
|
+
fromPartial(object) {
|
|
4589
|
+
const message = createBaseClientConfigureSession();
|
|
4590
|
+
message.sampleRate = object.sampleRate ?? 0;
|
|
4591
|
+
message.bitrate = object.bitrate ?? 0;
|
|
4592
|
+
message.audioFormat = object.audioFormat ?? 0;
|
|
4593
|
+
message.transportCompression = object.transportCompression ?? 0;
|
|
4594
|
+
return message;
|
|
4481
4595
|
}
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4596
|
+
};
|
|
4597
|
+
function createBaseServerConfirmSession() {
|
|
4598
|
+
return { connectionId: "" };
|
|
4599
|
+
}
|
|
4600
|
+
const ServerConfirmSession = {
|
|
4601
|
+
encode(message, writer = new BinaryWriter()) {
|
|
4602
|
+
if (message.connectionId !== "") {
|
|
4603
|
+
writer.uint32(10).string(message.connectionId);
|
|
4486
4604
|
}
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4605
|
+
return writer;
|
|
4606
|
+
},
|
|
4607
|
+
decode(input, length) {
|
|
4608
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4609
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
4610
|
+
const message = createBaseServerConfirmSession();
|
|
4611
|
+
while (reader.pos < end) {
|
|
4612
|
+
const tag = reader.uint32();
|
|
4613
|
+
switch (tag >>> 3) {
|
|
4614
|
+
case 1: {
|
|
4615
|
+
if (tag !== 10) {
|
|
4616
|
+
break;
|
|
4617
|
+
}
|
|
4618
|
+
message.connectionId = reader.string();
|
|
4619
|
+
continue;
|
|
4620
|
+
}
|
|
4621
|
+
}
|
|
4622
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4623
|
+
break;
|
|
4624
|
+
}
|
|
4625
|
+
reader.skip(tag & 7);
|
|
4626
|
+
}
|
|
4627
|
+
return message;
|
|
4628
|
+
},
|
|
4629
|
+
fromJSON(object) {
|
|
4630
|
+
return { connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "" };
|
|
4631
|
+
},
|
|
4632
|
+
toJSON(message) {
|
|
4633
|
+
const obj = {};
|
|
4634
|
+
if (message.connectionId !== "") {
|
|
4635
|
+
obj.connectionId = message.connectionId;
|
|
4636
|
+
}
|
|
4637
|
+
return obj;
|
|
4638
|
+
},
|
|
4639
|
+
create(base) {
|
|
4640
|
+
return ServerConfirmSession.fromPartial(base ?? {});
|
|
4641
|
+
},
|
|
4642
|
+
fromPartial(object) {
|
|
4643
|
+
const message = createBaseServerConfirmSession();
|
|
4644
|
+
message.connectionId = object.connectionId ?? "";
|
|
4645
|
+
return message;
|
|
4646
|
+
}
|
|
4647
|
+
};
|
|
4648
|
+
function createBaseClientAudioInput() {
|
|
4649
|
+
return { reqId: "", end: false, audio: new Uint8Array(0) };
|
|
4650
|
+
}
|
|
4651
|
+
const ClientAudioInput = {
|
|
4652
|
+
encode(message, writer = new BinaryWriter()) {
|
|
4653
|
+
if (message.reqId !== "") {
|
|
4654
|
+
writer.uint32(10).string(message.reqId);
|
|
4655
|
+
}
|
|
4656
|
+
if (message.end !== false) {
|
|
4657
|
+
writer.uint32(16).bool(message.end);
|
|
4658
|
+
}
|
|
4659
|
+
if (message.audio.length !== 0) {
|
|
4660
|
+
writer.uint32(26).bytes(message.audio);
|
|
4661
|
+
}
|
|
4662
|
+
return writer;
|
|
4663
|
+
},
|
|
4664
|
+
decode(input, length) {
|
|
4665
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4666
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
4667
|
+
const message = createBaseClientAudioInput();
|
|
4668
|
+
while (reader.pos < end) {
|
|
4669
|
+
const tag = reader.uint32();
|
|
4670
|
+
switch (tag >>> 3) {
|
|
4671
|
+
case 1: {
|
|
4672
|
+
if (tag !== 10) {
|
|
4673
|
+
break;
|
|
4674
|
+
}
|
|
4675
|
+
message.reqId = reader.string();
|
|
4676
|
+
continue;
|
|
4677
|
+
}
|
|
4678
|
+
case 2: {
|
|
4679
|
+
if (tag !== 16) {
|
|
4680
|
+
break;
|
|
4681
|
+
}
|
|
4682
|
+
message.end = reader.bool();
|
|
4683
|
+
continue;
|
|
4684
|
+
}
|
|
4685
|
+
case 3: {
|
|
4686
|
+
if (tag !== 26) {
|
|
4687
|
+
break;
|
|
4688
|
+
}
|
|
4689
|
+
message.audio = reader.bytes();
|
|
4690
|
+
continue;
|
|
4691
|
+
}
|
|
4692
|
+
}
|
|
4693
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4694
|
+
break;
|
|
4695
|
+
}
|
|
4696
|
+
reader.skip(tag & 7);
|
|
4697
|
+
}
|
|
4698
|
+
return message;
|
|
4699
|
+
},
|
|
4700
|
+
fromJSON(object) {
|
|
4701
|
+
return {
|
|
4702
|
+
reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "",
|
|
4703
|
+
end: isSet(object.end) ? globalThis.Boolean(object.end) : false,
|
|
4704
|
+
audio: isSet(object.audio) ? bytesFromBase64(object.audio) : new Uint8Array(0)
|
|
4705
|
+
};
|
|
4706
|
+
},
|
|
4707
|
+
toJSON(message) {
|
|
4708
|
+
const obj = {};
|
|
4709
|
+
if (message.reqId !== "") {
|
|
4710
|
+
obj.reqId = message.reqId;
|
|
4711
|
+
}
|
|
4712
|
+
if (message.end !== false) {
|
|
4713
|
+
obj.end = message.end;
|
|
4714
|
+
}
|
|
4715
|
+
if (message.audio.length !== 0) {
|
|
4716
|
+
obj.audio = base64FromBytes(message.audio);
|
|
4717
|
+
}
|
|
4718
|
+
return obj;
|
|
4719
|
+
},
|
|
4720
|
+
create(base) {
|
|
4721
|
+
return ClientAudioInput.fromPartial(base ?? {});
|
|
4722
|
+
},
|
|
4723
|
+
fromPartial(object) {
|
|
4724
|
+
const message = createBaseClientAudioInput();
|
|
4725
|
+
message.reqId = object.reqId ?? "";
|
|
4726
|
+
message.end = object.end ?? false;
|
|
4727
|
+
message.audio = object.audio ?? new Uint8Array(0);
|
|
4728
|
+
return message;
|
|
4729
|
+
}
|
|
4730
|
+
};
|
|
4731
|
+
function createBaseServerError() {
|
|
4732
|
+
return { connectionId: "", reqId: "", code: 0, message: "" };
|
|
4733
|
+
}
|
|
4734
|
+
const ServerError = {
|
|
4735
|
+
encode(message, writer = new BinaryWriter()) {
|
|
4736
|
+
if (message.connectionId !== "") {
|
|
4737
|
+
writer.uint32(10).string(message.connectionId);
|
|
4738
|
+
}
|
|
4739
|
+
if (message.reqId !== "") {
|
|
4740
|
+
writer.uint32(18).string(message.reqId);
|
|
4741
|
+
}
|
|
4742
|
+
if (message.code !== 0) {
|
|
4743
|
+
writer.uint32(24).int32(message.code);
|
|
4744
|
+
}
|
|
4745
|
+
if (message.message !== "") {
|
|
4746
|
+
writer.uint32(34).string(message.message);
|
|
4747
|
+
}
|
|
4748
|
+
return writer;
|
|
4749
|
+
},
|
|
4750
|
+
decode(input, length) {
|
|
4751
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4752
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
4753
|
+
const message = createBaseServerError();
|
|
4754
|
+
while (reader.pos < end) {
|
|
4755
|
+
const tag = reader.uint32();
|
|
4756
|
+
switch (tag >>> 3) {
|
|
4757
|
+
case 1: {
|
|
4758
|
+
if (tag !== 10) {
|
|
4759
|
+
break;
|
|
4760
|
+
}
|
|
4761
|
+
message.connectionId = reader.string();
|
|
4762
|
+
continue;
|
|
4763
|
+
}
|
|
4764
|
+
case 2: {
|
|
4765
|
+
if (tag !== 18) {
|
|
4766
|
+
break;
|
|
4767
|
+
}
|
|
4768
|
+
message.reqId = reader.string();
|
|
4769
|
+
continue;
|
|
4770
|
+
}
|
|
4771
|
+
case 3: {
|
|
4772
|
+
if (tag !== 24) {
|
|
4773
|
+
break;
|
|
4774
|
+
}
|
|
4775
|
+
message.code = reader.int32();
|
|
4776
|
+
continue;
|
|
4777
|
+
}
|
|
4778
|
+
case 4: {
|
|
4779
|
+
if (tag !== 34) {
|
|
4780
|
+
break;
|
|
4781
|
+
}
|
|
4782
|
+
message.message = reader.string();
|
|
4783
|
+
continue;
|
|
4784
|
+
}
|
|
4785
|
+
}
|
|
4786
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4787
|
+
break;
|
|
4788
|
+
}
|
|
4789
|
+
reader.skip(tag & 7);
|
|
4790
|
+
}
|
|
4791
|
+
return message;
|
|
4792
|
+
},
|
|
4793
|
+
fromJSON(object) {
|
|
4794
|
+
return {
|
|
4795
|
+
connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "",
|
|
4796
|
+
reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "",
|
|
4797
|
+
code: isSet(object.code) ? globalThis.Number(object.code) : 0,
|
|
4798
|
+
message: isSet(object.message) ? globalThis.String(object.message) : ""
|
|
4799
|
+
};
|
|
4800
|
+
},
|
|
4801
|
+
toJSON(message) {
|
|
4802
|
+
const obj = {};
|
|
4803
|
+
if (message.connectionId !== "") {
|
|
4804
|
+
obj.connectionId = message.connectionId;
|
|
4805
|
+
}
|
|
4806
|
+
if (message.reqId !== "") {
|
|
4807
|
+
obj.reqId = message.reqId;
|
|
4808
|
+
}
|
|
4809
|
+
if (message.code !== 0) {
|
|
4810
|
+
obj.code = Math.round(message.code);
|
|
4811
|
+
}
|
|
4812
|
+
if (message.message !== "") {
|
|
4813
|
+
obj.message = message.message;
|
|
4814
|
+
}
|
|
4815
|
+
return obj;
|
|
4816
|
+
},
|
|
4817
|
+
create(base) {
|
|
4818
|
+
return ServerError.fromPartial(base ?? {});
|
|
4819
|
+
},
|
|
4820
|
+
fromPartial(object) {
|
|
4821
|
+
const message = createBaseServerError();
|
|
4822
|
+
message.connectionId = object.connectionId ?? "";
|
|
4823
|
+
message.reqId = object.reqId ?? "";
|
|
4824
|
+
message.code = object.code ?? 0;
|
|
4825
|
+
message.message = object.message ?? "";
|
|
4826
|
+
return message;
|
|
4827
|
+
}
|
|
4828
|
+
};
|
|
4829
|
+
function createBaseFlame() {
|
|
4830
|
+
return { translation: [], rotation: [], neckPose: [], jawPose: [], eyePose: [], eyeLid: [], expression: [] };
|
|
4831
|
+
}
|
|
4832
|
+
const Flame = {
|
|
4833
|
+
encode(message, writer = new BinaryWriter()) {
|
|
4834
|
+
writer.uint32(10).fork();
|
|
4835
|
+
for (const v of message.translation) {
|
|
4836
|
+
writer.float(v);
|
|
4837
|
+
}
|
|
4838
|
+
writer.join();
|
|
4839
|
+
writer.uint32(18).fork();
|
|
4840
|
+
for (const v of message.rotation) {
|
|
4841
|
+
writer.float(v);
|
|
4842
|
+
}
|
|
4843
|
+
writer.join();
|
|
4844
|
+
writer.uint32(26).fork();
|
|
4845
|
+
for (const v of message.neckPose) {
|
|
4846
|
+
writer.float(v);
|
|
4847
|
+
}
|
|
4848
|
+
writer.join();
|
|
4849
|
+
writer.uint32(34).fork();
|
|
4850
|
+
for (const v of message.jawPose) {
|
|
4851
|
+
writer.float(v);
|
|
4852
|
+
}
|
|
4853
|
+
writer.join();
|
|
4854
|
+
writer.uint32(42).fork();
|
|
4855
|
+
for (const v of message.eyePose) {
|
|
4856
|
+
writer.float(v);
|
|
4857
|
+
}
|
|
4858
|
+
writer.join();
|
|
4859
|
+
writer.uint32(50).fork();
|
|
4860
|
+
for (const v of message.eyeLid) {
|
|
4861
|
+
writer.float(v);
|
|
4862
|
+
}
|
|
4863
|
+
writer.join();
|
|
4864
|
+
writer.uint32(58).fork();
|
|
4865
|
+
for (const v of message.expression) {
|
|
4866
|
+
writer.float(v);
|
|
4867
|
+
}
|
|
4868
|
+
writer.join();
|
|
4869
|
+
return writer;
|
|
4870
|
+
},
|
|
4871
|
+
decode(input, length) {
|
|
4872
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
4873
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
4874
|
+
const message = createBaseFlame();
|
|
4875
|
+
while (reader.pos < end) {
|
|
4876
|
+
const tag = reader.uint32();
|
|
4877
|
+
switch (tag >>> 3) {
|
|
4878
|
+
case 1: {
|
|
4879
|
+
if (tag === 13) {
|
|
4880
|
+
message.translation.push(reader.float());
|
|
4881
|
+
continue;
|
|
4882
|
+
}
|
|
4883
|
+
if (tag === 10) {
|
|
4884
|
+
const end2 = reader.uint32() + reader.pos;
|
|
4885
|
+
while (reader.pos < end2) {
|
|
4886
|
+
message.translation.push(reader.float());
|
|
4887
|
+
}
|
|
4888
|
+
continue;
|
|
4889
|
+
}
|
|
4890
|
+
break;
|
|
4891
|
+
}
|
|
4892
|
+
case 2: {
|
|
4893
|
+
if (tag === 21) {
|
|
4894
|
+
message.rotation.push(reader.float());
|
|
4895
|
+
continue;
|
|
4896
|
+
}
|
|
4897
|
+
if (tag === 18) {
|
|
4898
|
+
const end2 = reader.uint32() + reader.pos;
|
|
4899
|
+
while (reader.pos < end2) {
|
|
4900
|
+
message.rotation.push(reader.float());
|
|
4901
|
+
}
|
|
4902
|
+
continue;
|
|
4903
|
+
}
|
|
4904
|
+
break;
|
|
4905
|
+
}
|
|
4906
|
+
case 3: {
|
|
4907
|
+
if (tag === 29) {
|
|
4908
|
+
message.neckPose.push(reader.float());
|
|
4909
|
+
continue;
|
|
4910
|
+
}
|
|
4911
|
+
if (tag === 26) {
|
|
4912
|
+
const end2 = reader.uint32() + reader.pos;
|
|
4913
|
+
while (reader.pos < end2) {
|
|
4914
|
+
message.neckPose.push(reader.float());
|
|
4915
|
+
}
|
|
4916
|
+
continue;
|
|
4917
|
+
}
|
|
4918
|
+
break;
|
|
4919
|
+
}
|
|
4920
|
+
case 4: {
|
|
4921
|
+
if (tag === 37) {
|
|
4922
|
+
message.jawPose.push(reader.float());
|
|
4923
|
+
continue;
|
|
4924
|
+
}
|
|
4925
|
+
if (tag === 34) {
|
|
4926
|
+
const end2 = reader.uint32() + reader.pos;
|
|
4927
|
+
while (reader.pos < end2) {
|
|
4928
|
+
message.jawPose.push(reader.float());
|
|
4929
|
+
}
|
|
4930
|
+
continue;
|
|
4931
|
+
}
|
|
4932
|
+
break;
|
|
4933
|
+
}
|
|
4934
|
+
case 5: {
|
|
4935
|
+
if (tag === 45) {
|
|
4936
|
+
message.eyePose.push(reader.float());
|
|
4937
|
+
continue;
|
|
4938
|
+
}
|
|
4939
|
+
if (tag === 42) {
|
|
4940
|
+
const end2 = reader.uint32() + reader.pos;
|
|
4941
|
+
while (reader.pos < end2) {
|
|
4942
|
+
message.eyePose.push(reader.float());
|
|
4943
|
+
}
|
|
4944
|
+
continue;
|
|
4945
|
+
}
|
|
4946
|
+
break;
|
|
4947
|
+
}
|
|
4948
|
+
case 6: {
|
|
4949
|
+
if (tag === 53) {
|
|
4950
|
+
message.eyeLid.push(reader.float());
|
|
4951
|
+
continue;
|
|
4952
|
+
}
|
|
4953
|
+
if (tag === 50) {
|
|
4954
|
+
const end2 = reader.uint32() + reader.pos;
|
|
4955
|
+
while (reader.pos < end2) {
|
|
4956
|
+
message.eyeLid.push(reader.float());
|
|
4957
|
+
}
|
|
4958
|
+
continue;
|
|
4959
|
+
}
|
|
4960
|
+
break;
|
|
4961
|
+
}
|
|
4962
|
+
case 7: {
|
|
4963
|
+
if (tag === 61) {
|
|
4964
|
+
message.expression.push(reader.float());
|
|
4965
|
+
continue;
|
|
4966
|
+
}
|
|
4967
|
+
if (tag === 58) {
|
|
4968
|
+
const end2 = reader.uint32() + reader.pos;
|
|
4969
|
+
while (reader.pos < end2) {
|
|
4970
|
+
message.expression.push(reader.float());
|
|
4971
|
+
}
|
|
4972
|
+
continue;
|
|
4973
|
+
}
|
|
4974
|
+
break;
|
|
4975
|
+
}
|
|
4976
|
+
}
|
|
4977
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
4978
|
+
break;
|
|
4979
|
+
}
|
|
4980
|
+
reader.skip(tag & 7);
|
|
4981
|
+
}
|
|
4982
|
+
return message;
|
|
4983
|
+
},
|
|
4984
|
+
fromJSON(object) {
|
|
4985
|
+
return {
|
|
4986
|
+
translation: globalThis.Array.isArray(object == null ? void 0 : object.translation) ? object.translation.map((e) => globalThis.Number(e)) : [],
|
|
4987
|
+
rotation: globalThis.Array.isArray(object == null ? void 0 : object.rotation) ? object.rotation.map((e) => globalThis.Number(e)) : [],
|
|
4988
|
+
neckPose: globalThis.Array.isArray(object == null ? void 0 : object.neckPose) ? object.neckPose.map((e) => globalThis.Number(e)) : [],
|
|
4989
|
+
jawPose: globalThis.Array.isArray(object == null ? void 0 : object.jawPose) ? object.jawPose.map((e) => globalThis.Number(e)) : [],
|
|
4990
|
+
eyePose: globalThis.Array.isArray(object == null ? void 0 : object.eyePose) ? object.eyePose.map((e) => globalThis.Number(e)) : [],
|
|
4991
|
+
eyeLid: globalThis.Array.isArray(object == null ? void 0 : object.eyeLid) ? object.eyeLid.map((e) => globalThis.Number(e)) : [],
|
|
4992
|
+
expression: globalThis.Array.isArray(object == null ? void 0 : object.expression) ? object.expression.map((e) => globalThis.Number(e)) : []
|
|
4993
|
+
};
|
|
4994
|
+
},
|
|
4995
|
+
toJSON(message) {
|
|
4996
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
4997
|
+
const obj = {};
|
|
4998
|
+
if ((_a = message.translation) == null ? void 0 : _a.length) {
|
|
4999
|
+
obj.translation = message.translation;
|
|
5000
|
+
}
|
|
5001
|
+
if ((_b = message.rotation) == null ? void 0 : _b.length) {
|
|
5002
|
+
obj.rotation = message.rotation;
|
|
5003
|
+
}
|
|
5004
|
+
if ((_c = message.neckPose) == null ? void 0 : _c.length) {
|
|
5005
|
+
obj.neckPose = message.neckPose;
|
|
5006
|
+
}
|
|
5007
|
+
if ((_d = message.jawPose) == null ? void 0 : _d.length) {
|
|
5008
|
+
obj.jawPose = message.jawPose;
|
|
5009
|
+
}
|
|
5010
|
+
if ((_e = message.eyePose) == null ? void 0 : _e.length) {
|
|
5011
|
+
obj.eyePose = message.eyePose;
|
|
5012
|
+
}
|
|
5013
|
+
if ((_f = message.eyeLid) == null ? void 0 : _f.length) {
|
|
5014
|
+
obj.eyeLid = message.eyeLid;
|
|
5015
|
+
}
|
|
5016
|
+
if ((_g = message.expression) == null ? void 0 : _g.length) {
|
|
5017
|
+
obj.expression = message.expression;
|
|
5018
|
+
}
|
|
5019
|
+
return obj;
|
|
5020
|
+
},
|
|
5021
|
+
create(base) {
|
|
5022
|
+
return Flame.fromPartial(base ?? {});
|
|
5023
|
+
},
|
|
5024
|
+
fromPartial(object) {
|
|
5025
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
5026
|
+
const message = createBaseFlame();
|
|
5027
|
+
message.translation = ((_a = object.translation) == null ? void 0 : _a.map((e) => e)) || [];
|
|
5028
|
+
message.rotation = ((_b = object.rotation) == null ? void 0 : _b.map((e) => e)) || [];
|
|
5029
|
+
message.neckPose = ((_c = object.neckPose) == null ? void 0 : _c.map((e) => e)) || [];
|
|
5030
|
+
message.jawPose = ((_d = object.jawPose) == null ? void 0 : _d.map((e) => e)) || [];
|
|
5031
|
+
message.eyePose = ((_e = object.eyePose) == null ? void 0 : _e.map((e) => e)) || [];
|
|
5032
|
+
message.eyeLid = ((_f = object.eyeLid) == null ? void 0 : _f.map((e) => e)) || [];
|
|
5033
|
+
message.expression = ((_g = object.expression) == null ? void 0 : _g.map((e) => e)) || [];
|
|
5034
|
+
return message;
|
|
5035
|
+
}
|
|
5036
|
+
};
|
|
5037
|
+
function createBaseFlameAnimation() {
|
|
5038
|
+
return { keyframes: [] };
|
|
5039
|
+
}
|
|
5040
|
+
const FlameAnimation = {
|
|
5041
|
+
encode(message, writer = new BinaryWriter()) {
|
|
5042
|
+
for (const v of message.keyframes) {
|
|
5043
|
+
Flame.encode(v, writer.uint32(10).fork()).join();
|
|
5044
|
+
}
|
|
5045
|
+
return writer;
|
|
5046
|
+
},
|
|
5047
|
+
decode(input, length) {
|
|
5048
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5049
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
5050
|
+
const message = createBaseFlameAnimation();
|
|
5051
|
+
while (reader.pos < end) {
|
|
5052
|
+
const tag = reader.uint32();
|
|
5053
|
+
switch (tag >>> 3) {
|
|
5054
|
+
case 1: {
|
|
5055
|
+
if (tag !== 10) {
|
|
5056
|
+
break;
|
|
5057
|
+
}
|
|
5058
|
+
message.keyframes.push(Flame.decode(reader, reader.uint32()));
|
|
5059
|
+
continue;
|
|
5060
|
+
}
|
|
5061
|
+
}
|
|
5062
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
5063
|
+
break;
|
|
5064
|
+
}
|
|
5065
|
+
reader.skip(tag & 7);
|
|
5066
|
+
}
|
|
5067
|
+
return message;
|
|
5068
|
+
},
|
|
5069
|
+
fromJSON(object) {
|
|
5070
|
+
return {
|
|
5071
|
+
keyframes: globalThis.Array.isArray(object == null ? void 0 : object.keyframes) ? object.keyframes.map((e) => Flame.fromJSON(e)) : []
|
|
5072
|
+
};
|
|
5073
|
+
},
|
|
5074
|
+
toJSON(message) {
|
|
5075
|
+
var _a;
|
|
5076
|
+
const obj = {};
|
|
5077
|
+
if ((_a = message.keyframes) == null ? void 0 : _a.length) {
|
|
5078
|
+
obj.keyframes = message.keyframes.map((e) => Flame.toJSON(e));
|
|
5079
|
+
}
|
|
5080
|
+
return obj;
|
|
5081
|
+
},
|
|
5082
|
+
create(base) {
|
|
5083
|
+
return FlameAnimation.fromPartial(base ?? {});
|
|
5084
|
+
},
|
|
5085
|
+
fromPartial(object) {
|
|
5086
|
+
var _a;
|
|
5087
|
+
const message = createBaseFlameAnimation();
|
|
5088
|
+
message.keyframes = ((_a = object.keyframes) == null ? void 0 : _a.map((e) => Flame.fromPartial(e))) || [];
|
|
5089
|
+
return message;
|
|
5090
|
+
}
|
|
5091
|
+
};
|
|
5092
|
+
function createBaseServerResponseAnimation() {
|
|
5093
|
+
return { connectionId: "", reqId: "", end: false, animation: void 0 };
|
|
5094
|
+
}
|
|
5095
|
+
const ServerResponseAnimation = {
|
|
5096
|
+
encode(message, writer = new BinaryWriter()) {
|
|
5097
|
+
if (message.connectionId !== "") {
|
|
5098
|
+
writer.uint32(10).string(message.connectionId);
|
|
5099
|
+
}
|
|
5100
|
+
if (message.reqId !== "") {
|
|
5101
|
+
writer.uint32(18).string(message.reqId);
|
|
5102
|
+
}
|
|
5103
|
+
if (message.end !== false) {
|
|
5104
|
+
writer.uint32(24).bool(message.end);
|
|
5105
|
+
}
|
|
5106
|
+
if (message.animation !== void 0) {
|
|
5107
|
+
FlameAnimation.encode(message.animation, writer.uint32(34).fork()).join();
|
|
5108
|
+
}
|
|
5109
|
+
return writer;
|
|
5110
|
+
},
|
|
5111
|
+
decode(input, length) {
|
|
5112
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5113
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
5114
|
+
const message = createBaseServerResponseAnimation();
|
|
5115
|
+
while (reader.pos < end) {
|
|
5116
|
+
const tag = reader.uint32();
|
|
5117
|
+
switch (tag >>> 3) {
|
|
5118
|
+
case 1: {
|
|
5119
|
+
if (tag !== 10) {
|
|
5120
|
+
break;
|
|
5121
|
+
}
|
|
5122
|
+
message.connectionId = reader.string();
|
|
5123
|
+
continue;
|
|
5124
|
+
}
|
|
5125
|
+
case 2: {
|
|
5126
|
+
if (tag !== 18) {
|
|
5127
|
+
break;
|
|
5128
|
+
}
|
|
5129
|
+
message.reqId = reader.string();
|
|
5130
|
+
continue;
|
|
5131
|
+
}
|
|
5132
|
+
case 3: {
|
|
5133
|
+
if (tag !== 24) {
|
|
5134
|
+
break;
|
|
5135
|
+
}
|
|
5136
|
+
message.end = reader.bool();
|
|
5137
|
+
continue;
|
|
5138
|
+
}
|
|
5139
|
+
case 4: {
|
|
5140
|
+
if (tag !== 34) {
|
|
5141
|
+
break;
|
|
5142
|
+
}
|
|
5143
|
+
message.animation = FlameAnimation.decode(reader, reader.uint32());
|
|
5144
|
+
continue;
|
|
5145
|
+
}
|
|
5146
|
+
}
|
|
5147
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
5148
|
+
break;
|
|
5149
|
+
}
|
|
5150
|
+
reader.skip(tag & 7);
|
|
5151
|
+
}
|
|
5152
|
+
return message;
|
|
5153
|
+
},
|
|
5154
|
+
fromJSON(object) {
|
|
5155
|
+
return {
|
|
5156
|
+
connectionId: isSet(object.connectionId) ? globalThis.String(object.connectionId) : "",
|
|
5157
|
+
reqId: isSet(object.reqId) ? globalThis.String(object.reqId) : "",
|
|
5158
|
+
end: isSet(object.end) ? globalThis.Boolean(object.end) : false,
|
|
5159
|
+
animation: isSet(object.animation) ? FlameAnimation.fromJSON(object.animation) : void 0
|
|
5160
|
+
};
|
|
5161
|
+
},
|
|
5162
|
+
toJSON(message) {
|
|
5163
|
+
const obj = {};
|
|
5164
|
+
if (message.connectionId !== "") {
|
|
5165
|
+
obj.connectionId = message.connectionId;
|
|
5166
|
+
}
|
|
5167
|
+
if (message.reqId !== "") {
|
|
5168
|
+
obj.reqId = message.reqId;
|
|
5169
|
+
}
|
|
5170
|
+
if (message.end !== false) {
|
|
5171
|
+
obj.end = message.end;
|
|
5172
|
+
}
|
|
5173
|
+
if (message.animation !== void 0) {
|
|
5174
|
+
obj.animation = FlameAnimation.toJSON(message.animation);
|
|
5175
|
+
}
|
|
5176
|
+
return obj;
|
|
5177
|
+
},
|
|
5178
|
+
create(base) {
|
|
5179
|
+
return ServerResponseAnimation.fromPartial(base ?? {});
|
|
5180
|
+
},
|
|
5181
|
+
fromPartial(object) {
|
|
5182
|
+
const message = createBaseServerResponseAnimation();
|
|
5183
|
+
message.connectionId = object.connectionId ?? "";
|
|
5184
|
+
message.reqId = object.reqId ?? "";
|
|
5185
|
+
message.end = object.end ?? false;
|
|
5186
|
+
message.animation = object.animation !== void 0 && object.animation !== null ? FlameAnimation.fromPartial(object.animation) : void 0;
|
|
5187
|
+
return message;
|
|
5188
|
+
}
|
|
5189
|
+
};
|
|
5190
|
+
function createBaseMessage() {
|
|
5191
|
+
return {
|
|
5192
|
+
type: 0,
|
|
5193
|
+
clientConfigureSession: void 0,
|
|
5194
|
+
serverConfirmSession: void 0,
|
|
5195
|
+
clientAudioInput: void 0,
|
|
5196
|
+
serverError: void 0,
|
|
5197
|
+
serverResponseAnimation: void 0
|
|
5198
|
+
};
|
|
5199
|
+
}
|
|
5200
|
+
const Message = {
|
|
5201
|
+
encode(message, writer = new BinaryWriter()) {
|
|
5202
|
+
if (message.type !== 0) {
|
|
5203
|
+
writer.uint32(8).int32(message.type);
|
|
5204
|
+
}
|
|
5205
|
+
if (message.clientConfigureSession !== void 0) {
|
|
5206
|
+
ClientConfigureSession.encode(message.clientConfigureSession, writer.uint32(18).fork()).join();
|
|
5207
|
+
}
|
|
5208
|
+
if (message.serverConfirmSession !== void 0) {
|
|
5209
|
+
ServerConfirmSession.encode(message.serverConfirmSession, writer.uint32(26).fork()).join();
|
|
5210
|
+
}
|
|
5211
|
+
if (message.clientAudioInput !== void 0) {
|
|
5212
|
+
ClientAudioInput.encode(message.clientAudioInput, writer.uint32(34).fork()).join();
|
|
5213
|
+
}
|
|
5214
|
+
if (message.serverError !== void 0) {
|
|
5215
|
+
ServerError.encode(message.serverError, writer.uint32(42).fork()).join();
|
|
5216
|
+
}
|
|
5217
|
+
if (message.serverResponseAnimation !== void 0) {
|
|
5218
|
+
ServerResponseAnimation.encode(message.serverResponseAnimation, writer.uint32(50).fork()).join();
|
|
5219
|
+
}
|
|
5220
|
+
return writer;
|
|
5221
|
+
},
|
|
5222
|
+
decode(input, length) {
|
|
5223
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
5224
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
5225
|
+
const message = createBaseMessage();
|
|
5226
|
+
while (reader.pos < end) {
|
|
5227
|
+
const tag = reader.uint32();
|
|
5228
|
+
switch (tag >>> 3) {
|
|
5229
|
+
case 1: {
|
|
5230
|
+
if (tag !== 8) {
|
|
5231
|
+
break;
|
|
5232
|
+
}
|
|
5233
|
+
message.type = reader.int32();
|
|
5234
|
+
continue;
|
|
5235
|
+
}
|
|
5236
|
+
case 2: {
|
|
5237
|
+
if (tag !== 18) {
|
|
5238
|
+
break;
|
|
5239
|
+
}
|
|
5240
|
+
message.clientConfigureSession = ClientConfigureSession.decode(reader, reader.uint32());
|
|
5241
|
+
continue;
|
|
5242
|
+
}
|
|
5243
|
+
case 3: {
|
|
5244
|
+
if (tag !== 26) {
|
|
5245
|
+
break;
|
|
5246
|
+
}
|
|
5247
|
+
message.serverConfirmSession = ServerConfirmSession.decode(reader, reader.uint32());
|
|
5248
|
+
continue;
|
|
5249
|
+
}
|
|
5250
|
+
case 4: {
|
|
5251
|
+
if (tag !== 34) {
|
|
5252
|
+
break;
|
|
5253
|
+
}
|
|
5254
|
+
message.clientAudioInput = ClientAudioInput.decode(reader, reader.uint32());
|
|
5255
|
+
continue;
|
|
5256
|
+
}
|
|
5257
|
+
case 5: {
|
|
5258
|
+
if (tag !== 42) {
|
|
5259
|
+
break;
|
|
5260
|
+
}
|
|
5261
|
+
message.serverError = ServerError.decode(reader, reader.uint32());
|
|
5262
|
+
continue;
|
|
5263
|
+
}
|
|
5264
|
+
case 6: {
|
|
5265
|
+
if (tag !== 50) {
|
|
5266
|
+
break;
|
|
5267
|
+
}
|
|
5268
|
+
message.serverResponseAnimation = ServerResponseAnimation.decode(reader, reader.uint32());
|
|
5269
|
+
continue;
|
|
5270
|
+
}
|
|
5271
|
+
}
|
|
5272
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
5273
|
+
break;
|
|
5274
|
+
}
|
|
5275
|
+
reader.skip(tag & 7);
|
|
5276
|
+
}
|
|
5277
|
+
return message;
|
|
5278
|
+
},
|
|
5279
|
+
fromJSON(object) {
|
|
5280
|
+
return {
|
|
5281
|
+
type: isSet(object.type) ? messageTypeFromJSON(object.type) : 0,
|
|
5282
|
+
clientConfigureSession: isSet(object.clientConfigureSession) ? ClientConfigureSession.fromJSON(object.clientConfigureSession) : void 0,
|
|
5283
|
+
serverConfirmSession: isSet(object.serverConfirmSession) ? ServerConfirmSession.fromJSON(object.serverConfirmSession) : void 0,
|
|
5284
|
+
clientAudioInput: isSet(object.clientAudioInput) ? ClientAudioInput.fromJSON(object.clientAudioInput) : void 0,
|
|
5285
|
+
serverError: isSet(object.serverError) ? ServerError.fromJSON(object.serverError) : void 0,
|
|
5286
|
+
serverResponseAnimation: isSet(object.serverResponseAnimation) ? ServerResponseAnimation.fromJSON(object.serverResponseAnimation) : void 0
|
|
5287
|
+
};
|
|
5288
|
+
},
|
|
5289
|
+
toJSON(message) {
|
|
5290
|
+
const obj = {};
|
|
5291
|
+
if (message.type !== 0) {
|
|
5292
|
+
obj.type = messageTypeToJSON(message.type);
|
|
5293
|
+
}
|
|
5294
|
+
if (message.clientConfigureSession !== void 0) {
|
|
5295
|
+
obj.clientConfigureSession = ClientConfigureSession.toJSON(message.clientConfigureSession);
|
|
5296
|
+
}
|
|
5297
|
+
if (message.serverConfirmSession !== void 0) {
|
|
5298
|
+
obj.serverConfirmSession = ServerConfirmSession.toJSON(message.serverConfirmSession);
|
|
5299
|
+
}
|
|
5300
|
+
if (message.clientAudioInput !== void 0) {
|
|
5301
|
+
obj.clientAudioInput = ClientAudioInput.toJSON(message.clientAudioInput);
|
|
5302
|
+
}
|
|
5303
|
+
if (message.serverError !== void 0) {
|
|
5304
|
+
obj.serverError = ServerError.toJSON(message.serverError);
|
|
5305
|
+
}
|
|
5306
|
+
if (message.serverResponseAnimation !== void 0) {
|
|
5307
|
+
obj.serverResponseAnimation = ServerResponseAnimation.toJSON(message.serverResponseAnimation);
|
|
5308
|
+
}
|
|
5309
|
+
return obj;
|
|
5310
|
+
},
|
|
5311
|
+
create(base) {
|
|
5312
|
+
return Message.fromPartial(base ?? {});
|
|
5313
|
+
},
|
|
5314
|
+
fromPartial(object) {
|
|
5315
|
+
const message = createBaseMessage();
|
|
5316
|
+
message.type = object.type ?? 0;
|
|
5317
|
+
message.clientConfigureSession = object.clientConfigureSession !== void 0 && object.clientConfigureSession !== null ? ClientConfigureSession.fromPartial(object.clientConfigureSession) : void 0;
|
|
5318
|
+
message.serverConfirmSession = object.serverConfirmSession !== void 0 && object.serverConfirmSession !== null ? ServerConfirmSession.fromPartial(object.serverConfirmSession) : void 0;
|
|
5319
|
+
message.clientAudioInput = object.clientAudioInput !== void 0 && object.clientAudioInput !== null ? ClientAudioInput.fromPartial(object.clientAudioInput) : void 0;
|
|
5320
|
+
message.serverError = object.serverError !== void 0 && object.serverError !== null ? ServerError.fromPartial(object.serverError) : void 0;
|
|
5321
|
+
message.serverResponseAnimation = object.serverResponseAnimation !== void 0 && object.serverResponseAnimation !== null ? ServerResponseAnimation.fromPartial(object.serverResponseAnimation) : void 0;
|
|
5322
|
+
return message;
|
|
5323
|
+
}
|
|
5324
|
+
};
|
|
5325
|
+
function bytesFromBase64(b64) {
|
|
5326
|
+
const bin = globalThis.atob(b64);
|
|
5327
|
+
const arr = new Uint8Array(bin.length);
|
|
5328
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
5329
|
+
arr[i] = bin.charCodeAt(i);
|
|
5330
|
+
}
|
|
5331
|
+
return arr;
|
|
5332
|
+
}
|
|
5333
|
+
function base64FromBytes(arr) {
|
|
5334
|
+
const bin = [];
|
|
5335
|
+
arr.forEach((byte) => {
|
|
5336
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
5337
|
+
});
|
|
5338
|
+
return globalThis.btoa(bin.join(""));
|
|
5339
|
+
}
|
|
5340
|
+
function isSet(value) {
|
|
5341
|
+
return value !== null && value !== void 0;
|
|
5342
|
+
}
|
|
5343
|
+
class EventEmitter {
|
|
5344
|
+
constructor() {
|
|
5345
|
+
__publicField(this, "events", /* @__PURE__ */ new Map());
|
|
5346
|
+
}
|
|
5347
|
+
on(event, handler) {
|
|
5348
|
+
if (!this.events.has(event)) {
|
|
5349
|
+
this.events.set(event, /* @__PURE__ */ new Set());
|
|
5350
|
+
}
|
|
5351
|
+
this.events.get(event).add(handler);
|
|
5352
|
+
}
|
|
5353
|
+
off(event, handler) {
|
|
5354
|
+
const handlers = this.events.get(event);
|
|
5355
|
+
if (handlers) {
|
|
5356
|
+
handlers.delete(handler);
|
|
5357
|
+
if (handlers.size === 0) {
|
|
5358
|
+
this.events.delete(event);
|
|
5359
|
+
}
|
|
5360
|
+
}
|
|
5361
|
+
}
|
|
5362
|
+
emit(event, ...args) {
|
|
5363
|
+
const handlers = this.events.get(event);
|
|
5364
|
+
if (handlers) {
|
|
5365
|
+
handlers.forEach((handler) => handler(...args));
|
|
5366
|
+
}
|
|
5367
|
+
}
|
|
5368
|
+
removeAllListeners(event) {
|
|
5369
|
+
if (event) {
|
|
5370
|
+
this.events.delete(event);
|
|
5371
|
+
} else {
|
|
5372
|
+
this.events.clear();
|
|
5373
|
+
}
|
|
5374
|
+
}
|
|
5375
|
+
}
|
|
5376
|
+
class AnimationWebSocketClient extends EventEmitter {
|
|
5377
|
+
constructor(options) {
|
|
5378
|
+
super();
|
|
5379
|
+
__publicField(this, "wsUrl");
|
|
5380
|
+
__publicField(this, "reconnectAttempts");
|
|
5381
|
+
__publicField(this, "jwtToken");
|
|
5382
|
+
__publicField(this, "appId");
|
|
5383
|
+
__publicField(this, "clientId");
|
|
5384
|
+
__publicField(this, "ws", null);
|
|
5385
|
+
__publicField(this, "currentCharacterId", "");
|
|
5386
|
+
__publicField(this, "currentRetryCount", 0);
|
|
5387
|
+
__publicField(this, "isConnecting", false);
|
|
5388
|
+
__publicField(this, "isManuallyDisconnected", false);
|
|
5389
|
+
__publicField(this, "reconnectTimer", null);
|
|
5390
|
+
__publicField(this, "sessionConfigured", false);
|
|
5391
|
+
this.wsUrl = options.wsUrl;
|
|
5392
|
+
this.reconnectAttempts = options.reconnectAttempts ?? 5;
|
|
5393
|
+
this.jwtToken = options.jwtToken;
|
|
5394
|
+
this.appId = options.appId;
|
|
5395
|
+
this.clientId = options.clientId;
|
|
5396
|
+
}
|
|
5397
|
+
async connect(characterId) {
|
|
5398
|
+
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
|
|
5399
|
+
logger.log("[AnimationWebSocketClient] Already connected");
|
|
5400
|
+
return;
|
|
5401
|
+
}
|
|
5402
|
+
if (this.isConnecting) {
|
|
5403
|
+
logger.log("[AnimationWebSocketClient] Already connecting");
|
|
5404
|
+
return;
|
|
5405
|
+
}
|
|
5406
|
+
try {
|
|
5407
|
+
this.isConnecting = true;
|
|
5408
|
+
this.currentCharacterId = characterId;
|
|
5409
|
+
this.sessionConfigured = false;
|
|
5410
|
+
idManager.generateConnectionId();
|
|
5411
|
+
const url = this.buildWebSocketUrl(characterId);
|
|
5412
|
+
logger.log("[AnimationWebSocketClient] Connecting to:", url);
|
|
5413
|
+
await this.connectWebSocket(url);
|
|
5414
|
+
logger.log("[AnimationWebSocketClient] Connected successfully");
|
|
5415
|
+
} catch (error) {
|
|
5416
|
+
this.isConnecting = false;
|
|
5417
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5418
|
+
logger.error("[AnimationWebSocketClient] Connection failed:", message);
|
|
5419
|
+
logEvent("character_animation_service", "error", {
|
|
5420
|
+
characterId,
|
|
5421
|
+
event: "connect_failed",
|
|
5422
|
+
reason: message
|
|
5423
|
+
});
|
|
5424
|
+
throw error;
|
|
5425
|
+
}
|
|
5426
|
+
}
|
|
5427
|
+
disconnect() {
|
|
5428
|
+
if (this.ws) {
|
|
5429
|
+
this.ws.close(1e3, "Normal closure");
|
|
5430
|
+
this.ws = null;
|
|
5431
|
+
}
|
|
5432
|
+
idManager.clearConnectionId();
|
|
5433
|
+
this.removeAllListeners();
|
|
5434
|
+
this.currentRetryCount = 0;
|
|
5435
|
+
this.isConnecting = false;
|
|
5436
|
+
this.isManuallyDisconnected = true;
|
|
5437
|
+
this.sessionConfigured = false;
|
|
5438
|
+
if (this.reconnectTimer) {
|
|
5439
|
+
clearTimeout(this.reconnectTimer);
|
|
5440
|
+
this.reconnectTimer = null;
|
|
5441
|
+
}
|
|
5442
|
+
logger.log("[AnimationWebSocketClient] Disconnected");
|
|
5443
|
+
}
|
|
5444
|
+
sendAudioData(conversationId, audioData, end) {
|
|
5445
|
+
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
|
5446
|
+
logger.error("[AnimationWebSocketClient] WebSocket not connected");
|
|
5447
|
+
return false;
|
|
5448
|
+
}
|
|
5449
|
+
if (!this.sessionConfigured) {
|
|
5450
|
+
logger.error("[AnimationWebSocketClient] Session not configured yet");
|
|
5451
|
+
return false;
|
|
5452
|
+
}
|
|
5453
|
+
try {
|
|
5454
|
+
const message = {
|
|
5455
|
+
type: MessageType.MESSAGE_CLIENT_AUDIO_INPUT,
|
|
5456
|
+
clientAudioInput: {
|
|
4491
5457
|
reqId: conversationId,
|
|
4492
5458
|
audio: new Uint8Array(audioData),
|
|
4493
5459
|
end
|
|
@@ -4501,11 +5467,10 @@ class AnimationWebSocketClient extends EventEmitter {
|
|
|
4501
5467
|
} catch (error) {
|
|
4502
5468
|
const message = error instanceof Error ? error.message : String(error);
|
|
4503
5469
|
logger.error("[AnimationWebSocketClient] Failed to send audio data:", message);
|
|
4504
|
-
logEvent("
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
reason: message
|
|
5470
|
+
logEvent("send_audio_failed", "error", {
|
|
5471
|
+
req_id: conversationId || "",
|
|
5472
|
+
con_id: idManager.getConnectionId() || "",
|
|
5473
|
+
description: message
|
|
4509
5474
|
});
|
|
4510
5475
|
this.emit("error", error);
|
|
4511
5476
|
return false;
|
|
@@ -4525,13 +5490,13 @@ class AnimationWebSocketClient extends EventEmitter {
|
|
|
4525
5490
|
url.searchParams.set("id", characterId);
|
|
4526
5491
|
const currentToken = AvatarSDK.sessionToken || this.jwtToken;
|
|
4527
5492
|
if (currentToken) {
|
|
4528
|
-
url.searchParams.set("
|
|
5493
|
+
url.searchParams.set("sessionKey", currentToken);
|
|
4529
5494
|
}
|
|
4530
5495
|
if (this.appId) {
|
|
4531
5496
|
url.searchParams.set("appId", this.appId);
|
|
4532
5497
|
}
|
|
4533
5498
|
if (this.clientId) {
|
|
4534
|
-
url.searchParams.set("
|
|
5499
|
+
url.searchParams.set("deviceId", this.clientId);
|
|
4535
5500
|
}
|
|
4536
5501
|
const connectionId = idManager.getConnectionId();
|
|
4537
5502
|
if (connectionId) {
|
|
@@ -4542,11 +5507,15 @@ class AnimationWebSocketClient extends EventEmitter {
|
|
|
4542
5507
|
connectWebSocket(url) {
|
|
4543
5508
|
return new Promise((resolve2, reject) => {
|
|
4544
5509
|
try {
|
|
5510
|
+
const urlForLog = this.sanitizeUrlForLog(url);
|
|
5511
|
+
logger.log(`[AnimationWebSocketClient] Connecting to WebSocket: ${urlForLog}`);
|
|
4545
5512
|
this.ws = new WebSocket(url);
|
|
4546
5513
|
this.ws.onopen = () => {
|
|
4547
5514
|
this.isConnecting = false;
|
|
4548
5515
|
this.currentRetryCount = 0;
|
|
4549
5516
|
this.isManuallyDisconnected = false;
|
|
5517
|
+
logger.log(`[AnimationWebSocketClient] WebSocket connected successfully`);
|
|
5518
|
+
this.configureSession();
|
|
4550
5519
|
this.emit("connected");
|
|
4551
5520
|
resolve2();
|
|
4552
5521
|
};
|
|
@@ -4568,19 +5537,77 @@ class AnimationWebSocketClient extends EventEmitter {
|
|
|
4568
5537
|
}
|
|
4569
5538
|
};
|
|
4570
5539
|
this.ws.onerror = (error) => {
|
|
4571
|
-
|
|
5540
|
+
var _a;
|
|
5541
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
5542
|
+
const readyState = (_a = this.ws) == null ? void 0 : _a.readyState;
|
|
5543
|
+
const readyStateText = readyState === WebSocket.CONNECTING ? "CONNECTING" : readyState === WebSocket.OPEN ? "OPEN" : readyState === WebSocket.CLOSING ? "CLOSING" : readyState === WebSocket.CLOSED ? "CLOSED" : "UNKNOWN";
|
|
5544
|
+
const errorDetails = `ReadyState: ${readyState} (${readyStateText}), URL: ${urlForLog}, Error: ${errorMessage}`;
|
|
5545
|
+
logger.error("[AnimationWebSocketClient] WebSocket error:", errorDetails);
|
|
5546
|
+
if (readyState === WebSocket.CLOSED) {
|
|
5547
|
+
logger.warn("[AnimationWebSocketClient] Connection failed immediately. Possible causes:");
|
|
5548
|
+
logger.warn(" 1. Server may not support v2 protocol yet");
|
|
5549
|
+
logger.warn(" 2. Incorrect URL path or server configuration");
|
|
5550
|
+
logger.warn(" 3. Authentication or authorization issue");
|
|
5551
|
+
logger.warn(" 4. Network/firewall blocking the connection");
|
|
5552
|
+
logger.warn(` Please check browser Network tab for detailed error information`);
|
|
5553
|
+
}
|
|
4572
5554
|
logEvent("character_animation_service", "error", {
|
|
4573
5555
|
characterId: this.currentCharacterId,
|
|
4574
|
-
event: "websocket_error"
|
|
5556
|
+
event: "websocket_error",
|
|
5557
|
+
reason: `ReadyState: ${readyState} (${readyStateText}), URL: ${urlForLog}`
|
|
4575
5558
|
});
|
|
4576
|
-
this.emit("error", new Error(
|
|
5559
|
+
this.emit("error", new Error(`WebSocket error (readyState: ${readyState})`));
|
|
4577
5560
|
if (!this.isManuallyDisconnected && this.currentRetryCount < this.reconnectAttempts) {
|
|
4578
5561
|
this.scheduleReconnect();
|
|
4579
5562
|
}
|
|
4580
5563
|
};
|
|
4581
5564
|
this.ws.onclose = (event) => {
|
|
4582
|
-
|
|
5565
|
+
const closeDetails = {
|
|
5566
|
+
code: event.code,
|
|
5567
|
+
reason: event.reason || "(no reason)",
|
|
5568
|
+
wasClean: event.wasClean,
|
|
5569
|
+
url: urlForLog
|
|
5570
|
+
};
|
|
5571
|
+
logger.log("[AnimationWebSocketClient] WebSocket closed:", closeDetails);
|
|
4583
5572
|
this.emit("disconnected", event.reason || "Connection closed");
|
|
5573
|
+
this.sessionConfigured = false;
|
|
5574
|
+
let sdkErrorCode = null;
|
|
5575
|
+
const reason = event.reason || "";
|
|
5576
|
+
const reasonLower = reason.toLowerCase();
|
|
5577
|
+
if (event.code === 1008 || reasonLower.includes("401") || reasonLower.includes("unauth") || reasonLower.includes("expired") || reasonLower.includes("token expired")) {
|
|
5578
|
+
sdkErrorCode = ErrorCode.sessionTokenExpired;
|
|
5579
|
+
logEvent("session_token_expired", "warning", {
|
|
5580
|
+
con_id: idManager.getConnectionId() || "",
|
|
5581
|
+
description: reason || "Session token expired"
|
|
5582
|
+
});
|
|
5583
|
+
} else if (reasonLower.includes("400") || reasonLower.includes("invalid") || reasonLower.includes("bad request")) {
|
|
5584
|
+
sdkErrorCode = ErrorCode.sessionTokenInvalid;
|
|
5585
|
+
logEvent("session_token_invalid", "warning", {
|
|
5586
|
+
con_id: idManager.getConnectionId() || "",
|
|
5587
|
+
description: reason || "Session token invalid"
|
|
5588
|
+
});
|
|
5589
|
+
} else if (reasonLower.includes("404") || reasonLower.includes("notfound") || reasonLower.includes("not found")) {
|
|
5590
|
+
sdkErrorCode = ErrorCode.avatarIDUnrecognized;
|
|
5591
|
+
logEvent("avatar_id_unrecognized", "error", {
|
|
5592
|
+
avatar_id: this.currentCharacterId || "",
|
|
5593
|
+
description: reason || "Avatar ID unrecognized"
|
|
5594
|
+
});
|
|
5595
|
+
}
|
|
5596
|
+
if (sdkErrorCode) {
|
|
5597
|
+
const error = new SPAvatarError(
|
|
5598
|
+
reason || `WebSocket connection failed with code ${event.code}`,
|
|
5599
|
+
sdkErrorCode
|
|
5600
|
+
);
|
|
5601
|
+
this.emit("error", error);
|
|
5602
|
+
}
|
|
5603
|
+
if (event.code === 1006) {
|
|
5604
|
+
logger.warn("[AnimationWebSocketClient] Connection closed abnormally (1006) - possible causes: network issue, server rejection, or protocol mismatch");
|
|
5605
|
+
logEvent("character_animation_service", "warning", {
|
|
5606
|
+
characterId: this.currentCharacterId,
|
|
5607
|
+
event: "websocket_abnormal_close",
|
|
5608
|
+
reason: `Code: ${event.code}, URL: ${urlForLog}`
|
|
5609
|
+
});
|
|
5610
|
+
}
|
|
4584
5611
|
if (event.code === 1012) {
|
|
4585
5612
|
logEvent("service_restarted", "warning", {
|
|
4586
5613
|
con_id: idManager.getConnectionId() || "",
|
|
@@ -4593,21 +5620,83 @@ class AnimationWebSocketClient extends EventEmitter {
|
|
|
4593
5620
|
};
|
|
4594
5621
|
} catch (error) {
|
|
4595
5622
|
this.isConnecting = false;
|
|
5623
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
5624
|
+
logger.error("[AnimationWebSocketClient] Failed to create WebSocket:", errorMessage);
|
|
4596
5625
|
reject(error);
|
|
4597
5626
|
}
|
|
4598
5627
|
});
|
|
4599
5628
|
}
|
|
5629
|
+
sanitizeUrlForLog(url) {
|
|
5630
|
+
try {
|
|
5631
|
+
const urlObj = new URL(url);
|
|
5632
|
+
if (urlObj.searchParams.has("sessionKey")) {
|
|
5633
|
+
const sessionKey = urlObj.searchParams.get("sessionKey") || "";
|
|
5634
|
+
urlObj.searchParams.set("sessionKey", sessionKey.length > 10 ? `${sessionKey.substring(0, 10)}...` : "***");
|
|
5635
|
+
}
|
|
5636
|
+
if (urlObj.searchParams.has("token")) {
|
|
5637
|
+
const token = urlObj.searchParams.get("token") || "";
|
|
5638
|
+
urlObj.searchParams.set("token", token.length > 10 ? `${token.substring(0, 10)}...` : "***");
|
|
5639
|
+
}
|
|
5640
|
+
return urlObj.toString();
|
|
5641
|
+
} catch {
|
|
5642
|
+
return url.length > 100 ? `${url.substring(0, 100)}...` : url;
|
|
5643
|
+
}
|
|
5644
|
+
}
|
|
5645
|
+
configureSession() {
|
|
5646
|
+
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
|
5647
|
+
logger.error("[AnimationWebSocketClient] Cannot configure session: WebSocket not open");
|
|
5648
|
+
return;
|
|
5649
|
+
}
|
|
5650
|
+
try {
|
|
5651
|
+
const audioFormatConfig = AvatarSDK.getAudioFormat();
|
|
5652
|
+
const message = {
|
|
5653
|
+
type: MessageType.MESSAGE_CLIENT_CONFIGURE_SESSION,
|
|
5654
|
+
clientConfigureSession: {
|
|
5655
|
+
sampleRate: audioFormatConfig.sampleRate,
|
|
5656
|
+
bitrate: 0,
|
|
5657
|
+
audioFormat: AudioFormat.AUDIO_FORMAT_PCM_S16LE,
|
|
5658
|
+
transportCompression: TransportCompression.TRANSPORT_COMPRESSION_NONE
|
|
5659
|
+
}
|
|
5660
|
+
};
|
|
5661
|
+
const writer = new BinaryWriter();
|
|
5662
|
+
Message.encode(message, writer);
|
|
5663
|
+
const bytes = writer.finish();
|
|
5664
|
+
this.ws.send(bytes);
|
|
5665
|
+
logger.log(`[AnimationWebSocketClient] Session configuration sent (sampleRate: ${audioFormatConfig.sampleRate})`);
|
|
5666
|
+
} catch (error) {
|
|
5667
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
5668
|
+
logger.error("[AnimationWebSocketClient] Failed to configure session:", message);
|
|
5669
|
+
logEvent("configure_session_failed", "error", {
|
|
5670
|
+
description: message
|
|
5671
|
+
});
|
|
5672
|
+
this.emit("error", error);
|
|
5673
|
+
}
|
|
5674
|
+
}
|
|
4600
5675
|
handleMessage(data) {
|
|
4601
5676
|
try {
|
|
4602
5677
|
const reader = new BinaryReader(new Uint8Array(data));
|
|
4603
5678
|
const message = Message.decode(reader);
|
|
4604
|
-
if (message.
|
|
4605
|
-
|
|
4606
|
-
|
|
5679
|
+
if (message.type === MessageType.MESSAGE_SERVER_CONFIRM_SESSION) {
|
|
5680
|
+
if (message.serverConfirmSession) {
|
|
5681
|
+
this.sessionConfigured = true;
|
|
5682
|
+
const connectionId = message.serverConfirmSession.connectionId;
|
|
5683
|
+
if (connectionId) {
|
|
5684
|
+
idManager.setConnectionId(connectionId);
|
|
5685
|
+
logger.log(`[AnimationWebSocketClient] Session confirmed, connection_id updated: ${connectionId}`);
|
|
5686
|
+
} else {
|
|
5687
|
+
logger.log("[AnimationWebSocketClient] Session confirmed by server");
|
|
5688
|
+
}
|
|
5689
|
+
this.emit("sessionConfirmed", connectionId);
|
|
5690
|
+
return;
|
|
5691
|
+
}
|
|
5692
|
+
}
|
|
5693
|
+
if (message.serverError) {
|
|
5694
|
+
logger.error(`[AnimationWebSocketClient] Server error: reqId=${message.serverError.reqId}, code=${message.serverError.code}, message=${message.serverError.message}`);
|
|
5695
|
+
this.emit("error", new Error(message.serverError.message || "Server error"));
|
|
4607
5696
|
return;
|
|
4608
5697
|
}
|
|
4609
|
-
if (message.type === MessageType.
|
|
4610
|
-
logger.warn("[AnimationWebSocketClient]
|
|
5698
|
+
if (message.type === MessageType.MESSAGE_SERVER_ERROR) {
|
|
5699
|
+
logger.warn("[AnimationWebSocketClient] MESSAGE_SERVER_ERROR received but no error field in message");
|
|
4611
5700
|
logEvent("character_animation_service", "warning", {
|
|
4612
5701
|
characterId: this.currentCharacterId,
|
|
4613
5702
|
event: "message_error_without_payload"
|
|
@@ -4644,7 +5733,6 @@ class NetworkLayer {
|
|
|
4644
5733
|
__publicField(this, "wsClient");
|
|
4645
5734
|
__publicField(this, "dataController");
|
|
4646
5735
|
__publicField(this, "currentConversationId", null);
|
|
4647
|
-
__publicField(this, "audioBytesPerSecond", APP_CONFIG.audio.sampleRate * 2);
|
|
4648
5736
|
__publicField(this, "audioMetrics", this.createAudioMetrics());
|
|
4649
5737
|
__publicField(this, "isFallbackMode", false);
|
|
4650
5738
|
__publicField(this, "isConnecting", false);
|
|
@@ -4659,6 +5747,10 @@ class NetworkLayer {
|
|
|
4659
5747
|
});
|
|
4660
5748
|
this.setupWebSocketListeners();
|
|
4661
5749
|
}
|
|
5750
|
+
getAudioBytesPerSecond() {
|
|
5751
|
+
const audioFormat = AvatarSDK.getAudioFormat();
|
|
5752
|
+
return audioFormat.sampleRate * 2;
|
|
5753
|
+
}
|
|
4662
5754
|
async connect(characterId) {
|
|
4663
5755
|
var _a, _b, _c, _d;
|
|
4664
5756
|
if (this.isConnecting) {
|
|
@@ -4733,7 +5825,7 @@ class NetworkLayer {
|
|
|
4733
5825
|
shouldReportMetrics = true;
|
|
4734
5826
|
}
|
|
4735
5827
|
metrics.accumulatedBytes += audioData.byteLength;
|
|
4736
|
-
const currentDuration = metrics.accumulatedBytes / this.
|
|
5828
|
+
const currentDuration = metrics.accumulatedBytes / this.getAudioBytesPerSecond();
|
|
4737
5829
|
if (currentDuration >= 2 && metrics.tap2Timestamp === 0) {
|
|
4738
5830
|
metrics.tap2Timestamp = Date.now();
|
|
4739
5831
|
metrics.cachedTap2Timestamp = String(metrics.tap2Timestamp);
|
|
@@ -4791,6 +5883,13 @@ class NetworkLayer {
|
|
|
4791
5883
|
}
|
|
4792
5884
|
setupWebSocketListeners() {
|
|
4793
5885
|
this.wsClient.removeAllListeners();
|
|
5886
|
+
this.wsClient.on("sessionConfirmed", (connectionId) => {
|
|
5887
|
+
if (connectionId) {
|
|
5888
|
+
logger.log(`[NetworkLayer] Session confirmed, connection_id: ${connectionId}, ready to send audio`);
|
|
5889
|
+
} else {
|
|
5890
|
+
logger.log("[NetworkLayer] Session confirmed, ready to send audio");
|
|
5891
|
+
}
|
|
5892
|
+
});
|
|
4794
5893
|
this.wsClient.on("connected", () => {
|
|
4795
5894
|
var _a, _b;
|
|
4796
5895
|
this.isFallbackMode = false;
|
|
@@ -4835,7 +5934,7 @@ class NetworkLayer {
|
|
|
4835
5934
|
case MessageType.MESSAGE_SERVER_RESPONSE_ANIMATION:
|
|
4836
5935
|
this.handleAnimationMessage(message);
|
|
4837
5936
|
break;
|
|
4838
|
-
case MessageType.
|
|
5937
|
+
case MessageType.MESSAGE_SERVER_ERROR:
|
|
4839
5938
|
this.handleErrorMessage(message);
|
|
4840
5939
|
break;
|
|
4841
5940
|
}
|
|
@@ -4899,42 +5998,43 @@ class NetworkLayer {
|
|
|
4899
5998
|
}
|
|
4900
5999
|
}
|
|
4901
6000
|
handleErrorMessage(message) {
|
|
4902
|
-
var _a, _b
|
|
4903
|
-
if (!message.
|
|
4904
|
-
logger.warn("[NetworkLayer]
|
|
4905
|
-
if (message.serverResponseAnimation) {
|
|
4906
|
-
logger.warn("[NetworkLayer] MESSAGE_ERROR contains animation data, treating as animation message");
|
|
4907
|
-
logEvent("character_manager", "warning", {
|
|
4908
|
-
characterId: this.dataController.getAvatarId(),
|
|
4909
|
-
event: "message_error_with_payload"
|
|
4910
|
-
});
|
|
4911
|
-
this.handleAnimationMessage(message);
|
|
4912
|
-
}
|
|
6001
|
+
var _a, _b;
|
|
6002
|
+
if (!message.serverError) {
|
|
6003
|
+
logger.warn("[NetworkLayer] MESSAGE_SERVER_ERROR received but message.serverError is empty");
|
|
4913
6004
|
return;
|
|
4914
6005
|
}
|
|
4915
|
-
const conversationId = message.
|
|
4916
|
-
logger.error(`[NetworkLayer] Server error: conversationId=${conversationId}, code=${message.
|
|
6006
|
+
const conversationId = message.serverError.reqId || this.currentConversationId || "";
|
|
6007
|
+
logger.error(`[NetworkLayer] Server error: conversationId=${conversationId}, code=${message.serverError.code}, message=${message.serverError.message}`);
|
|
4917
6008
|
logEvent("message_error", "error", {
|
|
4918
6009
|
req_id: conversationId,
|
|
4919
6010
|
con_id: idManager.getConnectionId() || "",
|
|
4920
|
-
description: message.
|
|
6011
|
+
description: message.serverError.message || `Server error: code=${message.serverError.code}`
|
|
4921
6012
|
});
|
|
4922
|
-
const
|
|
4923
|
-
|
|
4924
|
-
|
|
6013
|
+
const httpStatusCode = message.serverError.code;
|
|
6014
|
+
const errorCodeStr = (httpStatusCode == null ? void 0 : httpStatusCode.toString()) ?? "";
|
|
6015
|
+
let sdkErrorCode;
|
|
6016
|
+
let errorMessage = message.serverError.message || "Server error occurred";
|
|
6017
|
+
if (httpStatusCode === 401) {
|
|
6018
|
+
sdkErrorCode = ErrorCode.sessionTokenExpired;
|
|
6019
|
+
logEvent("session_token_expired", "warning", {
|
|
4925
6020
|
con_id: idManager.getConnectionId() || "",
|
|
4926
|
-
description:
|
|
6021
|
+
description: errorMessage
|
|
4927
6022
|
});
|
|
4928
|
-
}
|
|
4929
|
-
|
|
4930
|
-
logEvent("
|
|
6023
|
+
} else if (httpStatusCode === 400) {
|
|
6024
|
+
sdkErrorCode = ErrorCode.sessionTokenInvalid;
|
|
6025
|
+
logEvent("session_token_invalid", "warning", {
|
|
4931
6026
|
con_id: idManager.getConnectionId() || "",
|
|
4932
|
-
description:
|
|
6027
|
+
description: errorMessage
|
|
4933
6028
|
});
|
|
6029
|
+
} else if (httpStatusCode === 404) {
|
|
6030
|
+
sdkErrorCode = ErrorCode.avatarIDUnrecognized;
|
|
6031
|
+
errorMessage = errorMessage || "Avatar ID not recognized";
|
|
6032
|
+
} else {
|
|
6033
|
+
sdkErrorCode = errorCodeStr || "SERVER_ERROR";
|
|
4934
6034
|
}
|
|
4935
|
-
(
|
|
4936
|
-
|
|
4937
|
-
|
|
6035
|
+
(_b = (_a = this.dataController).onError) == null ? void 0 : _b.call(_a, new SPAvatarError(
|
|
6036
|
+
errorMessage,
|
|
6037
|
+
sdkErrorCode
|
|
4938
6038
|
));
|
|
4939
6039
|
if (this.currentConversationId && conversationId === this.currentConversationId) {
|
|
4940
6040
|
logger.warn("[NetworkLayer] Server error for current conversation - triggering audio-only mode via empty animation data");
|
|
@@ -5000,6 +6100,8 @@ class AvatarController {
|
|
|
5000
6100
|
__publicField(this, "keyframesOffset", 0);
|
|
5001
6101
|
__publicField(this, "MAX_KEYFRAMES", 5e3);
|
|
5002
6102
|
__publicField(this, "KEYFRAMES_CLEANUP_THRESHOLD", 3e3);
|
|
6103
|
+
__publicField(this, "lastSyncLogTime", 0);
|
|
6104
|
+
__publicField(this, "lastOutOfBoundsState", false);
|
|
5003
6105
|
__publicField(this, "isAudioOnlyMode", false);
|
|
5004
6106
|
__publicField(this, "hostModeMetrics", {
|
|
5005
6107
|
accumulatedBytes: 0,
|
|
@@ -5044,8 +6146,9 @@ class AvatarController {
|
|
|
5044
6146
|
case AvatarState.active:
|
|
5045
6147
|
return this.isPlaying ? ConversationState.playing : ConversationState.idle;
|
|
5046
6148
|
case AvatarState.playing:
|
|
5047
|
-
case AvatarState.paused:
|
|
5048
6149
|
return ConversationState.playing;
|
|
6150
|
+
case AvatarState.paused:
|
|
6151
|
+
return ConversationState.pausing;
|
|
5049
6152
|
default:
|
|
5050
6153
|
return ConversationState.idle;
|
|
5051
6154
|
}
|
|
@@ -5234,7 +6337,7 @@ class AvatarController {
|
|
|
5234
6337
|
}
|
|
5235
6338
|
try {
|
|
5236
6339
|
const reader = new BinaryReader(binaryData);
|
|
5237
|
-
const message = Message.decode(reader);
|
|
6340
|
+
const message = Message$1.decode(reader);
|
|
5238
6341
|
if ((_b = (_a = message.serverResponseAnimation) == null ? void 0 : _a.animation) == null ? void 0 : _b.keyframes) {
|
|
5239
6342
|
const chunkKeyframes = message.serverResponseAnimation.animation.keyframes;
|
|
5240
6343
|
allKeyframes.push(...chunkKeyframes);
|
|
@@ -5396,6 +6499,8 @@ class AvatarController {
|
|
|
5396
6499
|
this.lastRenderedFrameIndex = -1;
|
|
5397
6500
|
this.keyframesOffset = 0;
|
|
5398
6501
|
this.isAudioOnlyMode = false;
|
|
6502
|
+
this.lastSyncLogTime = 0;
|
|
6503
|
+
this.lastOutOfBoundsState = false;
|
|
5399
6504
|
if (this.playbackMode === DrivingServiceMode.host) {
|
|
5400
6505
|
this.hostModeMetrics = {
|
|
5401
6506
|
accumulatedBytes: 0,
|
|
@@ -5584,8 +6689,21 @@ class AvatarController {
|
|
|
5584
6689
|
if (arrayIndex < 0) {
|
|
5585
6690
|
arrayIndex = 0;
|
|
5586
6691
|
}
|
|
5587
|
-
|
|
6692
|
+
const isOutOfBounds = arrayIndex >= this.currentKeyframes.length;
|
|
6693
|
+
if (isOutOfBounds) {
|
|
5588
6694
|
arrayIndex = this.currentKeyframes.length - 1;
|
|
6695
|
+
const now = Date.now();
|
|
6696
|
+
const stateChanged = isOutOfBounds !== this.lastOutOfBoundsState;
|
|
6697
|
+
const timeSinceLastLog = now - this.lastSyncLogTime;
|
|
6698
|
+
if (stateChanged || timeSinceLastLog >= 1e3) {
|
|
6699
|
+
logger.warn(`[PlaybackLoop] Frame index out of bounds! audioTime: ${audioTime.toFixed(3)}s, frameIndex: ${frameIndex}, maxAvailable: ${this.currentKeyframes.length - 1 + this.keyframesOffset}, using last frame`);
|
|
6700
|
+
this.lastSyncLogTime = now;
|
|
6701
|
+
this.lastOutOfBoundsState = isOutOfBounds;
|
|
6702
|
+
}
|
|
6703
|
+
} else {
|
|
6704
|
+
if (isOutOfBounds !== this.lastOutOfBoundsState) {
|
|
6705
|
+
this.lastOutOfBoundsState = isOutOfBounds;
|
|
6706
|
+
}
|
|
5589
6707
|
}
|
|
5590
6708
|
if (frameIndex === this.lastRenderedFrameIndex) {
|
|
5591
6709
|
this.playbackLoopId = requestAnimationFrame(playLoop);
|
|
@@ -6095,18 +7213,32 @@ class AvatarDownloader {
|
|
|
6095
7213
|
body: options.body ? JSON.stringify(options.body) : void 0
|
|
6096
7214
|
});
|
|
6097
7215
|
if (!response.ok) {
|
|
6098
|
-
|
|
7216
|
+
let error;
|
|
7217
|
+
if (response.status === 401) {
|
|
7218
|
+
logEvent("session_token_expired", "warning", {
|
|
7219
|
+
con_id: idManager.getConnectionId() || "",
|
|
7220
|
+
description: `HTTP 401: ${response.statusText}`
|
|
7221
|
+
});
|
|
7222
|
+
error = new SPAvatarError(`HTTP 401: ${response.statusText}`, ErrorCode.sessionTokenExpired);
|
|
7223
|
+
} else if (response.status === 400) {
|
|
6099
7224
|
logEvent("session_token_invalid", "warning", {
|
|
6100
7225
|
con_id: idManager.getConnectionId() || "",
|
|
6101
7226
|
description: `HTTP 400: ${response.statusText}`
|
|
6102
7227
|
});
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
7228
|
+
error = new SPAvatarError(`HTTP 400: ${response.statusText}`, ErrorCode.sessionTokenInvalid);
|
|
7229
|
+
} else if (response.status === 404) {
|
|
7230
|
+
const urlMatch = url.match(/\/v2\/character\/([^/?]+)/);
|
|
7231
|
+
const extractedCharacterId = urlMatch ? urlMatch[1] : "unknown";
|
|
7232
|
+
const errorMessage = `HTTP 404: ${response.statusText}`;
|
|
7233
|
+
logEvent("avatar_id_unrecognized", "error", {
|
|
7234
|
+
avatar_id: extractedCharacterId,
|
|
7235
|
+
description: errorMessage
|
|
6107
7236
|
});
|
|
7237
|
+
error = new SPAvatarError(errorMessage, ErrorCode.avatarIDUnrecognized);
|
|
7238
|
+
} else {
|
|
7239
|
+
error = new Error(`HTTP ${response.status} ${response.statusText}`);
|
|
6108
7240
|
}
|
|
6109
|
-
throw
|
|
7241
|
+
throw error;
|
|
6110
7242
|
}
|
|
6111
7243
|
return response.json();
|
|
6112
7244
|
} catch (err) {
|
|
@@ -6118,14 +7250,27 @@ class AvatarDownloader {
|
|
|
6118
7250
|
}
|
|
6119
7251
|
async getCharacterById(characterId) {
|
|
6120
7252
|
var _a;
|
|
7253
|
+
const startTime = Date.now();
|
|
6121
7254
|
try {
|
|
6122
7255
|
const client = this.getSdkApiClient();
|
|
6123
7256
|
const response = await client.request(`/v2/character/${characterId}`, {
|
|
6124
7257
|
method: "GET"
|
|
6125
7258
|
});
|
|
7259
|
+
const duration = Date.now() - startTime;
|
|
7260
|
+
logEvent("fetch_avatar_metadata_measure", "info", {
|
|
7261
|
+
avatar_id: characterId,
|
|
7262
|
+
duration
|
|
7263
|
+
});
|
|
6126
7264
|
return response;
|
|
6127
7265
|
} catch (error) {
|
|
6128
7266
|
logger.errorWithError("Failed to fetch character:", error);
|
|
7267
|
+
if (error instanceof SPAvatarError) {
|
|
7268
|
+
logEvent("fetch_avatar_metadata_failed", "error", {
|
|
7269
|
+
avatar_id: characterId ?? "unknown",
|
|
7270
|
+
description: error.message
|
|
7271
|
+
});
|
|
7272
|
+
throw error;
|
|
7273
|
+
}
|
|
6129
7274
|
const errorMessage = error && typeof error === "object" && "message" in error ? String(error.message) : "Failed to fetch character";
|
|
6130
7275
|
const dataMessage = error && typeof error === "object" && "data" in error && typeof error.data === "object" && ((_a = error.data) == null ? void 0 : _a.message) ? String(error.data.message) : null;
|
|
6131
7276
|
logEvent("fetch_avatar_metadata_failed", "error", {
|
|
@@ -6833,7 +7978,6 @@ class WebGPURenderer {
|
|
|
6833
7978
|
__publicField(this, "sortIndexBuffer", null);
|
|
6834
7979
|
__publicField(this, "splatDataBuffer", null);
|
|
6835
7980
|
__publicField(this, "storageBindGroup", null);
|
|
6836
|
-
__publicField(this, "lastSortOrder", null);
|
|
6837
7981
|
__publicField(this, "bindGroupNeedsUpdate", false);
|
|
6838
7982
|
__publicField(this, "splatCount", 0);
|
|
6839
7983
|
__publicField(this, "presentationFormat", "bgra8unorm");
|
|
@@ -7201,7 +8345,6 @@ class WebGPURenderer {
|
|
|
7201
8345
|
);
|
|
7202
8346
|
if (sortOrder) {
|
|
7203
8347
|
const indexBufferSize = sortOrder.byteLength;
|
|
7204
|
-
const sortOrderChanged = !this.lastSortOrder || sortOrder !== this.lastSortOrder;
|
|
7205
8348
|
if (!this.sortIndexBuffer || this.sortIndexBuffer.size !== indexBufferSize) {
|
|
7206
8349
|
if (this.sortIndexBuffer) {
|
|
7207
8350
|
this.sortIndexBuffer.destroy();
|
|
@@ -7213,16 +8356,13 @@ class WebGPURenderer {
|
|
|
7213
8356
|
});
|
|
7214
8357
|
this.bindGroupNeedsUpdate = true;
|
|
7215
8358
|
}
|
|
7216
|
-
|
|
7217
|
-
this.
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
);
|
|
7224
|
-
this.lastSortOrder = sortOrder;
|
|
7225
|
-
}
|
|
8359
|
+
this.device.queue.writeBuffer(
|
|
8360
|
+
this.sortIndexBuffer,
|
|
8361
|
+
0,
|
|
8362
|
+
sortOrder.buffer,
|
|
8363
|
+
sortOrder.byteOffset,
|
|
8364
|
+
sortOrder.byteLength
|
|
8365
|
+
);
|
|
7226
8366
|
if (this.bindGroupNeedsUpdate && this.renderPipeline && this.sortIndexBuffer && this.splatDataBuffer) {
|
|
7227
8367
|
const storageBindGroupLayout = this.renderPipeline.getBindGroupLayout(1);
|
|
7228
8368
|
this.storageBindGroup = this.device.createBindGroup({
|
|
@@ -7244,7 +8384,7 @@ class WebGPURenderer {
|
|
|
7244
8384
|
}
|
|
7245
8385
|
}
|
|
7246
8386
|
render(viewMatrix, projectionMatrix, screenSize, transform) {
|
|
7247
|
-
if (!this.device || !this.context || !this.renderPipeline
|
|
8387
|
+
if (!this.device || !this.context || !this.renderPipeline)
|
|
7248
8388
|
return;
|
|
7249
8389
|
if (this.splatCount === 0 || !this.storageBindGroup)
|
|
7250
8390
|
return;
|