@escapeaihq/client-core 0.52.0 → 0.138.0

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.
Files changed (782) hide show
  1. package/README.md +445 -153
  2. package/dist/adapters/capabilities.d.ts +20 -3
  3. package/dist/adapters/capabilities.d.ts.map +1 -1
  4. package/dist/adapters/directorAdapter.d.ts +5 -4
  5. package/dist/adapters/directorAdapter.d.ts.map +1 -1
  6. package/dist/adapters/directorAdapter.js +5 -4
  7. package/dist/adapters/directorAdapter.js.map +1 -1
  8. package/dist/adapters/experienceModelCatalog.d.ts +382 -0
  9. package/dist/adapters/experienceModelCatalog.d.ts.map +1 -0
  10. package/dist/adapters/experienceModelCatalog.js +401 -0
  11. package/dist/adapters/experienceModelCatalog.js.map +1 -0
  12. package/dist/adapters/extractionAdapter.d.ts +81 -0
  13. package/dist/adapters/extractionAdapter.d.ts.map +1 -0
  14. package/dist/adapters/extractionAdapter.js +98 -0
  15. package/dist/adapters/extractionAdapter.js.map +1 -0
  16. package/dist/adapters/imageAdapter.d.ts +5 -1
  17. package/dist/adapters/imageAdapter.d.ts.map +1 -1
  18. package/dist/adapters/imageAdapter.js +5 -1
  19. package/dist/adapters/imageAdapter.js.map +1 -1
  20. package/dist/adapters/index.d.ts +54 -16
  21. package/dist/adapters/index.d.ts.map +1 -1
  22. package/dist/adapters/index.js +62 -11
  23. package/dist/adapters/index.js.map +1 -1
  24. package/dist/adapters/momentDirective.d.ts +66 -0
  25. package/dist/adapters/momentDirective.d.ts.map +1 -0
  26. package/dist/adapters/momentDirective.js +78 -0
  27. package/dist/adapters/momentDirective.js.map +1 -0
  28. package/dist/adapters/momentPolicy.d.ts +132 -0
  29. package/dist/adapters/momentPolicy.d.ts.map +1 -0
  30. package/dist/adapters/momentPolicy.js +165 -0
  31. package/dist/adapters/momentPolicy.js.map +1 -0
  32. package/dist/adapters/registry.d.ts +1 -1
  33. package/dist/adapters/registry.d.ts.map +1 -1
  34. package/dist/adapters/videoGenAdapter.d.ts +55 -0
  35. package/dist/adapters/videoGenAdapter.d.ts.map +1 -0
  36. package/dist/adapters/videoGenAdapter.js +78 -0
  37. package/dist/adapters/videoGenAdapter.js.map +1 -0
  38. package/dist/adapters/worldAdapter.d.ts +132 -11
  39. package/dist/adapters/worldAdapter.d.ts.map +1 -1
  40. package/dist/adapters/worldAdapter.js +127 -11
  41. package/dist/adapters/worldAdapter.js.map +1 -1
  42. package/dist/adapters/worldModelPreference.d.ts +173 -0
  43. package/dist/adapters/worldModelPreference.d.ts.map +1 -0
  44. package/dist/adapters/worldModelPreference.js +209 -0
  45. package/dist/adapters/worldModelPreference.js.map +1 -0
  46. package/dist/adapters/worldModelTradeoffs.d.ts +120 -0
  47. package/dist/adapters/worldModelTradeoffs.d.ts.map +1 -0
  48. package/dist/adapters/worldModelTradeoffs.js +154 -0
  49. package/dist/adapters/worldModelTradeoffs.js.map +1 -0
  50. package/dist/admin.d.ts +545 -0
  51. package/dist/admin.d.ts.map +1 -1
  52. package/dist/admin.js +230 -16
  53. package/dist/admin.js.map +1 -1
  54. package/dist/api.d.ts +10281 -2216
  55. package/dist/api.d.ts.map +1 -1
  56. package/dist/api.js +4174 -1240
  57. package/dist/api.js.map +1 -1
  58. package/dist/arcBoardJoin.d.ts +38 -0
  59. package/dist/arcBoardJoin.d.ts.map +1 -0
  60. package/dist/arcBoardJoin.js +37 -0
  61. package/dist/arcBoardJoin.js.map +1 -0
  62. package/dist/arcPreview.d.ts +49 -0
  63. package/dist/arcPreview.d.ts.map +1 -0
  64. package/dist/arcPreview.js +65 -0
  65. package/dist/arcPreview.js.map +1 -0
  66. package/dist/audio.d.ts +259 -16
  67. package/dist/audio.d.ts.map +1 -1
  68. package/dist/audio.js +605 -114
  69. package/dist/audio.js.map +1 -1
  70. package/dist/audioDsp.d.ts +45 -0
  71. package/dist/audioDsp.d.ts.map +1 -0
  72. package/dist/audioDsp.js +108 -0
  73. package/dist/audioDsp.js.map +1 -0
  74. package/dist/audioProtocol.d.ts +160 -0
  75. package/dist/audioProtocol.d.ts.map +1 -1
  76. package/dist/audioProtocol.js +99 -0
  77. package/dist/audioProtocol.js.map +1 -1
  78. package/dist/beatTitles.d.ts +33 -0
  79. package/dist/beatTitles.d.ts.map +1 -0
  80. package/dist/beatTitles.js +39 -0
  81. package/dist/beatTitles.js.map +1 -0
  82. package/dist/castProjection.d.ts +204 -1
  83. package/dist/castProjection.d.ts.map +1 -1
  84. package/dist/castProjection.js +202 -0
  85. package/dist/castProjection.js.map +1 -1
  86. package/dist/characterGrounding.d.ts +369 -0
  87. package/dist/characterGrounding.d.ts.map +1 -0
  88. package/dist/characterGrounding.js +408 -0
  89. package/dist/characterGrounding.js.map +1 -0
  90. package/dist/conversation/binding.d.ts +13 -0
  91. package/dist/conversation/binding.d.ts.map +1 -1
  92. package/dist/conversation/binding.js.map +1 -1
  93. package/dist/conversation/chatSessionStore.d.ts +178 -0
  94. package/dist/conversation/chatSessionStore.d.ts.map +1 -0
  95. package/dist/conversation/chatSessionStore.js +196 -0
  96. package/dist/conversation/chatSessionStore.js.map +1 -0
  97. package/dist/conversation/controller.d.ts +44 -0
  98. package/dist/conversation/controller.d.ts.map +1 -1
  99. package/dist/conversation/controller.js +82 -3
  100. package/dist/conversation/controller.js.map +1 -1
  101. package/dist/conversation/index.d.ts +2 -0
  102. package/dist/conversation/index.d.ts.map +1 -1
  103. package/dist/conversation/index.js +2 -0
  104. package/dist/conversation/index.js.map +1 -1
  105. package/dist/conversation/participant.d.ts +16 -0
  106. package/dist/conversation/participant.d.ts.map +1 -1
  107. package/dist/conversation/readSequencer.d.ts +38 -0
  108. package/dist/conversation/readSequencer.d.ts.map +1 -0
  109. package/dist/conversation/readSequencer.js +42 -0
  110. package/dist/conversation/readSequencer.js.map +1 -0
  111. package/dist/conversation/roster.d.ts +5 -1
  112. package/dist/conversation/roster.d.ts.map +1 -1
  113. package/dist/conversation/roster.js.map +1 -1
  114. package/dist/conversation/rosterProjection.d.ts +74 -1
  115. package/dist/conversation/rosterProjection.d.ts.map +1 -1
  116. package/dist/conversation/rosterProjection.js +135 -1
  117. package/dist/conversation/rosterProjection.js.map +1 -1
  118. package/dist/conversation/runtime.d.ts +20 -3
  119. package/dist/conversation/runtime.d.ts.map +1 -1
  120. package/dist/conversation/runtime.js +66 -7
  121. package/dist/conversation/runtime.js.map +1 -1
  122. package/dist/conversation/types.d.ts +43 -4
  123. package/dist/conversation/types.d.ts.map +1 -1
  124. package/dist/conversation/voice.d.ts +290 -13
  125. package/dist/conversation/voice.d.ts.map +1 -1
  126. package/dist/conversation/voice.js +565 -42
  127. package/dist/conversation/voice.js.map +1 -1
  128. package/dist/creatorCuration.d.ts +134 -0
  129. package/dist/creatorCuration.d.ts.map +1 -0
  130. package/dist/creatorCuration.js +228 -0
  131. package/dist/creatorCuration.js.map +1 -0
  132. package/dist/creatorDashboard.d.ts +155 -0
  133. package/dist/creatorDashboard.d.ts.map +1 -0
  134. package/dist/creatorDashboard.js +237 -0
  135. package/dist/creatorDashboard.js.map +1 -0
  136. package/dist/creatorUniverse.d.ts +95 -0
  137. package/dist/creatorUniverse.d.ts.map +1 -0
  138. package/dist/creatorUniverse.js +136 -0
  139. package/dist/creatorUniverse.js.map +1 -0
  140. package/dist/curationWrite.d.ts +76 -0
  141. package/dist/curationWrite.d.ts.map +1 -0
  142. package/dist/curationWrite.js +106 -0
  143. package/dist/curationWrite.js.map +1 -0
  144. package/dist/designTokens.d.ts +64 -0
  145. package/dist/designTokens.d.ts.map +1 -0
  146. package/dist/designTokens.js +117 -0
  147. package/dist/designTokens.js.map +1 -0
  148. package/dist/dialogAttribution.d.ts +79 -0
  149. package/dist/dialogAttribution.d.ts.map +1 -0
  150. package/dist/dialogAttribution.js +144 -0
  151. package/dist/dialogAttribution.js.map +1 -0
  152. package/dist/dmRunWorldReadiness.d.ts +605 -0
  153. package/dist/dmRunWorldReadiness.d.ts.map +1 -0
  154. package/dist/dmRunWorldReadiness.js +775 -0
  155. package/dist/dmRunWorldReadiness.js.map +1 -0
  156. package/dist/domains/access.d.ts +32 -0
  157. package/dist/domains/access.d.ts.map +1 -0
  158. package/dist/domains/access.js +43 -0
  159. package/dist/domains/access.js.map +1 -0
  160. package/dist/domains/adventureDefinitions.d.ts +159 -0
  161. package/dist/domains/adventureDefinitions.d.ts.map +1 -0
  162. package/dist/domains/adventureDefinitions.js +168 -0
  163. package/dist/domains/adventureDefinitions.js.map +1 -0
  164. package/dist/domains/adventures.d.ts +329 -0
  165. package/dist/domains/adventures.d.ts.map +1 -0
  166. package/dist/domains/adventures.js +359 -0
  167. package/dist/domains/adventures.js.map +1 -0
  168. package/dist/domains/arcs.d.ts +146 -0
  169. package/dist/domains/arcs.d.ts.map +1 -0
  170. package/dist/domains/arcs.js +202 -0
  171. package/dist/domains/arcs.js.map +1 -0
  172. package/dist/domains/artifacts.d.ts +259 -0
  173. package/dist/domains/artifacts.d.ts.map +1 -0
  174. package/dist/domains/artifacts.js +125 -0
  175. package/dist/domains/artifacts.js.map +1 -0
  176. package/dist/domains/chat.d.ts +158 -0
  177. package/dist/domains/chat.d.ts.map +1 -0
  178. package/dist/domains/chat.js +224 -0
  179. package/dist/domains/chat.js.map +1 -0
  180. package/dist/domains/decisions.d.ts +31 -0
  181. package/dist/domains/decisions.d.ts.map +1 -0
  182. package/dist/domains/decisions.js +42 -0
  183. package/dist/domains/decisions.js.map +1 -0
  184. package/dist/domains/documents.d.ts +218 -0
  185. package/dist/domains/documents.d.ts.map +1 -0
  186. package/dist/domains/documents.js +252 -0
  187. package/dist/domains/documents.js.map +1 -0
  188. package/dist/domains/enhancements.d.ts +106 -0
  189. package/dist/domains/enhancements.d.ts.map +1 -0
  190. package/dist/domains/enhancements.js +160 -0
  191. package/dist/domains/enhancements.js.map +1 -0
  192. package/dist/domains/graph.d.ts +454 -0
  193. package/dist/domains/graph.d.ts.map +1 -0
  194. package/dist/domains/graph.js +648 -0
  195. package/dist/domains/graph.js.map +1 -0
  196. package/dist/domains/images.d.ts +220 -0
  197. package/dist/domains/images.d.ts.map +1 -0
  198. package/dist/domains/images.js +307 -0
  199. package/dist/domains/images.js.map +1 -0
  200. package/dist/domains/ingestion.d.ts +312 -0
  201. package/dist/domains/ingestion.d.ts.map +1 -0
  202. package/dist/domains/ingestion.js +495 -0
  203. package/dist/domains/ingestion.js.map +1 -0
  204. package/dist/domains/me.d.ts +21 -0
  205. package/dist/domains/me.d.ts.map +1 -0
  206. package/dist/domains/me.js +23 -0
  207. package/dist/domains/me.js.map +1 -0
  208. package/dist/domains/orgs.d.ts +47 -0
  209. package/dist/domains/orgs.d.ts.map +1 -0
  210. package/dist/domains/orgs.js +75 -0
  211. package/dist/domains/orgs.js.map +1 -0
  212. package/dist/domains/personas.d.ts +135 -0
  213. package/dist/domains/personas.d.ts.map +1 -0
  214. package/dist/domains/personas.js +316 -0
  215. package/dist/domains/personas.js.map +1 -0
  216. package/dist/domains/projects.d.ts +53 -0
  217. package/dist/domains/projects.d.ts.map +1 -0
  218. package/dist/domains/projects.js +94 -0
  219. package/dist/domains/projects.js.map +1 -0
  220. package/dist/domains/quests.d.ts +431 -0
  221. package/dist/domains/quests.d.ts.map +1 -0
  222. package/dist/domains/quests.js +61 -0
  223. package/dist/domains/quests.js.map +1 -0
  224. package/dist/domains/reactor.d.ts +98 -0
  225. package/dist/domains/reactor.d.ts.map +1 -0
  226. package/dist/domains/reactor.js +131 -0
  227. package/dist/domains/reactor.js.map +1 -0
  228. package/dist/domains/showcase.d.ts +28 -0
  229. package/dist/domains/showcase.d.ts.map +1 -0
  230. package/dist/domains/showcase.js +28 -0
  231. package/dist/domains/showcase.js.map +1 -0
  232. package/dist/domains/storyboards.d.ts +1253 -0
  233. package/dist/domains/storyboards.d.ts.map +1 -0
  234. package/dist/domains/storyboards.js +781 -0
  235. package/dist/domains/storyboards.js.map +1 -0
  236. package/dist/domains/studioSettings.d.ts +39 -0
  237. package/dist/domains/studioSettings.d.ts.map +1 -0
  238. package/dist/domains/studioSettings.js +80 -0
  239. package/dist/domains/studioSettings.js.map +1 -0
  240. package/dist/domains/universes.d.ts +191 -0
  241. package/dist/domains/universes.d.ts.map +1 -0
  242. package/dist/domains/universes.js +276 -0
  243. package/dist/domains/universes.js.map +1 -0
  244. package/dist/domains/userDefaults.d.ts +18 -0
  245. package/dist/domains/userDefaults.d.ts.map +1 -0
  246. package/dist/domains/userDefaults.js +27 -0
  247. package/dist/domains/userDefaults.js.map +1 -0
  248. package/dist/domains/visemeBundles.d.ts +262 -0
  249. package/dist/domains/visemeBundles.d.ts.map +1 -0
  250. package/dist/domains/visemeBundles.js +373 -0
  251. package/dist/domains/visemeBundles.js.map +1 -0
  252. package/dist/domains/workflows.d.ts +142 -0
  253. package/dist/domains/workflows.d.ts.map +1 -0
  254. package/dist/domains/workflows.js +245 -0
  255. package/dist/domains/workflows.js.map +1 -0
  256. package/dist/enhancementDiff.d.ts +56 -0
  257. package/dist/enhancementDiff.d.ts.map +1 -0
  258. package/dist/enhancementDiff.js +110 -0
  259. package/dist/enhancementDiff.js.map +1 -0
  260. package/dist/generated/contract.d.ts +372 -0
  261. package/dist/generated/contract.d.ts.map +1 -0
  262. package/dist/generated/contract.js +390 -0
  263. package/dist/generated/contract.js.map +1 -0
  264. package/dist/graphSchema.d.ts +36 -5
  265. package/dist/graphSchema.d.ts.map +1 -1
  266. package/dist/graphSchema.js +88 -2
  267. package/dist/graphSchema.js.map +1 -1
  268. package/dist/http.d.ts +70 -1
  269. package/dist/http.d.ts.map +1 -1
  270. package/dist/http.js +263 -11
  271. package/dist/http.js.map +1 -1
  272. package/dist/identity.d.ts +81 -0
  273. package/dist/identity.d.ts.map +1 -0
  274. package/dist/identity.js +65 -0
  275. package/dist/identity.js.map +1 -0
  276. package/dist/index.d.ts +35 -0
  277. package/dist/index.d.ts.map +1 -1
  278. package/dist/index.js +118 -0
  279. package/dist/index.js.map +1 -1
  280. package/dist/messageContent.d.ts +174 -0
  281. package/dist/messageContent.d.ts.map +1 -0
  282. package/dist/messageContent.js +405 -0
  283. package/dist/messageContent.js.map +1 -0
  284. package/dist/mutationEpoch.d.ts +83 -0
  285. package/dist/mutationEpoch.d.ts.map +1 -0
  286. package/dist/mutationEpoch.js +109 -0
  287. package/dist/mutationEpoch.js.map +1 -0
  288. package/dist/obo.d.ts +144 -0
  289. package/dist/obo.d.ts.map +1 -0
  290. package/dist/obo.js +135 -0
  291. package/dist/obo.js.map +1 -0
  292. package/dist/opusTransport.d.ts +113 -0
  293. package/dist/opusTransport.d.ts.map +1 -0
  294. package/dist/opusTransport.js +170 -0
  295. package/dist/opusTransport.js.map +1 -0
  296. package/dist/pagination.d.ts +18 -0
  297. package/dist/pagination.d.ts.map +1 -0
  298. package/dist/pagination.js +26 -0
  299. package/dist/pagination.js.map +1 -0
  300. package/dist/platformAssistant.d.ts +55 -1
  301. package/dist/platformAssistant.d.ts.map +1 -1
  302. package/dist/platformAssistant.js +39 -1
  303. package/dist/platformAssistant.js.map +1 -1
  304. package/dist/pollUtils.d.ts +19 -0
  305. package/dist/pollUtils.d.ts.map +1 -0
  306. package/dist/pollUtils.js +35 -0
  307. package/dist/pollUtils.js.map +1 -0
  308. package/dist/questLog.d.ts +232 -0
  309. package/dist/questLog.d.ts.map +1 -0
  310. package/dist/questLog.js +522 -0
  311. package/dist/questLog.js.map +1 -0
  312. package/dist/reactor/dmDirectiveToExperience.d.ts +300 -0
  313. package/dist/reactor/dmDirectiveToExperience.d.ts.map +1 -0
  314. package/dist/reactor/dmDirectiveToExperience.js +401 -0
  315. package/dist/reactor/dmDirectiveToExperience.js.map +1 -0
  316. package/dist/reactor/dmSceneControlPrompt.d.ts.map +1 -1
  317. package/dist/reactor/dmSceneControlPrompt.js +64 -2
  318. package/dist/reactor/dmSceneControlPrompt.js.map +1 -1
  319. package/dist/reactor/dmWorldEntry.d.ts +1278 -0
  320. package/dist/reactor/dmWorldEntry.d.ts.map +1 -0
  321. package/dist/reactor/dmWorldEntry.js +1396 -0
  322. package/dist/reactor/dmWorldEntry.js.map +1 -0
  323. package/dist/reactor/framePromptCompaction.d.ts +223 -0
  324. package/dist/reactor/framePromptCompaction.d.ts.map +1 -0
  325. package/dist/reactor/framePromptCompaction.js +393 -0
  326. package/dist/reactor/framePromptCompaction.js.map +1 -0
  327. package/dist/reactor/frameWorldBind.d.ts +86 -0
  328. package/dist/reactor/frameWorldBind.d.ts.map +1 -0
  329. package/dist/reactor/frameWorldBind.js +79 -0
  330. package/dist/reactor/frameWorldBind.js.map +1 -0
  331. package/dist/reactor/happyOysterSeed.d.ts +166 -0
  332. package/dist/reactor/happyOysterSeed.d.ts.map +1 -0
  333. package/dist/reactor/happyOysterSeed.js +233 -0
  334. package/dist/reactor/happyOysterSeed.js.map +1 -0
  335. package/dist/reactor/happyOysterWalk.d.ts +274 -0
  336. package/dist/reactor/happyOysterWalk.d.ts.map +1 -0
  337. package/dist/reactor/happyOysterWalk.js +407 -0
  338. package/dist/reactor/happyOysterWalk.js.map +1 -0
  339. package/dist/reactor/happyOysterWorld.d.ts +718 -0
  340. package/dist/reactor/happyOysterWorld.d.ts.map +1 -0
  341. package/dist/reactor/happyOysterWorld.js +826 -0
  342. package/dist/reactor/happyOysterWorld.js.map +1 -0
  343. package/dist/reactor/heliosCommandDispatcher.d.ts.map +1 -1
  344. package/dist/reactor/heliosCommandDispatcher.js +5 -2
  345. package/dist/reactor/heliosCommandDispatcher.js.map +1 -1
  346. package/dist/reactor/hiddenWorldLifecycle.d.ts +101 -0
  347. package/dist/reactor/hiddenWorldLifecycle.d.ts.map +1 -0
  348. package/dist/reactor/hiddenWorldLifecycle.js +119 -0
  349. package/dist/reactor/hiddenWorldLifecycle.js.map +1 -0
  350. package/dist/reactor/imageCanvas.d.ts +15 -0
  351. package/dist/reactor/imageCanvas.d.ts.map +1 -0
  352. package/dist/reactor/imageCanvas.js +33 -0
  353. package/dist/reactor/imageCanvas.js.map +1 -0
  354. package/dist/reactor/index.d.ts +19 -0
  355. package/dist/reactor/index.d.ts.map +1 -1
  356. package/dist/reactor/index.js +78 -0
  357. package/dist/reactor/index.js.map +1 -1
  358. package/dist/reactor/longLiveCommandDispatcher.d.ts +23 -8
  359. package/dist/reactor/longLiveCommandDispatcher.d.ts.map +1 -1
  360. package/dist/reactor/longLiveCommandDispatcher.js +16 -4
  361. package/dist/reactor/longLiveCommandDispatcher.js.map +1 -1
  362. package/dist/reactor/longLiveSceneEntry.d.ts +203 -0
  363. package/dist/reactor/longLiveSceneEntry.d.ts.map +1 -0
  364. package/dist/reactor/longLiveSceneEntry.js +280 -0
  365. package/dist/reactor/longLiveSceneEntry.js.map +1 -0
  366. package/dist/reactor/momentCut.d.ts +153 -0
  367. package/dist/reactor/momentCut.d.ts.map +1 -0
  368. package/dist/reactor/momentCut.js +142 -0
  369. package/dist/reactor/momentCut.js.map +1 -0
  370. package/dist/reactor/promptAddonRegistry.d.ts +39 -3
  371. package/dist/reactor/promptAddonRegistry.d.ts.map +1 -1
  372. package/dist/reactor/promptAddonRegistry.js +42 -3
  373. package/dist/reactor/promptAddonRegistry.js.map +1 -1
  374. package/dist/reactor/promptTemplatePreview.d.ts +97 -0
  375. package/dist/reactor/promptTemplatePreview.d.ts.map +1 -0
  376. package/dist/reactor/promptTemplatePreview.js +185 -0
  377. package/dist/reactor/promptTemplatePreview.js.map +1 -0
  378. package/dist/reactor/reactorAvailability.d.ts +80 -0
  379. package/dist/reactor/reactorAvailability.d.ts.map +1 -0
  380. package/dist/reactor/reactorAvailability.js +121 -0
  381. package/dist/reactor/reactorAvailability.js.map +1 -0
  382. package/dist/reactor/reactorSessionRefusal.d.ts +125 -0
  383. package/dist/reactor/reactorSessionRefusal.d.ts.map +1 -0
  384. package/dist/reactor/reactorSessionRefusal.js +197 -0
  385. package/dist/reactor/reactorSessionRefusal.js.map +1 -0
  386. package/dist/reactor/reactorTokenScope.d.ts +47 -0
  387. package/dist/reactor/reactorTokenScope.d.ts.map +1 -0
  388. package/dist/reactor/reactorTokenScope.js +64 -0
  389. package/dist/reactor/reactorTokenScope.js.map +1 -0
  390. package/dist/reactor/resolveDirectorBeats.d.ts +65 -0
  391. package/dist/reactor/resolveDirectorBeats.d.ts.map +1 -0
  392. package/dist/reactor/resolveDirectorBeats.js +86 -0
  393. package/dist/reactor/resolveDirectorBeats.js.map +1 -0
  394. package/dist/reactor/sanaLiveEdit.d.ts +117 -0
  395. package/dist/reactor/sanaLiveEdit.d.ts.map +1 -0
  396. package/dist/reactor/sanaLiveEdit.js +105 -0
  397. package/dist/reactor/sanaLiveEdit.js.map +1 -0
  398. package/dist/reactor/sceneEntry.d.ts +66 -9
  399. package/dist/reactor/sceneEntry.d.ts.map +1 -1
  400. package/dist/reactor/sceneEntry.js +59 -66
  401. package/dist/reactor/sceneEntry.js.map +1 -1
  402. package/dist/reactor/sceneSeedImage.d.ts +199 -0
  403. package/dist/reactor/sceneSeedImage.d.ts.map +1 -0
  404. package/dist/reactor/sceneSeedImage.js +239 -0
  405. package/dist/reactor/sceneSeedImage.js.map +1 -0
  406. package/dist/reactor/seedImageOrchestrator.d.ts +70 -3
  407. package/dist/reactor/seedImageOrchestrator.d.ts.map +1 -1
  408. package/dist/reactor/seedImageOrchestrator.js +92 -28
  409. package/dist/reactor/seedImageOrchestrator.js.map +1 -1
  410. package/dist/reactor/toolPromptAddon.d.ts.map +1 -1
  411. package/dist/reactor/toolPromptAddon.js +16 -2
  412. package/dist/reactor/toolPromptAddon.js.map +1 -1
  413. package/dist/reactor/worldMintLoop.d.ts +286 -0
  414. package/dist/reactor/worldMintLoop.d.ts.map +1 -0
  415. package/dist/reactor/worldMintLoop.js +381 -0
  416. package/dist/reactor/worldMintLoop.js.map +1 -0
  417. package/dist/reactor/worldSteerOutcome.d.ts +98 -0
  418. package/dist/reactor/worldSteerOutcome.d.ts.map +1 -0
  419. package/dist/reactor/worldSteerOutcome.js +81 -0
  420. package/dist/reactor/worldSteerOutcome.js.map +1 -0
  421. package/dist/retryAfter.d.ts +15 -0
  422. package/dist/retryAfter.d.ts.map +1 -0
  423. package/dist/retryAfter.js +75 -0
  424. package/dist/retryAfter.js.map +1 -0
  425. package/dist/seriesKey.d.ts +31 -0
  426. package/dist/seriesKey.d.ts.map +1 -0
  427. package/dist/seriesKey.js +33 -0
  428. package/dist/seriesKey.js.map +1 -0
  429. package/dist/sessionRefresh.d.ts +135 -0
  430. package/dist/sessionRefresh.d.ts.map +1 -0
  431. package/dist/sessionRefresh.js +215 -0
  432. package/dist/sessionRefresh.js.map +1 -0
  433. package/dist/sharedAudioContext.d.ts +39 -0
  434. package/dist/sharedAudioContext.d.ts.map +1 -0
  435. package/dist/sharedAudioContext.js +63 -0
  436. package/dist/sharedAudioContext.js.map +1 -0
  437. package/dist/singleFlight.d.ts +51 -0
  438. package/dist/singleFlight.d.ts.map +1 -0
  439. package/dist/singleFlight.js +87 -0
  440. package/dist/singleFlight.js.map +1 -0
  441. package/dist/storyGraph.d.ts +83 -0
  442. package/dist/storyGraph.d.ts.map +1 -1
  443. package/dist/storyGraph.js +169 -4
  444. package/dist/storyGraph.js.map +1 -1
  445. package/dist/storyboardMask.d.ts +343 -0
  446. package/dist/storyboardMask.d.ts.map +1 -0
  447. package/dist/storyboardMask.js +505 -0
  448. package/dist/storyboardMask.js.map +1 -0
  449. package/dist/storyboardTimeline.d.ts +93 -0
  450. package/dist/storyboardTimeline.d.ts.map +1 -0
  451. package/dist/storyboardTimeline.js +131 -0
  452. package/dist/storyboardTimeline.js.map +1 -0
  453. package/dist/studioAutomation.d.ts +104 -0
  454. package/dist/studioAutomation.d.ts.map +1 -0
  455. package/dist/studioAutomation.js +178 -0
  456. package/dist/studioAutomation.js.map +1 -0
  457. package/dist/tenantClaim.d.ts +86 -0
  458. package/dist/tenantClaim.d.ts.map +1 -0
  459. package/dist/tenantClaim.js +164 -0
  460. package/dist/tenantClaim.js.map +1 -0
  461. package/dist/timeFormat.d.ts +25 -0
  462. package/dist/timeFormat.d.ts.map +1 -1
  463. package/dist/timeFormat.js +56 -0
  464. package/dist/timeFormat.js.map +1 -1
  465. package/dist/toolSchemas.d.ts +53 -10
  466. package/dist/toolSchemas.d.ts.map +1 -1
  467. package/dist/toolSchemas.js +36 -9
  468. package/dist/toolSchemas.js.map +1 -1
  469. package/dist/transport.d.ts +120 -0
  470. package/dist/transport.d.ts.map +1 -0
  471. package/dist/transport.js +282 -0
  472. package/dist/transport.js.map +1 -0
  473. package/dist/videoGenFacade.d.ts +63 -0
  474. package/dist/videoGenFacade.d.ts.map +1 -0
  475. package/dist/videoGenFacade.js +49 -0
  476. package/dist/videoGenFacade.js.map +1 -0
  477. package/dist/visemeScheduler.d.ts +24 -2
  478. package/dist/visemeScheduler.d.ts.map +1 -1
  479. package/dist/visemeScheduler.js +31 -2
  480. package/dist/visemeScheduler.js.map +1 -1
  481. package/dist/vision/VisionPublisher.d.ts +88 -0
  482. package/dist/vision/VisionPublisher.d.ts.map +1 -1
  483. package/dist/vision/VisionPublisher.js +196 -13
  484. package/dist/vision/VisionPublisher.js.map +1 -1
  485. package/dist/vision/VisionSourceController.d.ts +67 -1
  486. package/dist/vision/VisionSourceController.d.ts.map +1 -1
  487. package/dist/vision/VisionSourceController.js +147 -5
  488. package/dist/vision/VisionSourceController.js.map +1 -1
  489. package/dist/vision/index.d.ts +2 -1
  490. package/dist/vision/index.d.ts.map +1 -1
  491. package/dist/vision/index.js +2 -1
  492. package/dist/vision/index.js.map +1 -1
  493. package/dist/vision/sourceKinds.d.ts +18 -5
  494. package/dist/vision/sourceKinds.d.ts.map +1 -1
  495. package/dist/vision/sourceKinds.js +15 -2
  496. package/dist/vision/sourceKinds.js.map +1 -1
  497. package/dist/vision/types.d.ts +7 -4
  498. package/dist/vision/types.d.ts.map +1 -1
  499. package/dist/vision/visionErrors.d.ts +45 -0
  500. package/dist/vision/visionErrors.d.ts.map +1 -0
  501. package/dist/vision/visionErrors.js +66 -0
  502. package/dist/vision/visionErrors.js.map +1 -0
  503. package/dist/voiceCloneCaption.d.ts +33 -0
  504. package/dist/voiceCloneCaption.d.ts.map +1 -0
  505. package/dist/voiceCloneCaption.js +69 -0
  506. package/dist/voiceCloneCaption.js.map +1 -0
  507. package/dist/websocket.d.ts +273 -10
  508. package/dist/websocket.d.ts.map +1 -1
  509. package/dist/websocket.js +79 -0
  510. package/dist/websocket.js.map +1 -1
  511. package/dist/workflowAuthoring.d.ts +139 -0
  512. package/dist/workflowAuthoring.d.ts.map +1 -0
  513. package/dist/workflowAuthoring.js +557 -0
  514. package/dist/workflowAuthoring.js.map +1 -0
  515. package/package.json +15 -5
  516. package/src/__tests__/adapters-director.test.ts +9 -6
  517. package/src/__tests__/adapters-extraction.test.ts +175 -0
  518. package/src/__tests__/adapters-image.test.ts +66 -0
  519. package/src/__tests__/adapters-momentPolicy.test.ts +218 -0
  520. package/src/__tests__/adapters-platform.test.ts +110 -4
  521. package/src/__tests__/adapters-videogen.test.ts +53 -0
  522. package/src/__tests__/adapters-world.test.ts +117 -7
  523. package/src/__tests__/admin.enhancement-defaults.test.ts +115 -0
  524. package/src/__tests__/admin.test.ts +282 -0
  525. package/src/__tests__/adventures-world-state.test.ts +156 -0
  526. package/src/__tests__/adventures.test.ts +111 -1
  527. package/src/__tests__/api-pollers.test.ts +113 -23
  528. package/src/__tests__/api.adventure-definitions.test.ts +312 -0
  529. package/src/__tests__/api.anchor-beat.test.ts +75 -0
  530. package/src/__tests__/api.arc-approval.test.ts +171 -0
  531. package/src/__tests__/api.arc-beats-floor.test.ts +56 -0
  532. package/src/__tests__/api.arc-generation.test.ts +168 -0
  533. package/src/__tests__/api.arc-templates.test.ts +78 -0
  534. package/src/__tests__/api.assignVideoSeries.test.ts +81 -0
  535. package/src/__tests__/api.cast-frame-choices.test.ts +141 -0
  536. package/src/__tests__/api.cutscene-registry.test.ts +148 -0
  537. package/src/__tests__/api.enhancement-addition-actions.test.ts +137 -0
  538. package/src/__tests__/api.enrichVideo-serialization.test.ts +116 -0
  539. package/src/__tests__/api.extraction-base.test.ts +87 -0
  540. package/src/__tests__/api.generateVideo-cutscene.test.ts +148 -0
  541. package/src/__tests__/api.job-pipeline-stages.test.ts +128 -0
  542. package/src/__tests__/api.list-images-filters.test.ts +6 -3
  543. package/src/__tests__/api.quest-curation.test.ts +169 -0
  544. package/src/__tests__/api.reprocessVideo.test.ts +71 -0
  545. package/src/__tests__/api.scene-split-merge.test.ts +129 -0
  546. package/src/__tests__/api.session-quests.test.ts +184 -0
  547. package/src/__tests__/api.test.ts +122 -0
  548. package/src/__tests__/api.transferSeries.test.ts +114 -0
  549. package/src/__tests__/api.unknown-clusters.test.ts +225 -0
  550. package/src/__tests__/api.uploadVideo-options.test.ts +156 -0
  551. package/src/__tests__/arcPreview.test.ts +71 -0
  552. package/src/__tests__/arcStyleProfile.test.ts +204 -0
  553. package/src/__tests__/artifacts-delete.test.ts +109 -0
  554. package/src/__tests__/audio.test.ts +864 -5
  555. package/src/__tests__/audioDsp.test.ts +196 -0
  556. package/src/__tests__/audioUnavailable.test.ts +43 -0
  557. package/src/__tests__/cast.test.ts +10 -1
  558. package/src/__tests__/castCurationProjection.test.ts +84 -0
  559. package/src/__tests__/castFramePipelinePending.test.ts +171 -0
  560. package/src/__tests__/castProjection.test.ts +497 -5
  561. package/src/__tests__/characterGrounding.test.ts +357 -0
  562. package/src/__tests__/contract.test.ts +97 -0
  563. package/src/__tests__/conversation/chatSessionStore.test.ts +243 -0
  564. package/src/__tests__/conversation/controller.test.ts +211 -0
  565. package/src/__tests__/conversation/readSequencer.test.ts +52 -0
  566. package/src/__tests__/conversation/rosterProjection.test.ts +204 -3
  567. package/src/__tests__/conversation/runtime.test.ts +118 -1
  568. package/src/__tests__/conversation/voice.test.ts +741 -7
  569. package/src/__tests__/creatorCuration.test.ts +256 -0
  570. package/src/__tests__/creatorDashboard.test.ts +444 -0
  571. package/src/__tests__/creatorUniverse.test.ts +138 -0
  572. package/src/__tests__/curationWrite.test.ts +179 -0
  573. package/src/__tests__/decisions.test.ts +89 -0
  574. package/src/__tests__/designTokens.test.ts +72 -0
  575. package/src/__tests__/dialogAttribution.test.ts +187 -0
  576. package/src/__tests__/dmDirectiveToExperience.test.ts +198 -0
  577. package/src/__tests__/dmWorldEntry.test.ts +2102 -0
  578. package/src/__tests__/enhancementDiff.test.ts +132 -0
  579. package/src/__tests__/experienceModelCatalog.test.ts +292 -0
  580. package/src/__tests__/extractionStageState.test.ts +67 -0
  581. package/src/__tests__/getVideo.test.ts +95 -0
  582. package/src/__tests__/graphReadAfterWrite.test.ts +211 -0
  583. package/src/__tests__/graphSchema.test.ts +55 -4
  584. package/src/__tests__/happyOysterSeed.test.ts +208 -0
  585. package/src/__tests__/happyOysterWorld.test.ts +1241 -0
  586. package/src/__tests__/happyOysterWorldRefusal.test.ts +224 -0
  587. package/src/__tests__/hiddenWorldLifecycle.test.ts +203 -0
  588. package/src/__tests__/http.session-refresh.test.ts +424 -0
  589. package/src/__tests__/http.test.ts +316 -0
  590. package/src/__tests__/identity.test.ts +132 -0
  591. package/src/__tests__/loadBundleManifest.test.ts +192 -22
  592. package/src/__tests__/longLiveSceneEntry.test.ts +371 -0
  593. package/src/__tests__/me.test.ts +74 -0
  594. package/src/__tests__/messageContent.test.ts +395 -0
  595. package/src/__tests__/momentCut.test.ts +229 -0
  596. package/src/__tests__/mutationEpoch.test.ts +218 -0
  597. package/src/__tests__/obo.test.ts +159 -0
  598. package/src/__tests__/opusTransport.test.ts +182 -0
  599. package/src/__tests__/opusTransportLibopus.test.ts +125 -0
  600. package/src/__tests__/orgs.test.ts +229 -0
  601. package/src/__tests__/persona-generation.test.ts +187 -1
  602. package/src/__tests__/platformAssistant.test.ts +140 -0
  603. package/src/__tests__/projects.test.ts +338 -0
  604. package/src/__tests__/promptTemplatePreview.test.ts +160 -0
  605. package/src/__tests__/reactor/__fixtures__/realFramePromptText.ts +23 -0
  606. package/src/__tests__/reactor/api-reactor.test.ts +60 -21
  607. package/src/__tests__/reactor/framePromptCompaction.test.ts +300 -0
  608. package/src/__tests__/reactor/promptAddonRegistry.test.ts +79 -0
  609. package/src/__tests__/reactor/reactorTokenScope.test.ts +50 -0
  610. package/src/__tests__/reactor/resolveDirectorBeats.test.ts +156 -0
  611. package/src/__tests__/reactor/sceneEntry.test.ts +3 -0
  612. package/src/__tests__/reactor/sceneSeedImage.test.ts +361 -0
  613. package/src/__tests__/reactor/seedImageOrchestrator.test.ts +43 -5
  614. package/src/__tests__/reactor-happyOysterWalk.test.ts +294 -0
  615. package/src/__tests__/reactorAvailability.test.ts +217 -0
  616. package/src/__tests__/reactorSessionRefusal.test.ts +189 -0
  617. package/src/__tests__/regeneration.test.ts +9 -9
  618. package/src/__tests__/reprocessBlockedReason.test.ts +30 -0
  619. package/src/__tests__/retryAfter.test.ts +65 -0
  620. package/src/__tests__/roleClaim.test.ts +102 -0
  621. package/src/__tests__/sanaLiveEdit.test.ts +84 -0
  622. package/src/__tests__/seriesKey.test.ts +24 -0
  623. package/src/__tests__/settings-set9.test.ts +238 -0
  624. package/src/__tests__/singleFlight.test.ts +348 -0
  625. package/src/__tests__/storyGraph.test.ts +111 -1
  626. package/src/__tests__/storyboardFrameCutscene.test.ts +115 -0
  627. package/src/__tests__/storyboardMask.test.ts +527 -0
  628. package/src/__tests__/storyboardTimeline.test.ts +228 -0
  629. package/src/__tests__/storyboards.test.ts +639 -0
  630. package/src/__tests__/studioAutomation.test.ts +325 -0
  631. package/src/__tests__/toolSchemas.test.ts +11 -18
  632. package/src/__tests__/transport.test.ts +312 -0
  633. package/src/__tests__/videoGenFacade.test.ts +141 -0
  634. package/src/__tests__/videoGraph.test.ts +43 -1
  635. package/src/__tests__/visemeScheduler.test.ts +55 -1
  636. package/src/__tests__/visibility.test.ts +143 -0
  637. package/src/__tests__/voiceCloneCaption.test.ts +80 -0
  638. package/src/__tests__/voiceFallback.test.ts +55 -0
  639. package/src/__tests__/websocket-error-turn-ended.test.ts +49 -0
  640. package/src/__tests__/websocket-vision.test.ts +141 -0
  641. package/src/__tests__/websocket.test.ts +75 -1
  642. package/src/__tests__/workflowAuthoring.test.ts +187 -0
  643. package/src/__tests__/workflows.test.ts +640 -0
  644. package/src/__tests__/worldMintLoop.test.ts +448 -0
  645. package/src/__tests__/worldModelPreference.test.ts +302 -0
  646. package/src/__tests__/worldModelTradeoffs.test.ts +89 -0
  647. package/src/__tests__/worldSteerOutcome.test.ts +62 -0
  648. package/src/adapters/capabilities.ts +39 -3
  649. package/src/adapters/directorAdapter.ts +5 -4
  650. package/src/adapters/experienceModelCatalog.ts +538 -0
  651. package/src/adapters/extractionAdapter.ts +150 -0
  652. package/src/adapters/imageAdapter.ts +5 -1
  653. package/src/adapters/index.ts +104 -17
  654. package/src/adapters/momentDirective.ts +109 -0
  655. package/src/adapters/momentPolicy.ts +209 -0
  656. package/src/adapters/registry.ts +1 -1
  657. package/src/adapters/videoGenAdapter.ts +124 -0
  658. package/src/adapters/worldAdapter.ts +221 -16
  659. package/src/adapters/worldModelPreference.ts +247 -0
  660. package/src/adapters/worldModelTradeoffs.ts +247 -0
  661. package/src/admin.ts +842 -16
  662. package/src/api.ts +12670 -3446
  663. package/src/arcBoardJoin.ts +46 -0
  664. package/src/arcPreview.ts +103 -0
  665. package/src/audio.ts +691 -130
  666. package/src/audioDsp.ts +132 -0
  667. package/src/audioProtocol.ts +235 -0
  668. package/src/beatTitles.ts +51 -0
  669. package/src/castProjection.ts +311 -0
  670. package/src/characterGrounding.ts +491 -0
  671. package/src/conversation/binding.ts +13 -0
  672. package/src/conversation/chatSessionStore.ts +281 -0
  673. package/src/conversation/controller.ts +96 -3
  674. package/src/conversation/index.ts +2 -0
  675. package/src/conversation/participant.ts +16 -0
  676. package/src/conversation/readSequencer.ts +55 -0
  677. package/src/conversation/roster.ts +5 -1
  678. package/src/conversation/rosterProjection.ts +166 -2
  679. package/src/conversation/runtime.ts +66 -7
  680. package/src/conversation/types.ts +43 -4
  681. package/src/conversation/voice.ts +655 -51
  682. package/src/creatorCuration.ts +316 -0
  683. package/src/creatorDashboard.ts +344 -0
  684. package/src/creatorUniverse.ts +222 -0
  685. package/src/curationWrite.ts +108 -0
  686. package/src/designTokens.ts +157 -0
  687. package/src/dialogAttribution.ts +182 -0
  688. package/src/dmRunWorldReadiness.ts +1168 -0
  689. package/src/domains/access.ts +92 -0
  690. package/src/domains/adventureDefinitions.ts +313 -0
  691. package/src/domains/adventures.ts +557 -0
  692. package/src/domains/arcs.ts +350 -0
  693. package/src/domains/artifacts.ts +349 -0
  694. package/src/domains/chat.ts +338 -0
  695. package/src/domains/decisions.ts +62 -0
  696. package/src/domains/documents.ts +389 -0
  697. package/src/domains/enhancements.ts +259 -0
  698. package/src/domains/graph.ts +959 -0
  699. package/src/domains/images.ts +451 -0
  700. package/src/domains/ingestion.ts +695 -0
  701. package/src/domains/me.ts +27 -0
  702. package/src/domains/orgs.ts +168 -0
  703. package/src/domains/personas.ts +433 -0
  704. package/src/domains/projects.ts +177 -0
  705. package/src/domains/quests.ts +587 -0
  706. package/src/domains/reactor.ts +163 -0
  707. package/src/domains/showcase.ts +35 -0
  708. package/src/domains/storyboards.ts +1698 -0
  709. package/src/domains/studioSettings.ts +149 -0
  710. package/src/domains/universes.ts +433 -0
  711. package/src/domains/userDefaults.ts +37 -0
  712. package/src/domains/visemeBundles.ts +541 -0
  713. package/src/domains/workflows.ts +376 -0
  714. package/src/enhancementDiff.ts +171 -0
  715. package/src/generated/contract.ts +1011 -0
  716. package/src/graphSchema.ts +154 -6
  717. package/src/http.ts +295 -11
  718. package/src/identity.ts +123 -0
  719. package/src/index.ts +131 -0
  720. package/src/messageContent.ts +500 -0
  721. package/src/mutationEpoch.ts +107 -0
  722. package/src/obo.ts +201 -0
  723. package/src/opusTransport.ts +268 -0
  724. package/src/pagination.ts +29 -0
  725. package/src/platformAssistant.ts +97 -1
  726. package/src/pollUtils.ts +35 -0
  727. package/src/questLog.ts +704 -0
  728. package/src/reactor/dmDirectiveToExperience.ts +636 -0
  729. package/src/reactor/dmSceneControlPrompt.ts +69 -2
  730. package/src/reactor/dmWorldEntry.ts +2226 -0
  731. package/src/reactor/framePromptCompaction.ts +544 -0
  732. package/src/reactor/frameWorldBind.ts +133 -0
  733. package/src/reactor/happyOysterSeed.ts +329 -0
  734. package/src/reactor/happyOysterWalk.ts +541 -0
  735. package/src/reactor/happyOysterWorld.ts +1270 -0
  736. package/src/reactor/heliosCommandDispatcher.ts +5 -1
  737. package/src/reactor/hiddenWorldLifecycle.ts +182 -0
  738. package/src/reactor/imageCanvas.ts +38 -0
  739. package/src/reactor/index.ts +78 -0
  740. package/src/reactor/longLiveCommandDispatcher.ts +23 -8
  741. package/src/reactor/longLiveSceneEntry.ts +409 -0
  742. package/src/reactor/momentCut.ts +219 -0
  743. package/src/reactor/promptAddonRegistry.ts +81 -3
  744. package/src/reactor/promptTemplatePreview.ts +240 -0
  745. package/src/reactor/reactorAvailability.ts +155 -0
  746. package/src/reactor/reactorSessionRefusal.ts +260 -0
  747. package/src/reactor/reactorTokenScope.ts +69 -0
  748. package/src/reactor/resolveDirectorBeats.ts +140 -0
  749. package/src/reactor/sanaLiveEdit.ts +158 -0
  750. package/src/reactor/sceneEntry.ts +106 -88
  751. package/src/reactor/sceneSeedImage.ts +338 -0
  752. package/src/reactor/seedImageOrchestrator.ts +116 -34
  753. package/src/reactor/toolPromptAddon.ts +16 -2
  754. package/src/reactor/worldMintLoop.ts +545 -0
  755. package/src/reactor/worldSteerOutcome.ts +132 -0
  756. package/src/retryAfter.ts +71 -0
  757. package/src/seriesKey.ts +42 -0
  758. package/src/sessionRefresh.ts +237 -0
  759. package/src/sharedAudioContext.ts +67 -0
  760. package/src/singleFlight.ts +91 -0
  761. package/src/storyGraph.ts +247 -4
  762. package/src/storyboardMask.ts +756 -0
  763. package/src/storyboardTimeline.ts +220 -0
  764. package/src/studioAutomation.ts +208 -0
  765. package/src/tenantClaim.ts +170 -0
  766. package/src/timeFormat.ts +51 -0
  767. package/src/toolSchemas.ts +39 -10
  768. package/src/transport.ts +327 -0
  769. package/src/videoGenFacade.ts +90 -0
  770. package/src/visemeScheduler.ts +36 -3
  771. package/src/vision/VisionPublisher.ts +204 -14
  772. package/src/vision/VisionSourceController.ts +187 -6
  773. package/src/vision/__tests__/VisionPublisher.kvs.test.ts +50 -0
  774. package/src/vision/__tests__/VisionPublisher.test.ts +291 -0
  775. package/src/vision/__tests__/VisionSourceController.test.ts +376 -6
  776. package/src/vision/index.ts +5 -1
  777. package/src/vision/sourceKinds.ts +19 -5
  778. package/src/vision/types.ts +7 -4
  779. package/src/vision/visionErrors.ts +70 -0
  780. package/src/voiceCloneCaption.ts +77 -0
  781. package/src/websocket.ts +361 -12
  782. package/src/workflowAuthoring.ts +664 -0
@@ -0,0 +1,781 @@
1
+ /**
2
+ * Visual-storyboard domain module (§Q SB-U.1, spec slice S1 —
3
+ * `specs/2026-07-24-storyboard-generator.md` §4.1/§4.5).
4
+ *
5
+ * Wire-type MIRROR of `shared/storyboard_models.py` (frozen by §Q SB.1,
6
+ * PR #1464) plus the §4.5 request surface. The BACKEND module is the single
7
+ * source of truth for this vocabulary: every union here is mirrored, never
8
+ * re-derived, and no consumer hard-codes a raw status/mode string. Additive-
9
+ * only, framework-agnostic (no React/Vue imports) — the `quests.ts`/
10
+ * `artifacts.ts` posture.
11
+ *
12
+ * Three shape decisions SB.1 PINNED, honoured here rather than re-litigated:
13
+ *
14
+ * 1. **Ordering lives ONLY in {@link Storyboard.frameIds}.** There is no
15
+ * per-frame `order` field and this module does not add one — a reorder is
16
+ * the single idempotent list patch
17
+ * {@link StoryboardsApi.reorderStoryboardFrames}, and
18
+ * {@link orderStoryboardFrames} is the ONE resolver that turns the id list
19
+ * into a rendered sequence.
20
+ * 2. **Frame status is DERIVED, never stored.** The backend computes it
21
+ * (`StoryboardFrame.status`, a pydantic `computed_field`) so it DOES ride
22
+ * the wire read-only; {@link deriveFrameStatus} mirrors the same rule for
23
+ * optimistic UI. Nothing client-side ever SENDS a frame status.
24
+ * 3. **Master frame is `1664×936` at exactly `16:9`**
25
+ * ({@link STORYBOARD_MASTER_FRAME_WIDTH}/{@link STORYBOARD_MASTER_FRAME_HEIGHT}/
26
+ * {@link STORYBOARD_MASTER_ASPECT_RATIO}). The old contradictory 1664×960
27
+ * appears nowhere — `StyleProfile` is REJECTED server-side when the declared
28
+ * ratio and the declared pixels disagree.
29
+ *
30
+ * `txnVer` is the store-owned optimistic-lock value. Clients never mint it:
31
+ * they read it off a frame and echo it back on the version-guarded writes
32
+ * ({@link StoryboardsApi.patchStoryboardFrame} /
33
+ * {@link StoryboardsApi.selectStoryboardFrameVariant}). Omitting it makes those
34
+ * calls last-writer-wins.
35
+ *
36
+ * Land-dark: the whole backend surface 404s until `SEER_STORYBOARD_ENABLED` is
37
+ * set server-side (SB.4 ships the routes; SB.15 flips staging). As of this
38
+ * slice NO storyboard route exists yet — this module is the contract every
39
+ * SB-U row builds against.
40
+ */
41
+ /** Statuses no transition may leave (mirrors `STORYBOARD_TERMINAL_STATUSES`). */
42
+ export const STORYBOARD_TERMINAL_STATUSES = [
43
+ 'succeeded',
44
+ 'failed',
45
+ 'cancelled',
46
+ ];
47
+ /** Poll predicate for the 202-create flow — prefer this over raw comparisons. */
48
+ export function isStoryboardTerminal(status) {
49
+ return STORYBOARD_TERMINAL_STATUSES.includes(status);
50
+ }
51
+ // --------------------------------------------------------------- constants
52
+ /** Canonical master-frame width in pixels (`MASTER_FRAME_WIDTH`). */
53
+ export const STORYBOARD_MASTER_FRAME_WIDTH = 1664;
54
+ /** Canonical master-frame height — 1664 × 9/16, exactly 16:9 (`MASTER_FRAME_HEIGHT`). */
55
+ export const STORYBOARD_MASTER_FRAME_HEIGHT = 936;
56
+ /** The ONE aspect ratio v1 boards render at, `"W:H"` (`MASTER_ASPECT_RATIO`). */
57
+ export const STORYBOARD_MASTER_ASPECT_RATIO = '16:9';
58
+ /** Max frames one board may hold (`MAX_FRAMES_PER_BOARD`). */
59
+ export const MAX_FRAMES_PER_BOARD = 24;
60
+ /** Variant history kept per frame (`VARIANT_HISTORY_CAP`); overflow evicts the
61
+ * oldest NON-SELECTED variant server-side. */
62
+ export const FRAME_VARIANT_HISTORY_CAP = 8;
63
+ /** Marble multi-view degrees cap — ≤8 in reconstruction mode
64
+ * (`MULTI_VIEW_AZIMUTH_CAP`). */
65
+ export const MULTI_VIEW_AZIMUTH_CAP = 8;
66
+ /** The same set as data, for pickers and validation messages
67
+ * (`FRAME_DURATION_CHOICES`). */
68
+ export const FRAME_DURATION_CHOICES = [4, 6, 8];
69
+ /** Our default when the composer does not choose (`DEFAULT_FRAME_DURATION_SECONDS`). */
70
+ export const DEFAULT_FRAME_DURATION_SECONDS = 6;
71
+ /** Per-tag length cap (`STYLE_TAG_MAX_LEN`) — the editor's own bound. */
72
+ export const STORYBOARD_STYLE_TAG_MAX_LEN = 64;
73
+ /** Style-tag count cap (`STYLE_TAGS_MAX`). */
74
+ export const STORYBOARD_STYLE_TAGS_MAX = 12;
75
+ /** Free-text prompt-field cap (`PROMPT_TEXT_MAX_LEN`). */
76
+ export const STORYBOARD_PROMPT_TEXT_MAX_LEN = 2000;
77
+ /** Dialogue-line count cap (`DIALOG_LINES_MAX`). */
78
+ export const STORYBOARD_DIALOG_LINES_MAX = 12;
79
+ /** Per-list reference cap for `characterRefs`/`settingRefs` (`FRAME_REFS_MAX`). */
80
+ export const STORYBOARD_FRAME_REFS_MAX = 12;
81
+ /**
82
+ * The frame budget an arc variant would generate — mirror of the backend's
83
+ * frame planner (`services/storyboard/worker.py` `_plan_frames`), which walks
84
+ * `topological_node_order(variant)` (beats then endings — EVERY beat and EVERY
85
+ * ending, in a stable order) and stops at {@link MAX_FRAMES_PER_BOARD}.
86
+ *
87
+ * Only the COUNT is mirrored, never the ordering: the count is order-invariant,
88
+ * so this cannot drift from the planner the way a re-implemented topological
89
+ * sort would. Structurally typed rather than taking `ArcVariant` so the
90
+ * storyboard module keeps its one-way dependency (arcs types live in `api.ts`,
91
+ * which imports this module).
92
+ */
93
+ export function storyboardFrameBudget(variant) {
94
+ const nodeCount = variant.beats.length + variant.endings.length;
95
+ return {
96
+ nodeCount,
97
+ frameCount: Math.min(nodeCount, MAX_FRAMES_PER_BOARD),
98
+ capped: nodeCount > MAX_FRAMES_PER_BOARD,
99
+ };
100
+ }
101
+ /** The default a surface starts on — identical to what the backend assumes. */
102
+ export const DEFAULT_ARC_STYLE_SELECTION = {
103
+ mode: 'original_similar',
104
+ styleTags: [],
105
+ styleDirection: '',
106
+ };
107
+ /**
108
+ * Trim, drop blanks, and de-duplicate style tags, preserving typed order.
109
+ *
110
+ * De-duplication is case-SENSITIVE on purpose: the backend folds tags into
111
+ * frame prompts verbatim, so `"Noir"` and `"noir"` are two different words to
112
+ * the image model and collapsing them would silently edit the creator's look.
113
+ * It only removes an exact repeat, which is always a typo.
114
+ */
115
+ export function normalizeArcStyleTags(tags) {
116
+ const seen = new Set();
117
+ const out = [];
118
+ for (const raw of tags ?? []) {
119
+ const tag = String(raw ?? '').trim();
120
+ if (tag === '' || seen.has(tag))
121
+ continue;
122
+ seen.add(tag);
123
+ out.push(tag);
124
+ }
125
+ return out;
126
+ }
127
+ /**
128
+ * Length in CODE POINTS, which is what the backend counts.
129
+ *
130
+ * `String.length` counts UTF-16 code units, so a 64-emoji tag measures 128 here
131
+ * and 64 in pydantic — the client would reject a value the server accepts. The
132
+ * error direction is safe (a false block, not a false send) and it is still a
133
+ * false gate on a creator's own text (codex, this PR).
134
+ */
135
+ function codePointLength(text) {
136
+ return [...text].length;
137
+ }
138
+ /**
139
+ * Why this selection would 422, or `null` when it is sendable.
140
+ *
141
+ * The caps are the backend's (`STYLE_TAGS_MAX`, `STYLE_TAG_MAX_LEN`,
142
+ * `PROMPT_TEXT_MAX_LEN`) and they are checked HERE rather than left to the
143
+ * server because `StyleProfile` validation happens at ARC GENERATION — a 422
144
+ * there loses the whole request, not just the style.
145
+ *
146
+ * The `original_similar` arm never fails: {@link buildArcStyleProfile} sends
147
+ * nothing on it, so an over-cap tag the creator typed and then abandoned
148
+ * cannot block a generate.
149
+ */
150
+ export function arcStyleSelectionError(selection) {
151
+ if (selection.mode === 'original_similar')
152
+ return null;
153
+ const tags = normalizeArcStyleTags(selection.styleTags);
154
+ if (tags.length > STORYBOARD_STYLE_TAGS_MAX) {
155
+ return `Use at most ${STORYBOARD_STYLE_TAGS_MAX} style tags (you have ${tags.length}).`;
156
+ }
157
+ const tooLong = tags.find((tag) => codePointLength(tag) > STORYBOARD_STYLE_TAG_MAX_LEN);
158
+ if (tooLong !== undefined) {
159
+ return `Each style tag must be ${STORYBOARD_STYLE_TAG_MAX_LEN} characters or fewer — "${tooLong.slice(0, 24)}…" is ${codePointLength(tooLong)}.`;
160
+ }
161
+ const direction = (selection.styleDirection ?? '').trim();
162
+ if (codePointLength(direction) > STORYBOARD_PROMPT_TEXT_MAX_LEN) {
163
+ return `Art direction must be ${STORYBOARD_PROMPT_TEXT_MAX_LEN} characters or fewer (you have ${codePointLength(direction)}).`;
164
+ }
165
+ return null;
166
+ }
167
+ /**
168
+ * The `styleProfile` partial to put on a `GenerateArcRequest`, or `undefined`
169
+ * to OMIT the key entirely (§Q `BOARD.5`).
170
+ *
171
+ * ⛔ **THE DEFAULT ARM RETURNS `undefined`, NOT A NEUTRAL PROFILE.** Every
172
+ * arc-generate surface omitted the key before this row, and the backend's
173
+ * `StyleProfile()` defaults ARE `original_similar` with no tags — so omitting
174
+ * keeps an unstyled generate byte-identical to what shipped, which is the
175
+ * only way to be sure this row changed nothing for a creator who ignores it.
176
+ * ⚠ The reason is NOT that a sent key would 422: `styleProfile` is a declared
177
+ * optional field and `{}` validates straight through to those same defaults
178
+ * (codex corrected an earlier claim here that blamed `extra="forbid"`; that
179
+ * setting rejects UNDECLARED keys, which this is not). The reason is that a
180
+ * proposal recording an explicit profile and one recording "the creator did
181
+ * not choose" are different facts, and only the second is true here.
182
+ *
183
+ * ⛔ **THE `original_similar` ARM DROPS TAGS AND DIRECTION.** The backend's
184
+ * `sheet_style_recipe` treats a profile as STYLIZED when it carries tags or
185
+ * direction *regardless of mode*, so forwarding text a creator typed and then
186
+ * switched away from would quietly buy a stylized board they de-selected.
187
+ *
188
+ * ⛔ **GEOMETRY IS NEVER SENT.** `aspectRatio`/`masterWidth`/`masterHeight`
189
+ * must agree with each other or the backend 422s the ARC REQUEST (not the
190
+ * board), and this surface offers no master control — so the server's own
191
+ * defaults are the only correct source. `boardSeed` is likewise not a
192
+ * creator-facing choice here.
193
+ *
194
+ * A restyled pick with neither tags nor direction still sends `{mode}`: mode
195
+ * alone is meaningful to `sheet_style_recipe`, not a no-op.
196
+ */
197
+ export function buildArcStyleProfile(selection) {
198
+ if (selection.mode !== 'restyled')
199
+ return undefined;
200
+ const styleTags = normalizeArcStyleTags(selection.styleTags);
201
+ const styleDirection = (selection.styleDirection ?? '').trim();
202
+ return {
203
+ mode: 'restyled',
204
+ ...(styleTags.length > 0 ? { styleTags } : {}),
205
+ ...(styleDirection !== '' ? { styleDirection } : {}),
206
+ };
207
+ }
208
+ /**
209
+ * The `styleProfile` key spread straight into a `GenerateArcRequest` literal —
210
+ * `{}` on the default arm, so the request object is byte-identical to the
211
+ * pre-`BOARD.5` payload. One helper so no surface re-derives the omit rule.
212
+ */
213
+ export function arcStyleProfileField(selection) {
214
+ const profile = buildArcStyleProfile(selection);
215
+ return profile === undefined ? {} : { styleProfile: profile };
216
+ }
217
+ // -------------------------------------------------------------- projections
218
+ /**
219
+ * The ONE place the ordering SSOT is applied: resolve
220
+ * {@link Storyboard.frameIds} against a detail read's frames, in board order.
221
+ *
222
+ * Ids with no loaded frame are skipped, and frames the board no longer lists
223
+ * are dropped — so a mid-reorder read renders a coherent (possibly short)
224
+ * board instead of a duplicated or mis-ordered one. Every SB-U board surface
225
+ * calls this rather than sorting frames itself.
226
+ */
227
+ export function orderStoryboardFrames(frameIds, frames) {
228
+ const byId = new Map(frames.map(frame => [frame.frameId, frame]));
229
+ const ordered = [];
230
+ for (const frameId of frameIds) {
231
+ const frame = byId.get(frameId);
232
+ if (frame)
233
+ ordered.push(frame);
234
+ }
235
+ return ordered;
236
+ }
237
+ /**
238
+ * Mirror of the backend's derived `StoryboardFrame.status` — in-flight wins
239
+ * (a regenerate on a succeeded frame reads `running`, so the board shows work
240
+ * happening), then any success, then all-failed, then empty ⇒ `pending`.
241
+ *
242
+ * The server value on {@link StoryboardFrame.status} is authoritative; this is
243
+ * for the optimistic window between appending a pending variant locally and
244
+ * the next poll.
245
+ */
246
+ export function deriveFrameStatus(variants) {
247
+ if (variants.some(variant => variant.status === 'pending'))
248
+ return 'running';
249
+ if (variants.some(variant => variant.status === 'succeeded'))
250
+ return 'succeeded';
251
+ if (variants.length > 0)
252
+ return 'failed';
253
+ return 'pending';
254
+ }
255
+ /**
256
+ * The variant {@link StoryboardFrame.selectedVariantId} names, if it is still
257
+ * held in the capped history (mirrors the backend's `selected_variant()`).
258
+ */
259
+ export function selectedFrameVariant(frame) {
260
+ if (!frame.selectedVariantId)
261
+ return undefined;
262
+ return frame.variants.find(variant => variant.variantId === frame.selectedVariantId);
263
+ }
264
+ /**
265
+ * Does this variant actually carry IMAGE BYTES a surface could render?
266
+ *
267
+ * ⛔ **"Has bytes" is `imageKey` OR `imageUrl`, and the `imageKey` half is the
268
+ * load-bearing one** — that is the durable field, and the one the
269
+ * select-variant route tests. `imageUrl` is only the detail read's presigned
270
+ * VIEW of it, so keying on the URL alone would call a genuinely rendered
271
+ * variant empty the moment presigning fails or the frame arrives from a read
272
+ * that does not presign.
273
+ *
274
+ * THE single definition, because two rules in this file disagreed about it and
275
+ * the disagreement was the §Q SB.71 defect (see {@link displayFrameVariant}).
276
+ */
277
+ export function variantHasBytes(variant) {
278
+ return (variant.imageKey ?? '') !== '' || (variant.imageUrl ?? '') !== '';
279
+ }
280
+ /**
281
+ * The variant a surface should SHOW for a frame (§Q SB-U.4): the explicitly
282
+ * selected one when it is present, succeeded AND carries bytes, otherwise the
283
+ * newest such variant, otherwise nothing.
284
+ *
285
+ * Distinct from {@link selectedFrameVariant}, which answers only "what does
286
+ * `selectedVariantId` point at" and is deliberately undefined before a
287
+ * selection exists. A freshly generated frame has no `selectedVariantId` yet,
288
+ * so a board keyed on that alone would render a rendered frame as blank; and a
289
+ * selection pointing at a `pending`/`failed` variant must not blank out the
290
+ * image the creator can already see. Variants are appended in generation
291
+ * order, so "newest succeeded" is the last succeeded entry.
292
+ *
293
+ * **§Q SB.71 — the bytes clause is new, and its absence BLANKED THE BOARD.**
294
+ * The rule was succeeded-only, so a variant marked `succeeded` while carrying
295
+ * no `imageKey` was honoured as the display variant: {@link frameImageUrl} then
296
+ * returned `null` and every surface rendered NOTHING while the frame claimed an
297
+ * image. Silent by construction — the frame looks healthy, and the older
298
+ * variant that DOES have bytes is sitting right there in the same history,
299
+ * never reached because the walk stopped at the keyless one.
300
+ *
301
+ * Two things make this the right shape rather than a patch. The server mirror
302
+ * (`shared/storyboard_store._display_variant`) has ALWAYS required an
303
+ * `image_key` and says so; the client was the half that drifted, on a docstring
304
+ * claiming the client "needs no such clause" because it reads `imageUrl`. And
305
+ * {@link buildFrameVariantStrip} in this same file already refused to promote a
306
+ * keyless variant (`no-image`) — so one file held both rules and they
307
+ * contradicted each other. They now share {@link variantHasBytes}.
308
+ */
309
+ export function displayFrameVariant(frame) {
310
+ const renderable = (variant) => variant?.status === 'succeeded' && variantHasBytes(variant);
311
+ const selected = selectedFrameVariant(frame);
312
+ if (renderable(selected))
313
+ return selected;
314
+ for (let i = frame.variants.length - 1; i >= 0; i -= 1) {
315
+ if (renderable(frame.variants[i]))
316
+ return frame.variants[i];
317
+ }
318
+ return undefined;
319
+ }
320
+ /**
321
+ * The presigned image URL a surface should render for a frame, or `null`.
322
+ *
323
+ * One line over {@link displayFrameVariant}, but kept here so every surface that
324
+ * only wants the URL (the timeline clip, the large preview, a future thumbnail)
325
+ * reads it from one place rather than repeating the `?.imageUrl ?? null` tail.
326
+ * `imageUrl` rides the DETAIL read only, so a list-shaped frame yields `null`.
327
+ */
328
+ export function frameImageUrl(frame) {
329
+ return displayFrameVariant(frame)?.imageUrl ?? null;
330
+ }
331
+ /**
332
+ * §Q `SB.34` — the variant a surface should read a frame's PROMPT from, which is
333
+ * deliberately NOT {@link displayFrameVariant}.
334
+ *
335
+ * `displayFrameVariant` is succeeded-only and must stay that way: it answers
336
+ * "which IMAGE do I show", and its rule defends a real invariant — a selection
337
+ * pointing at a `pending`/`failed` variant must not blank out the image the
338
+ * creator can already see. Reading the prompt through it, though, made a FAILED
339
+ * frame indistinguishable from a frame that does not exist: the DM world-entry
340
+ * path got `undefined` and reported "no world for this beat" on a beat that was
341
+ * fully storyboarded and merely refused by the image model.
342
+ *
343
+ * The prompt is a different kind of fact from the image. It is COMPOSED BEFORE
344
+ * the image call and is not itself what failed, and §Q `SB.38` (#1575) made the
345
+ * backend persist it on all four failure arms — so a failed variant carries the
346
+ * text of the beat it meant to draw. This accessor is what lets that text be
347
+ * read without touching the image rule.
348
+ *
349
+ * Order: the displayed (succeeded) variant when it carries prompt text — a
350
+ * rendered frame's own provenance always wins — then the newest variant of ANY
351
+ * status that carries some. Variants are appended in generation order, so
352
+ * "newest" is the last entry. `undefined` when no variant carries prompt text at
353
+ * all (including boards generated before `SB.38`, whose failed variants were
354
+ * written with an empty string).
355
+ */
356
+ export function promptFrameVariant(frame) {
357
+ const displayed = displayFrameVariant(frame);
358
+ if (hasPromptText(displayed))
359
+ return displayed;
360
+ for (let i = frame.variants.length - 1; i >= 0; i -= 1) {
361
+ if (hasPromptText(frame.variants[i]))
362
+ return frame.variants[i];
363
+ }
364
+ return undefined;
365
+ }
366
+ function hasPromptText(variant) {
367
+ return (variant?.promptText?.trim() ?? '') !== '';
368
+ }
369
+ /**
370
+ * §Q `SB.34` — why a frame's render FAILED, or `null` when it did not fail.
371
+ *
372
+ * A frame with no image can be in two completely different situations: still
373
+ * generating, or refused/errored and never coming back on its own. Both used to
374
+ * read as "not rendered yet", which told the owner to wait for something that
375
+ * was never going to happen. This is the ONE place that tells them apart, so no
376
+ * surface re-derives the distinction from raw variant statuses.
377
+ *
378
+ * Derived from the variants via {@link deriveFrameStatus} rather than the
379
+ * server's {@link StoryboardFrame.status} so it stays correct in the optimistic
380
+ * window between a regenerate and its refetch — the same reason
381
+ * `deriveFrameStatus` exists.
382
+ *
383
+ * Returns the newest failed variant's `error` — for a content-policy refusal
384
+ * that is `SB.36`'s classified message, which is the actionable half. Falls back
385
+ * to `null` text only if the backend recorded none; callers pair this with their
386
+ * own copy, so an empty reason still reads as "failed", never as "pending".
387
+ */
388
+ export function frameRenderFailure(frame) {
389
+ if (deriveFrameStatus(frame.variants) !== 'failed')
390
+ return null;
391
+ for (let i = frame.variants.length - 1; i >= 0; i -= 1) {
392
+ const variant = frame.variants[i];
393
+ if (variant.status !== 'failed')
394
+ continue;
395
+ const error = variant.error?.trim() ?? '';
396
+ if (error !== '')
397
+ return error;
398
+ }
399
+ return null;
400
+ }
401
+ /**
402
+ * Whether a frame's render failed at all — {@link frameRenderFailure} answers
403
+ * "why", this answers "did it", and a failure the backend recorded no message
404
+ * for is still a failure. Kept beside it so the two can never disagree.
405
+ */
406
+ export function frameRenderFailed(frame) {
407
+ return deriveFrameStatus(frame.variants) === 'failed';
408
+ }
409
+ /**
410
+ * §Q SB-U.6 — the variant compare strip for one frame, as pure data.
411
+ *
412
+ * Chips are in GENERATION ORDER (oldest first), which is the order
413
+ * `append_variant` writes them and therefore the order eviction removes them —
414
+ * so left-to-right is also "closest to being evicted" first.
415
+ *
416
+ * `promotable` encodes the SERVER's rule rather than a looser client guess: the
417
+ * select-variant route accepts a variant only when it is `succeeded` AND carries
418
+ * rendered bytes, and 422s otherwise — so those chips are disabled with a reason
419
+ * instead of offering a click that fails.
420
+ *
421
+ * ⚠ **`already-current` is the one block that is NOT a server rejection.**
422
+ * Re-selecting the variant a frame already holds is accepted (200, idempotent);
423
+ * the chip hides the control because the click would be a no-op, not because it
424
+ * would fail. Do not read the four blocks as "the server would 422".
425
+ *
426
+ * ⛔ **"Has bytes" is {@link variantHasBytes}** — `imageKey` OR `imageUrl`, with
427
+ * the `imageKey` half load-bearing. §Q SB.71: this rule and
428
+ * {@link displayFrameVariant} used to disagree inside this one file, which is
429
+ * how a keyless variant could be refused promotion here and still be chosen as
430
+ * the thing to render.
431
+ */
432
+ export function buildFrameVariantStrip(frame) {
433
+ const displayed = displayFrameVariant(frame);
434
+ const chips = frame.variants.map(variant => {
435
+ const selected = frame.selectedVariantId === variant.variantId;
436
+ const isDisplayed = displayed?.variantId === variant.variantId;
437
+ const hasBytes = variantHasBytes(variant);
438
+ let promoteBlock = null;
439
+ if (variant.status === 'pending')
440
+ promoteBlock = 'pending';
441
+ else if (variant.status === 'failed')
442
+ promoteBlock = 'failed';
443
+ else if (!hasBytes)
444
+ promoteBlock = 'no-image';
445
+ else if (selected)
446
+ promoteBlock = 'already-current';
447
+ return {
448
+ variantId: variant.variantId,
449
+ status: variant.status,
450
+ origin: variant.origin,
451
+ modelId: variant.modelId ?? null,
452
+ seed: variant.seed ?? null,
453
+ imageUrl: variant.imageUrl ?? null,
454
+ createdAt: variant.createdAt,
455
+ error: variant.error ?? null,
456
+ selected,
457
+ displayed: isDisplayed,
458
+ promotable: promoteBlock === null,
459
+ promoteBlock,
460
+ };
461
+ });
462
+ // A selection is adrift unless it names a chip that is itself PROMOTABLE-shaped
463
+ // (succeeded with bytes) — the same rule the select-variant route enforces on
464
+ // the write, applied to what is already stored. Deliberately NOT
465
+ // `displayed?.variantId !== selectedVariantId`: `displayFrameVariant` honours a
466
+ // succeeded-but-keyless selection, so that comparison reads "in agreement" on
467
+ // the exact frame whose board renders nothing.
468
+ const selectedChip = chips.find(chip => chip.variantId === frame.selectedVariantId);
469
+ const selectionAdrift = (frame.selectedVariantId ?? '') !== '' &&
470
+ (selectedChip === undefined ||
471
+ selectedChip.promoteBlock === 'pending' ||
472
+ selectedChip.promoteBlock === 'failed' ||
473
+ selectedChip.promoteBlock === 'no-image');
474
+ const remainingSlots = Math.max(0, FRAME_VARIANT_HISTORY_CAP - frame.variants.length);
475
+ return {
476
+ chips,
477
+ selectionAdrift,
478
+ remainingSlots,
479
+ evictionImminent: remainingSlots === 0,
480
+ };
481
+ }
482
+ /** Runtime enumeration of {@link StoryboardView} for view pickers. */
483
+ export const STORYBOARD_VIEWS = ['arc', 'quests'];
484
+ /**
485
+ * §Q DM.105 — whether a board's frames resolved to graph `PlotBeat` ids
486
+ * (mirrors backend `services/storyboard/beat_scope.py::BoardGraphResolution`).
487
+ * Compare against these, never a raw literal.
488
+ */
489
+ export const BOARD_GRAPH_RESOLUTION = {
490
+ /** Every frame was checked; the unresolved ones are named. */
491
+ RESOLVED: 'resolved',
492
+ /** The board's arc variant is not the approved one — no PlotBeat of it exists. */
493
+ ARC_NOT_APPROVED: 'arc_not_approved',
494
+ /** The graph holds no node of the arc yet, could not be read, or the board is still generating. */
495
+ UNVERIFIED: 'unverified',
496
+ /** §Q SB.93 — the board's source arc is gone (deleted, another video's, or
497
+ * re-generated without the board's variant). PERMANENT: no later read resolves it. */
498
+ ARC_GONE: 'arc_gone',
499
+ };
500
+ /** Why a frame cannot ground a cutscene (§Q UX.38). */
501
+ export const FRAME_CUTSCENE_BLOCK = {
502
+ /** The board's arc is not approved, so none of its beats is in the graph. */
503
+ ARC_NOT_APPROVED: 'arc_not_approved',
504
+ /** The graph has not (yet) confirmed this board's beats — or answered a resolution this client does not know. */
505
+ GRAPH_UNVERIFIED: 'graph_unverified',
506
+ /** This frame's beat is no PlotBeat in the graph. */
507
+ FRAME_UNRESOLVED: 'frame_unresolved',
508
+ /** The board's source arc is gone — permanent, unlike {@link FRAME_CUTSCENE_BLOCK.GRAPH_UNVERIFIED}. */
509
+ ARC_GONE: 'arc_gone',
510
+ };
511
+ /**
512
+ * §Q UX.38 — the `{storyId, beatId}` a "cutscene from this frame" posts to
513
+ * `POST /api/v1/videos/generate`, from the board detail read's DM.105 overlay.
514
+ *
515
+ * The ONE place the rule lives: the GRAPH ids (`graphStoryId` +
516
+ * `graphBeatId`), never the frame's board-scoped `beatId` (the measured 404
517
+ * class); and only on a `resolved` board for a frame it did not name as
518
+ * unresolved. Every other state is `blocked` with its reason — including a
519
+ * resolution value this client does not know.
520
+ */
521
+ export function storyboardFrameCutsceneTarget(detail, frame) {
522
+ if (detail.graphResolution === BOARD_GRAPH_RESOLUTION.ARC_NOT_APPROVED) {
523
+ return { status: 'blocked', reason: FRAME_CUTSCENE_BLOCK.ARC_NOT_APPROVED };
524
+ }
525
+ if (detail.graphResolution === BOARD_GRAPH_RESOLUTION.ARC_GONE) {
526
+ return { status: 'blocked', reason: FRAME_CUTSCENE_BLOCK.ARC_GONE };
527
+ }
528
+ const storyId = detail.graphStoryId?.trim() ?? '';
529
+ if (detail.graphResolution !== BOARD_GRAPH_RESOLUTION.RESOLVED || storyId === '') {
530
+ return { status: 'blocked', reason: FRAME_CUTSCENE_BLOCK.GRAPH_UNVERIFIED };
531
+ }
532
+ const beatId = frame.graphBeatId?.trim() ?? '';
533
+ if (beatId === '' || (detail.unresolvedGraphFrameIds ?? []).includes(frame.frameId)) {
534
+ return { status: 'blocked', reason: FRAME_CUTSCENE_BLOCK.FRAME_UNRESOLVED };
535
+ }
536
+ return { status: 'ready', storyId, beatId };
537
+ }
538
+ /**
539
+ * The leases a CONFIRM issued — every `pending` entry carrying a `leaseToken`
540
+ * (§Q WORLD.44). What a client hands back through
541
+ * {@link StoryboardsApi.releaseStoryboardWorlds} when it will not spend them. A
542
+ * preview's entries carry no token, so this is empty for a preview.
543
+ */
544
+ export function worldLeasesOf(beats) {
545
+ return beats.flatMap(beat => beat.disposition === 'pending' && typeof beat.leaseToken === 'string' && beat.leaseToken !== ''
546
+ ? [{ frameId: beat.frameId, leaseToken: beat.leaseToken }]
547
+ : []);
548
+ }
549
+ /** Runtime enumeration of {@link StoryboardExportTarget}. */
550
+ export const STORYBOARD_EXPORT_TARGETS = [
551
+ 'longlive',
552
+ 'seedance',
553
+ 'bundle',
554
+ ];
555
+ // -------------------------------------------------------------------- api
556
+ /**
557
+ * The visual-storyboard surface (spec §4.5), mounted on the STORIES app
558
+ * alongside arcs — so every call goes to `transport.baseUrl`. Land-dark: 404s
559
+ * until `SEER_STORYBOARD_ENABLED` is set server-side.
560
+ *
561
+ * Board creation is async (the arcs envelope): create returns **202** with a
562
+ * QUEUED board, then poll {@link StoryboardsApi.getStoryboard} until
563
+ * {@link isStoryboardTerminal}. `regenerate` and `region-edit` are likewise
564
+ * 202 — they append a PENDING variant, which makes the frame read `running`.
565
+ */
566
+ export class StoryboardsApi {
567
+ transport;
568
+ constructor(transport) {
569
+ this.transport = transport;
570
+ }
571
+ boardsPath(storyId) {
572
+ return `/api/v1/stories/${encodeURIComponent(storyId)}/storyboards`;
573
+ }
574
+ framePath(storyId, storyboardId, frameId) {
575
+ return `${this.boardsPath(storyId)}/${encodeURIComponent(storyboardId)}/frames/${encodeURIComponent(frameId)}`;
576
+ }
577
+ /**
578
+ * Generate a board from an approved arc variant. `POST
579
+ * /api/v1/stories/{storyId}/storyboards` → **202** + `Location` + the QUEUED
580
+ * board; frames fill in as the worker completes them.
581
+ */
582
+ async createStoryboard(storyId, req) {
583
+ return this.transport.requestJson(this.transport.baseUrl, this.boardsPath(storyId), { method: 'POST', body: JSON.stringify(req) });
584
+ }
585
+ /**
586
+ * List a story's boards newest-first (summaries — no frames). `GET
587
+ * /api/v1/stories/{storyId}/storyboards`.
588
+ */
589
+ async listStoryboards(storyId) {
590
+ return this.transport.requestJson(this.transport.baseUrl, this.boardsPath(storyId));
591
+ }
592
+ /**
593
+ * Read one board in full — frames + presigned variant URLs, and (with
594
+ * `view: 'quests'`) the computed quest join. `GET
595
+ * /api/v1/stories/{storyId}/storyboards/{storyboardId}?view=…&sessionId=…`.
596
+ * This is also the 202-create poll target.
597
+ *
598
+ * `sessionId` (§Q SEC.44, additive): the caller's OWN play session. The
599
+ * storyboard reads take the fork-material grade, so a definition's player who
600
+ * is not a member of the story's owner reads the board their run plays only
601
+ * by naming that session — and only at the default `arc` view. A caller the
602
+ * grade already admits is unaffected by it.
603
+ */
604
+ async getStoryboard(storyId, storyboardId, params) {
605
+ const search = new URLSearchParams();
606
+ if (params?.view)
607
+ search.set('view', params.view);
608
+ if (params?.sessionId)
609
+ search.set('sessionId', params.sessionId);
610
+ const encoded = search.toString();
611
+ const query = encoded ? `?${encoded}` : '';
612
+ return this.transport.requestJson(this.transport.baseUrl, `${this.boardsPath(storyId)}/${encodeURIComponent(storyboardId)}${query}`);
613
+ }
614
+ /**
615
+ * Partial edit of ONE frame — prompt fields, duration, transition, camera,
616
+ * refs, extensions. Absent fields are unchanged; pass the frame's `txnVer`
617
+ * to make the write version-guarded (409 on a stale base). `PATCH
618
+ * /api/v1/stories/{storyId}/storyboards/{storyboardId}/frames/{frameId}`.
619
+ */
620
+ async patchStoryboardFrame(storyId, storyboardId, frameId, body) {
621
+ return this.transport.requestJson(this.transport.baseUrl, this.framePath(storyId, storyboardId, frameId), { method: 'PATCH', body: JSON.stringify(body) });
622
+ }
623
+ /**
624
+ * @deprecated Use {@link StoryboardsApi.retryStoryboardFrame} — it is the same
625
+ * operation under the name the server actually implements, and it accepts the
626
+ * `{modelId}` body this signature cannot express (§Q SB.55).
627
+ *
628
+ * Re-run generation for ONE frame with its CURRENT prompt (patch it first with
629
+ * {@link StoryboardsApi.patchStoryboardFrame} to change it) → **202** + the
630
+ * frame as it stands; poll the detail read for the appended variant.
631
+ *
632
+ * **§Q SB.70 — this used to POST `…/frames/{frameId}/regenerate`, a route that
633
+ * never existed, so every call 404'd.** It was published by SB-U.1 (#1472)
634
+ * against a planned endpoint and shipped ahead of it; `SB-U.6`'s row was
635
+ * written against this method, hit the 404, and had to be rebuilt on `/retry`.
636
+ * It now targets `/retry`, which has done exactly this job since §Q SB.35.
637
+ *
638
+ * Retargeting rather than removing is deliberate: client-core is a contract
639
+ * with two consumers, one of them a pinned app outside this repo, so the
640
+ * method must keep existing. Two behaviours you inherit from the real route
641
+ * and should know about — it **409s a board that is not terminal** (a running
642
+ * generation already owns the frame), and a retry of an ALREADY-SUCCEEDED
643
+ * frame is allowed and is a PAID re-roll.
644
+ */
645
+ async regenerateStoryboardFrame(storyId, storyboardId, frameId) {
646
+ return this.retryStoryboardFrame(storyId, storyboardId, frameId);
647
+ }
648
+ /**
649
+ * Edit a REGION of one frame — with a mask (inpaint) or without (semantic
650
+ * edit). `POST …/frames/{frameId}/region-edit` → **202** + the frame with a
651
+ * PENDING `region_edit` variant appended.
652
+ */
653
+ async regionEditStoryboardFrame(storyId, storyboardId, frameId, body) {
654
+ return this.transport.requestJson(this.transport.baseUrl, `${this.framePath(storyId, storyboardId, frameId)}/region-edit`, { method: 'POST', body: JSON.stringify(body) });
655
+ }
656
+ /**
657
+ * Choose which variant is the frame's image — SYNCHRONOUS and
658
+ * version-guarded (echo the frame's `txnVer`; a stale value 409s rather than
659
+ * clobbering a concurrent edit). `POST …/frames/{frameId}/select-variant`.
660
+ */
661
+ async selectStoryboardFrameVariant(storyId, storyboardId, frameId, body) {
662
+ return this.transport.requestJson(this.transport.baseUrl, `${this.framePath(storyId, storyboardId, frameId)}/select-variant`, { method: 'POST', body: JSON.stringify(body) });
663
+ }
664
+ /**
665
+ * Regenerate ONE frame of a terminal board — 202, the board stays terminal
666
+ * (§Q SB.35, `POST
667
+ * /api/v1/stories/{storyId}/storyboards/{storyboardId}/frames/{frameId}/retry`).
668
+ *
669
+ * The recovery action for a PARTIALLY failed board: without it the only way
670
+ * to repair one blocked frame is regenerating the whole storyboard, which
671
+ * re-pays for every frame that already rendered. Pass
672
+ * {@link RetryStoryboardFrameRequest.modelId} to re-compose with a different
673
+ * model (§Q SB.55); omit the body entirely to use the board's own.
674
+ *
675
+ * **It is asynchronous and PAID.** The response carries the frame as it
676
+ * stands NOW — poll {@link StoryboardsApi.getStoryboard} for the appended
677
+ * variant. Two dispatches for the same frame are refused: the second gets a
678
+ * **409** rather than composing a second billed image (§Q SB.44), so a UI
679
+ * should disable the control while one is outstanding and treat a 409 as
680
+ * "already running", not as an error to surface.
681
+ *
682
+ * ⚠ **The 202 returns the frame UNCHANGED — no pending variant is appended**
683
+ * (the worker appends it asynchronously). So the response is a receipt, not
684
+ * new state: a caller cannot tell from it that the retry is in flight, and
685
+ * must keep its own outstanding flag and watch the detail read for a variant
686
+ * id it did not already hold. Watching the variant COUNT does not work at
687
+ * {@link FRAME_VARIANT_HISTORY_CAP} — `append_variant` evicts one to add one,
688
+ * so the length does not change (§Q SB-U.6).
689
+ */
690
+ async retryStoryboardFrame(storyId, storyboardId, frameId, body = {}) {
691
+ return this.transport.requestJson(this.transport.baseUrl, `${this.framePath(storyId, storyboardId, frameId)}/retry`, { method: 'POST', body: JSON.stringify(body) });
692
+ }
693
+ /**
694
+ * Persist the HappyOyster world this frame opens into — the DM world-entry
695
+ * write (§Q DM.1). `PUT
696
+ * /api/v1/stories/{storyId}/storyboards/{storyboardId}/frames/{frameId}/world`.
697
+ *
698
+ * Call it IMMEDIATELY after `createWorld` resolves, and also from
699
+ * `HappyOysterLaunchError.handle` when `startTravel` failed on a world that
700
+ * was nonetheless created — that world is already billed, and this call is the
701
+ * only thing that keeps it findable. Idempotent: safe to retry with the same
702
+ * id. See {@link SetFrameWorldRequest} for the 409 semantics.
703
+ */
704
+ async setStoryboardFrameWorld(storyId, storyboardId, frameId, body, options = {}) {
705
+ // §Q MOMENT.8 — the flag and `body.supersedesWorldId` are ONE decision and
706
+ // the server 422s on either half alone. Sending the flag only when a fence
707
+ // is present is what keeps a plain DM-side bind on the first-writer-wins
708
+ // path: a supersede is creator-only and must never be reachable by default.
709
+ const supersede = options.supersede === true ? '?supersede=true' : '';
710
+ return this.transport.requestJson(this.transport.baseUrl, `${this.framePath(storyId, storyboardId, frameId)}/world${supersede}`, { method: 'PUT', body: JSON.stringify(body) });
711
+ }
712
+ /**
713
+ * Plan pre-minting one adventure world per BEAT (§Q MOMENT.6a) —
714
+ * `/api/v1/stories/{storyId}/storyboards/{storyboardId}/worlds/prepare`.
715
+ *
716
+ * **§Q WORLD.29 — two arms, and the DEFAULT reserves nothing.** Without
717
+ * `confirm` this is the spend PREVIEW (`GET`): the same plan with
718
+ * `preview: true`, no lease taken, no cap slot consumed — so a preview a
719
+ * creator abandons blocks no board/video delete. With `confirm: true` it is
720
+ * the creator's CONFIRM (`POST`): every `pending` entry is LEASED (a story
721
+ * cap slot reserved for an hour) and carries the `leaseToken` the bind must
722
+ * echo. Only an explicit "mint" click may pass `confirm` — the owner ruled
723
+ * leases are taken only on confirm. The confirm answers a 409
724
+ * `reactor_disabled` while the admin Reactor switch is off (§Q WORLD.30).
725
+ *
726
+ * ⚠ **CREATOR-INVOKED ONLY, and the confirm authorises SPEND.** `pendingCount`
727
+ * is a count of permanent, billed, undeletable worlds — show it before
728
+ * minting. Then, for each `pending` entry of the CONFIRM, `createWorld` from
729
+ * that frame's image + compiled prompt and persist the result with
730
+ * {@link StoryboardsApi.setStoryboardFrameWorld}. Nothing is minted server-side.
731
+ *
732
+ * `supersede` (§Q MOMENT.8) re-opens already-bound beats for replacement
733
+ * instead of skipping them; each authorised entry carries the `worldId` to
734
+ * echo back as `supersedesWorldId`.
735
+ *
736
+ * **§Q WORLD.44 — `frameIds` SCOPES the confirm.** Pass the anchor frames the
737
+ * run will actually mint (the `frameId` of each confirmed target): only those
738
+ * beats are leased, and the response reports only them. A confirm without it
739
+ * leases EVERY pending beat for an hour, holding board and video DELETE at 409
740
+ * over beats nobody mints. Ignored on the preview. Leases the run then will
741
+ * not spend go back through {@link StoryboardsApi.releaseStoryboardWorlds}.
742
+ */
743
+ async prepareStoryboardWorlds(storyId, storyboardId, options = {}) {
744
+ const supersede = options.supersede === true ? '?supersede=true' : '';
745
+ const confirm = options.confirm === true;
746
+ return this.transport.requestJson(this.transport.baseUrl, `${this.boardsPath(storyId)}/${encodeURIComponent(storyboardId)}/worlds/prepare${supersede}`, confirm && options.frameIds !== undefined
747
+ ? { method: 'POST', body: JSON.stringify({ frameIds: [...options.frameIds] }) }
748
+ : { method: confirm ? 'POST' : 'GET' });
749
+ }
750
+ /**
751
+ * Hand back world-mint authorisations this client will not spend (§Q
752
+ * WORLD.44) — `POST
753
+ * /api/v1/stories/{storyId}/storyboards/{storyboardId}/worlds/release`.
754
+ *
755
+ * Call it for a confirm the drift check refused, and for targets a run never
756
+ * reached or skipped before `createWorld`. ⛔ NEVER for a target whose mint may
757
+ * have been billed — a release frees the slot for another prepare while that
758
+ * world is still unrecorded. Token-fenced and idempotent; not Reactor-gated.
759
+ */
760
+ async releaseStoryboardWorlds(storyId, storyboardId, body) {
761
+ return this.transport.requestJson(this.transport.baseUrl, `${this.boardsPath(storyId)}/${encodeURIComponent(storyboardId)}/worlds/release`, { method: 'POST', body: JSON.stringify(body) });
762
+ }
763
+ /**
764
+ * Reorder the board — a FULL-LIST replace of {@link Storyboard.frameIds},
765
+ * which is the ONE ordering source of truth, so this is idempotent and
766
+ * cannot diverge from a per-frame order. `PATCH
767
+ * /api/v1/stories/{storyId}/storyboards/{storyboardId}/order`.
768
+ */
769
+ async reorderStoryboardFrames(storyId, storyboardId, body) {
770
+ return this.transport.requestJson(this.transport.baseUrl, `${this.boardsPath(storyId)}/${encodeURIComponent(storyboardId)}/order`, { method: 'PATCH', body: JSON.stringify(body) });
771
+ }
772
+ /**
773
+ * Export the board to one of the v1 targets (`longlive` / `seedance` /
774
+ * `bundle`). `GET
775
+ * /api/v1/stories/{storyId}/storyboards/{storyboardId}/export/{target}`.
776
+ */
777
+ async exportStoryboard(storyId, storyboardId, target) {
778
+ return this.transport.requestJson(this.transport.baseUrl, `${this.boardsPath(storyId)}/${encodeURIComponent(storyboardId)}/export/${encodeURIComponent(target)}`);
779
+ }
780
+ }
781
+ //# sourceMappingURL=storyboards.js.map