@celljs/ta-web 4.9.1 → 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 (302) 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 +20 -0
  6. package/esm/browser/assistant/assistant-protocol.d.ts +3 -1
  7. package/esm/browser/assistant/assistant-task-util.d.ts +2 -0
  8. package/esm/browser/assistant/assistant-task-util.js +5 -3
  9. package/esm/browser/assistant/assistant-view.js +81 -56
  10. package/esm/browser/assistant/assistant.d.ts +10 -1
  11. package/esm/browser/assistant/assistant.js +44 -5
  12. package/esm/browser/chat/chat-packages.d.ts +39 -0
  13. package/esm/browser/chat/chat-packages.js +70 -0
  14. package/esm/browser/chat/chat-protocol.d.ts +23 -1
  15. package/esm/browser/chat/chat-stores.d.ts +59 -0
  16. package/esm/browser/chat/chat-stores.js +121 -0
  17. package/esm/browser/chat/chat-util.d.ts +17 -0
  18. package/esm/browser/chat/chat-util.js +61 -0
  19. package/esm/browser/chat/chat-view.js +33 -12
  20. package/esm/browser/chat/chat.d.ts +31 -39
  21. package/esm/browser/chat/chat.js +226 -175
  22. package/esm/browser/components/app-nav.d.ts +6 -3
  23. package/esm/browser/components/app-nav.js +19 -10
  24. package/esm/browser/components/app-shell-hooks.d.ts +2 -2
  25. package/esm/browser/components/app-shell-hooks.js +7 -3
  26. package/esm/browser/components/app-view.js +75 -21
  27. package/esm/browser/components/chat-list.d.ts +20 -2
  28. package/esm/browser/components/chat-list.js +138 -22
  29. package/esm/browser/components/composer-box.d.ts +5 -5
  30. package/esm/browser/components/composer-box.js +111 -4
  31. package/esm/browser/components/composer.d.ts +7 -0
  32. package/esm/browser/components/composer.js +5 -4
  33. package/esm/browser/components/connection-bar.js +50 -17
  34. package/esm/browser/components/context-menu.d.ts +30 -4
  35. package/esm/browser/components/context-menu.js +199 -37
  36. package/esm/browser/components/conversation-scroll.d.ts +129 -6
  37. package/esm/browser/components/conversation-scroll.js +429 -109
  38. package/esm/browser/components/earlier-messages.d.ts +2 -1
  39. package/esm/browser/components/earlier-messages.js +2 -17
  40. package/esm/browser/components/editor-area.d.ts +3 -1
  41. package/esm/browser/components/editor-area.js +6 -5
  42. package/esm/browser/components/empty-pictures.d.ts +0 -2
  43. package/esm/browser/components/empty-pictures.js +0 -16
  44. package/esm/browser/components/folder-picker.d.ts +5 -2
  45. package/esm/browser/components/folder-picker.js +26 -8
  46. package/esm/browser/components/held-talk.d.ts +28 -0
  47. package/esm/browser/components/held-talk.js +76 -0
  48. package/esm/browser/components/host-view.d.ts +1 -1
  49. package/esm/browser/components/icon.d.ts +2 -2
  50. package/esm/browser/components/icon.js +5 -6
  51. package/esm/browser/components/image-viewer.d.ts +124 -0
  52. package/esm/browser/components/image-viewer.js +397 -0
  53. package/esm/browser/components/lightbox.d.ts +11 -0
  54. package/esm/browser/components/lightbox.js +24 -0
  55. package/esm/browser/components/markdown.d.ts +6 -2
  56. package/esm/browser/components/markdown.js +24 -10
  57. package/esm/browser/components/media.js +1 -10
  58. package/esm/browser/components/message-footer.d.ts +16 -2
  59. package/esm/browser/components/message-footer.js +29 -12
  60. package/esm/browser/components/message-list.d.ts +24 -3
  61. package/esm/browser/components/message-list.js +149 -20
  62. package/esm/browser/components/message-menu.d.ts +3 -1
  63. package/esm/browser/components/message-menu.js +18 -3
  64. package/esm/browser/components/nav-places.d.ts +16 -1
  65. package/esm/browser/components/nav-places.js +12 -3
  66. package/esm/browser/components/phone-shell.d.ts +4 -1
  67. package/esm/browser/components/phone-shell.js +3 -1
  68. package/esm/browser/components/run-status.js +3 -3
  69. package/esm/browser/components/session-settings.d.ts +6 -0
  70. package/esm/browser/components/session-settings.js +14 -1
  71. package/esm/browser/components/session-view.js +8 -4
  72. package/esm/browser/components/settings-parts.d.ts +2 -2
  73. package/esm/browser/components/settings-parts.js +24 -1
  74. package/esm/browser/components/swipe-row.d.ts +2 -2
  75. package/esm/browser/components/swipe-row.js +7 -3
  76. package/esm/browser/components/tool-view.js +14 -12
  77. package/esm/browser/components/voice-button.d.ts +1 -1
  78. package/esm/browser/components/voice-button.js +1 -1
  79. package/esm/browser/components/voice-talk.d.ts +43 -0
  80. package/esm/browser/components/voice-talk.js +222 -0
  81. package/esm/browser/device/device.d.ts +3 -0
  82. package/esm/browser/device/device.js +11 -1
  83. package/esm/browser/device/hold.d.ts +42 -0
  84. package/esm/browser/device/hold.js +136 -0
  85. package/esm/browser/device/launch-screen.d.ts +1 -1
  86. package/esm/browser/device/launch-screen.js +1 -1
  87. package/esm/browser/device/long-press.d.ts +2 -0
  88. package/esm/browser/device/long-press.js +16 -1
  89. package/esm/browser/device/pull-down.d.ts +4 -2
  90. package/esm/browser/device/pull-down.js +64 -76
  91. package/esm/browser/device/row-swipe.d.ts +35 -10
  92. package/esm/browser/device/row-swipe.js +149 -71
  93. package/esm/browser/device/shake-undo.d.ts +16 -0
  94. package/esm/browser/device/shake-undo.js +59 -0
  95. package/esm/browser/device/sheet-swipe.d.ts +118 -18
  96. package/esm/browser/device/sheet-swipe.js +406 -107
  97. package/esm/browser/extension/web-extension-api.d.ts +97 -1
  98. package/esm/browser/extension/web-extension-code.d.ts +6 -0
  99. package/esm/browser/extension/web-extension-code.js +24 -0
  100. package/esm/browser/extension/web-extension-protocol.d.ts +23 -1
  101. package/esm/browser/extension/web-extension-protocol.js +8 -0
  102. package/esm/browser/extension/web-extensions.d.ts +14 -1
  103. package/esm/browser/extension/web-extensions.js +122 -23
  104. package/esm/browser/files/files-protocol.d.ts +25 -0
  105. package/esm/browser/files/files-protocol.js +2 -0
  106. package/esm/browser/files/files.d.ts +35 -0
  107. package/esm/browser/files/files.js +119 -0
  108. package/esm/browser/i18n/locales.d.ts +24 -2
  109. package/esm/browser/i18n/messages.d.ts +23 -1
  110. package/esm/browser/i18n/messages.js +48 -4
  111. package/esm/browser/index.d.ts +6 -0
  112. package/esm/browser/index.js +6 -0
  113. package/esm/browser/notices/notices-protocol.d.ts +9 -1
  114. package/esm/browser/notices/notices.d.ts +2 -0
  115. package/esm/browser/notices/notices.js +20 -10
  116. package/esm/browser/offline/device-values.d.ts +55 -0
  117. package/esm/browser/offline/device-values.js +142 -0
  118. package/esm/browser/offline/kept-chats-protocol.d.ts +17 -0
  119. package/esm/browser/offline/kept-chats-protocol.js +2 -0
  120. package/esm/browser/offline/kept-chats.d.ts +47 -0
  121. package/esm/browser/offline/kept-chats.js +146 -0
  122. package/esm/browser/offline/offline-reads.d.ts +44 -0
  123. package/esm/browser/offline/offline-reads.js +107 -0
  124. package/esm/browser/settings/settings-protocol.d.ts +2 -0
  125. package/esm/browser/settings/settings-protocol.js +2 -0
  126. package/esm/browser/style/conversation.d.ts +1 -1
  127. package/esm/browser/style/conversation.js +57 -17
  128. package/esm/browser/style/device.js +27 -4
  129. package/esm/browser/style/layout.d.ts +1 -1
  130. package/esm/browser/style/layout.js +67 -15
  131. package/esm/browser/style/pages.d.ts +1 -1
  132. package/esm/browser/style/pages.js +2 -1
  133. package/esm/browser/style/shell.d.ts +1 -1
  134. package/esm/browser/style/shell.js +46 -3
  135. package/esm/browser/util/frame.d.ts +5 -4
  136. package/esm/browser/util/frame.js +5 -4
  137. package/esm/browser/util/markdown.d.ts +18 -1
  138. package/esm/browser/util/markdown.js +119 -5
  139. package/esm/browser/util/process.d.ts +21 -0
  140. package/esm/browser/util/process.js +45 -1
  141. package/esm/browser/util/voice.d.ts +5 -2
  142. package/esm/browser/util/voice.js +6 -3
  143. package/esm/browser/util/zoom.d.ts +46 -0
  144. package/esm/browser/util/zoom.js +96 -0
  145. package/esm/browser/workbench-calls.d.ts +59 -0
  146. package/esm/browser/workbench-calls.js +141 -0
  147. package/esm/browser/workbench-protocol.d.ts +5 -1
  148. package/esm/browser/workbench-util.d.ts +7 -0
  149. package/esm/browser/workbench-util.js +9 -2
  150. package/esm/browser/workbench.d.ts +14 -5
  151. package/esm/browser/workbench.js +51 -31
  152. package/lib/browser/assistant/assistant-chat-list.js +8 -2
  153. package/lib/browser/assistant/assistant-extension.d.ts +8 -1
  154. package/lib/browser/assistant/assistant-extension.js +20 -0
  155. package/lib/browser/assistant/assistant-protocol.d.ts +3 -1
  156. package/lib/browser/assistant/assistant-task-util.d.ts +2 -0
  157. package/lib/browser/assistant/assistant-task-util.js +5 -3
  158. package/lib/browser/assistant/assistant-view.js +78 -53
  159. package/lib/browser/assistant/assistant.d.ts +10 -1
  160. package/lib/browser/assistant/assistant.js +44 -5
  161. package/lib/browser/chat/chat-packages.d.ts +40 -0
  162. package/lib/browser/chat/chat-packages.js +74 -0
  163. package/lib/browser/chat/chat-protocol.d.ts +23 -1
  164. package/lib/browser/chat/chat-stores.d.ts +60 -0
  165. package/lib/browser/chat/chat-stores.js +125 -0
  166. package/lib/browser/chat/chat-util.d.ts +18 -0
  167. package/lib/browser/chat/chat-util.js +64 -0
  168. package/lib/browser/chat/chat-view.js +33 -12
  169. package/lib/browser/chat/chat.d.ts +31 -39
  170. package/lib/browser/chat/chat.js +227 -176
  171. package/lib/browser/components/app-nav.d.ts +6 -3
  172. package/lib/browser/components/app-nav.js +17 -8
  173. package/lib/browser/components/app-shell-hooks.d.ts +2 -2
  174. package/lib/browser/components/app-shell-hooks.js +7 -3
  175. package/lib/browser/components/app-view.js +74 -20
  176. package/lib/browser/components/chat-list.d.ts +20 -2
  177. package/lib/browser/components/chat-list.js +137 -21
  178. package/lib/browser/components/composer-box.d.ts +5 -5
  179. package/lib/browser/components/composer-box.js +111 -4
  180. package/lib/browser/components/composer.d.ts +7 -0
  181. package/lib/browser/components/composer.js +5 -4
  182. package/lib/browser/components/connection-bar.js +48 -15
  183. package/lib/browser/components/context-menu.d.ts +30 -4
  184. package/lib/browser/components/context-menu.js +198 -36
  185. package/lib/browser/components/conversation-scroll.d.ts +129 -6
  186. package/lib/browser/components/conversation-scroll.js +431 -110
  187. package/lib/browser/components/earlier-messages.d.ts +2 -1
  188. package/lib/browser/components/earlier-messages.js +2 -17
  189. package/lib/browser/components/editor-area.d.ts +3 -1
  190. package/lib/browser/components/editor-area.js +5 -4
  191. package/lib/browser/components/empty-pictures.d.ts +0 -2
  192. package/lib/browser/components/empty-pictures.js +0 -17
  193. package/lib/browser/components/folder-picker.d.ts +5 -2
  194. package/lib/browser/components/folder-picker.js +26 -8
  195. package/lib/browser/components/held-talk.d.ts +29 -0
  196. package/lib/browser/components/held-talk.js +79 -0
  197. package/lib/browser/components/host-view.d.ts +1 -1
  198. package/lib/browser/components/icon.d.ts +2 -2
  199. package/lib/browser/components/icon.js +7 -6
  200. package/lib/browser/components/image-viewer.d.ts +125 -0
  201. package/lib/browser/components/image-viewer.js +435 -0
  202. package/lib/browser/components/lightbox.d.ts +12 -0
  203. package/lib/browser/components/lightbox.js +60 -0
  204. package/lib/browser/components/markdown.d.ts +6 -2
  205. package/lib/browser/components/markdown.js +24 -10
  206. package/lib/browser/components/media.js +2 -11
  207. package/lib/browser/components/message-footer.d.ts +16 -2
  208. package/lib/browser/components/message-footer.js +31 -12
  209. package/lib/browser/components/message-list.d.ts +24 -3
  210. package/lib/browser/components/message-list.js +146 -16
  211. package/lib/browser/components/message-menu.d.ts +3 -1
  212. package/lib/browser/components/message-menu.js +17 -2
  213. package/lib/browser/components/nav-places.d.ts +16 -1
  214. package/lib/browser/components/nav-places.js +13 -3
  215. package/lib/browser/components/phone-shell.d.ts +4 -1
  216. package/lib/browser/components/phone-shell.js +3 -1
  217. package/lib/browser/components/run-status.js +3 -3
  218. package/lib/browser/components/session-settings.d.ts +6 -0
  219. package/lib/browser/components/session-settings.js +14 -1
  220. package/lib/browser/components/session-view.js +7 -3
  221. package/lib/browser/components/settings-parts.d.ts +2 -2
  222. package/lib/browser/components/settings-parts.js +24 -1
  223. package/lib/browser/components/swipe-row.d.ts +2 -2
  224. package/lib/browser/components/swipe-row.js +7 -3
  225. package/lib/browser/components/tool-view.js +14 -12
  226. package/lib/browser/components/voice-button.d.ts +1 -1
  227. package/lib/browser/components/voice-button.js +1 -1
  228. package/lib/browser/components/voice-talk.d.ts +44 -0
  229. package/lib/browser/components/voice-talk.js +260 -0
  230. package/lib/browser/device/device.d.ts +3 -0
  231. package/lib/browser/device/device.js +11 -1
  232. package/lib/browser/device/hold.d.ts +43 -0
  233. package/lib/browser/device/hold.js +173 -0
  234. package/lib/browser/device/launch-screen.d.ts +1 -1
  235. package/lib/browser/device/launch-screen.js +1 -1
  236. package/lib/browser/device/long-press.d.ts +2 -0
  237. package/lib/browser/device/long-press.js +16 -1
  238. package/lib/browser/device/pull-down.d.ts +4 -2
  239. package/lib/browser/device/pull-down.js +63 -75
  240. package/lib/browser/device/row-swipe.d.ts +35 -10
  241. package/lib/browser/device/row-swipe.js +148 -70
  242. package/lib/browser/device/shake-undo.d.ts +17 -0
  243. package/lib/browser/device/shake-undo.js +63 -0
  244. package/lib/browser/device/sheet-swipe.d.ts +118 -18
  245. package/lib/browser/device/sheet-swipe.js +410 -108
  246. package/lib/browser/extension/web-extension-api.d.ts +97 -1
  247. package/lib/browser/extension/web-extension-code.d.ts +6 -0
  248. package/lib/browser/extension/web-extension-code.js +24 -0
  249. package/lib/browser/extension/web-extension-protocol.d.ts +23 -1
  250. package/lib/browser/extension/web-extension-protocol.js +9 -1
  251. package/lib/browser/extension/web-extensions.d.ts +14 -1
  252. package/lib/browser/extension/web-extensions.js +120 -21
  253. package/lib/browser/files/files-protocol.d.ts +26 -0
  254. package/lib/browser/files/files-protocol.js +5 -0
  255. package/lib/browser/files/files.d.ts +36 -0
  256. package/lib/browser/files/files.js +122 -0
  257. package/lib/browser/i18n/locales.d.ts +24 -2
  258. package/lib/browser/i18n/messages.d.ts +23 -1
  259. package/lib/browser/i18n/messages.js +48 -4
  260. package/lib/browser/index.d.ts +6 -0
  261. package/lib/browser/index.js +6 -0
  262. package/lib/browser/notices/notices-protocol.d.ts +9 -1
  263. package/lib/browser/notices/notices.d.ts +2 -0
  264. package/lib/browser/notices/notices.js +20 -10
  265. package/lib/browser/offline/device-values.d.ts +56 -0
  266. package/lib/browser/offline/device-values.js +148 -0
  267. package/lib/browser/offline/kept-chats-protocol.d.ts +18 -0
  268. package/lib/browser/offline/kept-chats-protocol.js +5 -0
  269. package/lib/browser/offline/kept-chats.d.ts +48 -0
  270. package/lib/browser/offline/kept-chats.js +149 -0
  271. package/lib/browser/offline/offline-reads.d.ts +45 -0
  272. package/lib/browser/offline/offline-reads.js +111 -0
  273. package/lib/browser/settings/settings-protocol.d.ts +2 -0
  274. package/lib/browser/settings/settings-protocol.js +2 -0
  275. package/lib/browser/style/conversation.d.ts +1 -1
  276. package/lib/browser/style/conversation.js +57 -17
  277. package/lib/browser/style/device.js +27 -4
  278. package/lib/browser/style/layout.d.ts +1 -1
  279. package/lib/browser/style/layout.js +67 -15
  280. package/lib/browser/style/pages.d.ts +1 -1
  281. package/lib/browser/style/pages.js +2 -1
  282. package/lib/browser/style/shell.d.ts +1 -1
  283. package/lib/browser/style/shell.js +46 -3
  284. package/lib/browser/util/frame.d.ts +5 -4
  285. package/lib/browser/util/frame.js +5 -4
  286. package/lib/browser/util/markdown.d.ts +18 -1
  287. package/lib/browser/util/markdown.js +119 -5
  288. package/lib/browser/util/process.d.ts +21 -0
  289. package/lib/browser/util/process.js +46 -2
  290. package/lib/browser/util/voice.d.ts +5 -2
  291. package/lib/browser/util/voice.js +6 -3
  292. package/lib/browser/util/zoom.d.ts +47 -0
  293. package/lib/browser/util/zoom.js +99 -0
  294. package/lib/browser/workbench-calls.d.ts +60 -0
  295. package/lib/browser/workbench-calls.js +145 -0
  296. package/lib/browser/workbench-protocol.d.ts +5 -1
  297. package/lib/browser/workbench-util.d.ts +7 -0
  298. package/lib/browser/workbench-util.js +10 -3
  299. package/lib/browser/workbench.d.ts +14 -5
  300. package/lib/browser/workbench.js +51 -31
  301. package/package.json +10 -10
  302. package/public/launch.svg +46 -42
@@ -0,0 +1,47 @@
1
+ /** The size of a picture or of the box it is shown in, in CSS pixels. */
2
+ export interface ZoomSize {
3
+ width: number;
4
+ height: number;
5
+ }
6
+ /** How far a picture may be zoomed in its box: `base` it shows at first, between `min` and `max`. */
7
+ export interface ZoomLimits {
8
+ base: number;
9
+ min: number;
10
+ max: number;
11
+ }
12
+ /**
13
+ * A picture zoomed in a box that scrolls: how big it is drawn, where it is in what scrolls, and how far that
14
+ * scrolls so that a point of the picture stays under the fingers or the pointer. Pure, for the tests.
15
+ */
16
+ export declare namespace ZoomUtil {
17
+ /** Space around the picture at every scale, so that its edges never touch the box. */
18
+ const PAD = 16;
19
+ /** The steps of the + and − buttons and keys. */
20
+ const STOPS: number[];
21
+ /** At this scale and over, its pixels are drawn as squares, as the viewers of pictures do. */
22
+ const PIXELATED = 4;
23
+ /** The scale at which all of the picture shows in the box: what it shows at first unless that is larger than its own pixels. */
24
+ function contain(image: ZoomSize, box: ZoomSize): number;
25
+ /** All of it in the box, never larger than its own pixels; no smaller than that, and in to at least LEAST_MAX. */
26
+ function limits(image: ZoomSize, box: ZoomSize): ZoomLimits;
27
+ function clamp(scale: number, limits: ZoomLimits): number;
28
+ /** What a pinch past the limits draws: it goes on, ever less far. */
29
+ function rubber(scale: number, limits: ZoomLimits): number;
30
+ /** Where the picture starts along an axis of `box` pixels, `size` pixels drawn: centred while smaller, else after PAD. */
31
+ function offset(size: number, box: number): number;
32
+ /** How long what scrolls is along an axis: the box, or the picture and PAD on both sides. */
33
+ function extent(size: number, box: number): number;
34
+ /** Where in the picture (its own pixels) a point of the box is, along an axis, the picture `natural` pixels long at `scale`. */
35
+ function at(point: number, scroll: number, natural: number, scale: number, box: number): number;
36
+ /** How far to scroll along an axis so that `spot` of the picture (its own pixels) is under `point` of the box, at `scale`. */
37
+ function scrollTo(spot: number, point: number, natural: number, scale: number, box: number): number;
38
+ /** The next step in (`way` 1) or out (-1) from `scale`; `base` is a step too. */
39
+ function step(scale: number, way: 1 | -1, limits: ZoomLimits): number;
40
+ /** Whether it shows as at first. */
41
+ function fitted(scale: number, limits: ZoomLimits): boolean;
42
+ /** A double tap or click: back to `base` when zoomed, else in, to its own pixels when that is a few times nearer. */
43
+ function toggle(scale: number, limits: ZoomLimits): number;
44
+ /** How much a turn of the wheel or a pinch of the trackpad (a wheel with Ctrl) zooms: `deltaY` in `deltaMode`'s unit. */
45
+ function wheel(deltaY: number, deltaMode: number): number;
46
+ }
47
+ //# sourceMappingURL=zoom.d.ts.map
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ZoomUtil = void 0;
4
+ /**
5
+ * A picture zoomed in a box that scrolls: how big it is drawn, where it is in what scrolls, and how far that
6
+ * scrolls so that a point of the picture stays under the fingers or the pointer. Pure, for the tests.
7
+ */
8
+ var ZoomUtil;
9
+ (function (ZoomUtil) {
10
+ /** Space around the picture at every scale, so that its edges never touch the box. */
11
+ ZoomUtil.PAD = 16;
12
+ /** The steps of the + and − buttons and keys. */
13
+ ZoomUtil.STOPS = [0.05, 0.1, 0.15, 0.25, 0.33, 0.5, 0.67, 0.75, 1, 1.25, 1.5, 2, 3, 4, 6, 8, 12, 16, 24, 32];
14
+ /** At least this far in, however big the picture. */
15
+ const LEAST_MAX = 8;
16
+ /** At this scale and over, its pixels are drawn as squares, as the viewers of pictures do. */
17
+ ZoomUtil.PIXELATED = 4;
18
+ /** A pinch past the limits goes on this much less far (a rubber band), then comes back. */
19
+ const RUBBER = 0.35;
20
+ /** The scale at which all of the picture shows in the box: what it shows at first unless that is larger than its own pixels. */
21
+ function contain(image, box) {
22
+ const width = Math.max(1, box.width - 2 * ZoomUtil.PAD);
23
+ const height = Math.max(1, box.height - 2 * ZoomUtil.PAD);
24
+ return Math.min(width / Math.max(1, image.width), height / Math.max(1, image.height));
25
+ }
26
+ ZoomUtil.contain = contain;
27
+ /** All of it in the box, never larger than its own pixels; no smaller than that, and in to at least LEAST_MAX. */
28
+ function limits(image, box) {
29
+ const whole = contain(image, box);
30
+ const base = Math.min(1, whole);
31
+ return { base, min: base, max: Math.max(LEAST_MAX, whole * 2) };
32
+ }
33
+ ZoomUtil.limits = limits;
34
+ function clamp(scale, limits) {
35
+ return Math.min(limits.max, Math.max(limits.min, scale));
36
+ }
37
+ ZoomUtil.clamp = clamp;
38
+ /** What a pinch past the limits draws: it goes on, ever less far. */
39
+ function rubber(scale, limits) {
40
+ if (scale < limits.min) {
41
+ return limits.min * (scale / limits.min) ** RUBBER;
42
+ }
43
+ if (scale > limits.max) {
44
+ return limits.max * (scale / limits.max) ** RUBBER;
45
+ }
46
+ return scale;
47
+ }
48
+ ZoomUtil.rubber = rubber;
49
+ /** Where the picture starts along an axis of `box` pixels, `size` pixels drawn: centred while smaller, else after PAD. */
50
+ function offset(size, box) {
51
+ return Math.max(ZoomUtil.PAD, (box - size) / 2);
52
+ }
53
+ ZoomUtil.offset = offset;
54
+ /** How long what scrolls is along an axis: the box, or the picture and PAD on both sides. */
55
+ function extent(size, box) {
56
+ return Math.max(box, size + 2 * ZoomUtil.PAD);
57
+ }
58
+ ZoomUtil.extent = extent;
59
+ /** Where in the picture (its own pixels) a point of the box is, along an axis, the picture `natural` pixels long at `scale`. */
60
+ function at(point, scroll, natural, scale, box) {
61
+ return (scroll + point - offset(natural * scale, box)) / scale;
62
+ }
63
+ ZoomUtil.at = at;
64
+ /** How far to scroll along an axis so that `spot` of the picture (its own pixels) is under `point` of the box, at `scale`. */
65
+ function scrollTo(spot, point, natural, scale, box) {
66
+ const size = natural * scale;
67
+ const most = extent(size, box) - box;
68
+ return Math.min(most, Math.max(0, spot * scale + offset(size, box) - point));
69
+ }
70
+ ZoomUtil.scrollTo = scrollTo;
71
+ /** The next step in (`way` 1) or out (-1) from `scale`; `base` is a step too. */
72
+ function step(scale, way, limits) {
73
+ const stops = [...ZoomUtil.STOPS, limits.base].sort((a, b) => a - b);
74
+ const next = way > 0 ? stops.find(stop => stop > scale * 1.01) : [...stops].reverse().find(stop => stop < scale * 0.99);
75
+ return clamp(next !== null && next !== void 0 ? next : (way > 0 ? limits.max : limits.min), limits);
76
+ }
77
+ ZoomUtil.step = step;
78
+ /** Whether it shows as at first. */
79
+ function fitted(scale, limits) {
80
+ return Math.abs(scale - limits.base) < limits.base * 0.01;
81
+ }
82
+ ZoomUtil.fitted = fitted;
83
+ /** A double tap or click: back to `base` when zoomed, else in, to its own pixels when that is a few times nearer. */
84
+ function toggle(scale, limits) {
85
+ if (!fitted(scale, limits)) {
86
+ return limits.base;
87
+ }
88
+ const target = limits.base < 1 ? Math.max(limits.base * 2, Math.min(1, limits.base * 4)) : limits.base * 2.5;
89
+ return clamp(target, limits);
90
+ }
91
+ ZoomUtil.toggle = toggle;
92
+ /** How much a turn of the wheel or a pinch of the trackpad (a wheel with Ctrl) zooms: `deltaY` in `deltaMode`'s unit. */
93
+ function wheel(deltaY, deltaMode) {
94
+ const pixels = deltaY * (deltaMode === 1 ? 16 : deltaMode === 2 ? 400 : 1);
95
+ return Math.exp(-Math.min(40, Math.max(-40, pixels)) * 0.01);
96
+ }
97
+ ZoomUtil.wheel = wheel;
98
+ })(ZoomUtil || (exports.ZoomUtil = ZoomUtil = {}));
99
+ //# sourceMappingURL=zoom.js.map
@@ -0,0 +1,60 @@
1
+ import { type SessionConnection, type TaConnection } from '@celljs/ta-client';
2
+ import { OfflineReads } from './offline/offline-reads';
3
+ import type { ConnectionStatus, WorkbenchState } from './workbench-protocol';
4
+ import { type ServiceName } from './workbench-util';
5
+ /** What the calls need of the workbench. */
6
+ export interface CallsOwner {
7
+ status(): ConnectionStatus;
8
+ /** The connection of now, if there is one. */
9
+ connection(): TaConnection | undefined;
10
+ connected(): Promise<void>;
11
+ subscribe(listener: (state: WorkbenchState) => void): () => void;
12
+ /** Tells web extensions that keys of their data changed. */
13
+ dataChanged(name: string, keys: string[], cwd?: string): void;
14
+ }
15
+ /**
16
+ * The calls of the page to its computer: those of the workbench's services, and those of its stores
17
+ * (`link`). Each goes to the connection of the time; before there is one, it waits for it. A call that
18
+ * reads (OFFLINE_READS) answers as it did last time while the computer cannot be reached, rather than
19
+ * waiting: what was shown shows again, web extensions started from the device too.
20
+ */
21
+ export declare class WorkbenchCalls {
22
+ protected readonly owner: CallsOwner;
23
+ /** The answers of the calls that read, of the computer in use. */
24
+ readonly reads: OfflineReads;
25
+ /** The services, the same across connections. */
26
+ protected readonly services: Map<ServiceName, object>;
27
+ /**
28
+ * The data of web extensions answered from the device (by call): read again once online, as the server
29
+ * tells of changes only to what a connection read, and it may have changed meanwhile.
30
+ */
31
+ protected readonly keptData: Map<string, {
32
+ name: string;
33
+ key: string;
34
+ cwd?: string;
35
+ }>;
36
+ constructor(owner: CallsOwner, host: string | undefined);
37
+ /** A service of the page, its methods the same each time too: what is given them is not drawn again for nothing. */
38
+ service<K extends ServiceName>(name: K): TaConnection[K];
39
+ /**
40
+ * What stores use of the connection, there before it is (a conversation kept on the device shows without
41
+ * one): their calls wait for it as on a connection that dropped, then fail; they attach once connected.
42
+ */
43
+ readonly link: SessionConnection;
44
+ /** As `connected`, failing as a call on a connection that dropped does once it is not back within `ms`. */
45
+ connectedWithin(ms: number): Promise<void>;
46
+ /** Online again: the web extensions that were given kept data hear that it changed, and read it from the computer. */
47
+ online(): void;
48
+ protected call(name: ServiceName, method: string, params: unknown[]): Promise<unknown>;
49
+ /**
50
+ * The answer kept of a call, once the connection is not there to give it: at once while offline, after a
51
+ * moment while connecting (a start through a relay is online within it); none online, or with none kept.
52
+ */
53
+ protected keptAnswer(name: ServiceName, method: string, params: unknown[]): Promise<{
54
+ value: unknown;
55
+ } | undefined>;
56
+ /** Resolves once the status is no longer `connecting`, or after `ms`. */
57
+ protected leavesConnecting(ms: number): Promise<void>;
58
+ protected signedIn(): TaConnection;
59
+ }
60
+ //# sourceMappingURL=workbench-calls.d.ts.map
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WorkbenchCalls = void 0;
4
+ const ta_client_1 = require("@celljs/ta-client");
5
+ const device_values_1 = require("./offline/device-values");
6
+ const offline_reads_1 = require("./offline/offline-reads");
7
+ const workbench_util_1 = require("./workbench-util");
8
+ /**
9
+ * The calls of the page to its computer: those of the workbench's services, and those of its stores
10
+ * (`link`). Each goes to the connection of the time; before there is one, it waits for it. A call that
11
+ * reads (OFFLINE_READS) answers as it did last time while the computer cannot be reached, rather than
12
+ * waiting: what was shown shows again, web extensions started from the device too.
13
+ */
14
+ class WorkbenchCalls {
15
+ constructor(owner, host) {
16
+ this.owner = owner;
17
+ /** The services, the same across connections. */
18
+ this.services = new Map();
19
+ /**
20
+ * The data of web extensions answered from the device (by call): read again once online, as the server
21
+ * tells of changes only to what a connection read, and it may have changed meanwhile.
22
+ */
23
+ this.keptData = new Map();
24
+ /**
25
+ * What stores use of the connection, there before it is (a conversation kept on the device shows without
26
+ * one): their calls wait for it as on a connection that dropped, then fail; they attach once connected.
27
+ */
28
+ this.link = {
29
+ server: new Proxy({}, {
30
+ get: (_target, method) => typeof method !== 'string' || method === 'then'
31
+ ? undefined
32
+ : async (...params) => {
33
+ if (!this.owner.connection()) {
34
+ await this.connectedWithin(workbench_util_1.STORE_WAIT_MS);
35
+ }
36
+ return this.signedIn().server[method](...params);
37
+ },
38
+ }),
39
+ onEvents: listener => this.signedIn().onEvents(listener),
40
+ onOpen: listener => this.signedIn().onOpen(listener),
41
+ };
42
+ this.reads = new offline_reads_1.OfflineReads((0, device_values_1.deviceValues)()).use(host);
43
+ }
44
+ /** A service of the page, its methods the same each time too: what is given them is not drawn again for nothing. */
45
+ service(name) {
46
+ const known = this.services.get(name);
47
+ if (known) {
48
+ return known;
49
+ }
50
+ const methods = new Map();
51
+ const service = new Proxy({}, {
52
+ get: (_target, method) => {
53
+ // Not a promise itself.
54
+ if (typeof method !== 'string' || method === 'then') {
55
+ return undefined;
56
+ }
57
+ let call = methods.get(method);
58
+ if (!call) {
59
+ call = (...params) => this.call(name, method, params);
60
+ methods.set(method, call);
61
+ }
62
+ return call;
63
+ },
64
+ });
65
+ this.services.set(name, service);
66
+ return service;
67
+ }
68
+ /** As `connected`, failing as a call on a connection that dropped does once it is not back within `ms`. */
69
+ connectedWithin(ms) {
70
+ let timer;
71
+ const late = new Promise((_, reject) => {
72
+ timer = setTimeout(() => reject(ta_client_1.TaRemoteError.notConnected()), ms);
73
+ });
74
+ return Promise.race([this.owner.connected(), late]).finally(() => clearTimeout(timer));
75
+ }
76
+ /** Online again: the web extensions that were given kept data hear that it changed, and read it from the computer. */
77
+ online() {
78
+ var _a;
79
+ const changed = new Map();
80
+ for (const { name, key, cwd } of this.keptData.values()) {
81
+ const of = `${name}\n${cwd !== null && cwd !== void 0 ? cwd : ''}`;
82
+ const entry = (_a = changed.get(of)) !== null && _a !== void 0 ? _a : { name, keys: [], cwd };
83
+ entry.keys.push(key);
84
+ changed.set(of, entry);
85
+ }
86
+ this.keptData.clear();
87
+ for (const { name, keys, cwd } of changed.values()) {
88
+ this.owner.dataChanged(name, keys, cwd);
89
+ }
90
+ }
91
+ async call(name, method, params) {
92
+ const reads = offline_reads_1.OfflineReads.reads(name, method);
93
+ if (reads && this.owner.status() !== 'online') {
94
+ const kept = await this.keptAnswer(name, method, params);
95
+ if (kept) {
96
+ if (name === 'packages' && method === 'getExtensionData') {
97
+ const [extension, key, cwd] = params;
98
+ this.keptData.set(offline_reads_1.OfflineReads.call(name, method, params), { name: extension, key, cwd });
99
+ }
100
+ return kept.value;
101
+ }
102
+ }
103
+ if (!this.owner.connection()) {
104
+ await this.owner.connected();
105
+ }
106
+ const answer = await this.signedIn()[name][method](...params);
107
+ if (reads) {
108
+ this.reads.keep(name, method, params, answer);
109
+ }
110
+ return answer;
111
+ }
112
+ /**
113
+ * The answer kept of a call, once the connection is not there to give it: at once while offline, after a
114
+ * moment while connecting (a start through a relay is online within it); none online, or with none kept.
115
+ */
116
+ async keptAnswer(name, method, params) {
117
+ const kept = await this.reads.answer(name, method, params);
118
+ if (kept && this.owner.status() === 'connecting') {
119
+ await this.leavesConnecting(workbench_util_1.KEPT_AFTER_MS);
120
+ }
121
+ const status = this.owner.status();
122
+ return status === 'offline' || status === 'connecting' ? kept : undefined;
123
+ }
124
+ /** Resolves once the status is no longer `connecting`, or after `ms`. */
125
+ leavesConnecting(ms) {
126
+ return new Promise(resolve => {
127
+ const done = () => {
128
+ clearTimeout(timer);
129
+ unsubscribe();
130
+ resolve();
131
+ };
132
+ const timer = setTimeout(done, ms);
133
+ const unsubscribe = this.owner.subscribe(state => state.status !== 'connecting' && done());
134
+ });
135
+ }
136
+ signedIn() {
137
+ const connection = this.owner.connection();
138
+ if (!connection) {
139
+ throw new Error('Not signed in to ta serve.');
140
+ }
141
+ return connection;
142
+ }
143
+ }
144
+ exports.WorkbenchCalls = WorkbenchCalls;
145
+ //# sourceMappingURL=workbench-calls.js.map
@@ -99,7 +99,11 @@ export interface TaWorkbench {
99
99
  * what names no directory opens. Open conversations stay in theirs.
100
100
  */
101
101
  setWorkingDirectory(cwd: string): Promise<void>;
102
- /** A store of a session on this connection; the caller attaches and detaches it. */
102
+ /**
103
+ * A store of a session on this connection; the caller attaches and detaches it. It can be made before
104
+ * there is a connection, to show a conversation kept on the device (SessionStoreOptions.initial): it is
105
+ * attached once connected, and its calls meanwhile fail as on a connection that dropped.
106
+ */
103
107
  createStore(sessionId: string, options?: SessionStoreOptions): SessionStore;
104
108
  /** Output of the terminals of this connection; the listener stays across reconnections and sign-ins. */
105
109
  onTerminalData(listener: (terminalId: string, data: string, exitCode?: number) => void): () => void;
@@ -9,6 +9,13 @@ export declare const PROBE_MS = 15000;
9
9
  * the first tries to connect again are within it, so a short drop shows nothing.
10
10
  */
11
11
  export declare const GRACE_MS = 2500;
12
+ /**
13
+ * While the page connects, how long a call that reads waits for the connection before it answers as it did
14
+ * last time (OfflineReads): through a relay the page is mostly online within it, and gets what is new.
15
+ */
16
+ export declare const KEPT_AFTER_MS = 1000;
17
+ /** How long a call of a conversation waits for a connection the page never had, as TaConnection's `waitForOpenMs`. */
18
+ export declare const STORE_WAIT_MS = 5000;
12
19
  /** How long the page shows which computer it switches to before it loads again for it. */
13
20
  export declare const SWITCH_MS = 160;
14
21
  export interface KeptLists {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WorkbenchUtil = exports.WorkbenchError = exports.PAGE_BYTES = exports.SWITCH_MS = exports.GRACE_MS = exports.PROBE_MS = void 0;
3
+ exports.WorkbenchUtil = exports.WorkbenchError = exports.PAGE_BYTES = exports.SWITCH_MS = exports.STORE_WAIT_MS = exports.KEPT_AFTER_MS = exports.GRACE_MS = exports.PROBE_MS = void 0;
4
4
  exports.storage = storage;
5
5
  exports.pageHost = pageHost;
6
6
  const ta_relay_1 = require("@celljs/ta-relay");
@@ -19,10 +19,17 @@ const RETRY_DELAYS_MS = [1000, 2000, 4000, 8000];
19
19
  exports.GRACE_MS = 2500;
20
20
  /**
21
21
  * The lists of the last time, of the ta serve they were of: the next start shows them at once while it
22
- * connects, as a phone's app shows its chats before it is online. They are small; the conversations
23
- * are not kept.
22
+ * connects, as a phone's app shows its chats before it is online. They are small, and read before the
23
+ * first frame; the conversations and what web extensions read are kept in IndexedDB (offline/).
24
24
  */
25
25
  const LISTS_KEY = 'ta.lists';
26
+ /**
27
+ * While the page connects, how long a call that reads waits for the connection before it answers as it did
28
+ * last time (OfflineReads): through a relay the page is mostly online within it, and gets what is new.
29
+ */
30
+ exports.KEPT_AFTER_MS = 1000;
31
+ /** How long a call of a conversation waits for a connection the page never had, as TaConnection's `waitForOpenMs`. */
32
+ exports.STORE_WAIT_MS = 5000;
26
33
  /** How long the page shows which computer it switches to before it loads again for it. */
27
34
  exports.SWITCH_MS = 160;
28
35
  /** A conversation opens with about this much of its latest messages, its earlier ones loaded as much at a time when scrolled to. */
@@ -1,6 +1,7 @@
1
1
  import { SessionStore, type SessionStoreOptions, TaConnection } from '@celljs/ta-client';
2
2
  import { type TaAccessServer, type TaAuthEvent, type TaAuthServer, type TaGatewayServer, type TaPackageServer, type TaRelayServer, type TaRemoteEvent, type TaRemoteServer, type TaServer, type TaServerInfo, type TaSettingsServer, type TaTerminalServer, type TaWorkspaceServer } from '@celljs/ta-protocol';
3
3
  import { type HostList } from './hosts';
4
+ import { WorkbenchCalls } from './workbench-calls';
4
5
  import { type Credential, TaWorkbench, type WorkbenchState } from './workbench-protocol';
5
6
  import { type ServiceName } from './workbench-util';
6
7
  export declare class TaWorkbenchImpl implements TaWorkbench {
@@ -16,13 +17,20 @@ export declare class TaWorkbenchImpl implements TaWorkbench {
16
17
  protected graceMs: number;
17
18
  /** The ta serve of the sign-in of now, whose lists are kept as they change. */
18
19
  protected listsOf?: string;
20
+ /**
21
+ * The calls of the services and of the stores, to the connection of the time; answered from the device
22
+ * while offline, for the computer in use from the start (web extensions started from the device read
23
+ * before the page connects).
24
+ */
25
+ protected readonly calls: WorkbenchCalls;
19
26
  /** Those waiting for the connection (`connected`): `resolve` once online, `reject` once signed out. */
20
- protected readonly beforeConnection: Map<ServiceName, object>;
21
27
  protected readonly connectedWaiters: Set<{
22
28
  resolve(): void;
23
29
  reject(error: Error): void;
24
30
  }>;
25
31
  protected waking: boolean;
32
+ protected refreshing?: Promise<void>;
33
+ protected refreshAgain?: Promise<void>;
26
34
  /** Counts sign-ins and sign-outs: an attempt of an earlier one does nothing when it ends. */
27
35
  protected generation: number;
28
36
  protected readonly listeners: Set<(state: WorkbenchState) => void>;
@@ -41,10 +49,6 @@ export declare class TaWorkbenchImpl implements TaWorkbench {
41
49
  get gateway(): TaGatewayServer;
42
50
  get relay(): TaRelayServer;
43
51
  get remote(): TaRemoteServer;
44
- /**
45
- * A service of the connection; before there is one (the lists of the last time show meanwhile), its
46
- * calls wait for it, and fail if the page signs out instead.
47
- */
48
52
  protected service<K extends ServiceName>(name: K): TaConnection[K];
49
53
  protected signedIn(): TaConnection;
50
54
  onTerminalData(listener: (terminalId: string, data: string, exitCode?: number) => void): () => void;
@@ -84,7 +88,12 @@ export declare class TaWorkbenchImpl implements TaWorkbench {
84
88
  signOut(): void;
85
89
  connected(): Promise<void>;
86
90
  reconnect(): void;
91
+ /**
92
+ * One read of the lists at a time: asked again meanwhile, one more follows it for all who asked, so that
93
+ * reads on a slow network do not pile up.
94
+ */
87
95
  refresh(): Promise<void>;
96
+ protected readLists(): Promise<void>;
88
97
  createStore(sessionId: string, options?: SessionStoreOptions): SessionStore;
89
98
  /** The prompts of ssh that wait for an answer, from now and those already there. */
90
99
  protected watchRemote(connection: TaConnection): Promise<void>;
@@ -12,7 +12,9 @@ const ta_client_1 = require("@celljs/ta-client");
12
12
  const ta_protocol_1 = require("@celljs/ta-protocol");
13
13
  const ta_relay_1 = require("@celljs/ta-relay");
14
14
  const hosts_1 = require("./hosts");
15
+ const device_values_1 = require("./offline/device-values");
15
16
  const state_protocol_1 = require("./state/state-protocol");
17
+ const workbench_calls_1 = require("./workbench-calls");
16
18
  const workbench_protocol_1 = require("./workbench-protocol");
17
19
  const workbench_util_1 = require("./workbench-util");
18
20
  let TaWorkbenchImpl = class TaWorkbenchImpl {
@@ -21,8 +23,23 @@ let TaWorkbenchImpl = class TaWorkbenchImpl {
21
23
  this.current = { status: 'connecting', hosts: this.list.hosts, host: this.list.current, sessions: [], saved: [] };
22
24
  this.attempts = 0;
23
25
  this.graceMs = workbench_util_1.GRACE_MS;
26
+ /**
27
+ * The calls of the services and of the stores, to the connection of the time; answered from the device
28
+ * while offline, for the computer in use from the start (web extensions started from the device read
29
+ * before the page connects).
30
+ */
31
+ this.calls = new workbench_calls_1.WorkbenchCalls({
32
+ status: () => this.current.status,
33
+ connection: () => this.connection,
34
+ connected: () => this.connected(),
35
+ subscribe: listener => this.subscribe(listener),
36
+ dataChanged: (name, keys, cwd) => {
37
+ for (const listener of this.extensionDataListeners) {
38
+ listener(name, keys, cwd);
39
+ }
40
+ },
41
+ }, this.list.current);
24
42
  /** Those waiting for the connection (`connected`): `resolve` once online, `reject` once signed out. */
25
- this.beforeConnection = new Map();
26
43
  this.connectedWaiters = new Set();
27
44
  this.waking = false;
28
45
  /** Counts sign-ins and sign-outs: an attempt of an earlier one does nothing when it ends. */
@@ -66,32 +83,8 @@ let TaWorkbenchImpl = class TaWorkbenchImpl {
66
83
  get remote() {
67
84
  return this.service('remote');
68
85
  }
69
- /**
70
- * A service of the connection; before there is one (the lists of the last time show meanwhile), its
71
- * calls wait for it, and fail if the page signs out instead.
72
- */
73
86
  service(name) {
74
- if (this.connection) {
75
- return this.connection[name];
76
- }
77
- // The same each time, as the connection's are: what is given it is not drawn again for nothing.
78
- const known = this.beforeConnection.get(name);
79
- if (known) {
80
- return known;
81
- }
82
- const service = new Proxy({}, {
83
- get: (_target, method) =>
84
- // Not a promise itself.
85
- method === 'then'
86
- ? undefined
87
- : async (...params) => {
88
- await this.connected();
89
- const real = this.signedIn()[name];
90
- return real[method](...params);
91
- },
92
- });
93
- this.beforeConnection.set(name, service);
94
- return service;
87
+ return this.calls.service(name);
95
88
  }
96
89
  signedIn() {
97
90
  if (!this.connection) {
@@ -223,6 +216,7 @@ let TaWorkbenchImpl = class TaWorkbenchImpl {
223
216
  if (kept) {
224
217
  state_protocol_1.StateUtil.forgetHost(kept, hostId);
225
218
  }
219
+ void device_values_1.OfflineKeys.forget((0, device_values_1.deviceValues)(), hostId);
226
220
  if (this.listsOf === hostId) {
227
221
  this.listsOf = undefined;
228
222
  }
@@ -247,6 +241,7 @@ let TaWorkbenchImpl = class TaWorkbenchImpl {
247
241
  if (of !== this.listsOf) {
248
242
  // Another ta serve: its lists of the last time, or none, rather than those of the one before.
249
243
  this.listsOf = of;
244
+ this.calls.reads.use(of);
250
245
  this.update({ server: undefined, sessions: [], saved: [], ...workbench_util_1.WorkbenchUtil.readLists((_c = (_b = (0, workbench_util_1.storage)()) === null || _b === void 0 ? void 0 : _b.getItem(workbench_util_1.WorkbenchUtil.listsKey(of))) !== null && _c !== void 0 ? _c : null, of) });
251
246
  }
252
247
  this.update({ status: 'connecting', error: undefined });
@@ -318,6 +313,11 @@ let TaWorkbenchImpl = class TaWorkbenchImpl {
318
313
  void this.watchRemote(connection);
319
314
  });
320
315
  void this.watchRemote(connection);
316
+ if ('pairing' in credential) {
317
+ // Through a relay the computer has let the page in once the socket is open, and no gateway is behind
318
+ // it: the calls of the page go now, with the one that reads who it is, not a round trip after it.
319
+ this.update({ status: 'online', error: undefined, retryAt: undefined });
320
+ }
321
321
  let server;
322
322
  try {
323
323
  server = await connection.server.getServerInfo();
@@ -390,7 +390,27 @@ let TaWorkbenchImpl = class TaWorkbenchImpl {
390
390
  (_a = this.connection) === null || _a === void 0 ? void 0 : _a.reconnect();
391
391
  }
392
392
  }
393
- async refresh() {
393
+ /**
394
+ * One read of the lists at a time: asked again meanwhile, one more follows it for all who asked, so that
395
+ * reads on a slow network do not pile up.
396
+ */
397
+ refresh() {
398
+ var _a;
399
+ if (!this.refreshing) {
400
+ this.refreshing = this.readLists().finally(() => {
401
+ this.refreshing = undefined;
402
+ });
403
+ return this.refreshing;
404
+ }
405
+ (_a = this.refreshAgain) !== null && _a !== void 0 ? _a : (this.refreshAgain = this.refreshing
406
+ .catch(() => undefined)
407
+ .then(() => {
408
+ this.refreshAgain = undefined;
409
+ return this.refresh();
410
+ }));
411
+ return this.refreshAgain;
412
+ }
413
+ async readLists() {
394
414
  // A ta serve of before has no saved sessions to list: its list stays the open ones. The default
395
415
  // directory comes along, as another device may have changed it.
396
416
  const [sessions, saved, server] = await Promise.all([
@@ -407,10 +427,7 @@ let TaWorkbenchImpl = class TaWorkbenchImpl {
407
427
  });
408
428
  }
409
429
  createStore(sessionId, options) {
410
- if (!this.connection) {
411
- throw new Error('Not signed in to ta serve.');
412
- }
413
- return new ta_client_1.SessionStore(this.connection, sessionId, { pageBytes: workbench_util_1.PAGE_BYTES, ...options });
430
+ return new ta_client_1.SessionStore(this.calls.link, sessionId, { pageBytes: workbench_util_1.PAGE_BYTES, ...options });
414
431
  }
415
432
  /** The prompts of ssh that wait for an answer, from now and those already there. */
416
433
  async watchRemote(connection) {
@@ -499,6 +516,9 @@ let TaWorkbenchImpl = class TaWorkbenchImpl {
499
516
  if (this.listsOf && (next.sessions !== before.sessions || next.saved !== before.saved || next.server !== before.server)) {
500
517
  this.keepLists(this.listsOf);
501
518
  }
519
+ if (before.status !== 'online') {
520
+ this.calls.online();
521
+ }
502
522
  }
503
523
  }
504
524
  keepLists(of) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-web",
3
- "version": "4.9.1",
3
+ "version": "4.10.0",
4
4
  "description": "The web client of ta serve: sessions, streaming messages, tool runs with diffs, and dialogs",
5
5
  "keywords": [
6
6
  "cell-component"
@@ -33,26 +33,26 @@
33
33
  "watch": "tsc -b -w --preserveWatchOutput"
34
34
  },
35
35
  "dependencies": {
36
- "@celljs/core": "4.9.1",
37
- "@celljs/react": "4.9.1",
38
- "@celljs/ta-client": "4.9.1",
39
- "@celljs/ta-protocol": "4.9.1",
40
- "@celljs/ta-relay": "4.9.1",
41
- "@celljs/widget": "4.9.1",
36
+ "@celljs/core": "4.10.0",
37
+ "@celljs/react": "4.10.0",
38
+ "@celljs/ta-client": "4.10.0",
39
+ "@celljs/ta-protocol": "4.10.0",
40
+ "@celljs/ta-relay": "4.10.0",
41
+ "@celljs/widget": "4.10.0",
42
42
  "@xterm/addon-fit": "^0.11.0",
43
43
  "@xterm/addon-unicode11": "^0.9.0",
44
44
  "@xterm/addon-webgl": "^0.19.0",
45
45
  "@xterm/xterm": "^6.0.0",
46
46
  "katex": "^0.18.11",
47
- "lucide-react": "^1.70.0",
47
+ "lucide-react": "^1.72.0",
48
48
  "mermaid": "^12.3.0",
49
49
  "monaco-editor": "^0.57.0",
50
50
  "react": "^19.3.1",
51
51
  "react-intl": "^7.1.14"
52
52
  },
53
53
  "devDependencies": {
54
- "@earendil-works/pi-ai": "^1.5.0",
55
- "@earendil-works/pi-coding-agent": "^1.5.0",
54
+ "@earendil-works/pi-ai": "^1.5.2",
55
+ "@earendil-works/pi-coding-agent": "^1.5.2",
56
56
  "@types/react": "^19.3.0",
57
57
  "react-dom": "^19.3.1"
58
58
  },