@celljs/ta-web 4.9.0 → 4.10.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 (376) hide show
  1. package/README.en.md +4 -3
  2. package/README.md +4 -3
  3. package/esm/browser/assistant/assistant-chat-list.js +8 -2
  4. package/esm/browser/assistant/assistant-extension.d.ts +8 -1
  5. package/esm/browser/assistant/assistant-extension.js +33 -5
  6. package/esm/browser/assistant/assistant-protocol.d.ts +3 -1
  7. package/esm/browser/assistant/assistant-task-source.d.ts +2 -0
  8. package/esm/browser/assistant/assistant-task-source.js +2 -0
  9. package/esm/browser/assistant/assistant-task-util.d.ts +8 -0
  10. package/esm/browser/assistant/assistant-task-util.js +13 -3
  11. package/esm/browser/assistant/assistant-tasks.js +3 -2
  12. package/esm/browser/assistant/assistant-view.js +81 -56
  13. package/esm/browser/assistant/assistant.d.ts +30 -1
  14. package/esm/browser/assistant/assistant.js +89 -6
  15. package/esm/browser/assistant/task-views.d.ts +40 -6
  16. package/esm/browser/assistant/task-views.js +73 -21
  17. package/esm/browser/avatar/dino-avatar.d.ts +3 -4
  18. package/esm/browser/avatar/dino-avatar.js +4 -178
  19. package/esm/browser/avatar/dino-face.d.ts +19 -0
  20. package/esm/browser/avatar/dino-face.js +142 -0
  21. package/esm/browser/avatar/dino-geometry.d.ts +11 -0
  22. package/esm/browser/avatar/dino-geometry.js +38 -0
  23. package/esm/browser/avatar/dino-kinds.d.ts +15 -0
  24. package/esm/browser/avatar/dino-kinds.js +544 -0
  25. package/esm/browser/avatar/dino-motion.js +1 -1
  26. package/esm/browser/avatar/dino-shape.d.ts +80 -0
  27. package/esm/browser/avatar/dino-shape.js +113 -0
  28. package/esm/browser/avatar/dino-species.d.ts +1 -61
  29. package/esm/browser/avatar/dino-species.js +2 -653
  30. package/esm/browser/chat/chat-packages.d.ts +39 -0
  31. package/esm/browser/chat/chat-packages.js +70 -0
  32. package/esm/browser/chat/chat-protocol.d.ts +23 -1
  33. package/esm/browser/chat/chat-stores.d.ts +59 -0
  34. package/esm/browser/chat/chat-stores.js +121 -0
  35. package/esm/browser/chat/chat-util.d.ts +17 -0
  36. package/esm/browser/chat/chat-util.js +61 -0
  37. package/esm/browser/chat/chat-view.js +33 -12
  38. package/esm/browser/chat/chat.d.ts +31 -39
  39. package/esm/browser/chat/chat.js +226 -175
  40. package/esm/browser/components/access-view.js +1 -1
  41. package/esm/browser/components/account-menu.js +1 -1
  42. package/esm/browser/components/app-nav.d.ts +6 -3
  43. package/esm/browser/components/app-nav.js +19 -10
  44. package/esm/browser/components/app-shell-hooks.d.ts +47 -0
  45. package/esm/browser/components/app-shell-hooks.js +169 -0
  46. package/esm/browser/components/app-view.js +81 -172
  47. package/esm/browser/components/auth-view.js +1 -1
  48. package/esm/browser/components/chat-list.d.ts +20 -2
  49. package/esm/browser/components/chat-list.js +138 -22
  50. package/esm/browser/components/composer-box.d.ts +5 -5
  51. package/esm/browser/components/composer-box.js +111 -4
  52. package/esm/browser/components/composer.d.ts +7 -0
  53. package/esm/browser/components/composer.js +22 -14
  54. package/esm/browser/components/connection-bar.js +50 -17
  55. package/esm/browser/components/context-menu.d.ts +30 -4
  56. package/esm/browser/components/context-menu.js +199 -37
  57. package/esm/browser/components/conversation-scroll.d.ts +129 -6
  58. package/esm/browser/components/conversation-scroll.js +429 -109
  59. package/esm/browser/components/dino.js +1 -1
  60. package/esm/browser/components/earlier-messages.d.ts +2 -1
  61. package/esm/browser/components/earlier-messages.js +2 -17
  62. package/esm/browser/components/editor-area.d.ts +3 -1
  63. package/esm/browser/components/editor-area.js +6 -5
  64. package/esm/browser/components/empty-pictures.d.ts +0 -2
  65. package/esm/browser/components/empty-pictures.js +0 -16
  66. package/esm/browser/components/folder-picker.d.ts +5 -2
  67. package/esm/browser/components/folder-picker.js +30 -9
  68. package/esm/browser/components/held-talk.d.ts +28 -0
  69. package/esm/browser/components/held-talk.js +76 -0
  70. package/esm/browser/components/host-view.d.ts +1 -1
  71. package/esm/browser/components/host-view.js +1 -1
  72. package/esm/browser/components/icon.d.ts +2 -2
  73. package/esm/browser/components/icon.js +5 -6
  74. package/esm/browser/components/image-viewer.d.ts +124 -0
  75. package/esm/browser/components/image-viewer.js +397 -0
  76. package/esm/browser/components/lightbox.d.ts +11 -0
  77. package/esm/browser/components/lightbox.js +24 -0
  78. package/esm/browser/components/markdown.d.ts +6 -2
  79. package/esm/browser/components/markdown.js +24 -10
  80. package/esm/browser/components/media.js +1 -10
  81. package/esm/browser/components/message-footer.d.ts +16 -2
  82. package/esm/browser/components/message-footer.js +29 -12
  83. package/esm/browser/components/message-list.d.ts +24 -3
  84. package/esm/browser/components/message-list.js +149 -20
  85. package/esm/browser/components/message-menu.d.ts +3 -1
  86. package/esm/browser/components/message-menu.js +18 -3
  87. package/esm/browser/components/nav-places.d.ts +16 -1
  88. package/esm/browser/components/nav-places.js +12 -3
  89. package/esm/browser/components/phone-shell.d.ts +4 -1
  90. package/esm/browser/components/phone-shell.js +3 -1
  91. package/esm/browser/components/run-status.js +3 -3
  92. package/esm/browser/components/select-bar.d.ts +9 -0
  93. package/esm/browser/components/select-bar.js +24 -0
  94. package/esm/browser/components/session-settings.d.ts +6 -0
  95. package/esm/browser/components/session-settings.js +14 -1
  96. package/esm/browser/components/session-view.js +8 -4
  97. package/esm/browser/components/settings-choices.d.ts +35 -0
  98. package/esm/browser/components/settings-choices.js +117 -0
  99. package/esm/browser/components/settings-parts.d.ts +21 -0
  100. package/esm/browser/components/settings-parts.js +323 -0
  101. package/esm/browser/components/settings-view.d.ts +0 -6
  102. package/esm/browser/components/settings-view.js +4 -406
  103. package/esm/browser/components/swipe-row.d.ts +2 -2
  104. package/esm/browser/components/swipe-row.js +7 -3
  105. package/esm/browser/components/tool-view.js +14 -12
  106. package/esm/browser/components/voice-button.d.ts +1 -1
  107. package/esm/browser/components/voice-button.js +1 -1
  108. package/esm/browser/components/voice-talk.d.ts +43 -0
  109. package/esm/browser/components/voice-talk.js +222 -0
  110. package/esm/browser/components/workbench-view.js +1 -1
  111. package/esm/browser/device/device.d.ts +3 -0
  112. package/esm/browser/device/device.js +11 -1
  113. package/esm/browser/device/hold.d.ts +42 -0
  114. package/esm/browser/device/hold.js +136 -0
  115. package/esm/browser/device/launch-screen.d.ts +1 -1
  116. package/esm/browser/device/launch-screen.js +1 -1
  117. package/esm/browser/device/long-press.d.ts +2 -0
  118. package/esm/browser/device/long-press.js +16 -1
  119. package/esm/browser/device/pull-down.d.ts +4 -2
  120. package/esm/browser/device/pull-down.js +64 -76
  121. package/esm/browser/device/row-swipe.d.ts +35 -10
  122. package/esm/browser/device/row-swipe.js +149 -71
  123. package/esm/browser/device/shake-undo.d.ts +16 -0
  124. package/esm/browser/device/shake-undo.js +59 -0
  125. package/esm/browser/device/sheet-swipe.d.ts +118 -18
  126. package/esm/browser/device/sheet-swipe.js +406 -107
  127. package/esm/browser/extension/icons.js +2 -1
  128. package/esm/browser/extension/web-extension-api.d.ts +135 -2
  129. package/esm/browser/extension/web-extension-code.d.ts +6 -0
  130. package/esm/browser/extension/web-extension-code.js +24 -0
  131. package/esm/browser/extension/web-extension-protocol.d.ts +23 -1
  132. package/esm/browser/extension/web-extension-protocol.js +8 -0
  133. package/esm/browser/extension/web-extensions.d.ts +14 -1
  134. package/esm/browser/extension/web-extensions.js +128 -24
  135. package/esm/browser/extension/web-tasks.d.ts +9 -1
  136. package/esm/browser/extension/web-tasks.js +24 -0
  137. package/esm/browser/files/files-protocol.d.ts +25 -0
  138. package/esm/browser/files/files-protocol.js +2 -0
  139. package/esm/browser/files/files.d.ts +35 -0
  140. package/esm/browser/files/files.js +119 -0
  141. package/esm/browser/hooks.d.ts +3 -1
  142. package/esm/browser/hooks.js +8 -0
  143. package/esm/browser/i18n/locales.d.ts +29 -2
  144. package/esm/browser/i18n/messages.d.ts +28 -1
  145. package/esm/browser/i18n/messages.js +58 -4
  146. package/esm/browser/index.d.ts +6 -0
  147. package/esm/browser/index.js +6 -0
  148. package/esm/browser/notices/notices-protocol.d.ts +9 -1
  149. package/esm/browser/notices/notices.d.ts +2 -0
  150. package/esm/browser/notices/notices.js +20 -10
  151. package/esm/browser/offline/device-values.d.ts +55 -0
  152. package/esm/browser/offline/device-values.js +142 -0
  153. package/esm/browser/offline/kept-chats-protocol.d.ts +17 -0
  154. package/esm/browser/offline/kept-chats-protocol.js +2 -0
  155. package/esm/browser/offline/kept-chats.d.ts +47 -0
  156. package/esm/browser/offline/kept-chats.js +146 -0
  157. package/esm/browser/offline/offline-reads.d.ts +44 -0
  158. package/esm/browser/offline/offline-reads.js +107 -0
  159. package/esm/browser/settings/settings-protocol.d.ts +2 -0
  160. package/esm/browser/settings/settings-protocol.js +2 -0
  161. package/esm/browser/style/conversation.d.ts +1 -1
  162. package/esm/browser/style/conversation.js +57 -17
  163. package/esm/browser/style/device.js +43 -4
  164. package/esm/browser/style/layout.d.ts +1 -1
  165. package/esm/browser/style/layout.js +67 -15
  166. package/esm/browser/style/pages.d.ts +1 -1
  167. package/esm/browser/style/pages.js +2 -1
  168. package/esm/browser/style/shell.d.ts +1 -1
  169. package/esm/browser/style/shell.js +47 -3
  170. package/esm/browser/style/tasks.d.ts +1 -1
  171. package/esm/browser/style/tasks.js +2 -0
  172. package/esm/browser/util/frame.d.ts +5 -4
  173. package/esm/browser/util/frame.js +5 -4
  174. package/esm/browser/util/markdown.d.ts +18 -1
  175. package/esm/browser/util/markdown.js +119 -5
  176. package/esm/browser/util/process.d.ts +21 -0
  177. package/esm/browser/util/process.js +45 -1
  178. package/esm/browser/util/voice.d.ts +5 -2
  179. package/esm/browser/util/voice.js +6 -3
  180. package/esm/browser/util/zoom.d.ts +46 -0
  181. package/esm/browser/util/zoom.js +96 -0
  182. package/esm/browser/workbench-calls.d.ts +59 -0
  183. package/esm/browser/workbench-calls.js +141 -0
  184. package/esm/browser/workbench-protocol.d.ts +5 -1
  185. package/esm/browser/workbench-util.d.ts +68 -0
  186. package/esm/browser/workbench-util.js +145 -0
  187. package/esm/browser/workbench.d.ts +15 -42
  188. package/esm/browser/workbench.js +53 -167
  189. package/lib/browser/assistant/assistant-chat-list.js +8 -2
  190. package/lib/browser/assistant/assistant-extension.d.ts +8 -1
  191. package/lib/browser/assistant/assistant-extension.js +33 -5
  192. package/lib/browser/assistant/assistant-protocol.d.ts +3 -1
  193. package/lib/browser/assistant/assistant-task-source.d.ts +2 -0
  194. package/lib/browser/assistant/assistant-task-source.js +2 -0
  195. package/lib/browser/assistant/assistant-task-util.d.ts +8 -0
  196. package/lib/browser/assistant/assistant-task-util.js +13 -3
  197. package/lib/browser/assistant/assistant-tasks.js +2 -1
  198. package/lib/browser/assistant/assistant-view.js +78 -53
  199. package/lib/browser/assistant/assistant.d.ts +30 -1
  200. package/lib/browser/assistant/assistant.js +89 -6
  201. package/lib/browser/assistant/task-views.d.ts +40 -6
  202. package/lib/browser/assistant/task-views.js +74 -21
  203. package/lib/browser/avatar/dino-avatar.d.ts +3 -4
  204. package/lib/browser/avatar/dino-avatar.js +27 -202
  205. package/lib/browser/avatar/dino-face.d.ts +20 -0
  206. package/lib/browser/avatar/dino-face.js +148 -0
  207. package/lib/browser/avatar/dino-geometry.d.ts +12 -0
  208. package/lib/browser/avatar/dino-geometry.js +47 -0
  209. package/lib/browser/avatar/dino-kinds.d.ts +16 -0
  210. package/lib/browser/avatar/dino-kinds.js +547 -0
  211. package/lib/browser/avatar/dino-motion.js +2 -2
  212. package/lib/browser/avatar/dino-shape.d.ts +81 -0
  213. package/lib/browser/avatar/dino-shape.js +126 -0
  214. package/lib/browser/avatar/dino-species.d.ts +1 -61
  215. package/lib/browser/avatar/dino-species.js +34 -687
  216. package/lib/browser/chat/chat-packages.d.ts +40 -0
  217. package/lib/browser/chat/chat-packages.js +74 -0
  218. package/lib/browser/chat/chat-protocol.d.ts +23 -1
  219. package/lib/browser/chat/chat-stores.d.ts +60 -0
  220. package/lib/browser/chat/chat-stores.js +125 -0
  221. package/lib/browser/chat/chat-util.d.ts +18 -0
  222. package/lib/browser/chat/chat-util.js +64 -0
  223. package/lib/browser/chat/chat-view.js +33 -12
  224. package/lib/browser/chat/chat.d.ts +31 -39
  225. package/lib/browser/chat/chat.js +227 -176
  226. package/lib/browser/components/access-view.js +2 -2
  227. package/lib/browser/components/account-menu.js +2 -2
  228. package/lib/browser/components/app-nav.d.ts +6 -3
  229. package/lib/browser/components/app-nav.js +17 -8
  230. package/lib/browser/components/app-shell-hooks.d.ts +48 -0
  231. package/lib/browser/components/app-shell-hooks.js +211 -0
  232. package/lib/browser/components/app-view.js +89 -180
  233. package/lib/browser/components/auth-view.js +3 -3
  234. package/lib/browser/components/chat-list.d.ts +20 -2
  235. package/lib/browser/components/chat-list.js +137 -21
  236. package/lib/browser/components/composer-box.d.ts +5 -5
  237. package/lib/browser/components/composer-box.js +111 -4
  238. package/lib/browser/components/composer.d.ts +7 -0
  239. package/lib/browser/components/composer.js +22 -14
  240. package/lib/browser/components/connection-bar.js +48 -15
  241. package/lib/browser/components/context-menu.d.ts +30 -4
  242. package/lib/browser/components/context-menu.js +198 -36
  243. package/lib/browser/components/conversation-scroll.d.ts +129 -6
  244. package/lib/browser/components/conversation-scroll.js +431 -110
  245. package/lib/browser/components/dino.js +3 -3
  246. package/lib/browser/components/earlier-messages.d.ts +2 -1
  247. package/lib/browser/components/earlier-messages.js +2 -17
  248. package/lib/browser/components/editor-area.d.ts +3 -1
  249. package/lib/browser/components/editor-area.js +5 -4
  250. package/lib/browser/components/empty-pictures.d.ts +0 -2
  251. package/lib/browser/components/empty-pictures.js +0 -17
  252. package/lib/browser/components/folder-picker.d.ts +5 -2
  253. package/lib/browser/components/folder-picker.js +30 -9
  254. package/lib/browser/components/held-talk.d.ts +29 -0
  255. package/lib/browser/components/held-talk.js +79 -0
  256. package/lib/browser/components/host-view.d.ts +1 -1
  257. package/lib/browser/components/host-view.js +5 -5
  258. package/lib/browser/components/icon.d.ts +2 -2
  259. package/lib/browser/components/icon.js +7 -6
  260. package/lib/browser/components/image-viewer.d.ts +125 -0
  261. package/lib/browser/components/image-viewer.js +435 -0
  262. package/lib/browser/components/lightbox.d.ts +12 -0
  263. package/lib/browser/components/lightbox.js +60 -0
  264. package/lib/browser/components/markdown.d.ts +6 -2
  265. package/lib/browser/components/markdown.js +24 -10
  266. package/lib/browser/components/media.js +2 -11
  267. package/lib/browser/components/message-footer.d.ts +16 -2
  268. package/lib/browser/components/message-footer.js +31 -12
  269. package/lib/browser/components/message-list.d.ts +24 -3
  270. package/lib/browser/components/message-list.js +146 -16
  271. package/lib/browser/components/message-menu.d.ts +3 -1
  272. package/lib/browser/components/message-menu.js +17 -2
  273. package/lib/browser/components/nav-places.d.ts +16 -1
  274. package/lib/browser/components/nav-places.js +13 -3
  275. package/lib/browser/components/phone-shell.d.ts +4 -1
  276. package/lib/browser/components/phone-shell.js +3 -1
  277. package/lib/browser/components/run-status.js +3 -3
  278. package/lib/browser/components/select-bar.d.ts +10 -0
  279. package/lib/browser/components/select-bar.js +61 -0
  280. package/lib/browser/components/session-settings.d.ts +6 -0
  281. package/lib/browser/components/session-settings.js +14 -1
  282. package/lib/browser/components/session-view.js +7 -3
  283. package/lib/browser/components/settings-choices.d.ts +36 -0
  284. package/lib/browser/components/settings-choices.js +156 -0
  285. package/lib/browser/components/settings-parts.d.ts +22 -0
  286. package/lib/browser/components/settings-parts.js +359 -0
  287. package/lib/browser/components/settings-view.d.ts +0 -6
  288. package/lib/browser/components/settings-view.js +2 -405
  289. package/lib/browser/components/swipe-row.d.ts +2 -2
  290. package/lib/browser/components/swipe-row.js +7 -3
  291. package/lib/browser/components/tool-view.js +14 -12
  292. package/lib/browser/components/voice-button.d.ts +1 -1
  293. package/lib/browser/components/voice-button.js +1 -1
  294. package/lib/browser/components/voice-talk.d.ts +44 -0
  295. package/lib/browser/components/voice-talk.js +260 -0
  296. package/lib/browser/components/workbench-view.js +3 -3
  297. package/lib/browser/device/device.d.ts +3 -0
  298. package/lib/browser/device/device.js +11 -1
  299. package/lib/browser/device/hold.d.ts +43 -0
  300. package/lib/browser/device/hold.js +173 -0
  301. package/lib/browser/device/launch-screen.d.ts +1 -1
  302. package/lib/browser/device/launch-screen.js +1 -1
  303. package/lib/browser/device/long-press.d.ts +2 -0
  304. package/lib/browser/device/long-press.js +16 -1
  305. package/lib/browser/device/pull-down.d.ts +4 -2
  306. package/lib/browser/device/pull-down.js +63 -75
  307. package/lib/browser/device/row-swipe.d.ts +35 -10
  308. package/lib/browser/device/row-swipe.js +148 -70
  309. package/lib/browser/device/shake-undo.d.ts +17 -0
  310. package/lib/browser/device/shake-undo.js +63 -0
  311. package/lib/browser/device/sheet-swipe.d.ts +118 -18
  312. package/lib/browser/device/sheet-swipe.js +410 -108
  313. package/lib/browser/extension/icons.js +1 -0
  314. package/lib/browser/extension/web-extension-api.d.ts +135 -2
  315. package/lib/browser/extension/web-extension-code.d.ts +6 -0
  316. package/lib/browser/extension/web-extension-code.js +24 -0
  317. package/lib/browser/extension/web-extension-protocol.d.ts +23 -1
  318. package/lib/browser/extension/web-extension-protocol.js +9 -1
  319. package/lib/browser/extension/web-extensions.d.ts +14 -1
  320. package/lib/browser/extension/web-extensions.js +125 -21
  321. package/lib/browser/extension/web-tasks.d.ts +9 -1
  322. package/lib/browser/extension/web-tasks.js +24 -0
  323. package/lib/browser/files/files-protocol.d.ts +26 -0
  324. package/lib/browser/files/files-protocol.js +5 -0
  325. package/lib/browser/files/files.d.ts +36 -0
  326. package/lib/browser/files/files.js +122 -0
  327. package/lib/browser/hooks.d.ts +3 -1
  328. package/lib/browser/hooks.js +9 -0
  329. package/lib/browser/i18n/locales.d.ts +29 -2
  330. package/lib/browser/i18n/messages.d.ts +28 -1
  331. package/lib/browser/i18n/messages.js +58 -4
  332. package/lib/browser/index.d.ts +6 -0
  333. package/lib/browser/index.js +6 -0
  334. package/lib/browser/notices/notices-protocol.d.ts +9 -1
  335. package/lib/browser/notices/notices.d.ts +2 -0
  336. package/lib/browser/notices/notices.js +20 -10
  337. package/lib/browser/offline/device-values.d.ts +56 -0
  338. package/lib/browser/offline/device-values.js +148 -0
  339. package/lib/browser/offline/kept-chats-protocol.d.ts +18 -0
  340. package/lib/browser/offline/kept-chats-protocol.js +5 -0
  341. package/lib/browser/offline/kept-chats.d.ts +48 -0
  342. package/lib/browser/offline/kept-chats.js +149 -0
  343. package/lib/browser/offline/offline-reads.d.ts +45 -0
  344. package/lib/browser/offline/offline-reads.js +111 -0
  345. package/lib/browser/settings/settings-protocol.d.ts +2 -0
  346. package/lib/browser/settings/settings-protocol.js +2 -0
  347. package/lib/browser/style/conversation.d.ts +1 -1
  348. package/lib/browser/style/conversation.js +57 -17
  349. package/lib/browser/style/device.js +43 -4
  350. package/lib/browser/style/layout.d.ts +1 -1
  351. package/lib/browser/style/layout.js +67 -15
  352. package/lib/browser/style/pages.d.ts +1 -1
  353. package/lib/browser/style/pages.js +2 -1
  354. package/lib/browser/style/shell.d.ts +1 -1
  355. package/lib/browser/style/shell.js +47 -3
  356. package/lib/browser/style/tasks.d.ts +1 -1
  357. package/lib/browser/style/tasks.js +2 -0
  358. package/lib/browser/util/frame.d.ts +5 -4
  359. package/lib/browser/util/frame.js +5 -4
  360. package/lib/browser/util/markdown.d.ts +18 -1
  361. package/lib/browser/util/markdown.js +119 -5
  362. package/lib/browser/util/process.d.ts +21 -0
  363. package/lib/browser/util/process.js +46 -2
  364. package/lib/browser/util/voice.d.ts +5 -2
  365. package/lib/browser/util/voice.js +6 -3
  366. package/lib/browser/util/zoom.d.ts +47 -0
  367. package/lib/browser/util/zoom.js +99 -0
  368. package/lib/browser/workbench-calls.d.ts +60 -0
  369. package/lib/browser/workbench-calls.js +145 -0
  370. package/lib/browser/workbench-protocol.d.ts +5 -1
  371. package/lib/browser/workbench-util.d.ts +69 -0
  372. package/lib/browser/workbench-util.js +151 -0
  373. package/lib/browser/workbench.d.ts +15 -42
  374. package/lib/browser/workbench.js +74 -189
  375. package/package.json +10 -10
  376. package/public/launch.svg +46 -42
@@ -1,7 +1,8 @@
1
1
  import { TaLocation } from '@celljs/ta-protocol';
2
- import { ChevronRight, FolderTree, Plus, Search, Trash2, Undo2, X } from 'lucide-react';
2
+ import { ChevronRight, Folder, FolderTree, Plus, Search, Trash2, Undo2, X } from 'lucide-react';
3
3
  import * as React from 'react';
4
4
  import { useDevice } from '../device/device.js';
5
+ import { ExtensionBoundary, SessionAvatars } from '../extension/extension-view.js';
5
6
  import { useT } from '../i18n/use-t.js';
6
7
  import { StateUtil } from '../state/state-protocol.js';
7
8
  import { MessageUtil } from '../util/message.js';
@@ -10,6 +11,7 @@ import { EmptyState } from './empty-state.js';
10
11
  import { HostTag } from './host-tag.js';
11
12
  import { Icon, IconButton } from './icon.js';
12
13
  import { SwipeRow } from './swipe-row.js';
14
+ import { DinoFace } from './ta-avatar.js';
13
15
  /** The list by directory or package, else by day; in any browser. */
14
16
  /** By day unless the user groups them: directories nest a list, and the remote ones are marked anyway (HostTag). */
15
17
  export const BY_DIRECTORY = { key: 'chat.byDirectory', tier: 'user', initial: false, parse: StateUtil.boolean };
@@ -28,6 +30,11 @@ export var ChatListUtil;
28
30
  return 'sessionId' in entry;
29
31
  }
30
32
  ChatListUtil.isOpen = isOpen;
33
+ /** Whether it is the double's own conversation: its session, or before that is open its file. */
34
+ function isDouble(entry, double) {
35
+ return isOpen(entry) && (entry.sessionId === double.session || (!!double.sessionFile && entry.sessionFile === double.sessionFile));
36
+ }
37
+ ChatListUtil.isDouble = isDouble;
31
38
  /** The id of an open session, the file of a saved one. */
32
39
  function key(entry) {
33
40
  return isOpen(entry) ? entry.sessionId : entry.sessionFile;
@@ -154,6 +161,42 @@ export var ChatListUtil;
154
161
  return session.sessionName || session.firstMessage || t('ta.chat.new');
155
162
  }
156
163
  ChatListUtil.title = title;
164
+ /**
165
+ * Whether a row shows the same: what of its conversation and its place it shows, and the rest as is. The list
166
+ * reads the conversations again every few seconds into new objects: one that answers draws its row again, not every row.
167
+ */
168
+ function sameRow(before, after) {
169
+ const a = before.session;
170
+ const b = after.session;
171
+ const sameSession = a === b ||
172
+ (key(a) === key(b) &&
173
+ a.sessionName === b.sessionName &&
174
+ a.firstMessage === b.firstMessage &&
175
+ a.lastMessage === b.lastMessage &&
176
+ a.updatedAt === b.updatedAt &&
177
+ a.cwd === b.cwd &&
178
+ a.group === b.group &&
179
+ (isOpen(a) && a.isStreaming) === (isOpen(b) && b.isStreaming));
180
+ const x = before.source;
181
+ const y = after.source;
182
+ const sameSource = x === y || (x.key === y.key && x.label === y.label && x.title === y.title && x.host === y.host && x.initial === y.initial && x.tone === y.tone);
183
+ if (!sameSession || !sameSource) {
184
+ return false;
185
+ }
186
+ for (const name of Object.keys(after)) {
187
+ if (name !== 'session' && name !== 'source' && before[name] !== after[name]) {
188
+ return false;
189
+ }
190
+ }
191
+ return Object.keys(before).length === Object.keys(after).length;
192
+ }
193
+ ChatListUtil.sameRow = sameRow;
194
+ /** What a row says under its title: the last thing said, unless it is the title again. */
195
+ function preview(session, title) {
196
+ const last = session.lastMessage;
197
+ return last && last !== title ? last : undefined;
198
+ }
199
+ ChatListUtil.preview = preview;
157
200
  /** The first letter of a name, for its avatar. */
158
201
  function initial(name) {
159
202
  const letter = [...name].find(char => /[\p{L}\p{N}]/u.test(char));
@@ -170,9 +213,49 @@ function useMinute() {
170
213
  }, []);
171
214
  return now;
172
215
  }
173
- function ChatItem({ session, source, selected, now, compact, onSelect, onRemove, onRestore, doubleTask, onHand }) {
216
+ /**
217
+ * The avatar of a row: the face of the double for its own conversation, the face an extension draws for its
218
+ * agents (registerAvatar), else the letter of its directory. A face works while the conversation answers.
219
+ */
220
+ function ChatAvatar({ session, source, who, size, mood }) {
221
+ var _a;
222
+ const avatars = React.useContext(SessionAvatars);
223
+ const letter = (React.createElement("span", { className: `ta-chat-avatar ta-tone-${source.tone}`, "aria-hidden": "true" }, source.initial));
224
+ if ((who === null || who === void 0 ? void 0 : who.kind) === 'double') {
225
+ return React.createElement(DinoFace, { className: "ta-chat-face", mood: mood, size: size });
226
+ }
227
+ const Avatar = who && ChatListUtil.isOpen(session) && session.group ? avatars[session.group] : undefined;
228
+ if (!Avatar || !ChatListUtil.isOpen(session)) {
229
+ return letter;
230
+ }
231
+ return (React.createElement("span", { className: "ta-chat-face", style: { width: size, height: size }, "aria-hidden": "true" },
232
+ React.createElement(ExtensionBoundary, { name: (_a = session.group) !== null && _a !== void 0 ? _a : '', resetKey: Avatar, fallback: letter },
233
+ React.createElement(Avatar, { session: session, mood: mood, size: size }))));
234
+ }
235
+ /** What goes on in it, on the line of a row of one line: answering now, or how the double's task ended. */
236
+ function ChatState({ streaming, task }) {
237
+ const t = useT();
238
+ if (streaming) {
239
+ return (React.createElement("span", { className: "ta-chat-state" },
240
+ React.createElement("span", { className: "ta-spinner" })));
241
+ }
242
+ if (task === 'failed' || task === 'stopped') {
243
+ return (React.createElement("span", { className: `ta-chat-state ta-${task}` },
244
+ React.createElement("span", { className: `ta-status ${task === 'failed' ? 'ta-status-error' : 'ta-status-cancelled'}` }),
245
+ t(task === 'failed' ? 'ta.task.failed' : 'ta.task.stopped')));
246
+ }
247
+ return null;
248
+ }
249
+ const ChatItem = React.memo(function ChatItem({ session, source, selected, time, compact, actions, restorable, task, doubleName, handable }) {
174
250
  const t = useT();
175
- const title = ChatListUtil.title(session, t);
251
+ const onSelect = () => actions.open(session);
252
+ const onRemove = () => actions.remove(session);
253
+ const onRestore = restorable ? () => actions.restore(session) : undefined;
254
+ const onHand = handable ? () => actions.hand(session) : undefined;
255
+ const avatars = React.useContext(SessionAvatars);
256
+ // The double's conversation is named after it; an agent's has its name (the extension named it so).
257
+ const who = doubleName !== undefined ? { kind: 'double', name: doubleName } : session.group && avatars[session.group] ? { kind: 'agent' } : undefined;
258
+ const title = (who === null || who === void 0 ? void 0 : who.kind) === 'double' ? who.name : ChatListUtil.title(session, t);
176
259
  // Held, a row offers what its hover does (its close button shows only on the row shown, on a phone).
177
260
  const [menu, openMenu] = useContextMenu();
178
261
  const onContextMenu = (event) => openMenu(event, [
@@ -180,33 +263,48 @@ function ChatItem({ session, source, selected, now, compact, onSelect, onRemove,
180
263
  ...(onHand ? [{ label: t('ta.chat.handToDouble'), run: onHand }] : []),
181
264
  onRestore ? { label: t('ta.chat.restore'), run: onRestore } : { label: t('ta.chat.remove'), run: () => onRemove === null || onRemove === void 0 ? void 0 : onRemove() },
182
265
  ]);
183
- const tag = doubleTask && (React.createElement("span", { className: "ta-double-tag", title: t('ta.chat.doubleTagTitle') }, t('ta.chat.doubleTag')));
266
+ const tag = task && (React.createElement("span", { className: "ta-double-tag", title: t('ta.chat.doubleTagTitle') }, t('ta.chat.doubleTag')));
184
267
  // On a phone, as in its messaging apps, a swipe to the left shows what its hover does behind the row.
185
268
  const handheld = useDevice(device => device.handheld);
186
269
  const swipe = onRestore
187
270
  ? { key: 'restore', label: t('ta.chat.restoreShort'), run: onRestore }
188
271
  : { key: 'remove', label: t('ta.chat.removeShort'), danger: true, run: () => onRemove === null || onRemove === void 0 ? void 0 : onRemove() };
189
272
  const streaming = ChatListUtil.isOpen(session) && session.isStreaming;
190
- return (React.createElement(SwipeRow, { as: "li", className: `ta-chat-row${selected ? ' ta-selected' : ''}`, actions: [swipe], overlay: menu, onContextMenu: onContextMenu },
273
+ const mood = streaming ? 'working' : 'idle';
274
+ const state = React.createElement(ChatState, { streaming: streaming, task: task });
275
+ // As in a messaging app, the last thing said; its directory before the first, and on hover in place of its time.
276
+ const said = ChatListUtil.preview(session, title);
277
+ const place = who ? MessageUtil.basename(session.cwd) : source.label;
278
+ const ended = task === 'failed' || task === 'stopped' ? task : undefined;
279
+ return (React.createElement(SwipeRow, { as: "li", className: `ta-chat-row${selected ? ' ta-selected' : ''}${who ? ` ta-chat-${who.kind}` : ''}`, actions: [swipe], overlay: menu, onContextMenu: onContextMenu },
191
280
  React.createElement("button", { type: "button", className: `ta-chat-item${compact ? ' ta-compact' : ''}`, title: `${title}\n${source.title}`, "aria-current": selected ? 'true' : undefined, onClick: onSelect }, compact ? (React.createElement("span", { className: "ta-chat-text" },
192
281
  React.createElement("span", { className: "ta-chat-line" },
282
+ who && React.createElement(ChatAvatar, { session: session, source: source, who: who, size: 20, mood: mood }),
193
283
  tag,
194
284
  React.createElement("span", { className: "ta-chat-title" }, title),
195
- streaming && React.createElement("span", { className: "ta-spinner" }),
196
- React.createElement("span", { className: "ta-chat-time" }, ChatListUtil.clock(session.updatedAt, now))))) : (React.createElement(React.Fragment, null,
197
- React.createElement("span", { className: `ta-chat-avatar ta-tone-${source.tone}`, "aria-hidden": "true" }, source.initial),
285
+ state,
286
+ React.createElement("span", { className: "ta-chat-time" }, time)))) : (React.createElement(React.Fragment, null,
287
+ React.createElement(ChatAvatar, { session: session, source: source, who: who, size: 38, mood: mood }),
198
288
  React.createElement("span", { className: "ta-chat-text" },
199
289
  React.createElement("span", { className: "ta-chat-line" },
200
290
  tag,
201
291
  React.createElement("span", { className: "ta-chat-title" }, title),
202
- React.createElement("span", { className: "ta-chat-time" }, ChatListUtil.clock(session.updatedAt, now))),
292
+ React.createElement("span", { className: "ta-chat-time" }, time),
293
+ React.createElement("span", { className: "ta-chat-place" },
294
+ React.createElement(Icon, { icon: Folder, size: 12 }),
295
+ React.createElement("span", null, place))),
203
296
  React.createElement("span", { className: "ta-chat-line" },
204
297
  React.createElement("span", { className: "ta-chat-sub" },
205
298
  React.createElement(HostTag, { host: source.host }),
206
- source.label),
207
- streaming && React.createElement("span", { className: "ta-spinner" })))))),
299
+ ended && !streaming && (React.createElement("span", { className: `ta-chat-flag ta-${ended}` },
300
+ "[",
301
+ t(ended === 'failed' ? 'ta.task.failed' : 'ta.task.stopped'),
302
+ "]")), said !== null && said !== void 0 ? said : (React.createElement("span", { className: "ta-chat-dir" },
303
+ React.createElement(Icon, { icon: Folder, size: 12 }),
304
+ place))),
305
+ streaming && React.createElement("span", { className: "ta-chat-state ta-spinner" })))))),
208
306
  handheld ? null : onRestore ? (React.createElement(IconButton, { className: "ta-chat-delete", icon: Undo2, label: t('ta.chat.restore'), onClick: onRestore })) : (React.createElement(IconButton, { className: "ta-chat-delete", icon: Trash2, label: t('ta.sidebar.closeTitle'), onClick: onRemove }))));
209
- }
307
+ }, ChatListUtil.sameRow);
210
308
  /**
211
309
  * The conversations of the server, open or saved, the latest first, with a search and `+` for a new one:
212
310
  * by directory or package, each group folding and with a `+` of its own, or by day. Those taken out are at
@@ -217,24 +315,42 @@ export function ChatList({ sessions, saved, removed: removedFiles, selected, cha
217
315
  const now = useMinute();
218
316
  const [query, setQuery] = React.useState('');
219
317
  const [removedOpen, setRemovedOpen] = React.useState(false);
318
+ // What the rows do reads the props of now, through one object that stays the same: no row is drawn again for it.
319
+ const latest = React.useRef({ chat, double, onPicked, t });
320
+ latest.current = { chat, double, onPicked, t };
321
+ const actions = React.useMemo(() => {
322
+ const pick = (change) => {
323
+ void change;
324
+ latest.current.onPicked();
325
+ };
326
+ return {
327
+ open: entry => pick(ChatListUtil.isOpen(entry) ? latest.current.chat.show(entry.sessionId) : latest.current.chat.resume(entry.sessionFile)),
328
+ remove: entry => void latest.current.chat.remove(entry),
329
+ restore: entry => void latest.current.chat.restore(ChatListUtil.key(entry)),
330
+ hand: entry => {
331
+ var _a;
332
+ if (ChatListUtil.isOpen(entry)) {
333
+ (_a = latest.current.double) === null || _a === void 0 ? void 0 : _a.hand(entry, ChatListUtil.title(entry, latest.current.t));
334
+ }
335
+ },
336
+ };
337
+ }, []);
220
338
  // A failure is a notice of the chat.
221
339
  const pick = (change) => {
222
340
  void change;
223
341
  onPicked();
224
342
  };
225
- const { listed, removed } = ChatListUtil.entries(sessions, saved, removedFiles);
226
- const sources = ChatListUtil.sources(listed);
227
- const shown = ChatListUtil.filter(listed, query, t);
228
- const shownRemoved = ChatListUtil.filter(removed, query, t);
343
+ // Worked out again only when the conversations or the search change, not as the minute or the selection does.
344
+ const { listed, removed } = React.useMemo(() => ChatListUtil.entries(sessions, saved, removedFiles), [sessions, saved, removedFiles]);
345
+ const sources = React.useMemo(() => ChatListUtil.sources(listed), [listed]);
346
+ const shown = React.useMemo(() => ChatListUtil.filter(listed, query, t), [listed, query, t]);
347
+ const shownRemoved = React.useMemo(() => ChatListUtil.filter(removed, query, t), [removed, query, t]);
229
348
  // What a search finds is one list by day, wherever it is.
230
349
  const grouped = byDirectory && sources.length > 1 && !query.trim();
231
- const open = (entry) => pick(ChatListUtil.isOpen(entry) ? chat.show(entry.sessionId) : chat.resume(entry.sessionFile));
232
350
  const draftIn = (cwd) => pick(chat.draft().then(() => chat.setDraftCwd(cwd)));
233
351
  const fold = (key) => onFolded(folded.includes(key) ? folded.filter(other => other !== key) : [...folded, key]);
234
- const byKey = new Map([...sources, ...ChatListUtil.sources(removed)].map(candidate => [candidate.key, candidate]));
235
- const item = (session, compact) => (React.createElement(ChatItem, { key: ChatListUtil.key(session), session: session, source: byKey.get(ChatListUtil.sourceKey(session)), selected: ChatListUtil.key(session) === selected, now: now, compact: compact, onSelect: () => open(session), onRemove: () => void chat.remove(session), doubleTask: ChatListUtil.isOpen(session) && !!(double === null || double === void 0 ? void 0 : double.tasks.has(session.sessionId)), onHand: double && ChatListUtil.isOpen(session) && !session.group && !double.tasks.has(session.sessionId) && session.sessionId !== double.session
236
- ? () => double.hand(session, ChatListUtil.title(session, t))
237
- : undefined }));
352
+ const byKey = React.useMemo(() => new Map([...sources, ...ChatListUtil.sources(removed)].map(candidate => [candidate.key, candidate])), [sources, removed]);
353
+ const item = (session, compact) => (React.createElement(ChatItem, { key: ChatListUtil.key(session), session: session, source: byKey.get(ChatListUtil.sourceKey(session)), selected: ChatListUtil.key(session) === selected, time: ChatListUtil.clock(session.updatedAt, now), compact: compact, actions: actions, task: ChatListUtil.isOpen(session) ? double === null || double === void 0 ? void 0 : double.tasks.get(session.sessionId) : undefined, doubleName: double && ChatListUtil.isDouble(session, double) ? double.name : undefined, handable: !!double && ChatListUtil.isOpen(session) && !session.group && !double.tasks.has(session.sessionId) && !ChatListUtil.isDouble(session, double) }));
238
354
  // The conversation shown is found in the list, however it came to be shown: out of a search that hides it, and scrolled to.
239
355
  const scroller = React.useRef(null);
240
356
  const reveal = React.useRef(false);
@@ -287,6 +403,6 @@ export function ChatList({ sessions, saved, removed: removedFiles, selected, cha
287
403
  React.createElement("button", { type: "button", className: "ta-chat-section-title ta-chat-removed-toggle", "aria-expanded": removedOpen, onClick: () => setRemovedOpen(!removedOpen) },
288
404
  React.createElement(Icon, { icon: ChevronRight, size: 13 }),
289
405
  t('ta.chat.removed', { count: shownRemoved.length })),
290
- removedOpen && (React.createElement("ul", { className: "ta-side-list" }, shownRemoved.map(session => (React.createElement(ChatItem, { key: ChatListUtil.key(session), session: session, source: byKey.get(ChatListUtil.sourceKey(session)), selected: false, now: now, onSelect: () => open(session), onRestore: () => chat.restore(ChatListUtil.key(session)) }))))))))));
406
+ removedOpen && (React.createElement("ul", { className: "ta-side-list" }, shownRemoved.map(session => (React.createElement(ChatItem, { key: ChatListUtil.key(session), session: session, source: byKey.get(ChatListUtil.sourceKey(session)), selected: false, time: ChatListUtil.clock(session.updatedAt, now), actions: actions, restorable: true }))))))))));
291
407
  }
292
408
  //# sourceMappingURL=chat-list.js.map
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { type ComposerAttachment, type ComposerImage } from '../util/composer.js';
3
3
  import { type ComposerMenuItem } from './composer-menu.js';
4
+ import { type TalkPlace } from './held-talk.js';
4
5
  /** An entry of the + menu: an action, or a list to pick one of (a model, a level). */
5
6
  export interface ComposerAction {
6
7
  key: string;
@@ -62,6 +63,10 @@ export interface ComposerBoxProps {
62
63
  after?: React.ReactNode;
63
64
  /** What the microphone hears is sent at once, as to the double; otherwise it stays in the box to be read over. */
64
65
  voiceSends?: boolean;
66
+ /** The entry of the navigation whose hold talks through this box (HeldTalk): the double's, a new conversation's. */
67
+ talkPlace?: TalkPlace;
68
+ /** A talk was sent (a finger held on the box, or on the entry of the navigation): the double reads its answer out. */
69
+ onTalkSent?(): void;
65
70
  onListening?(listening: boolean): void;
66
71
  autoFocus?: boolean;
67
72
  /** The directory of the conversation: files dragged in from it become `@` references relative to it. */
@@ -76,9 +81,4 @@ export declare function Attachments({ attachments, onRemove }: {
76
81
  attachments: ComposerAttachment[];
77
82
  onRemove(id: string): void;
78
83
  }): React.JSX.Element;
79
- /**
80
- * The message box of every conversation: Enter sends (the Send key of a phone, as in WeChat), Shift+Enter is a new line, Alt+Enter a follow-up;
81
- * `/` lists commands, `@` the `mentions` its owner finds; images are pasted, dropped or picked; the microphone, where the browser recognizes speech, types what is said. The rest (images,
82
- * mentions, commands, the settings of the conversation) is behind the + on its left.
83
- */
84
84
  export declare const ComposerBox: React.ForwardRefExoticComponent<ComposerBoxProps & React.RefAttributes<ComposerBoxHandle>>;
@@ -1,13 +1,18 @@
1
1
  import { ArrowUp, AtSign, Check, ChevronLeft, ChevronRight, ImagePlus, Plus, Slash, Square, X } from 'lucide-react';
2
2
  import * as React from 'react';
3
+ import { useDevice } from '../device/device.js';
4
+ import { useHeld } from '../device/hold.js';
5
+ import { LongPressUtil } from '../device/long-press.js';
3
6
  import { useT } from '../i18n/use-t.js';
4
7
  import { ComposerUtil, IMAGE_TYPES } from '../util/composer.js';
5
8
  import { FileDragUtil } from '../util/file-drag.js';
6
9
  import { Voice } from '../util/voice.js';
7
10
  import { ComposerMenu } from './composer-menu.js';
11
+ import { HeldTalk } from './held-talk.js';
8
12
  import { Icon, IconButton } from './icon.js';
9
13
  import { OptionList } from './option-list.js';
10
14
  import { VoiceButton } from './voice-button.js';
15
+ import { useVoiceTalk, VoiceTalkOverlay } from './voice-talk.js';
11
16
  import { useWorkbenchAction } from './workbench-toggle.js';
12
17
  function readImage(file) {
13
18
  return new Promise(resolve => {
@@ -63,9 +68,13 @@ function PlusMenu({ sections, onClose }) {
63
68
  * `/` lists commands, `@` the `mentions` its owner finds; images are pasted, dropped or picked; the microphone, where the browser recognizes speech, types what is said. The rest (images,
64
69
  * mentions, commands, the settings of the conversation) is behind the + on its left.
65
70
  */
71
+ /** A press on the box that is the talk's: the field while the keyboard is down, its blank space, the microphone. */
72
+ function talkTarget(target) {
73
+ return target !== document.activeElement && !target.closest('input, a, [role="menu"], .ta-attachments, button:not(.ta-mic)');
74
+ }
66
75
  export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
67
76
  var _a;
68
- const { placeholder, working = false, onStop, onSend, commands = [], onMentionQuery, mentions, mentionLabel, images: takesImages, actions = [], above, beside, after, voiceSends, onListening, autoFocus, cwd, onError, } = props;
77
+ const { placeholder, working = false, onStop, onSend, commands = [], onMentionQuery, mentions, mentionLabel, images: takesImages, actions = [], above, beside, after, voiceSends, talkPlace, onTalkSent, onListening, autoFocus, cwd, onError, } = props;
69
78
  const t = useT();
70
79
  const workbench = useWorkbenchAction();
71
80
  const [text, setText] = React.useState('');
@@ -80,6 +89,7 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
80
89
  const picker = React.useRef(null);
81
90
  const plus = React.useRef(null);
82
91
  const menuId = React.useId();
92
+ const touch = useDevice(device => device.touch);
83
93
  const found = ComposerUtil.trigger(text, caret);
84
94
  const trigger = found && `${found.kind}:${found.start}` !== dismissed ? found : undefined;
85
95
  const query = (trigger === null || trigger === void 0 ? void 0 : trigger.kind) === 'file' ? trigger.query : undefined;
@@ -97,12 +107,17 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
97
107
  // An image still being read holds the message back, rather than leaving without it.
98
108
  const reading = !ComposerUtil.ready(attachments);
99
109
  // Grows with the text, up to a limit; measured again when the text or the width changes (the first
100
- // layout of a page can be narrower than the last).
110
+ // layout of a page can be narrower than the last). Measured at its least height, its row keeps the height
111
+ // it had meanwhile: the page around does not shrink for that moment, which would pull a conversation at its
112
+ // bottom up by the lines the field had, and leave it there.
101
113
  const fit = React.useCallback(() => {
102
114
  const element = input.current;
103
- if (element) {
115
+ const row = element === null || element === void 0 ? void 0 : element.parentElement;
116
+ if (element && row) {
117
+ row.style.minHeight = `${row.offsetHeight}px`;
104
118
  element.style.height = 'auto';
105
119
  element.style.height = `${Math.min(element.scrollHeight, 240)}px`;
120
+ row.style.minHeight = '';
106
121
  }
107
122
  }, []);
108
123
  // biome-ignore lint/correctness/useExhaustiveDependencies: the height is measured again whenever the text changes
@@ -166,6 +181,11 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
166
181
  };
167
182
  const latest = React.useRef(text);
168
183
  latest.current = text;
184
+ // What a talk finds as it ends, long after it began.
185
+ const latestCaret = React.useRef(caret);
186
+ latestCaret.current = caret;
187
+ const readingNow = React.useRef(reading);
188
+ readingNow.current = reading;
169
189
  React.useImperativeHandle(ref, () => ({ text: () => latest.current, setText: next => edit(next, next.length) }));
170
190
  const pick = (item) => {
171
191
  if (!trigger) {
@@ -191,6 +211,40 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
191
211
  onError(error);
192
212
  });
193
213
  };
214
+ // A finger held on the box talks, as WeChat's: let go and what was said goes, at the caret with what was typed;
215
+ // slid over 编辑 it stays in the box, over 取消 it is dropped, and a talk too short to be meant leaves nothing.
216
+ const talk = useVoiceTalk((words, zone) => {
217
+ const [message, position] = ComposerUtil.insert(latest.current, latestCaret.current, words);
218
+ // An image still being read would hold the message back: it waits in the box instead.
219
+ if (zone === 'send' && !readingNow.current) {
220
+ send(false, message.trim());
221
+ onTalkSent === null || onTalkSent === void 0 ? void 0 : onTalkSent();
222
+ }
223
+ else {
224
+ edit(message, position);
225
+ }
226
+ }, onError);
227
+ const talking = React.useRef(talk);
228
+ talking.current = talk;
229
+ const listeningTo = React.useRef(onListening);
230
+ listeningTo.current = onListening;
231
+ const talkActive = talk.active;
232
+ const talked = React.useRef(false);
233
+ React.useEffect(() => {
234
+ var _a;
235
+ if (talkActive !== talked.current) {
236
+ talked.current = talkActive;
237
+ (_a = listeningTo.current) === null || _a === void 0 ? void 0 : _a.call(listeningTo, talkActive);
238
+ }
239
+ }, [talkActive]);
240
+ // The entry of the navigation held for this box: it listens as the hold comes and gives as it goes.
241
+ React.useEffect(() => talkPlace &&
242
+ HeldTalk.attach(talkPlace, {
243
+ start: () => talking.current.start(),
244
+ point: (x, y) => talking.current.point(x, y),
245
+ release: () => talking.current.release(),
246
+ cancel: () => talking.current.cancel(),
247
+ }), [talkPlace]);
194
248
  // Speech goes where the caret was when listening began, between what was typed.
195
249
  const spoken = React.useRef({ before: '', after: '' });
196
250
  const listen = (on) => {
@@ -205,6 +259,58 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
205
259
  setText(speech(words));
206
260
  setCaret(spoken.current.before.length + words.length);
207
261
  }, onHeard: words => (voiceSends ? send(false, speech(words).trim()) : edit(speech(words), spoken.current.before.length + words.length)), onError: onError }));
262
+ // A finger held on the box talks: its blank space, its microphone, and its field while the keyboard is down (the
263
+ // field takes no finger then, .ta-talkable: a tap on it is the box's, which types in it). The field being
264
+ // typed in, the buttons and what the box holds are theirs.
265
+ const held = useHeld();
266
+ const talkable = touch && Voice.canListen();
267
+ const boxHold = held(talkable
268
+ ? {
269
+ accepts: event => event.pointerType !== 'mouse' && talkTarget(event.target),
270
+ start: () => talking.current.start(),
271
+ move: (x, y) => talking.current.point(x, y),
272
+ end: () => talking.current.release(),
273
+ cancel: () => talking.current.cancel(),
274
+ }
275
+ : undefined);
276
+ // iOS takes a finger held on a field for its caret, with its loupe, whatever the field lets through: the box
277
+ // keeps a finger on its field or its blank space from the system while the keyboard is down, and a tap of it
278
+ // types in the field, as it would have.
279
+ const box = React.useRef(null);
280
+ React.useEffect(() => {
281
+ const element = box.current;
282
+ if (!element || !talkable) {
283
+ return;
284
+ }
285
+ let tap;
286
+ const onStart = (event) => {
287
+ const touch = event.touches[0];
288
+ tap = undefined;
289
+ if (event.touches.length !== 1 || !touch || !(event.target instanceof Element) || event.target.closest('.ta-mic') || !talkTarget(event.target)) {
290
+ return;
291
+ }
292
+ event.preventDefault();
293
+ tap = { x: touch.clientX, y: touch.clientY, at: Date.now() };
294
+ };
295
+ const onEnd = (event) => {
296
+ const touch = event.changedTouches[0];
297
+ const press = tap;
298
+ tap = undefined;
299
+ if (press && touch && Date.now() - press.at < LongPressUtil.PRESS_MS && !LongPressUtil.moved(press, { x: touch.clientX, y: touch.clientY })) {
300
+ const field = input.current;
301
+ if (field && document.activeElement !== field) {
302
+ field.focus();
303
+ field.setSelectionRange(field.value.length, field.value.length);
304
+ }
305
+ }
306
+ };
307
+ element.addEventListener('touchstart', onStart, { passive: false });
308
+ element.addEventListener('touchend', onEnd);
309
+ return () => {
310
+ element.removeEventListener('touchstart', onStart);
311
+ element.removeEventListener('touchend', onEnd);
312
+ };
313
+ }, [talkable]);
208
314
  const remove = (id) => {
209
315
  ComposerUtil.release(attachments.filter(attachment => attachment.id === id));
210
316
  setAttachments(previous => previous.filter(attachment => attachment.id !== id));
@@ -301,9 +407,10 @@ export const ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
301
407
  const typing = (action) => action.insert === undefined ? action : { ...action, run: () => edit(...ComposerUtil.insert(text, caret, action.insert)) };
302
408
  const sections = [own, ...actions.map(section => section.map(typing)), workbench ? [workbench] : []].filter(section => section.length > 0);
303
409
  return (React.createElement("div", { className: "ta-console-composer" },
410
+ React.createElement(VoiceTalkOverlay, { talk: talk }),
304
411
  (items.length > 0 || note) && React.createElement(ComposerMenu, { id: menuId, items: items, selected: selected, note: note, onPick: pick, onHover: setSelected }),
305
412
  above,
306
- React.createElement("div", { className: `ta-console-box ${dragging ? 'ta-dragging' : ''}`, onDragOver: event => {
413
+ React.createElement("div", { ref: box, className: `ta-console-box${dragging ? ' ta-dragging' : ''}${talkable ? ' ta-talkable' : ''}`, ...boxHold, onDragOver: event => {
307
414
  if (FileDragUtil.has(event.dataTransfer) || (takesImages && event.dataTransfer.types.includes('Files'))) {
308
415
  event.preventDefault();
309
416
  setDragging(true);
@@ -3,6 +3,7 @@ import type { TaCommandResult, TaServer, TaWorkspaceServer } from '@celljs/ta-pr
3
3
  import * as React from 'react';
4
4
  import { type ComposerImage } from '../util/composer.js';
5
5
  import { type ComposerAction, type ComposerBoxHandle } from './composer-box.js';
6
+ import type { TalkPlace } from './held-talk.js';
6
7
  type Command = TaCommandResult<'get_commands'>['commands'][number];
7
8
  export interface ComposerProps {
8
9
  /** The session it sends to; none for a new conversation, which sends with `onSubmit`. */
@@ -14,6 +15,10 @@ export interface ComposerProps {
14
15
  after?: React.ReactNode;
15
16
  /** What the microphone hears is sent at once. */
16
17
  voiceSends?: boolean;
18
+ /** The entry of the navigation whose hold talks through this box (HeldTalk). */
19
+ talkPlace?: TalkPlace;
20
+ /** A talk was sent. */
21
+ onTalkSent?(): void;
17
22
  onListening?(listening: boolean): void;
18
23
  server: TaServer;
19
24
  /** Where `@` looks for files. */
@@ -30,6 +35,8 @@ export interface ComposerProps {
30
35
  above?: React.ReactNode;
31
36
  /** A message goes out (as the double stops reading aloud). */
32
37
  onSending?(): void;
38
+ /** Stops the work with no session yet (a new conversation still opening). */
39
+ onStop?(): void;
33
40
  onError(error: unknown): void;
34
41
  }
35
42
  /**
@@ -1,5 +1,6 @@
1
1
  import { Clock3, CornerDownRight, Undo2, X } from 'lucide-react';
2
2
  import * as React from 'react';
3
+ import { AssistantTaskUtil } from '../assistant/assistant-task-util.js';
3
4
  import { useDevice } from '../device/device.js';
4
5
  import { useT } from '../i18n/use-t.js';
5
6
  import { ComposerUtil } from '../util/composer.js';
@@ -8,6 +9,8 @@ import { Icon } from './icon.js';
8
9
  const FILE_LIMIT = 20;
9
10
  const FILE_DELAY_MS = 120;
10
11
  const EMPTY_QUEUE = { steering: [], followUp: [] };
12
+ /** What the user said of what waited: not the notes of the tasks that ended, which they did not write. */
13
+ const said = (texts) => texts.filter(text => !AssistantTaskUtil.noteOf(text));
11
14
  /** The files for an `@` being typed; a server without file search answers with an error, and the menu says so. */
12
15
  function useFiles(workspace, cwd, query) {
13
16
  const t = useT();
@@ -54,7 +57,7 @@ function useQueue(store, working) {
54
57
  * and Alt+Enter queues a follow-up; Escape stops it.
55
58
  */
56
59
  export const Composer = React.forwardRef(function Composer(props, ref) {
57
- const { store, onSubmit, beside, after, voiceSends, onListening, server, workspace, working, commands, cwd, actions, placeholder, above, onSending, onError, } = props;
60
+ const { store, onSubmit, beside, after, voiceSends, talkPlace, onTalkSent, onListening, server, workspace, working, commands, cwd, actions, placeholder, above, onSending, onStop, onError, } = props;
58
61
  // A finger: the keyboard opens on focus, over the conversation, and there are no keys to name.
59
62
  const touch = useDevice(device => device.touch);
60
63
  const t = useT();
@@ -63,7 +66,7 @@ export const Composer = React.forwardRef(function Composer(props, ref) {
63
66
  const files = useFiles(workspace, cwd, query);
64
67
  const box = React.useRef(null);
65
68
  React.useImperativeHandle(ref, () => ({ text: () => { var _a; var _b; return (_b = (_a = box.current) === null || _a === void 0 ? void 0 : _a.text()) !== null && _b !== void 0 ? _b : ''; }, setText: text => { var _a; return (_a = box.current) === null || _a === void 0 ? void 0 : _a.setText(text); } }));
66
- const stop = () => store && server.abort(store.sessionId).catch(onError);
69
+ const stop = () => (store ? server.abort(store.sessionId).catch(onError) : onStop === null || onStop === void 0 ? void 0 : onStop());
67
70
  const send = (message, images, followUp) => {
68
71
  var _a;
69
72
  onSending === null || onSending === void 0 ? void 0 : onSending();
@@ -71,8 +74,9 @@ export const Composer = React.forwardRef(function Composer(props, ref) {
71
74
  if (!store) {
72
75
  return (_a = onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(message, prompt.images)) !== null && _a !== void 0 ? _a : Promise.resolve();
73
76
  }
77
+ // A message that fails to go stays in the conversation, marked, to send again: not back in the box.
74
78
  return !working
75
- ? store.prompt(message, { images: prompt.images })
79
+ ? store.send(message, { images: prompt.images })
76
80
  : followUp
77
81
  ? server.followUp(store.sessionId, prompt)
78
82
  : server.steer(store.sessionId, prompt);
@@ -84,7 +88,7 @@ export const Composer = React.forwardRef(function Composer(props, ref) {
84
88
  server.clearQueue(store.sessionId).then(taken => {
85
89
  var _a;
86
90
  setQueue(EMPTY_QUEUE);
87
- (_a = box.current) === null || _a === void 0 ? void 0 : _a.setText(ComposerUtil.restore(taken, box.current.text()));
91
+ (_a = box.current) === null || _a === void 0 ? void 0 : _a.setText(ComposerUtil.restore({ steering: said(taken.steering), followUp: said(taken.followUp) }, box.current.text()));
88
92
  }, onError);
89
93
  };
90
94
  /** Takes one message out; into the box when `back`. */
@@ -101,20 +105,24 @@ export const Composer = React.forwardRef(function Composer(props, ref) {
101
105
  }, onError);
102
106
  };
103
107
  const waiting = ComposerUtil.queued(queue);
104
- return (React.createElement(ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(ComposerUtil.placeholderKey(working, touch)), working: working, onStop: stop, onSend: send, commands: commands, onMentionQuery: setQuery, mentions: files, mentionLabel: t('ta.composer.mentionFile'), images: true, actions: actions, beside: beside, after: after, voiceSends: voiceSends, onListening: onListening, autoFocus: !touch, cwd: cwd, onError: onError, above: React.createElement(React.Fragment, null,
108
+ return (React.createElement(ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(ComposerUtil.placeholderKey(working, touch)), working: working, onStop: stop, onSend: send, commands: commands, onMentionQuery: setQuery, mentions: files, mentionLabel: t('ta.composer.mentionFile'), images: true, actions: actions, beside: beside, after: after, voiceSends: voiceSends, talkPlace: talkPlace, onTalkSent: onTalkSent, onListening: onListening, autoFocus: !touch, cwd: cwd, onError: onError, above: React.createElement(React.Fragment, null,
105
109
  above,
106
110
  waiting.length > 0 && (React.createElement("div", { className: "ta-queue", "aria-live": "polite" },
107
111
  React.createElement("div", { className: "ta-queue-head" },
108
112
  React.createElement("span", null, t('ta.composer.queue.count', { count: waiting.length })),
109
113
  React.createElement("button", { type: "button", className: "ta-queue-all", onClick: takeBack, title: t('ta.composer.queue.takeBackTitle') }, t('ta.composer.queue.takeBackAll'))),
110
- waiting.map(entry => (React.createElement("div", { key: `${entry.kind}-${entry.index}-${entry.text}`, className: "ta-queue-row" },
111
- React.createElement("span", { className: "ta-queue-kind", title: t(entry.kind === 'steering' ? 'ta.composer.queue.steering' : 'ta.composer.queue.followUp') },
112
- React.createElement(Icon, { icon: entry.kind === 'steering' ? CornerDownRight : Clock3, size: 13 })),
113
- React.createElement("span", { className: "ta-ellipsis ta-queue-text", title: entry.text }, entry.text),
114
- React.createElement("span", { className: "ta-queue-actions" },
115
- React.createElement("button", { type: "button", className: "ta-icon-button", onClick: () => remove(entry, true), title: t('ta.composer.queue.editTitle'), "aria-label": t('ta.composer.queue.editTitle') },
116
- React.createElement(Icon, { icon: Undo2, size: 13 })),
117
- React.createElement("button", { type: "button", className: "ta-icon-button", onClick: () => remove(entry, false), title: t('ta.composer.queue.remove'), "aria-label": t('ta.composer.queue.remove') },
118
- React.createElement(Icon, { icon: X, size: 13 }))))))))) }));
114
+ waiting.map(entry => {
115
+ const note = AssistantTaskUtil.noteOf(entry.text);
116
+ const text = note ? t('ta.task.ended', { title: note.title, status: t(`ta.task.${note.status}`) }) : entry.text;
117
+ return (React.createElement("div", { key: `${entry.kind}-${entry.index}-${entry.text}`, className: "ta-queue-row" },
118
+ React.createElement("span", { className: "ta-queue-kind", title: t(entry.kind === 'steering' ? 'ta.composer.queue.steering' : 'ta.composer.queue.followUp') },
119
+ React.createElement(Icon, { icon: entry.kind === 'steering' ? CornerDownRight : Clock3, size: 13 })),
120
+ React.createElement("span", { className: "ta-ellipsis ta-queue-text", title: text }, text),
121
+ React.createElement("span", { className: "ta-queue-actions" },
122
+ !note && (React.createElement("button", { type: "button", className: "ta-icon-button", onClick: () => remove(entry, true), title: t('ta.composer.queue.editTitle'), "aria-label": t('ta.composer.queue.editTitle') },
123
+ React.createElement(Icon, { icon: Undo2, size: 13 }))),
124
+ React.createElement("button", { type: "button", className: "ta-icon-button", onClick: () => remove(entry, false), title: t('ta.composer.queue.remove'), "aria-label": t('ta.composer.queue.remove') },
125
+ React.createElement(Icon, { icon: X, size: 13 })))));
126
+ })))) }));
119
127
  });
120
128
  //# sourceMappingURL=composer.js.map