@escapeaihq/client-core 0.8.0 → 0.42.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 (307) hide show
  1. package/README.md +48 -4
  2. package/dist/adapters/capabilities.d.ts +10 -0
  3. package/dist/adapters/capabilities.d.ts.map +1 -0
  4. package/dist/adapters/capabilities.js +2 -0
  5. package/dist/adapters/capabilities.js.map +1 -0
  6. package/dist/adapters/chatAdapter.d.ts +38 -0
  7. package/dist/adapters/chatAdapter.d.ts.map +1 -0
  8. package/dist/adapters/chatAdapter.js +88 -0
  9. package/dist/adapters/chatAdapter.js.map +1 -0
  10. package/dist/adapters/directorAdapter.d.ts +62 -0
  11. package/dist/adapters/directorAdapter.d.ts.map +1 -0
  12. package/dist/adapters/directorAdapter.js +71 -0
  13. package/dist/adapters/directorAdapter.js.map +1 -0
  14. package/dist/adapters/imageAdapter.d.ts +44 -0
  15. package/dist/adapters/imageAdapter.d.ts.map +1 -0
  16. package/dist/adapters/imageAdapter.js +73 -0
  17. package/dist/adapters/imageAdapter.js.map +1 -0
  18. package/dist/adapters/index.d.ts +47 -0
  19. package/dist/adapters/index.d.ts.map +1 -0
  20. package/dist/adapters/index.js +41 -0
  21. package/dist/adapters/index.js.map +1 -0
  22. package/dist/adapters/registry.d.ts +98 -0
  23. package/dist/adapters/registry.d.ts.map +1 -0
  24. package/dist/adapters/registry.js +106 -0
  25. package/dist/adapters/registry.js.map +1 -0
  26. package/dist/adapters/worldAdapter.d.ts +142 -0
  27. package/dist/adapters/worldAdapter.d.ts.map +1 -0
  28. package/dist/adapters/worldAdapter.js +164 -0
  29. package/dist/adapters/worldAdapter.js.map +1 -0
  30. package/dist/admin.d.ts +200 -0
  31. package/dist/admin.d.ts.map +1 -0
  32. package/dist/admin.js +124 -0
  33. package/dist/admin.js.map +1 -0
  34. package/dist/api.d.ts +1299 -3
  35. package/dist/api.d.ts.map +1 -1
  36. package/dist/api.js +683 -95
  37. package/dist/api.js.map +1 -1
  38. package/dist/audio.d.ts +33 -1
  39. package/dist/audio.d.ts.map +1 -1
  40. package/dist/audio.js +4 -1
  41. package/dist/audio.js.map +1 -1
  42. package/dist/castProjection.d.ts +35 -0
  43. package/dist/castProjection.d.ts.map +1 -0
  44. package/dist/castProjection.js +80 -0
  45. package/dist/castProjection.js.map +1 -0
  46. package/dist/conversation/binding.d.ts +62 -0
  47. package/dist/conversation/binding.d.ts.map +1 -0
  48. package/dist/conversation/binding.js +51 -0
  49. package/dist/conversation/binding.js.map +1 -0
  50. package/dist/conversation/controller.d.ts +209 -0
  51. package/dist/conversation/controller.d.ts.map +1 -0
  52. package/dist/conversation/controller.js +342 -0
  53. package/dist/conversation/controller.js.map +1 -0
  54. package/dist/conversation/effectiveModel.d.ts +62 -0
  55. package/dist/conversation/effectiveModel.d.ts.map +1 -0
  56. package/dist/conversation/effectiveModel.js +73 -0
  57. package/dist/conversation/effectiveModel.js.map +1 -0
  58. package/dist/conversation/index.d.ts +27 -0
  59. package/dist/conversation/index.d.ts.map +1 -0
  60. package/dist/conversation/index.js +27 -0
  61. package/dist/conversation/index.js.map +1 -0
  62. package/dist/conversation/participant.d.ts +66 -0
  63. package/dist/conversation/participant.d.ts.map +1 -0
  64. package/dist/conversation/participant.js +36 -0
  65. package/dist/conversation/participant.js.map +1 -0
  66. package/dist/conversation/presence.d.ts +56 -0
  67. package/dist/conversation/presence.d.ts.map +1 -0
  68. package/dist/conversation/presence.js +34 -0
  69. package/dist/conversation/presence.js.map +1 -0
  70. package/dist/conversation/presenceBus.d.ts +42 -0
  71. package/dist/conversation/presenceBus.d.ts.map +1 -0
  72. package/dist/conversation/presenceBus.js +81 -0
  73. package/dist/conversation/presenceBus.js.map +1 -0
  74. package/dist/conversation/presenceRegistry.d.ts +49 -0
  75. package/dist/conversation/presenceRegistry.d.ts.map +1 -0
  76. package/dist/conversation/presenceRegistry.js +59 -0
  77. package/dist/conversation/presenceRegistry.js.map +1 -0
  78. package/dist/conversation/roster.d.ts +72 -0
  79. package/dist/conversation/roster.d.ts.map +1 -0
  80. package/dist/conversation/roster.js +69 -0
  81. package/dist/conversation/roster.js.map +1 -0
  82. package/dist/conversation/rosterProjection.d.ts +52 -0
  83. package/dist/conversation/rosterProjection.d.ts.map +1 -0
  84. package/dist/conversation/rosterProjection.js +74 -0
  85. package/dist/conversation/rosterProjection.js.map +1 -0
  86. package/dist/conversation/router.d.ts +74 -0
  87. package/dist/conversation/router.d.ts.map +1 -0
  88. package/dist/conversation/router.js +58 -0
  89. package/dist/conversation/router.js.map +1 -0
  90. package/dist/conversation/runtime.d.ts +64 -0
  91. package/dist/conversation/runtime.d.ts.map +1 -0
  92. package/dist/conversation/runtime.js +172 -0
  93. package/dist/conversation/runtime.js.map +1 -0
  94. package/dist/conversation/types.d.ts +99 -0
  95. package/dist/conversation/types.d.ts.map +1 -0
  96. package/dist/conversation/types.js +13 -0
  97. package/dist/conversation/types.js.map +1 -0
  98. package/dist/conversation/voice.d.ts +185 -0
  99. package/dist/conversation/voice.d.ts.map +1 -0
  100. package/dist/conversation/voice.js +307 -0
  101. package/dist/conversation/voice.js.map +1 -0
  102. package/dist/graphSchema.d.ts +260 -0
  103. package/dist/graphSchema.d.ts.map +1 -0
  104. package/dist/graphSchema.js +354 -0
  105. package/dist/graphSchema.js.map +1 -0
  106. package/dist/http.d.ts +20 -0
  107. package/dist/http.d.ts.map +1 -0
  108. package/dist/http.js +57 -0
  109. package/dist/http.js.map +1 -0
  110. package/dist/index.d.ts +9 -0
  111. package/dist/index.d.ts.map +1 -1
  112. package/dist/index.js +12 -0
  113. package/dist/index.js.map +1 -1
  114. package/dist/platformAssistant.d.ts +155 -0
  115. package/dist/platformAssistant.d.ts.map +1 -0
  116. package/dist/platformAssistant.js +256 -0
  117. package/dist/platformAssistant.js.map +1 -0
  118. package/dist/reactor/abortUtils.d.ts +16 -0
  119. package/dist/reactor/abortUtils.d.ts.map +1 -0
  120. package/dist/reactor/abortUtils.js +26 -0
  121. package/dist/reactor/abortUtils.js.map +1 -0
  122. package/dist/reactor/applyScenePrompt.d.ts +75 -0
  123. package/dist/reactor/applyScenePrompt.d.ts.map +1 -0
  124. package/dist/reactor/applyScenePrompt.js +60 -0
  125. package/dist/reactor/applyScenePrompt.js.map +1 -0
  126. package/dist/reactor/chunkDistribution.d.ts +43 -0
  127. package/dist/reactor/chunkDistribution.d.ts.map +1 -0
  128. package/dist/reactor/chunkDistribution.js +85 -0
  129. package/dist/reactor/chunkDistribution.js.map +1 -0
  130. package/dist/reactor/heliosCommandDispatcher.d.ts.map +1 -1
  131. package/dist/reactor/heliosCommandDispatcher.js +10 -15
  132. package/dist/reactor/heliosCommandDispatcher.js.map +1 -1
  133. package/dist/reactor/index.d.ts +4 -0
  134. package/dist/reactor/index.d.ts.map +1 -1
  135. package/dist/reactor/index.js +7 -0
  136. package/dist/reactor/index.js.map +1 -1
  137. package/dist/reactor/longLiveCommandDispatcher.d.ts +103 -0
  138. package/dist/reactor/longLiveCommandDispatcher.d.ts.map +1 -0
  139. package/dist/reactor/longLiveCommandDispatcher.js +87 -0
  140. package/dist/reactor/longLiveCommandDispatcher.js.map +1 -0
  141. package/dist/reactor/sceneEntry.d.ts +40 -6
  142. package/dist/reactor/sceneEntry.d.ts.map +1 -1
  143. package/dist/reactor/sceneEntry.js +63 -24
  144. package/dist/reactor/sceneEntry.js.map +1 -1
  145. package/dist/reactor/scenesFromEnrichment.d.ts.map +1 -1
  146. package/dist/reactor/scenesFromEnrichment.js +2 -66
  147. package/dist/reactor/scenesFromEnrichment.js.map +1 -1
  148. package/dist/reactor/seedImageOrchestrator.d.ts +42 -2
  149. package/dist/reactor/seedImageOrchestrator.d.ts.map +1 -1
  150. package/dist/reactor/seedImageOrchestrator.js +173 -4
  151. package/dist/reactor/seedImageOrchestrator.js.map +1 -1
  152. package/dist/reactor/storyTimeline.d.ts +44 -0
  153. package/dist/reactor/storyTimeline.d.ts.map +1 -0
  154. package/dist/reactor/storyTimeline.js +95 -0
  155. package/dist/reactor/storyTimeline.js.map +1 -0
  156. package/dist/storyGraph.d.ts +70 -0
  157. package/dist/storyGraph.d.ts.map +1 -0
  158. package/dist/storyGraph.js +178 -0
  159. package/dist/storyGraph.js.map +1 -0
  160. package/dist/timeFormat.d.ts +10 -0
  161. package/dist/timeFormat.d.ts.map +1 -1
  162. package/dist/timeFormat.js +12 -0
  163. package/dist/timeFormat.js.map +1 -1
  164. package/dist/toolSchemas.d.ts +370 -0
  165. package/dist/toolSchemas.d.ts.map +1 -0
  166. package/dist/toolSchemas.js +182 -0
  167. package/dist/toolSchemas.js.map +1 -0
  168. package/dist/vision/VisionPublisher.d.ts +115 -0
  169. package/dist/vision/VisionPublisher.d.ts.map +1 -0
  170. package/dist/vision/VisionPublisher.js +475 -0
  171. package/dist/vision/VisionPublisher.js.map +1 -0
  172. package/dist/vision/VisionSourceController.d.ts +127 -0
  173. package/dist/vision/VisionSourceController.d.ts.map +1 -0
  174. package/dist/vision/VisionSourceController.js +284 -0
  175. package/dist/vision/VisionSourceController.js.map +1 -0
  176. package/dist/vision/credentials.d.ts +22 -0
  177. package/dist/vision/credentials.d.ts.map +1 -0
  178. package/dist/vision/credentials.js +34 -0
  179. package/dist/vision/credentials.js.map +1 -0
  180. package/dist/vision/index.d.ts +18 -0
  181. package/dist/vision/index.d.ts.map +1 -0
  182. package/dist/vision/index.js +13 -0
  183. package/dist/vision/index.js.map +1 -0
  184. package/dist/vision/sourceKinds.d.ts +65 -0
  185. package/dist/vision/sourceKinds.d.ts.map +1 -0
  186. package/dist/vision/sourceKinds.js +26 -0
  187. package/dist/vision/sourceKinds.js.map +1 -0
  188. package/dist/vision/startVisionPublisher.d.ts +38 -0
  189. package/dist/vision/startVisionPublisher.d.ts.map +1 -0
  190. package/dist/vision/startVisionPublisher.js +44 -0
  191. package/dist/vision/startVisionPublisher.js.map +1 -0
  192. package/dist/vision/types.d.ts +95 -0
  193. package/dist/vision/types.d.ts.map +1 -0
  194. package/dist/vision/types.js +12 -0
  195. package/dist/vision/types.js.map +1 -0
  196. package/dist/vision/visionScheduler.d.ts +63 -0
  197. package/dist/vision/visionScheduler.d.ts.map +1 -0
  198. package/dist/vision/visionScheduler.js +67 -0
  199. package/dist/vision/visionScheduler.js.map +1 -0
  200. package/dist/websocket.d.ts +195 -0
  201. package/dist/websocket.d.ts.map +1 -1
  202. package/dist/websocket.js +179 -1
  203. package/dist/websocket.js.map +1 -1
  204. package/package.json +11 -1
  205. package/src/__tests__/adapters-capabilities.test.ts +46 -0
  206. package/src/__tests__/adapters-chat.test.ts +172 -0
  207. package/src/__tests__/adapters-director.test.ts +95 -0
  208. package/src/__tests__/adapters-image.test.ts +133 -0
  209. package/src/__tests__/adapters-platform.test.ts +95 -0
  210. package/src/__tests__/adapters-registry.test.ts +189 -0
  211. package/src/__tests__/adapters-world.test.ts +296 -0
  212. package/src/__tests__/admin.test.ts +312 -0
  213. package/src/__tests__/adventures-party.test.ts +219 -0
  214. package/src/__tests__/adventures.test.ts +282 -0
  215. package/src/__tests__/api-pollers.test.ts +104 -0
  216. package/src/__tests__/api.clip-lookup.test.ts +64 -0
  217. package/src/__tests__/api.list-images-filters.test.ts +103 -0
  218. package/src/__tests__/api.test.ts +470 -0
  219. package/src/__tests__/audio.test.ts +65 -0
  220. package/src/__tests__/cast.test.ts +95 -0
  221. package/src/__tests__/castProjection.test.ts +167 -0
  222. package/src/__tests__/chat-auth.test.ts +91 -0
  223. package/src/__tests__/conversation/controller.test.ts +697 -0
  224. package/src/__tests__/conversation/effectiveModel.test.ts +169 -0
  225. package/src/__tests__/conversation/headlessRenderer.ts +46 -0
  226. package/src/__tests__/conversation/presenceBus.test.ts +236 -0
  227. package/src/__tests__/conversation/presenceRegistry.test.ts +73 -0
  228. package/src/__tests__/conversation/roster.test.ts +100 -0
  229. package/src/__tests__/conversation/rosterProjection.test.ts +142 -0
  230. package/src/__tests__/conversation/router.test.ts +81 -0
  231. package/src/__tests__/conversation/runtime.test.ts +206 -0
  232. package/src/__tests__/conversation/voice.test.ts +440 -0
  233. package/src/__tests__/documents.test.ts +360 -0
  234. package/src/__tests__/graphSchema.test.ts +326 -0
  235. package/src/__tests__/longLiveCommandDispatcher.test.ts +185 -0
  236. package/src/__tests__/platformAssistant.test.ts +484 -0
  237. package/src/__tests__/reactor/applyScenePrompt.test.ts +192 -0
  238. package/src/__tests__/reactor/heliosCommandDispatcher.test.ts +4 -3
  239. package/src/__tests__/reactor/sceneEntry.test.ts +134 -10
  240. package/src/__tests__/reactor/seedImageOrchestrator.test.ts +51 -16
  241. package/src/__tests__/reactor/storyTimeline.test.ts +186 -0
  242. package/src/__tests__/regeneration.test.ts +486 -0
  243. package/src/__tests__/stories.test.ts +171 -0
  244. package/src/__tests__/storyGraph.test.ts +134 -0
  245. package/src/__tests__/timeFormat.test.ts +22 -1
  246. package/src/__tests__/toolSchemas.test.ts +57 -0
  247. package/src/__tests__/tools-wrappers.test.ts +272 -0
  248. package/src/__tests__/videoGraph.test.ts +94 -0
  249. package/src/__tests__/websocket-vision.test.ts +265 -0
  250. package/src/__tests__/websocket.test.ts +213 -0
  251. package/src/adapters/capabilities.ts +24 -0
  252. package/src/adapters/chatAdapter.ts +114 -0
  253. package/src/adapters/directorAdapter.ts +126 -0
  254. package/src/adapters/imageAdapter.ts +100 -0
  255. package/src/adapters/index.ts +67 -0
  256. package/src/adapters/registry.ts +159 -0
  257. package/src/adapters/worldAdapter.ts +272 -0
  258. package/src/admin.ts +310 -0
  259. package/src/api.ts +1890 -162
  260. package/src/audio.ts +35 -0
  261. package/src/castProjection.ts +95 -0
  262. package/src/conversation/binding.ts +81 -0
  263. package/src/conversation/controller.ts +439 -0
  264. package/src/conversation/effectiveModel.ts +111 -0
  265. package/src/conversation/index.ts +27 -0
  266. package/src/conversation/participant.ts +71 -0
  267. package/src/conversation/presence.ts +60 -0
  268. package/src/conversation/presenceBus.ts +109 -0
  269. package/src/conversation/presenceRegistry.ts +83 -0
  270. package/src/conversation/roster.ts +111 -0
  271. package/src/conversation/rosterProjection.ts +98 -0
  272. package/src/conversation/router.ts +96 -0
  273. package/src/conversation/runtime.ts +188 -0
  274. package/src/conversation/types.ts +100 -0
  275. package/src/conversation/voice.ts +402 -0
  276. package/src/graphSchema.ts +532 -0
  277. package/src/http.ts +72 -0
  278. package/src/index.ts +12 -0
  279. package/src/platformAssistant.ts +347 -0
  280. package/src/reactor/abortUtils.ts +22 -0
  281. package/src/reactor/applyScenePrompt.ts +136 -0
  282. package/src/reactor/chunkDistribution.ts +98 -0
  283. package/src/reactor/heliosCommandDispatcher.ts +10 -18
  284. package/src/reactor/index.ts +7 -0
  285. package/src/reactor/longLiveCommandDispatcher.ts +156 -0
  286. package/src/reactor/sceneEntry.ts +104 -33
  287. package/src/reactor/scenesFromEnrichment.ts +11 -76
  288. package/src/reactor/seedImageOrchestrator.ts +200 -4
  289. package/src/reactor/storyTimeline.ts +127 -0
  290. package/src/storyGraph.ts +298 -0
  291. package/src/timeFormat.ts +13 -0
  292. package/src/toolSchemas.ts +225 -0
  293. package/src/vision/VisionPublisher.ts +553 -0
  294. package/src/vision/VisionSourceController.ts +354 -0
  295. package/src/vision/__tests__/VisionPublisher.kvs.test.ts +244 -0
  296. package/src/vision/__tests__/VisionPublisher.test.ts +301 -0
  297. package/src/vision/__tests__/VisionSourceController.test.ts +719 -0
  298. package/src/vision/__tests__/startVisionPublisher.test.ts +251 -0
  299. package/src/vision/__tests__/toVisionRtcCredentials.test.ts +113 -0
  300. package/src/vision/__tests__/visionScheduler.test.ts +149 -0
  301. package/src/vision/credentials.ts +39 -0
  302. package/src/vision/index.ts +44 -0
  303. package/src/vision/sourceKinds.ts +75 -0
  304. package/src/vision/startVisionPublisher.ts +64 -0
  305. package/src/vision/types.ts +101 -0
  306. package/src/vision/visionScheduler.ts +102 -0
  307. package/src/websocket.ts +334 -4
@@ -0,0 +1,73 @@
1
+ import { AdapterRegistry, ROUTE_DEFAULT, ROUTE_FALLBACK, } from './registry.js';
2
+ /**
3
+ * Map one {@link ImageModelInfo} from `GET /api/v1/images/models` to an
4
+ * {@link ImageAdapterDescriptor}. PURE — no I/O, no mutation of `info`.
5
+ *
6
+ * `capabilities` is copied VERBATIM (a fresh array, same members/order) — the
7
+ * backend image registry (`shared/image_model_registry.py`) is the single
8
+ * source of truth for what an image model can do; this layer never re-derives
9
+ * them from id/provider. The wire type is `string[]`; the backend emits only
10
+ * image caps so the cast to `Capability[]` is safe.
11
+ */
12
+ export function imageModelInfoToDescriptor(info) {
13
+ return {
14
+ id: info.id,
15
+ displayName: info.displayName,
16
+ provider: info.provider,
17
+ // VERBATIM copy — defensive clone so the descriptor can't alias the
18
+ // response array, but NO re-derivation of which caps are present.
19
+ capabilities: [...info.capabilities],
20
+ isDefault: info.isDefault,
21
+ isFallback: info.isFallback,
22
+ };
23
+ }
24
+ /**
25
+ * Build an image {@link AdapterRegistry} from the live backend model list.
26
+ *
27
+ * This is a FACADE over the backend — it makes NO model-selection decision of
28
+ * its own. Image generation still resolves to Gemini in the pipeline unchanged
29
+ * (R1c is land-dark); this loader only mirrors the catalogue so a future UI (R6)
30
+ * can list / filter image models. There is deliberately no `route()` method and
31
+ * no client-side selection table.
32
+ *
33
+ * Default resolution: the `isDefault`-flagged model id; if none is flagged,
34
+ * the first model by id (deterministic tiebreak). `ROUTE_FALLBACK` resolves to
35
+ * the `isFallback`-flagged model (the registry's real fallback), or the default
36
+ * when none is flagged. With no models there is no default — a `''` sentinel
37
+ * (never registered) seeds both routes so the R1a constructor guard
38
+ * (`ROUTE_FALLBACK` must be present in `routes`) still passes and `resolveRoute`
39
+ * degrades to `undefined` rather than throwing. This loader still makes no
40
+ * model-selection decision — it only mirrors the registry's default/fallback
41
+ * markers so `resolveRoute` reflects them.
42
+ */
43
+ export async function loadImageAdapterRegistry(client) {
44
+ const resp = await client.listImageModels();
45
+ const models = resp.models;
46
+ // Default = the isDefault-flagged model; else first by id (deterministic).
47
+ let defaultId = models.find((m) => m.isDefault)?.id ?? '';
48
+ if (!defaultId && models.length > 0) {
49
+ defaultId = [...models].sort((a, b) => (a.id < b.id ? -1 : a.id > b.id ? 1 : 0))[0].id;
50
+ }
51
+ // Fallback = the isFallback-flagged model (the registry's real fallback);
52
+ // mirror the default when none is flagged.
53
+ const fallbackId = models.find((m) => m.isFallback)?.id ?? defaultId;
54
+ // ROUTE_FALLBACK must always be present by name or the R1a constructor throws.
55
+ const routes = [
56
+ { name: ROUTE_DEFAULT, adapterId: defaultId, reason: 'image registry default model' },
57
+ {
58
+ name: ROUTE_FALLBACK,
59
+ adapterId: fallbackId,
60
+ reason: 'image registry fallback model (mirrors default if none flagged)',
61
+ },
62
+ ];
63
+ const registry = new AdapterRegistry({
64
+ domain: 'image',
65
+ routes,
66
+ fallbackRouteName: ROUTE_FALLBACK,
67
+ });
68
+ for (const info of models) {
69
+ registry.register(imageModelInfoToDescriptor(info));
70
+ }
71
+ return registry;
72
+ }
73
+ //# sourceMappingURL=imageAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imageAdapter.js","sourceRoot":"","sources":["../../src/adapters/imageAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,aAAa,EACb,cAAc,GAGf,MAAM,YAAY,CAAC;AAepB;;;;;;;;;GASG;AACH,MAAM,UAAU,0BAA0B,CAAC,IAAoB;IAC7D,OAAO;QACL,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,oEAAoE;QACpE,kEAAkE;QAClE,YAAY,EAAE,CAAC,GAAG,IAAI,CAAC,YAAY,CAAiB;QACpD,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAA0C;IAE1C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC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C,0BAA0B,CAAC,IAAI,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,47 @@
1
+ import type { ApiClient } from '../api';
2
+ import { type ChatAdapterDescriptor } from './chatAdapter';
3
+ import { type ImageAdapterDescriptor } from './imageAdapter';
4
+ import { type WorldAdapterDescriptor } from './worldAdapter';
5
+ import { type DirectorAdapterDescriptor } from './directorAdapter';
6
+ import type { AdapterRegistry } from './registry';
7
+ export * from './capabilities';
8
+ export * from './registry';
9
+ export * from './chatAdapter';
10
+ export * from './imageAdapter';
11
+ export * from './worldAdapter';
12
+ export * from './directorAdapter';
13
+ /**
14
+ * The four R1 adapter registries, pre-wired — the showroom view of the
15
+ * platform's capability matrix. One per capability domain:
16
+ * - `chat` — delegates selection to `shared/model_router.py` (facade only).
17
+ * - `image` — the Gemini image catalogue (R1c).
18
+ * - `world` — step-into-video; Helios default, LongLive-v2 also registered.
19
+ * - `director` — timeline director; LongLive-v2 default (the Step-2/3 swap),
20
+ * Helios the fallback.
21
+ */
22
+ export interface PlatformRegistries {
23
+ chat: AdapterRegistry<ChatAdapterDescriptor>;
24
+ image: AdapterRegistry<ImageAdapterDescriptor>;
25
+ world: AdapterRegistry<WorldAdapterDescriptor>;
26
+ director: AdapterRegistry<DirectorAdapterDescriptor>;
27
+ }
28
+ /**
29
+ * Aggregate all four R1 adapter registries — the single entry every
30
+ * downstream wave (and the `/admin/adapters` showroom inspector) imports to
31
+ * get the platform's capability matrix pre-wired.
32
+ *
33
+ * `world` + `director` are SYNCHRONOUS seeds (no I/O): the Helios world
34
+ * default and the LongLive-v2 director default (post Step-2/3 swap) come from
35
+ * their factory functions. `chat` + `image` are loaded from their backend
36
+ * catalogues (`GET /api/v1/chat|images/models`) via the existing facades and
37
+ * resolved in PARALLEL; awaiting the returned promise yields all four
38
+ * registries ready.
39
+ *
40
+ * Like the facades it composes, this makes NO model-selection decision — chat
41
+ * selection stays server-side in `shared/model_router.py`; this only wires the
42
+ * registries together (DRY: it reuses `loadChatAdapterRegistry` /
43
+ * `loadImageAdapterRegistry` / `createWorldRegistry` / `createDirectorRegistry`
44
+ * rather than re-deriving any of them).
45
+ */
46
+ export declare function createPlatformRegistries(client: Pick<ApiClient, 'listChatModels' | 'listImageModels'>): Promise<PlatformRegistries>;
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAA2B,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAA4B,KAAK,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAClF,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAElC;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;IAC7C,KAAK,EAAE,eAAe,CAAC,sBAAsB,CAAC,CAAC;IAC/C,KAAK,EAAE,eAAe,CAAC,sBAAsB,CAAC,CAAC;IAC/C,QAAQ,EAAE,eAAe,CAAC,yBAAyB,CAAC,CAAC;CACtD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,gBAAgB,GAAG,iBAAiB,CAAC,GAC5D,OAAO,CAAC,kBAAkB,CAAC,CAW7B"}
@@ -0,0 +1,41 @@
1
+ import { loadChatAdapterRegistry } from './chatAdapter.js';
2
+ import { loadImageAdapterRegistry } from './imageAdapter.js';
3
+ import { createWorldRegistry } from './worldAdapter.js';
4
+ import { createDirectorRegistry, } from './directorAdapter.js';
5
+ export * from './capabilities.js';
6
+ export * from './registry.js';
7
+ export * from './chatAdapter.js';
8
+ export * from './imageAdapter.js';
9
+ export * from './worldAdapter.js';
10
+ export * from './directorAdapter.js';
11
+ /**
12
+ * Aggregate all four R1 adapter registries — the single entry every
13
+ * downstream wave (and the `/admin/adapters` showroom inspector) imports to
14
+ * get the platform's capability matrix pre-wired.
15
+ *
16
+ * `world` + `director` are SYNCHRONOUS seeds (no I/O): the Helios world
17
+ * default and the LongLive-v2 director default (post Step-2/3 swap) come from
18
+ * their factory functions. `chat` + `image` are loaded from their backend
19
+ * catalogues (`GET /api/v1/chat|images/models`) via the existing facades and
20
+ * resolved in PARALLEL; awaiting the returned promise yields all four
21
+ * registries ready.
22
+ *
23
+ * Like the facades it composes, this makes NO model-selection decision — chat
24
+ * selection stays server-side in `shared/model_router.py`; this only wires the
25
+ * registries together (DRY: it reuses `loadChatAdapterRegistry` /
26
+ * `loadImageAdapterRegistry` / `createWorldRegistry` / `createDirectorRegistry`
27
+ * rather than re-deriving any of them).
28
+ */
29
+ export async function createPlatformRegistries(client) {
30
+ const [chat, image] = await Promise.all([
31
+ loadChatAdapterRegistry(client),
32
+ loadImageAdapterRegistry(client),
33
+ ]);
34
+ return {
35
+ chat,
36
+ image,
37
+ world: createWorldRegistry(),
38
+ director: createDirectorRegistry(),
39
+ };
40
+ }
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,uBAAuB,EAA8B,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAA+B,MAAM,gBAAgB,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAA+B,MAAM,gBAAgB,CAAC;AAClF,OAAO,EACL,sBAAsB,GAEvB,MAAM,mBAAmB,CAAC;AAG3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAkBlC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,MAA6D;IAE7D,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACtC,uBAAuB,CAAC,MAAM,CAAC;QAC/B,wBAAwB,CAAC,MAAM,CAAC;KACjC,CAAC,CAAC;IACH,OAAO;QACL,IAAI;QACJ,KAAK;QACL,KAAK,EAAE,mBAAmB,EAAE;QAC5B,QAAQ,EAAE,sBAAsB,EAAE;KACnC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,98 @@
1
+ import type { Capability } from './capabilities';
2
+ /**
3
+ * Framework-agnostic model-adapter registry contract (R1a).
4
+ *
5
+ * The primitive every later R1 adapter (image / world / director domains)
6
+ * registers into. Deliberately free of React, DOM, and provider-SDK imports —
7
+ * mirror the discipline of the `reactor/` and `vision/` submodules. It carries
8
+ * descriptors and resolves named routes; it never invokes a model.
9
+ *
10
+ * The route/fallback semantics mirror the backend chat router
11
+ * (`shared/model_router.py:344-360`): a route whose adapter is unregistered
12
+ * degrades to the configured fallback route rather than throwing, keeping the
13
+ * resolution path crash-proof.
14
+ */
15
+ /**
16
+ * Named-route constants — the `ROUTE_*` analogue of
17
+ * `shared/model_router.py:56-59`. Use these at call sites instead of inline
18
+ * string literals so a route name can never be a raw string.
19
+ */
20
+ export declare const ROUTE_DEFAULT: "default";
21
+ export declare const ROUTE_FALLBACK: "fallback";
22
+ export declare const ROUTE_HIGH_QUALITY: "high_quality";
23
+ /**
24
+ * A single registered adapter. `id` is the stable lookup key; `capabilities`
25
+ * is the advertised {@link Capability} vocabulary. `metadata` is opaque and
26
+ * forward-compatible — the registry carries it untouched, never interpreting
27
+ * it, so adapters can stamp cost tier / cache policy / etc. without a contract
28
+ * change here.
29
+ */
30
+ export interface ModelAdapterDescriptor {
31
+ /** Stable lookup key, e.g. `'helios'`, `'gemini-3.1-flash-image-preview'`. */
32
+ id: string;
33
+ displayName: string;
34
+ /** Provider family, e.g. `'reactor' | 'gemini' | 'bedrock' | 'ollama'`. */
35
+ provider: string;
36
+ capabilities: readonly Capability[];
37
+ /** Opaque, forward-compat metadata (cost tier, cache policy) — carried, not interpreted. */
38
+ metadata?: Readonly<Record<string, unknown>>;
39
+ }
40
+ /**
41
+ * A named route binding — the `ROUTE_*` → adapter mapping. `name` is always a
42
+ * named-route constant, never a raw string at call sites.
43
+ */
44
+ export interface NamedRoute {
45
+ /**
46
+ * `ROUTE_*` analogue, never a raw string at call sites. Deliberately typed
47
+ * `string` (not a literal union of the known `ROUTE_*`) so downstream R1b–R1d
48
+ * PRs can register new routes without widening it back; `resolveRoute`
49
+ * degrades on an unknown name rather than rejecting it.
50
+ */
51
+ name: string;
52
+ adapterId: string;
53
+ reason: string;
54
+ }
55
+ /**
56
+ * Additive registry of {@link ModelAdapterDescriptor}s for a single domain.
57
+ *
58
+ * - {@link register} is additive and THROWS on a duplicate id (no silent
59
+ * overwrite).
60
+ * - {@link resolveRoute} degrades to the fallback route rather than throwing.
61
+ */
62
+ export declare class AdapterRegistry<TDescriptor extends ModelAdapterDescriptor> {
63
+ private readonly domain;
64
+ private readonly routes;
65
+ private readonly fallbackRouteName;
66
+ private readonly descriptors;
67
+ constructor(opts: {
68
+ domain: string;
69
+ routes: readonly NamedRoute[];
70
+ fallbackRouteName: string;
71
+ });
72
+ /** Register a descriptor. Additive — THROWS if `descriptor.id` already exists. */
73
+ register(descriptor: TDescriptor): void;
74
+ /** Look up a descriptor by id, or `undefined` if unregistered. */
75
+ get(id: string): TDescriptor | undefined;
76
+ /** All registered descriptors (registration order). */
77
+ list(): readonly TDescriptor[];
78
+ /** Descriptors whose `capabilities` include `cap`. */
79
+ listWithCapability(cap: Capability): readonly TDescriptor[];
80
+ /**
81
+ * Resolve a named route to its adapter. If the route's `adapterId` is
82
+ * registered, return it. Otherwise (route unknown, or its adapter
83
+ * unregistered) degrade to the configured fallback route and return ITS
84
+ * adapter if registered. If even the fallback adapter is missing, return
85
+ * `undefined`. NEVER throws.
86
+ *
87
+ * Parity with `shared/model_router.py:344-360`.
88
+ */
89
+ resolveRoute(routeName: string): TDescriptor | undefined;
90
+ /**
91
+ * True iff `id` is registered AND its descriptor advertises EVERY member of
92
+ * `required`. False for an unregistered id.
93
+ */
94
+ satisfies(id: string, required: readonly Capability[]): boolean;
95
+ /** Resolve a route name to its REGISTERED adapter, or `undefined`. No fallback. */
96
+ private adapterForRoute;
97
+ }
98
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/adapters/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;;;;;;;;GAYG;AAEH;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAG,SAAkB,CAAC;AAChD,eAAO,MAAM,cAAc,EAAG,UAAmB,CAAC;AAClD,eAAO,MAAM,kBAAkB,EAAG,cAAuB,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC,8EAA8E;IAC9E,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,SAAS,UAAU,EAAE,CAAC;IACpC,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC9C;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,qBAAa,eAAe,CAAC,WAAW,SAAS,sBAAsB;IACrE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAkC;IACzD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkC;gBAElD,IAAI,EAAE;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,SAAS,UAAU,EAAE,CAAC;QAC9B,iBAAiB,EAAE,MAAM,CAAC;KAC3B;IAeD,kFAAkF;IAClF,QAAQ,CAAC,UAAU,EAAE,WAAW,GAAG,IAAI;IAUvC,kEAAkE;IAClE,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAIxC,uDAAuD;IACvD,IAAI,IAAI,SAAS,WAAW,EAAE;IAI9B,sDAAsD;IACtD,kBAAkB,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,WAAW,EAAE;IAI3D;;;;;;;;OAQG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAYxD;;;OAGG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,UAAU,EAAE,GAAG,OAAO;IAQ/D,mFAAmF;IACnF,OAAO,CAAC,eAAe;CAOxB"}
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Framework-agnostic model-adapter registry contract (R1a).
3
+ *
4
+ * The primitive every later R1 adapter (image / world / director domains)
5
+ * registers into. Deliberately free of React, DOM, and provider-SDK imports —
6
+ * mirror the discipline of the `reactor/` and `vision/` submodules. It carries
7
+ * descriptors and resolves named routes; it never invokes a model.
8
+ *
9
+ * The route/fallback semantics mirror the backend chat router
10
+ * (`shared/model_router.py:344-360`): a route whose adapter is unregistered
11
+ * degrades to the configured fallback route rather than throwing, keeping the
12
+ * resolution path crash-proof.
13
+ */
14
+ /**
15
+ * Named-route constants — the `ROUTE_*` analogue of
16
+ * `shared/model_router.py:56-59`. Use these at call sites instead of inline
17
+ * string literals so a route name can never be a raw string.
18
+ */
19
+ export const ROUTE_DEFAULT = 'default';
20
+ export const ROUTE_FALLBACK = 'fallback';
21
+ export const ROUTE_HIGH_QUALITY = 'high_quality';
22
+ /**
23
+ * Additive registry of {@link ModelAdapterDescriptor}s for a single domain.
24
+ *
25
+ * - {@link register} is additive and THROWS on a duplicate id (no silent
26
+ * overwrite).
27
+ * - {@link resolveRoute} degrades to the fallback route rather than throwing.
28
+ */
29
+ export class AdapterRegistry {
30
+ domain;
31
+ routes;
32
+ fallbackRouteName;
33
+ descriptors = new Map();
34
+ constructor(opts) {
35
+ // Eager guard: a fallbackRouteName absent from `routes` would make EVERY
36
+ // degrade silently return undefined (resolveRoute never throws). Fail at
37
+ // construction — the only place the misconfiguration is detectable.
38
+ if (!opts.routes.some((route) => route.name === opts.fallbackRouteName)) {
39
+ throw new Error(`AdapterRegistry(${opts.domain}): fallbackRouteName "${opts.fallbackRouteName}" ` +
40
+ 'is not present in the routes array — configure a fallback route.');
41
+ }
42
+ this.domain = opts.domain;
43
+ this.fallbackRouteName = opts.fallbackRouteName;
44
+ this.routes = new Map(opts.routes.map((route) => [route.name, route]));
45
+ }
46
+ /** Register a descriptor. Additive — THROWS if `descriptor.id` already exists. */
47
+ register(descriptor) {
48
+ if (this.descriptors.has(descriptor.id)) {
49
+ throw new Error(`AdapterRegistry(${this.domain}): duplicate adapter id "${descriptor.id}" — ` +
50
+ 'registration is additive and must not silently overwrite an existing adapter.');
51
+ }
52
+ this.descriptors.set(descriptor.id, descriptor);
53
+ }
54
+ /** Look up a descriptor by id, or `undefined` if unregistered. */
55
+ get(id) {
56
+ return this.descriptors.get(id);
57
+ }
58
+ /** All registered descriptors (registration order). */
59
+ list() {
60
+ return [...this.descriptors.values()];
61
+ }
62
+ /** Descriptors whose `capabilities` include `cap`. */
63
+ listWithCapability(cap) {
64
+ return this.list().filter((descriptor) => descriptor.capabilities.includes(cap));
65
+ }
66
+ /**
67
+ * Resolve a named route to its adapter. If the route's `adapterId` is
68
+ * registered, return it. Otherwise (route unknown, or its adapter
69
+ * unregistered) degrade to the configured fallback route and return ITS
70
+ * adapter if registered. If even the fallback adapter is missing, return
71
+ * `undefined`. NEVER throws.
72
+ *
73
+ * Parity with `shared/model_router.py:344-360`.
74
+ */
75
+ resolveRoute(routeName) {
76
+ const direct = this.adapterForRoute(routeName);
77
+ if (direct !== undefined) {
78
+ return direct;
79
+ }
80
+ // Already tried the fallback route directly above — skip the second lookup.
81
+ if (routeName === this.fallbackRouteName) {
82
+ return undefined;
83
+ }
84
+ return this.adapterForRoute(this.fallbackRouteName);
85
+ }
86
+ /**
87
+ * True iff `id` is registered AND its descriptor advertises EVERY member of
88
+ * `required`. False for an unregistered id.
89
+ */
90
+ satisfies(id, required) {
91
+ const descriptor = this.descriptors.get(id);
92
+ if (descriptor === undefined) {
93
+ return false;
94
+ }
95
+ return required.every((cap) => descriptor.capabilities.includes(cap));
96
+ }
97
+ /** Resolve a route name to its REGISTERED adapter, or `undefined`. No fallback. */
98
+ adapterForRoute(routeName) {
99
+ const route = this.routes.get(routeName);
100
+ if (route === undefined) {
101
+ return undefined;
102
+ }
103
+ return this.descriptors.get(route.adapterId);
104
+ }
105
+ }
106
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/adapters/registry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,SAAkB,CAAC;AAChD,MAAM,CAAC,MAAM,cAAc,GAAG,UAAmB,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AAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC/C,CAAC;CACF"}
@@ -0,0 +1,142 @@
1
+ import { AdapterRegistry, type ModelAdapterDescriptor } from './registry';
2
+ import type { WorldCapability } from './capabilities';
3
+ import type { HeliosCommand, HeliosToolContext, LongLiveCommand, LongLiveToolContext } from '../reactor';
4
+ /**
5
+ * World-domain (step-into-video) adapter registry — R1d, Helios seed.
6
+ *
7
+ * This is a capability GATE in FRONT of the existing, working Helios
8
+ * machinery, NOT a rewrite. Today the live `/interactive` pages dispatch
9
+ * through {@link dispatchHeliosCommand} against a structural
10
+ * `HeliosReactorBridge`; the `modelName="helios"` literal is hard-coded in
11
+ * those React pages. R1d wraps that one model behind a
12
+ * {@link WorldAdapterDescriptor} + {@link AdapterRegistry} so later waves
13
+ * (R7 flagship DM, R8 Director/Interactive rewire) can register sibling
14
+ * adapters and swap them. The 'helios' model-name literal is CENTRALIZED
15
+ * here so the R8 rewire stops hard-coding it in the pages.
16
+ *
17
+ * LAND-DARK: the live Helios path is UNCHANGED. {@link dispatchWorldCommand}
18
+ * only gates in front of {@link dispatchHeliosCommand} and delegates with
19
+ * IDENTICAL arguments. The adapters/ submodule stays SDK-free — it reuses
20
+ * the structural `HeliosReactorBridge` via {@link HeliosToolContext} and
21
+ * takes NO `@reactor-team/js-sdk` dependency.
22
+ */
23
+ /**
24
+ * A world adapter descriptor — a {@link ModelAdapterDescriptor} that also
25
+ * declares the world commands it accepts. `supportedCommands` is deliberately
26
+ * `readonly string[]` (model-agnostic), NOT locked to the {@link HeliosCommand}
27
+ * variant set: the registry's purpose is to hold heterogeneous world models,
28
+ * and a sibling model (e.g. a Reactor LongLive adapter) has its OWN command
29
+ * vocabulary (`set_shot`/`scene_cut`/`schedule_shot`/…) that is not a
30
+ * `HeliosCommand`. Each adapter declares its own command strings here; the
31
+ * Helios seed below declares the `HeliosCommand` variant names.
32
+ */
33
+ export interface WorldAdapterDescriptor extends ModelAdapterDescriptor {
34
+ /**
35
+ * The world commands this adapter accepts (each model's own vocabulary).
36
+ *
37
+ * Distinct axis from the inherited `capabilities`: `capabilities` (e.g.
38
+ * `'world_stream'`/`'pause_resume'`) is the **registry** axis that
39
+ * `listWithCapability`/`satisfies` filter and gate on; `supportedCommands`
40
+ * (e.g. `'set_scene'`/`'reset_world'`) is **advisory metadata** naming the
41
+ * command strings the adapter's dispatcher understands. The dispatch gate
42
+ * routes on `id` + (when a 2nd adapter lands) `capabilities`, NOT on this
43
+ * array.
44
+ */
45
+ supportedCommands: readonly string[];
46
+ }
47
+ /**
48
+ * The one world model that exists today. Helios drives the live
49
+ * step-into-video stream over the structural Reactor bridge. Its
50
+ * `supportedCommands` is the EXACT {@link HeliosCommand} variant set
51
+ * (`reactor/heliosTools.ts:32-37`).
52
+ *
53
+ * The 'helios' id is the single source of truth for the model name — the
54
+ * R8 rewire reads it from here instead of re-spelling the literal in the
55
+ * `/interactive` pages.
56
+ */
57
+ export declare const heliosWorldAdapter: {
58
+ readonly id: "helios";
59
+ readonly displayName: "Helios";
60
+ readonly provider: "reactor";
61
+ readonly capabilities: readonly ["world_stream", "set_scene", "swap_seed", "pause_resume"];
62
+ readonly supportedCommands: readonly ["set_scene", "swap_seed", "pause_world", "resume_world", "reset_world"];
63
+ };
64
+ /**
65
+ * The second world model — Reactor LongLive-v2. SAME Reactor transport as
66
+ * Helios (only the `modelName` differs on the bridge); its OWN command
67
+ * vocabulary (`set_shot`/`scene_cut`/`schedule_shot`/… — the
68
+ * {@link LongLiveCommand} variant set, not a `HeliosCommand`).
69
+ *
70
+ * ASYMMETRIC capability matrix vs Helios: LongLive is text-to-video with NO
71
+ * image conditioning, so it LACKS `swap_seed`; but it ADDS `scene_cut` (a
72
+ * hard, memory-purging transition) which Helios — a continuous morph — lacks.
73
+ * That asymmetry is exactly what `registry.satisfies` lets the Step-3 director
74
+ * UI query (hide the seed-image UI when the resolved world is LongLive).
75
+ */
76
+ export declare const longLiveWorldAdapter: {
77
+ readonly id: "longlive-v2";
78
+ readonly displayName: "LongLive 2.0";
79
+ readonly provider: "reactor";
80
+ readonly capabilities: readonly ["world_stream", "set_scene", "scene_cut", "pause_resume"];
81
+ readonly supportedCommands: readonly ["set_shot", "scene_cut", "schedule_shot", "schedule_scene_cut", "pause", "resume", "reset", "set_seed"];
82
+ };
83
+ /**
84
+ * Build a world {@link AdapterRegistry} pre-registered with the Helios seed.
85
+ * Each call returns a FRESH instance (the factory is synchronous + free) —
86
+ * callers that dispatch repeatedly should memoize one registry rather than
87
+ * rebuild it per call.
88
+ *
89
+ * Both `ROUTE_DEFAULT` and `ROUTE_FALLBACK` STAY pointed at the Helios id —
90
+ * Helios remains the WORLD default (plain `/interactive` is unchanged). The
91
+ * LongLive adapter is registered + resolvable by id (`get('longlive-v2')`)
92
+ * and by capability (`listWithCapability('scene_cut')`), but it is NOT the
93
+ * world default. The DIRECTOR registry is where LongLive becomes the default
94
+ * (see `createDirectorRegistry`). The R1a constructor guard REQUIRES the
95
+ * `fallbackRouteName` to be present by name in `routes`.
96
+ */
97
+ export declare function createWorldRegistry(): AdapterRegistry<WorldAdapterDescriptor>;
98
+ /**
99
+ * Pure mapping from a world command to the {@link WorldCapability} an
100
+ * adapter must advertise to accept it. Mirrors the dispatcher's
101
+ * exhaustive-switch idiom (`reactor/heliosCommandDispatcher.ts:114-142`) so
102
+ * a new {@link HeliosCommand} variant fails to compile until mapped here.
103
+ */
104
+ export declare function requiredCapabilityForCommand(cmd: HeliosCommand): WorldCapability;
105
+ /**
106
+ * Thrown by {@link dispatchWorldCommand} when an adapter id has no real world
107
+ * transport wired (anything other than the Helios or LongLive seeds). Typed
108
+ * so callers can distinguish "no transport for this adapter" from a transient
109
+ * Reactor failure (which the underlying dispatchers swallow). Carries the
110
+ * offending `adapterId`.
111
+ */
112
+ export declare class UnsupportedWorldAdapterError extends Error {
113
+ readonly adapterId: string;
114
+ constructor(adapterId: string);
115
+ }
116
+ /**
117
+ * Per-adapter dispatch of a single world command, routed by `adapterId`.
118
+ *
119
+ * (a) `heliosWorldAdapter.id` → delegate to the EXISTING
120
+ * {@link dispatchHeliosCommand} with IDENTICAL arguments. The Helios path
121
+ * is UNCHANGED — this only routes in front of it (LAND-DARK). This branch
122
+ * is BYTE-IDENTICAL to the R1d single-adapter body; the LongLive branch is
123
+ * purely ADDITIVE.
124
+ * (b) `longLiveWorldAdapter.id` → delegate to {@link dispatchLongLiveCommand}
125
+ * over the SAME structural Reactor bridge.
126
+ * (c) Any other id → throw a typed {@link UnsupportedWorldAdapterError}
127
+ * WITHOUT touching the bridge (no other adapter has a real transport).
128
+ *
129
+ * Compile-time safety is enforced by the FUNCTION OVERLOADS below — each
130
+ * `(adapterId, cmd, ctx)` triple must agree (a `LongLiveCommand` cannot be
131
+ * passed under the Helios id, and vice versa). So NO per-command runtime
132
+ * capability gate is added here (the R1d review removed the unreachable
133
+ * `satisfies` scaffolding): the overloads enforce the cmd/adapter match at the
134
+ * type level, and the capability INFO (the asymmetric matrix — helios
135
+ * `swap_seed` not `scene_cut`; longlive `scene_cut` not `swap_seed`) is
136
+ * consumed via `registry.satisfies()` by the Step-3 director UI (to hide the
137
+ * seed-image control for LongLive), NOT by a runtime dispatch gate. Resolves
138
+ * tech-debt #414.
139
+ */
140
+ export declare function dispatchWorldCommand(adapterId: typeof heliosWorldAdapter.id, cmd: HeliosCommand, ctx: HeliosToolContext): Promise<void>;
141
+ export declare function dispatchWorldCommand(adapterId: typeof longLiveWorldAdapter.id, cmd: LongLiveCommand, ctx: LongLiveToolContext): Promise<void>;
142
+ //# sourceMappingURL=worldAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worldAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/worldAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAIf,KAAK,sBAAsB,EAC5B,MA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