@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,16 +1,28 @@
1
- import type { ClientTool, SessionState, SessionStore } from '@celljs/ta-client';
1
+ import { type ClientTool, type SessionState, type SessionStore } from '@celljs/ta-client';
2
2
  import { type TaPromptInput, type TaServer, type TaSessionInfo } from '@celljs/ta-protocol';
3
+ import { TaKeptChats } from '../offline/kept-chats-protocol.js';
3
4
  import { type Settings, TaSettings } from '../settings/settings-protocol.js';
4
5
  import { TaState } from '../state/state-protocol.js';
5
6
  import { TaWorkbench } from '../workbench-protocol.js';
6
7
  import { type AssistantAsk, type AssistantState, type AssistantTask, TaAssistant } from './assistant-protocol.js';
7
8
  import { AssistantTaskBook } from './assistant-task-book.js';
9
+ /** What the double is to hear of a task that ended (finished), and when it ended. */
10
+ interface TaskNote {
11
+ text: string;
12
+ clientMessageId: string;
13
+ at: number;
14
+ }
8
15
  export declare class TaAssistantImpl implements TaAssistant {
9
16
  protected readonly workbench: TaWorkbench;
10
17
  protected readonly persisted: TaState;
11
18
  protected readonly settings: TaSettings;
19
+ protected readonly kept: TaKeptChats;
12
20
  protected current: AssistantState;
13
21
  protected assistant?: SessionStore;
22
+ /** Until the conversation is open (and while the computer cannot be reached): it as this device kept it. */
23
+ protected preview?: SessionStore;
24
+ /** Stops keeping the conversation on the device. */
25
+ protected unkeep?: () => void;
14
26
  /** The directory of the conversation with ta, set when it opened: pi's `/new` keeps it. */
15
27
  protected cwd?: string;
16
28
  protected readonly taskStores: Map<string, SessionStore>;
@@ -23,6 +35,14 @@ export declare class TaAssistantImpl implements TaAssistant {
23
35
  protected readonly following: Map<string, () => void>;
24
36
  /** The answers the asks wait for, by ask id. */
25
37
  protected readonly answers: Map<string, (start: boolean) => void>;
38
+ /**
39
+ * The notes of tasks that ended, by task id, held while the double works and until the task stayed
40
+ * ended a moment (flushNotes): one per task, the last, so that a task that ends again and again does
41
+ * not pile notes up in the double's queue.
42
+ */
43
+ protected readonly notes: Map<string, TaskNote>;
44
+ protected noteTimer?: ReturnType<typeof setTimeout>;
45
+ protected noteSettleMs: number;
26
46
  protected unwatchSettings?: () => void;
27
47
  protected unwatchTasks?: () => void;
28
48
  protected unwatchOnline?: () => void;
@@ -39,6 +59,7 @@ export declare class TaAssistantImpl implements TaAssistant {
39
59
  start(): Promise<void>;
40
60
  warm(): Promise<void>;
41
61
  store(): SessionStore | undefined;
62
+ showKept(): Promise<void>;
42
63
  loadTasks(): Promise<void>;
43
64
  /** The tasks other pages change, and the connection: back online (the service restarted, say), what runs is followed again. */
44
65
  protected watchTasks(): void;
@@ -79,6 +100,8 @@ export declare class TaAssistantImpl implements TaAssistant {
79
100
  protected reopen(store: SessionStore): Promise<void>;
80
101
  stop(): Promise<void>;
81
102
  restart(): Promise<void>;
103
+ /** Keeps the conversation on the device as it changes, under its file of the time (`restart` gives it another). */
104
+ protected keep(store: SessionStore): void;
82
105
  /** The role of ta, whether it asks first, and what the user added to it. */
83
106
  protected systemPrompt(): string;
84
107
  /** Asking first or not is in the role: the conversation opens again with it, once the double is not at work. */
@@ -120,5 +143,11 @@ export declare class TaAssistantImpl implements TaAssistant {
120
143
  * id of the message is the same in each: the time of the task's last answer, by the computer's clock).
121
144
  */
122
145
  protected finished(id: string, state: SessionState): void;
146
+ /**
147
+ * Sends the notes of the tasks that stayed ended a moment, once the double is not at work: what it
148
+ * did not hear yet waits here rather than in its queue, where a task that ended again would add one more.
149
+ */
150
+ protected flushNotes(): void;
123
151
  protected update(change: Partial<AssistantState>): void;
124
152
  }
153
+ export {};
@@ -8,7 +8,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { Autowired, Component } from '@celljs/core';
11
+ import { TaRemoteError } from '@celljs/ta-client';
11
12
  import { TaErrorCode, TaErrorUtil } from '@celljs/ta-protocol';
13
+ import { TaKeptChats } from '../offline/kept-chats-protocol.js';
12
14
  import { SettingsUtil, TaSettings } from '../settings/settings-protocol.js';
13
15
  import { TaState } from '../state/state-protocol.js';
14
16
  import { TaWorkbench } from '../workbench-protocol.js';
@@ -18,6 +20,8 @@ import { ASSISTANT_NAME_STATE, AssistantStates } from './assistant-state.js';
18
20
  import { AssistantTaskBook } from './assistant-task-book.js';
19
21
  import { AssistantTaskUtil } from './assistant-task-util.js';
20
22
  const { FILE, TASKS, PROMPT, ASKING } = AssistantStates;
23
+ /** How long a task stays ended before the double hears of it: an agent that goes on by itself ends and runs again within seconds. */
24
+ const NOTE_SETTLE_MS = 5000;
21
25
  let TaAssistantImpl = class TaAssistantImpl {
22
26
  constructor() {
23
27
  this.current = { ready: false, tasks: [], asks: [] };
@@ -29,6 +33,13 @@ let TaAssistantImpl = class TaAssistantImpl {
29
33
  this.following = new Map();
30
34
  /** The answers the asks wait for, by ask id. */
31
35
  this.answers = new Map();
36
+ /**
37
+ * The notes of tasks that ended, by task id, held while the double works and until the task stayed
38
+ * ended a moment (flushNotes): one per task, the last, so that a task that ends again and again does
39
+ * not pile notes up in the double's queue.
40
+ */
41
+ this.notes = new Map();
42
+ this.noteSettleMs = NOTE_SETTLE_MS;
32
43
  this.asked = 0;
33
44
  this.listeners = new Set();
34
45
  }
@@ -50,6 +61,11 @@ let TaAssistantImpl = class TaAssistantImpl {
50
61
  (_a = this.unwatchSettings) !== null && _a !== void 0 ? _a : (this.unwatchSettings = this.settings.subscribe(state => this.settingsChanged(state.settings)));
51
62
  (_b = this.starting) !== null && _b !== void 0 ? _b : (this.starting = this.open().catch(error => {
52
63
  this.starting = undefined;
64
+ if (TaRemoteError.isConnectionLost(error)) {
65
+ // No failure to show: it wakes once the connection is back (a moment after, not in a loop).
66
+ setTimeout(() => void this.workbench.connected().then(() => (this.starting || this.assistant ? undefined : this.start()), () => undefined), 1000);
67
+ return;
68
+ }
53
69
  this.update({ error: error instanceof Error ? error.message : String(error) });
54
70
  }));
55
71
  return this.starting;
@@ -60,7 +76,17 @@ let TaAssistantImpl = class TaAssistantImpl {
60
76
  }
61
77
  }
62
78
  store() {
63
- return this.assistant;
79
+ var _a;
80
+ return (_a = this.assistant) !== null && _a !== void 0 ? _a : this.preview;
81
+ }
82
+ async showKept() {
83
+ const file = this.assistant || this.preview ? undefined : await this.persisted.load(FILE);
84
+ const initial = file ? await this.kept.read(file).catch(() => undefined) : undefined;
85
+ if (initial && !this.assistant && !this.preview) {
86
+ // Under its file: it is of no session until the conversation opens, which takes over what it shows.
87
+ this.preview = this.workbench.createStore(file, { initial });
88
+ this.update({});
89
+ }
64
90
  }
65
91
  async loadTasks() {
66
92
  this.watchTasks();
@@ -142,6 +168,9 @@ let TaAssistantImpl = class TaAssistantImpl {
142
168
  // Opening (again, after a reconnect found it gone): sent once it is open.
143
169
  await this.starting;
144
170
  const store = this.assistant;
171
+ if (!store && this.workbench.state.status !== 'online') {
172
+ throw TaRemoteError.notConnected();
173
+ }
145
174
  if (!store) {
146
175
  throw new Error('Ta is not ready yet.');
147
176
  }
@@ -293,6 +322,18 @@ let TaAssistantImpl = class TaAssistantImpl {
293
322
  this.persisted.set(FILE, sessionFile);
294
323
  }
295
324
  }
325
+ /** Keeps the conversation on the device as it changes, under its file of the time (`restart` gives it another). */
326
+ keep(store) {
327
+ var _a;
328
+ (_a = this.unkeep) === null || _a === void 0 ? void 0 : _a.call(this);
329
+ let file = this.sessionFile;
330
+ this.unkeep = this.kept.follow(store, () => {
331
+ if (this.assistant === store) {
332
+ file = this.sessionFile;
333
+ }
334
+ return file;
335
+ });
336
+ }
296
337
  /** The role of ta, whether it asks first, and what the user added to it. */
297
338
  systemPrompt() {
298
339
  return assistantRole(this.settings.state.settings.confirmTasks, this.prompt);
@@ -325,8 +366,8 @@ let TaAssistantImpl = class TaAssistantImpl {
325
366
  * trip to ta serve, which over a relay or a phone's network takes long.
326
367
  */
327
368
  async open() {
328
- var _a;
329
- var _b;
369
+ var _a, _b;
370
+ var _c;
330
371
  this.watchTasks();
331
372
  const clientTools = this.clientTools();
332
373
  const [tasks, file, wasAsking, sessions] = await Promise.all([
@@ -351,7 +392,7 @@ let TaAssistantImpl = class TaAssistantImpl {
351
392
  if (!info) {
352
393
  this.persisted.set(ASKING, asking);
353
394
  const options = {
354
- cwd: (_b = (_a = this.workbench.state.server) === null || _a === void 0 ? void 0 : _a.cwd) !== null && _b !== void 0 ? _b : '.',
395
+ cwd: (_c = (_a = this.workbench.state.server) === null || _a === void 0 ? void 0 : _a.cwd) !== null && _c !== void 0 ? _c : '.',
355
396
  appendSystemPrompt: this.systemPrompt(),
356
397
  clientTools: clientTools.map(tool => tool.definition),
357
398
  };
@@ -369,11 +410,20 @@ let TaAssistantImpl = class TaAssistantImpl {
369
410
  }
370
411
  const { sessionId } = info;
371
412
  this.cwd = info.cwd;
372
- const store = this.workbench.createStore(sessionId, { clientTools });
413
+ // What the device kept shows on: the messages that are the same keep their objects.
414
+ const store = this.workbench.createStore(sessionId, { clientTools, initial: (_b = this.preview) === null || _b === void 0 ? void 0 : _b.state });
373
415
  await Promise.all([named ? this.server.setSessionName(sessionId, 'Ta') : undefined, this.applyModel(sessionId, info.model), store.attach()]);
374
416
  store.onGone(() => void this.recover(store));
417
+ store.subscribe(state => {
418
+ if (!state.working && this.assistant === store) {
419
+ this.flushNotes();
420
+ }
421
+ });
375
422
  this.assistant = store;
423
+ this.preview = undefined;
424
+ this.keep(store);
376
425
  this.update({ ready: true, error: undefined });
426
+ this.flushNotes();
377
427
  await this.followRunning(sessions);
378
428
  }
379
429
  /**
@@ -516,6 +566,8 @@ let TaAssistantImpl = class TaAssistantImpl {
516
566
  return;
517
567
  }
518
568
  if (state.working) {
569
+ // Not ended after all: the double hears of it when it ends again.
570
+ this.notes.delete(id);
519
571
  if (task.status !== 'running') {
520
572
  this.book.change(id, { status: 'running', endedAt: undefined, result: undefined });
521
573
  }
@@ -532,7 +584,34 @@ let TaAssistantImpl = class TaAssistantImpl {
532
584
  const { status, result, endedAt, key } = AssistantTaskUtil.outcome(state);
533
585
  this.book.change(id, { status, endedAt: endedAt !== null && endedAt !== void 0 ? endedAt : Date.now(), result });
534
586
  this.update({ lastFinished: Date.now() });
535
- void this.send(AssistantTaskUtil.updateNote(this.book.get(id)), 'followUp', `task-update:${id}:${key}`).catch(() => undefined);
587
+ this.notes.set(id, { text: AssistantTaskUtil.updateNote(this.book.get(id)), clientMessageId: `task-update:${id}:${key}`, at: Date.now() });
588
+ this.flushNotes();
589
+ }
590
+ /**
591
+ * Sends the notes of the tasks that stayed ended a moment, once the double is not at work: what it
592
+ * did not hear yet waits here rather than in its queue, where a task that ended again would add one more.
593
+ */
594
+ flushNotes() {
595
+ clearTimeout(this.noteTimer);
596
+ this.noteTimer = undefined;
597
+ const store = this.assistant;
598
+ if (!this.notes.size || !store || store.state.working) {
599
+ return;
600
+ }
601
+ const now = Date.now();
602
+ let next = Number.POSITIVE_INFINITY;
603
+ for (const [id, note] of this.notes) {
604
+ const wait = note.at + this.noteSettleMs - now;
605
+ if (wait > 0) {
606
+ next = Math.min(next, wait);
607
+ continue;
608
+ }
609
+ this.notes.delete(id);
610
+ void this.send(note.text, 'followUp', note.clientMessageId).catch(() => undefined);
611
+ }
612
+ if (next !== Number.POSITIVE_INFINITY) {
613
+ this.noteTimer = setTimeout(() => this.flushNotes(), next);
614
+ }
536
615
  }
537
616
  update(change) {
538
617
  this.current = { ...this.current, ...change };
@@ -553,6 +632,10 @@ __decorate([
553
632
  Autowired(TaSettings),
554
633
  __metadata("design:type", Object)
555
634
  ], TaAssistantImpl.prototype, "settings", void 0);
635
+ __decorate([
636
+ Autowired(TaKeptChats),
637
+ __metadata("design:type", Object)
638
+ ], TaAssistantImpl.prototype, "kept", void 0);
556
639
  TaAssistantImpl = __decorate([
557
640
  Component(TaAssistant)
558
641
  ], TaAssistantImpl);
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { WebTask, WebTaskEntry } from '../extension/web-extension-api.js';
2
+ import type { WebTask, WebTaskEntry, WebTaskRemoval } from '../extension/web-extension-api.js';
3
3
  import { type Translate } from '../i18n/use-t.js';
4
4
  import type { AssistantAsk } from './assistant-protocol.js';
5
5
  /** The dot of a status, in the colors of the steps of a turn. */
@@ -23,13 +23,47 @@ export declare const TaskCard: React.MemoExoticComponent<({ task }: {
23
23
  export declare function TaskCards({ tasks }: {
24
24
  tasks: WebTaskEntry[];
25
25
  }): React.JSX.Element | null;
26
- /** A task in a list: its face, its title and what it is at, its time. */
27
- export declare const TaskRow: React.MemoExoticComponent<({ task }: {
26
+ /** What a list of tasks does with its rows: the same functions for every row, so that a row draws again only for its own change. */
27
+ export interface TaskListActions {
28
+ /** Deletes it once the user agrees. */
29
+ remove(task: WebTaskEntry): void;
30
+ /** The list starts selecting, with it chosen. */
31
+ select(key: string): void;
32
+ /** Chooses it, or no longer, while the list selects. */
33
+ toggle(key: string): void;
34
+ }
35
+ export interface TaskRowProps {
28
36
  task: WebTaskEntry;
29
- }) => React.JSX.Element>;
30
- /** Every task: what waits for the user, what runs, then what ended, the latest first. */
31
- export declare function TaskBoardList({ tasks }: {
37
+ actions?: TaskListActions;
38
+ /** The list selects: a tap chooses the row, `checked` once chosen. */
39
+ selecting?: boolean;
40
+ checked?: boolean;
41
+ }
42
+ /**
43
+ * A task in a list: its face, its title and what it is at, its time. On a phone a swipe to the left shows
44
+ * Delete behind it, as the other lists; its menu starts selecting several, to delete them at once.
45
+ */
46
+ export declare const TaskRow: React.MemoExoticComponent<({ task, actions, selecting, checked }: TaskRowProps) => React.JSX.Element>;
47
+ /**
48
+ * Which tasks of a list are chosen while it selects (undefined while it does not), and what its rows do: a
49
+ * swipe deletes one, the menu of one starts selecting, and the bar deletes those chosen, asked once. Those
50
+ * gone from the list are no longer chosen; with none left that can be deleted, it stops selecting.
51
+ */
52
+ export declare function useTaskSelection(tasks: readonly WebTaskEntry[], remove: (tasks: readonly WebTaskRemoval[]) => Promise<boolean>): {
53
+ actions: TaskListActions;
54
+ selecting: boolean;
55
+ isChosen: (task: WebTaskEntry) => boolean;
56
+ selected: WebTaskEntry[];
57
+ removable: WebTaskEntry[];
58
+ selectAll: (all: boolean) => void;
59
+ done: () => void;
60
+ /** Deletes those chosen once the user agrees, and stops selecting. */
61
+ removeSelected: () => Promise<void>;
62
+ };
63
+ /** Every task: what waits for the user, what runs, then what ended, the latest first. `onRemove` deletes some once the user agrees (useRemoveTasks). */
64
+ export declare function TaskBoardList({ tasks, onRemove }: {
32
65
  tasks: readonly WebTaskEntry[];
66
+ onRemove(tasks: readonly WebTaskRemoval[]): Promise<boolean>;
33
67
  }): React.JSX.Element;
34
68
  /** In the head of the double: how many run and how many wait for the user; the tasks open on a click. */
35
69
  export declare function TasksChip({ tasks, onOpen }: {
@@ -4,6 +4,8 @@ import { useContextMenu } from '../components/context-menu.js';
4
4
  import { TasksPicture } from '../components/empty-pictures.js';
5
5
  import { EmptyState } from '../components/empty-state.js';
6
6
  import { Icon, IconButton } from '../components/icon.js';
7
+ import { SelectBar, SelectCheck } from '../components/select-bar.js';
8
+ import { SwipeRow } from '../components/swipe-row.js';
7
9
  import { WebTaskUtil } from '../extension/web-tasks.js';
8
10
  import { useT } from '../i18n/use-t.js';
9
11
  // The tasks of the double and of extensions, drawn alike: a card in the turn that started it, a row in the lists.
@@ -66,21 +68,21 @@ export function taskLine(task, t) {
66
68
  const detail = (_a = task.detail) === null || _a === void 0 ? void 0 : _a.trim();
67
69
  return detail && detail !== status ? detail : status;
68
70
  }
69
- function menuItems(task) {
71
+ function menuItems(task, more) {
70
72
  var _a;
71
73
  var _b;
72
- return ((_b = (_a = task.menu) === null || _a === void 0 ? void 0 : _a.call(task)) !== null && _b !== void 0 ? _b : [])
74
+ return [
75
+ ...((_b = (_a = task.menu) === null || _a === void 0 ? void 0 : _a.call(task)) !== null && _b !== void 0 ? _b : []).map(section => section.map(item => ({ label: item.label, disabled: item.disabled, danger: item.danger, run: item.run }))),
76
+ more,
77
+ ]
73
78
  .filter(section => section.length > 0)
74
- .flatMap((section, index) => [
75
- ...(index > 0 ? ['-'] : []),
76
- ...section.map(item => ({ label: item.label, disabled: item.disabled, danger: item.danger, run: item.run })),
77
- ]);
79
+ .flatMap((section, index) => [...(index > 0 ? ['-'] : []), ...section]);
78
80
  }
79
- /** A held finger or a right click opens its …; so does the button that shows on hover. */
80
- function useTaskMenu(task) {
81
+ /** A held finger or a right click opens its …; so does the button that shows on hover. `more`: what the list adds, last. */
82
+ function useTaskMenu(task, more = []) {
81
83
  const [menu, openMenu] = useContextMenu();
82
84
  const open = (event) => {
83
- const items = menuItems(task);
85
+ const items = menuItems(task, more);
84
86
  if (items.length > 0) {
85
87
  openMenu(event, items);
86
88
  }
@@ -112,12 +114,18 @@ export function TaskCards({ tasks }) {
112
114
  }
113
115
  return (React.createElement("div", { className: "ta-task-cards" }, tasks.map(task => (React.createElement(TaskCard, { key: task.key, task: task })))));
114
116
  }
115
- /** A task in a list: its face, its title and what it is at, its time. */
116
- export const TaskRow = React.memo(function TaskRow({ task }) {
117
+ /**
118
+ * A task in a list: its face, its title and what it is at, its time. On a phone a swipe to the left shows
119
+ * Delete behind it, as the other lists; its menu starts selecting several, to delete them at once.
120
+ */
121
+ export const TaskRow = React.memo(function TaskRow({ task, actions, selecting = false, checked = false }) {
117
122
  const t = useT();
118
- const [menu, openMenu] = useTaskMenu(task);
119
- return (React.createElement("li", { className: `ta-task-row ta-task-${task.status}`, onContextMenu: openMenu },
120
- React.createElement("button", { type: "button", className: "ta-task-row-main", onClick: () => task.open() },
123
+ const removable = !!task.remove && !!actions;
124
+ const [menu, openMenu] = useTaskMenu(task, removable ? [{ label: t('ta.tasks.select'), run: () => actions === null || actions === void 0 ? void 0 : actions.select(task.key) }] : []);
125
+ const swipe = removable && !selecting ? [{ key: 'remove', label: t('ta.task.remove'), danger: true, run: () => actions === null || actions === void 0 ? void 0 : actions.remove(task) }] : undefined;
126
+ return (React.createElement(SwipeRow, { as: "li", className: `ta-task-row ta-task-${task.status}${selecting ? ' ta-selecting' : ''}`, actions: swipe, overlay: menu, onContextMenu: selecting ? undefined : openMenu },
127
+ React.createElement("button", { type: "button", className: "ta-task-row-main", "aria-pressed": selecting ? checked : undefined, disabled: selecting && !removable, onClick: selecting ? () => actions === null || actions === void 0 ? void 0 : actions.toggle(task.key) : () => task.open() },
128
+ selecting && React.createElement(SelectCheck, { checked: checked, disabled: !removable }),
121
129
  React.createElement(TaskIcon, { task: task, size: 28 }),
122
130
  React.createElement("span", { className: "ta-task-row-text" },
123
131
  React.createElement("span", { className: "ta-task-row-title" }, task.title),
@@ -125,29 +133,73 @@ export const TaskRow = React.memo(function TaskRow({ task }) {
125
133
  React.createElement("span", { className: `ta-status ta-status-${TASK_DOT[task.status]}` }),
126
134
  React.createElement("span", null, taskLine(task, t)))),
127
135
  React.createElement(Elapsed, { task: task })),
128
- task.menu && React.createElement(IconButton, { icon: MoreHorizontal, label: t('ta.more'), className: "ta-task-more", onClick: openMenu }),
129
- menu));
136
+ (task.menu || removable) && !selecting && React.createElement(IconButton, { icon: MoreHorizontal, label: t('ta.more'), className: "ta-task-more", onClick: openMenu })));
130
137
  });
131
138
  const ENDED_SHOWN = 8;
132
- /** Every task: what waits for the user, what runs, then what ended, the latest first. */
133
- export function TaskBoardList({ tasks }) {
139
+ /**
140
+ * Which tasks of a list are chosen while it selects (undefined while it does not), and what its rows do: a
141
+ * swipe deletes one, the menu of one starts selecting, and the bar deletes those chosen, asked once. Those
142
+ * gone from the list are no longer chosen; with none left that can be deleted, it stops selecting.
143
+ */
144
+ export function useTaskSelection(tasks, remove) {
145
+ const [chosen, setChosen] = React.useState();
146
+ const removable = React.useMemo(() => tasks.filter(task => task.remove), [tasks]);
147
+ const selected = chosen ? removable.filter(task => chosen.has(task.key)) : [];
148
+ const selecting = !!chosen && removable.length > 0;
149
+ React.useEffect(() => {
150
+ if (chosen && removable.length === 0) {
151
+ setChosen(undefined);
152
+ }
153
+ }, [chosen, removable.length]);
154
+ const actions = React.useMemo(() => ({
155
+ remove: task => void remove([task]),
156
+ select: key => setChosen(new Set([key])),
157
+ toggle: key => setChosen(before => {
158
+ const next = new Set(before);
159
+ if (!next.delete(key)) {
160
+ next.add(key);
161
+ }
162
+ return next;
163
+ }),
164
+ }), [remove]);
165
+ return {
166
+ actions,
167
+ selecting,
168
+ isChosen: (task) => !!(chosen === null || chosen === void 0 ? void 0 : chosen.has(task.key)),
169
+ selected,
170
+ removable,
171
+ selectAll: (all) => setChosen(new Set(all ? removable.map(task => task.key) : [])),
172
+ done: () => setChosen(undefined),
173
+ /** Deletes those chosen once the user agrees, and stops selecting. */
174
+ removeSelected: async () => {
175
+ if (await remove(selected)) {
176
+ setChosen(undefined);
177
+ }
178
+ },
179
+ };
180
+ }
181
+ /** Every task: what waits for the user, what runs, then what ended, the latest first. `onRemove` deletes some once the user agrees (useRemoveTasks). */
182
+ export function TaskBoardList({ tasks, onRemove }) {
134
183
  const t = useT();
135
184
  const [all, setAll] = React.useState(false);
136
185
  const groups = React.useMemo(() => WebTaskUtil.groups(tasks), [tasks]);
186
+ const selection = useTaskSelection(tasks, onRemove);
137
187
  if (tasks.length === 0) {
138
188
  return React.createElement(EmptyState, { picture: React.createElement(TasksPicture, null), title: t('ta.assistant.noTasks'), hint: t('ta.assistant.noTasksHint') });
139
189
  }
140
- const ended = all ? groups.ended : groups.ended.slice(0, ENDED_SHOWN);
190
+ // Selecting, every row shows: Select all chooses what the user sees.
191
+ const ended = all || selection.selecting ? groups.ended : groups.ended.slice(0, ENDED_SHOWN);
141
192
  const group = (title, list, more) => list.length > 0 && (React.createElement("section", { className: "ta-task-group" },
142
193
  React.createElement("div", { className: "ta-task-group-title" },
143
194
  React.createElement("span", null, t(title)),
144
195
  React.createElement("span", { className: "ta-task-group-count" }, list === ended ? groups.ended.length : list.length)),
145
- React.createElement("ul", { className: "ta-task-rows" }, list.map(task => (React.createElement(TaskRow, { key: task.key, task: task })))),
196
+ React.createElement("ul", { className: "ta-task-rows" }, list.map(task => (React.createElement(TaskRow, { key: task.key, task: task, actions: selection.actions, selecting: selection.selecting, checked: selection.isChosen(task) })))),
146
197
  more));
147
198
  return (React.createElement(React.Fragment, null,
148
199
  group('ta.tasks.waiting', groups.waiting),
149
200
  group('ta.tasks.running', groups.running),
150
- group('ta.tasks.ended', ended, groups.ended.length > ENDED_SHOWN && (React.createElement("button", { type: "button", className: "ta-task-more-rows", onClick: () => setAll(!all) }, t(all ? 'ta.tasks.fewer' : 'ta.tasks.all', { count: groups.ended.length }))))));
201
+ group('ta.tasks.ended', ended, groups.ended.length > ENDED_SHOWN && !selection.selecting && (React.createElement("button", { type: "button", className: "ta-task-more-rows", onClick: () => setAll(!all) }, t(all ? 'ta.tasks.fewer' : 'ta.tasks.all', { count: groups.ended.length })))),
202
+ selection.selecting && (React.createElement(SelectBar, { count: selection.selected.length, total: selection.removable.length, onSelectAll: selection.selectAll, onDone: selection.done, actions: [{ key: 'remove', label: t('ta.task.remove'), danger: true, run: () => void selection.removeSelected() }] }))));
151
203
  }
152
204
  /** In the head of the double: how many run and how many wait for the user; the tasks open on a click. */
153
205
  export function TasksChip({ tasks, onOpen }) {
@@ -1,4 +1,6 @@
1
- import { type Bone, DinoSpecies, type Point } from './dino-species.js';
1
+ import { type Matrix } from './dino-geometry.js';
2
+ import { type Bone, type Point } from './dino-shape.js';
3
+ import { DinoSpecies } from './dino-species.js';
2
4
  /** What ta is doing, as its face and pose show it. */
3
5
  export type Mood = 'idle' | 'listening' | 'thinking' | 'working' | 'speaking' | 'attention' | 'done' | 'sleeping';
4
6
  export declare const MOODS: Mood[];
@@ -39,8 +41,6 @@ export interface Pose {
39
41
  wing: number;
40
42
  }
41
43
  export declare const REST: Pose;
42
- /** A 2D affine transform [a, b, c, d, e, f], as in SVG's matrix(). */
43
- export type Matrix = [number, number, number, number, number, number];
44
44
  /**
45
45
  * How many pieces the rounded side of the head and body is made of, from the far side to the near one.
46
46
  * Between two pieces the outline is swept, not stacked, so the side is smooth at every angle.
@@ -70,7 +70,6 @@ export declare function rig(pose: Pose, species?: DinoSpecies): Rig;
70
70
  export declare function skin(r: Rig): string;
71
71
  /** Where the middle of the head is in a pose, in the coordinates of the drawing; the eyes follow what is around it from there. */
72
72
  export declare function headAt(pose: Pose, species?: DinoSpecies): Point;
73
- export declare function matrix(m: Matrix): string;
74
73
  /** The transforms and the outline a pose draws, ready for the attributes of the drawing. */
75
74
  export interface Frame {
76
75
  skin: string;