Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

model-meta.ts

102 lines3.3 KB

1/**
2 * Reactor world-model ids and connect slugs.
3 *
4 * Ids are the short names passed to `reactorWorld('visko-orbis-stable')`.
5 * `REACTOR_WORLD_SLUGS` maps each id to the `modelName` the Reactor SDK
6 * connects with.
7 */
8​
9export const REACTOR_WORLD_MODELS = [
10 'visko-orbis-stable',
11 'visko-orbis-dynamic',
12 'happy-oyster-adventure',
13 'happy-oyster-director',
14 'lingbot-world-2',
15 'lingbot',
16 'helios',
17] as const
18​
19export type ReactorWorldModel = (typeof REACTOR_WORLD_MODELS)[number]
20​
21export function isReactorWorldModel(model: string): model is ReactorWorldModel {
22 return (REACTOR_WORLD_MODELS as ReadonlyArray<string>).includes(model)
24​
25export const REACTOR_WORLD_SLUGS = {
26 'visko-orbis-stable': 'reactor/visko-orbis-stable',
27 'visko-orbis-dynamic': 'reactor/visko-orbis-dynamic',
28 'happy-oyster-adventure': 'reactor/happy-oyster-adventure',
29 'happy-oyster-director': 'reactor/happy-oyster-director',
30 'lingbot-world-2': 'reactor/lingbot-world-2',
31 lingbot: 'reactor/lingbot',
32 helios: 'reactor/helios',
33} as const satisfies Record<ReactorWorldModel, string>
34​
35export type ReactorWorldSlug = (typeof REACTOR_WORLD_SLUGS)[ReactorWorldModel]
36​
37export type ReactorWorldResolution = '1080p' | '2k' | '4k'
38​
39/**
40 * Browser session commands for Reactor world models (`set_resolution`,
41 * `set_seed`, `set_audio_enabled`, `set_audio_prompt`). `createWorld` does
42 * not send these. Keep them in client state and apply after connect.
43 */
44export interface ReactorWorldProviderOptions {
45 /** Delivery resolution for Orbis. Ignored by models that do not expose it. */
46 resolution?: ReactorWorldResolution
47 /** RNG seed for the next run. */
48 seed?: number
49 /** When false, skip audio compute on the next start. */
50 audioEnabled?: boolean
51 /** Sound description. Empty string generates audio from the picture alone. */
52 audioPrompt?: string
54​
55export type ReactorWorldModelProviderOptionsByName = {
56 [M in ReactorWorldModel]: ReactorWorldProviderOptions
58​
59/**
60 * Reactor video-model ids and connect slugs.
61 *
62 * Ids are the short names passed to `reactorVideo('helios')`.
63 * `REACTOR_VIDEO_SLUGS` maps each id to the `modelName` the Reactor SDK
64 * connects with.
65 *
66 * These models stream live video over WebRTC. Use them with `generateLiveVideo()`.
67 * They do not return a download URL. X2 and SANA-Streaming need a live source
68 * track, so they are not in this list.
69 */
70​
71export const REACTOR_VIDEO_MODELS = [
72 'helios',
73 'fast-h3',
74 'longlive-v2',
75 'ltx2',
76] as const
77​
78export type ReactorVideoModel = (typeof REACTOR_VIDEO_MODELS)[number]
79​
80export function isReactorVideoModel(model: string): model is ReactorVideoModel {
81 return (REACTOR_VIDEO_MODELS as ReadonlyArray<string>).includes(model)
83​
84export const REACTOR_VIDEO_SLUGS = {
85 helios: 'reactor/helios',
86 'fast-h3': 'reactor/fast-h3',
87 'longlive-v2': 'reactor/longlive-v2',
88 ltx2: 'reactor/ltx2',
89} as const satisfies Record<ReactorVideoModel, string>
90​
91export type ReactorVideoSlug = (typeof REACTOR_VIDEO_SLUGS)[ReactorVideoModel]
92​
93/**
94 * Browser session commands for Reactor video models. Same fields as world.
95 * `createLiveVideo` does not send these. Keep them in client state and apply after
96 * connect.
97 */
98export type ReactorVideoProviderOptions = ReactorWorldProviderOptions
99​
100export type ReactorVideoModelProviderOptionsByName = {
101 [M in ReactorVideoModel]: ReactorVideoProviderOptions