@decartai/sdk 0.0.52 → 0.0.54
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/dist/process/types.d.ts +25 -1
- package/dist/realtime/webrtc-connection.js +2 -13
- package/dist/shared/model.d.ts +19 -2
- package/dist/shared/model.js +20 -2
- package/package.json +1 -1
package/dist/process/types.d.ts
CHANGED
|
@@ -80,6 +80,30 @@ interface VideoEditInputs {
|
|
|
80
80
|
*/
|
|
81
81
|
reference_image?: FileInput;
|
|
82
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Model-specific input documentation for lucy-2-v2v.
|
|
85
|
+
* Requires at least one of prompt or reference_image. Both can be provided together.
|
|
86
|
+
*/
|
|
87
|
+
interface VideoEdit2Inputs {
|
|
88
|
+
/**
|
|
89
|
+
* Text description to use for the video editing.
|
|
90
|
+
* At least one of prompt or reference_image must be provided.
|
|
91
|
+
*
|
|
92
|
+
* See our [Prompt Engineering](https://docs.platform.decart.ai/models/video/video-generation#prompt-engineering) guide for how to write prompt for Decart video models effectively.
|
|
93
|
+
*/
|
|
94
|
+
prompt?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Video file to process.
|
|
97
|
+
* Can be a File, Blob, ReadableStream, URL, or string URL.
|
|
98
|
+
*/
|
|
99
|
+
data: FileInput;
|
|
100
|
+
/**
|
|
101
|
+
* Optional reference image to guide what to add to the video.
|
|
102
|
+
* At least one of prompt or reference_image must be provided.
|
|
103
|
+
* Can be a File, Blob, ReadableStream, URL, or string URL.
|
|
104
|
+
*/
|
|
105
|
+
reference_image?: FileInput;
|
|
106
|
+
}
|
|
83
107
|
/**
|
|
84
108
|
* Model-specific input documentation for lucy-restyle-v2v.
|
|
85
109
|
* Allows either prompt or reference_image (mutually exclusive).
|
|
@@ -116,7 +140,7 @@ interface PromptInput {
|
|
|
116
140
|
* This allows different models to have field-specific documentation while maintaining type safety.
|
|
117
141
|
* Specific models are checked first, then falls back to category-based selection.
|
|
118
142
|
*/
|
|
119
|
-
type ModelSpecificInputs<T extends ModelDefinition> = T["name"] extends "lucy-pro-i2i" ? ImageEditingInputs : T["name"] extends "lucy-restyle-v2v" ? VideoRestyleInputs : T["name"] extends "lucy-pro-v2v" ? VideoEditInputs : T["name"] extends ImageModels ? ImageGenerationInputs : T["name"] extends VideoModels ? VideoModelInputs : PromptInput;
|
|
143
|
+
type ModelSpecificInputs<T extends ModelDefinition> = T["name"] extends "lucy-pro-i2i" ? ImageEditingInputs : T["name"] extends "lucy-restyle-v2v" ? VideoRestyleInputs : T["name"] extends "lucy-2-v2v" ? VideoEdit2Inputs : T["name"] extends "lucy-pro-v2v" ? VideoEditInputs : T["name"] extends ImageModels ? ImageGenerationInputs : T["name"] extends VideoModels ? VideoModelInputs : PromptInput;
|
|
120
144
|
interface ProcessInputs {
|
|
121
145
|
/**
|
|
122
146
|
* Random seed for reproducible results.
|
|
@@ -226,11 +226,6 @@ var WebRTCConnection = class {
|
|
|
226
226
|
});
|
|
227
227
|
}
|
|
228
228
|
break;
|
|
229
|
-
case "ice-restart": {
|
|
230
|
-
const turnConfig = msg.turn_config;
|
|
231
|
-
if (turnConfig) await this.setupNewPeerConnection(turnConfig);
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
229
|
}
|
|
235
230
|
} catch (error) {
|
|
236
231
|
this.logger.error("Signaling handler error", { error: String(error) });
|
|
@@ -307,20 +302,14 @@ var WebRTCConnection = class {
|
|
|
307
302
|
this.callbacks.onStateChange?.(state);
|
|
308
303
|
}
|
|
309
304
|
}
|
|
310
|
-
async setupNewPeerConnection(
|
|
305
|
+
async setupNewPeerConnection() {
|
|
311
306
|
if (this.pc) {
|
|
312
307
|
this.pc.getSenders().forEach((sender) => {
|
|
313
308
|
if (sender.track && this.pc) this.pc.removeTrack(sender);
|
|
314
309
|
});
|
|
315
310
|
this.pc.close();
|
|
316
311
|
}
|
|
317
|
-
|
|
318
|
-
if (turnConfig) iceServers.push({
|
|
319
|
-
urls: turnConfig.server_url,
|
|
320
|
-
credential: turnConfig.credential,
|
|
321
|
-
username: turnConfig.username
|
|
322
|
-
});
|
|
323
|
-
this.pc = new RTCPeerConnection({ iceServers });
|
|
312
|
+
this.pc = new RTCPeerConnection({ iceServers: ICE_SERVERS });
|
|
324
313
|
this.setState("connecting");
|
|
325
314
|
if (this.localStream) {
|
|
326
315
|
if (this.callbacks.modelName === "live_avatar") this.pc.addTransceiver("video", { direction: "recvonly" });
|
package/dist/shared/model.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { z } from "zod";
|
|
|
2
2
|
|
|
3
3
|
//#region src/shared/model.d.ts
|
|
4
4
|
declare const realtimeModels: z.ZodUnion<readonly [z.ZodLiteral<"mirage">, z.ZodLiteral<"mirage_v2">, z.ZodLiteral<"lucy_v2v_720p_rt">, z.ZodLiteral<"lucy_2_rt">, z.ZodLiteral<"live_avatar">]>;
|
|
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">]>;
|
|
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">, z.ZodLiteral<"lucy-2-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<"lucy_2_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">]>]>;
|
|
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<"lucy_2_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.ZodLiteral<"lucy-2-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>;
|
|
@@ -143,6 +143,22 @@ declare const modelInputSchemas: {
|
|
|
143
143
|
resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
|
|
144
144
|
enhance_prompt: z.ZodOptional<z.ZodBoolean>;
|
|
145
145
|
}, z.core.$strip>;
|
|
146
|
+
readonly "lucy-2-v2v": z.ZodObject<{
|
|
147
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
148
|
+
reference_image: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<File, File>, z.ZodCustom<Blob, Blob>, z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>, z.ZodCustom<URL, URL>, z.ZodURL, z.ZodObject<{
|
|
149
|
+
uri: z.ZodString;
|
|
150
|
+
type: z.ZodString;
|
|
151
|
+
name: z.ZodString;
|
|
152
|
+
}, z.core.$strip>]>>;
|
|
153
|
+
data: z.ZodUnion<readonly [z.ZodCustom<File, File>, z.ZodCustom<Blob, Blob>, z.ZodCustom<ReadableStream<unknown>, ReadableStream<unknown>>, z.ZodCustom<URL, URL>, z.ZodURL, z.ZodObject<{
|
|
154
|
+
uri: z.ZodString;
|
|
155
|
+
type: z.ZodString;
|
|
156
|
+
name: z.ZodString;
|
|
157
|
+
}, z.core.$strip>]>;
|
|
158
|
+
seed: z.ZodOptional<z.ZodNumber>;
|
|
159
|
+
resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
|
|
160
|
+
enhance_prompt: z.ZodOptional<z.ZodBoolean>;
|
|
161
|
+
}, z.core.$strip>;
|
|
146
162
|
};
|
|
147
163
|
type ModelInputSchemas = typeof modelInputSchemas;
|
|
148
164
|
type ModelDefinition<T extends Model = Model> = {
|
|
@@ -185,6 +201,7 @@ declare const models: {
|
|
|
185
201
|
* - `"lucy-dev-i2v"` - Image-to-video (Dev quality)
|
|
186
202
|
* - `"lucy-fast-v2v"` - Video-to-video (Fast quality)
|
|
187
203
|
* - `"lucy-restyle-v2v"` - Video-to-video (Restyling)
|
|
204
|
+
* - `"lucy-2-v2v"` - Video-to-video (Long-form editing, 720p)
|
|
188
205
|
*/
|
|
189
206
|
video: <T extends VideoModels>(model: T) => ModelDefinition<T>;
|
|
190
207
|
/**
|
package/dist/shared/model.js
CHANGED
|
@@ -17,7 +17,8 @@ const videoModels = z.union([
|
|
|
17
17
|
z.literal("lucy-pro-v2v"),
|
|
18
18
|
z.literal("lucy-pro-flf2v"),
|
|
19
19
|
z.literal("lucy-motion"),
|
|
20
|
-
z.literal("lucy-restyle-v2v")
|
|
20
|
+
z.literal("lucy-restyle-v2v"),
|
|
21
|
+
z.literal("lucy-2-v2v")
|
|
21
22
|
]);
|
|
22
23
|
const imageModels = z.union([z.literal("lucy-pro-t2i"), z.literal("lucy-pro-i2i")]);
|
|
23
24
|
const modelSchema = z.union([
|
|
@@ -136,7 +137,15 @@ const modelInputSchemas = {
|
|
|
136
137
|
seed: z.number().optional().describe("Seed for the video generation"),
|
|
137
138
|
resolution: proV2vResolutionSchema,
|
|
138
139
|
enhance_prompt: z.boolean().optional().describe("Whether to enhance the prompt (only valid with text prompt, defaults to true on backend)")
|
|
139
|
-
}).refine((data) => data.prompt !== void 0 !== (data.reference_image !== void 0), { message: "Must provide either 'prompt' or 'reference_image', but not both" }).refine((data) => !(data.reference_image !== void 0 && data.enhance_prompt !== void 0), { message: "'enhance_prompt' is only valid when using 'prompt', not 'reference_image'" })
|
|
140
|
+
}).refine((data) => data.prompt !== void 0 !== (data.reference_image !== void 0), { message: "Must provide either 'prompt' or 'reference_image', but not both" }).refine((data) => !(data.reference_image !== void 0 && data.enhance_prompt !== void 0), { message: "'enhance_prompt' is only valid when using 'prompt', not 'reference_image'" }),
|
|
141
|
+
"lucy-2-v2v": z.object({
|
|
142
|
+
prompt: z.string().min(1).max(1e3).optional().describe("Text prompt for the video editing"),
|
|
143
|
+
reference_image: fileInputSchema.optional().describe("Optional reference image to guide the edit (File, Blob, ReadableStream, URL, or string URL)"),
|
|
144
|
+
data: fileInputSchema.describe("Video file to process (File, Blob, ReadableStream, URL, or string URL)"),
|
|
145
|
+
seed: z.number().optional().describe("The seed to use for the generation"),
|
|
146
|
+
resolution: proV2vResolutionSchema,
|
|
147
|
+
enhance_prompt: z.boolean().optional().describe("Whether to enhance the prompt")
|
|
148
|
+
}).refine((data) => data.prompt !== void 0 || data.reference_image !== void 0, { message: "Must provide at least one of 'prompt' or 'reference_image'" })
|
|
140
149
|
};
|
|
141
150
|
const modelDefinitionSchema = z.object({
|
|
142
151
|
name: z.string(),
|
|
@@ -282,6 +291,15 @@ const _models = {
|
|
|
282
291
|
width: 1280,
|
|
283
292
|
height: 704,
|
|
284
293
|
inputSchema: modelInputSchemas["lucy-restyle-v2v"]
|
|
294
|
+
},
|
|
295
|
+
"lucy-2-v2v": {
|
|
296
|
+
urlPath: "/v1/generate/lucy-2-v2v",
|
|
297
|
+
queueUrlPath: "/v1/jobs/lucy-2-v2v",
|
|
298
|
+
name: "lucy-2-v2v",
|
|
299
|
+
fps: 20,
|
|
300
|
+
width: 1280,
|
|
301
|
+
height: 720,
|
|
302
|
+
inputSchema: modelInputSchemas["lucy-2-v2v"]
|
|
285
303
|
}
|
|
286
304
|
}
|
|
287
305
|
};
|