@celljs/ta-web 4.27.0 → 4.29.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 (586) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/assistant/assistant-role.d.ts +9 -4
  4. package/esm/browser/assistant/assistant-role.js +17 -5
  5. package/esm/browser/assistant/assistant-task-util.d.ts +6 -0
  6. package/esm/browser/assistant/assistant-task-util.js +12 -1
  7. package/esm/browser/assistant/assistant-thread.js +15 -2
  8. package/esm/browser/assistant/assistant-view.js +4 -1
  9. package/esm/browser/assistant/assistant.d.ts +2 -1
  10. package/esm/browser/assistant/assistant.js +9 -7
  11. package/esm/browser/assistant/call-conversing.d.ts +45 -0
  12. package/esm/browser/assistant/call-conversing.js +91 -0
  13. package/esm/browser/assistant/call-face.d.ts +13 -0
  14. package/esm/browser/assistant/call-face.js +81 -0
  15. package/esm/browser/assistant/call-keeper.d.ts +8 -4
  16. package/esm/browser/assistant/call-keeper.js +32 -11
  17. package/esm/browser/assistant/call-partnering.d.ts +37 -0
  18. package/esm/browser/assistant/call-partnering.js +79 -0
  19. package/esm/browser/assistant/call-scenes.d.ts +26 -0
  20. package/esm/browser/assistant/call-scenes.js +85 -0
  21. package/esm/browser/assistant/call-screen.d.ts +3 -0
  22. package/esm/browser/assistant/call-screen.js +15 -0
  23. package/esm/browser/assistant/mic-sense.d.ts +31 -0
  24. package/esm/browser/assistant/mic-sense.js +119 -0
  25. package/esm/browser/assistant/noise-gate.d.ts +32 -0
  26. package/esm/browser/assistant/noise-gate.js +66 -0
  27. package/esm/browser/assistant/pcm-util.d.ts +10 -0
  28. package/esm/browser/assistant/pcm-util.js +55 -0
  29. package/esm/browser/assistant/read-aloud.d.ts +2 -1
  30. package/esm/browser/assistant/realtime-voice-protocol.d.ts +84 -0
  31. package/esm/browser/assistant/realtime-voice-protocol.js +40 -0
  32. package/esm/browser/assistant/realtime-voice.d.ts +50 -62
  33. package/esm/browser/assistant/realtime-voice.js +213 -134
  34. package/esm/browser/assistant/spoken-timeline.d.ts +27 -0
  35. package/esm/browser/assistant/spoken-timeline.js +49 -0
  36. package/esm/browser/assistant/voice-call-bar.d.ts +9 -2
  37. package/esm/browser/assistant/voice-call-bar.js +81 -31
  38. package/esm/browser/assistant/voice-call-protocol.d.ts +61 -4
  39. package/esm/browser/assistant/voice-call.d.ts +16 -23
  40. package/esm/browser/assistant/voice-call.js +134 -117
  41. package/esm/browser/assistant/voice-reading.d.ts +83 -0
  42. package/esm/browser/assistant/voice-reading.js +150 -0
  43. package/esm/browser/avatar/dino-talk.d.ts +15 -0
  44. package/esm/browser/avatar/dino-talk.js +34 -0
  45. package/esm/browser/chat/chat-protocol.d.ts +2 -0
  46. package/esm/browser/chat/chat-shown.d.ts +3 -1
  47. package/esm/browser/chat/chat-shown.js +25 -3
  48. package/esm/browser/chat/chat.d.ts +5 -1
  49. package/esm/browser/chat/chat.js +32 -16
  50. package/esm/browser/components/account-menu.d.ts +6 -16
  51. package/esm/browser/components/account-menu.js +47 -101
  52. package/esm/browser/components/app-contexts.js +3 -2
  53. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  54. package/esm/browser/components/composer-box-protocol.d.ts +2 -0
  55. package/esm/browser/components/composer-box.js +20 -1
  56. package/esm/browser/components/composer-emoji.d.ts +22 -0
  57. package/esm/browser/components/composer-emoji.js +50 -0
  58. package/esm/browser/components/conversation-scroll-util.d.ts +8 -1
  59. package/esm/browser/components/conversation-scroll-util.js +21 -0
  60. package/esm/browser/components/conversation-scroll.js +10 -11
  61. package/esm/browser/components/discover-view.d.ts +4 -3
  62. package/esm/browser/components/discover-view.js +5 -4
  63. package/esm/browser/components/emoji-panel.d.ts +22 -0
  64. package/esm/browser/components/emoji-panel.js +54 -0
  65. package/esm/browser/components/gallery.js +28 -7
  66. package/esm/browser/components/host-view.d.ts +1 -1
  67. package/esm/browser/components/image-pull.d.ts +64 -0
  68. package/esm/browser/components/image-pull.js +202 -0
  69. package/esm/browser/components/kept-call-bar.js +2 -1
  70. package/esm/browser/components/lightbox.d.ts +1 -1
  71. package/esm/browser/components/lightbox.js +57 -2
  72. package/esm/browser/components/markdown.d.ts +8 -1
  73. package/esm/browser/components/markdown.js +12 -4
  74. package/esm/browser/components/me-rows.d.ts +24 -0
  75. package/esm/browser/components/me-rows.js +19 -0
  76. package/esm/browser/components/me-view.d.ts +2 -1
  77. package/esm/browser/components/me-view.js +3 -2
  78. package/esm/browser/components/message-list.js +47 -7
  79. package/esm/browser/components/message-steps.js +13 -0
  80. package/esm/browser/components/nav-places.js +1 -1
  81. package/esm/browser/components/partner-row.js +2 -1
  82. package/esm/browser/components/relay-services.d.ts +9 -3
  83. package/esm/browser/components/relay-services.js +73 -35
  84. package/esm/browser/components/session-view.js +4 -2
  85. package/esm/browser/components/settings-choices.js +3 -0
  86. package/esm/browser/components/settings-controls.d.ts +13 -0
  87. package/esm/browser/components/settings-controls.js +19 -0
  88. package/esm/browser/components/settings-more.d.ts +1 -1
  89. package/esm/browser/components/settings-more.js +28 -39
  90. package/esm/browser/components/settings-parts.d.ts +4 -2
  91. package/esm/browser/components/settings-parts.js +16 -9
  92. package/esm/browser/components/settings-view.js +2 -6
  93. package/esm/browser/components/ta-avatar.d.ts +15 -1
  94. package/esm/browser/components/ta-avatar.js +38 -5
  95. package/esm/browser/components/voice-services.js +6 -1
  96. package/esm/browser/components/web-composer.d.ts +1 -1
  97. package/esm/browser/components/web-composer.js +2 -2
  98. package/esm/browser/device/file-save.d.ts +31 -0
  99. package/esm/browser/device/file-save.js +80 -0
  100. package/esm/browser/extension/extension-view.d.ts +2 -0
  101. package/esm/browser/extension/extension-view.js +2 -0
  102. package/esm/browser/extension/web-api-call.d.ts +109 -2
  103. package/esm/browser/extension/web-api-components.d.ts +4 -0
  104. package/esm/browser/extension/web-api-contributions.d.ts +14 -14
  105. package/esm/browser/extension/web-api-desktop.d.ts +16 -1
  106. package/esm/browser/extension/web-api-desktop.js +1 -0
  107. package/esm/browser/extension/web-api-partners.d.ts +2 -0
  108. package/esm/browser/extension/web-extension-api.d.ts +8 -10
  109. package/esm/browser/extension/web-extension-code.d.ts +15 -8
  110. package/esm/browser/extension/web-extension-code.js +25 -27
  111. package/esm/browser/extension/web-extension-context.js +4 -0
  112. package/esm/browser/extension/web-extension-protocol.d.ts +10 -1
  113. package/esm/browser/extension/web-extension-protocol.js +1 -0
  114. package/esm/browser/extension/web-extension-run.d.ts +4 -2
  115. package/esm/browser/extension/web-extension-run.js +10 -4
  116. package/esm/browser/extension/web-extensions-running.js +7 -6
  117. package/esm/browser/extension/web-pages.d.ts +2 -0
  118. package/esm/browser/extension/web-pages.js +2 -0
  119. package/esm/browser/i18n/en/account.d.ts +202 -0
  120. package/esm/browser/i18n/en/account.js +205 -0
  121. package/esm/browser/i18n/en/assistant.d.ts +129 -0
  122. package/esm/browser/i18n/en/assistant.js +130 -0
  123. package/esm/browser/i18n/en/call.d.ts +86 -0
  124. package/esm/browser/i18n/en/call.js +87 -0
  125. package/esm/browser/i18n/en/chat.d.ts +213 -0
  126. package/esm/browser/i18n/en/chat.js +214 -0
  127. package/esm/browser/i18n/en/common.d.ts +99 -0
  128. package/esm/browser/i18n/en/common.js +101 -0
  129. package/esm/browser/i18n/en/console.d.ts +230 -0
  130. package/esm/browser/i18n/en/console.js +232 -0
  131. package/esm/browser/i18n/en/discover.d.ts +117 -0
  132. package/esm/browser/i18n/en/discover.js +119 -0
  133. package/esm/browser/i18n/en/service.d.ts +242 -0
  134. package/esm/browser/i18n/en/service.js +245 -0
  135. package/esm/browser/i18n/en/settings.d.ts +213 -0
  136. package/esm/browser/i18n/en/settings.js +214 -0
  137. package/esm/browser/i18n/en/tools.d.ts +85 -0
  138. package/esm/browser/i18n/en/tools.js +87 -0
  139. package/esm/browser/i18n/ja/account.d.ts +2 -0
  140. package/esm/browser/i18n/ja/account.js +202 -0
  141. package/esm/browser/i18n/ja/assistant.d.ts +2 -0
  142. package/esm/browser/i18n/ja/assistant.js +129 -0
  143. package/esm/browser/i18n/ja/call.d.ts +2 -0
  144. package/esm/browser/i18n/ja/call.js +86 -0
  145. package/esm/browser/i18n/ja/chat.d.ts +2 -0
  146. package/esm/browser/i18n/ja/chat.js +213 -0
  147. package/esm/browser/i18n/ja/common.d.ts +2 -0
  148. package/esm/browser/i18n/ja/common.js +99 -0
  149. package/esm/browser/i18n/ja/console.d.ts +2 -0
  150. package/esm/browser/i18n/ja/console.js +230 -0
  151. package/esm/browser/i18n/ja/discover.d.ts +2 -0
  152. package/esm/browser/i18n/ja/discover.js +117 -0
  153. package/esm/browser/i18n/ja/service.d.ts +2 -0
  154. package/esm/browser/i18n/ja/service.js +242 -0
  155. package/esm/browser/i18n/ja/settings.d.ts +2 -0
  156. package/esm/browser/i18n/ja/settings.js +213 -0
  157. package/esm/browser/i18n/ja/tools.d.ts +2 -0
  158. package/esm/browser/i18n/ja/tools.js +85 -0
  159. package/esm/browser/i18n/locales.d.ts +1150 -1131
  160. package/esm/browser/i18n/messages-ja.js +20 -1567
  161. package/esm/browser/i18n/messages-zh-tw.d.ts +0 -1
  162. package/esm/browser/i18n/messages-zh-tw.js +20 -1568
  163. package/esm/browser/i18n/messages.d.ts +1153 -1131
  164. package/esm/browser/i18n/messages.js +44 -3145
  165. package/esm/browser/i18n/zh/account.d.ts +2 -0
  166. package/esm/browser/i18n/zh/account.js +203 -0
  167. package/esm/browser/i18n/zh/assistant.d.ts +2 -0
  168. package/esm/browser/i18n/zh/assistant.js +129 -0
  169. package/esm/browser/i18n/zh/call.d.ts +2 -0
  170. package/esm/browser/i18n/zh/call.js +86 -0
  171. package/esm/browser/i18n/zh/chat.d.ts +2 -0
  172. package/esm/browser/i18n/zh/chat.js +213 -0
  173. package/esm/browser/i18n/zh/common.d.ts +2 -0
  174. package/esm/browser/i18n/zh/common.js +99 -0
  175. package/esm/browser/i18n/zh/console.d.ts +2 -0
  176. package/esm/browser/i18n/zh/console.js +230 -0
  177. package/esm/browser/i18n/zh/discover.d.ts +2 -0
  178. package/esm/browser/i18n/zh/discover.js +117 -0
  179. package/esm/browser/i18n/zh/service.d.ts +2 -0
  180. package/esm/browser/i18n/zh/service.js +242 -0
  181. package/esm/browser/i18n/zh/settings.d.ts +2 -0
  182. package/esm/browser/i18n/zh/settings.js +213 -0
  183. package/esm/browser/i18n/zh/tools.d.ts +2 -0
  184. package/esm/browser/i18n/zh/tools.js +86 -0
  185. package/esm/browser/i18n/zh-tw/account.d.ts +2 -0
  186. package/esm/browser/i18n/zh-tw/account.js +202 -0
  187. package/esm/browser/i18n/zh-tw/assistant.d.ts +2 -0
  188. package/esm/browser/i18n/zh-tw/assistant.js +129 -0
  189. package/esm/browser/i18n/zh-tw/call.d.ts +2 -0
  190. package/esm/browser/i18n/zh-tw/call.js +86 -0
  191. package/esm/browser/i18n/zh-tw/chat.d.ts +2 -0
  192. package/esm/browser/i18n/zh-tw/chat.js +213 -0
  193. package/esm/browser/i18n/zh-tw/common.d.ts +2 -0
  194. package/esm/browser/i18n/zh-tw/common.js +99 -0
  195. package/esm/browser/i18n/zh-tw/console.d.ts +2 -0
  196. package/esm/browser/i18n/zh-tw/console.js +230 -0
  197. package/esm/browser/i18n/zh-tw/discover.d.ts +2 -0
  198. package/esm/browser/i18n/zh-tw/discover.js +117 -0
  199. package/esm/browser/i18n/zh-tw/service.d.ts +2 -0
  200. package/esm/browser/i18n/zh-tw/service.js +242 -0
  201. package/esm/browser/i18n/zh-tw/settings.d.ts +2 -0
  202. package/esm/browser/i18n/zh-tw/settings.js +213 -0
  203. package/esm/browser/i18n/zh-tw/tools.d.ts +2 -0
  204. package/esm/browser/i18n/zh-tw/tools.js +85 -0
  205. package/esm/browser/markdown/code-renderers.d.ts +2 -0
  206. package/esm/browser/markdown/code-renderers.js +2 -0
  207. package/esm/browser/offline/device-values.d.ts +4 -0
  208. package/esm/browser/offline/device-values.js +10 -0
  209. package/esm/browser/pwa/page-build.d.ts +15 -0
  210. package/esm/browser/pwa/page-build.js +45 -0
  211. package/esm/browser/screen/page-answers.d.ts +2 -1
  212. package/esm/browser/screen/page-answers.js +7 -4
  213. package/esm/browser/settings/settings-protocol.d.ts +4 -0
  214. package/esm/browser/settings/settings-protocol.js +4 -0
  215. package/esm/browser/style/base.d.ts +1 -1
  216. package/esm/browser/style/base.js +3 -0
  217. package/esm/browser/style/chat-list.d.ts +1 -1
  218. package/esm/browser/style/chat-list.js +1 -1
  219. package/esm/browser/style/conversation-column.d.ts +1 -1
  220. package/esm/browser/style/conversation-column.js +17 -0
  221. package/esm/browser/style/conversation.d.ts +1 -1
  222. package/esm/browser/style/conversation.js +11 -1
  223. package/esm/browser/style/device.js +1 -0
  224. package/esm/browser/style/dialogs.d.ts +1 -1
  225. package/esm/browser/style/dialogs.js +1 -1
  226. package/esm/browser/style/layout.d.ts +1 -1
  227. package/esm/browser/style/layout.js +135 -57
  228. package/esm/browser/style/pages.d.ts +1 -1
  229. package/esm/browser/style/pages.js +0 -7
  230. package/esm/browser/style/shell.d.ts +1 -1
  231. package/esm/browser/style/shell.js +8 -0
  232. package/esm/browser/style/video-call.d.ts +2 -0
  233. package/esm/browser/style/video-call.js +63 -0
  234. package/esm/browser/style.js +2 -0
  235. package/esm/browser/util/call-transcript.d.ts +16 -0
  236. package/esm/browser/util/call-transcript.js +110 -0
  237. package/esm/browser/util/desktop.d.ts +10 -1
  238. package/esm/browser/util/desktop.js +10 -0
  239. package/esm/browser/util/image-pull.d.ts +61 -0
  240. package/esm/browser/util/image-pull.js +88 -0
  241. package/esm/browser/util/process.d.ts +6 -0
  242. package/esm/browser/util/process.js +18 -5
  243. package/esm/browser/util/spoken.d.ts +3 -3
  244. package/esm/browser/util/spoken.js +4 -4
  245. package/esm/browser/video-call/call-camera.d.ts +59 -0
  246. package/esm/browser/video-call/call-camera.js +188 -0
  247. package/esm/browser/video-call/call-people.d.ts +21 -0
  248. package/esm/browser/video-call/call-people.js +29 -0
  249. package/esm/browser/video-call/call-window.d.ts +19 -0
  250. package/esm/browser/video-call/call-window.js +80 -0
  251. package/esm/browser/video-call/clip-plan.d.ts +56 -0
  252. package/esm/browser/video-call/clip-plan.js +76 -0
  253. package/esm/browser/video-call/face-camera.d.ts +93 -0
  254. package/esm/browser/video-call/face-camera.js +192 -0
  255. package/esm/browser/video-call/face-files.d.ts +69 -0
  256. package/esm/browser/video-call/face-files.js +132 -0
  257. package/esm/browser/video-call/face-moves.d.ts +68 -0
  258. package/esm/browser/video-call/face-moves.js +180 -0
  259. package/esm/browser/video-call/face-stage.d.ts +139 -0
  260. package/esm/browser/video-call/face-stage.js +219 -0
  261. package/esm/browser/video-call/mouth-layer.d.ts +81 -0
  262. package/esm/browser/video-call/mouth-layer.js +241 -0
  263. package/esm/browser/video-call/video-call-view.d.ts +19 -0
  264. package/esm/browser/video-call/video-call-view.js +254 -0
  265. package/esm/browser/video-call/video-face.d.ts +19 -0
  266. package/esm/browser/video-call/video-face.js +471 -0
  267. package/esm/browser/workbench-hosts.d.ts +1 -0
  268. package/esm/browser/workbench-protocol.d.ts +2 -0
  269. package/esm/browser/workbench-util.d.ts +5 -0
  270. package/esm/browser/workbench-util.js +18 -0
  271. package/esm/browser/workbench.d.ts +14 -0
  272. package/esm/browser/workbench.js +73 -6
  273. package/lib/browser/assistant/assistant-role.d.ts +9 -4
  274. package/lib/browser/assistant/assistant-role.js +17 -5
  275. package/lib/browser/assistant/assistant-task-util.d.ts +6 -0
  276. package/lib/browser/assistant/assistant-task-util.js +11 -0
  277. package/lib/browser/assistant/assistant-thread.js +15 -2
  278. package/lib/browser/assistant/assistant-view.js +3 -0
  279. package/lib/browser/assistant/assistant.d.ts +2 -1
  280. package/lib/browser/assistant/assistant.js +9 -7
  281. package/lib/browser/assistant/call-conversing.d.ts +46 -0
  282. package/lib/browser/assistant/call-conversing.js +96 -0
  283. package/lib/browser/assistant/call-face.d.ts +14 -0
  284. package/lib/browser/assistant/call-face.js +117 -0
  285. package/lib/browser/assistant/call-keeper.d.ts +8 -4
  286. package/lib/browser/assistant/call-keeper.js +32 -11
  287. package/lib/browser/assistant/call-partnering.d.ts +38 -0
  288. package/lib/browser/assistant/call-partnering.js +83 -0
  289. package/lib/browser/assistant/call-scenes.d.ts +27 -0
  290. package/lib/browser/assistant/call-scenes.js +88 -0
  291. package/lib/browser/assistant/call-screen.d.ts +3 -0
  292. package/lib/browser/assistant/call-screen.js +15 -0
  293. package/lib/browser/assistant/mic-sense.d.ts +32 -0
  294. package/lib/browser/assistant/mic-sense.js +123 -0
  295. package/lib/browser/assistant/noise-gate.d.ts +33 -0
  296. package/lib/browser/assistant/noise-gate.js +71 -0
  297. package/lib/browser/assistant/pcm-util.d.ts +11 -0
  298. package/lib/browser/assistant/pcm-util.js +58 -0
  299. package/lib/browser/assistant/read-aloud.d.ts +2 -1
  300. package/lib/browser/assistant/realtime-voice-protocol.d.ts +85 -0
  301. package/lib/browser/assistant/realtime-voice-protocol.js +43 -0
  302. package/lib/browser/assistant/realtime-voice.d.ts +50 -62
  303. package/lib/browser/assistant/realtime-voice.js +217 -138
  304. package/lib/browser/assistant/spoken-timeline.d.ts +28 -0
  305. package/lib/browser/assistant/spoken-timeline.js +53 -0
  306. package/lib/browser/assistant/voice-call-bar.d.ts +9 -2
  307. package/lib/browser/assistant/voice-call-bar.js +81 -30
  308. package/lib/browser/assistant/voice-call-protocol.d.ts +61 -4
  309. package/lib/browser/assistant/voice-call.d.ts +16 -23
  310. package/lib/browser/assistant/voice-call.js +134 -117
  311. package/lib/browser/assistant/voice-reading.d.ts +84 -0
  312. package/lib/browser/assistant/voice-reading.js +156 -0
  313. package/lib/browser/avatar/dino-talk.d.ts +16 -0
  314. package/lib/browser/avatar/dino-talk.js +37 -0
  315. package/lib/browser/chat/chat-protocol.d.ts +2 -0
  316. package/lib/browser/chat/chat-shown.d.ts +3 -1
  317. package/lib/browser/chat/chat-shown.js +25 -3
  318. package/lib/browser/chat/chat.d.ts +5 -1
  319. package/lib/browser/chat/chat.js +32 -16
  320. package/lib/browser/components/account-menu.d.ts +6 -16
  321. package/lib/browser/components/account-menu.js +45 -99
  322. package/lib/browser/components/app-contexts.js +2 -1
  323. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  324. package/lib/browser/components/composer-box-protocol.d.ts +2 -0
  325. package/lib/browser/components/composer-box.js +20 -1
  326. package/lib/browser/components/composer-emoji.d.ts +23 -0
  327. package/lib/browser/components/composer-emoji.js +87 -0
  328. package/lib/browser/components/conversation-scroll-util.d.ts +8 -1
  329. package/lib/browser/components/conversation-scroll-util.js +21 -0
  330. package/lib/browser/components/conversation-scroll.js +10 -11
  331. package/lib/browser/components/discover-view.d.ts +4 -3
  332. package/lib/browser/components/discover-view.js +5 -4
  333. package/lib/browser/components/emoji-panel.d.ts +23 -0
  334. package/lib/browser/components/emoji-panel.js +90 -0
  335. package/lib/browser/components/gallery.js +28 -7
  336. package/lib/browser/components/host-view.d.ts +1 -1
  337. package/lib/browser/components/image-pull.d.ts +65 -0
  338. package/lib/browser/components/image-pull.js +206 -0
  339. package/lib/browser/components/kept-call-bar.js +2 -1
  340. package/lib/browser/components/lightbox.d.ts +1 -1
  341. package/lib/browser/components/lightbox.js +57 -2
  342. package/lib/browser/components/markdown.d.ts +8 -1
  343. package/lib/browser/components/markdown.js +11 -3
  344. package/lib/browser/components/me-rows.d.ts +25 -0
  345. package/lib/browser/components/me-rows.js +22 -0
  346. package/lib/browser/components/me-view.d.ts +2 -1
  347. package/lib/browser/components/me-view.js +3 -2
  348. package/lib/browser/components/message-list.js +46 -6
  349. package/lib/browser/components/message-steps.js +13 -0
  350. package/lib/browser/components/nav-places.js +1 -1
  351. package/lib/browser/components/partner-row.js +2 -1
  352. package/lib/browser/components/relay-services.d.ts +9 -3
  353. package/lib/browser/components/relay-services.js +71 -33
  354. package/lib/browser/components/session-view.js +3 -1
  355. package/lib/browser/components/settings-choices.js +3 -0
  356. package/lib/browser/components/settings-controls.d.ts +13 -0
  357. package/lib/browser/components/settings-controls.js +19 -0
  358. package/lib/browser/components/settings-more.d.ts +1 -1
  359. package/lib/browser/components/settings-more.js +27 -38
  360. package/lib/browser/components/settings-parts.d.ts +4 -2
  361. package/lib/browser/components/settings-parts.js +15 -8
  362. package/lib/browser/components/settings-view.js +2 -6
  363. package/lib/browser/components/ta-avatar.d.ts +15 -1
  364. package/lib/browser/components/ta-avatar.js +38 -5
  365. package/lib/browser/components/voice-services.js +5 -0
  366. package/lib/browser/components/web-composer.d.ts +1 -1
  367. package/lib/browser/components/web-composer.js +2 -2
  368. package/lib/browser/device/file-save.d.ts +32 -0
  369. package/lib/browser/device/file-save.js +83 -0
  370. package/lib/browser/extension/extension-view.d.ts +2 -0
  371. package/lib/browser/extension/extension-view.js +3 -1
  372. package/lib/browser/extension/web-api-call.d.ts +109 -2
  373. package/lib/browser/extension/web-api-components.d.ts +4 -0
  374. package/lib/browser/extension/web-api-contributions.d.ts +14 -14
  375. package/lib/browser/extension/web-api-desktop.d.ts +16 -1
  376. package/lib/browser/extension/web-api-desktop.js +1 -0
  377. package/lib/browser/extension/web-api-partners.d.ts +2 -0
  378. package/lib/browser/extension/web-extension-api.d.ts +8 -10
  379. package/lib/browser/extension/web-extension-code.d.ts +15 -8
  380. package/lib/browser/extension/web-extension-code.js +25 -27
  381. package/lib/browser/extension/web-extension-context.js +4 -0
  382. package/lib/browser/extension/web-extension-protocol.d.ts +10 -1
  383. package/lib/browser/extension/web-extension-protocol.js +1 -0
  384. package/lib/browser/extension/web-extension-run.d.ts +4 -2
  385. package/lib/browser/extension/web-extension-run.js +10 -4
  386. package/lib/browser/extension/web-extensions-running.js +7 -6
  387. package/lib/browser/extension/web-pages.d.ts +2 -0
  388. package/lib/browser/extension/web-pages.js +2 -0
  389. package/lib/browser/i18n/en/account.d.ts +203 -0
  390. package/lib/browser/i18n/en/account.js +208 -0
  391. package/lib/browser/i18n/en/assistant.d.ts +130 -0
  392. package/lib/browser/i18n/en/assistant.js +133 -0
  393. package/lib/browser/i18n/en/call.d.ts +87 -0
  394. package/lib/browser/i18n/en/call.js +90 -0
  395. package/lib/browser/i18n/en/chat.d.ts +214 -0
  396. package/lib/browser/i18n/en/chat.js +217 -0
  397. package/lib/browser/i18n/en/common.d.ts +100 -0
  398. package/lib/browser/i18n/en/common.js +104 -0
  399. package/lib/browser/i18n/en/console.d.ts +231 -0
  400. package/lib/browser/i18n/en/console.js +235 -0
  401. package/lib/browser/i18n/en/discover.d.ts +118 -0
  402. package/lib/browser/i18n/en/discover.js +122 -0
  403. package/lib/browser/i18n/en/service.d.ts +243 -0
  404. package/lib/browser/i18n/en/service.js +248 -0
  405. package/lib/browser/i18n/en/settings.d.ts +214 -0
  406. package/lib/browser/i18n/en/settings.js +217 -0
  407. package/lib/browser/i18n/en/tools.d.ts +86 -0
  408. package/lib/browser/i18n/en/tools.js +90 -0
  409. package/lib/browser/i18n/ja/account.d.ts +3 -0
  410. package/lib/browser/i18n/ja/account.js +205 -0
  411. package/lib/browser/i18n/ja/assistant.d.ts +3 -0
  412. package/lib/browser/i18n/ja/assistant.js +132 -0
  413. package/lib/browser/i18n/ja/call.d.ts +3 -0
  414. package/lib/browser/i18n/ja/call.js +89 -0
  415. package/lib/browser/i18n/ja/chat.d.ts +3 -0
  416. package/lib/browser/i18n/ja/chat.js +216 -0
  417. package/lib/browser/i18n/ja/common.d.ts +3 -0
  418. package/lib/browser/i18n/ja/common.js +102 -0
  419. package/lib/browser/i18n/ja/console.d.ts +3 -0
  420. package/lib/browser/i18n/ja/console.js +233 -0
  421. package/lib/browser/i18n/ja/discover.d.ts +3 -0
  422. package/lib/browser/i18n/ja/discover.js +120 -0
  423. package/lib/browser/i18n/ja/service.d.ts +3 -0
  424. package/lib/browser/i18n/ja/service.js +245 -0
  425. package/lib/browser/i18n/ja/settings.d.ts +3 -0
  426. package/lib/browser/i18n/ja/settings.js +216 -0
  427. package/lib/browser/i18n/ja/tools.d.ts +3 -0
  428. package/lib/browser/i18n/ja/tools.js +88 -0
  429. package/lib/browser/i18n/locales.d.ts +1150 -1131
  430. package/lib/browser/i18n/messages-ja.js +20 -1567
  431. package/lib/browser/i18n/messages-zh-tw.d.ts +0 -1
  432. package/lib/browser/i18n/messages-zh-tw.js +20 -1568
  433. package/lib/browser/i18n/messages.d.ts +1153 -1131
  434. package/lib/browser/i18n/messages.js +44 -3145
  435. package/lib/browser/i18n/zh/account.d.ts +3 -0
  436. package/lib/browser/i18n/zh/account.js +206 -0
  437. package/lib/browser/i18n/zh/assistant.d.ts +3 -0
  438. package/lib/browser/i18n/zh/assistant.js +132 -0
  439. package/lib/browser/i18n/zh/call.d.ts +3 -0
  440. package/lib/browser/i18n/zh/call.js +89 -0
  441. package/lib/browser/i18n/zh/chat.d.ts +3 -0
  442. package/lib/browser/i18n/zh/chat.js +216 -0
  443. package/lib/browser/i18n/zh/common.d.ts +3 -0
  444. package/lib/browser/i18n/zh/common.js +102 -0
  445. package/lib/browser/i18n/zh/console.d.ts +3 -0
  446. package/lib/browser/i18n/zh/console.js +233 -0
  447. package/lib/browser/i18n/zh/discover.d.ts +3 -0
  448. package/lib/browser/i18n/zh/discover.js +120 -0
  449. package/lib/browser/i18n/zh/service.d.ts +3 -0
  450. package/lib/browser/i18n/zh/service.js +245 -0
  451. package/lib/browser/i18n/zh/settings.d.ts +3 -0
  452. package/lib/browser/i18n/zh/settings.js +216 -0
  453. package/lib/browser/i18n/zh/tools.d.ts +3 -0
  454. package/lib/browser/i18n/zh/tools.js +89 -0
  455. package/lib/browser/i18n/zh-tw/account.d.ts +3 -0
  456. package/lib/browser/i18n/zh-tw/account.js +205 -0
  457. package/lib/browser/i18n/zh-tw/assistant.d.ts +3 -0
  458. package/lib/browser/i18n/zh-tw/assistant.js +132 -0
  459. package/lib/browser/i18n/zh-tw/call.d.ts +3 -0
  460. package/lib/browser/i18n/zh-tw/call.js +89 -0
  461. package/lib/browser/i18n/zh-tw/chat.d.ts +3 -0
  462. package/lib/browser/i18n/zh-tw/chat.js +216 -0
  463. package/lib/browser/i18n/zh-tw/common.d.ts +3 -0
  464. package/lib/browser/i18n/zh-tw/common.js +102 -0
  465. package/lib/browser/i18n/zh-tw/console.d.ts +3 -0
  466. package/lib/browser/i18n/zh-tw/console.js +233 -0
  467. package/lib/browser/i18n/zh-tw/discover.d.ts +3 -0
  468. package/lib/browser/i18n/zh-tw/discover.js +120 -0
  469. package/lib/browser/i18n/zh-tw/service.d.ts +3 -0
  470. package/lib/browser/i18n/zh-tw/service.js +245 -0
  471. package/lib/browser/i18n/zh-tw/settings.d.ts +3 -0
  472. package/lib/browser/i18n/zh-tw/settings.js +216 -0
  473. package/lib/browser/i18n/zh-tw/tools.d.ts +3 -0
  474. package/lib/browser/i18n/zh-tw/tools.js +88 -0
  475. package/lib/browser/markdown/code-renderers.d.ts +2 -0
  476. package/lib/browser/markdown/code-renderers.js +3 -1
  477. package/lib/browser/offline/device-values.d.ts +4 -0
  478. package/lib/browser/offline/device-values.js +10 -0
  479. package/lib/browser/pwa/page-build.d.ts +16 -0
  480. package/lib/browser/pwa/page-build.js +48 -0
  481. package/lib/browser/screen/page-answers.d.ts +2 -1
  482. package/lib/browser/screen/page-answers.js +7 -4
  483. package/lib/browser/settings/settings-protocol.d.ts +4 -0
  484. package/lib/browser/settings/settings-protocol.js +4 -0
  485. package/lib/browser/style/base.d.ts +1 -1
  486. package/lib/browser/style/base.js +3 -0
  487. package/lib/browser/style/chat-list.d.ts +1 -1
  488. package/lib/browser/style/chat-list.js +1 -1
  489. package/lib/browser/style/conversation-column.d.ts +1 -1
  490. package/lib/browser/style/conversation-column.js +17 -0
  491. package/lib/browser/style/conversation.d.ts +1 -1
  492. package/lib/browser/style/conversation.js +11 -1
  493. package/lib/browser/style/device.js +1 -0
  494. package/lib/browser/style/dialogs.d.ts +1 -1
  495. package/lib/browser/style/dialogs.js +1 -1
  496. package/lib/browser/style/layout.d.ts +1 -1
  497. package/lib/browser/style/layout.js +135 -57
  498. package/lib/browser/style/pages.d.ts +1 -1
  499. package/lib/browser/style/pages.js +0 -7
  500. package/lib/browser/style/shell.d.ts +1 -1
  501. package/lib/browser/style/shell.js +8 -0
  502. package/lib/browser/style/video-call.d.ts +3 -0
  503. package/lib/browser/style/video-call.js +66 -0
  504. package/lib/browser/style.js +2 -0
  505. package/lib/browser/util/call-transcript.d.ts +17 -0
  506. package/lib/browser/util/call-transcript.js +113 -0
  507. package/lib/browser/util/desktop.d.ts +10 -1
  508. package/lib/browser/util/desktop.js +10 -0
  509. package/lib/browser/util/image-pull.d.ts +62 -0
  510. package/lib/browser/util/image-pull.js +91 -0
  511. package/lib/browser/util/process.d.ts +6 -0
  512. package/lib/browser/util/process.js +17 -4
  513. package/lib/browser/util/spoken.d.ts +3 -3
  514. package/lib/browser/util/spoken.js +4 -4
  515. package/lib/browser/video-call/call-camera.d.ts +60 -0
  516. package/lib/browser/video-call/call-camera.js +192 -0
  517. package/lib/browser/video-call/call-people.d.ts +22 -0
  518. package/lib/browser/video-call/call-people.js +32 -0
  519. package/lib/browser/video-call/call-window.d.ts +20 -0
  520. package/lib/browser/video-call/call-window.js +83 -0
  521. package/lib/browser/video-call/clip-plan.d.ts +57 -0
  522. package/lib/browser/video-call/clip-plan.js +80 -0
  523. package/lib/browser/video-call/face-camera.d.ts +94 -0
  524. package/lib/browser/video-call/face-camera.js +197 -0
  525. package/lib/browser/video-call/face-files.d.ts +70 -0
  526. package/lib/browser/video-call/face-files.js +137 -0
  527. package/lib/browser/video-call/face-moves.d.ts +69 -0
  528. package/lib/browser/video-call/face-moves.js +184 -0
  529. package/lib/browser/video-call/face-stage.d.ts +140 -0
  530. package/lib/browser/video-call/face-stage.js +223 -0
  531. package/lib/browser/video-call/mouth-layer.d.ts +82 -0
  532. package/lib/browser/video-call/mouth-layer.js +245 -0
  533. package/lib/browser/video-call/video-call-view.d.ts +20 -0
  534. package/lib/browser/video-call/video-call-view.js +290 -0
  535. package/lib/browser/video-call/video-face.d.ts +20 -0
  536. package/lib/browser/video-call/video-face.js +507 -0
  537. package/lib/browser/workbench-hosts.d.ts +1 -0
  538. package/lib/browser/workbench-protocol.d.ts +2 -0
  539. package/lib/browser/workbench-util.d.ts +5 -0
  540. package/lib/browser/workbench-util.js +18 -0
  541. package/lib/browser/workbench.d.ts +14 -0
  542. package/lib/browser/workbench.js +71 -4
  543. package/package.json +7 -7
  544. package/public/faces/README.md +40 -0
  545. package/public/faces/blonde/clap.mp4 +0 -0
  546. package/public/faces/blonde/dance.mp4 +0 -0
  547. package/public/faces/blonde/face.jpg +0 -0
  548. package/public/faces/blonde/happy.mp4 +0 -0
  549. package/public/faces/blonde/heart.mp4 +0 -0
  550. package/public/faces/blonde/idle-1.mp4 +0 -0
  551. package/public/faces/blonde/idle-2.mp4 +0 -0
  552. package/public/faces/blonde/idle-3.mp4 +0 -0
  553. package/public/faces/blonde/laugh.mp4 +0 -0
  554. package/public/faces/blonde/listening.mp4 +0 -0
  555. package/public/faces/blonde/poster.jpg +0 -0
  556. package/public/faces/blonde/shy.mp4 +0 -0
  557. package/public/faces/blonde/sorry.mp4 +0 -0
  558. package/public/faces/blonde/stretch.mp4 +0 -0
  559. package/public/faces/blonde/surprised.mp4 +0 -0
  560. package/public/faces/blonde/talk-1.mp4 +0 -0
  561. package/public/faces/blonde/talk-2.mp4 +0 -0
  562. package/public/faces/blonde/think-2.mp4 +0 -0
  563. package/public/faces/blonde/thinking.mp4 +0 -0
  564. package/public/faces/blonde/wave.mp4 +0 -0
  565. package/public/faces/clap.mp4 +0 -0
  566. package/public/faces/dance.mp4 +0 -0
  567. package/public/faces/face.jpg +0 -0
  568. package/public/faces/framing.json +1 -0
  569. package/public/faces/happy.mp4 +0 -0
  570. package/public/faces/heart.mp4 +0 -0
  571. package/public/faces/idle-1.mp4 +0 -0
  572. package/public/faces/idle-2.mp4 +0 -0
  573. package/public/faces/idle-3.mp4 +0 -0
  574. package/public/faces/laugh.mp4 +0 -0
  575. package/public/faces/lips.json +1 -0
  576. package/public/faces/listening.mp4 +0 -0
  577. package/public/faces/poster.jpg +0 -0
  578. package/public/faces/shy.mp4 +0 -0
  579. package/public/faces/sorry.mp4 +0 -0
  580. package/public/faces/stretch.mp4 +0 -0
  581. package/public/faces/surprised.mp4 +0 -0
  582. package/public/faces/talk-1.mp4 +0 -0
  583. package/public/faces/talk-2.mp4 +0 -0
  584. package/public/faces/think-2.mp4 +0 -0
  585. package/public/faces/thinking.mp4 +0 -0
  586. package/public/faces/wave.mp4 +0 -0
@@ -0,0 +1,471 @@
1
+ import * as React from 'react';
2
+ import { CallScenes } from '../assistant/call-scenes.js';
3
+ import { useWebExtensions } from '../hooks.js';
4
+ import { TurnEnd } from '../util/turn-end.js';
5
+ import { CallPeople } from './call-people.js';
6
+ import { CLIP_FPS, ClipPlan, ClipSync } from './clip-plan.js';
7
+ import { FaceCameras } from './face-camera.js';
8
+ import { FaceFiles } from './face-files.js';
9
+ import { FaceMoves } from './face-moves.js';
10
+ import { FaceBlend, FaceStage, SEAM_MS } from './face-stage.js';
11
+ import { MouthLayer } from './mouth-layer.js';
12
+ /** How long a move she said she would make (a dance) may wait for her to listen, in ms: then it is let go. */
13
+ const COMING_MS = 20000;
14
+ /** How fast she goes back to rest from a move (a heart, a dance), as the call goes on: faster than this looked hurried. */
15
+ const HURRY_RATE = 1.5;
16
+ /** How long the sound may not go on before the clip holds still too, in ms (the clock of sound moves in steps). */
17
+ const STILL_MS = 120;
18
+ /** The frames of a clip when faces/lips.json does not say (5 s and a sixth at 24 fps). */
19
+ const FRAMES = 124;
20
+ /** How long before a clip ends the next is chosen and loaded behind it, in seconds. */
21
+ const AHEAD_S = 1;
22
+ /**
23
+ * The person of a video call (docs/design/ta-call.md 12, 15, 16): two layers of video (FaceStage), the next clip decoded
24
+ * behind and fading in over the one shown once its first frame is on the screen. What plays is decided in one place,
25
+ * each frame: as Ta reads with a voice service, the clip its ClipPlan has for that moment of the sound, the mouth an
26
+ * extension draws for it laid over it (MouthLayer); otherwise the clips of the state of the call, and the moves of
27
+ * what she says (FaceMoves, the user's own first). Each layer shows the part of its clip its camera aims at
28
+ * (FaceCameras): her face close as she sits, all of her as she stands up and moves.
29
+ */
30
+ export function VideoFace({ call, person = '', clear = 0, onReady, onFailed, }) {
31
+ var _a;
32
+ var _b;
33
+ const layers = [React.useRef(null), React.useRef(null)];
34
+ const box = React.useRef(null);
35
+ const canvas = React.useRef(null);
36
+ const [{ callMouth, callMoves }] = useWebExtensions();
37
+ const mouth = React.useRef(callMouth);
38
+ mouth.current = callMouth;
39
+ const sources = React.useRef(callMoves);
40
+ sources.current = callMoves;
41
+ const clearing = React.useRef(clear);
42
+ clearing.current = clear;
43
+ // biome-ignore lint/correctness/useExhaustiveDependencies: the layers are refs, set up once a call
44
+ React.useEffect(() => {
45
+ var _a;
46
+ var _b, _c;
47
+ const doc = (_b = (_a = box.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) !== null && _b !== void 0 ? _b : document;
48
+ const view = (_c = doc.defaultView) !== null && _c !== void 0 ? _c : window;
49
+ const videos = layers.map(layer => layer.current).filter((video) => !!video);
50
+ if (videos.length !== 2) {
51
+ return;
52
+ }
53
+ let gone = false;
54
+ let ready = false;
55
+ let started = false;
56
+ const faces = FaceFiles.of(doc, CallPeople.dir(person));
57
+ const book = new FaceMoves();
58
+ const stage = new FaceStage(videos, clip => faces.clip(clip), () => view.performance.now(), {
59
+ shown: () => {
60
+ if (!ready) {
61
+ ready = true;
62
+ onReady();
63
+ }
64
+ },
65
+ failed: (clip, error) => { var _a; return fail(clip, String((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : error)); },
66
+ });
67
+ const playing = () => {
68
+ const { video, clip } = stage.playing();
69
+ return { video: video, clip };
70
+ };
71
+ const cameras = new FaceCameras(faces, videos, box.current, () => clearing.current);
72
+ const frames = (clip) => { var _a; return (_a = faces.frames(clip)) !== null && _a !== void 0 ? _a : FRAMES; };
73
+ // The state whose clips play, or the move that plays, and the clip asked for last.
74
+ let loop;
75
+ let move;
76
+ let last;
77
+ // Whether the clip of the move is over.
78
+ let moveDone = false;
79
+ // The sentences of this answer whose move played, by the plan of a reading or by what she says: each plays once,
80
+ // though the sentence is still the one heard as the reading ends. Forgotten as Ta thinks of the next answer.
81
+ const moved = new Set();
82
+ // What she said she would do (FaceMoves.after), and the sentence that said it: it plays once she listens.
83
+ let coming;
84
+ let comingFor;
85
+ let comingAt = 0;
86
+ // The reading whose plan shows the move playing, and whether she listened since it began (wentOn).
87
+ let plannedSay;
88
+ let settled = false;
89
+ /** A move plays, not over yet: it plays to its end, unless the call goes on (hurrying). */
90
+ const moving = () => !!move && !moveDone;
91
+ /**
92
+ * The user says something: words, not a sound alone ("嗯") nor a word of the echo of her voice, which the
93
+ * service hears now and then and never makes a turn of.
94
+ */
95
+ const userSpoke = () => {
96
+ const heard = call.state.heard;
97
+ return TurnEnd.words(heard) >= 2 && !TurnEnd.sounds(heard);
98
+ };
99
+ /**
100
+ * The call went on since the move began: the user speaks, or Ta speaks again after she listened. Not Ta thinking
101
+ * of news of the work, which it often answers with nothing.
102
+ */
103
+ const wentOn = () => {
104
+ if (userSpoke()) {
105
+ return true;
106
+ }
107
+ if (call.state.phase === 'speaking') {
108
+ return settled;
109
+ }
110
+ settled = true;
111
+ return false;
112
+ };
113
+ // The next clip of a state, chosen as the clip shown nears its end and loaded behind it.
114
+ let upcoming;
115
+ const words = () => {
116
+ const reading = call.state.reading;
117
+ return reading === null || reading === void 0 ? void 0 : reading.pieces[reading.at];
118
+ };
119
+ /** A reading of a voice service waits to begin (its hold): what plays goes on until its sound does. */
120
+ const holding = () => {
121
+ const reading = call.sounds.nowReading();
122
+ return !!reading && !call.state.paused && call.state.phase === 'speaking' && reading.now() < 0;
123
+ };
124
+ /** What should play now; undefined to go on with what plays. */
125
+ const wanted = () => {
126
+ const plain = FaceMoves.kind(call.state.phase, !!call.state.paused);
127
+ if (plain === 'listening') {
128
+ // What she said she would do, once she said it; then it plays to its end, unless Ta thinks or speaks.
129
+ if (coming) {
130
+ return coming;
131
+ }
132
+ return moving() ? move : plain;
133
+ }
134
+ if (plain !== 'speaking') {
135
+ return plain;
136
+ }
137
+ if (holding()) {
138
+ return undefined;
139
+ }
140
+ if (moving() && (move === null || move === void 0 ? void 0 : move.when) === 'say') {
141
+ return move;
142
+ }
143
+ // The move a sentence asks for, else its look, as she says it (FaceMoves.said).
144
+ const said = words();
145
+ const look = book.said(said);
146
+ return look && said !== undefined && !moved.has(said) ? look : 'speaking';
147
+ };
148
+ /** How long `clip` from `at` fades in over what shows: short at a seam, longer the farther her pose. */
149
+ const blend = (clip, at) => {
150
+ var _a, _b;
151
+ const { video, clip: from } = playing();
152
+ if (!from || !ready) {
153
+ return SEAM_MS;
154
+ }
155
+ const frame = Math.round(video.currentTime * CLIP_FPS);
156
+ const to = Math.round(at * CLIP_FPS);
157
+ const seam = FaceBlend.seated(frame, frames(from)) && FaceBlend.seated(to, frames(clip));
158
+ return FaceBlend.ms((_a = faces.boxes(from)) === null || _a === void 0 ? void 0 : _a[Math.min(frame, frames(from) - 1)], (_b = faces.boxes(clip)) === null || _b === void 0 ? void 0 : _b[to], seam);
159
+ };
160
+ const show = (clip, at = 0) => {
161
+ last = clip;
162
+ stage.show(clip, at, blend(clip, at));
163
+ };
164
+ const play = (next) => {
165
+ var _a;
166
+ if (typeof next === 'string') {
167
+ plannedSay = undefined;
168
+ move = undefined;
169
+ loop = next;
170
+ // Never the clip asked for last: asked again, the stage keeps it as it is, and one that ended stays still.
171
+ const clip = (upcoming === null || upcoming === void 0 ? void 0 : upcoming.loop) === next && upcoming.clip !== stage.wanted ? upcoming.clip : book.loop(next, (_a = stage.wanted) !== null && _a !== void 0 ? _a : last);
172
+ upcoming = undefined;
173
+ show(clip);
174
+ return;
175
+ }
176
+ if (next !== move) {
177
+ const said = words();
178
+ if (said !== undefined) {
179
+ moved.add(said);
180
+ }
181
+ moveDone = false;
182
+ settled = false;
183
+ }
184
+ plannedSay = undefined;
185
+ if (next === coming) {
186
+ coming = undefined;
187
+ }
188
+ move = next;
189
+ loop = undefined;
190
+ upcoming = undefined;
191
+ show(next.clip);
192
+ };
193
+ /** A clip could not play: one of the user's gives way to Ta's own, and the extension that gave it is told why. */
194
+ const fail = (clip, reason) => {
195
+ var _a;
196
+ var _b;
197
+ if (!book.fail(clip, reason)) {
198
+ if (!ready) {
199
+ onFailed();
200
+ }
201
+ return false;
202
+ }
203
+ const name = clip.slice(clip.indexOf(':') + 1);
204
+ for (const source of sources.current) {
205
+ (_a = source.failed) === null || _a === void 0 ? void 0 : _a.call(source, name, reason);
206
+ }
207
+ CallScenes.show(call, { moves: book.told() });
208
+ move = undefined;
209
+ loop = undefined;
210
+ upcoming = undefined;
211
+ play((_b = wanted()) !== null && _b !== void 0 ? _b : FaceMoves.kind(call.state.phase, !!call.state.paused));
212
+ return true;
213
+ };
214
+ // The plans of the readings, by their say: which clip shows at each moment of their sound.
215
+ const plans = new Map();
216
+ const planOf = (say) => {
217
+ let plan = plans.get(say);
218
+ if (!plan) {
219
+ const used = new Set();
220
+ const of = () => {
221
+ const reading = call.sounds.nowReading();
222
+ return (reading === null || reading === void 0 ? void 0 : reading.say) === say ? reading : undefined;
223
+ };
224
+ plan = new ClipPlan(frames, (seconds, before) => book.at(of(), seconds, before !== null && before !== void 0 ? before : last, used), seconds => book.cue(of(), seconds, used), clip => !!book.of(clip));
225
+ plans.set(say, plan);
226
+ for (const old of plans.keys()) {
227
+ if (old < say - 1) {
228
+ plans.delete(old);
229
+ }
230
+ }
231
+ }
232
+ return plan;
233
+ };
234
+ /** The reading that drives the face now: one of a voice service, playing, while Ta speaks. */
235
+ const driving = () => {
236
+ const reading = call.sounds.nowReading();
237
+ return reading && !call.state.paused && call.state.phase === 'speaking' && reading.now() >= 0 ? reading : undefined;
238
+ };
239
+ const ended = (event) => {
240
+ var _a, _b;
241
+ if (event.target !== playing().video) {
242
+ return;
243
+ }
244
+ if (move) {
245
+ moveDone = true;
246
+ }
247
+ if (!driving()) {
248
+ play((_b = (_a = wanted()) !== null && _a !== void 0 ? _a : loop) !== null && _b !== void 0 ? _b : 'listening');
249
+ }
250
+ };
251
+ /**
252
+ * A move plays on its own, past the sentence that named it (a heart takes its time, a dance is 10 s), true while
253
+ * it does: to its end, which is her at rest again. When the call goes on (the user speaks, Ta speaks again) she
254
+ * hurries there rather than the clip cutting away: from a dance or a stretch she first goes to where she sits
255
+ * down again (ClipFraming.back, faded into as any change of clip), then fast. While the plan of the reading that
256
+ * named it shows it, the plan keeps it on the clock of the sound instead.
257
+ */
258
+ const hurrying = () => {
259
+ var _a, _b;
260
+ const { video, clip } = playing();
261
+ if (!moving() || !move || clip !== move.clip || video.ended) {
262
+ return false;
263
+ }
264
+ if (plannedSay !== undefined && ((_a = driving()) === null || _a === void 0 ? void 0 : _a.say) === plannedSay) {
265
+ return false;
266
+ }
267
+ if (call.state.paused !== video.paused) {
268
+ void (call.state.paused ? video.pause() : video.play().catch(() => undefined));
269
+ }
270
+ if (!wentOn()) {
271
+ video.playbackRate = 1;
272
+ return true;
273
+ }
274
+ const back = move.when === 'after' ? (_b = faces.framing(move.clip)) === null || _b === void 0 ? void 0 : _b.back : undefined;
275
+ if (back !== undefined && video.currentTime < back) {
276
+ if (stage.wanted === move.clip && !stage.jumping(back)) {
277
+ stage.show(move.clip, back, blend(move.clip, back), true);
278
+ }
279
+ return true;
280
+ }
281
+ video.playbackRate = HURRY_RATE;
282
+ return true;
283
+ };
284
+ /** What plays, by the state of the call and what she says: asked each frame, so that one place decides. */
285
+ const decide = () => {
286
+ var _a, _b;
287
+ if (call.state.phase === 'thinking') {
288
+ moved.clear();
289
+ }
290
+ const said = call.state.phase === 'speaking' ? words() : undefined;
291
+ const then = book.after(said);
292
+ if (then && said !== comingFor) {
293
+ comingFor = said;
294
+ coming = then;
295
+ comingAt = Date.now();
296
+ }
297
+ // The user spoke before she stood up, or it waited too long: what she said she would do is let go.
298
+ if (coming && (userSpoke() || Date.now() - comingAt > COMING_MS)) {
299
+ coming = undefined;
300
+ }
301
+ if (!started || hurrying() || driving()) {
302
+ return;
303
+ }
304
+ const next = wanted();
305
+ if (next !== undefined && next !== (move !== null && move !== void 0 ? move : loop)) {
306
+ play(next);
307
+ }
308
+ const { video, clip } = playing();
309
+ // What plays ended and nothing comes after it (an end missed): the next clip, rather than a picture held still.
310
+ if (clip && video.ended && stage.wanted === clip && !stage.busy()) {
311
+ if (move) {
312
+ moveDone = true;
313
+ }
314
+ play((_b = (_a = wanted()) !== null && _a !== void 0 ? _a : loop) !== null && _b !== void 0 ? _b : 'listening');
315
+ return;
316
+ }
317
+ // The clip after this one, chosen and decoded behind it as it nears its end: it comes in at once. Only once
318
+ // the clip asked for is the one that plays: chosen while it loads, it would be of the clip before.
319
+ if (clip && clip === stage.wanted && !upcoming && video.duration - video.currentTime < AHEAD_S) {
320
+ const after = FaceMoves.kind(call.state.phase, !!call.state.paused);
321
+ upcoming = { loop: after, clip: book.loop(after, clip) };
322
+ stage.prime(upcoming.clip);
323
+ }
324
+ // Paused (the page hidden), it holds still; it moves again as the call does.
325
+ if (call.state.paused && !video.paused) {
326
+ video.pause();
327
+ }
328
+ else if (!call.state.paused && video.paused && ready && clip && !video.ended) {
329
+ void video.play().catch(() => undefined);
330
+ }
331
+ };
332
+ const failed = (event) => {
333
+ const clip = event.target.dataset.clip;
334
+ if (!clip || !fail(clip, 'decode')) {
335
+ if (!ready) {
336
+ onFailed();
337
+ }
338
+ }
339
+ };
340
+ for (const video of videos) {
341
+ video.addEventListener('ended', ended);
342
+ video.addEventListener('error', failed);
343
+ }
344
+ // The clips as they are now (faces/README.md) and the user's own; then the face moves, and Ta knows its moves.
345
+ void (async () => {
346
+ var _a;
347
+ await faces.ready;
348
+ // The user's moves are made from the first person's picture (@celljs/ta-moves): hers alone.
349
+ const lists = faces.person ? [] : await Promise.all(sources.current.map(source => source.moves().catch(() => [])));
350
+ const own = lists.flat();
351
+ for (const given of own) {
352
+ faces.add(FaceMoves.ownClip(given.name), given);
353
+ }
354
+ book.use(own);
355
+ if (gone) {
356
+ return;
357
+ }
358
+ started = true;
359
+ CallScenes.show(call, { moves: book.told() });
360
+ play((_a = wanted()) !== null && _a !== void 0 ? _a : 'listening');
361
+ })();
362
+ const layer = new MouthLayer(call, planOf, canvas.current, view, faces, (video, width) => cameras.place(video, width), () => {
363
+ const reading = driving();
364
+ const { video, clip } = playing();
365
+ const under = stage.under();
366
+ return reading && clip ? { reading, video, clip, under: under && { video: under.video, alpha: under.alpha } } : undefined;
367
+ });
368
+ void layer.open(mouth.current);
369
+ layer.watch(videos);
370
+ // Each frame: the fade goes on, the cameras aim, what plays is decided; as Ta reads, the clip of the moment of
371
+ // the sound, kept on its clock, and the mouth drawn for it.
372
+ let held;
373
+ let heldAt = 0;
374
+ let frame = view.requestAnimationFrame(function tick(time) {
375
+ if (gone) {
376
+ return;
377
+ }
378
+ frame = view.requestAnimationFrame(tick);
379
+ stage.frame();
380
+ cameras.frame(time, stage.names);
381
+ decide();
382
+ const reading = driving();
383
+ // The reading that drives the clip now, for checks of the call (and anyone curious).
384
+ const drives = reading ? String(reading.say) : '';
385
+ if (box.current && box.current.dataset.reading !== drives) {
386
+ box.current.dataset.reading = drives;
387
+ }
388
+ if (!reading) {
389
+ layer.clear();
390
+ held = undefined;
391
+ if (!hurrying()) {
392
+ for (const video of videos) {
393
+ video.playbackRate = 1;
394
+ }
395
+ }
396
+ return;
397
+ }
398
+ if (!started) {
399
+ return;
400
+ }
401
+ const seconds = reading.now();
402
+ if (hurrying()) {
403
+ layer.follow(reading, seconds);
404
+ return;
405
+ }
406
+ const plan = planOf(reading.say);
407
+ const at = plan.at(seconds);
408
+ const { video, clip } = playing();
409
+ if (stage.wanted !== at.clip) {
410
+ // A move of the plan (FaceMoves.at): it plays whole, past the end of the reading.
411
+ const next = book.of(at.clip);
412
+ if (next && next !== move) {
413
+ // The sentences heard up to now: the move is of one of them (FaceMoves.at looks back), none plays again.
414
+ for (let k = reading.pieceAt(seconds); k >= 0; k--) {
415
+ moved.add(reading.pieces[k]);
416
+ }
417
+ moveDone = false;
418
+ settled = false;
419
+ }
420
+ move = next;
421
+ loop = next ? undefined : 'speaking';
422
+ plannedSay = reading.say;
423
+ show(at.clip, at.frame / CLIP_FPS);
424
+ }
425
+ else if (clip === at.clip) {
426
+ // The sound stopped short (what comes next is late): she holds still until it goes on.
427
+ const time = view.performance.now();
428
+ if (seconds !== held) {
429
+ held = seconds;
430
+ heldAt = time;
431
+ }
432
+ const still = time - heldAt > STILL_MS;
433
+ if (still !== video.paused) {
434
+ void (still ? video.pause() : video.play().catch(() => undefined));
435
+ }
436
+ const sync = ClipSync.step(at.frame / CLIP_FPS, video.currentTime);
437
+ // Never a seek while the clip fades in (it would show a frame of before as it decodes): it catches up.
438
+ if (sync.seek !== undefined && !stage.under()) {
439
+ video.currentTime = sync.seek;
440
+ }
441
+ video.playbackRate = sync.seek !== undefined && stage.under() ? 1.25 : sync.rate;
442
+ }
443
+ // The clip that comes next in the plan, decoded behind ahead of its moment.
444
+ const ahead = plan.at(seconds + AHEAD_S);
445
+ if (ahead.clip !== at.clip) {
446
+ stage.prime(ahead.clip);
447
+ }
448
+ layer.follow(reading, seconds);
449
+ });
450
+ return () => {
451
+ gone = true;
452
+ stage.close();
453
+ view.cancelAnimationFrame(frame);
454
+ cameras.close();
455
+ layer.close();
456
+ for (const video of videos) {
457
+ video.removeEventListener('ended', ended);
458
+ video.removeEventListener('error', failed);
459
+ video.pause();
460
+ video.removeAttribute('src');
461
+ video.load();
462
+ }
463
+ };
464
+ }, [call, person]);
465
+ const poster = FaceFiles.poster((_b = (_a = box.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) !== null && _b !== void 0 ? _b : document, CallPeople.dir(person));
466
+ return (React.createElement("div", { ref: box, className: "ta-video-clips" },
467
+ React.createElement("img", { className: "ta-video-backdrop", src: poster, alt: "", "aria-hidden": true, draggable: false }),
468
+ layers.map((layer, index) => (React.createElement("video", { key: index, ref: layer, className: "ta-video-clip", poster: poster, muted: true, playsInline: true, preload: "auto", disablePictureInPicture: true }))),
469
+ React.createElement("canvas", { ref: canvas, className: "ta-video-mouth" })));
470
+ }
471
+ //# sourceMappingURL=video-face.js.map
@@ -41,6 +41,7 @@ export declare abstract class WorkbenchHosts extends WorkbenchLists {
41
41
  protected abstract open(credential: Credential): {
42
42
  connection: TaConnection;
43
43
  refused(): Promise<boolean>;
44
+ direct?(server: TaServerInfo): void;
44
45
  };
45
46
  abstract signOut(): void;
46
47
  }
@@ -88,6 +88,8 @@ export interface WorkbenchPages {
88
88
  readonly agent: boolean;
89
89
  /** Answers `kind` (`<package>/<kind>`, `ta/<kind>`) from now on; the function returned stops. */
90
90
  answer(kind: string, handler: (payload: unknown) => unknown): () => void;
91
+ /** The device the page runs on, as it lays itself out (setDevice). */
92
+ readonly device: 'phone' | 'tablet' | 'computer';
91
93
  setDevice(device: 'phone' | 'tablet' | 'computer'): void;
92
94
  }
93
95
  export interface TaWorkbench {
@@ -60,6 +60,11 @@ export declare namespace WorkbenchUtil {
60
60
  function reachable(base: string, fetcher?: typeof fetch): Promise<boolean>;
61
61
  /** The hosts kept in `storage`; the token or pairing an older version kept becomes the first. */
62
62
  function readHosts(storage: Storage | undefined, now?: number): HostList;
63
+ /**
64
+ * A pairing with the ways to its computer that computer told (TaServerInfo.relays), the same credential when they did not
65
+ * change or it told none (a ta serve of before), or it is no pairing.
66
+ */
67
+ function routed(credential: Credential, relays: readonly string[] | undefined): Credential;
63
68
  /** Which ta serve a credential reaches, to know whose lists were kept: that of the page (`host`) for a token alone. */
64
69
  function serverOf(credential: Credential, host: string): string;
65
70
  /** Where the ta serve of a token answers: its own address, or that of the page. */
@@ -131,6 +131,24 @@ export var WorkbenchUtil;
131
131
  return credential ? HostUtil.use({ hosts: [] }, serverOf(credential, pageHost()), credential, now) : { hosts: [] };
132
132
  }
133
133
  WorkbenchUtil.readHosts = readHosts;
134
+ /**
135
+ * A pairing with the ways to its computer that computer told (TaServerInfo.relays), the same credential when they did not
136
+ * change or it told none (a ta serve of before), or it is no pairing.
137
+ */
138
+ function routed(credential, relays) {
139
+ if (!('pairing' in credential) || !Array.isArray(relays)) {
140
+ return credential;
141
+ }
142
+ const told = RelayPairingUtil.routes(relays);
143
+ const before = RelayPairingUtil.routes(credential.pairing.relays);
144
+ if (told.join(' ') === before.join(' ')) {
145
+ return credential;
146
+ }
147
+ const { relays: _before, ...pairing } = credential.pairing;
148
+ // Its own relay alone is what a pairing without ways does.
149
+ return { pairing: told.length && told.join(' ') !== pairing.relay ? { ...pairing, relays: told } : pairing };
150
+ }
151
+ WorkbenchUtil.routed = routed;
134
152
  /** Which ta serve a credential reaches, to know whose lists were kept: that of the page (`host`) for a token alone. */
135
153
  function serverOf(credential, host) {
136
154
  if ('pairing' in credential) {
@@ -1,10 +1,13 @@
1
1
  import { TaConnection } from '@celljs/ta-client';
2
+ import { type TaServerInfo } from '@celljs/ta-protocol';
3
+ import { TaCallKeeper } from './assistant/call-keeper.js';
2
4
  import { PresenceReporter } from './presence/presence-reporter.js';
3
5
  import { PageAnswers } from './screen/page-answers.js';
4
6
  import { WorkbenchCalls } from './workbench-calls.js';
5
7
  import { WorkbenchHosts } from './workbench-hosts.js';
6
8
  import { type Credential, TaWorkbench, type WorkbenchState } from './workbench-protocol.js';
7
9
  export declare class TaWorkbenchImpl extends WorkbenchHosts implements TaWorkbench {
10
+ protected readonly callKeeper?: TaCallKeeper;
8
11
  /** Signed out from the first frame when nothing is there to sign in with: the sign-in, not the app for a moment before it. */
9
12
  protected current: WorkbenchState;
10
13
  /** On the connection of the time, only while it is open: what it was at goes again once it opens (resend). */
@@ -12,6 +15,10 @@ export declare class TaWorkbenchImpl extends WorkbenchHosts implements TaWorkben
12
15
  /** What ta serve may ask this page, and what it is told of the page (docs/design/ta-app-use.md 4.1). */
13
16
  readonly pages: PageAnswers;
14
17
  protected retryTimer?: ReturnType<typeof setTimeout>;
18
+ /** By computer, what it said a direct connection to it takes (TaServerInfo.direct), for the connections of later. */
19
+ protected readonly directs: Map<string, {
20
+ stun: string[];
21
+ }>;
15
22
  /** A restart asked for: whether a build was installed over the one running, and whether its connection closed yet. */
16
23
  protected restart?: {
17
24
  update: boolean;
@@ -59,6 +66,7 @@ export declare class TaWorkbenchImpl extends WorkbenchHosts implements TaWorkben
59
66
  protected open(credential: Credential): {
60
67
  connection: TaConnection;
61
68
  refused(): Promise<boolean>;
69
+ direct?(server: TaServerInfo): void;
62
70
  };
63
71
  /**
64
72
  * Back to the sign-in, loaded again: what the page holds of the computer (the double's and the open
@@ -76,6 +84,12 @@ export declare class TaWorkbenchImpl extends WorkbenchHosts implements TaWorkben
76
84
  * page was not seen gets its grace from now.
77
85
  */
78
86
  protected watchWake(): void;
87
+ /**
88
+ * The page is of another build than ta serve serves now (PageBuild): it loads again, once no call goes on (the
89
+ * window of a video call is drawn by this page, and would go on with the scripts of before). Not the app, which
90
+ * carries the page it was built with.
91
+ */
92
+ protected checkPage(): Promise<void>;
79
93
  /** Whether another build of Ta was installed since (TaServerInfo.update), read while the page is seen. */
80
94
  protected checkUpdate(): Promise<void>;
81
95
  protected update(change: Partial<WorkbenchState>): void;