@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
@@ -0,0 +1,70 @@
1
+ import { ChatUtil } from './chat-util.js';
2
+ /**
3
+ * The packages of the conversation shown, after a run in which ta may have made or changed one: the web
4
+ * extensions load again; new or removed web tools open the conversation again with them; a changed package
5
+ * has its pi extensions loaded again. A new run in the meantime puts both off to its end.
6
+ */
7
+ export class ChatPackages {
8
+ constructor(extensions, workbench, stores, host) {
9
+ this.extensions = extensions;
10
+ this.workbench = workbench;
11
+ this.stores = stores;
12
+ this.host = host;
13
+ /** The runs of tools of the conversation shown, seen before: only those after are its edits. */
14
+ this.seen = new Set();
15
+ /** A web extension changed packages during a run: its end loads them again. */
16
+ this.pending = false;
17
+ }
18
+ /** The runs of a store so far are not edits of a run to come; `fresh`: a store shown in place of another. */
19
+ saw(store, fresh = false) {
20
+ if (fresh) {
21
+ this.seen.clear();
22
+ }
23
+ for (const id of Object.keys(store.state.tools)) {
24
+ this.seen.add(id);
25
+ }
26
+ }
27
+ /**
28
+ * A run ended, in which ta may have made or changed a package. The web extensions load again. New or
29
+ * removed web tools need the conversation opened again with them; a changed package needs its pi
30
+ * extensions loaded again. A new run in the meantime puts both off to its end.
31
+ */
32
+ settled(store) {
33
+ return this.host.enqueue(ChatUtil.quietly(async () => {
34
+ const changed = await this.extensions.refresh();
35
+ const edits = ChatUtil.packageEdits(store.state, this.seen);
36
+ for (const id of edits) {
37
+ this.seen.add(id);
38
+ }
39
+ if (store !== this.host.shown() || store.state.working) {
40
+ return;
41
+ }
42
+ const pending = this.pending;
43
+ this.pending = false;
44
+ await this.load(store, changed || edits.length > 0 || pending);
45
+ }));
46
+ }
47
+ /** A web extension changed packages (reloadExtensions): as at the end of a run, or at the end of the one under way. */
48
+ reload(store) {
49
+ return this.host.enqueue(async () => {
50
+ if (store !== this.host.shown()) {
51
+ return;
52
+ }
53
+ if (store.state.working) {
54
+ this.pending = true;
55
+ return;
56
+ }
57
+ await this.load(store, true);
58
+ });
59
+ }
60
+ async load(store, changed) {
61
+ const tools = this.stores.openedWith(store.sessionId);
62
+ if (tools !== undefined && tools !== this.stores.toolNames()) {
63
+ await this.host.reopen(store);
64
+ }
65
+ else if (changed) {
66
+ await this.workbench.server.reload(store.sessionId);
67
+ }
68
+ }
69
+ }
70
+ //# sourceMappingURL=chat-packages.js.map
@@ -10,11 +10,23 @@ export interface ChatDraft {
10
10
  cwd: string;
11
11
  /** `<provider>/<model id>` it will start on; none: the default model of the settings. */
12
12
  model?: string;
13
+ /**
14
+ * Its first message, shown at once while its session opens, or `failed` to open it. `heldAt`: when the
15
+ * connection was lost opening it; it opens once the connection is back, and fails only after HOLD_MS.
16
+ */
17
+ sending?: {
18
+ message: string;
19
+ images?: ImageContent[];
20
+ failed?: string;
21
+ heldAt?: number;
22
+ };
13
23
  }
14
24
  /** What a conversation still opening says of itself, before the server has it (TaChat.show of a session on its way). */
15
25
  export interface ChatOpening {
16
26
  title?: string;
17
27
  cwd?: string;
28
+ /** Its file, when known: what this device kept of it shows while it opens, without the computer too. */
29
+ sessionFile?: string;
18
30
  }
19
31
  export interface ChatState {
20
32
  /** The conversation shown, once there is one. */
@@ -49,8 +61,18 @@ export interface TaChat {
49
61
  setDraftCwd(cwd: string): Promise<void>;
50
62
  /** The model the new conversation starts on; none: the default one. */
51
63
  setDraftModel(model: string | undefined): void;
52
- /** Opens the session of the new conversation and sends its first message; fails as the opening fails. */
64
+ /**
65
+ * Opens the session of the new conversation and sends its first message. When that fails the message
66
+ * stays, marked failed (`ChatDraft.sending`), to send again or take back. Another message while it
67
+ * opens follows the first.
68
+ */
53
69
  submit(message: string, images?: ImageContent[]): Promise<void>;
70
+ /** Sends again the first message that failed. */
71
+ resendDraft(): Promise<void>;
72
+ /** Takes back the first message that failed. */
73
+ discardDraft(): void;
74
+ /** Stops the run of the conversation still opening, once it is there. */
75
+ stopDraft(): void;
54
76
  /**
55
77
  * Shows an open session; one the service closed meanwhile opens again from its file. A session still on its
56
78
  * way (a promise of its id) has its place at once, said by `opening`, and shows when it comes; it fails as it fails.
@@ -0,0 +1,59 @@
1
+ import type { ClientTool, SessionSnapshot, SessionStore } from '@celljs/ta-client';
2
+ import type { TaOpenSessionOptions, TaSessionInfo } from '@celljs/ta-protocol';
3
+ import type { TaWebExtensions } from '../extension/web-extension-protocol.js';
4
+ import type { TaKeptChats } from '../offline/kept-chats-protocol.js';
5
+ import type { TaWorkbench } from '../workbench-protocol.js';
6
+ import { RecentStores } from './recent-stores.js';
7
+ /**
8
+ * The sessions and stores of the conversations TaChat shows. Sessions open, and stores are made, with the
9
+ * web tools of now (each kept with their names, to tell when they changed); a store starts
10
+ * from what the device kept of its conversation when it has it, and knows whether it is attached. One that is
11
+ * not shows a conversation as the device kept it, until the connection is there: it is not kept among the
12
+ * recent ones, the device has it.
13
+ */
14
+ export declare class ChatStores {
15
+ protected readonly workbench: TaWorkbench;
16
+ protected readonly kept: TaKeptChats;
17
+ protected readonly extensions: TaWebExtensions;
18
+ /** The conversations shown before, to show again at once. */
19
+ readonly recent: RecentStores;
20
+ protected readonly tools: WeakMap<SessionStore, string>;
21
+ /** The tools of the sessions this page opened, by session: only those are opened again when the tools change. */
22
+ protected readonly opened: Map<string, string>;
23
+ protected readonly attached: WeakSet<SessionStore>;
24
+ /** The file of the conversation a store not attached shows: the store that attaches for it takes on what failed to go there. */
25
+ protected readonly files: WeakMap<SessionStore, string>;
26
+ constructor(workbench: TaWorkbench, kept: TaKeptChats, extensions: TaWebExtensions);
27
+ /** The names of the web tools of now. */
28
+ toolNames(): string;
29
+ /** Opens a session with the web tools of now. */
30
+ open(options: Partial<TaOpenSessionOptions>): Promise<string>;
31
+ /** The names of the tools this page opened a session with; none for one it did not open. */
32
+ openedWith(sessionId: string): string | undefined;
33
+ /** The session closed. */
34
+ closed(sessionId: string): void;
35
+ /** A store of the session with the web tools of now, showing `initial` until it attaches. */
36
+ create(sessionId: string, initial?: SessionSnapshot): SessionStore;
37
+ /** A store, not attached, of the conversation of `sessionFile` as the device kept it, under `key`; none if it kept none. */
38
+ fromDevice(key: string, sessionFile: string | undefined): Promise<SessionStore | undefined>;
39
+ /** The conversation under `key` as this page or else this device had it, not attached: one shown lately, else the one of its file (else the list's). */
40
+ shown(key: string, sessionFile: string | undefined): Promise<SessionStore | undefined>;
41
+ /** What the device kept of the conversation of a file. */
42
+ read(sessionFile: string | undefined): Promise<SessionSnapshot | undefined>;
43
+ /** Whether the list has the session open. */
44
+ listed(sessionId: string): boolean;
45
+ /** The open session of a file. */
46
+ openOf(sessionFile: string): TaSessionInfo | undefined;
47
+ /** The file of an open session of the list. */
48
+ fileOf(sessionId: string): string | undefined;
49
+ /** The names of the web tools a store runs. */
50
+ toolsOf(store: SessionStore): string | undefined;
51
+ isAttached(store: SessionStore): boolean;
52
+ setAttached(store: SessionStore): void;
53
+ /** It is detached: whether it was attached. */
54
+ setDetached(store: SessionStore): boolean;
55
+ /** Whether `store`, not attached, shows the conversation of `sessionFile`. */
56
+ standsFor(store: SessionStore, sessionFile: string | undefined): boolean;
57
+ /** Runs the web tool of the name that is loaded when the model calls it: a changed one runs as it is now. */
58
+ protected clientTool(name: string): ClientTool;
59
+ }
@@ -0,0 +1,121 @@
1
+ import { ChatUtil } from './chat-util.js';
2
+ import { RecentStores } from './recent-stores.js';
3
+ /**
4
+ * The sessions and stores of the conversations TaChat shows. Sessions open, and stores are made, with the
5
+ * web tools of now (each kept with their names, to tell when they changed); a store starts
6
+ * from what the device kept of its conversation when it has it, and knows whether it is attached. One that is
7
+ * not shows a conversation as the device kept it, until the connection is there: it is not kept among the
8
+ * recent ones, the device has it.
9
+ */
10
+ export class ChatStores {
11
+ constructor(workbench, kept, extensions) {
12
+ this.workbench = workbench;
13
+ this.kept = kept;
14
+ this.extensions = extensions;
15
+ /** The conversations shown before, to show again at once. */
16
+ this.recent = new RecentStores();
17
+ this.tools = new WeakMap();
18
+ /** The tools of the sessions this page opened, by session: only those are opened again when the tools change. */
19
+ this.opened = new Map();
20
+ this.attached = new WeakSet();
21
+ /** The file of the conversation a store not attached shows: the store that attaches for it takes on what failed to go there. */
22
+ this.files = new WeakMap();
23
+ }
24
+ /** The names of the web tools of now. */
25
+ toolNames() {
26
+ return ChatUtil.toolNames(this.extensions.state.tools);
27
+ }
28
+ /** Opens a session with the web tools of now. */
29
+ async open(options) {
30
+ var _a, _b;
31
+ const tools = this.extensions.state.tools;
32
+ const { sessionId } = await this.workbench.server.openSession({
33
+ ...options,
34
+ cwd: ((_a = options.cwd) === null || _a === void 0 ? void 0 : _a.trim()) || ((_b = this.workbench.state.server) === null || _b === void 0 ? void 0 : _b.cwd) || '.',
35
+ clientTools: tools.map(({ name, description, parameters }) => ({ name, description, parameters })),
36
+ });
37
+ this.opened.set(sessionId, ChatUtil.toolNames(tools));
38
+ return sessionId;
39
+ }
40
+ /** The names of the tools this page opened a session with; none for one it did not open. */
41
+ openedWith(sessionId) {
42
+ return this.opened.get(sessionId);
43
+ }
44
+ /** The session closed. */
45
+ closed(sessionId) {
46
+ this.opened.delete(sessionId);
47
+ }
48
+ /** A store of the session with the web tools of now, showing `initial` until it attaches. */
49
+ create(sessionId, initial) {
50
+ const store = this.workbench.createStore(sessionId, { clientTools: this.extensions.state.tools.map(tool => this.clientTool(tool.name)), initial });
51
+ this.tools.set(store, this.toolNames());
52
+ return store;
53
+ }
54
+ /** A store, not attached, of the conversation of `sessionFile` as the device kept it, under `key`; none if it kept none. */
55
+ async fromDevice(key, sessionFile) {
56
+ const initial = await this.read(sessionFile);
57
+ if (!sessionFile || !initial) {
58
+ return undefined;
59
+ }
60
+ const store = this.create(key, initial);
61
+ this.files.set(store, sessionFile);
62
+ return store;
63
+ }
64
+ /** The conversation under `key` as this page or else this device had it, not attached: one shown lately, else the one of its file (else the list's). */
65
+ async shown(key, sessionFile) {
66
+ var _a;
67
+ return (_a = this.recent.take(key, this.toolNames())) !== null && _a !== void 0 ? _a : (await this.fromDevice(key, sessionFile !== null && sessionFile !== void 0 ? sessionFile : this.fileOf(key)));
68
+ }
69
+ /** What the device kept of the conversation of a file. */
70
+ read(sessionFile) {
71
+ return sessionFile ? this.kept.read(sessionFile).catch(() => undefined) : Promise.resolve(undefined);
72
+ }
73
+ /** Whether the list has the session open. */
74
+ listed(sessionId) {
75
+ return this.workbench.state.sessions.some(session => session.sessionId === sessionId);
76
+ }
77
+ /** The open session of a file. */
78
+ openOf(sessionFile) {
79
+ return this.workbench.state.sessions.find(session => session.sessionFile === sessionFile);
80
+ }
81
+ /** The file of an open session of the list. */
82
+ fileOf(sessionId) {
83
+ var _a;
84
+ return (_a = this.workbench.state.sessions.find(session => session.sessionId === sessionId)) === null || _a === void 0 ? void 0 : _a.sessionFile;
85
+ }
86
+ /** The names of the web tools a store runs. */
87
+ toolsOf(store) {
88
+ return this.tools.get(store);
89
+ }
90
+ isAttached(store) {
91
+ return this.attached.has(store);
92
+ }
93
+ setAttached(store) {
94
+ this.attached.add(store);
95
+ }
96
+ /** It is detached: whether it was attached. */
97
+ setDetached(store) {
98
+ return this.attached.delete(store);
99
+ }
100
+ /** Whether `store`, not attached, shows the conversation of `sessionFile`. */
101
+ standsFor(store, sessionFile) {
102
+ return !!sessionFile && !this.attached.has(store) && this.files.get(store) === sessionFile;
103
+ }
104
+ /** Runs the web tool of the name that is loaded when the model calls it: a changed one runs as it is now. */
105
+ clientTool(name) {
106
+ var _a;
107
+ const tool = () => this.extensions.state.tools.find(candidate => candidate.name === name);
108
+ const { description = '', parameters = {} } = (_a = tool()) !== null && _a !== void 0 ? _a : {};
109
+ return {
110
+ definition: { name, description, parameters },
111
+ run: async (input, request) => {
112
+ const current = tool();
113
+ if (!current) {
114
+ throw new Error(`The web extension of the tool ${name} is no longer loaded.`);
115
+ }
116
+ return current.execute(request.id, (input !== null && input !== void 0 ? input : {}));
117
+ },
118
+ };
119
+ }
120
+ }
121
+ //# sourceMappingURL=chat-stores.js.map
@@ -0,0 +1,17 @@
1
+ import { type SessionState } from '@celljs/ta-client';
2
+ import type { WebTool } from '../extension/web-extension-api.js';
3
+ export declare namespace ChatUtil {
4
+ function toolNames(tools: WebTool[]): string;
5
+ /** Ids of the runs of `write` and `edit` in a directory of packages that are not in `seen`. */
6
+ function packageEdits(state: SessionState, seen: Set<string>): string[];
7
+ function message(error: unknown): string;
8
+ /** Only the connection was lost: it mends itself, and what it cut off goes again once it is back. */
9
+ function lost(error: unknown): boolean;
10
+ /** A change nobody asked for now (after a run): a lost connection is no failure to tell, the next run does it again. */
11
+ function quietly(change: () => Promise<void>): () => Promise<void>;
12
+ /**
13
+ * Runs `run` again each time the connection is lost under it and comes back, while `wanted` (a few times
14
+ * at most): opening a conversation on a network that drops goes on, rather than failing.
15
+ */
16
+ function untilConnected(run: () => Promise<void>, connected: () => Promise<void>, wanted: () => boolean): Promise<void>;
17
+ }
@@ -0,0 +1,61 @@
1
+ import { TaRemoteError } from '@celljs/ta-client';
2
+ /** A file in a directory of packages: `extensions/<name>/...`, of the user or a project. */
3
+ const PACKAGE_FILE = /(^|[\\/])extensions[\\/][^\\/]+[\\/]/;
4
+ export var ChatUtil;
5
+ (function (ChatUtil) {
6
+ function toolNames(tools) {
7
+ return tools
8
+ .map(tool => tool.name)
9
+ .sort()
10
+ .join(',');
11
+ }
12
+ ChatUtil.toolNames = toolNames;
13
+ /** Ids of the runs of `write` and `edit` in a directory of packages that are not in `seen`. */
14
+ function packageEdits(state, seen) {
15
+ return Object.entries(state.tools)
16
+ .filter(([id, run]) => {
17
+ var _a;
18
+ const path = (_a = run.args) === null || _a === void 0 ? void 0 : _a.path;
19
+ return !seen.has(id) && (run.toolName === 'write' || run.toolName === 'edit') && typeof path === 'string' && PACKAGE_FILE.test(path);
20
+ })
21
+ .map(([id]) => id);
22
+ }
23
+ ChatUtil.packageEdits = packageEdits;
24
+ function message(error) {
25
+ return error instanceof Error ? error.message : String(error);
26
+ }
27
+ ChatUtil.message = message;
28
+ /** Only the connection was lost: it mends itself, and what it cut off goes again once it is back. */
29
+ function lost(error) {
30
+ return TaRemoteError.isConnectionLost(error);
31
+ }
32
+ ChatUtil.lost = lost;
33
+ /** A change nobody asked for now (after a run): a lost connection is no failure to tell, the next run does it again. */
34
+ function quietly(change) {
35
+ return () => change().catch(error => {
36
+ if (!lost(error)) {
37
+ throw error;
38
+ }
39
+ });
40
+ }
41
+ ChatUtil.quietly = quietly;
42
+ /**
43
+ * Runs `run` again each time the connection is lost under it and comes back, while `wanted` (a few times
44
+ * at most): opening a conversation on a network that drops goes on, rather than failing.
45
+ */
46
+ async function untilConnected(run, connected, wanted) {
47
+ for (let tries = 1;; tries++) {
48
+ try {
49
+ return await run();
50
+ }
51
+ catch (error) {
52
+ if (!lost(error) || tries >= 5 || !wanted()) {
53
+ throw error;
54
+ }
55
+ await connected();
56
+ }
57
+ }
58
+ }
59
+ ChatUtil.untilConnected = untilConnected;
60
+ })(ChatUtil || (ChatUtil = {}));
61
+ //# sourceMappingURL=chat-util.js.map
@@ -1,4 +1,5 @@
1
1
  import { useInject } from '@celljs/react';
2
+ import { SessionReducer, SessionStore } from '@celljs/ta-client';
2
3
  import { ChevronLeft } from 'lucide-react';
3
4
  import * as React from 'react';
4
5
  import { Callout } from '../components/callout.js';
@@ -7,6 +8,7 @@ import { ConnectionBanner } from '../components/connection-bar.js';
7
8
  import { DirectoryButton } from '../components/folder-picker.js';
8
9
  import { HeroCards } from '../components/hero-cards.js';
9
10
  import { IconButton, SidebarLeft } from '../components/icon.js';
11
+ import { MessageList } from '../components/message-list.js';
10
12
  import { useScreenArriving } from '../components/phone-shell.js';
11
13
  import { SessionView } from '../components/session-view.js';
12
14
  import { TaAvatar } from '../components/ta-avatar.js';
@@ -53,24 +55,40 @@ function DraftView({ draft, menu, aboveComposer, belowComposer }) {
53
55
  const list = React.useCallback((directory) => workbench.workspace.listDirectory('.', directory), [workbench]);
54
56
  const pickModel = React.useCallback((model) => chat.setDraftModel(model), [chat]);
55
57
  const model = useDraftModel(workbench.settings, draft, pickModel, t);
58
+ const { sending } = draft;
59
+ const going = !!sending && !sending.failed;
60
+ // Its first message, as the conversation will show it, while the session opens.
61
+ const sent = React.useMemo(() => {
62
+ var _a;
63
+ if (!sending) {
64
+ return undefined;
65
+ }
66
+ const message = {
67
+ role: 'user',
68
+ content: [{ type: 'text', text: sending.message }, ...((_a = sending.images) !== null && _a !== void 0 ? _a : [])],
69
+ timestamp: Date.now(),
70
+ };
71
+ return SessionStore.withSent(SessionReducer.initial(), [{ id: 'draft', message, failed: sending.failed }]);
72
+ }, [sending]);
73
+ const outbox = React.useMemo(() => ({ resend: () => void chat.resendDraft(), discard: () => chat.discardDraft() }), [chat]);
56
74
  return (React.createElement("section", { className: "ta-session" },
57
75
  React.createElement("header", { className: "ta-session-header" },
58
76
  menu,
59
- React.createElement("div", { className: "ta-session-title" },
60
- React.createElement("span", { className: "ta-title" }, t('ta.chat.new'))),
77
+ React.createElement("div", { className: "ta-session-title" }, going ? (React.createElement(React.Fragment, null,
78
+ React.createElement("span", { className: "ta-title" }, MessageUtil.basename(draft.cwd) || t('ta.session.title')),
79
+ React.createElement("span", { className: "ta-muted ta-path", title: draft.cwd }, MessageUtil.shortPath(draft.cwd)))) : (React.createElement("span", { className: "ta-title" }, t('ta.chat.new')))),
61
80
  React.createElement(WorkbenchToggle, null)),
62
- React.createElement("div", { className: "ta-scroll" },
63
- React.createElement("div", { className: "ta-thread" },
64
- React.createElement(Hero, { cwd: draft.cwd, onPick: text => void submit(text).catch(fail) }))),
81
+ React.createElement("div", { className: sent ? 'ta-scroll ta-conversation' : 'ta-scroll' },
82
+ React.createElement("div", { className: "ta-thread" }, sent ? React.createElement(MessageList, { state: sent, outbox: outbox }) : React.createElement(Hero, { cwd: draft.cwd, onPick: text => void submit(text).catch(fail) }))),
65
83
  React.createElement("div", { className: "ta-bottom" },
66
84
  aboveComposer,
67
- React.createElement(Composer, { server: workbench.server, workspace: workbench.workspace, working: false, commands: [], cwd: draft.cwd || undefined, onSubmit: submit, onError: fail, actions: model ? [[model]] : undefined, beside: React.createElement(DirectoryButton, { cwd: draft.cwd, list: list, remote: workbench, onPick: cwd => chat.setDraftCwd(cwd) }) }),
85
+ React.createElement(Composer, { server: workbench.server, workspace: workbench.workspace, working: going, onStop: () => chat.stopDraft(), commands: [], cwd: draft.cwd || undefined, onSubmit: submit, onError: fail, talkPlace: "draft", actions: model ? [[model]] : undefined, beside: going ? undefined : React.createElement(DirectoryButton, { cwd: draft.cwd, list: list, remote: workbench, onPick: cwd => chat.setDraftCwd(cwd) }) }),
68
86
  belowComposer)));
69
87
  }
70
88
  /** A conversation picked that is still loading, laid out as it will be: its head, a spinner, a message box that waits. */
71
89
  function OpeningView({ info, menu }) {
72
90
  const t = useT();
73
- const [, workbench] = useWorkbench();
91
+ const [{ offlineShown }, workbench] = useWorkbench();
74
92
  return (React.createElement("section", { className: "ta-session", "aria-busy": "true" },
75
93
  React.createElement("header", { className: "ta-session-header" },
76
94
  menu,
@@ -78,16 +96,16 @@ function OpeningView({ info, menu }) {
78
96
  React.createElement("span", { className: "ta-title" }, (info === null || info === void 0 ? void 0 : info.title) || ((info === null || info === void 0 ? void 0 : info.cwd) ? MessageUtil.basename(info.cwd) : t('ta.session.title'))),
79
97
  (info === null || info === void 0 ? void 0 : info.cwd) && (React.createElement("span", { className: "ta-muted ta-path", title: info.cwd }, MessageUtil.shortPath(info.cwd)))),
80
98
  React.createElement(WorkbenchToggle, null)),
81
- React.createElement("div", { className: "ta-empty" },
99
+ React.createElement("div", { className: "ta-empty" }, offlineShown ? (React.createElement("span", { className: "ta-muted" }, t('ta.chat.openingOffline'))) : (React.createElement(React.Fragment, null,
82
100
  React.createElement("span", { className: "ta-spinner" }),
83
101
  " ",
84
- t('ta.chat.opening')),
102
+ t('ta.chat.opening')))),
85
103
  React.createElement("div", { className: "ta-bottom", inert: true },
86
104
  React.createElement(Composer, { server: workbench.server, workspace: workbench.workspace, working: false, commands: [], cwd: info === null || info === void 0 ? void 0 : info.cwd, onError: () => undefined }))));
87
105
  }
88
106
  /** The conversation shown, with the widgets of web extensions around its message box. */
89
107
  export function ChatView({ widgets, onMenu, back }) {
90
- var _a, _b;
108
+ var _a, _b, _c, _d;
91
109
  const t = useT();
92
110
  const [{ sessions, saved }, workbench] = useWorkbench();
93
111
  const [{ store, draft, pending, opening, error }] = useChat();
@@ -123,7 +141,10 @@ export function ChatView({ widgets, onMenu, back }) {
123
141
  " ",
124
142
  t('ta.chat.opening'))))));
125
143
  }
126
- const info = sessions.find(session => session.sessionId === store.sessionId);
127
- return (React.createElement(SessionView, { key: store.sessionId, store: store, server: workbench.server, workspace: workbench.workspace, info: info, onClosed: refresh, onActivity: refresh, leading: menu, trailing: React.createElement(WorkbenchToggle, null), empty: React.createElement(Hero, { cwd: (_b = info === null || info === void 0 ? void 0 : info.cwd) !== null && _b !== void 0 ? _b : '', onPick: text => store.prompt(text).catch(() => undefined) }), aboveComposer: aboveComposer, belowComposer: around('belowEditor') }));
144
+ // One shown from the device under what is pending (a saved conversation, an agent's on its way) is said by what opens.
145
+ const info = (_b = sessions.find(session => session.sessionId === store.sessionId)) !== null && _b !== void 0 ? _b : (opening && pending === store.sessionId
146
+ ? { sessionId: store.sessionId, sessionName: opening.title, cwd: (_c = opening.cwd) !== null && _c !== void 0 ? _c : '', sessionFile: opening.sessionFile }
147
+ : undefined);
148
+ return (React.createElement(SessionView, { key: store.sessionId, store: store, server: workbench.server, workspace: workbench.workspace, info: info, onClosed: refresh, onActivity: refresh, leading: menu, trailing: React.createElement(WorkbenchToggle, null), empty: React.createElement(Hero, { cwd: (_d = info === null || info === void 0 ? void 0 : info.cwd) !== null && _d !== void 0 ? _d : '', onPick: text => store.send(text).catch(() => undefined) }), aboveComposer: aboveComposer, belowComposer: around('belowEditor') }));
128
149
  }
129
150
  //# sourceMappingURL=chat-view.js.map
@@ -1,42 +1,37 @@
1
- import type { ClientTool, SessionState, SessionStore } from '@celljs/ta-client';
2
- import { type ImageContent, type TaEvent, type TaOpenSessionOptions, type TaSessionInfo } from '@celljs/ta-protocol';
3
- import type { WebTool } from '../extension/web-extension-api.js';
1
+ import { type SessionStore } from '@celljs/ta-client';
2
+ import { type ImageContent, type TaEvent } from '@celljs/ta-protocol';
4
3
  import { TaWebExtensions } from '../extension/web-extension-protocol.js';
5
4
  import { TaNotices } from '../notices/notices-protocol.js';
5
+ import { TaKeptChats } from '../offline/kept-chats-protocol.js';
6
6
  import { TaState } from '../state/state-protocol.js';
7
7
  import { TaWorkbench } from '../workbench-protocol.js';
8
- import { type ChatOpening, type ChatState, TaChat } from './chat-protocol.js';
9
- import { RecentStores } from './recent-stores.js';
10
- export declare namespace ChatUtil {
11
- function toolNames(tools: WebTool[]): string;
12
- /** Ids of the runs of `write` and `edit` in a directory of packages that are not in `seen`. */
13
- function packageEdits(state: SessionState, seen: Set<string>): string[];
14
- function message(error: unknown): string;
15
- }
8
+ import { ChatPackages } from './chat-packages.js';
9
+ import { type ChatDraft, type ChatOpening, type ChatState, TaChat } from './chat-protocol.js';
10
+ import { ChatStores } from './chat-stores.js';
16
11
  export declare class TaChatImpl implements TaChat {
17
12
  protected readonly workbench: TaWorkbench;
18
13
  protected readonly extensions: TaWebExtensions;
19
14
  protected readonly notices: TaNotices;
20
15
  protected readonly persisted: TaState;
16
+ protected readonly kept: TaKeptChats;
21
17
  protected current: ChatState;
22
18
  protected readonly listeners: Set<(state: ChatState) => void>;
23
19
  /** One change of the conversation shown at a time. */
24
20
  protected queue: Promise<void>;
25
- /** The tools of the conversations this page opened, by session: only those are opened again when the tools change. */
26
- protected readonly opened: Map<string, string>;
27
- protected readonly seenEdits: Set<string>;
28
21
  protected unfollow: (() => void)[];
29
22
  protected watching: boolean;
30
- /** A web extension changed packages during a run: its end loads them again. */
31
- protected reloadPending: boolean;
32
23
  /** The conversation asked for last: of quick switches, only the last is shown. */
33
24
  protected wanted?: string;
34
25
  /** Sessions shown while still on their way, counted for their keys. */
35
26
  protected coming: number;
36
- /** The conversations shown before, to show again at once. */
37
- protected readonly recent: RecentStores;
38
- /** The names of the web tools each store runs. */
39
- protected readonly toolsOf: WeakMap<SessionStore, string>;
27
+ /** Stop was pressed while the new conversation opened: its run stops once it is there. */
28
+ protected stopping: boolean;
29
+ protected madeStores?: ChatStores;
30
+ protected madePackages?: ChatPackages;
31
+ /** The packages of the conversation shown, loaded again after a run that changed them. */
32
+ protected get packages(): ChatPackages;
33
+ /** The sessions and stores of the conversations, made once the services are in. */
34
+ protected get stores(): ChatStores;
40
35
  get state(): ChatState;
41
36
  subscribe(listener: (state: ChatState) => void): () => void;
42
37
  start(): Promise<void>;
@@ -46,6 +41,13 @@ export declare class TaChatImpl implements TaChat {
46
41
  protected followDefault(): void;
47
42
  setDraftModel(model: string | undefined): void;
48
43
  submit(message: string, images?: ImageContent[]): Promise<void>;
44
+ /** Opens the new conversation with its first message (`ChatDraft.sending`). */
45
+ protected openDraft(): Promise<void>;
46
+ /** Keeps the first message on its way while the connection is lost, and opens it once it is back; false past HOLD_MS. */
47
+ protected holdDraft(sending: NonNullable<ChatDraft['sending']>): boolean;
48
+ resendDraft(): Promise<void>;
49
+ discardDraft(): void;
50
+ stopDraft(): void;
49
51
  show(session: string | Promise<string>, opening?: ChatOpening): Promise<void>;
50
52
  /** A session the caller still opens: its place shows now, under a key no session has. */
51
53
  protected showComing(session: Promise<string>, opening: ChatOpening | undefined): Promise<void>;
@@ -62,19 +64,20 @@ export declare class TaChatImpl implements TaChat {
62
64
  /** Closes an open session; its file stays. Closing the one shown shows another, or a new one. */
63
65
  protected close(sessionId: string): Promise<void>;
64
66
  protected enqueue(change: () => Promise<void>): Promise<void>;
65
- /** Opens a session with the tools of the web extensions of now. */
66
- protected open(options: Partial<TaOpenSessionOptions>): Promise<string>;
67
67
  /**
68
68
  * Follows a session, running the web tools it asks for. One shown lately and still open shows at once
69
- * as it was, and catches up as it attaches again. Another shows once loaded, the conversation shown
70
- * staying until then, so that switching does not flash an empty page.
69
+ * as it was, and catches up as it attaches again; so does one this device kept (its file: `sessionFile`,
70
+ * else the list's). Another shows once loaded, the conversation shown staying until then, so that
71
+ * switching does not flash an empty page.
72
+ */
73
+ protected attach(sessionId: string, send?: (store: SessionStore) => Promise<unknown>, sessionFile?: string): Promise<void>;
74
+ /**
75
+ * Before the connection, the conversation picked as this device kept it, under `key` (what is pending):
76
+ * one shown lately, else the one of its file. It attaches once connected (`attach`); online, `attach` shows it.
71
77
  */
72
- protected attach(sessionId: string): Promise<void>;
73
- protected listed(sessionId: string): boolean;
78
+ protected showKept(key: string, sessionFile?: string): Promise<void>;
74
79
  /** Shows a store in place of the one shown, which is kept for later. */
75
80
  protected enter(store: SessionStore): void;
76
- /** The open session of a file. */
77
- protected openOf(sessionFile: string): TaSessionInfo | undefined;
78
81
  /**
79
82
  * A session of the list that the service closed since the list was read (idle, or a restart): opened
80
83
  * again from its file. One of a package's group is left to its package, which opens it with its role.
@@ -85,8 +88,6 @@ export declare class TaChatImpl implements TaChat {
85
88
  /** The newest other open session, or a new conversation. */
86
89
  protected replace(): Promise<void>;
87
90
  protected showDraft(): void;
88
- /** Runs the web tool of the name that is loaded when the model calls it: a changed one runs as it is now. */
89
- protected clientTool(name: string): ClientTool;
90
91
  protected follow(store: SessionStore): void;
91
92
  /**
92
93
  * The events of a store go to web extensions once it is attached: not those it catches up on, which
@@ -96,15 +97,6 @@ export declare class TaChatImpl implements TaChat {
96
97
  /** Stops following the conversation shown; it is kept to show again unless `keep` is false (it closed, or is gone). */
97
98
  protected leave(keep?: boolean): void;
98
99
  protected onEvent(event: TaEvent): void;
99
- /**
100
- * A run ended, in which ta may have made or changed a package. The web extensions load again. New or
101
- * removed web tools need the conversation opened again with them; a changed package needs its pi
102
- * extensions loaded again. A new run in the meantime puts both off to its end.
103
- */
104
- protected settled(store: SessionStore): Promise<void>;
105
- /** A web extension changed packages (reloadExtensions): as at the end of a run, or at the end of the one under way. */
106
- protected reloadPackages(store: SessionStore): Promise<void>;
107
- protected loadPackages(store: SessionStore, changed: boolean): Promise<void>;
108
100
  /** The same conversation, from its file, with the tools of now. */
109
101
  protected reopen(store: SessionStore): Promise<void>;
110
102
  protected remember(info: {