@reactor-models/fast-h3 1.7.2 → 1.9.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/README.md +47 -21
- package/dist/{chunk-KXGCFYKC.mjs → chunk-CQBNH4KP.mjs} +2 -2
- package/dist/chunk-CQBNH4KP.mjs.map +1 -0
- package/dist/{chunk-YANZ4HCV.mjs → chunk-XXLA5OAS.mjs} +26 -26
- package/dist/chunk-XXLA5OAS.mjs.map +1 -0
- package/dist/core.d.mts +35 -31
- package/dist/core.d.ts +35 -31
- package/dist/core.js +25 -25
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +1 -1
- package/dist/index.js +25 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/react.d.mts +5 -0
- package/dist/react.d.ts +5 -0
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-KXGCFYKC.mjs.map +0 -1
- package/dist/chunk-YANZ4HCV.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @reactor-models/fast-h3
|
|
2
2
|
|
|
3
|
-
> Typed JavaScript + React SDK for the **FastH3** model on [Reactor](https://reactor.inc). Version **v1.
|
|
3
|
+
> Typed JavaScript + React SDK for the **FastH3** model on [Reactor](https://reactor.inc). Version **v1.9.1**.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -145,11 +145,33 @@ export default function App() {
|
|
|
145
145
|
|
|
146
146
|
Client-to-model commands. The typed surface is `FastH3Model` (one method per event) in plain JS, and `useFastH3()` in React — every field name below matches the parameter name the method accepts. Every awaited call resolves once the model's handler has completed; a command whose handler returns a message resolves with that reply (see each event's "Returns" line).
|
|
147
147
|
|
|
148
|
+
### Refused commands
|
|
149
|
+
|
|
150
|
+
A call never rejects. When a command fails or the model refuses it, the call resolves `undefined` and the SDK emits a `ReactorError` on the `error` event with `operation: "sendCommand"`. For a refusal, its `code` is the model's own code and its `message` reads `command '<name>' failed (<code>): <reason>`. For a command that declares a reply, `undefined` means it did not succeed. For a command without one, `undefined` also follows success, so only the `error` event tells them apart. Keep these errors apart from connection and session errors. A model that reports a refusal only as a broadcast message (see Messages) emits no `error` event; the call still resolves `undefined`.
|
|
151
|
+
|
|
152
|
+
#### JavaScript
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
fastH3.on("error", (error) => {
|
|
156
|
+
if (error.operation !== "sendCommand") return; // a connection or session error
|
|
157
|
+
console.warn(error.code, error.message);
|
|
158
|
+
});
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
#### React
|
|
162
|
+
|
|
163
|
+
In React, the same error lands in `lastError` from `useFastH3()`. The store keeps the latest error until the next one replaces it.
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
const { lastError } = useFastH3();
|
|
167
|
+
const commandError = lastError?.operation === "sendCommand" ? lastError : undefined;
|
|
168
|
+
```
|
|
169
|
+
|
|
148
170
|
### `pop`
|
|
149
171
|
|
|
150
|
-
Remove one clip by its UUID from whichever queue holds it, freeing its slot. Works on generating and built clips alike; a build already running for it is discarded when it completes. The clip that is playing is in neither queue — [`stop`](#stop) is the command that cuts it. A built clip stays in `queue_update.history` after popping, so clips referencing its frame are unaffected; an unbuilt clip that queued clips reference is refused, since popping it would leave them without an endpoint — pop those first. Emits [`clip_popped`](#clip_popped), [`queue_update`](#queue_update) and [`state_update`](#state_update)
|
|
172
|
+
Remove one clip by its UUID from whichever queue holds it, freeing its slot. Works on generating and built clips alike; a build already running for it is discarded when it completes. The clip that is playing is in neither queue — [`stop`](#stop) is the command that cuts it. A built clip stays in `queue_update.history` after popping, so clips referencing its frame are unaffected; an unbuilt clip that queued clips reference is refused, since popping it would leave them without an endpoint — pop those first. Emits [`clip_popped`](#clip_popped), [`queue_update`](#queue_update) and [`state_update`](#state_update). A refusal fails the call with a code and is also broadcast as [`command_error`](#command_error): `unknown_clip` when no queued clip has that id, `clip_referenced` when queued clips still reference its last frame.
|
|
151
173
|
|
|
152
|
-
Returns: [`clip_popped`](#clip_popped) — `{ type: "clip_popped", clip: null }` (or `undefined` when the
|
|
174
|
+
Returns: [`clip_popped`](#clip_popped) — `{ type: "clip_popped", clip: null }` (or `undefined` when the command failed or was refused — see [Refused commands](#refused-commands)).
|
|
153
175
|
|
|
154
176
|
| Parameter | Type | Description |
|
|
155
177
|
|---|---|---|
|
|
@@ -185,9 +207,9 @@ function Example() {
|
|
|
185
207
|
|
|
186
208
|
### `move`
|
|
187
209
|
|
|
188
|
-
Reposition one clip within the queue that holds it — the generation queue for a clip still to build, the playout queue for a built one; clips never move between queues except by building. `position` 0 is the front: the next build, or what bare [`play`](#play) and autoplay take next. Values past the end mean the back. Replies [`clip_moved`](#clip_moved) with the queue and the resulting position, and emits [`queue_update`](#queue_update)
|
|
210
|
+
Reposition one clip within the queue that holds it — the generation queue for a clip still to build, the playout queue for a built one; clips never move between queues except by building. `position` 0 is the front: the next build, or what bare [`play`](#play) and autoplay take next. Values past the end mean the back. Replies [`clip_moved`](#clip_moved) with the queue and the resulting position, and emits [`queue_update`](#queue_update). Fails the call with `unknown_clip`, also broadcast as [`command_error`](#command_error), when no queued clip has that id.
|
|
189
211
|
|
|
190
|
-
Returns: [`clip_moved`](#clip_moved) — `{ type: "clip_moved", clip: null, queue: "", position: 0 }` (or `undefined` when the
|
|
212
|
+
Returns: [`clip_moved`](#clip_moved) — `{ type: "clip_moved", clip: null, queue: "", position: 0 }` (or `undefined` when the command failed or was refused — see [Refused commands](#refused-commands)).
|
|
191
213
|
|
|
192
214
|
| Parameter | Type | Description |
|
|
193
215
|
|---|---|---|
|
|
@@ -229,9 +251,9 @@ function Example() {
|
|
|
229
251
|
|
|
230
252
|
### `play`
|
|
231
253
|
|
|
232
|
-
Play one clip from the playout queue. Blank `clip_id` plays the front clip; a UUID plays that specific one. Playing consumes the entry: it leaves the queue, [`clip_started`](#clip_started) marks its first frames, and when it ends the stream holds on black until the next [`play`](#play). Emits [`queue_update`](#queue_update) and [`state_update`](#state_update)
|
|
254
|
+
Play one clip from the playout queue. Blank `clip_id` plays the front clip; a UUID plays that specific one. Playing consumes the entry: it leaves the queue, [`clip_started`](#clip_started) marks its first frames, and when it ends the stream holds on black until the next [`play`](#play). Emits [`queue_update`](#queue_update) and [`state_update`](#state_update). A refusal fails the call with a code and is also broadcast as [`command_error`](#command_error): `already_playing`, `unknown_clip` for an unknown id, `clip_not_ready` while the clip is still generating, and `no_ready_clip` when the playout queue is empty.
|
|
233
255
|
|
|
234
|
-
Returns: nothing — the awaited call resolves `undefined` once the model's handler has run.
|
|
256
|
+
Returns: nothing — the awaited call resolves `undefined` once the model's handler has run, and also when the command was refused (see [Refused commands](#refused-commands)).
|
|
235
257
|
|
|
236
258
|
| Parameter | Type | Description |
|
|
237
259
|
|---|---|---|
|
|
@@ -263,9 +285,9 @@ function Example() {
|
|
|
263
285
|
|
|
264
286
|
### `stop`
|
|
265
287
|
|
|
266
|
-
Cut the clip that is playing. Whatever is queued on the output tracks is dropped and the picture goes to black within a fraction of a second (with [`set_flush_on_clip_end`](#setflushonclipend) off, the transport drains what it holds and freezes on the last frame instead), and the session is back where a finished clip leaves it — the queue is untouched and the next [`play`](#play) starts clean. With autoplay on this acts as a skip: the next ready clip starts on its own, so send [`set_autoplay`](#setautoplay) off first to hold the stream. Emits [`clip_stopped`](#clip_stopped) and [`state_update`](#state_update)
|
|
288
|
+
Cut the clip that is playing. Whatever is queued on the output tracks is dropped and the picture goes to black within a fraction of a second (with [`set_flush_on_clip_end`](#setflushonclipend) off, the transport drains what it holds and freezes on the last frame instead), and the session is back where a finished clip leaves it — the queue is untouched and the next [`play`](#play) starts clean. With autoplay on this acts as a skip: the next ready clip starts on its own, so send [`set_autoplay`](#setautoplay) off first to hold the stream. Emits [`clip_stopped`](#clip_stopped) and [`state_update`](#state_update). Fails the call with `not_playing`, also broadcast as [`command_error`](#command_error), when no clip is playing.
|
|
267
289
|
|
|
268
|
-
Returns: nothing — the awaited call resolves `undefined` once the model's handler has run.
|
|
290
|
+
Returns: nothing — the awaited call resolves `undefined` once the model's handler has run, and also when the command was refused (see [Refused commands](#refused-commands)).
|
|
269
291
|
|
|
270
292
|
_No parameters._
|
|
271
293
|
|
|
@@ -297,7 +319,7 @@ function Example() {
|
|
|
297
319
|
|
|
298
320
|
Return every condition to its default, drop both queues' clips and the retained history, and clear the output tracks. A clip that is playing is cut, with a [`clip_stopped`](#clip_stopped) to mark it. Valid at any time. Replies [`session_reset`](#session_reset) and emits [`queue_update`](#queue_update) and [`state_update`](#state_update).
|
|
299
321
|
|
|
300
|
-
Returns: [`session_reset`](#session_reset) — `{ type: "session_reset", was_playing: true, cleared_clips: 0 }` (or `undefined` when the
|
|
322
|
+
Returns: [`session_reset`](#session_reset) — `{ type: "session_reset", was_playing: true, cleared_clips: 0 }` (or `undefined` when the command failed or was refused — see [Refused commands](#refused-commands)).
|
|
301
323
|
|
|
302
324
|
_No parameters._
|
|
303
325
|
|
|
@@ -331,9 +353,9 @@ function Example() {
|
|
|
331
353
|
|
|
332
354
|
### `enqueue`
|
|
333
355
|
|
|
334
|
-
Queue one clip generation. The clip enters the generation queue (at `position`, or the back), builds when its turn comes, and then joins the back of the playout queue, announced by [`clip_generated`](#clip_generated). The prompt is what the clip will show; the metadata is an opaque string echoed back on every message that references the clip, for frontends to carry their own tracking data. The clip opens from text alone, from an uploaded still (`starting_frame` — the image animates forward), or from an existing clip's last frame (`continue_from_clip_id` — any clip in the queues or in `queue_update.history`); a continued clip simply waits its turn until its source is built, wherever the two sit in the queue. An uploaded `ending_frame` or a generated clip's clean last frame (`ending_from_clip_id`) can accompany any opener — or stand alone — to make the clip animate *into* and close on that image. Set both clip-id fields to the same UUID to leave and return to one generated frame. The clip's canvas is the session's; its length is the `seconds` passed here (snapped to what the model can produce) or the session default, and its seed is the one passed here or the session's advancing default. Builds run through the queue in order; watch [`queue_update`](#queue_update) for the clip turning ready. Replies [`clip_queued`](#clip_queued) with the clip's UUID and emits [`queue_update`](#queue_update) and [`state_update`](#state_update)
|
|
356
|
+
Queue one clip generation. The clip enters the generation queue (at `position`, or the back), builds when its turn comes, and then joins the back of the playout queue, announced by [`clip_generated`](#clip_generated). The prompt is what the clip will show; the metadata is an opaque string echoed back on every message that references the clip, for frontends to carry their own tracking data. The clip opens from text alone, from an uploaded still (`starting_frame` — the image animates forward), or from an existing clip's last frame (`continue_from_clip_id` — any clip in the queues or in `queue_update.history`); a continued clip simply waits its turn until its source is built, wherever the two sit in the queue. An uploaded `ending_frame` or a generated clip's clean last frame (`ending_from_clip_id`) can accompany any opener — or stand alone — to make the clip animate *into* and close on that image. Set both clip-id fields to the same UUID to leave and return to one generated frame. The clip's canvas is the session's; its length is the `seconds` passed here (snapped to what the model can produce) or the session default, and its seed is the one passed here or the session's advancing default. Builds run through the queue in order; watch [`queue_update`](#queue_update) for the clip turning ready. Replies [`clip_queued`](#clip_queued) with the clip's UUID and emits [`queue_update`](#queue_update) and [`state_update`](#state_update). A refusal fails the call with a code and is also broadcast as [`command_error`](#command_error): `queue_full` when the queue is full, `empty_prompt` or `prompt_too_long` when the prompt is empty or over the model's token budget, `invalid_request` when both a starting frame and a source clip, or both ending conditions, are given, `unknown_clip` when a source clip is unknown or no longer retained, and `invalid_image` when an upload is not a decodable image.
|
|
335
357
|
|
|
336
|
-
Returns: [`clip_queued`](#clip_queued) — `{ type: "clip_queued", clip: null }` (or `undefined` when the
|
|
358
|
+
Returns: [`clip_queued`](#clip_queued) — `{ type: "clip_queued", clip: null }` (or `undefined` when the command failed or was refused — see [Refused commands](#refused-commands)).
|
|
337
359
|
|
|
338
360
|
| Parameter | Type | Description |
|
|
339
361
|
|---|---|---|
|
|
@@ -385,7 +407,7 @@ function Example() {
|
|
|
385
407
|
|
|
386
408
|
Set the default seed — the one an [`enqueue`](#enqueue) without a seed of its own uses, advancing it by one, so re-enqueuing the same prompts in the same order reproduces the same clips. Clips already in the queue keep the seed they were enqueued with. Valid at any time. Emits [`seed_accepted`](#seed_accepted) and [`state_update`](#state_update).
|
|
387
409
|
|
|
388
|
-
Returns: [`seed_accepted`](#seed_accepted) — `{ type: "seed_accepted", seed: 0 }` (or `undefined` when the
|
|
410
|
+
Returns: [`seed_accepted`](#seed_accepted) — `{ type: "seed_accepted", seed: 0 }` (or `undefined` when the command failed or was refused — see [Refused commands](#refused-commands)).
|
|
389
411
|
|
|
390
412
|
| Parameter | Type | Description |
|
|
391
413
|
|---|---|---|
|
|
@@ -423,7 +445,7 @@ function Example() {
|
|
|
423
445
|
|
|
424
446
|
Return both queues' contents — `generation` (waiting to build) and `playout` (built, playable) — plus `history`, the built clips no longer queued that `continue_from_clip_id` or `ending_from_clip_id` can still name, every clip as its full structure. The same payload the model broadcasts as [`queue_update`](#queue_update). Valid at any time.
|
|
425
447
|
|
|
426
|
-
Returns: [`queue_update`](#queue_update) — `{ type: "queue_update", history: null, playout: null, generation: null }` (or `undefined` when the
|
|
448
|
+
Returns: [`queue_update`](#queue_update) — `{ type: "queue_update", history: null, playout: null, generation: null }` (or `undefined` when the command failed or was refused — see [Refused commands](#refused-commands)).
|
|
427
449
|
|
|
428
450
|
_No parameters._
|
|
429
451
|
|
|
@@ -464,7 +486,7 @@ function Example() {
|
|
|
464
486
|
|
|
465
487
|
Return a snapshot of everything the session exposes except the queue's contents ([`get_queue`](#getqueue) carries those): the conditions in force, what is playing, progress counters, and the commands that are valid right now. The same payload the model broadcasts as [`state_update`](#state_update). Valid at any time.
|
|
466
488
|
|
|
467
|
-
Returns: [`state_update`](#state_update) — `{ type: "state_update", seed: 0, width: 0, aspect: "", height: 0, playing: true, autoplay: true, clip_seconds: 0, clips_played: 0, seconds_sent: 0, playout_queued: 0, valid_commands: null, playing_clip_id: null, clip_seconds_max: 0, clip_seconds_min: 0, playout_capacity: 0, flush_on_clip_end: true, generation_queued: 0, generation_capacity: 0 }` (or `undefined` when the
|
|
489
|
+
Returns: [`state_update`](#state_update) — `{ type: "state_update", seed: 0, width: 0, aspect: "", height: 0, playing: true, autoplay: true, clip_seconds: 0, clips_played: 0, seconds_sent: 0, playout_queued: 0, valid_commands: null, playing_clip_id: null, clip_seconds_max: 0, clip_seconds_min: 0, playout_capacity: 0, flush_on_clip_end: true, generation_queued: 0, generation_capacity: 0 }` (or `undefined` when the command failed or was refused — see [Refused commands](#refused-commands)).
|
|
468
490
|
|
|
469
491
|
_No parameters._
|
|
470
492
|
|
|
@@ -518,9 +540,9 @@ function Example() {
|
|
|
518
540
|
|
|
519
541
|
### `setCanvas`
|
|
520
542
|
|
|
521
|
-
Choose the aspect ratio of `main_video`. The video track keeps one size and queued clips are built at it, so this is only valid while the queue is empty and nothing is playing. Emits [`canvas_accepted`](#canvas_accepted), carrying the exact pixel size, and [`state_update`](#state_update)
|
|
543
|
+
Choose the aspect ratio of `main_video`. The video track keeps one size and queued clips are built at it, so this is only valid while the queue is empty and nothing is playing. Emits [`canvas_accepted`](#canvas_accepted), carrying the exact pixel size, and [`state_update`](#state_update). A refusal fails the call with a code and is also broadcast as [`command_error`](#command_error): `session_not_empty` while clips are queued or playing, `invalid_aspect` when the ratio is not one this model offers.
|
|
522
544
|
|
|
523
|
-
Returns: [`canvas_accepted`](#canvas_accepted) — `{ type: "canvas_accepted", width: 0, aspect: "", height: 0 }` (or `undefined` when the
|
|
545
|
+
Returns: [`canvas_accepted`](#canvas_accepted) — `{ type: "canvas_accepted", width: 0, aspect: "", height: 0 }` (or `undefined` when the command failed or was refused — see [Refused commands](#refused-commands)).
|
|
524
546
|
|
|
525
547
|
| Parameter | Type | Description |
|
|
526
548
|
|---|---|---|
|
|
@@ -563,7 +585,7 @@ function Example() {
|
|
|
563
585
|
|
|
564
586
|
Turn autoplay on or off. On, the playout queue's front clip starts on its own whenever nothing is playing — right after a clip finishes, or the moment a build completes while the stream is idle — so a steadily fed queue plays through without a [`play`](#play) per clip. Off (the default), the stream holds on black until an explicit [`play`](#play). Takes effect immediately and lasts for the session. Emits [`autoplay_accepted`](#autoplay_accepted) and [`state_update`](#state_update).
|
|
565
587
|
|
|
566
|
-
Returns: [`autoplay_accepted`](#autoplay_accepted) — `{ type: "autoplay_accepted", enabled: true }` (or `undefined` when the
|
|
588
|
+
Returns: [`autoplay_accepted`](#autoplay_accepted) — `{ type: "autoplay_accepted", enabled: true }` (or `undefined` when the command failed or was refused — see [Refused commands](#refused-commands)).
|
|
567
589
|
|
|
568
590
|
| Parameter | Type | Description |
|
|
569
591
|
|---|---|---|
|
|
@@ -601,7 +623,7 @@ function Example() {
|
|
|
601
623
|
|
|
602
624
|
Set the default length for enqueues that carry no `seconds` of their own. The value is snapped to the nearest length the model can produce, so read the effective one back from [`clip_length_accepted`](#clip_length_accepted). Clips already in the queue keep the length they were enqueued with. Longer clips carry a scene further; shorter ones build faster. Valid at any time. Emits [`clip_length_accepted`](#clip_length_accepted) and [`state_update`](#state_update).
|
|
603
625
|
|
|
604
|
-
Returns: [`clip_length_accepted`](#clip_length_accepted) — `{ type: "clip_length_accepted", frames: 0, clip_seconds: 0 }` (or `undefined` when the
|
|
626
|
+
Returns: [`clip_length_accepted`](#clip_length_accepted) — `{ type: "clip_length_accepted", frames: 0, clip_seconds: 0 }` (or `undefined` when the command failed or was refused — see [Refused commands](#refused-commands)).
|
|
605
627
|
|
|
606
628
|
| Parameter | Type | Description |
|
|
607
629
|
|---|---|---|
|
|
@@ -639,7 +661,7 @@ function Example() {
|
|
|
639
661
|
|
|
640
662
|
Set whether the stream cuts to black when a clip ends, is stopped, or a non-continuing clip follows it. On (the default) those boundaries flush to black at once. Off, the stream holds the last frame instead — [`stop`](#stop) then drains what the transport already holds (up to a couple of seconds) before the picture freezes, rather than snapping to black. Either way, autoplay chains a clip whose `continue_from_clip_id` names the clip just finished with no cut at all, and [`reset`](#reset) always clears the tracks. Takes effect at the next boundary and lasts for the session. Emits [`flush_accepted`](#flush_accepted) and [`state_update`](#state_update).
|
|
641
663
|
|
|
642
|
-
Returns: [`flush_accepted`](#flush_accepted) — `{ type: "flush_accepted", enabled: true }` (or `undefined` when the
|
|
664
|
+
Returns: [`flush_accepted`](#flush_accepted) — `{ type: "flush_accepted", enabled: true }` (or `undefined` when the command failed or was refused — see [Refused commands](#refused-commands)).
|
|
643
665
|
|
|
644
666
|
| Parameter | Type | Description |
|
|
645
667
|
|---|---|---|
|
|
@@ -1083,7 +1105,11 @@ useFastH3ClipFinished((msg) => {
|
|
|
1083
1105
|
|
|
1084
1106
|
### `command_error`
|
|
1085
1107
|
|
|
1086
|
-
Emitted when a command is rejected. The command had no effect.
|
|
1108
|
+
Emitted to every client when a command is rejected. The command had no effect.
|
|
1109
|
+
|
|
1110
|
+
The rejected call itself also fails, with the same reason and a stable
|
|
1111
|
+
error code. Read the failure on the call; this broadcast stays until the
|
|
1112
|
+
next major release.
|
|
1087
1113
|
|
|
1088
1114
|
Listener: `onCommandError` · React hook: `useFastH3CommandError`
|
|
1089
1115
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FastH3Tracks,
|
|
3
3
|
MODEL_NAME
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XXLA5OAS.mjs";
|
|
5
5
|
|
|
6
6
|
// src/react.tsx
|
|
7
7
|
import {
|
|
@@ -298,4 +298,4 @@ export {
|
|
|
298
298
|
useFastH3Track,
|
|
299
299
|
FastH3MainVideoView
|
|
300
300
|
};
|
|
301
|
-
//# sourceMappingURL=chunk-
|
|
301
|
+
//# sourceMappingURL=chunk-CQBNH4KP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react.tsx"],"sourcesContent":["// Copyright (c) 2026 Reactor Technologies, Inc. All rights reserved.\n\n// Auto-generated by @reactor-team/codegen — DO NOT EDIT\n// Model: fast-h3 v1.9.1\n\n\"use client\";\n\nimport { type ReactElement } from \"react\";\nimport {\n ReactorProvider,\n useReactor,\n useReactorMessage,\n ReactorView,\n type ReactorViewProps,\n} from \"@reactor-team/js-sdk\";\nimport {\n MODEL_NAME,\n FastH3Tracks,\n type FastH3Options,\n type FastH3PopParams,\n type FastH3MoveParams,\n type FastH3PlayParams,\n type FastH3EnqueueParams,\n type FastH3SetSeedParams,\n type FastH3SetCanvasParams,\n type FastH3SetAutoplayParams,\n type FastH3SetClipSecondsParams,\n type FastH3SetFlushOnClipEndParams,\n type FastH3Message,\n type FastH3ClipMovedMessage,\n type FastH3ClipFailedMessage,\n type FastH3ClipPoppedMessage,\n type FastH3ClipQueuedMessage,\n type FastH3ClipStartedMessage,\n type FastH3ClipStoppedMessage,\n type FastH3QueueUpdateMessage,\n type FastH3StateUpdateMessage,\n type FastH3ClipFinishedMessage,\n type FastH3CommandErrorMessage,\n type FastH3SeedAcceptedMessage,\n type FastH3SessionResetMessage,\n type FastH3ClipGeneratedMessage,\n type FastH3FlushAcceptedMessage,\n type FastH3CanvasAcceptedMessage,\n type FastH3AutoplayAcceptedMessage,\n type FastH3ClipLengthAcceptedMessage,\n type FastH3RecvTrackName,\n} from \"./core.js\";\n\n/**\n * @internal Flatten the `{ type, data, uploads? }` envelope the SDK\n * hands to `reactor.on(\"message\", …)` so a field the model schema\n * declares on a message is reachable at `msg.<field>` — matching the\n * shape the exported message interfaces promise.\n */\nfunction _unwrapMessage<T>(raw: unknown): T {\n const env = raw as { type?: string; data?: Record<string, unknown> };\n if (\n env &&\n typeof env === \"object\" &&\n env.data &&\n typeof env.data === \"object\"\n ) {\n return { ...env.data, type: env.type } as T;\n }\n return raw as T;\n}\n\n/**\n * Props for the {@link FastH3Provider} component.\n *\n * Derived from `ReactorProvider`'s own props, with `modelName` and\n * `modelTracks` stripped — those are supplied by this provider.\n */\nexport type FastH3ProviderProps = Omit<\n Parameters<typeof ReactorProvider>[0],\n \"modelName\" | \"modelTracks\"\n>;\n\n/**\n * Provider for the FastH3 model.\n *\n * Wraps {@link ReactorProvider} with `modelName` and `modelTracks` pre-configured from the\n * generated constants. Drop this near the top of your tree, then use\n * {@link useFastH3} and the `useFastH3<Message>` hooks below it.\n */\nexport function FastH3Provider({\n children,\n ...rest\n}: FastH3ProviderProps): ReactElement {\n return (\n <ReactorProvider\n {...rest}\n modelName={MODEL_NAME}\n modelTracks={[...FastH3Tracks]}\n >\n {children}\n </ReactorProvider>\n );\n}\n\n/**\n * Access the FastH3 model as typed commands bound to the nearest\n * {@link FastH3Provider}.\n *\n * Returns the full action surface — every public field on the SDK's\n * `ReactorStore` (`status`, `sessionId`, `connect`, `disconnect`,\n * `sendCommand`, `uploadFile`, `publish`, `unpublish`, `reconnect`,\n * …) is exposed automatically, alongside one typed method per\n * model event.\n *\n * Fields are pulled off the store one at a time so Zustand's\n * shallow-equality selector keeps each subscription scoped — a\n * component reading only `status` doesn't re-render when\n * `lastError` changes. Future SDK releases that add new\n * store fields flow into this hook on the next codegen run with no\n * hand-edit (the field list is derived from `js-sdk`'s d.ts via\n * `loadReactorStoreFieldsFromDts` in `sdk-surface.ts`).\n *\n * Each typed event method resolves with the command's correlated\n * reply: the declared reply message for commands that return one,\n * `undefined` once the handler completes for commands that don't.\n * A failed or refused command resolves `undefined` and never rejects;\n * its error lands in `lastError` with `operation: \"sendCommand\"` and,\n * for a refusal, the model's `code`. The store keeps the latest error until\n * the next one, so do not render a command failure as a connection\n * error.\n */\nexport function useFastH3() {\n const connect = useReactor((s) => s.connect);\n const connectOptions = useReactor((s) => s.connectOptions);\n const disconnect = useReactor((s) => s.disconnect);\n const downloadClipAsFile = useReactor((s) => s.downloadClipAsFile);\n const jwtToken = useReactor((s) => s.jwtToken);\n const lastError = useReactor((s) => s.lastError);\n const lastMessage = useReactor((s) => s.lastMessage);\n const pauseTrack = useReactor((s) => s.pauseTrack);\n const publish = useReactor((s) => s.publish);\n const reconnect = useReactor((s) => s.reconnect);\n const requestClip = useReactor((s) => s.requestClip);\n const requestRecording = useReactor((s) => s.requestRecording);\n const resumeTrack = useReactor((s) => s.resumeTrack);\n const sendCommand = useReactor((s) => s.sendCommand);\n const sessionId = useReactor((s) => s.sessionId);\n const status = useReactor((s) => s.status);\n const tracks = useReactor((s) => s.tracks);\n const unpublish = useReactor((s) => s.unpublish);\n const uploadFile = useReactor((s) => s.uploadFile);\n\n return {\n connect,\n connectOptions,\n disconnect,\n downloadClipAsFile,\n jwtToken,\n lastError,\n lastMessage,\n pauseTrack,\n publish,\n reconnect,\n requestClip,\n requestRecording,\n resumeTrack,\n sendCommand,\n sessionId,\n status,\n tracks,\n unpublish,\n uploadFile,\n pop: async (params: FastH3PopParams): Promise<FastH3ClipPoppedMessage | undefined> => {\n const reply = await sendCommand(\"pop\", params);\n return reply === undefined ? undefined : _unwrapMessage<FastH3ClipPoppedMessage>(reply);\n },\n move: async (params: FastH3MoveParams): Promise<FastH3ClipMovedMessage | undefined> => {\n const reply = await sendCommand(\"move\", params);\n return reply === undefined ? undefined : _unwrapMessage<FastH3ClipMovedMessage>(reply);\n },\n play: async (params: FastH3PlayParams): Promise<undefined> => {\n await sendCommand(\"play\", params);\n return undefined;\n },\n stop: async (): Promise<undefined> => {\n await sendCommand(\"stop\", {});\n return undefined;\n },\n reset: async (): Promise<FastH3SessionResetMessage | undefined> => {\n const reply = await sendCommand(\"reset\", {});\n return reply === undefined ? undefined : _unwrapMessage<FastH3SessionResetMessage>(reply);\n },\n enqueue: async (params: FastH3EnqueueParams): Promise<FastH3ClipQueuedMessage | undefined> => {\n const reply = await sendCommand(\"enqueue\", params);\n return reply === undefined ? undefined : _unwrapMessage<FastH3ClipQueuedMessage>(reply);\n },\n setSeed: async (params: FastH3SetSeedParams): Promise<FastH3SeedAcceptedMessage | undefined> => {\n const reply = await sendCommand(\"set_seed\", params);\n return reply === undefined ? undefined : _unwrapMessage<FastH3SeedAcceptedMessage>(reply);\n },\n getQueue: async (): Promise<FastH3QueueUpdateMessage | undefined> => {\n const reply = await sendCommand(\"get_queue\", {});\n return reply === undefined ? undefined : _unwrapMessage<FastH3QueueUpdateMessage>(reply);\n },\n getState: async (): Promise<FastH3StateUpdateMessage | undefined> => {\n const reply = await sendCommand(\"get_state\", {});\n return reply === undefined ? undefined : _unwrapMessage<FastH3StateUpdateMessage>(reply);\n },\n setCanvas: async (params: FastH3SetCanvasParams): Promise<FastH3CanvasAcceptedMessage | undefined> => {\n const reply = await sendCommand(\"set_canvas\", params);\n return reply === undefined ? undefined : _unwrapMessage<FastH3CanvasAcceptedMessage>(reply);\n },\n setAutoplay: async (params: FastH3SetAutoplayParams): Promise<FastH3AutoplayAcceptedMessage | undefined> => {\n const reply = await sendCommand(\"set_autoplay\", params);\n return reply === undefined ? undefined : _unwrapMessage<FastH3AutoplayAcceptedMessage>(reply);\n },\n setClipSeconds: async (params: FastH3SetClipSecondsParams): Promise<FastH3ClipLengthAcceptedMessage | undefined> => {\n const reply = await sendCommand(\"set_clip_seconds\", params);\n return reply === undefined ? undefined : _unwrapMessage<FastH3ClipLengthAcceptedMessage>(reply);\n },\n setFlushOnClipEnd: async (params: FastH3SetFlushOnClipEndParams): Promise<FastH3FlushAcceptedMessage | undefined> => {\n const reply = await sendCommand(\"set_flush_on_clip_end\", params);\n return reply === undefined ? undefined : _unwrapMessage<FastH3FlushAcceptedMessage>(reply);\n },\n };\n}\n\n/**\n * Subscribe to any FastH3 message with a fully-typed handler.\n * The handler receives a discriminated FastH3Message.\n */\nexport function useFastH3Message(\n handler: (message: FastH3Message) => void,\n): void {\n useReactorMessage((msg: unknown) =>\n handler(_unwrapMessage<FastH3Message>(msg)),\n );\n}\n\n/**\n * Subscribe to \"clip_moved\" messages only.\n * Handler receives a fully-typed FastH3ClipMovedMessage.\n */\nexport function useFastH3ClipMoved(\n handler: (message: FastH3ClipMovedMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"clip_moved\") {\n handler(m as FastH3ClipMovedMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"clip_failed\" messages only.\n * Handler receives a fully-typed FastH3ClipFailedMessage.\n */\nexport function useFastH3ClipFailed(\n handler: (message: FastH3ClipFailedMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"clip_failed\") {\n handler(m as FastH3ClipFailedMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"clip_popped\" messages only.\n * Handler receives a fully-typed FastH3ClipPoppedMessage.\n */\nexport function useFastH3ClipPopped(\n handler: (message: FastH3ClipPoppedMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"clip_popped\") {\n handler(m as FastH3ClipPoppedMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"clip_queued\" messages only.\n * Handler receives a fully-typed FastH3ClipQueuedMessage.\n */\nexport function useFastH3ClipQueued(\n handler: (message: FastH3ClipQueuedMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"clip_queued\") {\n handler(m as FastH3ClipQueuedMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"clip_started\" messages only.\n * Handler receives a fully-typed FastH3ClipStartedMessage.\n */\nexport function useFastH3ClipStarted(\n handler: (message: FastH3ClipStartedMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"clip_started\") {\n handler(m as FastH3ClipStartedMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"clip_stopped\" messages only.\n * Handler receives a fully-typed FastH3ClipStoppedMessage.\n */\nexport function useFastH3ClipStopped(\n handler: (message: FastH3ClipStoppedMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"clip_stopped\") {\n handler(m as FastH3ClipStoppedMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"queue_update\" messages only.\n * Handler receives a fully-typed FastH3QueueUpdateMessage.\n */\nexport function useFastH3QueueUpdate(\n handler: (message: FastH3QueueUpdateMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"queue_update\") {\n handler(m as FastH3QueueUpdateMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"state_update\" messages only.\n * Handler receives a fully-typed FastH3StateUpdateMessage.\n */\nexport function useFastH3StateUpdate(\n handler: (message: FastH3StateUpdateMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"state_update\") {\n handler(m as FastH3StateUpdateMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"clip_finished\" messages only.\n * Handler receives a fully-typed FastH3ClipFinishedMessage.\n */\nexport function useFastH3ClipFinished(\n handler: (message: FastH3ClipFinishedMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"clip_finished\") {\n handler(m as FastH3ClipFinishedMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"command_error\" messages only.\n * Handler receives a fully-typed FastH3CommandErrorMessage.\n */\nexport function useFastH3CommandError(\n handler: (message: FastH3CommandErrorMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"command_error\") {\n handler(m as FastH3CommandErrorMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"seed_accepted\" messages only.\n * Handler receives a fully-typed FastH3SeedAcceptedMessage.\n */\nexport function useFastH3SeedAccepted(\n handler: (message: FastH3SeedAcceptedMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"seed_accepted\") {\n handler(m as FastH3SeedAcceptedMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"session_reset\" messages only.\n * Handler receives a fully-typed FastH3SessionResetMessage.\n */\nexport function useFastH3SessionReset(\n handler: (message: FastH3SessionResetMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"session_reset\") {\n handler(m as FastH3SessionResetMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"clip_generated\" messages only.\n * Handler receives a fully-typed FastH3ClipGeneratedMessage.\n */\nexport function useFastH3ClipGenerated(\n handler: (message: FastH3ClipGeneratedMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"clip_generated\") {\n handler(m as FastH3ClipGeneratedMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"flush_accepted\" messages only.\n * Handler receives a fully-typed FastH3FlushAcceptedMessage.\n */\nexport function useFastH3FlushAccepted(\n handler: (message: FastH3FlushAcceptedMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"flush_accepted\") {\n handler(m as FastH3FlushAcceptedMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"canvas_accepted\" messages only.\n * Handler receives a fully-typed FastH3CanvasAcceptedMessage.\n */\nexport function useFastH3CanvasAccepted(\n handler: (message: FastH3CanvasAcceptedMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"canvas_accepted\") {\n handler(m as FastH3CanvasAcceptedMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"autoplay_accepted\" messages only.\n * Handler receives a fully-typed FastH3AutoplayAcceptedMessage.\n */\nexport function useFastH3AutoplayAccepted(\n handler: (message: FastH3AutoplayAcceptedMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"autoplay_accepted\") {\n handler(m as FastH3AutoplayAcceptedMessage);\n }\n });\n}\n\n/**\n * Subscribe to \"clip_length_accepted\" messages only.\n * Handler receives a fully-typed FastH3ClipLengthAcceptedMessage.\n */\nexport function useFastH3ClipLengthAccepted(\n handler: (message: FastH3ClipLengthAcceptedMessage) => void,\n): void {\n useReactorMessage((msg: unknown) => {\n const m = _unwrapMessage<FastH3Message>(msg);\n if (m.type === \"clip_length_accepted\") {\n handler(m as FastH3ClipLengthAcceptedMessage);\n }\n });\n}\n\n/**\n * Subscribe to a recvonly MediaStreamTrack the model publishes, by name.\n *\n * Returns `undefined` until the model emits the track, then the live track for the lifetime of the connection. `name` is constrained to the model's declared recvonly channels — use one of `FastH3RecvTrackName`.\n * @param name - A recvonly track name declared by the model\n * @returns The live MediaStreamTrack, or `undefined` until received\n */\nexport function useFastH3Track(\n name: FastH3RecvTrackName,\n): MediaStreamTrack | undefined {\n return useReactor((s) => s.tracks[name]);\n}\n\nexport type FastH3MainVideoViewProps = Omit<ReactorViewProps, \"track\">;\n\n/**\n * Render the model's \"main_video\" recvonly video track in a `<video>` element.\n *\n * Thin wrapper around `<ReactorView>` with `track` pre-bound. Accepts every other `ReactorViewProps` (`audioTrack`, `className`, `style`, `videoObjectFit`, `muted`, …). Must be rendered inside `<FastH3Provider>`.\n */\nexport function FastH3MainVideoView(\n props: FastH3MainVideoViewProps,\n): ReactElement {\n return <ReactorView {...props} track=\"main_video\" />;\n}\n"],"mappings":";;;;;;AAQA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AA6EH;AApCJ,SAAS,eAAkB,KAAiB;AAC1C,QAAM,MAAM;AACZ,MACE,OACA,OAAO,QAAQ,YACf,IAAI,QACJ,OAAO,IAAI,SAAS,UACpB;AACA,WAAO,EAAE,GAAG,IAAI,MAAM,MAAM,IAAI,KAAK;AAAA,EACvC;AACA,SAAO;AACT;AAoBO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA,GAAG;AACL,GAAsC;AACpC,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,WAAW;AAAA,MACX,aAAa,CAAC,GAAG,YAAY;AAAA,MAE5B;AAAA;AAAA,EACH;AAEJ;AA6BO,SAAS,YAAY;AAC1B,QAAM,UAAU,WAAW,CAAC,MAAM,EAAE,OAAO;AAC3C,Q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8B,GAAG;AAC3C,QAAI,EAAE,SAAS,kBAAkB;AAC/B,cAAQ,CAA+B;AAAA,IACzC;AAAA,EACF,CAAC;AACH;AAMO,SAAS,uBACd,SACM;AACN,oBAAkB,CAAC,QAAiB;AAClC,UAAM,IAAI,eAA8B,GAAG;AAC3C,QAAI,EAAE,SAAS,kBAAkB;AAC/B,cAAQ,CAA+B;AAAA,IACzC;AAAA,EACF,CAAC;AACH;AAMO,SAAS,wBACd,SACM;AACN,oBAAkB,CAAC,QAAiB;AAClC,UAAM,IAAI,eAA8B,GAAG;AAC3C,QAAI,EAAE,SAAS,mBAAmB;AAChC,cAAQ,CAAgC;AAAA,IAC1C;AAAA,EACF,CAAC;AACH;AAMO,SAAS,0BACd,SACM;AACN,oBAAkB,CAAC,QAAiB;AAClC,UAAM,IAAI,eAA8B,GAAG;AAC3C,QAAI,EAAE,SAAS,qBAAqB;AAClC,cAAQ,CAAkC;AAAA,IAC5C;AAAA,EACF,CAAC;AACH;AAMO,SAAS,4BACd,SACM;AACN,oBAAkB,CAAC,QAAiB;AAClC,UAAM,IAAI,eAA8B,GAAG;AAC3C,QAAI,EAAE,SAAS,wBAAwB;AACrC,cAAQ,CAAoC;AAAA,IAC9C;AAAA,EACF,CAAC;AACH;AASO,SAAS,eACd,MAC8B;AAC9B,SAAO,WAAW,CAAC,MAAM,EAAE,OAAO,IAAI,CAAC;AACzC;AASO,SAAS,oBACd,OACc;AACd,SAAO,oBAAC,eAAa,GAAG,OAAO,OAAM,cAAa;AACpD;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/core.ts
|
|
2
2
|
import { Reactor, FileRef } from "@reactor-team/js-sdk";
|
|
3
3
|
var MODEL_NAME = "reactor/fast-h3";
|
|
4
|
-
var MODEL_VERSION = "v1.
|
|
4
|
+
var MODEL_VERSION = "v1.9.1";
|
|
5
5
|
var FastH3Tracks = [
|
|
6
6
|
{ name: "main_video", kind: "video", direction: "recvonly" },
|
|
7
7
|
{ name: "main_audio", kind: "audio", direction: "recvonly" }
|
|
@@ -26,35 +26,35 @@ var FastH3Model = class extends Reactor {
|
|
|
26
26
|
return this;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Remove one clip by its UUID from whichever queue holds it, freeing its slot. Works on generating and built clips alike; a build already running for it is discarded when it completes. The clip that is playing is in neither queue — `stop` is the command that cuts it. A built clip stays in `queue_update.history` after popping, so clips referencing its frame are unaffected; an unbuilt clip that queued clips reference is refused, since popping it would leave them without an endpoint — pop those first. Emits `clip_popped`, `queue_update` and `state_update
|
|
30
|
-
* @param params - Remove one clip by its UUID from whichever queue holds it, freeing its slot. Works on generating and built clips alike; a build already running for it is discarded when it completes. The clip that is playing is in neither queue — `stop` is the command that cuts it. A built clip stays in `queue_update.history` after popping, so clips referencing its frame are unaffected; an unbuilt clip that queued clips reference is refused, since popping it would leave them without an endpoint — pop those first. Emits `clip_popped`, `queue_update` and `state_update
|
|
31
|
-
* @returns The correlated {@link FastH3ClipPoppedMessage} reply, or `undefined` when the
|
|
29
|
+
* Remove one clip by its UUID from whichever queue holds it, freeing its slot. Works on generating and built clips alike; a build already running for it is discarded when it completes. The clip that is playing is in neither queue — `stop` is the command that cuts it. A built clip stays in `queue_update.history` after popping, so clips referencing its frame are unaffected; an unbuilt clip that queued clips reference is refused, since popping it would leave them without an endpoint — pop those first. Emits `clip_popped`, `queue_update` and `state_update`. A refusal fails the call with a code and is also broadcast as `command_error`: `unknown_clip` when no queued clip has that id, `clip_referenced` when queued clips still reference its last frame.
|
|
30
|
+
* @param params - Remove one clip by its UUID from whichever queue holds it, freeing its slot. Works on generating and built clips alike; a build already running for it is discarded when it completes. The clip that is playing is in neither queue — `stop` is the command that cuts it. A built clip stays in `queue_update.history` after popping, so clips referencing its frame are unaffected; an unbuilt clip that queued clips reference is refused, since popping it would leave them without an endpoint — pop those first. Emits `clip_popped`, `queue_update` and `state_update`. A refusal fails the call with a code and is also broadcast as `command_error`: `unknown_clip` when no queued clip has that id, `clip_referenced` when queued clips still reference its last frame.
|
|
31
|
+
* @returns The correlated {@link FastH3ClipPoppedMessage} reply, or `undefined` when the command failed or the model refused it. The call never rejects: the failure arrives on the `error` event (and `getLastError()`) with `operation: "sendCommand"` and, for a refusal, the model's `code`.
|
|
32
32
|
*/
|
|
33
33
|
async pop(params) {
|
|
34
34
|
const reply = await this.sendCommand("pop", params);
|
|
35
35
|
return reply === void 0 ? void 0 : _unwrapMessage(reply);
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
* Reposition one clip within the queue that holds it — the generation queue for a clip still to build, the playout queue for a built one; clips never move between queues except by building. `position` 0 is the front: the next build, or what bare `play` and autoplay take next. Values past the end mean the back. Replies `clip_moved` with the queue and the resulting position, and emits `queue_update
|
|
39
|
-
* @param params - Reposition one clip within the queue that holds it — the generation queue for a clip still to build, the playout queue for a built one; clips never move between queues except by building. `position` 0 is the front: the next build, or what bare `play` and autoplay take next. Values past the end mean the back. Replies `clip_moved` with the queue and the resulting position, and emits `queue_update
|
|
40
|
-
* @returns The correlated {@link FastH3ClipMovedMessage} reply, or `undefined` when the
|
|
38
|
+
* Reposition one clip within the queue that holds it — the generation queue for a clip still to build, the playout queue for a built one; clips never move between queues except by building. `position` 0 is the front: the next build, or what bare `play` and autoplay take next. Values past the end mean the back. Replies `clip_moved` with the queue and the resulting position, and emits `queue_update`. Fails the call with `unknown_clip`, also broadcast as `command_error`, when no queued clip has that id.
|
|
39
|
+
* @param params - Reposition one clip within the queue that holds it — the generation queue for a clip still to build, the playout queue for a built one; clips never move between queues except by building. `position` 0 is the front: the next build, or what bare `play` and autoplay take next. Values past the end mean the back. Replies `clip_moved` with the queue and the resulting position, and emits `queue_update`. Fails the call with `unknown_clip`, also broadcast as `command_error`, when no queued clip has that id.
|
|
40
|
+
* @returns The correlated {@link FastH3ClipMovedMessage} reply, or `undefined` when the command failed or the model refused it. The call never rejects: the failure arrives on the `error` event (and `getLastError()`) with `operation: "sendCommand"` and, for a refusal, the model's `code`.
|
|
41
41
|
*/
|
|
42
42
|
async move(params) {
|
|
43
43
|
const reply = await this.sendCommand("move", params);
|
|
44
44
|
return reply === void 0 ? void 0 : _unwrapMessage(reply);
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* Play one clip from the playout queue. Blank `clip_id` plays the front clip; a UUID plays that specific one. Playing consumes the entry: it leaves the queue, `clip_started` marks its first frames, and when it ends the stream holds on black until the next `play`. Emits `queue_update` and `state_update
|
|
48
|
-
* @param params - Play one clip from the playout queue. Blank `clip_id` plays the front clip; a UUID plays that specific one. Playing consumes the entry: it leaves the queue, `clip_started` marks its first frames, and when it ends the stream holds on black until the next `play`. Emits `queue_update` and `state_update
|
|
49
|
-
* @returns
|
|
47
|
+
* Play one clip from the playout queue. Blank `clip_id` plays the front clip; a UUID plays that specific one. Playing consumes the entry: it leaves the queue, `clip_started` marks its first frames, and when it ends the stream holds on black until the next `play`. Emits `queue_update` and `state_update`. A refusal fails the call with a code and is also broadcast as `command_error`: `already_playing`, `unknown_clip` for an unknown id, `clip_not_ready` while the clip is still generating, and `no_ready_clip` when the playout queue is empty.
|
|
48
|
+
* @param params - Play one clip from the playout queue. Blank `clip_id` plays the front clip; a UUID plays that specific one. Playing consumes the entry: it leaves the queue, `clip_started` marks its first frames, and when it ends the stream holds on black until the next `play`. Emits `queue_update` and `state_update`. A refusal fails the call with a code and is also broadcast as `command_error`: `already_playing`, `unknown_clip` for an unknown id, `clip_not_ready` while the clip is still generating, and `no_ready_clip` when the playout queue is empty.
|
|
49
|
+
* @returns `undefined` once the model's handler has completed. This command declares no reply, so a refusal also resolves `undefined`: only the `error` event (with `operation: "sendCommand"` and the model's `code`) tells the two apart.
|
|
50
50
|
*/
|
|
51
51
|
async play(params) {
|
|
52
52
|
await this.sendCommand("play", params);
|
|
53
53
|
return void 0;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* Cut the clip that is playing. Whatever is queued on the output tracks is dropped and the picture goes to black within a fraction of a second (with `set_flush_on_clip_end` off, the transport drains what it holds and freezes on the last frame instead), and the session is back where a finished clip leaves it — the queue is untouched and the next `play` starts clean. With autoplay on this acts as a skip: the next ready clip starts on its own, so send `set_autoplay` off first to hold the stream. Emits `clip_stopped` and `state_update`,
|
|
57
|
-
* @returns
|
|
56
|
+
* Cut the clip that is playing. Whatever is queued on the output tracks is dropped and the picture goes to black within a fraction of a second (with `set_flush_on_clip_end` off, the transport drains what it holds and freezes on the last frame instead), and the session is back where a finished clip leaves it — the queue is untouched and the next `play` starts clean. With autoplay on this acts as a skip: the next ready clip starts on its own, so send `set_autoplay` off first to hold the stream. Emits `clip_stopped` and `state_update`. Fails the call with `not_playing`, also broadcast as `command_error`, when no clip is playing.
|
|
57
|
+
* @returns `undefined` once the model's handler has completed. This command declares no reply, so a refusal also resolves `undefined`: only the `error` event (with `operation: "sendCommand"` and the model's `code`) tells the two apart.
|
|
58
58
|
*/
|
|
59
59
|
async stop() {
|
|
60
60
|
await this.sendCommand("stop", {});
|
|
@@ -62,16 +62,16 @@ var FastH3Model = class extends Reactor {
|
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Return every condition to its default, drop both queues' clips and the retained history, and clear the output tracks. A clip that is playing is cut, with a `clip_stopped` to mark it. Valid at any time. Replies `session_reset` and emits `queue_update` and `state_update`.
|
|
65
|
-
* @returns The correlated {@link FastH3SessionResetMessage} reply, or `undefined` when the
|
|
65
|
+
* @returns The correlated {@link FastH3SessionResetMessage} reply, or `undefined` when the command failed or the model refused it. The call never rejects: the failure arrives on the `error` event (and `getLastError()`) with `operation: "sendCommand"` and, for a refusal, the model's `code`.
|
|
66
66
|
*/
|
|
67
67
|
async reset() {
|
|
68
68
|
const reply = await this.sendCommand("reset", {});
|
|
69
69
|
return reply === void 0 ? void 0 : _unwrapMessage(reply);
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
|
-
* Queue one clip generation. The clip enters the generation queue (at `position`, or the back), builds when its turn comes, and then joins the back of the playout queue, announced by `clip_generated`. The prompt is what the clip will show; the metadata is an opaque string echoed back on every message that references the clip, for frontends to carry their own tracking data. The clip opens from text alone, from an uploaded still (`starting_frame` — the image animates forward), or from an existing clip's last frame (`continue_from_clip_id` — any clip in the queues or in `queue_update.history`); a continued clip simply waits its turn until its source is built, wherever the two sit in the queue. An uploaded `ending_frame` or a generated clip's clean last frame (`ending_from_clip_id`) can accompany any opener — or stand alone — to make the clip animate *into* and close on that image. Set both clip-id fields to the same UUID to leave and return to one generated frame. The clip's canvas is the session's; its length is the `seconds` passed here (snapped to what the model can produce) or the session default, and its seed is the one passed here or the session's advancing default. Builds run through the queue in order; watch `queue_update` for the clip turning ready. Replies `clip_queued` with the clip's UUID and emits `queue_update` and `state_update
|
|
73
|
-
* @param params - Queue one clip generation. The clip enters the generation queue (at `position`, or the back), builds when its turn comes, and then joins the back of the playout queue, announced by `clip_generated`. The prompt is what the clip will show; the metadata is an opaque string echoed back on every message that references the clip, for frontends to carry their own tracking data. The clip opens from text alone, from an uploaded still (`starting_frame` — the image animates forward), or from an existing clip's last frame (`continue_from_clip_id` — any clip in the queues or in `queue_update.history`); a continued clip simply waits its turn until its source is built, wherever the two sit in the queue. An uploaded `ending_frame` or a generated clip's clean last frame (`ending_from_clip_id`) can accompany any opener — or stand alone — to make the clip animate *into* and close on that image. Set both clip-id fields to the same UUID to leave and return to one generated frame. The clip's canvas is the session's; its length is the `seconds` passed here (snapped to what the model can produce) or the session default, and its seed is the one passed here or the session's advancing default. Builds run through the queue in order; watch `queue_update` for the clip turning ready. Replies `clip_queued` with the clip's UUID and emits `queue_update` and `state_update
|
|
74
|
-
* @returns The correlated {@link FastH3ClipQueuedMessage} reply, or `undefined` when the
|
|
72
|
+
* Queue one clip generation. The clip enters the generation queue (at `position`, or the back), builds when its turn comes, and then joins the back of the playout queue, announced by `clip_generated`. The prompt is what the clip will show; the metadata is an opaque string echoed back on every message that references the clip, for frontends to carry their own tracking data. The clip opens from text alone, from an uploaded still (`starting_frame` — the image animates forward), or from an existing clip's last frame (`continue_from_clip_id` — any clip in the queues or in `queue_update.history`); a continued clip simply waits its turn until its source is built, wherever the two sit in the queue. An uploaded `ending_frame` or a generated clip's clean last frame (`ending_from_clip_id`) can accompany any opener — or stand alone — to make the clip animate *into* and close on that image. Set both clip-id fields to the same UUID to leave and return to one generated frame. The clip's canvas is the session's; its length is the `seconds` passed here (snapped to what the model can produce) or the session default, and its seed is the one passed here or the session's advancing default. Builds run through the queue in order; watch `queue_update` for the clip turning ready. Replies `clip_queued` with the clip's UUID and emits `queue_update` and `state_update`. A refusal fails the call with a code and is also broadcast as `command_error`: `queue_full` when the queue is full, `empty_prompt` or `prompt_too_long` when the prompt is empty or over the model's token budget, `invalid_request` when both a starting frame and a source clip, or both ending conditions, are given, `unknown_clip` when a source clip is unknown or no longer retained, and `invalid_image` when an upload is not a decodable image.
|
|
73
|
+
* @param params - Queue one clip generation. The clip enters the generation queue (at `position`, or the back), builds when its turn comes, and then joins the back of the playout queue, announced by `clip_generated`. The prompt is what the clip will show; the metadata is an opaque string echoed back on every message that references the clip, for frontends to carry their own tracking data. The clip opens from text alone, from an uploaded still (`starting_frame` — the image animates forward), or from an existing clip's last frame (`continue_from_clip_id` — any clip in the queues or in `queue_update.history`); a continued clip simply waits its turn until its source is built, wherever the two sit in the queue. An uploaded `ending_frame` or a generated clip's clean last frame (`ending_from_clip_id`) can accompany any opener — or stand alone — to make the clip animate *into* and close on that image. Set both clip-id fields to the same UUID to leave and return to one generated frame. The clip's canvas is the session's; its length is the `seconds` passed here (snapped to what the model can produce) or the session default, and its seed is the one passed here or the session's advancing default. Builds run through the queue in order; watch `queue_update` for the clip turning ready. Replies `clip_queued` with the clip's UUID and emits `queue_update` and `state_update`. A refusal fails the call with a code and is also broadcast as `command_error`: `queue_full` when the queue is full, `empty_prompt` or `prompt_too_long` when the prompt is empty or over the model's token budget, `invalid_request` when both a starting frame and a source clip, or both ending conditions, are given, `unknown_clip` when a source clip is unknown or no longer retained, and `invalid_image` when an upload is not a decodable image.
|
|
74
|
+
* @returns The correlated {@link FastH3ClipQueuedMessage} reply, or `undefined` when the command failed or the model refused it. The call never rejects: the failure arrives on the `error` event (and `getLastError()`) with `operation: "sendCommand"` and, for a refusal, the model's `code`.
|
|
75
75
|
*/
|
|
76
76
|
async enqueue(params) {
|
|
77
77
|
const reply = await this.sendCommand("enqueue", params);
|
|
@@ -80,7 +80,7 @@ var FastH3Model = class extends Reactor {
|
|
|
80
80
|
/**
|
|
81
81
|
* Set the default seed — the one an `enqueue` without a seed of its own uses, advancing it by one, so re-enqueuing the same prompts in the same order reproduces the same clips. Clips already in the queue keep the seed they were enqueued with. Valid at any time. Emits `seed_accepted` and `state_update`.
|
|
82
82
|
* @param params - Set the default seed — the one an `enqueue` without a seed of its own uses, advancing it by one, so re-enqueuing the same prompts in the same order reproduces the same clips. Clips already in the queue keep the seed they were enqueued with. Valid at any time. Emits `seed_accepted` and `state_update`.
|
|
83
|
-
* @returns The correlated {@link FastH3SeedAcceptedMessage} reply, or `undefined` when the
|
|
83
|
+
* @returns The correlated {@link FastH3SeedAcceptedMessage} reply, or `undefined` when the command failed or the model refused it. The call never rejects: the failure arrives on the `error` event (and `getLastError()`) with `operation: "sendCommand"` and, for a refusal, the model's `code`.
|
|
84
84
|
*/
|
|
85
85
|
async setSeed(params) {
|
|
86
86
|
const reply = await this.sendCommand("set_seed", params);
|
|
@@ -88,7 +88,7 @@ var FastH3Model = class extends Reactor {
|
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
90
|
* Return both queues' contents — `generation` (waiting to build) and `playout` (built, playable) — plus `history`, the built clips no longer queued that `continue_from_clip_id` or `ending_from_clip_id` can still name, every clip as its full structure. The same payload the model broadcasts as `queue_update`. Valid at any time.
|
|
91
|
-
* @returns The correlated {@link FastH3QueueUpdateMessage} reply, or `undefined` when the
|
|
91
|
+
* @returns The correlated {@link FastH3QueueUpdateMessage} reply, or `undefined` when the command failed or the model refused it. The call never rejects: the failure arrives on the `error` event (and `getLastError()`) with `operation: "sendCommand"` and, for a refusal, the model's `code`.
|
|
92
92
|
*/
|
|
93
93
|
async getQueue() {
|
|
94
94
|
const reply = await this.sendCommand("get_queue", {});
|
|
@@ -96,16 +96,16 @@ var FastH3Model = class extends Reactor {
|
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* Return a snapshot of everything the session exposes except the queue's contents (`get_queue` carries those): the conditions in force, what is playing, progress counters, and the commands that are valid right now. The same payload the model broadcasts as `state_update`. Valid at any time.
|
|
99
|
-
* @returns The correlated {@link FastH3StateUpdateMessage} reply, or `undefined` when the
|
|
99
|
+
* @returns The correlated {@link FastH3StateUpdateMessage} reply, or `undefined` when the command failed or the model refused it. The call never rejects: the failure arrives on the `error` event (and `getLastError()`) with `operation: "sendCommand"` and, for a refusal, the model's `code`.
|
|
100
100
|
*/
|
|
101
101
|
async getState() {
|
|
102
102
|
const reply = await this.sendCommand("get_state", {});
|
|
103
103
|
return reply === void 0 ? void 0 : _unwrapMessage(reply);
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
|
-
* Choose the aspect ratio of `main_video`. The video track keeps one size and queued clips are built at it, so this is only valid while the queue is empty and nothing is playing. Emits `canvas_accepted`, carrying the exact pixel size, and `state_update
|
|
107
|
-
* @param params - Choose the aspect ratio of `main_video`. The video track keeps one size and queued clips are built at it, so this is only valid while the queue is empty and nothing is playing. Emits `canvas_accepted`, carrying the exact pixel size, and `state_update
|
|
108
|
-
* @returns The correlated {@link FastH3CanvasAcceptedMessage} reply, or `undefined` when the
|
|
106
|
+
* Choose the aspect ratio of `main_video`. The video track keeps one size and queued clips are built at it, so this is only valid while the queue is empty and nothing is playing. Emits `canvas_accepted`, carrying the exact pixel size, and `state_update`. A refusal fails the call with a code and is also broadcast as `command_error`: `session_not_empty` while clips are queued or playing, `invalid_aspect` when the ratio is not one this model offers.
|
|
107
|
+
* @param params - Choose the aspect ratio of `main_video`. The video track keeps one size and queued clips are built at it, so this is only valid while the queue is empty and nothing is playing. Emits `canvas_accepted`, carrying the exact pixel size, and `state_update`. A refusal fails the call with a code and is also broadcast as `command_error`: `session_not_empty` while clips are queued or playing, `invalid_aspect` when the ratio is not one this model offers.
|
|
108
|
+
* @returns The correlated {@link FastH3CanvasAcceptedMessage} reply, or `undefined` when the command failed or the model refused it. The call never rejects: the failure arrives on the `error` event (and `getLastError()`) with `operation: "sendCommand"` and, for a refusal, the model's `code`.
|
|
109
109
|
*/
|
|
110
110
|
async setCanvas(params) {
|
|
111
111
|
const reply = await this.sendCommand("set_canvas", params);
|
|
@@ -114,7 +114,7 @@ var FastH3Model = class extends Reactor {
|
|
|
114
114
|
/**
|
|
115
115
|
* Turn autoplay on or off. On, the playout queue's front clip starts on its own whenever nothing is playing — right after a clip finishes, or the moment a build completes while the stream is idle — so a steadily fed queue plays through without a `play` per clip. Off (the default), the stream holds on black until an explicit `play`. Takes effect immediately and lasts for the session. Emits `autoplay_accepted` and `state_update`.
|
|
116
116
|
* @param params - Turn autoplay on or off. On, the playout queue's front clip starts on its own whenever nothing is playing — right after a clip finishes, or the moment a build completes while the stream is idle — so a steadily fed queue plays through without a `play` per clip. Off (the default), the stream holds on black until an explicit `play`. Takes effect immediately and lasts for the session. Emits `autoplay_accepted` and `state_update`.
|
|
117
|
-
* @returns The correlated {@link FastH3AutoplayAcceptedMessage} reply, or `undefined` when the
|
|
117
|
+
* @returns The correlated {@link FastH3AutoplayAcceptedMessage} reply, or `undefined` when the command failed or the model refused it. The call never rejects: the failure arrives on the `error` event (and `getLastError()`) with `operation: "sendCommand"` and, for a refusal, the model's `code`.
|
|
118
118
|
*/
|
|
119
119
|
async setAutoplay(params) {
|
|
120
120
|
const reply = await this.sendCommand("set_autoplay", params);
|
|
@@ -123,7 +123,7 @@ var FastH3Model = class extends Reactor {
|
|
|
123
123
|
/**
|
|
124
124
|
* Set the default length for enqueues that carry no `seconds` of their own. The value is snapped to the nearest length the model can produce, so read the effective one back from `clip_length_accepted`. Clips already in the queue keep the length they were enqueued with. Longer clips carry a scene further; shorter ones build faster. Valid at any time. Emits `clip_length_accepted` and `state_update`.
|
|
125
125
|
* @param params - Set the default length for enqueues that carry no `seconds` of their own. The value is snapped to the nearest length the model can produce, so read the effective one back from `clip_length_accepted`. Clips already in the queue keep the length they were enqueued with. Longer clips carry a scene further; shorter ones build faster. Valid at any time. Emits `clip_length_accepted` and `state_update`.
|
|
126
|
-
* @returns The correlated {@link FastH3ClipLengthAcceptedMessage} reply, or `undefined` when the
|
|
126
|
+
* @returns The correlated {@link FastH3ClipLengthAcceptedMessage} reply, or `undefined` when the command failed or the model refused it. The call never rejects: the failure arrives on the `error` event (and `getLastError()`) with `operation: "sendCommand"` and, for a refusal, the model's `code`.
|
|
127
127
|
*/
|
|
128
128
|
async setClipSeconds(params) {
|
|
129
129
|
const reply = await this.sendCommand("set_clip_seconds", params);
|
|
@@ -132,7 +132,7 @@ var FastH3Model = class extends Reactor {
|
|
|
132
132
|
/**
|
|
133
133
|
* Set whether the stream cuts to black when a clip ends, is stopped, or a non-continuing clip follows it. On (the default) those boundaries flush to black at once. Off, the stream holds the last frame instead — `stop` then drains what the transport already holds (up to a couple of seconds) before the picture freezes, rather than snapping to black. Either way, autoplay chains a clip whose `continue_from_clip_id` names the clip just finished with no cut at all, and `reset` always clears the tracks. Takes effect at the next boundary and lasts for the session. Emits `flush_accepted` and `state_update`.
|
|
134
134
|
* @param params - Set whether the stream cuts to black when a clip ends, is stopped, or a non-continuing clip follows it. On (the default) those boundaries flush to black at once. Off, the stream holds the last frame instead — `stop` then drains what the transport already holds (up to a couple of seconds) before the picture freezes, rather than snapping to black. Either way, autoplay chains a clip whose `continue_from_clip_id` names the clip just finished with no cut at all, and `reset` always clears the tracks. Takes effect at the next boundary and lasts for the session. Emits `flush_accepted` and `state_update`.
|
|
135
|
-
* @returns The correlated {@link FastH3FlushAcceptedMessage} reply, or `undefined` when the
|
|
135
|
+
* @returns The correlated {@link FastH3FlushAcceptedMessage} reply, or `undefined` when the command failed or the model refused it. The call never rejects: the failure arrives on the `error` event (and `getLastError()`) with `operation: "sendCommand"` and, for a refusal, the model's `code`.
|
|
136
136
|
*/
|
|
137
137
|
async setFlushOnClipEnd(params) {
|
|
138
138
|
const reply = await this.sendCommand("set_flush_on_clip_end", params);
|
|
@@ -340,4 +340,4 @@ export {
|
|
|
340
340
|
FastH3Tracks,
|
|
341
341
|
FastH3Model
|
|
342
342
|
};
|
|
343
|
-
//# sourceMappingURL=chunk-
|
|
343
|
+
//# sourceMappingURL=chunk-XXLA5OAS.mjs.map
|