@decartai/sdk 0.0.29 → 0.0.31

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.
@@ -1,6 +1,6 @@
1
1
  //#region src/realtime/audio-stream-manager.ts
2
2
  /**
3
- * Manages an audio stream for avatar-live mode.
3
+ * Manages an audio stream for live_avatar mode.
4
4
  * Creates a continuous audio stream that outputs silence by default,
5
5
  * and allows playing audio files through the stream.
6
6
  */
@@ -17,7 +17,7 @@ declare const avatarOptionsSchema: z.ZodObject<{
17
17
  type AvatarOptions = z.infer<typeof avatarOptionsSchema>;
18
18
  declare const realTimeClientConnectOptionsSchema: z.ZodObject<{
19
19
  model: z.ZodObject<{
20
- name: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"mirage">, z.ZodLiteral<"mirage_v2">, z.ZodLiteral<"lucy_v2v_720p_rt">, z.ZodLiteral<"avatar-live">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-dev-i2v">, z.ZodLiteral<"lucy-fast-v2v">, z.ZodLiteral<"lucy-pro-t2v">, z.ZodLiteral<"lucy-pro-i2v">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-pro-flf2v">, z.ZodLiteral<"lucy-motion">, z.ZodLiteral<"lucy-restyle-v2v">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-pro-t2i">, z.ZodLiteral<"lucy-pro-i2i">]>]>;
20
+ name: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"mirage">, z.ZodLiteral<"mirage_v2">, z.ZodLiteral<"lucy_v2v_720p_rt">, z.ZodLiteral<"live_avatar">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-dev-i2v">, z.ZodLiteral<"lucy-fast-v2v">, z.ZodLiteral<"lucy-pro-t2v">, z.ZodLiteral<"lucy-pro-i2v">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-pro-flf2v">, z.ZodLiteral<"lucy-motion">, z.ZodLiteral<"lucy-restyle-v2v">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-pro-t2i">, z.ZodLiteral<"lucy-pro-i2i">]>]>;
21
21
  urlPath: z.ZodString;
22
22
  queueUrlPath: z.ZodOptional<z.ZodString>;
23
23
  fps: z.ZodNumber;
@@ -41,7 +41,7 @@ const createRealTimeClient = (opts) => {
41
41
  const parsedOptions = realTimeClientConnectOptionsSchema.safeParse(options);
42
42
  if (!parsedOptions.success) throw parsedOptions.error;
43
43
  const sessionId = v4();
44
- const isAvatarLive = options.model.name === "avatar-live";
44
+ const isAvatarLive = options.model.name === "live_avatar";
45
45
  const { onRemoteStream, initialState, avatar } = parsedOptions.data;
46
46
  let audioStreamManager;
47
47
  let inputStream;
@@ -67,8 +67,8 @@ var WebRTCConnection = class {
67
67
  }
68
68
  return;
69
69
  }
70
- if (msg.type === "image_set") {
71
- this.websocketMessagesEmitter.emit("imageSet", msg);
70
+ if (msg.type === "set_image_ack") {
71
+ this.websocketMessagesEmitter.emit("setImageAck", msg);
72
72
  return;
73
73
  }
74
74
  if (!this.pc) return;
@@ -134,16 +134,16 @@ var WebRTCConnection = class {
134
134
  async setImageBase64(imageBase64) {
135
135
  return new Promise((resolve, reject) => {
136
136
  const timeoutId = setTimeout(() => {
137
- this.websocketMessagesEmitter.off("imageSet", listener);
137
+ this.websocketMessagesEmitter.off("setImageAck", listener);
138
138
  reject(/* @__PURE__ */ new Error("Image send timed out"));
139
139
  }, AVATAR_SETUP_TIMEOUT_MS);
140
140
  const listener = (msg) => {
141
141
  clearTimeout(timeoutId);
142
- this.websocketMessagesEmitter.off("imageSet", listener);
143
- if (msg.status === "success") resolve();
144
- else reject(/* @__PURE__ */ new Error(`Failed to send image: ${msg.status}`));
142
+ this.websocketMessagesEmitter.off("setImageAck", listener);
143
+ if (msg.success) resolve();
144
+ else reject(new Error(msg.error ?? "Failed to send image"));
145
145
  };
146
- this.websocketMessagesEmitter.on("imageSet", listener);
146
+ this.websocketMessagesEmitter.on("setImageAck", listener);
147
147
  this.send({
148
148
  type: "set_image",
149
149
  image_data: imageBase64
@@ -1,10 +1,10 @@
1
1
  import { z } from "zod";
2
2
 
3
3
  //#region src/shared/model.d.ts
4
- declare const realtimeModels: z.ZodUnion<readonly [z.ZodLiteral<"mirage">, z.ZodLiteral<"mirage_v2">, z.ZodLiteral<"lucy_v2v_720p_rt">, z.ZodLiteral<"avatar-live">]>;
4
+ declare const realtimeModels: z.ZodUnion<readonly [z.ZodLiteral<"mirage">, z.ZodLiteral<"mirage_v2">, z.ZodLiteral<"lucy_v2v_720p_rt">, z.ZodLiteral<"live_avatar">]>;
5
5
  declare const videoModels: z.ZodUnion<readonly [z.ZodLiteral<"lucy-dev-i2v">, z.ZodLiteral<"lucy-fast-v2v">, z.ZodLiteral<"lucy-pro-t2v">, z.ZodLiteral<"lucy-pro-i2v">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-pro-flf2v">, z.ZodLiteral<"lucy-motion">, z.ZodLiteral<"lucy-restyle-v2v">]>;
6
6
  declare const imageModels: z.ZodUnion<readonly [z.ZodLiteral<"lucy-pro-t2i">, z.ZodLiteral<"lucy-pro-i2i">]>;
7
- declare const modelSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"mirage">, z.ZodLiteral<"mirage_v2">, z.ZodLiteral<"lucy_v2v_720p_rt">, z.ZodLiteral<"avatar-live">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-dev-i2v">, z.ZodLiteral<"lucy-fast-v2v">, z.ZodLiteral<"lucy-pro-t2v">, z.ZodLiteral<"lucy-pro-i2v">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-pro-flf2v">, z.ZodLiteral<"lucy-motion">, z.ZodLiteral<"lucy-restyle-v2v">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-pro-t2i">, z.ZodLiteral<"lucy-pro-i2i">]>]>;
7
+ declare const modelSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"mirage">, z.ZodLiteral<"mirage_v2">, z.ZodLiteral<"lucy_v2v_720p_rt">, z.ZodLiteral<"live_avatar">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-dev-i2v">, z.ZodLiteral<"lucy-fast-v2v">, z.ZodLiteral<"lucy-pro-t2v">, z.ZodLiteral<"lucy-pro-i2v">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-pro-flf2v">, z.ZodLiteral<"lucy-motion">, z.ZodLiteral<"lucy-restyle-v2v">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-pro-t2i">, z.ZodLiteral<"lucy-pro-i2i">]>]>;
8
8
  type Model = z.infer<typeof modelSchema>;
9
9
  type RealTimeModels = z.infer<typeof realtimeModels>;
10
10
  type VideoModels = z.infer<typeof videoModels>;
@@ -6,7 +6,7 @@ const realtimeModels = z.union([
6
6
  z.literal("mirage"),
7
7
  z.literal("mirage_v2"),
8
8
  z.literal("lucy_v2v_720p_rt"),
9
- z.literal("avatar-live")
9
+ z.literal("live_avatar")
10
10
  ]);
11
11
  const videoModels = z.union([
12
12
  z.literal("lucy-dev-i2v"),
@@ -167,9 +167,9 @@ const _models = {
167
167
  height: 704,
168
168
  inputSchema: z.object({})
169
169
  },
170
- "avatar-live": {
171
- urlPath: "/v1/avatar-live/stream",
172
- name: "avatar-live",
170
+ live_avatar: {
171
+ urlPath: "/v1/live_avatar/stream",
172
+ name: "live_avatar",
173
173
  fps: 25,
174
174
  width: 1280,
175
175
  height: 720,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decartai/sdk",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "description": "Decart's JavaScript SDK",
5
5
  "type": "module",
6
6
  "license": "MIT",