@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
@@ -11,6 +11,8 @@ export interface AssistantTaskActions {
11
11
  /** Shows the double, where a start waits for the user's go. */
12
12
  openDouble(): void;
13
13
  menu(task: AssistantTask): WebMenuItem[][];
14
+ /** Deletes it without asking (WebTask.remove). */
15
+ remove(task: AssistantTask): Promise<void>;
14
16
  }
15
17
  /** What of a task's session the list shows: a new task object only when it changes. */
16
18
  interface Shown {
@@ -154,6 +154,8 @@ class AssistantTaskSource {
154
154
  origin: task.origin,
155
155
  open: () => this.actions.open(task),
156
156
  menu: () => this.actions.menu(task),
157
+ remove: () => this.actions.remove(task),
158
+ removeHint: this.actions.t('ta.task.removeHint'),
157
159
  };
158
160
  }
159
161
  }
@@ -13,6 +13,8 @@ export declare namespace AssistantTaskUtil {
13
13
  /**
14
14
  * The tasks of both lists, each in its newer copy (the higher `rev`; the server's, `theirs`, when
15
15
  * both are as new, so that the pages end with the same), in the order they started; the last MAX_TASKS.
16
+ * A task taken off the list in either stays off: a page that changed it meanwhile, as often, does not
17
+ * bring it back.
16
18
  */
17
19
  function merge(ours: readonly AssistantTask[], theirs: readonly AssistantTask[]): AssistantTask[];
18
20
  /** The tasks the lists show. */
@@ -43,6 +45,12 @@ export declare namespace AssistantTaskUtil {
43
45
  function lastWords(messages: readonly SessionMessage[]): string | undefined;
44
46
  /** What the double reads when a task ended. */
45
47
  function updateNote(task: AssistantTask): string;
48
+ /** The task a note of updateNote is about, if `text` is one. */
49
+ function noteOf(text: string): {
50
+ id: string;
51
+ title: string;
52
+ status: AssistantTask['status'];
53
+ } | undefined;
46
54
  /** What the double reads when the user hands it one of their conversations. */
47
55
  function adoptedNote(task: AssistantTask, said: string): string;
48
56
  }
@@ -6,6 +6,8 @@ const message_1 = require("../util/message");
6
6
  exports.MAX_TASKS = 50;
7
7
  /** As much of what a task said as the double reads. */
8
8
  const RESULT_CHARS = 4000;
9
+ /** The start of a note of updateNote. */
10
+ const NOTE = /^<task_update id="([^"]+)" title="([^"]*)" status="(\w+)">/;
9
11
  /**
10
12
  * What the pages of the double agree on about its tasks. Every page of the user lists them, follows those
11
13
  * that run and keeps the list on the server: no one page owns them, so a change is a newer copy of a task,
@@ -18,6 +20,8 @@ var AssistantTaskUtil;
18
20
  /**
19
21
  * The tasks of both lists, each in its newer copy (the higher `rev`; the server's, `theirs`, when
20
22
  * both are as new, so that the pages end with the same), in the order they started; the last MAX_TASKS.
23
+ * A task taken off the list in either stays off: a page that changed it meanwhile, as often, does not
24
+ * bring it back.
21
25
  */
22
26
  function merge(ours, theirs) {
23
27
  var _a, _b;
@@ -27,9 +31,9 @@ var AssistantTaskUtil;
27
31
  }
28
32
  for (const task of theirs) {
29
33
  const mine = byId.get(task.id);
30
- if (!mine || ((_a = task.rev) !== null && _a !== void 0 ? _a : 0) >= ((_b = mine.rev) !== null && _b !== void 0 ? _b : 0)) {
31
- byId.set(task.id, task);
32
- }
34
+ const newer = !mine || ((_a = task.rev) !== null && _a !== void 0 ? _a : 0) >= ((_b = mine.rev) !== null && _b !== void 0 ? _b : 0) ? task : mine;
35
+ const removed = !!(task.removed || (mine === null || mine === void 0 ? void 0 : mine.removed));
36
+ byId.set(task.id, removed && !newer.removed ? { ...newer, removed } : newer);
33
37
  }
34
38
  return [...byId.values()].sort((a, b) => number(a.id) - number(b.id) || a.startedAt - b.startedAt).slice(-exports.MAX_TASKS);
35
39
  }
@@ -93,6 +97,12 @@ var AssistantTaskUtil;
93
97
  return `<task_update id="${task.id}" title="${task.title}" status="${task.status}">\n${((_a = task.result) !== null && _a !== void 0 ? _a : '').slice(0, RESULT_CHARS)}\n</task_update>`;
94
98
  }
95
99
  AssistantTaskUtil.updateNote = updateNote;
100
+ /** The task a note of updateNote is about, if `text` is one. */
101
+ function noteOf(text) {
102
+ const match = NOTE.exec(text);
103
+ return match ? { id: match[1], title: match[2], status: match[3] } : undefined;
104
+ }
105
+ AssistantTaskUtil.noteOf = noteOf;
96
106
  /** What the double reads when the user hands it one of their conversations. */
97
107
  function adoptedNote(task, said) {
98
108
  return `<task_adopted id="${task.id}" title="${task.title}" status="${task.status}">\nThe user handed you one of their conversations, in ${task.cwd}: follow it as your task ${task.id}. Its last words:\n${said.slice(0, RESULT_CHARS)}\n</task_adopted>`;
@@ -62,8 +62,9 @@ exports.ASSISTANT_TASKS_VIEW = 'tasks';
62
62
  /** Every task, the double's and those of extensions, what waits for the user first: a tool of the workbench beside the conversation. */
63
63
  function AssistantTasks() {
64
64
  const tasks = (0, hooks_1.useTasks)();
65
+ const remove = (0, hooks_1.useRemoveTasks)();
65
66
  return (React.createElement("div", { className: "ta-assistant-tasks" },
66
- React.createElement(task_views_1.TaskBoardList, { tasks: tasks })));
67
+ React.createElement(task_views_1.TaskBoardList, { tasks: tasks, onRemove: remove })));
67
68
  }
68
69
  /** The … of a task, from the sections its extension gives: the same entries as in the lists. */
69
70
  function sectionItems(sections) {
@@ -41,6 +41,7 @@ const React = __importStar(require("react"));
41
41
  const callout_1 = require("../components/callout");
42
42
  const composer_1 = require("../components/composer");
43
43
  const composer_addons_1 = require("../components/composer-addons");
44
+ const connection_bar_1 = require("../components/connection-bar");
44
45
  const conversation_scroll_1 = require("../components/conversation-scroll");
45
46
  const dialog_view_1 = require("../components/dialog-view");
46
47
  const earlier_messages_1 = require("../components/earlier-messages");
@@ -123,37 +124,33 @@ function lastReply(messages, start) {
123
124
  }
124
125
  return undefined;
125
126
  }
126
- /** When an item of the conversation began: its first message; one still empty (a turn about to come), when the one before did. */
127
- function startsOf(items) {
128
- let last = Number.NEGATIVE_INFINITY;
129
- return items.map(item => {
130
- const first = item.kind === 'turn' ? item.messages[0] : item.message;
131
- const at = first === null || first === void 0 ? void 0 : first.timestamp;
132
- last = typeof at === 'number' ? at : last;
133
- return last;
134
- });
135
- }
136
127
  /** A turn of the double: held, it opens the same menu as a turn of a conversation (message-menu.tsx). */
137
- function DoubleTurn({ item, children }) {
128
+ function DoubleTurn({ item, latest, children }) {
138
129
  const reply = item.reply.join('\n\n').trim();
139
- const [menu, onContextMenu] = (0, message_menu_1.useMessageMenu)({ kind: 'turn', last: item.active ? undefined : item.last, reply: item.active ? '' : reply });
130
+ const [menu, onContextMenu] = (0, message_menu_1.useMessageMenu)({
131
+ kind: 'turn',
132
+ last: item.active ? undefined : item.last,
133
+ reply: item.active ? '' : reply,
134
+ messages: item.messages,
135
+ });
140
136
  return (React.createElement("div", { className: `ta-msg-ta ${item.active ? 'ta-turn-live' : ''}`, onContextMenu: onContextMenu },
141
137
  children,
142
- !item.active && React.createElement(message_footer_1.TurnFooter, { messages: item.messages, last: item.last, reply: reply }),
138
+ !item.active && React.createElement(message_footer_1.TurnFooter, { messages: item.messages, last: item.last, reply: reply, latest: latest }),
143
139
  menu));
144
140
  }
145
141
  /** What the user said to the double: held, the same menu as a message of a conversation. */
146
142
  function DoubleUserMessage({ message, blocks, text }) {
147
143
  const [menu, onContextMenu] = (0, message_menu_1.useMessageMenu)({ kind: 'user', message, text });
148
144
  return (React.createElement("div", { className: `ta-msg-user ${conversation_scroll_1.ASK_CLASS}`, onContextMenu: onContextMenu },
149
- React.createElement(message_list_1.UserImages, { blocks: blocks }),
150
- text && React.createElement("div", { className: "ta-msg-bubble" }, text),
145
+ React.createElement(message_list_1.UserSaid, { blocks: blocks, text: text, bubble: "ta-msg-bubble" }),
151
146
  React.createElement(message_footer_1.UserFooter, { message: message, text: text }),
152
147
  menu));
153
148
  }
154
149
  function Conversation({ state, tasks, origin, onTask, t }) {
155
150
  const items = React.useMemo(() => process_1.ProcessUtil.items(state.messages, state.working, state.start), [state.messages, state.working, state.start]);
156
- const starts = React.useMemo(() => startsOf(items), [items]);
151
+ const starts = React.useMemo(() => process_1.ProcessUtil.starts(items), [items]);
152
+ const renderers = React.useContext(extension_view_1.MessageRenderers);
153
+ const breaks = React.useMemo(() => process_1.ProcessUtil.timeBreaks(starts, index => process_1.ProcessUtil.shown(items[index], renderers)), [starts, items, renderers]);
157
154
  const own = React.useMemo(() => tasks.filter(task => task.origin && task.origin === origin), [tasks, origin]);
158
155
  let lastTurn = items.length - 1;
159
156
  while (lastTurn >= 0 && items[lastTurn].kind !== 'turn') {
@@ -163,40 +160,43 @@ function Conversation({ state, tasks, origin, onTask, t }) {
163
160
  const last = items[items.length - 1];
164
161
  const status = state.working || state.compacting ? React.createElement(run_status_1.RunStatus, { state: state }) : undefined;
165
162
  const onHead = status && (0, message_list_1.quiet)(last);
163
+ const row = (item, index) => {
164
+ var _a, _b;
165
+ if (item.kind === 'turn') {
166
+ const results = message_1.MessageUtil.results(item.messages);
167
+ const { errorMessage } = ((_a = item.last) !== null && _a !== void 0 ? _a : {});
168
+ const stopReason = message_1.MessageUtil.stopReason(item.last);
169
+ const mood = process_1.ProcessUtil.mood(item, index === lastTurn, waiting);
170
+ const started = web_tasks_1.WebTaskUtil.startedIn(own, origin, starts[index], (_b = starts[index + 1]) !== null && _b !== void 0 ? _b : Number.POSITIVE_INFINITY);
171
+ return (React.createElement(DoubleTurn, { key: item.key, item: item, latest: index === lastTurn },
172
+ React.createElement(message_list_1.Process, { steps: item.steps, active: item.active, results: results, tools: state.tools, leading: React.createElement(message_list_1.TurnAvatar, { mood: mood }), status: onHead && item === last ? status : undefined }),
173
+ React.createElement(task_views_1.TaskCards, { tasks: started }),
174
+ item.reply.map((text, index) => (React.createElement(markdown_1.Markdown, { key: index, text: text, streaming: item.active && index === item.reply.length - 1 }))),
175
+ !item.active && stopReason === 'error' && errorMessage && React.createElement(callout_1.Callout, { level: "error" }, errorMessage)));
176
+ }
177
+ const { role } = item.message;
178
+ if (role === 'custom') {
179
+ return React.createElement(extension_view_1.CustomMessage, { key: item.key, message: item.message });
180
+ }
181
+ if (role !== 'user') {
182
+ return null;
183
+ }
184
+ const blocks = message_1.MessageUtil.blocks(item.message);
185
+ const text = message_1.MessageUtil.text(blocks).trim();
186
+ const update = TASK_UPDATE.exec(text);
187
+ if (update) {
188
+ const status = update[3];
189
+ return (React.createElement("button", { key: item.key, type: "button", className: "ta-task-update", onClick: () => onTask(update[1]) },
190
+ React.createElement("span", { className: `ta-status ta-status-${assistant_tasks_1.TASK_DOTS[status]}` }),
191
+ React.createElement("span", { className: "ta-task-update-text" }, t('ta.task.ended', { title: update[2], status: t(`ta.task.${status}`) })),
192
+ React.createElement(icon_1.Icon, { icon: lucide_react_1.ChevronRight, size: 13, className: "ta-task-update-chevron" })));
193
+ }
194
+ return React.createElement(DoubleUserMessage, { key: item.key, message: item.message, blocks: blocks, text: text });
195
+ };
166
196
  return (React.createElement(React.Fragment, null,
167
- items.map((item, index) => {
168
- var _a, _b;
169
- if (item.kind === 'turn') {
170
- const results = message_1.MessageUtil.results(item.messages);
171
- const { errorMessage } = ((_a = item.last) !== null && _a !== void 0 ? _a : {});
172
- const stopReason = message_1.MessageUtil.stopReason(item.last);
173
- const mood = process_1.ProcessUtil.mood(item, index === lastTurn, waiting);
174
- const started = web_tasks_1.WebTaskUtil.startedIn(own, origin, starts[index], (_b = starts[index + 1]) !== null && _b !== void 0 ? _b : Number.POSITIVE_INFINITY);
175
- return (React.createElement(DoubleTurn, { key: item.key, item: item },
176
- React.createElement(message_list_1.Process, { steps: item.steps, active: item.active, results: results, tools: state.tools, leading: React.createElement(message_list_1.TurnAvatar, { mood: mood }), status: onHead && item === last ? status : undefined }),
177
- React.createElement(task_views_1.TaskCards, { tasks: started }),
178
- item.reply.map((text, index) => (React.createElement(markdown_1.Markdown, { key: index, text: text }))),
179
- !item.active && stopReason === 'error' && errorMessage && React.createElement(callout_1.Callout, { level: "error" }, errorMessage)));
180
- }
181
- const { role } = item.message;
182
- if (role === 'custom') {
183
- return React.createElement(extension_view_1.CustomMessage, { key: item.key, message: item.message });
184
- }
185
- if (role !== 'user') {
186
- return null;
187
- }
188
- const blocks = message_1.MessageUtil.blocks(item.message);
189
- const text = message_1.MessageUtil.text(blocks).trim();
190
- const update = TASK_UPDATE.exec(text);
191
- if (update) {
192
- const status = update[3];
193
- return (React.createElement("button", { key: item.key, type: "button", className: "ta-task-update", onClick: () => onTask(update[1]) },
194
- React.createElement("span", { className: `ta-status ta-status-${assistant_tasks_1.TASK_DOTS[status]}` }),
195
- React.createElement("span", { className: "ta-task-update-text" }, t('ta.task.ended', { title: update[2], status: t(`ta.task.${status}`) })),
196
- React.createElement(icon_1.Icon, { icon: lucide_react_1.ChevronRight, size: 13, className: "ta-task-update-chevron" })));
197
- }
198
- return React.createElement(DoubleUserMessage, { key: item.key, message: item.message, blocks: blocks, text: text });
199
- }),
197
+ items.map((item, index) => (React.createElement(React.Fragment, { key: item.key },
198
+ breaks[index] !== undefined && React.createElement(message_footer_1.TimeBreak, { timestamp: breaks[index] }),
199
+ row(item, index)))),
200
200
  status && !onHead && React.createElement("div", { className: "ta-run-line" }, status)));
201
201
  }
202
202
  function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
@@ -215,7 +215,7 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
215
215
  const [, notices] = (0, hooks_1.useNotices)();
216
216
  const spoken = React.useRef(undefined);
217
217
  const box = React.useRef(null);
218
- const { speak, confirmTasks } = settingsState.settings;
218
+ const { speak, speakTalk, confirmTasks } = settingsState.settings;
219
219
  const [name] = (0, hooks_1.usePersisted)(assistant_state_1.ASSISTANT_NAME_STATE);
220
220
  const attentions = [
221
221
  ...state.pendingUi.map(request => ({ source: 'ta', store, request })),
@@ -238,6 +238,10 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
238
238
  });
239
239
  React.useEffect(() => onMood(mood), [mood, onMood]);
240
240
  const reply = lastReply(state.messages, state.start);
241
+ // Said to it by voice, held (its box, or its entry of the navigation): what it answers is heard once, as a
242
+ // conversation by voice, where the user asked for it (Settings.speakTalk, off at first: a reply read out loud
243
+ // where the user only wanted to type by voice is awkward).
244
+ const aloud = React.useRef(false);
241
245
  // Reads a new reply out once the run has settled; what was said before the page opened stays quiet.
242
246
  React.useEffect(() => {
243
247
  if (state.working || !reply || spoken.current === reply.index) {
@@ -245,7 +249,11 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
245
249
  }
246
250
  const first = spoken.current === undefined;
247
251
  spoken.current = reply.index;
248
- if (!first && speak && voice_1.Voice.canSpeak()) {
252
+ const audible = voice_1.Voice.canSpeak();
253
+ // A conversation by voice is heard even as the first reply the page shows.
254
+ const answerAloud = aloud.current && audible;
255
+ aloud.current = false;
256
+ if (answerAloud || (!first && speak && audible)) {
249
257
  setSpeaking(true);
250
258
  voice_1.Voice.speak(reply.text, settingsState.language, () => setSpeaking(false));
251
259
  }
@@ -314,6 +322,17 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
314
322
  },
315
323
  ]
316
324
  : []),
325
+ ...(voice_1.Voice.canSpeak() && voice_1.Voice.canListen()
326
+ ? [
327
+ {
328
+ key: 'speakTalk',
329
+ label: t('ta.settings.speakTalk'),
330
+ icon: React.createElement(icon_1.Icon, { icon: lucide_react_1.Mic, size: 16 }),
331
+ detail: t(speakTalk ? 'ta.on' : 'ta.off'),
332
+ run: () => settings.update({ speakTalk: !speakTalk }),
333
+ },
334
+ ]
335
+ : []),
317
336
  {
318
337
  key: 'confirm',
319
338
  label: t('ta.assistant.confirmOn'),
@@ -350,8 +369,11 @@ function Chat({ store, tasks, taskStates, onTask, onMood, onTasks }) {
350
369
  attentions.map(({ source, store: from, request }) => (React.createElement("div", { key: request.id, className: "ta-attention" },
351
370
  React.createElement("div", { className: "ta-attention-source" }, source),
352
371
  React.createElement(dialog_view_1.DialogView, { request: request, respond: response => from.respondUi(response).catch(() => undefined) })))),
372
+ React.createElement(connection_bar_1.ConnectionBanner, null),
353
373
  addons.above,
354
- React.createElement(composer_1.Composer, { ref: box, store: store, server: bench.server, workspace: bench.workspace, working: state.working, commands: session.settings.commands, cwd: cwd, placeholder: t('ta.assistant.placeholder'), actions: actions, onSending: hush, onError: fail, voiceSends: true, onListening: on => {
374
+ React.createElement(composer_1.Composer, { ref: box, store: store, server: bench.server, workspace: bench.workspace, working: state.working, commands: session.settings.commands, cwd: cwd, placeholder: t('ta.assistant.placeholder'), actions: actions, onSending: hush, onError: fail, voiceSends: true, talkPlace: "double", onTalkSent: () => {
375
+ aloud.current = speakTalk;
376
+ }, onListening: on => {
355
377
  setListening(on);
356
378
  if (on) {
357
379
  hush();
@@ -369,6 +391,9 @@ function AssistantPanel({ onTask }) {
369
391
  const [mood, setMood] = React.useState('idle');
370
392
  const [name] = (0, hooks_1.usePersisted)(assistant_state_1.ASSISTANT_NAME_STATE);
371
393
  const taskStates = (0, assistant_hooks_1.useTaskStates)(assistant, state.tasks);
394
+ React.useEffect(() => {
395
+ void assistant.showKept();
396
+ }, [assistant]);
372
397
  React.useEffect(() => {
373
398
  if (workbench.status === 'online') {
374
399
  void assistant.start();
@@ -396,7 +421,7 @@ function AssistantPanel({ onTask }) {
396
421
  React.createElement(task_views_1.TasksChip, { tasks: allTasks, onOpen: openTasks }),
397
422
  React.createElement(workbench_toggle_1.WorkbenchToggle, null)),
398
423
  React.createElement("div", { className: "ta-assistant-body" },
399
- React.createElement("div", { className: "ta-assistant-chat" }, store ? (React.createElement(Chat, { store: store, tasks: state.tasks, taskStates: taskStates, onTask: openTask, onMood: setMood, onTasks: openTasks })) : (React.createElement("div", { className: "ta-empty" }, state.error ? (React.createElement(callout_1.Callout, { level: "error" }, state.error)) : (React.createElement(React.Fragment, null,
424
+ React.createElement("div", { className: "ta-assistant-chat" }, store ? (React.createElement(Chat, { store: store, tasks: state.tasks, taskStates: taskStates, onTask: openTask, onMood: setMood, onTasks: openTasks })) : (React.createElement("div", { className: "ta-empty" }, state.error ? (React.createElement(callout_1.Callout, { level: "error" }, state.error)) : workbench.offlineShown ? (React.createElement("span", { className: "ta-muted" }, t('ta.assistant.offline'))) : (React.createElement(React.Fragment, null,
400
425
  React.createElement("span", { className: "ta-spinner" }),
401
426
  " ",
402
427
  t('ta.assistant.waking'))))))))));
@@ -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';
3
4
  import { type Settings, TaSettings } from '../settings/settings-protocol';
4
5
  import { TaState } from '../state/state-protocol';
5
6
  import { TaWorkbench } from '../workbench-protocol';
6
7
  import { type AssistantAsk, type AssistantState, type AssistantTask, TaAssistant } from './assistant-protocol';
7
8
  import { AssistantTaskBook } from './assistant-task-book';
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,6 +143,12 @@ 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 {};
125
154
  //# sourceMappingURL=assistant.d.ts.map
@@ -11,7 +11,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.TaAssistantImpl = void 0;
13
13
  const core_1 = require("@celljs/core");
14
+ const ta_client_1 = require("@celljs/ta-client");
14
15
  const ta_protocol_1 = require("@celljs/ta-protocol");
16
+ const kept_chats_protocol_1 = require("../offline/kept-chats-protocol");
15
17
  const settings_protocol_1 = require("../settings/settings-protocol");
16
18
  const state_protocol_1 = require("../state/state-protocol");
17
19
  const workbench_protocol_1 = require("../workbench-protocol");
@@ -21,6 +23,8 @@ const assistant_state_1 = require("./assistant-state");
21
23
  const assistant_task_book_1 = require("./assistant-task-book");
22
24
  const assistant_task_util_1 = require("./assistant-task-util");
23
25
  const { FILE, TASKS, PROMPT, ASKING } = assistant_state_1.AssistantStates;
26
+ /** 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. */
27
+ const NOTE_SETTLE_MS = 5000;
24
28
  let TaAssistantImpl = class TaAssistantImpl {
25
29
  constructor() {
26
30
  this.current = { ready: false, tasks: [], asks: [] };
@@ -32,6 +36,13 @@ let TaAssistantImpl = class TaAssistantImpl {
32
36
  this.following = new Map();
33
37
  /** The answers the asks wait for, by ask id. */
34
38
  this.answers = new Map();
39
+ /**
40
+ * The notes of tasks that ended, by task id, held while the double works and until the task stayed
41
+ * ended a moment (flushNotes): one per task, the last, so that a task that ends again and again does
42
+ * not pile notes up in the double's queue.
43
+ */
44
+ this.notes = new Map();
45
+ this.noteSettleMs = NOTE_SETTLE_MS;
35
46
  this.asked = 0;
36
47
  this.listeners = new Set();
37
48
  }
@@ -53,6 +64,11 @@ let TaAssistantImpl = class TaAssistantImpl {
53
64
  (_a = this.unwatchSettings) !== null && _a !== void 0 ? _a : (this.unwatchSettings = this.settings.subscribe(state => this.settingsChanged(state.settings)));
54
65
  (_b = this.starting) !== null && _b !== void 0 ? _b : (this.starting = this.open().catch(error => {
55
66
  this.starting = undefined;
67
+ if (ta_client_1.TaRemoteError.isConnectionLost(error)) {
68
+ // No failure to show: it wakes once the connection is back (a moment after, not in a loop).
69
+ setTimeout(() => void this.workbench.connected().then(() => (this.starting || this.assistant ? undefined : this.start()), () => undefined), 1000);
70
+ return;
71
+ }
56
72
  this.update({ error: error instanceof Error ? error.message : String(error) });
57
73
  }));
58
74
  return this.starting;
@@ -63,7 +79,17 @@ let TaAssistantImpl = class TaAssistantImpl {
63
79
  }
64
80
  }
65
81
  store() {
66
- return this.assistant;
82
+ var _a;
83
+ return (_a = this.assistant) !== null && _a !== void 0 ? _a : this.preview;
84
+ }
85
+ async showKept() {
86
+ const file = this.assistant || this.preview ? undefined : await this.persisted.load(FILE);
87
+ const initial = file ? await this.kept.read(file).catch(() => undefined) : undefined;
88
+ if (initial && !this.assistant && !this.preview) {
89
+ // Under its file: it is of no session until the conversation opens, which takes over what it shows.
90
+ this.preview = this.workbench.createStore(file, { initial });
91
+ this.update({});
92
+ }
67
93
  }
68
94
  async loadTasks() {
69
95
  this.watchTasks();
@@ -145,6 +171,9 @@ let TaAssistantImpl = class TaAssistantImpl {
145
171
  // Opening (again, after a reconnect found it gone): sent once it is open.
146
172
  await this.starting;
147
173
  const store = this.assistant;
174
+ if (!store && this.workbench.state.status !== 'online') {
175
+ throw ta_client_1.TaRemoteError.notConnected();
176
+ }
148
177
  if (!store) {
149
178
  throw new Error('Ta is not ready yet.');
150
179
  }
@@ -296,6 +325,18 @@ let TaAssistantImpl = class TaAssistantImpl {
296
325
  this.persisted.set(FILE, sessionFile);
297
326
  }
298
327
  }
328
+ /** Keeps the conversation on the device as it changes, under its file of the time (`restart` gives it another). */
329
+ keep(store) {
330
+ var _a;
331
+ (_a = this.unkeep) === null || _a === void 0 ? void 0 : _a.call(this);
332
+ let file = this.sessionFile;
333
+ this.unkeep = this.kept.follow(store, () => {
334
+ if (this.assistant === store) {
335
+ file = this.sessionFile;
336
+ }
337
+ return file;
338
+ });
339
+ }
299
340
  /** The role of ta, whether it asks first, and what the user added to it. */
300
341
  systemPrompt() {
301
342
  return (0, assistant_role_1.assistantRole)(this.settings.state.settings.confirmTasks, this.prompt);
@@ -328,8 +369,8 @@ let TaAssistantImpl = class TaAssistantImpl {
328
369
  * trip to ta serve, which over a relay or a phone's network takes long.
329
370
  */
330
371
  async open() {
331
- var _a;
332
- var _b;
372
+ var _a, _b;
373
+ var _c;
333
374
  this.watchTasks();
334
375
  const clientTools = this.clientTools();
335
376
  const [tasks, file, wasAsking, sessions] = await Promise.all([
@@ -354,7 +395,7 @@ let TaAssistantImpl = class TaAssistantImpl {
354
395
  if (!info) {
355
396
  this.persisted.set(ASKING, asking);
356
397
  const options = {
357
- cwd: (_b = (_a = this.workbench.state.server) === null || _a === void 0 ? void 0 : _a.cwd) !== null && _b !== void 0 ? _b : '.',
398
+ cwd: (_c = (_a = this.workbench.state.server) === null || _a === void 0 ? void 0 : _a.cwd) !== null && _c !== void 0 ? _c : '.',
358
399
  appendSystemPrompt: this.systemPrompt(),
359
400
  clientTools: clientTools.map(tool => tool.definition),
360
401
  };
@@ -372,11 +413,20 @@ let TaAssistantImpl = class TaAssistantImpl {
372
413
  }
373
414
  const { sessionId } = info;
374
415
  this.cwd = info.cwd;
375
- const store = this.workbench.createStore(sessionId, { clientTools });
416
+ // What the device kept shows on: the messages that are the same keep their objects.
417
+ const store = this.workbench.createStore(sessionId, { clientTools, initial: (_b = this.preview) === null || _b === void 0 ? void 0 : _b.state });
376
418
  await Promise.all([named ? this.server.setSessionName(sessionId, 'Ta') : undefined, this.applyModel(sessionId, info.model), store.attach()]);
377
419
  store.onGone(() => void this.recover(store));
420
+ store.subscribe(state => {
421
+ if (!state.working && this.assistant === store) {
422
+ this.flushNotes();
423
+ }
424
+ });
378
425
  this.assistant = store;
426
+ this.preview = undefined;
427
+ this.keep(store);
379
428
  this.update({ ready: true, error: undefined });
429
+ this.flushNotes();
380
430
  await this.followRunning(sessions);
381
431
  }
382
432
  /**
@@ -519,6 +569,8 @@ let TaAssistantImpl = class TaAssistantImpl {
519
569
  return;
520
570
  }
521
571
  if (state.working) {
572
+ // Not ended after all: the double hears of it when it ends again.
573
+ this.notes.delete(id);
522
574
  if (task.status !== 'running') {
523
575
  this.book.change(id, { status: 'running', endedAt: undefined, result: undefined });
524
576
  }
@@ -535,7 +587,34 @@ let TaAssistantImpl = class TaAssistantImpl {
535
587
  const { status, result, endedAt, key } = assistant_task_util_1.AssistantTaskUtil.outcome(state);
536
588
  this.book.change(id, { status, endedAt: endedAt !== null && endedAt !== void 0 ? endedAt : Date.now(), result });
537
589
  this.update({ lastFinished: Date.now() });
538
- void this.send(assistant_task_util_1.AssistantTaskUtil.updateNote(this.book.get(id)), 'followUp', `task-update:${id}:${key}`).catch(() => undefined);
590
+ this.notes.set(id, { text: assistant_task_util_1.AssistantTaskUtil.updateNote(this.book.get(id)), clientMessageId: `task-update:${id}:${key}`, at: Date.now() });
591
+ this.flushNotes();
592
+ }
593
+ /**
594
+ * Sends the notes of the tasks that stayed ended a moment, once the double is not at work: what it
595
+ * did not hear yet waits here rather than in its queue, where a task that ended again would add one more.
596
+ */
597
+ flushNotes() {
598
+ clearTimeout(this.noteTimer);
599
+ this.noteTimer = undefined;
600
+ const store = this.assistant;
601
+ if (!this.notes.size || !store || store.state.working) {
602
+ return;
603
+ }
604
+ const now = Date.now();
605
+ let next = Number.POSITIVE_INFINITY;
606
+ for (const [id, note] of this.notes) {
607
+ const wait = note.at + this.noteSettleMs - now;
608
+ if (wait > 0) {
609
+ next = Math.min(next, wait);
610
+ continue;
611
+ }
612
+ this.notes.delete(id);
613
+ void this.send(note.text, 'followUp', note.clientMessageId).catch(() => undefined);
614
+ }
615
+ if (next !== Number.POSITIVE_INFINITY) {
616
+ this.noteTimer = setTimeout(() => this.flushNotes(), next);
617
+ }
539
618
  }
540
619
  update(change) {
541
620
  this.current = { ...this.current, ...change };
@@ -557,6 +636,10 @@ __decorate([
557
636
  (0, core_1.Autowired)(settings_protocol_1.TaSettings),
558
637
  __metadata("design:type", Object)
559
638
  ], TaAssistantImpl.prototype, "settings", void 0);
639
+ __decorate([
640
+ (0, core_1.Autowired)(kept_chats_protocol_1.TaKeptChats),
641
+ __metadata("design:type", Object)
642
+ ], TaAssistantImpl.prototype, "kept", void 0);
560
643
  exports.TaAssistantImpl = TaAssistantImpl = __decorate([
561
644
  (0, core_1.Component)(assistant_protocol_1.TaAssistant)
562
645
  ], TaAssistantImpl);
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { WebTask, WebTaskEntry } from '../extension/web-extension-api';
2
+ import type { WebTask, WebTaskEntry, WebTaskRemoval } from '../extension/web-extension-api';
3
3
  import { type Translate } from '../i18n/use-t';
4
4
  import type { AssistantAsk } from './assistant-protocol';
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 }: {