Reactor
class with named methods and React hooks mirroring that model’s published schema. It only adds
ergonomics to aid in development, such as autocomplete, typed parameters, and named hooks. Every
typed method ultimately calls sendCommand() on the base class. See the
SDK Reference overview for when to reach for a typed SDK vs. the
base class.
Each package ships two layers: an imperative class and a React layer. The examples below use Helios;
the other packages are identical with the names swapped, e.g.
LongliveV2Model,
LongliveV2Provider, useLongliveV2, LongliveV2MainVideoView (and the same pattern for LingBot,
LingBot World 2 (LingbotWorld2Model / LingbotWorld2Provider / useLingbotWorld2 /
LingbotWorld2MainVideoView), SanaStreamingModel / SanaStreamingProvider / useSanaStreaming /
SanaStreamingMainVideoView, and X2Model / X2Provider / useX2 / X2MainVideoView).
HappyOyster follows the same naming (HappyOysterModel / HappyOysterProvider / useHappyOyster)
with one difference: you fix an experience mode at construction (mode: "adventure" | "directing"),
and the mode selects between its two model names. For details, see the
HappyOyster overview.
Imperative class
HeliosModel (and LingbotModel, LingbotWorld2Model, LongliveV2Model, SanaStreamingModel)
extends Reactor, so it keeps every base method (connect,
disconnect, uploadFile, on, pauseTrack, resumeTrack, …) and adds a typed method per
command. The model name is set for you.
helios.setPrompt(...) sends the
set_prompt command. The canonical list of methods
and their parameters is each model’s Commands table:
Helios commands /
LingBot commands /
LingBot World 2 commands /
LongLive-2.0 commands /
SANA-Streaming commands.
Non-React apps can import the class from the package’s
./core entry
(@reactor-models/helios/core) to skip the React dependency. The default import includes both
layers.React layer
For React apps the package also exports a provider, hooks, and a typed video component.<HeliosProvider>is<ReactorProvider>withmodelNamepre-set. Pass the same props (jwtToken,connectOptions, …) minusmodelName.connectOptionsaccepts the fullConnectOptionsset (autoConnect,maxAttempts,autoResumeTracks,sessionId,connectionId).useHelios()returns the baseuseReactorstore (status,connect,disconnect,sendCommand,uploadFile,lastError, …) plus a typed method per command (setPrompt,schedulePrompt,setImage,setSeed,setSrScale,setImageStrength,start,pause,resume,reset, andsetConditioningon Helios 0.9.0+).- Per-message hooks are typed equivalents of
useReactorMessage, each filtered to one message type, plus the catch-alluseHeliosMessage. Helios exposesuseHeliosState,useHeliosCommandError,useHeliosImageAccepted,useHeliosPromptAccepted,useHeliosConditionsReady,useHeliosChunkComplete,useHeliosGenerationStarted/useHeliosGenerationPaused/useHeliosGenerationResumed. LingBot mirrors these and addsuseLingbotGenerationCompleteanduseLingbotGenerationReset. LingBot World 2 mirrors LingBot’s full set under theLingbotWorld2prefix (useLingbotWorld2State,useLingbotWorld2CommandError,useLingbotWorld2ImageAccepted,useLingbotWorld2PromptAccepted,useLingbotWorld2ConditionsReady,useLingbotWorld2ChunkComplete, theuseLingbotWorld2Generation*hooks includingCompleteandReset, and the catch-alluseLingbotWorld2Message). SANA-Streaming addsuseSanaStreamingVideoAccepted,useSanaStreamingAnchored, anduseSanaStreamingGenerationComplete/useSanaStreamingGenerationReset. Payloads match the model’s Messages table. <HeliosMainVideoView>is<ReactorView>withtrack="main_video"pre-bound; it accepts the otherReactorViewprops.useHeliosTrack(name)returns a rawMediaStreamTrackfor a named track. SANA-Streaming, which takes a live webcam as input, also ships<SanaStreamingCameraView>, a<WebcamStream>with thecamerainput track pre-bound that acquires and publishes the webcam for you.
Multiple clients can share one session. Adopt a backend-created session with
connectOptions= {{ sessionId }} (or connect({sessionId}) on the class), and adopt a pre-registered connection
with connectionId. With autoResumeTracks: false a client subscribes to a subset of output
tracks and resumes them with resumeTrack(). See
Sessions.