@mseep/clawdcursor 1.5.5

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 (354) hide show
  1. package/CHANGELOG.md +2264 -0
  2. package/LICENSE +21 -0
  3. package/README.md +385 -0
  4. package/SECURITY.md +44 -0
  5. package/SKILL.md +503 -0
  6. package/dist/core/agent-loop/agent.d.ts +42 -0
  7. package/dist/core/agent-loop/agent.js +1023 -0
  8. package/dist/core/agent-loop/agent.js.map +1 -0
  9. package/dist/core/agent-loop/batch-tool.d.ts +25 -0
  10. package/dist/core/agent-loop/batch-tool.js +218 -0
  11. package/dist/core/agent-loop/batch-tool.js.map +1 -0
  12. package/dist/core/agent-loop/coord-scale.d.ts +72 -0
  13. package/dist/core/agent-loop/coord-scale.js +89 -0
  14. package/dist/core/agent-loop/coord-scale.js.map +1 -0
  15. package/dist/core/agent-loop/focus-guard.d.ts +24 -0
  16. package/dist/core/agent-loop/focus-guard.js +29 -0
  17. package/dist/core/agent-loop/focus-guard.js.map +1 -0
  18. package/dist/core/agent-loop/project-mcp.d.ts +97 -0
  19. package/dist/core/agent-loop/project-mcp.js +253 -0
  20. package/dist/core/agent-loop/project-mcp.js.map +1 -0
  21. package/dist/core/agent-loop/prompt.d.ts +45 -0
  22. package/dist/core/agent-loop/prompt.js +426 -0
  23. package/dist/core/agent-loop/prompt.js.map +1 -0
  24. package/dist/core/agent-loop/tool-meta.d.ts +93 -0
  25. package/dist/core/agent-loop/tool-meta.js +651 -0
  26. package/dist/core/agent-loop/tool-meta.js.map +1 -0
  27. package/dist/core/agent-loop/tools.d.ts +38 -0
  28. package/dist/core/agent-loop/tools.js +2134 -0
  29. package/dist/core/agent-loop/tools.js.map +1 -0
  30. package/dist/core/agent-loop/types.d.ts +170 -0
  31. package/dist/core/agent-loop/types.js +12 -0
  32. package/dist/core/agent-loop/types.js.map +1 -0
  33. package/dist/core/agent.d.ts +51 -0
  34. package/dist/core/agent.js +245 -0
  35. package/dist/core/agent.js.map +1 -0
  36. package/dist/core/app-categories.d.ts +67 -0
  37. package/dist/core/app-categories.js +108 -0
  38. package/dist/core/app-categories.js.map +1 -0
  39. package/dist/core/banner.d.ts +70 -0
  40. package/dist/core/banner.js +245 -0
  41. package/dist/core/banner.js.map +1 -0
  42. package/dist/core/classify/capability.d.ts +45 -0
  43. package/dist/core/classify/capability.js +78 -0
  44. package/dist/core/classify/capability.js.map +1 -0
  45. package/dist/core/decompose/llm-decomposer.d.ts +35 -0
  46. package/dist/core/decompose/llm-decomposer.js +156 -0
  47. package/dist/core/decompose/llm-decomposer.js.map +1 -0
  48. package/dist/core/decompose/parser.d.ts +27 -0
  49. package/dist/core/decompose/parser.js +101 -0
  50. package/dist/core/decompose/parser.js.map +1 -0
  51. package/dist/core/observability/correlation.d.ts +19 -0
  52. package/dist/core/observability/correlation.js +36 -0
  53. package/dist/core/observability/correlation.js.map +1 -0
  54. package/dist/core/observability/cost-meter.d.ts +51 -0
  55. package/dist/core/observability/cost-meter.js +134 -0
  56. package/dist/core/observability/cost-meter.js.map +1 -0
  57. package/dist/core/observability/logger.d.ts +61 -0
  58. package/dist/core/observability/logger.js +550 -0
  59. package/dist/core/observability/logger.js.map +1 -0
  60. package/dist/core/router/aliases.d.ts +50 -0
  61. package/dist/core/router/aliases.js +104 -0
  62. package/dist/core/router/aliases.js.map +1 -0
  63. package/dist/core/router/normalize.d.ts +41 -0
  64. package/dist/core/router/normalize.js +80 -0
  65. package/dist/core/router/normalize.js.map +1 -0
  66. package/dist/core/safety.d.ts +126 -0
  67. package/dist/core/safety.js +568 -0
  68. package/dist/core/safety.js.map +1 -0
  69. package/dist/core/sense/a11y-resolver.d.ts +73 -0
  70. package/dist/core/sense/a11y-resolver.js +76 -0
  71. package/dist/core/sense/a11y-resolver.js.map +1 -0
  72. package/dist/core/sense/fingerprint.d.ts +41 -0
  73. package/dist/core/sense/fingerprint.js +123 -0
  74. package/dist/core/sense/fingerprint.js.map +1 -0
  75. package/dist/core/sense/rank.d.ts +70 -0
  76. package/dist/core/sense/rank.js +192 -0
  77. package/dist/core/sense/rank.js.map +1 -0
  78. package/dist/core/sense/reactive-check.d.ts +40 -0
  79. package/dist/core/sense/reactive-check.js +48 -0
  80. package/dist/core/sense/reactive-check.js.map +1 -0
  81. package/dist/core/sense/snapshot.d.ts +19 -0
  82. package/dist/core/sense/snapshot.js +100 -0
  83. package/dist/core/sense/snapshot.js.map +1 -0
  84. package/dist/core/sense/types.d.ts +66 -0
  85. package/dist/core/sense/types.js +9 -0
  86. package/dist/core/sense/types.js.map +1 -0
  87. package/dist/core/sense/ui-map-anchors.d.ts +7 -0
  88. package/dist/core/sense/ui-map-anchors.js +24 -0
  89. package/dist/core/sense/ui-map-anchors.js.map +1 -0
  90. package/dist/core/sense/ui-map-elements.d.ts +5 -0
  91. package/dist/core/sense/ui-map-elements.js +33 -0
  92. package/dist/core/sense/ui-map-elements.js.map +1 -0
  93. package/dist/core/sense/ui-map-find.d.ts +56 -0
  94. package/dist/core/sense/ui-map-find.js +153 -0
  95. package/dist/core/sense/ui-map-find.js.map +1 -0
  96. package/dist/core/sense/ui-map-fuse.d.ts +4 -0
  97. package/dist/core/sense/ui-map-fuse.js +44 -0
  98. package/dist/core/sense/ui-map-fuse.js.map +1 -0
  99. package/dist/core/sense/ui-map-geom.d.ts +3 -0
  100. package/dist/core/sense/ui-map-geom.js +16 -0
  101. package/dist/core/sense/ui-map-geom.js.map +1 -0
  102. package/dist/core/sense/ui-map-holder.d.ts +58 -0
  103. package/dist/core/sense/ui-map-holder.js +87 -0
  104. package/dist/core/sense/ui-map-holder.js.map +1 -0
  105. package/dist/core/sense/ui-map-normalize.d.ts +19 -0
  106. package/dist/core/sense/ui-map-normalize.js +65 -0
  107. package/dist/core/sense/ui-map-normalize.js.map +1 -0
  108. package/dist/core/sense/ui-map-render.d.ts +4 -0
  109. package/dist/core/sense/ui-map-render.js +34 -0
  110. package/dist/core/sense/ui-map-render.js.map +1 -0
  111. package/dist/core/sense/ui-map-resolve.d.ts +41 -0
  112. package/dist/core/sense/ui-map-resolve.js +59 -0
  113. package/dist/core/sense/ui-map-resolve.js.map +1 -0
  114. package/dist/core/sense/ui-map-types.d.ts +66 -0
  115. package/dist/core/sense/ui-map-types.js +11 -0
  116. package/dist/core/sense/ui-map-types.js.map +1 -0
  117. package/dist/core/sense/ui-map.d.ts +29 -0
  118. package/dist/core/sense/ui-map.js +113 -0
  119. package/dist/core/sense/ui-map.js.map +1 -0
  120. package/dist/core/verify/assertions.d.ts +132 -0
  121. package/dist/core/verify/assertions.js +284 -0
  122. package/dist/core/verify/assertions.js.map +1 -0
  123. package/dist/index.d.ts +21 -0
  124. package/dist/index.js +24 -0
  125. package/dist/index.js.map +1 -0
  126. package/dist/llm/browser-config.d.ts +36 -0
  127. package/dist/llm/browser-config.js +83 -0
  128. package/dist/llm/browser-config.js.map +1 -0
  129. package/dist/llm/client.d.ts +268 -0
  130. package/dist/llm/client.js +1094 -0
  131. package/dist/llm/client.js.map +1 -0
  132. package/dist/llm/config.d.ts +79 -0
  133. package/dist/llm/config.js +375 -0
  134. package/dist/llm/config.js.map +1 -0
  135. package/dist/llm/credentials.d.ts +35 -0
  136. package/dist/llm/credentials.js +491 -0
  137. package/dist/llm/credentials.js.map +1 -0
  138. package/dist/llm/external-creds.d.ts +42 -0
  139. package/dist/llm/external-creds.js +169 -0
  140. package/dist/llm/external-creds.js.map +1 -0
  141. package/dist/llm/providers.d.ts +123 -0
  142. package/dist/llm/providers.js +717 -0
  143. package/dist/llm/providers.js.map +1 -0
  144. package/dist/paths.d.ts +31 -0
  145. package/dist/paths.js +147 -0
  146. package/dist/paths.js.map +1 -0
  147. package/dist/platform/accessibility.d.ts +139 -0
  148. package/dist/platform/accessibility.js +670 -0
  149. package/dist/platform/accessibility.js.map +1 -0
  150. package/dist/platform/cdp-driver.d.ts +318 -0
  151. package/dist/platform/cdp-driver.js +1179 -0
  152. package/dist/platform/cdp-driver.js.map +1 -0
  153. package/dist/platform/index.d.ts +11 -0
  154. package/dist/platform/index.js +69 -0
  155. package/dist/platform/index.js.map +1 -0
  156. package/dist/platform/keys.d.ts +17 -0
  157. package/dist/platform/keys.js +129 -0
  158. package/dist/platform/keys.js.map +1 -0
  159. package/dist/platform/launch-poll.d.ts +101 -0
  160. package/dist/platform/launch-poll.js +177 -0
  161. package/dist/platform/launch-poll.js.map +1 -0
  162. package/dist/platform/linux.d.ts +173 -0
  163. package/dist/platform/linux.js +1253 -0
  164. package/dist/platform/linux.js.map +1 -0
  165. package/dist/platform/macos.d.ts +136 -0
  166. package/dist/platform/macos.js +976 -0
  167. package/dist/platform/macos.js.map +1 -0
  168. package/dist/platform/native-desktop.d.ts +145 -0
  169. package/dist/platform/native-desktop.js +936 -0
  170. package/dist/platform/native-desktop.js.map +1 -0
  171. package/dist/platform/native-helper.d.ts +130 -0
  172. package/dist/platform/native-helper.js +592 -0
  173. package/dist/platform/native-helper.js.map +1 -0
  174. package/dist/platform/ocr-engine.d.ts +78 -0
  175. package/dist/platform/ocr-engine.js +363 -0
  176. package/dist/platform/ocr-engine.js.map +1 -0
  177. package/dist/platform/ps-runner.d.ts +28 -0
  178. package/dist/platform/ps-runner.js +228 -0
  179. package/dist/platform/ps-runner.js.map +1 -0
  180. package/dist/platform/types.d.ts +397 -0
  181. package/dist/platform/types.js +15 -0
  182. package/dist/platform/types.js.map +1 -0
  183. package/dist/platform/uri-handler.d.ts +75 -0
  184. package/dist/platform/uri-handler.js +273 -0
  185. package/dist/platform/uri-handler.js.map +1 -0
  186. package/dist/platform/wayland-backend.d.ts +53 -0
  187. package/dist/platform/wayland-backend.js +348 -0
  188. package/dist/platform/wayland-backend.js.map +1 -0
  189. package/dist/platform/windows.d.ts +232 -0
  190. package/dist/platform/windows.js +1210 -0
  191. package/dist/platform/windows.js.map +1 -0
  192. package/dist/postbuild.d.ts +10 -0
  193. package/dist/postbuild.js +98 -0
  194. package/dist/postbuild.js.map +1 -0
  195. package/dist/schema/snapshot.d.ts +33 -0
  196. package/dist/schema/snapshot.js +90 -0
  197. package/dist/schema/snapshot.js.map +1 -0
  198. package/dist/shortcuts.d.ts +30 -0
  199. package/dist/shortcuts.js +261 -0
  200. package/dist/shortcuts.js.map +1 -0
  201. package/dist/surface/cli.d.ts +7 -0
  202. package/dist/surface/cli.js +1556 -0
  203. package/dist/surface/cli.js.map +1 -0
  204. package/dist/surface/dashboard.d.ts +8 -0
  205. package/dist/surface/dashboard.js +1193 -0
  206. package/dist/surface/dashboard.js.map +1 -0
  207. package/dist/surface/doctor.d.ts +29 -0
  208. package/dist/surface/doctor.js +1514 -0
  209. package/dist/surface/doctor.js.map +1 -0
  210. package/dist/surface/format.d.ts +10 -0
  211. package/dist/surface/format.js +37 -0
  212. package/dist/surface/format.js.map +1 -0
  213. package/dist/surface/http-utility.d.ts +65 -0
  214. package/dist/surface/http-utility.js +336 -0
  215. package/dist/surface/http-utility.js.map +1 -0
  216. package/dist/surface/mcp-server.d.ts +91 -0
  217. package/dist/surface/mcp-server.js +280 -0
  218. package/dist/surface/mcp-server.js.map +1 -0
  219. package/dist/surface/onboarding.d.ts +15 -0
  220. package/dist/surface/onboarding.js +184 -0
  221. package/dist/surface/onboarding.js.map +1 -0
  222. package/dist/surface/pidfile.d.ts +79 -0
  223. package/dist/surface/pidfile.js +263 -0
  224. package/dist/surface/pidfile.js.map +1 -0
  225. package/dist/surface/readiness.d.ts +45 -0
  226. package/dist/surface/readiness.js +230 -0
  227. package/dist/surface/readiness.js.map +1 -0
  228. package/dist/surface/report.d.ts +68 -0
  229. package/dist/surface/report.js +341 -0
  230. package/dist/surface/report.js.map +1 -0
  231. package/dist/surface/skill-register.d.ts +14 -0
  232. package/dist/surface/skill-register.js +150 -0
  233. package/dist/surface/skill-register.js.map +1 -0
  234. package/dist/surface/version.d.ts +6 -0
  235. package/dist/surface/version.js +27 -0
  236. package/dist/surface/version.js.map +1 -0
  237. package/dist/tools/a11y.d.ts +8 -0
  238. package/dist/tools/a11y.js +545 -0
  239. package/dist/tools/a11y.js.map +1 -0
  240. package/dist/tools/a11y_depth.d.ts +19 -0
  241. package/dist/tools/a11y_depth.js +455 -0
  242. package/dist/tools/a11y_depth.js.map +1 -0
  243. package/dist/tools/agent.d.ts +15 -0
  244. package/dist/tools/agent.js +248 -0
  245. package/dist/tools/agent.js.map +1 -0
  246. package/dist/tools/batch.d.ts +46 -0
  247. package/dist/tools/batch.js +230 -0
  248. package/dist/tools/batch.js.map +1 -0
  249. package/dist/tools/cdp.d.ts +8 -0
  250. package/dist/tools/cdp.js +233 -0
  251. package/dist/tools/cdp.js.map +1 -0
  252. package/dist/tools/compact.d.ts +63 -0
  253. package/dist/tools/compact.js +418 -0
  254. package/dist/tools/compact.js.map +1 -0
  255. package/dist/tools/cost-class.d.ts +38 -0
  256. package/dist/tools/cost-class.js +117 -0
  257. package/dist/tools/cost-class.js.map +1 -0
  258. package/dist/tools/desktop.d.ts +9 -0
  259. package/dist/tools/desktop.js +346 -0
  260. package/dist/tools/desktop.js.map +1 -0
  261. package/dist/tools/electron_bridge.d.ts +41 -0
  262. package/dist/tools/electron_bridge.js +261 -0
  263. package/dist/tools/electron_bridge.js.map +1 -0
  264. package/dist/tools/extras.d.ts +22 -0
  265. package/dist/tools/extras.js +942 -0
  266. package/dist/tools/extras.js.map +1 -0
  267. package/dist/tools/favorites.d.ts +13 -0
  268. package/dist/tools/favorites.js +137 -0
  269. package/dist/tools/favorites.js.map +1 -0
  270. package/dist/tools/introspection.d.ts +13 -0
  271. package/dist/tools/introspection.js +55 -0
  272. package/dist/tools/introspection.js.map +1 -0
  273. package/dist/tools/ocr.d.ts +8 -0
  274. package/dist/tools/ocr.js +66 -0
  275. package/dist/tools/ocr.js.map +1 -0
  276. package/dist/tools/orchestration.d.ts +7 -0
  277. package/dist/tools/orchestration.js +377 -0
  278. package/dist/tools/orchestration.js.map +1 -0
  279. package/dist/tools/playbooks/extract-compose.d.ts +22 -0
  280. package/dist/tools/playbooks/extract-compose.js +85 -0
  281. package/dist/tools/playbooks/extract-compose.js.map +1 -0
  282. package/dist/tools/playbooks/find-replace.d.ts +11 -0
  283. package/dist/tools/playbooks/find-replace.js +56 -0
  284. package/dist/tools/playbooks/find-replace.js.map +1 -0
  285. package/dist/tools/playbooks/index.d.ts +63 -0
  286. package/dist/tools/playbooks/index.js +70 -0
  287. package/dist/tools/playbooks/index.js.map +1 -0
  288. package/dist/tools/playbooks/keys-blocklist.d.ts +24 -0
  289. package/dist/tools/playbooks/keys-blocklist.js +89 -0
  290. package/dist/tools/playbooks/keys-blocklist.js.map +1 -0
  291. package/dist/tools/registry.d.ts +40 -0
  292. package/dist/tools/registry.js +560 -0
  293. package/dist/tools/registry.js.map +1 -0
  294. package/dist/tools/safety-gate.d.ts +16 -0
  295. package/dist/tools/safety-gate.js +70 -0
  296. package/dist/tools/safety-gate.js.map +1 -0
  297. package/dist/tools/scheduler.d.ts +76 -0
  298. package/dist/tools/scheduler.js +413 -0
  299. package/dist/tools/scheduler.js.map +1 -0
  300. package/dist/tools/shortcuts.d.ts +13 -0
  301. package/dist/tools/shortcuts.js +205 -0
  302. package/dist/tools/shortcuts.js.map +1 -0
  303. package/dist/tools/smart.d.ts +15 -0
  304. package/dist/tools/smart.js +785 -0
  305. package/dist/tools/smart.js.map +1 -0
  306. package/dist/tools/types.d.ts +174 -0
  307. package/dist/tools/types.js +67 -0
  308. package/dist/tools/types.js.map +1 -0
  309. package/dist/tools/window-text.d.ts +15 -0
  310. package/dist/tools/window-text.js +39 -0
  311. package/dist/tools/window-text.js.map +1 -0
  312. package/dist/types.d.ts +122 -0
  313. package/dist/types.js +41 -0
  314. package/dist/types.js.map +1 -0
  315. package/native/Package.swift +38 -0
  316. package/native/README.md +113 -0
  317. package/native/Sources/ClawdCursorHelper/main.swift +602 -0
  318. package/native/Sources/ClawdCursorHost/main.swift +182 -0
  319. package/native/Sources/PermissionCheck/main.swift +53 -0
  320. package/native/Sources/ScreenshotHelper/main.swift +219 -0
  321. package/native/build.sh +139 -0
  322. package/native/entitlements.plist +12 -0
  323. package/package.json +115 -0
  324. package/scripts/banner.ps1 +112 -0
  325. package/scripts/coord-accuracy.ps1 +140 -0
  326. package/scripts/coord-uwp.ps1 +80 -0
  327. package/scripts/edge-glow.ps1 +180 -0
  328. package/scripts/find-element.ps1 +198 -0
  329. package/scripts/get-foreground-window.ps1 +71 -0
  330. package/scripts/get-screen-context.ps1 +183 -0
  331. package/scripts/get-windows.ps1 +66 -0
  332. package/scripts/install-panic-hotkey.ps1 +46 -0
  333. package/scripts/interact-element.ps1 +431 -0
  334. package/scripts/invoke-element.ps1 +314 -0
  335. package/scripts/linux/atspi-bridge.py +356 -0
  336. package/scripts/linux/ocr-recognize.py +154 -0
  337. package/scripts/mac/_window-picker.jxa +163 -0
  338. package/scripts/mac/find-element.jxa +0 -0
  339. package/scripts/mac/find-element.sh +161 -0
  340. package/scripts/mac/focus-window.jxa +284 -0
  341. package/scripts/mac/get-focused-element.jxa +102 -0
  342. package/scripts/mac/get-foreground-window.jxa +173 -0
  343. package/scripts/mac/get-screen-context.jxa +197 -0
  344. package/scripts/mac/get-ui-tree.sh +141 -0
  345. package/scripts/mac/get-windows.jxa +117 -0
  346. package/scripts/mac/interact-element.sh +235 -0
  347. package/scripts/mac/invoke-element.jxa +408 -0
  348. package/scripts/mac/ocr-recognize.swift +124 -0
  349. package/scripts/ocr-recognize.ps1 +102 -0
  350. package/scripts/postinstall-native.js +48 -0
  351. package/scripts/ps-bridge.ps1 +830 -0
  352. package/scripts/smoke-mcp.ps1 +119 -0
  353. package/scripts/sync-version.ts +178 -0
  354. package/scripts/verify-install.js +81 -0
@@ -0,0 +1,346 @@
1
+ "use strict";
2
+ /**
3
+ * Desktop tools — screenshot, mouse, keyboard, screen info.
4
+ *
5
+ * Coordinate system: All mouse tools accept IMAGE-SPACE coordinates
6
+ * (matching the 1280px-wide screenshots from desktop_screenshot).
7
+ * The server auto-scales to Windows LOGICAL coordinates via mouseScaleFactor.
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || (function () {
26
+ var ownKeys = function(o) {
27
+ ownKeys = Object.getOwnPropertyNames || function (o) {
28
+ var ar = [];
29
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
+ return ar;
31
+ };
32
+ return ownKeys(o);
33
+ };
34
+ return function (mod) {
35
+ if (mod && mod.__esModule) return mod;
36
+ var result = {};
37
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
+ __setModuleDefault(result, mod);
39
+ return result;
40
+ };
41
+ })();
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.getDesktopTools = getDesktopTools;
44
+ const os = __importStar(require("os"));
45
+ /** Dangerous key combos that are blocked */
46
+ const BLOCKED_KEYS = ['alt+f4', 'ctrl+alt+delete', 'ctrl+alt+del'];
47
+ const IS_MAC = os.platform() === 'darwin';
48
+ /**
49
+ * Best-effort active-window label for a tool's result text.
50
+ *
51
+ * `getActiveWindow()` goes through the platform a11y bridge (the persistent
52
+ * PowerShell/UIA process on Windows, AX on macOS, AT-SPI on Linux). That call
53
+ * is only ever used here to ANNOTATE the result ("Key pressed: X in [app]") —
54
+ * it is NOT load-bearing for the actual key/type action. So it must never be
55
+ * able to block or hang the action: if the bridge is slow, recovering, or
56
+ * wedged, we fall back to "(unknown)" after a short timeout and the keystroke
57
+ * still goes through. OS-agnostic — applies to every platform's bridge.
58
+ */
59
+ async function activeWindowLabel(ctx) {
60
+ try {
61
+ const active = await Promise.race([
62
+ ctx.a11y.getActiveWindow(),
63
+ new Promise(resolve => setTimeout(() => resolve(null), 1500)),
64
+ ]);
65
+ return active ? `[${active.processName}] "${active.title}"` : '(unknown)';
66
+ }
67
+ catch {
68
+ return '(unknown)';
69
+ }
70
+ }
71
+ function getDesktopTools() {
72
+ return [
73
+ // ── PERCEPTION ──
74
+ {
75
+ name: 'desktop_screenshot',
76
+ description: 'LAST RESORT — take a screenshot only when the accessibility tree and OCR are both insufficient (custom canvas, icon-only UI, pixel-level verification). Prefer read_screen first, then ocr_read_screen; escalate to screenshot only when those fail. Returns the image resized to 1280px wide.',
77
+ parameters: {},
78
+ category: 'perception',
79
+ compactGroup: 'computer',
80
+ safetyTier: 0,
81
+ handler: async (_params, ctx) => {
82
+ await ctx.ensureInitialized();
83
+ const frame = await ctx.desktop.captureForLLM();
84
+ const base64 = frame.buffer.toString('base64');
85
+ return {
86
+ text: `Screenshot: ${frame.llmWidth}x${frame.llmHeight}px (real: ${frame.width}x${frame.height}, scale: ${frame.scaleFactor.toFixed(2)}x). Mouse tools accept these image-space coordinates.`,
87
+ image: { data: base64, mimeType: 'image/jpeg' },
88
+ };
89
+ },
90
+ },
91
+ {
92
+ name: 'desktop_screenshot_region',
93
+ description: 'Take a zoomed screenshot of a specific screen region for detailed inspection. Coordinates are in image-space (from desktop_screenshot).',
94
+ parameters: {
95
+ x: { type: 'number', description: 'Left edge X in image-space coordinates', required: true },
96
+ y: { type: 'number', description: 'Top edge Y in image-space coordinates', required: true },
97
+ width: { type: 'number', description: 'Width in image-space pixels', required: true },
98
+ height: { type: 'number', description: 'Height in image-space pixels', required: true },
99
+ },
100
+ category: 'perception',
101
+ compactGroup: 'computer',
102
+ safetyTier: 0,
103
+ handler: async ({ x, y, width, height }, ctx) => {
104
+ await ctx.ensureInitialized();
105
+ const sf = ctx.getScreenshotScaleFactor();
106
+ const frame = await ctx.desktop.captureRegionForLLM(Math.round(x * sf), Math.round(y * sf), Math.round(width * sf), Math.round(height * sf));
107
+ const base64 = frame.buffer.toString('base64');
108
+ return {
109
+ text: `Region: (${x},${y}) ${width}x${height} image-space → zoomed to ${frame.llmWidth}x${frame.llmHeight}px.`,
110
+ image: { data: base64, mimeType: 'image/jpeg' },
111
+ };
112
+ },
113
+ },
114
+ {
115
+ name: 'get_screen_size',
116
+ description: 'Get the screen dimensions and scale factor.',
117
+ parameters: {},
118
+ category: 'perception',
119
+ compactGroup: 'window',
120
+ safetyTier: 0,
121
+ handler: async (_params, ctx) => {
122
+ await ctx.ensureInitialized();
123
+ const size = ctx.desktop.getScreenSize();
124
+ const msf = ctx.getMouseScaleFactor();
125
+ const ssf = ctx.getScreenshotScaleFactor();
126
+ return {
127
+ text: JSON.stringify({
128
+ physicalWidth: size.width,
129
+ physicalHeight: size.height,
130
+ screenshotScaleFactor: ssf,
131
+ mouseScaleFactor: msf,
132
+ imageWidth: Math.round(size.width / ssf),
133
+ imageHeight: Math.round(size.height / ssf),
134
+ }),
135
+ };
136
+ },
137
+ },
138
+ // ── MOUSE ──
139
+ {
140
+ name: 'mouse_click',
141
+ description: 'Click the left mouse button at the given image-space coordinates.',
142
+ parameters: {
143
+ x: { type: 'number', description: 'X coordinate in image-space', required: true },
144
+ y: { type: 'number', description: 'Y coordinate in image-space', required: true },
145
+ },
146
+ category: 'mouse',
147
+ compactGroup: 'computer',
148
+ safetyTier: 1,
149
+ handler: async ({ x, y }, ctx) => {
150
+ await ctx.ensureInitialized();
151
+ const sf = ctx.getMouseScaleFactor();
152
+ const rx = Math.round(x * sf), ry = Math.round(y * sf);
153
+ await ctx.desktop.mouseClick(rx, ry);
154
+ ctx.a11y.invalidateCache();
155
+ ctx.uiMaps?.invalidate();
156
+ return { text: `Clicked at (${x}, ${y}) → logical (${rx}, ${ry})` };
157
+ },
158
+ },
159
+ {
160
+ name: 'mouse_double_click',
161
+ description: 'Double-click the left mouse button at the given image-space coordinates.',
162
+ parameters: {
163
+ x: { type: 'number', description: 'X coordinate in image-space', required: true },
164
+ y: { type: 'number', description: 'Y coordinate in image-space', required: true },
165
+ },
166
+ category: 'mouse',
167
+ compactGroup: 'computer',
168
+ safetyTier: 1,
169
+ handler: async ({ x, y }, ctx) => {
170
+ await ctx.ensureInitialized();
171
+ const sf = ctx.getMouseScaleFactor();
172
+ await ctx.desktop.mouseDoubleClick(Math.round(x * sf), Math.round(y * sf));
173
+ ctx.a11y.invalidateCache();
174
+ ctx.uiMaps?.invalidate();
175
+ return { text: `Double-clicked at (${x}, ${y})` };
176
+ },
177
+ },
178
+ {
179
+ name: 'mouse_right_click',
180
+ description: 'Right-click at the given image-space coordinates (opens context menu).',
181
+ parameters: {
182
+ x: { type: 'number', description: 'X coordinate in image-space', required: true },
183
+ y: { type: 'number', description: 'Y coordinate in image-space', required: true },
184
+ },
185
+ category: 'mouse',
186
+ compactGroup: 'computer',
187
+ safetyTier: 1,
188
+ handler: async ({ x, y }, ctx) => {
189
+ await ctx.ensureInitialized();
190
+ const sf = ctx.getMouseScaleFactor();
191
+ await ctx.desktop.mouseRightClick(Math.round(x * sf), Math.round(y * sf));
192
+ ctx.a11y.invalidateCache();
193
+ ctx.uiMaps?.invalidate();
194
+ return { text: `Right-clicked at (${x}, ${y})` };
195
+ },
196
+ },
197
+ {
198
+ name: 'mouse_hover',
199
+ description: 'Move the mouse to the given image-space coordinates without clicking. Useful for revealing tooltips or hover menus.',
200
+ parameters: {
201
+ x: { type: 'number', description: 'X coordinate in image-space', required: true },
202
+ y: { type: 'number', description: 'Y coordinate in image-space', required: true },
203
+ },
204
+ category: 'mouse',
205
+ compactGroup: 'computer',
206
+ safetyTier: 1,
207
+ handler: async ({ x, y }, ctx) => {
208
+ await ctx.ensureInitialized();
209
+ const sf = ctx.getMouseScaleFactor();
210
+ await ctx.desktop.mouseMove(Math.round(x * sf), Math.round(y * sf));
211
+ return { text: `Mouse moved to (${x}, ${y})` };
212
+ },
213
+ },
214
+ {
215
+ name: 'mouse_scroll',
216
+ description: 'Scroll the mouse wheel at the given image-space coordinates.',
217
+ parameters: {
218
+ x: { type: 'number', description: 'X coordinate in image-space', required: true },
219
+ y: { type: 'number', description: 'Y coordinate in image-space', required: true },
220
+ direction: { type: 'string', description: 'Scroll direction', required: true, enum: ['up', 'down'] },
221
+ amount: { type: 'number', description: 'Scroll amount in wheel ticks (default: 3)', required: false, default: 3 },
222
+ },
223
+ category: 'mouse',
224
+ compactGroup: 'computer',
225
+ safetyTier: 1,
226
+ handler: async ({ x, y, direction, amount }, ctx) => {
227
+ await ctx.ensureInitialized();
228
+ const sf = ctx.getMouseScaleFactor();
229
+ const ticks = amount ?? 3;
230
+ const delta = direction === 'down' ? ticks : -ticks;
231
+ await ctx.desktop.mouseScroll(Math.round(x * sf), Math.round(y * sf), delta);
232
+ return { text: `Scrolled ${direction} ${ticks} ticks at (${x}, ${y})` };
233
+ },
234
+ },
235
+ {
236
+ name: 'mouse_drag',
237
+ description: 'Drag from one image-space coordinate to another (click-hold-move-release). Useful for selecting text, moving objects, or resizing.',
238
+ parameters: {
239
+ startX: { type: 'number', description: 'Start X in image-space', required: true },
240
+ startY: { type: 'number', description: 'Start Y in image-space', required: true },
241
+ endX: { type: 'number', description: 'End X in image-space', required: true },
242
+ endY: { type: 'number', description: 'End Y in image-space', required: true },
243
+ x1: { type: 'number', description: 'Alias for startX', required: false },
244
+ y1: { type: 'number', description: 'Alias for startY', required: false },
245
+ x2: { type: 'number', description: 'Alias for endX', required: false },
246
+ y2: { type: 'number', description: 'Alias for endY', required: false },
247
+ },
248
+ category: 'mouse',
249
+ compactGroup: 'computer',
250
+ safetyTier: 1,
251
+ handler: async ({ startX, startY, endX, endY, x1, y1, x2, y2 }, ctx) => {
252
+ await ctx.ensureInitialized();
253
+ const sx = startX ?? x1;
254
+ const sy = startY ?? y1;
255
+ const ex = endX ?? x2;
256
+ const ey = endY ?? y2;
257
+ const sf = ctx.getMouseScaleFactor();
258
+ await ctx.desktop.mouseDrag(Math.round(sx * sf), Math.round(sy * sf), Math.round(ex * sf), Math.round(ey * sf));
259
+ ctx.a11y.invalidateCache();
260
+ ctx.uiMaps?.invalidate();
261
+ return { text: `Dragged (${sx},${sy}) → (${ex},${ey})` };
262
+ },
263
+ },
264
+ // ── KEYBOARD ──
265
+ {
266
+ name: 'type_text',
267
+ description: 'Type text into the currently focused element. Internally uses clipboard paste for reliability (no dropped chars). The user clipboard is saved before and restored after, so calling type_text never clobbers any text the caller had previously placed on the clipboard.',
268
+ parameters: {
269
+ text: { type: 'string', description: 'The text to type', required: true },
270
+ },
271
+ category: 'keyboard',
272
+ compactGroup: 'computer',
273
+ safetyTier: 1,
274
+ handler: async ({ text }, ctx) => {
275
+ await ctx.ensureInitialized();
276
+ const activeInfo = await activeWindowLabel(ctx);
277
+ // Preserve the user's clipboard contents around the paste-as-type
278
+ // operation. Without this, callers who do
279
+ // write_clipboard("important sentence")
280
+ // type_text("\nheader\n")
281
+ // key_press("ctrl+v")
282
+ // get the header text re-pasted instead of the sentence — type_text
283
+ // silently overwrote the clipboard. Save/restore makes type_text
284
+ // transparent to the clipboard.
285
+ let saved = null;
286
+ try {
287
+ saved = await ctx.a11y.readClipboard();
288
+ }
289
+ catch { /* clipboard unreadable — leave saved=null, restore becomes a no-op below */ }
290
+ await ctx.a11y.writeClipboard(text);
291
+ await new Promise(r => setTimeout(r, 50));
292
+ // Paste combo is platform-specific
293
+ await ctx.desktop.keyPress(IS_MAC ? 'super+v' : 'ctrl+v');
294
+ await new Promise(r => setTimeout(r, 100));
295
+ // Restore clipboard. Best-effort — if the read failed (no clipboard
296
+ // available) or the restore throws, we don't surface the error;
297
+ // type_text's contract is about typing, not clipboard ops.
298
+ if (saved !== null) {
299
+ try {
300
+ await ctx.a11y.writeClipboard(saved);
301
+ }
302
+ catch { /* best-effort */ }
303
+ }
304
+ ctx.a11y.invalidateCache();
305
+ ctx.uiMaps?.invalidate();
306
+ return { text: `Typed ${text.length} chars into ${activeInfo}` };
307
+ },
308
+ },
309
+ {
310
+ name: 'key_press',
311
+ description: 'Press a keyboard key or key combination. Use "+" for a chord (e.g. "ctrl+s", "shift+enter", "alt+tab"). Separate multiple presses with SPACES to send them in sequence (e.g. "Down Down End", "ctrl+a Delete"). Single keys: "Return", "Tab", "Escape", "Backspace", "Delete", "F1"-"F12", "Left/Right/Up/Down".',
312
+ parameters: {
313
+ key: { type: 'string', description: 'Key/combo to press (e.g. "Return", "ctrl+a", "F5"). Space-separate combos for a sequence ("Down Down End").', required: true },
314
+ },
315
+ category: 'keyboard',
316
+ compactGroup: 'computer',
317
+ safetyTier: 1,
318
+ handler: async ({ key }, ctx) => {
319
+ await ctx.ensureInitialized();
320
+ // Defense-in-depth: a missing/mistyped arg used to reach `.toLowerCase()`
321
+ // on `undefined` and throw an opaque crash. Fail with an actionable
322
+ // message instead (the `computer` compound names this field `combo`,
323
+ // with `key` accepted as an alias).
324
+ if (typeof key !== 'string' || key.trim() === '') {
325
+ return { text: 'key_press: "key" is required — the key or combo to press, e.g. "Return" or "ctrl+a". (On the `computer` compound the field is `combo`; `key` is also accepted.)', isError: true };
326
+ }
327
+ // "+" joins a chord; whitespace separates combos pressed in sequence.
328
+ const combos = key.trim().split(/\s+/);
329
+ for (const combo of combos) {
330
+ const lower = combo.toLowerCase().replace(/\s+/g, '');
331
+ if (BLOCKED_KEYS.some(b => lower === b)) {
332
+ return { text: `BLOCKED: "${combo}" is a dangerous key combo.`, isError: true };
333
+ }
334
+ }
335
+ const activeInfo = await activeWindowLabel(ctx);
336
+ for (const combo of combos) {
337
+ await ctx.desktop.keyPress(combo);
338
+ }
339
+ ctx.a11y.invalidateCache();
340
+ ctx.uiMaps?.invalidate();
341
+ return { text: `Key pressed: ${key} in ${activeInfo}` };
342
+ },
343
+ },
344
+ ];
345
+ }
346
+ //# sourceMapping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AAC,CAAC;gBACpC,CAAC;gBACD,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;gBAC3B,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC;gBACzB,OAAO,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,UAAU,EAAE,EAAE,CAAC;YAC1D,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * v0.8.2 — Electron / WebView2 / WKWebView detection + CDP bridging hints.
3
+ *
4
+ * Modern "native" apps on Windows and macOS are frequently Electron or
5
+ * WebView2 wrappers around Chromium. Their accessibility trees often
6
+ * contain only the window chrome — the entire document body is inside
7
+ * the web view and is NOT reachable via UIA or AX directly.
8
+ *
9
+ * Examples on Windows (WebView2 / Electron):
10
+ * - New Outlook (olk)
11
+ * - Microsoft Teams
12
+ * - Discord
13
+ * - Slack
14
+ * - VS Code
15
+ * - GitHub Desktop
16
+ * - Notion
17
+ *
18
+ * The clean fix is to bridge to their embedded Chromium via CDP. That
19
+ * requires the app to be launched with a remote-debugging port. We
20
+ * cannot attach to an already-running app that wasn't launched that
21
+ * way, but we CAN:
22
+ *
23
+ * 1. Detect which running processes are Electron/WebView2 shells by
24
+ * process-name heuristics + module snooping (on Windows).
25
+ * 2. Scan the common Electron remote-debug port range for already-
26
+ * enabled /json endpoints.
27
+ * 3. Tell the agent HOW to relaunch the app with debugging enabled
28
+ * so a bridge can attach.
29
+ *
30
+ * This file ships two tools:
31
+ * - `detect_webview_apps` — enumerate candidates + their CDP status
32
+ * - `attach_webview_cdp` — discover the debugger URL and connect
33
+ * the existing cdp_driver to it
34
+ *
35
+ * Linux TODO: the same heuristics apply (look for
36
+ * /proc/{pid}/cmdline containing `--type=renderer` or `.asar`), but
37
+ * AT-SPI already gives us a richer tree on Linux Electron apps than
38
+ * UIA does on Windows. Follow-up.
39
+ */
40
+ import type { ToolDefinition } from './types';
41
+ export declare function getElectronBridgeTools(): ToolDefinition[];