@decartai/sdk 0.1.7 → 0.1.8

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.
@@ -15,6 +15,7 @@ declare const realTimeClientInitialStateSchema: z.ZodObject<{
15
15
  enhance: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
16
16
  }, z.core.$strip>>;
17
17
  image: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<Blob, Blob>, z.ZodCustom<File, File>, z.ZodString]>>;
18
+ passthrough: z.ZodOptional<z.ZodBoolean>;
18
19
  }, z.core.$strip>;
19
20
  type OnRemoteStreamFn = (stream: MediaStream) => void;
20
21
  type OnConnectionChangeFn = (state: ConnectionState) => void;
@@ -46,6 +47,7 @@ declare const realTimeClientConnectOptionsSchema: z.ZodObject<{
46
47
  enhance: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
47
48
  }, z.core.$strip>>;
48
49
  image: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<Blob, Blob>, z.ZodCustom<File, File>, z.ZodString]>>;
50
+ passthrough: z.ZodOptional<z.ZodBoolean>;
49
51
  }, z.core.$strip>>;
50
52
  queryParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
51
53
  mirror: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodBoolean]>>;
@@ -89,6 +89,7 @@ const createRealTimeClient = (opts) => {
89
89
  initialImage,
90
90
  initialImageRef,
91
91
  initialPrompt,
92
+ initialPassthrough: initialState?.passthrough,
92
93
  logger,
93
94
  videoCodec: publishCodec
94
95
  });
@@ -63,14 +63,19 @@ var SignalingChannel = class {
63
63
  this.config.observability?.startPhase("room-join");
64
64
  const roomInfoWait = this.waitForRoomInfo(handshakeTimeout);
65
65
  const initialStateRequest = buildInitialStateRequest(opts.initialState);
66
+ const userSetInitialState = opts.initialState != null && (opts.initialState.image != null || opts.initialState.imageRef != null || opts.initialState.prompt != null);
66
67
  const joinMessage = {
67
68
  type: "livekit_join",
68
- initial_state: initialStateRequest ? initialStateRequest.message : null
69
+ passthrough: opts.passthrough ?? !userSetInitialState
69
70
  };
70
71
  if (!this.writeMessage(joinMessage)) {
71
72
  roomInfoWait.cancel();
72
73
  throw new Error("WebSocket is not open");
73
74
  }
75
+ if (initialStateRequest && !this.writeMessage(initialStateRequest.message)) {
76
+ roomInfoWait.cancel();
77
+ throw new Error("WebSocket is not open");
78
+ }
74
79
  let roomInfo;
75
80
  try {
76
81
  roomInfo = await roomInfoWait.promise;
@@ -103,7 +103,8 @@ var StreamSession = class {
103
103
  this.config.observability?.markGlassToGlassStart();
104
104
  const { roomInfo, initialStateAck } = await this.signaling.openAndJoin({
105
105
  connectTimeout: REALTIME_CONFIG.session.connectionTimeoutMs,
106
- initialState
106
+ initialState,
107
+ passthrough: this.config.initialPassthrough
107
108
  });
108
109
  this.watchInitialStateAck(initialStateAck, attempt);
109
110
  if (this.disposed || this.currentAttempt !== attempt) {
@@ -7,6 +7,7 @@ declare const modelStateSchema: z.ZodObject<{
7
7
  enhance: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
8
8
  }, z.core.$strip>>;
9
9
  image: z.ZodOptional<z.ZodUnion<readonly [z.ZodCustom<Blob, Blob>, z.ZodCustom<File, File>, z.ZodString]>>;
10
+ passthrough: z.ZodOptional<z.ZodBoolean>;
10
11
  }, z.core.$strip>;
11
12
  type ModelState = z.infer<typeof modelStateSchema>;
12
13
  //#endregion
@@ -9,7 +9,8 @@ const modelStateSchema = z.object({
9
9
  z.instanceof(Blob),
10
10
  z.instanceof(File),
11
11
  z.string()
12
- ]).optional()
12
+ ]).optional(),
13
+ passthrough: z.boolean().optional()
13
14
  });
14
15
  //#endregion
15
16
  export { modelStateSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decartai/sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Decart's JavaScript SDK",
5
5
  "type": "module",
6
6
  "license": "MIT",