@celljs/ta-web 4.10.0 → 4.12.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 (559) hide show
  1. package/README.en.md +7 -7
  2. package/README.md +7 -7
  3. package/esm/browser/assistant/assistant-chat-list.d.ts +11 -0
  4. package/esm/browser/assistant/assistant-chat-list.js +12 -0
  5. package/esm/browser/assistant/assistant-extension.js +5 -0
  6. package/esm/browser/assistant/assistant-protocol.d.ts +2 -1
  7. package/esm/browser/assistant/assistant-task-book.d.ts +12 -2
  8. package/esm/browser/assistant/assistant-task-book.js +23 -4
  9. package/esm/browser/assistant/assistant-task-source.d.ts +1 -1
  10. package/esm/browser/assistant/assistant-task-source.js +5 -10
  11. package/esm/browser/assistant/assistant-task-util.d.ts +13 -3
  12. package/esm/browser/assistant/assistant-task-util.js +59 -12
  13. package/esm/browser/assistant/assistant-view.js +48 -24
  14. package/esm/browser/assistant/assistant.d.ts +18 -4
  15. package/esm/browser/assistant/assistant.js +52 -17
  16. package/esm/browser/avatar/dino-face.js +1 -2
  17. package/esm/browser/chat/chat-protocol.d.ts +5 -0
  18. package/esm/browser/chat/chat-stores.d.ts +8 -5
  19. package/esm/browser/chat/chat-stores.js +17 -9
  20. package/esm/browser/chat/chat-view.js +23 -15
  21. package/esm/browser/chat/chat.d.ts +16 -8
  22. package/esm/browser/chat/chat.js +86 -51
  23. package/esm/browser/components/account-menu.d.ts +0 -2
  24. package/esm/browser/components/account-menu.js +1 -27
  25. package/esm/browser/components/agent-settings-view.d.ts +3 -2
  26. package/esm/browser/components/agent-settings-view.js +2 -1
  27. package/esm/browser/components/app-nav.d.ts +5 -2
  28. package/esm/browser/components/app-nav.js +22 -9
  29. package/esm/browser/components/app-shell-hooks.js +5 -3
  30. package/esm/browser/components/app-view.js +84 -20
  31. package/esm/browser/components/busy.d.ts +25 -0
  32. package/esm/browser/components/busy.js +52 -0
  33. package/esm/browser/components/chat-icon.d.ts +29 -0
  34. package/esm/browser/components/chat-icon.js +78 -0
  35. package/esm/browser/components/chat-list.d.ts +73 -6
  36. package/esm/browser/components/chat-list.js +295 -60
  37. package/esm/browser/components/chat-seen.d.ts +53 -0
  38. package/esm/browser/components/chat-seen.js +101 -0
  39. package/esm/browser/components/composer-box.d.ts +15 -4
  40. package/esm/browser/components/composer-box.js +139 -77
  41. package/esm/browser/components/composer.d.ts +9 -6
  42. package/esm/browser/components/composer.js +32 -4
  43. package/esm/browser/components/conversation-scroll-hooks.d.ts +16 -0
  44. package/esm/browser/components/conversation-scroll-hooks.js +98 -0
  45. package/esm/browser/components/conversation-scroll-util.d.ts +30 -0
  46. package/esm/browser/components/conversation-scroll-util.js +56 -0
  47. package/esm/browser/components/conversation-scroll.d.ts +52 -31
  48. package/esm/browser/components/conversation-scroll.js +170 -129
  49. package/esm/browser/components/custom-host.d.ts +3 -0
  50. package/esm/browser/components/custom-host.js +14 -0
  51. package/esm/browser/components/directory-commands.d.ts +6 -0
  52. package/esm/browser/components/directory-commands.js +34 -0
  53. package/esm/browser/components/discover-view.d.ts +11 -4
  54. package/esm/browser/components/discover-view.js +20 -11
  55. package/esm/browser/components/dismiss.d.ts +3 -0
  56. package/esm/browser/components/dismiss.js +29 -0
  57. package/esm/browser/components/earlier-messages.d.ts +34 -3
  58. package/esm/browser/components/earlier-messages.js +42 -8
  59. package/esm/browser/components/editor-area.d.ts +6 -22
  60. package/esm/browser/components/editor-area.js +10 -97
  61. package/esm/browser/components/face.d.ts +24 -0
  62. package/esm/browser/components/face.js +42 -0
  63. package/esm/browser/components/fold-text.d.ts +20 -0
  64. package/esm/browser/components/fold-text.js +66 -0
  65. package/esm/browser/components/folder-picker.d.ts +1 -1
  66. package/esm/browser/components/folder-picker.js +1 -1
  67. package/esm/browser/components/full-screen.d.ts +9 -0
  68. package/esm/browser/components/full-screen.js +26 -0
  69. package/esm/browser/components/grow-box.d.ts +9 -0
  70. package/esm/browser/components/grow-box.js +50 -0
  71. package/esm/browser/components/hold-to-talk.d.ts +22 -0
  72. package/esm/browser/components/hold-to-talk.js +29 -0
  73. package/esm/browser/components/host-view.d.ts +1 -1
  74. package/esm/browser/components/icon.d.ts +3 -1
  75. package/esm/browser/components/icon.js +4 -3
  76. package/esm/browser/components/image-viewer.d.ts +10 -2
  77. package/esm/browser/components/image-viewer.js +48 -11
  78. package/esm/browser/components/launcher-search-util.d.ts +4 -3
  79. package/esm/browser/components/launcher-search-util.js +12 -4
  80. package/esm/browser/components/lightbox.d.ts +5 -2
  81. package/esm/browser/components/lightbox.js +4 -3
  82. package/esm/browser/components/list-rows.d.ts +9 -1
  83. package/esm/browser/components/list-rows.js +17 -3
  84. package/esm/browser/components/markdown.js +36 -4
  85. package/esm/browser/components/media.js +73 -7
  86. package/esm/browser/components/message-actions.js +3 -0
  87. package/esm/browser/components/message-footer.d.ts +8 -0
  88. package/esm/browser/components/message-footer.js +20 -3
  89. package/esm/browser/components/message-list.d.ts +60 -7
  90. package/esm/browser/components/message-list.js +206 -58
  91. package/esm/browser/components/message-menu.js +6 -1
  92. package/esm/browser/components/model-picker.js +1 -0
  93. package/esm/browser/components/nav-places.d.ts +21 -2
  94. package/esm/browser/components/nav-places.js +20 -4
  95. package/esm/browser/components/notice-center.js +34 -0
  96. package/esm/browser/components/notice-face.d.ts +10 -0
  97. package/esm/browser/components/notice-face.js +28 -0
  98. package/esm/browser/components/phone-shell.d.ts +23 -1
  99. package/esm/browser/components/phone-shell.js +98 -9
  100. package/esm/browser/components/picture.d.ts +8 -1
  101. package/esm/browser/components/picture.js +12 -1
  102. package/esm/browser/components/plus-menu.d.ts +23 -0
  103. package/esm/browser/components/plus-menu.js +90 -0
  104. package/esm/browser/components/recent-shot.d.ts +15 -0
  105. package/esm/browser/components/recent-shot.js +174 -0
  106. package/esm/browser/components/relay-view.js +10 -3
  107. package/esm/browser/components/run-status.d.ts +1 -1
  108. package/esm/browser/components/run-status.js +17 -29
  109. package/esm/browser/components/said-text.d.ts +6 -0
  110. package/esm/browser/components/said-text.js +14 -0
  111. package/esm/browser/components/scan-screen.d.ts +10 -0
  112. package/esm/browser/components/scan-screen.js +230 -0
  113. package/esm/browser/components/search-page.js +10 -6
  114. package/esm/browser/components/session-settings.d.ts +2 -3
  115. package/esm/browser/components/session-settings.js +1 -0
  116. package/esm/browser/components/session-view.d.ts +3 -1
  117. package/esm/browser/components/session-view.js +35 -21
  118. package/esm/browser/components/settings-choices.d.ts +1 -0
  119. package/esm/browser/components/settings-choices.js +3 -2
  120. package/esm/browser/components/settings-controls.d.ts +5 -3
  121. package/esm/browser/components/settings-controls.js +10 -1
  122. package/esm/browser/components/settings-parts.js +45 -14
  123. package/esm/browser/components/stop-times.d.ts +47 -0
  124. package/esm/browser/components/stop-times.js +81 -0
  125. package/esm/browser/components/tool-view.js +7 -2
  126. package/esm/browser/components/unseen-drop.d.ts +39 -0
  127. package/esm/browser/components/unseen-drop.js +219 -0
  128. package/esm/browser/components/use-seen-chats.d.ts +8 -0
  129. package/esm/browser/components/use-seen-chats.js +49 -0
  130. package/esm/browser/components/use-stop-times.d.ts +3 -0
  131. package/esm/browser/components/use-stop-times.js +17 -0
  132. package/esm/browser/components/voice-button.d.ts +7 -1
  133. package/esm/browser/components/voice-button.js +15 -2
  134. package/esm/browser/components/voice-picker.d.ts +6 -0
  135. package/esm/browser/components/voice-picker.js +53 -0
  136. package/esm/browser/components/voice-talk.d.ts +11 -3
  137. package/esm/browser/components/voice-talk.js +24 -4
  138. package/esm/browser/components/web-composer.d.ts +4 -2
  139. package/esm/browser/components/web-composer.js +8 -4
  140. package/esm/browser/components/workbench-tabs.d.ts +41 -0
  141. package/esm/browser/components/workbench-tabs.js +193 -0
  142. package/esm/browser/components/workbench-toggle.d.ts +0 -13
  143. package/esm/browser/components/workbench-toggle.js +1 -28
  144. package/esm/browser/device/code-scan.d.ts +55 -0
  145. package/esm/browser/device/code-scan.js +137 -0
  146. package/esm/browser/device/code-vision.d.ts +51 -0
  147. package/esm/browser/device/code-vision.js +100 -0
  148. package/esm/browser/device/hold.js +4 -6
  149. package/esm/browser/device/long-press.d.ts +10 -0
  150. package/esm/browser/device/long-press.js +28 -12
  151. package/esm/browser/device/own-gestures.d.ts +25 -0
  152. package/esm/browser/device/own-gestures.js +39 -0
  153. package/esm/browser/device/photo-picker.d.ts +14 -0
  154. package/esm/browser/device/photo-picker.js +48 -0
  155. package/esm/browser/device/pull-down.js +3 -2
  156. package/esm/browser/device/recent-shots.d.ts +45 -0
  157. package/esm/browser/device/recent-shots.js +142 -0
  158. package/esm/browser/device/row-swipe.d.ts +2 -0
  159. package/esm/browser/device/row-swipe.js +14 -3
  160. package/esm/browser/device/sheet-swipe.d.ts +1 -1
  161. package/esm/browser/device/sheet-swipe.js +25 -4
  162. package/esm/browser/extension/extension-view.d.ts +10 -0
  163. package/esm/browser/extension/extension-view.js +6 -0
  164. package/esm/browser/extension/icons.js +16 -2
  165. package/esm/browser/extension/web-api-components.d.ts +287 -0
  166. package/esm/browser/extension/web-api-components.js +2 -0
  167. package/esm/browser/extension/web-api-contributions.d.ts +394 -0
  168. package/esm/browser/extension/web-api-contributions.js +2 -0
  169. package/esm/browser/extension/web-api-desktop.d.ts +55 -0
  170. package/esm/browser/extension/web-api-desktop.js +2 -0
  171. package/esm/browser/extension/web-api-terminal.d.ts +71 -0
  172. package/esm/browser/extension/web-api-terminal.js +2 -0
  173. package/esm/browser/extension/web-editor-tabs.d.ts +42 -0
  174. package/esm/browser/extension/web-editor-tabs.js +137 -0
  175. package/esm/browser/extension/web-extension-api.d.ts +186 -565
  176. package/esm/browser/extension/web-extension-context.d.ts +78 -0
  177. package/esm/browser/extension/web-extension-context.js +354 -0
  178. package/esm/browser/extension/web-extension-protocol.d.ts +57 -7
  179. package/esm/browser/extension/web-extension-protocol.js +34 -0
  180. package/esm/browser/extension/web-extension-run.d.ts +54 -0
  181. package/esm/browser/extension/web-extension-run.js +120 -0
  182. package/esm/browser/extension/web-extensions.d.ts +29 -69
  183. package/esm/browser/extension/web-extensions.js +121 -516
  184. package/esm/browser/extension/web-home.d.ts +19 -0
  185. package/esm/browser/extension/web-home.js +72 -0
  186. package/esm/browser/extension/web-pages.d.ts +13 -3
  187. package/esm/browser/extension/web-pages.js +23 -3
  188. package/esm/browser/extension/web-session-notices.d.ts +36 -0
  189. package/esm/browser/extension/web-session-notices.js +174 -0
  190. package/esm/browser/extension/web-sharing.d.ts +2 -0
  191. package/esm/browser/extension/web-sharing.js +4 -0
  192. package/esm/browser/game/game-host.d.ts +27 -0
  193. package/esm/browser/game/game-host.js +127 -0
  194. package/esm/browser/game/game-loader.d.ts +10 -0
  195. package/esm/browser/game/game-loader.js +28 -0
  196. package/esm/browser/game/game-protocol.d.ts +49 -0
  197. package/esm/browser/game/game-protocol.js +2 -0
  198. package/esm/browser/game/game-runner.d.ts +27 -0
  199. package/esm/browser/game/game-runner.js +60 -0
  200. package/esm/browser/game/game-util.d.ts +29 -0
  201. package/esm/browser/game/game-util.js +180 -0
  202. package/esm/browser/game/game-view.d.ts +12 -0
  203. package/esm/browser/game/game-view.js +31 -0
  204. package/esm/browser/game/game3d-protocol.d.ts +51 -0
  205. package/esm/browser/game/game3d-protocol.js +2 -0
  206. package/esm/browser/game/game3d-runner.d.ts +27 -0
  207. package/esm/browser/game/game3d-runner.js +149 -0
  208. package/esm/browser/hooks.d.ts +5 -1
  209. package/esm/browser/hooks.js +13 -2
  210. package/esm/browser/i18n/locales.d.ts +92 -2
  211. package/esm/browser/i18n/messages.d.ts +91 -1
  212. package/esm/browser/i18n/messages.js +187 -7
  213. package/esm/browser/index.d.ts +9 -0
  214. package/esm/browser/index.js +9 -0
  215. package/esm/browser/links/links-protocol.d.ts +7 -0
  216. package/esm/browser/links/links.d.ts +24 -7
  217. package/esm/browser/links/links.js +64 -11
  218. package/esm/browser/markdown/code-renderers.d.ts +4 -0
  219. package/esm/browser/markdown/code-renderers.js +4 -0
  220. package/esm/browser/notices/notices-protocol.d.ts +17 -0
  221. package/esm/browser/notices/notices.d.ts +1 -1
  222. package/esm/browser/notices/notices.js +6 -2
  223. package/esm/browser/notices/session-notices.d.ts +69 -0
  224. package/esm/browser/notices/session-notices.js +92 -0
  225. package/esm/browser/offline/device-values.js +12 -3
  226. package/esm/browser/offline/offline-reads.js +3 -1
  227. package/esm/browser/settings/navigation.d.ts +3 -2
  228. package/esm/browser/settings/navigation.js +4 -3
  229. package/esm/browser/settings/settings-protocol.d.ts +15 -0
  230. package/esm/browser/settings/settings-protocol.js +18 -4
  231. package/esm/browser/state/state-protocol.d.ts +8 -1
  232. package/esm/browser/state/state.d.ts +2 -0
  233. package/esm/browser/state/state.js +21 -2
  234. package/esm/browser/style/base.d.ts +1 -1
  235. package/esm/browser/style/base.js +27 -1
  236. package/esm/browser/style/conversation.d.ts +1 -1
  237. package/esm/browser/style/conversation.js +45 -5
  238. package/esm/browser/style/device.js +15 -1
  239. package/esm/browser/style/layout.d.ts +1 -1
  240. package/esm/browser/style/layout.js +192 -56
  241. package/esm/browser/style/pages.d.ts +1 -1
  242. package/esm/browser/style/pages.js +39 -1
  243. package/esm/browser/style/phone.d.ts +1 -1
  244. package/esm/browser/style/phone.js +15 -0
  245. package/esm/browser/style/shell.d.ts +1 -1
  246. package/esm/browser/style/shell.js +32 -6
  247. package/esm/browser/style/surfaces.d.ts +1 -1
  248. package/esm/browser/style/surfaces.js +21 -2
  249. package/esm/browser/style/tints.d.ts +27 -0
  250. package/esm/browser/style/tints.js +56 -0
  251. package/esm/browser/style.js +13 -1
  252. package/esm/browser/util/composer.d.ts +6 -0
  253. package/esm/browser/util/composer.js +16 -0
  254. package/esm/browser/util/desktop.d.ts +19 -1
  255. package/esm/browser/util/desktop.js +15 -0
  256. package/esm/browser/util/frame.d.ts +2 -0
  257. package/esm/browser/util/frame.js +2 -0
  258. package/esm/browser/util/link.d.ts +18 -0
  259. package/esm/browser/util/link.js +66 -1
  260. package/esm/browser/util/markdown.d.ts +4 -1
  261. package/esm/browser/util/markdown.js +1 -1
  262. package/esm/browser/util/message.d.ts +5 -0
  263. package/esm/browser/util/message.js +30 -0
  264. package/esm/browser/util/process.d.ts +57 -3
  265. package/esm/browser/util/process.js +123 -11
  266. package/esm/browser/util/progress.d.ts +19 -1
  267. package/esm/browser/util/progress.js +57 -4
  268. package/esm/browser/util/quote.d.ts +19 -0
  269. package/esm/browser/util/quote.js +58 -0
  270. package/esm/browser/util/tool.d.ts +19 -2
  271. package/esm/browser/util/tool.js +70 -2
  272. package/esm/browser/util/voice.d.ts +47 -7
  273. package/esm/browser/util/voice.js +269 -27
  274. package/esm/browser/workbench-calls.d.ts +6 -4
  275. package/esm/browser/workbench-calls.js +15 -10
  276. package/esm/browser/workbench-protocol.d.ts +31 -2
  277. package/esm/browser/workbench-util.d.ts +15 -4
  278. package/esm/browser/workbench-util.js +28 -5
  279. package/esm/browser/workbench.d.ts +33 -1
  280. package/esm/browser/workbench.js +142 -14
  281. package/lib/browser/assistant/assistant-chat-list.d.ts +11 -0
  282. package/lib/browser/assistant/assistant-chat-list.js +13 -0
  283. package/lib/browser/assistant/assistant-extension.js +5 -0
  284. package/lib/browser/assistant/assistant-protocol.d.ts +2 -1
  285. package/lib/browser/assistant/assistant-task-book.d.ts +12 -2
  286. package/lib/browser/assistant/assistant-task-book.js +23 -4
  287. package/lib/browser/assistant/assistant-task-source.d.ts +1 -1
  288. package/lib/browser/assistant/assistant-task-source.js +5 -10
  289. package/lib/browser/assistant/assistant-task-util.d.ts +13 -3
  290. package/lib/browser/assistant/assistant-task-util.js +59 -12
  291. package/lib/browser/assistant/assistant-view.js +46 -22
  292. package/lib/browser/assistant/assistant.d.ts +18 -4
  293. package/lib/browser/assistant/assistant.js +52 -17
  294. package/lib/browser/avatar/dino-face.js +1 -2
  295. package/lib/browser/chat/chat-protocol.d.ts +5 -0
  296. package/lib/browser/chat/chat-stores.d.ts +8 -5
  297. package/lib/browser/chat/chat-stores.js +17 -9
  298. package/lib/browser/chat/chat-view.js +22 -14
  299. package/lib/browser/chat/chat.d.ts +16 -8
  300. package/lib/browser/chat/chat.js +86 -51
  301. package/lib/browser/components/account-menu.d.ts +0 -2
  302. package/lib/browser/components/account-menu.js +2 -29
  303. package/lib/browser/components/agent-settings-view.d.ts +3 -2
  304. package/lib/browser/components/agent-settings-view.js +2 -1
  305. package/lib/browser/components/app-nav.d.ts +5 -2
  306. package/lib/browser/components/app-nav.js +18 -5
  307. package/lib/browser/components/app-shell-hooks.js +5 -3
  308. package/lib/browser/components/app-view.js +80 -16
  309. package/lib/browser/components/busy.d.ts +26 -0
  310. package/lib/browser/components/busy.js +91 -0
  311. package/lib/browser/components/chat-icon.d.ts +30 -0
  312. package/lib/browser/components/chat-icon.js +117 -0
  313. package/lib/browser/components/chat-list.d.ts +73 -6
  314. package/lib/browser/components/chat-list.js +295 -59
  315. package/lib/browser/components/chat-seen.d.ts +54 -0
  316. package/lib/browser/components/chat-seen.js +104 -0
  317. package/lib/browser/components/composer-box.d.ts +15 -4
  318. package/lib/browser/components/composer-box.js +136 -74
  319. package/lib/browser/components/composer.d.ts +9 -6
  320. package/lib/browser/components/composer.js +31 -3
  321. package/lib/browser/components/conversation-scroll-hooks.d.ts +17 -0
  322. package/lib/browser/components/conversation-scroll-hooks.js +135 -0
  323. package/lib/browser/components/conversation-scroll-util.d.ts +31 -0
  324. package/lib/browser/components/conversation-scroll-util.js +60 -0
  325. package/lib/browser/components/conversation-scroll.d.ts +52 -31
  326. package/lib/browser/components/conversation-scroll.js +171 -164
  327. package/lib/browser/components/custom-host.d.ts +4 -0
  328. package/lib/browser/components/custom-host.js +50 -0
  329. package/lib/browser/components/directory-commands.d.ts +7 -0
  330. package/lib/browser/components/directory-commands.js +70 -0
  331. package/lib/browser/components/discover-view.d.ts +11 -4
  332. package/lib/browser/components/discover-view.js +19 -10
  333. package/lib/browser/components/dismiss.d.ts +4 -0
  334. package/lib/browser/components/dismiss.js +65 -0
  335. package/lib/browser/components/earlier-messages.d.ts +34 -3
  336. package/lib/browser/components/earlier-messages.js +44 -9
  337. package/lib/browser/components/editor-area.d.ts +6 -22
  338. package/lib/browser/components/editor-area.js +11 -98
  339. package/lib/browser/components/face.d.ts +25 -0
  340. package/lib/browser/components/face.js +79 -0
  341. package/lib/browser/components/fold-text.d.ts +21 -0
  342. package/lib/browser/components/fold-text.js +103 -0
  343. package/lib/browser/components/folder-picker.d.ts +1 -1
  344. package/lib/browser/components/folder-picker.js +1 -1
  345. package/lib/browser/components/full-screen.d.ts +10 -0
  346. package/lib/browser/components/full-screen.js +62 -0
  347. package/lib/browser/components/grow-box.d.ts +10 -0
  348. package/lib/browser/components/grow-box.js +86 -0
  349. package/lib/browser/components/hold-to-talk.d.ts +23 -0
  350. package/lib/browser/components/hold-to-talk.js +65 -0
  351. package/lib/browser/components/host-view.d.ts +1 -1
  352. package/lib/browser/components/icon.d.ts +3 -1
  353. package/lib/browser/components/icon.js +4 -3
  354. package/lib/browser/components/image-viewer.d.ts +10 -2
  355. package/lib/browser/components/image-viewer.js +47 -10
  356. package/lib/browser/components/launcher-search-util.d.ts +4 -3
  357. package/lib/browser/components/launcher-search-util.js +12 -4
  358. package/lib/browser/components/lightbox.d.ts +5 -2
  359. package/lib/browser/components/lightbox.js +4 -3
  360. package/lib/browser/components/list-rows.d.ts +9 -1
  361. package/lib/browser/components/list-rows.js +18 -3
  362. package/lib/browser/components/markdown.js +36 -4
  363. package/lib/browser/components/media.js +73 -7
  364. package/lib/browser/components/message-actions.js +3 -0
  365. package/lib/browser/components/message-footer.d.ts +8 -0
  366. package/lib/browser/components/message-footer.js +20 -2
  367. package/lib/browser/components/message-list.d.ts +60 -7
  368. package/lib/browser/components/message-list.js +206 -55
  369. package/lib/browser/components/message-menu.js +6 -1
  370. package/lib/browser/components/model-picker.js +1 -0
  371. package/lib/browser/components/nav-places.d.ts +21 -2
  372. package/lib/browser/components/nav-places.js +22 -4
  373. package/lib/browser/components/notice-center.js +34 -0
  374. package/lib/browser/components/notice-face.d.ts +11 -0
  375. package/lib/browser/components/notice-face.js +64 -0
  376. package/lib/browser/components/phone-shell.d.ts +23 -1
  377. package/lib/browser/components/phone-shell.js +99 -10
  378. package/lib/browser/components/picture.d.ts +8 -1
  379. package/lib/browser/components/picture.js +13 -1
  380. package/lib/browser/components/plus-menu.d.ts +24 -0
  381. package/lib/browser/components/plus-menu.js +126 -0
  382. package/lib/browser/components/recent-shot.d.ts +16 -0
  383. package/lib/browser/components/recent-shot.js +210 -0
  384. package/lib/browser/components/relay-view.js +10 -3
  385. package/lib/browser/components/run-status.d.ts +1 -1
  386. package/lib/browser/components/run-status.js +17 -29
  387. package/lib/browser/components/said-text.d.ts +7 -0
  388. package/lib/browser/components/said-text.js +50 -0
  389. package/lib/browser/components/scan-screen.d.ts +11 -0
  390. package/lib/browser/components/scan-screen.js +266 -0
  391. package/lib/browser/components/search-page.js +10 -6
  392. package/lib/browser/components/session-settings.d.ts +2 -3
  393. package/lib/browser/components/session-settings.js +1 -0
  394. package/lib/browser/components/session-view.d.ts +3 -1
  395. package/lib/browser/components/session-view.js +32 -18
  396. package/lib/browser/components/settings-choices.d.ts +1 -0
  397. package/lib/browser/components/settings-choices.js +2 -1
  398. package/lib/browser/components/settings-controls.d.ts +5 -3
  399. package/lib/browser/components/settings-controls.js +10 -1
  400. package/lib/browser/components/settings-parts.js +43 -12
  401. package/lib/browser/components/stop-times.d.ts +48 -0
  402. package/lib/browser/components/stop-times.js +85 -0
  403. package/lib/browser/components/tool-view.js +7 -2
  404. package/lib/browser/components/unseen-drop.d.ts +40 -0
  405. package/lib/browser/components/unseen-drop.js +256 -0
  406. package/lib/browser/components/use-seen-chats.d.ts +9 -0
  407. package/lib/browser/components/use-seen-chats.js +85 -0
  408. package/lib/browser/components/use-stop-times.d.ts +4 -0
  409. package/lib/browser/components/use-stop-times.js +53 -0
  410. package/lib/browser/components/voice-button.d.ts +7 -1
  411. package/lib/browser/components/voice-button.js +16 -2
  412. package/lib/browser/components/voice-picker.d.ts +7 -0
  413. package/lib/browser/components/voice-picker.js +89 -0
  414. package/lib/browser/components/voice-talk.d.ts +11 -3
  415. package/lib/browser/components/voice-talk.js +25 -4
  416. package/lib/browser/components/web-composer.d.ts +4 -2
  417. package/lib/browser/components/web-composer.js +7 -3
  418. package/lib/browser/components/workbench-tabs.d.ts +42 -0
  419. package/lib/browser/components/workbench-tabs.js +232 -0
  420. package/lib/browser/components/workbench-toggle.d.ts +0 -13
  421. package/lib/browser/components/workbench-toggle.js +1 -29
  422. package/lib/browser/device/code-scan.d.ts +56 -0
  423. package/lib/browser/device/code-scan.js +141 -0
  424. package/lib/browser/device/code-vision.d.ts +52 -0
  425. package/lib/browser/device/code-vision.js +103 -0
  426. package/lib/browser/device/hold.js +4 -6
  427. package/lib/browser/device/long-press.d.ts +10 -0
  428. package/lib/browser/device/long-press.js +28 -12
  429. package/lib/browser/device/own-gestures.d.ts +26 -0
  430. package/lib/browser/device/own-gestures.js +42 -0
  431. package/lib/browser/device/photo-picker.d.ts +15 -0
  432. package/lib/browser/device/photo-picker.js +51 -0
  433. package/lib/browser/device/pull-down.js +3 -2
  434. package/lib/browser/device/recent-shots.d.ts +46 -0
  435. package/lib/browser/device/recent-shots.js +145 -0
  436. package/lib/browser/device/row-swipe.d.ts +2 -0
  437. package/lib/browser/device/row-swipe.js +14 -3
  438. package/lib/browser/device/sheet-swipe.d.ts +1 -1
  439. package/lib/browser/device/sheet-swipe.js +25 -4
  440. package/lib/browser/extension/extension-view.d.ts +10 -0
  441. package/lib/browser/extension/extension-view.js +7 -1
  442. package/lib/browser/extension/icons.js +15 -1
  443. package/lib/browser/extension/web-api-components.d.ts +288 -0
  444. package/lib/browser/extension/web-api-components.js +3 -0
  445. package/lib/browser/extension/web-api-contributions.d.ts +395 -0
  446. package/lib/browser/extension/web-api-contributions.js +3 -0
  447. package/lib/browser/extension/web-api-desktop.d.ts +56 -0
  448. package/lib/browser/extension/web-api-desktop.js +3 -0
  449. package/lib/browser/extension/web-api-terminal.d.ts +72 -0
  450. package/lib/browser/extension/web-api-terminal.js +3 -0
  451. package/lib/browser/extension/web-editor-tabs.d.ts +43 -0
  452. package/lib/browser/extension/web-editor-tabs.js +141 -0
  453. package/lib/browser/extension/web-extension-api.d.ts +186 -565
  454. package/lib/browser/extension/web-extension-context.d.ts +79 -0
  455. package/lib/browser/extension/web-extension-context.js +391 -0
  456. package/lib/browser/extension/web-extension-protocol.d.ts +57 -7
  457. package/lib/browser/extension/web-extension-protocol.js +35 -1
  458. package/lib/browser/extension/web-extension-run.d.ts +55 -0
  459. package/lib/browser/extension/web-extension-run.js +123 -0
  460. package/lib/browser/extension/web-extensions.d.ts +29 -69
  461. package/lib/browser/extension/web-extensions.js +117 -545
  462. package/lib/browser/extension/web-home.d.ts +20 -0
  463. package/lib/browser/extension/web-home.js +76 -0
  464. package/lib/browser/extension/web-pages.d.ts +13 -3
  465. package/lib/browser/extension/web-pages.js +23 -3
  466. package/lib/browser/extension/web-session-notices.d.ts +37 -0
  467. package/lib/browser/extension/web-session-notices.js +177 -0
  468. package/lib/browser/extension/web-sharing.d.ts +2 -0
  469. package/lib/browser/extension/web-sharing.js +4 -0
  470. package/lib/browser/game/game-host.d.ts +28 -0
  471. package/lib/browser/game/game-host.js +163 -0
  472. package/lib/browser/game/game-loader.d.ts +11 -0
  473. package/lib/browser/game/game-loader.js +31 -0
  474. package/lib/browser/game/game-protocol.d.ts +50 -0
  475. package/lib/browser/game/game-protocol.js +3 -0
  476. package/lib/browser/game/game-runner.d.ts +28 -0
  477. package/lib/browser/game/game-runner.js +64 -0
  478. package/lib/browser/game/game-util.d.ts +30 -0
  479. package/lib/browser/game/game-util.js +183 -0
  480. package/lib/browser/game/game-view.d.ts +13 -0
  481. package/lib/browser/game/game-view.js +68 -0
  482. package/lib/browser/game/game3d-protocol.d.ts +52 -0
  483. package/lib/browser/game/game3d-protocol.js +3 -0
  484. package/lib/browser/game/game3d-runner.d.ts +28 -0
  485. package/lib/browser/game/game3d-runner.js +153 -0
  486. package/lib/browser/hooks.d.ts +5 -1
  487. package/lib/browser/hooks.js +14 -2
  488. package/lib/browser/i18n/locales.d.ts +92 -2
  489. package/lib/browser/i18n/messages.d.ts +91 -1
  490. package/lib/browser/i18n/messages.js +187 -7
  491. package/lib/browser/index.d.ts +9 -0
  492. package/lib/browser/index.js +9 -0
  493. package/lib/browser/links/links-protocol.d.ts +7 -0
  494. package/lib/browser/links/links.d.ts +24 -7
  495. package/lib/browser/links/links.js +64 -11
  496. package/lib/browser/markdown/code-renderers.d.ts +5 -0
  497. package/lib/browser/markdown/code-renderers.js +40 -0
  498. package/lib/browser/notices/notices-protocol.d.ts +17 -0
  499. package/lib/browser/notices/notices.d.ts +1 -1
  500. package/lib/browser/notices/notices.js +6 -2
  501. package/lib/browser/notices/session-notices.d.ts +70 -0
  502. package/lib/browser/notices/session-notices.js +96 -0
  503. package/lib/browser/offline/device-values.js +12 -3
  504. package/lib/browser/offline/offline-reads.js +3 -1
  505. package/lib/browser/settings/navigation.d.ts +3 -2
  506. package/lib/browser/settings/navigation.js +4 -3
  507. package/lib/browser/settings/settings-protocol.d.ts +15 -0
  508. package/lib/browser/settings/settings-protocol.js +19 -5
  509. package/lib/browser/state/state-protocol.d.ts +8 -1
  510. package/lib/browser/state/state.d.ts +2 -0
  511. package/lib/browser/state/state.js +21 -2
  512. package/lib/browser/style/base.d.ts +1 -1
  513. package/lib/browser/style/base.js +27 -1
  514. package/lib/browser/style/conversation.d.ts +1 -1
  515. package/lib/browser/style/conversation.js +45 -5
  516. package/lib/browser/style/device.js +15 -1
  517. package/lib/browser/style/layout.d.ts +1 -1
  518. package/lib/browser/style/layout.js +192 -56
  519. package/lib/browser/style/pages.d.ts +1 -1
  520. package/lib/browser/style/pages.js +39 -1
  521. package/lib/browser/style/phone.d.ts +1 -1
  522. package/lib/browser/style/phone.js +15 -0
  523. package/lib/browser/style/shell.d.ts +1 -1
  524. package/lib/browser/style/shell.js +32 -6
  525. package/lib/browser/style/surfaces.d.ts +1 -1
  526. package/lib/browser/style/surfaces.js +21 -2
  527. package/lib/browser/style/tints.d.ts +28 -0
  528. package/lib/browser/style/tints.js +59 -0
  529. package/lib/browser/style.js +13 -1
  530. package/lib/browser/util/composer.d.ts +6 -0
  531. package/lib/browser/util/composer.js +16 -0
  532. package/lib/browser/util/desktop.d.ts +19 -1
  533. package/lib/browser/util/desktop.js +15 -0
  534. package/lib/browser/util/frame.d.ts +2 -0
  535. package/lib/browser/util/frame.js +2 -0
  536. package/lib/browser/util/link.d.ts +18 -0
  537. package/lib/browser/util/link.js +66 -1
  538. package/lib/browser/util/markdown.d.ts +4 -1
  539. package/lib/browser/util/markdown.js +1 -1
  540. package/lib/browser/util/message.d.ts +5 -0
  541. package/lib/browser/util/message.js +30 -0
  542. package/lib/browser/util/process.d.ts +57 -3
  543. package/lib/browser/util/process.js +125 -12
  544. package/lib/browser/util/progress.d.ts +19 -1
  545. package/lib/browser/util/progress.js +57 -4
  546. package/lib/browser/util/quote.d.ts +20 -0
  547. package/lib/browser/util/quote.js +61 -0
  548. package/lib/browser/util/tool.d.ts +19 -2
  549. package/lib/browser/util/tool.js +70 -2
  550. package/lib/browser/util/voice.d.ts +47 -7
  551. package/lib/browser/util/voice.js +269 -27
  552. package/lib/browser/workbench-calls.d.ts +6 -4
  553. package/lib/browser/workbench-calls.js +15 -10
  554. package/lib/browser/workbench-protocol.d.ts +31 -2
  555. package/lib/browser/workbench-util.d.ts +15 -4
  556. package/lib/browser/workbench-util.js +28 -5
  557. package/lib/browser/workbench.d.ts +33 -1
  558. package/lib/browser/workbench.js +140 -12
  559. package/package.json +11 -8
package/README.en.md CHANGED
@@ -16,14 +16,14 @@ The Web client can be installed as an application on desktop or mobile: use the
16
16
 
17
17
  ## Interface
18
18
 
19
- The main layout is IDE-style: the navigation bar on the far left, in the order of a phone's bottom tabs: under the logo the lists of the sidebar (web extension sidebar views such as the agents, then the conversations), a divider, then pages for web extensions and Discover, and the account menu at the bottom; picking a list shows it in the sidebar, picking it again hides the sidebar (Mod+B also toggles it; the Workbench button at the bottom of the rail and Mod+J show or hide the workbench on the right from any page, its head saying the directory its tools are in). The sidebar next to it (resizable and collapsible; the current list's search box and + button at the top) containing all open sessions on the server (which can be created, created in a specified directory, or closed; grouped by directory by default, each group folding with a + of its own for a new chat there, a button in the search box switching to a list by time, which a search always shows), the current conversation in the middle, and a collapsible panel on the right for web extension cards. On narrow screens, the navigation bar and conversation list become drawers, and the panel floats above the conversation. Holding the double or the conversations in the navigation (their tabs on a phone) opens no menu: it talks, as a held message box does (below). Held, the double opens and its box listens, and what was said goes to it as the finger lets go (its answer only shows, unless "Read the answer to what I say by voice" is on, in the Voice settings or the + of the double's box); held, the conversations open a new conversation whose box listens, and letting go starts it with what was said (`HeldTalk`, `components/held-talk.ts`). Where the browser cannot recognize speech, both are a plain tap.
19
+ The main layout is IDE-style: the navigation bar on the far left, in the order of a phone's bottom tabs: under the logo the lists of the sidebar (web extension sidebar views such as the agents, then the conversations), a divider, then pages for web extensions and Discover, and the account menu at the bottom; picking a list shows it in the sidebar, picking it again hides the sidebar (Mod+B also toggles it; the Workbench button at the bottom of the rail and Mod+J show or hide the workbench on the right from any page, its head saying the directory its tools are in). The sidebar next to it (resizable and collapsible; the current list's search box and + button at the top) containing all open sessions on the server (which can be created, created in a specified directory, or closed; grouped by directory by default, each group folding with a + of its own for a new chat there, a button in the search box switching to a list by time, which a search always shows), the current conversation in the middle, and a collapsible panel on the right for web extension cards. On narrow screens, the navigation bar and conversation list become drawers, and the panel floats above the conversation. Holding the double or the conversations in the navigation (their tabs on a phone) opens no menu: it talks, as the "hold to talk" bar of a message box does (below). Held, the double opens and its box listens, and what was said goes to it as the finger lets go (its answer only shows, unless "Read the answer to what I say by voice" is on, in the Voice settings or the + of the double's box); held, the conversations open a new conversation whose box listens, and letting go starts it with what was said (`HeldTalk`, `components/held-talk.ts`). Where the browser cannot recognize speech, both are a plain tap.
20
20
 
21
21
  Initially, the interface shows only conversations. You tell Ta what you want this page to do and display, and Ta builds it as a pi package—cards beside the conversation, a standalone page, or a new Ta command—which appears on the page immediately.
22
22
 
23
23
  Everything new in the interface comes from **web extensions** within packages, using the same mechanism and terminology as pi extensions:
24
24
 
25
25
  - **Packages** are pi packages. In the `pi` field of `package.json`, `extensions` are extensions for Ta (terminal and server), and `web` are extensions for this page; when not declared, modules in the `web/` directory are used. Packages can be placed in `~/.ta/agent/extensions/<name>/` or the project's `.ta/extensions/` to take effect, or installed with `ta install`.
26
- - **Web extensions** are ES modules without import statements, with a default export of a function that the page calls with `pi`; the returned function is called on unload. The `pi` interface follows pi's ExtensionAPI naming: `ui.setWidget` (default above the input box, same as pi; `placement: 'panel'` puts it in the right workbench's card tabs), `registerView` (pages in the navigation bar, or a list of the sidebar at the top of the navigation bar; `location: 'panel'` is a tool in the right workbench; `discover: true` keeps a page not used every day under Discover until the user pins it), `registerMessageRenderer` (displays custom messages sent by pi extensions with `sendMessage`), `registerTool` (tools executed by the browser in conversations opened on the page), `registerSettings` (a section of the settings, after those of Ta: rows of a label, a description and a control the extension draws, the values kept with `storage`), `registerTasks` / `ui.useTasks` (work done for the user, listed by the double with its own tasks and those of other extensions; see docs/design/ta-double.md. A task with `remove` and `removeHint` can be swiped away in the lists, or selected with others and deleted at once; `ui.removeTasks` asks the user), `ui.SelectCheck` / `ui.SelectBar` (the round mark at the start of a row and the bar under a list while it selects several, as the lists of the page), `registerOpener` (opens links in replies: files and their lines, directories, web pages, asked in registration order, returns true if opened), `registerComposerAddon` (adds to the message box of every conversation: `actions(conversation)` is a section of its own in the + menu, entries may have `items`, a list in its place; `above` is drawn above the box; `subscribe` says the entries changed. `conversation` says which: `sessionId`, `sessionFile`, `cwd`, `kind` `double` or `chat`, `group`, `title`; the double, agents and plain conversations all have it), `ui.QrCode` (a QR code of a text, black on white whatever the theme), `ui.ImageViewer` (a picture to look at closely: all of it at first and never larger than its own pixels, pinched with two fingers or a trackpad, zoomed with Ctrl/⌘ and the wheel or a double click or tap, dragged or scrolled once zoomed, with − / the scale / + / 1:1 below it; the previews of pictures in the workbench and the large pictures of a conversation are this), `on` (events of the current conversation), `sendUserMessage` (sends to the current conversation; a `/command` runs a command of a pi extension), `switchSession` (shows another session open in ta serve as the current conversation; given a Promise of the session id it switches at once and shows "Opening", `opening` giving the title meanwhile), `callHost` (calls a method of the package's `pi.host`, through `callPackageHost`), `reloadExtensions` (after an extension installed, imported or removed packages itself, reloads the web extensions and the pi extensions of the current conversation as at the end of a reply), `ui.showView` / `ui.useView` (shows and reads any extension's view), `ui.Composer` / `ui.Markdown` (the message box and the Markdown of the conversations), `ui.useChatScroll` (scrolls as the conversations: at the bottom it follows new messages, scrolled up it is never pulled back and what is read does not jump, a part opened by a click stays where it was; `sent` is how many messages the user sent, one more of which goes to the bottom), `ui.Empty` (what a list or a view shows while empty: a title and at most one line of hint, centred in its space; `compact` in menus, pickers and dialogs; `picture` puts a picture above), `ui.Picture` / `ui.PictureCards` (small pictures as those of Ta: the shapes of an SVG take the classes `ta-pic-*` and follow the theme; a row of picture cards to click, with a label and a line of description), `ui.Dialog` (a dialog over the page), `preview` of `ui.openEditor` (a preview tab opened by a click, its title in italics, replaced by the next preview, kept by a double click or `ui.pinEditor`), `ui.setEditorDirty` (the tab shows an unsaved dot and asks before closing), `ui.useActiveEditor` (the current tab of the workbench), `ui.DiffEditor` (Monaco's diff editor, side by side or inline, the right side editable), `confirmLabel` / `danger` of `ui.confirm`, `head` of a view (a top bar of its own), `ui.input` / `ui.editor` (asks the user for a line or lines of text, `undefined` when cancelled), the page's `menu` (floating … menu when the page is listed in sidebar) and `pages` (pages listed in sidebar, navigation bar no longer lists them separately), `ui.notify` (notifications in bottom right of page), `ui.confirm` (confirm before continuing, returns whether user agreed), `ui.theme`, `ui.language`, `ui.supportsWebview` (whether a view can show a site in a `<webview>`, as in Ta Desktop, rather than an iframe), `ui.debugWebview` (Ta Desktop: a command of the Chrome DevTools Protocol to the page of such a webview, limited to the page itself), `ui.desktop.browserData` (Ta Desktop on macOS and Windows: the cookies of a profile of the user's browser taken into the browser of Ta once the user says yes in a dialog of the app, and clearing that browser's data), and page services: `server` (session, pi's RPC commands), `workspace` (files and commands in directory), `terminals` (terminals), `packages` (packages) (types see `WebExtensionAPI`).
26
+ - **Web extensions** are ES modules without import statements, with a default export of a function that the page calls with `pi`; the returned function is called on unload. The `pi` interface follows pi's ExtensionAPI naming: `ui.setWidget` (default above the input box, same as pi; `placement: 'panel'` puts it in the right workbench's card tabs), `registerView` (pages in the navigation bar, or a list of the sidebar at the top of the navigation bar; `location: 'panel'` is a tool in the right workbench; `discover: true` keeps a page not used every day under Discover until the user pins it), `registerMessageRenderer` (displays custom messages sent by pi extensions with `sendMessage`), `registerCodeRenderer` (draws the fenced blocks of a language in replies and in `ui.Markdown` as a card of the extension's own; the component gets `{ code, language, closed }`, `closed` false while the block streams, and a renderer that throws shows the block as code, as the `ta-glance` cards of `@celljs/ta-glance`), `registerTool` (tools executed by the browser in conversations opened on the page), `registerToolRenderer` (as pi's, a resolver `(toolName, next) => renderer` that chooses how calls of any tool read in conversations: `renderCall(args)` gives a verb, a target and a small icon in the language of the page, in place of the tool's name; `next()` is what the resolvers after it would use), `registerSettings` (a section of the settings, after those of Ta: rows of a label, a description and a control the extension draws, the values kept with `storage`), `registerTasks` / `ui.useTasks` (work done for the user, listed by the double with its own tasks and those of other extensions; see docs/design/ta-double.md. A task with `remove` and `removeHint` can be swiped away in the lists, or selected with others and deleted at once; `ui.removeTasks` asks the user), `ui.SelectCheck` / `ui.SelectBar` (the round mark at the start of a row and the bar under a list while it selects several, as the lists of the page), `registerOpener` (opens links in replies: files and their lines, directories, web pages, asked in registration order, returns true if opened), `registerComposerAddon` (adds to the message box of every conversation: `actions(conversation)` are entries of the + menu, each a tile of its grid (four by two a page, more a page to swipe to): `setting: true` shows its value (`detail`) under its label, `toggle: true` is a switch (`checked` is on, its icon lit; turning it leaves the menu open), and entries may have `items`, a list in its place; `above` is drawn above the box; `subscribe` says the entries changed. `conversation` says which: `sessionId`, `sessionFile`, `cwd`, `kind` `double` or `chat`, `group`, `title`; the double, agents and plain conversations all have it), `ui.Game3D` (a 3D game on Three.js: `setup(context)` gets a renderer, a scene, a camera and OrbitControls, fills the scene and returns what to do each frame; loaded, asleep and ended as `ui.Game`, its scene and WebGL context given back at the end), `ui.FullScreen` (covers all of the page: the shell, its head and side columns under it, under the notch and the home bar, below the title bar of the desktop app and above the keyboard; its touches are all its own, an edge brings out no panel of Ta; for a game held sideways or a world to walk in, `??` back to its place in an app older than it), `data-own-gestures` (an attribute of an element whose touches are its own: the slides of Ta start there only from an edge of the screen, a held finger opens no menu; games carry it), `ui.Game` (a game on Phaser 4, the game engine of the page, loaded when the first game starts; it fills its parent, sleeps while out of sight and ends when it unmounts, takes the keyboard only while it has the focus, and finds the colors of the theme in its registry; see docs/design/ta-games.md), `ui.QrCode` (a QR code of a text, black on white whatever the theme), `ui.ImageViewer` (a picture to look at closely: all of it at first and never larger than its own pixels, pinched with two fingers or a trackpad, zoomed with Ctrl/⌘ and the wheel or a double click or tap, dragged or scrolled once zoomed, with − / the scale / + / fit to window / actual size below it, and given `onPrevious` / `onNext` the pictures beside it by buttons at its sides and, unless zoomed, ← →; the previews of pictures in the workbench and the large pictures of a conversation are this), `on` (events of the current conversation), `sendUserMessage` (sends to the current conversation; a `/command` runs a command of a pi extension), `switchSession` (shows another session open in ta serve as the current conversation; given a Promise of the session id it switches at once and shows "Opening", `opening` giving the title meanwhile), `openChat` (opens the conversation of a session file as the lists do: at once from what the page or the device has, opened again in one round trip when it closed; false when no conversation has it), `callHost` (calls a method of the package's `pi.host`, through `callPackageHost`), `reloadExtensions` (after an extension installed, imported or removed packages itself, reloads the web extensions and the pi extensions of the current conversation as at the end of a reply), `ui.showView` / `ui.useView` (shows and reads any extension's view), `ui.Composer` / `ui.Markdown` (the message box and the Markdown of the conversations, the microphone and the hold to talk too; with `commands`, `/` lists the commands a new conversation in `cwd` will have; `voiceSends`, `onTalkSent`, `onListening`, `working` / `onStop` and `after` are those of the double's box: what is heard is sent at once, the page knows what was said by voice to read its answer aloud, that the user talks now, the send button stops what answers, buttons of its own on the right), `ui.HoldToTalk` (a button held to talk, as the bar of the message box: the page dims and listens with its recognizer, 取消 and 编辑 to slide onto, the words given as the finger lets go; nothing where the page cannot listen), `ui.voice` (`canListen` / `canSpeak` / `speak` / `hush`: read aloud in the voice of the settings), the `send` of a view (a page that is a conversation takes a message from another extension as if typed in its box; the double's page has it, its answer comes as its `preview`), `ui.useChatScroll` (scrolls as the conversations: at the bottom it follows new messages, scrolled up it is never pulled back and what is read does not jump, a part opened by a click stays where it was; `sent` is how many messages the user sent, one more of which goes to the bottom), `ui.Empty` (what a list or a view shows while empty: a title and at most one line of hint, centred in its space; `compact` in menus, pickers and dialogs; `picture` puts a picture above), `ui.Picture` / `ui.PictureCards` (small pictures as those of Ta: the shapes of an SVG take the classes `ta-pic-*` and follow the theme; a row of picture cards to click, with a label and a line of description), `ui.Dialog` (a dialog over the page), `preview` of `ui.openEditor` (a preview tab opened by a click, its title in italics, replaced by the next preview, kept by a double click or `ui.pinEditor`), `ui.setEditorDirty` (the tab shows an unsaved dot and asks before closing), `ui.useActiveEditor` (the current tab of the workbench), `ui.DiffEditor` (Monaco's diff editor, side by side or inline, the right side editable), `confirmLabel` / `danger` of `ui.confirm`, `head` of a view (a top bar of its own), `ui.input` / `ui.editor` (asks the user for a line or lines of text, `undefined` when cancelled), the page's `menu` (floating … menu when the page is listed in sidebar) and `pages` (pages listed in sidebar, navigation bar no longer lists them separately), `ui.notify` (notifications in bottom right of page), `ui.notifySession` (tells the user what a conversation said, as a messenger does: nothing while they look at it, nothing of a task the double follows unless it asks; nothing that pops up on a phone or a tablet, the unread dots of the list and of the Chats tab telling; on a computer in front, a banner with the face and name of the conversation, a tap opening it, its `options` buttons that send that answer once from whichever page; a notice of the system while it is not, silent for an answer; without those, a banner that waits for the user when it asks or failed), `ui.confirm` (confirm before continuing, returns whether user agreed), `ui.theme`, `ui.language`, `ui.supportsWebview` (whether a view can show a site in a `<webview>`, as in Ta Desktop, rather than an iframe), `ui.debugWebview` (Ta Desktop: a command of the Chrome DevTools Protocol to the page of such a webview, limited to the page itself), `ui.desktop.browserData` (Ta Desktop on macOS and Windows: the cookies of a profile of the user's browser taken into the browser of Ta once the user says yes in a dialog of the app, and clearing that browser's data), and page services: `server` (session, pi's RPC commands), `workspace` (files and commands in directory), `terminals` (terminals), `packages` (packages) (types see `WebExtensionAPI`).
27
27
  - **The bytes of files**: `pi.files` gives the bytes of a file of the workspace. When the page is served by ta serve itself, `byUrl` is true and the URL of `workspace.fileUrl` loads as it is; in the app on a phone, or when the page is opened through a relay, that URL is not there to load, `byUrl` is false, and `pi.files.read(url)` gives `{ type, size, data }` over the WebSocket (sealed end to end: the relay reads none of it). The previews of @celljs/ta-workspace are built on it: pictures, videos, sounds and PDFs as `blob:` URLs, an HTML report from the text of the file in a sandboxed frame.
28
28
  - **Make packages with natural language**: the built-in extension [@celljs/ta-extensions](../ta-extensions/README.md) includes the skill `ta-package` (also available in the Ta terminal) and adds an "Extensions" page in the navigation bar (create an extension in one sentence, export or import). It documents package format, the web extension interface, and validation steps. At the end of each reply in the current conversation, the page reloads web extensions: new ones load, changed ones reload, and deleted ones unload; when tools change, the conversation reopens that part in the same session file (only for conversations opened on this page); when packages change, the session reloads pi extensions. The page checks again when redisplayed (packages might change in the terminal too).
29
29
  - **Stable**: each extension owns what it registers and removes it all on unload; if one extension fails to load or render, only that extension's area shows an error, without affecting the page or other extensions.
@@ -35,7 +35,7 @@ Everything new in the interface comes from **web extensions** within packages, u
35
35
  ### Conversation and Input Box
36
36
 
37
37
  - **Conversation flow**: continuous thinking, tool calls, and interim explanations in a turn are folded into a single line "Executed N steps": this expands while in progress, shows only recent steps, and collapses after completion (remaining expanded and marking failed steps if any); the final text is the reply. Layout is a pure function `ProcessUtil` (`util/process.ts`); each message uses a stable key and memos per message, so streaming output only redraws changed messages.
38
- - **Input box**: Enter sends, Shift+Enter inserts a newline; during IME composition, Enter does not send. While Ta works, Enter suggests, Alt+Enter queues, Esc stops, and send and stop use the same button. `/` lists commands, `@` finds and inserts `@path` by filename (using the server's `findFiles`; the menu explains if unsupported); images can be pasted, dragged, or selected (PNG, JPEG, GIF, WebP; max 5 MB per image, max 8 per message); queued messages show above the input box and can be undone back to the box (`clearQueue`). Where the browser recognizes speech (`Voice`, `util/voice.ts`), every input box has a microphone on its right: a conversation puts what is heard at the caret to be read over before sending; the double sends it as soon as it is heard. Logic is in `ComposerUtil` (`util/composer.ts`). On a touch screen a finger held on the message box talks, as in WeChat (the whole box while the keyboard is down, its field and microphone included; with the keyboard up the field is the system's, to select and paste): the page dims and blurs, a green bubble shows the words as they come, a 取消 (cancel) and a 编辑 (edit) circle wait left and right, and the arc at the bottom says "release to send". Let go where the finger is and what was said is sent, with what the box already held; slid onto 取消 it is dropped, onto 编辑 it stays in the box to read over; a talk under 600 ms is no input at all (the bubble says it was too short, then goes), nor is one where nothing was heard, which a wrong touch is; the overlay fades out as the finger lets go (`VoiceTalkUtil`, `components/voice-talk.tsx`; the gesture is `device/hold.ts`).
38
+ - **Input box**: Enter sends, Shift+Enter inserts a newline; during IME composition, Enter does not send. While Ta works, Enter suggests, Alt+Enter queues, Esc stops, and send and stop use the same button. `/` lists commands (a new conversation's too, before it opens: those its directory will have, by `getDirectoryCommands`), `@` finds and inserts `@path` by filename (using the server's `findFiles`; the menu explains if unsupported); images can be pasted, dragged, or selected (PNG, JPEG, GIF, WebP; max 5 MB per image, max 8 per message); queued messages show above the input box and can be undone back to the box (`clearQueue`). Where speech can be recognized (`Voice`, `util/voice.ts`), every input box has a microphone on its right. In the Ta app on iOS it is Apple's recognizer itself (the native `TaSpeech.swift`, through `webkit.messageHandlers.taSpeech`): with punctuation, and told to expect the words of the work (README, commit) and the name of the directory; WebKit's recognition of the page, which repeats what it heard and leaves punctuation out, is only a browser's, its repetitions taken out (`Voice.transcript`). With a mouse a click of the microphone dictates: a conversation puts what is heard at the caret to be read over before sending; the double sends it as soon as it is heard. Logic is in `ComposerUtil` (`util/composer.ts`). On a touch screen it is WeChat's: a tap of the microphone turns the field into a "按住 说话" (hold to talk) bar (the button becoming a keyboard, which types again), and a finger held on the bar talks; a finger held on the field is still the system's edit menu (paste, new line), never a talk. Held, the page dims and blurs, a green bubble shows the words as they come, a 取消 (cancel) and a 编辑 (edit) circle wait left and right, and the arc at the bottom says "release to send". Let go where the finger is and what was said is sent, with what the box already held; slid onto 取消 it is dropped, onto 编辑 it stays in the box to read over; a talk under 600 ms is no input at all (the bubble says it was too short, then goes), nor is one where nothing was heard, which a wrong touch is; the overlay fades out as the finger lets go; the first time asks for the microphone and speech recognition (`VoiceTalkUtil`, `TalkBar`, `components/voice-talk.tsx`). The directory of a new conversation is a button above its box (`ComposerBox`'s `head`), which picks another. While the double reads a reply aloud, a "Stop" with a wave is on the right of the box, which a tap stops; it reads a sentence at a time, with the most natural voice of the system (premium and enhanced first, never a robotic one), which the Voice settings change and let one listen to (`Voice.pick`, `components/voice-picker.tsx`).
39
39
  - **Avatar**: `TaAvatar` is the dinosaur the double is (the Cell logo by default), and `mark` is a 1–2 character badge to distinguish agents (in web extensions it's `pi.ui.Avatar`); each reply starts with a small avatar (once per turn): during work, eye expression shows thinking, execution, or output; on the last turn when done, eyes squint with a checkmark; on error, it shows an alert badge; an empty conversation page displays a large avatar that blinks and occasionally looks at the input box. With reduced motion, everything is static. The figure of the account (the bottom of the rail, Me on a phone) is a close-up of the same dinosaur's head, `DinoFace`: round eyes and blushing cheeks; it tilts its head, blinks, follows the pointer with its eyes and laughs when tapped. Still SVG files of every kind are in `assets/dinos/` (made by `bun ta-packages/ta-web/scripts/dino-art.ts`).
40
40
  - **Status and hints**: four levels (info, success, warning, and error), each with a fixed icon and color, with the body always in body color. By ownership, there are three types: global **connection status bar** (a capsule at the top of the main area that appears after 1 second of disconnect, showing reason, countdown, and "Retry now"; shows "Reconnected" for 2 seconds after recovery); **notices** (`TaNotices`, bottom right, top on phone; success 3s, info 4s, warning 6s, error 8s; add 4s for buttons; pause on hover or focus; merge same messages with count; max 4 notices); **inline hints** (`Callout`, staying at the place of issue, such as when a turn reply fails, an extension view errors, or a token is rejected). Operation failures (send, switch model, open conversation, etc.) uniformly use `notices.error`: server errors with `hint` put the suggestion on the second line; failures from disconnect merge into one "Did not complete: ta serve not connected" message. Operations needing user confirmation use `notices.confirm`; irreversible operations have red buttons with default focus on "Cancel".
41
41
  - **Links**: all links in replies are clickable (`TaLinks`, parsed in `LinkUtil`). Web links, bare URLs in text, and `<URL>` open by default in the browser on the right workbench; Cmd/Ctrl+click (or middle button) opens in the system browser. File paths (`[text](src/a.ts#L10-L20)`, `src/a.ts:10:5`, `file://` address, and inline code like `src/a.ts:12` and `package.json`) are parsed relative to the conversation directory, open and locate in the workbench, and select corresponding lines and columns (syntax like VS Code: `#L10`, `#L10C5-L12C3`, `:10:5`, `:10-20`); directories (`docs/`) open in the explorer at that directory. Open actions are provided by web extensions (`registerOpener`; the built-in @celljs/ta-workspace handles files, directories, and the built-in browser). For security, following VS Code: only http(s), mailto, and paths are recognized; `javascript:`, `data:`, `command:`, etc. are plain text; rendering results are React elements, not HTML; paths are confirmed to exist on the server first, though read/write are still subject to execution environment constraints. Before opening in the system browser, a popup shows the full address with the domain highlighted (domains with similar appearance are shown in browser's punycode format); you can copy, open, or trust the domain. Localhost addresses (localhost, 127.0.0.1, and the host where ta serve runs) and **Settings → Links → Trusted Domains** (`github.com`, `*.github.com`, `localhost:3000`, `*`) skip confirmation; new windows always have `noopener,noreferrer`. In the built-in browser, URLs same-origin with the Ta page do not get `allow-same-origin` and cannot reach the page or token.
@@ -65,7 +65,7 @@ As WeChat pulls its mini programs down over its chats (design record docs/design
65
65
  - **Widgets** (views at `location: 'board'`): on a phone, a swipe to the right over the first tab brings the board in from the left (from the left edge over a row swiped open); elsewhere a button of the rail. Edit takes cards off, puts them back and orders them by their handles, kept for the user (`board`). Built in: the double's tasks, Quick open, and Next up of the scheduled tasks.
66
66
  - **Started on open**: a package with `pi.webActivation: 'open'`, or one opened without installing (`origin: 'temporary'`), loads when one of its pages opens; left, it keeps running in the background with its page as it was (`KeptPages`), shown again at once; it stops after the time of Settings, Extensions (5 minutes by default) in the background, or when more than three are there. Its pages are not in the navigation: Quick open lists them.
67
67
  - **Sharing**: `ui.shareExtension` opens the dialog that hands an extension on (QR code, copy, the share of the system): the source of a published one, else end to end through the relay and kept nowhere (`TaRelayServer.sharePackage`); `ui.openShared` opens a link of an extension, asked first.
68
- - For web extensions: `ui.usePages()` (every page, with its state, place, last use and temporary package), `ui.showView` (starts one started on open first; its name opens its first page), `ui.stopExtension`, `ui.forgetPage`, `pi.openTemporary(source, from)`, `ui.useContextMenu()` (the menu of the page, right click or long press), `ui.QrCode`, `ui.scanCode` (in the Ta app only).
68
+ - For web extensions: `ui.usePages()` (every page, with its state, place, last use and temporary package), `ui.showView` (starts one started on open first; its name opens its first page), `ui.stopExtension`, `ui.forgetPage`, `pi.openTemporary(source, from)`, `ui.useContextMenu()` (the menu of the page, right click or long press), `ui.QrCode`, `ui.scanCode` and `ui.scan` (in the Ta app only; `ui.scan` is the Scan of the page, which opens what the code carries).
69
69
 
70
70
  ## Phones and tablets
71
71
 
@@ -81,7 +81,7 @@ One page fits computers, phones and tablets, adapted in one place: `DeviceMedia`
81
81
  - **Alignment**: the first icon of a row of buttons starts where the text does; icon buttons drop the padding of the browser (14px a side on iOS, which put icons off centre); sideways, the notch and the rounded corners are kept clear.
82
82
  - A conversation scrolled up by more than half a screen shows a button back to the latest above the message box.
83
83
  - **Long press**: on a touch screen a held finger is a right click. Every menu a right click opens (files, tabs, chats, agents, terminals, search results) opens on a long press, through one bridge (`device/long-press.ts`): iOS fires no `contextmenu` on a long press, so the bridge sends one; Android does, and the bridge keeps it to one menu. The menu comes out above the finger, centred, clear of the status bar, in rows of 44px, with a light tap of the haptic engine in the app. The click of the finger let go is swallowed, and the system does not select the word under it.
84
- - **Messages held**, as in WeChat: copy, select text (in a sheet, with the system's handles), a new conversation from here, rewind to here, copy debug info. On a touch screen the text of a message is not selected by a long press, except in code blocks, where a long press does not open the menu. A row of the chats held: open, delete from the list.
84
+ - **Messages held**, as in WeChat: copy, quote (the message goes into the box as `> ` lines, asking about that part; on a computer the quote button of a reply's footer takes what is selected in that reply first, 400 characters at most, and the bubble of the user shows the quote it starts with apart, as a quieter passage), select text (in a sheet, with the system's handles), a new conversation from here, rewind to here, copy debug info. On a touch screen the text of a message is not selected by a long press, except in code blocks, where a long press does not open the menu. A row of the chats held: open, delete from the list.
85
85
  - **Easy to hit**: the buttons under a message take touches over 36×48px while their icons stay lined up with the text; the heads of the steps, the pill of changed files, the close of a tab take touches farther out, and the heads and rows of the groups of the chat list are 44px high; a tap anywhere in the message box types.
86
86
 
87
87
  Web extensions read the same state with `ui.useDevice()` (`layout`, `touch`, `handheld`, `keyboard`). The root carries it as `data-layout`, `data-touch`, `data-handheld` and `data-keyboard` for styles.
@@ -101,7 +101,7 @@ Web extensions read the same state with `ui.useDevice()` (`layout`, `touch`, `ha
101
101
  | `TaNotices` (`TaNoticesImpl`) | Page's notices and confirmations; shared by Ta and web extensions |
102
102
  | `TaAppPage` | Home page registered with `@View` (`AppView`) |
103
103
 
104
- The server ([@celljs/ta-host](../ta-host/README.md)) adds `getSettings` and `updateSettings` (Ta's settings) and three methods: `listWebExtensions`, `readWebExtension`, and `removeWebExtension`, which find web extensions the same way pi loads packages (`packages` setting and `extensions/` directory; project's only when trusted); and `reload`, which is the same as pi's `/reload`.
104
+ The server ([@celljs/ta-host](../ta-host/README.md)) adds `getSettings` and `updateSettings` (Ta's settings) and two methods: `listWebExtensions` and `readWebExtension`, which find web extensions the same way pi loads packages (`packages` setting and `extensions/` directory; project's only when trusted); and `reload`, which is the same as pi's `/reload`.
105
105
 
106
106
  ## Interface State
107
107
 
@@ -119,4 +119,4 @@ State for a specific directory (expanded folders in the explorer) is saved by th
119
119
 
120
120
  The token is a login credential, not interface state, and is still stored by `TaWorkbench` in localStorage (after being installed as an app, you can sign in in its own window).
121
121
 
122
- To add a built-in web extension, write a `@Component(BuiltinWebExtension)`. To replace the whole interface, rebind the home page with `@View({ index: true, component: MyView }, true)`.
122
+ To add a built-in web extension, write a `@Component(BuiltinWebExtension)`. To replace the whole interface, rebind the home page with `@View({ index: true, component: MyView }, true)`.
package/README.md CHANGED
@@ -16,14 +16,14 @@ Web 客户端可以装成桌面或手机上的应用:Chrome / Edge 地址栏
16
16
 
17
17
  ## 界面
18
18
 
19
- 主框架是 IDE 式布局:最左侧是导航栏,和手机的底部标签同一顺序:logo 下面先是侧栏的列表(Web 扩展的侧栏视图,如智能体,然后是对话),一条分隔线后是 Web 扩展的页面和"发现",底部是头像菜单;点一个列表,侧栏换成它,再点一次收起侧栏(Mod+B 同样开关侧栏;导轨底部的"工作台"按钮和 Mod+J 在任何页面上开关右侧工作台,工作台顶栏显示它的工具所在的目录)。旁边是侧栏(可拖宽、可收起;顶部是当前列表的搜索框和 +)(服务器上所有打开的会话,可新建、在指定目录新建、关闭;默认按目录分组,每组可折叠、组头的 + 在该目录新建,搜索框里的按钮切回按时间排列,搜索时总是按时间排列),中间是当前对话,右侧是可收起的面板,放 Web 扩展的卡片。窄屏时导航栏和对话列表变成抽屉,面板浮在对话上方。按住导航栏上的"分身"和"对话"(手机上是底部对应的标签)不弹菜单,而是按住说话(见下面的输入框):按住分身,打开它并在它的输入框上开始听,松手发给分身(回复默认只显示文字;设置的"声音"里打开"语音说话后朗读回复",或分身输入框 + 菜单里的同名开关,它的回复才会读出来);按住对话,新建一个对话并在它的输入框上听,松手就用这句话开始这个对话(`HeldTalk`,`components/held-talk.ts`)。浏览器不能识别语音时,这两项只是普通点按。
19
+ 主框架是 IDE 式布局:最左侧是导航栏,和手机的底部标签同一顺序:logo 下面先是侧栏的列表(Web 扩展的侧栏视图,如智能体,然后是对话),一条分隔线后是 Web 扩展的页面和"发现",底部是头像菜单;点一个列表,侧栏换成它,再点一次收起侧栏(Mod+B 同样开关侧栏;导轨底部的"工作台"按钮和 Mod+J 在任何页面上开关右侧工作台,工作台顶栏显示它的工具所在的目录)。旁边是侧栏(可拖宽、可收起;顶部是当前列表的搜索框和 +)(服务器上所有打开的会话,可新建、在指定目录新建、关闭;默认按目录分组,每组可折叠、组头的 + 在该目录新建,搜索框里的按钮切回按时间排列,搜索时总是按时间排列),中间是当前对话,右侧是可收起的面板,放 Web 扩展的卡片。窄屏时导航栏和对话列表变成抽屉,面板浮在对话上方。按住导航栏上的"分身"和"对话"(手机上是底部对应的标签)不弹菜单,而是按住说话(和输入框的"按住 说话"一样,见下面的输入框):按住分身,打开它并在它的输入框上开始听,松手发给分身(回复默认只显示文字;设置的"声音"里打开"语音说话后朗读回复",或分身输入框 + 菜单里的同名开关,它的回复才会读出来);按住对话,新建一个对话并在它的输入框上听,松手就用这句话开始这个对话(`HeldTalk`,`components/held-talk.ts`)。浏览器不能识别语音时,这两项只是普通点按。
20
20
 
21
21
  一开始,界面上只有对话。你告诉 Ta 想让这个页面做什么、显示什么,Ta 就把它做成一个 pi 包——对话旁的卡片、单独的页面,或者 Ta 的新命令——做完立刻出现在页面上。
22
22
 
23
23
  界面上新增的一切都来自包里的 **Web 扩展**,和 pi 的扩展同一套机制、同一套叫法:
24
24
 
25
25
  - **包**就是 pi 的包。`package.json` 的 `pi` 里,`extensions` 是给 Ta(终端和服务端)的扩展,`web` 是给这个页面的扩展;没有声明时取 `web/` 目录下的模块。包放在 `~/.ta/agent/extensions/<名字>/`(项目的 `.ta/extensions/`)即可生效,也可以用 `ta install` 安装。
26
- - **Web 扩展**是一个不带 import 的 ES 模块,默认导出一个函数,页面用 `pi` 调用它;返回的函数在卸载时调用。`pi` 的接口照 pi 的 ExtensionAPI 命名:`ui.setWidget`(默认在输入框上方,和 pi 一样;`placement: 'panel'` 放进右侧工作台的卡片标签)、`registerView`(导航栏里的页面,或导航栏上方的一个侧栏列表;`location: 'panel'` 是右侧工作台的工具)、`registerMessageRenderer`(显示 pi 扩展用 `sendMessage` 发出的自定义消息)、`registerTool`(页面打开的对话里由浏览器执行的工具)、`registerSettings`(设置里的一个分区,排在 Ta 自己的分区之后:每行是标签、说明和扩展自己画的控件,值用 `storage` 保存)、`registerTasks` / `ui.useTasks`(替用户做的事,由分身和其他扩展的任务一起列出,见 docs/design/ta-double.md;任务带 `remove` 和 `removeHint` 时,列表里可以左滑删除、多选后批量删除,询问统一由 `ui.removeTasks` 做)、`ui.SelectCheck` / `ui.SelectBar`(列表多选时行首的圆形勾选和列表底部的操作栏,样式与页面一致)、`registerOpener`(打开回复里的链接:文件及其行、目录、网页,按注册顺序询问,返回 true 表示已打开)、`registerComposerAddon`(给所有对话的输入框加东西:`actions(conversation)` 是 + 菜单里自己的一组,条目可以带 `items` 二级列表;`above` 画在输入框上方;`subscribe` 通知条目变了。`conversation` 说明是哪个对话:`sessionId`、`sessionFile`、`cwd`、`kind` 为 `double` 或 `chat`、`group`、`title`;分身、智能体和普通对话都有)、`ui.QrCode`(文字的二维码,任何主题下都是白底黑码)、`ui.ImageViewer`(看图:先完整显示且不超过原始像素,双指或触控板捏合、Ctrl/⌘ 加滚轮、双击或双点缩放,放大后拖动或滚动,底部是 − / 比例 / + / 1:1;工作台的图片预览和对话里的大图用的都是它)、`on`(当前对话的事件)、`sendUserMessage`(发到当前对话;`/命令` 会执行 pi 扩展的命令)、`switchSession`(把 ta serve 里另一个打开的会话显示为当前对话;传会话 id 的 Promise 时立即切过去显示"正在打开",`opening` 给出占位的标题)、`callHost`(调用本包 `pi.host` 的方法,经 `callPackageHost`)、`reloadExtensions`(扩展自己安装、导入或移除了包之后,像回复结束时一样重新加载 Web 扩展和当前对话的 pi 扩展)、`ui.showView` / `ui.useView`(显示、查看任意扩展的视图)、`ui.Composer` / `ui.Markdown`(和对话一样的输入框与 Markdown)、`ui.useChatScroll`(和对话一样的滚动:停在底部时跟随新消息,往上翻看时不会被拉回、正在看的内容不跳,点开的部分留在原处;`sent` 是用户发出的消息数,多一条就回到底部)、`ui.Empty`(列表或视图为空时的提示:一行标题加至多一行说明,在所在区域居中;菜单、选择器和弹窗里用 `compact`;`picture` 在上方放一张插图)、`ui.Picture` / `ui.PictureCards`(和 Ta 一样的小插图:SVG 里的图形用 `ta-pic-*` 类名,跟随主题;一排可点的插图卡片,带标签和一行说明)、`ui.Dialog`(盖住整页的弹窗)、`ui.openEditor` 的 `preview`(单击打开的预览标签,标题斜体,下一个预览会替换它,双击或 `ui.pinEditor` 固定)、`ui.setEditorDirty`(标签显示未保存圆点,关闭前确认)、`ui.useActiveEditor`(工作台当前标签)、`ui.DiffEditor`(Monaco 差异编辑器,并排或内联,可编辑右侧)、`ui.confirm` 的 `confirmLabel` / `danger`、视图的 `head`(自己的顶栏)、`ui.input` / `ui.editor`(向用户要一行或多行文字,取消时为 `undefined`)、页面的 `menu`(侧栏列出该页面时悬浮显示的 … 菜单)与 `pages`(侧栏列出的页面,导航栏不再单列)、`discover`(不常用的页面默认收在"发现",用户固定后才进导航栏)、`ui.notify`(页面右下角的通知)、`ui.confirm`(继续前先确认,返回用户是否同意)、`ui.theme`、`ui.language`、`ui.supportsWebview`(能否用 `<webview>` 显示网站,Ta 桌面版里可以,其他地方用 iframe)、`ui.debugWebview`(Ta 桌面版:向这种 webview 里的网页发 Chrome DevTools Protocol 命令,只限网页本身)、`ui.desktop.browserData`(Ta 桌面版,macOS 和 Windows:用户在应用的原生对话框里同意后,把其浏览器某个个人资料的 Cookie 导入内置浏览器;也可清除内置浏览器数据),以及页面的 `React` 和 ta serve 的服务:`server`(会话,pi 的 RPC 命令)、`workspace`(目录里的文件与命令)、`terminals`(终端)、`packages`(包)(类型见 `WebExtensionAPI`)。
26
+ - **Web 扩展**是一个不带 import 的 ES 模块,默认导出一个函数,页面用 `pi` 调用它;返回的函数在卸载时调用。`pi` 的接口照 pi 的 ExtensionAPI 命名:`ui.setWidget`(默认在输入框上方,和 pi 一样;`placement: 'panel'` 放进右侧工作台的卡片标签)、`registerView`(导航栏里的页面,或导航栏上方的一个侧栏列表;`location: 'panel'` 是右侧工作台的工具)、`registerMessageRenderer`(显示 pi 扩展用 `sendMessage` 发出的自定义消息)、`registerCodeRenderer`(把回复和 `ui.Markdown` 里某种语言的代码块画成扩展自己的卡片,组件拿到 `{ code, language, closed }`,流式时 `closed` 为假;抛错时显示为代码,如 `@celljs/ta-glance` 的 `ta-glance` 卡片)、`registerTool`(页面打开的对话里由浏览器执行的工具)、`registerToolRenderer`(照 pi 的同名接口传一个 resolver `(toolName, next) => renderer`,决定任意工具的调用在对话里怎么读:`renderCall(args)` 给出页面语言的动词、对象和可选的小图标,代替工具名;`next()` 是后面的 resolver 的结果)、`registerSettings`(设置里的一个分区,排在 Ta 自己的分区之后:每行是标签、说明和扩展自己画的控件,值用 `storage` 保存)、`registerTasks` / `ui.useTasks`(替用户做的事,由分身和其他扩展的任务一起列出,见 docs/design/ta-double.md;任务带 `remove` 和 `removeHint` 时,列表里可以左滑删除、多选后批量删除,询问统一由 `ui.removeTasks` 做)、`ui.SelectCheck` / `ui.SelectBar`(列表多选时行首的圆形勾选和列表底部的操作栏,样式与页面一致)、`registerOpener`(打开回复里的链接:文件及其行、目录、网页,按注册顺序询问,返回 true 表示已打开)、`registerComposerAddon`(给所有对话的输入框加东西:`actions(conversation)` 是 + 菜单里的条目,每个都是一个图标方块(每页 4×2,多了左右滑动翻页):`setting: true` 在名字下显示当前值(`detail`),`toggle: true` 是开关(`checked` 表示开着,图标点亮,点了不关菜单),条目可以带 `items` 二级列表;`above` 画在输入框上方;`subscribe` 通知条目变了。`conversation` 说明是哪个对话:`sessionId`、`sessionFile`、`cwd`、`kind` 为 `double` 或 `chat`、`group`、`title`;分身、智能体和普通对话都有)、`ui.Game3D`(Three.js 3D 游戏:`setup(context)` 拿到渲染器、场景、相机和 OrbitControls,往场景里放东西并返回每帧要做的事;同样懒加载、休眠、卸载时释放场景和 WebGL 上下文)、`ui.FullScreen`(盖住整个页面:外壳、它的顶栏和侧栏都在下面,铺到刘海和底部横条下,在桌面版标题栏之下、键盘之上;触摸全归它,屏幕边缘也不会拉出 Ta 的面板;给横屏游戏、能走进去的世界用,旧版 App 没有它时用 `??` 退回原处显示)、`data-own-gestures`(元素上的属性:从它开始的触摸归它,Ta 的滑动只从屏幕边缘开始,长按不出菜单;游戏自动带上)、`ui.Game`(Phaser 4 游戏:页面自带的游戏引擎,第一次开始游戏时才加载;填满父元素,看不见时休眠,卸载时销毁,键盘只在游戏获得焦点时归它,主题颜色放在游戏的 registry 里,见 docs/design/ta-games.md)、`ui.QrCode`(文字的二维码,任何主题下都是白底黑码)、`ui.ImageViewer`(看图:先完整显示且不超过原始像素,双指或触控板捏合、Ctrl/⌘ 加滚轮、双击或双点缩放,放大后拖动或滚动,底部是 − / 比例 / + / 适应窗口 / 实际大小;给了 `onPrevious` / `onNext` 时两侧有上一张、下一张按钮,未放大时 ← → 也能切换;工作台的图片预览和对话里的大图用的都是它)、`on`(当前对话的事件)、`sendUserMessage`(发到当前对话;`/命令` 会执行 pi 扩展的命令)、`switchSession`(把 ta serve 里另一个打开的会话显示为当前对话;传会话 id 的 Promise 时立即切过去显示"正在打开",`opening` 给出占位的标题)、`openChat`(按会话文件打开对话,和对话列表一样:先显示页面或设备上已有的内容,已关闭的一次往返重新打开;没有这个对话时返回 false)、`callHost`(调用本包 `pi.host` 的方法,经 `callPackageHost`)、`reloadExtensions`(扩展自己安装、导入或移除了包之后,像回复结束时一样重新加载 Web 扩展和当前对话的 pi 扩展)、`ui.showView` / `ui.useView`(显示、查看任意扩展的视图)、`ui.Composer` / `ui.Markdown`(和对话一样的输入框与 Markdown,麦克风和按住说话也一样;输入框的 `commands` 让 `/` 列出在 `cwd` 新开对话时会有的命令,`voiceSends`、`onTalkSent`、`onListening`、`working` / `onStop`、`after` 和分身的输入框一样:听到的话直接发出、知道哪句是说的以便朗读回答、正在听、正在回答时发送键变成停止、右侧放自己的按钮)、`ui.HoldToTalk`(按住说话的按钮,和输入框的“按住 说话”条一样:页面变暗、用页面的识别器听,可滑到“取消”“编辑”,松手交出文字;页面不能识别语音时不显示)、`ui.voice`(`canListen` / `canSpeak` / `speak` / `hush`:用设置里的声音朗读)、视图的 `send`(对话式页面接收别的扩展发来的一条消息,就像在它的输入框里输入;分身页面有它,回答经 `preview` 读到)、`ui.useChatScroll`(和对话一样的滚动:停在底部时跟随新消息,往上翻看时不会被拉回、正在看的内容不跳,点开的部分留在原处;`sent` 是用户发出的消息数,多一条就回到底部)、`ui.Empty`(列表或视图为空时的提示:一行标题加至多一行说明,在所在区域居中;菜单、选择器和弹窗里用 `compact`;`picture` 在上方放一张插图)、`ui.Picture` / `ui.PictureCards`(和 Ta 一样的小插图:SVG 里的图形用 `ta-pic-*` 类名,跟随主题;一排可点的插图卡片,带标签和一行说明)、`ui.Dialog`(盖住整页的弹窗)、`ui.openEditor` 的 `preview`(单击打开的预览标签,标题斜体,下一个预览会替换它,双击或 `ui.pinEditor` 固定)、`ui.setEditorDirty`(标签显示未保存圆点,关闭前确认)、`ui.useActiveEditor`(工作台当前标签)、`ui.DiffEditor`(Monaco 差异编辑器,并排或内联,可编辑右侧)、`ui.confirm` 的 `confirmLabel` / `danger`、视图的 `head`(自己的顶栏)、`ui.input` / `ui.editor`(向用户要一行或多行文字,取消时为 `undefined`)、页面的 `menu`(侧栏列出该页面时悬浮显示的 … 菜单)与 `pages`(侧栏列出的页面,导航栏不再单列)、`discover`(不常用的页面默认收在"发现",用户固定后才进导航栏)、`ui.notify`(页面右下角的通知)、`ui.notifySession`(像聊天软件那样告诉用户某个对话说了什么:用户正在看它时不提醒,分身跟进的任务交给分身,除非它在提问;手机和平板上不弹窗,由列表和“对话”标签上的未读黄点告诉;电脑上页面在前台时是带对话头像和名字的横幅,点一下打开对话,`options` 是可点的回答,同一个回答从各个页面只发一次;页面不在前台时是系统通知,回复是静音的;没有系统通知时,提问和失败留一条横幅等用户回来)、`ui.confirm`(继续前先确认,返回用户是否同意)、`ui.theme`、`ui.language`、`ui.supportsWebview`(能否用 `<webview>` 显示网站,Ta 桌面版里可以,其他地方用 iframe)、`ui.debugWebview`(Ta 桌面版:向这种 webview 里的网页发 Chrome DevTools Protocol 命令,只限网页本身)、`ui.desktop.browserData`(Ta 桌面版,macOS 和 Windows:用户在应用的原生对话框里同意后,把其浏览器某个个人资料的 Cookie 导入内置浏览器;也可清除内置浏览器数据),以及页面的 `React` 和 ta serve 的服务:`server`(会话,pi 的 RPC 命令)、`workspace`(目录里的文件与命令)、`terminals`(终端)、`packages`(包)(类型见 `WebExtensionAPI`)。
27
27
  - **文件的字节**:`pi.files` 给出工作区的文件字节。页面由 ta serve 自己提供时 `byUrl` 为真,直接用 `workspace.fileUrl` 的地址加载就行;手机应用里、或页面经中继打开时,那个地址在页面里加载不到,`byUrl` 为假,`pi.files.read(url)` 经 WebSocket 取回 `{ type, size, data }`(端到端加密,中继读不到)。`@celljs/ta-workspace` 的预览就靠它:图片、视频、声音、PDF 做成 `blob:`,HTML 报告按文件文本放进沙框。
28
28
  - **用自然语言做包**:内置扩展 [@celljs/ta-extensions](../ta-extensions/README.md) 带技能 `ta-package`(终端里的 Ta 也有),并在导航栏加了"扩展"页(一句话做扩展、导出导入),写明了包的格式、Web 扩展接口和验证步骤。当前对话每次回复结束,页面重新读取 Web 扩展:新的加载、改过的重新加载、删掉的卸载;工具有变化时,用同一个会话文件重新打开这段对话(只限本页打开的对话),包有改动时让会话重新加载 pi 扩展。页面重新显示时也会检查一次(包也可能在终端里改)。
29
29
  - **稳定**:每个扩展注册的东西归它自己,卸载时一并撤掉;一个扩展加载失败或渲染出错,只在它自己的位置显示错误,不影响页面和其他扩展。
@@ -35,7 +35,7 @@ Web 客户端可以装成桌面或手机上的应用:Chrome / Edge 地址栏
35
35
  ### 对话与输入框
36
36
 
37
37
  - **对话流**:一轮里连续的思考、工具调用和中途说明折成一行“已执行 N 步”:进行中展开、只显示最近几步,结束后收起(有失败的步骤时保持展开并标出),最后的正文是回复。布局是纯函数 `ProcessUtil`(`util/process.ts`);每条用稳定的 key 并按条 memo,流式输出时只重绘变化的那条。
38
- - **输入框**:Enter 发送、Shift+Enter 换行,输入法合成期间的回车不发送;Ta 工作时 Enter 引导、Alt+Enter 排队追加、Esc 停止,发送与停止是同一个按钮。`/` 列出命令,`@` 按文件名查找并插入 `@路径`(服务端 `findFiles`,不支持时菜单里说明);图片可粘贴、拖入或选择(PNG/JPEG/GIF/WebP,单张 5 MB、每条 8 张以内);排队的消息显示在输入框上方,可撤回到输入框(`clearQueue`)。浏览器能识别语音时(`Voice`,`util/voice.ts`),每个输入框右侧都有麦克风:普通对话把听到的话填进光标处,改完再发;分身听完直接发出。逻辑在 `ComposerUtil`(`util/composer.ts`)。触屏上还可以照微信那样按住输入框说话(键盘收起时的整个输入框,含文字区和话筒;键盘弹出后文字区留给系统选字、粘贴):页面变暗模糊,绿色气泡边听边显示文字,下方左右是"取消""编辑"两个圆,底部弧形提示"松开 发送"。原地松手就把这句话(连同输入框里已有的内容)发出;手指滑到"取消"上松手则丢掉,滑到"编辑"上松手则留在输入框里改;说话不到 600ms 不算这次输入(气泡里提示"说话时间太短"后消失),什么都没听到也不算,防止误触;松手后浮层淡出,首次使用浏览器会先询问麦克风权限(`VoiceTalkUtil`,`components/voice-talk.tsx`;手势在 `device/hold.ts`)。
38
+ - **输入框**:Enter 发送、Shift+Enter 换行,输入法合成期间的回车不发送;Ta 工作时 Enter 引导、Alt+Enter 排队追加、Esc 停止,发送与停止是同一个按钮。`/` 列出命令(新对话还没打开时也有:`getDirectoryCommands` 读出它的目录会有的命令),`@` 按文件名查找并插入 `@路径`(服务端 `findFiles`,不支持时菜单里说明);图片可粘贴、拖入或选择(PNG/JPEG/GIF/WebP,单张 5 MB、每条 8 张以内);排队的消息显示在输入框上方,可撤回到输入框(`clearQueue`)。能识别语音时(`Voice`,`util/voice.ts`),每个输入框右侧都有麦克风。在 Ta 手机应用(iOS)里用苹果自己的识别器(原生的 `TaSpeech.swift`,经 `webkit.messageHandlers.taSpeech`):带标点,并提前告诉它 README、commit 这类开发用词和当前目录名;WebKit 的网页识别会重复已识别的话、不加标点,只在浏览器里用,Safari 的重复也会去掉(`Voice.transcript`)。用鼠标时点麦克风听写:普通对话把听到的话填进光标处,改完再发;分身听完直接发出。逻辑在 `ComposerUtil`(`util/composer.ts`)。触屏上照微信:点麦克风,文字区换成"按住 说话"条(右侧按钮变成键盘,点它切回打字),按住这条说话;长按文字区仍是系统的编辑菜单(粘贴、换行),不会和说话冲突。按住时页面变暗模糊,绿色气泡边听边显示文字,下方左右是"取消""编辑"两个圆,底部弧形提示"松开 发送"。原地松手就把这句话(连同输入框里已有的内容)发出;手指滑到"取消"上松手则丢掉,滑到"编辑"上松手则留在输入框里改;说话不到 600ms 不算这次输入(气泡里提示"说话时间太短"后消失),什么都没听到也不算,防止误触;松手后浮层淡出,首次使用会先询问麦克风和语音识别权限(`VoiceTalkUtil`、`TalkBar`,`components/voice-talk.tsx`)。新对话的目录按钮在输入框上方(`ComposerBox` 的 `head`),点它换目录。分身朗读回复时,输入框右侧出现带声波的"停止",点一下就停;朗读按句进行,默认挑系统里最自然的声音(高音质、增强版优先,避开机械音),设置的"语音"里可以换声音并试听(`Voice.pick`,`components/voice-picker.tsx`)。
39
39
  - **头像**:`TaAvatar` 是分身选的那种恐龙(默认就是 Cell logo),`mark` 是 1~2 个字符的角标,用来区分智能体(Web 扩展里是 `pi.ui.Avatar`);每轮回复开头放一个小头像(一轮一次):工作中用眼神表示思考、执行或输出,最后一轮完成时眯眼带勾,出错时带提醒角标;空对话页是大号头像,会眨眼、不时看向输入框。减少动效时全部静止。账号头像(导轨左下角、手机"我")是同一只恐龙的头部特写 `DinoFace`:圆眼、腮红,会歪头、眨眼、眼睛跟着指针,点一下会笑。各品种的静态 SVG 在 `assets/dinos/`(`bun ta-packages/ta-web/scripts/dino-art.ts` 生成)。
40
40
  - **状态与提示**:分四级(info / success / warning / error),每级有固定的图标和颜色,正文始终用正文色。按归属分三种:全局的**连接状态条**(主区顶部的胶囊,断线超过 1 秒才出现,显示原因、倒计时和“立即重试”,恢复后显示“已重新连接”2 秒);**通知**(`TaNotices`,右下角、手机在顶部,success 3 秒、info 4 秒、warning 6 秒、error 8 秒,有按钮的多留 4 秒,悬停或聚焦时暂停计时,同一条重复出现时合并计数,最多 4 条);**就地提示**(`Callout`,留在出事的位置,如一轮回复失败、扩展视图出错、token 被拒绝)。操作失败(发送、切换模型、打开对话等)统一用 `notices.error`:服务端带 `hint` 的错误把建议放第二行,断线导致的失败合并成一条“没有完成:ta serve 未连接”。需要用户确认的操作用 `notices.confirm`,不可撤销的操作按钮为红色、默认焦点在“取消”。
41
41
  - **链接**:回复里的链接都可以点(`TaLinks`,解析在 `LinkUtil`)。网页链接、正文里的裸 URL 和 `<URL>` 默认在右侧工作台的浏览器里打开,Cmd/Ctrl + 点击(或中键)在系统浏览器里打开;文件路径(`[说明](src/a.ts#L10-L20)`、`src/a.ts:10:5`、`file://` 地址,以及写成行内代码的 `src/a.ts:12`、`package.json`)按对话目录解析,在工作台打开并定位、选中对应行列(写法同 VS Code:`#L10`、`#L10C5-L12C3`、`:10:5`、`:10-20`);目录(`docs/`)在资源管理器里切到该目录。打开动作由 Web 扩展提供(`registerOpener`,内置的 @celljs/ta-workspace 负责文件、目录和内置浏览器)。安全上照 VS Code 的做法:只认 http(s)、mailto 和路径,`javascript:`、`data:`、`command:` 等其他协议一律当普通文本;渲染结果是 React 元素而不是 HTML;路径先经服务端确认存在,读写仍受执行环境约束;在系统浏览器打开前会弹窗显示完整地址并突出域名(外观相近的域名按浏览器的 punycode 显示),可复制、打开或信任该域名,本机地址(localhost、127.0.0.1、ta serve 所在主机)和 **设置 → 链接 → 受信任的域名**(`github.com`、`*.github.com`、`localhost:3000`、`*`)里的不再询问;新窗口一律 `noopener,noreferrer`。内置浏览器里,与 Ta 页面同源的地址不给 `allow-same-origin`,碰不到页面和 token。
@@ -65,7 +65,7 @@ Web 客户端可以装成桌面或手机上的应用:Chrome / Edge 地址栏
65
65
  - **小组件**(`location: 'board'` 的视图):手机上在第一个标签上从左往右划,小组件面板从左侧滑入(已经划开的列表行上从左边缘开始);电脑和平板上是导轨底部的按钮。"编辑"里可以移除、加回卡片,拖动右侧把手排序,排列存在用户数据里(`board`)。内置的卡片有分身的任务、快捷打开和定时任务的"接下来"。
66
66
  - **按需启动**:包的 `pi.webActivation: 'open'`,或免安装打开的临时扩展(`origin: 'temporary'`),在打开它的页面时才加载;离开后在后台继续运行、页面原样保留(`KeptPages`),再次打开没有等待;在后台超过保留时间(设置 → 扩展,默认 5 分钟)或后台超过 3 个时停止。这类扩展的页面不进导航栏,在快捷打开里找到。
67
67
  - **分享**:`ui.shareExtension` 打开分享弹窗(二维码、复制、系统分享),已发布的扩展给来源,本机的经中继端到端发送、不存储(`TaRelayServer.sharePackage`);`ui.openShared` 打开扩展链接,先确认。
68
- - 扩展接口:`ui.usePages()`(所有页面及其状态、位置、最近使用时间、临时扩展信息)、`ui.showView`(按需启动的先启动,扩展名打开它的第一个页面)、`ui.stopExtension`、`ui.forgetPage`、`pi.openTemporary(source, from)`、`ui.useContextMenu()`(和页面一样的右键/长按菜单)、`ui.QrCode`、`ui.scanCode`(只在 Ta 手机应用里)。
68
+ - 扩展接口:`ui.usePages()`(所有页面及其状态、位置、最近使用时间、临时扩展信息)、`ui.showView`(按需启动的先启动,扩展名打开它的第一个页面)、`ui.stopExtension`、`ui.forgetPage`、`pi.openTemporary(source, from)`、`ui.useContextMenu()`(和页面一样的右键/长按菜单)、`ui.QrCode`、`ui.scanCode` 和 `ui.scan`(只在 Ta 手机应用里;`ui.scan` 就是页面自己的“扫一扫”,扫完打开二维码里的内容)。
69
69
 
70
70
  ## 手机与平板
71
71
 
@@ -81,7 +81,7 @@ Web 客户端可以装成桌面或手机上的应用:Chrome / Edge 地址栏
81
81
  - **对齐**:按钮第一个图标的边缘与正文对齐,图标按钮去掉浏览器默认内边距(iOS 每边 14px,会让图标偏离中心);横屏时避开刘海和圆角。
82
82
  - 对话向上翻了半屏以上时,输入框上方会出现"回到最新"按钮。
83
83
  - **长按**:在触屏上,长按就是右键。凡是右键能打开的菜单(文件、标签页、对话、智能体、终端、搜索结果),长按都能打开,由 `device/long-press.ts` 统一桥接。iOS 长按不会触发 `contextmenu`,就由这里补发一个;Android 会自己发,这里保证只出现一次。菜单出现在手指上方并居中,不会被状态栏或手指挡住,每行 44px。打开菜单时,手机应用会给一次轻触反馈。松手后的点击会被吞掉,系统也不会去选中手指下的字。
84
- - **长按消息**(参照微信):可以复制、选择文本(在底部弹层里用系统手柄选择)、从这里新开对话、回退到这里,或复制调试信息。消息正文在触屏上不能直接长按选中;代码块例外,可以选中,且长按代码不会弹出菜单。长按对话列表里的某一行,可以打开或从列表删除。
84
+ - **长按消息**(参照微信):可以复制、引用(把这条消息作为 `> ` 引用放进输入框,问的就是这一段;电脑上回复底栏的引用按钮会优先取在这条回复里选中的文字,最多 400 字,用户气泡把开头的引用单独显示成一段浅色引文)、选择文本(在底部弹层里用系统手柄选择)、从这里新开对话、回退到这里,或复制调试信息。消息正文在触屏上不能直接长按选中;代码块例外,可以选中,且长按代码不会弹出菜单。长按对话列表里的某一行,可以打开或从列表删除。
85
85
  - **好点**:消息下方的按钮是 36×48px 的触控区,图标仍然和正文对齐;步骤标题、改动胶囊、标签页关闭按钮的触控区都已扩大,对话列表的分组标题和组内对话行高 44px;点输入框的任何空白处都会开始输入。
86
86
 
87
87
  Web 扩展用 `ui.useDevice()` 读取同样的状态(`layout`、`touch`、`handheld`、`keyboard`)。根元素上也有对应的 `data-layout`、`data-touch`、`data-handheld`、`data-keyboard`,样式可以直接按它们写。
@@ -101,7 +101,7 @@ Web 扩展用 `ui.useDevice()` 读取同样的状态(`layout`、`touch`、`han
101
101
  | `TaNotices`(`TaNoticesImpl`) | 页面的通知与确认框:Ta 自身和 Web 扩展共用 |
102
102
  | `TaAppPage` | `@View` 注册的首页(`AppView`) |
103
103
 
104
- 服务端([@celljs/ta-host](../ta-host/README.md))为此加了 `getSettings` / `updateSettings`(ta 的设置),以及三个方法:`listWebExtensions`、`readWebExtension`、`removeWebExtension`,按 pi 加载包的方式(`packages` 设置与 `extensions/` 目录,项目的只在受信任时)找到 Web 扩展;以及与 pi `/reload` 相同的 `reload`。
104
+ 服务端([@celljs/ta-host](../ta-host/README.md))为此加了 `getSettings` / `updateSettings`(ta 的设置),以及两个方法:`listWebExtensions`、`readWebExtension`,按 pi 加载包的方式(`packages` 设置与 `extensions/` 目录,项目的只在受信任时)找到 Web 扩展;以及与 pi `/reload` 相同的 `reload`。
105
105
 
106
106
  ## 界面状态
107
107
 
@@ -119,4 +119,4 @@ Web 扩展用 `ui.useDevice()` 读取同样的状态(`layout`、`touch`、`han
119
119
 
120
120
  token 是登录凭据,不算界面状态,仍由 `TaWorkbench` 存在 localStorage(安装成应用后在自己的窗口里也能登录)。
121
121
 
122
- 要加一个内置 Web 扩展,写一个 `@Component(BuiltinWebExtension)`;要替换整个界面,用 `@View({ index: true, component: MyView }, true)` 重新绑定首页。
122
+ 要加一个内置 Web 扩展,写一个 `@Component(BuiltinWebExtension)`;要替换整个界面,用 `@View({ index: true, component: MyView }, true)` 重新绑定首页。
@@ -1,4 +1,15 @@
1
+ import type { TaSessionInfo } from '@celljs/ta-protocol';
1
2
  import * as React from 'react';
2
3
  import { type ChatListProps } from '../components/chat-list.js';
4
+ import type { ChatSeen } from '../components/chat-seen.js';
5
+ /**
6
+ * Which conversations the user has seen (useSeenChats), and the one in front of them: the conversation `shown`,
7
+ * else the double's own while its page is in front (`doubleShown`). The app keeps it, whichever list or tab is
8
+ * out: a conversation read from the agents' list is seen too.
9
+ */
10
+ export declare function useSeenConversations(sessions: readonly TaSessionInfo[], shown: string | undefined, doubleShown: boolean): {
11
+ seen: ChatSeen;
12
+ looking?: string;
13
+ };
3
14
  /** The list of chats with what the double knows of them: its tasks marked, a conversation to hand it. */
4
15
  export declare function AssistantChatList(props: Omit<ChatListProps, 'double' | 'notice'>): React.JSX.Element;
@@ -1,9 +1,21 @@
1
1
  import * as React from 'react';
2
2
  import { ChatList } from '../components/chat-list.js';
3
3
  import { ConnectionBanner } from '../components/connection-bar.js';
4
+ import { useSeenChats } from '../components/use-seen-chats.js';
4
5
  import { useNotices } from '../hooks.js';
5
6
  import { useT } from '../i18n/use-t.js';
6
7
  import { useAssistant } from './assistant-hooks.js';
8
+ /**
9
+ * Which conversations the user has seen (useSeenChats), and the one in front of them: the conversation `shown`,
10
+ * else the double's own while its page is in front (`doubleShown`). The app keeps it, whichever list or tab is
11
+ * out: a conversation read from the agents' list is seen too.
12
+ */
13
+ export function useSeenConversations(sessions, shown, doubleShown) {
14
+ var _a;
15
+ const [{ ready }, assistant] = useAssistant();
16
+ const looking = shown !== null && shown !== void 0 ? shown : (doubleShown && ready ? (_a = assistant.store()) === null || _a === void 0 ? void 0 : _a.sessionId : undefined);
17
+ return { seen: useSeenChats(sessions, looking), looking };
18
+ }
7
19
  /** The list of chats with what the double knows of them: its tasks marked, a conversation to hand it. */
8
20
  export function AssistantChatList(props) {
9
21
  var _a;
@@ -106,6 +106,11 @@ let AssistantWebExtension = class AssistantWebExtension {
106
106
  preview: () => this.preview(),
107
107
  busy: () => this.busy(),
108
108
  subscribe: listener => this.workbench.subscribe(() => listener()),
109
+ // From another extension, before its page was ever shown: its conversation opens first.
110
+ send: async (text, images) => {
111
+ await this.assistant.start();
112
+ await this.assistant.say(text, images);
113
+ },
109
114
  });
110
115
  registerPage();
111
116
  pi.registerView('tasks-card', {
@@ -1,4 +1,5 @@
1
1
  import type { SessionStore } from '@celljs/ta-client';
2
+ import type { ComposerImage } from '../util/composer.js';
2
3
  export declare const TaAssistant: unique symbol;
3
4
  export interface AssistantTask {
4
5
  /** Short, for the model: `t1`, `t2`, … */
@@ -71,7 +72,7 @@ export interface TaAssistant {
71
72
  /** Takes a task that does not run off the list; its conversation stays with the user's others. */
72
73
  removeTask(taskId: string): Promise<void>;
73
74
  /** Says something to ta: a new message, or, while it works, one it reads at its next step. */
74
- say(text: string): Promise<void>;
75
+ say(text: string, images?: ComposerImage[]): Promise<void>;
75
76
  stopTask(taskId: string): Promise<void>;
76
77
  /** The user lets the task start, or not. */
77
78
  answer(askId: string, start: boolean): void;
@@ -9,20 +9,30 @@ export declare class AssistantTaskBook {
9
9
  protected readonly persisted: TaState;
10
10
  /** The tasks the lists show changed. */
11
11
  protected readonly changed: (tasks: AssistantTask[]) => void;
12
+ /** A task has another id now, as another page gave its id to one it started at the same time (AssistantTaskUtil.merge). */
13
+ protected readonly renamed: (task: AssistantTask, was: string) => void;
12
14
  /** Every task kept, those taken off the list too (AssistantTask.removed). */
13
15
  protected records: AssistantTask[];
14
16
  /** The list of the server this page took last. */
15
17
  protected kept?: AssistantTask[];
16
18
  constructor(persisted: TaState,
17
19
  /** The tasks the lists show changed. */
18
- changed: (tasks: AssistantTask[]) => void);
20
+ changed: (tasks: AssistantTask[]) => void,
21
+ /** A task has another id now, as another page gave its id to one it started at the same time (AssistantTaskUtil.merge). */
22
+ renamed?: (task: AssistantTask, was: string) => void);
19
23
  /** Follows what other pages write. */
20
24
  watch(): () => void;
21
25
  load(): Promise<void>;
22
26
  /** The list of the server, read late or written by another page. */
23
27
  take(kept: AssistantTask[]): void;
24
28
  get(id: string): AssistantTask;
25
- change(id: string, change: Partial<AssistantTask>): void;
29
+ /**
30
+ * Changes a task by its id, or a task read before by what it stays (AssistantTaskUtil.identity): one read
31
+ * before a wait may have another id after it (merge).
32
+ */
33
+ change(of: string | AssistantTask, change: Partial<AssistantTask>): void;
34
+ /** The id a task read before has now. */
35
+ idOf(task: AssistantTask): string;
26
36
  add(task: AssistantTask): void;
27
37
  /** `t1`, `t2`, …: never one given before, taken off the list since or not. */
28
38
  nextId(): string;
@@ -9,9 +9,12 @@ import { AssistantTaskUtil } from './assistant-task-util.js';
9
9
  export class AssistantTaskBook {
10
10
  constructor(persisted,
11
11
  /** The tasks the lists show changed. */
12
- changed) {
12
+ changed,
13
+ /** A task has another id now, as another page gave its id to one it started at the same time (AssistantTaskUtil.merge). */
14
+ renamed = () => undefined) {
13
15
  this.persisted = persisted;
14
16
  this.changed = changed;
17
+ this.renamed = renamed;
15
18
  /** Every task kept, those taken off the list too (AssistantTask.removed). */
16
19
  this.records = [];
17
20
  }
@@ -30,7 +33,8 @@ export class AssistantTaskBook {
30
33
  /** The list of the server, read late or written by another page. */
31
34
  take(kept) {
32
35
  this.kept = kept;
33
- const merged = AssistantTaskUtil.merge(this.records, kept);
36
+ const moved = [];
37
+ const merged = AssistantTaskUtil.merge(this.records, kept, (task, was) => moved.push([task, was]));
34
38
  if (!StateUtil.same(merged, kept)) {
35
39
  this.set(merged);
36
40
  }
@@ -38,6 +42,9 @@ export class AssistantTaskBook {
38
42
  this.records = merged;
39
43
  this.changed(AssistantTaskUtil.visible(merged));
40
44
  }
45
+ for (const [task, was] of moved) {
46
+ this.renamed(task, was);
47
+ }
41
48
  }
42
49
  get(id) {
43
50
  const task = this.records.find(candidate => candidate.id === id && !candidate.removed);
@@ -46,12 +53,24 @@ export class AssistantTaskBook {
46
53
  }
47
54
  return task;
48
55
  }
49
- change(id, change) {
50
- const records = this.records.map(task => (task.id === id ? AssistantTaskUtil.changed(task, change) : task));
56
+ /**
57
+ * Changes a task by its id, or a task read before by what it stays (AssistantTaskUtil.identity): one read
58
+ * before a wait may have another id after it (merge).
59
+ */
60
+ change(of, change) {
61
+ const key = typeof of === 'string' ? undefined : AssistantTaskUtil.identity(of);
62
+ const records = this.records.map(task => (key === undefined ? task.id === of : AssistantTaskUtil.identity(task) === key) ? AssistantTaskUtil.changed(task, change) : task);
51
63
  if (records.some((task, index) => task !== this.records[index])) {
52
64
  this.set(records);
53
65
  }
54
66
  }
67
+ /** The id a task read before has now. */
68
+ idOf(task) {
69
+ var _a;
70
+ var _b;
71
+ const key = AssistantTaskUtil.identity(task);
72
+ return (_b = (_a = this.records.find(each => AssistantTaskUtil.identity(each) === key)) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : task.id;
73
+ }
55
74
  add(task) {
56
75
  this.set(AssistantTaskUtil.merge(this.records, [task]));
57
76
  }
@@ -2,7 +2,7 @@ import type { SessionState, SessionStore } from '@celljs/ta-client';
2
2
  import type { WebMenuItem, WebTask, WebTaskSource } from '../extension/web-extension-api.js';
3
3
  import type { Translate } from '../i18n/use-t.js';
4
4
  import type { AssistantAsk, AssistantState, AssistantTask, TaAssistant } from './assistant-protocol.js';
5
- /** What a task does now, in a few words: the call it runs, else whether it thinks or writes. */
5
+ /** What a task does now, in a few words: what the loading line of its conversation says (ProgressUtil.text), the same. */
6
6
  export declare function activity(task: AssistantTask, state: SessionState | undefined, t: Translate): string;
7
7
  /** What the source does with a task besides listing it: the workbench and the menus are the extension's. */
8
8
  export interface AssistantTaskActions {
@@ -1,17 +1,12 @@
1
1
  import { ProcessUtil } from '../util/process.js';
2
- import { ToolUtil } from '../util/tool.js';
3
- /** What a task does now, in a few words: the call it runs, else whether it thinks or writes. */
2
+ import { ProgressUtil } from '../util/progress.js';
3
+ /** What a task does now, in a few words: what the loading line of its conversation says (ProgressUtil.text), the same. */
4
4
  export function activity(task, state, t) {
5
- var _a, _b;
6
- const run = state && ToolUtil.current(state.tools);
7
- if (run) {
8
- const summary = ToolUtil.summary(run.toolName, (_a = run.args) !== null && _a !== void 0 ? _a : {});
9
- return [summary.verb ? t(summary.verb) : summary.name, summary.target].filter(Boolean).join(' ');
10
- }
5
+ var _a;
11
6
  if (task.status === 'running' && (state === null || state === void 0 ? void 0 : state.working)) {
12
- return t(`ta.session.phase.${ProcessUtil.phase(state.messages)}`);
7
+ return ProgressUtil.text(ProgressUtil.phase(state), t, { working: state.workingMessage });
13
8
  }
14
- return task.status === 'running' ? t('ta.task.running') : ProcessUtil.preview((_b = task.result) !== null && _b !== void 0 ? _b : '', 80) || t(`ta.task.${task.status}`);
9
+ return task.status === 'running' ? t('ta.task.running') : ProcessUtil.preview((_a = task.result) !== null && _a !== void 0 ? _a : '', 80) || t(`ta.task.${task.status}`);
15
10
  }
16
11
  /**
17
12
  * The double's own tasks as a source of WebExtensionAPI.registerTasks, which lists them with those of
@@ -12,11 +12,15 @@ export declare namespace AssistantTaskUtil {
12
12
  const CLOSED_RESULT = "Its session closed while nobody watched (the Ta service restarted, or closed it).";
13
13
  /**
14
14
  * The tasks of both lists, each in its newer copy (the higher `rev`; the server's, `theirs`, when
15
- * both are as new, so that the pages end with the same), in the order they started; the last MAX_TASKS.
15
+ * both are as new, so that the pages end with the same), in the order of their ids; the last MAX_TASKS.
16
16
  * A task taken off the list in either stays off: a page that changed it meanwhile, as often, does not
17
- * bring it back.
17
+ * bring it back. A task is known by when it started and its title (`identity`), not by its id: two pages
18
+ * that start one at once give both the same id, of which the one started first keeps it and the other
19
+ * takes the next free one (`renamed` hears of it, with the id it had), the same on every page.
18
20
  */
19
- function merge(ours: readonly AssistantTask[], theirs: readonly AssistantTask[]): AssistantTask[];
21
+ function merge(ours: readonly AssistantTask[], theirs: readonly AssistantTask[], renamed?: (task: AssistantTask, was: string) => void): AssistantTask[];
22
+ /** What a task stays through its changes, its id too: when it started and its title. */
23
+ function identity(task: Pick<AssistantTask, 'startedAt' | 'title'>): string;
20
24
  /** The tasks the lists show. */
21
25
  function visible(tasks: readonly AssistantTask[]): AssistantTask[];
22
26
  /** `task` with `change`, one change more; itself when nothing changes. */
@@ -51,6 +55,12 @@ export declare namespace AssistantTaskUtil {
51
55
  title: string;
52
56
  status: AssistantTask['status'];
53
57
  } | undefined;
58
+ /**
59
+ * What the double reads when a task it was told of under one id has another now (merge): two pages started
60
+ * one at once. Not shown to the user (isRenamedNote).
61
+ */
62
+ function renamedNote(task: AssistantTask, was: string): string;
63
+ function isRenamedNote(text: string): boolean;
54
64
  /** What the double reads when the user hands it one of their conversations. */
55
65
  function adoptedNote(task: AssistantTask, said: string): string;
56
66
  }
@@ -5,6 +5,8 @@ export const MAX_TASKS = 50;
5
5
  const RESULT_CHARS = 4000;
6
6
  /** The start of a note of updateNote. */
7
7
  const NOTE = /^<task_update id="([^"]+)" title="([^"]*)" status="(\w+)">/;
8
+ /** The start of a note of renamedNote. */
9
+ const RENAMED = /^<task_renamed id="[^"]+" was="[^"]+"/;
8
10
  /**
9
11
  * What the pages of the double agree on about its tasks. Every page of the user lists them, follows those
10
12
  * that run and keeps the list on the server: no one page owns them, so a change is a newer copy of a task,
@@ -16,25 +18,50 @@ export var AssistantTaskUtil;
16
18
  AssistantTaskUtil.CLOSED_RESULT = 'Its session closed while nobody watched (the Ta service restarted, or closed it).';
17
19
  /**
18
20
  * The tasks of both lists, each in its newer copy (the higher `rev`; the server's, `theirs`, when
19
- * both are as new, so that the pages end with the same), in the order they started; the last MAX_TASKS.
21
+ * both are as new, so that the pages end with the same), in the order of their ids; the last MAX_TASKS.
20
22
  * A task taken off the list in either stays off: a page that changed it meanwhile, as often, does not
21
- * bring it back.
23
+ * bring it back. A task is known by when it started and its title (`identity`), not by its id: two pages
24
+ * that start one at once give both the same id, of which the one started first keeps it and the other
25
+ * takes the next free one (`renamed` hears of it, with the id it had), the same on every page.
22
26
  */
23
- function merge(ours, theirs) {
27
+ function merge(ours, theirs, renamed) {
24
28
  var _a, _b;
25
- const byId = new Map();
29
+ const byTask = new Map();
26
30
  for (const task of ours) {
27
- byId.set(task.id, task);
31
+ byTask.set(identity(task), task);
28
32
  }
29
33
  for (const task of theirs) {
30
- const mine = byId.get(task.id);
34
+ const key = identity(task);
35
+ const mine = byTask.get(key);
31
36
  const newer = !mine || ((_a = task.rev) !== null && _a !== void 0 ? _a : 0) >= ((_b = mine.rev) !== null && _b !== void 0 ? _b : 0) ? task : mine;
32
37
  const removed = !!(task.removed || (mine === null || mine === void 0 ? void 0 : mine.removed));
33
- byId.set(task.id, removed && !newer.removed ? { ...newer, removed } : newer);
38
+ byTask.set(key, removed && !newer.removed ? { ...newer, removed } : newer);
34
39
  }
35
- return [...byId.values()].sort((a, b) => number(a.id) - number(b.id) || a.startedAt - b.startedAt).slice(-MAX_TASKS);
40
+ const tasks = [...byTask.values()].sort(order);
41
+ let next = tasks.reduce((max, task) => Math.max(max, number(task.id)), 0) + 1;
42
+ const taken = new Set();
43
+ const unique = tasks.map(task => {
44
+ var _a;
45
+ if (!taken.has(task.id)) {
46
+ taken.add(task.id);
47
+ return task;
48
+ }
49
+ const moved = { ...task, id: `t${next++}`, rev: ((_a = task.rev) !== null && _a !== void 0 ? _a : 0) + 1 };
50
+ taken.add(moved.id);
51
+ renamed === null || renamed === void 0 ? void 0 : renamed(moved, task.id);
52
+ return moved;
53
+ });
54
+ return unique.sort(order).slice(-MAX_TASKS);
36
55
  }
37
56
  AssistantTaskUtil.merge = merge;
57
+ /** What a task stays through its changes, its id too: when it started and its title. */
58
+ function identity(task) {
59
+ return `${task.startedAt}\n${task.title}`;
60
+ }
61
+ AssistantTaskUtil.identity = identity;
62
+ function order(a, b) {
63
+ return number(a.id) - number(b.id) || a.startedAt - b.startedAt || (a.title < b.title ? -1 : a.title > b.title ? 1 : 0);
64
+ }
38
65
  /** The tasks the lists show. */
39
66
  function visible(tasks) {
40
67
  return tasks.filter(task => !task.removed);
@@ -77,7 +104,8 @@ export var AssistantTaskUtil;
77
104
  var _a, _b, _c;
78
105
  const last = lastAnswer(state.messages);
79
106
  const reason = MessageUtil.stopReason(last);
80
- const status = state.closed || reason === 'aborted' ? 'stopped' : reason === 'error' ? 'failed' : 'done';
107
+ // Its last answer asked for a tool, whose result never came: the run was cut, not done.
108
+ const status = state.closed || reason === 'aborted' || reason === 'toolUse' ? 'stopped' : reason === 'error' ? 'failed' : 'done';
81
109
  const result = (_b = (_a = (status === 'failed' ? last === null || last === void 0 ? void 0 : last.errorMessage : undefined)) !== null && _a !== void 0 ? _a : lastWords(state.messages)) !== null && _b !== void 0 ? _b : '';
82
110
  return { status, result, endedAt: state.closed ? undefined : last === null || last === void 0 ? void 0 : last.timestamp, key: `${status}:${(_c = last === null || last === void 0 ? void 0 : last.timestamp) !== null && _c !== void 0 ? _c : 0}` };
83
111
  }
@@ -91,20 +119,39 @@ export var AssistantTaskUtil;
91
119
  /** What the double reads when a task ended. */
92
120
  function updateNote(task) {
93
121
  var _a;
94
- return `<task_update id="${task.id}" title="${task.title}" status="${task.status}">\n${((_a = task.result) !== null && _a !== void 0 ? _a : '').slice(0, RESULT_CHARS)}\n</task_update>`;
122
+ return `<task_update id="${task.id}" title="${attribute(task.title)}" status="${task.status}">\n${((_a = task.result) !== null && _a !== void 0 ? _a : '').slice(0, RESULT_CHARS)}\n</task_update>`;
95
123
  }
96
124
  AssistantTaskUtil.updateNote = updateNote;
97
125
  /** The task a note of updateNote is about, if `text` is one. */
98
126
  function noteOf(text) {
99
127
  const match = NOTE.exec(text);
100
- return match ? { id: match[1], title: match[2], status: match[3] } : undefined;
128
+ return match ? { id: match[1], title: unattribute(match[2]), status: match[3] } : undefined;
101
129
  }
102
130
  AssistantTaskUtil.noteOf = noteOf;
131
+ /**
132
+ * What the double reads when a task it was told of under one id has another now (merge): two pages started
133
+ * one at once. Not shown to the user (isRenamedNote).
134
+ */
135
+ function renamedNote(task, was) {
136
+ return `<task_renamed id="${task.id}" was="${was}" title="${attribute(task.title)}">\nTwo tasks were given the id ${was} at once: "${task.title}" is task ${task.id} from now on; ${was} is the other one. Use ${task.id} for it.\n</task_renamed>`;
137
+ }
138
+ AssistantTaskUtil.renamedNote = renamedNote;
139
+ function isRenamedNote(text) {
140
+ return RENAMED.test(text);
141
+ }
142
+ AssistantTaskUtil.isRenamedNote = isRenamedNote;
103
143
  /** What the double reads when the user hands it one of their conversations. */
104
144
  function adoptedNote(task, said) {
105
- return `<task_adopted id="${task.id}" title="${task.title}" status="${task.status}">\nThe user handed you one of their conversations, in ${task.cwd}: follow it as your task ${task.id}. Its last words:\n${said.slice(0, RESULT_CHARS)}\n</task_adopted>`;
145
+ return `<task_adopted id="${task.id}" title="${attribute(task.title)}" status="${task.status}">\nThe user handed you one of their conversations, in ${task.cwd}: follow it as your task ${task.id}. Its last words:\n${said.slice(0, RESULT_CHARS)}\n</task_adopted>`;
106
146
  }
107
147
  AssistantTaskUtil.adoptedNote = adoptedNote;
148
+ /** A title the model gave, in the quotes of an attribute: a quote in it would end the attribute, and noteOf would not know the note. */
149
+ function attribute(text) {
150
+ return text.replace(/&/g, '&amp;').replace(/"/g, '&quot;');
151
+ }
152
+ function unattribute(text) {
153
+ return text.replace(/&quot;/g, '"').replace(/&amp;/g, '&');
154
+ }
108
155
  function role(message) {
109
156
  return message.role;
110
157
  }