@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,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.TaNoticesImpl = exports.NoticesUtil = exports.SIGN_IN_EVENT = 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");
15
16
  const messages_1 = require("../i18n/messages");
16
17
  const settings_protocol_1 = require("../settings/settings-protocol");
@@ -53,6 +54,9 @@ var NoticesUtil;
53
54
  [ta_protocol_1.TaErrorCode.TOO_MANY_SESSIONS]: 'ta.error.tooManySessions',
54
55
  [ta_protocol_1.TaErrorCode.MESSAGE_CONFLICT]: 'ta.error.messageConflict',
55
56
  [ta_protocol_1.TaErrorCode.MODEL_NOT_FOUND]: 'ta.error.modelNotFound',
57
+ [ta_protocol_1.TaErrorCode.NOTHING_TO_COMPACT]: 'ta.error.nothingToCompact',
58
+ [ta_protocol_1.TaErrorCode.ALREADY_COMPACTED]: 'ta.error.alreadyCompacted',
59
+ [ta_protocol_1.TaErrorCode.SESSION_BUSY]: 'ta.error.sessionBusy',
56
60
  };
57
61
  /** What an error says: its message, and for a failure ta serve names (TaRemoteError) its hint. */
58
62
  function describe(cause) {
@@ -79,8 +83,12 @@ let TaNoticesImpl = class TaNoticesImpl {
79
83
  return () => this.listeners.delete(listener);
80
84
  }
81
85
  notify(text, options = {}) {
82
- var _a;
86
+ var _a, _b;
83
87
  const level = (_a = options.level) !== null && _a !== void 0 ? _a : 'info';
88
+ if (level === 'error' && ta_client_1.TaRemoteError.isConnectionLost(`${text}\n${(_b = options.detail) !== null && _b !== void 0 ? _b : ''}`)) {
89
+ // A web extension saying a call failed, in words: only the connection, which mends itself.
90
+ return this.notDone();
91
+ }
84
92
  const key = NoticesUtil.key(level, text, options);
85
93
  const same = this.current.notices.find(notice => notice.key === key);
86
94
  const notice = {
@@ -104,15 +112,12 @@ let TaNoticesImpl = class TaNoticesImpl {
104
112
  window.dispatchEvent(new Event(exports.SIGN_IN_EVENT));
105
113
  return 0;
106
114
  }
107
- if (code === ta_protocol_1.TaErrorCode.CONNECTION_LOST) {
108
- // The bar of the connection says why; this says what did not happen, once however many calls failed.
109
- const language = this.settings.state.language;
110
- return this.notify((0, messages_1.message)(language, 'ta.connection.notDone'), {
111
- ...options,
112
- level: 'error',
113
- key: 'connection-lost',
114
- detail: (0, messages_1.message)(language, 'ta.connection.notDoneHint'),
115
- });
115
+ if (code === ta_protocol_1.TaErrorCode.CANCELLED) {
116
+ // The user stopped it (or an extension did, and says why itself): nothing went wrong.
117
+ return 0;
118
+ }
119
+ if (ta_client_1.TaRemoteError.isConnectionLost(cause)) {
120
+ return this.notDone();
116
121
  }
117
122
  const known = code ? NoticesUtil.LOCALIZED[code] : undefined;
118
123
  if (known) {
@@ -122,6 +127,11 @@ let TaNoticesImpl = class TaNoticesImpl {
122
127
  }
123
128
  return this.notify(text, { detail, ...options, level: 'error' });
124
129
  }
130
+ /** Not a notice over the page: the row of the connection says that it did not happen, and why. */
131
+ notDone() {
132
+ this.update({ notDoneAt: Date.now() });
133
+ return 0;
134
+ }
125
135
  dismiss(id) {
126
136
  if (this.current.notices.some(notice => notice.id === id)) {
127
137
  this.update({ notices: this.current.notices.filter(notice => notice.id !== id) });
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Values this device keeps across starts, for what the page shows while it cannot reach the computer: more
3
+ * than localStorage holds (a conversation is up to about a megabyte), and read without holding up a frame.
4
+ */
5
+ export interface DeviceValues {
6
+ get<T>(key: string): Promise<T | undefined>;
7
+ /** The values whose key starts with `prefix`. */
8
+ entries<T>(prefix: string): Promise<[string, T][]>;
9
+ set(key: string, value: unknown): Promise<void>;
10
+ delete(key: string): Promise<void>;
11
+ /** Every value whose key starts with `prefix`. */
12
+ deleteAll(prefix: string): Promise<void>;
13
+ }
14
+ /** The keys of what is kept, each with the computer it is of: what one computer showed is not shown for another. */
15
+ export declare namespace OfflineKeys {
16
+ /** The answer of a call that reads (OfflineReads). */
17
+ function read(host: string, call: string): string;
18
+ /** The conversation of a session file (KeptChats). */
19
+ function chat(host: string, sessionFile: string): string;
20
+ /** Which conversations are kept, the one seen last at the end. */
21
+ function chats(host: string): string;
22
+ /** Takes off the device all that was kept of a computer. */
23
+ function forget(values: DeviceValues, host: string): Promise<void>;
24
+ }
25
+ /** In memory: where there is no IndexedDB (a test, a browser that has it off), kept for the page only. */
26
+ export declare class MemoryValues implements DeviceValues {
27
+ protected readonly values: Map<string, unknown>;
28
+ get<T>(key: string): Promise<T | undefined>;
29
+ entries<T>(prefix: string): Promise<[string, T][]>;
30
+ set(key: string, value: unknown): Promise<void>;
31
+ delete(key: string): Promise<void>;
32
+ deleteAll(prefix: string): Promise<void>;
33
+ }
34
+ /**
35
+ * In IndexedDB, one store of keys and values. What fails (no room, the database closed under it) is as if
36
+ * nothing were kept: the page then waits for the computer, as it would without.
37
+ */
38
+ export declare class IndexedValues implements DeviceValues {
39
+ protected readonly factory: IDBFactory;
40
+ static readonly DATABASE = "ta";
41
+ static readonly STORE = "kept";
42
+ protected database?: Promise<IDBDatabase | undefined>;
43
+ constructor(factory: IDBFactory);
44
+ get<T>(key: string): Promise<T | undefined>;
45
+ entries<T>(prefix: string): Promise<[string, T][]>;
46
+ set(key: string, value: unknown): Promise<void>;
47
+ delete(key: string): Promise<void>;
48
+ deleteAll(prefix: string): Promise<void>;
49
+ /** The keys that start with `prefix`. */
50
+ protected static range(prefix: string): IDBKeyRange;
51
+ protected open(): Promise<IDBDatabase | undefined>;
52
+ protected run<T>(mode: IDBTransactionMode, work: (store: IDBObjectStore) => IDBRequest | Promise<T>, otherwise: T): Promise<T>;
53
+ }
54
+ /** The values of this device: in IndexedDB when the browser has it. */
55
+ export declare function deviceValues(): DeviceValues;
56
+ //# sourceMappingURL=device-values.d.ts.map
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IndexedValues = exports.MemoryValues = exports.OfflineKeys = void 0;
4
+ exports.deviceValues = deviceValues;
5
+ /** The keys of what is kept, each with the computer it is of: what one computer showed is not shown for another. */
6
+ var OfflineKeys;
7
+ (function (OfflineKeys) {
8
+ /** The answer of a call that reads (OfflineReads). */
9
+ function read(host, call) {
10
+ return `read|${host}|${call}`;
11
+ }
12
+ OfflineKeys.read = read;
13
+ /** The conversation of a session file (KeptChats). */
14
+ function chat(host, sessionFile) {
15
+ return `chat|${host}|${sessionFile}`;
16
+ }
17
+ OfflineKeys.chat = chat;
18
+ /** Which conversations are kept, the one seen last at the end. */
19
+ function chats(host) {
20
+ return `chats|${host}`;
21
+ }
22
+ OfflineKeys.chats = chats;
23
+ /** Takes off the device all that was kept of a computer. */
24
+ async function forget(values, host) {
25
+ await Promise.all([values.deleteAll(read(host, '')), values.deleteAll(chat(host, '')), values.delete(chats(host))]);
26
+ }
27
+ OfflineKeys.forget = forget;
28
+ })(OfflineKeys || (exports.OfflineKeys = OfflineKeys = {}));
29
+ /** In memory: where there is no IndexedDB (a test, a browser that has it off), kept for the page only. */
30
+ class MemoryValues {
31
+ constructor() {
32
+ this.values = new Map();
33
+ }
34
+ async get(key) {
35
+ return this.values.get(key);
36
+ }
37
+ async entries(prefix) {
38
+ return [...this.values].filter(([key]) => key.startsWith(prefix));
39
+ }
40
+ async set(key, value) {
41
+ this.values.set(key, value);
42
+ }
43
+ async delete(key) {
44
+ this.values.delete(key);
45
+ }
46
+ async deleteAll(prefix) {
47
+ for (const key of [...this.values.keys()]) {
48
+ if (key.startsWith(prefix)) {
49
+ this.values.delete(key);
50
+ }
51
+ }
52
+ }
53
+ }
54
+ exports.MemoryValues = MemoryValues;
55
+ /**
56
+ * In IndexedDB, one store of keys and values. What fails (no room, the database closed under it) is as if
57
+ * nothing were kept: the page then waits for the computer, as it would without.
58
+ */
59
+ class IndexedValues {
60
+ constructor(factory) {
61
+ this.factory = factory;
62
+ }
63
+ get(key) {
64
+ return this.run('readonly', store => store.get(key), undefined);
65
+ }
66
+ entries(prefix) {
67
+ return this.run('readonly', store => new Promise((resolve, reject) => {
68
+ const found = [];
69
+ const cursor = store.openCursor(IndexedValues.range(prefix));
70
+ cursor.onsuccess = () => {
71
+ const at = cursor.result;
72
+ if (!at) {
73
+ resolve(found);
74
+ return;
75
+ }
76
+ found.push([String(at.key), at.value]);
77
+ at.continue();
78
+ };
79
+ cursor.onerror = () => reject(cursor.error);
80
+ }), []);
81
+ }
82
+ set(key, value) {
83
+ return this.run('readwrite', store => store.put(value, key), undefined);
84
+ }
85
+ delete(key) {
86
+ return this.run('readwrite', store => store.delete(key), undefined);
87
+ }
88
+ deleteAll(prefix) {
89
+ return this.run('readwrite', store => store.delete(IndexedValues.range(prefix)), undefined);
90
+ }
91
+ /** The keys that start with `prefix`. */
92
+ static range(prefix) {
93
+ return IDBKeyRange.bound(prefix, `${prefix}\uffff`);
94
+ }
95
+ open() {
96
+ var _a;
97
+ (_a = this.database) !== null && _a !== void 0 ? _a : (this.database = new Promise(resolve => {
98
+ try {
99
+ const request = this.factory.open(IndexedValues.DATABASE, 1);
100
+ request.onupgradeneeded = () => request.result.createObjectStore(IndexedValues.STORE);
101
+ request.onsuccess = () => {
102
+ const database = request.result;
103
+ // Closed by the browser (storage cleared): opened again next time.
104
+ database.onclose = () => {
105
+ this.database = undefined;
106
+ };
107
+ resolve(database);
108
+ };
109
+ request.onerror = () => resolve(undefined);
110
+ request.onblocked = () => resolve(undefined);
111
+ }
112
+ catch (_a) {
113
+ resolve(undefined);
114
+ }
115
+ }));
116
+ return this.database;
117
+ }
118
+ async run(mode, work, otherwise) {
119
+ const database = await this.open();
120
+ if (!database) {
121
+ return otherwise;
122
+ }
123
+ try {
124
+ const store = database.transaction(IndexedValues.STORE, mode).objectStore(IndexedValues.STORE);
125
+ const request = work(store);
126
+ if (request instanceof Promise) {
127
+ return await request;
128
+ }
129
+ return await new Promise((resolve, reject) => {
130
+ request.onsuccess = () => resolve(request.result);
131
+ request.onerror = () => reject(request.error);
132
+ });
133
+ }
134
+ catch (_a) {
135
+ return otherwise;
136
+ }
137
+ }
138
+ }
139
+ exports.IndexedValues = IndexedValues;
140
+ IndexedValues.DATABASE = 'ta';
141
+ IndexedValues.STORE = 'kept';
142
+ let shared;
143
+ /** The values of this device: in IndexedDB when the browser has it. */
144
+ function deviceValues() {
145
+ shared !== null && shared !== void 0 ? shared : (shared = typeof indexedDB === 'undefined' ? new MemoryValues() : new IndexedValues(indexedDB));
146
+ return shared;
147
+ }
148
+ //# sourceMappingURL=device-values.js.map
@@ -0,0 +1,18 @@
1
+ import type { SessionSnapshot, SessionStore } from '@celljs/ta-client';
2
+ export declare const TaKeptChats: unique symbol;
3
+ /**
4
+ * The conversations this device showed, as they were last seen, by session file and computer: one opened
5
+ * again shows at once, without the computer too, and catches up once it attaches (as a chat app shows
6
+ * what it has while it has no network).
7
+ */
8
+ export interface TaKeptChats {
9
+ /** The conversation of the file as this device last saw it; none if it did not, or of another computer. */
10
+ read(sessionFile: string): Promise<SessionSnapshot | undefined>;
11
+ /**
12
+ * Keeps the conversation of `store` as it changes, once it is not at work (a reply as it streams is not
13
+ * written each moment), and when the page is hidden, as the system may end it there. The function
14
+ * returned stops, keeping it a last time. `sessionFile` is asked each time: a session may get its file late.
15
+ */
16
+ follow(store: SessionStore, sessionFile: () => string | undefined): () => void;
17
+ }
18
+ //# sourceMappingURL=kept-chats-protocol.d.ts.map
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TaKeptChats = void 0;
4
+ exports.TaKeptChats = Symbol('TaKeptChats');
5
+ //# sourceMappingURL=kept-chats-protocol.js.map
@@ -0,0 +1,48 @@
1
+ import type { SessionSnapshot, SessionState, SessionStore } from '@celljs/ta-client';
2
+ import { TaWorkbench } from '../workbench-protocol';
3
+ import { type DeviceValues } from './device-values';
4
+ import { TaKeptChats } from './kept-chats-protocol';
5
+ /** How many conversations are kept, and how much of each (the JSON of its latest messages). */
6
+ export declare const KEPT_CHAT_LIMITS: {
7
+ count: number;
8
+ bytes: number;
9
+ };
10
+ export declare namespace KeptChatUtil {
11
+ /**
12
+ * What is kept of a conversation: its latest messages up to `bytes` of JSON, from a message of the user
13
+ * when one is among them (not the result of a call without the call), and the calls of its last run.
14
+ * Not those sent from here that the session does not have (`outbox`). None when there is nothing to keep.
15
+ */
16
+ function snapshot(state: Pick<SessionState, 'messages' | 'start' | 'tools' | 'outbox'>, bytes: number): SessionSnapshot | undefined;
17
+ /** The files kept, the one seen now last, with those past `count` (seen longest ago) apart. */
18
+ function seen(files: readonly string[], file: string, count: number): {
19
+ files: string[];
20
+ dropped: string[];
21
+ };
22
+ }
23
+ interface Followed {
24
+ store: SessionStore;
25
+ sessionFile(): string | undefined;
26
+ /** What was written last, not written again. */
27
+ written?: SessionState;
28
+ timer?: ReturnType<typeof setTimeout>;
29
+ }
30
+ export declare class TaKeptChatsImpl implements TaKeptChats {
31
+ protected readonly workbench: TaWorkbench;
32
+ protected readonly values: DeviceValues;
33
+ protected readonly limits: {
34
+ count: number;
35
+ bytes: number;
36
+ };
37
+ protected readonly followed: Set<Followed>;
38
+ /** The files kept of each computer, once read; one write at a time changes them. */
39
+ protected readonly files: Map<string, Promise<string[]>>;
40
+ protected watching: boolean;
41
+ read(sessionFile: string): Promise<SessionSnapshot | undefined>;
42
+ follow(store: SessionStore, sessionFile: () => string | undefined): () => void;
43
+ protected watchHidden(): void;
44
+ protected write(followed: Followed): void;
45
+ protected keep(host: string, file: string, snapshot: SessionSnapshot): Promise<void>;
46
+ }
47
+ export {};
48
+ //# sourceMappingURL=kept-chats.d.ts.map
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TaKeptChatsImpl = exports.KeptChatUtil = exports.KEPT_CHAT_LIMITS = void 0;
13
+ const core_1 = require("@celljs/core");
14
+ const workbench_protocol_1 = require("../workbench-protocol");
15
+ const device_values_1 = require("./device-values");
16
+ const kept_chats_protocol_1 = require("./kept-chats-protocol");
17
+ /** How many conversations are kept, and how much of each (the JSON of its latest messages). */
18
+ exports.KEPT_CHAT_LIMITS = { count: 30, bytes: 768 * 1024 };
19
+ /** How long after the last change a conversation not at work is written. */
20
+ const WRITE_MS = 600;
21
+ var KeptChatUtil;
22
+ (function (KeptChatUtil) {
23
+ /**
24
+ * What is kept of a conversation: its latest messages up to `bytes` of JSON, from a message of the user
25
+ * when one is among them (not the result of a call without the call), and the calls of its last run.
26
+ * Not those sent from here that the session does not have (`outbox`). None when there is nothing to keep.
27
+ */
28
+ function snapshot(state, bytes) {
29
+ var _a;
30
+ const { start } = state;
31
+ const messages = ((_a = state.outbox) === null || _a === void 0 ? void 0 : _a.length) ? state.messages.slice(0, -state.outbox.length) : state.messages;
32
+ const tools = JSON.stringify(state.tools).length > bytes / 4 ? {} : state.tools;
33
+ let room = bytes - JSON.stringify(tools).length;
34
+ let from = messages.length;
35
+ while (from > 0) {
36
+ const size = JSON.stringify(messages[from - 1]).length;
37
+ if (size > room) {
38
+ break;
39
+ }
40
+ room -= size;
41
+ from--;
42
+ }
43
+ if (from > 0) {
44
+ const user = messages.findIndex((message, index) => index >= from && message.role === 'user');
45
+ if (user > 0 && user < messages.length - 1) {
46
+ from = user;
47
+ }
48
+ }
49
+ if (from >= messages.length) {
50
+ return undefined;
51
+ }
52
+ return { messages: from ? messages.slice(from) : messages, start: start + from, tools };
53
+ }
54
+ KeptChatUtil.snapshot = snapshot;
55
+ /** The files kept, the one seen now last, with those past `count` (seen longest ago) apart. */
56
+ function seen(files, file, count) {
57
+ const next = [...files.filter(other => other !== file), file];
58
+ const over = Math.max(0, next.length - count);
59
+ return { files: next.slice(over), dropped: next.slice(0, over) };
60
+ }
61
+ KeptChatUtil.seen = seen;
62
+ })(KeptChatUtil || (exports.KeptChatUtil = KeptChatUtil = {}));
63
+ let TaKeptChatsImpl = class TaKeptChatsImpl {
64
+ constructor() {
65
+ this.values = (0, device_values_1.deviceValues)();
66
+ this.limits = exports.KEPT_CHAT_LIMITS;
67
+ this.followed = new Set();
68
+ /** The files kept of each computer, once read; one write at a time changes them. */
69
+ this.files = new Map();
70
+ this.watching = false;
71
+ }
72
+ read(sessionFile) {
73
+ const { host } = this.workbench.state;
74
+ return host ? this.values.get(device_values_1.OfflineKeys.chat(host, sessionFile)) : Promise.resolve(undefined);
75
+ }
76
+ follow(store, sessionFile) {
77
+ this.watchHidden();
78
+ const followed = { store, sessionFile };
79
+ this.followed.add(followed);
80
+ const later = (state) => {
81
+ clearTimeout(followed.timer);
82
+ followed.timer = state.working ? undefined : setTimeout(() => this.write(followed), WRITE_MS);
83
+ };
84
+ const unsubscribe = store.subscribe(later);
85
+ // As it is now too: it attached before it was followed.
86
+ later(store.state);
87
+ return () => {
88
+ unsubscribe();
89
+ clearTimeout(followed.timer);
90
+ this.followed.delete(followed);
91
+ this.write(followed);
92
+ };
93
+ }
94
+ watchHidden() {
95
+ if (this.watching || typeof document === 'undefined') {
96
+ return;
97
+ }
98
+ this.watching = true;
99
+ // The system may end a page it hides, an app in the background most of all.
100
+ document.addEventListener('visibilitychange', () => {
101
+ if (document.visibilityState === 'hidden') {
102
+ for (const followed of this.followed) {
103
+ this.write(followed);
104
+ }
105
+ }
106
+ });
107
+ }
108
+ write(followed) {
109
+ clearTimeout(followed.timer);
110
+ followed.timer = undefined;
111
+ const { state } = followed.store;
112
+ const { host } = this.workbench.state;
113
+ const file = followed.sessionFile();
114
+ const { written } = followed;
115
+ // What extensions show, dialogs and the like are not kept: only a change of the conversation is written.
116
+ if (!host || !file || (written && written.messages === state.messages && written.start === state.start && written.tools === state.tools)) {
117
+ return;
118
+ }
119
+ followed.written = state;
120
+ const snapshot = KeptChatUtil.snapshot(state, this.limits.bytes);
121
+ if (snapshot) {
122
+ void this.keep(host, file, snapshot);
123
+ }
124
+ }
125
+ keep(host, file, snapshot) {
126
+ var _a;
127
+ const before = (_a = this.files.get(host)) !== null && _a !== void 0 ? _a : this.values.get(device_values_1.OfflineKeys.chats(host)).then(files => files !== null && files !== void 0 ? files : []);
128
+ const after = before.then(async (files) => {
129
+ const { files: next, dropped } = KeptChatUtil.seen(files, file, this.limits.count);
130
+ await Promise.all([
131
+ this.values.set(device_values_1.OfflineKeys.chat(host, file), snapshot),
132
+ this.values.set(device_values_1.OfflineKeys.chats(host), next),
133
+ ...dropped.map(old => this.values.delete(device_values_1.OfflineKeys.chat(host, old))),
134
+ ]);
135
+ return next;
136
+ });
137
+ this.files.set(host, after.catch(() => before));
138
+ return after.then(() => undefined);
139
+ }
140
+ };
141
+ exports.TaKeptChatsImpl = TaKeptChatsImpl;
142
+ __decorate([
143
+ (0, core_1.Autowired)(workbench_protocol_1.TaWorkbench),
144
+ __metadata("design:type", Object)
145
+ ], TaKeptChatsImpl.prototype, "workbench", void 0);
146
+ exports.TaKeptChatsImpl = TaKeptChatsImpl = __decorate([
147
+ (0, core_1.Component)(kept_chats_protocol_1.TaKeptChats)
148
+ ], TaKeptChatsImpl);
149
+ //# sourceMappingURL=kept-chats.js.map
@@ -0,0 +1,45 @@
1
+ import { type DeviceValues } from './device-values';
2
+ /**
3
+ * The calls whose answers the device keeps, by service and method: they only read, and what they read is
4
+ * what the lists and web extensions show. Each may say how a kept answer reads while offline: what it said
5
+ * of the moment it was given is not known of now.
6
+ */
7
+ export declare const OFFLINE_READS: Record<string, Record<string, ((answer: unknown) => unknown) | undefined>>;
8
+ /** How many answers are kept, and how large one may be (its JSON): those used longest ago go first. */
9
+ export declare const OFFLINE_READ_LIMITS: {
10
+ count: number;
11
+ bytes: number;
12
+ };
13
+ /**
14
+ * The answers of the calls that read (OFFLINE_READS) as the computer last gave them, on the device: while
15
+ * the page cannot reach the computer, a call answers with them rather than waiting, so that what was shown
16
+ * shows again (the agents of a cold start too). Online, each answer that changed is kept again.
17
+ */
18
+ export declare class OfflineReads {
19
+ protected readonly values: DeviceValues;
20
+ protected readonly limits: {
21
+ count: number;
22
+ bytes: number;
23
+ };
24
+ /** By call (`OfflineReads.call`), the JSON of the answer, the one used last at the end. */
25
+ protected answers: Map<string, string>;
26
+ protected host?: string;
27
+ protected loading: Promise<void>;
28
+ constructor(values: DeviceValues, limits?: {
29
+ count: number;
30
+ bytes: number;
31
+ });
32
+ static reads(service: string, method: string): boolean;
33
+ /** What names a call: its service, method and parameters. */
34
+ static call(service: string, method: string, params: unknown[]): string;
35
+ /** The answers of another computer from now on. */
36
+ use(host: string | undefined): this;
37
+ /** The answer kept of a call, as it reads offline; none if there is none. */
38
+ answer(service: string, method: string, params: unknown[]): Promise<{
39
+ value: unknown;
40
+ } | undefined>;
41
+ /** Keeps the answer of a call, if it changed; one too large is not kept. */
42
+ keep(service: string, method: string, params: unknown[], value: unknown): void;
43
+ protected touch(call: string, json: string): void;
44
+ }
45
+ //# sourceMappingURL=offline-reads.d.ts.map
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OfflineReads = exports.OFFLINE_READ_LIMITS = exports.OFFLINE_READS = void 0;
4
+ const device_values_1 = require("./device-values");
5
+ /**
6
+ * The calls whose answers the device keeps, by service and method: they only read, and what they read is
7
+ * what the lists and web extensions show. Each may say how a kept answer reads while offline: what it said
8
+ * of the moment it was given is not known of now.
9
+ */
10
+ exports.OFFLINE_READS = {
11
+ server: {
12
+ // A session answering then is not said to be answering now.
13
+ listSessions: answer => (Array.isArray(answer) ? answer.map(session => ({ ...session, isStreaming: false })) : answer),
14
+ listSavedSessions: undefined,
15
+ getServerInfo: undefined,
16
+ },
17
+ // The data of web extensions (pi.storage): the agents and channels, what they said, the tasks.
18
+ packages: { getExtensionData: undefined },
19
+ };
20
+ /** How many answers are kept, and how large one may be (its JSON): those used longest ago go first. */
21
+ exports.OFFLINE_READ_LIMITS = { count: 400, bytes: 512 * 1024 };
22
+ /**
23
+ * The answers of the calls that read (OFFLINE_READS) as the computer last gave them, on the device: while
24
+ * the page cannot reach the computer, a call answers with them rather than waiting, so that what was shown
25
+ * shows again (the agents of a cold start too). Online, each answer that changed is kept again.
26
+ */
27
+ class OfflineReads {
28
+ constructor(values, limits = exports.OFFLINE_READ_LIMITS) {
29
+ this.values = values;
30
+ this.limits = limits;
31
+ /** By call (`OfflineReads.call`), the JSON of the answer, the one used last at the end. */
32
+ this.answers = new Map();
33
+ this.loading = Promise.resolve();
34
+ }
35
+ static reads(service, method) {
36
+ const methods = exports.OFFLINE_READS[service];
37
+ return !!methods && Object.keys(methods).includes(method);
38
+ }
39
+ /** What names a call: its service, method and parameters. */
40
+ static call(service, method, params) {
41
+ return `${service}.${method}${JSON.stringify(params)}`;
42
+ }
43
+ /** The answers of another computer from now on. */
44
+ use(host) {
45
+ if (host === this.host) {
46
+ return this;
47
+ }
48
+ this.host = host;
49
+ this.answers = new Map();
50
+ if (!host) {
51
+ return this;
52
+ }
53
+ const prefix = device_values_1.OfflineKeys.read(host, '');
54
+ this.loading = this.values.entries(prefix).then(entries => {
55
+ if (this.host === host) {
56
+ // Those given since the page started are newer.
57
+ this.answers = new Map([...entries.map(([key, json]) => [key.slice(prefix.length), json]), ...this.answers]);
58
+ }
59
+ });
60
+ return this;
61
+ }
62
+ /** The answer kept of a call, as it reads offline; none if there is none. */
63
+ async answer(service, method, params) {
64
+ var _a;
65
+ await this.loading;
66
+ const call = OfflineReads.call(service, method, params);
67
+ const json = this.answers.get(call);
68
+ if (json === undefined) {
69
+ return undefined;
70
+ }
71
+ this.touch(call, json);
72
+ const value = JSON.parse(json);
73
+ const offline = (_a = exports.OFFLINE_READS[service]) === null || _a === void 0 ? void 0 : _a[method];
74
+ return { value: offline ? offline(value) : value };
75
+ }
76
+ /** Keeps the answer of a call, if it changed; one too large is not kept. */
77
+ keep(service, method, params, value) {
78
+ const { host } = this;
79
+ if (!host) {
80
+ return;
81
+ }
82
+ const call = OfflineReads.call(service, method, params);
83
+ // JSON has no undefined: what the server gives as none comes as null.
84
+ const json = JSON.stringify(value !== null && value !== void 0 ? value : null);
85
+ if (this.answers.get(call) === json) {
86
+ this.touch(call, json);
87
+ return;
88
+ }
89
+ if (json.length > this.limits.bytes) {
90
+ if (this.answers.delete(call)) {
91
+ void this.values.delete(device_values_1.OfflineKeys.read(host, call));
92
+ }
93
+ return;
94
+ }
95
+ this.touch(call, json);
96
+ void this.values.set(device_values_1.OfflineKeys.read(host, call), json);
97
+ for (const old of this.answers.keys()) {
98
+ if (this.answers.size <= this.limits.count) {
99
+ break;
100
+ }
101
+ this.answers.delete(old);
102
+ void this.values.delete(device_values_1.OfflineKeys.read(host, old));
103
+ }
104
+ }
105
+ touch(call, json) {
106
+ this.answers.delete(call);
107
+ this.answers.set(call, json);
108
+ }
109
+ }
110
+ exports.OfflineReads = OfflineReads;
111
+ //# sourceMappingURL=offline-reads.js.map
@@ -24,6 +24,8 @@ export interface Settings {
24
24
  chatFontSize: FontSize;
25
25
  /** Read the replies of ta aloud. */
26
26
  speak: boolean;
27
+ /** Said to the double by voice (a finger held to talk), its answer is read aloud, even with `speak` off. */
28
+ speakTalk: boolean;
27
29
  /** The double asks before it hands out work: it says what it would start and waits for the user's go. */
28
30
  confirmTasks: boolean;
29
31
  /** How many of the double's tasks run at once; 0, as many as it starts. */