@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
package/README.md CHANGED
@@ -10,13 +10,21 @@ ESM-only. The published `package.json` points `exports[".".import]` at `./dist/i
10
10
 
11
11
  | Module | What it does |
12
12
  |---|---|
13
+ | `timeFormat` | `formatTimestamp(seconds, opts?)` — locale-aware `M:SS` / `M:SS.cs` formatter. `formatCitationTimestamp(seconds)` (`src/timeFormat.ts:68`) is a preset with `centiseconds: true`, used by chat surfaces for sub-second word/turn citations (renders as `"1:23.45"`). |
14
+ | `graphSchema` | **0.12.0:** Graph-schema vocabulary mirrored from the backend single source of truth (`shared/graph_schema.py` + `shared/provenance.py`). Types `GraphNodeLabel`, `GraphRelationshipType`; two **separate** provenance unions `StoryGraphProvenance` (`'pegasus' \| 'user' \| 'document' \| 'regenerated'`) and `MemoryFactProvenance` (`'chat' \| 'document' \| 'system' \| 'regenerated'`) — never merged. Runtime constants `GRAPH_NODE_LABELS`, `GRAPH_RELATIONSHIP_TYPES`, `GRAPH_PRIMARY_KEY`, `GRAPH_EDITABLE_NODE_PROPERTIES`, `GRAPH_EDITABLE_RELATIONSHIP_PROPERTIES`, `STORY_GRAPH_PROVENANCE_VALUES`, `MEMORY_FACT_PROVENANCE_VALUES`; authored-canon sets `AUTHORED_STORY_PROVENANCE` / `AUTHORED_MEMORY_PROVENANCE` + guards `isStoryGraphProvenance` / `isMemoryFactProvenance`. **0.13.0:** adds a session-scoped memoized `fetchGraphSchema(client)` that fetches the live `GET /graph/schema` payload once per session (resets its cache on rejection so a failed fetch retries; `__resetGraphSchemaCache()` test hook). The graph-editor `PropertyPanel` now sources its **runtime** editable/PK lists from this fetched payload (backend = single runtime source of truth), dropping its hand-maintained literal whitelist. The static `GRAPH_*` unions/constants are **retained** as the typed compile-time vocabulary and a back-compat fallback — they are **not** removed (eliminating the TS copy entirely needs build-time codegen; tech-debt #205). Resolves tech-debt #45 for the graph editor (M7 Phase 1a). **0.15.0 (M7 Phase 3a):** widens `GraphNodeLabel` + `GRAPH_NODE_LABELS` with `Scene`/`PlotBeat`/`CharacterArc` and `GraphRelationshipType` + `GRAPH_RELATIONSHIP_TYPES` with the six user-creatable edges (`RELATES_TO`/`CAUSES`/`SET_IN`/`FEATURES`/`ON_ARC`/`LEADS_TO`); adds `GRAPH_PRIMARY_KEY` (`Scene→sceneId`, `PlotBeat→beatId`, `CharacterArc→arcId`) + `GRAPH_EDITABLE_NODE_PROPERTIES` entries. New exports consumed by the 3b creation UI: `userCreatableLabels` (`['Scene','PlotBeat','CharacterArc']`), `userCreatableEdges` (the six edges), and `allowedPairs` (the TS mirror of the backend `_VALID_EDGE_PAIRS`: `RELATES_TO→[[Entity,Entity]]`, `SET_IN`/`FEATURES→[[Scene,Entity]]`, `ON_ARC→[[PlotBeat,CharacterArc]]`, `LEADS_TO→[[PlotBeat,PlotBeat]]`, `CAUSES→[[Event,Event]]`) — all **additive**. Graph schema only — no tool/MCP schemas. **0.39.0 (R8.1):** adds the studio **read-surface** vocabulary `STUDIO_NODE_LABELS` / `STUDIO_EDGE_TYPES` / `STUDIO_NODE_PROPERTIES` / `STUDIO_CHARACTER_TYPE` (lifted from web `graphVocabulary.ts`, which now re-exports them) so the lifted `storyGraph` projection resolves its vocabulary in one place. |
15
+ | `storyGraph` | **0.39.0 (R8.1):** the pure get_video_graph projection lifted from `web/app/components/studio/storyGraph.ts` (the web module is now a thin re-export shim). `deriveScenes(graph): SceneView[]` (collapsed scenes with featured characters, location, shots, parent act — sorted by act.index then scene.index) and `deriveCast(graph): CharacterView[]` (character entities with aliases, scene memberships, arcs, related characters). Edge-direction-agnostic traversal (CONTAINS/INCLUDES/FEATURES/SET_IN/ON_ARC/RELATES_TO matched by EITHER endpoint). The **single source** of the collapsed-story projection both Studio read-views AND the Director story-timeline mapper (`reactor/storyTimeline.ts`) consume — two copies would drift. Plus view-model types `SceneView`/`CharacterView`/`ArcView`/`ShotView`/`CharacterRef`/`LocationRef`. |
16
+ | `toolSchemas` | **0.11.0:** `AGENT_TOOL_SCHEMAS`, `AGENT_TOOL_NAMES`, `getAgentToolSchema(name)` + types `AgentToolSchema` / `AgentToolName` / `ToolRequestField` / `ToolFieldType` (`src/toolSchemas.ts`). Framework-agnostic TS mirror of the backend's 12 SERVER-SIDE RAG tools whose canonical source is `shared/tool_schemas.py`. Exposes each tool's name, description, endpoint, HTTP method, and request field shapes so clients can introspect the agent's tool surface without copy-pasting strings. Keep in sync when the backend tool list changes (no codegen yet). **Distinct from** the Helios browser-side `BEDROCK_TOOL_SCHEMAS` in `reactor/heliosTools.ts` — different vocabulary, do not converge. |
13
17
  | `audioProtocol` | Binary audio frame codec (1-byte tag + 320 samples PCM16); type defs for phoneme/word/barge-in messages |
14
18
  | `audio` | `MicrophoneRecorder`, `AudioFramePlayer`, `PlaybackTracker`, `AudioSessionClient`, `AudioPipeline`. Web Audio API based. Clean barge-in via `GainNode` + tracked `activeSources`. Sentence-boundary viseme scheduling. |
15
19
  | `visemeScheduler` | Maps Inworld TTS 1.5 phoneme timing to mouth shape changes via `requestAnimationFrame`, locked to `AudioContext.currentTime`. Stops the loop when idle. |
16
20
  | `visemeGeometry` | Pure path math: derive inner-lip donut, mouth clip ellipse, teeth/tongue geometry from existing `mouth_paths` data |
17
- | `websocket` | `ChatWebSocket` — auto-reconnecting wrapper around native WebSocket with text/binary multiplexing. `sendPlaybackState(state: PlaybackState)` publishes `{ action: 'playback_state', videoId, currentTime, shotId?, paused, clientTs }` for cross-device video↔chat sync (`src/websocket.ts:493` `sendPlaybackState` + `src/websocket.ts:69` `PlaybackState`). Fire-and-forget: drops silently when the socket isn't OPEN. See `specs/2026-05-17-cross-device-playback-sync.md`. |
18
- | `api` | `ApiClient` REST client + all backend response/request type definitions. Constructor takes `baseURL` and `chatBaseUrl` from the caller (no env-var coupling). Image-tool wrappers since 0.3.0: `extractImage`, `regenerateImage`, `pollVisemeBundleUntilDone`. Bundle resolution since 0.5.0: `loadBundleManifest` (handles the inline-vs-S3 body_svg split internally) + canonical `VisemeBundleManifest` type. Reactor/Helios wrappers: `getReactorToken`, `getSeedImageBlob`, `upsampleReactorPrompt`. See [CHANGELOG.md](./CHANGELOG.md). |
19
- | `reactor/` | Pure builders for the `/interactive` page in seer-agent (and reusable by the Vue Web-App). `buildRegenPrompt(input)` produces deterministic Gemini Flash Image prompts with locked 16:9 + identity guarantees plus a creative-direction escape hatch. `buildUpsamplePrompt(input)` returns `{system, user}` message blocks for any LLM transport, encoding the Helios prompt-guide rules and weaving in entity/persona/previous-prompt context. `aggregateEntityContext` and `aggregatePersonaContext` adapt our existing `ImageRecord` / `EnrichmentRecord` / `PersonaConfig` types into the canonical context shapes. **Phase 2:** `mapEnrichmentToTimeline(enrichment, opts)` consumes a `EnrichmentRecord` and returns a `TimelineBeat[]` (chunk-pinned prompts) for the `/interactive/director` timeline UI. Defensively probes multiple Pegasus result shapes. **Phase 3:** `heliosTools.ts` — `HeliosCommand` (discriminated union), `parseHeliosCommands(text)` (extracts `[SET_SCENE: "…"]`-style inline markers from streamed chat output), `stripHeliosCommands(text)` (removes markers from the displayed transcript), and the future-use `BEDROCK_TOOL_SCHEMAS` Converse-tool-spec export. `toolPromptAddon.ts` — `HELIOS_STEERING_ADDON_ID`, `getHeliosSteeringAddonText()`, idempotent `buildHeliosSteeringSystemPrompt(base)` for personas with `prompt_addon_ids: ['helios-world-steering']`. `entitySearch.ts` — `findEntityImageBySeedName(apiClient, videoId, name)` resolves an entity name to its `ImageRecord` (searches `extracted` then `character`, case-insensitive). Per-`(videoId, category)` in-process cache so repeat SWAP_SEED commands skip the API round-trip; `forceRefresh: true` and `clearEntitySearchCache()` bypass it. `heliosCommandDispatcher.ts` — `dispatchHeliosCommand(cmd, ctx)` executes a `HeliosCommand` against a structural Reactor bridge (`sendCommand` + `uploadFile`); pure async function, no React. `HeliosToolContext.signal?: AbortSignal` cancels in-flight upsample + seed-image work on unmount. `seedImageOrchestrator.ts` — `loadSeedImageFile(imageId, apiClient)` + `sendSeedFileToReactor(file, reactor, opts)` + convenience `loadAndApplySeedImage`. Used by all three `/interactive` React pages AND by the SWAP_SEED branch of the dispatcher, so the load → upload → set_image sequence has exactly one implementation. No `@reactor-team/js-sdk` dependency — that stays in the consuming app. Spec: [`specs/interactive-helios-prototype.md`](../../specs/interactive-helios-prototype.md). |
21
+ | `websocket` | `ChatWebSocket` — auto-reconnecting wrapper around native WebSocket with text/binary multiplexing. `sendPlaybackState(state: PlaybackState)` publishes `{ action: 'playback_state', videoId, currentTime, shotId?, paused, clientTs }` for cross-device video↔chat sync (`src/websocket.ts:493` `sendPlaybackState` + `src/websocket.ts:69` `PlaybackState`). Fire-and-forget: drops silently when the socket isn't OPEN. See `specs/2026-05-17-cross-device-playback-sync.md`. **Phase 2 vision signaling:** `sendVisionOffer({ sdp, fps })` (`src/websocket.ts:578`), `sendVisionIce({ candidate, sdpMid, sdpMLineIndex })` (`src/websocket.ts:594`), and `sendVisionClose()` (`src/websocket.ts:614`) forward SDP/ICE over the existing chat-ws WebSocket; inbound `vision_answer`, `vision_ice`, and `vision_status` events are surfaced via typed event handlers. |
22
+ | `vision/` | **Phase 2:** `VisionPublisher` (`src/vision/VisionPublisher.ts:1`) — framework-agnostic class taking any `MediaStreamTrack` + `ChatWebSocket` + optional `VisionRtcCredentials` and managing the `RTCPeerConnection` lifecycle (SDP offer/answer, ICE trickle, restart-on-disconnect). **Dual-mode signaling**: `credentials.mode === 'kvs'` dynamically imports the optional `amazon-kinesis-video-streams-webrtc` peer dep and connects via Amazon KVS WebRTC against a backend-minted SigV4-presigned wss:// URL; otherwise (or when no credentials passed) uses the existing chat-WS `vision_offer`/`vision_ice`/`vision_close` protocol. `ChatWebSocket.sendVisionAttach({clientId})` (KVS mode only) binds the chat session to the KVS viewer ClientId so the backend dispatcher can find the FrameBuffer. `visionScheduler.ts` adjusts published fps from backend `vision_status` back-pressure (pure helper). `types.ts` exports `VisionPublisherConfig`, `VisionPublisherOptions`, `VisionRtcCredentials`, `VisionStatus`, `VisionStatusListener`, `VisionErrorListener`. Source-agnostic by design — consumers wire `<video>.captureStream()`, `getUserMedia()`, or future Reactor/Helios/PlayCanvas surfaces (Issue #150). **0.10.0 additions:** `toVisionRtcCredentials(response)` (`src/vision/credentials.ts:23`) — pure mapping helper that converts a `ChatVisionRtcCredentialsResponse` API wire shape into `VisionRtcCredentials`, coercing `null` ICE fields to `undefined`. `startVisionPublisher(opts)` (`src/vision/startVisionPublisher.ts:42`) — framework-agnostic factory: construct→subscribe→start→cleanup in one call, returning `VisionPublisherHandle { publisher, stop() }`. Used by both `/watch` and `/chat-ws` React hooks so the construct/teardown sequence has exactly one implementation. **0.31.0 (R3a — vision-source picker):** `sourceKinds.ts` — `VISION_SOURCE_KINDS` (`webcam`/`playing-video`/`server-render`, the frozen constant + `VisionSourceKind` union) and the `VisionSourceDescriptor` tagged union (`{kind:'webcam',constraints?}` vs `{kind:'playing-video'|'server-render', element, waitForFrame?}`) so the controller never queries the DOM. `VisionSourceController.ts` (`src/vision/VisionSourceController.ts:89`) — the framework-agnostic owner of "turn a chosen local source into a published feed": `start(descriptor)` acquires (getUserMedia vs `element.captureStream()`, with the `waitForFrame` black-frame gate lifted from the watch hook), mints credentials AFTER acquisition, then DELEGATES to `startVisionPublisher`; `switchSource()` tears the previous publisher + tracks down BEFORE acquiring the next; `stop()` is idempotent, leaves zero live tracks, and epoch-guards in-flight starts (a racing stop/switch releases the late stream, no error); `currentKind` + `isStarting` expose the published source and the in-flight phase. Environmental failures → `onError` (restartable); misuse (`start()` while active) throws. `ws` must be the SAME authenticated `ChatWebSocket` as the chat turns (frames are keyed to the WS session server-side). Land-dark until R3b–R3d wire the surfaces; sources are LOCAL only (cross-device vision deferred). |
23
+ | `api` | `ApiClient` REST client + all backend response/request type definitions. Constructor takes `baseURL` and `chatBaseUrl` from the caller (no env-var coupling). Image-tool wrappers since 0.3.0: `extractImage`, `regenerateImage`, `pollVisemeBundleUntilDone`. Bundle resolution since 0.5.0: `loadBundleManifest` (handles the inline-vs-S3 body_svg split internally) + canonical `VisemeBundleManifest` type. Reactor/Helios wrappers: `getReactorToken`, `getSeedImageBlob`, `upsampleReactorPrompt`. Chat-model registry (since the LLM-provider phase): `listChatModels()` returns `ChatModelsResponse` with `ChatModelInfo` entries (`id`, `provider`, `capabilities: ChatModelCapability[]`, context window, etc.) — public endpoint so it works before login. **0.10.0 additions:** `getSystemPrompt()` returns `SystemPromptComponents` (`src/api.ts:205,2132`) with `{ film_qa, guardrails, audio_markup, full_default }` — calls `GET /api/v1/chat/system-prompt`. **0.13.0 additions (M7 Phase 1a):** `getGraphSchema()` returns `GraphSchemaResponse` (`{ traceId, labels: Record<string,{pk,editable[]}>, edges: Record<string,{editable[]}> }`) — calls `GET /api/v1/tools/graph/schema`. **Graph-editor signature changes:** `deleteGraphNode` / `deleteGraphEdge` now send **query params** (no request body — tech-debt #42), and `UpdateNodeRequest` / `DeleteNodeRequest` input types **dropped `idProperty`** (backend derives the PK — tech-debt #44). These are input-type narrowings (callers pass less); additive otherwise. **0.14.0 additions (M7 Phase 1b):** `NarrativeAct` (`src/api.ts:751`) gains **optional** `actId` / `index` / `title` / `summary` / `t0` / `t1` — **additive only**; the existing `act` / `timeRange` / `description` fields are retained (per the client-core API-is-a-contract rule, no public export removed/renamed). Acts and `themes` / `mainCharacterNames` are now read **from the graph** — `Act`-labelled `GraphNode`s and the `Video` node properties returned by `getVideoGraph()` — rather than parsed from `getEnrichments()`; `GraphNode` / `VideoGraphResponse` carry `Act` nodes with no schema change. **0.15.0 additions (M7 Phase 3a):** `createGraphNode(data: CreateNodeRequest): Promise<CreateNodeResponse>` (`POST /api/v1/tools/graph/nodes`) and `createGraphEdge(data: CreateEdgeRequest): Promise<CreateEdgeResponse>` (`POST /api/v1/tools/graph/edges`) — both **additive** (no public export removed/renamed, per the API-is-a-contract rule). New request/response types `CreateNodeRequest` `{ videoId, label, properties }` / `CreateNodeResponse` `{ traceId, nodeId, properties }` and `CreateEdgeRequest` `{ videoId, sourceId, targetId, type, properties? }` / `CreateEdgeResponse` `{ traceId, edgeId, properties }`. The 201 JSON body is parsed by the existing `makeRequest` path (only 204 is special-cased); a 422 surfaces the FastAPI `detail` message unchanged. **Source-document CRUD (M7 Phase 4, package version 0.14.0):** shapes mirror the **authoritative backend Pydantic models** (`api/tools/schemas.py`). `uploadDocument(file, meta, onProgress?)` (multipart XHR mirroring `uploadVideo`; file sent under the multipart field **`upload`**; `POST /api/v1/ingestion/documents` → `{ traceId, document }`, HTTP 202 new / 200 idempotent dedupe), `listDocuments({ videoId?, seriesId?, limit?, nextToken? })`, `getDocument(docId)` (→ `{ traceId, document }` — suggestions are **nested** in `document.suggestions`, no top-level field), `acceptSuggestion(docId, sid)` (201 `{ traceId, suggestionId, graphId }`, writes graph node/edge with provenance `document`), `rejectSuggestion(docId, sid)` (204), `deleteDocument(docId)` (204) — all on the tools/ingestion base URL, not chat. New types/constants: `DocumentKind`, `DocumentStatus` + `DOC_STATUS_*`, `SuggestionStatus` + `SUGGESTION_STATUS_*`, `Suggestion`, `DocumentRecord` (mirrors `DocumentResponse`: `suggestions` always present; no `ownerUserId`/`s3Key`/`contentHash`), `UploadDocumentMeta`, `UploadDocumentResponse` `{ traceId, document }`, `ListDocumentsResponse`, `GetDocumentResponse` `{ traceId, document }`, `AcceptSuggestionResponse` `{ traceId, suggestionId, graphId }`. **0.16.0 additions (M7 Phase 6 — narrative regeneration):** `startRegeneration(videoId, request: RegenerateRequest): Promise<RegenerationRunResponse>` (`POST /api/v1/tools/graph/{videoId}/regenerate` → 202; `statusUrl`/`Location` to the run's poll URL; a 409 lock / 429 cap / 422 bad-scope surfaces the FastAPI `detail`), `listRegenerations(videoId, { limit?, cursor? }?)` (`GET .../regenerations` → `RegenerationListResponse` newest-first + `nextCursor`), `getRegeneration(videoId, runId, { signal? }?)` (`GET .../regenerations/{runId}`, 404 absent), and `pollRegenerationUntilDone(videoId, runId, { intervalMs?, timeoutMs?, signal? }?)` (5s cadence, abortable — resolves on `complete`/`cancelled`, throws on `failed`, mirrors `pollVisemeBundleUntilDone`). New types/constants `RegenerationRunStatus` + `REGENERATION_STATUS` const map + `REGENERATION_TERMINAL_STATUSES`, `RegenerationScopeKind` + `REGEN_SCOPE_BARE_KINDS`/`REGEN_SCOPE_TARGETED_KINDS`/`REGEN_SCOPE_SEPARATOR` + `buildRegenerationScope(kind, targetId?)` (builds `acts`/`characters`/`scene:<id>`/`arc:<id>`; throws on a bare+target or targeted-without-id contract violation), `RegenerateRequest` `{ scope, promptAddon? }`, `RegenerationRunResponse` `{ traceId, runId, videoId, scope, status, statusUrl, createdAt, promptAddon?, startedAt?, completedAt?, delta, error? }`, `RegenerationListResponse` `{ traceId, videoId, runs, nextCursor }`. **0.21.0 additions (M9 Story Engine Phase 8a — Adventure Runtime):** `startAdventure(request: StartAdventureRequest, { signal? }?): Promise<AdventureResponse>` (`POST /api/v1/adventures` → 201, `Location` to the session GET URL; a 422 `Persona is not a Dungeon Master` / 404 / 403 surfaces the FastAPI `detail`), `getAdventure(sessionId, { signal? }?): Promise<GetAdventureResponse>` (`GET /api/v1/adventures/{sessionId}`, 404 absent/not-owned), `deleteAdventure(sessionId, { signal? }?): Promise<void>` (`DELETE .../{sessionId}` → 204). New camelCase-wire types `TurnRecord` `{ turn, beatId, summary }`, `AdventureState` `{ sessionId, ownerUserId, storyId, videoId, dmPersonaId, partyPersonaIds, currentBeatId?, visitedBeatIds, flags, inventory, turnHistory, createdAt, updatedAt }`, `StartAdventureRequest` `{ storyId, videoId, dmPersonaId, initialBeatId? }`, `AdventureResponse` `{ traceId, sessionId, state }`, `GetAdventureResponse` `{ traceId, state }`. `PersonaConfig` / `CreatePersonaRequest` / `UpdatePersonaRequest` gain optional snake_case `is_dungeon_master` (read defaults `false`). `ChatWebSocket.send()` options + `buildHelloPayload()` gain optional `adventureSessionId` (spread only when set → land-dark). **0.22.0 additions:** `listAdventures(storyId?, { signal? }?): Promise<ListAdventuresResponse>` (`GET /api/v1/adventures`, owner-scoped newest-first, optional `storyId` filter) + `ListAdventuresResponse` `{ traceId, adventures }`. **0.23.0 additions (M10 Story Engine Phase 9a — multi-persona scene orchestrator):** `addPartyMember(sessionId, personaId, { signal? }?): Promise<GetAdventureResponse>` and `removePartyMember(sessionId, personaId, { signal? }?): Promise<GetAdventureResponse>` — both `PATCH /api/v1/adventures/{sessionId}/party` with `{ action, personaId }` (add: 422 for a DM / non-character / unowned persona; remove: idempotent 200 no-op; 404 for a missing adventure). New types/constants `PARTY_ACTION` (`{ ADD:'add', REMOVE:'remove' }`) + `PartyAction` + `PartyUpdateRequest` `{ action, personaId }`; `StartAdventureRequest` gains optional `partyPersonaIds?: string[]`. `ChatWebSocket.send()` options + `buildHelloPayload()` gain optional `partyPersonaIds?: string[]` (spread only when non-empty → land-dark; advisory — the server's `AdventureState.party_persona_ids` is authoritative). `ChatWsEvent` gains a `turn_changed` member `{ type, timestamp?, personaId, previousPersonaId? }` (mirrors `ChatEventType.TURN_CHANGED`) and an optional `personaId?` on the `token`/`done`/`citation`/`image`/`audio_chunk` members (orchestrator-stamped; undefined elsewhere → land-dark; per-turn TTS voice swap on audio deferred). **R1c additions (Platform Experience Restructure — image adapter registry, no version bump, release is R1e):** `listImageModels(): Promise<ImageModelsResponse>` (`GET /api/v1/images/models`, **authenticated** — unlike chat/models it is NOT in `DEFAULT_PUBLIC_PATHS`; served on the **chat** base URL via `chatRequest`) + `ImageModelInfo` `{ id, displayName, provider, capabilities: string[], isDefault, isFallback }` / `ImageModelsResponse` `{ models }`. **Additive only** (no public export removed/renamed). **0.32.0 additions (Platform Experience Restructure R5a+R5c — cast-with-persona projection):** `getCast(videoId): Promise<CastWithPersonaResponse>` (`GET /api/v1/tools/videos/{videoId}/cast`, tools base URL) — one call returns the character cast pre-joined to bound-persona display fields (the server resolves the PORTRAYS binding; replaces the CastGrid `getVideoGraph`+`listPersonas` client-side `entity_id` join since R5c). New types `CastArc`/`CastScene`/`CastCharacter`/`CastPersonaSummary`/`CastEntry`/`CastWithPersonaResponse` (`CastCharacter.scenes: CastScene[]` carries `{sceneId, title}` so a Cast drawer renders scene titles without the graph payload). New `castWithPersona(response): CastEntry[]` (`src/castProjection.ts`) — the framework-agnostic pure normalizer (deterministic ordering, list coalescing, title/name fallbacks, input never mutated) every Cast consumer shares. **0.32.0 additions (R5b — story-detail graph read):** `getVideoGraph(videoId, detail?)` gains an optional `detail` arg — `GRAPH_DETAIL.STORY` requests the server-collapsed story view (Acts/Scenes/cast/narrative edges; Shots collapsed to per-Scene `shotCount` properties; DialogLine/Event/MENTIONS omitted), `GRAPH_DETAIL.RAW` the full graph; omitting it sends NO query param (byte-identical pre-R5b request). New exports `GRAPH_DETAIL` + `GraphDetail` (mirror of `shared/graph_schema.py`). **0.33.0 additions (Platform Experience Restructure R6b — image filtering params):** `listImages(params)` gains optional `model?: string` + `status?: ImageStatus` filters, mirroring the new `GET /api/v1/images` query params. `model` ids come from R1's image-model registry (discoverable via `listImageModels()`); the backend rejects an unregistered id with 400 — **no client-core image-model descriptor is added** (R1's `imageAdapter.ts` stays the sole catalogue owner). `status` reuses the existing `ImageStatus` union (`ImageRecord['status']`) — no parallel status enum. Omitting both leaves the request byte-identical to 0.32.0 (additive only). See [CHANGELOG.md](./CHANGELOG.md). |
24
+ | `admin` | **0.19.0 (GitHub #215 Phase 2):** `AdminClient` — the prompt-defaults editor surface. Constructed with the **chat** base URL + session token (the admin router is mounted in `api/chat/app.py`). Methods: `listPromptDefaults()` → `PromptDefaultsListResponse`; `getPromptDefault(key)` / `updatePromptDefault(key, {value})` / `revertPromptDefault(key)` → `PromptDefaultDetail`. Types: `PromptDefaultSource` (`'db'|'code'`), `PromptDefaultSummary`, `PromptDefaultDetail`, `UpdatePromptDefaultRequest`. **0.24.0 (M12 Slice 5 — eval-observability reader):** added `listEvalRuns(params, {signal})` → `EvalRunsListResponse` (one cursor page) and `listAllEvalRuns(params, {signal})` → `AllEvalRunsResult` (`{runs, truncated}`; follows `nextCursor` until null, capped at `MAX_EVAL_RUN_PAGES = 50` — stops not throws, and sets `truncated: true` when the cap is hit with pages still pending so the page warns rather than presenting a partial series as complete). `params` carries the XOR selector `benchmarkId` **or** `promptVersion` (server returns 422 on neither/both) + optional `limit`/`cursor`. Types: `EvalRunSummary`, `EvalRunsListResponse`, `ListEvalRunsParams`, `AllEvalRunsResult` (mirror `api/admin/schemas.py` exactly). The `/observability` web page is the consumer (charts metric scores per `promptVersion`, one line per `modelId`, grouped client-side). **Additive only** — no `ApiClient` export changed. Shares the internal `http.ts` `requestJson` helper that `ApiClient.makeRequest` now also delegates to (DRY, private — not re-exported). The server enforces the editable-key carve-out (extraction keys are not editable → 404 → thrown `Error`). **R6d (read-only regen base prompts):** added `listRegenBasePrompts()` → `RegenBasePromptsResponse` (`GET /api/v1/admin/regen-prompts`; types `RegenBasePrompt`/`RegenBasePromptsResponse` mirror `api/admin/schemas.py`; `editable` always `false`, no write method exists). Also additive on `api.ts`: `RegenerateRequest.appliedDocumentIds?: string[] | null` (cap 20; server silently dedups + drops unknown ids) and `RegenerationRunResponse.appliedDocumentIds?: string[]` mirror the R6c backend fields. |
25
+ | `reactor/` | Pure builders for the `/interactive` page in seer-agent (and reusable by the Vue Web-App). `buildRegenPrompt(input)` produces deterministic Gemini Flash Image prompts with locked 16:9 + identity guarantees plus a creative-direction escape hatch. `buildUpsamplePrompt(input)` returns `{system, user}` message blocks for any LLM transport, encoding the Helios prompt-guide rules and weaving in entity/persona/previous-prompt context. `aggregateEntityContext` and `aggregatePersonaContext` adapt our existing `ImageRecord` / `EnrichmentRecord` / `PersonaConfig` types into the canonical context shapes. **Phase 2:** `mapEnrichmentToTimeline(enrichment, opts)` consumes a `EnrichmentRecord` and returns a `TimelineBeat[]` (chunk-pinned prompts) for the `/interactive/director` timeline UI. Defensively probes multiple Pegasus result shapes. **Phase 3:** `heliosTools.ts` — `HeliosCommand` (discriminated union), `parseHeliosCommands(text)` (extracts `[SET_SCENE: "…"]`-style inline markers from streamed chat output), `stripHeliosCommands(text)` (removes markers from the displayed transcript), and the future-use `BEDROCK_TOOL_SCHEMAS` Converse-tool-spec export. `toolPromptAddon.ts` — `HELIOS_STEERING_ADDON_ID`, `getHeliosSteeringAddonText()`, idempotent `buildHeliosSteeringSystemPrompt(base)` for personas with `prompt_addon_ids: ['helios-world-steering']`. `entitySearch.ts` — `findEntityImageBySeedName(apiClient, videoId, name)` resolves an entity name to its `ImageRecord` (searches `extracted` then `character`, case-insensitive). Per-`(videoId, category)` in-process cache so repeat SWAP_SEED commands skip the API round-trip; `forceRefresh: true` and `clearEntitySearchCache()` bypass it. `heliosCommandDispatcher.ts` — `dispatchHeliosCommand(cmd, ctx)` executes a `HeliosCommand` against a structural Reactor bridge (`sendCommand` + `uploadFile`); pure async function, no React. `HeliosToolContext.signal?: AbortSignal` cancels in-flight upsample + seed-image work on unmount. `seedImageOrchestrator.ts` — `loadSeedImageFile(imageId, apiClient)` + `sendSeedFileToReactor(file, reactor, opts)` + convenience `loadAndApplySeedImage`. Used by all three `/interactive` React pages AND by the SWAP_SEED branch of the dispatcher, so the load → upload → set_image sequence has exactly one implementation. No `@reactor-team/js-sdk` dependency — that stays in the consuming app. `applyScenePrompt.ts` — `applyScenePrompt({prompt, apiClient, reactor, currentChunk, isRunning, ...})`: shared submit policy for a live Helios session. `!isRunning` → `set_prompt` + `start`; running → `schedule_prompt` at `currentChunk + 2`. Upsample failure falls back to the raw prompt; abort propagates. Used by both `InteractiveController` and the watch-page `HeliosWorldControls` so the two pages cannot diverge. **LongLive-v2 director initiative (Step 2, additive, land-dark — no version bump, R1e releases):** `longLiveCommandDispatcher.ts` — `dispatchLongLiveCommand(cmd, ctx)`, the `dispatchHeliosCommand` analogue for the Reactor **LongLive-v2** world model over the **SAME Reactor transport** (only the `modelName` differs). `LongLiveCommand` is its OWN discriminated union (`set_shot`/`scene_cut`/`schedule_shot`/`schedule_scene_cut`/`pause`/`resume`/`reset`/`set_seed`) — NOT a `HeliosCommand`. Mappings to `reactor.sendCommand`: `set_shot{prompt}` → `set_shot` then `start` **only when `!ctx.hasStarted`** (the opening-shot-then-start guard, mirroring Helios `set_scene` chunk-0); `scene_cut{prompt}` → `scene_cut` (a HARD, memory-purging transition Helios lacks); `schedule_shot`/`schedule_scene_cut` use the snake_case `at_session_chunk` wire field; `pause`/`resume`/`reset` → `{}`; `set_seed{seed}` → `set_seed`. `LongLiveToolContext` is NARROWER than `HeliosToolContext`: `reactor: Pick<HeliosReactorBridge, 'sendCommand'>` (reuses the structural bridge — **no rename, no `uploadFile`**: LongLive is text-to-video with NO image conditioning, hence **NO `swap_seed`**), `hasStarted?`, `signal?`, `onUserWarning?`. Same failure policy: clean abort silent (reuses `isAbortError`), other failures logged + skipped. **SDK-free** (no `@reactor-team/js-sdk` import). **R8.1 (0.39.0):** `storyTimeline.ts` — `deriveStoryTimeline(scenes: SceneView[], options?)` maps the collapsed R5 `detail=story` projection (one `SceneView` per scene) to `TimelineBeat[]`: one beat per scene, prompt grounded in the scene summary + featured-character names + location label, scene-id provenance in the `label`. The **story-graph-driven sibling** of `mapEnrichmentToTimeline` (which stays the labelled FALLBACK for graph-less videos). `chunkDistribution.ts` (internal — NOT barrel-exported) holds the shared `computeChunkIndices`/`enforceSpacing` so BOTH mappers share ONE chunk-distribution algorithm (extracted from `scenesFromEnrichment.ts`; DRY — one place can break). `StoryTimelineOptions` mirrors `MapEnrichmentOptions`. Spec: [`specs/interactive-helios-prototype.md`](../../specs/interactive-helios-prototype.md). |
26
+ | `adapters/` | **R1a (Platform Experience Restructure):** the framework-agnostic model-adapter registry primitive every later R1 adapter (image / world / director domains) registers into. **Zero React / DOM / provider-SDK imports** — same discipline as `reactor/` and `vision/`. `capabilities.ts` — `Capability` is the single capability union, formed by **extending** the existing `ChatModelCapability` (`api.ts:499`, the source of truth that mirrors `shared/model_config.py:CAPABILITY_*`) with the net-new TS-only domains `ImageCapability` (`'image_gen'|'image_edit'|'identity_preserve'`), `WorldCapability` (`'world_stream'|'set_scene'|'swap_seed'|'pause_resume'`), `DirectorCapability` (`'timeline_schedule'|'enrichment_driven'`). There is **no parallel `CAPABILITY` const map** — extend the union, don't re-spell the four chat strings. `registry.ts` — `AdapterRegistry<TDescriptor extends ModelAdapterDescriptor>` ({ `domain`, `routes`, `fallbackRouteName` }): `register()` is additive and **throws on a duplicate id** (no silent overwrite); `get`/`list`/`listWithCapability(cap)`; `resolveRoute(name)` returns the named route's adapter and **degrades to the fallback route's adapter when the route's adapterId is unregistered — NEVER throws** (parity with `shared/model_router.py:344-360`); `satisfies(id, required)` is true iff the id is registered and advertises every required cap. Route names are the exported `ROUTE_DEFAULT`/`ROUTE_FALLBACK`/`ROUTE_HIGH_QUALITY` string constants (the `ROUTE_*` analogue of `shared/model_router.py:56-59`), never inline literals. `ModelAdapterDescriptor.metadata` is opaque/forward-compat — carried, not interpreted. **R1b** adds `chatAdapter.ts` — `loadChatAdapterRegistry(client)` hydrates an `AdapterRegistry<ChatAdapterDescriptor>` from `GET /api/v1/chat/models` and is a **FACADE over the backend**: model selection stays server-side in `shared/model_router.py`, so there is **no `route()` / client-side selection table** here — it only mirrors the catalogue (one descriptor per model, `capabilities` copied VERBATIM) so the UI can list / `listWithCapability` / auto-switch. `ROUTE_DEFAULT`/`ROUTE_FALLBACK` both mirror the resolved default id (parity with `api/chat/app.py:686-697`: `defaultModelId` when present in models, else the first model by `(provider, id)`; empty models → `''` sentinel so the constructor guard still passes and `resolveRoute` degrades to `undefined`, never throws). **R1c** adds `imageAdapter.ts` — `loadImageAdapterRegistry(client)` hydrates an `AdapterRegistry<ImageAdapterDescriptor>` from `GET /api/v1/images/models` (via `ApiClient.listImageModels()`, served on the **chat** base URL since the images API is mounted on the chat app). Same FACADE discipline as the chat adapter — image generation still resolves to Gemini in the pipeline unchanged (R1c is land-dark); this only mirrors the catalogue so a future UI (R6) can list / `listWithCapability('identity_preserve')`. `ROUTE_DEFAULT` mirrors the `isDefault`-flagged model id (else first by id), and `ROUTE_FALLBACK` the `isFallback`-flagged model (the registry's real fallback; mirrors default when none flagged) — empty models → `''` sentinel so the constructor guard still passes and `resolveRoute` degrades to `undefined`. `ImageModelInfo`/`ImageModelsResponse` wire types live in `api.ts` (`capabilities: string[]` — cast to `Capability[]` only inside the adapter to avoid an `api.ts`↔`capabilities.ts` cycle). **R1d** adds `worldAdapter.ts` + `directorAdapter.ts` — the net-new WORLD (step-into-video) and DIRECTOR registries, seeded with the one model that exists today: **Helios**. `worldAdapter.ts` — `WorldAdapterDescriptor` extends `ModelAdapterDescriptor` with `supportedCommands: readonly string[]` (**model-agnostic** — the registry holds heterogeneous world models; a sibling such as a Reactor LongLive adapter has its OWN command vocabulary `set_shot`/`scene_cut`/… that is not a `HeliosCommand`); `heliosWorldAdapter` (`id:'helios'`, provider `'reactor'`, caps `['world_stream','set_scene','swap_seed','pause_resume']`, `supportedCommands` = the EXACT `HeliosCommand` variant set from `reactor/heliosTools.ts:32-37`) **CENTRALIZES the `'helios'` model-name literal** so the R8 page rewire stops hard-coding it; `createWorldRegistry()` pre-registers it with `ROUTE_DEFAULT`+`ROUTE_FALLBACK` both → its id; `requiredCapabilityForCommand(cmd)` is the pure exhaustive-switch mapping (`set_scene`→`'set_scene'`, `swap_seed`→`'swap_seed'`, `pause_world`/`resume_world`→`'pause_resume'`, `reset_world`→`'world_stream'`). `dispatchWorldCommand(adapterId, cmd, ctx)` routes **in FRONT of the existing `dispatchHeliosCommand`** (NOT a rewrite): the Helios branch delegates with **IDENTICAL args** — the live Helios path is UNCHANGED (LAND-DARK) — and an unknown id throws the typed `UnsupportedWorldAdapterError` WITHOUT touching the bridge. It reuses the structural `HeliosReactorBridge` via `HeliosToolContext` — **no `@reactor-team/js-sdk` import**, the adapters/ submodule stays SDK-free. `directorAdapter.ts` — `DirectorAdapterDescriptor` extends `ModelAdapterDescriptor` with `worldAdapterId`; `heliosDirectorAdapter` (`id:'helios-director'`) backs onto `heliosWorldAdapter` and its `capabilities` are the director members `['timeline_schedule','enrichment_driven']` **plus the four world caps it inherits via `worldAdapterId`** (deduped); `createDirectorRegistry()` pre-registers it. **LongLive-v2 director initiative (Step 2 — additive, land-dark, no version bump):** `worldAdapter.ts` adds `longLiveWorldAdapter` (`id:'longlive-v2'`, displayName `'LongLive 2.0'`, provider `'reactor'`, caps `['world_stream','set_scene','scene_cut','pause_resume']`, `supportedCommands` = its 8 LongLive command strings). The **ASYMMETRIC capability matrix** holds via `registry.satisfies`: Helios HAS `swap_seed` and NOT `scene_cut`; LongLive HAS `scene_cut` (a hard memory-purging transition) and NOT `swap_seed` (text-to-video, no image conditioning). `createWorldRegistry()` now registers **both** adapters; **world `ROUTE_DEFAULT`+`ROUTE_FALLBACK` STAY Helios** (plain `/interactive` unchanged — LongLive is resolvable by id + `listWithCapability('scene_cut')` but is NOT the world default). `dispatchWorldCommand` is **widened via FUNCTION OVERLOADS** that keep exact `(adapterId, cmd, ctx)` typing per adapter — `'helios'` → `dispatchHeliosCommand` (BYTE-IDENTICAL to R1d), `'longlive-v2'` → `dispatchLongLiveCommand`, unknown → throw. **No per-command runtime capability gate** (the R1d review removed the unreachable `satisfies` scaffolding): the overloads enforce the cmd/adapter match at compile time, and the asymmetric-matrix INFO is consumed via `registry.satisfies()` by the Step-3 director UI (to hide the seed-image control for LongLive), not a dispatch gate (resolves tech-debt #414). `directorAdapter.ts` adds `longLiveDirectorAdapter` (`id:'longlive-director'`, backs onto `longLiveWorldAdapter`, inherits `scene_cut` + the director members, NOT `swap_seed`). **THE DIRECTOR-DEFAULT FLIP:** `createDirectorRegistry()` registers both directors and points `ROUTE_DEFAULT` → `'longlive-director'`, `ROUTE_FALLBACK` → `'helios-director'` (the world default stays Helios; only the DIRECTOR default flips). LAND-DARK — nothing reads the director route until **Step 3 wires the web director page**; the live `/interactive` and `/interactive/director` pages are UNCHANGED (their `modelName="helios"` literals stay; **R8 migrates the pages**). **Purely additive to client-core** — no existing public export removed/renamed (the sibling Vue Web-App pins this package); Steps 1–2 carried no version bump (the release is R1e). **R1e (0.25.0 — R1's release):** `index.ts` adds the aggregator `createPlatformRegistries(client): Promise<PlatformRegistries>` — the **single entry** every downstream wave imports to get all four registries pre-wired. `world` + `director` are synchronous seeds (Helios world default; LongLive-v2 director default); `chat` + `image` load from their backend catalogues via the existing facades in parallel. It makes NO selection decision — it only composes `loadChatAdapterRegistry`/`loadImageAdapterRegistry`/`createWorldRegistry`/`createDirectorRegistry` (DRY). `PlatformRegistries` = `{ chat, image, world, director }`. The `seer-agent` `web/` `/admin/adapters` showroom inspector is the first consumer; additive-only (no export removed/renamed). |
27
+ | `conversation/` | **R2.1 (0.26.0 — Conversation panel core):** the framework-agnostic, headless **conversation state** primitive that lets React (R2.2) and a game engine (PlayCanvas, R7) render the **same** controller. **Zero DOM** — same discipline as `reactor/`/`adapters/`. `participant.ts` — `ConversationParticipant` `{ participantId; personaId?; role; presence; modelId?; capabilities? }` + the frozen constant objects `ParticipantRole` (`persona`/`dm`/`user`) and `PresenceKind` (`PRESENCE_NONE`/`PRESENCE_FACE_2D`/`PRESENCE_AVATAR_3D`) — constants, never inline literals. `presenceRegistry.ts` — `PresenceRendererRegistry` (mirrors `reactor/promptAddonRegistry.ts`): `register(kind, factory)`/`resolve(kind)`/`has(kind)`; a factory returns an opaque `PresenceHandle` (`mount`/`update`/`destroy`) so React and a game engine register their own renderer; **THROWS on duplicate register** (fail-loud) and **returns the `PRESENCE_NONE` no-op for any unregistered kind** (fail-soft — this is what lets the reserved `PRESENCE_AVATAR_3D` stub render nothing until R7; tech-debt #421). `binding.ts` — `ConversationContextBinding` `{ kind: 'video'|'studio_session'|'none'; videoId?; entityId?; adventureSessionId?; partyPersonaIds? }` + the `ConversationContextKind` constant + a single `toHelloArgs(binding)` mapper that maps **1:1 onto `buildHelloPayload`** so there is exactly one hello-builder (DRY). `effectiveModel.ts` — `resolveEffectiveModel({ boundModelId, capabilities, needed, override, registry })` is the **single, pure** capability auto-switch (no I/O; R3's vision picker CONSUMES it — there is no parallel `resolveVisionCapability`): returns `{ modelId; reason: 'bound'|'override'|'auto_switch'; switchedFrom?; needed }`. Capability facts come ONLY from the injected R1 chat registry (`listWithCapability`/`satisfies`, typed as a narrow `Pick<>` so the helper depends on just those two methods) — R2 never hardcodes which models are vision-capable, and **fails SOFT to `bound`** when no model advertises the needed capability (a config state the panel surfaces, not a crash). `controller.ts` — `ConversationController`, a **thin state+reducer over the existing `ChatWebSocket`** (it does NOT reimplement transport/reconnect/protocol): holds participants/activeParticipant/`contextBinding`/`modelOverride?` + a reference to the R1 chat registry; `connect()`/`send(text)`/`setModelOverride`/`clearModelOverride`/`addParticipant`/`removeParticipant`/`setActiveParticipant`/`dispose()`; emits a typed `onState(snapshot)` callback (no framework events); the sole `buildHello()` builds the hello once via `buildHelloPayload(toHelloArgs(binding))`; re-derives advisory `partyPersonaIds` (matching `chat-ws/adventureMode.ts`) on participant changes. **Socket adoption:** the constructor takes an optional `existingSocket?: ChatWebSocket` — when supplied it ADOPTS that socket (opens none) and `dispose()` does **NOT** close it (the owner does) — the Watch shared-socket invariant (R2.4) so the dispatcher reads one `FrameBuffer`. **ADDITIVE-ONLY:** `Citation`/`PlaybackState`/`ChatModelCapability` are IMPORTED from `websocket.ts`/`api.ts`, never re-declared (avoids the ambiguous-export trap). **R2.3 (0.30.0):** the controller's hello is **`mode:'text'`, always** (it previously inherited `buildHelloPayload`'s `tts_stt` default, which would have routed the first self-driving `connect()` into the backend voice pipeline — the controller owns TEXT conversations; the voice hello stays page-owned per the R2.2 finding), `onMessage(handler): () => void` is the additive reply-event seam (a passthrough to `ChatWebSocket.onMessage`/`offMessage`) so a renderer can consume `token`/`citation`/`done`/`error`/`turn_changed` frames without reaching into a privately-owned socket, and `send(text, opts?)` gains additive `opts.messages` (`ConversationSendOptions`/`ConversationHistoryMessage`) — the transcript-owning renderer passes prior turns per send because the backend builds `conversation_history` solely from each send's `messages` field (omitted/empty ⇒ wire unchanged). **R7.1 (0.35.0 — portable conversation runtime):** the multi-persona runtime joins the subsystem. `router.ts` — advisory routing helpers lifted verbatim from `web/app/chat-ws/adventureMode.ts` (`MultiPersonaFrameFields`, `turnChangedSpeakerId`, `resolvePersonaPill`+`PillPersona`, `advisoryPartyPersonaIds`); **ADVISORY ONLY** — the server `agents/orchestrator/persona_router.py` `resolve_addressed_persona` is authoritative, the client never routes a turn, it only renders the server's `turn_changed`. `roster.ts` — `ADVENTURE_MUTATION_TOOLS` (the SINGLE copy of the four DM mutation tool names, mirroring `shared/tool_schemas.py`), `isAdventureMutationTool`, `shouldRefreshAdventureRail` (the one land-dark gate on adventure-state refresh), `filterPartyCandidates`+`PartyCandidatePersona`. `runtime.ts` — `ConversationRuntime` (`src/conversation/runtime.ts:33`): a pure reducer/observer over the existing `ChatWsEvent` union — `applyFrame(event)` / `getState(): ConversationRuntimeState` / `subscribe(listener)` (fault-isolated, returns unsubscribe) / `acknowledgeAdventureState()` / `releaseTurn(personaId)` (R7.2, additive: the host removed the persona holding the turn — `activePersonaId` returns to null; the only host-driven speaker transition, `turn_changed` remains the only way the speaker MOVES to a persona). The speaker ONLY moves on a server `turn_changed` while an adventure is active; `done` finalizes the per-message persona pill; a DM-mutation `tool_result` sets `staleAdventureState` for the host to re-fetch+ack. Immutable state-per-transition, listeners fire only on actual change. `types.ts` — `RosterParticipant`/`ConversationRuntimeState`/`ConversationRuntimeOptions` (REUSES the R2.1 `PresenceKind` constants — never re-declared, per the ambiguous-export trap). **PlayCanvas portability:** the runtime has zero React/DOM imports and runs in plain node — a 3D host feeds it the same frames and renders `ConversationRuntimeState` directly; the renderer seam (`PresenceAdapter`) lands in R7.3. Caveat for any engine host: client routing stays advisory — never promote the router helpers to a turn decision. **R7.3 (0.36.0 — `PresenceAdapter` seam, the portability contract):** `presence.ts` — `PresenceAdapter`, the renderer-agnostic interface the runtime drives: `mount(participant)`/`unmount(personaId)`/`setActiveParticipant(personaId|null)`/`setSpeaking(personaId, speaking)`/`applyViseme(personaId, viseme: VisemeSymbol)` — every method keyed by `personaId` (N participants → N presence slots, renderer-independent); `applyViseme` takes the *scheduled viseme value* from the existing `visemeScheduler` pipeline, NEVER a DOM node (the React adapter applies it to SVG, a PlayCanvas adapter to morph targets); `presenceKindHasStage(kind)` is the single text-only gate (a `PRESENCE_NONE` seat receives nothing beyond `mount`/`unmount`). Adapter *selection* stays on the R2.1 `PresenceRendererRegistry` — no parallel kind→factory map. `presenceBus.ts` — `bindPresence(runtime, adapter): PresenceBinding`, pure glue (no renderer dependency): bind mounts the roster + stages the initial speaker; a speaker swap emits `setActiveParticipant(next)` + `setSpeaking(prev,false)` + `setSpeaking(next,true)`; an unstaged/unknown speaker clears the stage to `null`; `PresenceBinding.applyViseme` is the SINGLE viseme delivery path (R7.5's voice module consumes it — never instantiate a second path); `dispose()` is idempotent. **Headless conformance harness:** `src/__tests__/conversation/headlessRenderer.ts` (`RecordingPresenceAdapter`) + `presenceBus.test.ts` pin the exact call sequence a real renderer receives for a 3-participant cue chain, in plain node — the executable proof of PlayCanvas-portability; an engine implements `PresenceAdapter` against that sequence with zero client-core changes. **R7.4 (0.37.0 — Studio cast roster projection):** `rosterProjection.ts` — `castToRoster({ cast, dmPersona, partyPersonaIds })` (`src/conversation/rosterProjection.ts:55`): the single DRY projection turning R5's one-call cast-with-persona response (`getCast` → `CastEntry[]`) + the active `AdventureState` into `RosterParticipant[]` (DM seat first, then party members in party order; de-duplicated, DM never doubled; every server-party member gets a seat even when absent from the cast so a `turn_changed` speaker can always be staged). This is the one place the renderer-facing roster is built — it replaces the pre-R7.4 client-side `entity_id ∈ storyCharacterEntityIds` join across two stores. Pure (no I/O/DOM/React). **R7.5 (0.38.0 — overlay voice parity):** `voice.ts` — `VoiceSession` (`src/conversation/voice.ts`): the framework-agnostic voice pipeline driving a full STT/TTS/mic/viseme round-trip over the SAME `ChatWebSocket` the controller owns/adopts. A THIN composition (not a re-implementation): it composes the existing `AudioPipeline` (player + `VisemeScheduler` + `AudioSessionClient` barge-in + sentence anchoring) + `MicrophoneRecorder`, and builds the voice (`tts_stt`) hello through the SINGLE `buildHelloPayload` — **no second viseme scheduler, no second hello-construction site**. `buildHello()` is fixture-diffed against the page's `startVoiceChat()` payload (the parity oracle, `voice.test.ts`); `start()` mirrors the page's iOS user-gesture priming order EXACTLY (player + `recorder.prime()` in the synchronous prefix — callers MUST invoke it from a click handler's sync prefix); `interrupt()` = barge-in; `dispose()` NEVER closes the socket (the Watch shared-socket invariant). Visemes flow through one `onViseme` callback the renderer routes onto R7.3's `PresenceAdapter.applyViseme` (the single delivery path). `ConversationController` gains additive `voiceSocket()` (hands the shared socket to a `VoiceSession`) + `voiceHelloArgs()` (the single hello-args input: context + active persona/model). The text-only overlay default is unchanged (`mode:'text'`; voice is per-conversation opt-in); `/chat-ws` stays the page-owned parity oracle (its collapse onto `VoiceSession` is tech-debt #470). |
20
28
 
21
29
  ## Layout
22
30
 
@@ -26,20 +34,49 @@ src/
26
34
  audio.ts
27
35
  visemeScheduler.ts
28
36
  visemeGeometry.ts
37
+ timeFormat.ts ← 0.10.0: formatTimestamp + formatCitationTimestamp
38
+ graphSchema.ts ← 0.12.0: graph whitelists + 2 provenance unions; 0.13.0: session-cached fetchGraphSchema(); 0.15.0: Scene/PlotBeat/CharacterArc + userCreatableLabels/userCreatableEdges/allowedPairs (M7 P3a); 0.39.0: STUDIO_NODE_LABELS/STUDIO_EDGE_TYPES/STUDIO_NODE_PROPERTIES/STUDIO_CHARACTER_TYPE read-surface vocab (R8.1)
39
+ storyGraph.ts ← 0.39.0: deriveScenes/deriveCast + SceneView/CharacterView/ArcView (lifted from web studio; the single story projection Studio + Director share) (R8.1)
40
+ toolSchemas.ts ← 0.11.0: AGENT_TOOL_SCHEMAS (mirror of shared/tool_schemas.py)
29
41
  websocket.ts
30
42
  api.ts
43
+ vision/ ← Phase 2 vision publisher
44
+ VisionPublisher.ts ← RTCPeerConnection lifecycle + SDP/ICE
45
+ visionScheduler.ts ← fps back-pressure (pure helper)
46
+ types.ts ← VisionPublisherConfig, VisionStatus, …
47
+ credentials.ts ← 0.10.0: toVisionRtcCredentials()
48
+ startVisionPublisher.ts ← 0.10.0: startVisionPublisher() + types
49
+ sourceKinds.ts ← 0.31.0 (R3a): VISION_SOURCE_KINDS + descriptors
50
+ VisionSourceController.ts ← 0.31.0 (R3a): source acquisition + lifecycle
51
+ index.ts ← submodule re-exports
52
+ __tests__/
53
+ VisionPublisher.test.ts
54
+ visionScheduler.test.ts
31
55
  reactor/
32
56
  types.ts
33
57
  regenTemplate.ts
34
58
  upsamplePrompt.ts
35
59
  entityContext.ts
36
- scenesFromEnrichment.ts ← Phase 2 timeline mapper
60
+ scenesFromEnrichment.ts ← Phase 2 timeline mapper (raw Pegasus enrichment → beats; the labelled fallback)
61
+ chunkDistribution.ts ← R8.1: shared computeChunkIndices/enforceSpacing (BOTH mappers; internal, not barrel-exported)
62
+ storyTimeline.ts ← R8.1: deriveStoryTimeline (collapsed R5 story projection → beats; sibling of scenesFromEnrichment)
37
63
  heliosTools.ts ← Phase 3 marker grammar
38
64
  toolPromptAddon.ts ← Phase 3 system-prompt addon
39
65
  toolPromptAddonId.ts ← Phase 3 addon ID constant
40
66
  entitySearch.ts ← Phase 3 SWAP_SEED lookup (cached)
41
67
  heliosCommandDispatcher.ts ← Phase 3 HeliosCommand executor (abort-aware)
68
+ longLiveCommandDispatcher.ts ← LongLive-v2: dispatchLongLiveCommand (set_shot/scene_cut/schedule_*/set_seed; SAME Reactor bridge, text-only, abort-aware)
42
69
  seedImageOrchestrator.ts ← Phase 3+ load → upload → set_image
70
+ sceneEntry.ts ← Step-Into-Scene orchestrator (extract + upsample + bootstrap)
71
+ applyScenePrompt.ts ← Shared upsample + chunk-0-vs-running submit policy
72
+ index.ts ← submodule re-exports
73
+ adapters/ ← R1a: framework-agnostic model-adapter registry (no React/DOM/SDK)
74
+ capabilities.ts ← Capability union = ChatModelCapability (api.ts) + image/world/director caps
75
+ registry.ts ← AdapterRegistry + ModelAdapterDescriptor/NamedRoute + ROUTE_* constants
76
+ chatAdapter.ts ← R1b: loadChatAdapterRegistry — FACADE over /chat/models (selection stays server-side)
77
+ imageAdapter.ts ← R1c: loadImageAdapterRegistry — FACADE over /images/models (catalogue; R1 owns registry, R6 consumes)
78
+ worldAdapter.ts ← R1d + LongLive: helios/longLiveWorldAdapter + createWorldRegistry (both; world default stays helios) + dispatchWorldCommand (per-adapter overloads → dispatchHelios/LongLiveCommand; SDK-free)
79
+ directorAdapter.ts ← R1d + LongLive: helios/longLiveDirectorAdapter + createDirectorRegistry (both; DIRECTOR default FLIPPED to longlive-director, fallback helios-director)
43
80
  index.ts ← submodule re-exports
44
81
  index.ts ← top-level re-exports
45
82
  __tests__/
@@ -48,6 +85,13 @@ src/
48
85
  loadBundleManifest.test.ts
49
86
  visemeGeometry.test.ts
50
87
  visemeScheduler.test.ts
88
+ adapters-capabilities.test.ts ← R1a: Capability ↔ imported ChatModelCapability assignability
89
+ adapters-registry.test.ts ← R1a: register/get/list/listWithCapability/resolveRoute/satisfies
90
+ adapters-chat.test.ts ← R1b: loadChatAdapterRegistry facade (verbatim caps, default tiebreak, empty-safe)
91
+ adapters-image.test.ts ← R1c: loadImageAdapterRegistry facade (verbatim caps, isDefault route seed, identity_preserve filter, empty-safe)
92
+ adapters-world.test.ts ← R1d + LongLive: createWorldRegistry seeds, supportedCommands↔HeliosCommand parity, asymmetric matrix via satisfies, dispatchWorldCommand helios delegation + longlive routing + unsupported-adapter throw
93
+ adapters-director.test.ts ← R1d + LongLive: createDirectorRegistry seeds, inherited world caps via worldAdapterId, DIRECTOR default flip (longlive-director) + fallback helios-director
94
+ longLiveCommandDispatcher.test.ts ← LongLive: each LongLiveCommand → correct sendCommand call(s) (set_shot+start guard, snake_case at_session_chunk, abort no-op)
51
95
  reactor/
52
96
  api-reactor.test.ts
53
97
  entityContext.test.ts
@@ -0,0 +1,10 @@
1
+ import type { ChatModelCapability } from '../api';
2
+ /** Net-new capabilities introduced by R1's image/world/director domains.
3
+ * No backend chat-enum equivalent yet; TS-only. */
4
+ export type ImageCapability = 'image_gen' | 'image_edit' | 'identity_preserve';
5
+ export type WorldCapability = 'world_stream' | 'set_scene' | 'swap_seed' | 'pause_resume' | 'scene_cut';
6
+ export type DirectorCapability = 'timeline_schedule' | 'enrichment_driven';
7
+ /** Registry capability vocabulary = the EXISTING chat union EXTENDED with the
8
+ * net-new domains. One union; no parallel CAPABILITY map. */
9
+ export type Capability = ChatModelCapability | ImageCapability | WorldCapability | DirectorCapability;
10
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../src/adapters/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAKlD;oDACoD;AACpD,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,YAAY,GAAG,mBAAmB,CAAC;AAW/E,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,WAAW,GAAG,WAAW,GAAG,cAAc,GAAG,WAAW,CAAC;AACxG,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,GAAG,mBAAmB,CAAC;AAE3E;8DAC8D;AAC9D,MAAM,MAAM,UAAU,GAAG,mBAAmB,GAAG,eAAe,GAAG,eAAe,GAAG,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=capabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../src/adapters/capabilities.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ import { AdapterRegistry, type ModelAdapterDescriptor } from './registry';
2
+ import type { ApiClient, ChatModelInfo } from '../api';
3
+ /**
4
+ * Chat-domain adapter descriptor — a {@link ModelAdapterDescriptor} carrying
5
+ * the two chat-only sizing fields the picker UI wants to surface. Everything
6
+ * else (id / displayName / provider / capabilities) is inherited unchanged.
7
+ */
8
+ export interface ChatAdapterDescriptor extends ModelAdapterDescriptor {
9
+ contextWindow: number;
10
+ maxOutputTokens: number;
11
+ }
12
+ /**
13
+ * Map one {@link ChatModelInfo} from `GET /api/v1/chat/models` to a
14
+ * {@link ChatAdapterDescriptor}. PURE — no I/O, no mutation of `info`.
15
+ *
16
+ * `capabilities` is copied VERBATIM (a fresh array, same members/order) — the
17
+ * backend (`shared/model_config.py:CAPABILITY_*`) is the single source of
18
+ * truth for what a model can do. This layer never re-derives them.
19
+ */
20
+ export declare function chatModelInfoToDescriptor(info: ChatModelInfo): ChatAdapterDescriptor;
21
+ /**
22
+ * Build a chat {@link AdapterRegistry} from the live backend model list.
23
+ *
24
+ * This is a FACADE over the backend — it makes NO model-selection decision of
25
+ * its own. The route decision stays server-side in `shared/model_router.py`;
26
+ * this loader only mirrors the catalogue so the UI can list / filter /
27
+ * auto-switch. There is deliberately no `route()` method and no client-side
28
+ * selection table.
29
+ *
30
+ * Default resolution mirrors `api/chat/app.py:686-697`: use
31
+ * `resp.defaultModelId` when it is set AND present in `models`; otherwise the
32
+ * first model by the backend's `(provider, id)` sort. With no models there is
33
+ * no default — a `''` sentinel (never registered) seeds both routes so the
34
+ * R1a constructor guard (`ROUTE_FALLBACK` must be present in `routes`) still
35
+ * passes and `resolveRoute` degrades to `undefined` rather than throwing.
36
+ */
37
+ export declare function loadChatAdapterRegistry(client: Pick<ApiClient, 'listChatModels'>): Promise<AdapterRegistry<ChatAdapterDescriptor>>;
38
+ //# sourceMappingURL=chatAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/chatAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAIf,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,sBAAsB;IACnE,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,aAAa,GAAG,qBAAqB,CAapF;AAkBD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,gBAAgB,CAAC,GACxC,OAAO,CAAC,eAAe,CAAC,qBAAqB,CAAC,CAAC,CAqCjD"}
@@ -0,0 +1,88 @@
1
+ import { AdapterRegistry, ROUTE_DEFAULT, ROUTE_FALLBACK, } from './registry.js';
2
+ /**
3
+ * Map one {@link ChatModelInfo} from `GET /api/v1/chat/models` to a
4
+ * {@link ChatAdapterDescriptor}. PURE — no I/O, no mutation of `info`.
5
+ *
6
+ * `capabilities` is copied VERBATIM (a fresh array, same members/order) — the
7
+ * backend (`shared/model_config.py:CAPABILITY_*`) is the single source of
8
+ * truth for what a model can do. This layer never re-derives them.
9
+ */
10
+ export function chatModelInfoToDescriptor(info) {
11
+ return {
12
+ id: info.id,
13
+ displayName: info.displayName,
14
+ provider: info.provider,
15
+ // VERBATIM copy — defensive clone so the descriptor can't alias the
16
+ // response array, but NO re-derivation of which caps are present.
17
+ capabilities: [...info.capabilities],
18
+ contextWindow: info.contextWindow,
19
+ maxOutputTokens: info.maxOutputTokens,
20
+ // Opaque, forward-compat — the registry carries `metadata` untouched.
21
+ metadata: { name: info.name },
22
+ };
23
+ }
24
+ /**
25
+ * Comparator matching the backend's deterministic ordering at
26
+ * `api/chat/app.py:666` — `sorted(..., key=lambda c: (c.provider, c.id))`.
27
+ * Used only for the null/absent-`defaultModelId` tiebreak so the client's
28
+ * "first model" agrees with the server's `models[0]`.
29
+ */
30
+ function byProviderThenId(a, b) {
31
+ if (a.provider !== b.provider) {
32
+ return a.provider < b.provider ? -1 : 1;
33
+ }
34
+ if (a.id !== b.id) {
35
+ return a.id < b.id ? -1 : 1;
36
+ }
37
+ return 0;
38
+ }
39
+ /**
40
+ * Build a chat {@link AdapterRegistry} from the live backend model list.
41
+ *
42
+ * This is a FACADE over the backend — it makes NO model-selection decision of
43
+ * its own. The route decision stays server-side in `shared/model_router.py`;
44
+ * this loader only mirrors the catalogue so the UI can list / filter /
45
+ * auto-switch. There is deliberately no `route()` method and no client-side
46
+ * selection table.
47
+ *
48
+ * Default resolution mirrors `api/chat/app.py:686-697`: use
49
+ * `resp.defaultModelId` when it is set AND present in `models`; otherwise the
50
+ * first model by the backend's `(provider, id)` sort. With no models there is
51
+ * no default — a `''` sentinel (never registered) seeds both routes so the
52
+ * R1a constructor guard (`ROUTE_FALLBACK` must be present in `routes`) still
53
+ * passes and `resolveRoute` degrades to `undefined` rather than throwing.
54
+ */
55
+ export async function loadChatAdapterRegistry(client) {
56
+ const resp = await client.listChatModels();
57
+ const models = resp.models;
58
+ const modelIds = new Set(models.map((m) => m.id));
59
+ const configuredDefault = resp.defaultModelId ?? '';
60
+ // Parity with the backend: a configured default that isn't in the active
61
+ // registry is discarded, then we fall back to the first-sorted model.
62
+ let defaultId = configuredDefault && modelIds.has(configuredDefault) ? configuredDefault : '';
63
+ if (!defaultId && models.length > 0) {
64
+ // Re-apply the backend's (provider, id) sort so the tiebreak agrees with
65
+ // the server's models[0] even if the payload arrives out of order.
66
+ defaultId = [...models].sort(byProviderThenId)[0].id;
67
+ }
68
+ // ROUTE_FALLBACK must always be present by name or the R1a constructor
69
+ // throws; both routes mirror the same id (selection is server-side).
70
+ const routes = [
71
+ { name: ROUTE_DEFAULT, adapterId: defaultId, reason: 'backend defaultModelId' },
72
+ {
73
+ name: ROUTE_FALLBACK,
74
+ adapterId: defaultId,
75
+ reason: 'selection is server-side; fallback mirrors default',
76
+ },
77
+ ];
78
+ const registry = new AdapterRegistry({
79
+ domain: 'chat',
80
+ routes,
81
+ fallbackRouteName: ROUTE_FALLBACK,
82
+ });
83
+ for (const info of models) {
84
+ registry.register(chatModelInfoToDescriptor(info));
85
+ }
86
+ return registry;
87
+ }
88
+ //# sourceMappingURL=chatAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chatAdapter.js","sourceRoot":"","sources":["../../src/adapters/chatAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,aAAa,EACb,cAAc,GAGf,MAAM,YAAY,CAAC;AAapB;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAmB;IAC3D,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,CAAC;QACpC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,sEAAsE;QACtE,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;KAC9B,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,CAAgB,EAAE,CAAgB;IAC1D,IAAI,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC9B,OAAO,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC;IACD,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;QAClB,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,MAAyC;IAEzC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC;IAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAE3B,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClD,MAAM,iBAAiB,GAAG,IAAI,CAAC,cAAc,IAAI,EAAE,CAAC;IACpD,yEAAyE;IACzE,sEAAsE;IACtE,IAAI,SAAS,GAAG,iBAAiB,IAAI,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9F,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,yEAAyE;QACzE,mEAAmE;QACnE,SAAS,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACvD,CAAC;IAED,uEAAuE;IACvE,qEAAqE;IACrE,MAAM,MAAM,GAAiB;QAC3B,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,wBAAwB,EAAE;QAC/E;YACE,IAAI,EAAE,cAAc;YACpB,SAAS,EAAE,SAAS;YACpB,MAAM,EAAE,oDAAoD;SAC7D;KACF,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAwB;QAC1D,MAAM,EAAE,MAAM;QACd,MAAM;QACN,iBAAiB,EAAE,cAAc;KAClC,CAAC,CAAC;IAEH,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAC1B,QAAQ,CAAC,QAAQ,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { AdapterRegistry, type ModelAdapterDescriptor } from './registry';
2
+ /**
3
+ * Director-domain adapter registry — R1d, Helios seed.
4
+ *
5
+ * A director adapter schedules timeline/enrichment-driven steering over a
6
+ * WORLD adapter's transport. It "backs onto" a world adapter via
7
+ * {@link DirectorAdapterDescriptor.worldAdapterId} and inherits that world
8
+ * adapter's capabilities on top of the director-only members
9
+ * (`'timeline_schedule'` / `'enrichment_driven'`). The Helios director backs
10
+ * onto the Helios world seed; the LongLive director backs onto the LongLive
11
+ * world adapter.
12
+ *
13
+ * LAND-DARK: this only seeds the registry + flips the DIRECTOR `ROUTE_DEFAULT`
14
+ * to LongLive — the live `/interactive/director` page is UNCHANGED (its
15
+ * `modelName="helios"` literal stays; Step 3 wires the web director to read
16
+ * the flipped default).
17
+ */
18
+ /**
19
+ * A director adapter descriptor — a {@link ModelAdapterDescriptor} that
20
+ * names the world adapter it backs onto. Its `capabilities` are the
21
+ * director members PLUS the world caps it inherits from the backing world
22
+ * adapter.
23
+ */
24
+ export interface DirectorAdapterDescriptor extends ModelAdapterDescriptor {
25
+ /**
26
+ * The id of the world adapter this director backs its transport onto.
27
+ * **Advisory** — not validated at construction against the world registry;
28
+ * a mistyped id won't fail until something tries to resolve it. (Both seeds
29
+ * — `helios-director`→`helios`, `longlive-director`→`longlive-v2` — point at
30
+ * registered world adapters; a cross-registry existence check is a low-pri
31
+ * candidate invariant tracked in tech-debt #416.)
32
+ */
33
+ worldAdapterId: string;
34
+ }
35
+ /**
36
+ * The one director that exists today — backs onto the Helios world seed.
37
+ * `capabilities` = the two director members plus every world cap
38
+ * `heliosWorldAdapter` advertises (deduped). The stable id is
39
+ * `'helios-director'` so the R8 rewire reads it from here.
40
+ */
41
+ export declare const heliosDirectorAdapter: DirectorAdapterDescriptor;
42
+ /**
43
+ * The LongLive-v2 director — backs onto the LongLive world adapter. Its
44
+ * `capabilities` are the two director members PLUS every world cap
45
+ * `longLiveWorldAdapter` advertises (deduped), so it INHERITS `scene_cut`
46
+ * and does NOT carry `swap_seed` — the same asymmetric matrix as the world
47
+ * adapter, surfaced at the director level for the Step-3 UI's
48
+ * `registry.satisfies` queries. The stable id is `'longlive-director'`.
49
+ */
50
+ export declare const longLiveDirectorAdapter: DirectorAdapterDescriptor;
51
+ /**
52
+ * Build a director {@link AdapterRegistry} pre-registered with BOTH director
53
+ * adapters. THE DIRECTOR-DEFAULT FLIP: `ROUTE_DEFAULT` → `longlive-director`
54
+ * (LongLive becomes the director default), `ROUTE_FALLBACK` →
55
+ * `helios-director` (Helios is the director fallback). LAND-DARK — nothing
56
+ * reads this route until Step 3 wires the web director page. The WORLD
57
+ * registry default stays Helios (plain `/interactive` is unchanged); only the
58
+ * DIRECTOR default flips here. The R1a constructor guard REQUIRES the
59
+ * `fallbackRouteName` present by name in `routes`.
60
+ */
61
+ export declare function createDirectorRegistry(): AdapterRegistry<DirectorAdapterDescriptor>;
62
+ //# sourceMappingURL=directorAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directorAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/directorAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAIf,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AAIpB;;;;;;;;;;;;;;;GAeG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,yBAA0B,SAAQ,sBAAsB;IACvE;;;;;;;OAOG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAcD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,yBASnC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,EAAE,yBASrC,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,IAAI,eAAe,CAAC,yBAAyB,CAAC,CAsBnF"}
@@ -0,0 +1,71 @@
1
+ import { AdapterRegistry, ROUTE_DEFAULT, ROUTE_FALLBACK, } from './registry.js';
2
+ import { heliosWorldAdapter, longLiveWorldAdapter } from './worldAdapter.js';
3
+ /**
4
+ * Build the director capability set: the director members FIRST, then the
5
+ * world caps inherited from the backing world adapter, de-duplicated so a
6
+ * cap shared by both domains appears once.
7
+ */
8
+ function directorCapabilities(directorCaps, inheritedWorldCaps) {
9
+ return [...new Set([...directorCaps, ...inheritedWorldCaps])];
10
+ }
11
+ /**
12
+ * The one director that exists today — backs onto the Helios world seed.
13
+ * `capabilities` = the two director members plus every world cap
14
+ * `heliosWorldAdapter` advertises (deduped). The stable id is
15
+ * `'helios-director'` so the R8 rewire reads it from here.
16
+ */
17
+ export const heliosDirectorAdapter = {
18
+ id: 'helios-director',
19
+ displayName: 'Helios Director',
20
+ provider: 'reactor',
21
+ worldAdapterId: heliosWorldAdapter.id,
22
+ capabilities: directorCapabilities(['timeline_schedule', 'enrichment_driven'], heliosWorldAdapter.capabilities),
23
+ };
24
+ /**
25
+ * The LongLive-v2 director — backs onto the LongLive world adapter. Its
26
+ * `capabilities` are the two director members PLUS every world cap
27
+ * `longLiveWorldAdapter` advertises (deduped), so it INHERITS `scene_cut`
28
+ * and does NOT carry `swap_seed` — the same asymmetric matrix as the world
29
+ * adapter, surfaced at the director level for the Step-3 UI's
30
+ * `registry.satisfies` queries. The stable id is `'longlive-director'`.
31
+ */
32
+ export const longLiveDirectorAdapter = {
33
+ id: 'longlive-director',
34
+ displayName: 'LongLive Director',
35
+ provider: 'reactor',
36
+ worldAdapterId: longLiveWorldAdapter.id,
37
+ capabilities: directorCapabilities(['timeline_schedule', 'enrichment_driven'], longLiveWorldAdapter.capabilities),
38
+ };
39
+ /**
40
+ * Build a director {@link AdapterRegistry} pre-registered with BOTH director
41
+ * adapters. THE DIRECTOR-DEFAULT FLIP: `ROUTE_DEFAULT` → `longlive-director`
42
+ * (LongLive becomes the director default), `ROUTE_FALLBACK` →
43
+ * `helios-director` (Helios is the director fallback). LAND-DARK — nothing
44
+ * reads this route until Step 3 wires the web director page. The WORLD
45
+ * registry default stays Helios (plain `/interactive` is unchanged); only the
46
+ * DIRECTOR default flips here. The R1a constructor guard REQUIRES the
47
+ * `fallbackRouteName` present by name in `routes`.
48
+ */
49
+ export function createDirectorRegistry() {
50
+ const routes = [
51
+ {
52
+ name: ROUTE_DEFAULT,
53
+ adapterId: longLiveDirectorAdapter.id,
54
+ reason: 'LongLive-v2 is the director default (the Step-2 flip)',
55
+ },
56
+ {
57
+ name: ROUTE_FALLBACK,
58
+ adapterId: heliosDirectorAdapter.id,
59
+ reason: 'Helios director is the fallback',
60
+ },
61
+ ];
62
+ const registry = new AdapterRegistry({
63
+ domain: 'director',
64
+ routes,
65
+ fallbackRouteName: ROUTE_FALLBACK,
66
+ });
67
+ registry.register(heliosDirectorAdapter);
68
+ registry.register(longLiveDirectorAdapter);
69
+ return registry;
70
+ }
71
+ //# sourceMappingURL=directorAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directorAdapter.js","sourceRoot":"","sources":["../../src/adapters/directorAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,aAAa,EACb,cAAc,GAGf,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAqC1E;;;;GAIG;AACH,SAAS,oBAAoB,CAC3B,YAA2C,EAC3C,kBAAyC;IAEzC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAa,CAAC,GAAG,YAAY,EAAE,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA8B;IAC9D,EAAE,EAAE,iBAAiB;IACrB,WAAW,EAAE,iBAAiB;IAC9B,QAAQ,EAAE,SAAS;IACnB,cAAc,EAAE,kBAAkB,CAAC,EAAE;IACrC,YAAY,EAAE,oBAAoB,CAChC,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,EAC1C,kBAAkB,CAAC,YAAY,CAChC;CACF,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA8B;IAChE,EAAE,EAAE,mBAAmB;IACvB,WAAW,EAAE,mBAAmB;IAChC,QAAQ,EAAE,SAAS;IACnB,cAAc,EAAE,oBAAoB,CAAC,EAAE;IACvC,YAAY,EAAE,oBAAoB,CAChC,CAAC,mBAAmB,EAAE,mBAAmB,CAAC,EAC1C,oBAAoB,CAAC,YAAY,CAClC;CACF,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,UAAU,sBAAsB;IACpC,MAAM,MAAM,GAAiB;QAC3B;YACE,IAAI,EAAE,aAAa;YACnB,SAAS,EAAE,uBAAuB,CAAC,EAAE;YACrC,MAAM,EAAE,uDAAuD;SAChE;QACD;YACE,IAAI,EAAE,cAAc;YACpB,SAAS,EAAE,qBAAqB,CAAC,EAAE;YACnC,MAAM,EAAE,iCAAiC;SAC1C;KACF,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAI,eAAe,CAA4B;QAC9D,MAAM,EAAE,UAAU;QAClB,MAAM;QACN,iBAAiB,EAAE,cAAc;KAClC,CAAC,CAAC;IACH,QAAQ,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;IACzC,QAAQ,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAAC;IAC3C,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { AdapterRegistry, type ModelAdapterDescriptor } from './registry';
2
+ import type { ApiClient, ImageModelInfo } from '../api';
3
+ /**
4
+ * Image-domain adapter descriptor — a {@link ModelAdapterDescriptor} carrying
5
+ * the image-only flags the catalogue UI wants to surface (default / fallback).
6
+ * Everything else (id / displayName / provider / capabilities) is inherited
7
+ * unchanged.
8
+ */
9
+ export interface ImageAdapterDescriptor extends ModelAdapterDescriptor {
10
+ isDefault: boolean;
11
+ isFallback: boolean;
12
+ }
13
+ /**
14
+ * Map one {@link ImageModelInfo} from `GET /api/v1/images/models` to an
15
+ * {@link ImageAdapterDescriptor}. PURE — no I/O, no mutation of `info`.
16
+ *
17
+ * `capabilities` is copied VERBATIM (a fresh array, same members/order) — the
18
+ * backend image registry (`shared/image_model_registry.py`) is the single
19
+ * source of truth for what an image model can do; this layer never re-derives
20
+ * them from id/provider. The wire type is `string[]`; the backend emits only
21
+ * image caps so the cast to `Capability[]` is safe.
22
+ */
23
+ export declare function imageModelInfoToDescriptor(info: ImageModelInfo): ImageAdapterDescriptor;
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 declare function loadImageAdapterRegistry(client: Pick<ApiClient, 'listImageModels'>): Promise<AdapterRegistry<ImageAdapterDescriptor>>;
44
+ //# sourceMappingURL=imageAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imageAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/imageAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAIf,KAAK,sBAAsB,EAC5B,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExD;;;;;GAKG;AACH,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB;IACpE,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,cAAc,GAAG,sBAAsB,CAWvF;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,GACzC,OAAO,CAAC,eAAe,CAAC,sBAAsB,CAAC,CAAC,CAkClD"}