@decartai/sdk 0.1.23 → 0.2.1

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/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import { G2GMetrics } from "./realtime/observability/g2g.js";
11
11
  import { WebRTCStats } from "./realtime/observability/webrtc-stats.js";
12
12
  import { ConnectionQuality, ConnectionQualityLimitingFactor, ConnectionQualityMetrics, ConnectionQualityReport } from "./realtime/observability/connection-quality.js";
13
13
  import { ClientSessionConnectionBreakdownEvent, ClientSessionConnectionBreakdownPhase, DiagnosticEvent, DiagnosticEventName, DiagnosticEvents, ReconnectEvent, VideoStallEvent } from "./realtime/observability/diagnostics.js";
14
- import { ConnectionState, GenerationEndedMessage, QueuePosition, QueuePositionMessage } from "./realtime/types.js";
14
+ import { ConnectionState, GenerationEndedMessage, QueuePosition, QueuePositionMessage, SessionEnded } from "./realtime/types.js";
15
15
  import { SetInput } from "./realtime/methods.js";
16
16
  import { Events, RealTimeClient, RealTimeClientConnectOptions, RealTimeClientInitialState, RealtimeMediaStream } from "./realtime/client.js";
17
17
  import { CheckConnectivityOptions, ConnectivityMetrics, ConnectivityReport, ConnectivityTransport } from "./realtime/preflight-types.js";
@@ -33,4 +33,4 @@ declare const createDecartClient: (options?: DecartClientOptions) => {
33
33
  files: FilesClient;
34
34
  };
35
35
  //#endregion
36
- export { CanonicalModel, CheckConnectivityOptions, ClientSessionConnectionBreakdownEvent, ClientSessionConnectionBreakdownPhase, ConnectionQuality, ConnectionQualityLimitingFactor, ConnectionQualityMetrics, ConnectionQualityReport, ConnectionState, ConnectivityMetrics, ConnectivityReport, ConnectivityTransport, CreateTokenOptions, CreateTokenResponse, CustomModelDefinition, type DecartClientOptions, DecartSDKError, DiagnosticEvent, DiagnosticEventName, DiagnosticEvents, ERROR_CODES, FileInput, FileReference, FileUploadInput, FilesClient, G2GMetrics, GenerationEndedMessage, ImageModelDefinition, ImageModels, JobStatus, JobStatusResponse, JobSubmitResponse, ListedModelDefinition, LogLevel, Logger, Model, ModelDefinition, ModelFps, ModelKind, ModelState, ProcessClient, ProcessOptions, QueueClient, QueueJobResult, QueuePosition, QueuePositionMessage, QueueSubmitAndPollOptions, QueueSubmitOptions, ReactNativeFile, RealTimeClient, RealTimeClientConnectOptions, RealTimeClientInitialState, Events as RealTimeEvents, RealTimeModels, RealTimeSubscribeClient, RealtimeMediaStream, ReconnectEvent, SetInput, SubscribeEvents, SubscribeOptions, TokensClient, UploadFileOptions, VideoModelDefinition, VideoModels, VideoStallEvent, WebRTCStats, createConsoleLogger, createDecartClient, isCanonicalModel, isImageModel, isModel, isRealtimeModel, isVideoModel, listModels, modelAliases, models, noopLogger, resolveCanonicalModelAlias, resolveFpsNumber, resolveModelAlias };
36
+ export { CanonicalModel, CheckConnectivityOptions, ClientSessionConnectionBreakdownEvent, ClientSessionConnectionBreakdownPhase, ConnectionQuality, ConnectionQualityLimitingFactor, ConnectionQualityMetrics, ConnectionQualityReport, ConnectionState, ConnectivityMetrics, ConnectivityReport, ConnectivityTransport, CreateTokenOptions, CreateTokenResponse, CustomModelDefinition, type DecartClientOptions, DecartSDKError, DiagnosticEvent, DiagnosticEventName, DiagnosticEvents, ERROR_CODES, FileInput, FileReference, FileUploadInput, FilesClient, G2GMetrics, GenerationEndedMessage, ImageModelDefinition, ImageModels, JobStatus, JobStatusResponse, JobSubmitResponse, ListedModelDefinition, LogLevel, Logger, Model, ModelDefinition, ModelFps, ModelKind, ModelState, ProcessClient, ProcessOptions, QueueClient, QueueJobResult, QueuePosition, QueuePositionMessage, QueueSubmitAndPollOptions, QueueSubmitOptions, ReactNativeFile, RealTimeClient, RealTimeClientConnectOptions, RealTimeClientInitialState, Events as RealTimeEvents, RealTimeModels, RealTimeSubscribeClient, RealtimeMediaStream, ReconnectEvent, SessionEnded, SetInput, SubscribeEvents, SubscribeOptions, TokensClient, UploadFileOptions, VideoModelDefinition, VideoModels, VideoStallEvent, WebRTCStats, createConsoleLogger, createDecartClient, isCanonicalModel, isImageModel, isModel, isRealtimeModel, isVideoModel, listModels, modelAliases, models, noopLogger, resolveCanonicalModelAlias, resolveFpsNumber, resolveModelAlias };
@@ -11,7 +11,7 @@ import { G2GMetrics } from "./realtime/observability/g2g.js";
11
11
  import { WebRTCStats } from "./realtime/observability/webrtc-stats.js";
12
12
  import { ConnectionQuality, ConnectionQualityLimitingFactor, ConnectionQualityMetrics, ConnectionQualityReport } from "./realtime/observability/connection-quality.js";
13
13
  import { ClientSessionConnectionBreakdownEvent, ClientSessionConnectionBreakdownPhase, DiagnosticEvent, DiagnosticEventName, DiagnosticEvents, ReconnectEvent, VideoStallEvent } from "./realtime/observability/diagnostics.js";
14
- import { ConnectionState, GenerationEndedMessage, QueuePosition, QueuePositionMessage } from "./realtime/types.js";
14
+ import { ConnectionState, GenerationEndedMessage, QueuePosition, QueuePositionMessage, SessionEnded } from "./realtime/types.js";
15
15
  import { SetInput } from "./realtime/methods.js";
16
16
  import { Events, RealTimeClient, RealTimeClientConnectOptions, RealTimeClientInitialState, RealtimeMediaStream } from "./realtime/client.js";
17
17
  import { CheckConnectivityOptions, ConnectivityMetrics, ConnectivityReport, ConnectivityTransport } from "./realtime/preflight-types.js";
@@ -33,4 +33,4 @@ declare const createDecartClient: (options?: DecartClientOptions) => {
33
33
  files: FilesClient;
34
34
  };
35
35
  //#endregion
36
- export { CanonicalModel, CheckConnectivityOptions, ClientSessionConnectionBreakdownEvent, ClientSessionConnectionBreakdownPhase, ConnectionQuality, ConnectionQualityLimitingFactor, ConnectionQualityMetrics, ConnectionQualityReport, ConnectionState, ConnectivityMetrics, ConnectivityReport, ConnectivityTransport, CreateTokenOptions, CreateTokenResponse, CustomModelDefinition, type DecartClientOptions, DecartSDKError, DiagnosticEvent, DiagnosticEventName, DiagnosticEvents, ERROR_CODES, FileInput, FileReference, FileUploadInput, FilesClient, G2GMetrics, GenerationEndedMessage, ImageModelDefinition, ImageModels, JobStatus, JobStatusResponse, JobSubmitResponse, ListedModelDefinition, LogLevel, Logger, Model, ModelDefinition, ModelFps, ModelKind, ModelState, ProcessClient, ProcessOptions, QueueClient, QueueJobResult, QueuePosition, QueuePositionMessage, QueueSubmitAndPollOptions, QueueSubmitOptions, ReactNativeFile, RealTimeClient, RealTimeClientConnectOptions, RealTimeClientInitialState, Events as RealTimeEvents, RealTimeModels, RealTimeSubscribeClient, RealtimeMediaStream, ReconnectEvent, SetInput, SubscribeEvents, SubscribeOptions, TokensClient, UploadFileOptions, VideoModelDefinition, VideoModels, VideoStallEvent, WebRTCStats, createConsoleLogger, createDecartClient, isCanonicalModel, isImageModel, isModel, isRealtimeModel, isVideoModel, listModels, modelAliases, models, noopLogger, resolveCanonicalModelAlias, resolveFpsNumber, resolveModelAlias };
36
+ export { CanonicalModel, CheckConnectivityOptions, ClientSessionConnectionBreakdownEvent, ClientSessionConnectionBreakdownPhase, ConnectionQuality, ConnectionQualityLimitingFactor, ConnectionQualityMetrics, ConnectionQualityReport, ConnectionState, ConnectivityMetrics, ConnectivityReport, ConnectivityTransport, CreateTokenOptions, CreateTokenResponse, CustomModelDefinition, type DecartClientOptions, DecartSDKError, DiagnosticEvent, DiagnosticEventName, DiagnosticEvents, ERROR_CODES, FileInput, FileReference, FileUploadInput, FilesClient, G2GMetrics, GenerationEndedMessage, ImageModelDefinition, ImageModels, JobStatus, JobStatusResponse, JobSubmitResponse, ListedModelDefinition, LogLevel, Logger, Model, ModelDefinition, ModelFps, ModelKind, ModelState, ProcessClient, ProcessOptions, QueueClient, QueueJobResult, QueuePosition, QueuePositionMessage, QueueSubmitAndPollOptions, QueueSubmitOptions, ReactNativeFile, RealTimeClient, RealTimeClientConnectOptions, RealTimeClientInitialState, Events as RealTimeEvents, RealTimeModels, RealTimeSubscribeClient, RealtimeMediaStream, ReconnectEvent, SessionEnded, SetInput, SubscribeEvents, SubscribeOptions, TokensClient, UploadFileOptions, VideoModelDefinition, VideoModels, VideoStallEvent, WebRTCStats, createConsoleLogger, createDecartClient, isCanonicalModel, isImageModel, isModel, isRealtimeModel, isVideoModel, listModels, modelAliases, models, noopLogger, resolveCanonicalModelAlias, resolveFpsNumber, resolveModelAlias };
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.1.23";
2
+ var version = "0.2.1";
3
3
  //#endregion
4
4
  export { version };
@@ -143,7 +143,7 @@ interface PromptInput {
143
143
  * This allows different models to have field-specific documentation while maintaining type safety.
144
144
  * Specific models are checked first, then falls back to category-based selection.
145
145
  */
146
- type ModelSpecificInputs<T extends ModelDefinition> = T["name"] extends "lucy-pro-i2i" | "lucy-image-2" ? ImageEditingInputs : T["name"] extends "lucy-restyle-v2v" | "lucy-restyle-2" ? VideoRestyleInputs : T["name"] extends "lucy-2.1" | "lucy-2.5" | "lucy-vton-2" | "lucy-vton-3" | "lucy-vton-3.5" | "lucy-2.1-vton-2" | "lucy-vton-latest" ? VideoEdit2Inputs : T["name"] extends "lucy-pro-v2v" | "lucy-clip" ? VideoEditInputs : T["name"] extends ImageModels ? ImageGenerationInputs : T["name"] extends VideoModels ? VideoModelInputs : PromptInput;
146
+ type ModelSpecificInputs<T extends ModelDefinition> = T["name"] extends "lucy-pro-i2i" | "lucy-image-2" ? ImageEditingInputs : T["name"] extends "lucy-restyle-v2v" | "lucy-restyle-2" ? VideoRestyleInputs : T["name"] extends "lucy-2.1" | "lucy-2.5" | "lucy-vton-3.5" | "lucy-vton-latest" ? VideoEdit2Inputs : T["name"] extends "lucy-pro-v2v" | "lucy-clip" ? VideoEditInputs : T["name"] extends ImageModels ? ImageGenerationInputs : T["name"] extends VideoModels ? VideoModelInputs : PromptInput;
147
147
  interface ProcessInputs {
148
148
  /**
149
149
  * Random seed for reproducible results.
@@ -3,7 +3,7 @@ import { DecartSDKError } from "../utils/errors.js";
3
3
  import { WebRTCStats } from "./observability/webrtc-stats.js";
4
4
  import { ConnectionQualityReport } from "./observability/connection-quality.js";
5
5
  import { DiagnosticEvent } from "./observability/diagnostics.js";
6
- import { ConnectionState, GenerationEnded, GenerationTick, ImageSetOptions, QueuePosition } from "./types.js";
6
+ import { ConnectionState, GenerationEnded, GenerationTick, ImageSetOptions, QueuePosition, SessionEnded } from "./types.js";
7
7
  import { SetInput } from "./methods.js";
8
8
  import { z } from "zod";
9
9
 
@@ -78,6 +78,8 @@ type Events = {
78
78
  error: DecartSDKError;
79
79
  generationTick: GenerationTick;
80
80
  generationEnded: GenerationEnded;
81
+ /** Terminal: the server ended the session and no reconnect is coming. */
82
+ sessionEnded: SessionEnded;
81
83
  diagnostic: DiagnosticEvent;
82
84
  stats: WebRTCStats;
83
85
  };
@@ -112,6 +112,7 @@ const createRealTimeClient = (opts) => {
112
112
  });
113
113
  session.on("generationTick", (e) => emitOrBuffer("generationTick", e));
114
114
  session.on("generationEnded", (e) => emitOrBuffer("generationEnded", e));
115
+ session.on("sessionEnded", (e) => emitOrBuffer("sessionEnded", e));
115
116
  session.on("error", (error) => {
116
117
  logger.error("Realtime error", { error: error.message });
117
118
  emitOrBuffer("error", classifyWebrtcError(error));
@@ -25,6 +25,14 @@ const REALTIME_CONFIG = {
25
25
  minTimeout: 1e3,
26
26
  maxTimeout: 1e4
27
27
  },
28
+ /**
29
+ * `generation_ended` reasons the server will not change its mind about.
30
+ * The rest of its vocabulary (`error`, `disconnect`, `timeout`) is generic
31
+ * or overloaded, so those still retry.
32
+ */
33
+ terminalEndReasons: ["moderation_violation", "insufficient_credits"],
34
+ /** Close code for a policy termination. */
35
+ terminalCloseCode: 1008,
28
36
  permanentErrorSubstrings: [
29
37
  "permission denied",
30
38
  "not allowed",
@@ -4,6 +4,22 @@ import { SignalingChannel } from "./signaling-channel.js";
4
4
  import mitt from "mitt";
5
5
  import pRetry, { AbortError } from "p-retry";
6
6
  //#region src/realtime/stream-session.ts
7
+ function isTerminalEndReason(reason) {
8
+ return reason !== void 0 && REALTIME_CONFIG.session.terminalEndReasons.includes(reason);
9
+ }
10
+ /** The reason is only sent once generation has started; earlier kills carry just the code. */
11
+ function terminalReasonFromClose(cause) {
12
+ return cause.code === REALTIME_CONFIG.session.terminalCloseCode ? "policy_violation" : null;
13
+ }
14
+ /**
15
+ * SignalingChannel only emits `closed` after the handshake, so a close during the
16
+ * join reaches us as connect-failure text rather than an event.
17
+ */
18
+ function terminalReasonFromError(error) {
19
+ if (!(error instanceof Error)) return null;
20
+ const marker = `websocket closed: ${REALTIME_CONFIG.session.terminalCloseCode}`;
21
+ return error.message.toLowerCase().includes(marker) ? "policy_violation" : null;
22
+ }
7
23
  function encodeSubscribeToken(roomName, options = {}) {
8
24
  return btoa(JSON.stringify({
9
25
  room_name: roomName,
@@ -28,6 +44,13 @@ var StreamSession = class {
28
44
  disposed = false;
29
45
  currentAttempt = 0;
30
46
  teardownGeneration = 0;
47
+ terminalEndReason = null;
48
+ /**
49
+ * Replayed as a reconnect's initial state. Callers usually connect first and
50
+ * send the image after, so without this the new session joins with nothing
51
+ * applied and never starts generating.
52
+ */
53
+ appliedState = null;
31
54
  logger;
32
55
  constructor(config) {
33
56
  this.config = config;
@@ -54,6 +77,7 @@ var StreamSession = class {
54
77
  }
55
78
  async connect() {
56
79
  this.disposed = false;
80
+ this.terminalEndReason = null;
57
81
  const attempt = ++this.currentAttempt;
58
82
  this.setState("connecting");
59
83
  this.logger.info("realtime connect: starting", { attemptCycle: attempt });
@@ -61,6 +85,14 @@ var StreamSession = class {
61
85
  await pRetry(() => this.runOneConnect(attempt), this.retryOptionsFor(attempt));
62
86
  } catch (error) {
63
87
  const message = error instanceof Error ? error.message : String(error);
88
+ const terminal = this.terminalEndReason ?? terminalReasonFromError(error);
89
+ if (terminal && !this.disposed) {
90
+ this.finishTerminally(terminal, {
91
+ source: "connect",
92
+ error: message
93
+ });
94
+ throw error;
95
+ }
64
96
  this.logger.error("realtime connect: exhausted all retries", { error: message });
65
97
  if (this.currentAttempt === attempt && !this.disposed) this.setState("disconnected");
66
98
  throw error;
@@ -68,11 +100,25 @@ var StreamSession = class {
68
100
  }
69
101
  async sendPrompt(text, opts) {
70
102
  this.assertConnected();
71
- return this.signaling.sendPrompt(text, opts);
103
+ await this.signaling.sendPrompt(text, opts);
104
+ this.appliedState = {
105
+ ...this.getInitialState(),
106
+ prompt: text,
107
+ enhance: opts?.enhance
108
+ };
72
109
  }
73
110
  async setImage(payload, opts) {
74
111
  this.assertConnected();
75
- return this.signaling.setImage(payload, opts);
112
+ await this.signaling.setImage(payload, opts);
113
+ this.appliedState = payload.kind === "ref" ? {
114
+ imageRef: payload.ref,
115
+ prompt: opts?.prompt ?? null,
116
+ enhance: opts?.enhance
117
+ } : {
118
+ image: payload.data,
119
+ prompt: opts?.prompt ?? null,
120
+ enhance: opts?.enhance
121
+ };
76
122
  }
77
123
  async replaceVideoTrack(track) {
78
124
  this.assertConnected();
@@ -96,6 +142,12 @@ var StreamSession = class {
96
142
  },
97
143
  shouldRetry: (error) => {
98
144
  if (this.disposed || this.currentAttempt !== attempt) return false;
145
+ const terminal = this.terminalEndReason ?? terminalReasonFromError(error);
146
+ if (terminal) {
147
+ this.terminalEndReason = terminal;
148
+ this.logger.error("realtime connect: session refused, not retrying", { reason: terminal });
149
+ return false;
150
+ }
99
151
  const msg = error.message.toLowerCase();
100
152
  const permanent = REALTIME_CONFIG.session.permanentErrorSubstrings.some((err) => msg.includes(err));
101
153
  if (permanent) this.logger.error("realtime connect: permanent error, not retrying", { error: error.message });
@@ -158,6 +210,9 @@ var StreamSession = class {
158
210
  });
159
211
  }
160
212
  getInitialState() {
213
+ return this.appliedState ?? this.configInitialState();
214
+ }
215
+ configInitialState() {
161
216
  if (this.config.initialImageRef !== void 0) return {
162
217
  imageRef: this.config.initialImageRef,
163
218
  prompt: this.config.initialPrompt?.text,
@@ -183,12 +238,18 @@ var StreamSession = class {
183
238
  this.markGenerating();
184
239
  this.events.emit("generationTick", e);
185
240
  });
186
- this.signaling.on("generationEnded", (e) => this.events.emit("generationEnded", e));
241
+ this.signaling.on("generationEnded", (e) => {
242
+ if (isTerminalEndReason(e.reason)) this.terminalEndReason = e.reason;
243
+ this.events.emit("generationEnded", e);
244
+ });
187
245
  this.signaling.on("serverError", (err) => this.events.emit("error", err));
188
- this.signaling.on("closed", (info) => this.handleConnectionLoss({
189
- source: "signaling",
190
- ...info
191
- }));
246
+ this.signaling.on("closed", (info) => {
247
+ this.terminalEndReason ??= terminalReasonFromClose({ ...info });
248
+ this.handleConnectionLoss({
249
+ source: "signaling",
250
+ ...info
251
+ });
252
+ });
192
253
  }
193
254
  markGenerating() {
194
255
  if (this.state === "connected") this.setState("generating");
@@ -202,6 +263,11 @@ var StreamSession = class {
202
263
  }
203
264
  handleConnectionLoss(cause) {
204
265
  if (this.disposed) return;
266
+ const terminalReason = this.terminalEndReason ?? terminalReasonFromClose(cause);
267
+ if (terminalReason) {
268
+ this.finishTerminally(terminalReason, cause);
269
+ return;
270
+ }
205
271
  if (this.state !== "connected" && this.state !== "generating") {
206
272
  this.logger.debug("connection loss ignored (not connected)", {
207
273
  state: this.state,
@@ -215,6 +281,22 @@ var StreamSession = class {
215
281
  });
216
282
  this.scheduleReconnect();
217
283
  }
284
+ /**
285
+ * The server ended this session on purpose: retrying would get the same answer
286
+ * and bill another session, and "reconnecting" would hide the reason.
287
+ */
288
+ finishTerminally(reason, cause) {
289
+ this.logger.warn("realtime session ended by the server; not reconnecting", {
290
+ reason,
291
+ state: this.state,
292
+ ...cause
293
+ });
294
+ this.terminalEndReason = reason;
295
+ this.disposed = true;
296
+ this.tearDown();
297
+ this.setState("disconnected");
298
+ this.events.emit("sessionEnded", { reason });
299
+ }
218
300
  scheduleReconnect() {
219
301
  const attempt = ++this.currentAttempt;
220
302
  this.setState("reconnecting");
@@ -229,6 +311,14 @@ var StreamSession = class {
229
311
  }).catch((error) => {
230
312
  if (this.disposed || this.currentAttempt !== attempt) return;
231
313
  const message = error instanceof Error ? error.message : String(error);
314
+ const terminal = this.terminalEndReason ?? terminalReasonFromError(error);
315
+ if (terminal) {
316
+ this.finishTerminally(terminal, {
317
+ source: "reconnect",
318
+ error: message
319
+ });
320
+ return;
321
+ }
232
322
  this.logger.error("realtime reconnect: failed permanently", { error: message });
233
323
  this.tearDown();
234
324
  this.setState("disconnected");
@@ -20,10 +20,14 @@ type GenerationEnded = {
20
20
  seconds: number;
21
21
  reason: string;
22
22
  };
23
+ /** The server ended the session on purpose; the SDK will not reconnect. */
24
+ type SessionEnded = {
25
+ reason: string;
26
+ };
23
27
  type ImageSetOptions = {
24
28
  prompt?: string | null;
25
29
  enhance?: boolean;
26
30
  timeout?: number;
27
31
  };
28
32
  //#endregion
29
- export { ConnectionState, GenerationEnded, GenerationEndedMessage, GenerationTick, ImageSetOptions, QueuePosition, QueuePositionMessage };
33
+ export { ConnectionState, GenerationEnded, GenerationEndedMessage, GenerationTick, ImageSetOptions, QueuePosition, QueuePositionMessage, SessionEnded };
@@ -5,8 +5,6 @@ import { z } from "zod";
5
5
  declare const canonicalModelSchema: z.ZodEnum<{
6
6
  "lucy-2.1": "lucy-2.1";
7
7
  "lucy-2.5": "lucy-2.5";
8
- "lucy-vton-2": "lucy-vton-2";
9
- "lucy-vton-3": "lucy-vton-3";
10
8
  "lucy-vton-3.5": "lucy-vton-3.5";
11
9
  "lucy-restyle-2": "lucy-restyle-2";
12
10
  "lucy-clip": "lucy-clip";
@@ -18,17 +16,16 @@ type CanonicalModel = z.infer<typeof canonicalModelSchema>;
18
16
  * Old names still work but will log a deprecation warning.
19
17
  */
20
18
  declare const modelAliases: {
21
- readonly "lucy-2.1-vton-2": "lucy-vton-2";
22
19
  readonly "lucy-pro-v2v": "lucy-clip";
23
20
  readonly "lucy-restyle-v2v": "lucy-restyle-2";
24
21
  readonly "lucy-pro-i2i": "lucy-image-2";
25
22
  };
26
23
  /** @internal Test-only helper to reset deprecation warning tracking */
27
24
 
28
- declare const realtimeModels: z.ZodUnion<readonly [z.ZodLiteral<"lucy-2.1">, z.ZodLiteral<"lucy-2.5">, z.ZodLiteral<"lucy-vton-2">, z.ZodLiteral<"lucy-vton-3">, z.ZodLiteral<"lucy-vton-3.5">, z.ZodLiteral<"lucy-restyle-2">, z.ZodLiteral<"lucy-latest">, z.ZodLiteral<"lucy-vton-latest">, z.ZodLiteral<"lucy-restyle-latest">, z.ZodLiteral<"lucy-2.1-vton-2">]>;
29
- declare const videoModels: z.ZodUnion<readonly [z.ZodLiteral<"lucy-clip">, z.ZodLiteral<"lucy-2.1">, z.ZodLiteral<"lucy-2.5">, z.ZodLiteral<"lucy-vton-2">, z.ZodLiteral<"lucy-vton-3">, z.ZodLiteral<"lucy-vton-3.5">, z.ZodLiteral<"lucy-restyle-2">, z.ZodLiteral<"lucy-latest">, z.ZodLiteral<"lucy-vton-latest">, z.ZodLiteral<"lucy-restyle-latest">, z.ZodLiteral<"lucy-clip-latest">, z.ZodLiteral<"lucy-2.1-vton-2">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-restyle-v2v">]>;
25
+ declare const realtimeModels: z.ZodUnion<readonly [z.ZodLiteral<"lucy-2.1">, z.ZodLiteral<"lucy-2.5">, z.ZodLiteral<"lucy-vton-3.5">, z.ZodLiteral<"lucy-restyle-2">, z.ZodLiteral<"lucy-latest">, z.ZodLiteral<"lucy-vton-latest">, z.ZodLiteral<"lucy-restyle-latest">]>;
26
+ declare const videoModels: z.ZodUnion<readonly [z.ZodLiteral<"lucy-clip">, z.ZodLiteral<"lucy-2.1">, z.ZodLiteral<"lucy-2.5">, z.ZodLiteral<"lucy-vton-3.5">, z.ZodLiteral<"lucy-restyle-2">, z.ZodLiteral<"lucy-latest">, z.ZodLiteral<"lucy-vton-latest">, z.ZodLiteral<"lucy-restyle-latest">, z.ZodLiteral<"lucy-clip-latest">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-restyle-v2v">]>;
30
27
  declare const imageModels: z.ZodUnion<readonly [z.ZodLiteral<"lucy-image-2">, z.ZodLiteral<"lucy-image-latest">, z.ZodLiteral<"lucy-pro-i2i">]>;
31
- declare const modelSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"lucy-2.1">, z.ZodLiteral<"lucy-2.5">, z.ZodLiteral<"lucy-vton-2">, z.ZodLiteral<"lucy-vton-3">, z.ZodLiteral<"lucy-vton-3.5">, z.ZodLiteral<"lucy-restyle-2">, z.ZodLiteral<"lucy-latest">, z.ZodLiteral<"lucy-vton-latest">, z.ZodLiteral<"lucy-restyle-latest">, z.ZodLiteral<"lucy-2.1-vton-2">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-clip">, z.ZodLiteral<"lucy-2.1">, z.ZodLiteral<"lucy-2.5">, z.ZodLiteral<"lucy-vton-2">, z.ZodLiteral<"lucy-vton-3">, z.ZodLiteral<"lucy-vton-3.5">, z.ZodLiteral<"lucy-restyle-2">, z.ZodLiteral<"lucy-latest">, z.ZodLiteral<"lucy-vton-latest">, z.ZodLiteral<"lucy-restyle-latest">, z.ZodLiteral<"lucy-clip-latest">, z.ZodLiteral<"lucy-2.1-vton-2">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-restyle-v2v">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-image-2">, z.ZodLiteral<"lucy-image-latest">, z.ZodLiteral<"lucy-pro-i2i">]>]>;
28
+ declare const modelSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"lucy-2.1">, z.ZodLiteral<"lucy-2.5">, z.ZodLiteral<"lucy-vton-3.5">, z.ZodLiteral<"lucy-restyle-2">, z.ZodLiteral<"lucy-latest">, z.ZodLiteral<"lucy-vton-latest">, z.ZodLiteral<"lucy-restyle-latest">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-clip">, z.ZodLiteral<"lucy-2.1">, z.ZodLiteral<"lucy-2.5">, z.ZodLiteral<"lucy-vton-3.5">, z.ZodLiteral<"lucy-restyle-2">, z.ZodLiteral<"lucy-latest">, z.ZodLiteral<"lucy-vton-latest">, z.ZodLiteral<"lucy-restyle-latest">, z.ZodLiteral<"lucy-clip-latest">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-restyle-v2v">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-image-2">, z.ZodLiteral<"lucy-image-latest">, z.ZodLiteral<"lucy-pro-i2i">]>]>;
32
29
  type Model = z.infer<typeof modelSchema>;
33
30
  type RealTimeModels = z.infer<typeof realtimeModels>;
34
31
  type VideoModels = z.infer<typeof videoModels>;
@@ -134,38 +131,6 @@ declare const modelInputSchemas: {
134
131
  resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
135
132
  enhance_prompt: z.ZodOptional<z.ZodBoolean>;
136
133
  }, z.core.$strip>;
137
- readonly "lucy-vton-2": z.ZodObject<{
138
- prompt: z.ZodString;
139
- reference_image: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<File, unknown, z.core.$ZodTypeInternals<File, unknown>>, z.ZodType<Blob, unknown, z.core.$ZodTypeInternals<Blob, unknown>>, z.ZodType<ReadableStream<any>, unknown, z.core.$ZodTypeInternals<ReadableStream<any>, unknown>>, z.ZodType<URL, unknown, z.core.$ZodTypeInternals<URL, unknown>>, z.ZodURL, z.ZodObject<{
140
- uri: z.ZodString;
141
- type: z.ZodString;
142
- name: z.ZodString;
143
- }, z.core.$strip>]>>;
144
- data: z.ZodUnion<readonly [z.ZodType<File, unknown, z.core.$ZodTypeInternals<File, unknown>>, z.ZodType<Blob, unknown, z.core.$ZodTypeInternals<Blob, unknown>>, z.ZodType<ReadableStream<any>, unknown, z.core.$ZodTypeInternals<ReadableStream<any>, unknown>>, z.ZodType<URL, unknown, z.core.$ZodTypeInternals<URL, unknown>>, z.ZodURL, z.ZodObject<{
145
- uri: z.ZodString;
146
- type: z.ZodString;
147
- name: z.ZodString;
148
- }, z.core.$strip>]>;
149
- seed: z.ZodOptional<z.ZodNumber>;
150
- resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
151
- enhance_prompt: z.ZodOptional<z.ZodBoolean>;
152
- }, z.core.$strip>;
153
- readonly "lucy-vton-3": z.ZodObject<{
154
- prompt: z.ZodString;
155
- reference_image: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<File, unknown, z.core.$ZodTypeInternals<File, unknown>>, z.ZodType<Blob, unknown, z.core.$ZodTypeInternals<Blob, unknown>>, z.ZodType<ReadableStream<any>, unknown, z.core.$ZodTypeInternals<ReadableStream<any>, unknown>>, z.ZodType<URL, unknown, z.core.$ZodTypeInternals<URL, unknown>>, z.ZodURL, z.ZodObject<{
156
- uri: z.ZodString;
157
- type: z.ZodString;
158
- name: z.ZodString;
159
- }, z.core.$strip>]>>;
160
- data: z.ZodUnion<readonly [z.ZodType<File, unknown, z.core.$ZodTypeInternals<File, unknown>>, z.ZodType<Blob, unknown, z.core.$ZodTypeInternals<Blob, unknown>>, z.ZodType<ReadableStream<any>, unknown, z.core.$ZodTypeInternals<ReadableStream<any>, unknown>>, z.ZodType<URL, unknown, z.core.$ZodTypeInternals<URL, unknown>>, z.ZodURL, z.ZodObject<{
161
- uri: z.ZodString;
162
- type: z.ZodString;
163
- name: z.ZodString;
164
- }, z.core.$strip>]>;
165
- seed: z.ZodOptional<z.ZodNumber>;
166
- resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
167
- enhance_prompt: z.ZodOptional<z.ZodBoolean>;
168
- }, z.core.$strip>;
169
134
  readonly "lucy-vton-3.5": z.ZodObject<{
170
135
  prompt: z.ZodString;
171
136
  reference_image: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<File, unknown, z.core.$ZodTypeInternals<File, unknown>>, z.ZodType<Blob, unknown, z.core.$ZodTypeInternals<Blob, unknown>>, z.ZodType<ReadableStream<any>, unknown, z.core.$ZodTypeInternals<ReadableStream<any>, unknown>>, z.ZodType<URL, unknown, z.core.$ZodTypeInternals<URL, unknown>>, z.ZodURL, z.ZodObject<{
@@ -265,22 +230,6 @@ declare const modelInputSchemas: {
265
230
  }>>>;
266
231
  enhance_prompt: z.ZodOptional<z.ZodBoolean>;
267
232
  }, z.core.$strip>;
268
- readonly "lucy-2.1-vton-2": z.ZodObject<{
269
- prompt: z.ZodString;
270
- reference_image: z.ZodOptional<z.ZodUnion<readonly [z.ZodType<File, unknown, z.core.$ZodTypeInternals<File, unknown>>, z.ZodType<Blob, unknown, z.core.$ZodTypeInternals<Blob, unknown>>, z.ZodType<ReadableStream<any>, unknown, z.core.$ZodTypeInternals<ReadableStream<any>, unknown>>, z.ZodType<URL, unknown, z.core.$ZodTypeInternals<URL, unknown>>, z.ZodURL, z.ZodObject<{
271
- uri: z.ZodString;
272
- type: z.ZodString;
273
- name: z.ZodString;
274
- }, z.core.$strip>]>>;
275
- data: z.ZodUnion<readonly [z.ZodType<File, unknown, z.core.$ZodTypeInternals<File, unknown>>, z.ZodType<Blob, unknown, z.core.$ZodTypeInternals<Blob, unknown>>, z.ZodType<ReadableStream<any>, unknown, z.core.$ZodTypeInternals<ReadableStream<any>, unknown>>, z.ZodType<URL, unknown, z.core.$ZodTypeInternals<URL, unknown>>, z.ZodURL, z.ZodObject<{
276
- uri: z.ZodString;
277
- type: z.ZodString;
278
- name: z.ZodString;
279
- }, z.core.$strip>]>;
280
- seed: z.ZodOptional<z.ZodNumber>;
281
- resolution: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"720p">>>;
282
- enhance_prompt: z.ZodOptional<z.ZodBoolean>;
283
- }, z.core.$strip>;
284
233
  readonly "lucy-pro-v2v": z.ZodObject<{
285
234
  prompt: z.ZodString;
286
235
  data: z.ZodUnion<readonly [z.ZodType<File, unknown, z.core.$ZodTypeInternals<File, unknown>>, z.ZodType<Blob, unknown, z.core.$ZodTypeInternals<Blob, unknown>>, z.ZodType<ReadableStream<any>, unknown, z.core.$ZodTypeInternals<ReadableStream<any>, unknown>>, z.ZodType<URL, unknown, z.core.$ZodTypeInternals<URL, unknown>>, z.ZodURL, z.ZodObject<{
@@ -396,8 +345,6 @@ declare const models: {
396
345
  * Available options:
397
346
  * - `"lucy-2.1"` - Lucy 2.1 realtime video editing
398
347
  * - `"lucy-2.5"` - Lucy 2.5 realtime video editing
399
- * - `"lucy-vton-2"` - Lucy virtual try-on 2
400
- * - `"lucy-vton-3"` - Lucy virtual try-on 3
401
348
  * - `"lucy-vton-3.5"` - Lucy virtual try-on 3.5 (latest)
402
349
  * - `"lucy-restyle-2"` - Realtime video restyling
403
350
  */
@@ -409,8 +356,6 @@ declare const models: {
409
356
  * - `"lucy-clip"` - Video-to-video editing
410
357
  * - `"lucy-2.1"` - Long-form video editing (Lucy 2.1)
411
358
  * - `"lucy-2.5"` - Long-form video editing (Lucy 2.5)
412
- * - `"lucy-vton-2"` - Virtual try-on 2 video editing
413
- * - `"lucy-vton-3"` - Virtual try-on 3 video editing
414
359
  * - `"lucy-vton-3.5"` - Virtual try-on 3.5 video editing (latest)
415
360
  * - `"lucy-restyle-2"` - Video restyling
416
361
  */
@@ -5,8 +5,6 @@ import { z } from "zod";
5
5
  const CANONICAL_MODEL_NAMES = [
6
6
  "lucy-2.1",
7
7
  "lucy-2.5",
8
- "lucy-vton-2",
9
- "lucy-vton-3",
10
8
  "lucy-vton-3.5",
11
9
  "lucy-restyle-2",
12
10
  "lucy-clip",
@@ -15,8 +13,6 @@ const CANONICAL_MODEL_NAMES = [
15
13
  const CANONICAL_REALTIME_MODEL_NAMES = [
16
14
  "lucy-2.1",
17
15
  "lucy-2.5",
18
- "lucy-vton-2",
19
- "lucy-vton-3",
20
16
  "lucy-vton-3.5",
21
17
  "lucy-restyle-2"
22
18
  ];
@@ -24,8 +20,6 @@ const CANONICAL_VIDEO_MODEL_NAMES = [
24
20
  "lucy-clip",
25
21
  "lucy-2.1",
26
22
  "lucy-2.5",
27
- "lucy-vton-2",
28
- "lucy-vton-3",
29
23
  "lucy-vton-3.5",
30
24
  "lucy-restyle-2"
31
25
  ];
@@ -39,7 +33,6 @@ const canonicalModelSchema = z.enum(CANONICAL_MODEL_NAMES);
39
33
  * Old names still work but will log a deprecation warning.
40
34
  */
41
35
  const modelAliases = {
42
- "lucy-2.1-vton-2": "lucy-vton-2",
43
36
  "lucy-pro-v2v": "lucy-clip",
44
37
  "lucy-restyle-v2v": "lucy-restyle-2",
45
38
  "lucy-pro-i2i": "lucy-image-2"
@@ -55,28 +48,22 @@ function warnDeprecated(model) {
55
48
  const realtimeModels = z.union([
56
49
  z.literal("lucy-2.1"),
57
50
  z.literal("lucy-2.5"),
58
- z.literal("lucy-vton-2"),
59
- z.literal("lucy-vton-3"),
60
51
  z.literal("lucy-vton-3.5"),
61
52
  z.literal("lucy-restyle-2"),
62
53
  z.literal("lucy-latest"),
63
54
  z.literal("lucy-vton-latest"),
64
- z.literal("lucy-restyle-latest"),
65
- z.literal("lucy-2.1-vton-2")
55
+ z.literal("lucy-restyle-latest")
66
56
  ]);
67
57
  const videoModels = z.union([
68
58
  z.literal("lucy-clip"),
69
59
  z.literal("lucy-2.1"),
70
60
  z.literal("lucy-2.5"),
71
- z.literal("lucy-vton-2"),
72
- z.literal("lucy-vton-3"),
73
61
  z.literal("lucy-vton-3.5"),
74
62
  z.literal("lucy-restyle-2"),
75
63
  z.literal("lucy-latest"),
76
64
  z.literal("lucy-vton-latest"),
77
65
  z.literal("lucy-restyle-latest"),
78
66
  z.literal("lucy-clip-latest"),
79
- z.literal("lucy-2.1-vton-2"),
80
67
  z.literal("lucy-pro-v2v"),
81
68
  z.literal("lucy-restyle-v2v")
82
69
  ]);
@@ -188,15 +175,12 @@ const modelInputSchemas = {
188
175
  "lucy-restyle-2": restyleSchema,
189
176
  "lucy-2.1": videoEdit2Schema,
190
177
  "lucy-2.5": videoEdit2Schema,
191
- "lucy-vton-2": videoEdit2Schema,
192
- "lucy-vton-3": videoEdit2Schema,
193
178
  "lucy-vton-3.5": videoEdit2Schema,
194
179
  "lucy-latest": videoEdit2Schema,
195
180
  "lucy-vton-latest": videoEdit2Schema,
196
181
  "lucy-restyle-latest": restyleSchema,
197
182
  "lucy-clip-latest": videoEditSchema,
198
183
  "lucy-image-latest": imageEditSchema,
199
- "lucy-2.1-vton-2": videoEdit2Schema,
200
184
  "lucy-pro-v2v": videoEditSchema,
201
185
  "lucy-pro-i2i": imageEditSchema,
202
186
  "lucy-restyle-v2v": restyleSchema
@@ -243,28 +227,6 @@ const _models = {
243
227
  height: 720,
244
228
  inputSchema: z.object({})
245
229
  },
246
- "lucy-vton-2": {
247
- urlPath: "/v1/stream",
248
- name: "lucy-vton-2",
249
- fps: {
250
- ideal: 30,
251
- max: 30
252
- },
253
- width: 1088,
254
- height: 624,
255
- inputSchema: z.object({})
256
- },
257
- "lucy-vton-3": {
258
- urlPath: "/v1/stream",
259
- name: "lucy-vton-3",
260
- fps: {
261
- ideal: 30,
262
- max: 30
263
- },
264
- width: 1088,
265
- height: 624,
266
- inputSchema: z.object({})
267
- },
268
230
  "lucy-vton-3.5": {
269
231
  urlPath: "/v1/stream",
270
232
  name: "lucy-vton-3.5",
@@ -319,17 +281,6 @@ const _models = {
319
281
  width: 1280,
320
282
  height: 704,
321
283
  inputSchema: z.object({})
322
- },
323
- "lucy-2.1-vton-2": {
324
- urlPath: "/v1/stream",
325
- name: "lucy-2.1-vton-2",
326
- fps: {
327
- ideal: 30,
328
- max: 30
329
- },
330
- width: 1088,
331
- height: 624,
332
- inputSchema: z.object({})
333
284
  }
334
285
  },
335
286
  image: {
@@ -389,24 +340,6 @@ const _models = {
389
340
  height: 720,
390
341
  inputSchema: modelInputSchemas["lucy-2.5"]
391
342
  },
392
- "lucy-vton-2": {
393
- urlPath: "/v1/generate/lucy-vton-2",
394
- queueUrlPath: "/v1/jobs/lucy-vton-2",
395
- name: "lucy-vton-2",
396
- fps: 20,
397
- width: 1088,
398
- height: 624,
399
- inputSchema: modelInputSchemas["lucy-vton-2"]
400
- },
401
- "lucy-vton-3": {
402
- urlPath: "/v1/generate/lucy-vton-3",
403
- queueUrlPath: "/v1/jobs/lucy-vton-3",
404
- name: "lucy-vton-3",
405
- fps: 20,
406
- width: 1088,
407
- height: 624,
408
- inputSchema: modelInputSchemas["lucy-vton-3"]
409
- },
410
343
  "lucy-vton-3.5": {
411
344
  urlPath: "/v1/generate/lucy-vton-3.5",
412
345
  queueUrlPath: "/v1/jobs/lucy-vton-3.5",
@@ -461,15 +394,6 @@ const _models = {
461
394
  height: 704,
462
395
  inputSchema: modelInputSchemas["lucy-clip-latest"]
463
396
  },
464
- "lucy-2.1-vton-2": {
465
- urlPath: "/v1/generate/lucy-2.1-vton-2",
466
- queueUrlPath: "/v1/jobs/lucy-2.1-vton-2",
467
- name: "lucy-2.1-vton-2",
468
- fps: 20,
469
- width: 1088,
470
- height: 624,
471
- inputSchema: modelInputSchemas["lucy-2.1-vton-2"]
472
- },
473
397
  "lucy-pro-v2v": {
474
398
  urlPath: "/v1/generate/lucy-pro-v2v",
475
399
  queueUrlPath: "/v1/jobs/lucy-pro-v2v",
@@ -520,8 +444,6 @@ const models = {
520
444
  * Available options:
521
445
  * - `"lucy-2.1"` - Lucy 2.1 realtime video editing
522
446
  * - `"lucy-2.5"` - Lucy 2.5 realtime video editing
523
- * - `"lucy-vton-2"` - Lucy virtual try-on 2
524
- * - `"lucy-vton-3"` - Lucy virtual try-on 3
525
447
  * - `"lucy-vton-3.5"` - Lucy virtual try-on 3.5 (latest)
526
448
  * - `"lucy-restyle-2"` - Realtime video restyling
527
449
  */
@@ -538,8 +460,6 @@ const models = {
538
460
  * - `"lucy-clip"` - Video-to-video editing
539
461
  * - `"lucy-2.1"` - Long-form video editing (Lucy 2.1)
540
462
  * - `"lucy-2.5"` - Long-form video editing (Lucy 2.5)
541
- * - `"lucy-vton-2"` - Virtual try-on 2 video editing
542
- * - `"lucy-vton-3"` - Virtual try-on 3 video editing
543
463
  * - `"lucy-vton-3.5"` - Virtual try-on 3.5 video editing (latest)
544
464
  * - `"lucy-restyle-2"` - Video restyling
545
465
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decartai/sdk",
3
- "version": "0.1.23",
3
+ "version": "0.2.1",
4
4
  "description": "Decart's JavaScript SDK",
5
5
  "type": "module",
6
6
  "license": "MIT",