@celljs/ta 4.6.1 → 4.8.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 (534) hide show
  1. package/README.en.md +112 -0
  2. package/README.md +15 -2
  3. package/dist/cli.mjs +168 -110
  4. package/dist/pi/CHANGELOG.md +36 -0
  5. package/dist/pi/package.json +1 -1
  6. package/dist/pi/packages/ta-agents/README.en.md +68 -0
  7. package/dist/pi/packages/ta-agents/README.md +68 -0
  8. package/dist/pi/packages/ta-agents/extension/index.mjs +1746 -0
  9. package/dist/pi/packages/ta-agents/fixtures/fake-acp-agent.mjs +183 -0
  10. package/dist/pi/packages/ta-agents/lib/acp-agent.d.ts +52 -0
  11. package/dist/pi/packages/ta-agents/lib/acp-agent.d.ts.map +1 -0
  12. package/dist/pi/packages/ta-agents/lib/acp-agent.js +218 -0
  13. package/dist/pi/packages/ta-agents/lib/acp-agent.js.map +1 -0
  14. package/dist/pi/packages/ta-agents/lib/acp-protocol.d.ts +153 -0
  15. package/dist/pi/packages/ta-agents/lib/acp-protocol.d.ts.map +1 -0
  16. package/dist/pi/packages/ta-agents/lib/acp-protocol.js +45 -0
  17. package/dist/pi/packages/ta-agents/lib/acp-protocol.js.map +1 -0
  18. package/dist/pi/packages/ta-agents/lib/agent-bindings.d.ts +45 -0
  19. package/dist/pi/packages/ta-agents/lib/agent-bindings.d.ts.map +1 -0
  20. package/dist/pi/packages/ta-agents/lib/agent-bindings.js +135 -0
  21. package/dist/pi/packages/ta-agents/lib/agent-bindings.js.map +1 -0
  22. package/dist/pi/packages/ta-agents/lib/agent-catalog.d.ts +50 -0
  23. package/dist/pi/packages/ta-agents/lib/agent-catalog.d.ts.map +1 -0
  24. package/dist/pi/packages/ta-agents/lib/agent-catalog.js +143 -0
  25. package/dist/pi/packages/ta-agents/lib/agent-catalog.js.map +1 -0
  26. package/dist/pi/packages/ta-agents/lib/agent-prompt.d.ts +18 -0
  27. package/dist/pi/packages/ta-agents/lib/agent-prompt.d.ts.map +1 -0
  28. package/dist/pi/packages/ta-agents/lib/agent-prompt.js +86 -0
  29. package/dist/pi/packages/ta-agents/lib/agent-prompt.js.map +1 -0
  30. package/dist/pi/packages/ta-agents/lib/agent-session.d.ts +71 -0
  31. package/dist/pi/packages/ta-agents/lib/agent-session.d.ts.map +1 -0
  32. package/dist/pi/packages/ta-agents/lib/agent-session.js +215 -0
  33. package/dist/pi/packages/ta-agents/lib/agent-session.js.map +1 -0
  34. package/dist/pi/packages/ta-agents/lib/agent-streamer.d.ts +41 -0
  35. package/dist/pi/packages/ta-agents/lib/agent-streamer.d.ts.map +1 -0
  36. package/dist/pi/packages/ta-agents/lib/agent-streamer.js +163 -0
  37. package/dist/pi/packages/ta-agents/lib/agent-streamer.js.map +1 -0
  38. package/dist/pi/packages/ta-agents/lib/agent-tool.d.ts +22 -0
  39. package/dist/pi/packages/ta-agents/lib/agent-tool.d.ts.map +1 -0
  40. package/dist/pi/packages/ta-agents/lib/agent-tool.js +88 -0
  41. package/dist/pi/packages/ta-agents/lib/agent-tool.js.map +1 -0
  42. package/dist/pi/packages/ta-agents/lib/agent-turn.d.ts +115 -0
  43. package/dist/pi/packages/ta-agents/lib/agent-turn.d.ts.map +1 -0
  44. package/dist/pi/packages/ta-agents/lib/agent-turn.js +343 -0
  45. package/dist/pi/packages/ta-agents/lib/agent-turn.js.map +1 -0
  46. package/dist/pi/packages/ta-agents/lib/extension.d.ts +26 -0
  47. package/dist/pi/packages/ta-agents/lib/extension.d.ts.map +1 -0
  48. package/dist/pi/packages/ta-agents/lib/extension.js +247 -0
  49. package/dist/pi/packages/ta-agents/lib/extension.js.map +1 -0
  50. package/dist/pi/packages/ta-agents/lib/json-rpc.d.ts +41 -0
  51. package/dist/pi/packages/ta-agents/lib/json-rpc.d.ts.map +1 -0
  52. package/dist/pi/packages/ta-agents/lib/json-rpc.js +145 -0
  53. package/dist/pi/packages/ta-agents/lib/json-rpc.js.map +1 -0
  54. package/dist/pi/packages/ta-agents/lib/message-stream.d.ts +31 -0
  55. package/dist/pi/packages/ta-agents/lib/message-stream.d.ts.map +1 -0
  56. package/dist/pi/packages/ta-agents/lib/message-stream.js +134 -0
  57. package/dist/pi/packages/ta-agents/lib/message-stream.js.map +1 -0
  58. package/dist/pi/packages/ta-agents/lib/pi-types.d.ts +20 -0
  59. package/dist/pi/packages/ta-agents/lib/pi-types.d.ts.map +1 -0
  60. package/dist/pi/packages/ta-agents/lib/pi-types.js +3 -0
  61. package/dist/pi/packages/ta-agents/lib/pi-types.js.map +1 -0
  62. package/dist/pi/packages/ta-agents/lib/texts.d.ts +36 -0
  63. package/dist/pi/packages/ta-agents/lib/texts.d.ts.map +1 -0
  64. package/dist/pi/packages/ta-agents/lib/texts.js +43 -0
  65. package/dist/pi/packages/ta-agents/lib/texts.js.map +1 -0
  66. package/dist/pi/packages/ta-agents/package.json +53 -0
  67. package/dist/pi/packages/ta-changes/README.en.md +21 -0
  68. package/dist/pi/packages/ta-changes/README.md +21 -0
  69. package/dist/pi/packages/ta-changes/extension/index.mjs +296 -0
  70. package/dist/pi/packages/ta-changes/host/index.mjs +309 -0
  71. package/dist/pi/packages/ta-changes/lib/blob-store.d.ts +16 -0
  72. package/dist/pi/packages/ta-changes/lib/blob-store.d.ts.map +1 -0
  73. package/dist/pi/packages/ta-changes/lib/blob-store.js +69 -0
  74. package/dist/pi/packages/ta-changes/lib/blob-store.js.map +1 -0
  75. package/dist/pi/packages/ta-changes/lib/card.d.ts +12 -0
  76. package/dist/pi/packages/ta-changes/lib/card.d.ts.map +1 -0
  77. package/dist/pi/packages/ta-changes/lib/card.js +149 -0
  78. package/dist/pi/packages/ta-changes/lib/card.js.map +1 -0
  79. package/dist/pi/packages/ta-changes/lib/changes-protocol.d.ts +76 -0
  80. package/dist/pi/packages/ta-changes/lib/changes-protocol.d.ts.map +1 -0
  81. package/dist/pi/packages/ta-changes/lib/changes-protocol.js +20 -0
  82. package/dist/pi/packages/ta-changes/lib/changes-protocol.js.map +1 -0
  83. package/dist/pi/packages/ta-changes/lib/changes-service.d.ts +20 -0
  84. package/dist/pi/packages/ta-changes/lib/changes-service.d.ts.map +1 -0
  85. package/dist/pi/packages/ta-changes/lib/changes-service.js +70 -0
  86. package/dist/pi/packages/ta-changes/lib/changes-service.js.map +1 -0
  87. package/dist/pi/packages/ta-changes/lib/changes-util.d.ts +21 -0
  88. package/dist/pi/packages/ta-changes/lib/changes-util.d.ts.map +1 -0
  89. package/dist/pi/packages/ta-changes/lib/changes-util.js +44 -0
  90. package/dist/pi/packages/ta-changes/lib/changes-util.js.map +1 -0
  91. package/dist/pi/packages/ta-changes/lib/diff-tab.d.ts +4 -0
  92. package/dist/pi/packages/ta-changes/lib/diff-tab.d.ts.map +1 -0
  93. package/dist/pi/packages/ta-changes/lib/diff-tab.js +45 -0
  94. package/dist/pi/packages/ta-changes/lib/diff-tab.js.map +1 -0
  95. package/dist/pi/packages/ta-changes/lib/extension.d.ts +21 -0
  96. package/dist/pi/packages/ta-changes/lib/extension.d.ts.map +1 -0
  97. package/dist/pi/packages/ta-changes/lib/extension.js +106 -0
  98. package/dist/pi/packages/ta-changes/lib/extension.js.map +1 -0
  99. package/dist/pi/packages/ta-changes/lib/host.d.ts +7 -0
  100. package/dist/pi/packages/ta-changes/lib/host.d.ts.map +1 -0
  101. package/dist/pi/packages/ta-changes/lib/host.js +16 -0
  102. package/dist/pi/packages/ta-changes/lib/host.js.map +1 -0
  103. package/dist/pi/packages/ta-changes/lib/i18n.d.ts +30 -0
  104. package/dist/pi/packages/ta-changes/lib/i18n.d.ts.map +1 -0
  105. package/dist/pi/packages/ta-changes/lib/i18n.js +61 -0
  106. package/dist/pi/packages/ta-changes/lib/i18n.js.map +1 -0
  107. package/dist/pi/packages/ta-changes/lib/index.d.ts +8 -0
  108. package/dist/pi/packages/ta-changes/lib/index.d.ts.map +1 -0
  109. package/dist/pi/packages/ta-changes/lib/index.js +28 -0
  110. package/dist/pi/packages/ta-changes/lib/index.js.map +1 -0
  111. package/dist/pi/packages/ta-changes/lib/line-diff.d.ts +11 -0
  112. package/dist/pi/packages/ta-changes/lib/line-diff.d.ts.map +1 -0
  113. package/dist/pi/packages/ta-changes/lib/line-diff.js +69 -0
  114. package/dist/pi/packages/ta-changes/lib/line-diff.js.map +1 -0
  115. package/dist/pi/packages/ta-changes/lib/page.d.ts +29 -0
  116. package/dist/pi/packages/ta-changes/lib/page.d.ts.map +1 -0
  117. package/dist/pi/packages/ta-changes/lib/page.js +106 -0
  118. package/dist/pi/packages/ta-changes/lib/page.js.map +1 -0
  119. package/dist/pi/packages/ta-changes/lib/react.d.ts +8 -0
  120. package/dist/pi/packages/ta-changes/lib/react.d.ts.map +1 -0
  121. package/dist/pi/packages/ta-changes/lib/react.js +8 -0
  122. package/dist/pi/packages/ta-changes/lib/react.js.map +1 -0
  123. package/dist/pi/packages/ta-changes/lib/recorder.d.ts +25 -0
  124. package/dist/pi/packages/ta-changes/lib/recorder.d.ts.map +1 -0
  125. package/dist/pi/packages/ta-changes/lib/recorder.js +117 -0
  126. package/dist/pi/packages/ta-changes/lib/recorder.js.map +1 -0
  127. package/dist/pi/packages/ta-changes/lib/style.d.ts +4 -0
  128. package/dist/pi/packages/ta-changes/lib/style.d.ts.map +1 -0
  129. package/dist/pi/packages/ta-changes/lib/style.js +44 -0
  130. package/dist/pi/packages/ta-changes/lib/style.js.map +1 -0
  131. package/dist/pi/packages/ta-changes/package.json +46 -0
  132. package/dist/pi/packages/ta-changes/web/index.js +460 -0
  133. package/dist/pi/packages/ta-channels/README.en.md +48 -0
  134. package/dist/pi/packages/ta-channels/README.md +1 -1
  135. package/dist/pi/packages/ta-channels/extension/index.mjs +8 -4
  136. package/dist/pi/packages/ta-channels/host/index.mjs +22 -3
  137. package/dist/pi/packages/ta-channels/lib/channels-model.d.ts +4 -1
  138. package/dist/pi/packages/ta-channels/lib/channels-model.d.ts.map +1 -1
  139. package/dist/pi/packages/ta-channels/lib/channels-model.js.map +1 -1
  140. package/dist/pi/packages/ta-channels/lib/channels-util.d.ts +2 -0
  141. package/dist/pi/packages/ta-channels/lib/channels-util.d.ts.map +1 -1
  142. package/dist/pi/packages/ta-channels/lib/channels-util.js +6 -1
  143. package/dist/pi/packages/ta-channels/lib/channels-util.js.map +1 -1
  144. package/dist/pi/packages/ta-channels/lib/channels.js +1 -1
  145. package/dist/pi/packages/ta-channels/lib/channels.js.map +1 -1
  146. package/dist/pi/packages/ta-channels/lib/extension.d.ts +2 -2
  147. package/dist/pi/packages/ta-channels/lib/extension.d.ts.map +1 -1
  148. package/dist/pi/packages/ta-channels/lib/extension.js +2 -2
  149. package/dist/pi/packages/ta-channels/lib/extension.js.map +1 -1
  150. package/dist/pi/packages/ta-channels/lib/sidebar.d.ts.map +1 -1
  151. package/dist/pi/packages/ta-channels/lib/sidebar.js +4 -2
  152. package/dist/pi/packages/ta-channels/lib/sidebar.js.map +1 -1
  153. package/dist/pi/packages/ta-channels/lib/style.d.ts +1 -1
  154. package/dist/pi/packages/ta-channels/lib/style.d.ts.map +1 -1
  155. package/dist/pi/packages/ta-channels/lib/style.js +1 -0
  156. package/dist/pi/packages/ta-channels/lib/style.js.map +1 -1
  157. package/dist/pi/packages/ta-channels/lib/team-tools.js +1 -1
  158. package/dist/pi/packages/ta-channels/lib/team-tools.js.map +1 -1
  159. package/dist/pi/packages/ta-channels/lib/team.d.ts +7 -1
  160. package/dist/pi/packages/ta-channels/lib/team.d.ts.map +1 -1
  161. package/dist/pi/packages/ta-channels/lib/team.js +25 -2
  162. package/dist/pi/packages/ta-channels/lib/team.js.map +1 -1
  163. package/dist/pi/packages/ta-channels/lib/views.d.ts +3 -1
  164. package/dist/pi/packages/ta-channels/lib/views.d.ts.map +1 -1
  165. package/dist/pi/packages/ta-channels/lib/views.js +12 -1
  166. package/dist/pi/packages/ta-channels/lib/views.js.map +1 -1
  167. package/dist/pi/packages/ta-channels/package.json +1 -1
  168. package/dist/pi/packages/ta-channels/web/index.js +23 -5
  169. package/dist/pi/packages/ta-computer-use/README.en.md +37 -0
  170. package/dist/pi/packages/ta-computer-use/README.md +37 -0
  171. package/dist/pi/packages/ta-computer-use/extension/index.mjs +551 -0
  172. package/dist/pi/packages/ta-computer-use/lib/cua-driver-access.d.ts +72 -0
  173. package/dist/pi/packages/ta-computer-use/lib/cua-driver-access.d.ts.map +1 -0
  174. package/dist/pi/packages/ta-computer-use/lib/cua-driver-access.js +149 -0
  175. package/dist/pi/packages/ta-computer-use/lib/cua-driver-access.js.map +1 -0
  176. package/dist/pi/packages/ta-computer-use/lib/cua-driver-daemon.d.ts +78 -0
  177. package/dist/pi/packages/ta-computer-use/lib/cua-driver-daemon.d.ts.map +1 -0
  178. package/dist/pi/packages/ta-computer-use/lib/cua-driver-daemon.js +250 -0
  179. package/dist/pi/packages/ta-computer-use/lib/cua-driver-daemon.js.map +1 -0
  180. package/dist/pi/packages/ta-computer-use/lib/cua-driver.d.ts +56 -0
  181. package/dist/pi/packages/ta-computer-use/lib/cua-driver.d.ts.map +1 -0
  182. package/dist/pi/packages/ta-computer-use/lib/cua-driver.js +112 -0
  183. package/dist/pi/packages/ta-computer-use/lib/cua-driver.js.map +1 -0
  184. package/dist/pi/packages/ta-computer-use/lib/extension.d.ts +39 -0
  185. package/dist/pi/packages/ta-computer-use/lib/extension.d.ts.map +1 -0
  186. package/dist/pi/packages/ta-computer-use/lib/extension.js +174 -0
  187. package/dist/pi/packages/ta-computer-use/lib/extension.js.map +1 -0
  188. package/dist/pi/packages/ta-computer-use/lib/pi-types.d.ts +3 -0
  189. package/dist/pi/packages/ta-computer-use/lib/pi-types.d.ts.map +1 -0
  190. package/dist/pi/packages/ta-computer-use/lib/pi-types.js +3 -0
  191. package/dist/pi/packages/ta-computer-use/lib/pi-types.js.map +1 -0
  192. package/dist/pi/packages/ta-computer-use/package.json +51 -0
  193. package/dist/pi/packages/ta-cron/README.en.md +48 -0
  194. package/dist/pi/packages/ta-cron/README.md +48 -0
  195. package/dist/pi/packages/ta-cron/extension/index.mjs +856 -0
  196. package/dist/pi/packages/ta-cron/host/index.mjs +877 -0
  197. package/dist/pi/packages/ta-cron/lib/commands.d.ts +61 -0
  198. package/dist/pi/packages/ta-cron/lib/commands.d.ts.map +1 -0
  199. package/dist/pi/packages/ta-cron/lib/commands.js +250 -0
  200. package/dist/pi/packages/ta-cron/lib/commands.js.map +1 -0
  201. package/dist/pi/packages/ta-cron/lib/cron-expression.d.ts +39 -0
  202. package/dist/pi/packages/ta-cron/lib/cron-expression.d.ts.map +1 -0
  203. package/dist/pi/packages/ta-cron/lib/cron-expression.js +146 -0
  204. package/dist/pi/packages/ta-cron/lib/cron-expression.js.map +1 -0
  205. package/dist/pi/packages/ta-cron/lib/cron-protocol.d.ts +160 -0
  206. package/dist/pi/packages/ta-cron/lib/cron-protocol.d.ts.map +1 -0
  207. package/dist/pi/packages/ta-cron/lib/cron-protocol.js +38 -0
  208. package/dist/pi/packages/ta-cron/lib/cron-protocol.js.map +1 -0
  209. package/dist/pi/packages/ta-cron/lib/editor.d.ts +17 -0
  210. package/dist/pi/packages/ta-cron/lib/editor.d.ts.map +1 -0
  211. package/dist/pi/packages/ta-cron/lib/editor.js +145 -0
  212. package/dist/pi/packages/ta-cron/lib/editor.js.map +1 -0
  213. package/dist/pi/packages/ta-cron/lib/extension.d.ts +27 -0
  214. package/dist/pi/packages/ta-cron/lib/extension.d.ts.map +1 -0
  215. package/dist/pi/packages/ta-cron/lib/extension.js +142 -0
  216. package/dist/pi/packages/ta-cron/lib/extension.js.map +1 -0
  217. package/dist/pi/packages/ta-cron/lib/form-util.d.ts +39 -0
  218. package/dist/pi/packages/ta-cron/lib/form-util.d.ts.map +1 -0
  219. package/dist/pi/packages/ta-cron/lib/form-util.js +121 -0
  220. package/dist/pi/packages/ta-cron/lib/form-util.js.map +1 -0
  221. package/dist/pi/packages/ta-cron/lib/host.d.ts +7 -0
  222. package/dist/pi/packages/ta-cron/lib/host.d.ts.map +1 -0
  223. package/dist/pi/packages/ta-cron/lib/host.js +14 -0
  224. package/dist/pi/packages/ta-cron/lib/host.js.map +1 -0
  225. package/dist/pi/packages/ta-cron/lib/i18n.d.ts +90 -0
  226. package/dist/pi/packages/ta-cron/lib/i18n.d.ts.map +1 -0
  227. package/dist/pi/packages/ta-cron/lib/i18n.js +177 -0
  228. package/dist/pi/packages/ta-cron/lib/i18n.js.map +1 -0
  229. package/dist/pi/packages/ta-cron/lib/index.d.ts +8 -0
  230. package/dist/pi/packages/ta-cron/lib/index.d.ts.map +1 -0
  231. package/dist/pi/packages/ta-cron/lib/index.js +37 -0
  232. package/dist/pi/packages/ta-cron/lib/index.js.map +1 -0
  233. package/dist/pi/packages/ta-cron/lib/model-picker.d.ts +33 -0
  234. package/dist/pi/packages/ta-cron/lib/model-picker.d.ts.map +1 -0
  235. package/dist/pi/packages/ta-cron/lib/model-picker.js +178 -0
  236. package/dist/pi/packages/ta-cron/lib/model-picker.js.map +1 -0
  237. package/dist/pi/packages/ta-cron/lib/notifier.d.ts +6 -0
  238. package/dist/pi/packages/ta-cron/lib/notifier.d.ts.map +1 -0
  239. package/dist/pi/packages/ta-cron/lib/notifier.js +50 -0
  240. package/dist/pi/packages/ta-cron/lib/notifier.js.map +1 -0
  241. package/dist/pi/packages/ta-cron/lib/page.d.ts +39 -0
  242. package/dist/pi/packages/ta-cron/lib/page.d.ts.map +1 -0
  243. package/dist/pi/packages/ta-cron/lib/page.js +113 -0
  244. package/dist/pi/packages/ta-cron/lib/page.js.map +1 -0
  245. package/dist/pi/packages/ta-cron/lib/react.d.ts +8 -0
  246. package/dist/pi/packages/ta-cron/lib/react.d.ts.map +1 -0
  247. package/dist/pi/packages/ta-cron/lib/react.js +8 -0
  248. package/dist/pi/packages/ta-cron/lib/react.js.map +1 -0
  249. package/dist/pi/packages/ta-cron/lib/reply.d.ts +6 -0
  250. package/dist/pi/packages/ta-cron/lib/reply.d.ts.map +1 -0
  251. package/dist/pi/packages/ta-cron/lib/reply.js +53 -0
  252. package/dist/pi/packages/ta-cron/lib/reply.js.map +1 -0
  253. package/dist/pi/packages/ta-cron/lib/schedule-util.d.ts +25 -0
  254. package/dist/pi/packages/ta-cron/lib/schedule-util.d.ts.map +1 -0
  255. package/dist/pi/packages/ta-cron/lib/schedule-util.js +223 -0
  256. package/dist/pi/packages/ta-cron/lib/schedule-util.js.map +1 -0
  257. package/dist/pi/packages/ta-cron/lib/scheduler.d.ts +76 -0
  258. package/dist/pi/packages/ta-cron/lib/scheduler.d.ts.map +1 -0
  259. package/dist/pi/packages/ta-cron/lib/scheduler.js +319 -0
  260. package/dist/pi/packages/ta-cron/lib/scheduler.js.map +1 -0
  261. package/dist/pi/packages/ta-cron/lib/server-texts.d.ts +7 -0
  262. package/dist/pi/packages/ta-cron/lib/server-texts.d.ts.map +1 -0
  263. package/dist/pi/packages/ta-cron/lib/server-texts.js +24 -0
  264. package/dist/pi/packages/ta-cron/lib/server-texts.js.map +1 -0
  265. package/dist/pi/packages/ta-cron/lib/style.d.ts +4 -0
  266. package/dist/pi/packages/ta-cron/lib/style.d.ts.map +1 -0
  267. package/dist/pi/packages/ta-cron/lib/style.js +137 -0
  268. package/dist/pi/packages/ta-cron/lib/style.js.map +1 -0
  269. package/dist/pi/packages/ta-cron/lib/task-store.d.ts +25 -0
  270. package/dist/pi/packages/ta-cron/lib/task-store.d.ts.map +1 -0
  271. package/dist/pi/packages/ta-cron/lib/task-store.js +60 -0
  272. package/dist/pi/packages/ta-cron/lib/task-store.js.map +1 -0
  273. package/dist/pi/packages/ta-cron/lib/task-util.d.ts +18 -0
  274. package/dist/pi/packages/ta-cron/lib/task-util.d.ts.map +1 -0
  275. package/dist/pi/packages/ta-cron/lib/task-util.js +167 -0
  276. package/dist/pi/packages/ta-cron/lib/task-util.js.map +1 -0
  277. package/dist/pi/packages/ta-cron/lib/tasks-view.d.ts +6 -0
  278. package/dist/pi/packages/ta-cron/lib/tasks-view.d.ts.map +1 -0
  279. package/dist/pi/packages/ta-cron/lib/tasks-view.js +189 -0
  280. package/dist/pi/packages/ta-cron/lib/tasks-view.js.map +1 -0
  281. package/dist/pi/packages/ta-cron/lib/tool.d.ts +85 -0
  282. package/dist/pi/packages/ta-cron/lib/tool.d.ts.map +1 -0
  283. package/dist/pi/packages/ta-cron/lib/tool.js +127 -0
  284. package/dist/pi/packages/ta-cron/lib/tool.js.map +1 -0
  285. package/dist/pi/packages/ta-cron/package.json +46 -0
  286. package/dist/pi/packages/ta-cron/web/index.js +1985 -0
  287. package/dist/pi/packages/ta-extensions/README.en.md +27 -0
  288. package/dist/pi/packages/ta-extensions/README.md +10 -3
  289. package/dist/pi/packages/ta-extensions/host/index.mjs +331 -1
  290. package/dist/pi/packages/ta-extensions/lib/actions.d.ts +5 -1
  291. package/dist/pi/packages/ta-extensions/lib/actions.d.ts.map +1 -1
  292. package/dist/pi/packages/ta-extensions/lib/actions.js +20 -1
  293. package/dist/pi/packages/ta-extensions/lib/actions.js.map +1 -1
  294. package/dist/pi/packages/ta-extensions/lib/context.d.ts +20 -0
  295. package/dist/pi/packages/ta-extensions/lib/context.d.ts.map +1 -0
  296. package/dist/pi/packages/ta-extensions/lib/context.js +8 -0
  297. package/dist/pi/packages/ta-extensions/lib/context.js.map +1 -0
  298. package/dist/pi/packages/ta-extensions/lib/host.d.ts +8 -2
  299. package/dist/pi/packages/ta-extensions/lib/host.d.ts.map +1 -1
  300. package/dist/pi/packages/ta-extensions/lib/host.js +11 -2
  301. package/dist/pi/packages/ta-extensions/lib/host.js.map +1 -1
  302. package/dist/pi/packages/ta-extensions/lib/i18n.d.ts +32 -0
  303. package/dist/pi/packages/ta-extensions/lib/i18n.d.ts.map +1 -1
  304. package/dist/pi/packages/ta-extensions/lib/i18n.js +78 -2
  305. package/dist/pi/packages/ta-extensions/lib/i18n.js.map +1 -1
  306. package/dist/pi/packages/ta-extensions/lib/index.d.ts +2 -1
  307. package/dist/pi/packages/ta-extensions/lib/index.d.ts.map +1 -1
  308. package/dist/pi/packages/ta-extensions/lib/index.js +25 -21
  309. package/dist/pi/packages/ta-extensions/lib/index.js.map +1 -1
  310. package/dist/pi/packages/ta-extensions/lib/market-detail.d.ts +12 -0
  311. package/dist/pi/packages/ta-extensions/lib/market-detail.d.ts.map +1 -0
  312. package/dist/pi/packages/ta-extensions/lib/market-detail.js +95 -0
  313. package/dist/pi/packages/ta-extensions/lib/market-detail.js.map +1 -0
  314. package/dist/pi/packages/ta-extensions/lib/market-parts.d.ts +33 -0
  315. package/dist/pi/packages/ta-extensions/lib/market-parts.d.ts.map +1 -0
  316. package/dist/pi/packages/ta-extensions/lib/market-parts.js +56 -0
  317. package/dist/pi/packages/ta-extensions/lib/market-parts.js.map +1 -0
  318. package/dist/pi/packages/ta-extensions/lib/market-store.d.ts +41 -0
  319. package/dist/pi/packages/ta-extensions/lib/market-store.d.ts.map +1 -0
  320. package/dist/pi/packages/ta-extensions/lib/market-store.js +99 -0
  321. package/dist/pi/packages/ta-extensions/lib/market-store.js.map +1 -0
  322. package/dist/pi/packages/ta-extensions/lib/market-style.d.ts +3 -0
  323. package/dist/pi/packages/ta-extensions/lib/market-style.d.ts.map +1 -0
  324. package/dist/pi/packages/ta-extensions/lib/market-style.js +98 -0
  325. package/dist/pi/packages/ta-extensions/lib/market-style.js.map +1 -0
  326. package/dist/pi/packages/ta-extensions/lib/market-util.d.ts +74 -0
  327. package/dist/pi/packages/ta-extensions/lib/market-util.d.ts.map +1 -0
  328. package/dist/pi/packages/ta-extensions/lib/market-util.js +193 -0
  329. package/dist/pi/packages/ta-extensions/lib/market-util.js.map +1 -0
  330. package/dist/pi/packages/ta-extensions/lib/market-view.d.ts +9 -0
  331. package/dist/pi/packages/ta-extensions/lib/market-view.d.ts.map +1 -0
  332. package/dist/pi/packages/ta-extensions/lib/market-view.js +144 -0
  333. package/dist/pi/packages/ta-extensions/lib/market-view.js.map +1 -0
  334. package/dist/pi/packages/ta-extensions/lib/market.d.ts +88 -0
  335. package/dist/pi/packages/ta-extensions/lib/market.d.ts.map +1 -0
  336. package/dist/pi/packages/ta-extensions/lib/market.js +198 -0
  337. package/dist/pi/packages/ta-extensions/lib/market.js.map +1 -0
  338. package/dist/pi/packages/ta-extensions/lib/page.d.ts +3 -16
  339. package/dist/pi/packages/ta-extensions/lib/page.d.ts.map +1 -1
  340. package/dist/pi/packages/ta-extensions/lib/page.js +87 -58
  341. package/dist/pi/packages/ta-extensions/lib/page.js.map +1 -1
  342. package/dist/pi/packages/ta-extensions/lib/signal.d.ts +12 -0
  343. package/dist/pi/packages/ta-extensions/lib/signal.d.ts.map +1 -0
  344. package/dist/pi/packages/ta-extensions/lib/signal.js +32 -0
  345. package/dist/pi/packages/ta-extensions/lib/signal.js.map +1 -0
  346. package/dist/pi/packages/ta-extensions/lib/style.d.ts +1 -1
  347. package/dist/pi/packages/ta-extensions/lib/style.d.ts.map +1 -1
  348. package/dist/pi/packages/ta-extensions/lib/style.js +3 -2
  349. package/dist/pi/packages/ta-extensions/lib/style.js.map +1 -1
  350. package/dist/pi/packages/ta-extensions/package.json +1 -1
  351. package/dist/pi/packages/ta-extensions/skills/ta-package/SKILL.md +3 -2
  352. package/dist/pi/packages/ta-extensions/web/index.js +937 -54
  353. package/dist/pi/packages/ta-workspace/README.md +5 -5
  354. package/dist/pi/packages/ta-workspace/README.zh-cn.md +29 -0
  355. package/dist/pi/packages/ta-workspace/lib/browser-agent.d.ts +36 -0
  356. package/dist/pi/packages/ta-workspace/lib/browser-agent.d.ts.map +1 -0
  357. package/dist/pi/packages/ta-workspace/lib/browser-agent.js +396 -0
  358. package/dist/pi/packages/ta-workspace/lib/browser-agent.js.map +1 -0
  359. package/dist/pi/packages/ta-workspace/lib/browser-common.d.ts +48 -0
  360. package/dist/pi/packages/ta-workspace/lib/browser-common.d.ts.map +1 -0
  361. package/dist/pi/packages/ta-workspace/lib/browser-common.js +180 -0
  362. package/dist/pi/packages/ta-workspace/lib/browser-common.js.map +1 -0
  363. package/dist/pi/packages/ta-workspace/lib/browser-import.d.ts +5 -0
  364. package/dist/pi/packages/ta-workspace/lib/browser-import.d.ts.map +1 -0
  365. package/dist/pi/packages/ta-workspace/lib/browser-import.js +97 -0
  366. package/dist/pi/packages/ta-workspace/lib/browser-import.js.map +1 -0
  367. package/dist/pi/packages/ta-workspace/lib/browser-webview.d.ts +7 -0
  368. package/dist/pi/packages/ta-workspace/lib/browser-webview.d.ts.map +1 -0
  369. package/dist/pi/packages/ta-workspace/lib/browser-webview.js +202 -0
  370. package/dist/pi/packages/ta-workspace/lib/browser-webview.js.map +1 -0
  371. package/dist/pi/packages/ta-workspace/lib/browser.d.ts +1 -7
  372. package/dist/pi/packages/ta-workspace/lib/browser.d.ts.map +1 -1
  373. package/dist/pi/packages/ta-workspace/lib/browser.js +14 -130
  374. package/dist/pi/packages/ta-workspace/lib/browser.js.map +1 -1
  375. package/dist/pi/packages/ta-workspace/lib/explorer.d.ts.map +1 -1
  376. package/dist/pi/packages/ta-workspace/lib/explorer.js +214 -3
  377. package/dist/pi/packages/ta-workspace/lib/explorer.js.map +1 -1
  378. package/dist/pi/packages/ta-workspace/lib/i18n.d.ts +37 -0
  379. package/dist/pi/packages/ta-workspace/lib/i18n.d.ts.map +1 -1
  380. package/dist/pi/packages/ta-workspace/lib/i18n.js +76 -2
  381. package/dist/pi/packages/ta-workspace/lib/i18n.js.map +1 -1
  382. package/dist/pi/packages/ta-workspace/lib/index.d.ts.map +1 -1
  383. package/dist/pi/packages/ta-workspace/lib/index.js +7 -1
  384. package/dist/pi/packages/ta-workspace/lib/index.js.map +1 -1
  385. package/dist/pi/packages/ta-workspace/lib/style.d.ts +1 -1
  386. package/dist/pi/packages/ta-workspace/lib/style.d.ts.map +1 -1
  387. package/dist/pi/packages/ta-workspace/lib/style.js +35 -6
  388. package/dist/pi/packages/ta-workspace/lib/style.js.map +1 -1
  389. package/dist/pi/packages/ta-workspace/lib/terminal.d.ts +2 -2
  390. package/dist/pi/packages/ta-workspace/lib/terminal.d.ts.map +1 -1
  391. package/dist/pi/packages/ta-workspace/lib/terminal.js +50 -104
  392. package/dist/pi/packages/ta-workspace/lib/terminal.js.map +1 -1
  393. package/dist/pi/packages/ta-workspace/lib/util/browser-snapshot.d.ts +52 -0
  394. package/dist/pi/packages/ta-workspace/lib/util/browser-snapshot.d.ts.map +1 -0
  395. package/dist/pi/packages/ta-workspace/lib/util/browser-snapshot.js +207 -0
  396. package/dist/pi/packages/ta-workspace/lib/util/browser-snapshot.js.map +1 -0
  397. package/dist/pi/packages/ta-workspace/lib/util/upload.d.ts +34 -0
  398. package/dist/pi/packages/ta-workspace/lib/util/upload.d.ts.map +1 -0
  399. package/dist/pi/packages/ta-workspace/lib/util/upload.js +109 -0
  400. package/dist/pi/packages/ta-workspace/lib/util/upload.js.map +1 -0
  401. package/dist/pi/packages/ta-workspace/lib/util/workspace.d.ts +20 -0
  402. package/dist/pi/packages/ta-workspace/lib/util/workspace.d.ts.map +1 -1
  403. package/dist/pi/packages/ta-workspace/lib/util/workspace.js +67 -0
  404. package/dist/pi/packages/ta-workspace/lib/util/workspace.js.map +1 -1
  405. package/dist/pi/packages/ta-workspace/lib/util/zip.d.ts +20 -0
  406. package/dist/pi/packages/ta-workspace/lib/util/zip.d.ts.map +1 -0
  407. package/dist/pi/packages/ta-workspace/lib/util/zip.js +128 -0
  408. package/dist/pi/packages/ta-workspace/lib/util/zip.js.map +1 -0
  409. package/dist/pi/packages/ta-workspace/lib/workspace-client.d.ts +12 -1
  410. package/dist/pi/packages/ta-workspace/lib/workspace-client.d.ts.map +1 -1
  411. package/dist/pi/packages/ta-workspace/lib/workspace-client.js +101 -0
  412. package/dist/pi/packages/ta-workspace/lib/workspace-client.js.map +1 -1
  413. package/dist/pi/packages/ta-workspace/package.json +1 -1
  414. package/dist/pi/packages/ta-workspace/web/index.js +1955 -637
  415. package/dist/public/assets/{abnfDiagram-S7VZAUFO-3_0FZVeo.js → abnfDiagram-S7VZAUFO-CNqfsCwx.js} +1 -1
  416. package/dist/public/assets/{architecture-WOLXFQ4H-BX-N-_gd.js → architecture-WOLXFQ4H-_WaGq-Qk.js} +1 -1
  417. package/dist/public/assets/{architectureDiagram-YGSQEFNW-Daeu1xjI.js → architectureDiagram-YGSQEFNW-Bn63Lctu.js} +1 -1
  418. package/dist/public/assets/{blockDiagram-APKKGZFW-DjJS8902.js → blockDiagram-APKKGZFW-BGaAecnk.js} +1 -1
  419. package/dist/public/assets/{browser-DZ1aJcgd.js → browser-DKagIN4Y.js} +1 -1
  420. package/dist/public/assets/{c4Diagram-KJ2TOQU5-mKfHFqh9.js → c4Diagram-KJ2TOQU5-CK9Z_9Zp.js} +1 -1
  421. package/dist/public/assets/{chunk-6MUBBAK2-Cnx7dsB1.js → chunk-6MUBBAK2-H3j3MGva.js} +1 -1
  422. package/dist/public/assets/{chunk-AXFCVDMN-g4Y7Pg2t.js → chunk-AXFCVDMN-Beljdjs9.js} +1 -1
  423. package/dist/public/assets/{chunk-BG4553SI-QNE6A_Vg.js → chunk-BG4553SI-TYEV5wLO.js} +1 -1
  424. package/dist/public/assets/{chunk-DQASFODM-DPHr08r0.js → chunk-DQASFODM-gmWJrizf.js} +1 -1
  425. package/dist/public/assets/{chunk-HFQBQIA3-CenkxHlV.js → chunk-HFQBQIA3-BTa7yKXI.js} +1 -1
  426. package/dist/public/assets/{chunk-KQLB2F66-C3Z8V8R_.js → chunk-KQLB2F66-BlwMm4R0.js} +1 -1
  427. package/dist/public/assets/{chunk-KS47KZWR-BbUyxMWY.js → chunk-KS47KZWR-CKTXjzwD.js} +1 -1
  428. package/dist/public/assets/{chunk-LEVMRMFU-CKECy4cp.js → chunk-LEVMRMFU-Bn9Xkefl.js} +1 -1
  429. package/dist/public/assets/{chunk-M57EVK23-DuZd8RGI.js → chunk-M57EVK23-B_QLqohG.js} +1 -1
  430. package/dist/public/assets/{chunk-OY52VR5R-DatO2fu-.js → chunk-OY52VR5R-BflzJHPz.js} +1 -1
  431. package/dist/public/assets/{chunk-QB3YPZ4I-11782Ox2.js → chunk-QB3YPZ4I-BXucfaFg.js} +1 -1
  432. package/dist/public/assets/{chunk-R3KSYZAL-CCTi2rHV.js → chunk-R3KSYZAL-CGwkwxm9.js} +1 -1
  433. package/dist/public/assets/{chunk-STOXU5M4-DU6EHCIH.js → chunk-STOXU5M4-DQGOPuM5.js} +1 -1
  434. package/dist/public/assets/{chunk-TU62E6Q5-BtgGljqq.js → chunk-TU62E6Q5-BCrs6AYI.js} +1 -1
  435. package/dist/public/assets/{chunk-X4PVCEUW-Dd_Qy0Gx.js → chunk-X4PVCEUW-MTv7nXJX.js} +1 -1
  436. package/dist/public/assets/{chunk-XXDRQBXY-DjOrWHxV.js → chunk-XXDRQBXY-fPaX8VIb.js} +1 -1
  437. package/dist/public/assets/{classDiagram-v2-L25IHNXF-KfN1--CA.js → classDiagram-v2-L25IHNXF-tm4uT08q.js} +1 -1
  438. package/dist/public/assets/{cose-bilkent-JH36ORCC-BuWVQ5UC.js → cose-bilkent-JH36ORCC-Dkk3pDZj.js} +1 -1
  439. package/dist/public/assets/cynefin-EF2NZ3EQ-D_QV_BJg.js +1 -0
  440. package/dist/public/assets/{cynefinDiagram-L36ESFBY-BKljxAVP.js → cynefinDiagram-L36ESFBY-BcoArW00.js} +1 -1
  441. package/dist/public/assets/{d3-selection-CtCbiJ-r.js → d3-selection-BzUITLov.js} +1 -1
  442. package/dist/public/assets/{dagre-SPEB5RXH-nD3f86OL.js → dagre-SPEB5RXH-oiU-wJxw.js} +1 -1
  443. package/dist/public/assets/{diagram-3B7GL73J-wSVpHF4f.js → diagram-3B7GL73J-BwlCOIW4.js} +1 -1
  444. package/dist/public/assets/{diagram-DNEMPZML-BOkeaSpr.js → diagram-DNEMPZML-CZGQiFrl.js} +1 -1
  445. package/dist/public/assets/{diagram-L3MUGCDN-CRCErdiz.js → diagram-L3MUGCDN-BJGDa24C.js} +1 -1
  446. package/dist/public/assets/{diagram-LA4NIPWU-y5kaOsii.js → diagram-LA4NIPWU-DdwHRhnP.js} +1 -1
  447. package/dist/public/assets/{diagram-MHCOC4E2-D7l7ybij.js → diagram-MHCOC4E2-IjreLUB9.js} +1 -1
  448. package/dist/public/assets/{diagram-XPFHEONP-kHzV_Ibv.js → diagram-XPFHEONP-CvaG0Zzq.js} +1 -1
  449. package/dist/public/assets/{dist-B-aKVhGg.js → dist-Cm4zqoMA.js} +1 -1
  450. package/dist/public/assets/{ebnfDiagram-UZSYDL2S-BX_-WdHG.js → ebnfDiagram-UZSYDL2S-C-FOI67M.js} +1 -1
  451. package/dist/public/assets/{editor.api-Dwz0wCaW.js → editor.api-hteKufWf.js} +1 -1
  452. package/dist/public/assets/{elk-XV6XMXQE-YaOVo5bZ.js → elk-XV6XMXQE-C_ClfkLy.js} +1 -1
  453. package/dist/public/assets/{erDiagram-EYBAPDEH-BXQPjKDV.js → erDiagram-EYBAPDEH-DSr0aRYm.js} +1 -1
  454. package/dist/public/assets/{eventmodeling-K75KTNOO-SiGVyftr.js → eventmodeling-K75KTNOO-COU_atV6.js} +1 -1
  455. package/dist/public/assets/flowDiagram-MALGAFMO-QGLBPpjQ.js +1 -0
  456. package/dist/public/assets/{freemarker2-DmbpSxx5.js → freemarker2-CBJnhymu.js} +1 -1
  457. package/dist/public/assets/{ganttDiagram-23REXITY-B_i7AN7O.js → ganttDiagram-23REXITY-BAcXXNjI.js} +1 -1
  458. package/dist/public/assets/gitGraph-VSP46ZUC-ByODkoVe.js +1 -0
  459. package/dist/public/assets/{gitGraphDiagram-STJD7YCW-BMA1YavS.js → gitGraphDiagram-STJD7YCW-Bk9sns6k.js} +1 -1
  460. package/dist/public/assets/{handlebars-BVNKBeJT.js → handlebars-CiqYW1im.js} +1 -1
  461. package/dist/public/assets/{html-BHaxuuAl.js → html-kafkm1Z0.js} +1 -1
  462. package/dist/public/assets/{index-DtU34jhH.js → index-DPLd0-lb.js} +2 -2
  463. package/dist/public/assets/info-OHQRW6UA-BMphWS2h.js +1 -0
  464. package/dist/public/assets/{infoDiagram-KBXO4MBG-BkNpfsDm.js → infoDiagram-KBXO4MBG-2hRQLVWa.js} +1 -1
  465. package/dist/public/assets/{ishikawaDiagram-M35NCXHK-xTM6C-Kn.js → ishikawaDiagram-M35NCXHK-hrOnhWJs.js} +1 -1
  466. package/dist/public/assets/{javascript-C5dXKvxq.js → javascript-Dt5MiA9w.js} +1 -1
  467. package/dist/public/assets/{journeyDiagram-OPLOXDXO-C6iaT7vL.js → journeyDiagram-OPLOXDXO-d8HJd04q.js} +1 -1
  468. package/dist/public/assets/{jsonMode-Ia_aRv-z.js → jsonMode-DBICoo6P.js} +1 -1
  469. package/dist/public/assets/{kanban-definition-BZKZHSQY-MobAdBhz.js → kanban-definition-BZKZHSQY-DOUuZDiv.js} +1 -1
  470. package/dist/public/assets/{liquid-CIbIBxiN.js → liquid-BGYhBP2h.js} +1 -1
  471. package/dist/public/assets/{mdx-BqruHcEe.js → mdx-Ct_gzcP3.js} +1 -1
  472. package/dist/public/assets/{mermaid-parser.core-kBQmxOUn.js → mermaid-parser.core-2yhxYNxq.js} +3 -3
  473. package/dist/public/assets/{mermaid.core-BFkQwIYu.js → mermaid.core-sx7teU8z.js} +4 -4
  474. package/dist/public/assets/{mindmap-definition-I2QAS2VK-DxpTmvUG.js → mindmap-definition-I2QAS2VK-DIc9LejH.js} +1 -1
  475. package/dist/public/assets/module-BX2fJibj.js +1124 -0
  476. package/dist/public/assets/module-N1D-AOa6.js +1 -0
  477. package/dist/public/assets/{monaco-BRwac88s.js → monaco-DJecWyyV.js} +3 -3
  478. package/dist/public/assets/packet-JDAUHWVQ-Ca8klABu.js +1 -0
  479. package/dist/public/assets/{pegDiagram-FD4XPPHP-B3bIVo4u.js → pegDiagram-FD4XPPHP-BfiT6-Vx.js} +1 -1
  480. package/dist/public/assets/pie-XZMESJXO-B-SN2eCI.js +1 -0
  481. package/dist/public/assets/{pieDiagram-J4AKIIQI-CgnbwU0I.js → pieDiagram-J4AKIIQI-DJ0sF_Eg.js} +1 -1
  482. package/dist/public/assets/{python-Cwjb3hEe.js → python-BrnocsK9.js} +1 -1
  483. package/dist/public/assets/{quadrantDiagram-XTYBLID2-DWx4wRau.js → quadrantDiagram-XTYBLID2-C3iF5PG6.js} +1 -1
  484. package/dist/public/assets/radar-ABXABTNO-DzDnNRnq.js +1 -0
  485. package/dist/public/assets/railroad-I3PHUGI6-7QAv0_1N.js +1 -0
  486. package/dist/public/assets/{railroad-abnf-LNEFI6M7-CyjF4cc_.js → railroad-abnf-LNEFI6M7-BI4N-mtq.js} +1 -1
  487. package/dist/public/assets/{railroad-ebnf-DWYD2UWJ-D2ypsr5c.js → railroad-ebnf-DWYD2UWJ-Ck2MUlyV.js} +1 -1
  488. package/dist/public/assets/{railroad-peg-JR7BVNR7-Cy6Mde1c.js → railroad-peg-JR7BVNR7-Cuc9S0f4.js} +1 -1
  489. package/dist/public/assets/{railroadDiagram-MRQ6NCDL-B6ya_k_l.js → railroadDiagram-MRQ6NCDL-Cw24sb_5.js} +1 -1
  490. package/dist/public/assets/{razor-D_ClW9Lh.js → razor-BDHTAmlI.js} +1 -1
  491. package/dist/public/assets/{requirementDiagram-Y7LWUY3S-Brg8B8VS.js → requirementDiagram-Y7LWUY3S-QQUXFr1R.js} +1 -1
  492. package/dist/public/assets/{sankeyDiagram-WGJFYUXA-DbzPDfky.js → sankeyDiagram-WGJFYUXA-mSlfAHND.js} +1 -1
  493. package/dist/public/assets/{sequenceDiagram-5NDRBG5M-BuN84drT.js → sequenceDiagram-5NDRBG5M-3t8hVott.js} +1 -1
  494. package/dist/public/assets/{stateDiagram-v2-FJ4FJNEA-C_CTpHMj.js → stateDiagram-v2-FJ4FJNEA-9EW807AL.js} +1 -1
  495. package/dist/public/assets/{swimlanes-UMQ2AFYF-BvD4v9jw.js → swimlanes-UMQ2AFYF-EbMBX_e0.js} +1 -1
  496. package/dist/public/assets/swimlanesDiagram-OMPLPG4O-CIFqDFf2.js +8 -0
  497. package/dist/public/assets/{timeline-definition-SEUHKTQE-VE2xWGk8.js → timeline-definition-SEUHKTQE-D14kjjsp.js} +1 -1
  498. package/dist/public/assets/treeView-D4JQ5SDB-cznq7PJK.js +1 -0
  499. package/dist/public/assets/treemap-SAJKECNS-CBYUiQGU.js +1 -0
  500. package/dist/public/assets/{typescript-upeNz2VW.js → typescript-BEEbbq69.js} +1 -1
  501. package/dist/public/assets/{usecaseDiagram-AFA6YXN4-ZtyyvKye.js → usecaseDiagram-AFA6YXN4-DKemtzU9.js} +1 -1
  502. package/dist/public/assets/{vennDiagram-NNMJR3RB-BTEvzrNd.js → vennDiagram-NNMJR3RB-DOBq9oeY.js} +1 -1
  503. package/dist/public/assets/wardley-7MLQ67FV-DV8bp8Ml.js +1 -0
  504. package/dist/public/assets/{wardleyDiagram-S7YFUSEH-CF8wIUhx.js → wardleyDiagram-S7YFUSEH-DquSJ4y-.js} +1 -1
  505. package/dist/public/assets/{xml-Cki0HxGb.js → xml-DvTQKQ_W.js} +1 -1
  506. package/dist/public/assets/xterm-BrP-ENHg.css +1 -0
  507. package/dist/public/assets/xterm-wtHqjrNn.js +85 -0
  508. package/dist/public/assets/{xychartDiagram-GGNKY7IX-DcDpoJ4n.js → xychartDiagram-GGNKY7IX-ClE_9jz4.js} +1 -1
  509. package/dist/public/assets/{yaml-YIY66l1U.js → yaml-ffiFfPtJ.js} +1 -1
  510. package/dist/public/index.html +21 -3
  511. package/dist/serve/index.mjs +6892 -5061
  512. package/package.json +22 -18
  513. package/dist/pi/packages/ta-workspace/lib/util/ansi.d.ts +0 -72
  514. package/dist/pi/packages/ta-workspace/lib/util/ansi.d.ts.map +0 -1
  515. package/dist/pi/packages/ta-workspace/lib/util/ansi.js +0 -434
  516. package/dist/pi/packages/ta-workspace/lib/util/ansi.js.map +0 -1
  517. package/dist/pi/packages/ta-workspace/lib/util/keys.d.ts +0 -14
  518. package/dist/pi/packages/ta-workspace/lib/util/keys.d.ts.map +0 -1
  519. package/dist/pi/packages/ta-workspace/lib/util/keys.js +0 -52
  520. package/dist/pi/packages/ta-workspace/lib/util/keys.js.map +0 -1
  521. package/dist/public/assets/cynefin-EF2NZ3EQ-D_GZWaFs.js +0 -1
  522. package/dist/public/assets/flowDiagram-MALGAFMO-BHpEyQnS.js +0 -1
  523. package/dist/public/assets/gitGraph-VSP46ZUC-CSv9x0vY.js +0 -1
  524. package/dist/public/assets/info-OHQRW6UA-Bx2U6fFU.js +0 -1
  525. package/dist/public/assets/module-C1y_4M09.js +0 -1061
  526. package/dist/public/assets/module-DYWqfyIP.js +0 -1
  527. package/dist/public/assets/packet-JDAUHWVQ-Dy7GyfNz.js +0 -1
  528. package/dist/public/assets/pie-XZMESJXO-B4D2CjUH.js +0 -1
  529. package/dist/public/assets/radar-ABXABTNO-Dtf3tObc.js +0 -1
  530. package/dist/public/assets/railroad-I3PHUGI6-DKGa9xBx.js +0 -1
  531. package/dist/public/assets/swimlanesDiagram-OMPLPG4O-CMvLg13v.js +0 -8
  532. package/dist/public/assets/treeView-D4JQ5SDB-ETecwv1j.js +0 -1
  533. package/dist/public/assets/treemap-SAJKECNS-er6ceAYK.js +0 -1
  534. package/dist/public/assets/wardley-7MLQ67FV-CzrxsjBc.js +0 -1
@@ -344,6 +344,22 @@ var ZH = {
344
344
  copied: "已复制",
345
345
  findInFolder: "在文件夹中查找…",
346
346
  revealInExplorer: "在资源管理器中显示",
347
+ revealInFinder: "在 Finder 中显示",
348
+ revealInFileExplorer: "在文件资源管理器中显示",
349
+ openContainingFolder: "打开所在的文件夹",
350
+ revealFailed: "无法在文件管理器中显示:{message}",
351
+ uploadFiles: "上传文件…",
352
+ uploadFolder: "上传文件夹…",
353
+ download: "下载",
354
+ uploading: "正在上传 {name}",
355
+ uploaded: "已上传 {count} 个文件",
356
+ uploadFailed: "上传失败:{message}",
357
+ replaceTitle: "已存在 {names},要替换吗?",
358
+ replaceMessage: "同名的文件会被上传的文件覆盖。",
359
+ packing: "正在打包 {name}",
360
+ downloadFailed: "下载失败:{message}",
361
+ moveExists: "目标文件夹中已有“{name}”。",
362
+ moveFailed: "移动失败:{message}",
347
363
  nameEmpty: "必须提供文件或文件夹名称。",
348
364
  nameSlash: "文件或文件夹名称不能以斜杠开头。",
349
365
  nameInvalid: "名称 {name} 不能用作文件或文件夹名称,请换一个。",
@@ -464,7 +480,28 @@ var ZH = {
464
480
  browserHint: "输入网址或搜索,也可以打开本机的开发服务器。",
465
481
  home: "起始页",
466
482
  removeRecent: "从最近访问中移除",
467
- frameHint: "有的网站不允许被嵌入,页面空白时请在新窗口打开。",
483
+ frameHint: "有的网站不允许被嵌入,页面空白时请在新窗口打开;Ta 桌面版没有这个限制。",
484
+ stop: "停止",
485
+ openBrowser: "在默认浏览器中打开",
486
+ loadFailed: "无法打开这个网页",
487
+ pageCrashed: "这个网页崩溃了",
488
+ retry: "重试",
489
+ agentDriving: "Ta 正在操作",
490
+ importSignIns: "导入浏览器的登录状态",
491
+ importTitle: "导入登录状态",
492
+ importHint: "把所选浏览器的 Cookie 复制到这里,你和 Agent 都能直接使用已登录的网站。不导入密码和浏览记录。",
493
+ importFrom: "从哪个浏览器导入",
494
+ noProfiles: "没有找到 Chrome、Edge、Brave、Arc、Vivaldi 或 Chromium 的个人资料。",
495
+ importNow: "导入…",
496
+ importing: "导入中…",
497
+ imported: "已导入 {count} 个 Cookie",
498
+ importSkipped: "{count} 个无法读取,已跳过。",
499
+ importAppBound: "{count} 个受 Chrome 应用绑定加密保护,只能在网站上重新登录。",
500
+ clearBrowserData: "清除内置浏览器数据",
501
+ clearBrowserDataDetail: "删除内置浏览器的全部 Cookie、网站存储和缓存,网站都需要重新登录。",
502
+ clear: "清除",
503
+ cleared: "已清除内置浏览器数据",
504
+ done: "完成",
468
505
  binary: "二进制文件,不显示内容({size})。",
469
506
  truncated: "文件较大,只显示前 1 MB,不能编辑。",
470
507
  line: "第 {line} 行",
@@ -493,6 +530,22 @@ var EN = {
493
530
  copied: "Copied",
494
531
  findInFolder: "Find in Folder…",
495
532
  revealInExplorer: "Reveal in Explorer",
533
+ revealInFinder: "Reveal in Finder",
534
+ revealInFileExplorer: "Reveal in File Explorer",
535
+ openContainingFolder: "Open Containing Folder",
536
+ revealFailed: "Could not show it in the file manager: {message}",
537
+ uploadFiles: "Upload Files…",
538
+ uploadFolder: "Upload Folder…",
539
+ download: "Download",
540
+ uploading: "Uploading {name}",
541
+ uploaded: "Uploaded {count} file(s)",
542
+ uploadFailed: "Could not upload: {message}",
543
+ replaceTitle: "{names} already exists. Replace it?",
544
+ replaceMessage: "Files of the same name are overwritten by the uploaded ones.",
545
+ packing: "Packing {name}",
546
+ downloadFailed: "Could not download: {message}",
547
+ moveExists: "{name} already exists in the folder.",
548
+ moveFailed: "Could not move: {message}",
496
549
  nameEmpty: "A file or folder name must be provided.",
497
550
  nameSlash: "A file or folder name cannot start with a slash.",
498
551
  nameInvalid: "The name {name} is not valid as a file or folder name. Please choose a different name.",
@@ -613,7 +666,28 @@ var EN = {
613
666
  browserHint: "Enter an address or search, or open a dev server on this machine.",
614
667
  home: "Start page",
615
668
  removeRecent: "Remove from recent",
616
- frameHint: "Some sites refuse to be embedded; if the page stays blank, open it in a new window.",
669
+ frameHint: "Some sites refuse to be embedded; if the page stays blank, open it in a new window. Ta Desktop has no such limit.",
670
+ stop: "Stop",
671
+ openBrowser: "Open in the default browser",
672
+ loadFailed: "This page did not open",
673
+ pageCrashed: "This page crashed",
674
+ retry: "Retry",
675
+ agentDriving: "Ta is working here",
676
+ importSignIns: "Import sign-ins from your browser",
677
+ importTitle: "Import sign-ins",
678
+ 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.",
679
+ importFrom: "Import from",
680
+ noProfiles: "No profile of Chrome, Edge, Brave, Arc, Vivaldi or Chromium was found.",
681
+ importNow: "Import…",
682
+ importing: "Importing…",
683
+ imported: "{count} cookies imported",
684
+ importSkipped: "{count} could not be read and were skipped.",
685
+ importAppBound: "{count} are under Chrome's app-bound encryption: sign in again on those sites.",
686
+ clearBrowserData: "Clear browser data",
687
+ clearBrowserDataDetail: "Deletes every cookie, site storage and the cache of the browser of Ta: every site needs a sign-in again.",
688
+ clear: "Clear",
689
+ cleared: "Browser data cleared",
690
+ done: "Done",
617
691
  binary: "A binary file; its content is not shown ({size}).",
618
692
  truncated: "A large file: only the first 1 MB is shown, read-only.",
619
693
  line: "Line {line}",
@@ -931,6 +1005,27 @@ var WorkspaceUtil;
931
1005
  return !folder || path === folder || path.startsWith(`${folder}/`);
932
1006
  }
933
1007
  WorkspaceUtil.within = within;
1008
+ function movable(paths2, folder) {
1009
+ const unique = [...new Set(paths2)].filter((path) => path && !within(folder, path) && dirname(path) !== folder);
1010
+ return unique.filter((path) => !unique.some((other) => other !== path && within(path, other)));
1011
+ }
1012
+ WorkspaceUtil.movable = movable;
1013
+ function movedTo(path, moved, folder) {
1014
+ const from = moved.find((source) => within(path, source));
1015
+ return from === undefined ? undefined : join(folder, basename(from)) + path.slice(from.length);
1016
+ }
1017
+ WorkspaceUtil.movedTo = movedTo;
1018
+ function shellQuote(path, windows = false) {
1019
+ if (/^[\w@%+=:,./-]+$/.test(path)) {
1020
+ return path;
1021
+ }
1022
+ return windows ? `"${path.replace(/"/g, '""')}"` : `'${path.replace(/'/g, "'\\''")}'`;
1023
+ }
1024
+ WorkspaceUtil.shellQuote = shellQuote;
1025
+ function fileManagerLabel(platform) {
1026
+ return platform === "darwin" ? "revealInFinder" : platform === "win32" ? "revealInFileExplorer" : "openContainingFolder";
1027
+ }
1028
+ WorkspaceUtil.fileManagerLabel = fileManagerLabel;
934
1029
  function groupMatches(matches) {
935
1030
  const files = new Map;
936
1031
  for (const match of matches) {
@@ -1003,6 +1098,37 @@ var WorkspaceUtil;
1003
1098
  return path ? `${cwd.replace(/\/+$/, "")}/${path}` : cwd;
1004
1099
  }
1005
1100
  WorkspaceUtil.absolute = absolute;
1101
+ function localPort(url) {
1102
+ try {
1103
+ const parsed = new URL(url);
1104
+ if (!/^https?:$/.test(parsed.protocol) || !["localhost", "127.0.0.1", "0.0.0.0", "[::1]"].includes(parsed.hostname)) {
1105
+ return;
1106
+ }
1107
+ return Number(parsed.port || (parsed.protocol === "https:" ? 443 : 80));
1108
+ } catch {
1109
+ return;
1110
+ }
1111
+ }
1112
+ WorkspaceUtil.localPort = localPort;
1113
+ function withPort(url, port) {
1114
+ const parsed = new URL(url);
1115
+ if (parsed.hostname === "0.0.0.0") {
1116
+ parsed.hostname = "localhost";
1117
+ }
1118
+ parsed.port = String(port);
1119
+ return parsed.toString();
1120
+ }
1121
+ WorkspaceUtil.withPort = withPort;
1122
+ function unforward(url, asked, shown) {
1123
+ try {
1124
+ const from = new URL(shown ?? asked).origin;
1125
+ const to = new URL(asked).origin;
1126
+ return from !== to && url.startsWith(`${from}/`) ? `${to}${url.slice(from.length)}` : url;
1127
+ } catch {
1128
+ return url;
1129
+ }
1130
+ }
1131
+ WorkspaceUtil.unforward = unforward;
1006
1132
  function toUrl(input) {
1007
1133
  const text = input.trim();
1008
1134
  if (!text) {
@@ -1036,7 +1162,7 @@ var WorkspaceUtil;
1036
1162
  WorkspaceUtil.size = size;
1037
1163
  })(WorkspaceUtil ||= {});
1038
1164
 
1039
- // web-src/browser.tsx
1165
+ // web-src/browser-common.tsx
1040
1166
  var RECENT_KEY = "recent";
1041
1167
  var MAX_RECENT = 12;
1042
1168
  var Recent;
@@ -1096,7 +1222,37 @@ function parts(url) {
1096
1222
  return { host: url, rest: "" };
1097
1223
  }
1098
1224
  }
1099
- function AddressBar({ value, loading, onOpen }) {
1225
+ function AddressIcon({ value, loading, favicon }) {
1226
+ const [broken, setBroken] = React.useState();
1227
+ if (loading) {
1228
+ return /* @__PURE__ */ React.createElement("span", {
1229
+ className: "taw-spin"
1230
+ }, /* @__PURE__ */ React.createElement(Glyph, {
1231
+ name: "LoaderCircle",
1232
+ size: 14
1233
+ }));
1234
+ }
1235
+ if (favicon && broken !== favicon) {
1236
+ return /* @__PURE__ */ React.createElement("img", {
1237
+ className: "taw-address-favicon",
1238
+ src: favicon,
1239
+ alt: "",
1240
+ referrerPolicy: "no-referrer",
1241
+ onError: () => setBroken(favicon)
1242
+ });
1243
+ }
1244
+ return /* @__PURE__ */ React.createElement(Glyph, {
1245
+ name: value ? "Globe" : "Search",
1246
+ size: 14
1247
+ });
1248
+ }
1249
+ function AddressBar({
1250
+ value,
1251
+ title,
1252
+ loading,
1253
+ favicon,
1254
+ onOpen
1255
+ }) {
1100
1256
  const [text, setText] = React.useState(value);
1101
1257
  React.useEffect(() => setText(value), [value]);
1102
1258
  return /* @__PURE__ */ React.createElement("form", {
@@ -1111,18 +1267,15 @@ function AddressBar({ value, loading, onOpen }) {
1111
1267
  }
1112
1268
  }, /* @__PURE__ */ React.createElement("span", {
1113
1269
  className: "taw-address-icon"
1114
- }, loading ? /* @__PURE__ */ React.createElement("span", {
1115
- className: "taw-spin"
1116
- }, /* @__PURE__ */ React.createElement(Glyph, {
1117
- name: "LoaderCircle",
1118
- size: 14
1119
- })) : /* @__PURE__ */ React.createElement(Glyph, {
1120
- name: value ? "Globe" : "Search",
1121
- size: 14
1270
+ }, /* @__PURE__ */ React.createElement(AddressIcon, {
1271
+ value,
1272
+ loading,
1273
+ favicon
1122
1274
  })), /* @__PURE__ */ React.createElement("input", {
1123
1275
  value: text,
1124
1276
  placeholder: t("address"),
1125
1277
  "aria-label": t("address"),
1278
+ title: title || undefined,
1126
1279
  spellCheck: false,
1127
1280
  autoComplete: "off",
1128
1281
  onFocus: (event) => event.target.select(),
@@ -1143,7 +1296,50 @@ function AddressBar({ value, loading, onOpen }) {
1143
1296
  size: 14
1144
1297
  })) : undefined);
1145
1298
  }
1146
- function Home({ onOpen }) {
1299
+ function BrowserBar(props) {
1300
+ const { url, loading, onStop } = props;
1301
+ return /* @__PURE__ */ React.createElement("header", {
1302
+ className: "taw-browser-bar"
1303
+ }, /* @__PURE__ */ React.createElement(Action, {
1304
+ icon: "ArrowLeft",
1305
+ label: t("back"),
1306
+ disabled: !props.canGoBack,
1307
+ onClick: props.onBack
1308
+ }), /* @__PURE__ */ React.createElement(Action, {
1309
+ icon: "ArrowRight",
1310
+ label: t("forward"),
1311
+ disabled: !props.canGoForward,
1312
+ onClick: props.onForward
1313
+ }), loading && onStop ? /* @__PURE__ */ React.createElement(Action, {
1314
+ icon: "X",
1315
+ label: t("stop"),
1316
+ onClick: onStop
1317
+ }) : /* @__PURE__ */ React.createElement(Action, {
1318
+ icon: "RefreshCw",
1319
+ label: t("refresh"),
1320
+ disabled: !url,
1321
+ onClick: props.onReload
1322
+ }), /* @__PURE__ */ React.createElement(AddressBar, {
1323
+ value: url,
1324
+ title: props.title,
1325
+ loading,
1326
+ favicon: props.favicon,
1327
+ onOpen: props.onOpen
1328
+ }), props.badge, /* @__PURE__ */ React.createElement(Action, {
1329
+ icon: "House",
1330
+ label: t("home"),
1331
+ disabled: !url,
1332
+ onClick: props.onHome
1333
+ }), /* @__PURE__ */ React.createElement(Action, {
1334
+ icon: "ExternalLink",
1335
+ label: props.outsideLabel,
1336
+ disabled: !props.onOpenOutside,
1337
+ onClick: () => props.onOpenOutside?.()
1338
+ }), loading ? /* @__PURE__ */ React.createElement("span", {
1339
+ className: "taw-browser-loading"
1340
+ }) : undefined);
1341
+ }
1342
+ function Home({ onOpen, foot, extra }) {
1147
1343
  const recent = React.useSyncExternalStore(Recent.subscribe, Recent.all);
1148
1344
  return /* @__PURE__ */ React.createElement("div", {
1149
1345
  className: `taw-browser-home ${recent.length === 0 ? "taw-browser-blank" : ""}`
@@ -1165,7 +1361,7 @@ function Home({ onOpen }) {
1165
1361
  key: address,
1166
1362
  className: "taw-browser-chip",
1167
1363
  onClick: () => onOpen(`http://${address}`)
1168
- }, address))) : undefined), recent.length > 0 ? /* @__PURE__ */ React.createElement("section", {
1364
+ }, address))) : undefined, extra), recent.length > 0 ? /* @__PURE__ */ React.createElement("section", {
1169
1365
  className: "taw-browser-recent"
1170
1366
  }, /* @__PURE__ */ React.createElement("h3", {
1171
1367
  className: "taw-browser-heading"
@@ -1195,15 +1391,937 @@ function Home({ onOpen }) {
1195
1391
  name: "X",
1196
1392
  size: 13
1197
1393
  })));
1198
- })) : undefined, /* @__PURE__ */ React.createElement("p", {
1394
+ })) : undefined, foot ? /* @__PURE__ */ React.createElement("p", {
1199
1395
  className: "taw-browser-foot"
1200
- }, t("frameHint")));
1396
+ }, foot) : undefined);
1201
1397
  }
1202
1398
  var ShowPage = new Channel;
1203
- function BrowserView() {
1399
+ function useForwarded(url, cwd) {
1400
+ const port = WorkspaceUtil.localPort(url);
1401
+ const remote = cwd.startsWith("ssh://") && port !== undefined;
1402
+ const [forwarded, setForwarded] = React.useState();
1403
+ React.useEffect(() => {
1404
+ if (!remote || port === undefined) {
1405
+ return;
1406
+ }
1407
+ let current = true;
1408
+ pi.remote.forwardPort(port, cwd).then(({ localPort }) => current && setForwarded({ url, to: WorkspaceUtil.withPort(url, localPort) }), (error) => current && pi.ui.notify(Host.message(error), "error"));
1409
+ return () => {
1410
+ current = false;
1411
+ };
1412
+ }, [remote, port, cwd, url]);
1413
+ if (!remote) {
1414
+ return url;
1415
+ }
1416
+ return forwarded?.url === url ? forwarded.to : undefined;
1417
+ }
1418
+ function openOutside(url) {
1419
+ window.open(url, "_blank", "noopener,noreferrer");
1420
+ }
1421
+
1422
+ // web-src/util/browser-snapshot.ts
1423
+ var ACTIONABLE = new Set([
1424
+ "button",
1425
+ "checkbox",
1426
+ "combobox",
1427
+ "link",
1428
+ "listbox",
1429
+ "menuitem",
1430
+ "menuitemcheckbox",
1431
+ "menuitemradio",
1432
+ "option",
1433
+ "radio",
1434
+ "searchbox",
1435
+ "slider",
1436
+ "spinbutton",
1437
+ "switch",
1438
+ "tab",
1439
+ "textbox",
1440
+ "treeitem"
1441
+ ]);
1442
+ var SKIPPED = new Set(["none", "presentation", "InlineTextBox", "LineBreak"]);
1443
+ var TRANSPARENT = new Set([
1444
+ "generic",
1445
+ "group",
1446
+ "paragraph",
1447
+ "Section",
1448
+ "LayoutTable",
1449
+ "LayoutTableRow",
1450
+ "LayoutTableCell",
1451
+ "LabelText",
1452
+ "RootWebArea",
1453
+ "WebArea"
1454
+ ]);
1455
+ var STATES = ["focused", "checked", "selected", "pressed", "disabled", "required", "readonly", "invalid"];
1456
+ var MAX_NAME = 120;
1457
+ var MODIFIERS = { alt: 1, option: 1, control: 2, ctrl: 2, meta: 4, cmd: 4, command: 4, shift: 8 };
1458
+ var NAMED = {
1459
+ Enter: [13, "\r"],
1460
+ Tab: [9],
1461
+ Escape: [27],
1462
+ Backspace: [8],
1463
+ Delete: [46],
1464
+ ArrowUp: [38],
1465
+ ArrowDown: [40],
1466
+ ArrowLeft: [37],
1467
+ ArrowRight: [39],
1468
+ Home: [36],
1469
+ End: [35],
1470
+ PageUp: [33],
1471
+ PageDown: [34],
1472
+ Space: [32, " "]
1473
+ };
1474
+ var BrowserSnapshot;
1475
+ ((BrowserSnapshot) => {
1476
+ function text(value, max = MAX_NAME) {
1477
+ const line = String(value ?? "").replace(/\s+/g, " ").trim();
1478
+ return line.length > max ? `${line.slice(0, max - 1)}…` : line;
1479
+ }
1480
+ function property(node, name) {
1481
+ return node.properties?.find((item) => item.name === name)?.value?.value;
1482
+ }
1483
+ function render(nodes, maxLines = 800) {
1484
+ const byId = new Map(nodes.map((node) => [node.nodeId, node]));
1485
+ const lines = [];
1486
+ let more = 0;
1487
+ const add = (line) => {
1488
+ if (lines.length < maxLines) {
1489
+ lines.push(line);
1490
+ } else {
1491
+ more++;
1492
+ }
1493
+ };
1494
+ const visit = (node, depth, parentName, inActionable = false) => {
1495
+ const role = String(node.role?.value ?? "");
1496
+ const name = text(node.name?.value);
1497
+ const children = (node.childIds ?? []).map((id) => byId.get(id)).filter((child) => child !== undefined);
1498
+ const pass = (nextDepth, nextName, nextInActionable = inActionable) => {
1499
+ for (const child of children) {
1500
+ visit(child, nextDepth, nextName, nextInActionable);
1501
+ }
1502
+ };
1503
+ if (node.ignored || SKIPPED.has(role)) {
1504
+ pass(depth, parentName);
1505
+ return;
1506
+ }
1507
+ if (role === "StaticText") {
1508
+ if (name && !parentName.includes(name)) {
1509
+ add(`${" ".repeat(depth)}${JSON.stringify(name)}`);
1510
+ }
1511
+ return;
1512
+ }
1513
+ const actionable = (ACTIONABLE.has(role) || property(node, "editable") !== undefined && !inActionable) && node.backendDOMNodeId !== undefined;
1514
+ if (!actionable && TRANSPARENT.has(role) && !name) {
1515
+ pass(depth, parentName);
1516
+ return;
1517
+ }
1518
+ let line = `${" ".repeat(depth)}${actionable ? `[${node.backendDOMNodeId}] ` : ""}${role}${name ? ` ${JSON.stringify(name)}` : ""}`;
1519
+ const level = property(node, "level");
1520
+ if (level !== undefined) {
1521
+ line += ` level=${level}`;
1522
+ }
1523
+ const states = STATES.filter((state) => {
1524
+ const value2 = property(node, state);
1525
+ return value2 === true || value2 === "true" || value2 === "mixed";
1526
+ }).map((state) => property(node, state) === "mixed" ? `${state}=mixed` : state);
1527
+ const expanded = property(node, "expanded");
1528
+ if (expanded !== undefined) {
1529
+ states.push(expanded ? "expanded" : "collapsed");
1530
+ }
1531
+ if (states.length > 0) {
1532
+ line += ` (${states.join(", ")})`;
1533
+ }
1534
+ const value = text(node.value?.value);
1535
+ if (value && value !== name) {
1536
+ line += ` value=${JSON.stringify(value)}`;
1537
+ }
1538
+ const description = text(node.description?.value, 80);
1539
+ if (description && description !== name) {
1540
+ line += ` description=${JSON.stringify(description)}`;
1541
+ }
1542
+ add(line);
1543
+ pass(depth + 1, name, inActionable || actionable);
1544
+ };
1545
+ for (const root of nodes.filter((node) => !node.parentId || !byId.has(node.parentId))) {
1546
+ visit(root, 0, "");
1547
+ }
1548
+ if (more > 0) {
1549
+ lines.push(`… ${more} more lines: scroll, or evaluate to read a part of the page.`);
1550
+ }
1551
+ return lines.length > 0 ? lines.join(`
1552
+ `) : "(the page shows nothing to read yet)";
1553
+ }
1554
+ BrowserSnapshot.render = render;
1555
+ function center(quad) {
1556
+ const xs = [quad[0], quad[2], quad[4], quad[6]];
1557
+ const ys = [quad[1], quad[3], quad[5], quad[7]];
1558
+ return { x: (Math.min(...xs) + Math.max(...xs)) / 2, y: (Math.min(...ys) + Math.max(...ys)) / 2 };
1559
+ }
1560
+ BrowserSnapshot.center = center;
1561
+ function key(input) {
1562
+ const parts2 = input.split("+");
1563
+ const name = input.endsWith("++") || input === "+" ? "+" : parts2.pop();
1564
+ if (!name) {
1565
+ return;
1566
+ }
1567
+ let modifiers = 0;
1568
+ for (const part of input === "+" ? [] : parts2.filter(Boolean)) {
1569
+ const bit = MODIFIERS[part.toLowerCase()];
1570
+ if (bit === undefined) {
1571
+ return;
1572
+ }
1573
+ modifiers |= bit;
1574
+ }
1575
+ const shortcut = (modifiers & (2 | 4)) !== 0;
1576
+ const named = Object.keys(NAMED).find((candidate) => candidate.toLowerCase() === name.toLowerCase());
1577
+ if (named) {
1578
+ const [code, typed] = NAMED[named];
1579
+ return {
1580
+ key: named === "Space" ? " " : named,
1581
+ code: named,
1582
+ windowsVirtualKeyCode: code,
1583
+ modifiers,
1584
+ ...typed && !shortcut ? { text: typed } : {}
1585
+ };
1586
+ }
1587
+ const fn = /^F([1-9]|1[0-2])$/i.exec(name);
1588
+ if (fn) {
1589
+ return { key: `F${fn[1]}`, code: `F${fn[1]}`, windowsVirtualKeyCode: 111 + Number(fn[1]), modifiers };
1590
+ }
1591
+ if ([...name].length !== 1) {
1592
+ return;
1593
+ }
1594
+ const shifted = (modifiers & 8) !== 0;
1595
+ const letter = /^[a-z]$/i.test(name);
1596
+ const digit = /^[0-9]$/.test(name);
1597
+ const key2 = letter ? shifted ? name.toUpperCase() : name.toLowerCase() : name;
1598
+ return {
1599
+ key: key2,
1600
+ code: letter ? `Key${name.toUpperCase()}` : digit ? `Digit${name}` : "",
1601
+ windowsVirtualKeyCode: letter ? name.toUpperCase().charCodeAt(0) : digit ? name.charCodeAt(0) : 0,
1602
+ modifiers,
1603
+ ...shortcut ? {} : { text: key2 }
1604
+ };
1605
+ }
1606
+ BrowserSnapshot.key = key;
1607
+ })(BrowserSnapshot ||= {});
1608
+
1609
+ // web-src/browser-agent.ts
1610
+ var ACTIONS = ["navigate", "back", "forward", "reload", "snapshot", "click", "type", "press", "scroll", "screenshot", "evaluate", "wait", "cdp"];
1611
+ var MAX_OUTPUT = 20000;
1612
+ var TYPE_INTO = `function (text) {
1613
+ this.focus();
1614
+ if (typeof this.select === 'function') {
1615
+ this.select();
1616
+ } else {
1617
+ const range = document.createRange();
1618
+ range.selectNodeContents(this);
1619
+ getSelection().removeAllRanges();
1620
+ getSelection().addRange(range);
1621
+ }
1622
+ const typed = text ? document.execCommand('insertText', false, text) : document.execCommand('delete');
1623
+ if (!typed && 'value' in this) {
1624
+ const setter = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this), 'value')?.set;
1625
+ setter ? setter.call(this, text) : (this.value = text);
1626
+ this.dispatchEvent(new Event('input', { bubbles: true }));
1627
+ this.dispatchEvent(new Event('change', { bubbles: true }));
1628
+ }
1629
+ }`;
1630
+ var MAX_WAIT_MS = 30000;
1631
+ var KEY_FOCUS_MS = 50;
1632
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1633
+ async function until(ready, ms) {
1634
+ const end = Date.now() + ms;
1635
+ for (;; ) {
1636
+ const value = ready();
1637
+ if (value !== undefined || Date.now() >= end) {
1638
+ return value;
1639
+ }
1640
+ await sleep(50);
1641
+ }
1642
+ }
1643
+ function clip(text) {
1644
+ return text.length > MAX_OUTPUT ? `${text.slice(0, MAX_OUTPUT)}
1645
+ … cut at ${MAX_OUTPUT} characters` : text;
1646
+ }
1647
+ var AgentBrowser;
1648
+ ((AgentBrowser) => {
1649
+ let handle;
1650
+ let snapshot;
1651
+ function attach(next) {
1652
+ handle = next;
1653
+ return () => {
1654
+ if (handle === next) {
1655
+ handle = undefined;
1656
+ }
1657
+ };
1658
+ }
1659
+ AgentBrowser.attach = attach;
1660
+ AgentBrowser.TOOL = {
1661
+ name: "browser",
1662
+ description: [
1663
+ "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.",
1664
+ "Actions:",
1665
+ "- navigate {url}: open a page (http or https); back, forward, reload",
1666
+ "- snapshot: the page as an accessibility tree, one element a line; what one acts on starts with its ref in brackets, [12]",
1667
+ "- click {ref} or {x, y}: click it; x and y are CSS pixels of the screenshot",
1668
+ "- type {ref, text, submit?}: replace the text of a field with text; submit presses Enter after",
1669
+ '- press {key}: a key or a shortcut: "Enter", "Escape", "Tab", "ArrowDown", "a", "Control+A", "Meta+Shift+Z"',
1670
+ '- scroll {direction: "down" | "up", amount?}: by amount pixels, a screen by default; or {ref}: until it is shown',
1671
+ "- screenshot: what is shown, as a data URL of a JPEG (in codemode, give it to image() to look at it)",
1672
+ "- evaluate {expression}: run JavaScript in the page; the JSON of its value, awaited",
1673
+ "- wait {text?, ms?}: until the page shows text, or for ms milliseconds; at most 30000",
1674
+ "- cdp {method, params?}: a command of the Chrome DevTools Protocol to the page (Accessibility, CSS, DOM, DOMSnapshot, Emulation, Input, Log, Overlay, Page, Runtime)",
1675
+ "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."
1676
+ ].join(`
1677
+ `),
1678
+ parameters: {
1679
+ type: "object",
1680
+ properties: {
1681
+ action: { type: "string", enum: [...ACTIONS] },
1682
+ url: { type: "string" },
1683
+ ref: { type: "integer", description: "The number in brackets in the last snapshot." },
1684
+ x: { type: "number" },
1685
+ y: { type: "number" },
1686
+ text: { type: "string" },
1687
+ submit: { type: "boolean" },
1688
+ key: { type: "string" },
1689
+ direction: { type: "string", enum: ["down", "up"] },
1690
+ amount: { type: "number" },
1691
+ expression: { type: "string" },
1692
+ ms: { type: "number" },
1693
+ method: { type: "string" },
1694
+ params: { type: "object" }
1695
+ },
1696
+ required: ["action"]
1697
+ },
1698
+ execute: (_toolCallId, params) => run(params)
1699
+ };
1700
+ async function run(params) {
1701
+ const action = params.action;
1702
+ if (!ACTIONS.includes(action)) {
1703
+ throw new Error(`Unknown action ${JSON.stringify(params.action)}: use one of ${ACTIONS.join(", ")}.`);
1704
+ }
1705
+ const browser = await open();
1706
+ browser.drive();
1707
+ if (action === "navigate") {
1708
+ const url = WorkspaceUtil.toUrl(String(params.url ?? ""));
1709
+ if (!url || !/^https?:\/\//i.test(url)) {
1710
+ throw new Error("navigate opens pages of the web: give an http or https url.");
1711
+ }
1712
+ const before = browser.view()?.getURL();
1713
+ browser.go(url);
1714
+ await settle(browser, before);
1715
+ return status(page(browser));
1716
+ }
1717
+ if (action === "wait" && !params.text) {
1718
+ await sleep(Math.min(MAX_WAIT_MS, Number(params.ms) > 0 ? Number(params.ms) : 1000));
1719
+ const shown = browser.view();
1720
+ return shown ? status(shown) : "No page is open.";
1721
+ }
1722
+ const view = page(browser);
1723
+ const send = (method, args = {}) => command(view, method, args);
1724
+ switch (action) {
1725
+ case "back":
1726
+ case "forward":
1727
+ case "reload": {
1728
+ const before = view.getURL();
1729
+ if (action === "back" && !view.canGoBack()) {
1730
+ throw new Error("There is no page to go back to.");
1731
+ }
1732
+ if (action === "forward" && !view.canGoForward()) {
1733
+ throw new Error("There is no page to go forward to.");
1734
+ }
1735
+ if (action === "back") {
1736
+ view.goBack();
1737
+ } else if (action === "forward") {
1738
+ view.goForward();
1739
+ } else {
1740
+ view.reload();
1741
+ }
1742
+ await settle(browser, action === "reload" ? undefined : before);
1743
+ return status(view);
1744
+ }
1745
+ case "snapshot": {
1746
+ const document2 = await documentOf(send);
1747
+ await send("Accessibility.enable");
1748
+ let text = "";
1749
+ for (let attempt = 0;attempt < 10; attempt++) {
1750
+ const { nodes } = await send("Accessibility.getFullAXTree");
1751
+ text = BrowserSnapshot.render(nodes);
1752
+ if (text.includes(`
1753
+ `) || !(await evaluate(send, "Boolean(document.body && document.body.childElementCount)").catch(() => "false")).includes("true")) {
1754
+ break;
1755
+ }
1756
+ await sleep(200);
1757
+ }
1758
+ snapshot = { document: document2, refs: new Set([...text.matchAll(/^\s*\[(\d+)\]/gm)].map((match) => Number(match[1]))) };
1759
+ return clip(`${status(view)}
1760
+
1761
+ ${text}`);
1762
+ }
1763
+ case "click": {
1764
+ const point = params.ref === undefined ? { x: Number(params.x), y: Number(params.y) } : await locate(send, await ref(send, params.ref));
1765
+ if (!Number.isFinite(point.x) || !Number.isFinite(point.y)) {
1766
+ throw new Error("click needs a ref, or x and y.");
1767
+ }
1768
+ const before = view.getURL();
1769
+ const focused = document.activeElement;
1770
+ await send("Input.dispatchMouseEvent", { type: "mouseMoved", ...point });
1771
+ await send("Input.dispatchMouseEvent", { type: "mousePressed", button: "left", clickCount: 1, ...point });
1772
+ await send("Input.dispatchMouseEvent", { type: "mouseReleased", button: "left", clickCount: 1, ...point });
1773
+ if (focused instanceof HTMLElement && focused !== view && document.activeElement === view) {
1774
+ focused.focus({ preventScroll: true });
1775
+ }
1776
+ await settle(browser, before, 300);
1777
+ return status(view);
1778
+ }
1779
+ case "type": {
1780
+ const backendNodeId = await ref(send, params.ref);
1781
+ await send("DOM.focus", { backendNodeId }).catch((error) => stale(error, backendNodeId));
1782
+ const { object } = await send("DOM.resolveNode", { backendNodeId });
1783
+ await send("Runtime.callFunctionOn", {
1784
+ objectId: object.objectId,
1785
+ functionDeclaration: TYPE_INTO,
1786
+ arguments: [{ value: String(params.text ?? "") }],
1787
+ userGesture: true
1788
+ });
1789
+ const before = view.getURL();
1790
+ if (params.submit === true) {
1791
+ await press(view, send, "Enter");
1792
+ }
1793
+ await settle(browser, before, 300);
1794
+ return status(view);
1795
+ }
1796
+ case "press": {
1797
+ const before = view.getURL();
1798
+ await press(view, send, String(params.key ?? ""));
1799
+ await settle(browser, before, 300);
1800
+ return status(view);
1801
+ }
1802
+ case "scroll": {
1803
+ if (params.ref !== undefined) {
1804
+ const backendNodeId = await ref(send, params.ref);
1805
+ await send("DOM.scrollIntoViewIfNeeded", { backendNodeId }).catch((error) => stale(error, backendNodeId));
1806
+ } else {
1807
+ const { cssLayoutViewport: viewport } = await send("Page.getLayoutMetrics");
1808
+ const amount = Number(params.amount) > 0 ? Number(params.amount) : Math.round(viewport.clientHeight * 0.8);
1809
+ await send("Input.dispatchMouseEvent", {
1810
+ type: "mouseWheel",
1811
+ x: viewport.clientWidth / 2,
1812
+ y: viewport.clientHeight / 2,
1813
+ deltaX: 0,
1814
+ deltaY: params.direction === "up" ? -amount : amount
1815
+ });
1816
+ await sleep(250);
1817
+ }
1818
+ const where = await evaluate(send, "[Math.round(scrollY), document.documentElement.scrollHeight, innerHeight]");
1819
+ const [top, height, shown] = JSON.parse(where);
1820
+ return `${status(view)}
1821
+ Scrolled to ${top} of ${height} pixels, ${shown} shown.`;
1822
+ }
1823
+ case "screenshot": {
1824
+ const { cssVisualViewport: viewport } = await send("Page.getLayoutMetrics");
1825
+ const ratio = Number(await evaluate(send, "devicePixelRatio")) || 1;
1826
+ const { data } = await send("Page.captureScreenshot", {
1827
+ format: "jpeg",
1828
+ quality: 70,
1829
+ clip: { x: viewport.pageX, y: viewport.pageY, width: viewport.clientWidth, height: viewport.clientHeight, scale: 1 / ratio }
1830
+ });
1831
+ return `data:image/jpeg;base64,${data}`;
1832
+ }
1833
+ case "evaluate":
1834
+ return clip(await evaluate(send, String(params.expression ?? "")));
1835
+ case "wait": {
1836
+ const ms = Math.min(MAX_WAIT_MS, Number(params.ms) > 0 ? Number(params.ms) : 1e4);
1837
+ const probe = `Boolean(document.body && document.body.innerText.includes(${JSON.stringify(params.text)}))`;
1838
+ const end = Date.now() + ms;
1839
+ while (Date.now() < end) {
1840
+ if (await evaluate(send, probe).catch(() => "false") === "true") {
1841
+ return status(view);
1842
+ }
1843
+ await sleep(250);
1844
+ }
1845
+ throw new Error(`The page did not show ${JSON.stringify(params.text)} in ${ms} ms.`);
1846
+ }
1847
+ case "cdp": {
1848
+ const method = String(params.method ?? "");
1849
+ const args = params.params && typeof params.params === "object" ? params.params : {};
1850
+ return clip(JSON.stringify(await send(method, args) ?? null));
1851
+ }
1852
+ }
1853
+ throw new Error(`Unknown action ${action}.`);
1854
+ }
1855
+ async function open() {
1856
+ if (!pi.ui.debugWebview) {
1857
+ throw new Error("The browser of Ta can be worked in Ta Desktop only.");
1858
+ }
1859
+ if (!handle?.shown()) {
1860
+ pi.ui.showView(`${PACKAGE}/browser`);
1861
+ }
1862
+ const opened = await until(() => handle, 5000);
1863
+ if (!opened) {
1864
+ throw new Error("The browser did not open.");
1865
+ }
1866
+ return opened;
1867
+ }
1868
+ function page(browser) {
1869
+ const view = browser.view();
1870
+ if (!view) {
1871
+ throw new Error("No page is open: navigate to one first.");
1872
+ }
1873
+ return view;
1874
+ }
1875
+ async function command(view, method, args) {
1876
+ const debug = pi.ui.debugWebview;
1877
+ if (!debug) {
1878
+ throw new Error("The browser of Ta can be worked in Ta Desktop only.");
1879
+ }
1880
+ return debug(view.getWebContentsId(), method, args);
1881
+ }
1882
+ async function settle(browser, before, grace = 150) {
1883
+ await sleep(grace);
1884
+ const view = await until(() => browser.view(), 15000);
1885
+ if (!view) {
1886
+ return;
1887
+ }
1888
+ const end = Date.now() + 15000;
1889
+ while (view.isLoading() && Date.now() < end) {
1890
+ await sleep(100);
1891
+ }
1892
+ if (before !== undefined && view.getURL() === before) {
1893
+ return;
1894
+ }
1895
+ while (Date.now() < end) {
1896
+ const state = await command(view, "Runtime.evaluate", { expression: "document.readyState", returnByValue: true }).catch(() => {
1897
+ return;
1898
+ });
1899
+ if (state?.result?.value !== "loading") {
1900
+ return;
1901
+ }
1902
+ await sleep(100);
1903
+ }
1904
+ }
1905
+ function status(view) {
1906
+ const title = view.getTitle();
1907
+ const url = view.getURL();
1908
+ return title && title !== url ? `Page: ${title} — ${url}` : `Page: ${url}`;
1909
+ }
1910
+ async function documentOf(send) {
1911
+ const { frameTree } = await send("Page.getFrameTree");
1912
+ return frameTree.frame.loaderId;
1913
+ }
1914
+ async function ref(send, value) {
1915
+ const id = Number(value);
1916
+ if (!Number.isInteger(id) || id <= 0) {
1917
+ throw new Error("ref is the number in brackets of an element in the last snapshot.");
1918
+ }
1919
+ if (!snapshot || snapshot.document !== await documentOf(send)) {
1920
+ throw new Error("The page changed since the last snapshot: take a snapshot, then use its refs.");
1921
+ }
1922
+ if (!snapshot.refs.has(id)) {
1923
+ throw new Error(`[${id}] is not a ref of the last snapshot.`);
1924
+ }
1925
+ return id;
1926
+ }
1927
+ function stale(error, id) {
1928
+ const message = error instanceof Error ? error.message : String(error);
1929
+ throw new Error(/node/i.test(message) ? `The element [${id}] is not on the page any more: take a snapshot again.` : message);
1930
+ }
1931
+ async function locate(send, backendNodeId) {
1932
+ await send("DOM.scrollIntoViewIfNeeded", { backendNodeId }).catch((error) => stale(error, backendNodeId));
1933
+ const { quads } = await send("DOM.getContentQuads", { backendNodeId }).catch((error) => stale(error, backendNodeId));
1934
+ if (!quads?.length) {
1935
+ throw new Error(`The element [${backendNodeId}] is not shown: scroll to it, or take a snapshot again.`);
1936
+ }
1937
+ return BrowserSnapshot.center(quads[0]);
1938
+ }
1939
+ async function press(view, send, name) {
1940
+ const key = BrowserSnapshot.key(name);
1941
+ if (!key) {
1942
+ throw new Error(`${JSON.stringify(name)} is not a key: use names such as Enter, Tab, Escape, ArrowDown, a, Control+A.`);
1943
+ }
1944
+ const { text, ...event } = key;
1945
+ const focused = document.activeElement;
1946
+ if (focused !== view) {
1947
+ view.focus();
1948
+ await sleep(KEY_FOCUS_MS);
1949
+ }
1950
+ try {
1951
+ await send("Input.dispatchKeyEvent", { type: text ? "keyDown" : "rawKeyDown", ...event, ...text ? { text, unmodifiedText: text } : {} });
1952
+ await send("Input.dispatchKeyEvent", { type: "keyUp", ...event });
1953
+ } finally {
1954
+ if (focused instanceof HTMLElement && focused !== view) {
1955
+ await sleep(KEY_FOCUS_MS);
1956
+ focused.focus({ preventScroll: true });
1957
+ }
1958
+ }
1959
+ }
1960
+ async function evaluate(send, expression) {
1961
+ const { result, exceptionDetails } = await send("Runtime.evaluate", { expression, returnByValue: true, awaitPromise: true, userGesture: true });
1962
+ if (exceptionDetails) {
1963
+ throw new Error(exceptionDetails.exception?.description ?? exceptionDetails.text ?? "The expression threw.");
1964
+ }
1965
+ if (result?.type === "undefined") {
1966
+ return "undefined";
1967
+ }
1968
+ return result && "value" in result ? JSON.stringify(result.value) ?? String(result.value) : result?.description ?? "undefined";
1969
+ }
1970
+ })(AgentBrowser ||= {});
1971
+
1972
+ // web-src/browser-import.tsx
1973
+ function ImportDialog({ data, onClose, onChanged }) {
1974
+ const [profiles, setProfiles] = React.useState();
1975
+ const [chosen, setChosen] = React.useState();
1976
+ const [step, setStep] = React.useState({ kind: "pick" });
1977
+ const [error, setError] = React.useState();
1978
+ React.useEffect(() => {
1979
+ data.profiles().then((list) => {
1980
+ setProfiles(list);
1981
+ setChosen(list[0]?.id);
1982
+ }, (failure) => setError(Host.message(failure)));
1983
+ }, [data]);
1984
+ const run = async (action) => {
1985
+ setError(undefined);
1986
+ setStep({ kind: "working" });
1987
+ try {
1988
+ setStep(await action() ?? { kind: "pick" });
1989
+ } catch (failure) {
1990
+ setError(Host.message(failure));
1991
+ setStep({ kind: "pick" });
1992
+ }
1993
+ };
1994
+ const take = () => run(async () => {
1995
+ const report = chosen ? await data.import(chosen) : undefined;
1996
+ if (report) {
1997
+ onChanged();
1998
+ }
1999
+ return report && { kind: "done", report };
2000
+ });
2001
+ const clear = async () => {
2002
+ if (await pi.ui.confirm(t("clearBrowserData"), t("clearBrowserDataDetail"), { confirmLabel: t("clear"), danger: true })) {
2003
+ await run(async () => {
2004
+ await data.clear();
2005
+ onChanged();
2006
+ return { kind: "cleared" };
2007
+ });
2008
+ }
2009
+ };
2010
+ const working = step.kind === "working";
2011
+ let body;
2012
+ if (step.kind === "done" || step.kind === "cleared") {
2013
+ const report = step.kind === "done" ? step.report : undefined;
2014
+ body = /* @__PURE__ */ React.createElement("div", {
2015
+ className: "taw-import-result"
2016
+ }, /* @__PURE__ */ React.createElement("span", {
2017
+ className: "taw-browser-mark"
2018
+ }, /* @__PURE__ */ React.createElement(Glyph, {
2019
+ name: "Check",
2020
+ size: 22
2021
+ })), /* @__PURE__ */ React.createElement("p", {
2022
+ className: "taw-browser-title"
2023
+ }, report ? t("imported", { count: report.imported }) : t("cleared")), report && report.skipped > 0 ? /* @__PURE__ */ React.createElement("p", {
2024
+ className: "taw-browser-sub"
2025
+ }, t("importSkipped", { count: report.skipped })) : undefined, report && report.appBound > 0 ? /* @__PURE__ */ React.createElement("p", {
2026
+ className: "taw-browser-sub"
2027
+ }, t("importAppBound", { count: report.appBound })) : undefined, /* @__PURE__ */ React.createElement("div", {
2028
+ className: "taw-import-actions"
2029
+ }, /* @__PURE__ */ React.createElement("button", {
2030
+ type: "button",
2031
+ className: "taw-button taw-primary",
2032
+ onClick: onClose
2033
+ }, t("done"))));
2034
+ } else {
2035
+ body = /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", {
2036
+ className: "taw-import-hint"
2037
+ }, t("importHint")), profiles === undefined && !error ? /* @__PURE__ */ React.createElement("p", {
2038
+ className: "taw-import-hint"
2039
+ }, t("loading")) : undefined, profiles?.length === 0 ? /* @__PURE__ */ React.createElement("p", {
2040
+ className: "taw-import-hint"
2041
+ }, t("noProfiles")) : undefined, profiles && profiles.length > 0 ? /* @__PURE__ */ React.createElement("div", {
2042
+ className: "taw-import-profiles",
2043
+ role: "radiogroup",
2044
+ "aria-label": t("importFrom")
2045
+ }, profiles.map((profile) => /* @__PURE__ */ React.createElement("label", {
2046
+ key: profile.id,
2047
+ className: `taw-import-profile ${chosen === profile.id ? "taw-on" : ""}`
2048
+ }, /* @__PURE__ */ React.createElement("input", {
2049
+ type: "radio",
2050
+ name: "taw-import-profile",
2051
+ checked: chosen === profile.id,
2052
+ onChange: () => setChosen(profile.id)
2053
+ }), /* @__PURE__ */ React.createElement("span", {
2054
+ className: "taw-browser-letter"
2055
+ }, profile.browser.replace(/^(Google|Microsoft) /, "").charAt(0)), /* @__PURE__ */ React.createElement("span", {
2056
+ className: "taw-import-browser"
2057
+ }, profile.browser), /* @__PURE__ */ React.createElement("span", {
2058
+ className: "taw-import-name"
2059
+ }, profile.name)))) : undefined, error ? /* @__PURE__ */ React.createElement("p", {
2060
+ className: "taw-import-error"
2061
+ }, error) : undefined, /* @__PURE__ */ React.createElement("div", {
2062
+ className: "taw-import-actions"
2063
+ }, /* @__PURE__ */ React.createElement("button", {
2064
+ type: "button",
2065
+ className: "taw-link",
2066
+ disabled: working,
2067
+ onClick: () => void clear()
2068
+ }, t("clearBrowserData")), /* @__PURE__ */ React.createElement("button", {
2069
+ type: "button",
2070
+ className: "taw-button taw-primary",
2071
+ disabled: working || !chosen,
2072
+ onClick: () => void take()
2073
+ }, working ? t("importing") : t("importNow"))));
2074
+ }
2075
+ return /* @__PURE__ */ React.createElement(pi.ui.Dialog, {
2076
+ title: t("importTitle"),
2077
+ onClose
2078
+ }, /* @__PURE__ */ React.createElement("div", {
2079
+ className: "taw-import"
2080
+ }, body));
2081
+ }
2082
+ function ImportSignIns({ onChanged }) {
2083
+ const data = pi.ui.desktop?.browserData;
2084
+ const [open, setOpen] = React.useState(false);
2085
+ if (!data) {
2086
+ return null;
2087
+ }
2088
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("button", {
2089
+ type: "button",
2090
+ className: "taw-browser-import",
2091
+ onClick: () => setOpen(true)
2092
+ }, /* @__PURE__ */ React.createElement(Glyph, {
2093
+ name: "Download",
2094
+ size: 13
2095
+ }), t("importSignIns")), open ? /* @__PURE__ */ React.createElement(ImportDialog, {
2096
+ data,
2097
+ onClose: () => setOpen(false),
2098
+ onChanged
2099
+ }) : undefined);
2100
+ }
2101
+
2102
+ // web-src/browser-webview.tsx
2103
+ var ERR_ABORTED = -3;
2104
+ var NO_PAGE = { url: "", title: "", loading: false, canGoBack: false, canGoForward: false };
2105
+ function usePage(view, mounted, onFailure) {
2106
+ const [page, setPage] = React.useState(NO_PAGE);
2107
+ const ready = React.useRef(false);
2108
+ const failed = React.useRef(onFailure);
2109
+ failed.current = onFailure;
2110
+ React.useEffect(() => {
2111
+ const element = view.current;
2112
+ if (!element) {
2113
+ return;
2114
+ }
2115
+ const update = (next) => setPage((previous) => ({
2116
+ ...previous,
2117
+ ...next,
2118
+ ...ready.current ? { canGoBack: element.canGoBack(), canGoForward: element.canGoForward() } : {}
2119
+ }));
2120
+ const listeners = [
2121
+ [
2122
+ "dom-ready",
2123
+ () => {
2124
+ ready.current = true;
2125
+ update({});
2126
+ }
2127
+ ],
2128
+ [
2129
+ "did-start-loading",
2130
+ () => {
2131
+ failed.current(undefined);
2132
+ update({ loading: true });
2133
+ }
2134
+ ],
2135
+ ["did-stop-loading", () => update({ loading: false })],
2136
+ ["did-navigate", (event) => update({ url: event.url, favicon: undefined })],
2137
+ ["did-navigate-in-page", (event) => event.isMainFrame && update({ url: event.url })],
2138
+ ["page-title-updated", (event) => update({ title: event.title })],
2139
+ ["page-favicon-updated", (event) => update({ favicon: event.favicons.find((icon) => /^(https?:|data:image\/)/i.test(icon)) })],
2140
+ [
2141
+ "did-fail-load",
2142
+ (event) => {
2143
+ if (event.isMainFrame && event.errorCode !== ERR_ABORTED) {
2144
+ failed.current({ url: event.validatedURL, reason: event.errorDescription || String(event.errorCode) });
2145
+ update({ url: event.validatedURL, title: "", favicon: undefined, loading: false });
2146
+ }
2147
+ }
2148
+ ],
2149
+ [
2150
+ "render-process-gone",
2151
+ () => {
2152
+ failed.current({ crashed: true });
2153
+ update({ loading: false });
2154
+ }
2155
+ ]
2156
+ ];
2157
+ for (const [name, listener] of listeners) {
2158
+ element.addEventListener(name, listener);
2159
+ }
2160
+ return () => {
2161
+ ready.current = false;
2162
+ for (const [name, listener] of listeners) {
2163
+ element.removeEventListener(name, listener);
2164
+ }
2165
+ };
2166
+ }, [mounted]);
2167
+ const expect = React.useCallback((url) => setPage((previous) => ({ ...previous, url, title: "", favicon: undefined })), []);
2168
+ return { page, ready, expect };
2169
+ }
2170
+ function FailurePanel({ failure, onRetry, onOutside }) {
2171
+ const crashed = "crashed" in failure;
2172
+ return /* @__PURE__ */ React.createElement("div", {
2173
+ className: "taw-browser-failure",
2174
+ role: "alert"
2175
+ }, /* @__PURE__ */ React.createElement("span", {
2176
+ className: "taw-browser-mark"
2177
+ }, /* @__PURE__ */ React.createElement(Glyph, {
2178
+ name: "CircleAlert",
2179
+ size: 22
2180
+ })), /* @__PURE__ */ React.createElement("p", {
2181
+ className: "taw-browser-title"
2182
+ }, t(crashed ? "pageCrashed" : "loadFailed")), crashed ? undefined : /* @__PURE__ */ React.createElement("p", {
2183
+ className: "taw-browser-sub"
2184
+ }, failure.reason), /* @__PURE__ */ React.createElement("div", {
2185
+ className: "taw-browser-chips"
2186
+ }, /* @__PURE__ */ React.createElement("button", {
2187
+ type: "button",
2188
+ className: "taw-browser-chip",
2189
+ onClick: onRetry
2190
+ }, t("retry")), onOutside ? /* @__PURE__ */ React.createElement("button", {
2191
+ type: "button",
2192
+ className: "taw-browser-chip",
2193
+ onClick: onOutside
2194
+ }, t("openBrowser")) : undefined));
2195
+ }
2196
+ var DRIVEN_MS = 4000;
2197
+ function useAgent(go, view, ready, hasPage, show, stage) {
2198
+ const [driven, setDriven] = React.useState(false);
2199
+ const latest = React.useRef({ go, hasPage, show });
2200
+ latest.current = { go, hasPage, show };
2201
+ React.useEffect(() => {
2202
+ let timer;
2203
+ const detach = AgentBrowser.attach({
2204
+ go: (url) => latest.current.go(url),
2205
+ view: () => latest.current.hasPage && ready.current ? view.current ?? undefined : undefined,
2206
+ shown: () => (stage.current?.getClientRects().length ?? 0) > 0,
2207
+ drive: () => {
2208
+ if (latest.current.hasPage) {
2209
+ latest.current.show();
2210
+ }
2211
+ setDriven(true);
2212
+ clearTimeout(timer);
2213
+ timer = setTimeout(() => setDriven(false), DRIVEN_MS);
2214
+ }
2215
+ });
2216
+ return () => {
2217
+ clearTimeout(timer);
2218
+ detach();
2219
+ };
2220
+ }, []);
2221
+ return driven;
2222
+ }
2223
+ function WebviewBrowser() {
2224
+ const cwd = pi.ui.useCwd();
2225
+ const [request, setRequest] = React.useState({ url: "", id: 0 });
2226
+ const [home, setHome] = React.useState(true);
2227
+ const [src, setSrc] = React.useState();
2228
+ const [failure, setFailure] = React.useState();
2229
+ const view = React.useRef(null);
2230
+ const stage = React.useRef(null);
2231
+ const { page, ready, expect } = usePage(view, Boolean(src), setFailure);
2232
+ const shown = useForwarded(request.url, cwd);
2233
+ React.useEffect(() => {
2234
+ if (!request.url || !shown) {
2235
+ return;
2236
+ }
2237
+ setFailure(undefined);
2238
+ expect(shown);
2239
+ if (view.current && ready.current) {
2240
+ view.current.loadURL(shown).catch(() => {
2241
+ return;
2242
+ });
2243
+ } else {
2244
+ setSrc(shown);
2245
+ }
2246
+ }, [shown, request.id]);
2247
+ const go = (url) => {
2248
+ if (!url) {
2249
+ setHome(true);
2250
+ return;
2251
+ }
2252
+ Recent.add(url);
2253
+ setHome(false);
2254
+ setRequest((previous) => ({ url, id: previous.id + 1 }));
2255
+ };
2256
+ ShowPage.useReceive(go);
2257
+ const driven = useAgent(go, view, ready, Boolean(src), () => setHome(false), stage);
2258
+ const call = (run) => {
2259
+ if (view.current && ready.current) {
2260
+ run(view.current);
2261
+ }
2262
+ };
2263
+ const retry = () => {
2264
+ if (failure && "url" in failure && failure.url) {
2265
+ setFailure(undefined);
2266
+ call((element) => element.loadURL(failure.url).catch(() => {
2267
+ return;
2268
+ }));
2269
+ } else {
2270
+ call((element) => element.reload());
2271
+ }
2272
+ };
2273
+ const address = home ? "" : WorkspaceUtil.unforward(page.url || request.url, request.url, shown);
2274
+ const current = page.url || shown;
2275
+ return /* @__PURE__ */ React.createElement("div", {
2276
+ className: "taw-browser"
2277
+ }, /* @__PURE__ */ React.createElement(BrowserBar, {
2278
+ url: address,
2279
+ title: home ? undefined : page.title,
2280
+ favicon: home ? undefined : page.favicon,
2281
+ loading: !home && page.loading,
2282
+ canGoBack: home ? Boolean(src) : page.canGoBack,
2283
+ canGoForward: !home && page.canGoForward,
2284
+ onBack: () => home ? setHome(false) : call((element) => element.goBack()),
2285
+ onForward: () => call((element) => element.goForward()),
2286
+ onReload: retry,
2287
+ onStop: () => call((element) => element.stop()),
2288
+ onOpen: go,
2289
+ onHome: () => setHome(true),
2290
+ onOpenOutside: !home && current ? () => openOutside(current) : undefined,
2291
+ outsideLabel: t("openBrowser"),
2292
+ badge: driven ? /* @__PURE__ */ React.createElement("span", {
2293
+ className: "taw-browser-driven",
2294
+ role: "status"
2295
+ }, /* @__PURE__ */ React.createElement("span", {
2296
+ className: "taw-browser-driven-dot"
2297
+ }), t("agentDriving")) : undefined
2298
+ }), /* @__PURE__ */ React.createElement("div", {
2299
+ className: "taw-browser-stage",
2300
+ ref: stage
2301
+ }, src ? React.createElement("webview", {
2302
+ ref: view,
2303
+ src,
2304
+ className: "taw-webview",
2305
+ allowpopups: "true",
2306
+ style: { display: home ? "none" : "flex" }
2307
+ }) : undefined, home ? /* @__PURE__ */ React.createElement(Home, {
2308
+ onOpen: go,
2309
+ extra: /* @__PURE__ */ React.createElement(ImportSignIns, {
2310
+ onChanged: () => call((element) => element.reload())
2311
+ })
2312
+ }) : undefined, !home && failure ? /* @__PURE__ */ React.createElement(FailurePanel, {
2313
+ failure,
2314
+ onRetry: retry,
2315
+ onOutside: "url" in failure ? () => openOutside(failure.url) : undefined
2316
+ }) : undefined));
2317
+ }
2318
+
2319
+ // web-src/browser.tsx
2320
+ function FrameBrowser() {
1204
2321
  const [history, setHistory] = React.useState({ list: [""], index: 0, reloads: 0 });
1205
2322
  const [loading, setLoading] = React.useState(false);
1206
2323
  const url = history.list[history.index];
2324
+ const shown = useForwarded(url, pi.ui.useCwd());
1207
2325
  const go = (next) => {
1208
2326
  if (next) {
1209
2327
  Recent.add(next);
@@ -1225,51 +2343,34 @@ function BrowserView() {
1225
2343
  };
1226
2344
  return /* @__PURE__ */ React.createElement("div", {
1227
2345
  className: "taw-browser"
1228
- }, /* @__PURE__ */ React.createElement("header", {
1229
- className: "taw-browser-bar"
1230
- }, /* @__PURE__ */ React.createElement(Action, {
1231
- icon: "ArrowLeft",
1232
- label: t("back"),
1233
- disabled: history.index === 0,
1234
- onClick: () => step(-1)
1235
- }), /* @__PURE__ */ React.createElement(Action, {
1236
- icon: "ArrowRight",
1237
- label: t("forward"),
1238
- disabled: history.index === history.list.length - 1,
1239
- onClick: () => step(1)
1240
- }), /* @__PURE__ */ React.createElement(Action, {
1241
- icon: "RefreshCw",
1242
- label: t("refresh"),
1243
- disabled: !url,
1244
- onClick: reload
1245
- }), /* @__PURE__ */ React.createElement(AddressBar, {
1246
- value: url,
2346
+ }, /* @__PURE__ */ React.createElement(BrowserBar, {
2347
+ url,
1247
2348
  loading,
1248
- onOpen: go
1249
- }), /* @__PURE__ */ React.createElement(Action, {
1250
- icon: "House",
1251
- label: t("home"),
1252
- disabled: !url,
1253
- onClick: () => go("")
1254
- }), /* @__PURE__ */ React.createElement(Action, {
1255
- icon: "ExternalLink",
1256
- label: t("openExternal"),
1257
- disabled: !url,
1258
- onClick: () => window.open(url, "_blank", "noopener,noreferrer")
1259
- }), loading ? /* @__PURE__ */ React.createElement("span", {
1260
- className: "taw-browser-loading"
1261
- }) : undefined), url ? /* @__PURE__ */ React.createElement("iframe", {
2349
+ canGoBack: history.index > 0,
2350
+ canGoForward: history.index < history.list.length - 1,
2351
+ onBack: () => step(-1),
2352
+ onForward: () => step(1),
2353
+ onReload: reload,
2354
+ onOpen: go,
2355
+ onHome: () => go(""),
2356
+ onOpenOutside: shown ? () => openOutside(shown) : undefined,
2357
+ outsideLabel: t("openExternal")
2358
+ }), url ? shown && /* @__PURE__ */ React.createElement("iframe", {
1262
2359
  key: `${history.index}:${history.reloads}`,
1263
2360
  className: "taw-frame",
1264
- title: url,
1265
- src: url,
2361
+ title: shown === url ? url : `${url} → ${shown}`,
2362
+ src: shown,
1266
2363
  referrerPolicy: "no-referrer",
1267
- sandbox: WorkspaceUtil.frameSandbox(url, location.origin),
2364
+ sandbox: WorkspaceUtil.frameSandbox(shown, location.origin),
1268
2365
  onLoad: () => setLoading(false)
1269
2366
  }) : /* @__PURE__ */ React.createElement(Home, {
1270
- onOpen: go
2367
+ onOpen: go,
2368
+ foot: t("frameHint")
1271
2369
  }));
1272
2370
  }
2371
+ function BrowserView() {
2372
+ return pi.ui.supportsWebview ? /* @__PURE__ */ React.createElement(WebviewBrowser, null) : /* @__PURE__ */ React.createElement(FrameBrowser, null);
2373
+ }
1273
2374
 
1274
2375
  // web-src/util/seti.ts
1275
2376
  var SETI_ICONS = [
@@ -4321,6 +5422,182 @@ function MediaPreview({ kind, url, size, onInfo }) {
4321
5422
  }
4322
5423
  }
4323
5424
 
5425
+ // ../ta-protocol/esm/common/auth-protocol.js
5426
+ var TaAuthServer = Symbol("TaAuthServer");
5427
+ // ../ta-protocol/esm/common/location.js
5428
+ var TaLocation;
5429
+ (function(TaLocation2) {
5430
+ TaLocation2.SSH = "ssh://";
5431
+ const HOST = /^(?!-)[\w.@:%+[\]-]+$/;
5432
+ function isRemote(location2) {
5433
+ return location2.startsWith(TaLocation2.SSH);
5434
+ }
5435
+ TaLocation2.isRemote = isRemote;
5436
+ function parse(location2) {
5437
+ if (!isRemote(location2)) {
5438
+ return;
5439
+ }
5440
+ const rest = location2.slice(TaLocation2.SSH.length);
5441
+ const slash = rest.indexOf("/");
5442
+ const host2 = slash < 0 ? rest : rest.slice(0, slash);
5443
+ const path2 = slash < 0 ? "" : normalize(rest.slice(slash));
5444
+ if (!isHost(host2)) {
5445
+ throw new Error(`${JSON.stringify(location2)} names no host: write ssh://<host>/<path>, the host as ssh takes it.`);
5446
+ }
5447
+ return { host: host2, path: path2 };
5448
+ }
5449
+ TaLocation2.parse = parse;
5450
+ function isHost(host2) {
5451
+ return HOST.test(host2);
5452
+ }
5453
+ TaLocation2.isHost = isHost;
5454
+ const FLAGS = /^-[46AaCfGgKkMNnqsTtVvXxYy]+$/;
5455
+ function readHost(input) {
5456
+ const words = input.trim().split(/\s+/).filter(Boolean);
5457
+ if (words[0] === "ssh") {
5458
+ words.shift();
5459
+ }
5460
+ let destination;
5461
+ let port;
5462
+ let user;
5463
+ const options2 = [];
5464
+ for (let i = 0;i < words.length; i++) {
5465
+ const word = words[i];
5466
+ const glued = /^-([pl])(.+)$/.exec(word);
5467
+ if (word === "-p" || word === "-l" || glued) {
5468
+ const value = glued ? glued[2] : words[++i];
5469
+ if (value === undefined) {
5470
+ return { error: "invalid" };
5471
+ }
5472
+ if ((glued ? glued[1] : word[1]) === "p") {
5473
+ port = value;
5474
+ } else {
5475
+ user = value;
5476
+ }
5477
+ } else if (word === "-o" || word.startsWith("-o")) {
5478
+ const value = word === "-o" ? words[++i] : word.slice(2);
5479
+ const option = /^(port|user)\s*=?\s*(.+)$/i.exec(value !== null && value !== undefined ? value : "");
5480
+ if (!option) {
5481
+ options2.push(`-o ${value !== null && value !== undefined ? value : ""}`.trim());
5482
+ } else if (option[1].toLowerCase() === "port") {
5483
+ port = option[2];
5484
+ } else {
5485
+ user = option[2];
5486
+ }
5487
+ } else if (FLAGS.test(word)) {} else if (word.startsWith("-")) {
5488
+ options2.push(/^-[bBcDeEFiIJLmOQRSwW]$/.test(word) && words[i + 1] !== undefined ? `${word} ${words[++i]}` : word);
5489
+ } else if (destination === undefined) {
5490
+ destination = word;
5491
+ } else {
5492
+ return { error: "invalid" };
5493
+ }
5494
+ }
5495
+ if (options2.length > 0) {
5496
+ return { error: "options", options: options2 };
5497
+ }
5498
+ if (!destination) {
5499
+ return { error: "empty" };
5500
+ }
5501
+ let host2 = destination.replace(/^ssh:\/\//, "").replace(/\/.*$/, "");
5502
+ if (user && !host2.includes("@")) {
5503
+ host2 = `${user}@${host2}`;
5504
+ }
5505
+ if (port) {
5506
+ if (!/^\d{1,5}$/.test(port) || /:\d+$/.test(host2)) {
5507
+ return { error: "invalid" };
5508
+ }
5509
+ host2 = port === "22" ? host2 : `${host2}:${port}`;
5510
+ }
5511
+ return isHost(host2) ? { host: host2 } : { error: "invalid" };
5512
+ }
5513
+ TaLocation2.readHost = readHost;
5514
+ function ssh(host2, path2 = "") {
5515
+ return `${TaLocation2.SSH}${host2}${path2 ? normalize(path2) : ""}`;
5516
+ }
5517
+ TaLocation2.ssh = ssh;
5518
+ function host(location2) {
5519
+ var _a;
5520
+ return isRemote(location2) ? (_a = parse(location2)) === null || _a === undefined ? undefined : _a.host : undefined;
5521
+ }
5522
+ TaLocation2.host = host;
5523
+ function path(location2) {
5524
+ var _a;
5525
+ var _b;
5526
+ return (_b = (_a = parse(location2)) === null || _a === undefined ? undefined : _a.path) !== null && _b !== undefined ? _b : location2;
5527
+ }
5528
+ TaLocation2.path = path;
5529
+ function parent(location2) {
5530
+ const remote = parse(location2);
5531
+ if (remote) {
5532
+ const above = remote.path ? parentPath(remote.path) : undefined;
5533
+ return above === undefined ? undefined : ssh(remote.host, above);
5534
+ }
5535
+ return parentPath(location2);
5536
+ }
5537
+ TaLocation2.parent = parent;
5538
+ function child(location2, name) {
5539
+ const remote = parse(location2);
5540
+ if (remote) {
5541
+ return ssh(remote.host, childPath(remote.path || "/", name));
5542
+ }
5543
+ return childPath(location2, name);
5544
+ }
5545
+ TaLocation2.child = child;
5546
+ function basename(location2) {
5547
+ const remote = parse(location2);
5548
+ const path2 = (remote ? remote.path : location2).replace(/[\\/]+$/, "");
5549
+ const name = path2.slice(Math.max(path2.lastIndexOf("/"), path2.lastIndexOf("\\")) + 1);
5550
+ return name || (remote === null || remote === undefined ? undefined : remote.host) || location2;
5551
+ }
5552
+ TaLocation2.basename = basename;
5553
+ function parentPath(path2) {
5554
+ const trimmed = path2.replace(/[\\/]+$/, "");
5555
+ const at = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
5556
+ if (at < 0) {
5557
+ return;
5558
+ }
5559
+ const head = trimmed.slice(0, at);
5560
+ return head === "" || /^[A-Za-z]:$/.test(head) ? head + trimmed[at] : head;
5561
+ }
5562
+ function childPath(path2, name) {
5563
+ const separator = path2.includes("/") || !path2.includes("\\") ? "/" : "\\";
5564
+ return path2.endsWith(separator) ? path2 + name : path2 + separator + name;
5565
+ }
5566
+ function normalize(path2) {
5567
+ const squeezed = `/${path2}`.replace(/\/+/g, "/");
5568
+ return squeezed.length > 1 ? squeezed.replace(/\/$/, "") : squeezed;
5569
+ }
5570
+ })(TaLocation || (TaLocation = {}));
5571
+ // ../ta-protocol/esm/common/package-protocol.js
5572
+ var TaPackageServer = Symbol("TaPackageServer");
5573
+ // ../ta-protocol/esm/common/relay-protocol.js
5574
+ var TaRelayServer = Symbol("TaRelayServer");
5575
+ // ../ta-protocol/esm/common/remote-protocol.js
5576
+ var TaRemoteServer = Symbol("TaRemoteServer");
5577
+ // ../ta-protocol/esm/common/settings-protocol.js
5578
+ var TaSettingsServer = Symbol("TaSettingsServer");
5579
+ // ../ta-protocol/esm/common/ta-protocol.js
5580
+ var TaServer = Symbol("TaServer");
5581
+ var TaClient = Symbol("TaClient");
5582
+ var TaMessageContext;
5583
+ (function(TaMessageContext2) {
5584
+ const BLOCK = /^<context>\n?[\s\S]*?\n?<\/context>\n?/;
5585
+ function wrap(context, message) {
5586
+ return `<context>
5587
+ ${context}
5588
+ </context>
5589
+ ${message}`;
5590
+ }
5591
+ TaMessageContext2.wrap = wrap;
5592
+ function strip(message) {
5593
+ return message.replace(BLOCK, "");
5594
+ }
5595
+ TaMessageContext2.strip = strip;
5596
+ })(TaMessageContext || (TaMessageContext = {}));
5597
+ // ../ta-protocol/esm/common/workspace-protocol.js
5598
+ var TaWorkspaceServer = Symbol("TaWorkspaceServer");
5599
+ var TaTerminalServer = Symbol("TaTerminalServer");
5600
+ var TA_UPLOAD_PART_BYTES = 4 * 1024 * 1024;
4324
5601
  // web-src/util/search.ts
4325
5602
  var PREVIEW_CHARS = 200;
4326
5603
  var SKIPPED_DIRECTORIES = [".git", "node_modules"];
@@ -4507,33 +5784,246 @@ var SearchUtil;
4507
5784
  if (!found?.[0]) {
4508
5785
  return { text, count: 0 };
4509
5786
  }
4510
- const offset = start + found.index;
4511
- return { text: text.slice(0, offset) + expand(found[0], found.slice(1)) + text.slice(offset + found[0].length), count: 1 };
4512
- }
4513
- SearchUtil.replace = replace;
4514
- function groupsOf(rest) {
4515
- return rest.slice(0, rest.findIndex((value) => typeof value === "number"));
5787
+ const offset = start + found.index;
5788
+ return { text: text.slice(0, offset) + expand(found[0], found.slice(1)) + text.slice(offset + found[0].length), count: 1 };
5789
+ }
5790
+ SearchUtil.replace = replace;
5791
+ function groupsOf(rest) {
5792
+ return rest.slice(0, rest.findIndex((value) => typeof value === "number"));
5793
+ }
5794
+ function substitute(replacement, match, groups) {
5795
+ return replacement.replace(/\$(\$|&|\d{1,2})/g, (all, name) => {
5796
+ if (name === "$") {
5797
+ return "$";
5798
+ }
5799
+ if (name === "&") {
5800
+ return match;
5801
+ }
5802
+ const index = Number(name);
5803
+ return index >= 1 && index <= groups.length ? groups[index - 1] ?? "" : all;
5804
+ });
5805
+ }
5806
+ SearchUtil.substitute = substitute;
5807
+ })(SearchUtil ||= {});
5808
+
5809
+ // web-src/util/upload.ts
5810
+ var UploadUtil;
5811
+ ((UploadUtil) => {
5812
+ function segments(path) {
5813
+ const parts3 = path.split(/[\\/]+/).filter((part) => part && part !== ".");
5814
+ if (!parts3.length || parts3.some((part) => part === ".." || part.includes("\x00"))) {
5815
+ throw new Error(`Not a path to upload to: ${path}`);
5816
+ }
5817
+ return parts3;
5818
+ }
5819
+ UploadUtil.segments = segments;
5820
+ function fromFiles(files) {
5821
+ return { files: Array.from(files, (file) => ({ path: file.webkitRelativePath || file.name, file })), folders: [] };
5822
+ }
5823
+ UploadUtil.fromFiles = fromFiles;
5824
+ async function fromDrop(dataTransfer) {
5825
+ const entries = Array.from(dataTransfer.items ?? []).filter((item) => item.kind === "file").map((item) => item.webkitGetAsEntry?.());
5826
+ if (!entries.length || entries.some((entry) => !entry)) {
5827
+ return fromFiles(Array.from(dataTransfer.files ?? []));
5828
+ }
5829
+ const batch = { files: [], folders: [] };
5830
+ for (const entry of entries) {
5831
+ await collect(entry, "", batch);
5832
+ }
5833
+ return batch;
5834
+ }
5835
+ UploadUtil.fromDrop = fromDrop;
5836
+ async function collect(entry, folder, batch) {
5837
+ const path = folder ? `${folder}/${entry.name}` : entry.name;
5838
+ if (entry.isFile && entry.file) {
5839
+ const read = entry.file.bind(entry);
5840
+ batch.files.push({ path, file: await new Promise((resolve, reject) => read(resolve, reject)) });
5841
+ } else if (entry.isDirectory && entry.createReader) {
5842
+ batch.folders.push(path);
5843
+ const reader = entry.createReader();
5844
+ for (;; ) {
5845
+ const children = await new Promise((resolve, reject) => reader.readEntries(resolve, reject));
5846
+ if (!children.length) {
5847
+ break;
5848
+ }
5849
+ for (const child of children) {
5850
+ await collect(child, path, batch);
5851
+ }
5852
+ }
5853
+ }
5854
+ }
5855
+ function topNames(batch) {
5856
+ const names = new Set;
5857
+ for (const path of [...batch.files.map((file) => file.path), ...batch.folders]) {
5858
+ names.add(segments(path)[0]);
5859
+ }
5860
+ return [...names];
5861
+ }
5862
+ UploadUtil.topNames = topNames;
5863
+ function emptyFolders(batch) {
5864
+ const filled = new Set;
5865
+ for (const { path } of batch.files) {
5866
+ const parts3 = segments(path);
5867
+ for (let i = 1;i < parts3.length; i++) {
5868
+ filled.add(parts3.slice(0, i).join("/"));
5869
+ }
5870
+ }
5871
+ const folders = batch.folders.map((folder) => segments(folder).join("/"));
5872
+ return [...new Set(folders)].filter((folder) => !filled.has(folder) && !folders.some((other) => other.startsWith(`${folder}/`)));
5873
+ }
5874
+ UploadUtil.emptyFolders = emptyFolders;
5875
+ function totalBytes(batch) {
5876
+ return batch.files.reduce((sum, { file }) => sum + file.size, 0);
5877
+ }
5878
+ UploadUtil.totalBytes = totalBytes;
5879
+ function parts2(size, partBytes) {
5880
+ if (size === 0) {
5881
+ return [[0, 0]];
5882
+ }
5883
+ const out = [];
5884
+ for (let start = 0;start < size; start += partBytes) {
5885
+ out.push([start, Math.min(size, start + partBytes)]);
5886
+ }
5887
+ return out;
5888
+ }
5889
+ UploadUtil.parts = parts2;
5890
+ function toBase64(bytes) {
5891
+ let binary = "";
5892
+ for (let i = 0;i < bytes.length; i += 32768) {
5893
+ binary += String.fromCharCode(...bytes.subarray(i, i + 32768));
5894
+ }
5895
+ return btoa(binary);
5896
+ }
5897
+ UploadUtil.toBase64 = toBase64;
5898
+ })(UploadUtil ||= {});
5899
+
5900
+ // web-src/util/zip.ts
5901
+ var CRC_TABLE = (() => {
5902
+ const table = new Uint32Array(256);
5903
+ for (let n = 0;n < 256; n++) {
5904
+ let c = n;
5905
+ for (let k = 0;k < 8; k++) {
5906
+ c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
5907
+ }
5908
+ table[n] = c >>> 0;
5909
+ }
5910
+ return table;
5911
+ })();
5912
+ var ZIP_MAX_BYTES = 4294967295;
5913
+ var ZIP_MAX_ENTRIES = 65535;
5914
+ var ZipUtil;
5915
+ ((ZipUtil) => {
5916
+ function crc32(data) {
5917
+ let crc = 4294967295;
5918
+ for (let i = 0;i < data.length; i++) {
5919
+ crc = CRC_TABLE[(crc ^ data[i]) & 255] ^ crc >>> 8;
5920
+ }
5921
+ return (crc ^ 4294967295) >>> 0;
5922
+ }
5923
+ ZipUtil.crc32 = crc32;
5924
+ function dosTime(date) {
5925
+ const year = Math.max(1980, date.getFullYear());
5926
+ return [
5927
+ date.getHours() << 11 | date.getMinutes() << 5 | Math.floor(date.getSeconds() / 2),
5928
+ year - 1980 << 9 | date.getMonth() + 1 << 5 | date.getDate()
5929
+ ];
5930
+ }
5931
+ async function create(entries, deflate) {
5932
+ if (entries.length > ZIP_MAX_ENTRIES) {
5933
+ throw new Error(`An archive holds at most ${ZIP_MAX_ENTRIES} files.`);
5934
+ }
5935
+ const encoder = new TextEncoder;
5936
+ const locals = [];
5937
+ const centrals = [];
5938
+ let offset = 0;
5939
+ for (const entry of entries) {
5940
+ const name = encoder.encode(entry.path.replace(/^\/+/, ""));
5941
+ const crc = crc32(entry.data);
5942
+ const deflated = deflate && entry.data.length > 0 ? await deflate(entry.data) : undefined;
5943
+ const compressed = deflated && deflated.length < entry.data.length ? deflated : entry.data;
5944
+ const method = compressed === entry.data ? 0 : 8;
5945
+ const [time, date] = dosTime(entry.modified ?? new Date);
5946
+ if (offset + 30 + name.length + compressed.length > ZIP_MAX_BYTES) {
5947
+ throw new Error("An archive holds at most 4 GB.");
5948
+ }
5949
+ const header = (signature, central) => {
5950
+ const view = new DataView(new ArrayBuffer(central ? 46 : 30));
5951
+ let at2 = 0;
5952
+ const u16 = (value) => {
5953
+ view.setUint16(at2, value, true);
5954
+ at2 += 2;
5955
+ };
5956
+ const u32 = (value) => {
5957
+ view.setUint32(at2, value >>> 0, true);
5958
+ at2 += 4;
5959
+ };
5960
+ u32(signature);
5961
+ if (central) {
5962
+ u16(20);
5963
+ }
5964
+ u16(20);
5965
+ u16(2048);
5966
+ u16(method);
5967
+ u16(time);
5968
+ u16(date);
5969
+ u32(crc);
5970
+ u32(compressed.length);
5971
+ u32(entry.data.length);
5972
+ u16(name.length);
5973
+ u16(0);
5974
+ if (central) {
5975
+ u16(0);
5976
+ u16(0);
5977
+ u16(0);
5978
+ u32(0);
5979
+ u32(offset);
5980
+ }
5981
+ return new Uint8Array(view.buffer);
5982
+ };
5983
+ const local = header(67324752, false);
5984
+ locals.push(local, name, compressed);
5985
+ centrals.push(header(33639248, true), name);
5986
+ offset += local.length + name.length + compressed.length;
5987
+ }
5988
+ const centralSize = centrals.reduce((sum, part) => sum + part.length, 0);
5989
+ const end = new DataView(new ArrayBuffer(22));
5990
+ end.setUint32(0, 101010256, true);
5991
+ end.setUint16(8, entries.length, true);
5992
+ end.setUint16(10, entries.length, true);
5993
+ end.setUint32(12, centralSize, true);
5994
+ end.setUint32(16, offset, true);
5995
+ const parts2 = [...locals, ...centrals, new Uint8Array(end.buffer)];
5996
+ const out = new Uint8Array(parts2.reduce((sum, part) => sum + part.length, 0));
5997
+ let at = 0;
5998
+ for (const part of parts2) {
5999
+ out.set(part, at);
6000
+ at += part.length;
6001
+ }
6002
+ return out;
4516
6003
  }
4517
- function substitute(replacement, match, groups) {
4518
- return replacement.replace(/\$(\$|&|\d{1,2})/g, (all, name) => {
4519
- if (name === "$") {
4520
- return "$";
4521
- }
4522
- if (name === "&") {
4523
- return match;
4524
- }
4525
- const index = Number(name);
4526
- return index >= 1 && index <= groups.length ? groups[index - 1] ?? "" : all;
4527
- });
6004
+ ZipUtil.create = create;
6005
+ function browserDeflate() {
6006
+ const Stream = globalThis.CompressionStream;
6007
+ if (!Stream) {
6008
+ return;
6009
+ }
6010
+ return async (data) => {
6011
+ const stream = new Stream("deflate-raw");
6012
+ const writer = stream.writable.getWriter();
6013
+ writer.write(data).then(() => writer.close());
6014
+ return new Uint8Array(await new Response(stream.readable).arrayBuffer());
6015
+ };
4528
6016
  }
4529
- SearchUtil.substitute = substitute;
4530
- })(SearchUtil ||= {});
6017
+ ZipUtil.browserDeflate = browserDeflate;
6018
+ })(ZipUtil ||= {});
4531
6019
 
4532
6020
  // web-src/workspace-client.ts
4533
6021
  var SEARCH_LIMIT = 2000;
4534
6022
  var SEARCH_BYTES = 8 * 1024 * 1024;
4535
6023
  var SEARCHERS = ["rg", "git", "grep"];
4536
6024
  var REMOTE_TIMEOUT_MS = 120000;
6025
+ var MAX_ARCHIVE_BYTES = 1024 * 1024 * 1024;
6026
+ var DOWNLOAD_CONCURRENCY = 4;
4537
6027
  var WorkspaceClient;
4538
6028
  ((WorkspaceClient) => {
4539
6029
  const missing = new Map;
@@ -4629,6 +6119,93 @@ var WorkspaceClient;
4629
6119
  return run(cwd, "rm", ["-rf", "--", path]);
4630
6120
  }
4631
6121
  WorkspaceClient.remove = remove;
6122
+ function move(cwd, paths, folder) {
6123
+ return run(cwd, "mv", ["-n", "--", ...paths, folder || "."]);
6124
+ }
6125
+ WorkspaceClient.move = move;
6126
+ async function upload(cwd, folder, batch, onProgress) {
6127
+ for (const empty of UploadUtil.emptyFolders(batch)) {
6128
+ await createFolder(cwd, WorkspaceUtil.join(folder, empty));
6129
+ }
6130
+ const total = UploadUtil.totalBytes(batch);
6131
+ let sent = 0;
6132
+ for (const { path, file } of batch.files) {
6133
+ const target = WorkspaceUtil.join(folder, UploadUtil.segments(path).join("/"));
6134
+ for (const [start, end] of UploadUtil.parts(file.size, TA_UPLOAD_PART_BYTES)) {
6135
+ onProgress?.(sent, total, file.name);
6136
+ const bytes = new Uint8Array(await file.slice(start, end).arrayBuffer());
6137
+ await pi.workspace.uploadFile(target, UploadUtil.toBase64(bytes), { cwd, append: start > 0 });
6138
+ sent += end - start;
6139
+ }
6140
+ }
6141
+ onProgress?.(sent, total, "");
6142
+ return batch.files.length;
6143
+ }
6144
+ WorkspaceClient.upload = upload;
6145
+ async function filesOf(cwd, folder) {
6146
+ const files = [];
6147
+ let level = [folder];
6148
+ while (level.length) {
6149
+ const listed = await Promise.all(level.map((dir) => pi.workspace.listDirectory(dir, cwd)));
6150
+ level = [];
6151
+ for (const entry of listed.flat()) {
6152
+ if (entry.kind === "directory") {
6153
+ level.push(entry.path);
6154
+ } else {
6155
+ files.push(entry);
6156
+ }
6157
+ }
6158
+ }
6159
+ return files;
6160
+ }
6161
+ WorkspaceClient.filesOf = filesOf;
6162
+ async function download(cwd, entry, onProgress) {
6163
+ if (entry.kind === "file") {
6164
+ save(await pi.workspace.fileUrl(entry.path, cwd), entry.name);
6165
+ return;
6166
+ }
6167
+ const files = await filesOf(cwd, entry.path);
6168
+ const total = files.reduce((sum, file) => sum + (file.size ?? 0), 0);
6169
+ if (total > MAX_ARCHIVE_BYTES) {
6170
+ throw new Error(`${WorkspaceUtil.size(total)} is more than a folder downloaded here may hold (${WorkspaceUtil.size(MAX_ARCHIVE_BYTES)}).`);
6171
+ }
6172
+ const base = (await pi.workspace.fileUrl(entry.path, cwd)).replace(/\/?$/, "/");
6173
+ const offset = entry.path ? entry.path.length + 1 : 0;
6174
+ const entries = new Array(files.length);
6175
+ let done = 0;
6176
+ let next = 0;
6177
+ const worker = async () => {
6178
+ while (next < files.length) {
6179
+ const index = next++;
6180
+ const file = files[index];
6181
+ const relative = file.path.slice(offset);
6182
+ onProgress?.(done, total, file.name);
6183
+ const response = await fetch(base + relative.split("/").map(encodeURIComponent).join("/"));
6184
+ if (!response.ok) {
6185
+ throw new Error(`${file.path}: HTTP ${response.status}`);
6186
+ }
6187
+ entries[index] = { path: `${entry.name}/${relative}`, data: new Uint8Array(await response.arrayBuffer()) };
6188
+ done += file.size ?? 0;
6189
+ }
6190
+ };
6191
+ await Promise.all(Array.from({ length: Math.min(DOWNLOAD_CONCURRENCY, files.length) }, worker));
6192
+ onProgress?.(total, total, "");
6193
+ const zip = await ZipUtil.create(entries, ZipUtil.browserDeflate());
6194
+ const url = URL.createObjectURL(new Blob([zip], { type: "application/zip" }));
6195
+ save(url, `${entry.name}.zip`);
6196
+ setTimeout(() => URL.revokeObjectURL(url), 60000);
6197
+ }
6198
+ WorkspaceClient.download = download;
6199
+ function save(url, name) {
6200
+ const link2 = document.createElement("a");
6201
+ link2.href = url;
6202
+ link2.download = name;
6203
+ link2.rel = "noopener";
6204
+ link2.style.display = "none";
6205
+ document.body.append(link2);
6206
+ link2.click();
6207
+ link2.remove();
6208
+ }
4632
6209
  })(WorkspaceClient ||= {});
4633
6210
 
4634
6211
  // web-src/editors.tsx
@@ -5458,6 +7035,10 @@ var roots = new Map;
5458
7035
  var INDENT2 = 12;
5459
7036
  var EXPANDED_KEY = "explorer.expanded";
5460
7037
  var NO_DECORATIONS = { files: new Map, folders: new Map, ignored: [] };
7038
+ var DRAG_OPEN_MS = 600;
7039
+ function acceptsDrop(dataTransfer) {
7040
+ return dataTransfer.types.includes("Files") || pi.ui.fileDrag.has(dataTransfer);
7041
+ }
5461
7042
  var RevealRequests = new Channel;
5462
7043
  var ShowDirectory = new Channel;
5463
7044
  function ExplorerView() {
@@ -5471,6 +7052,14 @@ function ExplorerView() {
5471
7052
  const [picking, setPicking] = React.useState(false);
5472
7053
  const [menu, openMenu] = useContextMenu();
5473
7054
  const list2 = React.useRef(null);
7055
+ const [dropTarget, setDropTarget] = React.useState();
7056
+ const [transfer, setTransfer] = React.useState();
7057
+ const filePicker = React.useRef(null);
7058
+ const folderPicker = React.useRef(null);
7059
+ const pickedFolder = React.useRef("");
7060
+ const dragOpen = React.useRef(undefined);
7061
+ const desktop = pi.ui.desktop;
7062
+ const showsInFileManager = !!desktop && !TaLocation.isRemote(root);
5474
7063
  const git = useLoad(() => WorkspaceClient.status(root, true).catch(() => {
5475
7064
  return;
5476
7065
  }), [root, changed]);
@@ -5643,6 +7232,141 @@ function ExplorerView() {
5643
7232
  pi.ui.notify(t("deleteFailed", { message: Host.message(error) }), "error");
5644
7233
  }
5645
7234
  };
7235
+ const reloadFolder = async (folder) => {
7236
+ await load([folder, ...[...tree.expanded].filter((dir) => dir !== folder && WorkspaceUtil.within(dir, folder))]);
7237
+ FilesChanged.notify();
7238
+ };
7239
+ const taken = (folder, names) => {
7240
+ const there = siblings(folder).map((name) => name.toLowerCase());
7241
+ return names.filter((name) => there.includes(name.toLowerCase()));
7242
+ };
7243
+ const upload = async (folder, pending) => {
7244
+ let batch;
7245
+ try {
7246
+ batch = await pending;
7247
+ } catch (error) {
7248
+ pi.ui.notify(t("uploadFailed", { message: Host.message(error) }), "error");
7249
+ return;
7250
+ }
7251
+ if (!batch.files.length && !batch.folders.length) {
7252
+ return;
7253
+ }
7254
+ const replaced = taken(folder, UploadUtil.topNames(batch));
7255
+ if (replaced.length && !await pi.ui.confirm(t("replaceTitle", { names: replaced.join(", ") }), t("replaceMessage"), { confirmLabel: t("replace") })) {
7256
+ return;
7257
+ }
7258
+ if (folder) {
7259
+ expand((previous) => WorkspaceUtil.reveal(new Set([...previous, folder]), folder));
7260
+ }
7261
+ setTransfer({ label: t("uploading", { name: "" }), done: 0, total: UploadUtil.totalBytes(batch) });
7262
+ try {
7263
+ const count = await WorkspaceClient.upload(root, folder, batch, (done, total, name) => setTransfer({ label: t("uploading", { name }), done, total }));
7264
+ pi.ui.notify(t("uploaded", { count }));
7265
+ } catch (error) {
7266
+ pi.ui.notify(t("uploadFailed", { message: Host.message(error) }), "error");
7267
+ } finally {
7268
+ setTransfer(undefined);
7269
+ await reloadFolder(folder);
7270
+ }
7271
+ };
7272
+ const pickFiles = (folder, folders) => {
7273
+ pickedFolder.current = folder;
7274
+ (folders ? folderPicker : filePicker).current?.click();
7275
+ };
7276
+ const onPicked = (event) => {
7277
+ const files = Array.from(event.target.files ?? []);
7278
+ event.target.value = "";
7279
+ if (files.length) {
7280
+ upload(pickedFolder.current, Promise.resolve(UploadUtil.fromFiles(files)));
7281
+ }
7282
+ };
7283
+ const download = async (entry) => {
7284
+ try {
7285
+ if (entry.kind === "directory") {
7286
+ setTransfer({ label: t("packing", { name: entry.name }), done: 0, total: 0 });
7287
+ }
7288
+ await WorkspaceClient.download(root, entry, (done, total) => setTransfer({ label: t("packing", { name: entry.name }), done, total }));
7289
+ } catch (error) {
7290
+ pi.ui.notify(t("downloadFailed", { message: Host.message(error) }), "error");
7291
+ } finally {
7292
+ setTransfer(undefined);
7293
+ }
7294
+ };
7295
+ const move = async (paths, folder) => {
7296
+ const moving = WorkspaceUtil.movable(paths, folder);
7297
+ if (!moving.length) {
7298
+ return;
7299
+ }
7300
+ const clash = taken(folder, moving.map(WorkspaceUtil.basename));
7301
+ if (clash.length) {
7302
+ pi.ui.notify(t("moveExists", { name: clash[0] }), "error");
7303
+ return;
7304
+ }
7305
+ const reopen = OpenFiles.list().filter((file) => file.kind === "file" && file.cwd === root && moving.some((path) => WorkspaceUtil.within(file.detail, path)));
7306
+ try {
7307
+ await WorkspaceClient.move(root, moving, folder);
7308
+ for (const path of moving) {
7309
+ closeEditorsOf(root, path);
7310
+ }
7311
+ for (const file of reopen) {
7312
+ const to = WorkspaceUtil.movedTo(file.detail, moving, folder);
7313
+ if (to) {
7314
+ openFile(root, to, undefined, { preserveFocus: true });
7315
+ }
7316
+ }
7317
+ expand((previous) => new Set([...previous].map((path) => WorkspaceUtil.movedTo(path, moving, folder) ?? path)));
7318
+ if (folder) {
7319
+ expand((previous) => WorkspaceUtil.reveal(new Set([...previous, folder]), folder));
7320
+ }
7321
+ await load([...new Set([folder, ...moving.map(WorkspaceUtil.dirname)])]);
7322
+ setSelected(WorkspaceUtil.movedTo(moving[0], moving, folder));
7323
+ FilesChanged.notify();
7324
+ } catch (error) {
7325
+ pi.ui.notify(t("moveFailed", { message: Host.message(error) }), "error");
7326
+ }
7327
+ };
7328
+ const showInFileManager = (path) => {
7329
+ desktop?.showItemInFolder(absolute(path)).catch((error) => pi.ui.notify(t("revealFailed", { message: Host.message(error) }), "error"));
7330
+ };
7331
+ const stopDragOpen = () => {
7332
+ clearTimeout(dragOpen.current?.timer);
7333
+ dragOpen.current = undefined;
7334
+ };
7335
+ const dragOver = (event, folder, entry) => {
7336
+ if (!acceptsDrop(event.dataTransfer)) {
7337
+ return;
7338
+ }
7339
+ event.preventDefault();
7340
+ event.stopPropagation();
7341
+ event.dataTransfer.dropEffect = event.dataTransfer.types.includes("Files") ? "copy" : "move";
7342
+ if (dropTarget !== folder) {
7343
+ setDropTarget(folder);
7344
+ }
7345
+ const closed = entry?.kind === "directory" && !tree.expanded.has(entry.path) ? entry : undefined;
7346
+ if (dragOpen.current?.path !== closed?.path) {
7347
+ stopDragOpen();
7348
+ if (closed) {
7349
+ dragOpen.current = { path: closed.path, timer: setTimeout(() => toggle(closed), DRAG_OPEN_MS) };
7350
+ }
7351
+ }
7352
+ };
7353
+ const drop = (event, folder) => {
7354
+ if (!acceptsDrop(event.dataTransfer)) {
7355
+ return;
7356
+ }
7357
+ event.preventDefault();
7358
+ event.stopPropagation();
7359
+ setDropTarget(undefined);
7360
+ stopDragOpen();
7361
+ if (event.dataTransfer.types.includes("Files")) {
7362
+ upload(folder, UploadUtil.fromDrop(event.dataTransfer));
7363
+ return;
7364
+ }
7365
+ const dragged = pi.ui.fileDrag.get(event.dataTransfer);
7366
+ if (dragged?.cwd === root) {
7367
+ move(dragged.paths, folder);
7368
+ }
7369
+ };
5646
7370
  const absolute = (path) => path ? `${root.replace(/\/+$/, "")}/${path}` : root;
5647
7371
  const findInFolder = (path) => {
5648
7372
  SearchRequests.send({ cwd: root, include: path ? `${path}/**` : "" });
@@ -5654,11 +7378,25 @@ function ExplorerView() {
5654
7378
  { label: t("newFile"), run: () => startCreate(false, folder) },
5655
7379
  { label: t("newFolder"), run: () => startCreate(true, folder) }
5656
7380
  ];
7381
+ const fileManager = desktop && showsInFileManager ? [{ label: t(WorkspaceUtil.fileManagerLabel(desktop.platform)), run: () => showInFileManager(entry?.path ?? "") }] : [];
7382
+ const transfers = [
7383
+ { label: t("uploadFiles"), run: () => pickFiles(folder, false) },
7384
+ { label: t("uploadFolder"), run: () => pickFiles(folder, true) },
7385
+ {
7386
+ label: t("download"),
7387
+ run: () => void download(entry ?? { path: "", name: WorkspaceUtil.basename(TaLocation.path(root)) || "workspace", kind: "directory" })
7388
+ }
7389
+ ];
5657
7390
  if (!entry) {
5658
7391
  return [
5659
7392
  ...items,
5660
7393
  "-",
7394
+ ...fileManager,
5661
7395
  { label: t("findInFolder"), run: () => findInFolder("") },
7396
+ "-",
7397
+ ...transfers,
7398
+ "-",
7399
+ { label: t("copyPath"), run: () => copyText(root, t("copied")) },
5662
7400
  { label: t("refresh"), run: () => void load(["", ...tree.expanded]) }
5663
7401
  ];
5664
7402
  }
@@ -5666,8 +7404,11 @@ function ExplorerView() {
5666
7404
  ...items,
5667
7405
  "-",
5668
7406
  ...entry.kind === "file" ? [{ label: t("open"), run: () => openFile(root, entry.path) }] : [],
7407
+ ...fileManager,
5669
7408
  ...entry.kind === "directory" ? [{ label: t("findInFolder"), run: () => findInFolder(entry.path) }] : [],
5670
7409
  "-",
7410
+ ...transfers,
7411
+ "-",
5671
7412
  { label: t("copyPath"), keys: MAC ? "⌥⌘C" : "Shift+Alt+C", run: () => copyText(absolute(entry.path), t("copied")) },
5672
7413
  { label: t("copyRelativePath"), run: () => copyText(entry.path, t("copied")) },
5673
7414
  "-",
@@ -5688,7 +7429,7 @@ function ExplorerView() {
5688
7429
  };
5689
7430
  const onKey = (event, entry, expanded) => {
5690
7431
  const row = event.currentTarget;
5691
- const move = (to) => {
7432
+ const move2 = (to) => {
5692
7433
  const path = to?.dataset.path;
5693
7434
  if (path !== undefined) {
5694
7435
  setSelected(path);
@@ -5701,22 +7442,22 @@ function ExplorerView() {
5701
7442
  if (!expanded) {
5702
7443
  toggle(entry);
5703
7444
  } else {
5704
- move(row.nextElementSibling);
7445
+ move2(row.nextElementSibling);
5705
7446
  }
5706
7447
  } else if (event.key === "ArrowLeft") {
5707
7448
  event.preventDefault();
5708
7449
  if (expanded) {
5709
7450
  toggle(entry);
5710
7451
  } else {
5711
- move(list2.current?.querySelector(`[data-path="${CSS.escape(WorkspaceUtil.dirname(entry.path))}"]`));
7452
+ move2(list2.current?.querySelector(`[data-path="${CSS.escape(WorkspaceUtil.dirname(entry.path))}"]`));
5712
7453
  }
5713
7454
  } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
5714
7455
  event.preventDefault();
5715
- move(event.key === "ArrowDown" ? row.nextElementSibling : row.previousElementSibling);
7456
+ move2(event.key === "ArrowDown" ? row.nextElementSibling : row.previousElementSibling);
5716
7457
  } else if (event.key === "Home" || event.key === "End") {
5717
7458
  event.preventDefault();
5718
7459
  const rowsShown = all();
5719
- move(event.key === "Home" ? rowsShown[0] : rowsShown[rowsShown.length - 1]);
7460
+ move2(event.key === "Home" ? rowsShown[0] : rowsShown[rowsShown.length - 1]);
5720
7461
  } else if (event.key === "Enter" && MAC) {
5721
7462
  event.preventDefault();
5722
7463
  setEditing({ kind: "rename", path: entry.path });
@@ -5771,7 +7512,7 @@ function ExplorerView() {
5771
7512
  "aria-expanded": entry.kind === "directory" ? expanded : undefined,
5772
7513
  "aria-level": depth + 1,
5773
7514
  "aria-selected": selected === entry.path,
5774
- className: `taw-row taw-tree-row ${selected === entry.path ? "taw-selected" : ""} ${ignored ? "taw-ignored" : ""} ${letter === "D" ? "taw-deleted" : ""}`,
7515
+ 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" : ""}`,
5775
7516
  style: { paddingLeft: 8 + depth * INDENT2 },
5776
7517
  title: letter ? `${entry.path} • ${gitLabel(letter)}` : entry.path,
5777
7518
  onClick: () => !renaming && activate(entry, false),
@@ -5780,7 +7521,15 @@ function ExplorerView() {
5780
7521
  onContextMenu: (event) => {
5781
7522
  setSelected(entry.path);
5782
7523
  openMenu(event, menuFor(entry));
5783
- }
7524
+ },
7525
+ draggable: !renaming,
7526
+ onDragStart: (event) => {
7527
+ setSelected(entry.path);
7528
+ event.dataTransfer.effectAllowed = "copyMove";
7529
+ pi.ui.fileDrag.set(event.dataTransfer, { cwd: root, paths: [entry.path] });
7530
+ },
7531
+ onDragOver: (event) => dragOver(event, entry.kind === "directory" ? entry.path : WorkspaceUtil.dirname(entry.path), entry),
7532
+ onDrop: (event) => drop(event, entry.kind === "directory" ? entry.path : WorkspaceUtil.dirname(entry.path))
5784
7533
  }, /* @__PURE__ */ React.createElement(Guides, {
5785
7534
  depth
5786
7535
  }), /* @__PURE__ */ React.createElement("span", {
@@ -5839,15 +7588,49 @@ function ExplorerView() {
5839
7588
  onClick: () => setPicking(true)
5840
7589
  })), /* @__PURE__ */ React.createElement("div", {
5841
7590
  ref: list2,
5842
- className: "taw-list taw-tree",
7591
+ className: `taw-list taw-tree ${dropTarget === "" ? "taw-drop-root" : ""}`,
5843
7592
  role: "tree",
5844
7593
  "aria-label": t("explorer"),
5845
7594
  onContextMenu: (event) => event.target === event.currentTarget && openMenu(event, menuFor()),
5846
7595
  onClick: (event) => event.target === event.currentTarget && setSelected(undefined),
5847
- onKeyDown: (event) => event.key === "Escape" && setSelected(undefined)
7596
+ onKeyDown: (event) => event.key === "Escape" && setSelected(undefined),
7597
+ onDragOver: (event) => dragOver(event, ""),
7598
+ onDrop: (event) => drop(event, ""),
7599
+ onDragLeave: (event) => {
7600
+ if (!event.currentTarget.contains(event.relatedTarget)) {
7601
+ setDropTarget(undefined);
7602
+ stopDragOpen();
7603
+ }
7604
+ },
7605
+ onDragEnd: () => {
7606
+ setDropTarget(undefined);
7607
+ stopDragOpen();
7608
+ }
5848
7609
  }, tree.error && /* @__PURE__ */ React.createElement(Empty, {
5849
7610
  tone: "error"
5850
- }, 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, {
7611
+ }, 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), transfer && /* @__PURE__ */ React.createElement("div", {
7612
+ className: "taw-transfer",
7613
+ role: "status"
7614
+ }, /* @__PURE__ */ React.createElement("span", null, transfer.label), transfer.total > 0 && /* @__PURE__ */ React.createElement("span", {
7615
+ className: "taw-detail"
7616
+ }, Math.floor(transfer.done / transfer.total * 100), "%"), /* @__PURE__ */ React.createElement("span", {
7617
+ className: "taw-transfer-bar",
7618
+ style: { width: transfer.total > 0 ? `${transfer.done / transfer.total * 100}%` : "0%" }
7619
+ })), /* @__PURE__ */ React.createElement("input", {
7620
+ ref: filePicker,
7621
+ type: "file",
7622
+ multiple: true,
7623
+ hidden: true,
7624
+ onChange: onPicked
7625
+ }), /* @__PURE__ */ React.createElement("input", {
7626
+ ref: (element) => {
7627
+ folderPicker.current = element;
7628
+ element?.setAttribute("webkitdirectory", "");
7629
+ },
7630
+ type: "file",
7631
+ hidden: true,
7632
+ onChange: onPicked
7633
+ }), menu, picking && /* @__PURE__ */ React.createElement(FolderPicker, {
5851
7634
  initial: root,
5852
7635
  onClose: () => setPicking(false),
5853
7636
  onPick: (path) => {
@@ -6307,6 +8090,12 @@ var STYLE = `
6307
8090
  .taw-guides { position: absolute; inset: 0; pointer-events: none; }
6308
8091
  .taw-guide { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ta-border); opacity: 0; transition: opacity 120ms; }
6309
8092
  .taw-tree:hover .taw-guide { opacity: 1; }
8093
+ .taw-tree-row.taw-drop, .taw-tree-row.taw-drop:hover { background: color-mix(in srgb, var(--ta-border-focus) 16%, transparent); }
8094
+ .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); }
8095
+ .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: 12px; overflow: hidden; }
8096
+ .taw-transfer > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
8097
+ .taw-transfer .taw-detail { flex: none; }
8098
+ .taw-transfer-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--ta-border-focus); transition: width 0.2s ease; }
6310
8099
  .taw-editing { cursor: default; background: none !important; }
6311
8100
  .taw-name-input { position: relative; flex: 1; min-width: 0; display: flex; }
6312
8101
  .taw-input.taw-inline { height: 22px; padding: 0 4px; border-radius: 4px; font-size: 13px; }
@@ -6461,11 +8250,35 @@ var STYLE = `
6461
8250
  .taw-text { padding-right: 16px; }
6462
8251
  .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; }
6463
8252
  .taw-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
6464
- .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; }
6465
- .taw-screen { margin: 0; font-family: var(--ta-mono); font-size: 12px; line-height: 18px; white-space: pre; }
6466
- .taw-screen-line { position: relative; min-height: 18px; }
6467
- .taw-cursor { position: absolute; top: 2px; width: 1ch; height: 14px; background: var(--ta-text); opacity: 0.55; pointer-events: none; }
6468
- .taw-terminal:not(:focus-within) .taw-cursor { background: none; outline: 1px solid var(--ta-muted); outline-offset: -1px; }
8253
+ .taw-browser-stage { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
8254
+ .taw-webview { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
8255
+ .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: 11.5px; white-space: nowrap; }
8256
+ .taw-browser-driven-dot { width: 6px; height: 6px; border-radius: 3px; background: currentColor; animation: taw-pulse 1.2s ease-in-out infinite; }
8257
+ @keyframes taw-pulse { 50% { opacity: 0.35; } }
8258
+ .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: 12.5px; cursor: pointer; }
8259
+ .taw-browser-import:hover { color: var(--ta-text); text-decoration: underline; text-underline-offset: 3px; }
8260
+ .taw-import { display: flex; flex-direction: column; gap: 12px; width: min(420px, 80vw); font-size: 13px; color: var(--ta-text); }
8261
+ .taw-import-hint { margin: 0; color: var(--ta-secondary); line-height: 1.6; }
8262
+ .taw-import-error { margin: 0; color: var(--ta-red); line-height: 1.5; overflow-wrap: anywhere; }
8263
+ .taw-import-profiles { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow: auto; }
8264
+ .taw-import-profile { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
8265
+ .taw-import-profile:hover { background: var(--ta-hover); }
8266
+ .taw-import-profile.taw-on { border-color: var(--ta-border-focus); background: var(--ta-hover); }
8267
+ .taw-import-profile input { position: absolute; opacity: 0; pointer-events: none; }
8268
+ .taw-import-browser { flex: none; font-weight: 500; }
8269
+ .taw-import-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ta-muted); }
8270
+ .taw-import-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; }
8271
+ .taw-import-result { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 0 0; }
8272
+ .taw-import-result .taw-import-actions { justify-content: center; margin-top: 18px; }
8273
+ .taw-button.taw-primary { border-color: var(--ta-brand); background: var(--ta-brand); color: var(--ta-brand-text); font-weight: 500; }
8274
+ .taw-button.taw-primary:hover:not(:disabled) { background: var(--ta-brand); opacity: 0.88; }
8275
+ .taw-button:disabled { opacity: 0.45; cursor: default; }
8276
+ .taw-link { padding: 0; border: 0; background: none; color: var(--ta-muted); font: inherit; font-size: 12.5px; cursor: pointer; }
8277
+ .taw-link:hover:not(:disabled) { color: var(--ta-text); text-decoration: underline; text-underline-offset: 3px; }
8278
+ .taw-address-favicon { width: 14px; height: 14px; border-radius: 3px; object-fit: contain; }
8279
+ .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; }
8280
+ .taw-browser-failure .taw-browser-sub { max-width: 380px; overflow-wrap: anywhere; }
8281
+ .taw-terminal { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--ta-code); }
6469
8282
  @media (pointer: coarse) {
6470
8283
  .taw-row { height: 36px; }
6471
8284
  .taw-action { width: 32px; height: 32px; }
@@ -6489,7 +8302,6 @@ var STYLE = `
6489
8302
  .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; }
6490
8303
  .taw-terminal-tab > button:first-child > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
6491
8304
  .taw-terminal-tab > .taw-action { width: 20px; height: 20px; }
6492
- .taw-terminal-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; resize: none; }
6493
8305
  `;
6494
8306
  function injectStyle() {
6495
8307
  const element = document.createElement("style");
@@ -6500,437 +8312,10 @@ ${STYLE}`;
6500
8312
  return () => element.remove();
6501
8313
  }
6502
8314
 
6503
- // web-src/util/ansi.ts
6504
- var PLAIN = Object.freeze({});
6505
- var ESC = "\x1B";
6506
- var CSI = new RegExp(`^${ESC}\\[([0-?]*)([ -/]*)([@-~])`);
6507
- var DEFAULT_MAX_LINES = 2000;
6508
- var TAB = 8;
6509
-
6510
- class AnsiScreen {
6511
- cols;
6512
- rows;
6513
- maxLines;
6514
- lines = [[]];
6515
- row = 0;
6516
- col = 0;
6517
- style = PLAIN;
6518
- rest = "";
6519
- savedCursor;
6520
- version = 0;
6521
- constructor(cols = 80, rows = 24, maxLines = DEFAULT_MAX_LINES) {
6522
- this.cols = cols;
6523
- this.rows = rows;
6524
- this.maxLines = maxLines;
6525
- }
6526
- resize(cols, rows) {
6527
- this.cols = Math.max(1, cols);
6528
- this.rows = Math.max(1, rows);
6529
- this.version++;
6530
- }
6531
- feed(input) {
6532
- const text = this.rest + input;
6533
- this.rest = "";
6534
- let i = 0;
6535
- while (i < text.length) {
6536
- const char = text[i];
6537
- if (char === "\x1B") {
6538
- const used = this.escape(text, i);
6539
- if (used < 0) {
6540
- this.rest = text.slice(i);
6541
- break;
6542
- }
6543
- i += used;
6544
- continue;
6545
- }
6546
- i++;
6547
- if (char === "\r") {
6548
- this.col = 0;
6549
- } else if (char === `
6550
- `) {
6551
- this.lineFeed();
6552
- } else if (char === "\b") {
6553
- this.col = Math.max(0, this.col - 1);
6554
- } else if (char === "\t") {
6555
- this.col = Math.min(this.cols - 1, (Math.floor(this.col / TAB) + 1) * TAB);
6556
- } else if (char >= " " && char !== "") {
6557
- const code = char.charCodeAt(0);
6558
- if (code >= 55296 && code < 56320 && i < text.length) {
6559
- this.put(char + text[i]);
6560
- i++;
6561
- } else {
6562
- this.put(char);
6563
- }
6564
- }
6565
- }
6566
- this.version++;
6567
- }
6568
- clear() {
6569
- this.lines = [[]];
6570
- this.row = 0;
6571
- this.col = 0;
6572
- this.version++;
6573
- }
6574
- spans() {
6575
- return this.lines.map((line) => {
6576
- const spans = [];
6577
- for (const cell of line) {
6578
- const last = spans[spans.length - 1];
6579
- if (last && last.style === cell.style) {
6580
- last.text += cell.char;
6581
- } else {
6582
- spans.push({ text: cell.char, style: cell.style });
6583
- }
6584
- }
6585
- return spans;
6586
- });
6587
- }
6588
- text() {
6589
- return this.lines.map((line) => line.map((cell) => cell.char).join("").trimEnd()).join(`
6590
- `);
6591
- }
6592
- cursor() {
6593
- return { row: this.row, col: this.col };
6594
- }
6595
- put(char) {
6596
- if (this.col >= this.cols) {
6597
- this.col = 0;
6598
- this.lineFeed();
6599
- }
6600
- const line = this.lines[this.row];
6601
- while (line.length < this.col) {
6602
- line.push({ char: " ", style: PLAIN });
6603
- }
6604
- line[this.col] = { char, style: this.style };
6605
- this.col++;
6606
- }
6607
- lineFeed() {
6608
- this.row++;
6609
- if (this.row === this.lines.length) {
6610
- this.lines.push([]);
6611
- }
6612
- if (this.lines.length > this.maxLines) {
6613
- const drop = this.lines.length - this.maxLines;
6614
- this.lines.splice(0, drop);
6615
- this.row -= drop;
6616
- }
6617
- }
6618
- top() {
6619
- return Math.max(0, this.lines.length - this.rows);
6620
- }
6621
- escape(text, start) {
6622
- const kind = text[start + 1];
6623
- if (kind === undefined) {
6624
- return -1;
6625
- }
6626
- if (kind === "[") {
6627
- const found = CSI.exec(text.slice(start, start + 64));
6628
- if (!found) {
6629
- return text.length - start < 64 ? -1 : 2;
6630
- }
6631
- this.csi(found[1], found[3]);
6632
- return found[0].length;
6633
- }
6634
- if (kind === "]" || kind === "P" || kind === "_" || kind === "^") {
6635
- const bel = text.indexOf("\x07", start + 2);
6636
- const st = text.indexOf("\x1B\\", start + 2);
6637
- const end = bel < 0 ? st : st < 0 ? bel : Math.min(bel, st);
6638
- if (end < 0) {
6639
- return -1;
6640
- }
6641
- return end - start + (end === bel ? 1 : 2);
6642
- }
6643
- if (kind === "(" || kind === ")" || kind === "#") {
6644
- return text.length - start < 3 ? -1 : 3;
6645
- }
6646
- if (kind === "7") {
6647
- this.savedCursor = { row: this.row, col: this.col };
6648
- } else if (kind === "8" && this.savedCursor) {
6649
- ({ row: this.row, col: this.col } = this.savedCursor);
6650
- } else if (kind === "M") {
6651
- this.row = Math.max(this.top(), this.row - 1);
6652
- } else if (kind === "c") {
6653
- this.clear();
6654
- this.style = PLAIN;
6655
- }
6656
- return 2;
6657
- }
6658
- csi(params, final) {
6659
- if (params.startsWith("?") || params.startsWith(">") || params.startsWith("=")) {
6660
- if (/^\?(1049|47|1047)$/.test(params) && (final === "h" || final === "l")) {
6661
- this.eraseScreen(2);
6662
- }
6663
- return;
6664
- }
6665
- const values = params.split(";").map((value) => value === "" ? undefined : Number(value));
6666
- const n = values[0] ?? 1;
6667
- switch (final) {
6668
- case "m":
6669
- this.sgr(values.map((value) => value ?? 0));
6670
- break;
6671
- case "A":
6672
- this.row = Math.max(this.top(), this.row - n);
6673
- break;
6674
- case "B":
6675
- this.moveRow(this.row + n);
6676
- break;
6677
- case "C":
6678
- this.col = Math.min(this.cols - 1, this.col + n);
6679
- break;
6680
- case "D":
6681
- this.col = Math.max(0, this.col - n);
6682
- break;
6683
- case "E":
6684
- this.moveRow(this.row + n);
6685
- this.col = 0;
6686
- break;
6687
- case "F":
6688
- this.row = Math.max(this.top(), this.row - n);
6689
- this.col = 0;
6690
- break;
6691
- case "G":
6692
- this.col = Math.min(this.cols - 1, Math.max(0, n - 1));
6693
- break;
6694
- case "H":
6695
- case "f":
6696
- this.moveRow(this.top() + Math.max(0, (values[0] ?? 1) - 1));
6697
- this.col = Math.min(this.cols - 1, Math.max(0, (values[1] ?? 1) - 1));
6698
- break;
6699
- case "J":
6700
- this.eraseScreen(values[0] ?? 0);
6701
- break;
6702
- case "K":
6703
- this.eraseLine(values[0] ?? 0);
6704
- break;
6705
- case "P":
6706
- this.lines[this.row].splice(this.col, n);
6707
- break;
6708
- case "X":
6709
- for (let i = this.col;i < Math.min(this.col + n, this.lines[this.row].length); i++) {
6710
- this.lines[this.row][i] = { char: " ", style: PLAIN };
6711
- }
6712
- break;
6713
- case "@":
6714
- if (this.col < this.lines[this.row].length) {
6715
- this.lines[this.row].splice(this.col, 0, ...Array.from({ length: n }, () => ({ char: " ", style: PLAIN })));
6716
- }
6717
- break;
6718
- case "s":
6719
- this.savedCursor = { row: this.row, col: this.col };
6720
- break;
6721
- case "u":
6722
- if (this.savedCursor) {
6723
- ({ row: this.row, col: this.col } = this.savedCursor);
6724
- }
6725
- break;
6726
- }
6727
- }
6728
- moveRow(row) {
6729
- while (this.lines.length <= row) {
6730
- this.lines.push([]);
6731
- }
6732
- this.row = row;
6733
- }
6734
- eraseLine(mode) {
6735
- const line = this.lines[this.row];
6736
- if (mode === 0) {
6737
- line.length = Math.min(line.length, this.col);
6738
- } else if (mode === 1) {
6739
- for (let i = 0;i <= Math.min(this.col, line.length - 1); i++) {
6740
- line[i] = { char: " ", style: PLAIN };
6741
- }
6742
- } else {
6743
- line.length = 0;
6744
- }
6745
- }
6746
- eraseScreen(mode) {
6747
- if (mode === 0) {
6748
- this.eraseLine(0);
6749
- this.lines.length = this.row + 1;
6750
- } else if (mode === 1) {
6751
- for (let i = this.top();i < this.row; i++) {
6752
- this.lines[i] = [];
6753
- }
6754
- this.eraseLine(1);
6755
- } else {
6756
- if (mode === 3) {
6757
- this.lines = [[]];
6758
- } else {
6759
- const used = this.lines.length > 1 || this.lines[0].length > 0;
6760
- for (let i = 0;used && i < this.rows; i++) {
6761
- this.lines.push([]);
6762
- }
6763
- }
6764
- this.row = this.top();
6765
- this.col = 0;
6766
- if (this.lines.length > this.maxLines) {
6767
- const drop = this.lines.length - this.maxLines;
6768
- this.lines.splice(0, drop);
6769
- this.row -= drop;
6770
- }
6771
- }
6772
- }
6773
- sgr(values) {
6774
- const style = { ...this.style };
6775
- for (let i = 0;i < values.length; i++) {
6776
- const value = values[i];
6777
- if (value === 0) {
6778
- for (const key of Object.keys(style)) {
6779
- delete style[key];
6780
- }
6781
- } else if (value === 1) {
6782
- style.bold = true;
6783
- } else if (value === 2) {
6784
- style.dim = true;
6785
- } else if (value === 3) {
6786
- style.italic = true;
6787
- } else if (value === 4) {
6788
- style.underline = true;
6789
- } else if (value === 7) {
6790
- style.inverse = true;
6791
- } else if (value === 22) {
6792
- delete style.bold;
6793
- delete style.dim;
6794
- } else if (value === 23) {
6795
- delete style.italic;
6796
- } else if (value === 24) {
6797
- delete style.underline;
6798
- } else if (value === 27) {
6799
- delete style.inverse;
6800
- } else if (value >= 30 && value <= 37) {
6801
- style.fg = value - 30;
6802
- } else if (value >= 90 && value <= 97) {
6803
- style.fg = value - 90 + 8;
6804
- } else if (value === 39) {
6805
- delete style.fg;
6806
- } else if (value >= 40 && value <= 47) {
6807
- style.bg = value - 40;
6808
- } else if (value >= 100 && value <= 107) {
6809
- style.bg = value - 100 + 8;
6810
- } else if (value === 49) {
6811
- delete style.bg;
6812
- } else if (value === 38 || value === 48) {
6813
- const key = value === 38 ? "fg" : "bg";
6814
- if (values[i + 1] === 5 && values[i + 2] !== undefined) {
6815
- style[key] = values[i + 2];
6816
- i += 2;
6817
- } else if (values[i + 1] === 2 && values[i + 4] !== undefined) {
6818
- style[key] = `#${values.slice(i + 2, i + 5).map((part) => Math.min(255, part).toString(16).padStart(2, "0")).join("")}`;
6819
- i += 4;
6820
- }
6821
- }
6822
- }
6823
- this.style = Object.keys(style).length ? style : PLAIN;
6824
- }
6825
- }
6826
- var AnsiUtil;
6827
- ((AnsiUtil) => {
6828
- const BASIC = ["--ta-text", "--ta-red", "--ta-green", "--ta-yellow", "--ta-blue", "#c084fc", "#22d3ee", "--ta-secondary"];
6829
- const STEPS = [0, 95, 135, 175, 215, 255];
6830
- function color(value) {
6831
- if (value === undefined || typeof value === "string") {
6832
- return value;
6833
- }
6834
- if (value < 16) {
6835
- if (value % 8 === 0) {
6836
- return "var(--ta-muted)";
6837
- }
6838
- const name = value === 15 ? "--ta-text" : BASIC[value % 8];
6839
- return name.startsWith("--") ? `var(${name})` : name;
6840
- }
6841
- if (value < 232) {
6842
- const n = value - 16;
6843
- return `rgb(${STEPS[Math.floor(n / 36)]}, ${STEPS[Math.floor(n / 6) % 6]}, ${STEPS[n % 6]})`;
6844
- }
6845
- const gray = 8 + (value - 232) * 10;
6846
- return `rgb(${gray}, ${gray}, ${gray})`;
6847
- }
6848
- AnsiUtil.color = color;
6849
- function css(style) {
6850
- if (style === PLAIN || !Object.keys(style).length) {
6851
- return;
6852
- }
6853
- let fg = color(style.fg);
6854
- let bg = color(style.bg);
6855
- if (style.inverse) {
6856
- [fg, bg] = [bg ?? "var(--ta-main)", fg ?? "var(--ta-text)"];
6857
- }
6858
- const css2 = {};
6859
- if (fg) {
6860
- css2.color = fg;
6861
- }
6862
- if (bg) {
6863
- css2.background = bg;
6864
- }
6865
- if (style.bold) {
6866
- css2.fontWeight = "600";
6867
- }
6868
- if (style.dim) {
6869
- css2.opacity = "0.65";
6870
- }
6871
- if (style.italic) {
6872
- css2.fontStyle = "italic";
6873
- }
6874
- if (style.underline) {
6875
- css2.textDecoration = "underline";
6876
- }
6877
- return css2;
6878
- }
6879
- AnsiUtil.css = css;
6880
- })(AnsiUtil ||= {});
6881
-
6882
- // web-src/util/keys.ts
6883
- var KEYS = {
6884
- Enter: "\r",
6885
- Backspace: "",
6886
- Tab: "\t",
6887
- Escape: "\x1B",
6888
- ArrowUp: "\x1B[A",
6889
- ArrowDown: "\x1B[B",
6890
- ArrowRight: "\x1B[C",
6891
- ArrowLeft: "\x1B[D",
6892
- Home: "\x1B[H",
6893
- End: "\x1B[F",
6894
- Delete: "\x1B[3~",
6895
- Insert: "\x1B[2~",
6896
- PageUp: "\x1B[5~",
6897
- PageDown: "\x1B[6~"
6898
- };
6899
- var TerminalKeys;
6900
- ((TerminalKeys) => {
6901
- function sequence(event) {
6902
- if (event.metaKey) {
6903
- return;
6904
- }
6905
- if (event.key === "Tab" && event.shiftKey) {
6906
- return "\x1B[Z";
6907
- }
6908
- const special = KEYS[event.key];
6909
- if (special) {
6910
- return event.altKey ? `\x1B${special}` : special;
6911
- }
6912
- if (event.ctrlKey && event.key.length === 1) {
6913
- const code = event.key.toUpperCase().charCodeAt(0);
6914
- if (code >= 64 && code <= 95) {
6915
- return String.fromCharCode(code - 64);
6916
- }
6917
- if (event.key === " ") {
6918
- return "\x00";
6919
- }
6920
- }
6921
- return;
6922
- }
6923
- TerminalKeys.sequence = sequence;
6924
- function paste(text) {
6925
- return text.replace(/\r?\n/g, "\r");
6926
- }
6927
- TerminalKeys.paste = paste;
6928
- })(TerminalKeys ||= {});
6929
-
6930
8315
  // web-src/terminal.tsx
6931
- var LINE_HEIGHT = 18;
6932
- var SCROLLBACK = 1000;
6933
8316
  var RESIZE_MS = 120;
8317
+ var OPEN_COLS = 100;
8318
+ var OPEN_ROWS = 30;
6934
8319
  var Terminals;
6935
8320
  ((Terminals) => {
6936
8321
  const sessions = new Map;
@@ -6965,8 +8350,25 @@ var Terminals;
6965
8350
  function add(info) {
6966
8351
  let session = sessions.get(info.terminalId);
6967
8352
  if (!session) {
6968
- session = { info, screen: new AnsiScreen(80, 24, SCROLLBACK) };
6969
- sessions.set(info.terminalId, session);
8353
+ const terminal = pi.ui.createTerminal({ cols: OPEN_COLS, rows: OPEN_ROWS, cwd: info.cwd || undefined });
8354
+ const created = { info, terminal };
8355
+ const id = info.terminalId;
8356
+ terminal.onData((data) => {
8357
+ if (created.exitCode === undefined) {
8358
+ pi.terminals.writeTerminal(id, data).catch(() => {
8359
+ return;
8360
+ });
8361
+ }
8362
+ });
8363
+ let timer;
8364
+ terminal.onResize(({ cols, rows }) => {
8365
+ clearTimeout(timer);
8366
+ timer = setTimeout(() => void pi.terminals.resizeTerminal(id, cols, rows).catch(() => {
8367
+ return;
8368
+ }), RESIZE_MS);
8369
+ });
8370
+ session = created;
8371
+ sessions.set(id, session);
6970
8372
  changed();
6971
8373
  }
6972
8374
  return session;
@@ -6977,18 +8379,20 @@ var Terminals;
6977
8379
  return;
6978
8380
  }
6979
8381
  const session = sessions.get(terminalId) ?? add({ terminalId, cwd: "", shell: "", pty: true });
6980
- session.screen.feed(data);
8382
+ session.terminal.write(data);
6981
8383
  if (exitCode !== undefined && exitCode !== null) {
6982
8384
  session.exitCode = exitCode;
6983
- session.screen.feed(`\r
8385
+ session.terminal.write(`\r
6984
8386
  ${t("terminalEnded", { code: exitCode })}\r
6985
- `);
8387
+ \x1B[?25l`);
8388
+ changed();
6986
8389
  }
6987
- changed();
6988
8390
  }
6989
8391
  Terminals.receive = receive;
6990
8392
  function remove(terminalId) {
6991
- if (sessions.delete(terminalId)) {
8393
+ const session = sessions.get(terminalId);
8394
+ if (session && sessions.delete(terminalId)) {
8395
+ session.terminal.dispose();
6992
8396
  closed.add(terminalId);
6993
8397
  changed();
6994
8398
  }
@@ -7033,7 +8437,7 @@ function TerminalView() {
7033
8437
  opening.current = true;
7034
8438
  try {
7035
8439
  setError(undefined);
7036
- setShown(Terminals.add(await pi.terminals.openTerminal({ cwd, cols: 100, rows: 30 })).info.terminalId);
8440
+ setShown(Terminals.add(await pi.terminals.openTerminal({ cwd, cols: OPEN_COLS, rows: OPEN_ROWS })).info.terminalId);
7037
8441
  } catch (failure) {
7038
8442
  setError(Host.message(failure));
7039
8443
  } finally {
@@ -7110,88 +8514,23 @@ function TerminalView() {
7110
8514
  terminalId: current.info.terminalId
7111
8515
  }));
7112
8516
  }
7113
- function measure(element) {
7114
- const probe = document.createElement("span");
7115
- probe.textContent = "MMMMMMMMMM";
7116
- probe.style.visibility = "hidden";
7117
- probe.style.position = "absolute";
7118
- element.appendChild(probe);
7119
- const width = probe.getBoundingClientRect().width / 10 || 8;
7120
- probe.remove();
7121
- return { width, height: LINE_HEIGHT };
7122
- }
7123
8517
  function TerminalEditor({ terminalId }) {
7124
8518
  useTerminals();
7125
8519
  const session = Terminals.get(terminalId);
7126
8520
  const box = React.useRef(null);
7127
- const input = React.useRef(null);
7128
- const composing = React.useRef(false);
7129
- const pinned = React.useRef(true);
7130
- const write = React.useCallback((data) => void pi.terminals.writeTerminal(terminalId, data).catch(() => {
7131
- return;
7132
- }), [terminalId]);
8521
+ const terminal = session?.terminal;
7133
8522
  React.useEffect(() => {
7134
8523
  const element = box.current;
7135
- if (!element || !session) {
8524
+ if (!element || !terminal) {
7136
8525
  return;
7137
8526
  }
7138
- let timer;
7139
- let last = "";
7140
- const observer = new ResizeObserver(() => {
7141
- if (!element.clientWidth || !element.clientHeight) {
7142
- return;
7143
- }
7144
- const cell = measure(element);
7145
- const cols = Math.max(20, Math.floor((element.clientWidth - 16) / cell.width));
7146
- const rows = Math.max(5, Math.floor((element.clientHeight - 16) / cell.height));
7147
- if (`${cols}x${rows}` === last) {
7148
- return;
7149
- }
7150
- last = `${cols}x${rows}`;
7151
- session.screen.resize(cols, rows);
7152
- clearTimeout(timer);
7153
- timer = setTimeout(() => void pi.terminals.resizeTerminal(terminalId, cols, rows).catch(() => {
7154
- return;
7155
- }), RESIZE_MS);
7156
- });
7157
- observer.observe(element);
7158
- return () => {
7159
- observer.disconnect();
7160
- clearTimeout(timer);
7161
- };
7162
- }, [session, terminalId]);
7163
- React.useEffect(() => input.current?.focus({ preventScroll: true }), []);
7164
- React.useLayoutEffect(() => {
7165
- const element = box.current;
7166
- if (element && pinned.current) {
7167
- element.scrollTop = element.scrollHeight;
7168
- }
7169
- });
8527
+ const detach = terminal.attach(element);
8528
+ terminal.focus();
8529
+ return detach;
8530
+ }, [terminal]);
7170
8531
  if (!session) {
7171
8532
  return /* @__PURE__ */ React.createElement(Empty, null, t("noTerminals"));
7172
8533
  }
7173
- const lines = session.screen.spans();
7174
- const cursor = session.screen.cursor();
7175
- const ended = session.exitCode !== undefined;
7176
- const onKeyDown = (event) => {
7177
- if (composing.current || ended) {
7178
- return;
7179
- }
7180
- const sequence = TerminalKeys.sequence(event);
7181
- if (sequence !== undefined) {
7182
- event.preventDefault();
7183
- write(sequence);
7184
- }
7185
- };
7186
- const flush = () => {
7187
- const element = input.current;
7188
- if (element?.value && !composing.current) {
7189
- if (!ended) {
7190
- write(element.value);
7191
- }
7192
- element.value = "";
7193
- }
7194
- };
7195
8534
  return /* @__PURE__ */ React.createElement("div", {
7196
8535
  className: "taw-editor"
7197
8536
  }, session.info.pty === false && /* @__PURE__ */ React.createElement("div", {
@@ -7199,50 +8538,26 @@ function TerminalEditor({ terminalId }) {
7199
8538
  }, t("pipeMode")), /* @__PURE__ */ React.createElement("div", {
7200
8539
  className: "taw-terminal",
7201
8540
  ref: box,
7202
- role: "presentation",
7203
- onScroll: (event) => {
7204
- const element = event.currentTarget;
7205
- pinned.current = element.scrollHeight - element.scrollTop - element.clientHeight < LINE_HEIGHT;
7206
- },
7207
- onMouseUp: () => {
7208
- if (!window.getSelection()?.toString()) {
7209
- input.current?.focus({ preventScroll: true });
8541
+ onDragOver: (event) => {
8542
+ if (pi.ui.fileDrag.has(event.dataTransfer)) {
8543
+ event.preventDefault();
8544
+ event.dataTransfer.dropEffect = "copy";
7210
8545
  }
7211
- }
7212
- }, /* @__PURE__ */ React.createElement("pre", {
7213
- className: "taw-screen"
7214
- }, lines.map((spans, row) => /* @__PURE__ */ React.createElement("div", {
7215
- key: row,
7216
- className: "taw-screen-line"
7217
- }, spans.map((span, index) => /* @__PURE__ */ React.createElement("span", {
7218
- key: index,
7219
- style: AnsiUtil.css(span.style)
7220
- }, span.text)), row === cursor.row && !ended && /* @__PURE__ */ React.createElement("span", {
7221
- className: "taw-cursor",
7222
- style: { left: `${cursor.col}ch` }
7223
- }), `
7224
- `))), /* @__PURE__ */ React.createElement("textarea", {
7225
- ref: input,
7226
- className: "taw-terminal-input",
7227
- "aria-label": t("terminal"),
7228
- autoCapitalize: "off",
7229
- autoComplete: "off",
7230
- autoCorrect: "off",
7231
- spellCheck: false,
7232
- onKeyDown,
7233
- onInput: flush,
7234
- onCompositionStart: () => composing.current = true,
7235
- onCompositionEnd: () => {
7236
- composing.current = false;
7237
- flush();
7238
8546
  },
7239
- onPaste: (event) => {
7240
- event.preventDefault();
7241
- if (!ended) {
7242
- write(TerminalKeys.paste(event.clipboardData.getData("text")));
8547
+ onDrop: (event) => {
8548
+ const files = pi.ui.fileDrag.get(event.dataTransfer);
8549
+ if (!files || session.exitCode !== undefined) {
8550
+ return;
7243
8551
  }
8552
+ event.preventDefault();
8553
+ const windows = /(^|[\\/])(cmd|powershell|pwsh)(\.exe)?$/i.test(session.info.shell);
8554
+ const words = pi.ui.fileDrag.paths(files).map((path) => WorkspaceUtil.shellQuote(path, windows));
8555
+ pi.terminals.writeTerminal(terminalId, `${words.join(" ")} `).catch(() => {
8556
+ return;
8557
+ });
8558
+ terminal?.focus();
7244
8559
  }
7245
- })));
8560
+ }));
7246
8561
  }
7247
8562
 
7248
8563
  // web-src/index.tsx
@@ -7277,6 +8592,9 @@ function activate(pi2) {
7277
8592
  pi2.on("tool_execution_end", () => FilesChanged.notify());
7278
8593
  pi2.on("agent_end", () => FilesChanged.notify());
7279
8594
  pi2.registerOpener((link2) => openLink(pi2, link2));
8595
+ if (pi2.ui.debugWebview) {
8596
+ pi2.registerTool(AgentBrowser.TOOL);
8597
+ }
7280
8598
  const stopTerminals = pi2.onTerminalData((terminalId, data, exitCode) => Terminals.receive(terminalId, data, exitCode));
7281
8599
  OpenFiles.restore();
7282
8600
  return () => {