@reactor-models/lingbot-world-2 0.2.5
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 +1084 -0
- package/dist/chunk-GS3BM4VC.mjs +247 -0
- package/dist/chunk-GS3BM4VC.mjs.map +1 -0
- package/dist/chunk-NTXVRMPF.mjs +205 -0
- package/dist/chunk-NTXVRMPF.mjs.map +1 -0
- package/dist/core.d.mts +370 -0
- package/dist/core.d.ts +370 -0
- package/dist/core.js +275 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +15 -0
- package/dist/core.mjs.map +1 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +485 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +49 -0
- package/dist/index.mjs.map +1 -0
- package/dist/react.d.mts +150 -0
- package/dist/react.d.ts +150 -0
- package/dist/react.js +244 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +39 -0
- package/dist/react.mjs.map +1 -0
- package/package.json +54 -0
package/dist/core.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core.ts"],"sourcesContent":["// Copyright (c) 2026 Reactor Technologies, Inc. All rights reserved.\n\n// Auto-generated by @reactor-team/codegen — DO NOT EDIT\n// Model: lingbot-world-2 v0.2.5\n\nimport { Reactor, FileRef } from \"@reactor-team/js-sdk\";\nexport { FileRef };\n\nexport const MODEL_NAME = \"reactor/lingbot-world-2\" as const;\nexport const MODEL_VERSION = \"v0.2.5\" as const;\n\n/**\n * Preset media tracks for the LingbotWorld2 model.\n *\n * Declared in the model's OpenAPI schema and passed to the SDK as\n * `modelTracks` so the transport can prepare the SDP offer in\n * parallel with session polling (faster first-frame latency).\n */\nexport const LingbotWorld2Tracks = [\n { name: \"main_video\", kind: \"video\", direction: \"recvonly\" },\n] as const;\n\n/** Track names the client can subscribe to (recvonly, from the client's perspective). */\nexport type LingbotWorld2RecvTrackName =\n \"main_video\";\n\n/** Set seed */\nexport interface LingbotWorld2SetSeedParams {\n /**\n * 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`.\n * @minimum 0\n * @default 42\n */\n\n seed?: number;\n}\n\n/** 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. */\nexport interface LingbotWorld2SetImageParams {\n /**\n * Reference to a file uploaded via the Reactor presigned-URL protocol.\n * @default null\n */\n\n image?: FileRef;\n}\n\n/** 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. */\nexport interface LingbotWorld2SetPromptParams {\n /**\n * 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.\n * @default \"\"\n */\n\n prompt?: string;\n}\n\n/** Set attn_window */\nexport interface LingbotWorld2SetAttnWindowParams {\n /**\n * Manual override for the DiT self-attention window. `auto` uses the motion-based still-window trigger (unchanged default behavior); `small` forces the still (small) window; `large` forces the moving (large) window. Can be changed at any time; the new value applies to the next chunk.\n * @default \"auto\"\n */\n\n attn_window?: \"auto\" | \"small\" | \"large\";\n}\n\n/** Set camera_pose */\nexport interface LingbotWorld2SetCameraPoseParams {\n /**\n * Native camera-pose layer: a flat list of per-frame motion deltas, length a multiple of 6 — `[rx, ry, rz, tx, ty, tz]` per frame (small Euler-radian rotation + translation, in the camera-local frame). 6 floats = one delta applied to the whole chunk; 6*chunk_size = one delta per latent frame; any other 6*k is resampled to chunk_size. When active, rotation OVERRIDES look_horizontal / look_vertical and translation ADDS to WASD movement. Inputs are sanitized (NaN/Inf→0, rotations clamped to ±pi, translation to ±100), so any payload is safe. Pass an empty list (or omit) to deactivate.\n * @maxLength 1536\n * @default null\n */\n\n camera_pose?: unknown[];\n}\n\n/** Set move_lateral */\nexport interface LingbotWorld2SetMoveLateralParams {\n /**\n * Lateral (strafe left/right) camera translation. `idle` holds position; `strafe_left` / `strafe_right` translate sideways. Independent of `move_longitudinal` — both can be active together for diagonal movement. Can be changed at any time; the new value applies to the next chunk.\n * @default \"idle\"\n */\n\n move_lateral?: \"idle\" | \"strafe_left\" | \"strafe_right\";\n}\n\n/** Set look_vertical */\nexport interface LingbotWorld2SetLookVerticalParams {\n /**\n * 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.\n * @default \"idle\"\n */\n\n look_vertical?: \"idle\" | \"up\" | \"down\";\n}\n\n/** Set look_horizontal */\nexport interface LingbotWorld2SetLookHorizontalParams {\n /**\n * 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.\n * @default \"idle\"\n */\n\n look_horizontal?: \"idle\" | \"left\" | \"right\";\n}\n\n/** Set move_longitudinal */\nexport interface LingbotWorld2SetMoveLongitudinalParams {\n /**\n * Longitudinal (forward/back) camera translation. `idle` holds position; `forward` / `back` translate along the look axis. Independent of `move_lateral` — both can be active together for diagonal movement. Can be changed at any time; the new value applies to the next chunk.\n * @default \"idle\"\n */\n\n move_longitudinal?: \"idle\" | \"forward\" | \"back\";\n}\n\n/** Set rotation_speed_deg */\nexport interface LingbotWorld2SetRotationSpeedDegParams {\n /**\n * 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.\n * @minimum 0\n * @maximum 30\n * @default 5\n */\n\n rotation_speed_deg?: number;\n}\n\n/**\n * Snapshot of the session's observable state.\n *\n * 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.\n */\nexport interface LingbotWorld2StateMessage {\n type: \"state\";\n /** 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`. */\n\n seed: number;\n /** True while generation is paused via `pause`. */\n\n paused: boolean;\n /** 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. */\n\n running: boolean;\n /** 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. */\n\n started: boolean;\n /** True once a reference image has been set for the session. */\n\n has_image: boolean;\n /** True once a prompt has been set for the session. */\n\n has_prompt: boolean;\n /** Current value of the `move_lateral` input field. */\n\n move_lateral: string;\n /** Zero-based index of the last completed chunk. `0` before the first chunk has completed, and resets to `0` on `reset`. */\n\n current_chunk: number;\n /** Current value of the `look_vertical` input field. */\n\n look_vertical: string;\n /** Composite action string derived from `move_longitudinal`, `move_lateral`, `look_horizontal`, and `look_vertical` — a `+`-joined combination of `w`/`s`/`a`/`d` and `left`/`right`/`up`/`down`, or `still` when idle. */\n\n current_action: string;\n /** The prompt currently driving generation, or `null` if no prompt has been set for the session. */\n\n current_prompt: unknown;\n /** Current value of the `look_horizontal` input field. */\n\n look_horizontal: string;\n /** Current value of the `move_longitudinal` input field. */\n\n move_longitudinal: string;\n /** True when a non-empty `camera_pose` has been set. */\n\n camera_pose_active: boolean;\n /** Current value of the `rotation_speed_deg` input field (0.0 – 30.0). */\n\n rotation_speed_deg: number;\n}\n\n/** Emitted when a command is rejected because preconditions are not met or its arguments could not be processed. */\nexport interface LingbotWorld2CommandErrorMessage {\n type: \"command_error\";\n /** Human-readable explanation of why the command was rejected. */\n\n reason: string;\n /** Name of the command that was rejected. */\n\n command: string;\n}\n\n/** Emitted once per completed chunk of `main_video`. */\nexport interface LingbotWorld2ChunkCompleteMessage {\n type: \"chunk_complete\";\n /** Zero-based index of the chunk that just completed. */\n\n chunk_index: number;\n /** The composite action string used to drive this chunk — a `+`-joined combination of translation (`w`/`s`/`a`/`d`) and look directions (`left`/`right`/`up`/`down`), or `still` when the camera is stationary. */\n\n active_action: string;\n /** The prompt that was active while this chunk was generated. */\n\n active_prompt: string;\n /** Number of pixel frames emitted by this chunk. */\n\n frames_emitted: number;\n}\n\n/** Emitted after `set_image` successfully decodes the uploaded file. */\nexport interface LingbotWorld2ImageAcceptedMessage {\n type: \"image_accepted\";\n /** Width in pixels of the decoded reference image. */\n\n width: number;\n /** Height in pixels of the decoded reference image. */\n\n height: number;\n}\n\n/** Emitted after `set_prompt` is accepted. */\nexport interface LingbotWorld2PromptAcceptedMessage {\n type: \"prompt_accepted\";\n /** The prompt text that was accepted. */\n\n prompt: string;\n}\n\n/** Emitted after `set_prompt` or `set_image` so the client can tell at a glance whether `start` will succeed. */\nexport interface LingbotWorld2ConditionsReadyMessage {\n type: \"conditions_ready\";\n /** True once a reference image has been set for the session. */\n\n has_image: boolean;\n /** True once a prompt has been set for the session. */\n\n has_prompt: boolean;\n}\n\n/** Emitted after `reset` clears session state and returns to the waiting state. */\nexport interface LingbotWorld2GenerationResetMessage {\n type: \"generation_reset\";\n /** Short human-readable reason the reset was issued. */\n\n reason: string;\n}\n\n/** Emitted in response to `pause`, once the current chunk finishes. */\nexport interface LingbotWorld2GenerationPausedMessage {\n type: \"generation_paused\";\n /** Index of the last completed chunk before pausing. */\n\n chunk_index: number;\n}\n\n/** Emitted in response to `resume` when leaving the paused state. */\nexport interface LingbotWorld2GenerationResumedMessage {\n type: \"generation_resumed\";\n /** Index of the last completed chunk before resuming. */\n\n chunk_index: number;\n}\n\n/** Emitted once when `start` succeeds and frames begin streaming. */\nexport interface LingbotWorld2GenerationStartedMessage {\n type: \"generation_started\";\n /** The prompt active at the start of generation. */\n\n prompt: string;\n /** Total number of chunks the run will produce before `generation_complete` fires. */\n\n chunk_num: number;\n /** Total number of pixel frames the run will emit on `main_video` before `generation_complete`. */\n\n frame_num: number;\n}\n\n/** 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. */\nexport interface LingbotWorld2GenerationCompleteMessage {\n type: \"generation_complete\";\n /** Total number of chunks produced by the run. */\n\n total_chunks: number;\n}\n\nexport type LingbotWorld2Message =\n | LingbotWorld2StateMessage\n | LingbotWorld2CommandErrorMessage\n | LingbotWorld2ChunkCompleteMessage\n | LingbotWorld2ImageAcceptedMessage\n | LingbotWorld2PromptAcceptedMessage\n | LingbotWorld2ConditionsReadyMessage\n | LingbotWorld2GenerationResetMessage\n | LingbotWorld2GenerationPausedMessage\n | LingbotWorld2GenerationResumedMessage\n | LingbotWorld2GenerationStartedMessage\n | LingbotWorld2GenerationCompleteMessage;\n\n/**\n * Options for creating a LingbotWorld2Model (model name is set automatically).\n *\n * Derived from `Reactor`'s own constructor options with `modelName`\n * and `modelTracks` removed — those are supplied by this class.\n * Any new option the SDK adds appears here automatically on the\n * next `defaultSdkVersion` bump.\n */\nexport type LingbotWorld2Options = Omit<\n ConstructorParameters<typeof Reactor>[0],\n \"modelName\" | \"modelTracks\"\n>;\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 * Strongly-typed client for the LingbotWorld2 model.\n *\n * Extends {@link Reactor} with the model name (and modelTracks) baked into the\n * constructor, so every public method on Reactor — `connect`, `disconnect`,\n * `sendCommand`, `on`/`off`, `getStats`, `publishTrack`/`unpublishTrack`,\n * etc. — is reachable directly on the instance. The schema-derived sugar\n * below adds typed wrappers for every declared event, message, and track.\n */\n\nexport class LingbotWorld2Model extends Reactor {\n constructor(options?: LingbotWorld2Options) {\n super({\n ...options,\n modelName: MODEL_NAME,\n modelTracks: [...LingbotWorld2Tracks],\n });\n }\n\n /** @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. */\n\n get reactor(): this {\n return this;\n }\n\n /** 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. */\n\n async pause(): Promise<void> {\n await this.sendCommand(\"pause\", {});\n }\n\n /** 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`. */\n\n async reset(): Promise<void> {\n await this.sendCommand(\"reset\", {});\n }\n\n /** 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. */\n\n async start(): Promise<void> {\n await this.sendCommand(\"start\", {});\n }\n\n /** 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. */\n\n async resume(): Promise<void> {\n await this.sendCommand(\"resume\", {});\n }\n\n /**\n * Set seed\n * @param params - Set seed\n */\n\n async setSeed(params: LingbotWorld2SetSeedParams): Promise<void> {\n await this.sendCommand(\"set_seed\", params);\n }\n\n /**\n * 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.\n * @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.\n */\n\n async setImage(params: LingbotWorld2SetImageParams): Promise<void> {\n await this.sendCommand(\"set_image\", params);\n }\n\n /**\n * 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.\n * @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.\n */\n\n async setPrompt(params: LingbotWorld2SetPromptParams): Promise<void> {\n await this.sendCommand(\"set_prompt\", params);\n }\n\n /**\n * Set attn_window\n * @param params - Set attn_window\n */\n\n async setAttnWindow(params: LingbotWorld2SetAttnWindowParams): Promise<void> {\n await this.sendCommand(\"set_attn_window\", params);\n }\n\n /**\n * Set camera_pose\n * @param params - Set camera_pose\n */\n\n async setCameraPose(params: LingbotWorld2SetCameraPoseParams): Promise<void> {\n await this.sendCommand(\"set_camera_pose\", params);\n }\n\n /**\n * Set move_lateral\n * @param params - Set move_lateral\n */\n\n async setMoveLateral(params: LingbotWorld2SetMoveLateralParams): Promise<void> {\n await this.sendCommand(\"set_move_lateral\", params);\n }\n\n /**\n * Set look_vertical\n * @param params - Set look_vertical\n */\n\n async setLookVertical(params: LingbotWorld2SetLookVerticalParams): Promise<void> {\n await this.sendCommand(\"set_look_vertical\", params);\n }\n\n /**\n * Set look_horizontal\n * @param params - Set look_horizontal\n */\n\n async setLookHorizontal(params: LingbotWorld2SetLookHorizontalParams): Promise<void> {\n await this.sendCommand(\"set_look_horizontal\", params);\n }\n\n /**\n * Set move_longitudinal\n * @param params - Set move_longitudinal\n */\n\n async setMoveLongitudinal(params: LingbotWorld2SetMoveLongitudinalParams): Promise<void> {\n await this.sendCommand(\"set_move_longitudinal\", params);\n }\n\n /**\n * Set rotation_speed_deg\n * @param params - Set rotation_speed_deg\n */\n\n async setRotationSpeedDeg(params: LingbotWorld2SetRotationSpeedDegParams): Promise<void> {\n await this.sendCommand(\"set_rotation_speed_deg\", params);\n }\n\n /**\n * Subscribe to typed model messages.\n * @param handler - Called with a discriminated LingbotWorld2Message\n * @returns Unsubscribe function\n */\n\n onMessage(handler: (message: LingbotWorld2Message) => void): () => void {\n const wrappedHandler = (raw: unknown) => {\n handler(_unwrapMessage<LingbotWorld2Message>(raw));\n };\n this.on(\"message\", wrappedHandler);\n return () => this.off(\"message\", wrappedHandler);\n }\n\n /**\n * Subscribe to \"state\" messages only.\n * @returns Unsubscribe function\n */\n\n onState(handler: (message: LingbotWorld2StateMessage) => void): () => void {\n return this.onMessage((msg) => {\n if (msg.type === \"state\") handler(msg as LingbotWorld2StateMessage);\n });\n }\n\n /**\n * Subscribe to \"command_error\" messages only.\n * @returns Unsubscribe function\n */\n\n onCommandError(handler: (message: LingbotWorld2CommandErrorMessage) => void): () => void {\n return this.onMessage((msg) => {\n if (msg.type === \"command_error\") handler(msg as LingbotWorld2CommandErrorMessage);\n });\n }\n\n /**\n * Subscribe to \"chunk_complete\" messages only.\n * @returns Unsubscribe function\n */\n\n onChunkComplete(handler: (message: LingbotWorld2ChunkCompleteMessage) => void): () => void {\n return this.onMessage((msg) => {\n if (msg.type === \"chunk_complete\") handler(msg as LingbotWorld2ChunkCompleteMessage);\n });\n }\n\n /**\n * Subscribe to \"image_accepted\" messages only.\n * @returns Unsubscribe function\n */\n\n onImageAccepted(handler: (message: LingbotWorld2ImageAcceptedMessage) => void): () => void {\n return this.onMessage((msg) => {\n if (msg.type === \"image_accepted\") handler(msg as LingbotWorld2ImageAcceptedMessage);\n });\n }\n\n /**\n * Subscribe to \"prompt_accepted\" messages only.\n * @returns Unsubscribe function\n */\n\n onPromptAccepted(handler: (message: LingbotWorld2PromptAcceptedMessage) => void): () => void {\n return this.onMessage((msg) => {\n if (msg.type === \"prompt_accepted\") handler(msg as LingbotWorld2PromptAcceptedMessage);\n });\n }\n\n /**\n * Subscribe to \"conditions_ready\" messages only.\n * @returns Unsubscribe function\n */\n\n onConditionsReady(handler: (message: LingbotWorld2ConditionsReadyMessage) => void): () => void {\n return this.onMessage((msg) => {\n if (msg.type === \"conditions_ready\") handler(msg as LingbotWorld2ConditionsReadyMessage);\n });\n }\n\n /**\n * Subscribe to \"generation_reset\" messages only.\n * @returns Unsubscribe function\n */\n\n onGenerationReset(handler: (message: LingbotWorld2GenerationResetMessage) => void): () => void {\n return this.onMessage((msg) => {\n if (msg.type === \"generation_reset\") handler(msg as LingbotWorld2GenerationResetMessage);\n });\n }\n\n /**\n * Subscribe to \"generation_paused\" messages only.\n * @returns Unsubscribe function\n */\n\n onGenerationPaused(handler: (message: LingbotWorld2GenerationPausedMessage) => void): () => void {\n return this.onMessage((msg) => {\n if (msg.type === \"generation_paused\") handler(msg as LingbotWorld2GenerationPausedMessage);\n });\n }\n\n /**\n * Subscribe to \"generation_resumed\" messages only.\n * @returns Unsubscribe function\n */\n\n onGenerationResumed(handler: (message: LingbotWorld2GenerationResumedMessage) => void): () => void {\n return this.onMessage((msg) => {\n if (msg.type === \"generation_resumed\") handler(msg as LingbotWorld2GenerationResumedMessage);\n });\n }\n\n /**\n * Subscribe to \"generation_started\" messages only.\n * @returns Unsubscribe function\n */\n\n onGenerationStarted(handler: (message: LingbotWorld2GenerationStartedMessage) => void): () => void {\n return this.onMessage((msg) => {\n if (msg.type === \"generation_started\") handler(msg as LingbotWorld2GenerationStartedMessage);\n });\n }\n\n /**\n * Subscribe to \"generation_complete\" messages only.\n * @returns Unsubscribe function\n */\n\n onGenerationComplete(handler: (message: LingbotWorld2GenerationCompleteMessage) => void): () => void {\n return this.onMessage((msg) => {\n if (msg.type === \"generation_complete\") handler(msg as LingbotWorld2GenerationCompleteMessage);\n });\n }\n\n /**\n * Subscribe to the \"main_video\" recvonly video track the model publishes.\n *\n * 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`).\n * @param handler - Called with the received track and its stream\n * @returns Unsubscribe function\n */\n\n onMainVideo(\n handler: (track: MediaStreamTrack, stream: MediaStream) => void,\n ): () => void {\n const wrapped = (name: string, t: MediaStreamTrack, s: MediaStream) => {\n if (name === \"main_video\") handler(t, s);\n };\n this.on(\"trackReceived\", wrapped);\n return () => this.off(\"trackReceived\", wrapped);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,oBAAiC;AAG1B,IAAM,aAAa;AACnB,IAAM,gBAAgB;AAStB,IAAM,sBAAsB;AAAA,EACjC,EAAE,MAAM,cAAc,MAAM,SAAS,WAAW,WAAW;AAC7D;AA4SA,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;AAYO,IAAM,qBAAN,cAAiC,sBAAQ;AAAA,EAC9C,YAAY,SAAgC;AAC1C,UAAM;AAAA,MACJ,GAAG;AAAA,MACH,WAAW;AAAA,MACX,aAAa,CAAC,GAAG,mBAAmB;AAAA,IACtC,CAAC;AAAA,EACH;AAAA;AAAA,EAIA,IAAI,UAAgB;AAClB,WAAO;AAAA,EACT;AAAA;AAAA,EAIA,MAAM,QAAuB;AAC3B,UAAM,KAAK,YAAY,SAAS,CAAC,CAAC;AAAA,EACpC;AAAA;AAAA,EAIA,MAAM,QAAuB;AAC3B,UAAM,KAAK,YAAY,SAAS,CAAC,CAAC;AAAA,EACpC;AAAA;AAAA,EAIA,MAAM,QAAuB;AAC3B,UAAM,KAAK,YAAY,SAAS,CAAC,CAAC;AAAA,EACpC;AAAA;AAAA,EAIA,MAAM,SAAwB;AAC5B,UAAM,KAAK,YAAY,UAAU,CAAC,CAAC;AAAA,EACrC;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,QAAQ,QAAmD;AAC/D,UAAM,KA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+
//# sourceMappingURL=core.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { LingbotWorld2ChunkCompleteMessage, LingbotWorld2CommandErrorMessage, LingbotWorld2ConditionsReadyMessage, LingbotWorld2GenerationCompleteMessage, LingbotWorld2GenerationPausedMessage, LingbotWorld2GenerationResetMessage, LingbotWorld2GenerationResumedMessage, LingbotWorld2GenerationStartedMessage, LingbotWorld2ImageAcceptedMessage, LingbotWorld2Message, LingbotWorld2Model, LingbotWorld2Options, LingbotWorld2PromptAcceptedMessage, LingbotWorld2RecvTrackName, LingbotWorld2SetAttnWindowParams, LingbotWorld2SetCameraPoseParams, LingbotWorld2SetImageParams, LingbotWorld2SetLookHorizontalParams, LingbotWorld2SetLookVerticalParams, LingbotWorld2SetMoveLateralParams, LingbotWorld2SetMoveLongitudinalParams, LingbotWorld2SetPromptParams, LingbotWorld2SetRotationSpeedDegParams, LingbotWorld2SetSeedParams, LingbotWorld2StateMessage, LingbotWorld2Tracks, MODEL_NAME, MODEL_VERSION } from './core.mjs';
|
|
2
|
+
export { LingbotWorld2MainVideoView, LingbotWorld2MainVideoViewProps, LingbotWorld2Provider, LingbotWorld2ProviderProps, useLingbotWorld2, useLingbotWorld2ChunkComplete, useLingbotWorld2CommandError, useLingbotWorld2ConditionsReady, useLingbotWorld2GenerationComplete, useLingbotWorld2GenerationPaused, useLingbotWorld2GenerationReset, useLingbotWorld2GenerationResumed, useLingbotWorld2GenerationStarted, useLingbotWorld2ImageAccepted, useLingbotWorld2Message, useLingbotWorld2PromptAccepted, useLingbotWorld2State, useLingbotWorld2Track } from './react.mjs';
|
|
3
|
+
export { FileRef } from '@reactor-team/js-sdk';
|
|
4
|
+
import 'react';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { LingbotWorld2ChunkCompleteMessage, LingbotWorld2CommandErrorMessage, LingbotWorld2ConditionsReadyMessage, LingbotWorld2GenerationCompleteMessage, LingbotWorld2GenerationPausedMessage, LingbotWorld2GenerationResetMessage, LingbotWorld2GenerationResumedMessage, LingbotWorld2GenerationStartedMessage, LingbotWorld2ImageAcceptedMessage, LingbotWorld2Message, LingbotWorld2Model, LingbotWorld2Options, LingbotWorld2PromptAcceptedMessage, LingbotWorld2RecvTrackName, LingbotWorld2SetAttnWindowParams, LingbotWorld2SetCameraPoseParams, LingbotWorld2SetImageParams, LingbotWorld2SetLookHorizontalParams, LingbotWorld2SetLookVerticalParams, LingbotWorld2SetMoveLateralParams, LingbotWorld2SetMoveLongitudinalParams, LingbotWorld2SetPromptParams, LingbotWorld2SetRotationSpeedDegParams, LingbotWorld2SetSeedParams, LingbotWorld2StateMessage, LingbotWorld2Tracks, MODEL_NAME, MODEL_VERSION } from './core.js';
|
|
2
|
+
export { LingbotWorld2MainVideoView, LingbotWorld2MainVideoViewProps, LingbotWorld2Provider, LingbotWorld2ProviderProps, useLingbotWorld2, useLingbotWorld2ChunkComplete, useLingbotWorld2CommandError, useLingbotWorld2ConditionsReady, useLingbotWorld2GenerationComplete, useLingbotWorld2GenerationPaused, useLingbotWorld2GenerationReset, useLingbotWorld2GenerationResumed, useLingbotWorld2GenerationStarted, useLingbotWorld2ImageAccepted, useLingbotWorld2Message, useLingbotWorld2PromptAccepted, useLingbotWorld2State, useLingbotWorld2Track } from './react.js';
|
|
3
|
+
export { FileRef } from '@reactor-team/js-sdk';
|
|
4
|
+
import 'react';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
FileRef: () => import_js_sdk.FileRef,
|
|
24
|
+
LingbotWorld2MainVideoView: () => LingbotWorld2MainVideoView,
|
|
25
|
+
LingbotWorld2Model: () => LingbotWorld2Model,
|
|
26
|
+
LingbotWorld2Provider: () => LingbotWorld2Provider,
|
|
27
|
+
LingbotWorld2Tracks: () => LingbotWorld2Tracks,
|
|
28
|
+
MODEL_NAME: () => MODEL_NAME,
|
|
29
|
+
MODEL_VERSION: () => MODEL_VERSION,
|
|
30
|
+
useLingbotWorld2: () => useLingbotWorld2,
|
|
31
|
+
useLingbotWorld2ChunkComplete: () => useLingbotWorld2ChunkComplete,
|
|
32
|
+
useLingbotWorld2CommandError: () => useLingbotWorld2CommandError,
|
|
33
|
+
useLingbotWorld2ConditionsReady: () => useLingbotWorld2ConditionsReady,
|
|
34
|
+
useLingbotWorld2GenerationComplete: () => useLingbotWorld2GenerationComplete,
|
|
35
|
+
useLingbotWorld2GenerationPaused: () => useLingbotWorld2GenerationPaused,
|
|
36
|
+
useLingbotWorld2GenerationReset: () => useLingbotWorld2GenerationReset,
|
|
37
|
+
useLingbotWorld2GenerationResumed: () => useLingbotWorld2GenerationResumed,
|
|
38
|
+
useLingbotWorld2GenerationStarted: () => useLingbotWorld2GenerationStarted,
|
|
39
|
+
useLingbotWorld2ImageAccepted: () => useLingbotWorld2ImageAccepted,
|
|
40
|
+
useLingbotWorld2Message: () => useLingbotWorld2Message,
|
|
41
|
+
useLingbotWorld2PromptAccepted: () => useLingbotWorld2PromptAccepted,
|
|
42
|
+
useLingbotWorld2State: () => useLingbotWorld2State,
|
|
43
|
+
useLingbotWorld2Track: () => useLingbotWorld2Track
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(index_exports);
|
|
46
|
+
|
|
47
|
+
// src/core.ts
|
|
48
|
+
var import_js_sdk = require("@reactor-team/js-sdk");
|
|
49
|
+
var MODEL_NAME = "reactor/lingbot-world-2";
|
|
50
|
+
var MODEL_VERSION = "v0.2.5";
|
|
51
|
+
var LingbotWorld2Tracks = [
|
|
52
|
+
{ name: "main_video", kind: "video", direction: "recvonly" }
|
|
53
|
+
];
|
|
54
|
+
function _unwrapMessage(raw) {
|
|
55
|
+
const env = raw;
|
|
56
|
+
if (env && typeof env === "object" && env.data && typeof env.data === "object") {
|
|
57
|
+
return { ...env.data, type: env.type };
|
|
58
|
+
}
|
|
59
|
+
return raw;
|
|
60
|
+
}
|
|
61
|
+
var LingbotWorld2Model = class extends import_js_sdk.Reactor {
|
|
62
|
+
constructor(options) {
|
|
63
|
+
super({
|
|
64
|
+
...options,
|
|
65
|
+
modelName: MODEL_NAME,
|
|
66
|
+
modelTracks: [...LingbotWorld2Tracks]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/** @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. */
|
|
70
|
+
get reactor() {
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
/** 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. */
|
|
74
|
+
async pause() {
|
|
75
|
+
await this.sendCommand("pause", {});
|
|
76
|
+
}
|
|
77
|
+
/** 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`. */
|
|
78
|
+
async reset() {
|
|
79
|
+
await this.sendCommand("reset", {});
|
|
80
|
+
}
|
|
81
|
+
/** 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. */
|
|
82
|
+
async start() {
|
|
83
|
+
await this.sendCommand("start", {});
|
|
84
|
+
}
|
|
85
|
+
/** 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. */
|
|
86
|
+
async resume() {
|
|
87
|
+
await this.sendCommand("resume", {});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Set seed
|
|
91
|
+
* @param params - Set seed
|
|
92
|
+
*/
|
|
93
|
+
async setSeed(params) {
|
|
94
|
+
await this.sendCommand("set_seed", params);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 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.
|
|
98
|
+
* @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.
|
|
99
|
+
*/
|
|
100
|
+
async setImage(params) {
|
|
101
|
+
await this.sendCommand("set_image", params);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 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.
|
|
105
|
+
* @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.
|
|
106
|
+
*/
|
|
107
|
+
async setPrompt(params) {
|
|
108
|
+
await this.sendCommand("set_prompt", params);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Set attn_window
|
|
112
|
+
* @param params - Set attn_window
|
|
113
|
+
*/
|
|
114
|
+
async setAttnWindow(params) {
|
|
115
|
+
await this.sendCommand("set_attn_window", params);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Set camera_pose
|
|
119
|
+
* @param params - Set camera_pose
|
|
120
|
+
*/
|
|
121
|
+
async setCameraPose(params) {
|
|
122
|
+
await this.sendCommand("set_camera_pose", params);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Set move_lateral
|
|
126
|
+
* @param params - Set move_lateral
|
|
127
|
+
*/
|
|
128
|
+
async setMoveLateral(params) {
|
|
129
|
+
await this.sendCommand("set_move_lateral", params);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Set look_vertical
|
|
133
|
+
* @param params - Set look_vertical
|
|
134
|
+
*/
|
|
135
|
+
async setLookVertical(params) {
|
|
136
|
+
await this.sendCommand("set_look_vertical", params);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Set look_horizontal
|
|
140
|
+
* @param params - Set look_horizontal
|
|
141
|
+
*/
|
|
142
|
+
async setLookHorizontal(params) {
|
|
143
|
+
await this.sendCommand("set_look_horizontal", params);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Set move_longitudinal
|
|
147
|
+
* @param params - Set move_longitudinal
|
|
148
|
+
*/
|
|
149
|
+
async setMoveLongitudinal(params) {
|
|
150
|
+
await this.sendCommand("set_move_longitudinal", params);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Set rotation_speed_deg
|
|
154
|
+
* @param params - Set rotation_speed_deg
|
|
155
|
+
*/
|
|
156
|
+
async setRotationSpeedDeg(params) {
|
|
157
|
+
await this.sendCommand("set_rotation_speed_deg", params);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Subscribe to typed model messages.
|
|
161
|
+
* @param handler - Called with a discriminated LingbotWorld2Message
|
|
162
|
+
* @returns Unsubscribe function
|
|
163
|
+
*/
|
|
164
|
+
onMessage(handler) {
|
|
165
|
+
const wrappedHandler = (raw) => {
|
|
166
|
+
handler(_unwrapMessage(raw));
|
|
167
|
+
};
|
|
168
|
+
this.on("message", wrappedHandler);
|
|
169
|
+
return () => this.off("message", wrappedHandler);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Subscribe to "state" messages only.
|
|
173
|
+
* @returns Unsubscribe function
|
|
174
|
+
*/
|
|
175
|
+
onState(handler) {
|
|
176
|
+
return this.onMessage((msg) => {
|
|
177
|
+
if (msg.type === "state") handler(msg);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Subscribe to "command_error" messages only.
|
|
182
|
+
* @returns Unsubscribe function
|
|
183
|
+
*/
|
|
184
|
+
onCommandError(handler) {
|
|
185
|
+
return this.onMessage((msg) => {
|
|
186
|
+
if (msg.type === "command_error") handler(msg);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Subscribe to "chunk_complete" messages only.
|
|
191
|
+
* @returns Unsubscribe function
|
|
192
|
+
*/
|
|
193
|
+
onChunkComplete(handler) {
|
|
194
|
+
return this.onMessage((msg) => {
|
|
195
|
+
if (msg.type === "chunk_complete") handler(msg);
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Subscribe to "image_accepted" messages only.
|
|
200
|
+
* @returns Unsubscribe function
|
|
201
|
+
*/
|
|
202
|
+
onImageAccepted(handler) {
|
|
203
|
+
return this.onMessage((msg) => {
|
|
204
|
+
if (msg.type === "image_accepted") handler(msg);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Subscribe to "prompt_accepted" messages only.
|
|
209
|
+
* @returns Unsubscribe function
|
|
210
|
+
*/
|
|
211
|
+
onPromptAccepted(handler) {
|
|
212
|
+
return this.onMessage((msg) => {
|
|
213
|
+
if (msg.type === "prompt_accepted") handler(msg);
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Subscribe to "conditions_ready" messages only.
|
|
218
|
+
* @returns Unsubscribe function
|
|
219
|
+
*/
|
|
220
|
+
onConditionsReady(handler) {
|
|
221
|
+
return this.onMessage((msg) => {
|
|
222
|
+
if (msg.type === "conditions_ready") handler(msg);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Subscribe to "generation_reset" messages only.
|
|
227
|
+
* @returns Unsubscribe function
|
|
228
|
+
*/
|
|
229
|
+
onGenerationReset(handler) {
|
|
230
|
+
return this.onMessage((msg) => {
|
|
231
|
+
if (msg.type === "generation_reset") handler(msg);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Subscribe to "generation_paused" messages only.
|
|
236
|
+
* @returns Unsubscribe function
|
|
237
|
+
*/
|
|
238
|
+
onGenerationPaused(handler) {
|
|
239
|
+
return this.onMessage((msg) => {
|
|
240
|
+
if (msg.type === "generation_paused") handler(msg);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Subscribe to "generation_resumed" messages only.
|
|
245
|
+
* @returns Unsubscribe function
|
|
246
|
+
*/
|
|
247
|
+
onGenerationResumed(handler) {
|
|
248
|
+
return this.onMessage((msg) => {
|
|
249
|
+
if (msg.type === "generation_resumed") handler(msg);
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Subscribe to "generation_started" messages only.
|
|
254
|
+
* @returns Unsubscribe function
|
|
255
|
+
*/
|
|
256
|
+
onGenerationStarted(handler) {
|
|
257
|
+
return this.onMessage((msg) => {
|
|
258
|
+
if (msg.type === "generation_started") handler(msg);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Subscribe to "generation_complete" messages only.
|
|
263
|
+
* @returns Unsubscribe function
|
|
264
|
+
*/
|
|
265
|
+
onGenerationComplete(handler) {
|
|
266
|
+
return this.onMessage((msg) => {
|
|
267
|
+
if (msg.type === "generation_complete") handler(msg);
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Subscribe to the "main_video" recvonly video track the model publishes.
|
|
272
|
+
*
|
|
273
|
+
* 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`).
|
|
274
|
+
* @param handler - Called with the received track and its stream
|
|
275
|
+
* @returns Unsubscribe function
|
|
276
|
+
*/
|
|
277
|
+
onMainVideo(handler) {
|
|
278
|
+
const wrapped = (name, t, s) => {
|
|
279
|
+
if (name === "main_video") handler(t, s);
|
|
280
|
+
};
|
|
281
|
+
this.on("trackReceived", wrapped);
|
|
282
|
+
return () => this.off("trackReceived", wrapped);
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
// src/react.tsx
|
|
287
|
+
var import_js_sdk2 = require("@reactor-team/js-sdk");
|
|
288
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
289
|
+
function _unwrapMessage2(raw) {
|
|
290
|
+
const env = raw;
|
|
291
|
+
if (env && typeof env === "object" && env.data && typeof env.data === "object") {
|
|
292
|
+
return { ...env.data, type: env.type };
|
|
293
|
+
}
|
|
294
|
+
return raw;
|
|
295
|
+
}
|
|
296
|
+
function LingbotWorld2Provider({
|
|
297
|
+
children,
|
|
298
|
+
...rest
|
|
299
|
+
}) {
|
|
300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
301
|
+
import_js_sdk2.ReactorProvider,
|
|
302
|
+
{
|
|
303
|
+
...rest,
|
|
304
|
+
modelName: MODEL_NAME,
|
|
305
|
+
modelTracks: [...LingbotWorld2Tracks],
|
|
306
|
+
children
|
|
307
|
+
}
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
function useLingbotWorld2() {
|
|
311
|
+
const connect = (0, import_js_sdk2.useReactor)((s) => s.connect);
|
|
312
|
+
const connectOptions = (0, import_js_sdk2.useReactor)((s) => s.connectOptions);
|
|
313
|
+
const disconnect = (0, import_js_sdk2.useReactor)((s) => s.disconnect);
|
|
314
|
+
const downloadClipAsFile = (0, import_js_sdk2.useReactor)((s) => s.downloadClipAsFile);
|
|
315
|
+
const jwtToken = (0, import_js_sdk2.useReactor)((s) => s.jwtToken);
|
|
316
|
+
const lastError = (0, import_js_sdk2.useReactor)((s) => s.lastError);
|
|
317
|
+
const publish = (0, import_js_sdk2.useReactor)((s) => s.publish);
|
|
318
|
+
const reconnect = (0, import_js_sdk2.useReactor)((s) => s.reconnect);
|
|
319
|
+
const requestClip = (0, import_js_sdk2.useReactor)((s) => s.requestClip);
|
|
320
|
+
const requestRecording = (0, import_js_sdk2.useReactor)((s) => s.requestRecording);
|
|
321
|
+
const sendCommand = (0, import_js_sdk2.useReactor)((s) => s.sendCommand);
|
|
322
|
+
const sessionExpiration = (0, import_js_sdk2.useReactor)((s) => s.sessionExpiration);
|
|
323
|
+
const sessionId = (0, import_js_sdk2.useReactor)((s) => s.sessionId);
|
|
324
|
+
const status = (0, import_js_sdk2.useReactor)((s) => s.status);
|
|
325
|
+
const tracks = (0, import_js_sdk2.useReactor)((s) => s.tracks);
|
|
326
|
+
const unpublish = (0, import_js_sdk2.useReactor)((s) => s.unpublish);
|
|
327
|
+
const uploadFile = (0, import_js_sdk2.useReactor)((s) => s.uploadFile);
|
|
328
|
+
return {
|
|
329
|
+
connect,
|
|
330
|
+
connectOptions,
|
|
331
|
+
disconnect,
|
|
332
|
+
downloadClipAsFile,
|
|
333
|
+
jwtToken,
|
|
334
|
+
lastError,
|
|
335
|
+
publish,
|
|
336
|
+
reconnect,
|
|
337
|
+
requestClip,
|
|
338
|
+
requestRecording,
|
|
339
|
+
sendCommand,
|
|
340
|
+
sessionExpiration,
|
|
341
|
+
sessionId,
|
|
342
|
+
status,
|
|
343
|
+
tracks,
|
|
344
|
+
unpublish,
|
|
345
|
+
uploadFile,
|
|
346
|
+
pause: () => sendCommand("pause", {}),
|
|
347
|
+
reset: () => sendCommand("reset", {}),
|
|
348
|
+
start: () => sendCommand("start", {}),
|
|
349
|
+
resume: () => sendCommand("resume", {}),
|
|
350
|
+
setSeed: (params) => sendCommand("set_seed", params),
|
|
351
|
+
setImage: (params) => sendCommand("set_image", params),
|
|
352
|
+
setPrompt: (params) => sendCommand("set_prompt", params),
|
|
353
|
+
setAttnWindow: (params) => sendCommand("set_attn_window", params),
|
|
354
|
+
setCameraPose: (params) => sendCommand("set_camera_pose", params),
|
|
355
|
+
setMoveLateral: (params) => sendCommand("set_move_lateral", params),
|
|
356
|
+
setLookVertical: (params) => sendCommand("set_look_vertical", params),
|
|
357
|
+
setLookHorizontal: (params) => sendCommand("set_look_horizontal", params),
|
|
358
|
+
setMoveLongitudinal: (params) => sendCommand("set_move_longitudinal", params),
|
|
359
|
+
setRotationSpeedDeg: (params) => sendCommand("set_rotation_speed_deg", params)
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
function useLingbotWorld2Message(handler) {
|
|
363
|
+
(0, import_js_sdk2.useReactorMessage)(
|
|
364
|
+
(msg) => handler(_unwrapMessage2(msg))
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
|
+
function useLingbotWorld2State(handler) {
|
|
368
|
+
(0, import_js_sdk2.useReactorMessage)((msg) => {
|
|
369
|
+
const m = _unwrapMessage2(msg);
|
|
370
|
+
if (m.type === "state") {
|
|
371
|
+
handler(m);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
function useLingbotWorld2CommandError(handler) {
|
|
376
|
+
(0, import_js_sdk2.useReactorMessage)((msg) => {
|
|
377
|
+
const m = _unwrapMessage2(msg);
|
|
378
|
+
if (m.type === "command_error") {
|
|
379
|
+
handler(m);
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
function useLingbotWorld2ChunkComplete(handler) {
|
|
384
|
+
(0, import_js_sdk2.useReactorMessage)((msg) => {
|
|
385
|
+
const m = _unwrapMessage2(msg);
|
|
386
|
+
if (m.type === "chunk_complete") {
|
|
387
|
+
handler(m);
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
function useLingbotWorld2ImageAccepted(handler) {
|
|
392
|
+
(0, import_js_sdk2.useReactorMessage)((msg) => {
|
|
393
|
+
const m = _unwrapMessage2(msg);
|
|
394
|
+
if (m.type === "image_accepted") {
|
|
395
|
+
handler(m);
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
function useLingbotWorld2PromptAccepted(handler) {
|
|
400
|
+
(0, import_js_sdk2.useReactorMessage)((msg) => {
|
|
401
|
+
const m = _unwrapMessage2(msg);
|
|
402
|
+
if (m.type === "prompt_accepted") {
|
|
403
|
+
handler(m);
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
function useLingbotWorld2ConditionsReady(handler) {
|
|
408
|
+
(0, import_js_sdk2.useReactorMessage)((msg) => {
|
|
409
|
+
const m = _unwrapMessage2(msg);
|
|
410
|
+
if (m.type === "conditions_ready") {
|
|
411
|
+
handler(m);
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
function useLingbotWorld2GenerationReset(handler) {
|
|
416
|
+
(0, import_js_sdk2.useReactorMessage)((msg) => {
|
|
417
|
+
const m = _unwrapMessage2(msg);
|
|
418
|
+
if (m.type === "generation_reset") {
|
|
419
|
+
handler(m);
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
function useLingbotWorld2GenerationPaused(handler) {
|
|
424
|
+
(0, import_js_sdk2.useReactorMessage)((msg) => {
|
|
425
|
+
const m = _unwrapMessage2(msg);
|
|
426
|
+
if (m.type === "generation_paused") {
|
|
427
|
+
handler(m);
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
function useLingbotWorld2GenerationResumed(handler) {
|
|
432
|
+
(0, import_js_sdk2.useReactorMessage)((msg) => {
|
|
433
|
+
const m = _unwrapMessage2(msg);
|
|
434
|
+
if (m.type === "generation_resumed") {
|
|
435
|
+
handler(m);
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
function useLingbotWorld2GenerationStarted(handler) {
|
|
440
|
+
(0, import_js_sdk2.useReactorMessage)((msg) => {
|
|
441
|
+
const m = _unwrapMessage2(msg);
|
|
442
|
+
if (m.type === "generation_started") {
|
|
443
|
+
handler(m);
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
function useLingbotWorld2GenerationComplete(handler) {
|
|
448
|
+
(0, import_js_sdk2.useReactorMessage)((msg) => {
|
|
449
|
+
const m = _unwrapMessage2(msg);
|
|
450
|
+
if (m.type === "generation_complete") {
|
|
451
|
+
handler(m);
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
function useLingbotWorld2Track(name) {
|
|
456
|
+
return (0, import_js_sdk2.useReactor)((s) => s.tracks[name]);
|
|
457
|
+
}
|
|
458
|
+
function LingbotWorld2MainVideoView(props) {
|
|
459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_js_sdk2.ReactorView, { ...props, track: "main_video" });
|
|
460
|
+
}
|
|
461
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
462
|
+
0 && (module.exports = {
|
|
463
|
+
FileRef,
|
|
464
|
+
LingbotWorld2MainVideoView,
|
|
465
|
+
LingbotWorld2Model,
|
|
466
|
+
LingbotWorld2Provider,
|
|
467
|
+
LingbotWorld2Tracks,
|
|
468
|
+
MODEL_NAME,
|
|
469
|
+
MODEL_VERSION,
|
|
470
|
+
useLingbotWorld2,
|
|
471
|
+
useLingbotWorld2ChunkComplete,
|
|
472
|
+
useLingbotWorld2CommandError,
|
|
473
|
+
useLingbotWorld2ConditionsReady,
|
|
474
|
+
useLingbotWorld2GenerationComplete,
|
|
475
|
+
useLingbotWorld2GenerationPaused,
|
|
476
|
+
useLingbotWorld2GenerationReset,
|
|
477
|
+
useLingbotWorld2GenerationResumed,
|
|
478
|
+
useLingbotWorld2GenerationStarted,
|
|
479
|
+
useLingbotWorld2ImageAccepted,
|
|
480
|
+
useLingbotWorld2Message,
|
|
481
|
+
useLingbotWorld2PromptAccepted,
|
|
482
|
+
useLingbotWorld2State,
|
|
483
|
+
useLingbotWorld2Track
|
|
484
|
+
});
|
|
485
|
+
//# sourceMappingURL=index.js.map
|