@decartai/sdk 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 DecartAI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,423 @@
1
+ # Decart SDK
2
+
3
+ A JavaScript SDK for Decart's models.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @decartai/sdk
9
+ # or
10
+ pnpm add @decartai/sdk
11
+ # or
12
+ yarn add @decartai/sdk
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ### Real-time Video Transformation
18
+
19
+ ```typescript
20
+ import { createDecartClient, models } from "@decartai/sdk";
21
+
22
+ const model = models.realtime("mirage");
23
+
24
+ // Get user's camera stream
25
+ const stream = await navigator.mediaDevices.getUserMedia({
26
+ audio: true,
27
+ video: {
28
+ frameRate: model.fps,
29
+ width: model.width,
30
+ height: model.height,
31
+ }
32
+ });
33
+
34
+ // Create a client
35
+ const client = createDecartClient({
36
+ apiKey: "your-api-key-here"
37
+ });
38
+
39
+ // Connect and transform the video stream
40
+ const realtimeClient = await client.realtime.connect(stream, {
41
+ model,
42
+ onRemoteStream: (transformedStream) => {
43
+ // Display the transformed video in your app
44
+ videoElement.srcObject = transformedStream;
45
+ },
46
+ initialState: {
47
+ prompt: {
48
+ text: "Anime",
49
+ enrich: true // We will enhance your prompt for better results
50
+ }
51
+ }
52
+ });
53
+
54
+ // Change the style on the fly
55
+ realtimeClient.setPrompt("Cyberpunk city");
56
+
57
+ // Disconnect when done
58
+ realtimeClient.disconnect();
59
+ ```
60
+
61
+ ### Process Video Files
62
+
63
+ ```typescript
64
+ import { createDecartClient } from "@decartai/sdk";
65
+
66
+ // Create a client
67
+ const client = createDecartClient({
68
+ apiKey: "your-api-key-here"
69
+ });
70
+
71
+ // Process a local video file
72
+ const fileInput = document.querySelector('input[type="file"]');
73
+ const file = fileInput.files[0];
74
+
75
+ const result = await client.process.video(file, {
76
+ model: models.realtime("mirage"),
77
+ prompt: {
78
+ text: "Lego World",
79
+ enrich: true
80
+ },
81
+ mirror: false
82
+ });
83
+
84
+ // Display the processed video
85
+ const video = document.querySelector('video');
86
+ video.src = URL.createObjectURL(result);
87
+
88
+ // Process a video from URL
89
+ const urlResult = await client.process.video(
90
+ "https://example.com/video.mp4",
91
+ {
92
+ model: models.realtime("mirage"),
93
+ prompt: {
94
+ text: "Anime style"
95
+ }
96
+ }
97
+ );
98
+ ```
99
+
100
+ ## Features
101
+
102
+ - **Real-time video transformation** - Transform video streams with minimal latency using WebRTC
103
+ - **Video file processing** - Transform video files and URLs on-demand
104
+ - **Dynamic prompt switching** - Change styles on the fly without reconnecting
105
+ - **Automatic prompt enhancement** - Decart enriches simple prompts for better results
106
+ - **Mirror mode** - Built-in support for front-facing camera scenarios
107
+ - **Connection state management** - Monitor and react to connection changes
108
+ - **TypeScript support** - Full type definitions included
109
+
110
+ ## Usage Guide
111
+
112
+ ### Real-time API
113
+
114
+ #### 1. Creating a Client
115
+
116
+ ```typescript
117
+ const client = createDecartClient({
118
+ apiKey: "your-api-key-here",
119
+ baseUrl: "https://custom-endpoint.com" // optional, uses default Decart endpoint
120
+ });
121
+ ```
122
+
123
+ #### 2. Connecting to the Real-time API
124
+
125
+ ```typescript
126
+ const realtimeClient = await client.realtime.connect(stream, {
127
+ model: models.realtime("mirage"),
128
+ onRemoteStream: (stream: MediaStream) => {
129
+ // Handle the transformed video stream
130
+ videoElement.srcObject = stream;
131
+ },
132
+ initialState: {
133
+ prompt: {
134
+ text: "Lego World",
135
+ enrich: true // Let Decart enhance the prompt (recommended)
136
+ },
137
+ mirror: false // Set to true for front-facing cameras
138
+ }
139
+ });
140
+ ```
141
+
142
+ #### 3. Managing Prompts
143
+
144
+ ```typescript
145
+ // Simple prompt with automatic enhancement
146
+ realtimeClient.setPrompt("Anime style");
147
+
148
+ // Use your own detailed prompt without enhancement
149
+ realtimeClient.setPrompt(
150
+ "A detailed artistic style with specific colors and mood...",
151
+ { enrich: false }
152
+ );
153
+
154
+ // Get an enhanced prompt without applying it (for preview/debugging)
155
+ const enhanced = await realtimeClient.enrichPrompt("Pixel art");
156
+ console.log(enhanced);
157
+ realtimeClient.setPrompt(enhanced, { enrich: false });
158
+ ```
159
+
160
+ #### 4. Camera Mirroring
161
+
162
+ ```typescript
163
+ // Toggle mirror mode (useful for front-facing cameras)
164
+ realtimeClient.setMirror(true);
165
+ ```
166
+
167
+ #### 5. Connection State Management
168
+
169
+ ```typescript
170
+ // Check connection state synchronously
171
+ const isConnected = realtimeClient.isConnected();
172
+ const state = realtimeClient.getConnectionState(); // "connected" | "connecting" | "disconnected"
173
+
174
+ // Listen to connection changes
175
+ realtimeClient.on("connectionChange", (state) => {
176
+ console.log(`Connection state: ${state}`);
177
+ if (state === "disconnected") {
178
+ // Handle disconnection
179
+ }
180
+ });
181
+ ```
182
+
183
+ #### 6. Error Handling
184
+
185
+ ```typescript
186
+ import type { DecartSDKError } from "@decartai/sdk";
187
+
188
+ realtimeClient.on("error", (error: DecartSDKError) => {
189
+ console.error("SDK error:", error.code, error.message);
190
+
191
+ // Handle specific errors
192
+ switch(error.code) {
193
+ case "INVALID_API_KEY":
194
+ // Handle invalid API key
195
+ break;
196
+ case "WEB_RTC_ERROR":
197
+ // Handle WebRTC connection issues
198
+ break;
199
+ }
200
+ });
201
+ ```
202
+
203
+ #### 7. Cleanup
204
+
205
+ ```typescript
206
+ // Always disconnect when done
207
+ realtimeClient.disconnect();
208
+
209
+ // Remove event listeners
210
+ realtimeClient.off("connectionChange", onConnectionChange);
211
+ realtimeClient.off("error", onError);
212
+ ```
213
+
214
+ ### Complete Example
215
+
216
+ ```typescript
217
+ import { createDecartClient, type DecartSDKError } from "@decartai/sdk";
218
+
219
+ async function setupSDK() {
220
+ try {
221
+ // Get camera stream
222
+ const stream = await navigator.mediaDevices.getUserMedia({
223
+ audio: true,
224
+ video: { frameRate: 14 }
225
+ });
226
+
227
+ // Create client
228
+ const client = createDecartClient({
229
+ apiKey: process.env.MIRAGE_API_KEY
230
+ });
231
+
232
+ // Connect with initial prompt
233
+ const realtimeClient = await client.realtime.connect(stream, {
234
+ onRemoteStream: (stream) => {
235
+ const video = document.getElementById("output-video");
236
+ video.srcObject = stream;
237
+ },
238
+ initialState: {
239
+ prompt: {
240
+ text: "Studio Ghibli animation style",
241
+ enrich: true
242
+ },
243
+ mirror: true // Using front camera
244
+ }
245
+ });
246
+
247
+ // Set up event handlers
248
+ realtimeClient.on("connectionChange", (state) => {
249
+ updateUIConnectionStatus(state);
250
+ });
251
+
252
+ realtimeClient.on("error", (error) => {
253
+ console.error("SDK error:", error);
254
+ showErrorToUser(error.message);
255
+ });
256
+
257
+ // Allow user to change styles
258
+ document.getElementById("style-input").addEventListener("change", async (e) => {
259
+ realtimeClient.setPrompt(e.target.value);
260
+ });
261
+
262
+ // Cleanup on page unload
263
+ window.addEventListener("beforeunload", async () => {
264
+ realtimeClient.disconnect();
265
+ });
266
+
267
+ return realtimeClient;
268
+ } catch (error) {
269
+ console.error("Failed to setup DecartSDK:", error);
270
+ }
271
+ }
272
+
273
+ setupSDK();
274
+ ```
275
+
276
+ ## Process API
277
+
278
+ #### 1. Creating a Client
279
+
280
+ ```typescript
281
+ const client = createDecartClient({
282
+ apiKey: "your-api-key-here",
283
+ baseUrl: "https://custom-endpoint.com" // optional, uses default Decart endpoint
284
+ });
285
+ ```
286
+
287
+ #### 2. Process Video Files
288
+
289
+ ```typescript
290
+ // 1. Process a local file (browser)
291
+ const fileInput = document.querySelector('input[type="file"]');
292
+ const file = fileInput.files[0];
293
+
294
+ const result = await client.process.video(file, {
295
+ prompt: {
296
+ text: "Cartoon style",
297
+ enrich: true
298
+ },
299
+ mirror: false
300
+ });
301
+
302
+ // Use the processed video
303
+ const video = document.querySelector('video');
304
+ video.src = URL.createObjectURL(result);
305
+
306
+ // 3. With cancellation
307
+ const controller = new AbortController();
308
+ const result = await client.process.video(file, {
309
+ prompt: { text: "Watercolor painting" },
310
+ signal: controller.signal
311
+ });
312
+
313
+ // Cancel if needed
314
+ controller.abort();
315
+ ```
316
+
317
+ ## API Reference
318
+
319
+ ### `createDecartClient(options)`
320
+ Creates a new Decart client instance.
321
+
322
+ - `options.apiKey` (required) - Your Decart API key
323
+ - `options.baseUrl` (optional) - Custom API endpoint (defaults to Decart)
324
+
325
+ ### Real-time API
326
+
327
+ #### `client.realtime.connect(stream, options)`
328
+ Connects to the real-time transformation service.
329
+
330
+ - `stream` - MediaStream from getUserMedia
331
+ - `options.onRemoteStream` - Callback for transformed video stream
332
+ - `options.initialState.prompt` - Initial transformation prompt
333
+ - `options.initialState.mirror` - Enable mirror mode
334
+
335
+ #### `realtimeClient.setPrompt(prompt, options?)`
336
+ Changes the transformation style.
337
+
338
+ - `prompt` - Text description of desired style
339
+ - `options.enrich` - Whether to enhance the prompt (default: true)
340
+
341
+ #### `realtimeClient.enrichPrompt(prompt)`
342
+ Gets an enhanced version of your prompt without applying it.
343
+
344
+ #### `realtimeClient.setMirror(enabled)`
345
+ Toggles video mirroring.
346
+
347
+ #### `realtimeClient.sessionId`
348
+ The id of the current real-time inference session.
349
+
350
+ #### `realtimeClient.disconnect()`
351
+ Closes the connection and cleans up resources.
352
+
353
+ #### Event: `'connectionChange'`
354
+ Fired when connection state changes.
355
+
356
+ #### Event: `'error'`
357
+ Fired when an error occurs.
358
+
359
+ ### Process API
360
+
361
+ #### `client.process.video(input, options?)`
362
+ Process a video file or URL.
363
+
364
+ **Parameters:**
365
+ - `input: FileInput` - Video input, can be:
366
+ - `File` - File object from input element (browser)
367
+ - `Blob` - Binary data (browser)
368
+ - `ReadableStream` - Streaming input
369
+ - `URL` or `string` - HTTP/HTTPS URL to video
370
+
371
+ - `options?: ProcessOptions` - Optional configuration:
372
+ - `prompt?: { text: string; enrich?: boolean }` - Style transformation
373
+ - `text` - Style description (required if prompt is provided)
374
+ - `enrich` - Enable prompt enhancement (default: `true`)
375
+ - `mirror?: boolean` - Mirror the video horizontally (default: `false`)
376
+ - `signal?: AbortSignal` - AbortSignal for cancellation
377
+
378
+ **Returns:** `Promise<Blob>` - The transformed video
379
+
380
+ **Type Definitions:**
381
+ ```typescript
382
+ type FileInput = File | Blob | ReadableStream | URL | string;
383
+
384
+ type ProcessOptions = {
385
+ prompt?: {
386
+ text: string;
387
+ enrich?: boolean;
388
+ };
389
+ mirror?: boolean;
390
+ signal?: AbortSignal;
391
+ };
392
+ ```
393
+
394
+ ## Development
395
+
396
+ ### Install dependencies
397
+ ```bash
398
+ pnpm install
399
+ ```
400
+
401
+ ### Run tests
402
+ ```bash
403
+ pnpm test
404
+ ```
405
+
406
+ ### Build the library
407
+ ```bash
408
+ pnpm build
409
+ ```
410
+
411
+ ### Run development mode
412
+ ```bash
413
+ pnpm dev
414
+ ```
415
+
416
+ ### Run examples
417
+ ```bash
418
+ pnpm dev:example
419
+ ```
420
+
421
+ ## License
422
+
423
+ MIT
@@ -0,0 +1,22 @@
1
+ import { Model, ModelDefinition, models } from "./shared/model.js";
2
+ import { FileInput, ProcessOptions } from "./process/types.js";
3
+ import { ProcessClient } from "./process/client.js";
4
+ import { DecartSDKError, ERROR_CODES } from "./utils/errors.js";
5
+ import { RealTimeClient, RealTimeClientConnectOptions, RealTimeClientInitialState } from "./realtime/client.js";
6
+ import { ModelState } from "./shared/types.js";
7
+ import { z } from "zod";
8
+
9
+ //#region src/index.d.ts
10
+ declare const decartClientOptionsSchema: z.ZodObject<{
11
+ apiKey: z.ZodString;
12
+ baseUrl: z.ZodOptional<z.ZodURL>;
13
+ }, z.core.$strip>;
14
+ type DecartClientOptions = z.infer<typeof decartClientOptionsSchema>;
15
+ declare const createDecartClient: (options: DecartClientOptions) => {
16
+ realtime: {
17
+ connect: (stream: MediaStream, options: RealTimeClientConnectOptions) => Promise<RealTimeClient>;
18
+ };
19
+ process: ProcessClient;
20
+ };
21
+ //#endregion
22
+ export { DecartClientOptions, type DecartSDKError, ERROR_CODES, type FileInput, type Model, type ModelDefinition, type ModelState, type ProcessClient, type ProcessOptions, type RealTimeClient, type RealTimeClientConnectOptions, type RealTimeClientInitialState, createDecartClient, models };
package/dist/index.js ADDED
@@ -0,0 +1,36 @@
1
+ import { ERROR_CODES, createInvalidApiKeyError, createInvalidBaseUrlError } from "./utils/errors.js";
2
+ import { createProcessClient } from "./process/client.js";
3
+ import { models } from "./shared/model.js";
4
+ import { createRealTimeClient } from "./realtime/client.js";
5
+ import { z } from "zod";
6
+
7
+ //#region src/index.ts
8
+ const decartClientOptionsSchema = z.object({
9
+ apiKey: z.string().min(1),
10
+ baseUrl: z.url().optional()
11
+ });
12
+ const createDecartClient = (options) => {
13
+ const parsedOptions = decartClientOptionsSchema.safeParse(options);
14
+ if (!parsedOptions.success) {
15
+ const issue = parsedOptions.error.issues[0];
16
+ if (issue.path.includes("apiKey")) throw createInvalidApiKeyError();
17
+ if (issue.path.includes("baseUrl")) throw createInvalidBaseUrlError(options.baseUrl);
18
+ throw parsedOptions.error;
19
+ }
20
+ const { baseUrl = "https://api.decart.ai", apiKey } = parsedOptions.data;
21
+ const realtime = createRealTimeClient({
22
+ baseUrl: "wss://api3.decart.ai",
23
+ apiKey
24
+ });
25
+ const process = createProcessClient({
26
+ baseUrl,
27
+ apiKey
28
+ });
29
+ return {
30
+ realtime,
31
+ process
32
+ };
33
+ };
34
+
35
+ //#endregion
36
+ export { ERROR_CODES, createDecartClient, models };
@@ -0,0 +1,7 @@
1
+ import { ModelDefinition } from "../shared/model.js";
2
+ import { ProcessOptions } from "./types.js";
3
+
4
+ //#region src/process/client.d.ts
5
+ type ProcessClient = <T extends ModelDefinition>(options: ProcessOptions<T>) => Promise<Blob>;
6
+ //#endregion
7
+ export { ProcessClient };
@@ -0,0 +1,26 @@
1
+ import { createInvalidInputError } from "../utils/errors.js";
2
+ import { fileInputToBlob, sendRequest } from "./request.js";
3
+
4
+ //#region src/process/client.ts
5
+ const createProcessClient = (opts) => {
6
+ const { apiKey, baseUrl } = opts;
7
+ const _process = async (options) => {
8
+ const { model, signal,...inputs } = options;
9
+ const parsedInputs = model.inputSchema.safeParse(inputs);
10
+ if (!parsedInputs.success) throw createInvalidInputError(`Invalid inputs for ${model.name}: ${parsedInputs.error.message}`);
11
+ const processedInputs = {};
12
+ for (const [key, value] of Object.entries(parsedInputs.data)) if (key === "data" || key === "start" || key === "end") processedInputs[key] = await fileInputToBlob(value);
13
+ else processedInputs[key] = value;
14
+ return await sendRequest({
15
+ baseUrl,
16
+ apiKey,
17
+ model,
18
+ inputs: processedInputs,
19
+ signal
20
+ });
21
+ };
22
+ return _process;
23
+ };
24
+
25
+ //#endregion
26
+ export { createProcessClient };
@@ -0,0 +1,35 @@
1
+ import { createInvalidInputError, createSDKError } from "../utils/errors.js";
2
+
3
+ //#region src/process/request.ts
4
+ async function fileInputToBlob(input) {
5
+ if (input instanceof Blob || input instanceof File) return input;
6
+ if (input instanceof ReadableStream) return new Response(input).blob();
7
+ if (typeof input === "string" || input instanceof URL) {
8
+ const url = typeof input === "string" ? input : input.toString();
9
+ if (!url.startsWith("http://") && !url.startsWith("https://")) throw createInvalidInputError("URL must start with http:// or https://");
10
+ const response = await fetch(url);
11
+ if (!response.ok) throw createInvalidInputError(`Failed to fetch file from URL: ${response.statusText}`);
12
+ return response.blob();
13
+ }
14
+ throw createInvalidInputError("Invalid file input type");
15
+ }
16
+ async function sendRequest({ baseUrl, apiKey, model, inputs, signal }) {
17
+ const formData = new FormData();
18
+ for (const [key, value] of Object.entries(inputs)) if (value !== void 0 && value !== null) if (value instanceof Blob) formData.append(key, value);
19
+ else formData.append(key, String(value));
20
+ const endpoint = `${baseUrl}${model.urlPath}`;
21
+ const response = await fetch(endpoint, {
22
+ method: "POST",
23
+ headers: { "X-API-KEY": apiKey },
24
+ body: formData,
25
+ signal
26
+ });
27
+ if (!response.ok) {
28
+ const errorText = await response.text().catch(() => "Unknown error");
29
+ throw createSDKError("PROCESSING_ERROR", `Processing failed: ${response.status} - ${errorText}`);
30
+ }
31
+ return response.blob();
32
+ }
33
+
34
+ //#endregion
35
+ export { fileInputToBlob, sendRequest };
@@ -0,0 +1,12 @@
1
+ import { ModelDefinition, ModelInputSchemas } from "../shared/model.js";
2
+ import { z } from "zod";
3
+
4
+ //#region src/process/types.d.ts
5
+ type InferModelInputs<T extends ModelDefinition> = T["name"] extends keyof ModelInputSchemas ? z.input<ModelInputSchemas[T["name"]]> : Record<string, never>;
6
+ type ProcessOptions<T extends ModelDefinition = ModelDefinition> = {
7
+ model: T;
8
+ signal?: AbortSignal;
9
+ } & InferModelInputs<T>;
10
+ type FileInput = File | Blob | ReadableStream | URL | string;
11
+ //#endregion
12
+ export { FileInput, ProcessOptions };
@@ -0,0 +1,55 @@
1
+ import { DecartSDKError } from "../utils/errors.js";
2
+ import { z } from "zod";
3
+
4
+ //#region src/realtime/client.d.ts
5
+
6
+ declare const realTimeClientInitialStateSchema: z.ZodObject<{
7
+ prompt: z.ZodOptional<z.ZodObject<{
8
+ text: z.ZodString;
9
+ enrich: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
10
+ }, z.core.$strip>>;
11
+ mirror: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
12
+ }, z.core.$strip>;
13
+ type OnRemoteStreamFn = (stream: MediaStream) => void;
14
+ type RealTimeClientInitialState = z.infer<typeof realTimeClientInitialStateSchema>;
15
+ declare const realTimeClientConnectOptionsSchema: z.ZodObject<{
16
+ model: z.ZodObject<{
17
+ name: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"mirage">, z.ZodLiteral<"lucy_v2v_720p_rt">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-dev-i2v">, z.ZodLiteral<"lucy-dev-v2v">, z.ZodLiteral<"lucy-pro-t2v">, z.ZodLiteral<"lucy-pro-i2v">, z.ZodLiteral<"lucy-pro-v2v">, z.ZodLiteral<"lucy-pro-flf2v">]>, z.ZodUnion<readonly [z.ZodLiteral<"lucy-pro-t2i">, z.ZodLiteral<"lucy-pro-i2i">]>]>;
18
+ urlPath: z.ZodString;
19
+ fps: z.ZodNumber;
20
+ width: z.ZodNumber;
21
+ height: z.ZodNumber;
22
+ inputSchema: z.ZodAny;
23
+ }, z.core.$strip>;
24
+ onRemoteStream: z.ZodCustom<OnRemoteStreamFn, OnRemoteStreamFn>;
25
+ initialState: z.ZodOptional<z.ZodObject<{
26
+ prompt: z.ZodOptional<z.ZodObject<{
27
+ text: z.ZodString;
28
+ enrich: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
29
+ }, z.core.$strip>>;
30
+ mirror: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
31
+ }, z.core.$strip>>;
32
+ customizeOffer: z.ZodOptional<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>, z.core.$InferInnerFunctionTypeAsync<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>>>;
33
+ }, z.core.$strip>;
34
+ type RealTimeClientConnectOptions = z.infer<typeof realTimeClientConnectOptionsSchema>;
35
+ type Events = {
36
+ connectionChange: "connected" | "connecting" | "disconnected";
37
+ error: DecartSDKError;
38
+ };
39
+ type RealTimeClient = {
40
+ enrichPrompt: (prompt: string) => Promise<string>;
41
+ setPrompt: (prompt: string, {
42
+ enrich
43
+ }?: {
44
+ enrich?: boolean;
45
+ }) => void;
46
+ setMirror: (enabled: boolean) => void;
47
+ isConnected: () => boolean;
48
+ getConnectionState: () => "connected" | "connecting" | "disconnected";
49
+ disconnect: () => void;
50
+ on: (event: keyof Events, listener: (...args: Events[keyof Events][]) => void) => void;
51
+ off: (event: keyof Events, listener: (...args: Events[keyof Events][]) => void) => void;
52
+ sessionId: string;
53
+ };
54
+ //#endregion
55
+ export { RealTimeClient, RealTimeClientConnectOptions, RealTimeClientInitialState };