@reactor-models/lingbot 0.2.18 → 0.2.21

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.
@@ -0,0 +1,326 @@
1
+ import { Reactor, FileRef } from '@reactor-team/js-sdk';
2
+ export { FileRef } from '@reactor-team/js-sdk';
3
+
4
+ declare const MODEL_NAME: "lingbot";
5
+ declare const MODEL_VERSION: "v0.2.21";
6
+ /**
7
+ * Preset media tracks for the Lingbot model.
8
+ *
9
+ * Declared in the model's OpenAPI schema and passed to the SDK as
10
+ * `modelTracks` so the transport can prepare the SDP offer in
11
+ * parallel with session polling (faster first-frame latency).
12
+ */
13
+ declare const LingbotTracks: readonly [{
14
+ readonly name: "main_video";
15
+ readonly kind: "video";
16
+ readonly direction: "recvonly";
17
+ }];
18
+ /** Track names the client can subscribe to (recvonly, from the client's perspective). */
19
+ type LingbotRecvTrackName = "main_video";
20
+ /** Set seed */
21
+ interface LingbotSetSeedParams {
22
+ /**
23
+ * Seed for the random generator used to sample the initial noise. Must be a non-negative integer; the model never draws its own random seed — pick one explicitly (or keep the default) for reproducible runs. Read once when `start` fires; later changes take effect only after `reset` followed by a new `start`.
24
+ * @minimum 0
25
+ * @default 42
26
+ */
27
+ seed?: number;
28
+ }
29
+ /** Provide a reference image that anchors generation (image-to-video). Call before `start`; the image is required for generation to begin. Changes during generation have no effect until `reset` is issued and `start` is called again. Emits `image_accepted`, `conditions_ready`, and `state` on success, or `command_error` if the file is missing, not an image, or cannot be decoded. */
30
+ interface LingbotSetImageParams {
31
+ /**
32
+ * Reference to a file uploaded via the Reactor presigned-URL protocol.
33
+ * @default null
34
+ */
35
+ image?: FileRef;
36
+ }
37
+ /** Set the scene prompt. Valid at any time — call before `start` to arm generation, or hot-swap during generation to steer the next chunk. Emits `prompt_accepted`, `conditions_ready`, and `state` on success. */
38
+ interface LingbotSetPromptParams {
39
+ /**
40
+ * Natural-language description of the scene to generate. Replaces the previously active prompt. Applied on the next chunk when generating; otherwise takes effect when `start` fires.
41
+ * @default ""
42
+ */
43
+ prompt?: string;
44
+ }
45
+ /** Set movement */
46
+ interface LingbotSetMovementParams {
47
+ /**
48
+ * Character movement in the generated scene. `idle` holds the character stationary; `forward` / `back` translate along the look axis; `strafe_left` / `strafe_right` translate sideways. Can be changed at any time; the new value applies to the next chunk.
49
+ * @default "idle"
50
+ */
51
+ movement?: "idle" | "forward" | "back" | "strafe_left" | "strafe_right";
52
+ }
53
+ /** Set look_vertical */
54
+ interface LingbotSetLookVerticalParams {
55
+ /**
56
+ * Vertical (pitch) camera rotation. `idle` holds pitch steady; `up` / `down` rotate the camera at the rate given by `rotation_speed_deg`. Can be changed at any time; the new value applies to the next chunk.
57
+ * @default "idle"
58
+ */
59
+ look_vertical?: "idle" | "up" | "down";
60
+ }
61
+ /** Set look_horizontal */
62
+ interface LingbotSetLookHorizontalParams {
63
+ /**
64
+ * Horizontal (yaw) camera rotation. `idle` holds yaw steady; `left` / `right` rotate the camera at the rate given by `rotation_speed_deg`. Can be changed at any time; the new value applies to the next chunk.
65
+ * @default "idle"
66
+ */
67
+ look_horizontal?: "idle" | "left" | "right";
68
+ }
69
+ /** Set rotation_speed_deg */
70
+ interface LingbotSetRotationSpeedDegParams {
71
+ /**
72
+ * Camera rotation speed in degrees per latent frame, applied when `look_horizontal` or `look_vertical` is not `idle`. Range 0.0 – 30.0. Ignored when both look axes are `idle`. Can be changed at any time; the new value applies to the next chunk.
73
+ * @minimum 0
74
+ * @maximum 30
75
+ * @default 5
76
+ */
77
+ rotation_speed_deg?: number;
78
+ }
79
+ /**
80
+ * Snapshot of the session's observable state.
81
+ *
82
+ * Emitted on connect, after every command that mutates session state (`set_prompt`, `set_image`, `start`, `pause`, `resume`, `reset`, and the auto-generated `set_<field>` setters), and after each `chunk_complete`. Clients can treat this as the single source of truth for driving UI, without having to track every individual command and message themselves.
83
+ */
84
+ interface LingbotStateMessage {
85
+ type: "state";
86
+ /** Current value of the `seed` input field. The seed that was actually used by the running generation was captured when `start` fired — later changes to `seed` only take effect after `reset` and a new `start`. */
87
+ seed: number;
88
+ /** True while generation is paused via `pause`. */
89
+ paused: boolean;
90
+ /** True while the chunk loop is actively producing frames — equivalent to `started and not paused`. `False` both before `start` and while paused; read `started` to disambiguate. */
91
+ running: boolean;
92
+ /** True once `start` has been accepted. Remains true while paused; reset to false by `reset` or after `generation_complete` when the session is not auto-restarting. */
93
+ started: boolean;
94
+ /** Current value of the `movement` input field. */
95
+ movement: string;
96
+ /** True once a reference image has been set for the session. */
97
+ has_image: boolean;
98
+ /** True once a prompt has been set for the session. */
99
+ has_prompt: boolean;
100
+ /** Zero-based index of the last completed chunk. `0` before the first chunk has completed, and resets to `0` on `reset`. */
101
+ current_chunk: number;
102
+ /** Current value of the `look_vertical` input field. */
103
+ look_vertical: string;
104
+ /** Composite action string derived from `movement`, `look_horizontal`, and `look_vertical` — a `+`-joined combination of `w`/`s`/`a`/`d` and `left`/`right`/`up`/`down`, or `still` when idle. */
105
+ current_action: string;
106
+ /** The prompt currently driving generation, or `null` if no prompt has been set for the session. */
107
+ current_prompt: unknown;
108
+ /** Current value of the `look_horizontal` input field. */
109
+ look_horizontal: string;
110
+ /** Current value of the `rotation_speed_deg` input field (0.0 – 30.0). */
111
+ rotation_speed_deg: number;
112
+ }
113
+ /** Emitted when a command is rejected because preconditions are not met or its arguments could not be processed. */
114
+ interface LingbotCommandErrorMessage {
115
+ type: "command_error";
116
+ /** Human-readable explanation of why the command was rejected. */
117
+ reason: string;
118
+ /** Name of the command that was rejected. */
119
+ command: string;
120
+ }
121
+ /** Emitted once per completed chunk of `main_video`. */
122
+ interface LingbotChunkCompleteMessage {
123
+ type: "chunk_complete";
124
+ /** Zero-based index of the chunk that just completed. */
125
+ chunk_index: number;
126
+ /** The composite action string used to drive this chunk — a `+`-joined combination of movement (`w`/`s`/`a`/`d`) and look directions (`left`/`right`/`up`/`down`), or `still` when the character is idle with no camera rotation. */
127
+ active_action: string;
128
+ /** The prompt that was active while this chunk was generated. */
129
+ active_prompt: string;
130
+ /** Number of pixel frames emitted by this chunk. */
131
+ frames_emitted: number;
132
+ }
133
+ /** Emitted after `set_image` successfully decodes the uploaded file. */
134
+ interface LingbotImageAcceptedMessage {
135
+ type: "image_accepted";
136
+ /** Width in pixels of the decoded reference image. */
137
+ width: number;
138
+ /** Height in pixels of the decoded reference image. */
139
+ height: number;
140
+ }
141
+ /** Emitted after `set_prompt` is accepted. */
142
+ interface LingbotPromptAcceptedMessage {
143
+ type: "prompt_accepted";
144
+ /** The prompt text that was accepted. */
145
+ prompt: string;
146
+ }
147
+ /** Emitted after `set_prompt` or `set_image` so the client can tell at a glance whether `start` will succeed. */
148
+ interface LingbotConditionsReadyMessage {
149
+ type: "conditions_ready";
150
+ /** True once a reference image has been set for the session. */
151
+ has_image: boolean;
152
+ /** True once a prompt has been set for the session. */
153
+ has_prompt: boolean;
154
+ }
155
+ /** Emitted after `reset` clears session state and returns to the waiting state. */
156
+ interface LingbotGenerationResetMessage {
157
+ type: "generation_reset";
158
+ /** Short human-readable reason the reset was issued. */
159
+ reason: string;
160
+ }
161
+ /** Emitted in response to `pause`, once the current chunk finishes. */
162
+ interface LingbotGenerationPausedMessage {
163
+ type: "generation_paused";
164
+ /** Index of the last completed chunk before pausing. */
165
+ chunk_index: number;
166
+ }
167
+ /** Emitted in response to `resume` when leaving the paused state. */
168
+ interface LingbotGenerationResumedMessage {
169
+ type: "generation_resumed";
170
+ /** Index of the last completed chunk before resuming. */
171
+ chunk_index: number;
172
+ }
173
+ /** Emitted once when `start` succeeds and frames begin streaming. */
174
+ interface LingbotGenerationStartedMessage {
175
+ type: "generation_started";
176
+ /** The prompt active at the start of generation. */
177
+ prompt: string;
178
+ /** Total number of chunks the run will produce before `generation_complete` fires. */
179
+ chunk_num: number;
180
+ /** Total number of pixel frames the run will emit on `main_video` before `generation_complete`. */
181
+ frame_num: number;
182
+ }
183
+ /** Emitted when all `chunk_num` chunks of a run have streamed. If the session is still `started`, a new run kicks off immediately with the same prompt and image; call `reset` to stop. */
184
+ interface LingbotGenerationCompleteMessage {
185
+ type: "generation_complete";
186
+ /** Total number of chunks produced by the run. */
187
+ total_chunks: number;
188
+ }
189
+ type LingbotMessage = LingbotStateMessage | LingbotCommandErrorMessage | LingbotChunkCompleteMessage | LingbotImageAcceptedMessage | LingbotPromptAcceptedMessage | LingbotConditionsReadyMessage | LingbotGenerationResetMessage | LingbotGenerationPausedMessage | LingbotGenerationResumedMessage | LingbotGenerationStartedMessage | LingbotGenerationCompleteMessage;
190
+ /**
191
+ * Options for creating a LingbotModel (model name is set automatically).
192
+ *
193
+ * Derived from `Reactor`'s own constructor options with `modelName`
194
+ * and `modelTracks` removed — those are supplied by this class.
195
+ * Any new option the SDK adds appears here automatically on the
196
+ * next `defaultSdkVersion` bump.
197
+ */
198
+ type LingbotOptions = Omit<ConstructorParameters<typeof Reactor>[0], "modelName" | "modelTracks">;
199
+ /**
200
+ * Strongly-typed client for the Lingbot model.
201
+ *
202
+ * Extends {@link Reactor} with the model name (and modelTracks) baked into the
203
+ * constructor, so every public method on Reactor — `connect`, `disconnect`,
204
+ * `sendCommand`, `on`/`off`, `getStats`, `publishTrack`/`unpublishTrack`,
205
+ * etc. — is reachable directly on the instance. The schema-derived sugar
206
+ * below adds typed wrappers for every declared event, message, and track.
207
+ */
208
+ declare class LingbotModel extends Reactor {
209
+ constructor(options?: LingbotOptions);
210
+ /** @deprecated The model client now extends `Reactor` directly — call methods on `this` instead. This accessor returns `this` for backwards compatibility and will be removed in a future major release. */
211
+ get reactor(): this;
212
+ /** Pause generation after the current chunk finishes. Frames stop streaming on `main_video` until `resume` is called. Requires generation to be active. Emits `generation_paused` and `state` on success, or `command_error` if not generating or already paused. */
213
+ pause(): Promise<void>;
214
+ /** Abort the current run, clear the active prompt and reference image, and return to the waiting state. Valid at any time. After `reset`, call `set_prompt` and `set_image` again before `start` to begin a new session. Emits `generation_reset` and `state`. */
215
+ reset(): Promise<void>;
216
+ /** Begin generating video on `main_video`. Requires both a prompt (via `set_prompt`) and a reference image (via `set_image`). Emits `generation_started` and `state` on success, or `command_error` if a precondition is missing. Has no effect while already generating. */
217
+ start(): Promise<void>;
218
+ /** Resume generation from a previous `pause`. Requires the session to be paused. Emits `generation_resumed` and `state` on success, or `command_error` if not paused. */
219
+ resume(): Promise<void>;
220
+ /**
221
+ * Set seed
222
+ * @param params - Set seed
223
+ */
224
+ setSeed(params: LingbotSetSeedParams): Promise<void>;
225
+ /**
226
+ * Provide a reference image that anchors generation (image-to-video). Call before `start`; the image is required for generation to begin. Changes during generation have no effect until `reset` is issued and `start` is called again. Emits `image_accepted`, `conditions_ready`, and `state` on success, or `command_error` if the file is missing, not an image, or cannot be decoded.
227
+ * @param params - Provide a reference image that anchors generation (image-to-video). Call before `start`; the image is required for generation to begin. Changes during generation have no effect until `reset` is issued and `start` is called again. Emits `image_accepted`, `conditions_ready`, and `state` on success, or `command_error` if the file is missing, not an image, or cannot be decoded.
228
+ */
229
+ setImage(params: LingbotSetImageParams): Promise<void>;
230
+ /**
231
+ * Set the scene prompt. Valid at any time — call before `start` to arm generation, or hot-swap during generation to steer the next chunk. Emits `prompt_accepted`, `conditions_ready`, and `state` on success.
232
+ * @param params - Set the scene prompt. Valid at any time — call before `start` to arm generation, or hot-swap during generation to steer the next chunk. Emits `prompt_accepted`, `conditions_ready`, and `state` on success.
233
+ */
234
+ setPrompt(params: LingbotSetPromptParams): Promise<void>;
235
+ /**
236
+ * Set movement
237
+ * @param params - Set movement
238
+ */
239
+ setMovement(params: LingbotSetMovementParams): Promise<void>;
240
+ /**
241
+ * Set look_vertical
242
+ * @param params - Set look_vertical
243
+ */
244
+ setLookVertical(params: LingbotSetLookVerticalParams): Promise<void>;
245
+ /**
246
+ * Set look_horizontal
247
+ * @param params - Set look_horizontal
248
+ */
249
+ setLookHorizontal(params: LingbotSetLookHorizontalParams): Promise<void>;
250
+ /**
251
+ * Set rotation_speed_deg
252
+ * @param params - Set rotation_speed_deg
253
+ */
254
+ setRotationSpeedDeg(params: LingbotSetRotationSpeedDegParams): Promise<void>;
255
+ /**
256
+ * Subscribe to typed model messages.
257
+ * @param handler - Called with a discriminated LingbotMessage
258
+ * @returns Unsubscribe function
259
+ */
260
+ onMessage(handler: (message: LingbotMessage) => void): () => void;
261
+ /**
262
+ * Subscribe to "state" messages only.
263
+ * @returns Unsubscribe function
264
+ */
265
+ onState(handler: (message: LingbotStateMessage) => void): () => void;
266
+ /**
267
+ * Subscribe to "command_error" messages only.
268
+ * @returns Unsubscribe function
269
+ */
270
+ onCommandError(handler: (message: LingbotCommandErrorMessage) => void): () => void;
271
+ /**
272
+ * Subscribe to "chunk_complete" messages only.
273
+ * @returns Unsubscribe function
274
+ */
275
+ onChunkComplete(handler: (message: LingbotChunkCompleteMessage) => void): () => void;
276
+ /**
277
+ * Subscribe to "image_accepted" messages only.
278
+ * @returns Unsubscribe function
279
+ */
280
+ onImageAccepted(handler: (message: LingbotImageAcceptedMessage) => void): () => void;
281
+ /**
282
+ * Subscribe to "prompt_accepted" messages only.
283
+ * @returns Unsubscribe function
284
+ */
285
+ onPromptAccepted(handler: (message: LingbotPromptAcceptedMessage) => void): () => void;
286
+ /**
287
+ * Subscribe to "conditions_ready" messages only.
288
+ * @returns Unsubscribe function
289
+ */
290
+ onConditionsReady(handler: (message: LingbotConditionsReadyMessage) => void): () => void;
291
+ /**
292
+ * Subscribe to "generation_reset" messages only.
293
+ * @returns Unsubscribe function
294
+ */
295
+ onGenerationReset(handler: (message: LingbotGenerationResetMessage) => void): () => void;
296
+ /**
297
+ * Subscribe to "generation_paused" messages only.
298
+ * @returns Unsubscribe function
299
+ */
300
+ onGenerationPaused(handler: (message: LingbotGenerationPausedMessage) => void): () => void;
301
+ /**
302
+ * Subscribe to "generation_resumed" messages only.
303
+ * @returns Unsubscribe function
304
+ */
305
+ onGenerationResumed(handler: (message: LingbotGenerationResumedMessage) => void): () => void;
306
+ /**
307
+ * Subscribe to "generation_started" messages only.
308
+ * @returns Unsubscribe function
309
+ */
310
+ onGenerationStarted(handler: (message: LingbotGenerationStartedMessage) => void): () => void;
311
+ /**
312
+ * Subscribe to "generation_complete" messages only.
313
+ * @returns Unsubscribe function
314
+ */
315
+ onGenerationComplete(handler: (message: LingbotGenerationCompleteMessage) => void): () => void;
316
+ /**
317
+ * Subscribe to the "main_video" recvonly video track the model publishes.
318
+ *
319
+ * The handler fires once the model starts publishing this track; it receives the live MediaStreamTrack and the parent MediaStream (useful for attaching to a `<video>` / `<audio>` element via `srcObject`).
320
+ * @param handler - Called with the received track and its stream
321
+ * @returns Unsubscribe function
322
+ */
323
+ onMainVideo(handler: (track: MediaStreamTrack, stream: MediaStream) => void): () => void;
324
+ }
325
+
326
+ export { type LingbotChunkCompleteMessage, type LingbotCommandErrorMessage, type LingbotConditionsReadyMessage, type LingbotGenerationCompleteMessage, type LingbotGenerationPausedMessage, type LingbotGenerationResetMessage, type LingbotGenerationResumedMessage, type LingbotGenerationStartedMessage, type LingbotImageAcceptedMessage, type LingbotMessage, LingbotModel, type LingbotOptions, type LingbotPromptAcceptedMessage, type LingbotRecvTrackName, type LingbotSetImageParams, type LingbotSetLookHorizontalParams, type LingbotSetLookVerticalParams, type LingbotSetMovementParams, type LingbotSetPromptParams, type LingbotSetRotationSpeedDegParams, type LingbotSetSeedParams, type LingbotStateMessage, LingbotTracks, MODEL_NAME, MODEL_VERSION };
package/dist/core.d.ts ADDED
@@ -0,0 +1,326 @@
1
+ import { Reactor, FileRef } from '@reactor-team/js-sdk';
2
+ export { FileRef } from '@reactor-team/js-sdk';
3
+
4
+ declare const MODEL_NAME: "lingbot";
5
+ declare const MODEL_VERSION: "v0.2.21";
6
+ /**
7
+ * Preset media tracks for the Lingbot model.
8
+ *
9
+ * Declared in the model's OpenAPI schema and passed to the SDK as
10
+ * `modelTracks` so the transport can prepare the SDP offer in
11
+ * parallel with session polling (faster first-frame latency).
12
+ */
13
+ declare const LingbotTracks: readonly [{
14
+ readonly name: "main_video";
15
+ readonly kind: "video";
16
+ readonly direction: "recvonly";
17
+ }];
18
+ /** Track names the client can subscribe to (recvonly, from the client's perspective). */
19
+ type LingbotRecvTrackName = "main_video";
20
+ /** Set seed */
21
+ interface LingbotSetSeedParams {
22
+ /**
23
+ * Seed for the random generator used to sample the initial noise. Must be a non-negative integer; the model never draws its own random seed — pick one explicitly (or keep the default) for reproducible runs. Read once when `start` fires; later changes take effect only after `reset` followed by a new `start`.
24
+ * @minimum 0
25
+ * @default 42
26
+ */
27
+ seed?: number;
28
+ }
29
+ /** Provide a reference image that anchors generation (image-to-video). Call before `start`; the image is required for generation to begin. Changes during generation have no effect until `reset` is issued and `start` is called again. Emits `image_accepted`, `conditions_ready`, and `state` on success, or `command_error` if the file is missing, not an image, or cannot be decoded. */
30
+ interface LingbotSetImageParams {
31
+ /**
32
+ * Reference to a file uploaded via the Reactor presigned-URL protocol.
33
+ * @default null
34
+ */
35
+ image?: FileRef;
36
+ }
37
+ /** Set the scene prompt. Valid at any time — call before `start` to arm generation, or hot-swap during generation to steer the next chunk. Emits `prompt_accepted`, `conditions_ready`, and `state` on success. */
38
+ interface LingbotSetPromptParams {
39
+ /**
40
+ * Natural-language description of the scene to generate. Replaces the previously active prompt. Applied on the next chunk when generating; otherwise takes effect when `start` fires.
41
+ * @default ""
42
+ */
43
+ prompt?: string;
44
+ }
45
+ /** Set movement */
46
+ interface LingbotSetMovementParams {
47
+ /**
48
+ * Character movement in the generated scene. `idle` holds the character stationary; `forward` / `back` translate along the look axis; `strafe_left` / `strafe_right` translate sideways. Can be changed at any time; the new value applies to the next chunk.
49
+ * @default "idle"
50
+ */
51
+ movement?: "idle" | "forward" | "back" | "strafe_left" | "strafe_right";
52
+ }
53
+ /** Set look_vertical */
54
+ interface LingbotSetLookVerticalParams {
55
+ /**
56
+ * Vertical (pitch) camera rotation. `idle` holds pitch steady; `up` / `down` rotate the camera at the rate given by `rotation_speed_deg`. Can be changed at any time; the new value applies to the next chunk.
57
+ * @default "idle"
58
+ */
59
+ look_vertical?: "idle" | "up" | "down";
60
+ }
61
+ /** Set look_horizontal */
62
+ interface LingbotSetLookHorizontalParams {
63
+ /**
64
+ * Horizontal (yaw) camera rotation. `idle` holds yaw steady; `left` / `right` rotate the camera at the rate given by `rotation_speed_deg`. Can be changed at any time; the new value applies to the next chunk.
65
+ * @default "idle"
66
+ */
67
+ look_horizontal?: "idle" | "left" | "right";
68
+ }
69
+ /** Set rotation_speed_deg */
70
+ interface LingbotSetRotationSpeedDegParams {
71
+ /**
72
+ * Camera rotation speed in degrees per latent frame, applied when `look_horizontal` or `look_vertical` is not `idle`. Range 0.0 – 30.0. Ignored when both look axes are `idle`. Can be changed at any time; the new value applies to the next chunk.
73
+ * @minimum 0
74
+ * @maximum 30
75
+ * @default 5
76
+ */
77
+ rotation_speed_deg?: number;
78
+ }
79
+ /**
80
+ * Snapshot of the session's observable state.
81
+ *
82
+ * Emitted on connect, after every command that mutates session state (`set_prompt`, `set_image`, `start`, `pause`, `resume`, `reset`, and the auto-generated `set_<field>` setters), and after each `chunk_complete`. Clients can treat this as the single source of truth for driving UI, without having to track every individual command and message themselves.
83
+ */
84
+ interface LingbotStateMessage {
85
+ type: "state";
86
+ /** Current value of the `seed` input field. The seed that was actually used by the running generation was captured when `start` fired — later changes to `seed` only take effect after `reset` and a new `start`. */
87
+ seed: number;
88
+ /** True while generation is paused via `pause`. */
89
+ paused: boolean;
90
+ /** True while the chunk loop is actively producing frames — equivalent to `started and not paused`. `False` both before `start` and while paused; read `started` to disambiguate. */
91
+ running: boolean;
92
+ /** True once `start` has been accepted. Remains true while paused; reset to false by `reset` or after `generation_complete` when the session is not auto-restarting. */
93
+ started: boolean;
94
+ /** Current value of the `movement` input field. */
95
+ movement: string;
96
+ /** True once a reference image has been set for the session. */
97
+ has_image: boolean;
98
+ /** True once a prompt has been set for the session. */
99
+ has_prompt: boolean;
100
+ /** Zero-based index of the last completed chunk. `0` before the first chunk has completed, and resets to `0` on `reset`. */
101
+ current_chunk: number;
102
+ /** Current value of the `look_vertical` input field. */
103
+ look_vertical: string;
104
+ /** Composite action string derived from `movement`, `look_horizontal`, and `look_vertical` — a `+`-joined combination of `w`/`s`/`a`/`d` and `left`/`right`/`up`/`down`, or `still` when idle. */
105
+ current_action: string;
106
+ /** The prompt currently driving generation, or `null` if no prompt has been set for the session. */
107
+ current_prompt: unknown;
108
+ /** Current value of the `look_horizontal` input field. */
109
+ look_horizontal: string;
110
+ /** Current value of the `rotation_speed_deg` input field (0.0 – 30.0). */
111
+ rotation_speed_deg: number;
112
+ }
113
+ /** Emitted when a command is rejected because preconditions are not met or its arguments could not be processed. */
114
+ interface LingbotCommandErrorMessage {
115
+ type: "command_error";
116
+ /** Human-readable explanation of why the command was rejected. */
117
+ reason: string;
118
+ /** Name of the command that was rejected. */
119
+ command: string;
120
+ }
121
+ /** Emitted once per completed chunk of `main_video`. */
122
+ interface LingbotChunkCompleteMessage {
123
+ type: "chunk_complete";
124
+ /** Zero-based index of the chunk that just completed. */
125
+ chunk_index: number;
126
+ /** The composite action string used to drive this chunk — a `+`-joined combination of movement (`w`/`s`/`a`/`d`) and look directions (`left`/`right`/`up`/`down`), or `still` when the character is idle with no camera rotation. */
127
+ active_action: string;
128
+ /** The prompt that was active while this chunk was generated. */
129
+ active_prompt: string;
130
+ /** Number of pixel frames emitted by this chunk. */
131
+ frames_emitted: number;
132
+ }
133
+ /** Emitted after `set_image` successfully decodes the uploaded file. */
134
+ interface LingbotImageAcceptedMessage {
135
+ type: "image_accepted";
136
+ /** Width in pixels of the decoded reference image. */
137
+ width: number;
138
+ /** Height in pixels of the decoded reference image. */
139
+ height: number;
140
+ }
141
+ /** Emitted after `set_prompt` is accepted. */
142
+ interface LingbotPromptAcceptedMessage {
143
+ type: "prompt_accepted";
144
+ /** The prompt text that was accepted. */
145
+ prompt: string;
146
+ }
147
+ /** Emitted after `set_prompt` or `set_image` so the client can tell at a glance whether `start` will succeed. */
148
+ interface LingbotConditionsReadyMessage {
149
+ type: "conditions_ready";
150
+ /** True once a reference image has been set for the session. */
151
+ has_image: boolean;
152
+ /** True once a prompt has been set for the session. */
153
+ has_prompt: boolean;
154
+ }
155
+ /** Emitted after `reset` clears session state and returns to the waiting state. */
156
+ interface LingbotGenerationResetMessage {
157
+ type: "generation_reset";
158
+ /** Short human-readable reason the reset was issued. */
159
+ reason: string;
160
+ }
161
+ /** Emitted in response to `pause`, once the current chunk finishes. */
162
+ interface LingbotGenerationPausedMessage {
163
+ type: "generation_paused";
164
+ /** Index of the last completed chunk before pausing. */
165
+ chunk_index: number;
166
+ }
167
+ /** Emitted in response to `resume` when leaving the paused state. */
168
+ interface LingbotGenerationResumedMessage {
169
+ type: "generation_resumed";
170
+ /** Index of the last completed chunk before resuming. */
171
+ chunk_index: number;
172
+ }
173
+ /** Emitted once when `start` succeeds and frames begin streaming. */
174
+ interface LingbotGenerationStartedMessage {
175
+ type: "generation_started";
176
+ /** The prompt active at the start of generation. */
177
+ prompt: string;
178
+ /** Total number of chunks the run will produce before `generation_complete` fires. */
179
+ chunk_num: number;
180
+ /** Total number of pixel frames the run will emit on `main_video` before `generation_complete`. */
181
+ frame_num: number;
182
+ }
183
+ /** Emitted when all `chunk_num` chunks of a run have streamed. If the session is still `started`, a new run kicks off immediately with the same prompt and image; call `reset` to stop. */
184
+ interface LingbotGenerationCompleteMessage {
185
+ type: "generation_complete";
186
+ /** Total number of chunks produced by the run. */
187
+ total_chunks: number;
188
+ }
189
+ type LingbotMessage = LingbotStateMessage | LingbotCommandErrorMessage | LingbotChunkCompleteMessage | LingbotImageAcceptedMessage | LingbotPromptAcceptedMessage | LingbotConditionsReadyMessage | LingbotGenerationResetMessage | LingbotGenerationPausedMessage | LingbotGenerationResumedMessage | LingbotGenerationStartedMessage | LingbotGenerationCompleteMessage;
190
+ /**
191
+ * Options for creating a LingbotModel (model name is set automatically).
192
+ *
193
+ * Derived from `Reactor`'s own constructor options with `modelName`
194
+ * and `modelTracks` removed — those are supplied by this class.
195
+ * Any new option the SDK adds appears here automatically on the
196
+ * next `defaultSdkVersion` bump.
197
+ */
198
+ type LingbotOptions = Omit<ConstructorParameters<typeof Reactor>[0], "modelName" | "modelTracks">;
199
+ /**
200
+ * Strongly-typed client for the Lingbot model.
201
+ *
202
+ * Extends {@link Reactor} with the model name (and modelTracks) baked into the
203
+ * constructor, so every public method on Reactor — `connect`, `disconnect`,
204
+ * `sendCommand`, `on`/`off`, `getStats`, `publishTrack`/`unpublishTrack`,
205
+ * etc. — is reachable directly on the instance. The schema-derived sugar
206
+ * below adds typed wrappers for every declared event, message, and track.
207
+ */
208
+ declare class LingbotModel extends Reactor {
209
+ constructor(options?: LingbotOptions);
210
+ /** @deprecated The model client now extends `Reactor` directly — call methods on `this` instead. This accessor returns `this` for backwards compatibility and will be removed in a future major release. */
211
+ get reactor(): this;
212
+ /** Pause generation after the current chunk finishes. Frames stop streaming on `main_video` until `resume` is called. Requires generation to be active. Emits `generation_paused` and `state` on success, or `command_error` if not generating or already paused. */
213
+ pause(): Promise<void>;
214
+ /** Abort the current run, clear the active prompt and reference image, and return to the waiting state. Valid at any time. After `reset`, call `set_prompt` and `set_image` again before `start` to begin a new session. Emits `generation_reset` and `state`. */
215
+ reset(): Promise<void>;
216
+ /** Begin generating video on `main_video`. Requires both a prompt (via `set_prompt`) and a reference image (via `set_image`). Emits `generation_started` and `state` on success, or `command_error` if a precondition is missing. Has no effect while already generating. */
217
+ start(): Promise<void>;
218
+ /** Resume generation from a previous `pause`. Requires the session to be paused. Emits `generation_resumed` and `state` on success, or `command_error` if not paused. */
219
+ resume(): Promise<void>;
220
+ /**
221
+ * Set seed
222
+ * @param params - Set seed
223
+ */
224
+ setSeed(params: LingbotSetSeedParams): Promise<void>;
225
+ /**
226
+ * Provide a reference image that anchors generation (image-to-video). Call before `start`; the image is required for generation to begin. Changes during generation have no effect until `reset` is issued and `start` is called again. Emits `image_accepted`, `conditions_ready`, and `state` on success, or `command_error` if the file is missing, not an image, or cannot be decoded.
227
+ * @param params - Provide a reference image that anchors generation (image-to-video). Call before `start`; the image is required for generation to begin. Changes during generation have no effect until `reset` is issued and `start` is called again. Emits `image_accepted`, `conditions_ready`, and `state` on success, or `command_error` if the file is missing, not an image, or cannot be decoded.
228
+ */
229
+ setImage(params: LingbotSetImageParams): Promise<void>;
230
+ /**
231
+ * Set the scene prompt. Valid at any time — call before `start` to arm generation, or hot-swap during generation to steer the next chunk. Emits `prompt_accepted`, `conditions_ready`, and `state` on success.
232
+ * @param params - Set the scene prompt. Valid at any time — call before `start` to arm generation, or hot-swap during generation to steer the next chunk. Emits `prompt_accepted`, `conditions_ready`, and `state` on success.
233
+ */
234
+ setPrompt(params: LingbotSetPromptParams): Promise<void>;
235
+ /**
236
+ * Set movement
237
+ * @param params - Set movement
238
+ */
239
+ setMovement(params: LingbotSetMovementParams): Promise<void>;
240
+ /**
241
+ * Set look_vertical
242
+ * @param params - Set look_vertical
243
+ */
244
+ setLookVertical(params: LingbotSetLookVerticalParams): Promise<void>;
245
+ /**
246
+ * Set look_horizontal
247
+ * @param params - Set look_horizontal
248
+ */
249
+ setLookHorizontal(params: LingbotSetLookHorizontalParams): Promise<void>;
250
+ /**
251
+ * Set rotation_speed_deg
252
+ * @param params - Set rotation_speed_deg
253
+ */
254
+ setRotationSpeedDeg(params: LingbotSetRotationSpeedDegParams): Promise<void>;
255
+ /**
256
+ * Subscribe to typed model messages.
257
+ * @param handler - Called with a discriminated LingbotMessage
258
+ * @returns Unsubscribe function
259
+ */
260
+ onMessage(handler: (message: LingbotMessage) => void): () => void;
261
+ /**
262
+ * Subscribe to "state" messages only.
263
+ * @returns Unsubscribe function
264
+ */
265
+ onState(handler: (message: LingbotStateMessage) => void): () => void;
266
+ /**
267
+ * Subscribe to "command_error" messages only.
268
+ * @returns Unsubscribe function
269
+ */
270
+ onCommandError(handler: (message: LingbotCommandErrorMessage) => void): () => void;
271
+ /**
272
+ * Subscribe to "chunk_complete" messages only.
273
+ * @returns Unsubscribe function
274
+ */
275
+ onChunkComplete(handler: (message: LingbotChunkCompleteMessage) => void): () => void;
276
+ /**
277
+ * Subscribe to "image_accepted" messages only.
278
+ * @returns Unsubscribe function
279
+ */
280
+ onImageAccepted(handler: (message: LingbotImageAcceptedMessage) => void): () => void;
281
+ /**
282
+ * Subscribe to "prompt_accepted" messages only.
283
+ * @returns Unsubscribe function
284
+ */
285
+ onPromptAccepted(handler: (message: LingbotPromptAcceptedMessage) => void): () => void;
286
+ /**
287
+ * Subscribe to "conditions_ready" messages only.
288
+ * @returns Unsubscribe function
289
+ */
290
+ onConditionsReady(handler: (message: LingbotConditionsReadyMessage) => void): () => void;
291
+ /**
292
+ * Subscribe to "generation_reset" messages only.
293
+ * @returns Unsubscribe function
294
+ */
295
+ onGenerationReset(handler: (message: LingbotGenerationResetMessage) => void): () => void;
296
+ /**
297
+ * Subscribe to "generation_paused" messages only.
298
+ * @returns Unsubscribe function
299
+ */
300
+ onGenerationPaused(handler: (message: LingbotGenerationPausedMessage) => void): () => void;
301
+ /**
302
+ * Subscribe to "generation_resumed" messages only.
303
+ * @returns Unsubscribe function
304
+ */
305
+ onGenerationResumed(handler: (message: LingbotGenerationResumedMessage) => void): () => void;
306
+ /**
307
+ * Subscribe to "generation_started" messages only.
308
+ * @returns Unsubscribe function
309
+ */
310
+ onGenerationStarted(handler: (message: LingbotGenerationStartedMessage) => void): () => void;
311
+ /**
312
+ * Subscribe to "generation_complete" messages only.
313
+ * @returns Unsubscribe function
314
+ */
315
+ onGenerationComplete(handler: (message: LingbotGenerationCompleteMessage) => void): () => void;
316
+ /**
317
+ * Subscribe to the "main_video" recvonly video track the model publishes.
318
+ *
319
+ * The handler fires once the model starts publishing this track; it receives the live MediaStreamTrack and the parent MediaStream (useful for attaching to a `<video>` / `<audio>` element via `srcObject`).
320
+ * @param handler - Called with the received track and its stream
321
+ * @returns Unsubscribe function
322
+ */
323
+ onMainVideo(handler: (track: MediaStreamTrack, stream: MediaStream) => void): () => void;
324
+ }
325
+
326
+ export { type LingbotChunkCompleteMessage, type LingbotCommandErrorMessage, type LingbotConditionsReadyMessage, type LingbotGenerationCompleteMessage, type LingbotGenerationPausedMessage, type LingbotGenerationResetMessage, type LingbotGenerationResumedMessage, type LingbotGenerationStartedMessage, type LingbotImageAcceptedMessage, type LingbotMessage, LingbotModel, type LingbotOptions, type LingbotPromptAcceptedMessage, type LingbotRecvTrackName, type LingbotSetImageParams, type LingbotSetLookHorizontalParams, type LingbotSetLookVerticalParams, type LingbotSetMovementParams, type LingbotSetPromptParams, type LingbotSetRotationSpeedDegParams, type LingbotSetSeedParams, type LingbotStateMessage, LingbotTracks, MODEL_NAME, MODEL_VERSION };