claude-code-zanii 2.8.4

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 (669) hide show
  1. package/README.md +146 -0
  2. package/dist/chunks/AddWorkspaceDirectory-y_rd6sRl.js +1 -0
  3. package/dist/chunks/App-DgWSavG1.js +1 -0
  4. package/dist/chunks/ApproveApiKey-CJKWha-a.js +1 -0
  5. package/dist/chunks/ApproveApiKey-DTs2ExZH.js +1 -0
  6. package/dist/chunks/AssistantSessionChooser-BAhVk4id.js +1 -0
  7. package/dist/chunks/BackgroundTasksDialog-XU_JPh7R.js +2 -0
  8. package/dist/chunks/BypassPermissionsModeDialog-DV0Pi7ys.js +1 -0
  9. package/dist/chunks/ClaudeInChromeOnboarding-6erm_8Fn.js +1 -0
  10. package/dist/chunks/ClaudeMdExternalIncludesDialog-CjBvzB5s.js +1 -0
  11. package/dist/chunks/ClaudeMdExternalIncludesDialog-ts0XnWwl.js +1 -0
  12. package/dist/chunks/ConsoleOAuthFlow-DySPdSqQ.js +1 -0
  13. package/dist/chunks/CustomSelect-DqZxzBZP.js +1 -0
  14. package/dist/chunks/DesktopHandoff-5c90JK88.js +1 -0
  15. package/dist/chunks/DevChannelsDialog-DCMderzu.js +1 -0
  16. package/dist/chunks/Dialog-Dgg8bqcG.js +1 -0
  17. package/dist/chunks/DiffDialog-BU765aqh.js +6 -0
  18. package/dist/chunks/Doctor-B73iDB-d.js +3 -0
  19. package/dist/chunks/Doctor-CLZDdNRo.js +1 -0
  20. package/dist/chunks/ExitFlow-DBqn2mUf.js +2 -0
  21. package/dist/chunks/Feedback-D-JHabwi.js +2 -0
  22. package/dist/chunks/Grove-D-uQNMMo.js +11 -0
  23. package/dist/chunks/HybridTransport-B-G4QJcy.js +4 -0
  24. package/dist/chunks/ITermBackend-KP1vKsRN.js +1 -0
  25. package/dist/chunks/InProcessTransport-ByBEKxrQ.js +1 -0
  26. package/dist/chunks/InvalidConfigDialog-CMqiZ5nG.js +1 -0
  27. package/dist/chunks/InvalidSettingsDialog-CjPCKzVZ.js +1 -0
  28. package/dist/chunks/ListItem-B6MyhHvM.js +1 -0
  29. package/dist/chunks/MCPConnectionManager-BJ8PcYPe.js +1 -0
  30. package/dist/chunks/Message-DNxJ_tMS.js +1 -0
  31. package/dist/chunks/MessageSelector-D79Ug71B.js +3 -0
  32. package/dist/chunks/Messages-CtIbkB2M.js +11 -0
  33. package/dist/chunks/Onboarding-DVrgKrI9.js +1 -0
  34. package/dist/chunks/OverageCreditUpsell-D_td1ss4.js +1 -0
  35. package/dist/chunks/PermissionDialog-BCS22yEO.js +1 -0
  36. package/dist/chunks/PermissionDialog-C5O1fL53.js +1 -0
  37. package/dist/chunks/PermissionRequestTitle-CtlbBU9t.js +1 -0
  38. package/dist/chunks/PluginSettings-OPrg-_3N.js +17 -0
  39. package/dist/chunks/PressEnterToContinue-DmzxIgbZ.js +1 -0
  40. package/dist/chunks/PromptInputFooterSuggestions-CcsKj5DK.js +1 -0
  41. package/dist/chunks/PromptInputHelpMenu-JedFdsxU.js +1 -0
  42. package/dist/chunks/REPL-ByhyIRnf.js +1 -0
  43. package/dist/chunks/REPL-Clve-8zC.js +157 -0
  44. package/dist/chunks/RemoteCallout-BZcabEKb.js +1 -0
  45. package/dist/chunks/RemoteSessionManager-C2PIFDHt.js +1 -0
  46. package/dist/chunks/ResumeConversation-D3ZRTFcF.js +1 -0
  47. package/dist/chunks/SSETransport-DmZWnH0k.js +4 -0
  48. package/dist/chunks/SearchBox-DQg2Ph0V.js +1 -0
  49. package/dist/chunks/SearchExtraToolsTool-CLO4nt6N.js +1 -0
  50. package/dist/chunks/SentryErrorBoundary-BVfBaOOU.js +2 -0
  51. package/dist/chunks/SentryErrorBoundary-DIaVFad-.js +1 -0
  52. package/dist/chunks/Settings-rOCxQdS8.js +2 -0
  53. package/dist/chunks/TeleportProgress-CP8IY6bz.js +1 -0
  54. package/dist/chunks/TeleportRepoMismatchDialog-DMmHgBqo.js +1 -0
  55. package/dist/chunks/TeleportResumeWrapper-D5wEAW1-.js +1 -0
  56. package/dist/chunks/ThemePicker-Bgr7yOQB.js +1 -0
  57. package/dist/chunks/TmuxBackend-BzbtUtP1.js +9 -0
  58. package/dist/chunks/TrustDialog-BI5U3BQ0.js +1 -0
  59. package/dist/chunks/TungstenTool-CiQclNwj.js +1 -0
  60. package/dist/chunks/TungstenTool-kMqy-ifa.js +1 -0
  61. package/dist/chunks/ValidationErrorsList-DprGtB2w.js +2 -0
  62. package/dist/chunks/WelcomeV2-C4vfBnIy.js +1 -0
  63. package/dist/chunks/WindowsTerminalBackend-BSoezOCE.js +2 -0
  64. package/dist/chunks/add-dir-DpOmv6kv.js +1 -0
  65. package/dist/chunks/agentDisplay-DuYEwOwO.js +1 -0
  66. package/dist/chunks/agents-BlurXZrF.js +2 -0
  67. package/dist/chunks/agents-DhZf7ftU.js +103 -0
  68. package/dist/chunks/ajv-CDrSAj3O.js +8 -0
  69. package/dist/chunks/analytics-i6X1et4O.js +1 -0
  70. package/dist/chunks/ant-D9hd_iYy.js +1 -0
  71. package/dist/chunks/api-CoaOHwDQ.js +4 -0
  72. package/dist/chunks/api-DvyGR-L7.js +1 -0
  73. package/dist/chunks/api-YHYC4Zdk.js +1 -0
  74. package/dist/chunks/artifacts-BMAYdaqh.js +1 -0
  75. package/dist/chunks/asciicast-DpHRoebc.js +1 -0
  76. package/dist/chunks/asciicast-HG1EoAQe.js +4 -0
  77. package/dist/chunks/assistant-D4-qcNT1.js +1 -0
  78. package/dist/chunks/assistant-DO2ZmZn1.js +1 -0
  79. package/dist/chunks/assistant-Dd86NmJM.js +1 -0
  80. package/dist/chunks/attributionHooks-BUmHrLhB.js +1 -0
  81. package/dist/chunks/attributionTrailer-r2Pbpu2N.js +1 -0
  82. package/dist/chunks/auth-CF3BGNYT.js +1 -0
  83. package/dist/chunks/auth-DwWwG43F.js +1 -0
  84. package/dist/chunks/auth-V_Xk2iea.js +1 -0
  85. package/dist/chunks/autoMode-DUksX5_i.js +45 -0
  86. package/dist/chunks/autoModeDenials-0CPO-Jbu.js +1 -0
  87. package/dist/chunks/autonomy-C5mNhAdz.js +21 -0
  88. package/dist/chunks/autonomy-CLt1dWaC.js +1 -0
  89. package/dist/chunks/autonomyPanel-rioFnrQO.js +1 -0
  90. package/dist/chunks/axios-DPuSPBlH.js +1 -0
  91. package/dist/chunks/axios-Zh7qGPze.js +12 -0
  92. package/dist/chunks/backgroundHousekeeping-BGtfqu-J.js +1 -0
  93. package/dist/chunks/backgroundHousekeeping-BqKZEvy0.js +17 -0
  94. package/dist/chunks/banner-BGLr3KYQ.js +2 -0
  95. package/dist/chunks/base64-js-B1tFNiG0.js +1 -0
  96. package/dist/chunks/bedrockClient-BFzWuhQK.js +15 -0
  97. package/dist/chunks/bg-B-YgGwLj.js +9 -0
  98. package/dist/chunks/bg-IU4gG3jc.js +1 -0
  99. package/dist/chunks/branch-BWY5W7hf.js +3 -0
  100. package/dist/chunks/break-cache-CY-O23fJ.js +8 -0
  101. package/dist/chunks/bridge-CqWd70vK.js +2 -0
  102. package/dist/chunks/bridgeConfig-CWO8AmCY.js +1 -0
  103. package/dist/chunks/bridgeConfig-D38y9eXn.js +1 -0
  104. package/dist/chunks/bridgeConfig-EwUq__ct.js +1 -0
  105. package/dist/chunks/bridgeConfig-GYR-LUiu.js +1 -0
  106. package/dist/chunks/bridgeEnabled-DKqmLnKO.js +1 -0
  107. package/dist/chunks/bridgeEnabled-DZIGDtfY.js +1 -0
  108. package/dist/chunks/bridgeMain-CXVks2ND.js +1 -0
  109. package/dist/chunks/bridgeMain-D4nsECwJ.js +68 -0
  110. package/dist/chunks/bridgeMessaging-BUOZU_ba.js +1 -0
  111. package/dist/chunks/bridgePointer-BpzIEsD_.js +1 -0
  112. package/dist/chunks/browser-D1vC3BNd.js +1 -0
  113. package/dist/chunks/btw-CVXJwoXo.js +1 -0
  114. package/dist/chunks/buddy-BLcvL8lP.js +3 -0
  115. package/dist/chunks/bundledMode-DQNSSQbt.js +1 -0
  116. package/dist/chunks/caches-BrfvzKn5.js +1 -0
  117. package/dist/chunks/caches-CkSv3MfC.js +3 -0
  118. package/dist/chunks/capacityWake-BWCSatN6.js +1 -0
  119. package/dist/chunks/changeDetector-DEZU6tum.js +1 -0
  120. package/dist/chunks/changeDetector-Df7c6U3d.js +1 -0
  121. package/dist/chunks/channelAllowlist-BApjAS0V.js +1 -0
  122. package/dist/chunks/channelNotification-BjWwF85R.js +1 -0
  123. package/dist/chunks/channelNotification-D01YVwNj.js +1 -0
  124. package/dist/chunks/chokidar-DPwMBcWI.js +1 -0
  125. package/dist/chunks/chokidar-DkDXNCTz.js +1 -0
  126. package/dist/chunks/chrome-D7coxEOI.js +1 -0
  127. package/dist/chunks/chromeNativeHost-CPj9M_4-.js +1 -0
  128. package/dist/chunks/chunk-DR8-3Aex.js +1 -0
  129. package/dist/chunks/classPrivateFieldSet2-DZkxcFPS.js +1 -0
  130. package/dist/chunks/claudeAiLimitsHook-ATshVrOH.js +1 -0
  131. package/dist/chunks/claudeDesktop-PVa9tWsM.js +1 -0
  132. package/dist/chunks/cleanup-C-PGmKpV.js +1 -0
  133. package/dist/chunks/clear-CxGE9Ntr.js +1 -0
  134. package/dist/chunks/cliLaunch-CMXoY_LO.js +1 -0
  135. package/dist/chunks/client-BWED8Tbu.js +35 -0
  136. package/dist/chunks/client-CinDjeSq.js +7 -0
  137. package/dist/chunks/client-CpXGg9e0.js +1 -0
  138. package/dist/chunks/color-B3w_VQTn.js +1 -0
  139. package/dist/chunks/color-convert-BQZnVz_5.js +1 -0
  140. package/dist/chunks/commands-DFp48zwy.js +1 -0
  141. package/dist/chunks/commitAttribution-B0cXmbvv.js +2 -0
  142. package/dist/chunks/commitAttribution-DRSKRoH6.js +1 -0
  143. package/dist/chunks/common-BX7bn3hg.js +1 -0
  144. package/dist/chunks/common-Ce3LanTX.js +1 -0
  145. package/dist/chunks/common-DdLQuE2_.js +1 -0
  146. package/dist/chunks/common-HfKcqOYK.js +1 -0
  147. package/dist/chunks/compact-C8ljGMdo.js +3 -0
  148. package/dist/chunks/companion-mD1jw6xX.js +1 -0
  149. package/dist/chunks/completionCache-BqQXVTa9.js +1 -0
  150. package/dist/chunks/completionCache-BtP4vfAi.js +4 -0
  151. package/dist/chunks/computerUseLock-ADE_PhIK.js +1 -0
  152. package/dist/chunks/config-CmyaIIOY.js +1 -0
  153. package/dist/chunks/config-Rl1Y_Dtq.js +1 -0
  154. package/dist/chunks/connectHeadless-MFABhXpz.js +1 -0
  155. package/dist/chunks/constants-BM62Vf_X.js +1 -0
  156. package/dist/chunks/constants-BfXy-5cI.js +1 -0
  157. package/dist/chunks/context-BeiZkUNq.js +1 -0
  158. package/dist/chunks/context-noninteractive-CRdF3iv8.js +54 -0
  159. package/dist/chunks/controlMessageCompat-591iGHUK.js +1 -0
  160. package/dist/chunks/conversation-BoguXZEI.js +1 -0
  161. package/dist/chunks/conversation-yhs7tT-g.js +1 -0
  162. package/dist/chunks/copy-BpeUcqku.js +7 -0
  163. package/dist/chunks/createSSHSession-B3JOB4TE.js +6 -0
  164. package/dist/chunks/createSession-BJSnFBGt.js +1 -0
  165. package/dist/chunks/createSession-CnRHI3RU.js +1 -0
  166. package/dist/chunks/cron-iqTFGIos.js +1 -0
  167. package/dist/chunks/cronScheduler-zRXhgEEU.js +6 -0
  168. package/dist/chunks/cronTasks-CMJldfoP.js +2 -0
  169. package/dist/chunks/crossProjectResume-DxO6TX30.js +40 -0
  170. package/dist/chunks/cwd-B2guYBbl.js +1 -0
  171. package/dist/chunks/cwd-B5bbyUwz.js +1 -0
  172. package/dist/chunks/cwd-BXiaJzLh.js +1 -0
  173. package/dist/chunks/daemon-B3v4OoOu.js +2 -0
  174. package/dist/chunks/dangerousBackend-OmCzoW35.js +1 -0
  175. package/dist/chunks/datadog-3-Vvz0yz.js +1 -0
  176. package/dist/chunks/datadog-BQlp3bTs.js +1 -0
  177. package/dist/chunks/debug-BDBIipC1.js +2 -0
  178. package/dist/chunks/debug-C7tW7DFW.js +1 -0
  179. package/dist/chunks/debug-CjIaNjpK.js +5 -0
  180. package/dist/chunks/debugUtils-Dsg-UHeg.js +1 -0
  181. package/dist/chunks/defineProperty-CaCI0a5T.js +1 -0
  182. package/dist/chunks/desktop-C_SS0068.js +1 -0
  183. package/dist/chunks/detached-B7RNZeyl.js +5 -0
  184. package/dist/chunks/detect-libc-DFFGDzPC.js +1 -0
  185. package/dist/chunks/detectRepository-BnTCJAXR.js +1 -0
  186. package/dist/chunks/detectRepository-Gobn9eFt.js +1 -0
  187. package/dist/chunks/detection-CN_uLGU2.js +1 -0
  188. package/dist/chunks/detection-DW6grIlc.js +1 -0
  189. package/dist/chunks/diff-B8YmRG5T.js +1 -0
  190. package/dist/chunks/directoryCompletion-J560aATd.js +1 -0
  191. package/dist/chunks/dist-B1wOprSs.js +29 -0
  192. package/dist/chunks/dist-DZQOarNX.js +5 -0
  193. package/dist/chunks/dist-HZfkKiUF.js +20 -0
  194. package/dist/chunks/dist-es-4xyrZoNc2.js +1 -0
  195. package/dist/chunks/dist-es-6kjvVbJd.js +1 -0
  196. package/dist/chunks/dist-es-BJldFHbt.js +3 -0
  197. package/dist/chunks/dist-es-BM013UFT.js +1 -0
  198. package/dist/chunks/dist-es-BPPewn1A.js +1 -0
  199. package/dist/chunks/dist-es-BZGG3Hnm.js +1 -0
  200. package/dist/chunks/dist-es-BZjJL64k2.js +1 -0
  201. package/dist/chunks/dist-es-BctcPxLN.js +1 -0
  202. package/dist/chunks/dist-es-Bf2jR30y.js +1 -0
  203. package/dist/chunks/dist-es-BgLoR-hQ.js +1 -0
  204. package/dist/chunks/dist-es-BismPcTW.js +1 -0
  205. package/dist/chunks/dist-es-BrPzXmSP.js +1 -0
  206. package/dist/chunks/dist-es-Bu21Wvhs.js +1 -0
  207. package/dist/chunks/dist-es-BuWNNAXW.js +1 -0
  208. package/dist/chunks/dist-es-Bz11sFiK2.js +1 -0
  209. package/dist/chunks/dist-es-C5VplyPL2.js +5 -0
  210. package/dist/chunks/dist-es-C66BuLgn.js +1 -0
  211. package/dist/chunks/dist-es-CCIzgNln2.js +1 -0
  212. package/dist/chunks/dist-es-CLyx7Kge2.js +1 -0
  213. package/dist/chunks/dist-es-CUbatGdn.js +1 -0
  214. package/dist/chunks/dist-es-CYe_-TbD.js +1 -0
  215. package/dist/chunks/dist-es-C_IHUdzL.js +1 -0
  216. package/dist/chunks/dist-es-Ci_rKlMr.js +1 -0
  217. package/dist/chunks/dist-es-ClDZBAj7.js +1 -0
  218. package/dist/chunks/dist-es-Cp--qjOi.js +1 -0
  219. package/dist/chunks/dist-es-CzE4kW1L.js +9 -0
  220. package/dist/chunks/dist-es-DUg5w7-v.js +1 -0
  221. package/dist/chunks/dist-es-Dl0ZRczY.js +1 -0
  222. package/dist/chunks/dist-es-Do_155z5.js +1 -0
  223. package/dist/chunks/dist-es-DxIM0jd82.js +1 -0
  224. package/dist/chunks/dist-es-Fav2oBDs.js +1 -0
  225. package/dist/chunks/dist-es-TZjwPaGn.js +1 -0
  226. package/dist/chunks/dist-es-W22ud2el2.js +1 -0
  227. package/dist/chunks/dist-es-aU8-02YH.js +1 -0
  228. package/dist/chunks/dist-es-b3yZSGx82.js +1 -0
  229. package/dist/chunks/dist-es-dIP5JtXz.js +5 -0
  230. package/dist/chunks/dist-es-mQ4HvnYs2.js +1 -0
  231. package/dist/chunks/distRoot-CJaacAHy.js +1 -0
  232. package/dist/chunks/doctor-DLZPF4iY.js +1 -0
  233. package/dist/chunks/earlyInput-BTI1CSNt.js +2 -0
  234. package/dist/chunks/earlyInput-BwGtzhhP.js +1 -0
  235. package/dist/chunks/effort-BaHvpBWr.js +9 -0
  236. package/dist/chunks/entry-_e-lyRwv.js +14 -0
  237. package/dist/chunks/env-CesrOJJq.js +1 -0
  238. package/dist/chunks/envLessBridgeConfig-4oys0_9A.js +1 -0
  239. package/dist/chunks/envLessBridgeConfig-DJ1Sts3F.js +1 -0
  240. package/dist/chunks/envUtils-CFG7IQID.js +1 -0
  241. package/dist/chunks/errorLogSink-Ti4Suoz6.js +2 -0
  242. package/dist/chunks/escHotkey-CVn_80xM.js +259 -0
  243. package/dist/chunks/esm-BFnjHW38.js +1 -0
  244. package/dist/chunks/esm-BQg_LX3V.js +1 -0
  245. package/dist/chunks/esm-BtC6CMmM.js +1 -0
  246. package/dist/chunks/esm-BwzC0MQp.js +1 -0
  247. package/dist/chunks/esm-CFybeQ_Q.js +1 -0
  248. package/dist/chunks/esm-CK-5CT5X.js +1 -0
  249. package/dist/chunks/esm-CL1OwlZB.js +1 -0
  250. package/dist/chunks/esm-CMzgSTAl.js +1 -0
  251. package/dist/chunks/esm-CPE_H2Lx.js +1 -0
  252. package/dist/chunks/esm-CcWquv5a.js +10 -0
  253. package/dist/chunks/esm-CeNEpRZt.js +1 -0
  254. package/dist/chunks/esm-D7hykoRB.js +1 -0
  255. package/dist/chunks/esm-DUtcefEV.js +1 -0
  256. package/dist/chunks/esm-DhrUwJBp.js +1 -0
  257. package/dist/chunks/esm-Duu1fRQ8.js +1 -0
  258. package/dist/chunks/esm-Ght2BaU2.js +1 -0
  259. package/dist/chunks/esm-Q6Yz2GMx.js +56 -0
  260. package/dist/chunks/esm-WONEiurY.js +13 -0
  261. package/dist/chunks/event-streams-BumpU1aB.js +1 -0
  262. package/dist/chunks/eventLoopStallDetector-DxyFdg1h.js +1 -0
  263. package/dist/chunks/execAsync-ChKxDZ8C.js +1 -0
  264. package/dist/chunks/execFileNoThrow-DdmR1mBS.js +1 -0
  265. package/dist/chunks/execSyncWrapper-Ch4TNj8u.js +1 -0
  266. package/dist/chunks/execa-BMaINL7N.js +34 -0
  267. package/dist/chunks/executor-C7INr19-.js +1 -0
  268. package/dist/chunks/executor-Dnf3YYma.js +1604 -0
  269. package/dist/chunks/exit-BakzsOD0.js +1 -0
  270. package/dist/chunks/exit-CiDn2tN9.js +2 -0
  271. package/dist/chunks/export-b-6pqMqz.js +2 -0
  272. package/dist/chunks/exportRenderer-RxtEIyTm.js +1 -0
  273. package/dist/chunks/extra-usage-7EPJNjNW.js +1 -0
  274. package/dist/chunks/extra-usage-ChvuewCq.js +1 -0
  275. package/dist/chunks/extra-usage-core-BVhLtoDF.js +1 -0
  276. package/dist/chunks/extra-usage-noninteractive-_Njh6q-q.js +1 -0
  277. package/dist/chunks/extraUsage-qOBMQB6g.js +1 -0
  278. package/dist/chunks/extractMemories-CRBVNiG1.js +1 -0
  279. package/dist/chunks/fast-C4uw_g7o.js +1 -0
  280. package/dist/chunks/fast-CEaIzaPl.js +1 -0
  281. package/dist/chunks/featureCheck-B1GSTyhh.js +1 -0
  282. package/dist/chunks/featureCheck-DKigAPal.js +1 -0
  283. package/dist/chunks/feedback-Bf3TjjuD.js +1 -0
  284. package/dist/chunks/figures-fES5sASd.js +1 -0
  285. package/dist/chunks/fileStateCache-DAsLEZau.js +1 -0
  286. package/dist/chunks/files-B-m_4X8b.js +2 -0
  287. package/dist/chunks/findExecutable-D8vJrFnO.js +1 -0
  288. package/dist/chunks/firstPartyEventLogger-BtrGagNa.js +1 -0
  289. package/dist/chunks/flushGate-2zqab-Pp.js +1 -0
  290. package/dist/chunks/foundry-sdk-CtX8C0x3.js +1 -0
  291. package/dist/chunks/fpsMetrics-ts_jaF3g.js +1 -0
  292. package/dist/chunks/fuse-ivQ_eRwF.js +1 -0
  293. package/dist/chunks/gates-CmKoQ0O-.js +1 -0
  294. package/dist/chunks/gates-_wbPDQ3M.js +1 -0
  295. package/dist/chunks/gemini-DRx495gn.js +3 -0
  296. package/dist/chunks/generateRecap-Cv8gd_QF.js +1 -0
  297. package/dist/chunks/generateSessionName-Dpjg-u_x.js +1 -0
  298. package/dist/chunks/genericProcessUtils-BFJMxLqn.js +23 -0
  299. package/dist/chunks/getMachineId-bsd-C9pL9Ajr.js +1 -0
  300. package/dist/chunks/getMachineId-darwin-Ma4F9rJg.js +2 -0
  301. package/dist/chunks/getMachineId-linux-C0lXMqsj.js +1 -0
  302. package/dist/chunks/getMachineId-unsupported-ByHQTXat.js +1 -0
  303. package/dist/chunks/getMachineId-win-DZsXZmTz.js +1 -0
  304. package/dist/chunks/git-Bj8Ow4pJ.js +6 -0
  305. package/dist/chunks/git-Q_b4oZ17.js +1 -0
  306. package/dist/chunks/githubRepoPathMapping-DGivBX9h.js +1 -0
  307. package/dist/chunks/goal-BrHEJv8o.js +3 -0
  308. package/dist/chunks/goalStorage-CsuPOQbk.js +1 -0
  309. package/dist/chunks/graceful-fs-BuPWC-vB.js +2 -0
  310. package/dist/chunks/grok-CDkDDaY_.js +1 -0
  311. package/dist/chunks/growthbook-D3_Cr9n-.js +1 -0
  312. package/dist/chunks/growthbook-p4aJ_UMv.js +32 -0
  313. package/dist/chunks/hash-KW-tVnPp.js +1 -0
  314. package/dist/chunks/heapdump-CloylIZ9.js +5 -0
  315. package/dist/chunks/help-DpSJlHIc.js +1 -0
  316. package/dist/chunks/hooks-2pogt8nv.js +79 -0
  317. package/dist/chunks/hooks-BBODdwnE.js +1 -0
  318. package/dist/chunks/hostAdapter-B5KTUqhv.js +1 -0
  319. package/dist/chunks/hostGuard-DyWr2TwE.js +1 -0
  320. package/dist/chunks/httpAuthSchemes-CgPbtGos.js +13 -0
  321. package/dist/chunks/ide-CJEcfBZq.js +2 -0
  322. package/dist/chunks/inboundAttachments-RNpYpRTO.js +1 -0
  323. package/dist/chunks/index.min-DCDiLq-j.js +1 -0
  324. package/dist/chunks/initReplBridge-D2E6IM2B.js +1 -0
  325. package/dist/chunks/initReplBridge-p2uwDBPx.js +1 -0
  326. package/dist/chunks/insights-DnpZScKs.js +822 -0
  327. package/dist/chunks/install-D_vTxUlG.js +1 -0
  328. package/dist/chunks/install-github-app-BK8A7g3i.js +147 -0
  329. package/dist/chunks/install-slack-app-C47R9VoI.js +1 -0
  330. package/dist/chunks/instinctParser-DxKdI3JC.js +1 -0
  331. package/dist/chunks/instrumentation-DkdAJFrZ.js +12 -0
  332. package/dist/chunks/intl-Pse97ORk.js +1 -0
  333. package/dist/chunks/isObject-DaxDnPKm.js +1 -0
  334. package/dist/chunks/isSymbol-D7QeUnS5.js +1 -0
  335. package/dist/chunks/job-opl00C4l.js +2 -0
  336. package/dist/chunks/json-bigint-BRRVs1dv.js +8 -0
  337. package/dist/chunks/jsx-runtime-BTgGEFjL.js +1 -0
  338. package/dist/chunks/jws-B_ieuaZg.js +3 -0
  339. package/dist/chunks/jwtUtils-D-tJzoJY.js +1 -0
  340. package/dist/chunks/keybindings-mRf9VSe8.js +2 -0
  341. package/dist/chunks/lang-eH4EJErj.js +1 -0
  342. package/dist/chunks/language-DD9ar6RA.js +1 -0
  343. package/dist/chunks/language-EZLNdETg.js +1 -0
  344. package/dist/chunks/launchAgentsPlatform-Cq0_7-IM.js +1 -0
  345. package/dist/chunks/launchAutofixPr-Bw7aUHUs.js +18 -0
  346. package/dist/chunks/launchCommand-Bk1Fn-qZ.js +1 -0
  347. package/dist/chunks/launchLocalMemory-CLBCUgwd.js +3 -0
  348. package/dist/chunks/launchLocalVault-BfWJWrBg.js +3 -0
  349. package/dist/chunks/launchMemoryStores-DdnSVSDZ.js +1 -0
  350. package/dist/chunks/launchOnboarding-ziCEX3GI.js +8 -0
  351. package/dist/chunks/launchSchedule-G_c7sgmy.js +1 -0
  352. package/dist/chunks/launchSkillStore-Z1Kd7nCg.js +1 -0
  353. package/dist/chunks/launchTeleport-Dp9AFbPx.js +3 -0
  354. package/dist/chunks/launchVault-hwK-Ljek.js +1 -0
  355. package/dist/chunks/lazySchema-2sOku3cX.js +1 -0
  356. package/dist/chunks/lib-BHRYgENJ.js +8 -0
  357. package/dist/chunks/lib-DRyNc7xD.js +2 -0
  358. package/dist/chunks/lib-Ddq71jM5.js +14 -0
  359. package/dist/chunks/loadAgentsDir-Bz0FfcVt.js +5620 -0
  360. package/dist/chunks/loadAgentsDir-CLM0ws7u.js +1 -0
  361. package/dist/chunks/loadPluginHooks-B5SIS2uo.js +1 -0
  362. package/dist/chunks/loadSso-RY87rrJO.js +1 -0
  363. package/dist/chunks/localSearch-BLF6PSv2.js +1 -0
  364. package/dist/chunks/localSearch-CTycGe3E.js +1 -0
  365. package/dist/chunks/localSearch-inDahM8I.js +1 -0
  366. package/dist/chunks/lockfile--gk1HDM6.js +1 -0
  367. package/dist/chunks/log-B-Nj3Yed.js +1 -0
  368. package/dist/chunks/log-DVv8YiNo.js +1 -0
  369. package/dist/chunks/login-BeLvLowc.js +1 -0
  370. package/dist/chunks/login-DUUOeNoz.js +1 -0
  371. package/dist/chunks/logoV2Utils-D5SpeZ3C.js +1 -0
  372. package/dist/chunks/logout-C2QuTBdS.js +1 -0
  373. package/dist/chunks/magicDocs-CUXKi-Wv.js +57 -0
  374. package/dist/chunks/main-CFhpWtpC.js +1420 -0
  375. package/dist/chunks/main-sboa5RKc.js +31 -0
  376. package/dist/chunks/mappers-DLkk0PZz.js +1 -0
  377. package/dist/chunks/mcp-C2f6IgAp.js +2 -0
  378. package/dist/chunks/mcp-Djui9m3_.js +6 -0
  379. package/dist/chunks/mcp-DvTSxrJ4.js +1 -0
  380. package/dist/chunks/mcpServer-DMA0bdFC.js +1 -0
  381. package/dist/chunks/mcpServer-DxEHfW2v.js +1 -0
  382. package/dist/chunks/memoize-Bg2dXTzV.js +1 -0
  383. package/dist/chunks/memoize-DNnuA2aU.js +1 -0
  384. package/dist/chunks/memory-B9io9Zcv.js +1 -0
  385. package/dist/chunks/mobile-CPnnvkQV.js +2 -0
  386. package/dist/chunks/modalContext-B1b0Gsro.js +1 -0
  387. package/dist/chunks/mode-BDgwh_Xb.js +2 -0
  388. package/dist/chunks/model-B6cpEh-s.js +1 -0
  389. package/dist/chunks/model-BcunOCC9.js +1 -0
  390. package/dist/chunks/modelOptions-CHUHQ9WG.js +1 -0
  391. package/dist/chunks/normalization-cjPqid31.js +1 -0
  392. package/dist/chunks/oauth-CnBLewrU.js +1 -0
  393. package/dist/chunks/oauth-DMPGYAoZ.js +1 -0
  394. package/dist/chunks/observationStore-DVBxrSdI.js +4 -0
  395. package/dist/chunks/onChangeAppState-M61XDN6V.js +1 -0
  396. package/dist/chunks/open-CsUNPSNx.js +1 -0
  397. package/dist/chunks/openai-BHvlYW3m.js +2 -0
  398. package/dist/chunks/output-style-BtKuBrs4.js +1 -0
  399. package/dist/chunks/outputStyles-hHuIBkRB.js +84 -0
  400. package/dist/chunks/overageCreditGrant-BLFT-rF3.js +1 -0
  401. package/dist/chunks/p-map-C-WNcN6g.js +1 -0
  402. package/dist/chunks/p-map-CQ2NythB.js +1 -0
  403. package/dist/chunks/package-9IAs5Qf0.js +1 -0
  404. package/dist/chunks/panel-27xLZI7c.js +1 -0
  405. package/dist/chunks/panel-NoDfShEZ.js +1 -0
  406. package/dist/chunks/panelCall-CEOWVNCM.js +1 -0
  407. package/dist/chunks/parseConnectUrl-CxU4IX9o.js +1 -0
  408. package/dist/chunks/parser-DGlAnaNj.js +1 -0
  409. package/dist/chunks/parser-DGoLe2RS.js +1 -0
  410. package/dist/chunks/passes-CExcqu66.js +1 -0
  411. package/dist/chunks/path-uaxlnhva.js +1 -0
  412. package/dist/chunks/permissions-B3PceQul.js +1 -0
  413. package/dist/chunks/permissions-DezIL2xF.js +3 -0
  414. package/dist/chunks/permissions-DnpI8Whh.js +1 -0
  415. package/dist/chunks/pipeTransport-CB_Wq_Kx.js +1 -0
  416. package/dist/chunks/plan-cfZBclh9.js +1 -0
  417. package/dist/chunks/platform-BXz_rgpy.js +2 -0
  418. package/dist/chunks/plist-DLGDWBD6.js +6 -0
  419. package/dist/chunks/plugin-CuhENLRs.js +1 -0
  420. package/dist/chunks/pluginAutoupdate-wTeOXfQe.js +1 -0
  421. package/dist/chunks/pluginBlocklist-D6pkKfXr.js +1 -0
  422. package/dist/chunks/pluginCliCommands-DqxdCwsq.js +1 -0
  423. package/dist/chunks/pluginFlagging-CjH48f-K.js +1 -0
  424. package/dist/chunks/pluginOperations-DMFYB3pK.js +2 -0
  425. package/dist/chunks/pluginStartupCheck-BW3_KfZz.js +1 -0
  426. package/dist/chunks/pluginStartupCheck-Cj2BMjVw.js +1 -0
  427. package/dist/chunks/plugins-CarsG2v8.js +4 -0
  428. package/dist/chunks/policyLimits-DFn1vHkN.js +1 -0
  429. package/dist/chunks/pollConfig-C8nODJY1.js +1 -0
  430. package/dist/chunks/poller-DXZJ-dUP.js +1 -0
  431. package/dist/chunks/poor-C7GQ4a5X.js +1 -0
  432. package/dist/chunks/poorMode-CBe0rfxB.js +1 -0
  433. package/dist/chunks/poorMode-CbZTudtw.js +1 -0
  434. package/dist/chunks/postCommitAttribution--vvAWIqD.js +1 -0
  435. package/dist/chunks/print-CwwtGSbK.js +114 -0
  436. package/dist/chunks/privacy-settings-Bz8cAVp5.js +11 -0
  437. package/dist/chunks/privacyLevel-CRCHhztk.js +1 -0
  438. package/dist/chunks/process-CnhUplBr.js +1 -0
  439. package/dist/chunks/process-X4vCP9x0.js +1 -0
  440. package/dist/chunks/processBashCommand-NL0YEUqW.js +3 -0
  441. package/dist/chunks/processSlashCommand-FPMWElsI.js +6 -0
  442. package/dist/chunks/processSlashCommand-_oJs6_w8.js +6 -0
  443. package/dist/chunks/processUserInput-QAJK0XSn.js +1 -0
  444. package/dist/chunks/projectContext-B21hXj9q.js +1 -0
  445. package/dist/chunks/projectContext-DbTQHQS3.js +1 -0
  446. package/dist/chunks/prompt-C6eleu4x.js +1 -0
  447. package/dist/chunks/prompt-CUdoQXyN.js +1 -0
  448. package/dist/chunks/prompt-CsBCtw4l.js +228 -0
  449. package/dist/chunks/prompt-hnIDYhP4.js +54 -0
  450. package/dist/chunks/promptEditor-CrlVcc17.js +4 -0
  451. package/dist/chunks/protectedNamespace-Cn4901XG.js +1 -0
  452. package/dist/chunks/protocolHandler-DM_w7sJ5.js +13 -0
  453. package/dist/chunks/protocols-CpoQzjyI.js +7 -0
  454. package/dist/chunks/proxy-9WvtUy8E.js +99 -0
  455. package/dist/chunks/rate-limit-options-BehQ3MoX.js +1 -0
  456. package/dist/chunks/rcDebugLog-BbHlIxCm.js +11 -0
  457. package/dist/chunks/referral-BfAZEIZL.js +1 -0
  458. package/dist/chunks/refresh-Bl3Miver.js +1 -0
  459. package/dist/chunks/registerProtocol-BHZ3vZED.js +36 -0
  460. package/dist/chunks/registerSkillHooks-BR7v5qDA.js +1 -0
  461. package/dist/chunks/registry-C2igpRd-.js +1 -0
  462. package/dist/chunks/release-notes-C_Cou6ye.js +4 -0
  463. package/dist/chunks/releaseNotes-DveQShyB.js +2 -0
  464. package/dist/chunks/reload-plugins-D-pAUoB5.js +1 -0
  465. package/dist/chunks/remote-env-C_dBgbgo.js +1 -0
  466. package/dist/chunks/remoteBridgeCore-BxWhTy1u.js +1 -0
  467. package/dist/chunks/remoteControlServer-D3OjUlB-.js +3 -0
  468. package/dist/chunks/rename-f3m0ETSt.js +1 -0
  469. package/dist/chunks/renderOptions-QZLxGnh_.js +1 -0
  470. package/dist/chunks/replBridge-qeVmCJOb.js +1 -0
  471. package/dist/chunks/resume-CM_8p9Iu.js +2 -0
  472. package/dist/chunks/rewind-0cB7o6fx.js +1 -0
  473. package/dist/chunks/ripgrep-BEWqxrpl.js +5 -0
  474. package/dist/chunks/ripgrep-G82m12Ng.js +1 -0
  475. package/dist/chunks/rollback-CVo2gqgR.js +11 -0
  476. package/dist/chunks/runtimeObserver-1EdvvoYw.js +1 -0
  477. package/dist/chunks/runtimeObserver-CX6vepq9.js +10 -0
  478. package/dist/chunks/sandbox-adapter-DzHfW2tH.js +1 -0
  479. package/dist/chunks/sandbox-toggle-N6KgmH2T.js +1 -0
  480. package/dist/chunks/sanitization-CIBpY9KT.js +1 -0
  481. package/dist/chunks/satisfies-B7ZvBUQP.js +1 -0
  482. package/dist/chunks/schemas-Bwt-7U5W.js +40 -0
  483. package/dist/chunks/sdk-Drp69kIx.js +1 -0
  484. package/dist/chunks/sdkHeapDumpMonitor-B9GVkISU.js +1 -0
  485. package/dist/chunks/searchExtraTools-BphNJsl8.js +1 -0
  486. package/dist/chunks/semver-BsItM2Z4.js +1 -0
  487. package/dist/chunks/semver-D3lOjiBN.js +1 -0
  488. package/dist/chunks/sentry-ySzRCXGd.js +1 -0
  489. package/dist/chunks/server-C8nMDji6.js +1 -0
  490. package/dist/chunks/server-XZG51Slr.js +1 -0
  491. package/dist/chunks/serverBanner-D68EBGzH.js +1 -0
  492. package/dist/chunks/serverLog-hv2hc5US.js +1 -0
  493. package/dist/chunks/session-CVoGFb8a.js +2 -0
  494. package/dist/chunks/sessionDataUploader-BaD1Q7v3.js +1 -0
  495. package/dist/chunks/sessionDiscovery-D7g66TX6.js +1 -0
  496. package/dist/chunks/sessionFileAccessHooks-9lPjspRX.js +1 -0
  497. package/dist/chunks/sessionManager-BhOjMNAP.js +1 -0
  498. package/dist/chunks/sessionMemory-BA6cdxqP.js +1 -0
  499. package/dist/chunks/sessionMemory-CtEhIRGF.js +1 -0
  500. package/dist/chunks/sessionMemoryUtils-D_B92ypa.js +1 -0
  501. package/dist/chunks/sessionObserver-CESI-uVZ.js +1 -0
  502. package/dist/chunks/sessionObserver-SpE_eglb.js +20 -0
  503. package/dist/chunks/sessionRestore-DqsqYK4K.js +1 -0
  504. package/dist/chunks/sessionState-Dgky34M4.js +1 -0
  505. package/dist/chunks/sessionStorage-DJb5HKhQ.js +1 -0
  506. package/dist/chunks/sessionStorage-DSMfHTcg.js +1 -0
  507. package/dist/chunks/sessionStoragePortable-DyM_hZnp.js +3 -0
  508. package/dist/chunks/sessionTitle-Bzxk_EW9.js +14 -0
  509. package/dist/chunks/sessionTracing-DR8O0686.js +12 -0
  510. package/dist/chunks/setup-BHNS9sBS.js +9 -0
  511. package/dist/chunks/setup-BafJxZ0F.js +4 -0
  512. package/dist/chunks/setup-MLNNYLi6.js +1 -0
  513. package/dist/chunks/shadowedRuleDetection-Ch9gTxfD.js +1 -0
  514. package/dist/chunks/shellQuote-3s6tV-hK.js +1 -0
  515. package/dist/chunks/sideQuestion-BBn6XIOD.js +20 -0
  516. package/dist/chunks/signal-BTxmab6r.js +1 -0
  517. package/dist/chunks/signin-ChbUAEGq.js +1 -0
  518. package/dist/chunks/sink-B1qICbRh.js +1 -0
  519. package/dist/chunks/sink-yBIcxQf1.js +1 -0
  520. package/dist/chunks/sinks-C7weduDR.js +1 -0
  521. package/dist/chunks/skill-learning-08nEdOJ2.js +5 -0
  522. package/dist/chunks/skillGapStore-CuvWGqFb.js +5 -0
  523. package/dist/chunks/skillGapStore-DmMuDXKO.js +1 -0
  524. package/dist/chunks/skillGenerator-mEMjcmmm.js +8 -0
  525. package/dist/chunks/skillLearning-B3a-8Ys3.js +1 -0
  526. package/dist/chunks/skillLearning-q5T6o0mH.js +1 -0
  527. package/dist/chunks/skillPanel-BuUMhONI.js +28 -0
  528. package/dist/chunks/skillSearchPanel-BUEv7Sm9.js +21 -0
  529. package/dist/chunks/skillUsageTracking-BBTiWOKB.js +1 -0
  530. package/dist/chunks/skills-DvQuQfDW.js +1 -0
  531. package/dist/chunks/slashCommandParsing-BkTC3GRb.js +1 -0
  532. package/dist/chunks/sleep-CC8jykQd.js +1 -0
  533. package/dist/chunks/slowOperations-niPqC54V.js +1 -0
  534. package/dist/chunks/sprites-C5X62Vyh.js +1 -0
  535. package/dist/chunks/src-58uAJYF_.js +6 -0
  536. package/dist/chunks/src-7Y8fx6gl.js +2 -0
  537. package/dist/chunks/src-BuserDTl.js +1 -0
  538. package/dist/chunks/src-CMY4XoRy.js +1 -0
  539. package/dist/chunks/src-CfeAM1FB.js +1 -0
  540. package/dist/chunks/src-CxT2FDXy.js +1 -0
  541. package/dist/chunks/src-CyQf7rVu.js +26 -0
  542. package/dist/chunks/src-DJLbU8sT.js +1 -0
  543. package/dist/chunks/src-DJQlyVK6.js +5 -0
  544. package/dist/chunks/src-DNHWYkls.js +53 -0
  545. package/dist/chunks/src-DU_g0n_Q.js +1 -0
  546. package/dist/chunks/src-DhqzQjMg.js +19 -0
  547. package/dist/chunks/src-Duzv1Znh.js +1 -0
  548. package/dist/chunks/src-OBx6GAig.js +1 -0
  549. package/dist/chunks/src-WjnK2Dbo.js +1 -0
  550. package/dist/chunks/src-hjAMxWFj.js +7 -0
  551. package/dist/chunks/src-lLwoqdC0.js +9 -0
  552. package/dist/chunks/src-yRsWbJp_.js +2 -0
  553. package/dist/chunks/sso-oidc-yfC-A2A2.js +1 -0
  554. package/dist/chunks/startupProfiler-4P7GdVw6.js +3 -0
  555. package/dist/chunks/startupProfiler-CipS0otN.js +1 -0
  556. package/dist/chunks/state-9wSimHaL.js +1 -0
  557. package/dist/chunks/state-BQkyHx88.js +1 -0
  558. package/dist/chunks/state-CEAUTY3A.js +1 -0
  559. package/dist/chunks/state-CUZTq6r0.js +1 -0
  560. package/dist/chunks/state-U0HNbTx8.js +1 -0
  561. package/dist/chunks/staticRender-BB3CisKd.js +1 -0
  562. package/dist/chunks/stats-Dyi2U_mq.js +1 -0
  563. package/dist/chunks/status-CSL-GMou.js +1 -0
  564. package/dist/chunks/statusNoticeHelpers-BaXE951d.js +1 -0
  565. package/dist/chunks/stdio-BuUJYJFs.js +3 -0
  566. package/dist/chunks/stdio-iX0TTmbp.js +1 -0
  567. package/dist/chunks/stickers-2CRSckfH.js +1 -0
  568. package/dist/chunks/store-DdfsZvtr.js +1 -0
  569. package/dist/chunks/stringUtils-U7kMYMJq.js +4 -0
  570. package/dist/chunks/sts-CJmdeT7s.js +1 -0
  571. package/dist/chunks/subprocessEnv-DKTILev5.js +1 -0
  572. package/dist/chunks/subprocessEnv-WjRguKWf.js +1 -0
  573. package/dist/chunks/supports-color-DaytqqjM.js +1 -0
  574. package/dist/chunks/systemPromptSections-BnrxBWdc.js +1 -0
  575. package/dist/chunks/systemPromptSections-Dk6azdAb.js +1 -0
  576. package/dist/chunks/systemTheme-C1GNqIfy.js +1 -0
  577. package/dist/chunks/tag-C4cH016L.js +11 -0
  578. package/dist/chunks/tasks-CEdUW3RQ.js +1 -0
  579. package/dist/chunks/teamHelpers-CTA_CtTT.js +1 -0
  580. package/dist/chunks/teamHelpers-D65qZInv.js +1 -0
  581. package/dist/chunks/teammate-C-FiRloZ.js +1 -0
  582. package/dist/chunks/teammateModeSnapshot-DWRG5-Us.js +1 -0
  583. package/dist/chunks/teammateModeSnapshot-DtgsNj1G.js +1 -0
  584. package/dist/chunks/teleport-C_UgMy0V.js +1 -0
  585. package/dist/chunks/templateJobs-CMbS0tuk.js +12 -0
  586. package/dist/chunks/terminalSetup--jwGVap8.js +33 -0
  587. package/dist/chunks/terminalSetup-zID-wokH.js +1 -0
  588. package/dist/chunks/theme-C6XwTpVy.js +1 -0
  589. package/dist/chunks/thinkback-CVLnmLAT.js +1 -0
  590. package/dist/chunks/thinkback-MeOOO7gf.js +1 -0
  591. package/dist/chunks/thinkback-play-D7G260F4.js +1 -0
  592. package/dist/chunks/tmux-DtYJuTWh.js +1 -0
  593. package/dist/chunks/toolEventObserver-BtC9xDYY.js +1 -0
  594. package/dist/chunks/toolEventObserver-MfsHAt8h.js +1 -0
  595. package/dist/chunks/toolPool-CEi_2xIH.js +1 -0
  596. package/dist/chunks/toolPool-CdYJcCnc.js +1 -0
  597. package/dist/chunks/trustedDevice-CjQTGAa4.js +1 -0
  598. package/dist/chunks/trustedDevice-DADcxAAs.js +1 -0
  599. package/dist/chunks/tui-B8Ijq4Pk.js +6 -0
  600. package/dist/chunks/turndown.es-T-Xe93nc.js +69 -0
  601. package/dist/chunks/types-BVelRhgb.js +17 -0
  602. package/dist/chunks/types-Bqp3meR4.js +1 -0
  603. package/dist/chunks/types-CNmINIu3.js +1 -0
  604. package/dist/chunks/types-DgzOOCDl.js +3 -0
  605. package/dist/chunks/udsClient-ClY_0CKr.js +1 -0
  606. package/dist/chunks/ultrareviewCommand-CqvHj9Io.js +3 -0
  607. package/dist/chunks/undercover-CVCVOSrs.js +1 -0
  608. package/dist/chunks/undercover-CbxiJO2b.js +31 -0
  609. package/dist/chunks/up-CBJhVVbd.js +12 -0
  610. package/dist/chunks/updateCCB-DPPpquAw.js +11 -0
  611. package/dist/chunks/upgrade-DaaHOvft.js +1 -0
  612. package/dist/chunks/upgrade-k7ZvAWZ0.js +1 -0
  613. package/dist/chunks/upload-CEDxwMa1.js +1 -0
  614. package/dist/chunks/upstreamproxy-BtGJ2LRi.js +11 -0
  615. package/dist/chunks/usage-CsUSu4fb.js +1 -0
  616. package/dist/chunks/usage-oABvixCs.js +1 -0
  617. package/dist/chunks/useExitOnCtrlCDWithKeybindings-CBce_-hb.js +1 -0
  618. package/dist/chunks/useExitOnCtrlCDWithKeybindings-CLYjTZXb.js +1 -0
  619. package/dist/chunks/useKeybinding-DAQL_dB_.js +1 -0
  620. package/dist/chunks/useMainLoopModel-QC_H3esG.js +1 -0
  621. package/dist/chunks/useManageMCPConnections-bf-VfJGD.js +1 -0
  622. package/dist/chunks/useManagePlugins-CXdYUpit.js +1 -0
  623. package/dist/chunks/useMergedTools-DERzhQOJ.js +1 -0
  624. package/dist/chunks/useSearchInput-nqhdILI2.js +1 -0
  625. package/dist/chunks/useTerminalSize-DzV4aaTi.js +1 -0
  626. package/dist/chunks/useVoice-CO69xtWC.js +1 -0
  627. package/dist/chunks/util-C8wqPqv0.js +1 -0
  628. package/dist/chunks/utils-CDFsSXHr.js +1 -0
  629. package/dist/chunks/utils-ZO5TryVH.js +1 -0
  630. package/dist/chunks/v4-DLhvDPkt.js +1 -0
  631. package/dist/chunks/validatePlugin-C4cd71Yz.js +1 -0
  632. package/dist/chunks/vertex-sdk-CC3U26o7.js +9 -0
  633. package/dist/chunks/vim-BNiQx5Vf.js +1 -0
  634. package/dist/chunks/voice-BCbnJzYL.js +8 -0
  635. package/dist/chunks/voice-BJyz9KZO.js +8 -0
  636. package/dist/chunks/voice-CP2ULpju.js +2 -0
  637. package/dist/chunks/voiceModeEnabled-C-pa8B3Q.js +1 -0
  638. package/dist/chunks/voiceModeEnabled-CMtRN2pa.js +1 -0
  639. package/dist/chunks/voiceStreamSTT-31b2u0rj.js +1 -0
  640. package/dist/chunks/voiceStreamSTT-Fkhm6Ftg.js +1 -0
  641. package/dist/chunks/voiceStreamSTT-sI-hg-aP.js +1 -0
  642. package/dist/chunks/web-tools-CLmlPgLk.js +1 -0
  643. package/dist/chunks/which-C0ex-06E.js +1 -0
  644. package/dist/chunks/windowsPaths-C5TNvKYu.js +1 -0
  645. package/dist/chunks/windowsPaths-Kue_7s52.js +1 -0
  646. package/dist/chunks/workSecret-Dh5Ayceu.js +1 -0
  647. package/dist/chunks/workerRegistry-B5iWYqpK.js +1 -0
  648. package/dist/chunks/worktree-BypJA0GB.js +1 -0
  649. package/dist/chunks/worktreeModeEnabled-DPTdK3JV.js +1 -0
  650. package/dist/chunks/worktreeModeEnabled-Dtrcn7eD.js +1 -0
  651. package/dist/chunks/wrapper-BDPb4PTV.js +6 -0
  652. package/dist/chunks/wrapper-DRTs77RK.js +1 -0
  653. package/dist/chunks/xdg-BaVL-FHd.js +1 -0
  654. package/dist/chunks/xml-E8VMPwdJ.js +1 -0
  655. package/dist/chunks/zod-B_P2Eo_D.js +1 -0
  656. package/dist/cli-bun.js +2 -0
  657. package/dist/cli-node.js +2 -0
  658. package/dist/cli.js +2 -0
  659. package/dist/vendor/audio-capture/arm64-darwin/audio-capture.node +0 -0
  660. package/dist/vendor/audio-capture/arm64-linux/audio-capture.node +0 -0
  661. package/dist/vendor/audio-capture/arm64-win32/audio-capture.node +0 -0
  662. package/dist/vendor/audio-capture/x64-darwin/audio-capture.node +0 -0
  663. package/dist/vendor/audio-capture/x64-linux/audio-capture.node +0 -0
  664. package/dist/vendor/audio-capture/x64-win32/audio-capture.node +0 -0
  665. package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
  666. package/package.json +233 -0
  667. package/scripts/postinstall.cjs +389 -0
  668. package/scripts/run-parallel.mjs +10 -0
  669. package/scripts/setup-chrome-mcp.mjs +70 -0
@@ -0,0 +1,1604 @@
1
+ import{a as e,n as t,r as n}from"./chunk-DR8-3Aex.js";import{U as r,l as i,p as a,z as o}from"./debug-CjIaNjpK.js";import{r as s,t as c}from"./execFileNoThrow-DdmR1mBS.js";import{n as l,t as u}from"./sleep-CC8jykQd.js";import{a as ee,n as te,o as ne,t as re}from"./common-HfKcqOYK.js";import{a as ie,o as ae,t as oe}from"./src-hjAMxWFj.js";import{a as d,c as f,n as se,o as ce,s as le,t as ue}from"./escHotkey-CVn_80xM.js";import*as de from"path";import{extname as fe}from"path";import*as p from"fs";import{promisify as pe}from"util";import{execFile as me,execFileSync as he}from"child_process";var ge=n({getFrontmostAppInfo:()=>ke,key:()=>Ce,keys:()=>we,mouseButton:()=>Ee,mouseLocation:()=>Te,mouseScroll:()=>De,moveMouse:()=>Se,typeText:()=>Oe});async function _e(e){let{stdout:t}=await ye(`osascript`,[`-e`,e],{encoding:`utf-8`});return t.trim()}async function m(e){let{stdout:t}=await ye(`osascript`,[`-l`,`JavaScript`,`-e`,e],{encoding:`utf-8`});return t.trim()}function ve(e,t,n,r,i){let a=`ObjC.import("CoreGraphics"); var p = $.CGPointMake(${t},${n}); var e = $.CGEventCreateMouseEvent(null, $.${e}, p, ${r});`;return i!==void 0&&(a+=` $.CGEventSetIntegerValueField(e, $.kCGMouseEventClickState, ${i});`),a+=` $.CGEventPost($.kCGHIDEventTap, e);`,a}var ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae=t((()=>{ye=pe(me),be={return:36,enter:36,tab:48,space:49,delete:51,backspace:51,escape:53,esc:53,left:123,right:124,down:125,up:126,f1:122,f2:120,f3:99,f4:118,f5:96,f6:97,f7:98,f8:100,f9:101,f10:109,f11:103,f12:111,home:115,end:119,pageup:116,pagedown:121},xe={command:`command down`,cmd:`command down`,meta:`command down`,super:`command down`,shift:`shift down`,option:`option down`,alt:`option down`,control:`control down`,ctrl:`control down`},Se=async(e,t,n)=>{await m(ve(`kCGEventMouseMoved`,e,t,0))},Ce=async(e,t)=>{if(t===`release`)return;let n=e.toLowerCase(),r=be[n];r===void 0?await _e(`tell application "System Events" to keystroke "${e.length===1?e:n}"`):await _e(`tell application "System Events" to key code ${r}`)},we=async e=>{let t=[],n=null;for(let r of e){let e=xe[r.toLowerCase()];e?t.push(e):n=r}if(!n)return;let r=n.toLowerCase(),i=be[r],a=t.length>0?` using {${t.join(`, `)}}`:``;i===void 0?await _e(`tell application "System Events" to keystroke "${n.length===1?n:r}"${a}`):await _e(`tell application "System Events" to key code ${i}${a}`)},Te=async()=>{let[e,t]=(await m(`ObjC.import("CoreGraphics"); var e = $.CGEventCreate(null); var p = $.CGEventGetLocation(e); p.x + "," + p.y`)).split(`,`);return{x:Math.round(Number(e)),y:Math.round(Number(t))}},Ee=async(e,t,n)=>{let r=await Te(),i=e===`left`?0:e===`right`?1:2,a=i===0?`kCGEventLeftMouseDown`:i===1?`kCGEventRightMouseDown`:`kCGEventOtherMouseDown`,o=i===0?`kCGEventLeftMouseUp`:i===1?`kCGEventRightMouseUp`:`kCGEventOtherMouseUp`;if(t===`click`)for(let e=0;e<(n??1);e++)await m(ve(a,r.x,r.y,i,e+1)),await m(ve(o,r.x,r.y,i,e+1));else t===`press`?await m(ve(a,r.x,r.y,i)):await m(ve(o,r.x,r.y,i))},De=async(e,t)=>{await m(t===`vertical`?`ObjC.import("CoreGraphics"); var e = $.CGEventCreateScrollWheelEvent(null, 0, 1, ${e}); $.CGEventPost($.kCGHIDEventTap, e);`:`ObjC.import("CoreGraphics"); var e = $.CGEventCreateScrollWheelEvent(null, 0, 2, 0, ${e}); $.CGEventPost($.kCGHIDEventTap, e);`)},Oe=async e=>{await _e(`tell application "System Events" to keystroke "${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`)},ke=()=>{try{let e=he(`osascript`,[`-e`,`
2
+ tell application "System Events"
3
+ set frontApp to first application process whose frontmost is true
4
+ set appName to name of frontApp
5
+ set bundleId to bundle identifier of frontApp
6
+ return bundleId & "|" & appName
7
+ end tell
8
+ `],{encoding:`utf-8`,stdio:[`pipe`,`pipe`,`ignore`]}).trim();if(!e||!e.includes(`|`))return null;let[t,n]=e.split(`|`,2);return{bundleId:t,appName:n}}catch{return null}}})),je=n({getFrontmostAppInfo:()=>Ve,key:()=>Re,keys:()=>ze,mouseButton:()=>Ie,mouseLocation:()=>Fe,mouseScroll:()=>Le,moveMouse:()=>Pe,typeText:()=>Be});function h(e){let t=Bun.spawnSync({cmd:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,e],stdout:`pipe`,stderr:`pipe`});return new TextDecoder().decode(t.stdout).trim()}var g,Me,Ne,Pe,Fe,Ie,Le,Re,ze,Be,Ve,He=t((()=>{g=`
9
+ Add-Type -Language CSharp @'
10
+ using System;
11
+ using System.Runtime.InteropServices;
12
+ using System.Text;
13
+ using System.Diagnostics;
14
+
15
+ public class CuWin32 {
16
+ // --- Cursor ---
17
+ [DllImport("user32.dll")] public static extern bool SetCursorPos(int X, int Y);
18
+ [DllImport("user32.dll")] public static extern bool GetCursorPos(out POINT p);
19
+ [StructLayout(LayoutKind.Sequential)] public struct POINT { public int X; public int Y; }
20
+
21
+ // --- SendInput ---
22
+ [StructLayout(LayoutKind.Sequential)] public struct MOUSEINPUT {
23
+ public int dx; public int dy; public int mouseData; public uint dwFlags; public uint time; public IntPtr dwExtraInfo;
24
+ }
25
+ [StructLayout(LayoutKind.Explicit)] public struct INPUT {
26
+ [FieldOffset(0)] public uint type;
27
+ [FieldOffset(4)] public MOUSEINPUT mi;
28
+ }
29
+ [StructLayout(LayoutKind.Sequential)] public struct KEYBDINPUT {
30
+ public ushort wVk; public ushort wScan; public uint dwFlags; public uint time; public IntPtr dwExtraInfo;
31
+ }
32
+ [StructLayout(LayoutKind.Explicit)] public struct KINPUT {
33
+ [FieldOffset(0)] public uint type;
34
+ [FieldOffset(4)] public KEYBDINPUT ki;
35
+ }
36
+ [DllImport("user32.dll", SetLastError=true)] public static extern uint SendInput(uint n, INPUT[] i, int cb);
37
+ [DllImport("user32.dll", SetLastError=true)] public static extern uint SendInput(uint n, KINPUT[] i, int cb);
38
+
39
+ // --- Keyboard ---
40
+ [DllImport("user32.dll")] public static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo);
41
+ [DllImport("user32.dll")] public static extern short VkKeyScan(char ch);
42
+
43
+ // --- Window ---
44
+ [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();
45
+ [DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint pid);
46
+ [DllImport("user32.dll", CharSet=CharSet.Unicode)] public static extern int GetWindowText(IntPtr hWnd, StringBuilder sb, int max);
47
+
48
+ // Constants
49
+ public const uint INPUT_MOUSE = 0, INPUT_KEYBOARD = 1;
50
+ public const uint MOUSEEVENTF_LEFTDOWN = 0x0002, MOUSEEVENTF_LEFTUP = 0x0004;
51
+ public const uint MOUSEEVENTF_RIGHTDOWN = 0x0008, MOUSEEVENTF_RIGHTUP = 0x0010;
52
+ public const uint MOUSEEVENTF_MIDDLEDOWN = 0x0020, MOUSEEVENTF_MIDDLEUP = 0x0040;
53
+ public const uint MOUSEEVENTF_WHEEL = 0x0800, MOUSEEVENTF_HWHEEL = 0x1000;
54
+ public const uint KEYEVENTF_KEYUP = 0x0002;
55
+ }
56
+ '@
57
+ `,Me={return:13,enter:13,tab:9,space:32,backspace:8,delete:46,escape:27,esc:27,left:37,up:38,right:39,down:40,home:36,end:35,pageup:33,pagedown:34,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,shift:160,lshift:160,rshift:161,control:162,ctrl:162,lcontrol:162,rcontrol:163,alt:164,option:164,lalt:164,ralt:165,win:91,meta:91,command:91,cmd:91,super:91,insert:45,printscreen:44,pause:19,numlock:144,capslock:20,scrolllock:145},Ne=new Set([`shift`,`lshift`,`rshift`,`control`,`ctrl`,`lcontrol`,`rcontrol`,`alt`,`option`,`lalt`,`ralt`,`win`,`meta`,`command`,`cmd`,`super`]),Pe=async(e,t,n)=>{h(`${g}; [CuWin32]::SetCursorPos(${Math.round(e)}, ${Math.round(t)}) | Out-Null`)},Fe=async()=>{let[e,t]=h(`${g}; $p = New-Object CuWin32+POINT; [CuWin32]::GetCursorPos([ref]$p) | Out-Null; "$($p.X),$($p.Y)"`).split(`,`);return{x:Number(e),y:Number(t)}},Ie=async(e,t,n)=>{let r=e===`left`?`MOUSEEVENTF_LEFTDOWN`:e===`right`?`MOUSEEVENTF_RIGHTDOWN`:`MOUSEEVENTF_MIDDLEDOWN`,i=e===`left`?`MOUSEEVENTF_LEFTUP`:e===`right`?`MOUSEEVENTF_RIGHTUP`:`MOUSEEVENTF_MIDDLEUP`;if(t===`click`){let e=n??1,t=``;for(let n=0;n<e;n++)t+=`$i.mi.dwFlags=[CuWin32]::${r}; [CuWin32]::SendInput(1, @($i), [Runtime.InteropServices.Marshal]::SizeOf($i)) | Out-Null; $i.mi.dwFlags=[CuWin32]::${i}; [CuWin32]::SendInput(1, @($i), [Runtime.InteropServices.Marshal]::SizeOf($i)) | Out-Null; `;h(`${g}; $i = New-Object CuWin32+INPUT; $i.type=[CuWin32]::INPUT_MOUSE; ${t}`)}else h(t===`press`?`${g}; $i = New-Object CuWin32+INPUT; $i.type=[CuWin32]::INPUT_MOUSE; $i.mi.dwFlags=[CuWin32]::${r}; [CuWin32]::SendInput(1, @($i), [Runtime.InteropServices.Marshal]::SizeOf($i)) | Out-Null`:`${g}; $i = New-Object CuWin32+INPUT; $i.type=[CuWin32]::INPUT_MOUSE; $i.mi.dwFlags=[CuWin32]::${i}; [CuWin32]::SendInput(1, @($i), [Runtime.InteropServices.Marshal]::SizeOf($i)) | Out-Null`)},Le=async(e,t)=>{h(`${g}; $i = New-Object CuWin32+INPUT; $i.type=[CuWin32]::INPUT_MOUSE; $i.mi.dwFlags=[CuWin32]::${t===`vertical`?`MOUSEEVENTF_WHEEL`:`MOUSEEVENTF_HWHEEL`}; $i.mi.mouseData=${e*120}; [CuWin32]::SendInput(1, @($i), [Runtime.InteropServices.Marshal]::SizeOf($i)) | Out-Null`)},Re=async(e,t)=>{let n=Me[e.toLowerCase()],r=t===`release`?`2`:`0`;n===void 0?e.length===1&&h(`${g}; $vk = [CuWin32]::VkKeyScan([char]${e.charCodeAt(0)}) -band 0xFF; [CuWin32]::keybd_event([byte]$vk, 0, ${r}, [UIntPtr]::Zero)`):h(`${g}; [CuWin32]::keybd_event(${n}, 0, ${r}, [UIntPtr]::Zero)`)},ze=async e=>{let t=[],n=null;for(let r of e){let e=r.toLowerCase();if(Ne.has(e)){let n=Me[e];n!==void 0&&t.push(n)}else n=r}if(!n)return;let r=g+`; `;for(let e of t)r+=`[CuWin32]::keybd_event(${e}, 0, 0, [UIntPtr]::Zero); `;let i=Me[n.toLowerCase()];if(i!==void 0)r+=`[CuWin32]::keybd_event(${i}, 0, 0, [UIntPtr]::Zero); [CuWin32]::keybd_event(${i}, 0, 2, [UIntPtr]::Zero); `;else if(n.length===1){let e=n.charCodeAt(0);r+=`$vk = [CuWin32]::VkKeyScan([char]${e}) -band 0xFF; [CuWin32]::keybd_event([byte]$vk, 0, 0, [UIntPtr]::Zero); [CuWin32]::keybd_event([byte]$vk, 0, 2, [UIntPtr]::Zero); `}for(let e of t.reverse())r+=`[CuWin32]::keybd_event(${e}, 0, 2, [UIntPtr]::Zero); `;h(r)},Be=async e=>{h(`Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.SendKeys]::SendWait('${e.replace(/'/g,`''`)}')`)},Ve=()=>{try{let e=h(`${g}
58
+ $hwnd = [CuWin32]::GetForegroundWindow()
59
+ $procId = [uint32]0
60
+ [CuWin32]::GetWindowThreadProcessId($hwnd, [ref]$procId) | Out-Null
61
+ $proc = Get-Process -Id $procId -ErrorAction SilentlyContinue
62
+ "$($proc.MainModule.FileName)|$($proc.ProcessName)"`);if(!e||!e.includes(`|`))return null;let[t,n]=e.split(`|`,2);return{bundleId:t,appName:n}}catch{return null}}})),Ue=n({getFrontmostAppInfo:()=>tt,key:()=>Qe,keys:()=>$e,mouseButton:()=>Xe,mouseLocation:()=>Ye,mouseScroll:()=>Ze,moveMouse:()=>Je,typeText:()=>et});function _(e){let t=Bun.spawnSync({cmd:e,stdout:`pipe`,stderr:`pipe`});return new TextDecoder().decode(t.stdout).trim()}function We(e){return Ke[e.toLowerCase()]??e}function Ge(e){return e===`left`?`1`:e===`right`?`3`:`2`}var Ke,qe,Je,Ye,Xe,Ze,Qe,$e,et,tt,nt=t((()=>{Ke={return:`Return`,enter:`Return`,tab:`Tab`,space:`space`,backspace:`BackSpace`,delete:`Delete`,escape:`Escape`,esc:`Escape`,left:`Left`,up:`Up`,right:`Right`,down:`Down`,home:`Home`,end:`End`,pageup:`Prior`,pagedown:`Next`,f1:`F1`,f2:`F2`,f3:`F3`,f4:`F4`,f5:`F5`,f6:`F6`,f7:`F7`,f8:`F8`,f9:`F9`,f10:`F10`,f11:`F11`,f12:`F12`,shift:`shift`,lshift:`shift`,rshift:`shift`,control:`ctrl`,ctrl:`ctrl`,lcontrol:`ctrl`,rcontrol:`ctrl`,alt:`alt`,option:`alt`,lalt:`alt`,ralt:`alt`,win:`super`,meta:`super`,command:`super`,cmd:`super`,super:`super`,insert:`Insert`,printscreen:`Print`,pause:`Pause`,numlock:`Num_Lock`,capslock:`Caps_Lock`,scrolllock:`Scroll_Lock`},qe=new Set([`shift`,`lshift`,`rshift`,`control`,`ctrl`,`lcontrol`,`rcontrol`,`alt`,`option`,`lalt`,`ralt`,`win`,`meta`,`command`,`cmd`,`super`]),Je=async(e,t,n)=>{_([`xdotool`,`mousemove`,`--sync`,String(Math.round(e)),String(Math.round(t))])},Ye=async()=>{let e=_([`xdotool`,`getmouselocation`]),t=e.match(/x:(\d+)/),n=e.match(/y:(\d+)/);return{x:t?Number(t[1]):0,y:n?Number(n[1]):0}},Xe=async(e,t,n)=>{let r=Ge(e);_(t===`click`?[`xdotool`,`click`,`--repeat`,String(n??1),r]:t===`press`?[`xdotool`,`mousedown`,r]:[`xdotool`,`mouseup`,r])},Ze=async(e,t)=>{if(t===`vertical`){let t=e>=0?`5`:`4`,n=Math.abs(Math.round(e));n>0&&_([`xdotool`,`click`,`--repeat`,String(n),t])}else{let t=e>=0?`7`:`6`,n=Math.abs(Math.round(e));n>0&&_([`xdotool`,`click`,`--repeat`,String(n),t])}},Qe=async(e,t)=>{let n=We(e);_(t===`press`?[`xdotool`,`keydown`,n]:[`xdotool`,`keyup`,n])},$e=async e=>{let t=[],n=null;for(let r of e)qe.has(r.toLowerCase())?t.push(We(r)):n=r;n&&_([`xdotool`,`key`,[...t,We(n)].join(`+`)])},et=async e=>{_([`xdotool`,`type`,`--delay`,`12`,e])},tt=()=>{try{let e=_([`xdotool`,`getactivewindow`]);if(!e)return null;let t=_([`xdotool`,`getwindowpid`,e]);if(!t)return null;let n=t.trim(),r=``;try{r=_([`readlink`,`-f`,`/proc/${n}/exe`])}catch{}let i=``;try{i=_([`cat`,`/proc/${n}/comm`])}catch{}return!r&&!i?null:{bundleId:r||`/proc/${n}/exe`,appName:i||`unknown`}}catch{return null}}})),rt=n({ComputerUseInputAPI:()=>mt,getFrontmostAppInfo:()=>pt,isSupported:()=>at,key:()=>st,keys:()=>ct,mouseButton:()=>ut,mouseLocation:()=>lt,mouseScroll:()=>dt,moveMouse:()=>ot,typeText:()=>ft});function it(){try{if(process.platform===`darwin`)return Ae(),e(ge);if(process.platform===`win32`)return He(),e(je);if(process.platform===`linux`)return nt(),e(Ue)}catch{return null}return null}var v,at,ot,st,ct,lt,ut,dt,ft,pt,mt,ht=t((()=>{v=it(),at=v!==null,ot=v?.moveMouse,st=v?.key,ct=v?.keys,lt=v?.mouseLocation,ut=v?.mouseButton,dt=v?.mouseScroll,ft=v?.typeText,pt=v?.getFrontmostAppInfo??(()=>null),mt=class{}}));function y(){if(gt)return gt;let t=(ht(),e(rt));if(!t.isSupported)throw Error(`@ant/computer-use-input is not supported on this platform`);return gt=t}var gt,_t=t((()=>{})),vt=n({MODIFIER_KEYS:()=>St,VK_MAP:()=>xt,getTmpDir:()=>bt,ps:()=>x,psAsync:()=>yt,runPs:()=>S,validateHwnd:()=>b});function b(e){if(!/^\d+$/.test(e))throw Error(`Invalid HWND: "${e}" — must be numeric`);return e}function x(e){let t=Bun.spawnSync({cmd:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,e],stdout:`pipe`,stderr:`pipe`});return new TextDecoder().decode(t.stdout).trim()}function S(e){try{let t=Bun.spawnSync({cmd:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,e],stdout:`pipe`,stderr:`pipe`});return t.exitCode===0?new TextDecoder().decode(t.stdout).trim():null}catch{return null}}async function yt(e){let t=Bun.spawn([`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,e],{stdout:`pipe`,stderr:`pipe`}),n=await new Response(t.stdout).text();return await t.exited,n.trim()}function bt(){return process.env.TEMP||process.env.TMP||`/tmp`}var xt,St,C=t((()=>{xt={backspace:8,tab:9,enter:13,return:13,shift:16,lshift:160,rshift:161,ctrl:17,control:17,lcontrol:162,rcontrol:163,alt:18,option:18,menu:18,lalt:164,ralt:165,pause:19,capslock:20,escape:27,esc:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,win:91,meta:91,command:91,cmd:91,super:91,numlock:144,scrolllock:145,printscreen:44,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},St=new Set([`shift`,`lshift`,`rshift`,`control`,`ctrl`,`lcontrol`,`rcontrol`,`alt`,`option`,`lalt`,`ralt`,`win`,`meta`,`command`,`cmd`,`super`])})),Ct=n({platform:()=>Ot}),wt,Tt,Et,Dt,Ot,kt=t((()=>{_t(),le(),wt={async moveMouse(e,t){await y().moveMouse(e,t,!1)},async click(e,t,n){let r=y();await r.moveMouse(e,t,!1),await r.mouseButton(n,`click`,1)},async typeText(e){await y().typeText(e)},async key(e,t){await y().key(e,t)},async keys(e){await y().keys(e)},async scroll(e,t){await y().mouseScroll(e,t)},async mouseLocation(){return y().mouseLocation()}},Tt={async captureScreen(e){return f().screenshot.captureExcluding([],void 0,void 0,void 0,e)},async captureRegion(e,t,n,r){return f().screenshot.captureRegion([],e,t,n,r)}},Et={listAll(){return f().display.listAll()},getSize(e){return f().display.getSize(e)}},Dt={listRunning(){return f().apps.listRunning().map(e=>({id:e.bundleId??``,pid:0,title:e.displayName??``}))},async listInstalled(){return(await f().apps.listInstalled()).map(e=>({id:e.bundleId??``,displayName:e.displayName??``,path:e.path??``}))},async open(e){await f().apps.open(e)},getFrontmostApp(){let e=y().getFrontmostAppInfo();return e?{id:e.bundleId,appName:e.appName}:null},findWindowByTitle(e){return this.listRunning().find(t=>t.title.includes(e))??null}},Ot={input:wt,screenshot:Tt,display:Et,apps:Dt}})),At=n({listWindows:()=>jt});function jt(){let e=Bun.spawnSync({cmd:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,Mt],stdout:`pipe`,stderr:`pipe`}),t=new TextDecoder().decode(e.stdout).trim();return t?t.split(`
63
+ `).filter(Boolean).map(e=>{let t=e.trim(),n=t.indexOf(`|`),r=t.indexOf(`|`,n+1);if(n===-1||r===-1)return null;let i=t.slice(0,n),a=Number(t.slice(n+1,r)),o=t.slice(r+1);return!i||isNaN(a)||!o?null:{hwnd:i,pid:a,title:o}}).filter(e=>e!==null):[]}var Mt,w=t((()=>{Mt=`
64
+ Add-Type @'
65
+ using System;
66
+ using System.Collections.Generic;
67
+ using System.Runtime.InteropServices;
68
+ using System.Text;
69
+ public class WinEnum {
70
+ public delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
71
+
72
+ [DllImport("user32.dll")]
73
+ public static extern bool EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam);
74
+ [DllImport("user32.dll")]
75
+ public static extern bool IsWindowVisible(IntPtr hWnd);
76
+ [DllImport("user32.dll", CharSet=CharSet.Unicode)]
77
+ public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
78
+ [DllImport("user32.dll")]
79
+ public static extern int GetWindowTextLength(IntPtr hWnd);
80
+ [DllImport("user32.dll")]
81
+ public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint processId);
82
+
83
+ public static List<string> results = new List<string>();
84
+
85
+ public static void Run() {
86
+ results.Clear();
87
+ EnumWindows(delegate(IntPtr hWnd, IntPtr lParam) {
88
+ if (!IsWindowVisible(hWnd)) return true;
89
+ int len = GetWindowTextLength(hWnd);
90
+ if (len == 0) return true;
91
+ StringBuilder sb = new StringBuilder(len + 1);
92
+ GetWindowText(hWnd, sb, sb.Capacity);
93
+ string title = sb.ToString();
94
+ if (string.IsNullOrWhiteSpace(title)) return true;
95
+ uint pid = 0;
96
+ GetWindowThreadProcessId(hWnd, out pid);
97
+ results.Add(hWnd.ToInt64() + "|" + pid + "|" + title);
98
+ return true;
99
+ }, IntPtr.Zero);
100
+ }
101
+ }
102
+ '@
103
+ [WinEnum]::Run()
104
+ [WinEnum]::results | ForEach-Object { $_ }
105
+ `})),Nt=n({closeExcel:()=>Ut,createExcel:()=>Ht,openExcel:()=>Ft,readCell:()=>It,readRange:()=>Lt,saveExcel:()=>Vt,setFormula:()=>Bt,writeCell:()=>Rt,writeRange:()=>zt});function T(e){let t=Bun.spawnSync({cmd:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,e],stdout:`pipe`,stderr:`pipe`}),n=new TextDecoder().decode(t.stderr).trim();if(t.exitCode!==0&&n)throw Error(`PowerShell error: ${n}`);return new TextDecoder().decode(t.stdout).trim()}function E(e){return e.replace(/'/g,`''`)}function Pt(e,t){return typeof t==`number`?`$${e} = $wb.Sheets.Item(${t})`:`$${e} = $wb.Sheets.Item('${t.replace(/'/g,`''`)}')`}function D(e=!0){let t=[];return e&&t.push(`if ($wb) { $wb.Close($false) }`),t.push(`$excel.Quit()`),t.push(`[System.Runtime.InteropServices.Marshal]::ReleaseComObject($excel) | Out-Null`),t.join(`
106
+ `)}function Ft(e){let t=T(`
107
+ ${O}
108
+ try {
109
+ $wb = $excel.Workbooks.Open('${E(e)}')
110
+ $result = @{ sheets = @(); sheetNames = @() }
111
+ foreach ($sheet in $wb.Sheets) {
112
+ $result.sheetNames += $sheet.Name
113
+ $ur = $sheet.UsedRange
114
+ $rows = $ur.Rows.Count
115
+ $cols = $ur.Columns.Count
116
+ $cells = @()
117
+ $count = 0
118
+ for ($r = 1; $r -le $rows -and $count -lt 1000; $r++) {
119
+ for ($c = 1; $c -le $cols -and $count -lt 1000; $c++) {
120
+ $cell = $sheet.Cells.Item($r, $c)
121
+ $val = $cell.Value2
122
+ if ($null -ne $val) {
123
+ $f = $null
124
+ if ($cell.HasFormula) { $f = $cell.Formula }
125
+ $entry = @{ row = $r; col = $c; value = $val }
126
+ if ($f) { $entry.formula = $f }
127
+ $cells += $entry
128
+ $count++
129
+ }
130
+ }
131
+ }
132
+ $result.sheets += @{
133
+ name = $sheet.Name
134
+ usedRange = @{ rows = $rows; cols = $cols }
135
+ cells = $cells
136
+ }
137
+ }
138
+ $result | ConvertTo-Json -Depth 5 -Compress
139
+ } finally {
140
+ ${D()}
141
+ }
142
+ `);if(!t)throw Error(`No output from openExcel`);let n=JSON.parse(t),r=Array.isArray(n.sheets)?n.sheets:[n.sheets],i=Array.isArray(n.sheetNames)?n.sheetNames:[n.sheetNames];return{sheets:r.map(e=>({name:e.name,usedRange:e.usedRange,cells:Array.isArray(e.cells)?e.cells:e.cells?[e.cells]:[]})),sheetNames:i}}function It(e,t,n,r){let i=T(`
143
+ ${O}
144
+ try {
145
+ $wb = $excel.Workbooks.Open('${E(e)}')
146
+ ${Pt(`sheet`,t)}
147
+ $val = $sheet.Cells.Item(${n}, ${r}).Value2
148
+ if ($null -eq $val) { Write-Output 'null' } else { Write-Output ($val | ConvertTo-Json -Compress) }
149
+ } finally {
150
+ ${D()}
151
+ }
152
+ `);return i===`null`||i===``?null:JSON.parse(i)}function Lt(e,t,n,r,i,a){let o=T(`
153
+ ${O}
154
+ try {
155
+ $wb = $excel.Workbooks.Open('${E(e)}')
156
+ ${Pt(`sheet`,t)}
157
+ $rows = @()
158
+ for ($r = ${n}; $r -le ${i}; $r++) {
159
+ $row = @()
160
+ for ($c = ${r}; $c -le ${a}; $c++) {
161
+ $val = $sheet.Cells.Item($r, $c).Value2
162
+ $row += if ($null -eq $val) { '__NULL__' } else { $val }
163
+ }
164
+ $rows += ,@($row)
165
+ }
166
+ $rows | ConvertTo-Json -Depth 3 -Compress
167
+ } finally {
168
+ ${D()}
169
+ }
170
+ `);if(!o)return[];let s=JSON.parse(o);return(Array.isArray(s[0])?s:[s]).map(e=>e.map(e=>e===`__NULL__`?null:e))}function Rt(e,t,n,r,i){let a=JSON.stringify(i);return T(`
171
+ ${O}
172
+ try {
173
+ $wb = $excel.Workbooks.Open('${E(e)}')
174
+ ${Pt(`sheet`,t)}
175
+ $sheet.Cells.Item(${n}, ${r}).Value2 = (ConvertFrom-Json '${a.replace(/'/g,`''`)}')
176
+ $wb.Save()
177
+ Write-Output 'true'
178
+ } finally {
179
+ ${D()}
180
+ }
181
+ `)===`true`}function zt(e,t,n,r,i){let a=JSON.stringify(i).replace(/'/g,`''`);return T(`
182
+ ${O}
183
+ try {
184
+ $wb = $excel.Workbooks.Open('${E(e)}')
185
+ ${Pt(`sheet`,t)}
186
+ $data = ConvertFrom-Json '${a}'
187
+ for ($r = 0; $r -lt $data.Count; $r++) {
188
+ $row = $data[$r]
189
+ for ($c = 0; $c -lt $row.Count; $c++) {
190
+ $val = $row[$c]
191
+ if ($null -ne $val) {
192
+ if ($val -is [int] -or $val -is [long] -or $val -is [double] -or $val -is [decimal]) {
193
+ $sheet.Cells.Item(${n} + $r, ${r} + $c).Value2 = [double]$val
194
+ } else {
195
+ $sheet.Cells.Item(${n} + $r, ${r} + $c).Value2 = [string]$val
196
+ }
197
+ }
198
+ }
199
+ }
200
+ $wb.Save()
201
+ Write-Output 'true'
202
+ } finally {
203
+ ${D()}
204
+ }
205
+ `)===`true`}function Bt(e,t,n,r,i){return T(`
206
+ ${O}
207
+ try {
208
+ $wb = $excel.Workbooks.Open('${E(e)}')
209
+ ${Pt(`sheet`,t)}
210
+ $sheet.Cells.Item(${n}, ${r}).Formula = '${i.replace(/'/g,`''`)}'
211
+ $wb.Save()
212
+ Write-Output 'true'
213
+ } finally {
214
+ ${D()}
215
+ }
216
+ `)===`true`}function Vt(e,t){let n=t?`$wb.SaveAs('${E(t)}')`:`$wb.Save()`;return T(`
217
+ ${O}
218
+ try {
219
+ $wb = $excel.Workbooks.Open('${E(e)}')
220
+ ${n}
221
+ Write-Output 'true'
222
+ } finally {
223
+ ${D()}
224
+ }
225
+ `)===`true`}function Ht(e){return T(`
226
+ ${O}
227
+ try {
228
+ $wb = $excel.Workbooks.Add()
229
+ $wb.SaveAs('${E(e)}')
230
+ Write-Output 'true'
231
+ } finally {
232
+ ${D()}
233
+ }
234
+ `)===`true`}function Ut(e){}var O,Wt=t((()=>{O=`$excel = New-Object -ComObject Excel.Application
235
+ $excel.Visible = $false
236
+ $excel.DisplayAlerts = $false`})),Gt=n({appendText:()=>Xt,closeWord:()=>rn,createWord:()=>nn,findReplace:()=>Qt,insertTable:()=>$t,insertText:()=>Zt,openWord:()=>Jt,readText:()=>Yt,saveAsPdf:()=>tn,saveWord:()=>en});function k(e){let t=Bun.spawnSync({cmd:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,e],stdout:`pipe`,stderr:`pipe`});return new TextDecoder().decode(t.stdout).trim()}function A(e,t){if(!e)return t;try{return JSON.parse(e)}catch{return t}}function j(e){return e.replace(/'/g,`''`)}function Kt(e,t){return`
237
+ $word = New-Object -ComObject Word.Application
238
+ $word.Visible = $false
239
+ $word.DisplayAlerts = 0
240
+ try {
241
+ ${t?`$doc = $word.Documents.Open('${j(t)}')`:`$doc = $word.Documents.Add()`}
242
+ ${e}
243
+ } finally {
244
+ if ($doc -ne $null) { $doc.Close($false); }
245
+ if ($word -ne $null) { $word.Quit(); }
246
+ if ($word -ne $null) { [System.Runtime.InteropServices.Marshal]::ReleaseComObject($word) | Out-Null }
247
+ }
248
+ `}function qt(e,t){return`
249
+ $word = New-Object -ComObject Word.Application
250
+ $word.Visible = $false
251
+ $word.DisplayAlerts = 0
252
+ try {
253
+ $doc = $word.Documents.Open('${j(t)}')
254
+ ${e}
255
+ $doc.Save()
256
+ Write-Output '{"ok":true}'
257
+ } catch {
258
+ Write-Output ('{"ok":false,"error":"' + ($_.Exception.Message -replace '"','\\"') + '"}')
259
+ } finally {
260
+ if ($doc -ne $null) { $doc.Close($false); }
261
+ if ($word -ne $null) { $word.Quit(); }
262
+ if ($word -ne $null) { [System.Runtime.InteropServices.Marshal]::ReleaseComObject($word) | Out-Null }
263
+ }
264
+ `}async function Jt(e){return A(k(Kt(`
265
+ # Paragraphs (limit 500)
266
+ $paras = @()
267
+ $paraCount = $doc.Paragraphs.Count
268
+ $limit = [Math]::Min($paraCount, 500)
269
+ for ($i = 1; $i -le $limit; $i++) {
270
+ $p = $doc.Paragraphs.Item($i)
271
+ $r = $p.Range
272
+ $paras += @{
273
+ text = $r.Text -replace '\\r$',''
274
+ bold = [bool]($r.Font.Bold -eq -1)
275
+ italic = [bool]($r.Font.Italic -eq -1)
276
+ fontSize = $r.Font.Size
277
+ }
278
+ }
279
+
280
+ # Tables
281
+ $tables = @()
282
+ foreach ($table in $doc.Tables) {
283
+ $rows = $table.Rows.Count
284
+ $cols = $table.Columns.Count
285
+ $data = @()
286
+ for ($r = 1; $r -le $rows; $r++) {
287
+ $row = @()
288
+ for ($c = 1; $c -le $cols; $c++) {
289
+ try {
290
+ $cellText = $table.Cell($r, $c).Range.Text
291
+ # Trim trailing \\r\\a that Word adds to cell text
292
+ $cellText = $cellText -replace '[\\r\\n\\a]+$',''
293
+ $row += $cellText
294
+ } catch {
295
+ $row += ''
296
+ }
297
+ }
298
+ $data += ,@($row)
299
+ }
300
+ $tables += @{ rows = $rows; cols = $cols; data = $data }
301
+ }
302
+
303
+ # Counts: wdStatisticWords=0, wdStatisticPages=2
304
+ $wordCount = $doc.ComputeStatistics(0)
305
+ $pageCount = $doc.ComputeStatistics(2)
306
+
307
+ $result = @{
308
+ text = $doc.Content.Text
309
+ paragraphs = $paras
310
+ tables = $tables
311
+ wordCount = $wordCount
312
+ pageCount = $pageCount
313
+ }
314
+ Write-Output (ConvertTo-Json $result -Depth 5 -Compress)
315
+ `,e)),{text:``,paragraphs:[],tables:[],wordCount:0,pageCount:0})}async function Yt(e){return k(Kt(`Write-Output $doc.Content.Text`,e))}async function Xt(e,t,n){return A(k(qt(`
316
+ $sel = $word.Selection
317
+ $sel.EndKey(6) | Out-Null
318
+ ${n?[n.bold===void 0?``:`$sel.Font.Bold = ${n.bold?`-1`:`0`}`,n.italic===void 0?``:`$sel.Font.Italic = ${n.italic?`-1`:`0`}`,n.fontSize===void 0?``:`$sel.Font.Size = ${n.fontSize}`,n.fontName?`$sel.Font.Name = '${j(n.fontName)}'`:``].filter(Boolean).join(`
319
+ `):``}
320
+ $sel.TypeText('${j(t)}')
321
+ `,e)),{ok:!1}).ok}async function Zt(e,t,n){return A(k(qt(`
322
+ $doc.Paragraphs.Item(${t}).Range.InsertBefore('${j(n)}')
323
+ `,e)),{ok:!1}).ok}async function Qt(e,t,n,r){let i=r===!1?1:2,a=`
324
+ $content = $doc.Content
325
+ $findObj = $content.Find
326
+ $findObj.ClearFormatting()
327
+ $findObj.Replacement.ClearFormatting()
328
+
329
+ # Count replacements by iterating
330
+ $count = 0
331
+ $findObj.Text = '${j(t)}'
332
+ $findObj.Replacement.Text = '${j(n)}'
333
+ $findObj.Forward = $true
334
+ $findObj.Wrap = 0
335
+ $findObj.Format = $false
336
+ $findObj.MatchCase = $false
337
+ $findObj.MatchWholeWord = $false
338
+ $findObj.MatchWildcards = $false
339
+
340
+ if (${i} -eq 2) {
341
+ # Count occurrences first using a clone of content
342
+ $range2 = $doc.Content.Duplicate
343
+ while ($range2.Find.Execute('${j(t)}')) { $count++ }
344
+ # Now do the actual replace
345
+ $findObj.Execute('${j(t)}', $false, $false, $false, $false, $false, $true, 0, $false, '${j(n)}', 2)
346
+ } else {
347
+ $found = $findObj.Execute('${j(t)}', $false, $false, $false, $false, $false, $true, 0, $false, '${j(n)}', 1)
348
+ if ($found) { $count = 1 }
349
+ }
350
+ `;return A(k(`
351
+ $word = New-Object -ComObject Word.Application
352
+ $word.Visible = $false
353
+ $word.DisplayAlerts = 0
354
+ try {
355
+ $doc = $word.Documents.Open('${j(e)}')
356
+ ${a}
357
+ $doc.Save()
358
+ Write-Output ('{"count":' + $count + '}')
359
+ } catch {
360
+ Write-Output '{"count":0}'
361
+ } finally {
362
+ if ($doc -ne $null) { $doc.Close($false); }
363
+ if ($word -ne $null) { $word.Quit(); }
364
+ if ($word -ne $null) { [System.Runtime.InteropServices.Marshal]::ReleaseComObject($word) | Out-Null }
365
+ }
366
+ `),{count:0}).count}async function $t(e,t,n,r){return A(k(qt(`
367
+ $sel = $word.Selection
368
+ $sel.EndKey(6) | Out-Null
369
+ $table = $doc.Tables.Add($sel.Range, ${t}, ${n})
370
+ $data = @(${r.map(e=>`,@(`+e.map(e=>`'${j(e)}'`).join(`,`)+`)`).join(`
371
+ `)})
372
+ for ($r = 0; $r -lt $data.Count; $r++) {
373
+ for ($c = 0; $c -lt $data[$r].Count; $c++) {
374
+ $table.Cell($r + 1, $c + 1).Range.Text = $data[$r][$c]
375
+ }
376
+ }
377
+ `,e)),{ok:!1}).ok}async function en(e,t){if(!t||t===e)return A(k(qt(``,e)),{ok:!1}).ok;let n=`$doc.SaveAs('${j(t)}')`;return A(k(`
378
+ $word = New-Object -ComObject Word.Application
379
+ $word.Visible = $false
380
+ $word.DisplayAlerts = 0
381
+ try {
382
+ $doc = $word.Documents.Open('${j(e)}')
383
+ ${n}
384
+ Write-Output '{"ok":true}'
385
+ } catch {
386
+ Write-Output ('{"ok":false,"error":"' + ($_.Exception.Message -replace '"','\\"') + '"}')
387
+ } finally {
388
+ if ($doc -ne $null) { $doc.Close($false); }
389
+ if ($word -ne $null) { $word.Quit(); }
390
+ if ($word -ne $null) { [System.Runtime.InteropServices.Marshal]::ReleaseComObject($word) | Out-Null }
391
+ }
392
+ `),{ok:!1}).ok}async function tn(e,t){let n=`$doc.SaveAs2('${j(t)}', 17)`;return A(k(`
393
+ $word = New-Object -ComObject Word.Application
394
+ $word.Visible = $false
395
+ $word.DisplayAlerts = 0
396
+ try {
397
+ $doc = $word.Documents.Open('${j(e)}')
398
+ ${n}
399
+ Write-Output '{"ok":true}'
400
+ } catch {
401
+ Write-Output ('{"ok":false,"error":"' + ($_.Exception.Message -replace '"','\\"') + '"}')
402
+ } finally {
403
+ if ($doc -ne $null) { $doc.Close($false); }
404
+ if ($word -ne $null) { $word.Quit(); }
405
+ if ($word -ne $null) { [System.Runtime.InteropServices.Marshal]::ReleaseComObject($word) | Out-Null }
406
+ }
407
+ `),{ok:!1}).ok}async function nn(e){return A(k(`
408
+ $word = New-Object -ComObject Word.Application
409
+ $word.Visible = $false
410
+ $word.DisplayAlerts = 0
411
+ try {
412
+ $doc = $word.Documents.Add()
413
+ $doc.SaveAs('${j(e)}')
414
+ Write-Output '{"ok":true}'
415
+ } catch {
416
+ Write-Output ('{"ok":false,"error":"' + ($_.Exception.Message -replace '"','\\"') + '"}')
417
+ } finally {
418
+ if ($doc -ne $null) { $doc.Close($false); }
419
+ if ($word -ne $null) { $word.Quit(); }
420
+ if ($word -ne $null) { [System.Runtime.InteropServices.Marshal]::ReleaseComObject($word) | Out-Null }
421
+ }
422
+ `),{ok:!1}).ok}function rn(e){}var an=t((()=>{}));function on(e){let t=e.toLowerCase(),n=fe(t);if(n){if(cn.has(n))return`excel`;if(ln.has(n))return`word`;if(un.has(n))return`text`}let r=t.replace(/\.exe$/,``).split(/[/\\]/).pop()??``;return r===`excel`||r.includes(`excel`)?`excel`:r===`winword`||r===`word`||r.includes(`word`)?`word`:r===`notepad`||r===`notepad++`||r===`code`?`text`:dn.has(r)?`browser`:`generic`}async function sn(t){let n=on(t);switch(n){case`excel`:{let{createExcel:n,openExcel:r}=(Wt(),e(Nt));if(t.match(/\.(xlsx|xls|csv|xlsm|xlsb)$/i))try{return r(t),{type:`excel`,filePath:t}}catch{return{type:`excel`,filePath:t}}let i=`${process.env.TEMP||`/tmp`}\\cu_new_${Date.now()}.xlsx`;return n(i),{type:`excel`,filePath:i}}case`word`:{let{createWord:n,openWord:r}=(an(),e(Gt));if(t.match(/\.(docx|doc|rtf)$/i))try{return r(t),{type:`word`,filePath:t}}catch{return{type:`word`,filePath:t}}let i=`${process.env.TEMP||`/tmp`}\\cu_new_${Date.now()}.docx`;return n(i),{type:`word`,filePath:i}}default:return{type:n}}}var cn,ln,un,dn,fn=t((()=>{cn=new Set([`.xlsx`,`.xls`,`.csv`,`.xlsm`,`.xlsb`]),ln=new Set([`.docx`,`.doc`,`.rtf`]),un=new Set([`.txt`,`.log`,`.md`,`.json`,`.xml`,`.yaml`,`.yml`,`.ini`,`.cfg`,`.conf`]),dn=new Set([`chrome`,`msedge`,`firefox`,`brave`,`opera`])}));function pn(e){return e=b(e),x(`Add-Type @'
423
+ using System;
424
+ using System.Runtime.InteropServices;
425
+ public class CuDwm {
426
+ [DllImport("dwmapi.dll")]
427
+ public static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref uint val, int size);
428
+ }
429
+ '@
430
+ $color = [uint32]0x0000C800
431
+ [CuDwm]::DwmSetWindowAttribute([IntPtr]::new([long]${e}), 34, [ref]$color, 4)`)===`0`}function mn(e){return e=b(e),x(`Add-Type @'
432
+ using System;
433
+ using System.Runtime.InteropServices;
434
+ public class CuDwm {
435
+ [DllImport("dwmapi.dll")]
436
+ public static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref uint val, int size);
437
+ }
438
+ '@
439
+ $color = [uint32]0xFFFFFFFF
440
+ [CuDwm]::DwmSetWindowAttribute([IntPtr]::new([long]${e}), 34, [ref]$color, 4)`)===`0`}var hn=t((()=>{C()})),gn=n({hideVirtualCursor:()=>bn,isVirtualCursorActive:()=>xn,moveVirtualCursor:()=>yn,showVirtualCursor:()=>vn});function _n(e,t){return`
441
+ Add-Type -AssemblyName System.Windows.Forms
442
+ Add-Type -AssemblyName System.Drawing
443
+ Add-Type @'
444
+ using System;
445
+ using System.Runtime.InteropServices;
446
+ using System.Drawing;
447
+ using System.Drawing.Drawing2D;
448
+
449
+ public class VCursor {
450
+ [DllImport("user32.dll")]
451
+ public static extern bool IsWindow(IntPtr hWnd);
452
+
453
+ [DllImport("user32.dll", SetLastError = true)]
454
+ public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
455
+
456
+ [DllImport("user32.dll", SetLastError = true)]
457
+ public static extern int GetWindowLong(IntPtr hWnd, int nIndex);
458
+
459
+ [DllImport("user32.dll")]
460
+ public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hAfter, int X, int Y, int cx, int cy, uint f);
461
+
462
+ [DllImport("user32.dll")]
463
+ public static extern bool GetWindowRect(IntPtr h, out RECT r);
464
+
465
+ [StructLayout(LayoutKind.Sequential)]
466
+ public struct RECT { public int L, T, R, B; }
467
+
468
+ public const int GWL_EXSTYLE = -20;
469
+ public const int WS_EX_LAYERED = 0x80000;
470
+ public const int WS_EX_TRANSPARENT = 0x20;
471
+ public const int WS_EX_TOOLWINDOW = 0x80;
472
+ public const int WS_EX_NOACTIVATE = 0x08000000;
473
+ public static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
474
+ public const uint SWP_NOACTIVATE = 0x0010;
475
+ public const uint SWP_SHOWWINDOW = 0x0040;
476
+ public const uint SWP_NOSIZE = 0x0001;
477
+
478
+ public static void MakeOverlay(IntPtr h) {
479
+ int ex = GetWindowLong(h, GWL_EXSTYLE);
480
+ ex |= WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE;
481
+ SetWindowLong(h, GWL_EXSTYLE, ex);
482
+ }
483
+ }
484
+ '@
485
+
486
+ $targetHwnd = [IntPtr]::new([long]${e})
487
+ $stopFile = '${t.replace(/\\/g,`\\\\`)}'
488
+ $cursorSize = ${Sn}
489
+
490
+ # Create cursor form with arrow shape
491
+ $cursor = New-Object System.Windows.Forms.Form
492
+ $cursor.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::None
493
+ $cursor.ShowInTaskbar = $false
494
+ $cursor.TopMost = $true
495
+ $cursor.StartPosition = [System.Windows.Forms.FormStartPosition]::Manual
496
+ $cursor.Size = New-Object System.Drawing.Size($cursorSize, $cursorSize)
497
+ $cursor.Location = New-Object System.Drawing.Point(-32000, -32000)
498
+ $cursor.Opacity = ${En}
499
+ $cursor.BackColor = [System.Drawing.Color]::Magenta
500
+ $cursor.TransparencyKey = [System.Drawing.Color]::Magenta
501
+
502
+ # Draw arrow cursor shape
503
+ $bmp = New-Object System.Drawing.Bitmap($cursorSize, $cursorSize)
504
+ $g = [System.Drawing.Graphics]::FromImage($bmp)
505
+ $g.SmoothingMode = [System.Drawing.Drawing2D.SmoothingMode]::AntiAlias
506
+ # Arrow polygon (pointing top-left)
507
+ $points = @(
508
+ (New-Object System.Drawing.Point(1, 1)),
509
+ (New-Object System.Drawing.Point(1, 16)),
510
+ (New-Object System.Drawing.Point(5, 12)),
511
+ (New-Object System.Drawing.Point(9, 18)),
512
+ (New-Object System.Drawing.Point(12, 16)),
513
+ (New-Object System.Drawing.Point(8, 10)),
514
+ (New-Object System.Drawing.Point(13, 10)),
515
+ (New-Object System.Drawing.Point(1, 1))
516
+ )
517
+ $brush = New-Object System.Drawing.SolidBrush([System.Drawing.Color]::FromArgb(${Cn}, ${wn}, ${Tn}))
518
+ $g.FillPolygon($brush, $points)
519
+ $pen = New-Object System.Drawing.Pen([System.Drawing.Color]::White, 1)
520
+ $g.DrawPolygon($pen, $points)
521
+ $g.Dispose()
522
+ $cursor.BackgroundImage = $bmp
523
+
524
+ $cursor.Show()
525
+ [VCursor]::MakeOverlay($cursor.Handle)
526
+
527
+ # Position file: the TS side writes "x,y" or "x,y,click" to this file
528
+ $posFile = $stopFile + '.pos'
529
+
530
+ $script:lastCX = -32000
531
+ $script:lastCY = -32000
532
+ $script:clickFlash = 0
533
+
534
+ $timer = New-Object System.Windows.Forms.Timer
535
+ $timer.Interval = 16 # ~60fps
536
+
537
+ $timer.Add_Tick({
538
+ if (-not [VCursor]::IsWindow($targetHwnd)) {
539
+ $timer.Stop(); $cursor.Close()
540
+ [System.Windows.Forms.Application]::ExitThread()
541
+ return
542
+ }
543
+ # Check stop
544
+ if (Test-Path $stopFile) {
545
+ $timer.Stop(); $cursor.Close()
546
+ try { Remove-Item $stopFile -ErrorAction SilentlyContinue } catch {}
547
+ try { Remove-Item $posFile -ErrorAction SilentlyContinue } catch {}
548
+ [System.Windows.Forms.Application]::ExitThread()
549
+ return
550
+ }
551
+ # Read position updates
552
+ if (Test-Path $posFile) {
553
+ try {
554
+ $data = Get-Content $posFile -Raw -ErrorAction SilentlyContinue
555
+ if ($data) {
556
+ $parts = $data.Trim().Split(',')
557
+ if ($parts.Length -ge 2) {
558
+ $script:lastCX = [int]$parts[0]
559
+ $script:lastCY = [int]$parts[1]
560
+ if ($parts.Length -ge 3 -and $parts[2] -eq 'click') {
561
+ $script:clickFlash = 6 # flash for 6 frames (~100ms)
562
+ }
563
+ }
564
+ Remove-Item $posFile -ErrorAction SilentlyContinue
565
+ }
566
+ } catch {}
567
+ }
568
+
569
+ # Get window position to convert client coords to screen coords
570
+ $wr = New-Object VCursor+RECT
571
+ [VCursor]::GetWindowRect($targetHwnd, [ref]$wr) | Out-Null
572
+ $screenX = $wr.L + $script:lastCX
573
+ $screenY = $wr.T + $script:lastCY
574
+
575
+ # Click flash: briefly change color
576
+ if ($script:clickFlash -gt 0) {
577
+ $cursor.Opacity = 1.0
578
+ $script:clickFlash--
579
+ if ($script:clickFlash -eq 0) {
580
+ $cursor.Opacity = ${En}
581
+ }
582
+ }
583
+
584
+ [VCursor]::SetWindowPos($cursor.Handle, [VCursor]::HWND_TOPMOST,
585
+ $screenX, $screenY, 0, 0,
586
+ [VCursor]::SWP_NOSIZE -bor [VCursor]::SWP_NOACTIVATE -bor [VCursor]::SWP_SHOWWINDOW) | Out-Null
587
+ $cursor.Visible = $true
588
+ })
589
+
590
+ $timer.Start()
591
+ [System.Windows.Forms.Application]::Run()
592
+ `}function vn(e){e=b(e),bn();try{let t=bt(),n=Date.now(),r=de.join(t,`cu_vcursor_stop_${n}`),i=de.join(t,`cu_vcursor_${n}.ps1`),a=_n(e,r);return p.writeFileSync(i,a,`utf-8`),Dn=Bun.spawn([`powershell`,`-NoProfile`,`-ExecutionPolicy`,`Bypass`,`-File`,i],{stdout:`ignore`,stderr:`ignore`}),M=r,On=i,!0}catch{return!1}}function yn(e,t,n=!1){if(!M)return;let r=M+`.pos`;try{let i=n?`${Math.round(e)},${Math.round(t)},click`:`${Math.round(e)},${Math.round(t)}`;p.writeFileSync(r,i,`utf-8`)}catch{}}function bn(){if(M){try{p.writeFileSync(M,`STOP`,`utf-8`)}catch{}setTimeout(()=>{try{Dn?.kill()}catch{}try{On&&p.unlinkSync(On)}catch{}try{M&&p.unlinkSync(M)}catch{}},2e3)}Dn=null,M=null,On=null}function xn(){return Dn!==null}var Sn,Cn,wn,Tn,En,Dn,M,On,kn=t((()=>{C(),Sn=20,Cn=255,wn=50,Tn=50,En=.9,Dn=null,M=null,On=null})),An=n({hideIndicator:()=>Pn,indicateClick:()=>Ln,indicateDone:()=>zn,indicateKey:()=>In,indicateScroll:()=>Rn,indicateTyping:()=>Fn,showIndicator:()=>Mn,updateIndicator:()=>Nn});function jn(e,t){return`
593
+ Add-Type -AssemblyName System.Windows.Forms
594
+ Add-Type -AssemblyName System.Drawing
595
+ Add-Type @'
596
+ using System;
597
+ using System.Runtime.InteropServices;
598
+ public class Indicator {
599
+ [DllImport("user32.dll")] public static extern bool IsWindow(IntPtr h);
600
+ [DllImport("user32.dll",SetLastError=true)] public static extern int SetWindowLong(IntPtr h, int i, int v);
601
+ [DllImport("user32.dll",SetLastError=true)] public static extern int GetWindowLong(IntPtr h, int i);
602
+ [DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr h, IntPtr a, int x, int y, int w, int h2, uint f);
603
+ [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr h, out RECT r);
604
+ [StructLayout(LayoutKind.Sequential)] public struct RECT { public int L,T,R,B; }
605
+ public const int GWL_EXSTYLE = -20;
606
+ public const int WS_EX_LAYERED = 0x80000;
607
+ public const int WS_EX_TRANSPARENT = 0x20;
608
+ public const int WS_EX_TOOLWINDOW = 0x80;
609
+ public const int WS_EX_NOACTIVATE = 0x08000000;
610
+ public static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
611
+ public const uint SWP_NOACTIVATE = 0x0010;
612
+ public const uint SWP_SHOWWINDOW = 0x0040;
613
+ public static void MakeOverlay(IntPtr h) {
614
+ int ex = GetWindowLong(h, GWL_EXSTYLE);
615
+ ex |= WS_EX_LAYERED | WS_EX_TRANSPARENT | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE;
616
+ SetWindowLong(h, GWL_EXSTYLE, ex);
617
+ }
618
+ }
619
+ '@
620
+
621
+ $targetHwnd = [IntPtr]::new([long]${e})
622
+ $stopFile = '${t.replace(/\\/g,`\\\\`)}'
623
+ $msgFile = $stopFile + '.msg'
624
+
625
+ $form = New-Object System.Windows.Forms.Form
626
+ $form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::None
627
+ $form.ShowInTaskbar = $false
628
+ $form.TopMost = $true
629
+ $form.StartPosition = [System.Windows.Forms.FormStartPosition]::Manual
630
+ $form.Size = New-Object System.Drawing.Size(${Bn}, ${Vn})
631
+ $form.Location = New-Object System.Drawing.Point(-32000, -32000)
632
+ $form.BackColor = [System.Drawing.Color]::FromArgb(240, ${Hn})
633
+ $form.Opacity = 0.92
634
+
635
+ $label = New-Object System.Windows.Forms.Label
636
+ $label.Dock = [System.Windows.Forms.DockStyle]::Fill
637
+ $label.ForeColor = [System.Drawing.Color]::FromArgb(${Un})
638
+ $label.Font = New-Object System.Drawing.Font("Segoe UI", 10, [System.Drawing.FontStyle]::Regular)
639
+ $label.TextAlign = [System.Drawing.ContentAlignment]::MiddleLeft
640
+ $label.Padding = New-Object System.Windows.Forms.Padding(8, 0, 8, 0)
641
+ $label.Text = ""
642
+ $form.Controls.Add($label)
643
+
644
+ $form.Show()
645
+ [Indicator]::MakeOverlay($form.Handle)
646
+
647
+ $script:lastMsg = ""
648
+ $script:lastMsgTime = [DateTime]::MinValue
649
+ $script:visible = $false
650
+
651
+ $timer = New-Object System.Windows.Forms.Timer
652
+ $timer.Interval = 50 # 20fps
653
+
654
+ $timer.Add_Tick({
655
+ if (-not [Indicator]::IsWindow($targetHwnd)) {
656
+ $timer.Stop(); $form.Close()
657
+ [System.Windows.Forms.Application]::ExitThread()
658
+ return
659
+ }
660
+ if (Test-Path $stopFile) {
661
+ $timer.Stop(); $form.Close()
662
+ try { Remove-Item $stopFile -ErrorAction SilentlyContinue } catch {}
663
+ try { Remove-Item $msgFile -ErrorAction SilentlyContinue } catch {}
664
+ [System.Windows.Forms.Application]::ExitThread()
665
+ return
666
+ }
667
+
668
+ # Read new message
669
+ if (Test-Path $msgFile) {
670
+ try {
671
+ $msg = Get-Content $msgFile -Raw -Encoding UTF8 -ErrorAction SilentlyContinue
672
+ if ($msg) {
673
+ $script:lastMsg = $msg.Trim()
674
+ $script:lastMsgTime = [DateTime]::Now
675
+ Remove-Item $msgFile -ErrorAction SilentlyContinue
676
+ }
677
+ } catch {}
678
+ }
679
+
680
+ # Fade logic: hide after ${N}ms of no updates
681
+ $elapsed = ([DateTime]::Now - $script:lastMsgTime).TotalMilliseconds
682
+ if ($elapsed -gt ${N} -and $script:visible) {
683
+ $form.Visible = $false
684
+ $script:visible = $false
685
+ return
686
+ }
687
+ if ($elapsed -le ${N} -and $script:lastMsg -ne "") {
688
+ # Position at bottom-center of the bound window
689
+ $wr = New-Object Indicator+RECT
690
+ [Indicator]::GetWindowRect($targetHwnd, [ref]$wr) | Out-Null
691
+ $ww = $wr.R - $wr.L
692
+ $fx = $wr.L + [int](($ww - ${Bn}) / 2)
693
+ $fy = $wr.B - ${Vn} - 8
694
+ $label.Text = $script:lastMsg
695
+ [Indicator]::SetWindowPos($form.Handle, [Indicator]::HWND_TOPMOST,
696
+ $fx, $fy, 0, 0,
697
+ 0x0001 -bor [Indicator]::SWP_NOACTIVATE -bor [Indicator]::SWP_SHOWWINDOW) | Out-Null
698
+ $form.Visible = $true
699
+ $script:visible = $true
700
+ # Fade opacity near end
701
+ if ($elapsed -gt ${N*.7}) {
702
+ $form.Opacity = [Math]::Max(0.3, 0.92 * (1.0 - ($elapsed - ${N*.7}) / ${N*.3}))
703
+ } else {
704
+ $form.Opacity = 0.92
705
+ }
706
+ }
707
+ })
708
+
709
+ $timer.Start()
710
+ [System.Windows.Forms.Application]::Run()
711
+ `}function Mn(e){e=b(e),Pn();try{let t=bt(),n=Date.now();return P=de.join(t,`cu_indicator_stop_${n}`),F=de.join(t,`cu_indicator_${n}.ps1`),I=P+`.msg`,p.writeFileSync(F,jn(e,P),`utf-8`),Wn=Bun.spawn([`powershell`,`-NoProfile`,`-ExecutionPolicy`,`Bypass`,`-File`,F],{stdout:`ignore`,stderr:`ignore`}),!0}catch{return!1}}function Nn(e){if(I)try{p.writeFileSync(I,e,`utf-8`)}catch{}}function Pn(){if(P){try{p.writeFileSync(P,`STOP`,`utf-8`)}catch{}setTimeout(()=>{try{Wn?.kill()}catch{}try{F&&p.unlinkSync(F)}catch{}try{P&&p.unlinkSync(P)}catch{}try{I&&p.unlinkSync(I)}catch{}},2e3)}Wn=null,P=null,F=null,I=null}function Fn(e){Nn(`\u2328 Typing "${e.length>30?e.slice(0,30)+`...`:e}"`)}function In(e){Nn(`\u2328 ${e}`)}function Ln(e,t,n=`left`){Nn(`\uD83D\uDDB1 ${n===`right`?`Right-click`:`Click`} (${e}, ${t})`)}function Rn(e,t){Nn(`\uD83D\uDCDC Scroll ${e===`up`?`↑`:e===`down`?`↓`:e===`left`?`←`:`→`} ${t}`)}function zn(){Nn(`✅ Done`)}var Bn,Vn,N,Hn,Un,Wn,P,F,I,Gn=t((()=>{C(),Bn=350,Vn=28,N=2e3,Hn=`30, 30, 30`,Un=`220, 220, 220`,Wn=null,P=null,F=null,I=null})),Kn=n({call:()=>Jn,callSync:()=>Yn,ensureBridge:()=>qn,stopBridge:()=>Xn});function qn(){if(L)return!0;try{let e=de.join(__dirname,`bridge.py`);L=Bun.spawn([`python`,`-u`,e],{stdin:`pipe`,stdout:`pipe`,stderr:`ignore`,env:{...process.env,PYTHONIOENCODING:`utf-8`,PYTHONUNBUFFERED:`1`}});let t=L.stdout.getReader();return(async()=>{try{for(;;){let{done:e,value:n}=await t.read();if(e)break;z+=new TextDecoder().decode(n);let r;for(;(r=z.indexOf(`
712
+ `))!==-1;){let e=z.slice(0,r).trim();if(z=z.slice(r+1),e)try{let t=JSON.parse(e),n=R.get(t.id);n&&(R.delete(t.id),t.error?n.reject(Error(t.error)):n.resolve(t.result))}catch{}}}}catch{}})(),!0}catch{return L=null,!1}}async function Jn(e,t={},n=1e4){if(!qn())throw Error(`Python bridge not available`);let r=++Zn,i={id:r,method:e,params:t};return new Promise((t,a)=>{R.set(r,{resolve:t,reject:a});let o=setTimeout(()=>{R.delete(r),a(Error(`Bridge call ${e} timed out after ${n}ms`))},n),s=t,c=a;R.set(r,{resolve:e=>{clearTimeout(o),s(e)},reject:e=>{clearTimeout(o),c(e)}});try{let e=L.stdin;if(e){let t=e;t.write(JSON.stringify(i)+`
713
+ `),typeof t.flush==`function`&&t.flush()}}catch(e){clearTimeout(o),R.delete(r),a(Error(`Bridge write failed: ${e}`))}})}function Yn(e,t={},n=1e4){try{let r=de.join(__dirname,`bridge.py`),i=JSON.stringify({id:1,method:e,params:t}),a=Bun.spawnSync({cmd:[`python`,`-u`,r],stdin:Buffer.from(i+`
714
+ `),stdout:`pipe`,stderr:`pipe`,env:{...process.env,PYTHONIOENCODING:`utf-8`},timeout:n}),o=new TextDecoder().decode(a.stdout).trim();if(!o)return null;let s=JSON.parse(o);if(s.error)throw Error(s.error);return s.result}catch{return null}}function Xn(){if(L){try{let e=L.stdin;if(e){let t=e;typeof t.end==`function`&&t.end()}L.kill()}catch{}L=null}R.clear(),z=``}var L,Zn,R,z,Qn=t((()=>{L=null,Zn=0,R=new Map,z=``})),B=n({clearEditChildCache:()=>$n,consoleKey:()=>or,consoleText:()=>sr,findEditChild:()=>er,resolveInputHwnd:()=>V,sendChar:()=>tr,sendClick:()=>cr,sendKey:()=>ir,sendKeys:()=>ar,sendMouseDown:()=>lr,sendMouseMove:()=>dr,sendMouseUp:()=>ur,sendMouseWheel:()=>fr,sendText:()=>rr});function $n(e){e?H.delete(e):H.clear()}function V(e){return e=b(e),er(e)??e}function er(e){if(e=b(e),H.has(e))return H.get(e);let t=S(`${U}
715
+ [WinMsg]::FindChildren([IntPtr]::new([long]${e}))
716
+ [WinMsg]::childResults | ForEach-Object { $_ }
717
+ `);if(t){let n=t.split(`
718
+ `).filter(Boolean).map(e=>{let t=e.trim(),n=t.indexOf(`|`);return n===-1?null:{hwnd:t.slice(0,n),className:t.slice(n+1)}}).filter(e=>e!==null);for(let t of pr){let r=n.find(e=>e.className===t);if(r)return H.set(e,r.hwnd),r.hwnd}}let n=S(`
719
+ Add-Type -AssemblyName UIAutomationClient
720
+ Add-Type -AssemblyName UIAutomationTypes
721
+ Add-Type @'
722
+ using System;
723
+ using System.Runtime.InteropServices;
724
+ public class UiaHelper {
725
+ [DllImport("user32.dll")]
726
+ public static extern bool IsWindow(IntPtr hWnd);
727
+ }
728
+ '@
729
+ try {
730
+ $el = [System.Windows.Automation.AutomationElement]::FromHandle([IntPtr]::new([long]${e}))
731
+ if ($el -eq $null) { Write-Output 'NONE'; exit }
732
+
733
+ # Search for Edit or Document control types (covers text editors)
734
+ $editCond = [System.Windows.Automation.PropertyCondition]::new(
735
+ [System.Windows.Automation.AutomationElement]::ControlTypeProperty,
736
+ [System.Windows.Automation.ControlType]::Edit)
737
+ $docCond = [System.Windows.Automation.PropertyCondition]::new(
738
+ [System.Windows.Automation.AutomationElement]::ControlTypeProperty,
739
+ [System.Windows.Automation.ControlType]::Document)
740
+ $orCond = [System.Windows.Automation.OrCondition]::new($editCond, $docCond)
741
+
742
+ $found = $el.FindFirst([System.Windows.Automation.TreeScope]::Descendants, $orCond)
743
+ if ($found -eq $null) { Write-Output 'NONE'; exit }
744
+
745
+ $nativeHwnd = $found.Current.NativeWindowHandle
746
+ if ($nativeHwnd -ne 0) {
747
+ Write-Output $nativeHwnd
748
+ } else {
749
+ Write-Output 'NONE'
750
+ }
751
+ } catch {
752
+ Write-Output 'NONE'
753
+ }
754
+ `);if(n&&n!==`NONE`){let t=n.trim();if(t&&t!==`0`)return H.set(e,t),t}return H.set(e,null),null}function tr(e,t){e=b(e);let n=t.codePointAt(0);if(n===void 0)return!1;let r=`[IntPtr]::new([long]${e})`;return n<=65535?S(`${U}
755
+ [WinMsg]::SendMessage(${r}, [WinMsg]::WM_CHAR, [IntPtr]${n}, [IntPtr]0)
756
+ `)!==null:S(`${U}
757
+ [WinMsg]::SendMessage(${r}, [WinMsg]::WM_CHAR, [IntPtr]${Math.floor((n-65536)/1024)+55296}, [IntPtr]0)
758
+ [WinMsg]::SendMessage(${r}, [WinMsg]::WM_CHAR, [IntPtr]${(n-65536)%1024+56320}, [IntPtr]0)
759
+ `)!==null}function nr(e,t){let n=`[IntPtr]::new([long]${e})`,r=[];for(let e of t){let t=e.codePointAt(0);if(t<=65535)r.push(`[WinMsg]::SendMessage(${n}, [WinMsg]::WM_CHAR, [IntPtr]${t}, [IntPtr]0)`);else{let e=Math.floor((t-65536)/1024)+55296,i=(t-65536)%1024+56320;r.push(`[WinMsg]::SendMessage(${n}, [WinMsg]::WM_CHAR, [IntPtr]${e}, [IntPtr]0)`),r.push(`[WinMsg]::SendMessage(${n}, [WinMsg]::WM_CHAR, [IntPtr]${i}, [IntPtr]0)`)}}return r}function rr(e,t){return S(`${U}
760
+ ${nr(V(e),t).join(`
761
+ `)}
762
+ `)!==null}function ir(e,t,n){return e=b(e),S(`${U}
763
+ [WinMsg]::PostMessage([IntPtr]::new([long]${e}), ${n===`down`?`0x0100`:`0x0101`}, [IntPtr]${t}, [WinMsg]::${n===`down`?`KeyDownLParam`:`KeyUpLParam`}(${t}))
764
+ `)!==null}function ar(e,t){if(e=V(e),t.length===0)return!1;let n=[],r;for(let e of t){let t=e.toLowerCase(),i=xt[t];if(i!==void 0)St.has(t)?n.push(i):r=i;else if(t.length===1)r=t.toUpperCase().charCodeAt(0);else return!1}if(r===void 0)return!1;let i=`[IntPtr]::new([long]${e})`,a=[];for(let e of n)a.push(`[WinMsg]::PostMessage(${i}, [WinMsg]::WM_KEYDOWN, [IntPtr]${e}, [WinMsg]::KeyDownLParam(${e}))`);a.push(`[WinMsg]::PostMessage(${i}, [WinMsg]::WM_KEYDOWN, [IntPtr]${r}, [WinMsg]::KeyDownLParam(${r}))`),a.push(`[WinMsg]::PostMessage(${i}, [WinMsg]::WM_KEYUP, [IntPtr]${r}, [WinMsg]::KeyUpLParam(${r}))`);for(let e of[...n].reverse())a.push(`[WinMsg]::PostMessage(${i}, [WinMsg]::WM_KEYUP, [IntPtr]${e}, [WinMsg]::KeyUpLParam(${e}))`);return S(`${U}
765
+ ${a.join(`
766
+ `)}
767
+ `)!==null}function or(e,t,n=`\0`){e=b(e);let r=n.charCodeAt(0);return S(`${mr}
768
+ [ConsoleInput]::SendKeyToConsole([IntPtr]::new([long]${e}), ${t}, [char]${r})
769
+ `)!==null}function sr(e,t){e=b(e);let n=t.replace(/'/g,`''`);return S(`${mr}
770
+ [ConsoleInput]::SendTextToConsole([IntPtr]::new([long]${e}), '${n}')
771
+ `)!==null}function cr(e,t,n,r){e=V(e);let i=r===`left`?`0x0201`:`0x0204`,a=r===`left`?`0x0202`:`0x0205`,o=`[IntPtr]::new([long]${e})`;return S(`${U}
772
+ $lp = [WinMsg]::MakeLParam(${t}, ${n})
773
+ [WinMsg]::SendMessage(${o}, ${i}, [IntPtr]0, $lp)
774
+ [WinMsg]::SendMessage(${o}, ${a}, [IntPtr]0, $lp)
775
+ `)!==null}function lr(e,t,n){return e=V(e),S(`${U}
776
+ $lp = [WinMsg]::MakeLParam(${t}, ${n})
777
+ [WinMsg]::SendMessage([IntPtr]::new([long]${e}), [WinMsg]::WM_LBUTTONDOWN, [IntPtr]1, $lp)
778
+ `)!==null}function ur(e,t,n){return e=V(e),S(`${U}
779
+ $lp = [WinMsg]::MakeLParam(${t}, ${n})
780
+ [WinMsg]::SendMessage([IntPtr]::new([long]${e}), [WinMsg]::WM_LBUTTONUP, [IntPtr]0, $lp)
781
+ `)!==null}function dr(e,t,n){return e=V(e),S(`${U}
782
+ $lp = [WinMsg]::MakeLParam(${t}, ${n})
783
+ [WinMsg]::SendMessage([IntPtr]::new([long]${e}), 0x0200, [IntPtr]1, $lp)
784
+ `)!==null}function fr(e,t,n,r,i=!1){e=V(e);let a=i?`0x020E`:`0x020A`,o=Math.round(r)*120;return S(`${U}
785
+ # WM_MOUSEWHEEL/WM_MOUSEHWHEEL require screen coords in lParam
786
+ # and wheel delta in high word of wParam
787
+ Add-Type @'
788
+ using System;
789
+ using System.Runtime.InteropServices;
790
+ public class WheelHelper {
791
+ [DllImport("user32.dll")] public static extern bool ClientToScreen(IntPtr hWnd, ref POINT p);
792
+ [StructLayout(LayoutKind.Sequential)] public struct POINT { public int X, Y; }
793
+
794
+ [DllImport("user32.dll", CharSet=CharSet.Unicode, EntryPoint="SendMessageW")]
795
+ public static extern IntPtr SendMsg(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
796
+
797
+ public static void Scroll(IntPtr hWnd, int clientX, int clientY, int delta, uint msg) {
798
+ POINT pt; pt.X = clientX; pt.Y = clientY;
799
+ ClientToScreen(hWnd, ref pt);
800
+ IntPtr wParam = (IntPtr)(delta << 16);
801
+ IntPtr lParam = (IntPtr)((pt.Y << 16) | (pt.X & 0xFFFF));
802
+ SendMsg(hWnd, msg, wParam, lParam);
803
+ }
804
+ }
805
+ '@
806
+ [WheelHelper]::Scroll([IntPtr]::new([long]${e}), ${t}, ${n}, ${o}, ${a})
807
+ `)!==null}var H,U,pr,mr,W=t((()=>{C(),H=new Map,U=`
808
+ Add-Type @'
809
+ using System;
810
+ using System.Collections.Generic;
811
+ using System.Runtime.InteropServices;
812
+ using System.Text;
813
+
814
+ public class WinMsg {
815
+ public delegate bool EnumChildProc(IntPtr hWnd, IntPtr lParam);
816
+
817
+ [DllImport("user32.dll")]
818
+ public static extern bool EnumChildWindows(IntPtr parent, EnumChildProc proc, IntPtr lParam);
819
+
820
+ [DllImport("user32.dll", CharSet=CharSet.Unicode)]
821
+ public static extern int GetClassName(IntPtr h, StringBuilder sb, int max);
822
+
823
+ // CRITICAL: CharSet.Unicode → resolves to SendMessageW
824
+ // SendMessageW sends Unicode WM_CHAR (full UTF-16 codepoints including CJK)
825
+ [DllImport("user32.dll", CharSet=CharSet.Unicode, EntryPoint="SendMessageW")]
826
+ public static extern IntPtr SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
827
+
828
+ [DllImport("user32.dll", CharSet=CharSet.Unicode, EntryPoint="PostMessageW")]
829
+ public static extern bool PostMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
830
+
831
+ [DllImport("user32.dll")]
832
+ public static extern uint MapVirtualKeyW(uint uCode, uint uMapType);
833
+
834
+ public static IntPtr MakeLParam(int lo, int hi) {
835
+ return (IntPtr)((hi << 16) | (lo & 0xFFFF));
836
+ }
837
+
838
+ // Build lParam for WM_KEYDOWN / WM_KEYUP with correct scan code
839
+ // lParam bits: 0-15 repeat count, 16-23 scan code, 24 extended, 30 prev state, 31 transition
840
+ public static IntPtr KeyDownLParam(uint vk) {
841
+ uint scanCode = MapVirtualKeyW(vk, 0); // MAPVK_VK_TO_VSC = 0
842
+ return (IntPtr)(1 | (scanCode << 16)); // repeat=1, scanCode in bits 16-23
843
+ }
844
+ public static IntPtr KeyUpLParam(uint vk) {
845
+ uint scanCode = MapVirtualKeyW(vk, 0);
846
+ return (IntPtr)(1 | (scanCode << 16) | (1 << 30) | (1u << 31)); // prev=1, transition=1
847
+ }
848
+
849
+ public const uint WM_CHAR = 0x0102;
850
+ public const uint WM_KEYDOWN = 0x0100;
851
+ public const uint WM_KEYUP = 0x0101;
852
+ public const uint WM_LBUTTONDOWN = 0x0201;
853
+ public const uint WM_LBUTTONUP = 0x0202;
854
+ public const uint WM_RBUTTONDOWN = 0x0204;
855
+ public const uint WM_RBUTTONUP = 0x0205;
856
+
857
+ public static List<string> childResults = new List<string>();
858
+
859
+ public static void FindChildren(IntPtr parent) {
860
+ childResults.Clear();
861
+ EnumChildWindows(parent, delegate(IntPtr hWnd, IntPtr lParam) {
862
+ StringBuilder sb = new StringBuilder(256);
863
+ GetClassName(hWnd, sb, sb.Capacity);
864
+ childResults.Add(hWnd.ToInt64() + "|" + sb.ToString());
865
+ return true;
866
+ }, IntPtr.Zero);
867
+ }
868
+ }
869
+ '@
870
+ `,pr=[`Windows.UI.Input.InputSite.WindowClass`,`RichEditD2DPT`,`RichEdit20W`,`Edit`,`Scintilla`,`Chrome_RenderWidgetHostHWND`,`TextBox`,`RichTextBox`,`Windows.UI.Core.CoreWindow`],mr=`
871
+ Add-Type @'
872
+ using System;
873
+ using System.Runtime.InteropServices;
874
+
875
+ public class ConsoleInput {
876
+ [DllImport("kernel32.dll", SetLastError=true)]
877
+ public static extern bool AttachConsole(uint dwProcessId);
878
+
879
+ [DllImport("kernel32.dll", SetLastError=true)]
880
+ public static extern bool FreeConsole();
881
+
882
+ [DllImport("kernel32.dll", SetLastError=true)]
883
+ public static extern IntPtr GetStdHandle(int nStdHandle);
884
+
885
+ [DllImport("kernel32.dll", CharSet=CharSet.Unicode, SetLastError=true)]
886
+ public static extern bool WriteConsoleInput(
887
+ IntPtr hConsoleInput,
888
+ INPUT_RECORD[] lpBuffer,
889
+ uint nLength,
890
+ out uint lpNumberOfEventsWritten);
891
+
892
+ [DllImport("kernel32.dll")]
893
+ public static extern uint MapVirtualKeyW(uint uCode, uint uMapType);
894
+
895
+ [DllImport("user32.dll")]
896
+ public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
897
+
898
+ public const int STD_INPUT_HANDLE = -10;
899
+
900
+ [StructLayout(LayoutKind.Explicit)]
901
+ public struct INPUT_RECORD {
902
+ [FieldOffset(0)] public ushort EventType;
903
+ [FieldOffset(4)] public KEY_EVENT_RECORD KeyEvent;
904
+ }
905
+
906
+ [StructLayout(LayoutKind.Explicit, CharSet=CharSet.Unicode)]
907
+ public struct KEY_EVENT_RECORD {
908
+ [FieldOffset(0)] public bool bKeyDown;
909
+ [FieldOffset(4)] public ushort wRepeatCount;
910
+ [FieldOffset(6)] public ushort wVirtualKeyCode;
911
+ [FieldOffset(8)] public ushort wVirtualScanCode;
912
+ [FieldOffset(10)] public char UnicodeChar;
913
+ [FieldOffset(12)] public uint dwControlKeyState;
914
+ }
915
+
916
+ public static bool SendKeyToConsole(IntPtr hwnd, ushort vk, char ch) {
917
+ uint pid;
918
+ GetWindowThreadProcessId(hwnd, out pid);
919
+ if (pid == 0) return false;
920
+
921
+ FreeConsole();
922
+ if (!AttachConsole(pid)) return false;
923
+
924
+ try {
925
+ IntPtr hInput = GetStdHandle(STD_INPUT_HANDLE);
926
+ if (hInput == IntPtr.Zero || hInput == (IntPtr)(-1)) return false;
927
+
928
+ ushort scanCode = (ushort)MapVirtualKeyW(vk, 0);
929
+ INPUT_RECORD[] records = new INPUT_RECORD[2];
930
+
931
+ // Key down
932
+ records[0].EventType = 1; // KEY_EVENT
933
+ records[0].KeyEvent.bKeyDown = true;
934
+ records[0].KeyEvent.wRepeatCount = 1;
935
+ records[0].KeyEvent.wVirtualKeyCode = vk;
936
+ records[0].KeyEvent.wVirtualScanCode = scanCode;
937
+ records[0].KeyEvent.UnicodeChar = ch;
938
+ records[0].KeyEvent.dwControlKeyState = 0;
939
+
940
+ // Key up
941
+ records[1].EventType = 1;
942
+ records[1].KeyEvent.bKeyDown = false;
943
+ records[1].KeyEvent.wRepeatCount = 1;
944
+ records[1].KeyEvent.wVirtualKeyCode = vk;
945
+ records[1].KeyEvent.wVirtualScanCode = scanCode;
946
+ records[1].KeyEvent.UnicodeChar = ch;
947
+ records[1].KeyEvent.dwControlKeyState = 0;
948
+
949
+ uint written;
950
+ return WriteConsoleInput(hInput, records, 2, out written);
951
+ } finally {
952
+ FreeConsole();
953
+ }
954
+ }
955
+
956
+ public static bool SendTextToConsole(IntPtr hwnd, string text) {
957
+ uint pid;
958
+ GetWindowThreadProcessId(hwnd, out pid);
959
+ if (pid == 0) return false;
960
+
961
+ FreeConsole();
962
+ if (!AttachConsole(pid)) return false;
963
+
964
+ try {
965
+ IntPtr hInput = GetStdHandle(STD_INPUT_HANDLE);
966
+ if (hInput == IntPtr.Zero || hInput == (IntPtr)(-1)) return false;
967
+
968
+ INPUT_RECORD[] records = new INPUT_RECORD[text.Length * 2];
969
+ for (int i = 0; i < text.Length; i++) {
970
+ char c = text[i];
971
+ ushort vk = 0;
972
+ ushort sc = 0;
973
+
974
+ // Key down
975
+ records[i * 2].EventType = 1;
976
+ records[i * 2].KeyEvent.bKeyDown = true;
977
+ records[i * 2].KeyEvent.wRepeatCount = 1;
978
+ records[i * 2].KeyEvent.wVirtualKeyCode = vk;
979
+ records[i * 2].KeyEvent.wVirtualScanCode = sc;
980
+ records[i * 2].KeyEvent.UnicodeChar = c;
981
+ records[i * 2].KeyEvent.dwControlKeyState = 0;
982
+
983
+ // Key up
984
+ records[i * 2 + 1].EventType = 1;
985
+ records[i * 2 + 1].KeyEvent.bKeyDown = false;
986
+ records[i * 2 + 1].KeyEvent.wRepeatCount = 1;
987
+ records[i * 2 + 1].KeyEvent.wVirtualKeyCode = vk;
988
+ records[i * 2 + 1].KeyEvent.wVirtualScanCode = sc;
989
+ records[i * 2 + 1].KeyEvent.UnicodeChar = c;
990
+ records[i * 2 + 1].KeyEvent.dwControlKeyState = 0;
991
+ }
992
+
993
+ uint written;
994
+ return WriteConsoleInput(hInput, records, (uint)records.Length, out written);
995
+ } finally {
996
+ FreeConsole();
997
+ }
998
+ }
999
+ }
1000
+ '@
1001
+ `})),G=n({bindFile:()=>br,bindWindow:()=>yr,getBoundAppType:()=>vr,getBoundHwnd:()=>_r,platform:()=>Pr,unbindWindow:()=>xr});function hr(){if(!wr)try{wr=(Qn(),e(Kn))}catch{}return wr}function gr(e,t={}){try{let n=hr();return n?n.callSync(e,t):null}catch{return null}}function _r(){return q}function vr(){return Er}function yr(e,t){e=b(e),q&&(mn(q),bn(),Pn()),q=e,Er=`generic`,Dr=null,x(`
1002
+ Add-Type @'
1003
+ using System;
1004
+ using System.Runtime.InteropServices;
1005
+ public class CuActivate {
1006
+ [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();
1007
+ [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr h);
1008
+ [DllImport("user32.dll")] public static extern bool IsIconic(IntPtr h);
1009
+ [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr h, int cmd);
1010
+ }
1011
+ '@
1012
+ $prev = [CuActivate]::GetForegroundWindow()
1013
+ $target = [IntPtr]::new([long]${e})
1014
+ if ([CuActivate]::IsIconic($target)) { [CuActivate]::ShowWindow($target, 9) | Out-Null }
1015
+ [CuActivate]::SetForegroundWindow($target) | Out-Null
1016
+ Start-Sleep -Milliseconds 100
1017
+ if ($prev -ne [IntPtr]::Zero -and $prev -ne $target) {
1018
+ [CuActivate]::SetForegroundWindow($prev) | Out-Null
1019
+ }
1020
+ `),pn(e),vn(e),Mn(e)}function br(e,t){q=null,Er=t,Dr=e}function xr(){q&&mn(q),bn(),Pn(),K().clearEditChildCache(),q=null,Er=null,Dr=null}function K(){return Or??(Or=(W(),e(B)))}function Sr(e){let t=jt(),n=e.toLowerCase();for(let e of t)if((e.title??``).toLowerCase().includes(n))return{hwnd:e.hwnd,pid:e.pid};return null}function Cr(){bn(),Pn();try{hr()?.stopBridge()}catch{}}var wr,Tr,q,Er,Dr,Or,kr,Ar,jr,Mr,J,Nr,Pr,Y=t((()=>{w(),fn(),hn(),kn(),Gn(),C(),Tr=`
1021
+ Add-Type -Language CSharp @'
1022
+ using System;
1023
+ using System.Runtime.InteropServices;
1024
+ using System.Text;
1025
+ using System.Diagnostics;
1026
+
1027
+ public class CuWin32 {
1028
+ // --- Cursor ---
1029
+ [DllImport("user32.dll")] public static extern bool SetCursorPos(int X, int Y);
1030
+ [DllImport("user32.dll")] public static extern bool GetCursorPos(out POINT p);
1031
+ [StructLayout(LayoutKind.Sequential)] public struct POINT { public int X; public int Y; }
1032
+
1033
+ // --- SendInput ---
1034
+ [StructLayout(LayoutKind.Sequential)] public struct MOUSEINPUT {
1035
+ public int dx; public int dy; public int mouseData; public uint dwFlags; public uint time; public IntPtr dwExtraInfo;
1036
+ }
1037
+ [StructLayout(LayoutKind.Explicit)] public struct INPUT {
1038
+ [FieldOffset(0)] public uint type;
1039
+ [FieldOffset(4)] public MOUSEINPUT mi;
1040
+ }
1041
+ [StructLayout(LayoutKind.Sequential)] public struct KEYBDINPUT {
1042
+ public ushort wVk; public ushort wScan; public uint dwFlags; public uint time; public IntPtr dwExtraInfo;
1043
+ }
1044
+ [StructLayout(LayoutKind.Explicit)] public struct KINPUT {
1045
+ [FieldOffset(0)] public uint type;
1046
+ [FieldOffset(4)] public KEYBDINPUT ki;
1047
+ }
1048
+ [DllImport("user32.dll", SetLastError=true)] public static extern uint SendInput(uint n, INPUT[] i, int cb);
1049
+ [DllImport("user32.dll", SetLastError=true)] public static extern uint SendInput(uint n, KINPUT[] i, int cb);
1050
+
1051
+ // --- Keyboard ---
1052
+ [DllImport("user32.dll")] public static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo);
1053
+ [DllImport("user32.dll")] public static extern short VkKeyScan(char ch);
1054
+
1055
+ // --- Window ---
1056
+ [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();
1057
+ [DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint pid);
1058
+ [DllImport("user32.dll", CharSet=CharSet.Unicode)] public static extern int GetWindowText(IntPtr hWnd, StringBuilder sb, int max);
1059
+
1060
+ // Constants
1061
+ public const uint INPUT_MOUSE = 0, INPUT_KEYBOARD = 1;
1062
+ public const uint MOUSEEVENTF_LEFTDOWN = 0x0002, MOUSEEVENTF_LEFTUP = 0x0004;
1063
+ public const uint MOUSEEVENTF_RIGHTDOWN = 0x0008, MOUSEEVENTF_RIGHTUP = 0x0010;
1064
+ public const uint MOUSEEVENTF_MIDDLEDOWN = 0x0020, MOUSEEVENTF_MIDDLEUP = 0x0040;
1065
+ public const uint MOUSEEVENTF_WHEEL = 0x0800, MOUSEEVENTF_HWHEEL = 0x1000;
1066
+ public const uint KEYEVENTF_KEYUP = 0x0002;
1067
+ }
1068
+ '@
1069
+ `,q=null,Er=null,Dr=null,kr={async moveMouse(e,t){if(q){yn(Math.round(e),Math.round(t));return}x(`${Tr}; [CuWin32]::SetCursorPos(${Math.round(e)}, ${Math.round(t)}) | Out-Null`)},async click(e,t,n){if(q){yn(Math.round(e),Math.round(t),!0);let r=K().findEditChild(q)??q;K().sendClick(r,Math.round(e),Math.round(t),n)||K().sendClick(q,Math.round(e),Math.round(t),n);return}x(`${Tr}; [CuWin32]::SetCursorPos(${Math.round(e)}, ${Math.round(t)}) | Out-Null; $i = New-Object CuWin32+INPUT; $i.type=[CuWin32]::INPUT_MOUSE; $i.mi.dwFlags=[CuWin32]::${n===`left`?`MOUSEEVENTF_LEFTDOWN`:n===`right`?`MOUSEEVENTF_RIGHTDOWN`:`MOUSEEVENTF_MIDDLEDOWN`}; [CuWin32]::SendInput(1, @($i), [Runtime.InteropServices.Marshal]::SizeOf($i)) | Out-Null; $i.mi.dwFlags=[CuWin32]::${n===`left`?`MOUSEEVENTF_LEFTUP`:n===`right`?`MOUSEEVENTF_RIGHTUP`:`MOUSEEVENTF_MIDDLEUP`}; [CuWin32]::SendInput(1, @($i), [Runtime.InteropServices.Marshal]::SizeOf($i)) | Out-Null`)},async typeText(t){if(Er===`word`&&Dr){let{appendText:n}=(an(),e(Gt));n(Dr,t);return}if(q){if(!K().sendText(q,t))throw Error(`typeText failed: SendMessage to HWND ${q} returned false. The edit control may not have been found (findEditChild returned null).`);return}throw Error(`typeText requires a bound window or file. Call open() first.`)},async key(e,t){if(q){let n=xt[e.toLowerCase()]??(e.length===1?e.charCodeAt(0):0);n&&K().sendKey(q,n,t===`release`?`up`:`down`);return}throw Error(`key requires a bound window HWND. Call open() first.`)},async keys(e){if(q){if(!K().sendKeys(q,e))throw Error(`keys [${e.join(`+`)}] failed on HWND ${q}`);return}throw Error(`keys requires a bound window HWND. Call open() first.`)},async scroll(e,t){if(q){let n=t===`vertical`?`0x0115`:`0x0114`,r=e>0?`1`:`0`,i=Math.abs(Math.round(e)),a=`
1070
+ Add-Type @'
1071
+ using System;
1072
+ using System.Runtime.InteropServices;
1073
+ public class WScroll {
1074
+ [DllImport("user32.dll", CharSet=CharSet.Unicode, EntryPoint="SendMessageW")]
1075
+ public static extern IntPtr SendMessage(IntPtr h, uint m, IntPtr w, IntPtr l);
1076
+ }
1077
+ '@
1078
+ `;for(let e=0;e<i;e++)a+=`[WScroll]::SendMessage([IntPtr]::new([long]${q}), ${n}, [IntPtr]${r}, [IntPtr]::Zero) | Out-Null; `;x(a);return}x(`${Tr}; $i = New-Object CuWin32+INPUT; $i.type=[CuWin32]::INPUT_MOUSE; $i.mi.dwFlags=[CuWin32]::${t===`vertical`?`MOUSEEVENTF_WHEEL`:`MOUSEEVENTF_HWHEEL`}; $i.mi.mouseData=${e*120}; [CuWin32]::SendInput(1, @($i), [Runtime.InteropServices.Marshal]::SizeOf($i)) | Out-Null`)},async mouseLocation(){let[e,t]=x(`${Tr}; $p = New-Object CuWin32+POINT; [CuWin32]::GetCursorPos([ref]$p) | Out-Null; "$($p.X),$($p.Y)"`).split(`,`);return{x:Number(e),y:Number(t)}},async sendChar(e,t){K().sendChar(String(e),t)},async sendKey(e,t,n){K().sendKey(String(e),t,n)},async sendClick(e,t,n,r){K().sendClick(String(e),t,n,r)},async sendText(e,t){K().sendText(String(e),t)}},Ar={async captureScreen(e){if(q){let e=await this.captureWindow?.(String(q));if(e)return e}let t=gr(`screenshot`,{display_id:e??0});if(t&&t.base64)return t;throw Error(`[computer-use] Screenshot failed: Python bridge returned no data. Ensure python3 + mss + Pillow are installed (pip install mss Pillow).`)},async captureRegion(e,t,n,r){if(q){let e=await this.captureWindow?.(String(q));if(e)return e}return this.captureScreen()},async captureWindow(e){let t=gr(`screenshot_window`,{hwnd:String(e)});if(t&&t.base64)return t;throw Error(`[computer-use] Window screenshot failed for HWND ${e}: Python bridge returned no data.`)}},jr={listAll(){try{return x(`
1079
+ Add-Type -AssemblyName System.Windows.Forms
1080
+ $result = @()
1081
+ $idx = 0
1082
+ foreach ($s in [System.Windows.Forms.Screen]::AllScreens) {
1083
+ $result += "$($s.Bounds.Width),$($s.Bounds.Height),$idx,$($s.Primary)"
1084
+ $idx++
1085
+ }
1086
+ $result -join "|"
1087
+ `).split(`|`).filter(Boolean).map(e=>{let[t,n,r]=e.split(`,`);return{width:Number(t),height:Number(n),scaleFactor:1,displayId:Number(r)}})}catch{return[{width:1920,height:1080,scaleFactor:1,displayId:0}]}},getSize(e){let t=this.listAll();if(e!==void 0){let n=t.find(t=>t.displayId===e);if(n)return n}return t[0]??{width:1920,height:1080,scaleFactor:1,displayId:0}}},Mr={listRunning(){return jt().map(e=>({id:String(e.hwnd),pid:e.pid,title:e.title}))},async listInstalled(){try{return(await yt(`
1088
+ $apps = @()
1089
+
1090
+ # Traditional Win32 apps from registry
1091
+ $paths = @(
1092
+ 'HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*',
1093
+ 'HKLM:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*',
1094
+ 'HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*'
1095
+ )
1096
+ foreach ($p in $paths) {
1097
+ Get-ItemProperty $p -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName } | ForEach-Object {
1098
+ $apps += "$($_.DisplayName)|$($_.InstallLocation)|$($_.PSChildName)"
1099
+ }
1100
+ }
1101
+
1102
+ # UWP/MSIX apps (Windows 10/11 Store apps)
1103
+ Get-AppxPackage -ErrorAction SilentlyContinue | Where-Object { $_.IsFramework -eq $false -and $_.SignatureKind -eq 'Store' } | ForEach-Object {
1104
+ $cleanName = $_.Name -replace '^Microsoft\\.Windows', '' -replace '^Microsoft\\.', ''
1105
+ $apps += "$cleanName|$($_.InstallLocation)|$($_.PackageFamilyName)"
1106
+ }
1107
+
1108
+ $apps | Select-Object -Unique | Select-Object -First 300
1109
+ `)).split(`
1110
+ `).filter(Boolean).map(e=>{let[t,n,r]=e.trim().split(`|`,3);return{id:(r??t??``).trim(),displayName:(t??``).trim(),path:(n??``).trim()}})}catch{return[]}},async open(e){let t=on(e);if(t===`excel`||t===`word`){let t=await sn(e);t.filePath&&br(t.filePath,t.type);return}let n=e;if(e.includes(`_`)&&e.includes(`.`)){let t=e.split(`_`)[0]?.split(`.`)??[],r=t[t.length-1]??e;n=r.replace(/^Windows/,``)||r}let r=Sr(n);if(r){yr(r.hwnd,r.pid);return}let i=n.replace(/'/g,`''`),a=await yt(`
1111
+ ${Tr}
1112
+ Add-Type @'
1113
+ using System;
1114
+ using System.Runtime.InteropServices;
1115
+ using System.Text;
1116
+ public class CuLaunch {
1117
+ public delegate bool EnumProc(IntPtr h, IntPtr lp);
1118
+ [DllImport("user32.dll")] public static extern bool EnumWindows(EnumProc cb, IntPtr lp);
1119
+ [DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr h);
1120
+ [DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr h, out uint pid);
1121
+ [DllImport("user32.dll", CharSet=CharSet.Unicode)] public static extern int GetWindowText(IntPtr h, StringBuilder sb, int n);
1122
+ [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr h, int cmd);
1123
+ public const int SW_SHOWMINNOACTIVE = 7;
1124
+ // Get all visible window HWNDs as array
1125
+ public static long[] GetAllVisibleHwnds() {
1126
+ var list = new System.Collections.Generic.List<long>();
1127
+ EnumWindows((h, _) => {
1128
+ if (IsWindowVisible(h)) list.Add(h.ToInt64());
1129
+ return true;
1130
+ }, IntPtr.Zero);
1131
+ return list.ToArray();
1132
+ }
1133
+ // Get PID for a single HWND
1134
+ public static uint GetPidForHwnd(long hwnd) {
1135
+ uint pid; GetWindowThreadProcessId((IntPtr)hwnd, out pid);
1136
+ return pid;
1137
+ }
1138
+ // Get title for a single HWND
1139
+ public static string GetTitle(long hwnd) {
1140
+ var sb = new StringBuilder(256);
1141
+ GetWindowText((IntPtr)hwnd, sb, 256);
1142
+ return sb.ToString();
1143
+ }
1144
+ }
1145
+ '@
1146
+ # Launch strategy: all exe-based, no GUI dialogs.
1147
+ # 1) exact path 2) exe in PATH 3) registry install dir 4) raw name
1148
+ $target = '${i}'
1149
+ $proc = $null
1150
+
1151
+ # 1. Exact file path
1152
+ if (Test-Path $target) {
1153
+ $proc = Start-Process $target -PassThru -ErrorAction SilentlyContinue
1154
+ }
1155
+
1156
+ # 2. exe name in PATH (notepad.exe, code.exe, chrome.exe, etc.)
1157
+ if (-not $proc) {
1158
+ # Try with .exe suffix if not already
1159
+ $tryExe = if ($target -notmatch '[.]exe$') { "$target.exe" } else { $target }
1160
+ $found = Get-Command $tryExe -ErrorAction SilentlyContinue | Select-Object -First 1
1161
+ if (-not $found) { $found = Get-Command $target -ErrorAction SilentlyContinue | Select-Object -First 1 }
1162
+ if ($found) { $proc = Start-Process $found.Source -PassThru -ErrorAction SilentlyContinue }
1163
+ }
1164
+
1165
+ # 3. Search registry for install location by display name → find .exe
1166
+ if (-not $proc) {
1167
+ $regPaths = @('HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*','HKLM:\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*','HKCU:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\*')
1168
+ foreach ($p in $regPaths) {
1169
+ $app = Get-ItemProperty $p -ErrorAction SilentlyContinue | Where-Object {
1170
+ $_.DisplayName -and $_.DisplayName -match [regex]::Escape($target)
1171
+ } | Select-Object -First 1
1172
+ if ($app) {
1173
+ # Try DisplayIcon (often the exe path), then InstallLocation
1174
+ $exePath = $null
1175
+ if ($app.DisplayIcon -and $app.DisplayIcon -match '[.]exe') {
1176
+ $exePath = ($app.DisplayIcon -split ',')[0].Trim('"')
1177
+ }
1178
+ if (-not $exePath -and $app.InstallLocation) {
1179
+ $exeFile = Get-ChildItem $app.InstallLocation -Filter '*.exe' -ErrorAction SilentlyContinue | Select-Object -First 1
1180
+ if ($exeFile) { $exePath = $exeFile.FullName }
1181
+ }
1182
+ if ($exePath -and (Test-Path $exePath)) {
1183
+ $proc = Start-Process $exePath -PassThru -ErrorAction SilentlyContinue
1184
+ break
1185
+ }
1186
+ }
1187
+ }
1188
+ }
1189
+
1190
+ # 4. Last resort: direct Start-Process (Windows may resolve it)
1191
+ if (-not $proc) { $proc = Start-Process -FilePath $target -PassThru -ErrorAction SilentlyContinue }
1192
+
1193
+ if (-not $proc) { Write-Host "LAUNCH_FAILED"; exit }
1194
+
1195
+ # Snapshot ALL visible window HWNDs before the new window appears
1196
+ $beforeHwnds = [CuLaunch]::GetAllVisibleHwnds()
1197
+
1198
+ # Wait for a NEW window from our process PID
1199
+ $hwnd = 0
1200
+ for ($i = 0; $i -lt 50; $i++) {
1201
+ Start-Sleep -Milliseconds 200
1202
+ $afterHwnds = [CuLaunch]::GetAllVisibleHwnds()
1203
+ # Find new windows (in after but not in before)
1204
+ foreach ($h in $afterHwnds) {
1205
+ if ($beforeHwnds -contains $h) { continue }
1206
+ # New window found — check PID
1207
+ $wPid = [CuLaunch]::GetPidForHwnd($h)
1208
+ if ($wPid -eq [uint32]$proc.Id) {
1209
+ $hwnd = $h; break # exact PID match
1210
+ }
1211
+ }
1212
+ if ($hwnd -ne 0) { break }
1213
+ # PID didn't match (process redirect) — accept new window matching title hint
1214
+ if ($i -gt 10) {
1215
+ $hint = '${i}'.Split('\\')[-1].Replace('.exe','')
1216
+ foreach ($h in $afterHwnds) {
1217
+ if ($beforeHwnds -contains $h) { continue }
1218
+ $title = [CuLaunch]::GetTitle($h)
1219
+ if ($title -and $title.IndexOf($hint, [StringComparison]::OrdinalIgnoreCase) -ge 0) {
1220
+ $hwnd = $h; break
1221
+ }
1222
+ }
1223
+ if ($hwnd -ne 0) { break }
1224
+ }
1225
+ }
1226
+ if ($hwnd -eq 0) { Write-Host "HWND_NOT_FOUND|$($proc.Id)"; exit }
1227
+ # Move offscreen instead of minimizing — keeps window restored so
1228
+ # PrintWindow and SendMessage work without needing restore/re-minimize.
1229
+ # User cannot see the window at -32000,-32000.
1230
+ Add-Type @'
1231
+ using System;
1232
+ using System.Runtime.InteropServices;
1233
+ public class CuPos {
1234
+ [DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr h, IntPtr a, int x, int y, int w, int h2, uint f);
1235
+ public const uint SWP_NOSIZE = 0x0001;
1236
+ public const uint SWP_NOZORDER = 0x0004;
1237
+ public const uint SWP_NOACTIVATE = 0x0010;
1238
+ }
1239
+ '@
1240
+ [CuPos]::SetWindowPos([IntPtr]::new([long]$hwnd), [IntPtr]::Zero, -32000, -32000, 0, 0, [CuPos]::SWP_NOSIZE -bor [CuPos]::SWP_NOZORDER -bor [CuPos]::SWP_NOACTIVATE) | Out-Null
1241
+ Write-Host "$hwnd|$($proc.Id)"
1242
+ `);if(!a)throw Error(`open(): failed to launch '${e}' — no output from launcher script`);if(a.startsWith(`LAUNCH_FAILED`))throw Error(`open(): failed to launch '${e}' — process did not start (${a})`);if(a.startsWith(`HWND_NOT_FOUND`))throw Error(`open(): launched '${e}' but could not find its window HWND (${a})`);let o=a.trim().split(`|`),s=o[0].trim(),c=Number(o[1]);s&&s!==`0`&&yr(s,c)},getFrontmostApp(){try{let e=x(`${Tr}
1243
+ $hwnd = [CuWin32]::GetForegroundWindow()
1244
+ $procId = [uint32]0
1245
+ [CuWin32]::GetWindowThreadProcessId($hwnd, [ref]$procId) | Out-Null
1246
+ $proc = Get-Process -Id $procId -ErrorAction SilentlyContinue
1247
+ "$($proc.MainModule.FileName)|$($proc.ProcessName)"`);if(!e||!e.includes(`|`))return null;let[t,n]=e.split(`|`,2);return{id:t,appName:n}}catch{return null}},findWindowByTitle(e){let t=jt().find(t=>t.title.includes(e));return t?{id:String(t.hwnd),pid:t.pid,title:t.title}:null}},J=`
1248
+ Add-Type @'
1249
+ using System;
1250
+ using System.Runtime.InteropServices;
1251
+
1252
+ public class CuWinMgmt {
1253
+ [DllImport("user32.dll")]
1254
+ public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
1255
+
1256
+ [DllImport("user32.dll")]
1257
+ public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hAfter, int X, int Y, int cx, int cy, uint uFlags);
1258
+
1259
+ [DllImport("user32.dll")]
1260
+ public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
1261
+
1262
+ [DllImport("user32.dll")]
1263
+ public static extern bool SetForegroundWindow(IntPtr hWnd);
1264
+
1265
+ [DllImport("user32.dll")]
1266
+ public static extern bool BringWindowToTop(IntPtr hWnd);
1267
+
1268
+ [DllImport("user32.dll", CharSet=CharSet.Unicode, EntryPoint="SendMessageW")]
1269
+ public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
1270
+
1271
+ [DllImport("user32.dll")]
1272
+ public static extern bool IsIconic(IntPtr hWnd);
1273
+
1274
+ [DllImport("user32.dll")]
1275
+ public static extern bool IsZoomed(IntPtr hWnd);
1276
+
1277
+ [StructLayout(LayoutKind.Sequential)]
1278
+ public struct RECT {
1279
+ public int Left; public int Top; public int Right; public int Bottom;
1280
+ }
1281
+
1282
+ // ShowWindow constants
1283
+ public const int SW_MINIMIZE = 6;
1284
+ public const int SW_MAXIMIZE = 3;
1285
+ public const int SW_RESTORE = 9;
1286
+ public const int SW_SHOWNOACTIVATE = 4;
1287
+ public const int SW_SHOWMINNOACTIVE = 7;
1288
+
1289
+ // SetWindowPos flags
1290
+ public const uint SWP_NOSIZE = 0x0001;
1291
+ public const uint SWP_NOMOVE = 0x0002;
1292
+ public const uint SWP_NOZORDER = 0x0004;
1293
+ public const uint SWP_NOACTIVATE = 0x0010;
1294
+ public const uint SWP_SHOWWINDOW = 0x0040;
1295
+
1296
+ // WM_CLOSE
1297
+ public const uint WM_CLOSE = 0x0010;
1298
+ // WM_SYSCOMMAND
1299
+ public const uint WM_SYSCOMMAND = 0x0112;
1300
+ public const int SC_MINIMIZE = 0xF020;
1301
+ public const int SC_MAXIMIZE = 0xF030;
1302
+ public const int SC_RESTORE = 0xF120;
1303
+ public const int SC_CLOSE = 0xF060;
1304
+ }
1305
+ '@
1306
+ `,Nr={manageWindow(e,t){if(!q)return!1;let n=q;switch(e){case`minimize`:return x(`${J}; [CuWinMgmt]::ShowWindow([IntPtr]::new([long]${n}), [CuWinMgmt]::SW_SHOWMINNOACTIVE)`)!==``;case`maximize`:return x(`${J}; [CuWinMgmt]::ShowWindow([IntPtr]::new([long]${n}), [CuWinMgmt]::SW_MAXIMIZE)`)!==``;case`restore`:return x(`${J}; [CuWinMgmt]::ShowWindow([IntPtr]::new([long]${n}), [CuWinMgmt]::SW_RESTORE)`)!==``;case`close`:return mn(n),x(`${J}; [CuWinMgmt]::SendMessage([IntPtr]::new([long]${n}), [CuWinMgmt]::WM_CLOSE, [IntPtr]::Zero, [IntPtr]::Zero)`),xr(),!0;case`focus`:return x(`${J}
1307
+ $h = [IntPtr]::new([long]${n})
1308
+ if ([CuWinMgmt]::IsIconic($h)) {
1309
+ [CuWinMgmt]::ShowWindow($h, [CuWinMgmt]::SW_RESTORE) | Out-Null
1310
+ }
1311
+ [CuWinMgmt]::SetForegroundWindow($h) | Out-Null
1312
+ [CuWinMgmt]::BringWindowToTop($h) | Out-Null
1313
+ `),!0;case`move_offscreen`:return x(`${J}; [CuWinMgmt]::SetWindowPos([IntPtr]::new([long]${n}), [IntPtr]::Zero, -32000, -32000, 0, 0, [CuWinMgmt]::SWP_NOSIZE -bor [CuWinMgmt]::SWP_NOZORDER -bor [CuWinMgmt]::SWP_NOACTIVATE)`),!0;case`move_resize`:return t?.x!==void 0&&t?.y!==void 0&&this.moveResize(t.x,t.y,t.width,t.height),!0;case`get_rect`:return!0;default:return!1}},moveResize(e,t,n,r){if(!q)return!1;let i=q;return x(n!==void 0&&r!==void 0?`${J}; [CuWinMgmt]::SetWindowPos([IntPtr]::new([long]${i}), [IntPtr]::Zero, ${e}, ${t}, ${n}, ${r}, [CuWinMgmt]::SWP_NOZORDER -bor [CuWinMgmt]::SWP_NOACTIVATE)`:`${J}; [CuWinMgmt]::SetWindowPos([IntPtr]::new([long]${i}), [IntPtr]::Zero, ${e}, ${t}, 0, 0, [CuWinMgmt]::SWP_NOSIZE -bor [CuWinMgmt]::SWP_NOZORDER -bor [CuWinMgmt]::SWP_NOACTIVATE)`),!0},getWindowRect(){if(!q)return null;let e=x(`${J}
1314
+ $rect = New-Object CuWinMgmt+RECT
1315
+ if ([CuWinMgmt]::GetWindowRect([IntPtr]::new([long]${q}), [ref]$rect)) {
1316
+ "$($rect.Left),$($rect.Top),$($rect.Right),$($rect.Bottom)"
1317
+ } else { "FAIL" }
1318
+ `);if(!e||e===`FAIL`)return null;let[t,n,r,i]=e.split(`,`).map(Number);return{x:t,y:n,width:r-t,height:i-n}}},process.on(`exit`,Cr),process.on(`SIGINT`,()=>{Cr(),process.exit()}),process.on(`SIGTERM`,()=>{Cr(),process.exit()}),Pr={input:kr,screenshot:Ar,display:jr,apps:Mr,windowManagement:Nr}})),Fr=n({platform:()=>Yr});function X(e){let t=Bun.spawnSync({cmd:e,stdout:`pipe`,stderr:`pipe`});return new TextDecoder().decode(t.stdout).trim()}async function Ir(e){let t=Bun.spawn(e,{stdout:`pipe`,stderr:`pipe`}),n=await new Response(t.stdout).text();return await t.exited,n.trim()}function Lr(e){return Bun.spawnSync({cmd:[`which`,e],stdout:`pipe`,stderr:`pipe`}).exitCode===0}function Rr(e){return Vr[e.toLowerCase()]??e}function zr(e){return e===`left`?`1`:e===`right`?`3`:`2`}async function Br(e,t,n){if(Lr(`convert`)){await Ir([`convert`,e,`-quality`,`75`,Gr]);let r=await Bun.file(Gr).arrayBuffer();return{base64:Buffer.from(r).toString(`base64`),width:t,height:n}}if(Lr(`ffmpeg`)){await Ir([`ffmpeg`,`-y`,`-i`,e,`-q:v`,`5`,Gr]);let r=await Bun.file(Gr).arrayBuffer();return{base64:Buffer.from(r).toString(`base64`),width:t,height:n}}let r=await Bun.file(e).arrayBuffer();return{base64:Buffer.from(r).toString(`base64`),width:t,height:n}}var Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr=t((()=>{Vr={return:`Return`,enter:`Return`,tab:`Tab`,space:`space`,backspace:`BackSpace`,delete:`Delete`,escape:`Escape`,esc:`Escape`,left:`Left`,up:`Up`,right:`Right`,down:`Down`,home:`Home`,end:`End`,pageup:`Prior`,pagedown:`Next`,f1:`F1`,f2:`F2`,f3:`F3`,f4:`F4`,f5:`F5`,f6:`F6`,f7:`F7`,f8:`F8`,f9:`F9`,f10:`F10`,f11:`F11`,f12:`F12`,shift:`shift`,lshift:`shift`,rshift:`shift`,control:`ctrl`,ctrl:`ctrl`,lcontrol:`ctrl`,rcontrol:`ctrl`,alt:`alt`,option:`alt`,lalt:`alt`,ralt:`alt`,win:`super`,meta:`super`,command:`super`,cmd:`super`,super:`super`,insert:`Insert`,printscreen:`Print`,pause:`Pause`,numlock:`Num_Lock`,capslock:`Caps_Lock`,scrolllock:`Scroll_Lock`},Hr=new Set([`shift`,`lshift`,`rshift`,`control`,`ctrl`,`lcontrol`,`rcontrol`,`alt`,`option`,`lalt`,`ralt`,`win`,`meta`,`command`,`cmd`,`super`]),Ur={async moveMouse(e,t){X([`xdotool`,`mousemove`,`--sync`,String(Math.round(e)),String(Math.round(t))])},async click(e,t,n){X([`xdotool`,`mousemove`,`--sync`,String(Math.round(e)),String(Math.round(t))]),X([`xdotool`,`click`,zr(n)])},async typeText(e){X([`xdotool`,`type`,`--delay`,`12`,e])},async key(e,t){let n=Rr(e);X(t===`press`?[`xdotool`,`keydown`,n]:[`xdotool`,`keyup`,n])},async keys(e){let t=[],n=null;for(let r of e)Hr.has(r.toLowerCase())?t.push(Rr(r)):n=r;n&&X([`xdotool`,`key`,[...t,Rr(n)].join(`+`)])},async scroll(e,t){if(t===`vertical`){let t=e>=0?`5`:`4`,n=Math.abs(Math.round(e));n>0&&X([`xdotool`,`click`,`--repeat`,String(n),t])}else{let t=e>=0?`7`:`6`,n=Math.abs(Math.round(e));n>0&&X([`xdotool`,`click`,`--repeat`,String(n),t])}},async mouseLocation(){let e=X([`xdotool`,`getmouselocation`]),t=e.match(/x:(\d+)/),n=e.match(/y:(\d+)/);return{x:t?Number(t[1]):0,y:n?Number(n[1]):0}}},Wr=`/tmp/cu-screenshot-tmp.png`,Gr=`/tmp/cu-screenshot.jpg`,Kr={async captureScreen(e){try{await Ir([`scrot`,`-o`,Wr]);let t=qr.getSize(e);return Br(Wr,t.width,t.height)}catch{return{base64:``,width:0,height:0}}},async captureRegion(e,t,n,r){try{return await Ir([`scrot`,`-a`,`${e},${t},${n},${r}`,`-o`,Wr]),Br(Wr,n,r)}catch{return{base64:``,width:n,height:r}}},async captureWindow(e){try{if(Lr(`import`)){let t=`/tmp/cu-window-capture.jpg`;await Ir([`import`,`-window`,e,`-quality`,`75`,t]);let n=X([`xdotool`,`getwindowgeometry`,`--shell`,e]),r=n.match(/WIDTH=(\d+)/),i=n.match(/HEIGHT=(\d+)/),a=r?Number(r[1]):0,o=i?Number(i[1]):0,s=await Bun.file(t).arrayBuffer();return{base64:Buffer.from(s).toString(`base64`),width:a,height:o}}return null}catch{return null}}},qr={listAll(){try{let e=X([`xrandr`,`--query`]),t=[],n=0,r=/^\S+\s+connected\s+(?:primary\s+)?(\d+)x(\d+)\+\d+\+\d+/gm,i;for(;(i=r.exec(e))!==null;)t.push({width:Number(i[1]),height:Number(i[2]),scaleFactor:1,displayId:n++});return t.length===0?[{width:1920,height:1080,scaleFactor:1,displayId:0}]:t}catch{return[{width:1920,height:1080,scaleFactor:1,displayId:0}]}},getSize(e){let t=this.listAll();if(e!==void 0){let n=t.find(t=>t.displayId===e);if(n)return n}return t[0]??{width:1920,height:1080,scaleFactor:1,displayId:0}}},Jr={listRunning(){try{if(Lr(`wmctrl`)){let e=X([`wmctrl`,`-l`,`-p`]),t=[];for(let n of e.split(`
1319
+ `).filter(Boolean)){let e=n.split(/\s+/),r=e[0],i=Number(e[2]);if(!i)continue;let a=e.slice(4).join(` `),o=``;try{o=X([`readlink`,`-f`,`/proc/${i}/exe`])}catch{}t.push({id:r??``,pid:i,title:a,exePath:o||void 0})}let n=new Set;return t.filter(e=>n.has(e.id)?!1:(n.add(e.id),!0)).slice(0,50)}let e=X([`xdotool`,`search`,`--name`,``]),t=[];for(let n of e.split(`
1320
+ `).filter(Boolean).slice(0,50)){let e=X([`xdotool`,`getwindowname`,n]),r=0;try{r=Number(X([`xdotool`,`getwindowpid`,n]))}catch{}e&&t.push({id:n,pid:r,title:e})}return t}catch{return[]}},async listInstalled(){try{let e=[`/usr/share/applications`,`/usr/local/share/applications`,`${process.env.HOME}/.local/share/applications`],t=[];for(let n of e){let e;try{e=X([`find`,n,`-name`,`*.desktop`,`-maxdepth`,`1`])}catch{continue}for(let n of e.split(`
1321
+ `).filter(Boolean))try{let e=X([`cat`,n]),r=e.match(/^Name=(.+)$/m),i=e.match(/^Exec=(.+)$/m);if(e.match(/^NoDisplay=true$/m))continue;let a=r?.[1]??``,o=i?.[1]??``;if(!a)continue;t.push({id:n.split(`/`).pop()?.replace(`.desktop`,``)??``,displayName:a,path:o.split(/\s+/)[0]??``})}catch{}}return t.slice(0,200)}catch{return[]}},async open(e){try{let t=e.endsWith(`.desktop`)?e:`${e}.desktop`;if(Lr(`gtk-launch`)){await Ir([`gtk-launch`,t]);return}}catch{}await Ir([`xdg-open`,e])},getFrontmostApp(){try{let e=X([`xdotool`,`getactivewindow`]);if(!e)return null;let t=X([`xdotool`,`getwindowpid`,e]);if(!t)return null;let n=``;try{n=X([`readlink`,`-f`,`/proc/${t}/exe`])}catch{}let r=``;try{r=X([`cat`,`/proc/${t}/comm`])}catch{}return!n&&!r?null:{id:n||`/proc/${t}/exe`,appName:r||`unknown`}}catch{return null}},findWindowByTitle(e){try{let t=X([`xdotool`,`search`,`--name`,e]).split(`
1322
+ `)[0];if(!t)return null;let n=X([`xdotool`,`getwindowname`,t]),r=0;try{r=Number(X([`xdotool`,`getwindowpid`,t]))}catch{}return{id:t,pid:r,title:n}}catch{return null}}},Yr={input:Ur,screenshot:Kr,display:qr,apps:Jr}}));function Zr(){if(Qr)return Qr;switch(process.platform){case`darwin`:Qr=(kt(),e(Ct)).platform;break;case`win32`:Qr=(Y(),e(G)).platform;break;case`linux`:Qr=(Xr(),e(Fr)).platform;break;default:throw Error(`Computer Use not supported on ${process.platform}`)}return Qr}var Qr,$r=t((()=>{})),ei=n({captureAccessibilitySnapshot:()=>ti,findNodeInSnapshot:()=>ai});function ti(e,t=4,n=!0){e=b(e);let r=`
1323
+ Add-Type -AssemblyName UIAutomationClient
1324
+ Add-Type -AssemblyName UIAutomationTypes
1325
+ Add-Type -AssemblyName WindowsBase
1326
+ ${n?`
1327
+ # Interactive control types only
1328
+ $interactiveTypes = @(
1329
+ 'Button','Edit','ComboBox','CheckBox','RadioButton',
1330
+ 'MenuItem','Menu','MenuBar','Link','Slider','Spinner',
1331
+ 'Tab','TabItem','List','ListItem','Tree','TreeItem',
1332
+ 'DataGrid','DataItem','Document','ScrollBar','ToolBar',
1333
+ 'SplitButton','ToggleButton','Hyperlink'
1334
+ )
1335
+ function Is-Interactive($ct) {
1336
+ $typeName = $ct -replace 'ControlType\\.', ''
1337
+ return $interactiveTypes -contains $typeName
1338
+ }`:`
1339
+ function Is-Interactive($ct) { return $true }`}
1340
+
1341
+ function Get-Tree($el, $depth, $maxDepth) {
1342
+ if ($depth -ge $maxDepth) { return @() }
1343
+ $result = @()
1344
+ $children = $el.FindAll(
1345
+ [System.Windows.Automation.TreeScope]::Children,
1346
+ [System.Windows.Automation.Condition]::TrueCondition)
1347
+ foreach ($child in $children) {
1348
+ $ct = $child.Current.ControlType.ProgrammaticName
1349
+ $typeName = $ct -replace 'ControlType\\.', ''
1350
+ $name = [string]$child.Current.Name
1351
+ $autoId = [string]$child.Current.AutomationId
1352
+ $rect = $child.Current.BoundingRectangle
1353
+ $enabled = $child.Current.IsEnabled
1354
+
1355
+ # Skip invisible/offscreen elements
1356
+ if ($rect.Width -le 0 -or $rect.Height -le 0) { continue }
1357
+ if ($rect.X -lt -10000) { continue }
1358
+
1359
+ $val = $null
1360
+ try {
1361
+ $vp = $child.GetCurrentPattern([System.Windows.Automation.ValuePattern]::Pattern)
1362
+ if ($vp -ne $null) { $val = $vp.Current.Value }
1363
+ } catch {}
1364
+
1365
+ $isInteractive = Is-Interactive $ct
1366
+ $sub = Get-Tree $child ($depth + 1) $maxDepth
1367
+
1368
+ if ($isInteractive -or $sub.Count -gt 0) {
1369
+ $node = @{
1370
+ role = $typeName
1371
+ name = $name
1372
+ id = $autoId
1373
+ x = [int]$rect.X; y = [int]$rect.Y
1374
+ w = [int]$rect.Width; h = [int]$rect.Height
1375
+ on = $enabled
1376
+ }
1377
+ if ($val -ne $null -and $val -ne '') { $node['v'] = $val }
1378
+ if ($sub.Count -gt 0) { $node['c'] = $sub }
1379
+ $result += $node
1380
+ }
1381
+ }
1382
+ return $result
1383
+ }
1384
+
1385
+ try {
1386
+ $root = [System.Windows.Automation.AutomationElement]::FromHandle([IntPtr]::new([long]${e}))
1387
+ if ($root -eq $null) { Write-Output '[]'; exit }
1388
+ $tree = Get-Tree $root 0 ${t}
1389
+ if ($tree -eq $null -or $tree.Count -eq 0) {
1390
+ Write-Output '[]'
1391
+ } else {
1392
+ $tree | ConvertTo-Json -Depth 20 -Compress
1393
+ }
1394
+ } catch {
1395
+ Write-Output '[]'
1396
+ }
1397
+ `;try{let e=x(r);if(!e||e===`[]`)return null;let t=JSON.parse(e),n=Array.isArray(t)?t.map(ni):[ni(t)];return{text:ri(n),nodes:n,timestamp:Date.now()}}catch{return null}}function ni(e){return{role:e.role||``,name:e.name||``,automationId:e.id||``,bounds:{x:e.x||0,y:e.y||0,w:e.w||0,h:e.h||0},enabled:e.on!==!1,value:e.v,children:e.c?Array.isArray(e.c)?e.c.map(ni):[ni(e.c)]:void 0}}function ri(e,t=0){let n=[],r=` `.repeat(t);for(let i of e){let e=`${r}[${i.role}]`;i.name&&(e+=` "${ii(i.name,40)}"`),e+=` (${i.bounds.x},${i.bounds.y} ${i.bounds.w}x${i.bounds.h})`,i.enabled||(e+=` DISABLED`),i.value&&(e+=` value="${ii(i.value,30)}"`),i.automationId&&(e+=` id=${i.automationId}`),n.push(e),i.children&&n.push(ri(i.children,t+1))}return n.join(`
1398
+ `)}function ii(e,t){return e.length>t?e.slice(0,t-1)+`…`:e}function ai(e,t){for(let n of e){let e=!0;if(t.name&&!n.name.toLowerCase().includes(t.name.toLowerCase())&&(e=!1),t.role&&n.role.toLowerCase()!==t.role.toLowerCase()&&(e=!1),t.automationId&&n.automationId!==t.automationId&&(e=!1),e&&(t.name||t.role||t.automationId))return n;if(n.children){let e=ai(n.children,t);if(e)return e}}return null}var oi=t((()=>{C()})),si=n({clickElement:()=>di,elementAtPoint:()=>pi,findElement:()=>ui,getUITree:()=>li,setValue:()=>fi});function ci(e,t){try{return e?JSON.parse(e):t}catch{return t}}function li(e,t=3){let n=ci(x(`
1399
+ ${hi}
1400
+ $title = '${e.replace(/'/g,`''`)}'
1401
+ ${gi}
1402
+ if ($window -eq $null) {
1403
+ Write-Output '[]'
1404
+ exit
1405
+ }
1406
+
1407
+ function Get-UIChildren($parent, $currentDepth, $maxDepth) {
1408
+ if ($currentDepth -ge $maxDepth) { return @() }
1409
+ $children = $parent.FindAll(
1410
+ [System.Windows.Automation.TreeScope]::Children,
1411
+ [System.Windows.Automation.Condition]::TrueCondition)
1412
+ $result = @()
1413
+ foreach ($el in $children) {
1414
+ $rect = $el.Current.BoundingRectangle
1415
+ $obj = @{
1416
+ name = [string]$el.Current.Name
1417
+ controlType = $el.Current.ControlType.ProgrammaticName -replace 'ControlType\\.', ''
1418
+ automationId = [string]$el.Current.AutomationId
1419
+ boundingRect = @{
1420
+ x = [int]$rect.X
1421
+ y = [int]$rect.Y
1422
+ w = [int]$rect.Width
1423
+ h = [int]$rect.Height
1424
+ }
1425
+ isEnabled = $el.Current.IsEnabled
1426
+ }
1427
+ try {
1428
+ $vp = $el.GetCurrentPattern([System.Windows.Automation.ValuePattern]::Pattern)
1429
+ if ($vp -ne $null) { $obj['value'] = $vp.Current.Value }
1430
+ } catch {}
1431
+ $sub = Get-UIChildren $el ($currentDepth + 1) $maxDepth
1432
+ if ($sub.Count -gt 0) { $obj['children'] = $sub }
1433
+ $result += $obj
1434
+ }
1435
+ return $result
1436
+ }
1437
+
1438
+ $tree = Get-UIChildren $window 0 ${t}
1439
+ if ($tree -eq $null -or $tree.Count -eq 0) {
1440
+ Write-Output '[]'
1441
+ } else {
1442
+ $tree | ConvertTo-Json -Depth 20 -Compress
1443
+ }
1444
+ `),[]);return Array.isArray(n)?n:[n]}function ui(e,t){let n=e.replace(/'/g,`''`),r=[];if(t.name){let e=t.name.replace(/'/g,`''`);r.push(`[System.Windows.Automation.PropertyCondition]::new([System.Windows.Automation.AutomationElement]::NameProperty, '${e}')`)}if(t.controlType){if(!mi.has(t.controlType))return null;let e=t.controlType.replace(/'/g,`''`);r.push(`[System.Windows.Automation.PropertyCondition]::new([System.Windows.Automation.AutomationElement]::ControlTypeProperty, [System.Windows.Automation.ControlType]::${e})`)}if(t.automationId){let e=t.automationId.replace(/'/g,`''`);r.push(`[System.Windows.Automation.PropertyCondition]::new([System.Windows.Automation.AutomationElement]::AutomationIdProperty, '${e}')`)}if(r.length===0)return null;let i;return i=r.length===1?r[0]:`[System.Windows.Automation.AndCondition]::new(@(${r.join(`, `)}))`,ci(x(`
1445
+ ${hi}
1446
+ $title = '${n}'
1447
+ ${gi}
1448
+ if ($window -eq $null) {
1449
+ Write-Output 'null'
1450
+ exit
1451
+ }
1452
+ $cond = ${i}
1453
+ $el = $window.FindFirst([System.Windows.Automation.TreeScope]::Descendants, $cond)
1454
+ if ($el -eq $null) {
1455
+ Write-Output 'null'
1456
+ exit
1457
+ }
1458
+ $rect = $el.Current.BoundingRectangle
1459
+ $obj = @{
1460
+ name = [string]$el.Current.Name
1461
+ controlType = $el.Current.ControlType.ProgrammaticName -replace 'ControlType\\.', ''
1462
+ automationId = [string]$el.Current.AutomationId
1463
+ boundingRect = @{
1464
+ x = [int]$rect.X
1465
+ y = [int]$rect.Y
1466
+ w = [int]$rect.Width
1467
+ h = [int]$rect.Height
1468
+ }
1469
+ isEnabled = $el.Current.IsEnabled
1470
+ }
1471
+ try {
1472
+ $vp = $el.GetCurrentPattern([System.Windows.Automation.ValuePattern]::Pattern)
1473
+ if ($vp -ne $null) { $obj['value'] = $vp.Current.Value }
1474
+ } catch {}
1475
+ $obj | ConvertTo-Json -Compress
1476
+ `),null)}function di(e,t){return x(`
1477
+ ${hi}
1478
+ $title = '${e.replace(/'/g,`''`)}'
1479
+ ${gi}
1480
+ if ($window -eq $null) {
1481
+ Write-Output 'false'
1482
+ exit
1483
+ }
1484
+ $cond = [System.Windows.Automation.PropertyCondition]::new(
1485
+ [System.Windows.Automation.AutomationElement]::AutomationIdProperty, '${t.replace(/'/g,`''`)}')
1486
+ $el = $window.FindFirst([System.Windows.Automation.TreeScope]::Descendants, $cond)
1487
+ if ($el -eq $null) {
1488
+ Write-Output 'false'
1489
+ exit
1490
+ }
1491
+ try {
1492
+ $ip = $el.GetCurrentPattern([System.Windows.Automation.InvokePattern]::Pattern)
1493
+ $ip.Invoke()
1494
+ Write-Output 'true'
1495
+ } catch {
1496
+ Write-Output 'false'
1497
+ }
1498
+ `)===`true`}function fi(e,t,n){return x(`
1499
+ ${hi}
1500
+ $title = '${e.replace(/'/g,`''`)}'
1501
+ ${gi}
1502
+ if ($window -eq $null) {
1503
+ Write-Output 'false'
1504
+ exit
1505
+ }
1506
+ $cond = [System.Windows.Automation.PropertyCondition]::new(
1507
+ [System.Windows.Automation.AutomationElement]::AutomationIdProperty, '${t.replace(/'/g,`''`)}')
1508
+ $el = $window.FindFirst([System.Windows.Automation.TreeScope]::Descendants, $cond)
1509
+ if ($el -eq $null) {
1510
+ Write-Output 'false'
1511
+ exit
1512
+ }
1513
+ try {
1514
+ $vp = $el.GetCurrentPattern([System.Windows.Automation.ValuePattern]::Pattern)
1515
+ $vp.SetValue('${n.replace(/'/g,`''`)}')
1516
+ Write-Output 'true'
1517
+ } catch {
1518
+ Write-Output 'false'
1519
+ }
1520
+ `)===`true`}function pi(e,t){return ci(x(`
1521
+ ${hi}
1522
+ try {
1523
+ $point = [System.Windows.Point]::new(${e}, ${t})
1524
+ $el = [System.Windows.Automation.AutomationElement]::FromPoint($point)
1525
+ if ($el -eq $null) {
1526
+ Write-Output 'null'
1527
+ exit
1528
+ }
1529
+ $rect = $el.Current.BoundingRectangle
1530
+ $obj = @{
1531
+ name = [string]$el.Current.Name
1532
+ controlType = $el.Current.ControlType.ProgrammaticName -replace 'ControlType\\.', ''
1533
+ automationId = [string]$el.Current.AutomationId
1534
+ boundingRect = @{
1535
+ x = [int]$rect.X
1536
+ y = [int]$rect.Y
1537
+ w = [int]$rect.Width
1538
+ h = [int]$rect.Height
1539
+ }
1540
+ isEnabled = $el.Current.IsEnabled
1541
+ }
1542
+ try {
1543
+ $vp = $el.GetCurrentPattern([System.Windows.Automation.ValuePattern]::Pattern)
1544
+ if ($vp -ne $null) { $obj['value'] = $vp.Current.Value }
1545
+ } catch {}
1546
+ $obj | ConvertTo-Json -Compress
1547
+ } catch {
1548
+ Write-Output 'null'
1549
+ }
1550
+ `),null)}var mi,hi,gi,_i=t((()=>{C(),mi=new Set(`Button.Calendar.CheckBox.ComboBox.Custom.DataGrid.DataItem.Document.Edit.Group.Header.HeaderItem.Hyperlink.Image.List.ListItem.Menu.MenuBar.MenuItem.Pane.ProgressBar.RadioButton.ScrollBar.Separator.Slider.Spinner.SplitButton.StatusBar.Tab.TabItem.Table.Text.Thumb.TitleBar.ToolBar.ToolTip.Tree.TreeItem.Window`.split(`.`)),hi=`
1551
+ Add-Type -AssemblyName UIAutomationClient
1552
+ Add-Type -AssemblyName UIAutomationTypes
1553
+ Add-Type -AssemblyName WindowsBase
1554
+ `,gi=`
1555
+ $root = [System.Windows.Automation.AutomationElement]::RootElement
1556
+ $window = $root.FindFirst(
1557
+ [System.Windows.Automation.TreeScope]::Children,
1558
+ [System.Windows.Automation.PropertyCondition]::new(
1559
+ [System.Windows.Automation.AutomationElement]::NameProperty, $title))
1560
+ if ($window -eq $null) {
1561
+ $all = $root.FindAll(
1562
+ [System.Windows.Automation.TreeScope]::Children,
1563
+ [System.Windows.Automation.Condition]::TrueCondition)
1564
+ foreach ($el in $all) {
1565
+ if ($el.Current.Name -and $el.Current.Name.Contains($title)) {
1566
+ $window = $el
1567
+ break
1568
+ }
1569
+ }
1570
+ }
1571
+ `})),vi=n({createCrossPlatformExecutor:()=>wi,unhideComputerUseAppsCrossPlatform:()=>Ti});function yi(){if(process.platform!==`win32`)return null;try{let{getBoundHwnd:t}=(Y(),e(G));return t()}catch{return null}}function Z(){return yi()!==null}function bi(){if(process.platform!==`win32`)return{dx:0,dy:0};try{let{getBoundHwnd:t}=(Y(),e(G)),n=t();if(!n)return{dx:0,dy:0};b(n);let r=Bun.spawnSync({cmd:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,`
1572
+ Add-Type @'
1573
+ using System;
1574
+ using System.Runtime.InteropServices;
1575
+ public class NcCalc {
1576
+ [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr h, out RECT r);
1577
+ [DllImport("user32.dll")] public static extern bool GetClientRect(IntPtr h, out RECT r);
1578
+ [DllImport("user32.dll")] public static extern bool ClientToScreen(IntPtr h, ref POINT p);
1579
+ [StructLayout(LayoutKind.Sequential)] public struct RECT { public int L, T, R, B; }
1580
+ [StructLayout(LayoutKind.Sequential)] public struct POINT { public int X, Y; }
1581
+ }
1582
+ '@
1583
+ $h = [IntPtr]::new([long]${n})
1584
+ $wr = New-Object NcCalc+RECT
1585
+ $cr = New-Object NcCalc+RECT
1586
+ [NcCalc]::GetWindowRect($h, [ref]$wr) | Out-Null
1587
+ [NcCalc]::GetClientRect($h, [ref]$cr) | Out-Null
1588
+ $pt = New-Object NcCalc+POINT
1589
+ $pt.X = 0; $pt.Y = 0
1590
+ [NcCalc]::ClientToScreen($h, [ref]$pt) | Out-Null
1591
+ "$($pt.X - $wr.L),$($pt.Y - $wr.T)"
1592
+ `],stdout:`pipe`,stderr:`pipe`}),[i,a]=new TextDecoder().decode(r.stdout).trim().split(`,`);return{dx:Number(i)||0,dy:Number(a)||0}}catch{return{dx:0,dy:0}}}function xi(){if(process.platform!==`win32`)return{dx:0,dy:0};try{let{getBoundHwnd:t}=(Y(),e(G)),n=t();return n?Q&&$===n?Q:(Q=bi(),$=n,Q):{dx:0,dy:0}}catch{return{dx:0,dy:0}}}function Si(){if(!(process.platform!==`win32`||!Z()))try{let{getBoundHwnd:t}=(Y(),e(G)),n=t();if(!n)return;let{captureAccessibilitySnapshot:r}=(oi(),e(ei)),i=r(n);return!i||!i.text?void 0:i.text}catch{return}}function Ci(e,t){if(Z()){let t=Si();return{base64:e.base64,width:e.width,height:e.height,displayWidth:e.width,displayHeight:e.height,originX:0,originY:0,accessibilityText:t}}return{base64:e.base64,width:e.width,height:e.height,displayWidth:t.width,displayHeight:t.height,originX:0,originY:0}}function wi(t){let n=Zr();return a(`[computer-use] cross-platform executor for ${process.platform}`),{capabilities:{...re,hostBundleId:te},async prepareForAction(){return[]},async previewHideSet(){return[]},async getDisplaySize(e){let t=n.display.getSize(e);return{...t,scaleFactor:t.scaleFactor??1,displayId:t.displayId??0,originX:0,originY:0}},async listDisplays(){return n.display.listAll().map(e=>({...e,originX:0,originY:0}))},async findWindowDisplays(e){return e.map(e=>({bundleId:e,displayIds:[0]}))},async resolvePrepareCapture(e){let t=n.display.getSize(e.preferredDisplayId);return{...Ci(await n.screenshot.captureScreen(e.preferredDisplayId),t),hidden:[],displayId:e.preferredDisplayId??t.displayId??0}},async screenshot(e){let t=n.display.getSize(e.displayId);return Ci(await n.screenshot.captureScreen(e.displayId),t)},async zoom(e,t,r){return n.screenshot.captureRegion(e.x,e.y,e.w,e.h)},async key(e,t){let r=e.split(`+`).filter(e=>e.length>0),i=t??1;for(let e=0;e<i;e++)e>0&&await l(8),await n.input.keys(r)},async holdKey(e,t){for(let t of e)await n.input.key(t,`press`);await l(t);for(let t of[...e].reverse())await n.input.key(t,`release`)},async type(e,t){await n.input.typeText(e)},async readClipboard(){if(process.platform===`win32`){let e=Bun.spawnSync({cmd:[`powershell`,`-NoProfile`,`-Command`,`Get-Clipboard`],stdout:`pipe`});return new TextDecoder().decode(e.stdout).trim()}let e=Bun.spawnSync({cmd:[`xclip`,`-selection`,`clipboard`,`-o`],stdout:`pipe`});return new TextDecoder().decode(e.stdout).trim()},async writeClipboard(e){if(process.platform===`win32`){let t=e.replace(/'/g,`''`);Bun.spawnSync({cmd:[`powershell`,`-NoProfile`,`-Command`,`Set-Clipboard -Value '${t}'`]});return}let t=Bun.spawn([`xclip`,`-selection`,`clipboard`],{stdin:`pipe`});t.stdin.write(e),t.stdin.end(),await t.exited},async moveMouse(e,t){await n.input.moveMouse(e,t)},async click(e,t,r,i,o){let s=Math.round(e),c=Math.round(t);if(Z()){let n=xi();s-=n.dx,c-=n.dy,a(`[computer-use] click(${Math.round(e)},${Math.round(t)}) → client(${s},${c}) [nc offset: ${n.dx},${n.dy}]`)}for(let e=0;e<i;e++)await n.input.click(s,c,r)},async mouseDown(){if(Z()&&process.platform===`win32`){let{getBoundHwnd:t}=(Y(),e(G)),r=t();if(r){let{sendMouseDown:t}=(W(),e(B)),i=await n.input.mouseLocation();t(r,i.x,i.y);return}}if(process.platform===`win32`){Bun.spawnSync({cmd:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,`Add-Type -Language CSharp @'
1593
+ using System; using System.Runtime.InteropServices;
1594
+ public class MDown { [StructLayout(LayoutKind.Sequential)] public struct MOUSEINPUT { public int dx; public int dy; public int mouseData; public uint dwFlags; public uint time; public IntPtr dwExtraInfo; }
1595
+ [StructLayout(LayoutKind.Explicit)] public struct INPUT { [FieldOffset(0)] public uint type; [FieldOffset(4)] public MOUSEINPUT mi; }
1596
+ [DllImport("user32.dll",SetLastError=true)] public static extern uint SendInput(uint n, INPUT[] i, int cb); }
1597
+ '@
1598
+ $i = New-Object MDown+INPUT; $i.type=0; $i.mi.dwFlags=0x0002; [MDown]::SendInput(1, @($i), [Runtime.InteropServices.Marshal]::SizeOf($i)) | Out-Null`]});return}},async mouseUp(){if(Z()&&process.platform===`win32`){let{getBoundHwnd:t}=(Y(),e(G)),r=t();if(r){let{sendMouseUp:t}=(W(),e(B)),i=await n.input.mouseLocation();t(r,i.x,i.y);return}}if(process.platform===`win32`){Bun.spawnSync({cmd:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,`Add-Type -Language CSharp @'
1599
+ using System; using System.Runtime.InteropServices;
1600
+ public class MUp { [StructLayout(LayoutKind.Sequential)] public struct MOUSEINPUT { public int dx; public int dy; public int mouseData; public uint dwFlags; public uint time; public IntPtr dwExtraInfo; }
1601
+ [StructLayout(LayoutKind.Explicit)] public struct INPUT { [FieldOffset(0)] public uint type; [FieldOffset(4)] public MOUSEINPUT mi; }
1602
+ [DllImport("user32.dll",SetLastError=true)] public static extern uint SendInput(uint n, INPUT[] i, int cb); }
1603
+ '@
1604
+ $i = New-Object MUp+INPUT; $i.type=0; $i.mi.dwFlags=0x0004; [MUp]::SendInput(1, @($i), [Runtime.InteropServices.Marshal]::SizeOf($i)) | Out-Null`]});return}},async getCursorPosition(){return n.input.mouseLocation()},async drag(t,r){if(Z()&&process.platform===`win32`){let{getBoundHwnd:n}=(Y(),e(G)),i=n();if(i){let{sendMouseDown:n,sendMouseMove:a,sendMouseUp:o}=(W(),e(B)),s=xi();t&&n(i,Math.round(t.x)-s.dx,Math.round(t.y)-s.dy),await l(50);let c=Math.round(r.x)-s.dx,u=Math.round(r.y)-s.dy;a(i,c,u),await l(16),o(i,c,u);return}}t&&(await n.input.moveMouse(t.x,t.y),await l(16)),await this.mouseDown(),await l(50),await n.input.moveMouse(r.x,r.y),await l(16),await this.mouseUp()},async scroll(e,t,r,i){i!==0&&await n.input.scroll(i,`vertical`),r!==0&&await n.input.scroll(r,`horizontal`)},async getFrontmostApp(){if(Z())return{bundleId:`cu-bound-window`,displayName:`Bound Window`};let e=n.apps.getFrontmostApp();return e?{bundleId:e.id,displayName:e.appName}:null},async appUnderPoint(e,t){return null},async listInstalledApps(){return(await n.apps.listInstalled()).map(e=>({bundleId:e.id,displayName:e.displayName,path:e.path}))},async getAppIcon(e){},async listRunningApps(){return n.apps.listRunning().map(e=>({bundleId:e.id,displayName:e.title}))},async openApp(e){await n.apps.open(e),Q=null,$=null},async manageWindow(e,t){if(!n.windowManagement)return!1;let r=n.windowManagement.manageWindow(e,t);return Q=null,$=null,r},async getWindowRect(){return n.windowManagement?n.windowManagement.getWindowRect():null},async openTerminal(t){if(process.platform!==`win32`)return null;try{let{listWindows:n}=(w(),e(At)),{bindWindow:r}=(Y(),e(G)),i={claude:`claude`,codex:`codex`,gemini:`gemini`,custom:t.command??``}[t.agent];if(!i)return null;let a=new Set(n().map(e=>e.hwnd)),o=(t.workingDirectory??process.cwd()).replace(/'/g,`''`);Bun.spawnSync({cmd:[`powershell`,`-Command`,`Start-Process powershell -ArgumentList '-NoExit','-Command','cd ''${o}''; ${i}'`],stdout:`ignore`,stderr:`ignore`});let s=null,c=``;for(let e=0;e<25;e++){await l(200);for(let e of n())if(!a.has(e.hwnd)){let t=e.title.toLowerCase();if(t.includes(`terminal`)||t.includes(`powershell`)||t.includes(`cmd`)||t.includes(i.toLowerCase())){s=e.hwnd,c=e.title;break}}if(s)break}if(!s)return null;let u=n().find(e=>e.hwnd===s);return r(s,u?.pid),Q=null,$=null,await l(2e3),{hwnd:s,title:c,launched:!0}}catch{return null}},async bindToWindow(t){if(process.platform!==`win32`)return null;let{bindWindow:n}=(Y(),e(G)),{listWindows:r}=(w(),e(At)),i=r(),a;if(t.hwnd)a=i.find(e=>e.hwnd===t.hwnd);else if(t.title){let e=t.title.toLowerCase();a=i.find(t=>t.title.toLowerCase().includes(e))}else t.pid&&(a=i.find(e=>e.pid===t.pid));return a?(n(a.hwnd,a.pid),Q=null,$=null,a):null},async unbindFromWindow(){if(process.platform!==`win32`)return;let{unbindWindow:t}=(Y(),e(G));t(),Q=null,$=null},async hasBoundWindow(){return Z()},async getBindingStatus(){if(process.platform!==`win32`)return null;let{getBoundHwnd:t}=(Y(),e(G)),r=t();if(!r)return{bound:!1};let{listWindows:i}=(w(),e(At)),a=i().find(e=>e.hwnd===r),o=n.windowManagement?.getWindowRect()??void 0;return{bound:!0,hwnd:r,title:a?.title,pid:a?.pid,rect:o??void 0}},async listVisibleWindows(){if(process.platform!==`win32`)return[];let{listWindows:t}=(w(),e(At));return t()},async statusIndicator(t,n){if(process.platform!==`win32`)return{active:!1};try{let r=(Gn(),e(An));return t===`show`&&n?(r.updateIndicator(n),{active:!0,message:n}):t===`hide`?(r.hideIndicator(),{active:!1}):{active:Z()}}catch{return{active:!1}}},async virtualKeyboard(t){if(process.platform!==`win32`||!Z())return!1;try{let n=yi();if(!n)return!1;let r=(W(),e(B)),{VK_MAP:i}=(C(),e(vt)),a=t.repeat??1;for(let e=0;e<a;e++)switch(e>0&&await l(30),t.action){case`type`:r.sendText(n,t.text);break;case`combo`:{let e=t.text.split(`+`).map(e=>e.trim()).filter(Boolean);r.sendKeys(n,e);break}case`press`:{let e=i[t.text.toLowerCase()]??(t.text.length===1?t.text.charCodeAt(0):0);e&&r.sendKey(n,e,`down`);break}case`release`:{let e=i[t.text.toLowerCase()]??(t.text.length===1?t.text.charCodeAt(0):0);e&&r.sendKey(n,e,`up`);break}case`hold`:{let e=t.text.split(`+`).map(e=>e.trim()).filter(Boolean);for(let t of e){let e=i[t.toLowerCase()]??(t.length===1?t.charCodeAt(0):0);e&&r.sendKey(n,e,`down`)}await l((t.duration??1)*1e3);for(let t of[...e].reverse()){let e=i[t.toLowerCase()]??(t.length===1?t.charCodeAt(0):0);e&&r.sendKey(n,e,`up`)}break}}return!0}catch{return!1}},async virtualMouse(t){if(process.platform!==`win32`||!Z())return!1;try{let n=yi();if(!n)return!1;let r=(W(),e(B)),i=(kn(),e(gn)),a=Math.round(t.x),o=Math.round(t.y);switch(t.action){case`click`:i.moveVirtualCursor(a,o,!0),r.sendClick(n,a,o,`left`);break;case`double_click`:i.moveVirtualCursor(a,o,!0),r.sendClick(n,a,o,`left`),await l(50),r.sendClick(n,a,o,`left`);break;case`right_click`:i.moveVirtualCursor(a,o,!0),r.sendClick(n,a,o,`right`);break;case`move`:i.moveVirtualCursor(a,o),r.sendMouseMove(n,a,o);break;case`drag`:{let e=Math.round(t.startX??a),s=Math.round(t.startY??o);i.moveVirtualCursor(e,s,!0),r.sendMouseDown(n,e,s),await l(16),r.sendMouseMove(n,a,o),i.moveVirtualCursor(a,o),await l(16),r.sendMouseUp(n,a,o);break}case`down`:i.moveVirtualCursor(a,o,!0),r.sendMouseDown(n,a,o);break;case`up`:i.moveVirtualCursor(a,o),r.sendMouseUp(n,a,o);break}return!0}catch{return!1}},async mouseWheel(t,n,r,i){if(process.platform!==`win32`||!Z())return!1;try{let a=yi();if(!a)return!1;try{if((Qn(),e(Kn)).callSync(`send_mouse_wheel`,{hwnd:a,x:Math.round(t),y:Math.round(n),delta:r,horizontal:i??!1})!==null)return!0}catch{}let{sendMouseWheel:o}=(W(),e(B));return o(a,Math.round(t),Math.round(n),r,i??!1)}catch{return!1}},async activateWindow(t,r){if(process.platform!==`win32`||!Z())return!1;try{let{getBoundHwnd:i}=(Y(),e(G)),a=i();if(!a)return!1;n.windowManagement&&n.windowManagement.manageWindow(`focus`);let{sendClick:o}=(W(),e(B));if(t!==void 0&&r!==void 0)o(a,t,r,`left`);else{let e=n.windowManagement?.getWindowRect();if(e){let t=xi();o(a,Math.round(e.width/2)-t.dx,Math.round(e.height/2)-t.dy,`left`)}}return!0}catch{return!1}},async respondToPrompt(t){if(process.platform!==`win32`||!Z())return!1;try{let{getBoundHwnd:n}=(Y(),e(G)),r=n();if(!r)return!1;let i=(W(),e(B));switch(t.responseType){case`yes`:i.sendChar(r,`y`),await l(50),i.sendKey(r,13,`down`),i.sendKey(r,13,`up`);break;case`no`:i.sendChar(r,`n`),await l(50),i.sendKey(r,13,`down`),i.sendKey(r,13,`up`);break;case`enter`:i.sendKey(r,13,`down`),i.sendKey(r,13,`up`);break;case`escape`:i.sendKey(r,27,`down`),i.sendKey(r,27,`up`);break;case`select`:{let e=(t.arrowDirection??`down`)===`down`?40:38,n=t.arrowCount??1;for(let t=0;t<n;t++)i.sendKey(r,e,`down`),i.sendKey(r,e,`up`),await l(30);await l(50),i.sendKey(r,13,`down`),i.sendKey(r,13,`up`);break}case`type`:t.text&&(i.sendText(r,t.text),await l(50)),i.sendKey(r,13,`down`),i.sendKey(r,13,`up`);break}return!0}catch{return!1}},async clickElement(t){if(process.platform!==`win32`||!Z())return!1;try{let{getBoundHwnd:n}=(Y(),e(G)),r=n();if(!r)return!1;let{captureAccessibilitySnapshot:i,findNodeInSnapshot:a}=(oi(),e(ei)),o=i(r);if(!o)return!1;let s=a(o.nodes,t);if(!s)return!1;let{clickElement:c}=(_i(),e(si)),l=(w(),e(At)).listWindows().find(e=>e.hwnd===r);if(l&&s.automationId&&c(l.title,s.automationId))return!0;let u=s.bounds.x+Math.round(s.bounds.w/2),ee=s.bounds.y+Math.round(s.bounds.h/2),te=xi(),{sendClick:ne}=(W(),e(B));return ne((W(),e(B)).findEditChild(r)??r,u-te.dx,ee-te.dy,`left`),!0}catch{return!1}},async typeIntoElement(t,n){if(process.platform!==`win32`||!Z())return!1;try{let{getBoundHwnd:r}=(Y(),e(G)),i=r();if(!i)return!1;let a=(w(),e(At)).listWindows().find(e=>e.hwnd===i);if(a){let{setValue:r,findElement:i}=(_i(),e(si));if(t.automationId&&r(a.title,t.automationId,n))return!0;if(t.name){let e=i(a.title,t);if(e&&e.automationId&&r(a.title,e.automationId,n))return!0}}let{captureAccessibilitySnapshot:o,findNodeInSnapshot:s}=(oi(),e(ei)),c=o(i);if(!c)return!1;let u=s(c.nodes,t);if(!u)return!1;let ee=xi(),te=u.bounds.x+Math.round(u.bounds.w/2)-ee.dx,ne=u.bounds.y+Math.round(u.bounds.h/2)-ee.dy,{sendClick:re,sendText:ie}=(W(),e(B));return re(i,te,ne,`left`),await l(50),ie(i,n)}catch{return!1}}}}async function Ti(e){}var Q,$,Ei=t((()=>{i(),u(),ne(),C(),$r(),Q=null,$=null}));function Di(e,t,n){return ae(Math.round(e*n),Math.round(t*n),ie)}async function Oi(){if(process.platform===`win32`){let{stdout:e,code:t}=await c(`powershell`,[`-NoProfile`,`-Command`,`Get-Clipboard`],{useCwd:!1});if(t!==0)throw Error(`PowerShell Get-Clipboard exited with code ${t}`);return e}if(process.platform===`linux`){let{stdout:e,code:t}=await c(`xclip`,[`-selection`,`clipboard`,`-o`],{useCwd:!1});if(t!==0)throw Error(`xclip exited with code ${t}`);return e}let{stdout:e,code:t}=await c(`pbpaste`,[],{useCwd:!1});if(t!==0)throw Error(`pbpaste exited with code ${t}`);return e}async function ki(e){if(process.platform===`win32`){let{code:t}=await c(`powershell`,[`-NoProfile`,`-Command`,`Set-Clipboard -Value '${e.replace(/'/g,`''`)}'`],{useCwd:!1});if(t!==0)throw Error(`PowerShell Set-Clipboard exited with code ${t}`);return}if(process.platform===`linux`){let{code:t}=await c(`xclip`,[`-selection`,`clipboard`],{input:e,useCwd:!1});if(t!==0)throw Error(`xclip exited with code ${t}`);return}let{code:t}=await c(`pbcopy`,[],{input:e,useCwd:!1});if(t!==0)throw Error(`pbcopy exited with code ${t}`)}function Ai(e){if(e.length!==1)return!1;let t=e[0].toLowerCase();return t===`escape`||t===`esc`}async function ji(e,t,n){await e.moveMouse(t,n,!1),await l(zi)}async function Mi(e,t){let n;for(;(n=t.pop())!==void 0;)try{await e.key(n,`release`)}catch{}}async function Ni(e,t,n){let r=[];try{for(let n of t)await e.key(n,`press`),r.push(n);return await n()}finally{await Mi(e,r)}}async function Pi(e,t){let n;try{n=await Oi()}catch{a(`[computer-use] pbpaste before paste failed; proceeding without restore`)}try{if(await ki(t),await Oi()!==t)throw Error(`Clipboard write did not round-trip.`);await e.keys([process.platform===`darwin`?`command`:`ctrl`,`v`]),await l(100)}finally{if(typeof n==`string`)try{await ki(n)}catch{a(`[computer-use] clipboard restore after paste failed`)}}}async function Fi(e,t,n,r){if(!r){await ji(e,t,n);return}let i=await e.mouseLocation(),a=t-i.x,o=n-i.y,s=Math.hypot(a,o);if(s<1)return;let c=Math.min(s/2e3,.5);if(c<.03){await ji(e,t,n);return}let u=Math.floor(c*60);for(let t=1;t<=u;t++){let n=1-(1-t/u)**3;await e.moveMouse(Math.round(i.x+a*n),Math.round(i.y+o*n),!1),t<u&&await l(16.666666666666668)}await l(zi)}function Ii(t){if(process.platform!==`darwin`){let{createCrossPlatformExecutor:n}=(Ei(),e(vi));return n(t)}let n=f(),{getMouseAnimationEnabled:r,getHideBeforeActionEnabled:i}=t,s=ee(),c=s??`com.anthropic.claude-code.cli-no-window`,u=e=>s===null?[...e]:e.filter(e=>e!==s);return a(s?`[computer-use] terminal ${s} → surrogate host (hide-exempt, activate-skip, screenshot-excluded)`:`[computer-use] terminal not detected; falling back to sentinel host`),{capabilities:{...re,hostBundleId:te},async prepareForAction(e,t){return i()?d(async()=>{try{let r=await n.apps.prepareDisplay(e,c,t);return r.activated&&a(`[computer-use] prepareForAction: activated ${r.activated}`),r.hidden}catch(e){return a(`[computer-use] prepareForAction failed; continuing to action: ${o(e)}`,{level:`warn`}),[]}}):[]},async previewHideSet(e,t){return n.apps.previewHideSet([...e,c],t)},async getDisplaySize(e){return n.display.getSize(e)},async listDisplays(){return n.display.listAll()},async findWindowDisplays(e){return n.apps.findWindowDisplays(e)},async resolvePrepareCapture(e){let t=n.display.getSize(e.preferredDisplayId),[r,i]=Di(t.width,t.height,t.scaleFactor),a=await d(()=>n.resolvePrepareCapture(u(e.allowedBundleIds),c,Ri,r,i,e.preferredDisplayId)),o=a;return{...a,displayWidth:o.displayWidth??o.width,displayHeight:o.displayHeight??o.height,originX:o.originX??0,originY:o.originY??0,hidden:o.hidden??[],displayId:o.displayId??e.preferredDisplayId??t.displayId}},async screenshot(e){let t=n.display.getSize(e.displayId),[r,i]=Di(t.width,t.height,t.scaleFactor);return d(()=>n.screenshot.captureExcluding(u(e.allowedBundleIds),Ri,r,i,e.displayId))},async zoom(e,t,r){let i=n.display.getSize(r),[a,o]=Di(e.w,e.h,i.scaleFactor);return d(()=>n.screenshot.captureRegion(u(t),e.x,e.y,e.w,e.h,a,o,Ri,r))},async key(e,t){let n=y(),r=e.split(`+`).filter(e=>e.length>0),i=Ai(r),a=t??1;await d(async()=>{for(let e=0;e<a;e++)e>0&&await l(8),i&&se(),await n.keys(r)})},async holdKey(e,t){let n=y(),r=[],i=!1;try{await d(async()=>{for(let t of e){if(i)return;Ai([t])&&se(),await n.key(t,`press`),r.push(t)}}),await l(t)}finally{i=!0,await d(()=>Mi(n,r))}},async type(e,t){let n=y();if(t.viaClipboard){await d(()=>Pi(n,e));return}await n.typeText(e)},readClipboard:Oi,writeClipboard:ki,async moveMouse(e,t){await ji(y(),e,t)},async click(e,t,n,r,i){let a=y();await ji(a,e,t),i&&i.length>0?await d(()=>Ni(a,i,()=>a.mouseButton(n,`click`,r))):await a.mouseButton(n,`click`,r)},async mouseDown(){await y().mouseButton(`left`,`press`)},async mouseUp(){await y().mouseButton(`left`,`release`)},async getCursorPosition(){return y().mouseLocation()},async drag(e,t){let n=y();e!==void 0&&await ji(n,e.x,e.y),await n.mouseButton(`left`,`press`),await l(zi);try{await Fi(n,t.x,t.y,r())}finally{await n.mouseButton(`left`,`release`)}},async scroll(e,t,n,r){let i=y();await ji(i,e,t),r!==0&&await i.mouseScroll(r,`vertical`),n!==0&&await i.mouseScroll(n,`horizontal`)},async getFrontmostApp(){let e=y().getFrontmostAppInfo();return!e||!e.bundleId?null:{bundleId:e.bundleId,displayName:e.appName}},async appUnderPoint(e,t){return n.apps.appUnderPoint(e,t)},async listInstalledApps(){return d(()=>n.apps.listInstalled())},async getAppIcon(e){return n.apps.iconDataUrl(e)??void 0},async listRunningApps(){return n.apps.listRunning()},async openApp(e){await n.apps.open(e)}}}async function Li(e){e.length!==0&&process.platform===`darwin`&&await f().apps.unhide([...e])}var Ri,zi,Bi=t((()=>{oe(),i(),r(),s(),u(),ne(),ce(),ue(),_t(),le(),Ri=.75,zi=50}));export{Bi as n,Li as r,Ii as t};