@celljs/ta 4.7.0 → 4.9.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 (585) hide show
  1. package/README.en.md +42 -3
  2. package/README.md +41 -2
  3. package/bin/ta.mjs +1 -1
  4. package/dist/cli.mjs +611 -22
  5. package/dist/gateway.mjs +2812 -0
  6. package/dist/pi/CHANGELOG.md +51 -0
  7. package/dist/pi/package.json +1 -1
  8. package/dist/pi/packages/ta-agents/README.en.md +68 -0
  9. package/dist/pi/packages/ta-agents/README.md +68 -0
  10. package/dist/pi/packages/ta-agents/extension/index.mjs +1756 -0
  11. package/dist/pi/packages/ta-agents/lib/acp-agent.d.ts +52 -0
  12. package/dist/pi/packages/ta-agents/lib/acp-agent.js +218 -0
  13. package/dist/pi/packages/ta-agents/lib/acp-protocol.d.ts +153 -0
  14. package/dist/pi/packages/ta-agents/lib/acp-protocol.js +45 -0
  15. package/dist/pi/packages/ta-agents/lib/agent-bindings.d.ts +45 -0
  16. package/dist/pi/packages/ta-agents/lib/agent-bindings.js +135 -0
  17. package/dist/pi/packages/ta-agents/lib/agent-catalog.d.ts +50 -0
  18. package/dist/pi/packages/ta-agents/lib/agent-catalog.js +143 -0
  19. package/dist/pi/packages/ta-agents/lib/agent-prompt.d.ts +18 -0
  20. package/dist/pi/packages/ta-agents/lib/agent-prompt.js +86 -0
  21. package/dist/pi/packages/ta-agents/lib/agent-session.d.ts +71 -0
  22. package/dist/pi/packages/ta-agents/lib/agent-session.js +220 -0
  23. package/dist/pi/packages/ta-agents/lib/agent-streamer.d.ts +41 -0
  24. package/dist/pi/packages/ta-agents/lib/agent-streamer.js +172 -0
  25. package/dist/pi/packages/ta-agents/lib/agent-tool.d.ts +22 -0
  26. package/dist/pi/packages/ta-agents/lib/agent-tool.js +88 -0
  27. package/dist/pi/packages/ta-agents/lib/agent-turn.d.ts +115 -0
  28. package/dist/pi/packages/ta-agents/lib/agent-turn.js +343 -0
  29. package/dist/pi/packages/ta-agents/lib/extension.d.ts +26 -0
  30. package/dist/pi/packages/ta-agents/lib/extension.js +247 -0
  31. package/dist/pi/packages/ta-agents/lib/json-rpc.d.ts +41 -0
  32. package/dist/pi/packages/ta-agents/lib/json-rpc.js +145 -0
  33. package/dist/pi/packages/ta-agents/lib/message-stream.d.ts +31 -0
  34. package/dist/pi/packages/ta-agents/lib/message-stream.js +134 -0
  35. package/dist/pi/packages/ta-agents/lib/pi-types.d.ts +20 -0
  36. package/dist/pi/packages/ta-agents/lib/pi-types.js +3 -0
  37. package/dist/pi/packages/ta-agents/lib/texts.d.ts +36 -0
  38. package/dist/pi/packages/ta-agents/lib/texts.js +43 -0
  39. package/dist/pi/packages/ta-agents/package.json +61 -0
  40. package/dist/pi/packages/ta-bots/README.en.md +46 -0
  41. package/dist/pi/packages/ta-bots/README.md +46 -0
  42. package/dist/pi/packages/ta-bots/extension/index.mjs +629 -0
  43. package/dist/pi/packages/ta-bots/host/index.mjs +2313 -0
  44. package/dist/pi/packages/ta-bots/lib/bot-service.d.ts +96 -0
  45. package/dist/pi/packages/ta-bots/lib/bot-service.js +391 -0
  46. package/dist/pi/packages/ta-bots/lib/bot-store.d.ts +42 -0
  47. package/dist/pi/packages/ta-bots/lib/bot-store.js +97 -0
  48. package/dist/pi/packages/ta-bots/lib/bots-protocol.d.ts +131 -0
  49. package/dist/pi/packages/ta-bots/lib/bots-protocol.js +46 -0
  50. package/dist/pi/packages/ta-bots/lib/bots-view.d.ts +7 -0
  51. package/dist/pi/packages/ta-bots/lib/bots-view.js +84 -0
  52. package/dist/pi/packages/ta-bots/lib/channel-protocol.d.ts +58 -0
  53. package/dist/pi/packages/ta-bots/lib/channel-protocol.js +37 -0
  54. package/dist/pi/packages/ta-bots/lib/composer.d.ts +21 -0
  55. package/dist/pi/packages/ta-bots/lib/composer.js +104 -0
  56. package/dist/pi/packages/ta-bots/lib/connect-dialog.d.ts +18 -0
  57. package/dist/pi/packages/ta-bots/lib/connect-dialog.js +198 -0
  58. package/dist/pi/packages/ta-bots/lib/extension.d.ts +34 -0
  59. package/dist/pi/packages/ta-bots/lib/extension.js +207 -0
  60. package/dist/pi/packages/ta-bots/lib/host.d.ts +8 -0
  61. package/dist/pi/packages/ta-bots/lib/host.js +15 -0
  62. package/dist/pi/packages/ta-bots/lib/i18n.d.ts +87 -0
  63. package/dist/pi/packages/ta-bots/lib/i18n.js +175 -0
  64. package/dist/pi/packages/ta-bots/lib/index.d.ts +9 -0
  65. package/dist/pi/packages/ta-bots/lib/index.js +40 -0
  66. package/dist/pi/packages/ta-bots/lib/login-book.d.ts +17 -0
  67. package/dist/pi/packages/ta-bots/lib/login-book.js +55 -0
  68. package/dist/pi/packages/ta-bots/lib/media-crypto.d.ts +19 -0
  69. package/dist/pi/packages/ta-bots/lib/media-crypto.js +70 -0
  70. package/dist/pi/packages/ta-bots/lib/message.d.ts +13 -0
  71. package/dist/pi/packages/ta-bots/lib/message.js +74 -0
  72. package/dist/pi/packages/ta-bots/lib/page.d.ts +54 -0
  73. package/dist/pi/packages/ta-bots/lib/page.js +131 -0
  74. package/dist/pi/packages/ta-bots/lib/pictures.d.ts +3 -0
  75. package/dist/pi/packages/ta-bots/lib/pictures.js +21 -0
  76. package/dist/pi/packages/ta-bots/lib/qr-image.d.ts +16 -0
  77. package/dist/pi/packages/ta-bots/lib/qr-image.js +70 -0
  78. package/dist/pi/packages/ta-bots/lib/react.d.ts +8 -0
  79. package/dist/pi/packages/ta-bots/lib/react.js +8 -0
  80. package/dist/pi/packages/ta-bots/lib/server-texts.d.ts +12 -0
  81. package/dist/pi/packages/ta-bots/lib/server-texts.js +45 -0
  82. package/dist/pi/packages/ta-bots/lib/session-bridge.d.ts +43 -0
  83. package/dist/pi/packages/ta-bots/lib/session-bridge.js +118 -0
  84. package/dist/pi/packages/ta-bots/lib/style.d.ts +4 -0
  85. package/dist/pi/packages/ta-bots/lib/style.js +114 -0
  86. package/dist/pi/packages/ta-bots/lib/test-fakes.d.ts +37 -0
  87. package/dist/pi/packages/ta-bots/lib/test-fakes.js +94 -0
  88. package/dist/pi/packages/ta-bots/lib/text-util.d.ts +16 -0
  89. package/dist/pi/packages/ta-bots/lib/text-util.js +158 -0
  90. package/dist/pi/packages/ta-bots/lib/web-socket-client.d.ts +38 -0
  91. package/dist/pi/packages/ta-bots/lib/web-socket-client.js +213 -0
  92. package/dist/pi/packages/ta-bots/lib/wecom-channel.d.ts +38 -0
  93. package/dist/pi/packages/ta-bots/lib/wecom-channel.js +222 -0
  94. package/dist/pi/packages/ta-bots/lib/wecom-login.d.ts +34 -0
  95. package/dist/pi/packages/ta-bots/lib/wecom-login.js +84 -0
  96. package/dist/pi/packages/ta-bots/lib/wecom-socket.d.ts +74 -0
  97. package/dist/pi/packages/ta-bots/lib/wecom-socket.js +214 -0
  98. package/dist/pi/packages/ta-bots/lib/weixin-api.d.ts +112 -0
  99. package/dist/pi/packages/ta-bots/lib/weixin-api.js +171 -0
  100. package/dist/pi/packages/ta-bots/lib/weixin-channel.d.ts +49 -0
  101. package/dist/pi/packages/ta-bots/lib/weixin-channel.js +258 -0
  102. package/dist/pi/packages/ta-bots/lib/weixin-login.d.ts +31 -0
  103. package/dist/pi/packages/ta-bots/lib/weixin-login.js +110 -0
  104. package/dist/pi/packages/ta-bots/package.json +55 -0
  105. package/dist/pi/packages/ta-bots/web/index.js +1241 -0
  106. package/dist/pi/packages/ta-changes/README.en.md +21 -0
  107. package/dist/pi/packages/ta-changes/README.md +21 -0
  108. package/dist/pi/packages/ta-changes/extension/index.mjs +296 -0
  109. package/dist/pi/packages/ta-changes/host/index.mjs +309 -0
  110. package/dist/pi/packages/ta-changes/lib/blob-store.d.ts +16 -0
  111. package/dist/pi/packages/ta-changes/lib/blob-store.js +69 -0
  112. package/dist/pi/packages/ta-changes/lib/card.d.ts +12 -0
  113. package/dist/pi/packages/ta-changes/lib/card.js +149 -0
  114. package/dist/pi/packages/ta-changes/lib/changes-protocol.d.ts +76 -0
  115. package/dist/pi/packages/ta-changes/lib/changes-protocol.js +20 -0
  116. package/dist/pi/packages/ta-changes/lib/changes-service.d.ts +20 -0
  117. package/dist/pi/packages/ta-changes/lib/changes-service.js +70 -0
  118. package/dist/pi/packages/ta-changes/lib/changes-util.d.ts +21 -0
  119. package/dist/pi/packages/ta-changes/lib/changes-util.js +44 -0
  120. package/dist/pi/packages/ta-changes/lib/diff-tab.d.ts +4 -0
  121. package/dist/pi/packages/ta-changes/lib/diff-tab.js +45 -0
  122. package/dist/pi/packages/ta-changes/lib/extension.d.ts +21 -0
  123. package/dist/pi/packages/ta-changes/lib/extension.js +106 -0
  124. package/dist/pi/packages/ta-changes/lib/host.d.ts +7 -0
  125. package/dist/pi/packages/ta-changes/lib/host.js +16 -0
  126. package/dist/pi/packages/ta-changes/lib/i18n.d.ts +30 -0
  127. package/dist/pi/packages/ta-changes/lib/i18n.js +61 -0
  128. package/dist/pi/packages/ta-changes/lib/index.d.ts +8 -0
  129. package/dist/pi/packages/ta-changes/lib/index.js +28 -0
  130. package/dist/pi/packages/ta-changes/lib/line-diff.d.ts +11 -0
  131. package/dist/pi/packages/ta-changes/lib/line-diff.js +69 -0
  132. package/dist/pi/packages/ta-changes/lib/page.d.ts +29 -0
  133. package/dist/pi/packages/ta-changes/lib/page.js +106 -0
  134. package/dist/pi/packages/ta-changes/lib/react.d.ts +8 -0
  135. package/dist/pi/packages/ta-changes/lib/react.js +8 -0
  136. package/dist/pi/packages/ta-changes/lib/recorder.d.ts +25 -0
  137. package/dist/pi/packages/ta-changes/lib/recorder.js +117 -0
  138. package/dist/pi/packages/ta-changes/lib/style.d.ts +4 -0
  139. package/dist/pi/packages/ta-changes/lib/style.js +46 -0
  140. package/dist/pi/packages/ta-changes/package.json +55 -0
  141. package/dist/pi/packages/ta-changes/web/index.js +463 -0
  142. package/dist/pi/packages/ta-channels/README.en.md +3 -2
  143. package/dist/pi/packages/ta-channels/README.md +3 -2
  144. package/dist/pi/packages/ta-channels/extension/index.mjs +109 -8
  145. package/dist/pi/packages/ta-channels/host/index.mjs +281 -5
  146. package/dist/pi/packages/ta-channels/lib/agent-menu.d.ts +2 -0
  147. package/dist/pi/packages/ta-channels/lib/agent-menu.js +19 -6
  148. package/dist/pi/packages/ta-channels/lib/channel-menu.d.ts +2 -0
  149. package/dist/pi/packages/ta-channels/lib/channel-menu.js +15 -12
  150. package/dist/pi/packages/ta-channels/lib/channels-model.d.ts +10 -0
  151. package/dist/pi/packages/ta-channels/lib/channels-util.d.ts +10 -0
  152. package/dist/pi/packages/ta-channels/lib/channels-util.js +29 -2
  153. package/dist/pi/packages/ta-channels/lib/channels.d.ts +2 -0
  154. package/dist/pi/packages/ta-channels/lib/channels.js +1 -0
  155. package/dist/pi/packages/ta-channels/lib/create.js +2 -2
  156. package/dist/pi/packages/ta-channels/lib/extension.d.ts +5 -0
  157. package/dist/pi/packages/ta-channels/lib/extension.js +25 -2
  158. package/dist/pi/packages/ta-channels/lib/i18n.d.ts +40 -9
  159. package/dist/pi/packages/ta-channels/lib/i18n.js +81 -19
  160. package/dist/pi/packages/ta-channels/lib/index.d.ts +3 -2
  161. package/dist/pi/packages/ta-channels/lib/index.js +14 -2
  162. package/dist/pi/packages/ta-channels/lib/members.js +10 -5
  163. package/dist/pi/packages/ta-channels/lib/more-menu.d.ts +5 -1
  164. package/dist/pi/packages/ta-channels/lib/more-menu.js +55 -9
  165. package/dist/pi/packages/ta-channels/lib/room.d.ts +11 -2
  166. package/dist/pi/packages/ta-channels/lib/room.js +47 -6
  167. package/dist/pi/packages/ta-channels/lib/sidebar.d.ts +5 -1
  168. package/dist/pi/packages/ta-channels/lib/sidebar.js +189 -31
  169. package/dist/pi/packages/ta-channels/lib/style.d.ts +1 -1
  170. package/dist/pi/packages/ta-channels/lib/style.js +136 -73
  171. package/dist/pi/packages/ta-channels/lib/tasks.d.ts +48 -0
  172. package/dist/pi/packages/ta-channels/lib/tasks.js +226 -0
  173. package/dist/pi/packages/ta-channels/lib/team-ask.d.ts +21 -0
  174. package/dist/pi/packages/ta-channels/lib/team-ask.js +73 -0
  175. package/dist/pi/packages/ta-channels/lib/team-tools.d.ts +6 -1
  176. package/dist/pi/packages/ta-channels/lib/team-tools.js +5 -4
  177. package/dist/pi/packages/ta-channels/lib/team.d.ts +5 -1
  178. package/dist/pi/packages/ta-channels/lib/team.js +10 -4
  179. package/dist/pi/packages/ta-channels/lib/views.d.ts +18 -3
  180. package/dist/pi/packages/ta-channels/lib/views.js +45 -9
  181. package/dist/pi/packages/ta-channels/package.json +11 -2
  182. package/dist/pi/packages/ta-channels/web/index.js +996 -205
  183. package/dist/pi/packages/ta-computer-use/extension/index.mjs +4 -2
  184. package/dist/pi/packages/ta-computer-use/lib/cua-driver-access.d.ts +2 -1
  185. package/dist/pi/packages/ta-computer-use/lib/cua-driver-access.js +9 -3
  186. package/dist/pi/packages/ta-computer-use/package.json +11 -2
  187. package/dist/pi/packages/ta-cron/README.en.md +48 -0
  188. package/dist/pi/packages/ta-cron/README.md +48 -0
  189. package/dist/pi/packages/ta-cron/extension/index.mjs +856 -0
  190. package/dist/pi/packages/ta-cron/host/index.mjs +884 -0
  191. package/dist/pi/packages/ta-cron/lib/commands.d.ts +61 -0
  192. package/dist/pi/packages/ta-cron/lib/commands.js +250 -0
  193. package/dist/pi/packages/ta-cron/lib/cron-expression.d.ts +39 -0
  194. package/dist/pi/packages/ta-cron/lib/cron-expression.js +146 -0
  195. package/dist/pi/packages/ta-cron/lib/cron-protocol.d.ts +160 -0
  196. package/dist/pi/packages/ta-cron/lib/cron-protocol.js +38 -0
  197. package/dist/pi/packages/ta-cron/lib/editor.d.ts +17 -0
  198. package/dist/pi/packages/ta-cron/lib/editor.js +143 -0
  199. package/dist/pi/packages/ta-cron/lib/extension.d.ts +27 -0
  200. package/dist/pi/packages/ta-cron/lib/extension.js +142 -0
  201. package/dist/pi/packages/ta-cron/lib/form-util.d.ts +39 -0
  202. package/dist/pi/packages/ta-cron/lib/form-util.js +121 -0
  203. package/dist/pi/packages/ta-cron/lib/host.d.ts +7 -0
  204. package/dist/pi/packages/ta-cron/lib/host.js +14 -0
  205. package/dist/pi/packages/ta-cron/lib/i18n.d.ts +88 -0
  206. package/dist/pi/packages/ta-cron/lib/i18n.js +173 -0
  207. package/dist/pi/packages/ta-cron/lib/index.d.ts +8 -0
  208. package/dist/pi/packages/ta-cron/lib/index.js +48 -0
  209. package/dist/pi/packages/ta-cron/lib/next-card.d.ts +9 -0
  210. package/dist/pi/packages/ta-cron/lib/next-card.js +35 -0
  211. package/dist/pi/packages/ta-cron/lib/notifier.d.ts +6 -0
  212. package/dist/pi/packages/ta-cron/lib/notifier.js +50 -0
  213. package/dist/pi/packages/ta-cron/lib/page.d.ts +42 -0
  214. package/dist/pi/packages/ta-cron/lib/page.js +116 -0
  215. package/dist/pi/packages/ta-cron/lib/pictures.d.ts +6 -0
  216. package/dist/pi/packages/ta-cron/lib/pictures.js +46 -0
  217. package/dist/pi/packages/ta-cron/lib/react.d.ts +8 -0
  218. package/dist/pi/packages/ta-cron/lib/react.js +8 -0
  219. package/dist/pi/packages/ta-cron/lib/reply.d.ts +6 -0
  220. package/dist/pi/packages/ta-cron/lib/reply.js +53 -0
  221. package/dist/pi/packages/ta-cron/lib/schedule-util.d.ts +25 -0
  222. package/dist/pi/packages/ta-cron/lib/schedule-util.js +223 -0
  223. package/dist/pi/packages/ta-cron/lib/scheduler.d.ts +78 -0
  224. package/dist/pi/packages/ta-cron/lib/scheduler.js +329 -0
  225. package/dist/pi/packages/ta-cron/lib/server-texts.d.ts +7 -0
  226. package/dist/pi/packages/ta-cron/lib/server-texts.js +24 -0
  227. package/dist/pi/packages/ta-cron/lib/style.d.ts +4 -0
  228. package/dist/pi/packages/ta-cron/lib/style.js +123 -0
  229. package/dist/pi/packages/ta-cron/lib/task-store.d.ts +25 -0
  230. package/dist/pi/packages/ta-cron/lib/task-store.js +60 -0
  231. package/dist/pi/packages/ta-cron/lib/task-util.d.ts +18 -0
  232. package/dist/pi/packages/ta-cron/lib/task-util.js +167 -0
  233. package/dist/pi/packages/ta-cron/lib/tasks-view.d.ts +10 -0
  234. package/dist/pi/packages/ta-cron/lib/tasks-view.js +204 -0
  235. package/dist/pi/packages/ta-cron/lib/tool.d.ts +85 -0
  236. package/dist/pi/packages/ta-cron/lib/tool.js +127 -0
  237. package/dist/pi/packages/ta-cron/package.json +55 -0
  238. package/dist/pi/packages/ta-cron/web/index.js +1953 -0
  239. package/dist/pi/packages/ta-extensions/README.en.md +4 -1
  240. package/dist/pi/packages/ta-extensions/README.md +4 -1
  241. package/dist/pi/packages/ta-extensions/host/index.mjs +64 -61
  242. package/dist/pi/packages/ta-extensions/lib/actions.d.ts +2 -0
  243. package/dist/pi/packages/ta-extensions/lib/actions.js +9 -1
  244. package/dist/pi/packages/ta-extensions/lib/host.d.ts +0 -8
  245. package/dist/pi/packages/ta-extensions/lib/host.js +7 -49
  246. package/dist/pi/packages/ta-extensions/lib/i18n.d.ts +8 -0
  247. package/dist/pi/packages/ta-extensions/lib/i18n.js +20 -4
  248. package/dist/pi/packages/ta-extensions/lib/index.js +2 -0
  249. package/dist/pi/packages/ta-extensions/lib/market-detail.js +14 -2
  250. package/dist/pi/packages/ta-extensions/lib/market-style.d.ts +1 -1
  251. package/dist/pi/packages/ta-extensions/lib/market-style.js +18 -18
  252. package/dist/pi/packages/ta-extensions/lib/page.js +22 -11
  253. package/dist/pi/packages/ta-extensions/lib/pictures.d.ts +3 -1
  254. package/dist/pi/packages/ta-extensions/lib/pictures.js +28 -32
  255. package/dist/pi/packages/ta-extensions/lib/search.d.ts +10 -0
  256. package/dist/pi/packages/ta-extensions/lib/search.js +139 -0
  257. package/dist/pi/packages/ta-extensions/lib/style.d.ts +1 -1
  258. package/dist/pi/packages/ta-extensions/lib/style.js +15 -34
  259. package/dist/pi/packages/ta-extensions/package.json +12 -2
  260. package/dist/pi/packages/ta-extensions/skills/ta-package/SKILL.md +12 -7
  261. package/dist/pi/packages/ta-extensions/web/index.js +488 -120
  262. package/dist/pi/packages/ta-launcher/README.en.md +15 -0
  263. package/dist/pi/packages/ta-launcher/README.md +15 -0
  264. package/dist/pi/packages/ta-launcher/lib/actions.d.ts +31 -0
  265. package/dist/pi/packages/ta-launcher/lib/actions.js +134 -0
  266. package/dist/pi/packages/ta-launcher/lib/i18n.d.ts +38 -0
  267. package/dist/pi/packages/ta-launcher/lib/i18n.js +77 -0
  268. package/dist/pi/packages/ta-launcher/lib/index.d.ts +8 -0
  269. package/dist/pi/packages/ta-launcher/lib/index.js +48 -0
  270. package/dist/pi/packages/ta-launcher/lib/launcher-util.d.ts +19 -0
  271. package/dist/pi/packages/ta-launcher/lib/launcher-util.js +47 -0
  272. package/dist/pi/packages/ta-launcher/lib/launcher-view.d.ts +20 -0
  273. package/dist/pi/packages/ta-launcher/lib/launcher-view.js +99 -0
  274. package/dist/pi/packages/ta-launcher/lib/mine-store.d.ts +22 -0
  275. package/dist/pi/packages/ta-launcher/lib/mine-store.js +60 -0
  276. package/dist/pi/packages/ta-launcher/lib/react.d.ts +8 -0
  277. package/dist/pi/packages/ta-launcher/lib/react.js +8 -0
  278. package/dist/pi/packages/ta-launcher/lib/style.d.ts +4 -0
  279. package/dist/pi/packages/ta-launcher/lib/style.js +48 -0
  280. package/dist/pi/packages/ta-launcher/package.json +49 -0
  281. package/dist/pi/packages/ta-launcher/web/index.js +553 -0
  282. package/dist/pi/packages/ta-workspace/README.md +6 -6
  283. package/dist/pi/packages/ta-workspace/README.zh-cn.md +6 -6
  284. package/dist/pi/packages/ta-workspace/lib/browser-agent.d.ts +36 -0
  285. package/dist/pi/packages/ta-workspace/lib/browser-agent.js +396 -0
  286. package/dist/pi/packages/ta-workspace/lib/browser-common.d.ts +48 -0
  287. package/dist/pi/packages/ta-workspace/lib/browser-common.js +180 -0
  288. package/dist/pi/packages/ta-workspace/lib/browser-import.d.ts +5 -0
  289. package/dist/pi/packages/ta-workspace/lib/browser-import.js +97 -0
  290. package/dist/pi/packages/ta-workspace/lib/browser-webview.d.ts +7 -0
  291. package/dist/pi/packages/ta-workspace/lib/browser-webview.js +202 -0
  292. package/dist/pi/packages/ta-workspace/lib/browser.d.ts +1 -7
  293. package/dist/pi/packages/ta-workspace/lib/browser.js +14 -154
  294. package/dist/pi/packages/ta-workspace/lib/common.d.ts +8 -5
  295. package/dist/pi/packages/ta-workspace/lib/common.js +53 -14
  296. package/dist/pi/packages/ta-workspace/lib/explorer-excluded.d.ts +3 -0
  297. package/dist/pi/packages/ta-workspace/lib/explorer-excluded.js +39 -0
  298. package/dist/pi/packages/ta-workspace/lib/explorer-transfer.d.ts +31 -0
  299. package/dist/pi/packages/ta-workspace/lib/explorer-transfer.js +156 -0
  300. package/dist/pi/packages/ta-workspace/lib/explorer.js +121 -18
  301. package/dist/pi/packages/ta-workspace/lib/i18n.d.ts +47 -0
  302. package/dist/pi/packages/ta-workspace/lib/i18n.js +106 -12
  303. package/dist/pi/packages/ta-workspace/lib/index.js +7 -1
  304. package/dist/pi/packages/ta-workspace/lib/open-files.js +1 -1
  305. package/dist/pi/packages/ta-workspace/lib/preview.js +6 -2
  306. package/dist/pi/packages/ta-workspace/lib/scm.js +4 -4
  307. package/dist/pi/packages/ta-workspace/lib/search.js +1 -1
  308. package/dist/pi/packages/ta-workspace/lib/style.d.ts +1 -1
  309. package/dist/pi/packages/ta-workspace/lib/style.js +130 -56
  310. package/dist/pi/packages/ta-workspace/lib/terminal.d.ts +25 -3
  311. package/dist/pi/packages/ta-workspace/lib/terminal.js +327 -119
  312. package/dist/pi/packages/ta-workspace/lib/util/browser-snapshot.d.ts +52 -0
  313. package/dist/pi/packages/ta-workspace/lib/util/browser-snapshot.js +207 -0
  314. package/dist/pi/packages/ta-workspace/lib/util/terminal.d.ts +25 -0
  315. package/dist/pi/packages/ta-workspace/lib/util/terminal.js +55 -0
  316. package/dist/pi/packages/ta-workspace/lib/util/upload.d.ts +34 -0
  317. package/dist/pi/packages/ta-workspace/lib/util/upload.js +109 -0
  318. package/dist/pi/packages/ta-workspace/lib/util/workspace.d.ts +19 -2
  319. package/dist/pi/packages/ta-workspace/lib/util/workspace.js +50 -3
  320. package/dist/pi/packages/ta-workspace/lib/util/zip.d.ts +20 -0
  321. package/dist/pi/packages/ta-workspace/lib/util/zip.js +128 -0
  322. package/dist/pi/packages/ta-workspace/lib/workspace-client.d.ts +12 -1
  323. package/dist/pi/packages/ta-workspace/lib/workspace-client.js +101 -0
  324. package/dist/pi/packages/ta-workspace/package.json +11 -2
  325. package/dist/pi/packages/ta-workspace/web/index.js +2695 -799
  326. package/dist/public/assets/{abnfDiagram-S7VZAUFO-D1ZeYB9c.js → abnfDiagram-S7VZAUFO-C1tb6dM5.js} +1 -1
  327. package/dist/public/assets/{architecture-WOLXFQ4H-RV_x_iFj.js → architecture-WOLXFQ4H-DN1Va8BF.js} +1 -1
  328. package/dist/public/assets/{architectureDiagram-YGSQEFNW-BGOmzcpZ.js → architectureDiagram-YGSQEFNW-BmK2SYtQ.js} +1 -1
  329. package/dist/public/assets/{blockDiagram-APKKGZFW-BkoflIym.js → blockDiagram-APKKGZFW-DvLrLzTm.js} +1 -1
  330. package/dist/public/assets/{browser-Cl9_lr0X.js → browser-DAv3ly6M.js} +1 -1
  331. package/dist/public/assets/{c4Diagram-KJ2TOQU5-CfrQTIEs.js → c4Diagram-KJ2TOQU5-CrQlWwrG.js} +1 -1
  332. package/dist/public/assets/{chunk-6MUBBAK2-C-VxnXsG.js → chunk-6MUBBAK2-CHKMsuY_.js} +1 -1
  333. package/dist/public/assets/{chunk-AXFCVDMN-aqbxPiaN.js → chunk-AXFCVDMN-CWJ7Np6s.js} +1 -1
  334. package/dist/public/assets/{chunk-BG4553SI-DDgvFLBP.js → chunk-BG4553SI-3v5XbQGM.js} +1 -1
  335. package/dist/public/assets/{chunk-DQASFODM-CItpjfW5.js → chunk-DQASFODM-2CC-yiCz.js} +1 -1
  336. package/dist/public/assets/{chunk-HFQBQIA3-BATYGV1I.js → chunk-HFQBQIA3-D2hzQPAy.js} +1 -1
  337. package/dist/public/assets/{chunk-KQLB2F66-BVAqVjgq.js → chunk-KQLB2F66-SifAZs2r.js} +1 -1
  338. package/dist/public/assets/{chunk-KS47KZWR-Bk0_a-eE.js → chunk-KS47KZWR-BP0C0VCC.js} +1 -1
  339. package/dist/public/assets/{chunk-LEVMRMFU-DsFG_U8r.js → chunk-LEVMRMFU-B1f5vw5b.js} +1 -1
  340. package/dist/public/assets/{chunk-M57EVK23-BgeE81Y7.js → chunk-M57EVK23-B2MCJt7Y.js} +1 -1
  341. package/dist/public/assets/{chunk-OY52VR5R-2Rp6C2LJ.js → chunk-OY52VR5R-cDpZJMk4.js} +1 -1
  342. package/dist/public/assets/{chunk-QB3YPZ4I-BhcIp-Bl.js → chunk-QB3YPZ4I-BE0we2xc.js} +1 -1
  343. package/dist/public/assets/{chunk-R3KSYZAL-i9n2AYPG.js → chunk-R3KSYZAL-D9wOfqqH.js} +1 -1
  344. package/dist/public/assets/{chunk-STOXU5M4-DOSqSu65.js → chunk-STOXU5M4-BIaVsc0K.js} +1 -1
  345. package/dist/public/assets/{chunk-TU62E6Q5-BDA8bjy3.js → chunk-TU62E6Q5-BZc0OZEM.js} +1 -1
  346. package/dist/public/assets/{chunk-X4PVCEUW-Cs-r9l_d.js → chunk-X4PVCEUW-Bngfwwzm.js} +1 -1
  347. package/dist/public/assets/{chunk-XXDRQBXY-DEcanQFC.js → chunk-XXDRQBXY-C5FQ6XHK.js} +1 -1
  348. package/dist/public/assets/{classDiagram-v2-L25IHNXF-BS8XxKRR.js → classDiagram-v2-L25IHNXF-_om54nmt.js} +1 -1
  349. package/dist/public/assets/{cose-bilkent-JH36ORCC--RPleOJ8.js → cose-bilkent-JH36ORCC-Dwpeee_6.js} +1 -1
  350. package/dist/public/assets/cynefin-EF2NZ3EQ-CW_93VVD.js +1 -0
  351. package/dist/public/assets/{cynefinDiagram-L36ESFBY-DZHM2oEU.js → cynefinDiagram-L36ESFBY-DP5_y9Dq.js} +1 -1
  352. package/dist/public/assets/{d3-selection-D2iIEb1P.js → d3-selection-DFiMlEmn.js} +1 -1
  353. package/dist/public/assets/{dagre-SPEB5RXH-h_G5ukMB.js → dagre-SPEB5RXH-DYwsk6gk.js} +1 -1
  354. package/dist/public/assets/{diagram-3B7GL73J-BnThWj9P.js → diagram-3B7GL73J-Dq_nT3AZ.js} +1 -1
  355. package/dist/public/assets/{diagram-DNEMPZML-DHCMo8sZ.js → diagram-DNEMPZML-ChURW6y9.js} +1 -1
  356. package/dist/public/assets/{diagram-L3MUGCDN-DxJZnIKT.js → diagram-L3MUGCDN-CgVp4Rto.js} +1 -1
  357. package/dist/public/assets/{diagram-LA4NIPWU-Cn0SGxqL.js → diagram-LA4NIPWU-vrqLMDby.js} +1 -1
  358. package/dist/public/assets/{diagram-MHCOC4E2-BafBOkBk.js → diagram-MHCOC4E2-lvfOr5ij.js} +1 -1
  359. package/dist/public/assets/{diagram-XPFHEONP-D7UnEMcU.js → diagram-XPFHEONP-oQ18TeVp.js} +1 -1
  360. package/dist/public/assets/{dist-CN9JBoER.js → dist-BOxxmveI.js} +1 -1
  361. package/dist/public/assets/{ebnfDiagram-UZSYDL2S-Us1rkKwp.js → ebnfDiagram-UZSYDL2S-C7_tlZCS.js} +1 -1
  362. package/dist/public/assets/{editor.api-S_CuXudU.js → editor.api-CoZ8MEuz.js} +1 -1
  363. package/dist/public/assets/{elk-XV6XMXQE-Czvqrn49.js → elk-XV6XMXQE-Dkt5-ikg.js} +1 -1
  364. package/dist/public/assets/{erDiagram-EYBAPDEH-C0g3K15f.js → erDiagram-EYBAPDEH-27kh3zlx.js} +1 -1
  365. package/dist/public/assets/{eventmodeling-K75KTNOO-DIcU7mQ5.js → eventmodeling-K75KTNOO-CxVEejjN.js} +1 -1
  366. package/dist/public/assets/flowDiagram-MALGAFMO-BRowRdve.js +1 -0
  367. package/dist/public/assets/{freemarker2-CkAEBjHO.js → freemarker2-D6CwPIXh.js} +1 -1
  368. package/dist/public/assets/{ganttDiagram-23REXITY-CIkKvihz.js → ganttDiagram-23REXITY-C-amlwpX.js} +1 -1
  369. package/dist/public/assets/gitGraph-VSP46ZUC-BGmojXlx.js +1 -0
  370. package/dist/public/assets/{gitGraphDiagram-STJD7YCW-BxM3589j.js → gitGraphDiagram-STJD7YCW-DKhzI0Xz.js} +1 -1
  371. package/dist/public/assets/{handlebars-CPBNiVZ2.js → handlebars-mxNr68Gm.js} +1 -1
  372. package/dist/public/assets/{html-CJBVALoy.js → html-Bze6s9R9.js} +1 -1
  373. package/dist/public/assets/{index-CBMmE3BQ.js → index-BhQUc9PU.js} +2 -2
  374. package/dist/public/assets/info-OHQRW6UA-CRRVgGj2.js +1 -0
  375. package/dist/public/assets/{infoDiagram-KBXO4MBG-BIcStK_t.js → infoDiagram-KBXO4MBG-WHuWjEDO.js} +1 -1
  376. package/dist/public/assets/{ishikawaDiagram-M35NCXHK-CpV2hKA6.js → ishikawaDiagram-M35NCXHK-DFHUwD0J.js} +1 -1
  377. package/dist/public/assets/{javascript-dv6GQsa3.js → javascript-4NMPu7y1.js} +1 -1
  378. package/dist/public/assets/{journeyDiagram-OPLOXDXO-B_vnmdId.js → journeyDiagram-OPLOXDXO-C7gV6zEr.js} +1 -1
  379. package/dist/public/assets/{jsonMode-DG_orhvz.js → jsonMode-B1JEHPMp.js} +1 -1
  380. package/dist/public/assets/{kanban-definition-BZKZHSQY-q5uWw99H.js → kanban-definition-BZKZHSQY-DlRu_d2Q.js} +1 -1
  381. package/dist/public/assets/{liquid-CD-LM2Kh.js → liquid-B7sIf4NX.js} +1 -1
  382. package/dist/public/assets/{mdx-C9mfI8up.js → mdx-CAN0qez6.js} +1 -1
  383. package/dist/public/assets/{mermaid-parser.core-DNe1duhT.js → mermaid-parser.core-BGmotBhf.js} +3 -3
  384. package/dist/public/assets/{mermaid.core-B1AcqJgl.js → mermaid.core-Cl6SS3cM.js} +4 -4
  385. package/dist/public/assets/{mindmap-definition-I2QAS2VK-CwYG3Fl3.js → mindmap-definition-I2QAS2VK-DiQ8Feqr.js} +1 -1
  386. package/dist/public/assets/module-1nDbf1AK.js +1761 -0
  387. package/dist/public/assets/module-BkKfSTDV.js +1 -0
  388. package/dist/public/assets/{monaco-C0ktZo3r.js → monaco-CwCjTWAO.js} +3 -3
  389. package/dist/public/assets/packet-JDAUHWVQ-DUlqTCWQ.js +1 -0
  390. package/dist/public/assets/{pegDiagram-FD4XPPHP-DxtA4QDS.js → pegDiagram-FD4XPPHP-XhCpv6BX.js} +1 -1
  391. package/dist/public/assets/pie-XZMESJXO-2RgP4ScO.js +1 -0
  392. package/dist/public/assets/{pieDiagram-J4AKIIQI-CfcIi0Vn.js → pieDiagram-J4AKIIQI-DUVzuXUd.js} +1 -1
  393. package/dist/public/assets/{python-DCA1j2QE.js → python-DsoF66Sp.js} +1 -1
  394. package/dist/public/assets/{quadrantDiagram-XTYBLID2-BxkJdurF.js → quadrantDiagram-XTYBLID2-Ddobf0z0.js} +1 -1
  395. package/dist/public/assets/radar-ABXABTNO-Dap8k-yH.js +1 -0
  396. package/dist/public/assets/railroad-I3PHUGI6-Ds10NBze.js +1 -0
  397. package/dist/public/assets/{railroad-abnf-LNEFI6M7--H3g5ywg.js → railroad-abnf-LNEFI6M7-DkrNo-Gf.js} +1 -1
  398. package/dist/public/assets/{railroad-ebnf-DWYD2UWJ-C2LAUFu6.js → railroad-ebnf-DWYD2UWJ-DaB7gY8P.js} +1 -1
  399. package/dist/public/assets/{railroad-peg-JR7BVNR7-Kq_ZXQMl.js → railroad-peg-JR7BVNR7-D_QG87QV.js} +1 -1
  400. package/dist/public/assets/{railroadDiagram-MRQ6NCDL-i4xIvHJV.js → railroadDiagram-MRQ6NCDL-x-nUoBjv.js} +1 -1
  401. package/dist/public/assets/{razor-CEeNaFx5.js → razor-DSrcJyQe.js} +1 -1
  402. package/dist/public/assets/{requirementDiagram-Y7LWUY3S-CYNXjuJm.js → requirementDiagram-Y7LWUY3S-kNNcbsty.js} +1 -1
  403. package/dist/public/assets/{sankeyDiagram-WGJFYUXA-CRQiHcW6.js → sankeyDiagram-WGJFYUXA-ClC12Odk.js} +1 -1
  404. package/dist/public/assets/{sequenceDiagram-5NDRBG5M-BSDVFsi2.js → sequenceDiagram-5NDRBG5M-DDQITP2g.js} +1 -1
  405. package/dist/public/assets/{stateDiagram-v2-FJ4FJNEA-uyUAaysl.js → stateDiagram-v2-FJ4FJNEA-N1t_36oh.js} +1 -1
  406. package/dist/public/assets/{swimlanes-UMQ2AFYF-DdEjQumY.js → swimlanes-UMQ2AFYF-DSt9fFYE.js} +1 -1
  407. package/dist/public/assets/swimlanesDiagram-OMPLPG4O-BHAN4SQO.js +8 -0
  408. package/dist/public/assets/{timeline-definition-SEUHKTQE-DZl-TXXh.js → timeline-definition-SEUHKTQE-CfymOw_s.js} +1 -1
  409. package/dist/public/assets/treeView-D4JQ5SDB-f1hLUBjI.js +1 -0
  410. package/dist/public/assets/treemap-SAJKECNS-_NPRpuUC.js +1 -0
  411. package/dist/public/assets/{typescript-DrF8YGbQ.js → typescript-J7rF-zX8.js} +1 -1
  412. package/dist/public/assets/{usecaseDiagram-AFA6YXN4-DkG3gLrp.js → usecaseDiagram-AFA6YXN4-CK_mRc2_.js} +1 -1
  413. package/dist/public/assets/{vennDiagram-NNMJR3RB-B_lj8x7-.js → vennDiagram-NNMJR3RB-DW8xR6IJ.js} +1 -1
  414. package/dist/public/assets/wardley-7MLQ67FV-CLBqtefx.js +1 -0
  415. package/dist/public/assets/{wardleyDiagram-S7YFUSEH-B1VFrC5a.js → wardleyDiagram-S7YFUSEH-Css55Zq5.js} +1 -1
  416. package/dist/public/assets/{xml-DfL-Brke.js → xml-CJeviG_a.js} +1 -1
  417. package/dist/public/assets/xterm-BrP-ENHg.css +1 -0
  418. package/dist/public/assets/xterm-wtHqjrNn.js +85 -0
  419. package/dist/public/assets/{xychartDiagram-GGNKY7IX-CM2CpXu9.js → xychartDiagram-GGNKY7IX-BnhK9cFS.js} +1 -1
  420. package/dist/public/assets/{yaml-CpmxRjjF.js → yaml-Gw3uo6rF.js} +1 -1
  421. package/dist/public/index.html +35 -6
  422. package/dist/public/launch.svg +49 -0
  423. package/dist/serve/index.mjs +8862 -5822
  424. package/package.json +24 -18
  425. package/dist/pi/packages/ta-channels/lib/agent-menu.d.ts.map +0 -1
  426. package/dist/pi/packages/ta-channels/lib/agent-menu.js.map +0 -1
  427. package/dist/pi/packages/ta-channels/lib/channel-menu.d.ts.map +0 -1
  428. package/dist/pi/packages/ta-channels/lib/channel-menu.js.map +0 -1
  429. package/dist/pi/packages/ta-channels/lib/channels-model.d.ts.map +0 -1
  430. package/dist/pi/packages/ta-channels/lib/channels-model.js.map +0 -1
  431. package/dist/pi/packages/ta-channels/lib/channels-util.d.ts.map +0 -1
  432. package/dist/pi/packages/ta-channels/lib/channels-util.js.map +0 -1
  433. package/dist/pi/packages/ta-channels/lib/channels.d.ts.map +0 -1
  434. package/dist/pi/packages/ta-channels/lib/channels.js.map +0 -1
  435. package/dist/pi/packages/ta-channels/lib/create.d.ts.map +0 -1
  436. package/dist/pi/packages/ta-channels/lib/create.js.map +0 -1
  437. package/dist/pi/packages/ta-channels/lib/extension.d.ts.map +0 -1
  438. package/dist/pi/packages/ta-channels/lib/extension.js.map +0 -1
  439. package/dist/pi/packages/ta-channels/lib/faces.d.ts.map +0 -1
  440. package/dist/pi/packages/ta-channels/lib/faces.js.map +0 -1
  441. package/dist/pi/packages/ta-channels/lib/host.d.ts.map +0 -1
  442. package/dist/pi/packages/ta-channels/lib/host.js.map +0 -1
  443. package/dist/pi/packages/ta-channels/lib/i18n.d.ts.map +0 -1
  444. package/dist/pi/packages/ta-channels/lib/i18n.js.map +0 -1
  445. package/dist/pi/packages/ta-channels/lib/index.d.ts.map +0 -1
  446. package/dist/pi/packages/ta-channels/lib/index.js.map +0 -1
  447. package/dist/pi/packages/ta-channels/lib/members.d.ts.map +0 -1
  448. package/dist/pi/packages/ta-channels/lib/members.js.map +0 -1
  449. package/dist/pi/packages/ta-channels/lib/more-menu.d.ts.map +0 -1
  450. package/dist/pi/packages/ta-channels/lib/more-menu.js.map +0 -1
  451. package/dist/pi/packages/ta-channels/lib/react.d.ts.map +0 -1
  452. package/dist/pi/packages/ta-channels/lib/react.js.map +0 -1
  453. package/dist/pi/packages/ta-channels/lib/room.d.ts.map +0 -1
  454. package/dist/pi/packages/ta-channels/lib/room.js.map +0 -1
  455. package/dist/pi/packages/ta-channels/lib/sidebar.d.ts.map +0 -1
  456. package/dist/pi/packages/ta-channels/lib/sidebar.js.map +0 -1
  457. package/dist/pi/packages/ta-channels/lib/style.d.ts.map +0 -1
  458. package/dist/pi/packages/ta-channels/lib/style.js.map +0 -1
  459. package/dist/pi/packages/ta-channels/lib/team-tools.d.ts.map +0 -1
  460. package/dist/pi/packages/ta-channels/lib/team-tools.js.map +0 -1
  461. package/dist/pi/packages/ta-channels/lib/team.d.ts.map +0 -1
  462. package/dist/pi/packages/ta-channels/lib/team.js.map +0 -1
  463. package/dist/pi/packages/ta-channels/lib/views.d.ts.map +0 -1
  464. package/dist/pi/packages/ta-channels/lib/views.js.map +0 -1
  465. package/dist/pi/packages/ta-computer-use/lib/cua-driver-access.d.ts.map +0 -1
  466. package/dist/pi/packages/ta-computer-use/lib/cua-driver-access.js.map +0 -1
  467. package/dist/pi/packages/ta-computer-use/lib/cua-driver-daemon.d.ts.map +0 -1
  468. package/dist/pi/packages/ta-computer-use/lib/cua-driver-daemon.js.map +0 -1
  469. package/dist/pi/packages/ta-computer-use/lib/cua-driver.d.ts.map +0 -1
  470. package/dist/pi/packages/ta-computer-use/lib/cua-driver.js.map +0 -1
  471. package/dist/pi/packages/ta-computer-use/lib/extension.d.ts.map +0 -1
  472. package/dist/pi/packages/ta-computer-use/lib/extension.js.map +0 -1
  473. package/dist/pi/packages/ta-computer-use/lib/pi-types.d.ts.map +0 -1
  474. package/dist/pi/packages/ta-computer-use/lib/pi-types.js.map +0 -1
  475. package/dist/pi/packages/ta-extensions/lib/actions.d.ts.map +0 -1
  476. package/dist/pi/packages/ta-extensions/lib/actions.js.map +0 -1
  477. package/dist/pi/packages/ta-extensions/lib/archive.d.ts +0 -30
  478. package/dist/pi/packages/ta-extensions/lib/archive.d.ts.map +0 -1
  479. package/dist/pi/packages/ta-extensions/lib/archive.js +0 -213
  480. package/dist/pi/packages/ta-extensions/lib/archive.js.map +0 -1
  481. package/dist/pi/packages/ta-extensions/lib/context.d.ts.map +0 -1
  482. package/dist/pi/packages/ta-extensions/lib/context.js.map +0 -1
  483. package/dist/pi/packages/ta-extensions/lib/extensions-util.d.ts.map +0 -1
  484. package/dist/pi/packages/ta-extensions/lib/extensions-util.js.map +0 -1
  485. package/dist/pi/packages/ta-extensions/lib/host.d.ts.map +0 -1
  486. package/dist/pi/packages/ta-extensions/lib/host.js.map +0 -1
  487. package/dist/pi/packages/ta-extensions/lib/i18n.d.ts.map +0 -1
  488. package/dist/pi/packages/ta-extensions/lib/i18n.js.map +0 -1
  489. package/dist/pi/packages/ta-extensions/lib/import-dialog.d.ts.map +0 -1
  490. package/dist/pi/packages/ta-extensions/lib/import-dialog.js.map +0 -1
  491. package/dist/pi/packages/ta-extensions/lib/index.d.ts.map +0 -1
  492. package/dist/pi/packages/ta-extensions/lib/index.js.map +0 -1
  493. package/dist/pi/packages/ta-extensions/lib/market-detail.d.ts.map +0 -1
  494. package/dist/pi/packages/ta-extensions/lib/market-detail.js.map +0 -1
  495. package/dist/pi/packages/ta-extensions/lib/market-parts.d.ts.map +0 -1
  496. package/dist/pi/packages/ta-extensions/lib/market-parts.js.map +0 -1
  497. package/dist/pi/packages/ta-extensions/lib/market-store.d.ts.map +0 -1
  498. package/dist/pi/packages/ta-extensions/lib/market-store.js.map +0 -1
  499. package/dist/pi/packages/ta-extensions/lib/market-style.d.ts.map +0 -1
  500. package/dist/pi/packages/ta-extensions/lib/market-style.js.map +0 -1
  501. package/dist/pi/packages/ta-extensions/lib/market-util.d.ts.map +0 -1
  502. package/dist/pi/packages/ta-extensions/lib/market-util.js.map +0 -1
  503. package/dist/pi/packages/ta-extensions/lib/market-view.d.ts.map +0 -1
  504. package/dist/pi/packages/ta-extensions/lib/market-view.js.map +0 -1
  505. package/dist/pi/packages/ta-extensions/lib/market.d.ts.map +0 -1
  506. package/dist/pi/packages/ta-extensions/lib/market.js.map +0 -1
  507. package/dist/pi/packages/ta-extensions/lib/page.d.ts.map +0 -1
  508. package/dist/pi/packages/ta-extensions/lib/page.js.map +0 -1
  509. package/dist/pi/packages/ta-extensions/lib/pictures.d.ts.map +0 -1
  510. package/dist/pi/packages/ta-extensions/lib/pictures.js.map +0 -1
  511. package/dist/pi/packages/ta-extensions/lib/react.d.ts.map +0 -1
  512. package/dist/pi/packages/ta-extensions/lib/react.js.map +0 -1
  513. package/dist/pi/packages/ta-extensions/lib/signal.d.ts.map +0 -1
  514. package/dist/pi/packages/ta-extensions/lib/signal.js.map +0 -1
  515. package/dist/pi/packages/ta-extensions/lib/style.d.ts.map +0 -1
  516. package/dist/pi/packages/ta-extensions/lib/style.js.map +0 -1
  517. package/dist/pi/packages/ta-workspace/lib/browser.d.ts.map +0 -1
  518. package/dist/pi/packages/ta-workspace/lib/browser.js.map +0 -1
  519. package/dist/pi/packages/ta-workspace/lib/common.d.ts.map +0 -1
  520. package/dist/pi/packages/ta-workspace/lib/common.js.map +0 -1
  521. package/dist/pi/packages/ta-workspace/lib/editors.d.ts.map +0 -1
  522. package/dist/pi/packages/ta-workspace/lib/editors.js.map +0 -1
  523. package/dist/pi/packages/ta-workspace/lib/explorer.d.ts.map +0 -1
  524. package/dist/pi/packages/ta-workspace/lib/explorer.js.map +0 -1
  525. package/dist/pi/packages/ta-workspace/lib/file-icon.d.ts.map +0 -1
  526. package/dist/pi/packages/ta-workspace/lib/file-icon.js.map +0 -1
  527. package/dist/pi/packages/ta-workspace/lib/host.d.ts.map +0 -1
  528. package/dist/pi/packages/ta-workspace/lib/host.js.map +0 -1
  529. package/dist/pi/packages/ta-workspace/lib/i18n.d.ts.map +0 -1
  530. package/dist/pi/packages/ta-workspace/lib/i18n.js.map +0 -1
  531. package/dist/pi/packages/ta-workspace/lib/index.d.ts.map +0 -1
  532. package/dist/pi/packages/ta-workspace/lib/index.js.map +0 -1
  533. package/dist/pi/packages/ta-workspace/lib/open-files.d.ts.map +0 -1
  534. package/dist/pi/packages/ta-workspace/lib/open-files.js.map +0 -1
  535. package/dist/pi/packages/ta-workspace/lib/preview.d.ts.map +0 -1
  536. package/dist/pi/packages/ta-workspace/lib/preview.js.map +0 -1
  537. package/dist/pi/packages/ta-workspace/lib/react.d.ts.map +0 -1
  538. package/dist/pi/packages/ta-workspace/lib/react.js.map +0 -1
  539. package/dist/pi/packages/ta-workspace/lib/scm.d.ts.map +0 -1
  540. package/dist/pi/packages/ta-workspace/lib/scm.js.map +0 -1
  541. package/dist/pi/packages/ta-workspace/lib/search.d.ts.map +0 -1
  542. package/dist/pi/packages/ta-workspace/lib/search.js.map +0 -1
  543. package/dist/pi/packages/ta-workspace/lib/style.d.ts.map +0 -1
  544. package/dist/pi/packages/ta-workspace/lib/style.js.map +0 -1
  545. package/dist/pi/packages/ta-workspace/lib/terminal.d.ts.map +0 -1
  546. package/dist/pi/packages/ta-workspace/lib/terminal.js.map +0 -1
  547. package/dist/pi/packages/ta-workspace/lib/util/ansi.d.ts +0 -72
  548. package/dist/pi/packages/ta-workspace/lib/util/ansi.d.ts.map +0 -1
  549. package/dist/pi/packages/ta-workspace/lib/util/ansi.js +0 -434
  550. package/dist/pi/packages/ta-workspace/lib/util/ansi.js.map +0 -1
  551. package/dist/pi/packages/ta-workspace/lib/util/file-icon.d.ts.map +0 -1
  552. package/dist/pi/packages/ta-workspace/lib/util/file-icon.js.map +0 -1
  553. package/dist/pi/packages/ta-workspace/lib/util/git.d.ts.map +0 -1
  554. package/dist/pi/packages/ta-workspace/lib/util/git.js.map +0 -1
  555. package/dist/pi/packages/ta-workspace/lib/util/keys.d.ts +0 -14
  556. package/dist/pi/packages/ta-workspace/lib/util/keys.d.ts.map +0 -1
  557. package/dist/pi/packages/ta-workspace/lib/util/keys.js +0 -52
  558. package/dist/pi/packages/ta-workspace/lib/util/keys.js.map +0 -1
  559. package/dist/pi/packages/ta-workspace/lib/util/preview.d.ts.map +0 -1
  560. package/dist/pi/packages/ta-workspace/lib/util/preview.js.map +0 -1
  561. package/dist/pi/packages/ta-workspace/lib/util/search.d.ts.map +0 -1
  562. package/dist/pi/packages/ta-workspace/lib/util/search.js.map +0 -1
  563. package/dist/pi/packages/ta-workspace/lib/util/seti-font.d.ts.map +0 -1
  564. package/dist/pi/packages/ta-workspace/lib/util/seti-font.js.map +0 -1
  565. package/dist/pi/packages/ta-workspace/lib/util/seti.d.ts.map +0 -1
  566. package/dist/pi/packages/ta-workspace/lib/util/seti.js.map +0 -1
  567. package/dist/pi/packages/ta-workspace/lib/util/workspace.d.ts.map +0 -1
  568. package/dist/pi/packages/ta-workspace/lib/util/workspace.js.map +0 -1
  569. package/dist/pi/packages/ta-workspace/lib/workspace-client.d.ts.map +0 -1
  570. package/dist/pi/packages/ta-workspace/lib/workspace-client.js.map +0 -1
  571. package/dist/pi/packages/ta-workspace/scripts/seti.ts +0 -173
  572. package/dist/public/assets/cynefin-EF2NZ3EQ-CXQC7Jwi.js +0 -1
  573. package/dist/public/assets/flowDiagram-MALGAFMO-D5Z_jzJ0.js +0 -1
  574. package/dist/public/assets/gitGraph-VSP46ZUC-CvdLb7m6.js +0 -1
  575. package/dist/public/assets/info-OHQRW6UA-BLs8wjUC.js +0 -1
  576. package/dist/public/assets/module-BLLqRvli.js +0 -1099
  577. package/dist/public/assets/module-BZPCnGxA.js +0 -1
  578. package/dist/public/assets/packet-JDAUHWVQ-jwWITUaQ.js +0 -1
  579. package/dist/public/assets/pie-XZMESJXO-CeTVZZgy.js +0 -1
  580. package/dist/public/assets/radar-ABXABTNO-BGI8J8LU.js +0 -1
  581. package/dist/public/assets/railroad-I3PHUGI6-CFkpx3Pr.js +0 -1
  582. package/dist/public/assets/swimlanesDiagram-OMPLPG4O-BJsun6CT.js +0 -8
  583. package/dist/public/assets/treeView-D4JQ5SDB-CL1mG6td.js +0 -1
  584. package/dist/public/assets/treemap-SAJKECNS-Bk3Z1uEC.js +0 -1
  585. package/dist/public/assets/wardley-7MLQ67FV-1E8i3qpD.js +0 -1
@@ -141,10 +141,10 @@ function Action({
141
141
  strokeWidth: 1.7
142
142
  }));
143
143
  }
144
- function Empty({ children, tone }) {
145
- return /* @__PURE__ */ React.createElement("div", {
146
- className: `taw-empty ${tone === "error" ? "taw-error" : ""}`
147
- }, children);
144
+ function Empty(props) {
145
+ return /* @__PURE__ */ React.createElement(pi.ui.Empty, {
146
+ ...props
147
+ });
148
148
  }
149
149
  function Glyph({ name, size = 15 }) {
150
150
  const Icon = Host.icon(name);
@@ -161,11 +161,20 @@ function useKept(store, key, initial) {
161
161
  const next = store.get(key) ?? initial();
162
162
  setValue(next);
163
163
  }
164
- const set = React.useCallback((next) => setValue((previous) => {
165
- const value2 = typeof next === "function" ? next(previous) : next;
166
- store.set(keyRef.current, value2);
167
- return value2;
168
- }), [store]);
164
+ const initialRef = React.useRef(initial);
165
+ initialRef.current = initial;
166
+ const set = React.useCallback((next) => {
167
+ const change = (previous) => typeof next === "function" ? next(previous) : next;
168
+ if (keyRef.current !== key) {
169
+ store.set(key, change(store.get(key) ?? initialRef.current()));
170
+ return;
171
+ }
172
+ setValue((previous) => {
173
+ const value2 = change(previous);
174
+ store.set(key, value2);
175
+ return value2;
176
+ });
177
+ }, [store, key]);
169
178
  return [value, set];
170
179
  }
171
180
  function useContextMenu() {
@@ -184,14 +193,27 @@ function useContextMenu() {
184
193
  }) : null;
185
194
  return [element, open];
186
195
  }
196
+ function safeAreaTop(element) {
197
+ const probe = document.createElement("div");
198
+ probe.style.cssText = "position:fixed;visibility:hidden;pointer-events:none;padding-top:env(safe-area-inset-top)";
199
+ element.appendChild(probe);
200
+ const top = Number.parseFloat(getComputedStyle(probe).paddingTop) || 0;
201
+ probe.remove();
202
+ return top;
203
+ }
187
204
  function ContextMenu({ x, y, items, onClose }) {
188
205
  const root = React.useRef(null);
189
- const [place, setPlace] = React.useState({ left: x, top: y, ready: false });
206
+ const [place, setPlace] = React.useState({ left: 0, top: 0, ready: false });
190
207
  React.useLayoutEffect(() => {
191
- const box = root.current?.getBoundingClientRect();
208
+ const element = root.current;
209
+ const box = element && { width: element.offsetWidth, height: element.offsetHeight };
192
210
  if (box) {
193
- const left = Math.max(4, Math.min(x, window.innerWidth - box.width - 4));
194
- const top = y + box.height > window.innerHeight - 4 ? Math.max(4, y - box.height) : y;
211
+ const clamp = (value, max) => Math.max(4, Math.min(value, max - 4));
212
+ const touch = document.documentElement.dataset.touch !== undefined;
213
+ const safeTop = touch ? safeAreaTop(element) : 0;
214
+ const above = y - 14 - box.height;
215
+ const left = touch ? clamp(x - box.width / 2, window.innerWidth - box.width) : clamp(x, window.innerWidth - box.width);
216
+ const top = touch ? above >= safeTop + 4 ? above : clamp(y + 14, window.innerHeight - box.height) : y + box.height > window.innerHeight - 4 ? Math.max(4, y - box.height) : y;
195
217
  setPlace({ left, top, ready: true });
196
218
  }
197
219
  root.current?.querySelector("button:not(:disabled)")?.focus();
@@ -344,6 +366,22 @@ var ZH = {
344
366
  copied: "已复制",
345
367
  findInFolder: "在文件夹中查找…",
346
368
  revealInExplorer: "在资源管理器中显示",
369
+ revealInFinder: "在 Finder 中显示",
370
+ revealInFileExplorer: "在文件资源管理器中显示",
371
+ openContainingFolder: "打开所在的文件夹",
372
+ revealFailed: "无法在文件管理器中显示:{message}",
373
+ uploadFiles: "上传文件…",
374
+ uploadFolder: "上传文件夹…",
375
+ download: "下载",
376
+ uploading: "正在上传 {name}",
377
+ uploaded: "已上传 {count} 个文件",
378
+ uploadFailed: "上传失败:{message}",
379
+ replaceTitle: "已存在 {names},要替换吗?",
380
+ replaceMessage: "同名的文件会被上传的文件覆盖。",
381
+ packing: "正在打包 {name}",
382
+ downloadFailed: "下载失败:{message}",
383
+ moveExists: "目标文件夹中已有“{name}”。",
384
+ moveFailed: "移动失败:{message}",
347
385
  nameEmpty: "必须提供文件或文件夹名称。",
348
386
  nameSlash: "文件或文件夹名称不能以斜杠开头。",
349
387
  nameInvalid: "名称 {name} 不能用作文件或文件夹名称,请换一个。",
@@ -432,11 +470,13 @@ var ZH = {
432
470
  browser: "浏览器",
433
471
  refresh: "刷新",
434
472
  collapseAll: "全部折叠",
473
+ showExcluded: "显示默认隐藏的文件(.git、.DS_Store 等)",
435
474
  changeFolder: "切换目录",
436
475
  followConversation: "回到对话的目录({name})",
437
476
  loading: "加载中…",
438
477
  empty: "空目录",
439
- noOpenFiles: "还没有打开的文件。在资源管理器、搜索或源代码管理里点一个文件。",
478
+ noOpenFiles: "没有打开的文件",
479
+ noOpenFilesHint: "在资源管理器、搜索或源代码管理中点击文件",
440
480
  close: "关闭",
441
481
  closeAll: "全部关闭",
442
482
  searchPlaceholder: "搜索",
@@ -446,14 +486,22 @@ var ZH = {
446
486
  noResults: "没有结果。",
447
487
  results: "{files} 个文件中有 {count} 个结果",
448
488
  moreResults: "结果太多,只显示前 {count} 个。",
449
- notRepository: "当前目录不是 git 仓库。",
450
- noChanges: "没有更改。",
489
+ notRepository: "当前目录不是 git 仓库",
490
+ noChanges: "没有更改",
451
491
  staged: "暂存的更改",
452
492
  ahead: "领先 {count}",
453
493
  behind: "落后 {count}",
454
494
  newTerminal: "新建终端",
455
- noTerminals: "没有打开的终端。",
456
- terminalEnded: "[进程已结束,退出码 {code}]",
495
+ noTerminals: "没有打开的终端",
496
+ terminalEnded: "进程已退出,退出码 {code}",
497
+ restartTerminal: "重新启动",
498
+ killTerminal: "终止终端",
499
+ clearTerminal: "清屏",
500
+ paste: "粘贴",
501
+ selectAll: "全选",
502
+ renameTerminal: "重命名",
503
+ terminalKeys: "终端按键",
504
+ terminalAttention: "有新提醒",
457
505
  pipeMode: "服务器上没有 script,终端运行在管道上:全屏程序(vim、top)和密码输入不可用。",
458
506
  address: "输入网址或搜索",
459
507
  back: "后退",
@@ -464,7 +512,28 @@ var ZH = {
464
512
  browserHint: "输入网址或搜索,也可以打开本机的开发服务器。",
465
513
  home: "起始页",
466
514
  removeRecent: "从最近访问中移除",
467
- frameHint: "有的网站不允许被嵌入,页面空白时请在新窗口打开。",
515
+ frameHint: "有的网站不允许被嵌入,页面空白时请在新窗口打开;Ta 桌面版没有这个限制。",
516
+ stop: "停止",
517
+ openBrowser: "在默认浏览器中打开",
518
+ loadFailed: "无法打开这个网页",
519
+ pageCrashed: "这个网页崩溃了",
520
+ retry: "重试",
521
+ agentDriving: "Ta 正在操作",
522
+ importSignIns: "导入浏览器的登录状态",
523
+ importTitle: "导入登录状态",
524
+ importHint: "把所选浏览器的 Cookie 复制到这里,你和 Agent 都能直接使用已登录的网站。不导入密码和浏览记录。",
525
+ importFrom: "从哪个浏览器导入",
526
+ noProfiles: "没有找到 Chrome、Edge、Brave、Arc、Vivaldi 或 Chromium 的个人资料。",
527
+ importNow: "导入…",
528
+ importing: "导入中…",
529
+ imported: "已导入 {count} 个 Cookie",
530
+ importSkipped: "{count} 个无法读取,已跳过。",
531
+ importAppBound: "{count} 个受 Chrome 应用绑定加密保护,只能在网站上重新登录。",
532
+ clearBrowserData: "清除内置浏览器数据",
533
+ clearBrowserDataDetail: "删除内置浏览器的全部 Cookie、网站存储和缓存,网站都需要重新登录。",
534
+ clear: "清除",
535
+ cleared: "已清除内置浏览器数据",
536
+ done: "完成",
468
537
  binary: "二进制文件,不显示内容({size})。",
469
538
  truncated: "文件较大,只显示前 1 MB,不能编辑。",
470
539
  line: "第 {line} 行",
@@ -493,6 +562,22 @@ var EN = {
493
562
  copied: "Copied",
494
563
  findInFolder: "Find in Folder…",
495
564
  revealInExplorer: "Reveal in Explorer",
565
+ revealInFinder: "Reveal in Finder",
566
+ revealInFileExplorer: "Reveal in File Explorer",
567
+ openContainingFolder: "Open Containing Folder",
568
+ revealFailed: "Could not show it in the file manager: {message}",
569
+ uploadFiles: "Upload Files…",
570
+ uploadFolder: "Upload Folder…",
571
+ download: "Download",
572
+ uploading: "Uploading {name}",
573
+ uploaded: "Uploaded {count} file(s)",
574
+ uploadFailed: "Could not upload: {message}",
575
+ replaceTitle: "{names} already exists. Replace it?",
576
+ replaceMessage: "Files of the same name are overwritten by the uploaded ones.",
577
+ packing: "Packing {name}",
578
+ downloadFailed: "Could not download: {message}",
579
+ moveExists: "{name} already exists in the folder.",
580
+ moveFailed: "Could not move: {message}",
496
581
  nameEmpty: "A file or folder name must be provided.",
497
582
  nameSlash: "A file or folder name cannot start with a slash.",
498
583
  nameInvalid: "The name {name} is not valid as a file or folder name. Please choose a different name.",
@@ -581,11 +666,13 @@ var EN = {
581
666
  browser: "Browser",
582
667
  refresh: "Refresh",
583
668
  collapseAll: "Collapse all",
669
+ showExcluded: "Show files hidden by default (.git, .DS_Store…)",
584
670
  changeFolder: "Change folder",
585
671
  followConversation: "Back to the folder of the conversation ({name})",
586
672
  loading: "Loading…",
587
673
  empty: "Empty folder",
588
- noOpenFiles: "No files are open. Click a file in the explorer, search or source control.",
674
+ noOpenFiles: "No open files",
675
+ noOpenFilesHint: "Click a file in the explorer, search or source control",
589
676
  close: "Close",
590
677
  closeAll: "Close all",
591
678
  searchPlaceholder: "Search",
@@ -595,14 +682,22 @@ var EN = {
595
682
  noResults: "No results.",
596
683
  results: "{count} results in {files} files",
597
684
  moreResults: "Too many results; the first {count} are shown.",
598
- notRepository: "This folder is not a git repository.",
599
- noChanges: "No changes.",
685
+ notRepository: "This folder is not a git repository",
686
+ noChanges: "No changes",
600
687
  staged: "Staged changes",
601
688
  ahead: "{count} ahead",
602
689
  behind: "{count} behind",
603
690
  newTerminal: "New terminal",
604
- noTerminals: "No terminals are open.",
605
- terminalEnded: "[The process ended with code {code}]",
691
+ noTerminals: "No open terminals",
692
+ terminalEnded: "The process exited with code {code}",
693
+ restartTerminal: "Restart",
694
+ killTerminal: "Kill Terminal",
695
+ clearTerminal: "Clear",
696
+ paste: "Paste",
697
+ selectAll: "Select All",
698
+ renameTerminal: "Rename",
699
+ terminalKeys: "Terminal keys",
700
+ terminalAttention: "Needs attention",
606
701
  pipeMode: "The server has no script: the terminal runs on pipes, so full-screen programs (vim, top) and password prompts do not work.",
607
702
  address: "Enter an address or search",
608
703
  back: "Back",
@@ -613,7 +708,28 @@ var EN = {
613
708
  browserHint: "Enter an address or search, or open a dev server on this machine.",
614
709
  home: "Start page",
615
710
  removeRecent: "Remove from recent",
616
- frameHint: "Some sites refuse to be embedded; if the page stays blank, open it in a new window.",
711
+ frameHint: "Some sites refuse to be embedded; if the page stays blank, open it in a new window. Ta Desktop has no such limit.",
712
+ stop: "Stop",
713
+ openBrowser: "Open in the default browser",
714
+ loadFailed: "This page did not open",
715
+ pageCrashed: "This page crashed",
716
+ retry: "Retry",
717
+ agentDriving: "Ta is working here",
718
+ importSignIns: "Import sign-ins from your browser",
719
+ importTitle: "Import sign-ins",
720
+ importHint: "Copies the cookies of the browser you pick here, so you and the agent use the sites you are signed in to. Passwords and history are not imported.",
721
+ importFrom: "Import from",
722
+ noProfiles: "No profile of Chrome, Edge, Brave, Arc, Vivaldi or Chromium was found.",
723
+ importNow: "Import…",
724
+ importing: "Importing…",
725
+ imported: "{count} cookies imported",
726
+ importSkipped: "{count} could not be read and were skipped.",
727
+ importAppBound: "{count} are under Chrome's app-bound encryption: sign in again on those sites.",
728
+ clearBrowserData: "Clear browser data",
729
+ clearBrowserDataDetail: "Deletes every cookie, site storage and the cache of the browser of Ta: every site needs a sign-in again.",
730
+ clear: "Clear",
731
+ cleared: "Browser data cleared",
732
+ done: "Done",
617
733
  binary: "A binary file; its content is not shown ({size}).",
618
734
  truncated: "A large file: only the first 1 MB is shown, read-only.",
619
735
  line: "Line {line}",
@@ -823,10 +939,13 @@ var WorkspaceUtil;
823
939
  return index < 0 ? "" : path.slice(0, index);
824
940
  }
825
941
  WorkspaceUtil.dirname = dirname;
826
- function rows(children, expanded, root = "") {
942
+ function rows(children, expanded, hidden) {
827
943
  const out = [];
828
944
  const walk = (dir, depth) => {
829
945
  for (const entry of children.get(dir) ?? []) {
946
+ if (hidden?.(entry)) {
947
+ continue;
948
+ }
830
949
  const open = entry.kind === "directory" && expanded.has(entry.path);
831
950
  out.push({ entry, depth, expanded: open, loading: open && !children.has(entry.path) });
832
951
  if (open) {
@@ -834,7 +953,7 @@ var WorkspaceUtil;
834
953
  }
835
954
  }
836
955
  };
837
- walk(root, 0);
956
+ walk("", 0);
838
957
  return out;
839
958
  }
840
959
  WorkspaceUtil.rows = rows;
@@ -931,6 +1050,27 @@ var WorkspaceUtil;
931
1050
  return !folder || path === folder || path.startsWith(`${folder}/`);
932
1051
  }
933
1052
  WorkspaceUtil.within = within;
1053
+ function movable(paths2, folder) {
1054
+ const unique = [...new Set(paths2)].filter((path) => path && !within(folder, path) && dirname(path) !== folder);
1055
+ return unique.filter((path) => !unique.some((other) => other !== path && within(path, other)));
1056
+ }
1057
+ WorkspaceUtil.movable = movable;
1058
+ function movedTo(path, moved, folder) {
1059
+ const from = moved.find((source) => within(path, source));
1060
+ return from === undefined ? undefined : join(folder, basename(from)) + path.slice(from.length);
1061
+ }
1062
+ WorkspaceUtil.movedTo = movedTo;
1063
+ function shellQuote(path, windows = false) {
1064
+ if (/^[\w@%+=:,./-]+$/.test(path)) {
1065
+ return path;
1066
+ }
1067
+ return windows ? `"${path.replace(/"/g, '""')}"` : `'${path.replace(/'/g, "'\\''")}'`;
1068
+ }
1069
+ WorkspaceUtil.shellQuote = shellQuote;
1070
+ function fileManagerLabel(platform) {
1071
+ return platform === "darwin" ? "revealInFinder" : platform === "win32" ? "revealInFileExplorer" : "openContainingFolder";
1072
+ }
1073
+ WorkspaceUtil.fileManagerLabel = fileManagerLabel;
934
1074
  function groupMatches(matches) {
935
1075
  const files = new Map;
936
1076
  for (const match of matches) {
@@ -1024,6 +1164,16 @@ var WorkspaceUtil;
1024
1164
  return parsed.toString();
1025
1165
  }
1026
1166
  WorkspaceUtil.withPort = withPort;
1167
+ function unforward(url, asked, shown) {
1168
+ try {
1169
+ const from = new URL(shown ?? asked).origin;
1170
+ const to = new URL(asked).origin;
1171
+ return from !== to && url.startsWith(`${from}/`) ? `${to}${url.slice(from.length)}` : url;
1172
+ } catch {
1173
+ return url;
1174
+ }
1175
+ }
1176
+ WorkspaceUtil.unforward = unforward;
1027
1177
  function toUrl(input) {
1028
1178
  const text = input.trim();
1029
1179
  if (!text) {
@@ -1057,7 +1207,7 @@ var WorkspaceUtil;
1057
1207
  WorkspaceUtil.size = size;
1058
1208
  })(WorkspaceUtil ||= {});
1059
1209
 
1060
- // web-src/browser.tsx
1210
+ // web-src/browser-common.tsx
1061
1211
  var RECENT_KEY = "recent";
1062
1212
  var MAX_RECENT = 12;
1063
1213
  var Recent;
@@ -1117,7 +1267,37 @@ function parts(url) {
1117
1267
  return { host: url, rest: "" };
1118
1268
  }
1119
1269
  }
1120
- function AddressBar({ value, loading, onOpen }) {
1270
+ function AddressIcon({ value, loading, favicon }) {
1271
+ const [broken, setBroken] = React.useState();
1272
+ if (loading) {
1273
+ return /* @__PURE__ */ React.createElement("span", {
1274
+ className: "taw-spin"
1275
+ }, /* @__PURE__ */ React.createElement(Glyph, {
1276
+ name: "LoaderCircle",
1277
+ size: 14
1278
+ }));
1279
+ }
1280
+ if (favicon && broken !== favicon) {
1281
+ return /* @__PURE__ */ React.createElement("img", {
1282
+ className: "taw-address-favicon",
1283
+ src: favicon,
1284
+ alt: "",
1285
+ referrerPolicy: "no-referrer",
1286
+ onError: () => setBroken(favicon)
1287
+ });
1288
+ }
1289
+ return /* @__PURE__ */ React.createElement(Glyph, {
1290
+ name: value ? "Globe" : "Search",
1291
+ size: 14
1292
+ });
1293
+ }
1294
+ function AddressBar({
1295
+ value,
1296
+ title,
1297
+ loading,
1298
+ favicon,
1299
+ onOpen
1300
+ }) {
1121
1301
  const [text, setText] = React.useState(value);
1122
1302
  React.useEffect(() => setText(value), [value]);
1123
1303
  return /* @__PURE__ */ React.createElement("form", {
@@ -1132,18 +1312,15 @@ function AddressBar({ value, loading, onOpen }) {
1132
1312
  }
1133
1313
  }, /* @__PURE__ */ React.createElement("span", {
1134
1314
  className: "taw-address-icon"
1135
- }, loading ? /* @__PURE__ */ React.createElement("span", {
1136
- className: "taw-spin"
1137
- }, /* @__PURE__ */ React.createElement(Glyph, {
1138
- name: "LoaderCircle",
1139
- size: 14
1140
- })) : /* @__PURE__ */ React.createElement(Glyph, {
1141
- name: value ? "Globe" : "Search",
1142
- size: 14
1315
+ }, /* @__PURE__ */ React.createElement(AddressIcon, {
1316
+ value,
1317
+ loading,
1318
+ favicon
1143
1319
  })), /* @__PURE__ */ React.createElement("input", {
1144
1320
  value: text,
1145
1321
  placeholder: t("address"),
1146
1322
  "aria-label": t("address"),
1323
+ title: title || undefined,
1147
1324
  spellCheck: false,
1148
1325
  autoComplete: "off",
1149
1326
  onFocus: (event) => event.target.select(),
@@ -1164,7 +1341,50 @@ function AddressBar({ value, loading, onOpen }) {
1164
1341
  size: 14
1165
1342
  })) : undefined);
1166
1343
  }
1167
- function Home({ onOpen }) {
1344
+ function BrowserBar(props) {
1345
+ const { url, loading, onStop } = props;
1346
+ return /* @__PURE__ */ React.createElement("header", {
1347
+ className: "taw-browser-bar"
1348
+ }, /* @__PURE__ */ React.createElement(Action, {
1349
+ icon: "ArrowLeft",
1350
+ label: t("back"),
1351
+ disabled: !props.canGoBack,
1352
+ onClick: props.onBack
1353
+ }), /* @__PURE__ */ React.createElement(Action, {
1354
+ icon: "ArrowRight",
1355
+ label: t("forward"),
1356
+ disabled: !props.canGoForward,
1357
+ onClick: props.onForward
1358
+ }), loading && onStop ? /* @__PURE__ */ React.createElement(Action, {
1359
+ icon: "X",
1360
+ label: t("stop"),
1361
+ onClick: onStop
1362
+ }) : /* @__PURE__ */ React.createElement(Action, {
1363
+ icon: "RefreshCw",
1364
+ label: t("refresh"),
1365
+ disabled: !url,
1366
+ onClick: props.onReload
1367
+ }), /* @__PURE__ */ React.createElement(AddressBar, {
1368
+ value: url,
1369
+ title: props.title,
1370
+ loading,
1371
+ favicon: props.favicon,
1372
+ onOpen: props.onOpen
1373
+ }), props.badge, /* @__PURE__ */ React.createElement(Action, {
1374
+ icon: "House",
1375
+ label: t("home"),
1376
+ disabled: !url,
1377
+ onClick: props.onHome
1378
+ }), /* @__PURE__ */ React.createElement(Action, {
1379
+ icon: "ExternalLink",
1380
+ label: props.outsideLabel,
1381
+ disabled: !props.onOpenOutside,
1382
+ onClick: () => props.onOpenOutside?.()
1383
+ }), loading ? /* @__PURE__ */ React.createElement("span", {
1384
+ className: "taw-browser-loading"
1385
+ }) : undefined);
1386
+ }
1387
+ function Home({ onOpen, foot, extra }) {
1168
1388
  const recent = React.useSyncExternalStore(Recent.subscribe, Recent.all);
1169
1389
  return /* @__PURE__ */ React.createElement("div", {
1170
1390
  className: `taw-browser-home ${recent.length === 0 ? "taw-browser-blank" : ""}`
@@ -1186,7 +1406,7 @@ function Home({ onOpen }) {
1186
1406
  key: address,
1187
1407
  className: "taw-browser-chip",
1188
1408
  onClick: () => onOpen(`http://${address}`)
1189
- }, address))) : undefined), recent.length > 0 ? /* @__PURE__ */ React.createElement("section", {
1409
+ }, address))) : undefined, extra), recent.length > 0 ? /* @__PURE__ */ React.createElement("section", {
1190
1410
  className: "taw-browser-recent"
1191
1411
  }, /* @__PURE__ */ React.createElement("h3", {
1192
1412
  className: "taw-browser-heading"
@@ -1216,9 +1436,9 @@ function Home({ onOpen }) {
1216
1436
  name: "X",
1217
1437
  size: 13
1218
1438
  })));
1219
- })) : undefined, /* @__PURE__ */ React.createElement("p", {
1439
+ })) : undefined, foot ? /* @__PURE__ */ React.createElement("p", {
1220
1440
  className: "taw-browser-foot"
1221
- }, t("frameHint")));
1441
+ }, foot) : undefined);
1222
1442
  }
1223
1443
  var ShowPage = new Channel;
1224
1444
  function useForwarded(url, cwd) {
@@ -1240,81 +1460,966 @@ function useForwarded(url, cwd) {
1240
1460
  }
1241
1461
  return forwarded?.url === url ? forwarded.to : undefined;
1242
1462
  }
1243
- function BrowserView() {
1244
- const [history, setHistory] = React.useState({ list: [""], index: 0, reloads: 0 });
1245
- const [loading, setLoading] = React.useState(false);
1246
- const url = history.list[history.index];
1247
- const shown = useForwarded(url, pi.ui.useCwd());
1248
- const go = (next) => {
1249
- if (next) {
1250
- Recent.add(next);
1463
+ function openOutside(url) {
1464
+ window.open(url, "_blank", "noopener,noreferrer");
1465
+ }
1466
+
1467
+ // web-src/util/browser-snapshot.ts
1468
+ var ACTIONABLE = new Set([
1469
+ "button",
1470
+ "checkbox",
1471
+ "combobox",
1472
+ "link",
1473
+ "listbox",
1474
+ "menuitem",
1475
+ "menuitemcheckbox",
1476
+ "menuitemradio",
1477
+ "option",
1478
+ "radio",
1479
+ "searchbox",
1480
+ "slider",
1481
+ "spinbutton",
1482
+ "switch",
1483
+ "tab",
1484
+ "textbox",
1485
+ "treeitem"
1486
+ ]);
1487
+ var SKIPPED = new Set(["none", "presentation", "InlineTextBox", "LineBreak"]);
1488
+ var TRANSPARENT = new Set([
1489
+ "generic",
1490
+ "group",
1491
+ "paragraph",
1492
+ "Section",
1493
+ "LayoutTable",
1494
+ "LayoutTableRow",
1495
+ "LayoutTableCell",
1496
+ "LabelText",
1497
+ "RootWebArea",
1498
+ "WebArea"
1499
+ ]);
1500
+ var STATES = ["focused", "checked", "selected", "pressed", "disabled", "required", "readonly", "invalid"];
1501
+ var MAX_NAME = 120;
1502
+ var MODIFIERS = { alt: 1, option: 1, control: 2, ctrl: 2, meta: 4, cmd: 4, command: 4, shift: 8 };
1503
+ var NAMED = {
1504
+ Enter: [13, "\r"],
1505
+ Tab: [9],
1506
+ Escape: [27],
1507
+ Backspace: [8],
1508
+ Delete: [46],
1509
+ ArrowUp: [38],
1510
+ ArrowDown: [40],
1511
+ ArrowLeft: [37],
1512
+ ArrowRight: [39],
1513
+ Home: [36],
1514
+ End: [35],
1515
+ PageUp: [33],
1516
+ PageDown: [34],
1517
+ Space: [32, " "]
1518
+ };
1519
+ var BrowserSnapshot;
1520
+ ((BrowserSnapshot) => {
1521
+ function text(value, max = MAX_NAME) {
1522
+ const line = String(value ?? "").replace(/\s+/g, " ").trim();
1523
+ return line.length > max ? `${line.slice(0, max - 1)}…` : line;
1524
+ }
1525
+ function property(node, name) {
1526
+ return node.properties?.find((item) => item.name === name)?.value?.value;
1527
+ }
1528
+ function render(nodes, maxLines = 800) {
1529
+ const byId = new Map(nodes.map((node) => [node.nodeId, node]));
1530
+ const lines = [];
1531
+ let more = 0;
1532
+ const add = (line) => {
1533
+ if (lines.length < maxLines) {
1534
+ lines.push(line);
1535
+ } else {
1536
+ more++;
1537
+ }
1538
+ };
1539
+ const visit = (node, depth, parentName, inActionable = false) => {
1540
+ const role = String(node.role?.value ?? "");
1541
+ const name = text(node.name?.value);
1542
+ const children = (node.childIds ?? []).map((id) => byId.get(id)).filter((child) => child !== undefined);
1543
+ const pass = (nextDepth, nextName, nextInActionable = inActionable) => {
1544
+ for (const child of children) {
1545
+ visit(child, nextDepth, nextName, nextInActionable);
1546
+ }
1547
+ };
1548
+ if (node.ignored || SKIPPED.has(role)) {
1549
+ pass(depth, parentName);
1550
+ return;
1551
+ }
1552
+ if (role === "StaticText") {
1553
+ if (name && !parentName.includes(name)) {
1554
+ add(`${" ".repeat(depth)}${JSON.stringify(name)}`);
1555
+ }
1556
+ return;
1557
+ }
1558
+ const actionable = (ACTIONABLE.has(role) || property(node, "editable") !== undefined && !inActionable) && node.backendDOMNodeId !== undefined;
1559
+ if (!actionable && TRANSPARENT.has(role) && !name) {
1560
+ pass(depth, parentName);
1561
+ return;
1562
+ }
1563
+ let line = `${" ".repeat(depth)}${actionable ? `[${node.backendDOMNodeId}] ` : ""}${role}${name ? ` ${JSON.stringify(name)}` : ""}`;
1564
+ const level = property(node, "level");
1565
+ if (level !== undefined) {
1566
+ line += ` level=${level}`;
1567
+ }
1568
+ const states = STATES.filter((state) => {
1569
+ const value2 = property(node, state);
1570
+ return value2 === true || value2 === "true" || value2 === "mixed";
1571
+ }).map((state) => property(node, state) === "mixed" ? `${state}=mixed` : state);
1572
+ const expanded = property(node, "expanded");
1573
+ if (expanded !== undefined) {
1574
+ states.push(expanded ? "expanded" : "collapsed");
1575
+ }
1576
+ if (states.length > 0) {
1577
+ line += ` (${states.join(", ")})`;
1578
+ }
1579
+ const value = text(node.value?.value);
1580
+ if (value && value !== name) {
1581
+ line += ` value=${JSON.stringify(value)}`;
1582
+ }
1583
+ const description = text(node.description?.value, 80);
1584
+ if (description && description !== name) {
1585
+ line += ` description=${JSON.stringify(description)}`;
1586
+ }
1587
+ add(line);
1588
+ pass(depth + 1, name, inActionable || actionable);
1589
+ };
1590
+ for (const root of nodes.filter((node) => !node.parentId || !byId.has(node.parentId))) {
1591
+ visit(root, 0, "");
1251
1592
  }
1252
- setLoading(Boolean(next));
1253
- setHistory((previous) => ({ list: [...previous.list.slice(0, previous.index + 1), next], index: previous.index + 1, reloads: 0 }));
1593
+ if (more > 0) {
1594
+ lines.push(`… ${more} more lines: scroll, or evaluate to read a part of the page.`);
1595
+ }
1596
+ return lines.length > 0 ? lines.join(`
1597
+ `) : "(the page shows nothing to read yet)";
1598
+ }
1599
+ BrowserSnapshot.render = render;
1600
+ function center(quad) {
1601
+ const xs = [quad[0], quad[2], quad[4], quad[6]];
1602
+ const ys = [quad[1], quad[3], quad[5], quad[7]];
1603
+ return { x: (Math.min(...xs) + Math.max(...xs)) / 2, y: (Math.min(...ys) + Math.max(...ys)) / 2 };
1604
+ }
1605
+ BrowserSnapshot.center = center;
1606
+ function key(input) {
1607
+ const parts2 = input.split("+");
1608
+ const name = input.endsWith("++") || input === "+" ? "+" : parts2.pop();
1609
+ if (!name) {
1610
+ return;
1611
+ }
1612
+ let modifiers = 0;
1613
+ for (const part of input === "+" ? [] : parts2.filter(Boolean)) {
1614
+ const bit = MODIFIERS[part.toLowerCase()];
1615
+ if (bit === undefined) {
1616
+ return;
1617
+ }
1618
+ modifiers |= bit;
1619
+ }
1620
+ const shortcut = (modifiers & (2 | 4)) !== 0;
1621
+ const named = Object.keys(NAMED).find((candidate) => candidate.toLowerCase() === name.toLowerCase());
1622
+ if (named) {
1623
+ const [code, typed] = NAMED[named];
1624
+ return {
1625
+ key: named === "Space" ? " " : named,
1626
+ code: named,
1627
+ windowsVirtualKeyCode: code,
1628
+ modifiers,
1629
+ ...typed && !shortcut ? { text: typed } : {}
1630
+ };
1631
+ }
1632
+ const fn = /^F([1-9]|1[0-2])$/i.exec(name);
1633
+ if (fn) {
1634
+ return { key: `F${fn[1]}`, code: `F${fn[1]}`, windowsVirtualKeyCode: 111 + Number(fn[1]), modifiers };
1635
+ }
1636
+ if ([...name].length !== 1) {
1637
+ return;
1638
+ }
1639
+ const shifted = (modifiers & 8) !== 0;
1640
+ const letter = /^[a-z]$/i.test(name);
1641
+ const digit = /^[0-9]$/.test(name);
1642
+ const key2 = letter ? shifted ? name.toUpperCase() : name.toLowerCase() : name;
1643
+ return {
1644
+ key: key2,
1645
+ code: letter ? `Key${name.toUpperCase()}` : digit ? `Digit${name}` : "",
1646
+ windowsVirtualKeyCode: letter ? name.toUpperCase().charCodeAt(0) : digit ? name.charCodeAt(0) : 0,
1647
+ modifiers,
1648
+ ...shortcut ? {} : { text: key2 }
1649
+ };
1650
+ }
1651
+ BrowserSnapshot.key = key;
1652
+ })(BrowserSnapshot ||= {});
1653
+
1654
+ // web-src/browser-agent.ts
1655
+ var ACTIONS = ["navigate", "back", "forward", "reload", "snapshot", "click", "type", "press", "scroll", "screenshot", "evaluate", "wait", "cdp"];
1656
+ var MAX_OUTPUT = 20000;
1657
+ var TYPE_INTO = `function (text) {
1658
+ this.focus();
1659
+ if (typeof this.select === 'function') {
1660
+ this.select();
1661
+ } else {
1662
+ const range = document.createRange();
1663
+ range.selectNodeContents(this);
1664
+ getSelection().removeAllRanges();
1665
+ getSelection().addRange(range);
1666
+ }
1667
+ const typed = text ? document.execCommand('insertText', false, text) : document.execCommand('delete');
1668
+ if (!typed && 'value' in this) {
1669
+ const setter = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this), 'value')?.set;
1670
+ setter ? setter.call(this, text) : (this.value = text);
1671
+ this.dispatchEvent(new Event('input', { bubbles: true }));
1672
+ this.dispatchEvent(new Event('change', { bubbles: true }));
1673
+ }
1674
+ }`;
1675
+ var MAX_WAIT_MS = 30000;
1676
+ var KEY_FOCUS_MS = 50;
1677
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1678
+ async function until(ready, ms) {
1679
+ const end = Date.now() + ms;
1680
+ for (;; ) {
1681
+ const value = ready();
1682
+ if (value !== undefined || Date.now() >= end) {
1683
+ return value;
1684
+ }
1685
+ await sleep(50);
1686
+ }
1687
+ }
1688
+ function clip(text) {
1689
+ return text.length > MAX_OUTPUT ? `${text.slice(0, MAX_OUTPUT)}
1690
+ … cut at ${MAX_OUTPUT} characters` : text;
1691
+ }
1692
+ var AgentBrowser;
1693
+ ((AgentBrowser) => {
1694
+ let handle;
1695
+ let snapshot;
1696
+ function attach(next) {
1697
+ handle = next;
1698
+ return () => {
1699
+ if (handle === next) {
1700
+ handle = undefined;
1701
+ }
1702
+ };
1703
+ }
1704
+ AgentBrowser.attach = attach;
1705
+ AgentBrowser.TOOL = {
1706
+ name: "browser",
1707
+ description: [
1708
+ "Works the browser in Ta's workbench, on the user's machine: the user sees it, and it keeps the user's sign-ins to sites.",
1709
+ "Actions:",
1710
+ "- navigate {url}: open a page (http or https); back, forward, reload",
1711
+ "- snapshot: the page as an accessibility tree, one element a line; what one acts on starts with its ref in brackets, [12]",
1712
+ "- click {ref} or {x, y}: click it; x and y are CSS pixels of the screenshot",
1713
+ "- type {ref, text, submit?}: replace the text of a field with text; submit presses Enter after",
1714
+ '- press {key}: a key or a shortcut: "Enter", "Escape", "Tab", "ArrowDown", "a", "Control+A", "Meta+Shift+Z"',
1715
+ '- scroll {direction: "down" | "up", amount?}: by amount pixels, a screen by default; or {ref}: until it is shown',
1716
+ "- screenshot: what is shown, as a data URL of a JPEG (in codemode, give it to image() to look at it)",
1717
+ "- evaluate {expression}: run JavaScript in the page; the JSON of its value, awaited",
1718
+ "- wait {text?, ms?}: until the page shows text, or for ms milliseconds; at most 30000",
1719
+ "- cdp {method, params?}: a command of the Chrome DevTools Protocol to the page (Accessibility, CSS, DOM, DOMSnapshot, Emulation, Input, Log, Overlay, Page, Runtime)",
1720
+ "After an action it says the title and address of the page; refs change when the page does, so take a snapshot again before acting on a new page."
1721
+ ].join(`
1722
+ `),
1723
+ parameters: {
1724
+ type: "object",
1725
+ properties: {
1726
+ action: { type: "string", enum: [...ACTIONS] },
1727
+ url: { type: "string" },
1728
+ ref: { type: "integer", description: "The number in brackets in the last snapshot." },
1729
+ x: { type: "number" },
1730
+ y: { type: "number" },
1731
+ text: { type: "string" },
1732
+ submit: { type: "boolean" },
1733
+ key: { type: "string" },
1734
+ direction: { type: "string", enum: ["down", "up"] },
1735
+ amount: { type: "number" },
1736
+ expression: { type: "string" },
1737
+ ms: { type: "number" },
1738
+ method: { type: "string" },
1739
+ params: { type: "object" }
1740
+ },
1741
+ required: ["action"]
1742
+ },
1743
+ execute: (_toolCallId, params) => run(params)
1254
1744
  };
1255
- const step = (delta) => {
1256
- const index = Math.min(history.list.length - 1, Math.max(0, history.index + delta));
1257
- if (index !== history.index) {
1258
- setLoading(Boolean(history.list[index]));
1259
- setHistory({ ...history, index });
1745
+ async function run(params) {
1746
+ const action = params.action;
1747
+ if (!ACTIONS.includes(action)) {
1748
+ throw new Error(`Unknown action ${JSON.stringify(params.action)}: use one of ${ACTIONS.join(", ")}.`);
1749
+ }
1750
+ const browser = await open();
1751
+ browser.drive();
1752
+ if (action === "navigate") {
1753
+ const url = WorkspaceUtil.toUrl(String(params.url ?? ""));
1754
+ if (!url || !/^https?:\/\//i.test(url)) {
1755
+ throw new Error("navigate opens pages of the web: give an http or https url.");
1756
+ }
1757
+ const before = browser.view()?.getURL();
1758
+ browser.go(url);
1759
+ await settle(browser, before);
1760
+ return status(page(browser));
1761
+ }
1762
+ if (action === "wait" && !params.text) {
1763
+ await sleep(Math.min(MAX_WAIT_MS, Number(params.ms) > 0 ? Number(params.ms) : 1000));
1764
+ const shown = browser.view();
1765
+ return shown ? status(shown) : "No page is open.";
1766
+ }
1767
+ const view = page(browser);
1768
+ const send = (method, args = {}) => command(view, method, args);
1769
+ switch (action) {
1770
+ case "back":
1771
+ case "forward":
1772
+ case "reload": {
1773
+ const before = view.getURL();
1774
+ if (action === "back" && !view.canGoBack()) {
1775
+ throw new Error("There is no page to go back to.");
1776
+ }
1777
+ if (action === "forward" && !view.canGoForward()) {
1778
+ throw new Error("There is no page to go forward to.");
1779
+ }
1780
+ if (action === "back") {
1781
+ view.goBack();
1782
+ } else if (action === "forward") {
1783
+ view.goForward();
1784
+ } else {
1785
+ view.reload();
1786
+ }
1787
+ await settle(browser, action === "reload" ? undefined : before);
1788
+ return status(view);
1789
+ }
1790
+ case "snapshot": {
1791
+ const document2 = await documentOf(send);
1792
+ await send("Accessibility.enable");
1793
+ let text = "";
1794
+ for (let attempt = 0;attempt < 10; attempt++) {
1795
+ const { nodes } = await send("Accessibility.getFullAXTree");
1796
+ text = BrowserSnapshot.render(nodes);
1797
+ if (text.includes(`
1798
+ `) || !(await evaluate(send, "Boolean(document.body && document.body.childElementCount)").catch(() => "false")).includes("true")) {
1799
+ break;
1800
+ }
1801
+ await sleep(200);
1802
+ }
1803
+ snapshot = { document: document2, refs: new Set([...text.matchAll(/^\s*\[(\d+)\]/gm)].map((match) => Number(match[1]))) };
1804
+ return clip(`${status(view)}
1805
+
1806
+ ${text}`);
1807
+ }
1808
+ case "click": {
1809
+ const point = params.ref === undefined ? { x: Number(params.x), y: Number(params.y) } : await locate(send, await ref(send, params.ref));
1810
+ if (!Number.isFinite(point.x) || !Number.isFinite(point.y)) {
1811
+ throw new Error("click needs a ref, or x and y.");
1812
+ }
1813
+ const before = view.getURL();
1814
+ const focused = document.activeElement;
1815
+ await send("Input.dispatchMouseEvent", { type: "mouseMoved", ...point });
1816
+ await send("Input.dispatchMouseEvent", { type: "mousePressed", button: "left", clickCount: 1, ...point });
1817
+ await send("Input.dispatchMouseEvent", { type: "mouseReleased", button: "left", clickCount: 1, ...point });
1818
+ if (focused instanceof HTMLElement && focused !== view && document.activeElement === view) {
1819
+ focused.focus({ preventScroll: true });
1820
+ }
1821
+ await settle(browser, before, 300);
1822
+ return status(view);
1823
+ }
1824
+ case "type": {
1825
+ const backendNodeId = await ref(send, params.ref);
1826
+ await send("DOM.focus", { backendNodeId }).catch((error) => stale(error, backendNodeId));
1827
+ const { object } = await send("DOM.resolveNode", { backendNodeId });
1828
+ await send("Runtime.callFunctionOn", {
1829
+ objectId: object.objectId,
1830
+ functionDeclaration: TYPE_INTO,
1831
+ arguments: [{ value: String(params.text ?? "") }],
1832
+ userGesture: true
1833
+ });
1834
+ const before = view.getURL();
1835
+ if (params.submit === true) {
1836
+ await press(view, send, "Enter");
1837
+ }
1838
+ await settle(browser, before, 300);
1839
+ return status(view);
1840
+ }
1841
+ case "press": {
1842
+ const before = view.getURL();
1843
+ await press(view, send, String(params.key ?? ""));
1844
+ await settle(browser, before, 300);
1845
+ return status(view);
1846
+ }
1847
+ case "scroll": {
1848
+ if (params.ref !== undefined) {
1849
+ const backendNodeId = await ref(send, params.ref);
1850
+ await send("DOM.scrollIntoViewIfNeeded", { backendNodeId }).catch((error) => stale(error, backendNodeId));
1851
+ } else {
1852
+ const { cssLayoutViewport: viewport } = await send("Page.getLayoutMetrics");
1853
+ const amount = Number(params.amount) > 0 ? Number(params.amount) : Math.round(viewport.clientHeight * 0.8);
1854
+ await send("Input.dispatchMouseEvent", {
1855
+ type: "mouseWheel",
1856
+ x: viewport.clientWidth / 2,
1857
+ y: viewport.clientHeight / 2,
1858
+ deltaX: 0,
1859
+ deltaY: params.direction === "up" ? -amount : amount
1860
+ });
1861
+ await sleep(250);
1862
+ }
1863
+ const where = await evaluate(send, "[Math.round(scrollY), document.documentElement.scrollHeight, innerHeight]");
1864
+ const [top, height, shown] = JSON.parse(where);
1865
+ return `${status(view)}
1866
+ Scrolled to ${top} of ${height} pixels, ${shown} shown.`;
1867
+ }
1868
+ case "screenshot": {
1869
+ const { cssVisualViewport: viewport } = await send("Page.getLayoutMetrics");
1870
+ const ratio = Number(await evaluate(send, "devicePixelRatio")) || 1;
1871
+ const { data } = await send("Page.captureScreenshot", {
1872
+ format: "jpeg",
1873
+ quality: 70,
1874
+ clip: { x: viewport.pageX, y: viewport.pageY, width: viewport.clientWidth, height: viewport.clientHeight, scale: 1 / ratio }
1875
+ });
1876
+ return `data:image/jpeg;base64,${data}`;
1877
+ }
1878
+ case "evaluate":
1879
+ return clip(await evaluate(send, String(params.expression ?? "")));
1880
+ case "wait": {
1881
+ const ms = Math.min(MAX_WAIT_MS, Number(params.ms) > 0 ? Number(params.ms) : 1e4);
1882
+ const probe = `Boolean(document.body && document.body.innerText.includes(${JSON.stringify(params.text)}))`;
1883
+ const end = Date.now() + ms;
1884
+ while (Date.now() < end) {
1885
+ if (await evaluate(send, probe).catch(() => "false") === "true") {
1886
+ return status(view);
1887
+ }
1888
+ await sleep(250);
1889
+ }
1890
+ throw new Error(`The page did not show ${JSON.stringify(params.text)} in ${ms} ms.`);
1891
+ }
1892
+ case "cdp": {
1893
+ const method = String(params.method ?? "");
1894
+ const args = params.params && typeof params.params === "object" ? params.params : {};
1895
+ return clip(JSON.stringify(await send(method, args) ?? null));
1896
+ }
1897
+ }
1898
+ throw new Error(`Unknown action ${action}.`);
1899
+ }
1900
+ async function open() {
1901
+ if (!pi.ui.debugWebview) {
1902
+ throw new Error("The browser of Ta can be worked in Ta Desktop only.");
1903
+ }
1904
+ if (!handle?.shown()) {
1905
+ pi.ui.showView(`${PACKAGE}/browser`);
1906
+ }
1907
+ const opened = await until(() => handle, 5000);
1908
+ if (!opened) {
1909
+ throw new Error("The browser did not open.");
1910
+ }
1911
+ return opened;
1912
+ }
1913
+ function page(browser) {
1914
+ const view = browser.view();
1915
+ if (!view) {
1916
+ throw new Error("No page is open: navigate to one first.");
1917
+ }
1918
+ return view;
1919
+ }
1920
+ async function command(view, method, args) {
1921
+ const debug = pi.ui.debugWebview;
1922
+ if (!debug) {
1923
+ throw new Error("The browser of Ta can be worked in Ta Desktop only.");
1924
+ }
1925
+ return debug(view.getWebContentsId(), method, args);
1926
+ }
1927
+ async function settle(browser, before, grace = 150) {
1928
+ await sleep(grace);
1929
+ const view = await until(() => browser.view(), 15000);
1930
+ if (!view) {
1931
+ return;
1932
+ }
1933
+ const end = Date.now() + 15000;
1934
+ while (view.isLoading() && Date.now() < end) {
1935
+ await sleep(100);
1936
+ }
1937
+ if (before !== undefined && view.getURL() === before) {
1938
+ return;
1939
+ }
1940
+ while (Date.now() < end) {
1941
+ const state = await command(view, "Runtime.evaluate", { expression: "document.readyState", returnByValue: true }).catch(() => {
1942
+ return;
1943
+ });
1944
+ if (state?.result?.value !== "loading") {
1945
+ return;
1946
+ }
1947
+ await sleep(100);
1948
+ }
1949
+ }
1950
+ function status(view) {
1951
+ const title = view.getTitle();
1952
+ const url = view.getURL();
1953
+ return title && title !== url ? `Page: ${title} — ${url}` : `Page: ${url}`;
1954
+ }
1955
+ async function documentOf(send) {
1956
+ const { frameTree } = await send("Page.getFrameTree");
1957
+ return frameTree.frame.loaderId;
1958
+ }
1959
+ async function ref(send, value) {
1960
+ const id = Number(value);
1961
+ if (!Number.isInteger(id) || id <= 0) {
1962
+ throw new Error("ref is the number in brackets of an element in the last snapshot.");
1963
+ }
1964
+ if (!snapshot || snapshot.document !== await documentOf(send)) {
1965
+ throw new Error("The page changed since the last snapshot: take a snapshot, then use its refs.");
1966
+ }
1967
+ if (!snapshot.refs.has(id)) {
1968
+ throw new Error(`[${id}] is not a ref of the last snapshot.`);
1969
+ }
1970
+ return id;
1971
+ }
1972
+ function stale(error, id) {
1973
+ const message = error instanceof Error ? error.message : String(error);
1974
+ throw new Error(/node/i.test(message) ? `The element [${id}] is not on the page any more: take a snapshot again.` : message);
1975
+ }
1976
+ async function locate(send, backendNodeId) {
1977
+ await send("DOM.scrollIntoViewIfNeeded", { backendNodeId }).catch((error) => stale(error, backendNodeId));
1978
+ const { quads } = await send("DOM.getContentQuads", { backendNodeId }).catch((error) => stale(error, backendNodeId));
1979
+ if (!quads?.length) {
1980
+ throw new Error(`The element [${backendNodeId}] is not shown: scroll to it, or take a snapshot again.`);
1981
+ }
1982
+ return BrowserSnapshot.center(quads[0]);
1983
+ }
1984
+ async function press(view, send, name) {
1985
+ const key = BrowserSnapshot.key(name);
1986
+ if (!key) {
1987
+ throw new Error(`${JSON.stringify(name)} is not a key: use names such as Enter, Tab, Escape, ArrowDown, a, Control+A.`);
1988
+ }
1989
+ const { text, ...event } = key;
1990
+ const focused = document.activeElement;
1991
+ if (focused !== view) {
1992
+ view.focus();
1993
+ await sleep(KEY_FOCUS_MS);
1994
+ }
1995
+ try {
1996
+ await send("Input.dispatchKeyEvent", { type: text ? "keyDown" : "rawKeyDown", ...event, ...text ? { text, unmodifiedText: text } : {} });
1997
+ await send("Input.dispatchKeyEvent", { type: "keyUp", ...event });
1998
+ } finally {
1999
+ if (focused instanceof HTMLElement && focused !== view) {
2000
+ await sleep(KEY_FOCUS_MS);
2001
+ focused.focus({ preventScroll: true });
2002
+ }
2003
+ }
2004
+ }
2005
+ async function evaluate(send, expression) {
2006
+ const { result, exceptionDetails } = await send("Runtime.evaluate", { expression, returnByValue: true, awaitPromise: true, userGesture: true });
2007
+ if (exceptionDetails) {
2008
+ throw new Error(exceptionDetails.exception?.description ?? exceptionDetails.text ?? "The expression threw.");
2009
+ }
2010
+ if (result?.type === "undefined") {
2011
+ return "undefined";
2012
+ }
2013
+ return result && "value" in result ? JSON.stringify(result.value) ?? String(result.value) : result?.description ?? "undefined";
2014
+ }
2015
+ })(AgentBrowser ||= {});
2016
+
2017
+ // web-src/browser-import.tsx
2018
+ function ImportDialog({ data, onClose, onChanged }) {
2019
+ const [profiles, setProfiles] = React.useState();
2020
+ const [chosen, setChosen] = React.useState();
2021
+ const [step, setStep] = React.useState({ kind: "pick" });
2022
+ const [error, setError] = React.useState();
2023
+ React.useEffect(() => {
2024
+ data.profiles().then((list) => {
2025
+ setProfiles(list);
2026
+ setChosen(list[0]?.id);
2027
+ }, (failure) => setError(Host.message(failure)));
2028
+ }, [data]);
2029
+ const run = async (action) => {
2030
+ setError(undefined);
2031
+ setStep({ kind: "working" });
2032
+ try {
2033
+ setStep(await action() ?? { kind: "pick" });
2034
+ } catch (failure) {
2035
+ setError(Host.message(failure));
2036
+ setStep({ kind: "pick" });
1260
2037
  }
1261
2038
  };
1262
- ShowPage.useReceive(go);
1263
- const reload = () => {
1264
- setLoading(true);
1265
- setHistory((previous) => ({ ...previous, reloads: previous.reloads + 1 }));
2039
+ const take = () => run(async () => {
2040
+ const report = chosen ? await data.import(chosen) : undefined;
2041
+ if (report) {
2042
+ onChanged();
2043
+ }
2044
+ return report && { kind: "done", report };
2045
+ });
2046
+ const clear = async () => {
2047
+ if (await pi.ui.confirm(t("clearBrowserData"), t("clearBrowserDataDetail"), { confirmLabel: t("clear"), danger: true })) {
2048
+ await run(async () => {
2049
+ await data.clear();
2050
+ onChanged();
2051
+ return { kind: "cleared" };
2052
+ });
2053
+ }
1266
2054
  };
1267
- return /* @__PURE__ */ React.createElement("div", {
1268
- className: "taw-browser"
1269
- }, /* @__PURE__ */ React.createElement("header", {
1270
- className: "taw-browser-bar"
1271
- }, /* @__PURE__ */ React.createElement(Action, {
1272
- icon: "ArrowLeft",
1273
- label: t("back"),
1274
- disabled: history.index === 0,
1275
- onClick: () => step(-1)
1276
- }), /* @__PURE__ */ React.createElement(Action, {
1277
- icon: "ArrowRight",
1278
- label: t("forward"),
1279
- disabled: history.index === history.list.length - 1,
1280
- onClick: () => step(1)
1281
- }), /* @__PURE__ */ React.createElement(Action, {
1282
- icon: "RefreshCw",
1283
- label: t("refresh"),
1284
- disabled: !url,
1285
- onClick: reload
1286
- }), /* @__PURE__ */ React.createElement(AddressBar, {
1287
- value: url,
1288
- loading,
1289
- onOpen: go
1290
- }), /* @__PURE__ */ React.createElement(Action, {
1291
- icon: "House",
1292
- label: t("home"),
1293
- disabled: !url,
1294
- onClick: () => go("")
1295
- }), /* @__PURE__ */ React.createElement(Action, {
1296
- icon: "ExternalLink",
1297
- label: t("openExternal"),
1298
- disabled: !shown,
1299
- onClick: () => shown && window.open(shown, "_blank", "noopener,noreferrer")
1300
- }), loading ? /* @__PURE__ */ React.createElement("span", {
1301
- className: "taw-browser-loading"
1302
- }) : undefined), url ? shown && /* @__PURE__ */ React.createElement("iframe", {
1303
- key: `${history.index}:${history.reloads}`,
1304
- className: "taw-frame",
1305
- title: shown === url ? url : `${url} → ${shown}`,
1306
- src: shown,
1307
- referrerPolicy: "no-referrer",
1308
- sandbox: WorkspaceUtil.frameSandbox(shown, location.origin),
1309
- onLoad: () => setLoading(false)
1310
- }) : /* @__PURE__ */ React.createElement(Home, {
1311
- onOpen: go
1312
- }));
2055
+ const working = step.kind === "working";
2056
+ let body;
2057
+ if (step.kind === "done" || step.kind === "cleared") {
2058
+ const report = step.kind === "done" ? step.report : undefined;
2059
+ body = /* @__PURE__ */ React.createElement("div", {
2060
+ className: "taw-import-result"
2061
+ }, /* @__PURE__ */ React.createElement("span", {
2062
+ className: "taw-browser-mark"
2063
+ }, /* @__PURE__ */ React.createElement(Glyph, {
2064
+ name: "Check",
2065
+ size: 22
2066
+ })), /* @__PURE__ */ React.createElement("p", {
2067
+ className: "taw-browser-title"
2068
+ }, report ? t("imported", { count: report.imported }) : t("cleared")), report && report.skipped > 0 ? /* @__PURE__ */ React.createElement("p", {
2069
+ className: "taw-browser-sub"
2070
+ }, t("importSkipped", { count: report.skipped })) : undefined, report && report.appBound > 0 ? /* @__PURE__ */ React.createElement("p", {
2071
+ className: "taw-browser-sub"
2072
+ }, t("importAppBound", { count: report.appBound })) : undefined, /* @__PURE__ */ React.createElement("div", {
2073
+ className: "taw-import-actions"
2074
+ }, /* @__PURE__ */ React.createElement("button", {
2075
+ type: "button",
2076
+ className: "taw-button taw-primary",
2077
+ onClick: onClose
2078
+ }, t("done"))));
2079
+ } else {
2080
+ body = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", {
2081
+ className: "taw-import-hint"
2082
+ }, t("importHint")), profiles === undefined && !error ? /* @__PURE__ */ React.createElement("p", {
2083
+ className: "taw-import-hint"
2084
+ }, t("loading")) : undefined, profiles?.length === 0 ? /* @__PURE__ */ React.createElement("p", {
2085
+ className: "taw-import-hint"
2086
+ }, t("noProfiles")) : undefined, profiles && profiles.length > 0 ? /* @__PURE__ */ React.createElement("div", {
2087
+ className: "taw-import-profiles",
2088
+ role: "radiogroup",
2089
+ "aria-label": t("importFrom")
2090
+ }, profiles.map((profile) => /* @__PURE__ */ React.createElement("label", {
2091
+ key: profile.id,
2092
+ className: `taw-import-profile ${chosen === profile.id ? "taw-on" : ""}`
2093
+ }, /* @__PURE__ */ React.createElement("input", {
2094
+ type: "radio",
2095
+ name: "taw-import-profile",
2096
+ checked: chosen === profile.id,
2097
+ onChange: () => setChosen(profile.id)
2098
+ }), /* @__PURE__ */ React.createElement("span", {
2099
+ className: "taw-browser-letter"
2100
+ }, profile.browser.replace(/^(Google|Microsoft) /, "").charAt(0)), /* @__PURE__ */ React.createElement("span", {
2101
+ className: "taw-import-browser"
2102
+ }, profile.browser), /* @__PURE__ */ React.createElement("span", {
2103
+ className: "taw-import-name"
2104
+ }, profile.name)))) : undefined, error ? /* @__PURE__ */ React.createElement("p", {
2105
+ className: "taw-import-error"
2106
+ }, error) : undefined, /* @__PURE__ */ React.createElement("div", {
2107
+ className: "taw-import-actions"
2108
+ }, /* @__PURE__ */ React.createElement("button", {
2109
+ type: "button",
2110
+ className: "taw-link",
2111
+ disabled: working,
2112
+ onClick: () => void clear()
2113
+ }, t("clearBrowserData")), /* @__PURE__ */ React.createElement("button", {
2114
+ type: "button",
2115
+ className: "taw-button taw-primary",
2116
+ disabled: working || !chosen,
2117
+ onClick: () => void take()
2118
+ }, working ? t("importing") : t("importNow"))));
2119
+ }
2120
+ return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
2121
+ title: t("importTitle"),
2122
+ onClose
2123
+ }, /* @__PURE__ */ React.createElement("div", {
2124
+ className: "taw-import"
2125
+ }, body));
1313
2126
  }
1314
-
1315
- // web-src/util/seti.ts
1316
- var SETI_ICONS = [
1317
- [57379, "#d4d7d6", "#bfc2c1"],
2127
+ function ImportSignIns({ onChanged }) {
2128
+ const data = pi.ui.desktop?.browserData;
2129
+ const [open, setOpen] = React.useState(false);
2130
+ if (!data) {
2131
+ return null;
2132
+ }
2133
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("button", {
2134
+ type: "button",
2135
+ className: "taw-browser-import",
2136
+ onClick: () => setOpen(true)
2137
+ }, /* @__PURE__ */ React.createElement(Glyph, {
2138
+ name: "Download",
2139
+ size: 13
2140
+ }), t("importSignIns")), open ? /* @__PURE__ */ React.createElement(ImportDialog, {
2141
+ data,
2142
+ onClose: () => setOpen(false),
2143
+ onChanged
2144
+ }) : undefined);
2145
+ }
2146
+
2147
+ // web-src/browser-webview.tsx
2148
+ var ERR_ABORTED = -3;
2149
+ var NO_PAGE = { url: "", title: "", loading: false, canGoBack: false, canGoForward: false };
2150
+ function usePage(view, mounted, onFailure) {
2151
+ const [page, setPage] = React.useState(NO_PAGE);
2152
+ const ready = React.useRef(false);
2153
+ const failed = React.useRef(onFailure);
2154
+ failed.current = onFailure;
2155
+ React.useEffect(() => {
2156
+ const element = view.current;
2157
+ if (!element) {
2158
+ return;
2159
+ }
2160
+ const update = (next) => setPage((previous) => ({
2161
+ ...previous,
2162
+ ...next,
2163
+ ...ready.current ? { canGoBack: element.canGoBack(), canGoForward: element.canGoForward() } : {}
2164
+ }));
2165
+ const listeners = [
2166
+ [
2167
+ "dom-ready",
2168
+ () => {
2169
+ ready.current = true;
2170
+ update({});
2171
+ }
2172
+ ],
2173
+ [
2174
+ "did-start-loading",
2175
+ () => {
2176
+ failed.current(undefined);
2177
+ update({ loading: true });
2178
+ }
2179
+ ],
2180
+ ["did-stop-loading", () => update({ loading: false })],
2181
+ ["did-navigate", (event) => update({ url: event.url, favicon: undefined })],
2182
+ ["did-navigate-in-page", (event) => event.isMainFrame && update({ url: event.url })],
2183
+ ["page-title-updated", (event) => update({ title: event.title })],
2184
+ ["page-favicon-updated", (event) => update({ favicon: event.favicons.find((icon) => /^(https?:|data:image\/)/i.test(icon)) })],
2185
+ [
2186
+ "did-fail-load",
2187
+ (event) => {
2188
+ if (event.isMainFrame && event.errorCode !== ERR_ABORTED) {
2189
+ failed.current({ url: event.validatedURL, reason: event.errorDescription || String(event.errorCode) });
2190
+ update({ url: event.validatedURL, title: "", favicon: undefined, loading: false });
2191
+ }
2192
+ }
2193
+ ],
2194
+ [
2195
+ "render-process-gone",
2196
+ () => {
2197
+ failed.current({ crashed: true });
2198
+ update({ loading: false });
2199
+ }
2200
+ ]
2201
+ ];
2202
+ for (const [name, listener] of listeners) {
2203
+ element.addEventListener(name, listener);
2204
+ }
2205
+ return () => {
2206
+ ready.current = false;
2207
+ for (const [name, listener] of listeners) {
2208
+ element.removeEventListener(name, listener);
2209
+ }
2210
+ };
2211
+ }, [mounted]);
2212
+ const expect = React.useCallback((url) => setPage((previous) => ({ ...previous, url, title: "", favicon: undefined })), []);
2213
+ return { page, ready, expect };
2214
+ }
2215
+ function FailurePanel({ failure, onRetry, onOutside }) {
2216
+ const crashed = "crashed" in failure;
2217
+ return /* @__PURE__ */ React.createElement("div", {
2218
+ className: "taw-browser-failure",
2219
+ role: "alert"
2220
+ }, /* @__PURE__ */ React.createElement("span", {
2221
+ className: "taw-browser-mark"
2222
+ }, /* @__PURE__ */ React.createElement(Glyph, {
2223
+ name: "CircleAlert",
2224
+ size: 22
2225
+ })), /* @__PURE__ */ React.createElement("p", {
2226
+ className: "taw-browser-title"
2227
+ }, t(crashed ? "pageCrashed" : "loadFailed")), crashed ? undefined : /* @__PURE__ */ React.createElement("p", {
2228
+ className: "taw-browser-sub"
2229
+ }, failure.reason), /* @__PURE__ */ React.createElement("div", {
2230
+ className: "taw-browser-chips"
2231
+ }, /* @__PURE__ */ React.createElement("button", {
2232
+ type: "button",
2233
+ className: "taw-browser-chip",
2234
+ onClick: onRetry
2235
+ }, t("retry")), onOutside ? /* @__PURE__ */ React.createElement("button", {
2236
+ type: "button",
2237
+ className: "taw-browser-chip",
2238
+ onClick: onOutside
2239
+ }, t("openBrowser")) : undefined));
2240
+ }
2241
+ var DRIVEN_MS = 4000;
2242
+ function useAgent(go, view, ready, hasPage, show, stage) {
2243
+ const [driven, setDriven] = React.useState(false);
2244
+ const latest = React.useRef({ go, hasPage, show });
2245
+ latest.current = { go, hasPage, show };
2246
+ React.useEffect(() => {
2247
+ let timer;
2248
+ const detach = AgentBrowser.attach({
2249
+ go: (url) => latest.current.go(url),
2250
+ view: () => latest.current.hasPage && ready.current ? view.current ?? undefined : undefined,
2251
+ shown: () => (stage.current?.getClientRects().length ?? 0) > 0,
2252
+ drive: () => {
2253
+ if (latest.current.hasPage) {
2254
+ latest.current.show();
2255
+ }
2256
+ setDriven(true);
2257
+ clearTimeout(timer);
2258
+ timer = setTimeout(() => setDriven(false), DRIVEN_MS);
2259
+ }
2260
+ });
2261
+ return () => {
2262
+ clearTimeout(timer);
2263
+ detach();
2264
+ };
2265
+ }, []);
2266
+ return driven;
2267
+ }
2268
+ function WebviewBrowser() {
2269
+ const cwd = pi.ui.useCwd();
2270
+ const [request, setRequest] = React.useState({ url: "", id: 0 });
2271
+ const [home, setHome] = React.useState(true);
2272
+ const [src, setSrc] = React.useState();
2273
+ const [failure, setFailure] = React.useState();
2274
+ const view = React.useRef(null);
2275
+ const stage = React.useRef(null);
2276
+ const { page, ready, expect } = usePage(view, Boolean(src), setFailure);
2277
+ const shown = useForwarded(request.url, cwd);
2278
+ React.useEffect(() => {
2279
+ if (!request.url || !shown) {
2280
+ return;
2281
+ }
2282
+ setFailure(undefined);
2283
+ expect(shown);
2284
+ if (view.current && ready.current) {
2285
+ view.current.loadURL(shown).catch(() => {
2286
+ return;
2287
+ });
2288
+ } else {
2289
+ setSrc(shown);
2290
+ }
2291
+ }, [shown, request.id]);
2292
+ const go = (url) => {
2293
+ if (!url) {
2294
+ setHome(true);
2295
+ return;
2296
+ }
2297
+ Recent.add(url);
2298
+ setHome(false);
2299
+ setRequest((previous) => ({ url, id: previous.id + 1 }));
2300
+ };
2301
+ ShowPage.useReceive(go);
2302
+ const driven = useAgent(go, view, ready, Boolean(src), () => setHome(false), stage);
2303
+ const call = (run) => {
2304
+ if (view.current && ready.current) {
2305
+ run(view.current);
2306
+ }
2307
+ };
2308
+ const retry = () => {
2309
+ if (failure && "url" in failure && failure.url) {
2310
+ setFailure(undefined);
2311
+ call((element) => element.loadURL(failure.url).catch(() => {
2312
+ return;
2313
+ }));
2314
+ } else {
2315
+ call((element) => element.reload());
2316
+ }
2317
+ };
2318
+ const address = home ? "" : WorkspaceUtil.unforward(page.url || request.url, request.url, shown);
2319
+ const current = page.url || shown;
2320
+ return /* @__PURE__ */ React.createElement("div", {
2321
+ className: "taw-browser"
2322
+ }, /* @__PURE__ */ React.createElement(BrowserBar, {
2323
+ url: address,
2324
+ title: home ? undefined : page.title,
2325
+ favicon: home ? undefined : page.favicon,
2326
+ loading: !home && page.loading,
2327
+ canGoBack: home ? Boolean(src) : page.canGoBack,
2328
+ canGoForward: !home && page.canGoForward,
2329
+ onBack: () => home ? setHome(false) : call((element) => element.goBack()),
2330
+ onForward: () => call((element) => element.goForward()),
2331
+ onReload: retry,
2332
+ onStop: () => call((element) => element.stop()),
2333
+ onOpen: go,
2334
+ onHome: () => setHome(true),
2335
+ onOpenOutside: !home && current ? () => openOutside(current) : undefined,
2336
+ outsideLabel: t("openBrowser"),
2337
+ badge: driven ? /* @__PURE__ */ React.createElement("span", {
2338
+ className: "taw-browser-driven",
2339
+ role: "status"
2340
+ }, /* @__PURE__ */ React.createElement("span", {
2341
+ className: "taw-browser-driven-dot"
2342
+ }), t("agentDriving")) : undefined
2343
+ }), /* @__PURE__ */ React.createElement("div", {
2344
+ className: "taw-browser-stage",
2345
+ ref: stage
2346
+ }, src ? React.createElement("webview", {
2347
+ ref: view,
2348
+ src,
2349
+ className: "taw-webview",
2350
+ allowpopups: "true",
2351
+ style: { display: home ? "none" : "flex" }
2352
+ }) : undefined, home ? /* @__PURE__ */ React.createElement(Home, {
2353
+ onOpen: go,
2354
+ extra: /* @__PURE__ */ React.createElement(ImportSignIns, {
2355
+ onChanged: () => call((element) => element.reload())
2356
+ })
2357
+ }) : undefined, !home && failure ? /* @__PURE__ */ React.createElement(FailurePanel, {
2358
+ failure,
2359
+ onRetry: retry,
2360
+ onOutside: "url" in failure ? () => openOutside(failure.url) : undefined
2361
+ }) : undefined));
2362
+ }
2363
+
2364
+ // web-src/browser.tsx
2365
+ function FrameBrowser() {
2366
+ const [history, setHistory] = React.useState({ list: [""], index: 0, reloads: 0 });
2367
+ const [loading, setLoading] = React.useState(false);
2368
+ const url = history.list[history.index];
2369
+ const shown = useForwarded(url, pi.ui.useCwd());
2370
+ const go = (next) => {
2371
+ if (next) {
2372
+ Recent.add(next);
2373
+ }
2374
+ setLoading(Boolean(next));
2375
+ setHistory((previous) => ({ list: [...previous.list.slice(0, previous.index + 1), next], index: previous.index + 1, reloads: 0 }));
2376
+ };
2377
+ const step = (delta) => {
2378
+ const index = Math.min(history.list.length - 1, Math.max(0, history.index + delta));
2379
+ if (index !== history.index) {
2380
+ setLoading(Boolean(history.list[index]));
2381
+ setHistory({ ...history, index });
2382
+ }
2383
+ };
2384
+ ShowPage.useReceive(go);
2385
+ const reload = () => {
2386
+ setLoading(true);
2387
+ setHistory((previous) => ({ ...previous, reloads: previous.reloads + 1 }));
2388
+ };
2389
+ return /* @__PURE__ */ React.createElement("div", {
2390
+ className: "taw-browser"
2391
+ }, /* @__PURE__ */ React.createElement(BrowserBar, {
2392
+ url,
2393
+ loading,
2394
+ canGoBack: history.index > 0,
2395
+ canGoForward: history.index < history.list.length - 1,
2396
+ onBack: () => step(-1),
2397
+ onForward: () => step(1),
2398
+ onReload: reload,
2399
+ onOpen: go,
2400
+ onHome: () => go(""),
2401
+ onOpenOutside: shown ? () => openOutside(shown) : undefined,
2402
+ outsideLabel: t("openExternal")
2403
+ }), url ? shown && /* @__PURE__ */ React.createElement("iframe", {
2404
+ key: `${history.index}:${history.reloads}`,
2405
+ className: "taw-frame",
2406
+ title: shown === url ? url : `${url} → ${shown}`,
2407
+ src: shown,
2408
+ referrerPolicy: "no-referrer",
2409
+ sandbox: WorkspaceUtil.frameSandbox(shown, location.origin),
2410
+ onLoad: () => setLoading(false)
2411
+ }) : /* @__PURE__ */ React.createElement(Home, {
2412
+ onOpen: go,
2413
+ foot: t("frameHint")
2414
+ }));
2415
+ }
2416
+ function BrowserView() {
2417
+ return pi.ui.supportsWebview ? /* @__PURE__ */ React.createElement(WebviewBrowser, null) : /* @__PURE__ */ React.createElement(FrameBrowser, null);
2418
+ }
2419
+
2420
+ // web-src/util/seti.ts
2421
+ var SETI_ICONS = [
2422
+ [57379, "#d4d7d6", "#bfc2c1"],
1318
2423
  [57415, "#cc3e44", "#b8383d"],
1319
2424
  [57431, "#8dc149", "#7fae42"],
1320
2425
  [57421, "#519aba", "#498ba7"],
@@ -4234,7 +5339,7 @@ var PreviewUtil;
4234
5339
 
4235
5340
  // web-src/preview.tsx
4236
5341
  var PAGE_SANDBOX = "allow-scripts allow-forms allow-popups allow-modals allow-downloads";
4237
- var MARKDOWN_SANDBOX = "allow-popups allow-popups-to-escape-sandbox";
5342
+ var MARKDOWN_SANDBOX = "allow-same-origin allow-popups allow-popups-to-escape-sandbox";
4238
5343
  var LINKED = [
4239
5344
  ["img", "src"],
4240
5345
  ["source", "src"],
@@ -4362,6 +5467,242 @@ function MediaPreview({ kind, url, size, onInfo }) {
4362
5467
  }
4363
5468
  }
4364
5469
 
5470
+ // ../ta-protocol/esm/common/access-protocol.js
5471
+ var TaAccessServer = Symbol("TaAccessServer");
5472
+ // ../ta-protocol/esm/common/auth-protocol.js
5473
+ var TaAuthServer = Symbol("TaAuthServer");
5474
+ // ../ta-protocol/esm/common/gateway-protocol.js
5475
+ var TaGatewayServer = Symbol("TaGatewayServer");
5476
+ // ../ta-protocol/esm/common/location.js
5477
+ var TaLocation;
5478
+ (function(TaLocation2) {
5479
+ TaLocation2.SSH = "ssh://";
5480
+ const HOST = /^(?!-)[\w.@:%+[\]-]+$/;
5481
+ function isRemote(location2) {
5482
+ return location2.startsWith(TaLocation2.SSH);
5483
+ }
5484
+ TaLocation2.isRemote = isRemote;
5485
+ function parse(location2) {
5486
+ if (!isRemote(location2)) {
5487
+ return;
5488
+ }
5489
+ const rest = location2.slice(TaLocation2.SSH.length);
5490
+ const slash = rest.indexOf("/");
5491
+ const host2 = slash < 0 ? rest : rest.slice(0, slash);
5492
+ const path2 = slash < 0 ? "" : normalize(rest.slice(slash));
5493
+ if (!isHost(host2)) {
5494
+ throw new Error(`${JSON.stringify(location2)} names no host: write ssh://<host>/<path>, the host as ssh takes it.`);
5495
+ }
5496
+ return { host: host2, path: path2 };
5497
+ }
5498
+ TaLocation2.parse = parse;
5499
+ function isHost(host2) {
5500
+ return HOST.test(host2);
5501
+ }
5502
+ TaLocation2.isHost = isHost;
5503
+ const FLAGS = /^-[46AaCfGgKkMNnqsTtVvXxYy]+$/;
5504
+ function readHost(input) {
5505
+ const words = input.trim().split(/\s+/).filter(Boolean);
5506
+ if (words[0] === "ssh") {
5507
+ words.shift();
5508
+ }
5509
+ let destination;
5510
+ let port;
5511
+ let user;
5512
+ const options2 = [];
5513
+ for (let i = 0;i < words.length; i++) {
5514
+ const word = words[i];
5515
+ const glued = /^-([pl])(.+)$/.exec(word);
5516
+ if (word === "-p" || word === "-l" || glued) {
5517
+ const value = glued ? glued[2] : words[++i];
5518
+ if (value === undefined) {
5519
+ return { error: "invalid" };
5520
+ }
5521
+ if ((glued ? glued[1] : word[1]) === "p") {
5522
+ port = value;
5523
+ } else {
5524
+ user = value;
5525
+ }
5526
+ } else if (word === "-o" || word.startsWith("-o")) {
5527
+ const value = word === "-o" ? words[++i] : word.slice(2);
5528
+ const option = /^(port|user)\s*=?\s*(.+)$/i.exec(value !== null && value !== undefined ? value : "");
5529
+ if (!option) {
5530
+ options2.push(`-o ${value !== null && value !== undefined ? value : ""}`.trim());
5531
+ } else if (option[1].toLowerCase() === "port") {
5532
+ port = option[2];
5533
+ } else {
5534
+ user = option[2];
5535
+ }
5536
+ } else if (FLAGS.test(word)) {} else if (word.startsWith("-")) {
5537
+ options2.push(/^-[bBcDeEFiIJLmOQRSwW]$/.test(word) && words[i + 1] !== undefined ? `${word} ${words[++i]}` : word);
5538
+ } else if (destination === undefined) {
5539
+ destination = word;
5540
+ } else {
5541
+ return { error: "invalid" };
5542
+ }
5543
+ }
5544
+ if (options2.length > 0) {
5545
+ return { error: "options", options: options2 };
5546
+ }
5547
+ if (!destination) {
5548
+ return { error: "empty" };
5549
+ }
5550
+ let host2 = destination.replace(/^ssh:\/\//, "").replace(/\/.*$/, "");
5551
+ if (user && !host2.includes("@")) {
5552
+ host2 = `${user}@${host2}`;
5553
+ }
5554
+ if (port) {
5555
+ if (!/^\d{1,5}$/.test(port) || /:\d+$/.test(host2)) {
5556
+ return { error: "invalid" };
5557
+ }
5558
+ host2 = port === "22" ? host2 : `${host2}:${port}`;
5559
+ }
5560
+ return isHost(host2) ? { host: host2 } : { error: "invalid" };
5561
+ }
5562
+ TaLocation2.readHost = readHost;
5563
+ function ssh(host2, path2 = "") {
5564
+ return `${TaLocation2.SSH}${host2}${path2 ? normalize(path2) : ""}`;
5565
+ }
5566
+ TaLocation2.ssh = ssh;
5567
+ function hostLabel(host2) {
5568
+ const name = host2.replace(/^[^@]*@/, "").replace(/^\[(.*)\](?::\d+)?$/, "$1").replace(/^([^:]*):\d+$/, "$1");
5569
+ return /^[\d.]+$/.test(name) || name.includes(":") ? name : name.split(".")[0] || name;
5570
+ }
5571
+ TaLocation2.hostLabel = hostLabel;
5572
+ function host(location2) {
5573
+ var _a;
5574
+ return isRemote(location2) ? (_a = parse(location2)) === null || _a === undefined ? undefined : _a.host : undefined;
5575
+ }
5576
+ TaLocation2.host = host;
5577
+ function path(location2) {
5578
+ var _a;
5579
+ var _b;
5580
+ return (_b = (_a = parse(location2)) === null || _a === undefined ? undefined : _a.path) !== null && _b !== undefined ? _b : location2;
5581
+ }
5582
+ TaLocation2.path = path;
5583
+ function parent(location2) {
5584
+ const remote = parse(location2);
5585
+ if (remote) {
5586
+ const above = remote.path ? parentPath(remote.path) : undefined;
5587
+ return above === undefined ? undefined : ssh(remote.host, above);
5588
+ }
5589
+ return parentPath(location2);
5590
+ }
5591
+ TaLocation2.parent = parent;
5592
+ function child(location2, name) {
5593
+ const remote = parse(location2);
5594
+ if (remote) {
5595
+ return ssh(remote.host, childPath(remote.path || "/", name));
5596
+ }
5597
+ return childPath(location2, name);
5598
+ }
5599
+ TaLocation2.child = child;
5600
+ function basename(location2) {
5601
+ const remote = parse(location2);
5602
+ const path2 = (remote ? remote.path : location2).replace(/[\\/]+$/, "");
5603
+ const name = path2.slice(Math.max(path2.lastIndexOf("/"), path2.lastIndexOf("\\")) + 1);
5604
+ return name || (remote === null || remote === undefined ? undefined : remote.host) || location2;
5605
+ }
5606
+ TaLocation2.basename = basename;
5607
+ function parentPath(path2) {
5608
+ const trimmed = path2.replace(/[\\/]+$/, "");
5609
+ const at = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
5610
+ if (at < 0) {
5611
+ return;
5612
+ }
5613
+ const head = trimmed.slice(0, at);
5614
+ return head === "" || /^[A-Za-z]:$/.test(head) ? head + trimmed[at] : head;
5615
+ }
5616
+ function childPath(path2, name) {
5617
+ const separator = path2.includes("/") || !path2.includes("\\") ? "/" : "\\";
5618
+ return path2.endsWith(separator) ? path2 + name : path2 + separator + name;
5619
+ }
5620
+ function normalize(path2) {
5621
+ const squeezed = `/${path2}`.replace(/\/+/g, "/");
5622
+ return squeezed.length > 1 ? squeezed.replace(/\/$/, "") : squeezed;
5623
+ }
5624
+ })(TaLocation || (TaLocation = {}));
5625
+ // ../ta-protocol/esm/common/package-protocol.js
5626
+ var TaPackageServer = Symbol("TaPackageServer");
5627
+ var TaPackageTextUtil;
5628
+ (function(TaPackageTextUtil2) {
5629
+ function pick(text, language) {
5630
+ var _a, _b, _c, _d;
5631
+ if (text === undefined || typeof text === "string") {
5632
+ return text;
5633
+ }
5634
+ return (_d = (_c = (_b = (_a = text[language]) !== null && _a !== undefined ? _a : text[language.split("-")[0]]) !== null && _b !== undefined ? _b : text.en) !== null && _c !== undefined ? _c : text["en-US"]) !== null && _d !== undefined ? _d : Object.values(text)[0];
5635
+ }
5636
+ TaPackageTextUtil2.pick = pick;
5637
+ })(TaPackageTextUtil || (TaPackageTextUtil = {}));
5638
+ // ../ta-protocol/esm/common/relay-protocol.js
5639
+ var TaRelayServer = Symbol("TaRelayServer");
5640
+ // ../ta-protocol/esm/common/remote-protocol.js
5641
+ var TaRemoteServer = Symbol("TaRemoteServer");
5642
+ // ../ta-protocol/esm/common/settings-protocol.js
5643
+ var TaSettingsServer = Symbol("TaSettingsServer");
5644
+ // ../ta-protocol/esm/common/ta-protocol.js
5645
+ var TaServer = Symbol("TaServer");
5646
+ var TaClient = Symbol("TaClient");
5647
+ var TaErrorUtil;
5648
+ (function(TaErrorUtil2) {
5649
+ function code(error) {
5650
+ var _a;
5651
+ var _b;
5652
+ const failure = error;
5653
+ const code2 = (_b = failure === null || failure === undefined ? undefined : failure.code) !== null && _b !== undefined ? _b : (_a = failure === null || failure === undefined ? undefined : failure.data) === null || _a === undefined ? undefined : _a.code;
5654
+ return typeof code2 === "string" ? code2 : undefined;
5655
+ }
5656
+ TaErrorUtil2.code = code;
5657
+ })(TaErrorUtil || (TaErrorUtil = {}));
5658
+ var TaMessageContext;
5659
+ (function(TaMessageContext2) {
5660
+ const BLOCK = /^<context>\n?[\s\S]*?\n?<\/context>\n?/;
5661
+ function wrap(context, message) {
5662
+ return `<context>
5663
+ ${context}
5664
+ </context>
5665
+ ${message}`;
5666
+ }
5667
+ TaMessageContext2.wrap = wrap;
5668
+ function strip(message) {
5669
+ return message.replace(BLOCK, "");
5670
+ }
5671
+ TaMessageContext2.strip = strip;
5672
+ })(TaMessageContext || (TaMessageContext = {}));
5673
+ var TaSkillUse;
5674
+ (function(TaSkillUse2) {
5675
+ const BLOCK = /^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/;
5676
+ function parse(message) {
5677
+ var _a;
5678
+ const match = BLOCK.exec(message);
5679
+ if (!match) {
5680
+ return;
5681
+ }
5682
+ return { name: match[1], location: match[2], content: match[3], message: ((_a = match[4]) === null || _a === undefined ? undefined : _a.trim()) || undefined };
5683
+ }
5684
+ TaSkillUse2.parse = parse;
5685
+ function command(use2) {
5686
+ return use2.message ? `/skill:${use2.name} ${use2.message}` : `/skill:${use2.name}`;
5687
+ }
5688
+ TaSkillUse2.command = command;
5689
+ })(TaSkillUse || (TaSkillUse = {}));
5690
+ // ../ta-protocol/esm/common/workspace-protocol.js
5691
+ var TaWorkspaceServer = Symbol("TaWorkspaceServer");
5692
+ var TaTerminalServer = Symbol("TaTerminalServer");
5693
+ var TaExcludedFiles;
5694
+ (function(TaExcludedFiles2) {
5695
+ TaExcludedFiles2.NAMES = [".git", ".svn", ".hg", ".DS_Store", "Thumbs.db"];
5696
+ function has(name) {
5697
+ return TaExcludedFiles2.NAMES.includes(name);
5698
+ }
5699
+ TaExcludedFiles2.has = has;
5700
+ function filter(entries) {
5701
+ return entries.filter((entry) => !has(entry.name));
5702
+ }
5703
+ TaExcludedFiles2.filter = filter;
5704
+ })(TaExcludedFiles || (TaExcludedFiles = {}));
5705
+ var TA_UPLOAD_PART_BYTES = 4 * 1024 * 1024;
4365
5706
  // web-src/util/search.ts
4366
5707
  var PREVIEW_CHARS = 200;
4367
5708
  var SKIPPED_DIRECTORIES = [".git", "node_modules"];
@@ -4570,11 +5911,224 @@ var SearchUtil;
4570
5911
  SearchUtil.substitute = substitute;
4571
5912
  })(SearchUtil ||= {});
4572
5913
 
5914
+ // web-src/util/upload.ts
5915
+ var UploadUtil;
5916
+ ((UploadUtil) => {
5917
+ function segments(path) {
5918
+ const parts3 = path.split(/[\\/]+/).filter((part) => part && part !== ".");
5919
+ if (!parts3.length || parts3.some((part) => part === ".." || part.includes("\x00"))) {
5920
+ throw new Error(`Not a path to upload to: ${path}`);
5921
+ }
5922
+ return parts3;
5923
+ }
5924
+ UploadUtil.segments = segments;
5925
+ function fromFiles(files) {
5926
+ return { files: Array.from(files, (file) => ({ path: file.webkitRelativePath || file.name, file })), folders: [] };
5927
+ }
5928
+ UploadUtil.fromFiles = fromFiles;
5929
+ async function fromDrop(dataTransfer) {
5930
+ const entries = Array.from(dataTransfer.items ?? []).filter((item) => item.kind === "file").map((item) => item.webkitGetAsEntry?.());
5931
+ if (!entries.length || entries.some((entry) => !entry)) {
5932
+ return fromFiles(Array.from(dataTransfer.files ?? []));
5933
+ }
5934
+ const batch = { files: [], folders: [] };
5935
+ for (const entry of entries) {
5936
+ await collect(entry, "", batch);
5937
+ }
5938
+ return batch;
5939
+ }
5940
+ UploadUtil.fromDrop = fromDrop;
5941
+ async function collect(entry, folder, batch) {
5942
+ const path = folder ? `${folder}/${entry.name}` : entry.name;
5943
+ if (entry.isFile && entry.file) {
5944
+ const read = entry.file.bind(entry);
5945
+ batch.files.push({ path, file: await new Promise((resolve, reject) => read(resolve, reject)) });
5946
+ } else if (entry.isDirectory && entry.createReader) {
5947
+ batch.folders.push(path);
5948
+ const reader = entry.createReader();
5949
+ for (;; ) {
5950
+ const children = await new Promise((resolve, reject) => reader.readEntries(resolve, reject));
5951
+ if (!children.length) {
5952
+ break;
5953
+ }
5954
+ for (const child of children) {
5955
+ await collect(child, path, batch);
5956
+ }
5957
+ }
5958
+ }
5959
+ }
5960
+ function topNames(batch) {
5961
+ const names = new Set;
5962
+ for (const path of [...batch.files.map((file) => file.path), ...batch.folders]) {
5963
+ names.add(segments(path)[0]);
5964
+ }
5965
+ return [...names];
5966
+ }
5967
+ UploadUtil.topNames = topNames;
5968
+ function emptyFolders(batch) {
5969
+ const filled = new Set;
5970
+ for (const { path } of batch.files) {
5971
+ const parts3 = segments(path);
5972
+ for (let i = 1;i < parts3.length; i++) {
5973
+ filled.add(parts3.slice(0, i).join("/"));
5974
+ }
5975
+ }
5976
+ const folders = batch.folders.map((folder) => segments(folder).join("/"));
5977
+ return [...new Set(folders)].filter((folder) => !filled.has(folder) && !folders.some((other) => other.startsWith(`${folder}/`)));
5978
+ }
5979
+ UploadUtil.emptyFolders = emptyFolders;
5980
+ function totalBytes(batch) {
5981
+ return batch.files.reduce((sum, { file }) => sum + file.size, 0);
5982
+ }
5983
+ UploadUtil.totalBytes = totalBytes;
5984
+ function parts2(size, partBytes) {
5985
+ if (size === 0) {
5986
+ return [[0, 0]];
5987
+ }
5988
+ const out = [];
5989
+ for (let start = 0;start < size; start += partBytes) {
5990
+ out.push([start, Math.min(size, start + partBytes)]);
5991
+ }
5992
+ return out;
5993
+ }
5994
+ UploadUtil.parts = parts2;
5995
+ function toBase64(bytes) {
5996
+ let binary = "";
5997
+ for (let i = 0;i < bytes.length; i += 32768) {
5998
+ binary += String.fromCharCode(...bytes.subarray(i, i + 32768));
5999
+ }
6000
+ return btoa(binary);
6001
+ }
6002
+ UploadUtil.toBase64 = toBase64;
6003
+ })(UploadUtil ||= {});
6004
+
6005
+ // web-src/util/zip.ts
6006
+ var CRC_TABLE = (() => {
6007
+ const table = new Uint32Array(256);
6008
+ for (let n = 0;n < 256; n++) {
6009
+ let c = n;
6010
+ for (let k = 0;k < 8; k++) {
6011
+ c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
6012
+ }
6013
+ table[n] = c >>> 0;
6014
+ }
6015
+ return table;
6016
+ })();
6017
+ var ZIP_MAX_BYTES = 4294967295;
6018
+ var ZIP_MAX_ENTRIES = 65535;
6019
+ var ZipUtil;
6020
+ ((ZipUtil) => {
6021
+ function crc32(data) {
6022
+ let crc = 4294967295;
6023
+ for (let i = 0;i < data.length; i++) {
6024
+ crc = CRC_TABLE[(crc ^ data[i]) & 255] ^ crc >>> 8;
6025
+ }
6026
+ return (crc ^ 4294967295) >>> 0;
6027
+ }
6028
+ ZipUtil.crc32 = crc32;
6029
+ function dosTime(date) {
6030
+ const year = Math.max(1980, date.getFullYear());
6031
+ return [
6032
+ date.getHours() << 11 | date.getMinutes() << 5 | Math.floor(date.getSeconds() / 2),
6033
+ year - 1980 << 9 | date.getMonth() + 1 << 5 | date.getDate()
6034
+ ];
6035
+ }
6036
+ async function create(entries, deflate) {
6037
+ if (entries.length > ZIP_MAX_ENTRIES) {
6038
+ throw new Error(`An archive holds at most ${ZIP_MAX_ENTRIES} files.`);
6039
+ }
6040
+ const encoder = new TextEncoder;
6041
+ const locals = [];
6042
+ const centrals = [];
6043
+ let offset = 0;
6044
+ for (const entry of entries) {
6045
+ const name = encoder.encode(entry.path.replace(/^\/+/, ""));
6046
+ const crc = crc32(entry.data);
6047
+ const deflated = deflate && entry.data.length > 0 ? await deflate(entry.data) : undefined;
6048
+ const compressed = deflated && deflated.length < entry.data.length ? deflated : entry.data;
6049
+ const method = compressed === entry.data ? 0 : 8;
6050
+ const [time, date] = dosTime(entry.modified ?? new Date);
6051
+ if (offset + 30 + name.length + compressed.length > ZIP_MAX_BYTES) {
6052
+ throw new Error("An archive holds at most 4 GB.");
6053
+ }
6054
+ const header = (signature, central) => {
6055
+ const view = new DataView(new ArrayBuffer(central ? 46 : 30));
6056
+ let at2 = 0;
6057
+ const u16 = (value) => {
6058
+ view.setUint16(at2, value, true);
6059
+ at2 += 2;
6060
+ };
6061
+ const u32 = (value) => {
6062
+ view.setUint32(at2, value >>> 0, true);
6063
+ at2 += 4;
6064
+ };
6065
+ u32(signature);
6066
+ if (central) {
6067
+ u16(20);
6068
+ }
6069
+ u16(20);
6070
+ u16(2048);
6071
+ u16(method);
6072
+ u16(time);
6073
+ u16(date);
6074
+ u32(crc);
6075
+ u32(compressed.length);
6076
+ u32(entry.data.length);
6077
+ u16(name.length);
6078
+ u16(0);
6079
+ if (central) {
6080
+ u16(0);
6081
+ u16(0);
6082
+ u16(0);
6083
+ u32(0);
6084
+ u32(offset);
6085
+ }
6086
+ return new Uint8Array(view.buffer);
6087
+ };
6088
+ const local = header(67324752, false);
6089
+ locals.push(local, name, compressed);
6090
+ centrals.push(header(33639248, true), name);
6091
+ offset += local.length + name.length + compressed.length;
6092
+ }
6093
+ const centralSize = centrals.reduce((sum, part) => sum + part.length, 0);
6094
+ const end = new DataView(new ArrayBuffer(22));
6095
+ end.setUint32(0, 101010256, true);
6096
+ end.setUint16(8, entries.length, true);
6097
+ end.setUint16(10, entries.length, true);
6098
+ end.setUint32(12, centralSize, true);
6099
+ end.setUint32(16, offset, true);
6100
+ const parts2 = [...locals, ...centrals, new Uint8Array(end.buffer)];
6101
+ const out = new Uint8Array(parts2.reduce((sum, part) => sum + part.length, 0));
6102
+ let at = 0;
6103
+ for (const part of parts2) {
6104
+ out.set(part, at);
6105
+ at += part.length;
6106
+ }
6107
+ return out;
6108
+ }
6109
+ ZipUtil.create = create;
6110
+ function browserDeflate() {
6111
+ const Stream = globalThis.CompressionStream;
6112
+ if (!Stream) {
6113
+ return;
6114
+ }
6115
+ return async (data) => {
6116
+ const stream = new Stream("deflate-raw");
6117
+ const writer = stream.writable.getWriter();
6118
+ writer.write(data).then(() => writer.close());
6119
+ return new Uint8Array(await new Response(stream.readable).arrayBuffer());
6120
+ };
6121
+ }
6122
+ ZipUtil.browserDeflate = browserDeflate;
6123
+ })(ZipUtil ||= {});
6124
+
4573
6125
  // web-src/workspace-client.ts
4574
6126
  var SEARCH_LIMIT = 2000;
4575
6127
  var SEARCH_BYTES = 8 * 1024 * 1024;
4576
6128
  var SEARCHERS = ["rg", "git", "grep"];
4577
6129
  var REMOTE_TIMEOUT_MS = 120000;
6130
+ var MAX_ARCHIVE_BYTES = 1024 * 1024 * 1024;
6131
+ var DOWNLOAD_CONCURRENCY = 4;
4578
6132
  var WorkspaceClient;
4579
6133
  ((WorkspaceClient) => {
4580
6134
  const missing = new Map;
@@ -4670,6 +6224,93 @@ var WorkspaceClient;
4670
6224
  return run(cwd, "rm", ["-rf", "--", path]);
4671
6225
  }
4672
6226
  WorkspaceClient.remove = remove;
6227
+ function move(cwd, paths, folder) {
6228
+ return run(cwd, "mv", ["-n", "--", ...paths, folder || "."]);
6229
+ }
6230
+ WorkspaceClient.move = move;
6231
+ async function upload(cwd, folder, batch, onProgress) {
6232
+ for (const empty of UploadUtil.emptyFolders(batch)) {
6233
+ await createFolder(cwd, WorkspaceUtil.join(folder, empty));
6234
+ }
6235
+ const total = UploadUtil.totalBytes(batch);
6236
+ let sent = 0;
6237
+ for (const { path, file } of batch.files) {
6238
+ const target = WorkspaceUtil.join(folder, UploadUtil.segments(path).join("/"));
6239
+ for (const [start, end] of UploadUtil.parts(file.size, TA_UPLOAD_PART_BYTES)) {
6240
+ onProgress?.(sent, total, file.name);
6241
+ const bytes = new Uint8Array(await file.slice(start, end).arrayBuffer());
6242
+ await pi.workspace.uploadFile(target, UploadUtil.toBase64(bytes), { cwd, append: start > 0 });
6243
+ sent += end - start;
6244
+ }
6245
+ }
6246
+ onProgress?.(sent, total, "");
6247
+ return batch.files.length;
6248
+ }
6249
+ WorkspaceClient.upload = upload;
6250
+ async function filesOf(cwd, folder) {
6251
+ const files = [];
6252
+ let level = [folder];
6253
+ while (level.length) {
6254
+ const listed = await Promise.all(level.map((dir) => pi.workspace.listDirectory(dir, cwd)));
6255
+ level = [];
6256
+ for (const entry of TaExcludedFiles.filter(listed.flat())) {
6257
+ if (entry.kind === "directory") {
6258
+ level.push(entry.path);
6259
+ } else {
6260
+ files.push(entry);
6261
+ }
6262
+ }
6263
+ }
6264
+ return files;
6265
+ }
6266
+ WorkspaceClient.filesOf = filesOf;
6267
+ async function download(cwd, entry, onProgress) {
6268
+ if (entry.kind === "file") {
6269
+ save(await pi.workspace.fileUrl(entry.path, cwd), entry.name);
6270
+ return;
6271
+ }
6272
+ const files = await filesOf(cwd, entry.path);
6273
+ const total = files.reduce((sum, file) => sum + (file.size ?? 0), 0);
6274
+ if (total > MAX_ARCHIVE_BYTES) {
6275
+ throw new Error(`${WorkspaceUtil.size(total)} is more than a folder downloaded here may hold (${WorkspaceUtil.size(MAX_ARCHIVE_BYTES)}).`);
6276
+ }
6277
+ const base = (await pi.workspace.fileUrl(entry.path, cwd)).replace(/\/?$/, "/");
6278
+ const offset = entry.path ? entry.path.length + 1 : 0;
6279
+ const entries = new Array(files.length);
6280
+ let done = 0;
6281
+ let next = 0;
6282
+ const worker = async () => {
6283
+ while (next < files.length) {
6284
+ const index = next++;
6285
+ const file = files[index];
6286
+ const relative = file.path.slice(offset);
6287
+ onProgress?.(done, total, file.name);
6288
+ const response = await fetch(base + relative.split("/").map(encodeURIComponent).join("/"));
6289
+ if (!response.ok) {
6290
+ throw new Error(`${file.path}: HTTP ${response.status}`);
6291
+ }
6292
+ entries[index] = { path: `${entry.name}/${relative}`, data: new Uint8Array(await response.arrayBuffer()) };
6293
+ done += file.size ?? 0;
6294
+ }
6295
+ };
6296
+ await Promise.all(Array.from({ length: Math.min(DOWNLOAD_CONCURRENCY, files.length) }, worker));
6297
+ onProgress?.(total, total, "");
6298
+ const zip = await ZipUtil.create(entries, ZipUtil.browserDeflate());
6299
+ const url = URL.createObjectURL(new Blob([zip], { type: "application/zip" }));
6300
+ save(url, `${entry.name}.zip`);
6301
+ setTimeout(() => URL.revokeObjectURL(url), 60000);
6302
+ }
6303
+ WorkspaceClient.download = download;
6304
+ function save(url, name) {
6305
+ const link2 = document.createElement("a");
6306
+ link2.href = url;
6307
+ link2.download = name;
6308
+ link2.rel = "noopener";
6309
+ link2.style.display = "none";
6310
+ document.body.append(link2);
6311
+ link2.click();
6312
+ link2.remove();
6313
+ }
4673
6314
  })(WorkspaceClient ||= {});
4674
6315
 
4675
6316
  // web-src/editors.tsx
@@ -5075,47 +6716,223 @@ function DiffEditor({ id, cwd, path, staged }) {
5075
6716
  }));
5076
6717
  }
5077
6718
 
5078
- // web-src/search.tsx
5079
- var DEBOUNCE_MS = 300;
5080
- var searches = new Map;
5081
- var SearchRequests = new Channel;
5082
- var INDENT = 12;
5083
- var matchKey = (match) => `${match.path}:${match.line}:${match.column}`;
5084
- function dismisses(key, match) {
5085
- return key === match.path || key === matchKey(match) || key.endsWith("/") && match.path.startsWith(key);
5086
- }
5087
- function resultRows(groups, tree, collapsed) {
5088
- const rows = [];
5089
- const file = (group, depth) => {
5090
- rows.push({ kind: "file", group, depth });
5091
- if (!collapsed.has(group.path)) {
5092
- for (const match of group.matches) {
5093
- rows.push({ kind: "match", match, depth });
6719
+ // web-src/explorer-excluded.ts
6720
+ var SHOW_EXCLUDED_KEY = "explorer.showExcluded";
6721
+ var kept;
6722
+ function useShowExcluded() {
6723
+ const [show, setShow] = React.useState(kept ?? false);
6724
+ React.useEffect(() => {
6725
+ let live = true;
6726
+ const read = () => pi.storage.get(SHOW_EXCLUDED_KEY).then((value) => {
6727
+ kept = value === true;
6728
+ if (live) {
6729
+ setShow(kept);
5094
6730
  }
5095
- }
5096
- };
5097
- const folder = (node, depth) => {
5098
- for (const inner of node.folders) {
5099
- const key = `${inner.path}/`;
5100
- rows.push({ kind: "folder", key, folder: inner, depth });
5101
- if (!collapsed.has(key)) {
5102
- folder(inner, depth + 1);
6731
+ }, () => {
6732
+ return;
6733
+ });
6734
+ read();
6735
+ const stop = pi.storage.onChange((keys) => {
6736
+ if (keys.includes(SHOW_EXCLUDED_KEY)) {
6737
+ read();
5103
6738
  }
6739
+ });
6740
+ return () => {
6741
+ live = false;
6742
+ stop();
6743
+ };
6744
+ }, []);
6745
+ const change = React.useCallback((next) => {
6746
+ kept = next;
6747
+ setShow(next);
6748
+ pi.storage.set(SHOW_EXCLUDED_KEY, next || null).catch(() => {
6749
+ return;
6750
+ });
6751
+ }, []);
6752
+ return [show, change];
6753
+ }
6754
+
6755
+ // web-src/explorer-transfer.tsx
6756
+ var DRAG_OPEN_MS = 600;
6757
+ function acceptsDrop(dataTransfer) {
6758
+ return dataTransfer.types.includes("Files") || pi.ui.fileDrag.has(dataTransfer);
6759
+ }
6760
+ function useExplorerTransfer(host) {
6761
+ const { root } = host;
6762
+ const [dropTarget, setDropTarget] = React.useState();
6763
+ const [transfer, setTransfer] = React.useState();
6764
+ const filePicker = React.useRef(null);
6765
+ const folderPicker = React.useRef(null);
6766
+ const pickedFolder = React.useRef("");
6767
+ const dragOpen = React.useRef(undefined);
6768
+ const upload = async (folder, pending) => {
6769
+ let batch;
6770
+ try {
6771
+ batch = await pending;
6772
+ } catch (error) {
6773
+ pi.ui.notify(t("uploadFailed", { message: Host.message(error) }), "error");
6774
+ return;
5104
6775
  }
5105
- for (const group of node.items) {
5106
- file(group, depth);
6776
+ if (!batch.files.length && !batch.folders.length) {
6777
+ return;
6778
+ }
6779
+ const replaced = host.taken(folder, UploadUtil.topNames(batch));
6780
+ if (replaced.length && !await pi.ui.confirm(t("replaceTitle", { names: replaced.join(", ") }), t("replaceMessage"), { confirmLabel: t("replace") })) {
6781
+ return;
6782
+ }
6783
+ if (folder) {
6784
+ host.expandTo(folder);
6785
+ }
6786
+ setTransfer({ label: t("uploading", { name: "" }), done: 0, total: UploadUtil.totalBytes(batch) });
6787
+ try {
6788
+ const count = await WorkspaceClient.upload(root, folder, batch, (done, total, name) => setTransfer({ label: t("uploading", { name }), done, total }));
6789
+ pi.ui.notify(t("uploaded", { count }));
6790
+ } catch (error) {
6791
+ pi.ui.notify(t("uploadFailed", { message: Host.message(error) }), "error");
6792
+ } finally {
6793
+ setTransfer(undefined);
6794
+ await host.reloadFolder(folder);
5107
6795
  }
5108
6796
  };
5109
- if (tree) {
5110
- folder(tree, 0);
5111
- } else {
5112
- for (const group of groups) {
5113
- file(group, 0);
6797
+ const pickFiles = (folder, folders) => {
6798
+ pickedFolder.current = folder;
6799
+ (folders ? folderPicker : filePicker).current?.click();
6800
+ };
6801
+ const onPicked = (event) => {
6802
+ const files = Array.from(event.target.files ?? []);
6803
+ event.target.value = "";
6804
+ if (files.length) {
6805
+ upload(pickedFolder.current, Promise.resolve(UploadUtil.fromFiles(files)));
5114
6806
  }
5115
- }
5116
- return rows;
5117
- }
5118
- function folderKeys(node) {
6807
+ };
6808
+ const download = async (entry) => {
6809
+ try {
6810
+ if (entry.kind === "directory") {
6811
+ setTransfer({ label: t("packing", { name: entry.name }), done: 0, total: 0 });
6812
+ }
6813
+ await WorkspaceClient.download(root, entry, (done, total) => setTransfer({ label: t("packing", { name: entry.name }), done, total }));
6814
+ } catch (error) {
6815
+ pi.ui.notify(t("downloadFailed", { message: Host.message(error) }), "error");
6816
+ } finally {
6817
+ setTransfer(undefined);
6818
+ }
6819
+ };
6820
+ const stopDragOpen = () => {
6821
+ clearTimeout(dragOpen.current?.timer);
6822
+ dragOpen.current = undefined;
6823
+ };
6824
+ const dragOver = (event, folder, entry) => {
6825
+ if (!acceptsDrop(event.dataTransfer)) {
6826
+ return;
6827
+ }
6828
+ event.preventDefault();
6829
+ event.stopPropagation();
6830
+ event.dataTransfer.dropEffect = event.dataTransfer.types.includes("Files") ? "copy" : "move";
6831
+ if (dropTarget !== folder) {
6832
+ setDropTarget(folder);
6833
+ }
6834
+ const closed = entry?.kind === "directory" && !host.expanded.has(entry.path) ? entry : undefined;
6835
+ if (dragOpen.current?.path !== closed?.path) {
6836
+ stopDragOpen();
6837
+ if (closed) {
6838
+ dragOpen.current = { path: closed.path, timer: setTimeout(() => host.toggle(closed), DRAG_OPEN_MS) };
6839
+ }
6840
+ }
6841
+ };
6842
+ const drop = (event, folder) => {
6843
+ if (!acceptsDrop(event.dataTransfer)) {
6844
+ return;
6845
+ }
6846
+ event.preventDefault();
6847
+ event.stopPropagation();
6848
+ setDropTarget(undefined);
6849
+ stopDragOpen();
6850
+ if (event.dataTransfer.types.includes("Files")) {
6851
+ upload(folder, UploadUtil.fromDrop(event.dataTransfer));
6852
+ return;
6853
+ }
6854
+ const dragged = pi.ui.fileDrag.get(event.dataTransfer);
6855
+ if (dragged?.cwd === root) {
6856
+ host.move(dragged.paths, folder);
6857
+ }
6858
+ };
6859
+ const dragLeave = (event) => {
6860
+ if (!event.currentTarget.contains(event.relatedTarget)) {
6861
+ setDropTarget(undefined);
6862
+ stopDragOpen();
6863
+ }
6864
+ };
6865
+ const dragEnd = () => {
6866
+ setDropTarget(undefined);
6867
+ stopDragOpen();
6868
+ };
6869
+ const view = /* @__PURE__ */ React.createElement(React.Fragment, null, transfer && /* @__PURE__ */ React.createElement("div", {
6870
+ className: "taw-transfer",
6871
+ role: "status"
6872
+ }, /* @__PURE__ */ React.createElement("span", null, transfer.label), transfer.total > 0 && /* @__PURE__ */ React.createElement("span", {
6873
+ className: "taw-detail"
6874
+ }, Math.floor(transfer.done / transfer.total * 100), "%"), /* @__PURE__ */ React.createElement("span", {
6875
+ className: "taw-transfer-bar",
6876
+ style: { width: transfer.total > 0 ? `${transfer.done / transfer.total * 100}%` : "0%" }
6877
+ })), /* @__PURE__ */ React.createElement("input", {
6878
+ ref: filePicker,
6879
+ type: "file",
6880
+ multiple: true,
6881
+ hidden: true,
6882
+ onChange: onPicked
6883
+ }), /* @__PURE__ */ React.createElement("input", {
6884
+ ref: (element) => {
6885
+ folderPicker.current = element;
6886
+ element?.setAttribute("webkitdirectory", "");
6887
+ },
6888
+ type: "file",
6889
+ hidden: true,
6890
+ onChange: onPicked
6891
+ }));
6892
+ return { transfer: view, dropTarget, upload, pickFiles, download, dragOver, drop, dragLeave, dragEnd };
6893
+ }
6894
+
6895
+ // web-src/search.tsx
6896
+ var DEBOUNCE_MS = 300;
6897
+ var searches = new Map;
6898
+ var SearchRequests = new Channel;
6899
+ var INDENT = 12;
6900
+ var matchKey = (match) => `${match.path}:${match.line}:${match.column}`;
6901
+ function dismisses(key, match) {
6902
+ return key === match.path || key === matchKey(match) || key.endsWith("/") && match.path.startsWith(key);
6903
+ }
6904
+ function resultRows(groups, tree, collapsed) {
6905
+ const rows = [];
6906
+ const file = (group, depth) => {
6907
+ rows.push({ kind: "file", group, depth });
6908
+ if (!collapsed.has(group.path)) {
6909
+ for (const match of group.matches) {
6910
+ rows.push({ kind: "match", match, depth });
6911
+ }
6912
+ }
6913
+ };
6914
+ const folder = (node, depth) => {
6915
+ for (const inner of node.folders) {
6916
+ const key = `${inner.path}/`;
6917
+ rows.push({ kind: "folder", key, folder: inner, depth });
6918
+ if (!collapsed.has(key)) {
6919
+ folder(inner, depth + 1);
6920
+ }
6921
+ }
6922
+ for (const group of node.items) {
6923
+ file(group, depth);
6924
+ }
6925
+ };
6926
+ if (tree) {
6927
+ folder(tree, 0);
6928
+ } else {
6929
+ for (const group of groups) {
6930
+ file(group, 0);
6931
+ }
6932
+ }
6933
+ return rows;
6934
+ }
6935
+ function folderKeys(node) {
5119
6936
  return node.folders.flatMap((inner) => [`${inner.path}/`, ...folderKeys(inner)]);
5120
6937
  }
5121
6938
  function onToggleKey(event, toggle) {
@@ -5371,8 +7188,9 @@ function SearchView() {
5371
7188
  role: "tree",
5372
7189
  "aria-label": t("search")
5373
7190
  }, state.error && /* @__PURE__ */ React.createElement(Empty, {
5374
- tone: "error"
5375
- }, t("failed", { message: state.error })), rows.map((row) => {
7191
+ tone: "error",
7192
+ title: t("failed", { message: state.error })
7193
+ }), rows.map((row) => {
5376
7194
  if (row.kind === "folder") {
5377
7195
  const open = !state.collapsed.includes(row.key);
5378
7196
  const paths = groups.filter((group) => WorkspaceUtil.within(group.path, row.folder.path)).map((group) => group.path);
@@ -5510,12 +7328,23 @@ function ExplorerView() {
5510
7328
  const [selected, setSelected] = React.useState();
5511
7329
  const [editing, setEditing] = React.useState();
5512
7330
  const [picking, setPicking] = React.useState(false);
7331
+ const [revealing, setRevealing] = React.useState();
7332
+ const [shownRoot, setShownRoot] = React.useState(root);
7333
+ const [showExcluded, setShowExcluded] = useShowExcluded();
5513
7334
  const [menu, openMenu] = useContextMenu();
7335
+ if (shownRoot !== root) {
7336
+ setShownRoot(root);
7337
+ setSelected(undefined);
7338
+ setEditing(undefined);
7339
+ }
5514
7340
  const list2 = React.useRef(null);
5515
- const git = useLoad(() => WorkspaceClient.status(root, true).catch(() => {
7341
+ const desktop = pi.ui.desktop;
7342
+ const showsInFileManager = !!desktop && !TaLocation.isRemote(root);
7343
+ const git = useLoad(async () => ({ root, status: await WorkspaceClient.status(root, true).catch(() => {
5516
7344
  return;
5517
- }), [root, changed]);
5518
- const decorations = React.useMemo(() => git.value?.repository ? GitUtil.decorations(git.value) : NO_DECORATIONS, [git.value]);
7345
+ }) }), [root, changed]);
7346
+ const status = git.value?.root === root ? git.value.status : undefined;
7347
+ const decorations = React.useMemo(() => status?.repository ? GitUtil.decorations(status) : NO_DECORATIONS, [status]);
5519
7348
  const FolderPicker = pi.ui.FolderPicker;
5520
7349
  const load = React.useCallback(async (dirs) => {
5521
7350
  const read = await Promise.all(dirs.map(async (dir) => {
@@ -5547,8 +7376,8 @@ function ExplorerView() {
5547
7376
  return;
5548
7377
  }
5549
7378
  let live = true;
5550
- pi.storage.directory(root).get(EXPANDED_KEY).then((kept) => {
5551
- const paths = WorkspaceUtil.paths(kept);
7379
+ pi.storage.directory(root).get(EXPANDED_KEY).then((kept2) => {
7380
+ const paths = WorkspaceUtil.paths(kept2);
5552
7381
  if (live) {
5553
7382
  setTree((previous) => ({ ...previous, restored: true, expanded: new Set([...previous.expanded, ...paths]) }));
5554
7383
  load(paths);
@@ -5579,18 +7408,21 @@ function ExplorerView() {
5579
7408
  reveal(active.slice(prefix.length));
5580
7409
  }
5581
7410
  }, [active, root]);
5582
- ShowDirectory.useReceive((directory) => {
5583
- setRoot(directory);
5584
- setSelected(undefined);
5585
- });
7411
+ ShowDirectory.useReceive((directory) => setRoot(directory));
5586
7412
  RevealRequests.useReceive((request) => {
5587
- if (request.cwd === root || request.cwd === cwd) {
5588
- if (request.cwd !== root) {
5589
- setRoot(request.cwd);
5590
- }
7413
+ if (request.cwd === root) {
5591
7414
  reveal(request.path);
7415
+ } else if (request.cwd === cwd) {
7416
+ setRoot(cwd);
7417
+ setRevealing({ root: cwd, path: request.path });
5592
7418
  }
5593
7419
  });
7420
+ React.useEffect(() => {
7421
+ if (revealing?.root === root) {
7422
+ setRevealing(undefined);
7423
+ reveal(revealing.path);
7424
+ }
7425
+ }, [revealing, root]);
5594
7426
  React.useEffect(() => {
5595
7427
  if (selected) {
5596
7428
  list2.current?.querySelector(`[data-path="${CSS.escape(selected)}"]`)?.scrollIntoView({ block: "nearest" });
@@ -5684,6 +7516,59 @@ function ExplorerView() {
5684
7516
  pi.ui.notify(t("deleteFailed", { message: Host.message(error) }), "error");
5685
7517
  }
5686
7518
  };
7519
+ const reloadFolder = async (folder) => {
7520
+ await load([folder, ...[...tree.expanded].filter((dir) => dir !== folder && WorkspaceUtil.within(dir, folder))]);
7521
+ FilesChanged.notify();
7522
+ };
7523
+ const taken = (folder, names) => {
7524
+ const there = siblings(folder).map((name) => name.toLowerCase());
7525
+ return names.filter((name) => there.includes(name.toLowerCase()));
7526
+ };
7527
+ const move = async (paths, folder) => {
7528
+ const moving = WorkspaceUtil.movable(paths, folder);
7529
+ if (!moving.length) {
7530
+ return;
7531
+ }
7532
+ const clash = taken(folder, moving.map(WorkspaceUtil.basename));
7533
+ if (clash.length) {
7534
+ pi.ui.notify(t("moveExists", { name: clash[0] }), "error");
7535
+ return;
7536
+ }
7537
+ const reopen = OpenFiles.list().filter((file) => file.kind === "file" && file.cwd === root && moving.some((path) => WorkspaceUtil.within(file.detail, path)));
7538
+ try {
7539
+ await WorkspaceClient.move(root, moving, folder);
7540
+ for (const path of moving) {
7541
+ closeEditorsOf(root, path);
7542
+ }
7543
+ for (const file of reopen) {
7544
+ const to = WorkspaceUtil.movedTo(file.detail, moving, folder);
7545
+ if (to) {
7546
+ openFile(root, to, undefined, { preserveFocus: true });
7547
+ }
7548
+ }
7549
+ expand((previous) => new Set([...previous].map((path) => WorkspaceUtil.movedTo(path, moving, folder) ?? path)));
7550
+ if (folder) {
7551
+ expand((previous) => WorkspaceUtil.reveal(new Set([...previous, folder]), folder));
7552
+ }
7553
+ await load([...new Set([folder, ...moving.map(WorkspaceUtil.dirname)])]);
7554
+ setSelected(WorkspaceUtil.movedTo(moving[0], moving, folder));
7555
+ FilesChanged.notify();
7556
+ } catch (error) {
7557
+ pi.ui.notify(t("moveFailed", { message: Host.message(error) }), "error");
7558
+ }
7559
+ };
7560
+ const { transfer, dropTarget, pickFiles, download, dragOver, drop, dragLeave, dragEnd } = useExplorerTransfer({
7561
+ root,
7562
+ expanded: tree.expanded,
7563
+ expandTo: (folder) => expand((previous) => WorkspaceUtil.reveal(new Set([...previous, folder]), folder)),
7564
+ taken,
7565
+ reloadFolder,
7566
+ toggle,
7567
+ move
7568
+ });
7569
+ const showInFileManager = (path) => {
7570
+ desktop?.showItemInFolder(absolute(path)).catch((error) => pi.ui.notify(t("revealFailed", { message: Host.message(error) }), "error"));
7571
+ };
5687
7572
  const absolute = (path) => path ? `${root.replace(/\/+$/, "")}/${path}` : root;
5688
7573
  const findInFolder = (path) => {
5689
7574
  SearchRequests.send({ cwd: root, include: path ? `${path}/**` : "" });
@@ -5695,11 +7580,25 @@ function ExplorerView() {
5695
7580
  { label: t("newFile"), run: () => startCreate(false, folder) },
5696
7581
  { label: t("newFolder"), run: () => startCreate(true, folder) }
5697
7582
  ];
7583
+ const fileManager = desktop && showsInFileManager ? [{ label: t(WorkspaceUtil.fileManagerLabel(desktop.platform)), run: () => showInFileManager(entry?.path ?? "") }] : [];
7584
+ const transfers = [
7585
+ { label: t("uploadFiles"), run: () => pickFiles(folder, false) },
7586
+ { label: t("uploadFolder"), run: () => pickFiles(folder, true) },
7587
+ {
7588
+ label: t("download"),
7589
+ run: () => void download(entry ?? { path: "", name: WorkspaceUtil.basename(TaLocation.path(root)) || "workspace", kind: "directory" })
7590
+ }
7591
+ ];
5698
7592
  if (!entry) {
5699
7593
  return [
5700
7594
  ...items,
5701
7595
  "-",
7596
+ ...fileManager,
5702
7597
  { label: t("findInFolder"), run: () => findInFolder("") },
7598
+ "-",
7599
+ ...transfers,
7600
+ "-",
7601
+ { label: t("copyPath"), run: () => copyText(root, t("copied")) },
5703
7602
  { label: t("refresh"), run: () => void load(["", ...tree.expanded]) }
5704
7603
  ];
5705
7604
  }
@@ -5707,8 +7606,11 @@ function ExplorerView() {
5707
7606
  ...items,
5708
7607
  "-",
5709
7608
  ...entry.kind === "file" ? [{ label: t("open"), run: () => openFile(root, entry.path) }] : [],
7609
+ ...fileManager,
5710
7610
  ...entry.kind === "directory" ? [{ label: t("findInFolder"), run: () => findInFolder(entry.path) }] : [],
5711
7611
  "-",
7612
+ ...transfers,
7613
+ "-",
5712
7614
  { label: t("copyPath"), keys: MAC ? "⌥⌘C" : "Shift+Alt+C", run: () => copyText(absolute(entry.path), t("copied")) },
5713
7615
  { label: t("copyRelativePath"), run: () => copyText(entry.path, t("copied")) },
5714
7616
  "-",
@@ -5716,7 +7618,7 @@ function ExplorerView() {
5716
7618
  { label: t("delete"), keys: MAC ? "⌘⌫" : "Delete", run: () => void remove(entry) }
5717
7619
  ];
5718
7620
  };
5719
- const rows = WorkspaceUtil.rows(tree.children, tree.expanded);
7621
+ const rows = WorkspaceUtil.rows(tree.children, tree.expanded, showExcluded ? undefined : (entry) => TaExcludedFiles.has(entry.name));
5720
7622
  const activate = (entry, pin) => {
5721
7623
  setSelected(entry.path);
5722
7624
  if (entry.kind === "directory") {
@@ -5729,7 +7631,7 @@ function ExplorerView() {
5729
7631
  };
5730
7632
  const onKey = (event, entry, expanded) => {
5731
7633
  const row = event.currentTarget;
5732
- const move = (to) => {
7634
+ const move2 = (to) => {
5733
7635
  const path = to?.dataset.path;
5734
7636
  if (path !== undefined) {
5735
7637
  setSelected(path);
@@ -5742,22 +7644,22 @@ function ExplorerView() {
5742
7644
  if (!expanded) {
5743
7645
  toggle(entry);
5744
7646
  } else {
5745
- move(row.nextElementSibling);
7647
+ move2(row.nextElementSibling);
5746
7648
  }
5747
7649
  } else if (event.key === "ArrowLeft") {
5748
7650
  event.preventDefault();
5749
7651
  if (expanded) {
5750
7652
  toggle(entry);
5751
7653
  } else {
5752
- move(list2.current?.querySelector(`[data-path="${CSS.escape(WorkspaceUtil.dirname(entry.path))}"]`));
7654
+ move2(list2.current?.querySelector(`[data-path="${CSS.escape(WorkspaceUtil.dirname(entry.path))}"]`));
5753
7655
  }
5754
7656
  } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
5755
7657
  event.preventDefault();
5756
- move(event.key === "ArrowDown" ? row.nextElementSibling : row.previousElementSibling);
7658
+ move2(event.key === "ArrowDown" ? row.nextElementSibling : row.previousElementSibling);
5757
7659
  } else if (event.key === "Home" || event.key === "End") {
5758
7660
  event.preventDefault();
5759
7661
  const rowsShown = all();
5760
- move(event.key === "Home" ? rowsShown[0] : rowsShown[rowsShown.length - 1]);
7662
+ move2(event.key === "Home" ? rowsShown[0] : rowsShown[rowsShown.length - 1]);
5761
7663
  } else if (event.key === "Enter" && MAC) {
5762
7664
  event.preventDefault();
5763
7665
  setEditing({ kind: "rename", path: entry.path });
@@ -5812,7 +7714,7 @@ function ExplorerView() {
5812
7714
  "aria-expanded": entry.kind === "directory" ? expanded : undefined,
5813
7715
  "aria-level": depth + 1,
5814
7716
  "aria-selected": selected === entry.path,
5815
- className: `taw-row taw-tree-row ${selected === entry.path ? "taw-selected" : ""} ${ignored ? "taw-ignored" : ""} ${letter === "D" ? "taw-deleted" : ""}`,
7717
+ className: `taw-row taw-tree-row ${selected === entry.path ? "taw-selected" : ""} ${ignored ? "taw-ignored" : ""} ${letter === "D" ? "taw-deleted" : ""} ${dropTarget && WorkspaceUtil.within(entry.path, dropTarget) ? "taw-drop" : ""}`,
5816
7718
  style: { paddingLeft: 8 + depth * INDENT2 },
5817
7719
  title: letter ? `${entry.path} • ${gitLabel(letter)}` : entry.path,
5818
7720
  onClick: () => !renaming && activate(entry, false),
@@ -5821,7 +7723,15 @@ function ExplorerView() {
5821
7723
  onContextMenu: (event) => {
5822
7724
  setSelected(entry.path);
5823
7725
  openMenu(event, menuFor(entry));
5824
- }
7726
+ },
7727
+ draggable: !renaming,
7728
+ onDragStart: (event) => {
7729
+ setSelected(entry.path);
7730
+ event.dataTransfer.effectAllowed = "copyMove";
7731
+ pi.ui.fileDrag.set(event.dataTransfer, { cwd: root, paths: [entry.path] });
7732
+ },
7733
+ onDragOver: (event) => dragOver(event, entry.kind === "directory" ? entry.path : WorkspaceUtil.dirname(entry.path), entry),
7734
+ onDrop: (event) => drop(event, entry.kind === "directory" ? entry.path : WorkspaceUtil.dirname(entry.path))
5825
7735
  }, /* @__PURE__ */ React.createElement(Guides, {
5826
7736
  depth
5827
7737
  }), /* @__PURE__ */ React.createElement("span", {
@@ -5874,26 +7784,39 @@ function ExplorerView() {
5874
7784
  icon: "ChevronsDownUp",
5875
7785
  label: t("collapseAll"),
5876
7786
  onClick: () => expand(() => new Set)
7787
+ }), /* @__PURE__ */ React.createElement(Action, {
7788
+ icon: "Eye",
7789
+ label: t("showExcluded"),
7790
+ active: showExcluded,
7791
+ onClick: () => setShowExcluded(!showExcluded)
5877
7792
  }), /* @__PURE__ */ React.createElement(Action, {
5878
7793
  icon: "FolderOpen",
5879
7794
  label: t("changeFolder"),
5880
7795
  onClick: () => setPicking(true)
5881
7796
  })), /* @__PURE__ */ React.createElement("div", {
5882
7797
  ref: list2,
5883
- className: "taw-list taw-tree",
7798
+ className: `taw-list taw-tree ${dropTarget === "" ? "taw-drop-root" : ""}`,
5884
7799
  role: "tree",
5885
7800
  "aria-label": t("explorer"),
5886
7801
  onContextMenu: (event) => event.target === event.currentTarget && openMenu(event, menuFor()),
5887
7802
  onClick: (event) => event.target === event.currentTarget && setSelected(undefined),
5888
- onKeyDown: (event) => event.key === "Escape" && setSelected(undefined)
7803
+ onKeyDown: (event) => event.key === "Escape" && setSelected(undefined),
7804
+ onDragOver: (event) => dragOver(event, ""),
7805
+ onDrop: (event) => drop(event, ""),
7806
+ onDragLeave: dragLeave,
7807
+ onDragEnd: dragEnd
5889
7808
  }, tree.error && /* @__PURE__ */ React.createElement(Empty, {
5890
- tone: "error"
5891
- }, t("failed", { message: tree.error })), !tree.error && !tree.children.has("") && /* @__PURE__ */ React.createElement(Empty, null, t("loading")), !tree.error && tree.children.get("")?.length === 0 && !creating && /* @__PURE__ */ React.createElement(Empty, null, t("empty")), shown), menu, picking && /* @__PURE__ */ React.createElement(FolderPicker, {
7809
+ tone: "error",
7810
+ title: t("failed", { message: tree.error })
7811
+ }), !tree.error && !tree.children.has("") && /* @__PURE__ */ React.createElement(Empty, {
7812
+ hint: t("loading")
7813
+ }), !tree.error && tree.children.has("") && rows.length === 0 && !creating && /* @__PURE__ */ React.createElement(Empty, {
7814
+ title: t("empty")
7815
+ }), shown), transfer, menu, picking && /* @__PURE__ */ React.createElement(FolderPicker, {
5892
7816
  initial: root,
5893
7817
  onClose: () => setPicking(false),
5894
7818
  onPick: (path) => {
5895
7819
  setRoot(path);
5896
- setSelected(undefined);
5897
7820
  setPicking(false);
5898
7821
  }
5899
7822
  }));
@@ -5951,7 +7874,10 @@ function OpenFilesView() {
5951
7874
  className: "taw-list",
5952
7875
  role: "listbox",
5953
7876
  "aria-label": t("openFiles")
5954
- }, files.length === 0 && /* @__PURE__ */ React.createElement(Empty, null, t("noOpenFiles")), files.map((file) => /* @__PURE__ */ React.createElement("div", {
7877
+ }, files.length === 0 && /* @__PURE__ */ React.createElement(Empty, {
7878
+ title: t("noOpenFiles"),
7879
+ hint: t("noOpenFilesHint")
7880
+ }), files.map((file) => /* @__PURE__ */ React.createElement("div", {
5955
7881
  key: file.id,
5956
7882
  role: "option",
5957
7883
  tabIndex: 0,
@@ -6189,8 +8115,15 @@ function ScmView() {
6189
8115
  }), t("commit"))), /* @__PURE__ */ React.createElement("div", {
6190
8116
  className: "taw-list taw-scm-list"
6191
8117
  }, status.error && /* @__PURE__ */ React.createElement(Empty, {
6192
- tone: "error"
6193
- }, t("failed", { message: status.error })), !status.error && !value && /* @__PURE__ */ React.createElement(Empty, null, t("loading")), value && !value.repository && /* @__PURE__ */ React.createElement(Empty, null, t("notRepository")), value?.repository && rows.length === 0 && /* @__PURE__ */ React.createElement(Empty, null, t("noChanges")), groups.map(([group, list2]) => {
8118
+ tone: "error",
8119
+ title: t("failed", { message: status.error })
8120
+ }), !status.error && !value && /* @__PURE__ */ React.createElement(Empty, {
8121
+ hint: t("loading")
8122
+ }), value && !value.repository && /* @__PURE__ */ React.createElement(Empty, {
8123
+ title: t("notRepository")
8124
+ }), value?.repository && rows.length === 0 && /* @__PURE__ */ React.createElement(Empty, {
8125
+ title: t("noChanges")
8126
+ }), groups.map(([group, list2]) => {
6194
8127
  if (list2.length === 0) {
6195
8128
  return null;
6196
8129
  }
@@ -6320,10 +8253,10 @@ var SETI_FONT = "data:font/woff;base64,d09GRgABAAAAAJGkAAsAAAAA3RAAAQAAAAAAAAAAA
6320
8253
 
6321
8254
  // web-src/style.ts
6322
8255
  var STYLE = `
6323
- .taw-view { --taw-git-added: var(--ta-green); --taw-git-deleted: var(--ta-red); --taw-git-modified: var(--ta-yellow); --taw-git-conflict: #e4676b; position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--ta-text); font-size: 13px; }
8256
+ .taw-view { --taw-git-added: var(--ta-green); --taw-git-deleted: var(--ta-red); --taw-git-modified: var(--ta-yellow); --taw-git-conflict: #e4676b; position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--ta-text); font-size: calc(13px * var(--ta-font-scale)); }
6324
8257
  :root[data-theme='light'] .taw-view { --taw-git-modified: #b8860b; --taw-git-conflict: #ad0707; }
6325
8258
  .taw-view-head { display: flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px 0 12px; flex: none; }
6326
- .taw-view-title { flex: 1; min-width: 0; font-size: 12px; font-weight: 600; color: var(--ta-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
8259
+ .taw-view-title { flex: 1; min-width: 0; font-size: calc(12px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
6327
8260
  .taw-actions { display: flex; gap: 2px; }
6328
8261
  .taw-action { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: none; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--ta-muted); cursor: pointer; }
6329
8262
  .taw-action:hover:not(:disabled) { background: var(--ta-hover); color: var(--ta-text); }
@@ -6331,6 +8264,7 @@ var STYLE = `
6331
8264
  .taw-action.taw-on { background: var(--ta-selected); color: var(--ta-text); }
6332
8265
  .taw-action:focus-visible, .taw-row:focus-visible, .taw-row-main:focus-visible, .taw-button:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
6333
8266
  .taw-list { flex: 1; min-height: 0; overflow: auto; padding: 0 4px 12px; }
8267
+ .taw-list:has(> .ta-empty) { display: flex; flex-direction: column; }
6334
8268
  .taw-row { position: relative; display: flex; align-items: center; gap: 6px; width: 100%; height: 24px; padding: 0 6px 0 8px; border: 0; border-radius: 6px; background: none; color: var(--ta-body); font: inherit; text-align: left; cursor: pointer; user-select: none; outline: none; }
6335
8269
  .taw-row:hover { background: var(--ta-hover); }
6336
8270
  .taw-row.taw-selected { background: var(--ta-selected); color: var(--ta-text); }
@@ -6348,37 +8282,41 @@ var STYLE = `
6348
8282
  .taw-guides { position: absolute; inset: 0; pointer-events: none; }
6349
8283
  .taw-guide { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ta-border); opacity: 0; transition: opacity 120ms; }
6350
8284
  .taw-tree:hover .taw-guide { opacity: 1; }
8285
+ .taw-tree-row.taw-drop, .taw-tree-row.taw-drop:hover { background: color-mix(in srgb, var(--ta-border-focus) 16%, transparent); }
8286
+ .taw-tree.taw-drop-root { box-shadow: inset 0 0 0 1px var(--ta-border-focus); background: color-mix(in srgb, var(--ta-border-focus) 8%, transparent); }
8287
+ .taw-transfer { position: relative; flex: none; display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-top: 1px solid var(--ta-border-muted); color: var(--ta-secondary); font-size: calc(12px * var(--ta-font-scale)); overflow: hidden; }
8288
+ .taw-transfer > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
8289
+ .taw-transfer .taw-detail { flex: none; }
8290
+ .taw-transfer-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--ta-border-focus); transition: width 0.2s ease; }
6351
8291
  .taw-editing { cursor: default; background: none !important; }
6352
8292
  .taw-name-input { position: relative; flex: 1; min-width: 0; display: flex; }
6353
- .taw-input.taw-inline { height: 22px; padding: 0 4px; border-radius: 4px; font-size: 13px; }
8293
+ .taw-input.taw-inline { height: 22px; padding: 0 4px; border-radius: 4px; font-size: calc(13px * var(--ta-font-scale)); }
6354
8294
  .taw-input.taw-inline.taw-error { border-color: var(--ta-red); }
6355
8295
  .taw-input.taw-inline.taw-warning { border-color: var(--ta-yellow); }
6356
- .taw-input-message { padding: 4px 6px; border-radius: 4px; font-size: 12px; line-height: 1.4; white-space: normal; }
8296
+ .taw-input-message { padding: 4px 6px; border-radius: 4px; font-size: calc(12px * var(--ta-font-scale)); line-height: 1.4; white-space: normal; }
6357
8297
  .taw-name-input .taw-input-message { position: absolute; z-index: 5; top: 100%; left: 0; right: 0; margin-top: 1px; box-shadow: var(--ta-shadow-pop); }
6358
8298
  .taw-input-message.taw-error { background: color-mix(in srgb, var(--ta-red) 16%, var(--ta-card)); border: 1px solid var(--ta-red); color: var(--ta-text); }
6359
8299
  .taw-input-message.taw-warning { background: color-mix(in srgb, var(--ta-yellow) 16%, var(--ta-card)); border: 1px solid var(--ta-yellow); color: var(--ta-text); }
6360
8300
  .taw-menu { position: fixed; z-index: 80; min-width: 210px; max-width: 320px; display: flex; flex-direction: column; gap: 1px; padding: 6px; border-radius: 12px; border: 1px solid var(--ta-border); background: var(--ta-side); box-shadow: var(--ta-shadow-pop); animation: taw-fade 100ms ease-out; }
6361
- .taw-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex: none; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ta-text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; outline: none; }
8301
+ .taw-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex: none; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ta-text); font: inherit; font-size: calc(13px * var(--ta-font-scale)); text-align: left; cursor: pointer; outline: none; }
6362
8302
  .taw-menu-item:hover:not(:disabled), .taw-menu-item:focus-visible { background: var(--ta-hover); }
6363
8303
  .taw-menu-item:disabled { opacity: 0.45; cursor: default; }
6364
- .taw-menu-item kbd { font-family: inherit; font-size: 12px; color: var(--ta-muted); }
8304
+ .taw-menu-item kbd { font-family: inherit; font-size: calc(12px * var(--ta-font-scale)); color: var(--ta-muted); }
6365
8305
  .taw-menu-line { flex: none; height: 1px; margin: 5px 8px; border: 0; background: var(--ta-border-muted); }
6366
8306
  @keyframes taw-fade { from { opacity: 0; } }
6367
8307
  .taw-section-head { display: flex; align-items: center; gap: 4px; height: 26px; margin-top: 6px; padding-right: 6px; border-radius: 6px; }
6368
8308
  .taw-section-head:hover { background: var(--ta-hover); }
6369
- .taw-section-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; height: 100%; padding: 0 0 0 4px; border: 0; background: none; color: var(--ta-secondary); font: inherit; font-size: 12px; font-weight: 600; text-align: left; cursor: pointer; }
8309
+ .taw-section-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; height: 100%; padding: 0 0 0 4px; border: 0; background: none; color: var(--ta-secondary); font: inherit; font-size: calc(12px * var(--ta-font-scale)); font-weight: 600; text-align: left; cursor: pointer; }
6370
8310
  .taw-section-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
6371
- .taw-badge { flex: none; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--ta-chip); color: var(--ta-secondary); font-size: 11px; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
8311
+ .taw-badge { flex: none; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--ta-chip); color: var(--ta-secondary); font-size: calc(11px * var(--ta-font-scale)); line-height: calc(18px * var(--ta-font-scale)); text-align: center; font-variant-numeric: tabular-nums; }
6372
8312
  .taw-twisty { display: inline-flex; width: 14px; flex: none; color: var(--ta-muted); }
6373
8313
  .taw-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
6374
- .taw-detail { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; }
6375
- .taw-count { margin-left: auto; padding: 0 6px; border-radius: 8px; background: var(--ta-chip); color: var(--ta-secondary); font-size: 11px; line-height: 16px; }
6376
- .taw-letter { margin-left: auto; width: 14px; flex: none; text-align: center; font-size: 12px; font-weight: 600; }
6377
- .taw-group { display: flex; align-items: center; gap: 6px; margin: 8px 0 2px; padding: 0 8px; font-size: 11px; font-weight: 600; color: var(--ta-secondary); }
6378
- .taw-empty { padding: 12px; color: var(--ta-muted); font-size: 12px; line-height: 1.6; }
6379
- .taw-empty p { margin: 0 0 8px; }
8314
+ .taw-detail { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
8315
+ .taw-count { margin-left: auto; padding: 0 6px; border-radius: 8px; background: var(--ta-chip); color: var(--ta-secondary); font-size: calc(11px * var(--ta-font-scale)); line-height: calc(16px * var(--ta-font-scale)); }
8316
+ .taw-letter { margin-left: auto; width: 14px; flex: none; text-align: center; font-size: calc(12px * var(--ta-font-scale)); font-weight: 600; }
8317
+ .taw-group { display: flex; align-items: center; gap: 6px; margin: 8px 0 2px; padding: 0 8px; font-size: calc(11px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-secondary); }
6380
8318
  .taw-error { color: var(--ta-red); }
6381
- .taw-note { color: var(--ta-muted); font-size: 12px; }
8319
+ .taw-note { color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
6382
8320
  .taw-pad { padding: 8px; margin: 0; line-height: 1.6; }
6383
8321
  .taw-button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--ta-border); border-radius: 6px; background: var(--ta-card); color: var(--ta-text); font: inherit; cursor: pointer; }
6384
8322
  .taw-button:hover { background: var(--ta-hover); }
@@ -6388,24 +8326,24 @@ var STYLE = `
6388
8326
  .taw-search-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
6389
8327
  .taw-search-fields .taw-field { flex: none; align-items: flex-start; }
6390
8328
  .taw-search-fields .taw-field .taw-action { margin-top: 3px; width: 22px; height: 22px; }
6391
- .taw-field .taw-input.taw-search-input { resize: none; height: auto; min-height: 28px; padding: 5px 4px 5px 8px; line-height: 18px; overflow: hidden; }
8329
+ .taw-field .taw-input.taw-search-input { resize: none; height: auto; min-height: 28px; padding: 5px 4px 5px 8px; line-height: calc(18px * var(--ta-font-scale)); overflow: hidden; }
6392
8330
  .taw-field.taw-invalid { border-color: var(--ta-red); }
6393
8331
  .taw-replace-row { display: flex; align-items: center; gap: 2px; }
6394
8332
  .taw-replace-row .taw-field { flex: 1; }
6395
8333
  .taw-details-toggle { display: flex; justify-content: flex-end; margin: -4px 0 -6px; }
6396
8334
  .taw-details-toggle .taw-action { width: 22px; height: 16px; }
6397
8335
  .taw-search-details { display: flex; flex-direction: column; gap: 6px; }
6398
- .taw-search-label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--ta-secondary); }
6399
- .taw-search-label .taw-input { flex: none; height: 28px; font-size: 12.5px; }
8336
+ .taw-search-label { display: flex; flex-direction: column; gap: 3px; font-size: calc(11px * var(--ta-font-scale)); color: var(--ta-secondary); }
8337
+ .taw-search-label .taw-input { flex: none; height: 28px; font-size: calc(12.5px * var(--ta-font-scale)); }
6400
8338
  .taw-results-head { display: flex; align-items: center; gap: 4px; min-height: 26px; padding: 0 8px 0 12px; flex: none; }
6401
- .taw-results-summary { flex: 1; min-width: 0; color: var(--ta-muted); font-size: 12px; }
8339
+ .taw-results-summary { flex: 1; min-width: 0; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
6402
8340
  .taw-results-summary .taw-summary { padding: 0; }
6403
8341
  .taw-progress { display: block; width: 100%; height: 2px; border-radius: 1px; background: linear-gradient(90deg, transparent, var(--ta-accent), transparent) 0 0 / 40% 100% no-repeat; animation: taw-slide 1s linear infinite; }
6404
8342
  .taw-progress-bar { position: absolute; left: 0; right: 0; top: 30px; height: 2px; background: linear-gradient(90deg, transparent, var(--ta-accent), transparent) 0 0 / 30% 100% no-repeat; animation: taw-slide 1.1s linear infinite; z-index: 2; }
6405
8343
  @keyframes taw-slide { from { background-position: -40% 0; } to { background-position: 140% 0; } }
6406
8344
  .taw-result-file { padding-right: 6px; }
6407
8345
  .taw-commit { display: flex; flex-direction: column; gap: 8px; padding: 2px 10px 10px; flex: none; }
6408
- .taw-input.taw-commit-input { flex: none; resize: none; height: auto; min-height: 34px; max-height: 200px; padding: 7px 10px; border-radius: 8px; line-height: 18px; }
8346
+ .taw-input.taw-commit-input { flex: none; resize: none; height: auto; min-height: 34px; max-height: 200px; padding: 7px 10px; border-radius: 8px; line-height: calc(18px * var(--ta-font-scale)); }
6409
8347
  .taw-button.taw-commit-button { justify-content: center; height: 30px; border-radius: 8px; border-color: var(--ta-border); background: var(--ta-raised); color: var(--ta-secondary); font-weight: 500; transition: background 120ms, color 120ms, opacity 120ms; }
6410
8348
  .taw-button.taw-commit-button:hover:not(:disabled) { background: var(--ta-hover-strong); color: var(--ta-text); }
6411
8349
  /* With a message, it stands out a little, without a bright bar in the side panel. */
@@ -6419,27 +8357,27 @@ var STYLE = `
6419
8357
  .taw-scm-row { padding-right: 6px; }
6420
8358
  .taw-field { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; padding-right: 2px; border: 1px solid var(--ta-border-field); border-radius: 6px; background: var(--ta-input); }
6421
8359
  .taw-field:focus-within { border-color: var(--ta-border-focus); }
6422
- .taw-input { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--ta-border-field); border-radius: 6px; background: var(--ta-input); color: var(--ta-text); font: inherit; font-size: 13px; outline: none; }
8360
+ .taw-input { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--ta-border-field); border-radius: 6px; background: var(--ta-input); color: var(--ta-text); font: inherit; font-size: calc(13px * var(--ta-font-scale)); outline: none; }
6423
8361
  .taw-input:focus { border-color: var(--ta-border-focus); }
6424
8362
  .taw-field .taw-input { height: 28px; border: 0; background: none; }
6425
- .taw-summary { padding: 4px 8px 6px; color: var(--ta-muted); font-size: 12px; }
8363
+ .taw-summary { padding: 4px 8px 6px; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
6426
8364
  .taw-match { padding-left: 36px; padding-right: 6px; }
6427
- .taw-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: pre; color: var(--ta-body); font-size: 12.5px; }
8365
+ .taw-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: pre; color: var(--ta-body); font-size: calc(12.5px * var(--ta-font-scale)); }
6428
8366
  .taw-preview mark { background: color-mix(in srgb, var(--ta-yellow) 32%, transparent); color: inherit; border-radius: 2px; }
6429
8367
  .taw-preview del { background: color-mix(in srgb, var(--ta-red) 22%, transparent); color: inherit; text-decoration: line-through; }
6430
8368
  .taw-preview ins { background: color-mix(in srgb, var(--ta-green) 24%, transparent); color: inherit; text-decoration: none; }
6431
- .taw-chip { padding: 0 6px; border-radius: 8px; background: var(--ta-chip); font-size: 11px; line-height: 18px; }
8369
+ .taw-chip { padding: 0 6px; border-radius: 8px; background: var(--ta-chip); font-size: calc(11px * var(--ta-font-scale)); line-height: calc(18px * var(--ta-font-scale)); }
6432
8370
  .taw-editor { display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--ta-main); color: var(--ta-text); }
6433
- .taw-editor-head { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px; border-bottom: 1px solid var(--ta-border-muted); font-size: 12px; color: var(--ta-secondary); flex: none; }
8371
+ .taw-editor-head { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px; border-bottom: 1px solid var(--ta-border-muted); font-size: calc(12px * var(--ta-font-scale)); color: var(--ta-secondary); flex: none; }
6434
8372
  .taw-editor-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--ta-mono); }
6435
8373
  .taw-view > .taw-editor { flex: 1; height: auto; }
6436
- .taw-browser { display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--ta-text); font-size: 13px; }
8374
+ .taw-browser { display: flex; flex-direction: column; height: 100%; min-height: 0; color: var(--ta-text); font-size: calc(13px * var(--ta-font-scale)); }
6437
8375
  .taw-browser-bar { position: relative; display: flex; align-items: center; gap: 2px; height: 42px; padding: 0 8px; border-bottom: 1px solid var(--ta-border-muted); flex: none; }
6438
8376
  .taw-browser-bar > .taw-action { width: 28px; height: 28px; border-radius: 7px; }
6439
8377
  .taw-address { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 30px; margin: 0 4px; padding: 0 3px 0 11px; border: 1px solid transparent; border-radius: 15px; background: var(--ta-chip); transition: background-color 120ms, border-color 120ms; }
6440
8378
  .taw-address:hover { background: color-mix(in srgb, var(--ta-chip) 70%, var(--ta-text) 6%); }
6441
8379
  .taw-address:focus-within { border-color: var(--ta-border-focus); background: var(--ta-input); }
6442
- .taw-address input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; color: var(--ta-text); font: inherit; font-size: 12.5px; outline: none; text-overflow: ellipsis; }
8380
+ .taw-address input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; color: var(--ta-text); font: inherit; font-size: calc(12.5px * var(--ta-font-scale)); outline: none; text-overflow: ellipsis; }
6443
8381
  .taw-address input::placeholder { color: var(--ta-muted); }
6444
8382
  .taw-address-icon { display: inline-flex; flex: none; color: var(--ta-muted); }
6445
8383
  .taw-address-go { width: 24px; height: 24px; border-radius: 12px; }
@@ -6451,33 +8389,33 @@ var STYLE = `
6451
8389
  .taw-browser-blank .taw-browser-hero { margin: auto 0; }
6452
8390
  .taw-browser-hero { display: flex; flex-direction: column; align-items: center; max-width: 380px; text-align: center; }
6453
8391
  .taw-browser-mark { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-bottom: 14px; border-radius: 14px; background: var(--ta-chip); color: var(--ta-secondary); }
6454
- .taw-browser-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--ta-text); }
6455
- .taw-browser-sub { margin: 6px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ta-muted); }
8392
+ .taw-browser-title { margin: 0; font-size: calc(14px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-text); }
8393
+ .taw-browser-sub { margin: 6px 0 0; font-size: calc(12.5px * var(--ta-font-scale)); line-height: 1.6; color: var(--ta-muted); }
6456
8394
  .taw-browser-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 16px; }
6457
- .taw-browser-chip { height: 26px; padding: 0 10px; border: 1px solid var(--ta-border); border-radius: 13px; background: none; color: var(--ta-secondary); font-family: var(--ta-mono); font-size: 11px; cursor: pointer; transition: background-color 120ms, color 120ms; }
8395
+ .taw-browser-chip { height: 26px; padding: 0 10px; border: 1px solid var(--ta-border); border-radius: 13px; background: none; color: var(--ta-secondary); font-family: var(--ta-mono); font-size: calc(11px * var(--ta-font-scale)); cursor: pointer; transition: background-color 120ms, color 120ms; }
6458
8396
  .taw-browser-chip:hover { background: var(--ta-hover); color: var(--ta-text); }
6459
8397
  .taw-browser-recent { width: 100%; max-width: 480px; margin-top: 32px; }
6460
- .taw-browser-heading { margin: 0 0 4px; padding: 0 10px; font-size: 11px; font-weight: 600; color: var(--ta-secondary); }
8398
+ .taw-browser-heading { margin: 0 0 4px; padding: 0 10px; font-size: calc(11px * var(--ta-font-scale)); font-weight: 600; color: var(--ta-secondary); }
6461
8399
  .taw-browser-site { display: flex; align-items: center; border-radius: 8px; }
6462
8400
  .taw-browser-site:hover { background: var(--ta-hover); }
6463
8401
  .taw-browser-site-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 4px 0 8px; border: 0; background: none; color: var(--ta-body); font: inherit; text-align: left; cursor: pointer; outline: none; }
6464
- .taw-browser-letter { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--ta-chip); color: var(--ta-secondary); font-size: 11px; font-weight: 600; }
8402
+ .taw-browser-letter { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--ta-chip); color: var(--ta-secondary); font-size: calc(11px * var(--ta-font-scale)); font-weight: 600; }
6465
8403
  .taw-browser-host { flex: none; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-text); }
6466
- .taw-browser-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: 12px; }
8404
+ .taw-browser-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); font-size: calc(12px * var(--ta-font-scale)); }
6467
8405
  .taw-browser-remove { margin-right: 6px; opacity: 0; }
6468
8406
  .taw-browser-site:hover .taw-browser-remove, .taw-browser-remove:focus-visible { opacity: 1; }
6469
8407
  .taw-browser-site-main:focus-visible { box-shadow: inset 0 0 0 1px var(--ta-border-focus); border-radius: 8px; }
6470
- .taw-browser-foot { margin: auto 0 0; padding-top: 24px; max-width: 340px; text-align: center; font-size: 11.5px; line-height: 1.6; color: var(--ta-muted); opacity: 0.8; }
8408
+ .taw-browser-foot { margin: auto 0 0; padding-top: 24px; max-width: 340px; text-align: center; font-size: calc(11.5px * var(--ta-font-scale)); line-height: 1.6; color: var(--ta-muted); opacity: 0.8; }
6471
8409
  .taw-editor-tools { display: flex; align-items: center; gap: 8px; flex: none; min-width: 0; }
6472
8410
  .taw-editor-tools .taw-note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
6473
8411
  .taw-warning { color: var(--ta-yellow); }
6474
8412
  .taw-link { padding: 0; border: 0; background: none; color: var(--ta-link); font: inherit; cursor: pointer; }
6475
8413
  .taw-link:hover { text-decoration: underline; }
6476
- .taw-button.taw-small { height: 24px; padding: 0 8px; font-size: 12px; flex: none; }
8414
+ .taw-button.taw-small { height: 24px; padding: 0 8px; font-size: calc(12px * var(--ta-font-scale)); flex: none; }
6477
8415
  .taw-button:disabled { opacity: 0.6; cursor: default; }
6478
8416
  .taw-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ta-text); }
6479
8417
  .taw-segmented { display: inline-flex; flex: none; min-inline-size: 0; margin: 0; border: 0; padding: 2px; border-radius: 7px; background: var(--ta-chip); }
6480
- .taw-segmented > button { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border: 0; border-radius: 5px; background: none; color: var(--ta-secondary); font: inherit; font-size: 12px; cursor: pointer; }
8418
+ .taw-segmented > button { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border: 0; border-radius: 5px; background: none; color: var(--ta-secondary); font: inherit; font-size: calc(12px * var(--ta-font-scale)); cursor: pointer; }
6481
8419
  .taw-segmented > button:hover { color: var(--ta-text); }
6482
8420
  .taw-segmented > button.taw-on { background: var(--ta-main); color: var(--ta-text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
6483
8421
  .taw-segmented > button:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; }
@@ -6493,492 +8431,176 @@ var STYLE = `
6493
8431
  .taw-preview-image.taw-actual { align-items: flex-start; justify-content: flex-start; }
6494
8432
  .taw-preview-image.taw-actual .taw-image-toggle { max-width: none; max-height: none; margin: auto; cursor: zoom-out; }
6495
8433
  .taw-preview-image.taw-actual img { max-width: none; max-height: none; }
6496
- .taw-message { padding: 16px; color: var(--ta-muted); font-size: 13px; }
6497
- .taw-code { flex: 1; min-height: 0; overflow: auto; padding: 6px 0; background: var(--ta-code); font-family: var(--ta-mono); font-size: 12px; line-height: 20px; }
8434
+ .taw-message { padding: 16px; color: var(--ta-muted); font-size: calc(13px * var(--ta-font-scale)); }
8435
+ .taw-code { flex: 1; min-height: 0; overflow: auto; padding: 6px 0; background: var(--ta-code); font-family: var(--ta-mono); font-size: calc(12px * var(--ta-font-scale)); line-height: calc(20px * var(--ta-font-scale)); }
6498
8436
  .taw-code-block { content-visibility: auto; }
6499
8437
  .taw-code-line { display: flex; min-width: max-content; white-space: pre; }
6500
8438
  .taw-code-line.taw-current { background: var(--ta-selected); }
6501
8439
  .taw-gutter { position: sticky; left: 0; flex: none; width: var(--taw-gutter, 5ch); padding-right: 12px; background: var(--ta-code); color: var(--ta-muted); text-align: right; user-select: none; }
6502
8440
  .taw-text { padding-right: 16px; }
6503
- .taw-hint { flex: none; padding: 4px 12px; border-bottom: 1px solid var(--ta-border-muted); background: var(--ta-raised); color: var(--ta-secondary); font-size: 12px; }
8441
+ .taw-hint { flex: none; padding: 4px 12px; border-bottom: 1px solid var(--ta-border-muted); background: var(--ta-raised); color: var(--ta-secondary); font-size: calc(12px * var(--ta-font-scale)); }
6504
8442
  .taw-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
6505
- .taw-terminal { position: relative; flex: 1; min-height: 0; overflow: auto; padding: 8px; background: var(--ta-code); color: var(--ta-text); cursor: text; font-family: var(--ta-mono); font-size: 12px; line-height: 18px; }
6506
- .taw-screen { margin: 0; font-family: var(--ta-mono); font-size: 12px; line-height: 18px; white-space: pre; }
6507
- .taw-screen-line { position: relative; min-height: 18px; }
6508
- .taw-cursor { position: absolute; top: 2px; width: 1ch; height: 14px; background: var(--ta-text); opacity: 0.55; pointer-events: none; }
6509
- .taw-terminal:not(:focus-within) .taw-cursor { background: none; outline: 1px solid var(--ta-muted); outline-offset: -1px; }
8443
+ .taw-browser-stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
8444
+ .taw-webview { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
8445
+ .taw-browser-driven { display: inline-flex; align-items: center; flex: none; gap: 6px; height: 22px; margin-right: 2px; padding: 0 9px 0 8px; border-radius: 11px; background: color-mix(in srgb, var(--ta-green) 14%, transparent); color: var(--ta-green); font-size: calc(11.5px * var(--ta-font-scale)); white-space: nowrap; }
8446
+ .taw-browser-driven-dot { width: 6px; height: 6px; border-radius: 3px; background: currentColor; animation: taw-pulse 1.2s ease-in-out infinite; }
8447
+ @keyframes taw-pulse { 50% { opacity: 0.35; } }
8448
+ .taw-browser-import { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; padding: 0; border: 0; background: none; color: var(--ta-secondary); font: inherit; font-size: calc(12.5px * var(--ta-font-scale)); cursor: pointer; }
8449
+ .taw-browser-import:hover { color: var(--ta-text); text-decoration: underline; text-underline-offset: 3px; }
8450
+ .taw-import { display: flex; flex-direction: column; gap: 12px; width: min(420px, 80vw); font-size: calc(13px * var(--ta-font-scale)); color: var(--ta-text); }
8451
+ .taw-import-hint { margin: 0; color: var(--ta-secondary); line-height: 1.6; }
8452
+ .taw-import-error { margin: 0; color: var(--ta-red); line-height: 1.5; overflow-wrap: anywhere; }
8453
+ .taw-import-profiles { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto; }
8454
+ .taw-import-profile { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
8455
+ .taw-import-profile:hover { background: var(--ta-hover); }
8456
+ .taw-import-profile.taw-on { border-color: var(--ta-border-focus); background: var(--ta-hover); }
8457
+ .taw-import-profile input { position: absolute; opacity: 0; pointer-events: none; }
8458
+ .taw-import-browser { flex: none; font-weight: 500; }
8459
+ .taw-import-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); }
8460
+ .taw-import-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
8461
+ .taw-import-result { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 0 0; }
8462
+ .taw-import-result .taw-import-actions { justify-content: center; margin-top: 18px; }
8463
+ .taw-button.taw-primary { border-color: var(--ta-brand); background: var(--ta-brand); color: var(--ta-brand-text); font-weight: 500; }
8464
+ .taw-button.taw-primary:hover:not(:disabled) { background: var(--ta-brand); opacity: 0.88; }
8465
+ .taw-button:disabled { opacity: 0.45; cursor: default; }
8466
+ .taw-link { padding: 0; border: 0; background: none; color: var(--ta-muted); font: inherit; font-size: calc(12.5px * var(--ta-font-scale)); cursor: pointer; }
8467
+ .taw-link:hover:not(:disabled) { color: var(--ta-text); text-decoration: underline; text-underline-offset: 3px; }
8468
+ .taw-address-favicon { width: 14px; height: 14px; border-radius: 3px; object-fit: contain; }
8469
+ .taw-browser-failure { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; background: var(--ta-main); text-align: center; }
8470
+ .taw-browser-failure .taw-browser-sub { max-width: 380px; overflow-wrap: anywhere; }
8471
+ .taw-terminal { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--ta-code); }
6510
8472
  @media (pointer: coarse) {
6511
8473
  .taw-row { height: 36px; }
6512
8474
  .taw-action { width: 32px; height: 32px; }
6513
8475
  .taw-row-actions { display: flex; }
6514
8476
  .taw-guide { opacity: 1; }
6515
- .taw-input { height: 34px; font-size: 16px; }
6516
- .taw-field .taw-input, .taw-search-label .taw-input { height: 34px; font-size: 16px; }
6517
- .taw-field .taw-input.taw-search-input { min-height: 34px; padding-top: 7px; padding-bottom: 7px; line-height: 20px; }
8477
+ .taw-input { height: 34px; font-size: calc(16px * var(--ta-font-scale)); }
8478
+ .taw-field .taw-input, .taw-search-label .taw-input { height: 34px; font-size: calc(16px * var(--ta-font-scale)); }
8479
+ .taw-field .taw-input.taw-search-input { min-height: 34px; padding-top: 7px; padding-bottom: 7px; line-height: calc(20px * var(--ta-font-scale)); }
6518
8480
  .taw-search-fields .taw-field .taw-action { width: 30px; height: 30px; margin-top: 2px; }
6519
8481
  .taw-search-toggle { width: 26px; padding-top: 10px; }
6520
8482
  .taw-input.taw-commit-input { min-height: 40px; }
6521
- .taw-address input { font-size: 16px; }
8483
+ .taw-address input { font-size: calc(16px * var(--ta-font-scale)); }
6522
8484
  .taw-browser-remove { opacity: 1; }
6523
8485
  }
6524
8486
  .taw-file-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden; font-family: 'taw-seti'; font-style: normal; font-weight: normal; line-height: 1; color: var(--taw-icon); -webkit-font-smoothing: antialiased; speak: never; }
6525
8487
  :root[data-theme='light'] .taw-file-icon { color: var(--taw-icon-light); }
6526
- .taw-terminal-tabs { display: flex; align-items: center; gap: 2px; min-height: 32px; padding: 0 6px; border-bottom: 1px solid var(--ta-border-muted); background: var(--ta-side); overflow-x: auto; scrollbar-width: none; flex: none; }
6527
- .taw-terminal-tab { display: flex; align-items: center; flex: none; max-width: 200px; border-radius: 6px; color: var(--ta-muted); }
6528
- .taw-terminal-tab:hover { background: var(--ta-hover); }
8488
+ /* Terminals: a bar on the terminal's own background (its title, or tabs when there are more), the screen, and under it the keys of a touch screen or how it ended. */
8489
+ .taw-terminals .taw-editor { background: var(--ta-code); }
8490
+ .taw-terminal-bar { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 6px 0 8px; flex: none; background: var(--ta-code); }
8491
+ .taw-terminal-tabs { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; height: 100%; overflow-x: auto; scrollbar-width: none; }
8492
+ .taw-terminal-tabs::-webkit-scrollbar { display: none; }
8493
+ .taw-terminal-tab { display: flex; align-items: center; flex: none; max-width: 200px; height: 26px; padding-right: 3px; border-radius: 6px; color: var(--ta-muted); transition: background-color 0.12s, color 0.12s; }
8494
+ .taw-terminal-tab:hover { background: var(--ta-hover); color: var(--ta-secondary); }
6529
8495
  .taw-terminal-tab.taw-on { background: var(--ta-selected); color: var(--ta-text); }
6530
- .taw-terminal-tab > button:first-child { display: flex; align-items: center; gap: 6px; min-width: 0; height: 24px; padding: 0 2px 0 8px; border: 0; background: none; color: inherit; font: inherit; font-size: 12px; cursor: pointer; }
6531
- .taw-terminal-tab > button:first-child > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
6532
- .taw-terminal-tab > .taw-action { width: 20px; height: 20px; }
6533
- .taw-terminal-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; resize: none; }
8496
+ .taw-terminal-tab-main { display: flex; align-items: center; gap: 6px; min-width: 0; height: 100%; padding: 0 4px 0 8px; border: 0; background: none; color: inherit; font: inherit; font-size: calc(12px * var(--ta-font-scale)); cursor: pointer; }
8497
+ .taw-terminal-tab-main:focus-visible { outline: 1px solid var(--ta-border-focus); outline-offset: -1px; border-radius: 6px; }
8498
+ .taw-terminal-tab-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
8499
+ .taw-terminal-tab > .taw-action { width: 18px; height: 18px; border-radius: 4px; opacity: 0; transition: opacity 0.12s; }
8500
+ .taw-terminal-tab:hover > .taw-action, .taw-terminal-tab.taw-on > .taw-action, .taw-terminal-tab:focus-within > .taw-action { opacity: 1; }
8501
+ .taw-terminal-tab > .taw-action svg { width: 13px; height: 13px; }
8502
+ .taw-terminal-title { display: flex; align-items: center; gap: 7px; flex: 1; min-width: 0; padding: 0 6px; font-size: calc(12px * var(--ta-font-scale)); color: var(--ta-secondary); cursor: default; }
8503
+ .taw-terminal-rename { width: 140px; min-width: 0; height: 20px; padding: 0 5px; border: 1px solid var(--ta-border-focus); border-radius: 4px; background: var(--ta-input); color: var(--ta-text); font: inherit; font-size: calc(12px * var(--ta-font-scale)); outline: none; }
8504
+ .taw-terminal-dot { flex: none; width: 7px; height: 7px; margin: 0 3px; border-radius: 50%; background: var(--ta-muted); }
8505
+ .taw-terminal-dot.taw-failed { background: var(--ta-red); }
8506
+ .taw-terminal-index { flex: none; min-width: 20px; height: 16px; padding: 0 4px; border-radius: 4px; background: color-mix(in srgb, currentColor 12%, transparent); font-family: var(--ta-mono); font-size: calc(10px * var(--ta-font-scale)); font-weight: 600; line-height: calc(16px * var(--ta-font-scale)); text-align: center; letter-spacing: 0.02em; }
8507
+ .taw-terminal-tab.taw-on .taw-terminal-index { background: color-mix(in srgb, currentColor 16%, transparent); }
8508
+ /* What its program says of itself: at work (a spinner), how far (a ring), that it rang while out of sight (a dot after the title). */
8509
+ .taw-terminal-spinner { flex: none; box-sizing: border-box; width: 12px; height: 12px; margin: 0 0.5px; border: 1.6px solid color-mix(in srgb, currentColor 22%, transparent); border-top-color: var(--ta-brand); border-radius: 50%; animation: taw-terminal-spin 0.9s linear infinite; }
8510
+ @keyframes taw-terminal-spin { to { transform: rotate(360deg); } }
8511
+ .taw-terminal-progress { flex: none; transform: rotate(-90deg); }
8512
+ .taw-terminal-progress circle { fill: none; stroke-width: 1.8; }
8513
+ .taw-terminal-progress circle:first-child { stroke: color-mix(in srgb, currentColor 22%, transparent); }
8514
+ .taw-terminal-progress circle:last-child { stroke: var(--ta-brand); stroke-linecap: round; transition: stroke-dashoffset 0.3s ease; }
8515
+ .taw-terminal-progress.taw-error circle:last-child { stroke: var(--ta-red); }
8516
+ .taw-terminal-progress.taw-paused circle:last-child { stroke: var(--ta-yellow); }
8517
+ .taw-terminal-attention { flex: none; width: 6px; height: 6px; margin-left: 2px; border-radius: 50%; background: var(--ta-brand); animation: taw-terminal-pop 0.24s ease-out; }
8518
+ @keyframes taw-terminal-pop { from { transform: scale(0); } }
8519
+ .taw-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
8520
+ @media (prefers-reduced-motion: reduce) { .taw-terminal-spinner { animation-duration: 2.4s; } .taw-terminal-attention { animation: none; } }
8521
+ .taw-terminal-ended { display: flex; align-items: center; gap: 8px; flex: none; padding: 8px 12px; border-top: 1px solid var(--ta-border-muted); background: var(--ta-code); color: var(--ta-secondary); font-size: calc(12px * var(--ta-font-scale)); }
8522
+ .taw-terminal-ended-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
8523
+ .taw-terminal-ended .taw-button { height: 26px; padding: 0 9px; font-size: calc(12px * var(--ta-font-scale)); }
8524
+ .taw-touch-keys { display: none; gap: 6px; flex: none; padding: 6px 8px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--ta-border-muted); background: var(--ta-side); }
8525
+ .taw-touch-keys::-webkit-scrollbar { display: none; }
8526
+ :root[data-touch] .taw-touch-keys { display: flex; }
8527
+ .taw-touch-key { flex: none; min-width: 42px; height: 36px; padding: 0 10px; border: 1px solid var(--ta-border); border-radius: 8px; background: var(--ta-card); color: var(--ta-text); font-family: var(--ta-mono); font-size: calc(14px * var(--ta-font-scale)); -webkit-user-select: none; user-select: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
8528
+ .taw-touch-key:active { background: var(--ta-hover); }
8529
+ .taw-touch-key.taw-on { border-color: var(--ta-brand); background: var(--ta-brand); color: var(--ta-brand-text); }
8530
+ :root[data-touch] .taw-terminal-bar { height: 44px; }
8531
+ :root[data-touch] .taw-terminal-tab { height: 34px; }
8532
+ :root[data-touch] .taw-terminal-tab-main { font-size: calc(13px * var(--ta-font-scale)); }
8533
+ :root[data-touch] .taw-terminal-tab > .taw-action { width: 30px; height: 30px; }
8534
+ :root[data-touch] .taw-terminal-tab:not(.taw-on) > .taw-action { display: none; }
6534
8535
  `;
6535
8536
  function injectStyle() {
6536
8537
  const element = document.createElement("style");
6537
8538
  element.dataset.taPackage = "ta-workspace";
6538
8539
  element.textContent = `@font-face { font-family: 'taw-seti'; src: url('${SETI_FONT}') format('woff'); font-display: block; }
6539
- ${STYLE}`;
8540
+ ${STYLE}/* A finger (the page's data-touch): menus of rows of a finger's height, without the keys a keyboard would press */
8541
+ :root[data-touch] .taw-menu { min-width: 220px; border-radius: 14px; }
8542
+ :root[data-touch] .taw-menu-item { height: 44px; padding: 0 14px; font-size: calc(15px * var(--ta-font-scale)); border-radius: 10px; }
8543
+ :root[data-touch] .taw-menu-item:active:not(:disabled) { background: var(--ta-hover); }
8544
+ :root[data-touch] .taw-menu-item kbd { display: none; }
8545
+ :root[data-touch] .taw-row { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
8546
+ `;
6540
8547
  document.head.appendChild(element);
6541
8548
  return () => element.remove();
6542
8549
  }
6543
8550
 
6544
- // web-src/util/ansi.ts
6545
- var PLAIN = Object.freeze({});
6546
- var ESC = "\x1B";
6547
- var CSI = new RegExp(`^${ESC}\\[([0-?]*)([ -/]*)([@-~])`);
6548
- var DEFAULT_MAX_LINES = 2000;
6549
- var TAB = 8;
6550
-
6551
- class AnsiScreen {
6552
- cols;
6553
- rows;
6554
- maxLines;
6555
- lines = [[]];
6556
- row = 0;
6557
- col = 0;
6558
- style = PLAIN;
6559
- rest = "";
6560
- savedCursor;
6561
- version = 0;
6562
- constructor(cols = 80, rows = 24, maxLines = DEFAULT_MAX_LINES) {
6563
- this.cols = cols;
6564
- this.rows = rows;
6565
- this.maxLines = maxLines;
6566
- }
6567
- resize(cols, rows) {
6568
- this.cols = Math.max(1, cols);
6569
- this.rows = Math.max(1, rows);
6570
- this.version++;
6571
- }
6572
- feed(input) {
6573
- const text = this.rest + input;
6574
- this.rest = "";
6575
- let i = 0;
6576
- while (i < text.length) {
6577
- const char = text[i];
6578
- if (char === "\x1B") {
6579
- const used = this.escape(text, i);
6580
- if (used < 0) {
6581
- this.rest = text.slice(i);
6582
- break;
6583
- }
6584
- i += used;
6585
- continue;
6586
- }
6587
- i++;
6588
- if (char === "\r") {
6589
- this.col = 0;
6590
- } else if (char === `
6591
- `) {
6592
- this.lineFeed();
6593
- } else if (char === "\b") {
6594
- this.col = Math.max(0, this.col - 1);
6595
- } else if (char === "\t") {
6596
- this.col = Math.min(this.cols - 1, (Math.floor(this.col / TAB) + 1) * TAB);
6597
- } else if (char >= " " && char !== "") {
6598
- const code = char.charCodeAt(0);
6599
- if (code >= 55296 && code < 56320 && i < text.length) {
6600
- this.put(char + text[i]);
6601
- i++;
6602
- } else {
6603
- this.put(char);
6604
- }
6605
- }
6606
- }
6607
- this.version++;
6608
- }
6609
- clear() {
6610
- this.lines = [[]];
6611
- this.row = 0;
6612
- this.col = 0;
6613
- this.version++;
6614
- }
6615
- spans() {
6616
- return this.lines.map((line) => {
6617
- const spans = [];
6618
- for (const cell of line) {
6619
- const last = spans[spans.length - 1];
6620
- if (last && last.style === cell.style) {
6621
- last.text += cell.char;
6622
- } else {
6623
- spans.push({ text: cell.char, style: cell.style });
6624
- }
6625
- }
6626
- return spans;
6627
- });
6628
- }
6629
- text() {
6630
- return this.lines.map((line) => line.map((cell) => cell.char).join("").trimEnd()).join(`
6631
- `);
6632
- }
6633
- cursor() {
6634
- return { row: this.row, col: this.col };
6635
- }
6636
- put(char) {
6637
- if (this.col >= this.cols) {
6638
- this.col = 0;
6639
- this.lineFeed();
6640
- }
6641
- const line = this.lines[this.row];
6642
- while (line.length < this.col) {
6643
- line.push({ char: " ", style: PLAIN });
6644
- }
6645
- line[this.col] = { char, style: this.style };
6646
- this.col++;
6647
- }
6648
- lineFeed() {
6649
- this.row++;
6650
- if (this.row === this.lines.length) {
6651
- this.lines.push([]);
6652
- }
6653
- if (this.lines.length > this.maxLines) {
6654
- const drop = this.lines.length - this.maxLines;
6655
- this.lines.splice(0, drop);
6656
- this.row -= drop;
6657
- }
6658
- }
6659
- top() {
6660
- return Math.max(0, this.lines.length - this.rows);
6661
- }
6662
- escape(text, start) {
6663
- const kind = text[start + 1];
6664
- if (kind === undefined) {
6665
- return -1;
6666
- }
6667
- if (kind === "[") {
6668
- const found = CSI.exec(text.slice(start, start + 64));
6669
- if (!found) {
6670
- return text.length - start < 64 ? -1 : 2;
6671
- }
6672
- this.csi(found[1], found[3]);
6673
- return found[0].length;
6674
- }
6675
- if (kind === "]" || kind === "P" || kind === "_" || kind === "^") {
6676
- const bel = text.indexOf("\x07", start + 2);
6677
- const st = text.indexOf("\x1B\\", start + 2);
6678
- const end = bel < 0 ? st : st < 0 ? bel : Math.min(bel, st);
6679
- if (end < 0) {
6680
- return -1;
6681
- }
6682
- return end - start + (end === bel ? 1 : 2);
6683
- }
6684
- if (kind === "(" || kind === ")" || kind === "#") {
6685
- return text.length - start < 3 ? -1 : 3;
6686
- }
6687
- if (kind === "7") {
6688
- this.savedCursor = { row: this.row, col: this.col };
6689
- } else if (kind === "8" && this.savedCursor) {
6690
- ({ row: this.row, col: this.col } = this.savedCursor);
6691
- } else if (kind === "M") {
6692
- this.row = Math.max(this.top(), this.row - 1);
6693
- } else if (kind === "c") {
6694
- this.clear();
6695
- this.style = PLAIN;
6696
- }
6697
- return 2;
6698
- }
6699
- csi(params, final) {
6700
- if (params.startsWith("?") || params.startsWith(">") || params.startsWith("=")) {
6701
- if (/^\?(1049|47|1047)$/.test(params) && (final === "h" || final === "l")) {
6702
- this.eraseScreen(2);
6703
- }
8551
+ // web-src/util/terminal.ts
8552
+ var CTRL_SYMBOLS = { "@": "\x00", " ": "\x00", "[": "\x1B", "\\": "\x1C", "]": "\x1D", "^": "\x1E", _: "\x1F", "?": "" };
8553
+ var TerminalUtil;
8554
+ ((TerminalUtil) => {
8555
+ function title(raw) {
8556
+ const text = raw?.trim();
8557
+ if (!text) {
6704
8558
  return;
6705
8559
  }
6706
- const values = params.split(";").map((value) => value === "" ? undefined : Number(value));
6707
- const n = values[0] ?? 1;
6708
- switch (final) {
6709
- case "m":
6710
- this.sgr(values.map((value) => value ?? 0));
6711
- break;
6712
- case "A":
6713
- this.row = Math.max(this.top(), this.row - n);
6714
- break;
6715
- case "B":
6716
- this.moveRow(this.row + n);
6717
- break;
6718
- case "C":
6719
- this.col = Math.min(this.cols - 1, this.col + n);
6720
- break;
6721
- case "D":
6722
- this.col = Math.max(0, this.col - n);
6723
- break;
6724
- case "E":
6725
- this.moveRow(this.row + n);
6726
- this.col = 0;
6727
- break;
6728
- case "F":
6729
- this.row = Math.max(this.top(), this.row - n);
6730
- this.col = 0;
6731
- break;
6732
- case "G":
6733
- this.col = Math.min(this.cols - 1, Math.max(0, n - 1));
6734
- break;
6735
- case "H":
6736
- case "f":
6737
- this.moveRow(this.top() + Math.max(0, (values[0] ?? 1) - 1));
6738
- this.col = Math.min(this.cols - 1, Math.max(0, (values[1] ?? 1) - 1));
6739
- break;
6740
- case "J":
6741
- this.eraseScreen(values[0] ?? 0);
6742
- break;
6743
- case "K":
6744
- this.eraseLine(values[0] ?? 0);
6745
- break;
6746
- case "P":
6747
- this.lines[this.row].splice(this.col, n);
6748
- break;
6749
- case "X":
6750
- for (let i = this.col;i < Math.min(this.col + n, this.lines[this.row].length); i++) {
6751
- this.lines[this.row][i] = { char: " ", style: PLAIN };
6752
- }
6753
- break;
6754
- case "@":
6755
- if (this.col < this.lines[this.row].length) {
6756
- this.lines[this.row].splice(this.col, 0, ...Array.from({ length: n }, () => ({ char: " ", style: PLAIN })));
6757
- }
6758
- break;
6759
- case "s":
6760
- this.savedCursor = { row: this.row, col: this.col };
6761
- break;
6762
- case "u":
6763
- if (this.savedCursor) {
6764
- ({ row: this.row, col: this.col } = this.savedCursor);
6765
- }
6766
- break;
8560
+ const at = text.lastIndexOf(":");
8561
+ const where = at < 0 ? "" : text.slice(at + 1).trim();
8562
+ if (where === "~") {
8563
+ return where;
6767
8564
  }
8565
+ return /[\\/]/.test(where) ? dir(where.replace(/[\\/]+$/, "")) || text : text;
6768
8566
  }
6769
- moveRow(row) {
6770
- while (this.lines.length <= row) {
6771
- this.lines.push([]);
6772
- }
6773
- this.row = row;
8567
+ TerminalUtil.title = title;
8568
+ function dir(cwd) {
8569
+ return cwd && /^[\\/]+$/.test(cwd) ? "/" : WorkspaceUtil.basename(cwd.replace(/\\/g, "/"));
6774
8570
  }
6775
- eraseLine(mode) {
6776
- const line = this.lines[this.row];
6777
- if (mode === 0) {
6778
- line.length = Math.min(line.length, this.col);
6779
- } else if (mode === 1) {
6780
- for (let i = 0;i <= Math.min(this.col, line.length - 1); i++) {
6781
- line[i] = { char: " ", style: PLAIN };
6782
- }
6783
- } else {
6784
- line.length = 0;
6785
- }
6786
- }
6787
- eraseScreen(mode) {
6788
- if (mode === 0) {
6789
- this.eraseLine(0);
6790
- this.lines.length = this.row + 1;
6791
- } else if (mode === 1) {
6792
- for (let i = this.top();i < this.row; i++) {
6793
- this.lines[i] = [];
6794
- }
6795
- this.eraseLine(1);
6796
- } else {
6797
- if (mode === 3) {
6798
- this.lines = [[]];
6799
- } else {
6800
- const used = this.lines.length > 1 || this.lines[0].length > 0;
6801
- for (let i = 0;used && i < this.rows; i++) {
6802
- this.lines.push([]);
6803
- }
6804
- }
6805
- this.row = this.top();
6806
- this.col = 0;
6807
- if (this.lines.length > this.maxLines) {
6808
- const drop = this.lines.length - this.maxLines;
6809
- this.lines.splice(0, drop);
6810
- this.row -= drop;
6811
- }
6812
- }
6813
- }
6814
- sgr(values) {
6815
- const style = { ...this.style };
6816
- for (let i = 0;i < values.length; i++) {
6817
- const value = values[i];
6818
- if (value === 0) {
6819
- for (const key of Object.keys(style)) {
6820
- delete style[key];
6821
- }
6822
- } else if (value === 1) {
6823
- style.bold = true;
6824
- } else if (value === 2) {
6825
- style.dim = true;
6826
- } else if (value === 3) {
6827
- style.italic = true;
6828
- } else if (value === 4) {
6829
- style.underline = true;
6830
- } else if (value === 7) {
6831
- style.inverse = true;
6832
- } else if (value === 22) {
6833
- delete style.bold;
6834
- delete style.dim;
6835
- } else if (value === 23) {
6836
- delete style.italic;
6837
- } else if (value === 24) {
6838
- delete style.underline;
6839
- } else if (value === 27) {
6840
- delete style.inverse;
6841
- } else if (value >= 30 && value <= 37) {
6842
- style.fg = value - 30;
6843
- } else if (value >= 90 && value <= 97) {
6844
- style.fg = value - 90 + 8;
6845
- } else if (value === 39) {
6846
- delete style.fg;
6847
- } else if (value >= 40 && value <= 47) {
6848
- style.bg = value - 40;
6849
- } else if (value >= 100 && value <= 107) {
6850
- style.bg = value - 100 + 8;
6851
- } else if (value === 49) {
6852
- delete style.bg;
6853
- } else if (value === 38 || value === 48) {
6854
- const key = value === 38 ? "fg" : "bg";
6855
- if (values[i + 1] === 5 && values[i + 2] !== undefined) {
6856
- style[key] = values[i + 2];
6857
- i += 2;
6858
- } else if (values[i + 1] === 2 && values[i + 4] !== undefined) {
6859
- style[key] = `#${values.slice(i + 2, i + 5).map((part) => Math.min(255, part).toString(16).padStart(2, "0")).join("")}`;
6860
- i += 4;
6861
- }
6862
- }
6863
- }
6864
- this.style = Object.keys(style).length ? style : PLAIN;
8571
+ TerminalUtil.dir = dir;
8572
+ function shellName(shell) {
8573
+ return WorkspaceUtil.basename(shell.replace(/\\/g, "/")).replace(/\.exe$/i, "");
6865
8574
  }
6866
- }
6867
- var AnsiUtil;
6868
- ((AnsiUtil) => {
6869
- const BASIC = ["--ta-text", "--ta-red", "--ta-green", "--ta-yellow", "--ta-blue", "#c084fc", "#22d3ee", "--ta-secondary"];
6870
- const STEPS = [0, 95, 135, 175, 215, 255];
6871
- function color(value) {
6872
- if (value === undefined || typeof value === "string") {
6873
- return value;
6874
- }
6875
- if (value < 16) {
6876
- if (value % 8 === 0) {
6877
- return "var(--ta-muted)";
6878
- }
6879
- const name = value === 15 ? "--ta-text" : BASIC[value % 8];
6880
- return name.startsWith("--") ? `var(${name})` : name;
6881
- }
6882
- if (value < 232) {
6883
- const n = value - 16;
6884
- return `rgb(${STEPS[Math.floor(n / 36)]}, ${STEPS[Math.floor(n / 6) % 6]}, ${STEPS[n % 6]})`;
6885
- }
6886
- const gray = 8 + (value - 232) * 10;
6887
- return `rgb(${gray}, ${gray}, ${gray})`;
6888
- }
6889
- AnsiUtil.color = color;
6890
- function css(style) {
6891
- if (style === PLAIN || !Object.keys(style).length) {
6892
- return;
6893
- }
6894
- let fg = color(style.fg);
6895
- let bg = color(style.bg);
6896
- if (style.inverse) {
6897
- [fg, bg] = [bg ?? "var(--ta-main)", fg ?? "var(--ta-text)"];
6898
- }
6899
- const css2 = {};
6900
- if (fg) {
6901
- css2.color = fg;
6902
- }
6903
- if (bg) {
6904
- css2.background = bg;
6905
- }
6906
- if (style.bold) {
6907
- css2.fontWeight = "600";
6908
- }
6909
- if (style.dim) {
6910
- css2.opacity = "0.65";
6911
- }
6912
- if (style.italic) {
6913
- css2.fontStyle = "italic";
6914
- }
6915
- if (style.underline) {
6916
- css2.textDecoration = "underline";
6917
- }
6918
- return css2;
8575
+ TerminalUtil.shellName = shellName;
8576
+ function titles(terminals, fallback) {
8577
+ return terminals.map((terminal) => terminal.name || terminal.title || shellName(terminal.shell) || fallback);
6919
8578
  }
6920
- AnsiUtil.css = css;
6921
- })(AnsiUtil ||= {});
6922
-
6923
- // web-src/util/keys.ts
6924
- var KEYS = {
6925
- Enter: "\r",
6926
- Backspace: "",
6927
- Tab: "\t",
6928
- Escape: "\x1B",
6929
- ArrowUp: "\x1B[A",
6930
- ArrowDown: "\x1B[B",
6931
- ArrowRight: "\x1B[C",
6932
- ArrowLeft: "\x1B[D",
6933
- Home: "\x1B[H",
6934
- End: "\x1B[F",
6935
- Delete: "\x1B[3~",
6936
- Insert: "\x1B[2~",
6937
- PageUp: "\x1B[5~",
6938
- PageDown: "\x1B[6~"
6939
- };
6940
- var TerminalKeys;
6941
- ((TerminalKeys) => {
6942
- function sequence(event) {
6943
- if (event.metaKey) {
6944
- return;
6945
- }
6946
- if (event.key === "Tab" && event.shiftKey) {
6947
- return "\x1B[Z";
8579
+ TerminalUtil.titles = titles;
8580
+ function ctrl(data) {
8581
+ if (data.length !== 1) {
8582
+ return data;
6948
8583
  }
6949
- const special = KEYS[event.key];
6950
- if (special) {
6951
- return event.altKey ? `\x1B${special}` : special;
8584
+ if (/[a-z]/i.test(data)) {
8585
+ return String.fromCharCode(data.toUpperCase().charCodeAt(0) - 64);
6952
8586
  }
6953
- if (event.ctrlKey && event.key.length === 1) {
6954
- const code = event.key.toUpperCase().charCodeAt(0);
6955
- if (code >= 64 && code <= 95) {
6956
- return String.fromCharCode(code - 64);
6957
- }
6958
- if (event.key === " ") {
6959
- return "\x00";
6960
- }
6961
- }
6962
- return;
6963
- }
6964
- TerminalKeys.sequence = sequence;
6965
- function paste(text) {
6966
- return text.replace(/\r?\n/g, "\r");
8587
+ return CTRL_SYMBOLS[data] ?? data;
6967
8588
  }
6968
- TerminalKeys.paste = paste;
6969
- })(TerminalKeys ||= {});
8589
+ TerminalUtil.ctrl = ctrl;
8590
+ })(TerminalUtil ||= {});
6970
8591
 
6971
8592
  // web-src/terminal.tsx
6972
- var LINE_HEIGHT = 18;
6973
- var SCROLLBACK = 1000;
6974
8593
  var RESIZE_MS = 120;
8594
+ var OPEN_COLS = 100;
8595
+ var OPEN_ROWS = 30;
6975
8596
  var Terminals;
6976
8597
  ((Terminals) => {
6977
- const sessions = new Map;
8598
+ let sessions = new Map;
6978
8599
  const closed = new Set;
6979
8600
  const listeners = new Set;
6980
8601
  let list2 = [];
6981
8602
  let frame = 0;
8603
+ let seen;
6982
8604
  function all() {
6983
8605
  return list2;
6984
8606
  }
@@ -7003,10 +8625,56 @@ var Terminals;
7003
8625
  });
7004
8626
  }
7005
8627
  }
8628
+ function create(info, name) {
8629
+ const terminal = pi.ui.createTerminal({ cols: OPEN_COLS, rows: OPEN_ROWS, cwd: info.cwd || undefined });
8630
+ const created = { info, terminal, name };
8631
+ const id = info.terminalId;
8632
+ terminal.onData((data) => {
8633
+ if (created.exitCode !== undefined) {
8634
+ return;
8635
+ }
8636
+ if (created.ctrl) {
8637
+ created.ctrl = false;
8638
+ data = TerminalUtil.ctrl(data);
8639
+ changed();
8640
+ }
8641
+ pi.terminals.writeTerminal(id, data).catch(() => {
8642
+ return;
8643
+ });
8644
+ });
8645
+ let timer;
8646
+ terminal.onResize(({ cols, rows }) => {
8647
+ clearTimeout(timer);
8648
+ timer = setTimeout(() => void pi.terminals.resizeTerminal(id, cols, rows).catch(() => {
8649
+ return;
8650
+ }), RESIZE_MS);
8651
+ });
8652
+ terminal.onCwdChange(() => changed());
8653
+ terminal.onTitleChange((raw) => {
8654
+ const title = TerminalUtil.title(raw);
8655
+ if (title && title !== created.title) {
8656
+ created.title = title;
8657
+ changed();
8658
+ }
8659
+ });
8660
+ terminal.onProgressChange((progress) => {
8661
+ created.progress = progress;
8662
+ changed();
8663
+ });
8664
+ terminal.onAttention(() => {
8665
+ const element = seen?.terminalId === created.info.terminalId ? seen.element : undefined;
8666
+ const inSight = element?.isConnected && element.offsetParent !== null && !document.hidden;
8667
+ if (!inSight && !created.attention) {
8668
+ created.attention = true;
8669
+ changed();
8670
+ }
8671
+ });
8672
+ return created;
8673
+ }
7006
8674
  function add(info) {
7007
8675
  let session = sessions.get(info.terminalId);
7008
8676
  if (!session) {
7009
- session = { info, screen: new AnsiScreen(80, 24, SCROLLBACK) };
8677
+ session = create(info);
7010
8678
  sessions.set(info.terminalId, session);
7011
8679
  changed();
7012
8680
  }
@@ -7018,23 +8686,74 @@ var Terminals;
7018
8686
  return;
7019
8687
  }
7020
8688
  const session = sessions.get(terminalId) ?? add({ terminalId, cwd: "", shell: "", pty: true });
7021
- session.screen.feed(data);
8689
+ session.terminal.write(data);
7022
8690
  if (exitCode !== undefined && exitCode !== null) {
7023
8691
  session.exitCode = exitCode;
7024
- session.screen.feed(`\r
7025
- ${t("terminalEnded", { code: exitCode })}\r
7026
- `);
8692
+ session.ctrl = false;
8693
+ session.terminal.write("\x1B[?25l");
8694
+ changed();
7027
8695
  }
7028
- changed();
7029
8696
  }
7030
8697
  Terminals.receive = receive;
7031
8698
  function remove(terminalId) {
7032
- if (sessions.delete(terminalId)) {
8699
+ const session = sessions.get(terminalId);
8700
+ if (session && sessions.delete(terminalId)) {
8701
+ session.terminal.dispose();
7033
8702
  closed.add(terminalId);
7034
8703
  changed();
7035
8704
  }
7036
8705
  }
7037
8706
  Terminals.remove = remove;
8707
+ function rename(terminalId, name) {
8708
+ const session = sessions.get(terminalId);
8709
+ if (session && session.name !== name) {
8710
+ session.name = name;
8711
+ changed();
8712
+ }
8713
+ }
8714
+ Terminals.rename = rename;
8715
+ function see(terminalId, element) {
8716
+ seen = { terminalId, element };
8717
+ const session = sessions.get(terminalId);
8718
+ if (session?.attention) {
8719
+ session.attention = false;
8720
+ changed();
8721
+ }
8722
+ return () => {
8723
+ if (seen?.element === element) {
8724
+ seen = undefined;
8725
+ }
8726
+ };
8727
+ }
8728
+ Terminals.see = see;
8729
+ function setCtrl(terminalId, ctrl) {
8730
+ const session = sessions.get(terminalId);
8731
+ if (session && session.exitCode === undefined && Boolean(session.ctrl) !== ctrl) {
8732
+ session.ctrl = ctrl;
8733
+ changed();
8734
+ }
8735
+ }
8736
+ Terminals.setCtrl = setCtrl;
8737
+ async function restart(session) {
8738
+ const old = session.info.terminalId;
8739
+ const { cols, rows } = session.terminal;
8740
+ const info = await pi.terminals.openTerminal({ cwd: session.info.cwd || undefined, cols, rows });
8741
+ const created = create(info, session.name);
8742
+ sessions = new Map([...sessions].map(([id, other]) => id === old ? [info.terminalId, created] : [id, other]));
8743
+ if (!sessions.has(info.terminalId)) {
8744
+ sessions.set(info.terminalId, created);
8745
+ }
8746
+ closed.add(old);
8747
+ session.terminal.dispose();
8748
+ if (session.exitCode === undefined) {
8749
+ pi.terminals.closeTerminal(old).catch(() => {
8750
+ return;
8751
+ });
8752
+ }
8753
+ changed();
8754
+ return info.terminalId;
8755
+ }
8756
+ Terminals.restart = restart;
7038
8757
  async function sync() {
7039
8758
  for (const info of await pi.terminals.listTerminals()) {
7040
8759
  add(info);
@@ -7045,8 +8764,12 @@ ${t("terminalEnded", { code: exitCode })}\r
7045
8764
  function useTerminals() {
7046
8765
  return React.useSyncExternalStore(Terminals.subscribe, Terminals.all);
7047
8766
  }
7048
- function title(session) {
7049
- return `${WorkspaceUtil.basename(session.info.shell) || t("terminal")} · ${WorkspaceUtil.basename(session.info.cwd)}`;
8767
+ function cwdOf(session) {
8768
+ return session.terminal.cwd || session.info.cwd;
8769
+ }
8770
+ function hintOf(session) {
8771
+ const title = session.terminal.title?.trim();
8772
+ return title ? `${title} — ${cwdOf(session)}` : cwdOf(session);
7050
8773
  }
7051
8774
  async function close2(session) {
7052
8775
  Terminals.remove(session.info.terminalId);
@@ -7061,10 +8784,98 @@ function closeEach(sessions) {
7061
8784
  close2(session);
7062
8785
  }
7063
8786
  }
8787
+ function copySelection(session) {
8788
+ const text = session.terminal.getSelection();
8789
+ if (text) {
8790
+ navigator.clipboard?.writeText(text).catch(() => {
8791
+ return;
8792
+ });
8793
+ }
8794
+ }
8795
+ function pasteClipboard(session) {
8796
+ navigator.clipboard?.readText().then((text) => text && session.terminal.paste(text)).catch(() => {
8797
+ return;
8798
+ });
8799
+ }
8800
+ function TerminalBadge({ session, index }) {
8801
+ const progress = session.progress;
8802
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("span", {
8803
+ className: "taw-terminal-index",
8804
+ "aria-hidden": "true"
8805
+ }, "T", index + 1), session.exitCode !== undefined ? /* @__PURE__ */ React.createElement("span", {
8806
+ className: `taw-terminal-dot ${session.exitCode ? "taw-failed" : ""}`,
8807
+ "aria-hidden": "true"
8808
+ }) : progress?.state === "busy" ? /* @__PURE__ */ React.createElement("span", {
8809
+ className: "taw-terminal-spinner",
8810
+ "aria-hidden": "true"
8811
+ }) : progress && (progress.value !== undefined || progress.state === "error") ? /* @__PURE__ */ React.createElement(ProgressRing, {
8812
+ state: progress.state,
8813
+ value: progress.value ?? 100
8814
+ }) : null);
8815
+ }
8816
+ function ProgressRing({ state, value }) {
8817
+ const radius = 5;
8818
+ const length = 2 * Math.PI * radius;
8819
+ return /* @__PURE__ */ React.createElement("svg", {
8820
+ className: `taw-terminal-progress taw-${state}`,
8821
+ width: "13",
8822
+ height: "13",
8823
+ viewBox: "0 0 13 13",
8824
+ "aria-hidden": "true"
8825
+ }, /* @__PURE__ */ React.createElement("circle", {
8826
+ cx: "6.5",
8827
+ cy: "6.5",
8828
+ r: radius
8829
+ }), /* @__PURE__ */ React.createElement("circle", {
8830
+ cx: "6.5",
8831
+ cy: "6.5",
8832
+ r: radius,
8833
+ strokeDasharray: length,
8834
+ strokeDashoffset: length * (1 - value / 100)
8835
+ }));
8836
+ }
8837
+ function stateOf(session) {
8838
+ if (session.exitCode !== undefined) {
8839
+ return t("terminalEnded", { code: session.exitCode });
8840
+ }
8841
+ const progress = session.progress;
8842
+ if (progress?.value !== undefined && progress.state !== "busy") {
8843
+ return `${progress.value}%`;
8844
+ }
8845
+ return;
8846
+ }
8847
+ function RenameField({ value, onDone }) {
8848
+ const input = React.useRef(null);
8849
+ const done = React.useRef(false);
8850
+ React.useEffect(() => input.current?.select(), []);
8851
+ const finish = (keep) => {
8852
+ if (!done.current) {
8853
+ done.current = true;
8854
+ onDone(input.current?.value.trim() || undefined, keep);
8855
+ }
8856
+ };
8857
+ return /* @__PURE__ */ React.createElement("input", {
8858
+ ref: input,
8859
+ className: "taw-terminal-rename",
8860
+ defaultValue: value,
8861
+ "aria-label": t("renameTerminal"),
8862
+ spellCheck: false,
8863
+ onKeyDown: (event) => {
8864
+ if (event.key === "Enter") {
8865
+ finish(true);
8866
+ } else if (event.key === "Escape") {
8867
+ event.stopPropagation();
8868
+ finish(false);
8869
+ }
8870
+ },
8871
+ onBlur: () => finish(true)
8872
+ });
8873
+ }
7064
8874
  function TerminalView() {
7065
8875
  const cwd = pi.ui.useCwd();
7066
8876
  const sessions = useTerminals();
7067
8877
  const [shown, setShown] = React.useState();
8878
+ const [renaming, setRenaming] = React.useState();
7068
8879
  const [error, setError] = React.useState();
7069
8880
  const opening = React.useRef(false);
7070
8881
  const create = React.useCallback(async () => {
@@ -7074,7 +8885,7 @@ function TerminalView() {
7074
8885
  opening.current = true;
7075
8886
  try {
7076
8887
  setError(undefined);
7077
- setShown(Terminals.add(await pi.terminals.openTerminal({ cwd, cols: 100, rows: 30 })).info.terminalId);
8888
+ setShown(Terminals.add(await pi.terminals.openTerminal({ cwd, cols: OPEN_COLS, rows: OPEN_ROWS })).info.terminalId);
7078
8889
  } catch (failure) {
7079
8890
  setError(Host.message(failure));
7080
8891
  } finally {
@@ -7089,14 +8900,37 @@ function TerminalView() {
7089
8900
  }, (failure) => setError(Host.message(failure)));
7090
8901
  }, []);
7091
8902
  const current = sessions.find((session) => session.info.terminalId === shown) ?? sessions[sessions.length - 1];
8903
+ const tabs = React.useRef(null);
8904
+ React.useEffect(() => {
8905
+ tabs.current?.querySelector(".taw-terminal-tab.taw-on")?.scrollIntoView({ block: "nearest", inline: "nearest" });
8906
+ }, [current, sessions.length]);
8907
+ const titles = TerminalUtil.titles(sessions.map((session) => ({
8908
+ name: session.name,
8909
+ title: session.title,
8910
+ shell: session.info.shell
8911
+ })), t("terminal"));
8912
+ const titleOf = (session) => titles[sessions.indexOf(session)] ?? t("terminal");
8913
+ const restart = (session) => {
8914
+ Terminals.restart(session).then(setShown, (failure) => setError(Host.message(failure)));
8915
+ };
8916
+ const finishRename = (session) => (name, keep) => {
8917
+ setRenaming(undefined);
8918
+ if (keep) {
8919
+ Terminals.rename(session.info.terminalId, name);
8920
+ }
8921
+ session.terminal.focus();
8922
+ };
7092
8923
  const [menu, openMenu] = useContextMenu();
7093
- const menuFor = (session) => {
8924
+ const tabMenu = (session) => {
7094
8925
  const at = sessions.indexOf(session);
7095
8926
  const others = sessions.filter((other) => other !== session);
7096
8927
  const left = sessions.slice(0, at);
7097
8928
  const right = sessions.slice(at + 1);
7098
8929
  const ended = sessions.filter((other) => other.exitCode !== undefined);
7099
8930
  return [
8931
+ { label: t("renameTerminal"), run: () => setRenaming(session.info.terminalId) },
8932
+ { label: t("restartTerminal"), run: () => restart(session) },
8933
+ "-",
7100
8934
  { label: t("close"), run: () => void close2(session) },
7101
8935
  { label: t("closeOthers"), run: () => closeEach(others), disabled: others.length === 0 },
7102
8936
  { label: t("closeToTheLeft"), run: () => closeEach(left), disabled: left.length === 0 },
@@ -7108,38 +8942,104 @@ function TerminalView() {
7108
8942
  { label: t("newTerminal"), run: () => void create() }
7109
8943
  ];
7110
8944
  };
8945
+ const screenMenu = (session) => {
8946
+ const selected = Boolean(session.terminal.getSelection());
8947
+ const refocus = (run) => () => {
8948
+ run();
8949
+ session.terminal.focus();
8950
+ };
8951
+ return [
8952
+ { label: t("copy"), keys: MAC ? "⌘C" : "Ctrl+Shift+C", run: refocus(() => copySelection(session)), disabled: !selected },
8953
+ { label: t("paste"), keys: MAC ? "⌘V" : "Ctrl+Shift+V", run: refocus(() => pasteClipboard(session)), disabled: session.exitCode !== undefined },
8954
+ { label: t("selectAll"), run: refocus(() => session.terminal.selectAll()) },
8955
+ "-",
8956
+ { label: t("clearTerminal"), keys: MAC ? "⌘K" : undefined, run: refocus(() => session.terminal.clear()) },
8957
+ "-",
8958
+ { label: t("newTerminal"), run: () => void create() },
8959
+ { label: t("renameTerminal"), run: () => setRenaming(session.info.terminalId) },
8960
+ { label: t("restartTerminal"), run: () => restart(session) },
8961
+ { label: t("killTerminal"), run: () => void close2(session) }
8962
+ ];
8963
+ };
7111
8964
  return /* @__PURE__ */ React.createElement("div", {
7112
- className: "taw-view"
8965
+ className: "taw-view taw-terminals"
7113
8966
  }, /* @__PURE__ */ React.createElement("header", {
8967
+ className: "taw-terminal-bar"
8968
+ }, sessions.length > 1 ? /* @__PURE__ */ React.createElement("div", {
7114
8969
  className: "taw-terminal-tabs",
8970
+ ref: tabs,
7115
8971
  role: "tablist",
7116
8972
  "aria-label": t("terminal")
7117
- }, sessions.map((session) => /* @__PURE__ */ React.createElement("div", {
7118
- key: session.info.terminalId,
7119
- className: `taw-terminal-tab ${session === current ? "taw-on" : ""}`,
7120
- title: session.info.cwd
7121
- }, /* @__PURE__ */ React.createElement("button", {
7122
- type: "button",
7123
- role: "tab",
7124
- "aria-selected": session === current,
7125
- onClick: () => setShown(session.info.terminalId),
7126
- onContextMenu: (event) => openMenu(event, menuFor(session))
7127
- }, /* @__PURE__ */ React.createElement(Glyph, {
7128
- name: "SquareTerminal",
7129
- size: 13
7130
- }), /* @__PURE__ */ React.createElement("span", null, title(session)), session.exitCode !== undefined && /* @__PURE__ */ React.createElement("span", {
7131
- className: "taw-detail"
7132
- }, session.exitCode)), /* @__PURE__ */ React.createElement(Action, {
7133
- icon: "X",
7134
- label: t("close"),
7135
- onClick: () => void close2(session)
7136
- }))), /* @__PURE__ */ React.createElement(Action, {
8973
+ }, sessions.map((session) => {
8974
+ const id = session.info.terminalId;
8975
+ const on = session === current;
8976
+ const title = titleOf(session);
8977
+ return /* @__PURE__ */ React.createElement("div", {
8978
+ key: id,
8979
+ className: `taw-terminal-tab ${on ? "taw-on" : ""}`,
8980
+ title: hintOf(session)
8981
+ }, renaming === id ? /* @__PURE__ */ React.createElement("span", {
8982
+ className: "taw-terminal-tab-main"
8983
+ }, /* @__PURE__ */ React.createElement(TerminalBadge, {
8984
+ session,
8985
+ index: sessions.indexOf(session)
8986
+ }), /* @__PURE__ */ React.createElement(RenameField, {
8987
+ value: title,
8988
+ onDone: finishRename(session)
8989
+ })) : /* @__PURE__ */ React.createElement("button", {
8990
+ type: "button",
8991
+ role: "tab",
8992
+ className: "taw-terminal-tab-main",
8993
+ "aria-selected": on,
8994
+ onClick: () => setShown(id),
8995
+ onDoubleClick: () => setRenaming(id),
8996
+ onAuxClick: (event) => event.button === 1 && void close2(session),
8997
+ onContextMenu: (event) => openMenu(event, tabMenu(session))
8998
+ }, /* @__PURE__ */ React.createElement(TerminalBadge, {
8999
+ session,
9000
+ index: sessions.indexOf(session)
9001
+ }), /* @__PURE__ */ React.createElement("span", {
9002
+ className: "taw-terminal-tab-title"
9003
+ }, title), stateOf(session) && /* @__PURE__ */ React.createElement("span", {
9004
+ className: "taw-sr-only"
9005
+ }, stateOf(session)), session.attention && !on && /* @__PURE__ */ React.createElement("span", {
9006
+ className: "taw-terminal-attention"
9007
+ }, /* @__PURE__ */ React.createElement("span", {
9008
+ className: "taw-sr-only"
9009
+ }, t("terminalAttention")))), /* @__PURE__ */ React.createElement(Action, {
9010
+ icon: "X",
9011
+ label: t("close"),
9012
+ onClick: () => void close2(session)
9013
+ }));
9014
+ })) : current && /* @__PURE__ */ React.createElement("div", {
9015
+ className: "taw-terminal-title",
9016
+ title: hintOf(current),
9017
+ onDoubleClick: () => setRenaming(current.info.terminalId),
9018
+ onContextMenu: (event) => openMenu(event, tabMenu(current))
9019
+ }, /* @__PURE__ */ React.createElement(TerminalBadge, {
9020
+ session: current,
9021
+ index: sessions.indexOf(current)
9022
+ }), renaming === current.info.terminalId ? /* @__PURE__ */ React.createElement(RenameField, {
9023
+ value: titleOf(current),
9024
+ onDone: finishRename(current)
9025
+ }) : /* @__PURE__ */ React.createElement("span", {
9026
+ className: "taw-terminal-tab-title"
9027
+ }, titleOf(current))), /* @__PURE__ */ React.createElement("div", {
9028
+ className: "taw-actions"
9029
+ }, /* @__PURE__ */ React.createElement(Action, {
7137
9030
  icon: "Plus",
7138
9031
  label: t("newTerminal"),
7139
9032
  onClick: () => void create()
7140
- })), menu, error && /* @__PURE__ */ React.createElement(Empty, {
7141
- tone: "error"
7142
- }, t("failed", { message: error })), !error && sessions.length === 0 && /* @__PURE__ */ React.createElement(Empty, null, /* @__PURE__ */ React.createElement("p", null, t("noTerminals")), /* @__PURE__ */ React.createElement("button", {
9033
+ }), current && /* @__PURE__ */ React.createElement(Action, {
9034
+ icon: "Trash2",
9035
+ label: t("killTerminal"),
9036
+ onClick: () => void close2(current)
9037
+ }))), menu, error && /* @__PURE__ */ React.createElement(Empty, {
9038
+ tone: "error",
9039
+ title: t("failed", { message: error })
9040
+ }), !error && sessions.length === 0 && /* @__PURE__ */ React.createElement(Empty, {
9041
+ title: t("noTerminals")
9042
+ }, /* @__PURE__ */ React.createElement("button", {
7143
9043
  type: "button",
7144
9044
  className: "taw-button",
7145
9045
  onClick: () => void create()
@@ -7148,91 +9048,85 @@ function TerminalView() {
7148
9048
  size: 14
7149
9049
  }), t("newTerminal"))), current && /* @__PURE__ */ React.createElement(TerminalEditor, {
7150
9050
  key: current.info.terminalId,
7151
- terminalId: current.info.terminalId
9051
+ terminalId: current.info.terminalId,
9052
+ onMenu: (event, session) => openMenu(event, screenMenu(session)),
9053
+ onRestart: restart
7152
9054
  }));
7153
9055
  }
7154
- function measure(element) {
7155
- const probe = document.createElement("span");
7156
- probe.textContent = "MMMMMMMMMM";
7157
- probe.style.visibility = "hidden";
7158
- probe.style.position = "absolute";
7159
- element.appendChild(probe);
7160
- const width = probe.getBoundingClientRect().width / 10 || 8;
7161
- probe.remove();
7162
- return { width, height: LINE_HEIGHT };
9056
+ var TOUCH_KEYS = [
9057
+ { label: "Esc", key: "Escape" },
9058
+ { label: "Tab", key: "Tab" },
9059
+ { label: "↑", key: "ArrowUp" },
9060
+ { label: "↓", key: "ArrowDown" },
9061
+ { label: "←", key: "ArrowLeft" },
9062
+ { label: "→", key: "ArrowRight" },
9063
+ { label: "~", text: "~" },
9064
+ { label: "/", text: "/" },
9065
+ { label: "|", text: "|" },
9066
+ { label: "-", text: "-" }
9067
+ ];
9068
+ function TouchKeys({ session }) {
9069
+ const keep = (event) => event.preventDefault();
9070
+ const press = (run) => () => {
9071
+ run();
9072
+ session.terminal.focus();
9073
+ };
9074
+ const id = session.info.terminalId;
9075
+ return /* @__PURE__ */ React.createElement("div", {
9076
+ className: "taw-touch-keys",
9077
+ role: "toolbar",
9078
+ "aria-label": t("terminalKeys")
9079
+ }, /* @__PURE__ */ React.createElement("button", {
9080
+ type: "button",
9081
+ className: `taw-touch-key ${session.ctrl ? "taw-on" : ""}`,
9082
+ "aria-pressed": Boolean(session.ctrl),
9083
+ onPointerDown: keep,
9084
+ onMouseDown: keep,
9085
+ onClick: press(() => Terminals.setCtrl(id, !session.ctrl))
9086
+ }, "Ctrl"), TOUCH_KEYS.map(({ label: label2, key, text }) => /* @__PURE__ */ React.createElement("button", {
9087
+ key: label2,
9088
+ type: "button",
9089
+ className: "taw-touch-key",
9090
+ onPointerDown: keep,
9091
+ onMouseDown: keep,
9092
+ onClick: press(() => {
9093
+ if (key) {
9094
+ Terminals.setCtrl(id, false);
9095
+ session.terminal.sendKey(key);
9096
+ } else if (text) {
9097
+ session.terminal.type(text);
9098
+ }
9099
+ })
9100
+ }, label2)));
7163
9101
  }
7164
- function TerminalEditor({ terminalId }) {
9102
+ function TerminalEditor({
9103
+ terminalId,
9104
+ onMenu,
9105
+ onRestart
9106
+ }) {
7165
9107
  useTerminals();
7166
9108
  const session = Terminals.get(terminalId);
7167
9109
  const box = React.useRef(null);
7168
- const input = React.useRef(null);
7169
- const composing = React.useRef(false);
7170
- const pinned = React.useRef(true);
7171
- const write = React.useCallback((data) => void pi.terminals.writeTerminal(terminalId, data).catch(() => {
7172
- return;
7173
- }), [terminalId]);
9110
+ const terminal = session?.terminal;
7174
9111
  React.useEffect(() => {
7175
9112
  const element = box.current;
7176
- if (!element || !session) {
9113
+ if (!element || !terminal) {
7177
9114
  return;
7178
9115
  }
7179
- let timer;
7180
- let last = "";
7181
- const observer = new ResizeObserver(() => {
7182
- if (!element.clientWidth || !element.clientHeight) {
7183
- return;
7184
- }
7185
- const cell = measure(element);
7186
- const cols = Math.max(20, Math.floor((element.clientWidth - 16) / cell.width));
7187
- const rows = Math.max(5, Math.floor((element.clientHeight - 16) / cell.height));
7188
- if (`${cols}x${rows}` === last) {
7189
- return;
7190
- }
7191
- last = `${cols}x${rows}`;
7192
- session.screen.resize(cols, rows);
7193
- clearTimeout(timer);
7194
- timer = setTimeout(() => void pi.terminals.resizeTerminal(terminalId, cols, rows).catch(() => {
7195
- return;
7196
- }), RESIZE_MS);
7197
- });
7198
- observer.observe(element);
9116
+ const detach = terminal.attach(element);
9117
+ const unsee = Terminals.see(terminalId, element);
9118
+ terminal.focus();
7199
9119
  return () => {
7200
- observer.disconnect();
7201
- clearTimeout(timer);
9120
+ unsee();
9121
+ detach();
7202
9122
  };
7203
- }, [session, terminalId]);
7204
- React.useEffect(() => input.current?.focus({ preventScroll: true }), []);
7205
- React.useLayoutEffect(() => {
7206
- const element = box.current;
7207
- if (element && pinned.current) {
7208
- element.scrollTop = element.scrollHeight;
7209
- }
7210
- });
9123
+ }, [terminal]);
7211
9124
  if (!session) {
7212
- return /* @__PURE__ */ React.createElement(Empty, null, t("noTerminals"));
9125
+ return /* @__PURE__ */ React.createElement(Empty, {
9126
+ title: t("noTerminals")
9127
+ });
7213
9128
  }
7214
- const lines = session.screen.spans();
7215
- const cursor = session.screen.cursor();
7216
9129
  const ended = session.exitCode !== undefined;
7217
- const onKeyDown = (event) => {
7218
- if (composing.current || ended) {
7219
- return;
7220
- }
7221
- const sequence = TerminalKeys.sequence(event);
7222
- if (sequence !== undefined) {
7223
- event.preventDefault();
7224
- write(sequence);
7225
- }
7226
- };
7227
- const flush = () => {
7228
- const element = input.current;
7229
- if (element?.value && !composing.current) {
7230
- if (!ended) {
7231
- write(element.value);
7232
- }
7233
- element.value = "";
7234
- }
7235
- };
7236
9130
  return /* @__PURE__ */ React.createElement("div", {
7237
9131
  className: "taw-editor"
7238
9132
  }, session.info.pty === false && /* @__PURE__ */ React.createElement("div", {
@@ -7240,50 +9134,49 @@ function TerminalEditor({ terminalId }) {
7240
9134
  }, t("pipeMode")), /* @__PURE__ */ React.createElement("div", {
7241
9135
  className: "taw-terminal",
7242
9136
  ref: box,
7243
- role: "presentation",
7244
- onScroll: (event) => {
7245
- const element = event.currentTarget;
7246
- pinned.current = element.scrollHeight - element.scrollTop - element.clientHeight < LINE_HEIGHT;
7247
- },
7248
- onMouseUp: () => {
7249
- if (!window.getSelection()?.toString()) {
7250
- input.current?.focus({ preventScroll: true });
9137
+ onFocus: () => box.current && Terminals.see(terminalId, box.current),
9138
+ onContextMenu: (event) => onMenu(event, session),
9139
+ onDragOver: (event) => {
9140
+ if (pi.ui.fileDrag.has(event.dataTransfer)) {
9141
+ event.preventDefault();
9142
+ event.dataTransfer.dropEffect = "copy";
7251
9143
  }
7252
- }
7253
- }, /* @__PURE__ */ React.createElement("pre", {
7254
- className: "taw-screen"
7255
- }, lines.map((spans, row) => /* @__PURE__ */ React.createElement("div", {
7256
- key: row,
7257
- className: "taw-screen-line"
7258
- }, spans.map((span, index) => /* @__PURE__ */ React.createElement("span", {
7259
- key: index,
7260
- style: AnsiUtil.css(span.style)
7261
- }, span.text)), row === cursor.row && !ended && /* @__PURE__ */ React.createElement("span", {
7262
- className: "taw-cursor",
7263
- style: { left: `${cursor.col}ch` }
7264
- }), `
7265
- `))), /* @__PURE__ */ React.createElement("textarea", {
7266
- ref: input,
7267
- className: "taw-terminal-input",
7268
- "aria-label": t("terminal"),
7269
- autoCapitalize: "off",
7270
- autoComplete: "off",
7271
- autoCorrect: "off",
7272
- spellCheck: false,
7273
- onKeyDown,
7274
- onInput: flush,
7275
- onCompositionStart: () => composing.current = true,
7276
- onCompositionEnd: () => {
7277
- composing.current = false;
7278
- flush();
7279
9144
  },
7280
- onPaste: (event) => {
7281
- event.preventDefault();
7282
- if (!ended) {
7283
- write(TerminalKeys.paste(event.clipboardData.getData("text")));
9145
+ onDrop: (event) => {
9146
+ const files = pi.ui.fileDrag.get(event.dataTransfer);
9147
+ if (!files || ended) {
9148
+ return;
7284
9149
  }
9150
+ event.preventDefault();
9151
+ const windows = /(^|[\\/])(cmd|powershell|pwsh)(\.exe)?$/i.test(session.info.shell);
9152
+ const words = pi.ui.fileDrag.paths(files).map((path) => WorkspaceUtil.shellQuote(path, windows));
9153
+ pi.terminals.writeTerminal(terminalId, `${words.join(" ")} `).catch(() => {
9154
+ return;
9155
+ });
9156
+ terminal?.focus();
7285
9157
  }
7286
- })));
9158
+ }), ended ? /* @__PURE__ */ React.createElement("div", {
9159
+ className: "taw-terminal-ended",
9160
+ role: "status"
9161
+ }, /* @__PURE__ */ React.createElement("span", {
9162
+ className: `taw-terminal-dot ${session.exitCode ? "taw-failed" : ""}`,
9163
+ "aria-hidden": "true"
9164
+ }), /* @__PURE__ */ React.createElement("span", {
9165
+ className: "taw-terminal-ended-text"
9166
+ }, t("terminalEnded", { code: session.exitCode ?? 0 })), /* @__PURE__ */ React.createElement("button", {
9167
+ type: "button",
9168
+ className: "taw-button",
9169
+ onClick: () => onRestart(session)
9170
+ }, /* @__PURE__ */ React.createElement(Glyph, {
9171
+ name: "RotateCcw",
9172
+ size: 13
9173
+ }), t("restartTerminal")), /* @__PURE__ */ React.createElement("button", {
9174
+ type: "button",
9175
+ className: "taw-button",
9176
+ onClick: () => void close2(session)
9177
+ }, t("close"))) : /* @__PURE__ */ React.createElement(TouchKeys, {
9178
+ session
9179
+ }));
7287
9180
  }
7288
9181
 
7289
9182
  // web-src/index.tsx
@@ -7312,12 +9205,15 @@ function activate(pi2) {
7312
9205
  ["terminal", "terminal", "SquareTerminal", TerminalView],
7313
9206
  ["browser", "browser", "Globe", BrowserView]
7314
9207
  ];
7315
- views.forEach(([name, title2, icon, render], index) => {
7316
- pi2.registerView(name, { title: label(title2), icon: Host.icon(icon), render, location: "panel", order: 10 + index * 10 });
9208
+ views.forEach(([name, title, icon, render], index) => {
9209
+ pi2.registerView(name, { title: label(title), icon: Host.icon(icon), render, location: "panel", order: 10 + index * 10 });
7317
9210
  });
7318
9211
  pi2.on("tool_execution_end", () => FilesChanged.notify());
7319
9212
  pi2.on("agent_end", () => FilesChanged.notify());
7320
9213
  pi2.registerOpener((link2) => openLink(pi2, link2));
9214
+ if (pi2.ui.debugWebview) {
9215
+ pi2.registerTool(AgentBrowser.TOOL);
9216
+ }
7321
9217
  const stopTerminals = pi2.onTerminalData((terminalId, data, exitCode) => Terminals.receive(terminalId, data, exitCode));
7322
9218
  OpenFiles.restore();
7323
9219
  return () => {