@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
@@ -2,6 +2,7 @@ import type { TaEvent, TaPackageServer, TaRemoteServer, TaServer, TaSessionInfo,
2
2
  import type * as React from 'react';
3
3
  import type { Mood } from '../avatar/dino-avatar.js';
4
4
  import type { DeviceState } from '../device/device-protocol.js';
5
+ import type { TaFiles } from '../files/files-protocol.js';
5
6
  import type { Language, Theme } from '../settings/settings-protocol.js';
6
7
  import type { WebPageInfo } from './web-pages.js';
7
8
  export type { WebPageInfo, WebPageState } from './web-pages.js';
@@ -21,6 +22,12 @@ export interface WebExtensionAPI {
21
22
  readonly terminals: TaTerminalServer;
22
23
  /** The packages pi loads; for the data of the extension's own package, {@link storage}. */
23
24
  readonly packages: TaPackageServer;
25
+ /**
26
+ * The bytes of the files of the workspace, for what the page cannot load by their URL
27
+ * (`workspace.fileUrl`): behind a relay, and in the app on a phone, only the calls on the WebSocket reach
28
+ * ta serve. `byUrl` says which way it is; the bytes come sealed, end to end, when it is not.
29
+ */
30
+ readonly files: TaFiles;
24
31
  /** The other machines of `ssh://` directories (TaLocation): their ports, for a page served there. */
25
32
  readonly remote: TaRemoteServer;
26
33
  /** pi's settings of ta (`settings.json`): `getSettings(cwd)` also lists the models with credentials, for a model picker. */
@@ -49,6 +56,12 @@ export interface WebExtensionAPI {
49
56
  * entries of its + menu and something above it, each given the conversation it is drawn for.
50
57
  */
51
58
  registerComposerAddon(addon: WebComposerAddon): void;
59
+ /**
60
+ * A section of the settings, after those of Ta: what the user sets once for the extension (a model it
61
+ * uses, a choice it makes), kept with `storage`. Its rows look like Ta's, each with a control the
62
+ * extension draws.
63
+ */
64
+ registerSettings(section: WebSettingsSection): void;
52
65
  /**
53
66
  * Opens what links of replies point to: files (at the lines they name), directories, pages of the web.
54
67
  * Openers are asked in the order they were registered; the first that returns true has opened it.
@@ -123,6 +136,8 @@ export type WebOpener = (link: WebLink) => boolean | Promise<boolean>;
123
136
  export interface WebSessionOpening {
124
137
  title?: string;
125
138
  cwd?: string;
139
+ /** Its session file, when known: what the device kept of the conversation shows while it opens, and while the computer cannot be reached. */
140
+ sessionFile?: string;
126
141
  }
127
142
  export interface WebStorage {
128
143
  get<T = unknown>(key: string): Promise<T | undefined>;
@@ -222,7 +237,10 @@ export interface WebExtensionUI {
222
237
  setEditorDirty(id: string, dirty: boolean): void;
223
238
  /** A React hook: the id of the tab shown in the workbench, whoever opened it. */
224
239
  useActiveEditor(): string | undefined;
225
- /** A React hook: the directory of the conversation shown, or the server's when none is. */
240
+ /**
241
+ * A React hook: the directory of the conversation (or agent) in front, as it changes; the default directory
242
+ * of the server when none is: a page, the settings, the lists of a phone. What opens now (a terminal) opens there.
243
+ */
226
244
  useCwd(): string;
227
245
  /**
228
246
  * A React hook: the device the page runs on, as it changes: the layout (`compact`: the navigation is a
@@ -233,6 +251,11 @@ export interface WebExtensionUI {
233
251
  useDevice(): DeviceState;
234
252
  /** A React hook: the session of the conversation shown (TaSessionInfo.sessionId). */
235
253
  useSessionId(): string | undefined;
254
+ /**
255
+ * A React hook: the open sessions of ta serve, as the page reads them again: whether each answers now
256
+ * (`isStreaming`), what was said last. The same array until one changes.
257
+ */
258
+ useSessions(): readonly TaSessionInfo[];
236
259
  /**
237
260
  * Shows a view of any web extension by its id, `<extension name>/<view name>` (`assistant/assistant`
238
261
  * for the double): a page in the main area, a tool of the workbench as its tab; `''` the conversation again.
@@ -250,6 +273,21 @@ export interface WebExtensionUI {
250
273
  * screen): the menu to render, and `open` for `onContextMenu`, with sections set apart by a line.
251
274
  */
252
275
  useContextMenu(): [React.ReactNode, (event: React.MouseEvent, sections: WebMenuItem[][]) => void];
276
+ /**
277
+ * For a menu of your own (`position: fixed`, its entries `role="menuitem"`), from a layout effect: places it
278
+ * where it was `opened` as the menus of the page go (at the pointer; under a finger, out from under it and the
279
+ * row it pressed, `around`), and on a touch screen lets the finger have it as the menus of the page do: slide
280
+ * onto an entry and let go to choose it, slide off and let go to `close` it, a tap outside only closing it.
281
+ * Returns how to stop. Prefer `useContextMenu`, which does this.
282
+ */
283
+ attachMenu(menu: HTMLElement, opened: {
284
+ x: number;
285
+ y: number;
286
+ around?: {
287
+ top: number;
288
+ bottom: number;
289
+ };
290
+ }, close: () => void): () => void;
253
291
  /**
254
292
  * In the Ta app: the camera of the system scans a QR code; resolves with its text, or undefined when the user
255
293
  * cancelled. Undefined elsewhere (a browser has no scanner of its own).
@@ -303,6 +341,14 @@ export interface WebExtensionUI {
303
341
  readonly Markdown: React.ComponentType<{
304
342
  text: string;
305
343
  }>;
344
+ /**
345
+ * A React hook: a chat that scrolls as the conversations of the page do, the element of the returned ref
346
+ * being what scrolls and its first child (positioned) holding a row for each message. At the bottom it
347
+ * follows what comes in; scrolled up, what the user reads stays where it is (the message box growing, rows
348
+ * changing their height); a part opened by a click stays where it was. `sent`: how many messages the user
349
+ * sent, one more of which goes to the bottom; another `key` (another chat in the same view) too.
350
+ */
351
+ useChatScroll(sent: number, key?: string): React.RefObject<HTMLDivElement | null>;
306
352
  /** What a list or a view shows while it has nothing, as the lists of the page show it: centered in the space it has. */
307
353
  readonly Empty: React.ComponentType<WebEmptyProps>;
308
354
  /** What a list shows while its rows are on their way (its data not read yet), as the lists of the page show it: after a moment, never for a list that comes at once. */
@@ -329,6 +375,13 @@ export interface WebExtensionUI {
329
375
  readonly Picture: React.ComponentType<WebPictureProps>;
330
376
  /** Choices as pictures in a row, as the suggestions of an empty conversation: a click picks one. */
331
377
  readonly PictureCards: React.ComponentType<WebPictureCardsProps>;
378
+ /**
379
+ * A picture to look at closely, as the viewers of pictures: all of it at first (never larger than its own
380
+ * pixels), pinched by two fingers or a trackpad, zoomed by a wheel with Ctrl or ⌘ and by a double tap or
381
+ * click, dragged or scrolled once zoomed; with − / the scale / + / 1:1 below it. It fills its parent (a
382
+ * column of flex).
383
+ */
384
+ readonly ImageViewer: React.ComponentType<WebImageViewerProps>;
332
385
  /** A QR code of a text (a link to scan with a phone), black on white whatever the theme; `label` for a screen reader. */
333
386
  readonly QrCode: React.ComponentType<{
334
387
  text: string;
@@ -600,6 +653,19 @@ export interface WebPictureCard {
600
653
  disabled?: boolean;
601
654
  onPick(): void;
602
655
  }
656
+ export interface WebImageViewerProps {
657
+ src: string;
658
+ alt?: string;
659
+ /** On its root, for the background behind the picture (a checkerboard for transparency). */
660
+ className?: string;
661
+ /** Once it loaded: its size in pixels. */
662
+ onLoad?(size: {
663
+ width: number;
664
+ height: number;
665
+ }): void;
666
+ /** A click or tap beside the picture. */
667
+ onBackground?(): void;
668
+ }
603
669
  export interface WebPictureCardsProps {
604
670
  cards: readonly WebPictureCard[];
605
671
  /** Default as many as there are cards. */
@@ -660,6 +726,22 @@ export interface WebConversation {
660
726
  /** As the page names it: the name of the session, or of the double. */
661
727
  title?: string;
662
728
  }
729
+ /** A section an extension adds to the settings (WebExtensionAPI.registerSettings). */
730
+ export interface WebSettingsSection {
731
+ title: WebLabel;
732
+ /** Beside its title in the list of the sections; default: a puzzle piece. */
733
+ icon?: WebIcon;
734
+ rows: WebSettingRow[];
735
+ }
736
+ /** A row of the settings of an extension: a label and a description as Ta's rows have, and its control. */
737
+ export interface WebSettingRow {
738
+ key: string;
739
+ label: WebLabel;
740
+ description?: WebLabel;
741
+ /** The control, beside the label; with `stacked`, under it, for a wide one (a model picker, a list). */
742
+ render: React.ComponentType;
743
+ stacked?: boolean;
744
+ }
663
745
  /** What an extension adds to the message box of every conversation (WebExtensionAPI.registerComposerAddon). */
664
746
  export interface WebComposerAddon {
665
747
  /** Entries of the + menu, a section of their own; read each time the conversation is drawn, and when `subscribe` says. */
@@ -723,6 +805,16 @@ export interface WebView {
723
805
  * navigation, instead of taking a place there by itself.
724
806
  */
725
807
  discover?: boolean;
808
+ /** A page: the line a list shows under its name, as a messenger does — the last thing said there, and when. */
809
+ preview?(): WebViewPreview | undefined;
810
+ /** A page: whoever is there answers now; a list that shows it marks it so, as a conversation answering. */
811
+ busy?(): boolean;
812
+ /** What `preview` or `busy` gives changed: the lists read it again. */
813
+ subscribe?(listener: () => void): () => void;
814
+ }
815
+ export interface WebViewPreview {
816
+ text: string;
817
+ at: number;
726
818
  }
727
819
  /** What `ui.shareExtension` hands on. */
728
820
  export interface WebShareTarget {
@@ -792,6 +884,10 @@ export interface WebViewInfo {
792
884
  shown: boolean;
793
885
  /** WebView.menu: the list that shows the page draws a … with it. */
794
886
  menu?(): WebMenuItem[][];
887
+ /** WebView.preview. */
888
+ preview?: WebViewPreview;
889
+ /** WebView.busy. */
890
+ busy: boolean;
795
891
  }
796
892
  export interface WebTool {
797
893
  /** Letters, digits, `_` and `-`, starting with a letter. */
@@ -1,15 +1,21 @@
1
+ import type { TaWebExtensionInfo } from '@celljs/ta-protocol';
1
2
  /**
2
3
  * The code of the web extensions of packages, kept in this browser by its hash (`TaWebExtensionInfo.hash`,
3
4
  * of the code itself): a start reads from ta serve only what changed. A phone over the relay read some 230 KB
4
5
  * at every start before its double's list could show.
5
6
  * What the last list of a ta serve does not name goes; switching to another computer reads its own again.
7
+ * The list itself is kept for each computer too, for the extensions to start before it answers.
6
8
  */
7
9
  export declare class WebExtensionCode {
8
10
  protected readonly storage: () => Storage | undefined;
9
11
  static readonly PREFIX = "ta.web-extension ";
12
+ static readonly LIST = "web-extensions";
10
13
  constructor(storage: () => Storage | undefined);
11
14
  get(hash: string): string | undefined;
12
15
  set(hash: string, code: string): void;
16
+ /** The list the computer `host` gave last (with the values it keeps for the page, forgotten with them). */
17
+ list(host: string): TaWebExtensionInfo[];
18
+ keepList(host: string, infos: TaWebExtensionInfo[]): void;
13
19
  /** Only the code of `hashes`, those of the list of now. */
14
20
  keepOnly(hashes: Iterable<string>): void;
15
21
  }
@@ -1,8 +1,10 @@
1
+ import { StateUtil } from '../state/state-protocol.js';
1
2
  /**
2
3
  * The code of the web extensions of packages, kept in this browser by its hash (`TaWebExtensionInfo.hash`,
3
4
  * of the code itself): a start reads from ta serve only what changed. A phone over the relay read some 230 KB
4
5
  * at every start before its double's list could show.
5
6
  * What the last list of a ta serve does not name goes; switching to another computer reads its own again.
7
+ * The list itself is kept for each computer too, for the extensions to start before it answers.
6
8
  */
7
9
  export class WebExtensionCode {
8
10
  constructor(storage) {
@@ -27,6 +29,27 @@ export class WebExtensionCode {
27
29
  // Full, or a browser that keeps nothing: read again next time.
28
30
  }
29
31
  }
32
+ /** The list the computer `host` gave last (with the values it keeps for the page, forgotten with them). */
33
+ list(host) {
34
+ var _a;
35
+ var _b;
36
+ try {
37
+ const kept = JSON.parse((_b = (_a = this.storage()) === null || _a === void 0 ? void 0 : _a.getItem(StateUtil.localKey(WebExtensionCode.LIST, 'user', host))) !== null && _b !== void 0 ? _b : 'null');
38
+ return Array.isArray(kept) ? kept : [];
39
+ }
40
+ catch (_c) {
41
+ return [];
42
+ }
43
+ }
44
+ keepList(host, infos) {
45
+ var _a;
46
+ try {
47
+ (_a = this.storage()) === null || _a === void 0 ? void 0 : _a.setItem(StateUtil.localKey(WebExtensionCode.LIST, 'user', host), JSON.stringify(infos));
48
+ }
49
+ catch (_b) {
50
+ // Full: the extensions start once the computer answers.
51
+ }
52
+ }
30
53
  /** Only the code of `hashes`, those of the list of now. */
31
54
  keepOnly(hashes) {
32
55
  const storage = this.storage();
@@ -52,4 +75,5 @@ export class WebExtensionCode {
52
75
  }
53
76
  }
54
77
  WebExtensionCode.PREFIX = 'ta.web-extension ';
78
+ WebExtensionCode.LIST = 'web-extensions';
55
79
  //# sourceMappingURL=web-extension-code.js.map
@@ -1,7 +1,7 @@
1
1
  import type { TaEvent, TaTemporaryFrom, TaWebExtensionInfo } from '@celljs/ta-protocol';
2
2
  import type * as React from 'react';
3
3
  import type { MessageId } from '../i18n/messages.js';
4
- import type { WebAvatarProps, WebComposerAddon, WebCustomMessage, WebEditor, WebExtensionFactory, WebIcon, WebLabel, WebMenuItem, WebOpener, WebSearchSource, WebSessionOpening, WebShareTarget, WebTool, WidgetOptions } from './web-extension-api.js';
4
+ import type { WebAvatarProps, WebComposerAddon, WebCustomMessage, WebEditor, WebExtensionFactory, WebIcon, WebLabel, WebMenuItem, WebOpener, WebSearchSource, WebSessionOpening, WebSettingsSection, WebShareTarget, WebTool, WebViewPreview, WidgetOptions } from './web-extension-api.js';
5
5
  import type { PageUsage, WebPageInfo } from './web-pages.js';
6
6
  import type { WebTaskBoard } from './web-tasks.js';
7
7
  export declare const TaWebExtensions: unique symbol;
@@ -38,6 +38,12 @@ export interface WebComposerAddonEntry {
38
38
  extension: string;
39
39
  addon: WebComposerAddon;
40
40
  }
41
+ export interface WebSettingsEntry {
42
+ /** `<extension id>/<index>`. */
43
+ id: string;
44
+ extension: string;
45
+ section: WebSettingsSection;
46
+ }
41
47
  export interface WebViewEntry {
42
48
  /** `<extension name>/<view name>`. */
43
49
  id: string;
@@ -54,6 +60,9 @@ export interface WebViewEntry {
54
60
  /** Under Discover until the user pins it (WebView.discover). */
55
61
  discover?: boolean;
56
62
  menu?(): WebMenuItem[][];
63
+ preview?(): WebViewPreview | undefined;
64
+ busy?(): boolean;
65
+ subscribePreview?(listener: () => void): () => void;
57
66
  /** Kept from before (WebViewUtil.placeholders): its place, until its extension registers it again. */
58
67
  pending?: boolean;
59
68
  }
@@ -87,6 +96,8 @@ export interface WebExtensionsState {
87
96
  widgets: WebWidgetEntry[];
88
97
  /** What extensions add to the message box of every conversation (WebExtensionAPI.registerComposerAddon). */
89
98
  composerAddons: WebComposerAddonEntry[];
99
+ /** The sections extensions add to the settings (WebExtensionAPI.registerSettings). */
100
+ settingsSections: WebSettingsEntry[];
90
101
  renderers: Record<string, React.ComponentType<{
91
102
  message: WebCustomMessage;
92
103
  }>>;
@@ -103,6 +114,11 @@ export interface WebExtensionsState {
103
114
  focus: number;
104
115
  /** The directory of the conversation shown. */
105
116
  cwd?: string;
117
+ /**
118
+ * The conversation is in front, not a page, the settings, Discover or the lists of a phone
119
+ * (setConversationShown): `ui.useCwd` gives its directory only then, else the default one.
120
+ */
121
+ conversationShown: boolean;
106
122
  /** The session of the conversation shown. */
107
123
  sessionId?: string;
108
124
  /** The view of the page shown in the main area; `''` for the conversation. */
@@ -122,6 +138,10 @@ export interface WebExtensionsState {
122
138
  /** An extension handed on: its dialog shows (WebExtensionUI.shareExtension). */
123
139
  sharing?: WebShareTarget;
124
140
  }
141
+ export declare namespace WebCwdUtil {
142
+ /** The directory of the conversation while it is in front; else none, and the workbench is in the default directory. */
143
+ function shown(state: Pick<WebExtensionsState, 'cwd' | 'conversationShown'>): string | undefined;
144
+ }
125
145
  export declare namespace WebLabelUtil {
126
146
  function text(label: WebLabel | undefined): string;
127
147
  }
@@ -191,6 +211,8 @@ export interface TaWebExtensions {
191
211
  pinEditor(id: string): void;
192
212
  /** The conversation shown, while there is one. */
193
213
  connect(conversation: WebExtensionConversation | undefined): void;
214
+ /** Whether the conversation is what the main area shows: the shell says so as it changes. */
215
+ setConversationShown(shown: boolean): void;
194
216
  /** An event of the conversation shown, for the handlers of `on`. */
195
217
  emit(event: TaEvent): void;
196
218
  /** What `switchSession` of web extensions does: the page shows that session; `undefined` until it can. */
@@ -1,5 +1,13 @@
1
1
  export const TaWebExtensions = Symbol('TaWebExtensions');
2
2
  export const BuiltinWebExtension = Symbol('BuiltinWebExtension');
3
+ export var WebCwdUtil;
4
+ (function (WebCwdUtil) {
5
+ /** The directory of the conversation while it is in front; else none, and the workbench is in the default directory. */
6
+ function shown(state) {
7
+ return state.conversationShown ? state.cwd : undefined;
8
+ }
9
+ WebCwdUtil.shown = shown;
10
+ })(WebCwdUtil || (WebCwdUtil = {}));
3
11
  export var WebLabelUtil;
4
12
  (function (WebLabelUtil) {
5
13
  function text(label) {
@@ -1,11 +1,12 @@
1
1
  import type { TaEvent, TaSettingsServer, TaTemporaryFrom, TaWebExtensionInfo } from '@celljs/ta-protocol';
2
2
  import * as React from 'react';
3
+ import { TaFiles } from '../files/files-protocol.js';
3
4
  import { TaLinks } from '../links/links-protocol.js';
4
5
  import { TaNotices } from '../notices/notices-protocol.js';
5
6
  import { TaSettings } from '../settings/settings-protocol.js';
6
7
  import { TaState } from '../state/state-protocol.js';
7
8
  import { TaWorkbench } from '../workbench-protocol.js';
8
- import type { CodeEditorProps, DiffEditorProps, WebComposerAddon, WebComposerProps, WebEditor, WebExtensionAPI, WebExtensionFactory, WebFolderPickerProps, WebModelPickerProps, WebOpener, WebSearchSource, WebShareTarget, WebStorage, WebTaskSource, WebTool, WebView, WidgetOptions } from './web-extension-api.js';
9
+ import type { CodeEditorProps, DiffEditorProps, WebComposerAddon, WebComposerProps, WebEditor, WebExtensionAPI, WebExtensionFactory, WebFolderPickerProps, WebModelPickerProps, WebOpener, WebSearchSource, WebSettingsSection, WebShareTarget, WebStorage, WebTaskSource, WebTool, WebView, WidgetOptions } from './web-extension-api.js';
9
10
  import { WebExtensionCode } from './web-extension-code.js';
10
11
  import { BuiltinWebExtension, type LoadedWebExtension, TaWebExtensions, type WebEditorEntry, type WebExtensionConversation, type WebExtensionsState, type WebSessionSwitcher, type WebViewEntry } from './web-extension-protocol.js';
11
12
  import { WebOnDemand } from './web-on-demand.js';
@@ -32,6 +33,7 @@ interface Running {
32
33
  taskSources: WebTaskSource[];
33
34
  searches: WebSearchSource[];
34
35
  composerAddons: WebComposerAddon[];
36
+ settingsSections: WebSettingsSection[];
35
37
  handlers: {
36
38
  type: string;
37
39
  handler: (event: TaEvent) => void;
@@ -43,6 +45,7 @@ interface Running {
43
45
  export declare class TaWebExtensionsImpl implements TaWebExtensions {
44
46
  protected readonly workbench: TaWorkbench;
45
47
  protected readonly settings: TaSettings;
48
+ protected readonly taFiles: TaFiles;
46
49
  /** Detached: TaLinks asks the openers of the extensions. */
47
50
  protected readonly links: TaLinks;
48
51
  protected readonly notices: TaNotices;
@@ -59,6 +62,8 @@ export declare class TaWebExtensionsImpl implements TaWebExtensions {
59
62
  protected refreshing: Promise<boolean>;
60
63
  /** The tabs of before are open again: from now on, what is open is kept. */
61
64
  protected restored: boolean;
65
+ /** The extensions of the list of the last time have started (startKept), once. */
66
+ protected keptStarted: boolean;
62
67
  /** The tab shown before the page loaded, until it opens again or the user shows another. */
63
68
  protected pendingActive?: string;
64
69
  /** The views of the navigation kept from before (WebViewUtil.KEPT), in their places until the extensions have loaded once. */
@@ -111,9 +116,17 @@ export declare class TaWebExtensionsImpl implements TaWebExtensions {
111
116
  protected dropEditor(editor: WebEditorEntry): void;
112
117
  protected setDirty(run: Running, id: string, dirty: boolean): void;
113
118
  connect(conversation: WebExtensionConversation | undefined): void;
119
+ setConversationShown(shown: boolean): void;
114
120
  setSessionSwitcher(switcher: WebSessionSwitcher | undefined): void;
115
121
  emit(event: TaEvent): void;
116
122
  protected reconcile(): Promise<boolean>;
123
+ /**
124
+ * The first time, before the computer has answered: the extensions of its list of the last time whose code
125
+ * this browser keeps. What they read goes with the first calls of the page, not a round trip after the list
126
+ * (a phone over the relay waited for it before its double's list could show). The list then keeps those
127
+ * still the same and stops the others.
128
+ */
129
+ protected startKept(host: string | undefined): Promise<boolean>;
117
130
  /** The tools open before, behind what is shown; the tab shown before, once it is open again. */
118
131
  protected restoreTabs(): Promise<void>;
119
132
  protected keepTabs(): void;