@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
@@ -39,6 +39,7 @@ const ta_protocol_1 = require("@celljs/ta-protocol");
39
39
  const lucide_react_1 = require("lucide-react");
40
40
  const React = __importStar(require("react"));
41
41
  const device_1 = require("../device/device");
42
+ const extension_view_1 = require("../extension/extension-view");
42
43
  const use_t_1 = require("../i18n/use-t");
43
44
  const state_protocol_1 = require("../state/state-protocol");
44
45
  const message_1 = require("../util/message");
@@ -47,6 +48,7 @@ const empty_state_1 = require("./empty-state");
47
48
  const host_tag_1 = require("./host-tag");
48
49
  const icon_1 = require("./icon");
49
50
  const swipe_row_1 = require("./swipe-row");
51
+ const ta_avatar_1 = require("./ta-avatar");
50
52
  /** The list by directory or package, else by day; in any browser. */
51
53
  /** By day unless the user groups them: directories nest a list, and the remote ones are marked anyway (HostTag). */
52
54
  exports.BY_DIRECTORY = { key: 'chat.byDirectory', tier: 'user', initial: false, parse: state_protocol_1.StateUtil.boolean };
@@ -65,6 +67,11 @@ var ChatListUtil;
65
67
  return 'sessionId' in entry;
66
68
  }
67
69
  ChatListUtil.isOpen = isOpen;
70
+ /** Whether it is the double's own conversation: its session, or before that is open its file. */
71
+ function isDouble(entry, double) {
72
+ return isOpen(entry) && (entry.sessionId === double.session || (!!double.sessionFile && entry.sessionFile === double.sessionFile));
73
+ }
74
+ ChatListUtil.isDouble = isDouble;
68
75
  /** The id of an open session, the file of a saved one. */
69
76
  function key(entry) {
70
77
  return isOpen(entry) ? entry.sessionId : entry.sessionFile;
@@ -191,6 +198,42 @@ var ChatListUtil;
191
198
  return session.sessionName || session.firstMessage || t('ta.chat.new');
192
199
  }
193
200
  ChatListUtil.title = title;
201
+ /**
202
+ * Whether a row shows the same: what of its conversation and its place it shows, and the rest as is. The list
203
+ * reads the conversations again every few seconds into new objects: one that answers draws its row again, not every row.
204
+ */
205
+ function sameRow(before, after) {
206
+ const a = before.session;
207
+ const b = after.session;
208
+ const sameSession = a === b ||
209
+ (key(a) === key(b) &&
210
+ a.sessionName === b.sessionName &&
211
+ a.firstMessage === b.firstMessage &&
212
+ a.lastMessage === b.lastMessage &&
213
+ a.updatedAt === b.updatedAt &&
214
+ a.cwd === b.cwd &&
215
+ a.group === b.group &&
216
+ (isOpen(a) && a.isStreaming) === (isOpen(b) && b.isStreaming));
217
+ const x = before.source;
218
+ const y = after.source;
219
+ 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);
220
+ if (!sameSession || !sameSource) {
221
+ return false;
222
+ }
223
+ for (const name of Object.keys(after)) {
224
+ if (name !== 'session' && name !== 'source' && before[name] !== after[name]) {
225
+ return false;
226
+ }
227
+ }
228
+ return Object.keys(before).length === Object.keys(after).length;
229
+ }
230
+ ChatListUtil.sameRow = sameRow;
231
+ /** What a row says under its title: the last thing said, unless it is the title again. */
232
+ function preview(session, title) {
233
+ const last = session.lastMessage;
234
+ return last && last !== title ? last : undefined;
235
+ }
236
+ ChatListUtil.preview = preview;
194
237
  /** The first letter of a name, for its avatar. */
195
238
  function initial(name) {
196
239
  const letter = [...name].find(char => /[\p{L}\p{N}]/u.test(char));
@@ -207,9 +250,49 @@ function useMinute() {
207
250
  }, []);
208
251
  return now;
209
252
  }
210
- function ChatItem({ session, source, selected, now, compact, onSelect, onRemove, onRestore, doubleTask, onHand }) {
253
+ /**
254
+ * The avatar of a row: the face of the double for its own conversation, the face an extension draws for its
255
+ * agents (registerAvatar), else the letter of its directory. A face works while the conversation answers.
256
+ */
257
+ function ChatAvatar({ session, source, who, size, mood }) {
258
+ var _a;
259
+ const avatars = React.useContext(extension_view_1.SessionAvatars);
260
+ const letter = (React.createElement("span", { className: `ta-chat-avatar ta-tone-${source.tone}`, "aria-hidden": "true" }, source.initial));
261
+ if ((who === null || who === void 0 ? void 0 : who.kind) === 'double') {
262
+ return React.createElement(ta_avatar_1.DinoFace, { className: "ta-chat-face", mood: mood, size: size });
263
+ }
264
+ const Avatar = who && ChatListUtil.isOpen(session) && session.group ? avatars[session.group] : undefined;
265
+ if (!Avatar || !ChatListUtil.isOpen(session)) {
266
+ return letter;
267
+ }
268
+ return (React.createElement("span", { className: "ta-chat-face", style: { width: size, height: size }, "aria-hidden": "true" },
269
+ React.createElement(extension_view_1.ExtensionBoundary, { name: (_a = session.group) !== null && _a !== void 0 ? _a : '', resetKey: Avatar, fallback: letter },
270
+ React.createElement(Avatar, { session: session, mood: mood, size: size }))));
271
+ }
272
+ /** What goes on in it, on the line of a row of one line: answering now, or how the double's task ended. */
273
+ function ChatState({ streaming, task }) {
274
+ const t = (0, use_t_1.useT)();
275
+ if (streaming) {
276
+ return (React.createElement("span", { className: "ta-chat-state" },
277
+ React.createElement("span", { className: "ta-spinner" })));
278
+ }
279
+ if (task === 'failed' || task === 'stopped') {
280
+ return (React.createElement("span", { className: `ta-chat-state ta-${task}` },
281
+ React.createElement("span", { className: `ta-status ${task === 'failed' ? 'ta-status-error' : 'ta-status-cancelled'}` }),
282
+ t(task === 'failed' ? 'ta.task.failed' : 'ta.task.stopped')));
283
+ }
284
+ return null;
285
+ }
286
+ const ChatItem = React.memo(function ChatItem({ session, source, selected, time, compact, actions, restorable, task, doubleName, handable }) {
211
287
  const t = (0, use_t_1.useT)();
212
- const title = ChatListUtil.title(session, t);
288
+ const onSelect = () => actions.open(session);
289
+ const onRemove = () => actions.remove(session);
290
+ const onRestore = restorable ? () => actions.restore(session) : undefined;
291
+ const onHand = handable ? () => actions.hand(session) : undefined;
292
+ const avatars = React.useContext(extension_view_1.SessionAvatars);
293
+ // The double's conversation is named after it; an agent's has its name (the extension named it so).
294
+ const who = doubleName !== undefined ? { kind: 'double', name: doubleName } : session.group && avatars[session.group] ? { kind: 'agent' } : undefined;
295
+ const title = (who === null || who === void 0 ? void 0 : who.kind) === 'double' ? who.name : ChatListUtil.title(session, t);
213
296
  // Held, a row offers what its hover does (its close button shows only on the row shown, on a phone).
214
297
  const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
215
298
  const onContextMenu = (event) => openMenu(event, [
@@ -217,33 +300,48 @@ function ChatItem({ session, source, selected, now, compact, onSelect, onRemove,
217
300
  ...(onHand ? [{ label: t('ta.chat.handToDouble'), run: onHand }] : []),
218
301
  onRestore ? { label: t('ta.chat.restore'), run: onRestore } : { label: t('ta.chat.remove'), run: () => onRemove === null || onRemove === void 0 ? void 0 : onRemove() },
219
302
  ]);
220
- const tag = doubleTask && (React.createElement("span", { className: "ta-double-tag", title: t('ta.chat.doubleTagTitle') }, t('ta.chat.doubleTag')));
303
+ const tag = task && (React.createElement("span", { className: "ta-double-tag", title: t('ta.chat.doubleTagTitle') }, t('ta.chat.doubleTag')));
221
304
  // On a phone, as in its messaging apps, a swipe to the left shows what its hover does behind the row.
222
305
  const handheld = (0, device_1.useDevice)(device => device.handheld);
223
306
  const swipe = onRestore
224
307
  ? { key: 'restore', label: t('ta.chat.restoreShort'), run: onRestore }
225
308
  : { key: 'remove', label: t('ta.chat.removeShort'), danger: true, run: () => onRemove === null || onRemove === void 0 ? void 0 : onRemove() };
226
309
  const streaming = ChatListUtil.isOpen(session) && session.isStreaming;
227
- return (React.createElement(swipe_row_1.SwipeRow, { as: "li", className: `ta-chat-row${selected ? ' ta-selected' : ''}`, actions: [swipe], overlay: menu, onContextMenu: onContextMenu },
310
+ const mood = streaming ? 'working' : 'idle';
311
+ const state = React.createElement(ChatState, { streaming: streaming, task: task });
312
+ // As in a messaging app, the last thing said; its directory before the first, and on hover in place of its time.
313
+ const said = ChatListUtil.preview(session, title);
314
+ const place = who ? message_1.MessageUtil.basename(session.cwd) : source.label;
315
+ const ended = task === 'failed' || task === 'stopped' ? task : undefined;
316
+ return (React.createElement(swipe_row_1.SwipeRow, { as: "li", className: `ta-chat-row${selected ? ' ta-selected' : ''}${who ? ` ta-chat-${who.kind}` : ''}`, actions: [swipe], overlay: menu, onContextMenu: onContextMenu },
228
317
  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" },
229
318
  React.createElement("span", { className: "ta-chat-line" },
319
+ who && React.createElement(ChatAvatar, { session: session, source: source, who: who, size: 20, mood: mood }),
230
320
  tag,
231
321
  React.createElement("span", { className: "ta-chat-title" }, title),
232
- streaming && React.createElement("span", { className: "ta-spinner" }),
233
- React.createElement("span", { className: "ta-chat-time" }, ChatListUtil.clock(session.updatedAt, now))))) : (React.createElement(React.Fragment, null,
234
- React.createElement("span", { className: `ta-chat-avatar ta-tone-${source.tone}`, "aria-hidden": "true" }, source.initial),
322
+ state,
323
+ React.createElement("span", { className: "ta-chat-time" }, time)))) : (React.createElement(React.Fragment, null,
324
+ React.createElement(ChatAvatar, { session: session, source: source, who: who, size: 38, mood: mood }),
235
325
  React.createElement("span", { className: "ta-chat-text" },
236
326
  React.createElement("span", { className: "ta-chat-line" },
237
327
  tag,
238
328
  React.createElement("span", { className: "ta-chat-title" }, title),
239
- React.createElement("span", { className: "ta-chat-time" }, ChatListUtil.clock(session.updatedAt, now))),
329
+ React.createElement("span", { className: "ta-chat-time" }, time),
330
+ React.createElement("span", { className: "ta-chat-place" },
331
+ React.createElement(icon_1.Icon, { icon: lucide_react_1.Folder, size: 12 }),
332
+ React.createElement("span", null, place))),
240
333
  React.createElement("span", { className: "ta-chat-line" },
241
334
  React.createElement("span", { className: "ta-chat-sub" },
242
335
  React.createElement(host_tag_1.HostTag, { host: source.host }),
243
- source.label),
244
- streaming && React.createElement("span", { className: "ta-spinner" })))))),
336
+ ended && !streaming && (React.createElement("span", { className: `ta-chat-flag ta-${ended}` },
337
+ "[",
338
+ t(ended === 'failed' ? 'ta.task.failed' : 'ta.task.stopped'),
339
+ "]")), said !== null && said !== void 0 ? said : (React.createElement("span", { className: "ta-chat-dir" },
340
+ React.createElement(icon_1.Icon, { icon: lucide_react_1.Folder, size: 12 }),
341
+ place))),
342
+ streaming && React.createElement("span", { className: "ta-chat-state ta-spinner" })))))),
245
343
  handheld ? null : onRestore ? (React.createElement(icon_1.IconButton, { className: "ta-chat-delete", icon: lucide_react_1.Undo2, label: t('ta.chat.restore'), onClick: onRestore })) : (React.createElement(icon_1.IconButton, { className: "ta-chat-delete", icon: lucide_react_1.Trash2, label: t('ta.sidebar.closeTitle'), onClick: onRemove }))));
246
- }
344
+ }, ChatListUtil.sameRow);
247
345
  /**
248
346
  * The conversations of the server, open or saved, the latest first, with a search and `+` for a new one:
249
347
  * by directory or package, each group folding and with a `+` of its own, or by day. Those taken out are at
@@ -254,24 +352,42 @@ function ChatList({ sessions, saved, removed: removedFiles, selected, chat, byDi
254
352
  const now = useMinute();
255
353
  const [query, setQuery] = React.useState('');
256
354
  const [removedOpen, setRemovedOpen] = React.useState(false);
355
+ // What the rows do reads the props of now, through one object that stays the same: no row is drawn again for it.
356
+ const latest = React.useRef({ chat, double, onPicked, t });
357
+ latest.current = { chat, double, onPicked, t };
358
+ const actions = React.useMemo(() => {
359
+ const pick = (change) => {
360
+ void change;
361
+ latest.current.onPicked();
362
+ };
363
+ return {
364
+ open: entry => pick(ChatListUtil.isOpen(entry) ? latest.current.chat.show(entry.sessionId) : latest.current.chat.resume(entry.sessionFile)),
365
+ remove: entry => void latest.current.chat.remove(entry),
366
+ restore: entry => void latest.current.chat.restore(ChatListUtil.key(entry)),
367
+ hand: entry => {
368
+ var _a;
369
+ if (ChatListUtil.isOpen(entry)) {
370
+ (_a = latest.current.double) === null || _a === void 0 ? void 0 : _a.hand(entry, ChatListUtil.title(entry, latest.current.t));
371
+ }
372
+ },
373
+ };
374
+ }, []);
257
375
  // A failure is a notice of the chat.
258
376
  const pick = (change) => {
259
377
  void change;
260
378
  onPicked();
261
379
  };
262
- const { listed, removed } = ChatListUtil.entries(sessions, saved, removedFiles);
263
- const sources = ChatListUtil.sources(listed);
264
- const shown = ChatListUtil.filter(listed, query, t);
265
- const shownRemoved = ChatListUtil.filter(removed, query, t);
380
+ // Worked out again only when the conversations or the search change, not as the minute or the selection does.
381
+ const { listed, removed } = React.useMemo(() => ChatListUtil.entries(sessions, saved, removedFiles), [sessions, saved, removedFiles]);
382
+ const sources = React.useMemo(() => ChatListUtil.sources(listed), [listed]);
383
+ const shown = React.useMemo(() => ChatListUtil.filter(listed, query, t), [listed, query, t]);
384
+ const shownRemoved = React.useMemo(() => ChatListUtil.filter(removed, query, t), [removed, query, t]);
266
385
  // What a search finds is one list by day, wherever it is.
267
386
  const grouped = byDirectory && sources.length > 1 && !query.trim();
268
- const open = (entry) => pick(ChatListUtil.isOpen(entry) ? chat.show(entry.sessionId) : chat.resume(entry.sessionFile));
269
387
  const draftIn = (cwd) => pick(chat.draft().then(() => chat.setDraftCwd(cwd)));
270
388
  const fold = (key) => onFolded(folded.includes(key) ? folded.filter(other => other !== key) : [...folded, key]);
271
- const byKey = new Map([...sources, ...ChatListUtil.sources(removed)].map(candidate => [candidate.key, candidate]));
272
- 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
273
- ? () => double.hand(session, ChatListUtil.title(session, t))
274
- : undefined }));
389
+ const byKey = React.useMemo(() => new Map([...sources, ...ChatListUtil.sources(removed)].map(candidate => [candidate.key, candidate])), [sources, removed]);
390
+ 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) }));
275
391
  // The conversation shown is found in the list, however it came to be shown: out of a search that hides it, and scrolled to.
276
392
  const scroller = React.useRef(null);
277
393
  const reveal = React.useRef(false);
@@ -324,6 +440,6 @@ function ChatList({ sessions, saved, removed: removedFiles, selected, chat, byDi
324
440
  React.createElement("button", { type: "button", className: "ta-chat-section-title ta-chat-removed-toggle", "aria-expanded": removedOpen, onClick: () => setRemovedOpen(!removedOpen) },
325
441
  React.createElement(icon_1.Icon, { icon: lucide_react_1.ChevronRight, size: 13 }),
326
442
  t('ta.chat.removed', { count: shownRemoved.length })),
327
- 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)) }))))))))));
443
+ 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 }))))))))));
328
444
  }
329
445
  //# 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';
3
3
  import { type ComposerMenuItem } from './composer-menu';
4
+ import { type TalkPlace } from './held-talk';
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,10 +81,5 @@ 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>>;
85
85
  //# sourceMappingURL=composer-box.d.ts.map
@@ -37,14 +37,19 @@ exports.ComposerBox = void 0;
37
37
  exports.Attachments = Attachments;
38
38
  const lucide_react_1 = require("lucide-react");
39
39
  const React = __importStar(require("react"));
40
+ const device_1 = require("../device/device");
41
+ const hold_1 = require("../device/hold");
42
+ const long_press_1 = require("../device/long-press");
40
43
  const use_t_1 = require("../i18n/use-t");
41
44
  const composer_1 = require("../util/composer");
42
45
  const file_drag_1 = require("../util/file-drag");
43
46
  const voice_1 = require("../util/voice");
44
47
  const composer_menu_1 = require("./composer-menu");
48
+ const held_talk_1 = require("./held-talk");
45
49
  const icon_1 = require("./icon");
46
50
  const option_list_1 = require("./option-list");
47
51
  const voice_button_1 = require("./voice-button");
52
+ const voice_talk_1 = require("./voice-talk");
48
53
  const workbench_toggle_1 = require("./workbench-toggle");
49
54
  function readImage(file) {
50
55
  return new Promise(resolve => {
@@ -100,9 +105,13 @@ function PlusMenu({ sections, onClose }) {
100
105
  * `/` 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,
101
106
  * mentions, commands, the settings of the conversation) is behind the + on its left.
102
107
  */
108
+ /** A press on the box that is the talk's: the field while the keyboard is down, its blank space, the microphone. */
109
+ function talkTarget(target) {
110
+ return target !== document.activeElement && !target.closest('input, a, [role="menu"], .ta-attachments, button:not(.ta-mic)');
111
+ }
103
112
  exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
104
113
  var _a;
105
- const { placeholder, working = false, onStop, onSend, commands = [], onMentionQuery, mentions, mentionLabel, images: takesImages, actions = [], above, beside, after, voiceSends, onListening, autoFocus, cwd, onError, } = props;
114
+ const { placeholder, working = false, onStop, onSend, commands = [], onMentionQuery, mentions, mentionLabel, images: takesImages, actions = [], above, beside, after, voiceSends, talkPlace, onTalkSent, onListening, autoFocus, cwd, onError, } = props;
106
115
  const t = (0, use_t_1.useT)();
107
116
  const workbench = (0, workbench_toggle_1.useWorkbenchAction)();
108
117
  const [text, setText] = React.useState('');
@@ -117,6 +126,7 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
117
126
  const picker = React.useRef(null);
118
127
  const plus = React.useRef(null);
119
128
  const menuId = React.useId();
129
+ const touch = (0, device_1.useDevice)(device => device.touch);
120
130
  const found = composer_1.ComposerUtil.trigger(text, caret);
121
131
  const trigger = found && `${found.kind}:${found.start}` !== dismissed ? found : undefined;
122
132
  const query = (trigger === null || trigger === void 0 ? void 0 : trigger.kind) === 'file' ? trigger.query : undefined;
@@ -134,12 +144,17 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
134
144
  // An image still being read holds the message back, rather than leaving without it.
135
145
  const reading = !composer_1.ComposerUtil.ready(attachments);
136
146
  // Grows with the text, up to a limit; measured again when the text or the width changes (the first
137
- // layout of a page can be narrower than the last).
147
+ // layout of a page can be narrower than the last). Measured at its least height, its row keeps the height
148
+ // it had meanwhile: the page around does not shrink for that moment, which would pull a conversation at its
149
+ // bottom up by the lines the field had, and leave it there.
138
150
  const fit = React.useCallback(() => {
139
151
  const element = input.current;
140
- if (element) {
152
+ const row = element === null || element === void 0 ? void 0 : element.parentElement;
153
+ if (element && row) {
154
+ row.style.minHeight = `${row.offsetHeight}px`;
141
155
  element.style.height = 'auto';
142
156
  element.style.height = `${Math.min(element.scrollHeight, 240)}px`;
157
+ row.style.minHeight = '';
143
158
  }
144
159
  }, []);
145
160
  // biome-ignore lint/correctness/useExhaustiveDependencies: the height is measured again whenever the text changes
@@ -203,6 +218,11 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
203
218
  };
204
219
  const latest = React.useRef(text);
205
220
  latest.current = text;
221
+ // What a talk finds as it ends, long after it began.
222
+ const latestCaret = React.useRef(caret);
223
+ latestCaret.current = caret;
224
+ const readingNow = React.useRef(reading);
225
+ readingNow.current = reading;
206
226
  React.useImperativeHandle(ref, () => ({ text: () => latest.current, setText: next => edit(next, next.length) }));
207
227
  const pick = (item) => {
208
228
  if (!trigger) {
@@ -228,6 +248,40 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
228
248
  onError(error);
229
249
  });
230
250
  };
251
+ // A finger held on the box talks, as WeChat's: let go and what was said goes, at the caret with what was typed;
252
+ // slid over 编辑 it stays in the box, over 取消 it is dropped, and a talk too short to be meant leaves nothing.
253
+ const talk = (0, voice_talk_1.useVoiceTalk)((words, zone) => {
254
+ const [message, position] = composer_1.ComposerUtil.insert(latest.current, latestCaret.current, words);
255
+ // An image still being read would hold the message back: it waits in the box instead.
256
+ if (zone === 'send' && !readingNow.current) {
257
+ send(false, message.trim());
258
+ onTalkSent === null || onTalkSent === void 0 ? void 0 : onTalkSent();
259
+ }
260
+ else {
261
+ edit(message, position);
262
+ }
263
+ }, onError);
264
+ const talking = React.useRef(talk);
265
+ talking.current = talk;
266
+ const listeningTo = React.useRef(onListening);
267
+ listeningTo.current = onListening;
268
+ const talkActive = talk.active;
269
+ const talked = React.useRef(false);
270
+ React.useEffect(() => {
271
+ var _a;
272
+ if (talkActive !== talked.current) {
273
+ talked.current = talkActive;
274
+ (_a = listeningTo.current) === null || _a === void 0 ? void 0 : _a.call(listeningTo, talkActive);
275
+ }
276
+ }, [talkActive]);
277
+ // The entry of the navigation held for this box: it listens as the hold comes and gives as it goes.
278
+ React.useEffect(() => talkPlace &&
279
+ held_talk_1.HeldTalk.attach(talkPlace, {
280
+ start: () => talking.current.start(),
281
+ point: (x, y) => talking.current.point(x, y),
282
+ release: () => talking.current.release(),
283
+ cancel: () => talking.current.cancel(),
284
+ }), [talkPlace]);
231
285
  // Speech goes where the caret was when listening began, between what was typed.
232
286
  const spoken = React.useRef({ before: '', after: '' });
233
287
  const listen = (on) => {
@@ -242,6 +296,58 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
242
296
  setText(speech(words));
243
297
  setCaret(spoken.current.before.length + words.length);
244
298
  }, onHeard: words => (voiceSends ? send(false, speech(words).trim()) : edit(speech(words), spoken.current.before.length + words.length)), onError: onError }));
299
+ // A finger held on the box talks: its blank space, its microphone, and its field while the keyboard is down (the
300
+ // field takes no finger then, .ta-talkable: a tap on it is the box's, which types in it). The field being
301
+ // typed in, the buttons and what the box holds are theirs.
302
+ const held = (0, hold_1.useHeld)();
303
+ const talkable = touch && voice_1.Voice.canListen();
304
+ const boxHold = held(talkable
305
+ ? {
306
+ accepts: event => event.pointerType !== 'mouse' && talkTarget(event.target),
307
+ start: () => talking.current.start(),
308
+ move: (x, y) => talking.current.point(x, y),
309
+ end: () => talking.current.release(),
310
+ cancel: () => talking.current.cancel(),
311
+ }
312
+ : undefined);
313
+ // iOS takes a finger held on a field for its caret, with its loupe, whatever the field lets through: the box
314
+ // keeps a finger on its field or its blank space from the system while the keyboard is down, and a tap of it
315
+ // types in the field, as it would have.
316
+ const box = React.useRef(null);
317
+ React.useEffect(() => {
318
+ const element = box.current;
319
+ if (!element || !talkable) {
320
+ return;
321
+ }
322
+ let tap;
323
+ const onStart = (event) => {
324
+ const touch = event.touches[0];
325
+ tap = undefined;
326
+ if (event.touches.length !== 1 || !touch || !(event.target instanceof Element) || event.target.closest('.ta-mic') || !talkTarget(event.target)) {
327
+ return;
328
+ }
329
+ event.preventDefault();
330
+ tap = { x: touch.clientX, y: touch.clientY, at: Date.now() };
331
+ };
332
+ const onEnd = (event) => {
333
+ const touch = event.changedTouches[0];
334
+ const press = tap;
335
+ tap = undefined;
336
+ if (press && touch && Date.now() - press.at < long_press_1.LongPressUtil.PRESS_MS && !long_press_1.LongPressUtil.moved(press, { x: touch.clientX, y: touch.clientY })) {
337
+ const field = input.current;
338
+ if (field && document.activeElement !== field) {
339
+ field.focus();
340
+ field.setSelectionRange(field.value.length, field.value.length);
341
+ }
342
+ }
343
+ };
344
+ element.addEventListener('touchstart', onStart, { passive: false });
345
+ element.addEventListener('touchend', onEnd);
346
+ return () => {
347
+ element.removeEventListener('touchstart', onStart);
348
+ element.removeEventListener('touchend', onEnd);
349
+ };
350
+ }, [talkable]);
245
351
  const remove = (id) => {
246
352
  composer_1.ComposerUtil.release(attachments.filter(attachment => attachment.id === id));
247
353
  setAttachments(previous => previous.filter(attachment => attachment.id !== id));
@@ -338,9 +444,10 @@ exports.ComposerBox = React.forwardRef(function ComposerBox(props, ref) {
338
444
  const typing = (action) => action.insert === undefined ? action : { ...action, run: () => edit(...composer_1.ComposerUtil.insert(text, caret, action.insert)) };
339
445
  const sections = [own, ...actions.map(section => section.map(typing)), workbench ? [workbench] : []].filter(section => section.length > 0);
340
446
  return (React.createElement("div", { className: "ta-console-composer" },
447
+ React.createElement(voice_talk_1.VoiceTalkOverlay, { talk: talk }),
341
448
  (items.length > 0 || note) && React.createElement(composer_menu_1.ComposerMenu, { id: menuId, items: items, selected: selected, note: note, onPick: pick, onHover: setSelected }),
342
449
  above,
343
- React.createElement("div", { className: `ta-console-box ${dragging ? 'ta-dragging' : ''}`, onDragOver: event => {
450
+ React.createElement("div", { ref: box, className: `ta-console-box${dragging ? ' ta-dragging' : ''}${talkable ? ' ta-talkable' : ''}`, ...boxHold, onDragOver: event => {
344
451
  if (file_drag_1.FileDragUtil.has(event.dataTransfer) || (takesImages && event.dataTransfer.types.includes('Files'))) {
345
452
  event.preventDefault();
346
453
  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';
5
5
  import { type ComposerAction, type ComposerBoxHandle } from './composer-box';
6
+ import type { TalkPlace } from './held-talk';
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
  /**
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Composer = void 0;
37
37
  const lucide_react_1 = require("lucide-react");
38
38
  const React = __importStar(require("react"));
39
+ const assistant_task_util_1 = require("../assistant/assistant-task-util");
39
40
  const device_1 = require("../device/device");
40
41
  const use_t_1 = require("../i18n/use-t");
41
42
  const composer_1 = require("../util/composer");
@@ -44,6 +45,8 @@ const icon_1 = require("./icon");
44
45
  const FILE_LIMIT = 20;
45
46
  const FILE_DELAY_MS = 120;
46
47
  const EMPTY_QUEUE = { steering: [], followUp: [] };
48
+ /** What the user said of what waited: not the notes of the tasks that ended, which they did not write. */
49
+ const said = (texts) => texts.filter(text => !assistant_task_util_1.AssistantTaskUtil.noteOf(text));
47
50
  /** The files for an `@` being typed; a server without file search answers with an error, and the menu says so. */
48
51
  function useFiles(workspace, cwd, query) {
49
52
  const t = (0, use_t_1.useT)();
@@ -90,7 +93,7 @@ function useQueue(store, working) {
90
93
  * and Alt+Enter queues a follow-up; Escape stops it.
91
94
  */
92
95
  exports.Composer = React.forwardRef(function Composer(props, ref) {
93
- const { store, onSubmit, beside, after, voiceSends, onListening, server, workspace, working, commands, cwd, actions, placeholder, above, onSending, onError, } = props;
96
+ const { store, onSubmit, beside, after, voiceSends, talkPlace, onTalkSent, onListening, server, workspace, working, commands, cwd, actions, placeholder, above, onSending, onStop, onError, } = props;
94
97
  // A finger: the keyboard opens on focus, over the conversation, and there are no keys to name.
95
98
  const touch = (0, device_1.useDevice)(device => device.touch);
96
99
  const t = (0, use_t_1.useT)();
@@ -99,7 +102,7 @@ exports.Composer = React.forwardRef(function Composer(props, ref) {
99
102
  const files = useFiles(workspace, cwd, query);
100
103
  const box = React.useRef(null);
101
104
  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); } }));
102
- const stop = () => store && server.abort(store.sessionId).catch(onError);
105
+ const stop = () => (store ? server.abort(store.sessionId).catch(onError) : onStop === null || onStop === void 0 ? void 0 : onStop());
103
106
  const send = (message, images, followUp) => {
104
107
  var _a;
105
108
  onSending === null || onSending === void 0 ? void 0 : onSending();
@@ -107,8 +110,9 @@ exports.Composer = React.forwardRef(function Composer(props, ref) {
107
110
  if (!store) {
108
111
  return (_a = onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(message, prompt.images)) !== null && _a !== void 0 ? _a : Promise.resolve();
109
112
  }
113
+ // A message that fails to go stays in the conversation, marked, to send again: not back in the box.
110
114
  return !working
111
- ? store.prompt(message, { images: prompt.images })
115
+ ? store.send(message, { images: prompt.images })
112
116
  : followUp
113
117
  ? server.followUp(store.sessionId, prompt)
114
118
  : server.steer(store.sessionId, prompt);
@@ -120,7 +124,7 @@ exports.Composer = React.forwardRef(function Composer(props, ref) {
120
124
  server.clearQueue(store.sessionId).then(taken => {
121
125
  var _a;
122
126
  setQueue(EMPTY_QUEUE);
123
- (_a = box.current) === null || _a === void 0 ? void 0 : _a.setText(composer_1.ComposerUtil.restore(taken, box.current.text()));
127
+ (_a = box.current) === null || _a === void 0 ? void 0 : _a.setText(composer_1.ComposerUtil.restore({ steering: said(taken.steering), followUp: said(taken.followUp) }, box.current.text()));
124
128
  }, onError);
125
129
  };
126
130
  /** Takes one message out; into the box when `back`. */
@@ -137,20 +141,24 @@ exports.Composer = React.forwardRef(function Composer(props, ref) {
137
141
  }, onError);
138
142
  };
139
143
  const waiting = composer_1.ComposerUtil.queued(queue);
140
- return (React.createElement(composer_box_1.ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(composer_1.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,
144
+ return (React.createElement(composer_box_1.ComposerBox, { ref: box, placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : t(composer_1.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,
141
145
  above,
142
146
  waiting.length > 0 && (React.createElement("div", { className: "ta-queue", "aria-live": "polite" },
143
147
  React.createElement("div", { className: "ta-queue-head" },
144
148
  React.createElement("span", null, t('ta.composer.queue.count', { count: waiting.length })),
145
149
  React.createElement("button", { type: "button", className: "ta-queue-all", onClick: takeBack, title: t('ta.composer.queue.takeBackTitle') }, t('ta.composer.queue.takeBackAll'))),
146
- waiting.map(entry => (React.createElement("div", { key: `${entry.kind}-${entry.index}-${entry.text}`, className: "ta-queue-row" },
147
- React.createElement("span", { className: "ta-queue-kind", title: t(entry.kind === 'steering' ? 'ta.composer.queue.steering' : 'ta.composer.queue.followUp') },
148
- React.createElement(icon_1.Icon, { icon: entry.kind === 'steering' ? lucide_react_1.CornerDownRight : lucide_react_1.Clock3, size: 13 })),
149
- React.createElement("span", { className: "ta-ellipsis ta-queue-text", title: entry.text }, entry.text),
150
- React.createElement("span", { className: "ta-queue-actions" },
151
- 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') },
152
- React.createElement(icon_1.Icon, { icon: lucide_react_1.Undo2, size: 13 })),
153
- 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') },
154
- React.createElement(icon_1.Icon, { icon: lucide_react_1.X, size: 13 }))))))))) }));
150
+ waiting.map(entry => {
151
+ const note = assistant_task_util_1.AssistantTaskUtil.noteOf(entry.text);
152
+ const text = note ? t('ta.task.ended', { title: note.title, status: t(`ta.task.${note.status}`) }) : entry.text;
153
+ return (React.createElement("div", { key: `${entry.kind}-${entry.index}-${entry.text}`, className: "ta-queue-row" },
154
+ React.createElement("span", { className: "ta-queue-kind", title: t(entry.kind === 'steering' ? 'ta.composer.queue.steering' : 'ta.composer.queue.followUp') },
155
+ React.createElement(icon_1.Icon, { icon: entry.kind === 'steering' ? lucide_react_1.CornerDownRight : lucide_react_1.Clock3, size: 13 })),
156
+ React.createElement("span", { className: "ta-ellipsis ta-queue-text", title: text }, text),
157
+ React.createElement("span", { className: "ta-queue-actions" },
158
+ !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') },
159
+ React.createElement(icon_1.Icon, { icon: lucide_react_1.Undo2, size: 13 }))),
160
+ 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') },
161
+ React.createElement(icon_1.Icon, { icon: lucide_react_1.X, size: 13 })))));
162
+ })))) }));
155
163
  });
156
164
  //# sourceMappingURL=composer.js.map