@escapeaihq/client-core 0.8.0 → 0.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. package/README.md +48 -4
  2. package/dist/adapters/capabilities.d.ts +10 -0
  3. package/dist/adapters/capabilities.d.ts.map +1 -0
  4. package/dist/adapters/capabilities.js +2 -0
  5. package/dist/adapters/capabilities.js.map +1 -0
  6. package/dist/adapters/chatAdapter.d.ts +38 -0
  7. package/dist/adapters/chatAdapter.d.ts.map +1 -0
  8. package/dist/adapters/chatAdapter.js +88 -0
  9. package/dist/adapters/chatAdapter.js.map +1 -0
  10. package/dist/adapters/directorAdapter.d.ts +62 -0
  11. package/dist/adapters/directorAdapter.d.ts.map +1 -0
  12. package/dist/adapters/directorAdapter.js +71 -0
  13. package/dist/adapters/directorAdapter.js.map +1 -0
  14. package/dist/adapters/imageAdapter.d.ts +44 -0
  15. package/dist/adapters/imageAdapter.d.ts.map +1 -0
  16. package/dist/adapters/imageAdapter.js +73 -0
  17. package/dist/adapters/imageAdapter.js.map +1 -0
  18. package/dist/adapters/index.d.ts +47 -0
  19. package/dist/adapters/index.d.ts.map +1 -0
  20. package/dist/adapters/index.js +41 -0
  21. package/dist/adapters/index.js.map +1 -0
  22. package/dist/adapters/registry.d.ts +98 -0
  23. package/dist/adapters/registry.d.ts.map +1 -0
  24. package/dist/adapters/registry.js +106 -0
  25. package/dist/adapters/registry.js.map +1 -0
  26. package/dist/adapters/worldAdapter.d.ts +142 -0
  27. package/dist/adapters/worldAdapter.d.ts.map +1 -0
  28. package/dist/adapters/worldAdapter.js +164 -0
  29. package/dist/adapters/worldAdapter.js.map +1 -0
  30. package/dist/admin.d.ts +200 -0
  31. package/dist/admin.d.ts.map +1 -0
  32. package/dist/admin.js +124 -0
  33. package/dist/admin.js.map +1 -0
  34. package/dist/api.d.ts +1299 -3
  35. package/dist/api.d.ts.map +1 -1
  36. package/dist/api.js +683 -95
  37. package/dist/api.js.map +1 -1
  38. package/dist/audio.d.ts +33 -1
  39. package/dist/audio.d.ts.map +1 -1
  40. package/dist/audio.js +4 -1
  41. package/dist/audio.js.map +1 -1
  42. package/dist/castProjection.d.ts +35 -0
  43. package/dist/castProjection.d.ts.map +1 -0
  44. package/dist/castProjection.js +80 -0
  45. package/dist/castProjection.js.map +1 -0
  46. package/dist/conversation/binding.d.ts +62 -0
  47. package/dist/conversation/binding.d.ts.map +1 -0
  48. package/dist/conversation/binding.js +51 -0
  49. package/dist/conversation/binding.js.map +1 -0
  50. package/dist/conversation/controller.d.ts +209 -0
  51. package/dist/conversation/controller.d.ts.map +1 -0
  52. package/dist/conversation/controller.js +342 -0
  53. package/dist/conversation/controller.js.map +1 -0
  54. package/dist/conversation/effectiveModel.d.ts +62 -0
  55. package/dist/conversation/effectiveModel.d.ts.map +1 -0
  56. package/dist/conversation/effectiveModel.js +73 -0
  57. package/dist/conversation/effectiveModel.js.map +1 -0
  58. package/dist/conversation/index.d.ts +27 -0
  59. package/dist/conversation/index.d.ts.map +1 -0
  60. package/dist/conversation/index.js +27 -0
  61. package/dist/conversation/index.js.map +1 -0
  62. package/dist/conversation/participant.d.ts +66 -0
  63. package/dist/conversation/participant.d.ts.map +1 -0
  64. package/dist/conversation/participant.js +36 -0
  65. package/dist/conversation/participant.js.map +1 -0
  66. package/dist/conversation/presence.d.ts +56 -0
  67. package/dist/conversation/presence.d.ts.map +1 -0
  68. package/dist/conversation/presence.js +34 -0
  69. package/dist/conversation/presence.js.map +1 -0
  70. package/dist/conversation/presenceBus.d.ts +42 -0
  71. package/dist/conversation/presenceBus.d.ts.map +1 -0
  72. package/dist/conversation/presenceBus.js +81 -0
  73. package/dist/conversation/presenceBus.js.map +1 -0
  74. package/dist/conversation/presenceRegistry.d.ts +49 -0
  75. package/dist/conversation/presenceRegistry.d.ts.map +1 -0
  76. package/dist/conversation/presenceRegistry.js +59 -0
  77. package/dist/conversation/presenceRegistry.js.map +1 -0
  78. package/dist/conversation/roster.d.ts +72 -0
  79. package/dist/conversation/roster.d.ts.map +1 -0
  80. package/dist/conversation/roster.js +69 -0
  81. package/dist/conversation/roster.js.map +1 -0
  82. package/dist/conversation/rosterProjection.d.ts +52 -0
  83. package/dist/conversation/rosterProjection.d.ts.map +1 -0
  84. package/dist/conversation/rosterProjection.js +74 -0
  85. package/dist/conversation/rosterProjection.js.map +1 -0
  86. package/dist/conversation/router.d.ts +74 -0
  87. package/dist/conversation/router.d.ts.map +1 -0
  88. package/dist/conversation/router.js +58 -0
  89. package/dist/conversation/router.js.map +1 -0
  90. package/dist/conversation/runtime.d.ts +64 -0
  91. package/dist/conversation/runtime.d.ts.map +1 -0
  92. package/dist/conversation/runtime.js +172 -0
  93. package/dist/conversation/runtime.js.map +1 -0
  94. package/dist/conversation/types.d.ts +99 -0
  95. package/dist/conversation/types.d.ts.map +1 -0
  96. package/dist/conversation/types.js +13 -0
  97. package/dist/conversation/types.js.map +1 -0
  98. package/dist/conversation/voice.d.ts +185 -0
  99. package/dist/conversation/voice.d.ts.map +1 -0
  100. package/dist/conversation/voice.js +307 -0
  101. package/dist/conversation/voice.js.map +1 -0
  102. package/dist/graphSchema.d.ts +260 -0
  103. package/dist/graphSchema.d.ts.map +1 -0
  104. package/dist/graphSchema.js +354 -0
  105. package/dist/graphSchema.js.map +1 -0
  106. package/dist/http.d.ts +20 -0
  107. package/dist/http.d.ts.map +1 -0
  108. package/dist/http.js +57 -0
  109. package/dist/http.js.map +1 -0
  110. package/dist/index.d.ts +9 -0
  111. package/dist/index.d.ts.map +1 -1
  112. package/dist/index.js +12 -0
  113. package/dist/index.js.map +1 -1
  114. package/dist/platformAssistant.d.ts +155 -0
  115. package/dist/platformAssistant.d.ts.map +1 -0
  116. package/dist/platformAssistant.js +256 -0
  117. package/dist/platformAssistant.js.map +1 -0
  118. package/dist/reactor/abortUtils.d.ts +16 -0
  119. package/dist/reactor/abortUtils.d.ts.map +1 -0
  120. package/dist/reactor/abortUtils.js +26 -0
  121. package/dist/reactor/abortUtils.js.map +1 -0
  122. package/dist/reactor/applyScenePrompt.d.ts +75 -0
  123. package/dist/reactor/applyScenePrompt.d.ts.map +1 -0
  124. package/dist/reactor/applyScenePrompt.js +60 -0
  125. package/dist/reactor/applyScenePrompt.js.map +1 -0
  126. package/dist/reactor/chunkDistribution.d.ts +43 -0
  127. package/dist/reactor/chunkDistribution.d.ts.map +1 -0
  128. package/dist/reactor/chunkDistribution.js +85 -0
  129. package/dist/reactor/chunkDistribution.js.map +1 -0
  130. package/dist/reactor/heliosCommandDispatcher.d.ts.map +1 -1
  131. package/dist/reactor/heliosCommandDispatcher.js +10 -15
  132. package/dist/reactor/heliosCommandDispatcher.js.map +1 -1
  133. package/dist/reactor/index.d.ts +4 -0
  134. package/dist/reactor/index.d.ts.map +1 -1
  135. package/dist/reactor/index.js +7 -0
  136. package/dist/reactor/index.js.map +1 -1
  137. package/dist/reactor/longLiveCommandDispatcher.d.ts +103 -0
  138. package/dist/reactor/longLiveCommandDispatcher.d.ts.map +1 -0
  139. package/dist/reactor/longLiveCommandDispatcher.js +87 -0
  140. package/dist/reactor/longLiveCommandDispatcher.js.map +1 -0
  141. package/dist/reactor/sceneEntry.d.ts +40 -6
  142. package/dist/reactor/sceneEntry.d.ts.map +1 -1
  143. package/dist/reactor/sceneEntry.js +63 -24
  144. package/dist/reactor/sceneEntry.js.map +1 -1
  145. package/dist/reactor/scenesFromEnrichment.d.ts.map +1 -1
  146. package/dist/reactor/scenesFromEnrichment.js +2 -66
  147. package/dist/reactor/scenesFromEnrichment.js.map +1 -1
  148. package/dist/reactor/seedImageOrchestrator.d.ts +42 -2
  149. package/dist/reactor/seedImageOrchestrator.d.ts.map +1 -1
  150. package/dist/reactor/seedImageOrchestrator.js +173 -4
  151. package/dist/reactor/seedImageOrchestrator.js.map +1 -1
  152. package/dist/reactor/storyTimeline.d.ts +44 -0
  153. package/dist/reactor/storyTimeline.d.ts.map +1 -0
  154. package/dist/reactor/storyTimeline.js +95 -0
  155. package/dist/reactor/storyTimeline.js.map +1 -0
  156. package/dist/storyGraph.d.ts +70 -0
  157. package/dist/storyGraph.d.ts.map +1 -0
  158. package/dist/storyGraph.js +178 -0
  159. package/dist/storyGraph.js.map +1 -0
  160. package/dist/timeFormat.d.ts +10 -0
  161. package/dist/timeFormat.d.ts.map +1 -1
  162. package/dist/timeFormat.js +12 -0
  163. package/dist/timeFormat.js.map +1 -1
  164. package/dist/toolSchemas.d.ts +370 -0
  165. package/dist/toolSchemas.d.ts.map +1 -0
  166. package/dist/toolSchemas.js +182 -0
  167. package/dist/toolSchemas.js.map +1 -0
  168. package/dist/vision/VisionPublisher.d.ts +115 -0
  169. package/dist/vision/VisionPublisher.d.ts.map +1 -0
  170. package/dist/vision/VisionPublisher.js +475 -0
  171. package/dist/vision/VisionPublisher.js.map +1 -0
  172. package/dist/vision/VisionSourceController.d.ts +127 -0
  173. package/dist/vision/VisionSourceController.d.ts.map +1 -0
  174. package/dist/vision/VisionSourceController.js +284 -0
  175. package/dist/vision/VisionSourceController.js.map +1 -0
  176. package/dist/vision/credentials.d.ts +22 -0
  177. package/dist/vision/credentials.d.ts.map +1 -0
  178. package/dist/vision/credentials.js +34 -0
  179. package/dist/vision/credentials.js.map +1 -0
  180. package/dist/vision/index.d.ts +18 -0
  181. package/dist/vision/index.d.ts.map +1 -0
  182. package/dist/vision/index.js +13 -0
  183. package/dist/vision/index.js.map +1 -0
  184. package/dist/vision/sourceKinds.d.ts +65 -0
  185. package/dist/vision/sourceKinds.d.ts.map +1 -0
  186. package/dist/vision/sourceKinds.js +26 -0
  187. package/dist/vision/sourceKinds.js.map +1 -0
  188. package/dist/vision/startVisionPublisher.d.ts +38 -0
  189. package/dist/vision/startVisionPublisher.d.ts.map +1 -0
  190. package/dist/vision/startVisionPublisher.js +44 -0
  191. package/dist/vision/startVisionPublisher.js.map +1 -0
  192. package/dist/vision/types.d.ts +95 -0
  193. package/dist/vision/types.d.ts.map +1 -0
  194. package/dist/vision/types.js +12 -0
  195. package/dist/vision/types.js.map +1 -0
  196. package/dist/vision/visionScheduler.d.ts +63 -0
  197. package/dist/vision/visionScheduler.d.ts.map +1 -0
  198. package/dist/vision/visionScheduler.js +67 -0
  199. package/dist/vision/visionScheduler.js.map +1 -0
  200. package/dist/websocket.d.ts +195 -0
  201. package/dist/websocket.d.ts.map +1 -1
  202. package/dist/websocket.js +179 -1
  203. package/dist/websocket.js.map +1 -1
  204. package/package.json +11 -1
  205. package/src/__tests__/adapters-capabilities.test.ts +46 -0
  206. package/src/__tests__/adapters-chat.test.ts +172 -0
  207. package/src/__tests__/adapters-director.test.ts +95 -0
  208. package/src/__tests__/adapters-image.test.ts +133 -0
  209. package/src/__tests__/adapters-platform.test.ts +95 -0
  210. package/src/__tests__/adapters-registry.test.ts +189 -0
  211. package/src/__tests__/adapters-world.test.ts +296 -0
  212. package/src/__tests__/admin.test.ts +312 -0
  213. package/src/__tests__/adventures-party.test.ts +219 -0
  214. package/src/__tests__/adventures.test.ts +282 -0
  215. package/src/__tests__/api-pollers.test.ts +104 -0
  216. package/src/__tests__/api.clip-lookup.test.ts +64 -0
  217. package/src/__tests__/api.list-images-filters.test.ts +103 -0
  218. package/src/__tests__/api.test.ts +470 -0
  219. package/src/__tests__/audio.test.ts +65 -0
  220. package/src/__tests__/cast.test.ts +95 -0
  221. package/src/__tests__/castProjection.test.ts +167 -0
  222. package/src/__tests__/chat-auth.test.ts +91 -0
  223. package/src/__tests__/conversation/controller.test.ts +697 -0
  224. package/src/__tests__/conversation/effectiveModel.test.ts +169 -0
  225. package/src/__tests__/conversation/headlessRenderer.ts +46 -0
  226. package/src/__tests__/conversation/presenceBus.test.ts +236 -0
  227. package/src/__tests__/conversation/presenceRegistry.test.ts +73 -0
  228. package/src/__tests__/conversation/roster.test.ts +100 -0
  229. package/src/__tests__/conversation/rosterProjection.test.ts +142 -0
  230. package/src/__tests__/conversation/router.test.ts +81 -0
  231. package/src/__tests__/conversation/runtime.test.ts +206 -0
  232. package/src/__tests__/conversation/voice.test.ts +440 -0
  233. package/src/__tests__/documents.test.ts +360 -0
  234. package/src/__tests__/graphSchema.test.ts +326 -0
  235. package/src/__tests__/longLiveCommandDispatcher.test.ts +185 -0
  236. package/src/__tests__/platformAssistant.test.ts +484 -0
  237. package/src/__tests__/reactor/applyScenePrompt.test.ts +192 -0
  238. package/src/__tests__/reactor/heliosCommandDispatcher.test.ts +4 -3
  239. package/src/__tests__/reactor/sceneEntry.test.ts +134 -10
  240. package/src/__tests__/reactor/seedImageOrchestrator.test.ts +51 -16
  241. package/src/__tests__/reactor/storyTimeline.test.ts +186 -0
  242. package/src/__tests__/regeneration.test.ts +486 -0
  243. package/src/__tests__/stories.test.ts +171 -0
  244. package/src/__tests__/storyGraph.test.ts +134 -0
  245. package/src/__tests__/timeFormat.test.ts +22 -1
  246. package/src/__tests__/toolSchemas.test.ts +57 -0
  247. package/src/__tests__/tools-wrappers.test.ts +272 -0
  248. package/src/__tests__/videoGraph.test.ts +94 -0
  249. package/src/__tests__/websocket-vision.test.ts +265 -0
  250. package/src/__tests__/websocket.test.ts +213 -0
  251. package/src/adapters/capabilities.ts +24 -0
  252. package/src/adapters/chatAdapter.ts +114 -0
  253. package/src/adapters/directorAdapter.ts +126 -0
  254. package/src/adapters/imageAdapter.ts +100 -0
  255. package/src/adapters/index.ts +67 -0
  256. package/src/adapters/registry.ts +159 -0
  257. package/src/adapters/worldAdapter.ts +272 -0
  258. package/src/admin.ts +310 -0
  259. package/src/api.ts +1890 -162
  260. package/src/audio.ts +35 -0
  261. package/src/castProjection.ts +95 -0
  262. package/src/conversation/binding.ts +81 -0
  263. package/src/conversation/controller.ts +439 -0
  264. package/src/conversation/effectiveModel.ts +111 -0
  265. package/src/conversation/index.ts +27 -0
  266. package/src/conversation/participant.ts +71 -0
  267. package/src/conversation/presence.ts +60 -0
  268. package/src/conversation/presenceBus.ts +109 -0
  269. package/src/conversation/presenceRegistry.ts +83 -0
  270. package/src/conversation/roster.ts +111 -0
  271. package/src/conversation/rosterProjection.ts +98 -0
  272. package/src/conversation/router.ts +96 -0
  273. package/src/conversation/runtime.ts +188 -0
  274. package/src/conversation/types.ts +100 -0
  275. package/src/conversation/voice.ts +402 -0
  276. package/src/graphSchema.ts +532 -0
  277. package/src/http.ts +72 -0
  278. package/src/index.ts +12 -0
  279. package/src/platformAssistant.ts +347 -0
  280. package/src/reactor/abortUtils.ts +22 -0
  281. package/src/reactor/applyScenePrompt.ts +136 -0
  282. package/src/reactor/chunkDistribution.ts +98 -0
  283. package/src/reactor/heliosCommandDispatcher.ts +10 -18
  284. package/src/reactor/index.ts +7 -0
  285. package/src/reactor/longLiveCommandDispatcher.ts +156 -0
  286. package/src/reactor/sceneEntry.ts +104 -33
  287. package/src/reactor/scenesFromEnrichment.ts +11 -76
  288. package/src/reactor/seedImageOrchestrator.ts +200 -4
  289. package/src/reactor/storyTimeline.ts +127 -0
  290. package/src/storyGraph.ts +298 -0
  291. package/src/timeFormat.ts +13 -0
  292. package/src/toolSchemas.ts +225 -0
  293. package/src/vision/VisionPublisher.ts +553 -0
  294. package/src/vision/VisionSourceController.ts +354 -0
  295. package/src/vision/__tests__/VisionPublisher.kvs.test.ts +244 -0
  296. package/src/vision/__tests__/VisionPublisher.test.ts +301 -0
  297. package/src/vision/__tests__/VisionSourceController.test.ts +719 -0
  298. package/src/vision/__tests__/startVisionPublisher.test.ts +251 -0
  299. package/src/vision/__tests__/toVisionRtcCredentials.test.ts +113 -0
  300. package/src/vision/__tests__/visionScheduler.test.ts +149 -0
  301. package/src/vision/credentials.ts +39 -0
  302. package/src/vision/index.ts +44 -0
  303. package/src/vision/sourceKinds.ts +75 -0
  304. package/src/vision/startVisionPublisher.ts +64 -0
  305. package/src/vision/types.ts +101 -0
  306. package/src/vision/visionScheduler.ts +102 -0
  307. package/src/websocket.ts +334 -4
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Framework-agnostic vision-SOURCE controller — the single source of truth
3
+ * for "turn a chosen local source into a published vision feed".
4
+ *
5
+ * R3a of the Platform Experience Restructure
6
+ * (`specs/platform-experience-restructure-phase-R3-vision-source-picker.md`).
7
+ *
8
+ * Today the two React call sites duplicate the same
9
+ * acquire→credentials→publish→teardown sequence and differ only in how the
10
+ * track is obtained (the fork `startVisionPublisher`'s header already calls
11
+ * out): the chat-ws page hardcodes `getUserMedia({ video: true })` and the
12
+ * watch hook hardcodes `<video>.captureStream()`. This controller owns the
13
+ * acquisition switch (webcam / playing-video / server-render) plus the full
14
+ * publisher lifecycle, and DELEGATES the publisher wiring to the existing
15
+ * `startVisionPublisher` helper — it does not duplicate it.
16
+ *
17
+ * Error discipline (matches the lifted call sites + this module's
18
+ * callbacks-not-throws convention): environmental/acquisition failures
19
+ * (no getUserMedia support, permission denied, captureStream unsupported,
20
+ * no video track, credential fetch failure) are reported via `onError` and
21
+ * `start()` RESOLVES with the controller back in the idle, restartable
22
+ * state. Programmer misuse (`start()` while a source is active or starting)
23
+ * THROWS fail-loud — use `switchSource()` to change sources.
24
+ *
25
+ * Zero React/DOM-query imports: descriptors carry any DOM element in, so a
26
+ * React hook (R3b) drives it today and a game-engine surface can later.
27
+ * Cross-device vision relay stays deferred — every source is local and the
28
+ * feed publishes over the caller's own authenticated `ChatWebSocket`
29
+ * exactly as today.
30
+ */
31
+ import type { ApiClient } from '../api';
32
+ import type { ChatWebSocket } from '../websocket';
33
+ import type { VisionStatus } from './types';
34
+ import type { VisionSourceDescriptor, VisionSourceKind } from './sourceKinds';
35
+ /**
36
+ * The slice of `ApiClient` the controller needs (structural — a full
37
+ * `ApiClient` satisfies it; tests can pass a one-method stub).
38
+ */
39
+ export type VisionCredentialsClient = Pick<ApiClient, 'getVisionRtcCredentials'>;
40
+ export interface VisionSourceControllerOptions {
41
+ /**
42
+ * The SAME authenticated `ChatWebSocket` the user's chat turns use —
43
+ * vision frames are keyed to the WS session ID server-side, so a fresh
44
+ * socket would land in a different `FrameBuffer`. Callers must keep this
45
+ * reference stable for the controller's lifetime (the identity-stability
46
+ * requirement lifted from the watch hook).
47
+ */
48
+ ws: ChatWebSocket;
49
+ /** Mints vision-signaling credentials via
50
+ * `POST /api/v1/chat/vision-rtc/credentials`. */
51
+ apiClient: VisionCredentialsClient;
52
+ /** Frames-per-second cadence; clamped server-side to 0.5–3.0 fps. */
53
+ fps: number;
54
+ /** Publisher telemetry (drives the HUD line). */
55
+ onStatus?: (status: VisionStatus) => void;
56
+ /** Environmental/acquisition failures AND asynchronous publisher errors. */
57
+ onError?: (error: Error) => void;
58
+ /** Fired when `currentKind` changes: the new kind after a successful
59
+ * `start`, and `null` when an active source is stopped. */
60
+ onSourceChange?: (kind: VisionSourceKind | null) => void;
61
+ }
62
+ export declare class VisionSourceController {
63
+ private readonly ws;
64
+ private readonly apiClient;
65
+ private readonly fps;
66
+ private readonly onStatus?;
67
+ private readonly onError?;
68
+ private readonly onSourceChange?;
69
+ /** Bumped by every `stop()`; in-flight `start()` work compares its
70
+ * captured epoch after each await and bails (releasing anything it
71
+ * acquired) when stale. */
72
+ private epoch;
73
+ private phase;
74
+ private kind;
75
+ private stream;
76
+ private handle;
77
+ /** Cancels a pending waitForFrame `loadeddata` listener. */
78
+ private cancelWaitForFrame;
79
+ constructor(opts: VisionSourceControllerOptions);
80
+ /** The currently-published source kind, or `null` when idle/starting. */
81
+ get currentKind(): VisionSourceKind | null;
82
+ /** True while a `start()` is in flight (acquisition / first-frame gate /
83
+ * credentials). Lets a UI adapter render a loading state without
84
+ * probing the lifecycle. */
85
+ get isStarting(): boolean;
86
+ /**
87
+ * Acquire the descriptor's track, mint credentials, and start publishing.
88
+ *
89
+ * Resolves when the publisher is started OR the attempt failed (failure
90
+ * reported via `onError`; controller back in the restartable idle state)
91
+ * OR a concurrent `stop()`/`switchSource()` cancelled it. Throws only on
92
+ * misuse: calling `start()` while a source is already active or starting.
93
+ */
94
+ start(descriptor: VisionSourceDescriptor): Promise<void>;
95
+ /**
96
+ * Stop the current source (publisher + every acquired track), then start
97
+ * the new one. The teardown completes synchronously BEFORE the next
98
+ * acquisition begins, so e.g. the webcam light is off before the video
99
+ * capture starts. This is the net-new capability the hardwired call
100
+ * sites couldn't do.
101
+ *
102
+ * Single-caller by design: the phase passes through `idle` between the
103
+ * stop and the start, so a concurrent `start()` issued in that window
104
+ * would win and make this call's deferred `start()` throw. The React
105
+ * adapter (R3b) holds the controller on a `useRef` and serializes calls
106
+ * through one effect, which guarantees a single caller.
107
+ */
108
+ switchSource(descriptor: VisionSourceDescriptor): Promise<void>;
109
+ /**
110
+ * Idempotent teardown: stops the publisher (via its handle), stops every
111
+ * acquired `MediaStreamTrack` (camera light off; no leaked captureStream
112
+ * tracks), cancels any pending first-frame gate, and aborts any in-flight
113
+ * `start()`.
114
+ */
115
+ stop(): void;
116
+ /** Report a failed start attempt and return to idle (unless a stop()
117
+ * superseded this attempt — then the user cancelled, not an error). */
118
+ private failStart;
119
+ /** Per-kind track acquisition. Throws environmental errors; the caller
120
+ * routes them through `failStart`. */
121
+ private acquire;
122
+ /** Resolve once the `<video>` has decoded its first frame (or
123
+ * immediately for canvases / already-decoded videos). Cancellable by
124
+ * `stop()` via `cancelWaitForFrame`. */
125
+ private waitForFirstFrame;
126
+ }
127
+ //# sourceMappingURL=VisionSourceController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VisionSourceController.d.ts","sourceRoot":"","sources":["../../src/vision/VisionSourceController.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAoC,MAAM,QAAQ,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAEV,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAEvB;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAA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G;IACG,YAAY,CAAC,UAAU,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrE;;;;;OAKG;IACH,IAAI,IAAI,IAAI;IAgBZ;2EACuE;IACvE,OAAO,CAAC,SAAS;IAMjB;0CACsC;YACxB,OAAO;IAkCrB;;4CAEwC;IACxC,OAAO,CAAC,iBAAiB;CAoB1B"}
@@ -0,0 +1,284 @@
1
+ /**
2
+ * Framework-agnostic vision-SOURCE controller — the single source of truth
3
+ * for "turn a chosen local source into a published vision feed".
4
+ *
5
+ * R3a of the Platform Experience Restructure
6
+ * (`specs/platform-experience-restructure-phase-R3-vision-source-picker.md`).
7
+ *
8
+ * Today the two React call sites duplicate the same
9
+ * acquire→credentials→publish→teardown sequence and differ only in how the
10
+ * track is obtained (the fork `startVisionPublisher`'s header already calls
11
+ * out): the chat-ws page hardcodes `getUserMedia({ video: true })` and the
12
+ * watch hook hardcodes `<video>.captureStream()`. This controller owns the
13
+ * acquisition switch (webcam / playing-video / server-render) plus the full
14
+ * publisher lifecycle, and DELEGATES the publisher wiring to the existing
15
+ * `startVisionPublisher` helper — it does not duplicate it.
16
+ *
17
+ * Error discipline (matches the lifted call sites + this module's
18
+ * callbacks-not-throws convention): environmental/acquisition failures
19
+ * (no getUserMedia support, permission denied, captureStream unsupported,
20
+ * no video track, credential fetch failure) are reported via `onError` and
21
+ * `start()` RESOLVES with the controller back in the idle, restartable
22
+ * state. Programmer misuse (`start()` while a source is active or starting)
23
+ * THROWS fail-loud — use `switchSource()` to change sources.
24
+ *
25
+ * Zero React/DOM-query imports: descriptors carry any DOM element in, so a
26
+ * React hook (R3b) drives it today and a game-engine surface can later.
27
+ * Cross-device vision relay stays deferred — every source is local and the
28
+ * feed publishes over the caller's own authenticated `ChatWebSocket`
29
+ * exactly as today.
30
+ */
31
+ import { startVisionPublisher } from './startVisionPublisher.js';
32
+ import { VISION_SOURCE_KINDS } from './sourceKinds.js';
33
+ /** First `readyState` where the `<video>` has a real decoded image; tracks
34
+ * pulled before then publish a black buffer (the watch-page guard). */
35
+ const HAVE_CURRENT_DATA = 2;
36
+ const toError = (err) => err instanceof Error ? err : new Error(String(err));
37
+ /**
38
+ * Module-private sentinel thrown to unwind `acquire()` when `stop()`
39
+ * cancels a pending first-frame gate. Handled explicitly in `start()`'s
40
+ * catch — it never reaches `onError` and is never user-visible.
41
+ */
42
+ class StartCancelledError extends Error {
43
+ constructor() {
44
+ super('vision source start cancelled');
45
+ this.name = 'StartCancelledError';
46
+ }
47
+ }
48
+ /** Duck-typed captureStream lookup — `HTMLVideoElement.captureStream` /
49
+ * `HTMLCanvasElement.captureStream` aren't in all lib.dom versions, so we
50
+ * cast locally rather than widening global types (same pattern as the
51
+ * watch hook this lifts). */
52
+ const captureStreamOf = (element) => {
53
+ const fn = element.captureStream;
54
+ return typeof fn === 'function' ? fn.bind(element) : undefined;
55
+ };
56
+ export class VisionSourceController {
57
+ ws;
58
+ apiClient;
59
+ fps;
60
+ onStatus;
61
+ onError;
62
+ onSourceChange;
63
+ /** Bumped by every `stop()`; in-flight `start()` work compares its
64
+ * captured epoch after each await and bails (releasing anything it
65
+ * acquired) when stale. */
66
+ epoch = 0;
67
+ phase = 'idle';
68
+ kind = null;
69
+ stream = null;
70
+ handle = null;
71
+ /** Cancels a pending waitForFrame `loadeddata` listener. */
72
+ cancelWaitForFrame = null;
73
+ constructor(opts) {
74
+ this.ws = opts.ws;
75
+ this.apiClient = opts.apiClient;
76
+ this.fps = opts.fps;
77
+ this.onStatus = opts.onStatus;
78
+ this.onError = opts.onError;
79
+ this.onSourceChange = opts.onSourceChange;
80
+ }
81
+ /** The currently-published source kind, or `null` when idle/starting. */
82
+ get currentKind() {
83
+ return this.kind;
84
+ }
85
+ /** True while a `start()` is in flight (acquisition / first-frame gate /
86
+ * credentials). Lets a UI adapter render a loading state without
87
+ * probing the lifecycle. */
88
+ get isStarting() {
89
+ return this.phase === 'starting';
90
+ }
91
+ /**
92
+ * Acquire the descriptor's track, mint credentials, and start publishing.
93
+ *
94
+ * Resolves when the publisher is started OR the attempt failed (failure
95
+ * reported via `onError`; controller back in the restartable idle state)
96
+ * OR a concurrent `stop()`/`switchSource()` cancelled it. Throws only on
97
+ * misuse: calling `start()` while a source is already active or starting.
98
+ */
99
+ async start(descriptor) {
100
+ if (this.phase !== 'idle') {
101
+ throw new Error(`VisionSourceController.start() called while a source is ${this.phase} — ` +
102
+ 'use switchSource() to change sources');
103
+ }
104
+ this.phase = 'starting';
105
+ const epoch = this.epoch;
106
+ // 1. Acquire the source stream (the only step that differs per kind).
107
+ let stream;
108
+ try {
109
+ stream = await this.acquire(descriptor, epoch);
110
+ }
111
+ catch (err) {
112
+ if (err instanceof StartCancelledError)
113
+ return; // deliberate stop — not an error
114
+ this.failStart(epoch, toError(err));
115
+ return;
116
+ }
117
+ if (epoch !== this.epoch) {
118
+ // stop()/switchSource() raced the acquisition — release what we
119
+ // acquired (the camera light must not linger) and bail silently:
120
+ // a deliberate stop is not an error.
121
+ stream.getTracks().forEach((t) => t.stop());
122
+ return;
123
+ }
124
+ const track = stream.getVideoTracks()[0];
125
+ if (!track) {
126
+ // A live MediaStream with no video track: stop its tracks before
127
+ // bailing so we don't leak the capture (lifted verbatim from both
128
+ // call sites).
129
+ stream.getTracks().forEach((t) => t.stop());
130
+ this.failStart(epoch, new Error(descriptor.kind === VISION_SOURCE_KINDS.WEBCAM
131
+ ? 'No video track available'
132
+ : 'No video track available from captureStream()'));
133
+ return;
134
+ }
135
+ // Safe to publish the stream onto the instance only now: the no-track
136
+ // check above ran synchronously since acquisition (no await between),
137
+ // so no stop() can have interleaved.
138
+ this.stream = stream;
139
+ // 2. Mint signaling credentials AFTER acquisition succeeds — keeps the
140
+ // AWS round-trip off the cold-toggle path until we can produce frames.
141
+ let credentialsResponse;
142
+ try {
143
+ credentialsResponse = await this.apiClient.getVisionRtcCredentials();
144
+ }
145
+ catch (err) {
146
+ // Release unconditionally — if stop() raced this await it already
147
+ // stopped these tracks via this.stream, and double-stopping a
148
+ // MediaStreamTrack is a spec'd no-op. Either way the camera light
149
+ // goes off.
150
+ stream.getTracks().forEach((t) => t.stop());
151
+ if (epoch === this.epoch)
152
+ this.stream = null;
153
+ this.failStart(epoch, toError(err));
154
+ return;
155
+ }
156
+ if (epoch !== this.epoch) {
157
+ // stop() already released this.stream; double-stopping a track is a
158
+ // spec'd no-op, so release unconditionally for safety.
159
+ stream.getTracks().forEach((t) => t.stop());
160
+ return;
161
+ }
162
+ // 3. Delegate the publisher wiring to the existing helper (DRY — the
163
+ // construct→subscribe→start sequence has exactly one implementation).
164
+ // Defensively wrapped: a synchronous throw here would otherwise leave
165
+ // the phase stuck at 'starting' (non-restartable) with no onError.
166
+ try {
167
+ this.handle = startVisionPublisher({
168
+ ws: this.ws,
169
+ track,
170
+ credentialsResponse,
171
+ fps: this.fps,
172
+ onStatus: this.onStatus,
173
+ onError: this.onError,
174
+ });
175
+ }
176
+ catch (err) {
177
+ stream.getTracks().forEach((t) => t.stop());
178
+ this.stream = null;
179
+ this.failStart(epoch, toError(err));
180
+ return;
181
+ }
182
+ this.phase = 'active';
183
+ this.kind = descriptor.kind;
184
+ this.onSourceChange?.(descriptor.kind);
185
+ }
186
+ /**
187
+ * Stop the current source (publisher + every acquired track), then start
188
+ * the new one. The teardown completes synchronously BEFORE the next
189
+ * acquisition begins, so e.g. the webcam light is off before the video
190
+ * capture starts. This is the net-new capability the hardwired call
191
+ * sites couldn't do.
192
+ *
193
+ * Single-caller by design: the phase passes through `idle` between the
194
+ * stop and the start, so a concurrent `start()` issued in that window
195
+ * would win and make this call's deferred `start()` throw. The React
196
+ * adapter (R3b) holds the controller on a `useRef` and serializes calls
197
+ * through one effect, which guarantees a single caller.
198
+ */
199
+ async switchSource(descriptor) {
200
+ this.stop();
201
+ await this.start(descriptor);
202
+ }
203
+ /**
204
+ * Idempotent teardown: stops the publisher (via its handle), stops every
205
+ * acquired `MediaStreamTrack` (camera light off; no leaked captureStream
206
+ * tracks), cancels any pending first-frame gate, and aborts any in-flight
207
+ * `start()`.
208
+ */
209
+ stop() {
210
+ this.epoch += 1;
211
+ this.cancelWaitForFrame?.();
212
+ this.handle?.stop();
213
+ this.handle = null;
214
+ this.stream?.getTracks().forEach((t) => t.stop());
215
+ this.stream = null;
216
+ this.phase = 'idle';
217
+ if (this.kind !== null) {
218
+ this.kind = null;
219
+ this.onSourceChange?.(null);
220
+ }
221
+ }
222
+ // ── Internals ──────────────────────────────────────────────────────────
223
+ /** Report a failed start attempt and return to idle (unless a stop()
224
+ * superseded this attempt — then the user cancelled, not an error). */
225
+ failStart(epoch, error) {
226
+ if (epoch !== this.epoch)
227
+ return;
228
+ this.phase = 'idle';
229
+ this.onError?.(error);
230
+ }
231
+ /** Per-kind track acquisition. Throws environmental errors; the caller
232
+ * routes them through `failStart`. */
233
+ async acquire(descriptor, epoch) {
234
+ if (descriptor.kind === VISION_SOURCE_KINDS.WEBCAM) {
235
+ if (typeof navigator === 'undefined' ||
236
+ !navigator.mediaDevices?.getUserMedia) {
237
+ throw new Error('Browser does not support webcam access');
238
+ }
239
+ return navigator.mediaDevices.getUserMedia(descriptor.constraints ?? { video: true });
240
+ }
241
+ // playing-video / server-render: captureStream() off the supplied
242
+ // element, optionally gated on the first decoded frame for <video>.
243
+ const { element } = descriptor;
244
+ if (descriptor.waitForFrame) {
245
+ await this.waitForFirstFrame(element);
246
+ if (epoch !== this.epoch) {
247
+ // stop() cancelled the gate while we were waiting — unwind out of
248
+ // acquire(); start()'s catch swallows this sentinel explicitly.
249
+ throw new StartCancelledError();
250
+ }
251
+ }
252
+ const captureStream = captureStreamOf(element);
253
+ if (!captureStream) {
254
+ throw new Error('Browser does not support captureStream()');
255
+ }
256
+ return captureStream();
257
+ }
258
+ /** Resolve once the `<video>` has decoded its first frame (or
259
+ * immediately for canvases / already-decoded videos). Cancellable by
260
+ * `stop()` via `cancelWaitForFrame`. */
261
+ waitForFirstFrame(element) {
262
+ const video = element;
263
+ // Canvas elements have no readyState — capture immediately.
264
+ if (typeof video.readyState !== 'number')
265
+ return Promise.resolve();
266
+ if (video.readyState >= HAVE_CURRENT_DATA)
267
+ return Promise.resolve();
268
+ return new Promise((resolve) => {
269
+ const onReady = () => {
270
+ video.removeEventListener('loadeddata', onReady);
271
+ this.cancelWaitForFrame = null;
272
+ resolve();
273
+ };
274
+ video.addEventListener('loadeddata', onReady);
275
+ this.cancelWaitForFrame = () => {
276
+ video.removeEventListener('loadeddata', onReady);
277
+ this.cancelWaitForFrame = null;
278
+ // Resolve (not reject): the epoch check after the await bails out.
279
+ resolve();
280
+ };
281
+ });
282
+ }
283
+ }
284
+ //# sourceMappingURL=VisionSourceController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VisionSourceController.js","sourceRoot":"","sources":["../../src/vision/VisionSourceController.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAG9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAoCpD;uEACuE;AACvE,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAI5B,MAAM,OAAO,GAAG,CAAC,GAAY,EAAS,EAAE,CACtC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;AAEtD;;;;GAIG;AACH,MAAM,mBAAoB,SAAQ,KAAK;IACrC;QACE,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED;;;6BAG6B;AAC7B,MAAM,eAAe,GAAG,CACtB,OAA6B,EACI,EAAE;IACnC,MAAM,EAAE,GAAI,OAAiD,CAAC,aAAa,CAAC;IAC5E,OAAO,OAAO,EAAE,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,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;YACnC,MAAM,OAAO,GAAG,GAAS,EAAE;gBACzB,KAAK,CAAC,mBAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;gBACjD,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;gBAC/B,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC;YACF,KAAK,CAAC,gBAAgB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YAC9C,IAAI,CAAC,kBAAkB,GAAG,GAAS,EAAE;gBACnC,KAAK,CAAC,mBAAmB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;gBACjD,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;gBAC/B,mEAAmE;gBACnE,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Pure mapping helper: API response → VisionPublisher credentials.
3
+ *
4
+ * The chat-API returns `ChatVisionRtcCredentialsResponse` whose ICE-server
5
+ * entries use `string | null` for optional fields (JSON can't carry
6
+ * `undefined`). `RTCIceServer` / `VisionRtcCredentials` want `string |
7
+ * undefined` instead, so we normalise here.
8
+ *
9
+ * `traceId` is a log-correlation field on the response; it is NOT part of
10
+ * `VisionRtcCredentials` and is intentionally dropped.
11
+ */
12
+ import type { ChatVisionRtcCredentialsResponse } from '../api';
13
+ import type { VisionRtcCredentials } from './types';
14
+ /**
15
+ * Convert a `ChatVisionRtcCredentialsResponse` (API wire shape) into the
16
+ * `VisionRtcCredentials` expected by `VisionPublisher`.
17
+ *
18
+ * - `null` ICE `username` / `credential` fields are coerced to `undefined`.
19
+ * - `traceId` (present on the response for log correlation) is dropped.
20
+ */
21
+ export declare function toVisionRtcCredentials(response: ChatVisionRtcCredentialsResponse): VisionRtcCredentials;
22
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/vision/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,gCAAgC,GACzC,oBAAoB,CActB"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Pure mapping helper: API response → VisionPublisher credentials.
3
+ *
4
+ * The chat-API returns `ChatVisionRtcCredentialsResponse` whose ICE-server
5
+ * entries use `string | null` for optional fields (JSON can't carry
6
+ * `undefined`). `RTCIceServer` / `VisionRtcCredentials` want `string |
7
+ * undefined` instead, so we normalise here.
8
+ *
9
+ * `traceId` is a log-correlation field on the response; it is NOT part of
10
+ * `VisionRtcCredentials` and is intentionally dropped.
11
+ */
12
+ /**
13
+ * Convert a `ChatVisionRtcCredentialsResponse` (API wire shape) into the
14
+ * `VisionRtcCredentials` expected by `VisionPublisher`.
15
+ *
16
+ * - `null` ICE `username` / `credential` fields are coerced to `undefined`.
17
+ * - `traceId` (present on the response for log correlation) is dropped.
18
+ */
19
+ export function toVisionRtcCredentials(response) {
20
+ return {
21
+ mode: response.mode,
22
+ iceServers: response.iceServers.map((entry) => ({
23
+ urls: entry.urls,
24
+ username: entry.username ?? undefined,
25
+ credential: entry.credential ?? undefined,
26
+ })),
27
+ signedSignalingUrl: response.signedSignalingUrl,
28
+ channelArn: response.channelArn,
29
+ clientId: response.clientId,
30
+ region: response.region,
31
+ expiresIn: response.expiresIn,
32
+ };
33
+ }
34
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/vision/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CACpC,QAA0C;IAE1C,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC9C,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,SAAS;YACrC,UAAU,EAAE,KAAK,CAAC,UAAU,IAAI,SAAS;SAC1C,CAAC,CAAC;QACH,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;QAC/C,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,SAAS,EAAE,QAAQ,CAAC,SAAS;KAC9B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Public surface for the framework-agnostic vision publisher.
3
+ *
4
+ * Re-exported from `packages/client-core/src/index.ts` so consumers can
5
+ * `import { VisionPublisher } from '@escapeaihq/client-core'`.
6
+ */
7
+ export { VisionPublisher } from './VisionPublisher';
8
+ export { computeNextFps, createVisionScheduler, } from './visionScheduler';
9
+ export type { VisionPublisherConfig, VisionPublisherOptions, VisionRtcCredentials, VisionStatus, VisionStatusListener, VisionErrorListener, } from './types';
10
+ export type { ComputeNextFpsInput, VisionScheduler, VisionSchedulerOptions, } from './visionScheduler';
11
+ export { toVisionRtcCredentials } from './credentials';
12
+ export { startVisionPublisher } from './startVisionPublisher';
13
+ export type { StartVisionPublisherOptions, VisionPublisherHandle, } from './startVisionPublisher';
14
+ export { VISION_SOURCE_KINDS } from './sourceKinds';
15
+ export type { ElementSourceDescriptor, VisionCaptureElement, VisionSourceDescriptor, VisionSourceKind, WebcamSourceDescriptor, } from './sourceKinds';
16
+ export { VisionSourceController } from './VisionSourceController';
17
+ export type { VisionCredentialsClient, VisionSourceControllerOptions, } from './VisionSourceController';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vision/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,cAAc,EACd,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EACV,2BAA2B,EAC3B,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,YAAY,EACV,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,YAAY,EACV,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Public surface for the framework-agnostic vision publisher.
3
+ *
4
+ * Re-exported from `packages/client-core/src/index.ts` so consumers can
5
+ * `import { VisionPublisher } from '@escapeaihq/client-core'`.
6
+ */
7
+ export { VisionPublisher } from './VisionPublisher.js';
8
+ export { computeNextFps, createVisionScheduler, } from './visionScheduler.js';
9
+ export { toVisionRtcCredentials } from './credentials.js';
10
+ export { startVisionPublisher } from './startVisionPublisher.js';
11
+ export { VISION_SOURCE_KINDS } from './sourceKinds.js';
12
+ export { VisionSourceController } from './VisionSourceController.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vision/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,cAAc,EACd,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAc3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAK9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAQpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Vision source kinds + descriptors — the single source of truth for the
3
+ * three local vision sources a surface can point the VLM at.
4
+ *
5
+ * R3a of the Platform Experience Restructure
6
+ * (`specs/platform-experience-restructure-phase-R3-vision-source-picker.md`).
7
+ * The `VisionSourceController` consumes these; the React adapter (R3b) and
8
+ * the `/chat-ws` + `/watch` surfaces (R3c/R3d) pick among them. Constants
9
+ * over bare literals, per CLAUDE.md — consumers compare against
10
+ * `VISION_SOURCE_KINDS.*`, never inline strings.
11
+ *
12
+ * Cross-device vision relay is explicitly deferred: every kind here is a
13
+ * LOCAL source, published over the user's own chat WebSocket exactly as
14
+ * today.
15
+ */
16
+ /** The three local vision source kinds, as a frozen constant object. */
17
+ export declare const VISION_SOURCE_KINDS: {
18
+ /** The user's camera via `navigator.mediaDevices.getUserMedia`. */
19
+ readonly WEBCAM: "webcam";
20
+ /** The surface's playing `<video>` element via `captureStream()`. */
21
+ readonly PLAYING_VIDEO: "playing-video";
22
+ /** A server-rendered world surface (e.g. the Step-Into-Video / Helios
23
+ * canvas) via `captureStream()`. */
24
+ readonly SERVER_RENDER: "server-render";
25
+ };
26
+ export type VisionSourceKind = (typeof VISION_SOURCE_KINDS)[keyof typeof VISION_SOURCE_KINDS];
27
+ /**
28
+ * An element whose `captureStream()` output can feed the publisher.
29
+ * `HTMLVideoElement.captureStream` / `HTMLCanvasElement.captureStream`
30
+ * aren't in every lib.dom version, so the controller duck-checks at
31
+ * runtime rather than widening global types (same pattern as the watch
32
+ * hook this lifts).
33
+ */
34
+ export type VisionCaptureElement = HTMLVideoElement | HTMLCanvasElement;
35
+ /** Webcam source: the controller calls `getUserMedia(constraints ?? { video: true })`. */
36
+ export interface WebcamSourceDescriptor {
37
+ kind: typeof VISION_SOURCE_KINDS.WEBCAM;
38
+ /** Optional getUserMedia constraints; defaults to `{ video: true }`
39
+ * (byte-parity with today's chat-ws webcam path). */
40
+ constraints?: MediaStreamConstraints;
41
+ }
42
+ /**
43
+ * Element-backed source (`playing-video` / `server-render`): the
44
+ * controller calls `element.captureStream()`. The DOM element stays a
45
+ * call-site concern — the descriptor carries it so the controller never
46
+ * queries the document.
47
+ */
48
+ export interface ElementSourceDescriptor {
49
+ kind: typeof VISION_SOURCE_KINDS.PLAYING_VIDEO | typeof VISION_SOURCE_KINDS.SERVER_RENDER;
50
+ element: VisionCaptureElement;
51
+ /**
52
+ * When true and the element is a `<video>` that hasn't decoded its
53
+ * first frame yet (`readyState < HAVE_CURRENT_DATA`), the controller
54
+ * waits for `loadeddata` before capturing — without this gate a fast
55
+ * toggle-on publishes a black frame (the watch-page guard, lifted
56
+ * verbatim). Ignored for canvas elements (no readyState).
57
+ */
58
+ waitForFrame?: boolean;
59
+ }
60
+ /**
61
+ * Tagged union describing where the published track comes from, without
62
+ * the controller knowing about the page. Discriminate on `kind`.
63
+ */
64
+ export type VisionSourceDescriptor = WebcamSourceDescriptor | ElementSourceDescriptor;
65
+ //# sourceMappingURL=sourceKinds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceKinds.d.ts","sourceRoot":"","sources":["../../src/vision/sourceKinds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,wEAAwE;AACxE,eAAO,MAAM,mBAAmB;IAC9B,mEAAmE;;IAEnE,qEAAqE;;IAErE;wCACoC;;CAE5B,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAC1B,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAExE,0FAA0F;AAC1F,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,OAAO,mBAAmB,CAAC,MAAM,CAAC;IACxC;yDACqD;IACrD,WAAW,CAAC,EAAE,sBAAsB,CAAC;CACtC;AAED;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EACA,OAAO,mBAAmB,CAAC,aAAa,GACxC,OAAO,mBAAmB,CAAC,aAAa,CAAC;IAC7C,OAAO,EAAE,oBAAoB,CAAC;IAC9B;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAC9B,sBAAsB,GACtB,uBAAuB,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Vision source kinds + descriptors — the single source of truth for the
3
+ * three local vision sources a surface can point the VLM at.
4
+ *
5
+ * R3a of the Platform Experience Restructure
6
+ * (`specs/platform-experience-restructure-phase-R3-vision-source-picker.md`).
7
+ * The `VisionSourceController` consumes these; the React adapter (R3b) and
8
+ * the `/chat-ws` + `/watch` surfaces (R3c/R3d) pick among them. Constants
9
+ * over bare literals, per CLAUDE.md — consumers compare against
10
+ * `VISION_SOURCE_KINDS.*`, never inline strings.
11
+ *
12
+ * Cross-device vision relay is explicitly deferred: every kind here is a
13
+ * LOCAL source, published over the user's own chat WebSocket exactly as
14
+ * today.
15
+ */
16
+ /** The three local vision source kinds, as a frozen constant object. */
17
+ export const VISION_SOURCE_KINDS = {
18
+ /** The user's camera via `navigator.mediaDevices.getUserMedia`. */
19
+ WEBCAM: 'webcam',
20
+ /** The surface's playing `<video>` element via `captureStream()`. */
21
+ PLAYING_VIDEO: 'playing-video',
22
+ /** A server-rendered world surface (e.g. the Step-Into-Video / Helios
23
+ * canvas) via `captureStream()`. */
24
+ SERVER_RENDER: 'server-render',
25
+ };
26
+ //# sourceMappingURL=sourceKinds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sourceKinds.js","sourceRoot":"","sources":["../../src/vision/sourceKinds.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,wEAAwE;AACxE,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,mEAAmE;IACnE,MAAM,EAAE,QAAQ;IAChB,qEAAqE;IACrE,aAAa,EAAE,eAAe;IAC9B;wCACoC;IACpC,aAAa,EAAE,eAAe;CACtB,CAAC"}