@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,104 @@
1
+ "use strict";
2
+ /**
3
+ * APP_ALIASES — the 40-app, 3-OS canonical app table.
4
+ *
5
+ * Ported verbatim from src/action-router.ts (v0.6.3 heritage). Each row
6
+ * maps a user-facing natural-language name to the set of actual process
7
+ * names on each OS plus the macOS app bundle name.
8
+ *
9
+ * Adding an app = one row here, nothing else. No business-logic file
10
+ * should reference raw process names — they go through this table.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.APP_ALIASES = void 0;
14
+ exports.resolveAlias = resolveAlias;
15
+ const normalize_1 = require("./normalize");
16
+ exports.APP_ALIASES = {
17
+ // Drawing / editors
18
+ 'paint': { processNames: ['mspaint'], searchTerm: 'Paint', executable: 'mspaint.exe', alwaysNewInstance: true },
19
+ 'mspaint': { processNames: ['mspaint'], searchTerm: 'Paint', executable: 'mspaint.exe', alwaysNewInstance: true },
20
+ // Notepad is UWP on Win11 (Microsoft.WindowsNotepad). The classic
21
+ // `notepad.exe` redirector still exists but spawns the UWP app via
22
+ // ApplicationFrameHost, so the polled window has processName "Notepad"
23
+ // not "notepad.exe". uwpAppId is the reliable Win11 launch route.
24
+ 'notepad': { processNames: ['Notepad', 'notepad', 'ApplicationFrameHost'], searchTerm: 'Notepad', executable: 'notepad.exe', uwpAppId: 'Microsoft.WindowsNotepad_8wekyb3d8bbwe!App', alwaysNewInstance: true, macOSAppName: 'TextEdit' },
25
+ 'textedit': { processNames: ['TextEdit'], searchTerm: 'TextEdit', macOSAppName: 'TextEdit' },
26
+ // Utility (Windows Calculator is UWP on Win10+; direct `Start-Process calc` fails)
27
+ 'calculator': { processNames: ['CalculatorApp', 'Calculator', 'calc'], searchTerm: 'Calculator', macOSAppName: 'Calculator', uwpAppId: 'Microsoft.WindowsCalculator_8wekyb3d8bbwe!App' },
28
+ 'calc': { processNames: ['CalculatorApp', 'Calculator', 'calc'], searchTerm: 'Calculator', macOSAppName: 'Calculator', uwpAppId: 'Microsoft.WindowsCalculator_8wekyb3d8bbwe!App' },
29
+ // Browsers — executables let the direct-launch strategy fire first on Win32.
30
+ // If the exe isn't on PATH, the router's Start Menu search fallback picks up.
31
+ 'chrome': { processNames: ['chrome', 'Google Chrome'], searchTerm: 'Chrome', executable: 'chrome.exe', macOSAppName: 'Google Chrome' },
32
+ 'google chrome': { processNames: ['chrome', 'Google Chrome'], searchTerm: 'Chrome', executable: 'chrome.exe', macOSAppName: 'Google Chrome' },
33
+ 'firefox': { processNames: ['firefox'], searchTerm: 'Firefox', executable: 'firefox.exe', macOSAppName: 'Firefox' },
34
+ 'safari': { processNames: ['Safari'], searchTerm: 'Safari', macOSAppName: 'Safari' },
35
+ 'edge': { processNames: ['msedge'], searchTerm: 'Edge', executable: 'msedge.exe', macOSAppName: 'Microsoft Edge' },
36
+ 'microsoft edge': { processNames: ['msedge'], searchTerm: 'Edge', executable: 'msedge.exe', macOSAppName: 'Microsoft Edge' },
37
+ // Office
38
+ 'outlook': { processNames: ['OUTLOOK', 'olk'], searchTerm: 'Outlook', macOSAppName: 'Microsoft Outlook' },
39
+ 'microsoft outlook': { processNames: ['OUTLOOK', 'olk'], searchTerm: 'Outlook', macOSAppName: 'Microsoft Outlook' },
40
+ 'word': { processNames: ['WINWORD'], searchTerm: 'Word', macOSAppName: 'Microsoft Word' },
41
+ 'excel': { processNames: ['EXCEL'], searchTerm: 'Excel', macOSAppName: 'Microsoft Excel' },
42
+ // Shell
43
+ 'explorer': { processNames: ['explorer'], searchTerm: 'File Explorer', macOSAppName: 'Finder' },
44
+ 'finder': { processNames: ['Finder'], searchTerm: 'Finder', macOSAppName: 'Finder' },
45
+ 'file explorer': { processNames: ['explorer'], searchTerm: 'File Explorer', macOSAppName: 'Finder' },
46
+ 'cmd': { processNames: ['cmd'], searchTerm: 'Command Prompt', macOSAppName: 'Terminal' },
47
+ 'terminal': { processNames: ['WindowsTerminal', 'cmd', 'Terminal'], searchTerm: 'Terminal', macOSAppName: 'Terminal' },
48
+ 'powershell': { processNames: ['powershell', 'pwsh'], searchTerm: 'PowerShell' },
49
+ // Dev tools
50
+ 'vscode': { processNames: ['Code'], searchTerm: 'Visual Studio Code', macOSAppName: 'Visual Studio Code' },
51
+ 'code': { processNames: ['Code'], searchTerm: 'Visual Studio Code', macOSAppName: 'Visual Studio Code' },
52
+ 'cursor': { processNames: ['Cursor'], searchTerm: 'Cursor', macOSAppName: 'Cursor' },
53
+ 'xcode': { processNames: ['Xcode'], searchTerm: 'Xcode', macOSAppName: 'Xcode' },
54
+ 'wezterm': { processNames: ['WezTerm', 'wezterm'], searchTerm: 'WezTerm', macOSAppName: 'WezTerm' },
55
+ 'iterm': { processNames: ['iTerm2', 'iTerm'], searchTerm: 'iTerm', macOSAppName: 'iTerm' },
56
+ 'iterm2': { processNames: ['iTerm2'], searchTerm: 'iTerm2', macOSAppName: 'iTerm' },
57
+ // Settings / system
58
+ 'settings': { processNames: ['SystemSettings'], searchTerm: 'Settings', macOSAppName: 'System Settings' },
59
+ 'system settings': { processNames: ['System Preferences', 'System Settings'], searchTerm: 'System Settings', macOSAppName: 'System Settings' },
60
+ 'task manager': { processNames: ['Taskmgr'], searchTerm: 'Task Manager', macOSAppName: 'Activity Monitor' },
61
+ 'activity monitor': { processNames: ['Activity Monitor'], searchTerm: 'Activity Monitor', macOSAppName: 'Activity Monitor' },
62
+ // Collab / comms
63
+ 'figma': { processNames: ['Figma'], searchTerm: 'Figma', macOSAppName: 'Figma' },
64
+ 'slack': { processNames: ['Slack', 'slack'], searchTerm: 'Slack', macOSAppName: 'Slack' },
65
+ 'teams': { processNames: ['ms-teams', 'Teams'], searchTerm: 'Teams', macOSAppName: 'Microsoft Teams' },
66
+ 'discord': { processNames: ['Discord'], searchTerm: 'Discord', macOSAppName: 'Discord' },
67
+ // Media
68
+ 'spotify': { processNames: ['Spotify'], searchTerm: 'Spotify', macOSAppName: 'Spotify' },
69
+ // Apple native
70
+ 'notes': { processNames: ['Notes'], searchTerm: 'Notes', macOSAppName: 'Notes' },
71
+ 'mail': { processNames: ['Mail'], searchTerm: 'Mail', macOSAppName: 'Mail' },
72
+ };
73
+ /**
74
+ * Resolve a user-facing app name to its alias row. Goes through
75
+ * `normalizeAppName` first so phrasings like "the Outlook app",
76
+ * "Edge browser", or '"chrome"' all match the same canonical key as
77
+ * the bare app name. Returns null for unknown apps — caller should
78
+ * fall back to `launchApp(name)` with the raw string.
79
+ *
80
+ * This is the single choke point for "name → alias row". Every caller
81
+ * (router, agent's `open_app`, MCP `mcp__clawdcursor__window`, REST
82
+ * `/execute`) hits this function, so adding normalization here means
83
+ * we don't have to push the same logic into every entry point.
84
+ */
85
+ function resolveAlias(name) {
86
+ const k = (0, normalize_1.normalizeAppName)(name);
87
+ if (!k)
88
+ return null;
89
+ // Try the normalized form first.
90
+ let hit = exports.APP_ALIASES[k];
91
+ // Fallback: if the user's literal phrase was multi-word with a filler
92
+ // suffix that took it back below an alias key (e.g. "music app" → "music"
93
+ // → no alias), try the un-normalized form too. Cheap and only fires
94
+ // when normalization didn't help.
95
+ if (!hit) {
96
+ const literal = name.trim().toLowerCase().replace(/['"`‘’“”]/g, '');
97
+ if (literal !== k)
98
+ hit = exports.APP_ALIASES[literal];
99
+ }
100
+ if (!hit)
101
+ return null;
102
+ return { key: k, ...hit };
103
+ }
104
+ //# sourceMappingURL=aliases.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aliases.js","sourceRoot":"","sources":["../../../src/core/router/aliases.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AA4GH,oCAeC;AAzHD,2CAA+C;AA2BlC,QAAA,WAAW,GAA6B;IACnD,oBAAoB;IACpB,OAAO,EAAe,EAAE,YAAY,EAAE,CAAC,SAAS,CAAC,EAA2B,UAAU,EAAE,OAAO,EAAe,UAAU,EAAE,aAAa,EAAE,iBAAiB,EAAE,IAAI,EAAE;IAClK,SAAS,EAAa,EAAE,YAAY,EAAE,CAAC,SAAS,CAAC,EAA2B,UAAU,EAAE,OAAO,EAAe,UAAU,EAAE,aAAa,EAAE,iBAAiB,EAAE,IAAI,EAAE;IAClK,kEAAkE;IAClE,mEAAmE;IACnE,uEAAuE;IACvE,kEAAkE;IAClE,SAAS,EAAa,EAAE,YAAY,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,sBAAsB,CAAC,EAAE,UAAU,EAAE,SAAS,EAAG,UAAU,EAAE,aAAa,EAAE,QAAQ,E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,GAAG,mBAAW,CAAC,CAAC,CAAC,CAAC;IACzB,sEAAsE;IACtE,0EAA0E;IAC1E,oEAAoE;IACpE,kCAAkC;IAClC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QACpE,IAAI,OAAO,KAAK,CAAC;YAAE,GAAG,GAAG,mBAAW,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IACD,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * `normalizeAppName` — turn a free-form app reference into the short
3
+ * canonical token the alias table is keyed on.
4
+ *
5
+ * Background. When a user says "open outlook app" the router's regex
6
+ * `/^(?:open|launch|start|run)\s+(.+?)$/` captures `"outlook app"`. The
7
+ * alias table is keyed on `'outlook'` — so without normalization the
8
+ * lookup misses, the launcher falls back to "type literal string into
9
+ * Start Menu", and Windows Search returns whichever app it ranks
10
+ * highest for "outlook app" (often nothing useful). Same pattern hits
11
+ * "the calculator", "edge browser", "chrome browser", etc.
12
+ *
13
+ * Properties:
14
+ * - **App-agnostic.** No allowlist of specific apps. Operates on
15
+ * stop-word stripping rules that work for any English app name.
16
+ * - **OS-agnostic.** Pure string transform. No platform calls.
17
+ * - **Model-agnostic.** Can be applied at the alias-resolution choke
18
+ * point so every caller (router, agent's open_app, MCP, REST) gets
19
+ * it without knowing it exists.
20
+ *
21
+ * Why not ask the LLM to normalize? Because the agent's `open_app` tool
22
+ * receives a `name` argument from the LLM directly, and we want the
23
+ * platform layer to be defensive against whatever the LLM emits — same
24
+ * model, same capability, different days, different verbosity. Doing
25
+ * this in code is cheaper, deterministic, and testable.
26
+ */
27
+ /**
28
+ * Normalize an app reference. Returns a lowercased, trimmed, filler-
29
+ * word-stripped string suitable for direct lookup against
30
+ * `APP_ALIASES`. Returns the empty string for empty / whitespace input.
31
+ *
32
+ * Examples:
33
+ * "Outlook" → "outlook"
34
+ * "the Outlook app" → "outlook"
35
+ * "Microsoft Outlook" → "microsoft outlook"
36
+ * "Edge browser" → "edge"
37
+ * '"google chrome browser"' → "google chrome"
38
+ * "calc app application" → "calc"
39
+ * "" → ""
40
+ */
41
+ export declare function normalizeAppName(name: string): string;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ /**
3
+ * `normalizeAppName` — turn a free-form app reference into the short
4
+ * canonical token the alias table is keyed on.
5
+ *
6
+ * Background. When a user says "open outlook app" the router's regex
7
+ * `/^(?:open|launch|start|run)\s+(.+?)$/` captures `"outlook app"`. The
8
+ * alias table is keyed on `'outlook'` — so without normalization the
9
+ * lookup misses, the launcher falls back to "type literal string into
10
+ * Start Menu", and Windows Search returns whichever app it ranks
11
+ * highest for "outlook app" (often nothing useful). Same pattern hits
12
+ * "the calculator", "edge browser", "chrome browser", etc.
13
+ *
14
+ * Properties:
15
+ * - **App-agnostic.** No allowlist of specific apps. Operates on
16
+ * stop-word stripping rules that work for any English app name.
17
+ * - **OS-agnostic.** Pure string transform. No platform calls.
18
+ * - **Model-agnostic.** Can be applied at the alias-resolution choke
19
+ * point so every caller (router, agent's open_app, MCP, REST) gets
20
+ * it without knowing it exists.
21
+ *
22
+ * Why not ask the LLM to normalize? Because the agent's `open_app` tool
23
+ * receives a `name` argument from the LLM directly, and we want the
24
+ * platform layer to be defensive against whatever the LLM emits — same
25
+ * model, same capability, different days, different verbosity. Doing
26
+ * this in code is cheaper, deterministic, and testable.
27
+ */
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.normalizeAppName = normalizeAppName;
30
+ /**
31
+ * Articles to strip from the front of an app reference.
32
+ * "the outlook" → "outlook" / "an excel sheet" → "excel sheet".
33
+ */
34
+ const ARTICLE_PREFIX = /^(?:the|a|an)\s+/i;
35
+ /**
36
+ * Generic suffixes that don't change which app the user means.
37
+ * "outlook app" → "outlook" / "edge browser" → "edge" /
38
+ * "calculator window" → "calculator" / "chrome program" → "chrome".
39
+ *
40
+ * Run iteratively so doubled suffixes ("outlook app application")
41
+ * collapse correctly.
42
+ */
43
+ const FILLER_SUFFIX = /\s+(?:app|application|browser|window|program)$/i;
44
+ /**
45
+ * Quotes / smart quotes the LLM sometimes wraps app names in.
46
+ * Stripped globally so `"outlook"` and `'outlook'` and `"outlook"` all
47
+ * collapse to `outlook` regardless of where they appear.
48
+ */
49
+ const QUOTE_CHARS = /['"`‘’“”]/g;
50
+ /**
51
+ * Normalize an app reference. Returns a lowercased, trimmed, filler-
52
+ * word-stripped string suitable for direct lookup against
53
+ * `APP_ALIASES`. Returns the empty string for empty / whitespace input.
54
+ *
55
+ * Examples:
56
+ * "Outlook" → "outlook"
57
+ * "the Outlook app" → "outlook"
58
+ * "Microsoft Outlook" → "microsoft outlook"
59
+ * "Edge browser" → "edge"
60
+ * '"google chrome browser"' → "google chrome"
61
+ * "calc app application" → "calc"
62
+ * "" → ""
63
+ */
64
+ function normalizeAppName(name) {
65
+ let s = name.replace(QUOTE_CHARS, '').trim().toLowerCase();
66
+ if (!s)
67
+ return '';
68
+ s = s.replace(ARTICLE_PREFIX, '').trim();
69
+ // Iteratively strip suffixes — handles "outlook app application",
70
+ // "edge browser app", etc. Bounded to a few passes so a pathological
71
+ // input never loops.
72
+ for (let i = 0; i < 4; i += 1) {
73
+ const next = s.replace(FILLER_SUFFIX, '').trim();
74
+ if (next === s)
75
+ break;
76
+ s = next;
77
+ }
78
+ return s;
79
+ }
80
+ //# sourceMappingURL=normalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../src/core/router/normalize.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;AAuCH,4CAaC;AAlDD;;;GAGG;AACH,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAE3C;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,iDAAiD,CAAC;AAExE;;;;GAIG;AACH,MAAM,WAAW,GAAG,YAAY,CAAC;AAEjC;;;;;;;;;;;;;GAaG;AACH,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3D,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IAClB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACzC,kEAAkE;IAClE,qEAAqE;IACrE,qBAAqB;IACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACjD,IAAI,IAAI,KAAK,CAAC;YAAE,MAAM;QACtB,CAAC,GAAG,IAAI,CAAC;IACX,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * SafetyLayer — unified gate for every agent action (v0.8.1 rebuild).
3
+ *
4
+ * v0.8.0's `src/safety.ts` classified only by description-string match, which
5
+ * the audit correctly flagged as trivially bypassable (a `mouse_click(x,y)` on
6
+ * a Send button never contains the word "send"). V2 orchestrator didn't call
7
+ * SafetyLayer at all, and the `/action` REST endpoint bypassed it entirely.
8
+ *
9
+ * v0.8.1 fixes the chokepoint problem:
10
+ * - Pure function `evaluate(action, context) → Decision` keyed on the ACTION
11
+ * TYPE, not on description prose. A mouse_click on a button whose OCR
12
+ * label matches a Confirm-tier pattern elevates to Confirm. A key combo
13
+ * in BLOCKED_KEYS returns Block.
14
+ * - Registry-driven coverage test (`safety-coverage.test.ts`) enforces
15
+ * that every MCP tool handler invokes `evaluate` before its first side
16
+ * effect.
17
+ * - Decision is observable via the audit log (`safety.decision` events).
18
+ *
19
+ * Model-agnostic: no LLM calls. Pure rule engine.
20
+ */
21
+ export type Tier = 'read' | 'input' | 'destructive' | 'system';
22
+ export type Decision = {
23
+ decision: 'allow';
24
+ tier: Tier;
25
+ } | {
26
+ decision: 'confirm';
27
+ tier: Tier;
28
+ reason: string;
29
+ } | {
30
+ decision: 'block';
31
+ tier: Tier;
32
+ reason: string;
33
+ };
34
+ /**
35
+ * Numeric safety tier used on `ToolDefinition.safetyTier` and returned by
36
+ * the PR6 canonical `evaluate()` signature.
37
+ *
38
+ * 0 — read-only (screenshot, a11y snapshot …)
39
+ * 1 — neutral (click, type, scroll — reversible)
40
+ * 2 — mutation (close_window, write_clipboard …)
41
+ * 3 — destructive (cdp_evaluate, relaunch_with_cdp …)
42
+ */
43
+ export type NumericTier = 0 | 1 | 2 | 3;
44
+ /**
45
+ * Canonical safety decision returned by every call site.
46
+ *
47
+ * - `allow: true` → proceed.
48
+ * - `allow: false` → block or ask for confirmation; inspect `suggestedAction`.
49
+ */
50
+ export interface SafetyDecision {
51
+ allow: boolean;
52
+ reason?: string;
53
+ suggestedAction?: 'block' | 'warn' | 'proceed';
54
+ tier: NumericTier;
55
+ }
56
+ /** What the evaluator sees. Tool name is CANONICAL — not a description. */
57
+ export interface EvaluationContext {
58
+ /** Canonical tool / action name (e.g. "mouse_click", "a11y_set_value"). */
59
+ tool: string;
60
+ /** Arbitrary args shape — typed by caller; evaluator pattern-matches safely. */
61
+ args: Record<string, unknown>;
62
+ /** Optional OCR label of the element the action targets, when known. */
63
+ targetLabel?: string;
64
+ /** Optional active app name — raises the tier for sensitive domains
65
+ * (email, banking, messaging, password managers). */
66
+ activeApp?: string;
67
+ /**
68
+ * The natural-language task the user submitted to the agent. When the
69
+ * target label appears verbatim in this text, the user has provided
70
+ * explicit consent for this destructive action and we skip the confirm
71
+ * tier. Without this field, all destructive matches require confirm
72
+ * (current behaviour). Pattern-based; works for any model + any app.
73
+ */
74
+ userTaskText?: string;
75
+ /**
76
+ * PR6: explicit numeric safety tier from the tool definition. When
77
+ * present, this overrides the TOOL_TIER name-lookup table so the gate
78
+ * consults the tool's own declared tier rather than guessing from the
79
+ * tool name string.
80
+ */
81
+ toolSafetyTier?: NumericTier;
82
+ }
83
+ /**
84
+ * Evaluate an action. Pure function — no side effects other than the
85
+ * `safety.decision` audit log.
86
+ *
87
+ * When `ctx.toolSafetyTier` is provided (set from `ToolDefinition.safetyTier`),
88
+ * it overrides the TOOL_TIER name-lookup for the base tier so the gate
89
+ * uses the tool's own declared tier rather than guessing from the name.
90
+ * Blocked-key and cdp_evaluate checks still run unconditionally.
91
+ */
92
+ export declare function evaluate(ctx: EvaluationContext): Decision;
93
+ /**
94
+ * Convenience predicate. Returns true if the decision allows the action to
95
+ * proceed without user confirmation.
96
+ */
97
+ export declare function isAllowed(d: Decision): boolean;
98
+ /**
99
+ * Canonical single safety gate used by every call site (PR6).
100
+ *
101
+ * Accepts the PR6 interface shape:
102
+ * { toolName, args, ctx? }
103
+ *
104
+ * Returns a `SafetyDecision` with `allow: boolean` so callers don't need to
105
+ * inspect the legacy `decision` string. The gate is the ONLY place that
106
+ * decides allow/block — no inline `if (toolName === 'desktop_screenshot')`
107
+ * branching anywhere else.
108
+ *
109
+ * Call sites:
110
+ * 1. `src/core/agent-loop/agent.ts` — agent loop, every tool call
111
+ * 2. `src/tools/safety-gate.ts` — MCP wrapper + REST execute middleware
112
+ *
113
+ * The `safetyTier` field is read from the tool's `ToolDefinition.safetyTier`
114
+ * by the caller before passing here; when absent the gate falls back to the
115
+ * internal TOOL_TIER name-lookup table.
116
+ */
117
+ export declare function evaluateInput(input: {
118
+ toolName: string;
119
+ args: Record<string, unknown>;
120
+ safetyTier?: NumericTier;
121
+ ctx?: {
122
+ targetLabel?: string;
123
+ activeApp?: string;
124
+ userIntent?: string;
125
+ };
126
+ }): SafetyDecision;