@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,91 @@
1
+ /**
2
+ * MCP Server — the single point of construction for clawdcursor's MCP
3
+ * surface. Used by both the stdio transport (editor integrations like
4
+ * Claude Code, Cursor, Windsurf) and the streamable-HTTP transport
5
+ * (the long-running `clawdcursor agent` daemon).
6
+ *
7
+ * Why this module exists
8
+ * ----------------------
9
+ * Up to v0.8.x clawdcursor had two transports:
10
+ * - REST API in src/server.ts (the daemon's /task /favorites /etc)
11
+ * - MCP stdio in src/index.ts (the `mcp` subcommand, inline-built)
12
+ *
13
+ * v0.9 PR7 collapses those into a single MCP server with two transport
14
+ * flavors. createMcpServer() is the registry-to-MCP adapter; the
15
+ * transports are independent and either or both can be active.
16
+ *
17
+ * The HTTP transport is mounted on the existing Express app at /mcp,
18
+ * with the same Bearer-token requireAuth middleware the REST routes used.
19
+ * That keeps localhost-only auth invariants identical across transports.
20
+ */
21
+ import type express from 'express';
22
+ import type { ToolContext, ToolDefinition } from '../tools/registry';
23
+ /** One content block in an MCP tools/call result. */
24
+ export type McpContentBlock = {
25
+ type: 'text';
26
+ text: string;
27
+ } | {
28
+ type: 'image';
29
+ data: string;
30
+ mimeType: string;
31
+ };
32
+ /** The result shape clawdcursor's tool handlers produce for the SDK. */
33
+ export interface McpToolResult {
34
+ content: McpContentBlock[];
35
+ isError?: boolean;
36
+ [key: string]: unknown;
37
+ }
38
+ /** The slice of the SDK's McpServer that clawdcursor drives. */
39
+ export interface McpServerLike {
40
+ tool(name: string, description: string, paramsSchema: Record<string, unknown>, handler: (params: Record<string, unknown>) => Promise<McpToolResult>): void;
41
+ connect(transport: McpTransportLike): Promise<void>;
42
+ }
43
+ /** The slice of an SDK transport that clawdcursor drives. */
44
+ export interface McpTransportLike {
45
+ close?: () => Promise<void> | void;
46
+ handleRequest?: (req: express.Request, res: express.Response, body?: unknown) => Promise<void>;
47
+ }
48
+ /** Options for createMcpServer. */
49
+ export interface CreateMcpServerOptions {
50
+ /** When true, expose the 6-compound surface instead of granular. */
51
+ compact?: boolean;
52
+ /** Subsystem context every tool handler receives. */
53
+ ctx: ToolContext;
54
+ }
55
+ /** A constructed MCP server with its registered tool count. */
56
+ export interface McpServerHandle {
57
+ /** The configured McpServer instance — connect a transport via .connect(). */
58
+ server: McpServerLike;
59
+ /** Number of tools registered (mirrors the surface size). */
60
+ toolCount: number;
61
+ /** Snapshot of the tools that were registered (in registration order). */
62
+ tools: ToolDefinition[];
63
+ }
64
+ /**
65
+ * Build a configured McpServer with all clawdcursor tools registered.
66
+ *
67
+ * The caller is responsible for connecting a transport via `server.connect(...)`.
68
+ * Use `startMcpStdio` for editor integrations and `startMcpHttp` for the daemon.
69
+ */
70
+ export declare function createMcpServer(options: CreateMcpServerOptions): Promise<McpServerHandle>;
71
+ /**
72
+ * Start the stdio MCP transport. Used by `clawdcursor mcp` for editor
73
+ * integrations (Claude Code, Cursor, Windsurf, Zed). Stdout becomes the
74
+ * protocol channel; logs must already be redirected to stderr by the
75
+ * caller.
76
+ */
77
+ export declare function startMcpStdio(server: McpServerLike): Promise<void>;
78
+ /**
79
+ * Mount the streamable HTTP MCP transport on an Express app at /mcp.
80
+ *
81
+ * Mounts both POST (JSON-RPC requests) and GET (SSE notifications), plus
82
+ * DELETE for session termination. Returns the underlying transport so the
83
+ * caller can close it on shutdown.
84
+ *
85
+ * Auth — the caller must apply Bearer-token middleware before this route
86
+ * (mirrors the REST surface's requireAuth). We don't apply auth here so
87
+ * tests and agent-mode can share the same mount with their own gate.
88
+ */
89
+ export declare function startMcpHttp(server: McpServerLike, app: express.Express, mountPath?: string): Promise<{
90
+ close: () => Promise<void>;
91
+ }>;
@@ -0,0 +1,280 @@
1
+ "use strict";
2
+ /**
3
+ * MCP Server — the single point of construction for clawdcursor's MCP
4
+ * surface. Used by both the stdio transport (editor integrations like
5
+ * Claude Code, Cursor, Windsurf) and the streamable-HTTP transport
6
+ * (the long-running `clawdcursor agent` daemon).
7
+ *
8
+ * Why this module exists
9
+ * ----------------------
10
+ * Up to v0.8.x clawdcursor had two transports:
11
+ * - REST API in src/server.ts (the daemon's /task /favorites /etc)
12
+ * - MCP stdio in src/index.ts (the `mcp` subcommand, inline-built)
13
+ *
14
+ * v0.9 PR7 collapses those into a single MCP server with two transport
15
+ * flavors. createMcpServer() is the registry-to-MCP adapter; the
16
+ * transports are independent and either or both can be active.
17
+ *
18
+ * The HTTP transport is mounted on the existing Express app at /mcp,
19
+ * with the same Bearer-token requireAuth middleware the REST routes used.
20
+ * That keeps localhost-only auth invariants identical across transports.
21
+ */
22
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ var desc = Object.getOwnPropertyDescriptor(m, k);
25
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
26
+ desc = { enumerable: true, get: function() { return m[k]; } };
27
+ }
28
+ Object.defineProperty(o, k2, desc);
29
+ }) : (function(o, m, k, k2) {
30
+ if (k2 === undefined) k2 = k;
31
+ o[k2] = m[k];
32
+ }));
33
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
34
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
35
+ }) : function(o, v) {
36
+ o["default"] = v;
37
+ });
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
55
+ Object.defineProperty(exports, "__esModule", { value: true });
56
+ exports.createMcpServer = createMcpServer;
57
+ exports.startMcpStdio = startMcpStdio;
58
+ exports.startMcpHttp = startMcpHttp;
59
+ const version_1 = require("./version");
60
+ const registry_1 = require("../tools/registry");
61
+ const safety_gate_1 = require("../tools/safety-gate");
62
+ const banner_1 = require("../core/banner");
63
+ /**
64
+ * Build a configured McpServer with all clawdcursor tools registered.
65
+ *
66
+ * The caller is responsible for connecting a transport via `server.connect(...)`.
67
+ * Use `startMcpStdio` for editor integrations and `startMcpHttp` for the daemon.
68
+ */
69
+ async function createMcpServer(options) {
70
+ const { compact, ctx } = options;
71
+ // Dynamic import: the SDK is ESM and our build is CJS. The specifier cast is
72
+ // a moduleResolution:"node" limitation (see the #115 note above); the VALUE
73
+ // is immediately narrowed to the structural contract.
74
+ const sdkMcp = await Promise.resolve(`${'@modelcontextprotocol/sdk/server/mcp.js'}`).then(s => __importStar(require(s)));
75
+ const { McpServer } = sdkMcp;
76
+ const { z } = await Promise.resolve().then(() => __importStar(require('zod')));
77
+ // MCP `instructions` — sent once at the initialize handshake and injected
78
+ // into the connecting agent's context. This is the only channel to tell an
79
+ // integrating agent (Claude Code, Cursor, Windsurf, Zed, OpenClaw) HOW to
80
+ // use clawdcursor cheaply. Without it, agents drive the raw GUI tools with
81
+ // their own premium model — the expensive path — and never discover the
82
+ // local fallback pipeline. The guidance differs by mode: only the daemon
83
+ // (HTTP) context has a live agent, so only it can offer `task`.
84
+ const instructions = ctx.agent
85
+ ? // Daemon / HTTP MCP — the cheap local pipeline is available.
86
+ 'clawdcursor is a local desktop-automation execution layer. PREFER the ' +
87
+ '`task` tool: it runs the full perceive→act→verify loop locally on a ' +
88
+ 'cheap model, so you spend almost no tokens driving the GUI yourself. ' +
89
+ 'Fall back to the granular tools only when you need fine-grained control. ' +
90
+ 'Every tool name carries a token-cost class — escalate in order: ' +
91
+ '[act] (side-effect actions) < [inspect] (cheap structured reads) < ' +
92
+ '[perceive-text] (a11y tree / OCR — no image bytes) < [perceive-image] (screenshot). ' +
93
+ 'For perception specifically: read the accessibility tree first; use OCR ' +
94
+ '([perceive-text]) when the tree is empty or sparse; take a screenshot ' +
95
+ '([perceive-image]) only as a last resort when both tree and OCR fail.'
96
+ : // Stdio MCP (editor integration) — no pipeline; you drive the tools.
97
+ 'clawdcursor is a local desktop-automation tool layer. You drive the tools ' +
98
+ 'yourself. To minimize tokens, follow the cost-class prefix on each tool — ' +
99
+ '[act] < [inspect] < [perceive-text] < [perceive-image]. ' +
100
+ 'For perception always escalate in this order: ' +
101
+ '(1) read the accessibility tree ([perceive-text], cheapest — start here); ' +
102
+ '(2) use OCR ([perceive-text]) when the tree is empty or sparse; ' +
103
+ '(3) capture a screenshot ([perceive-image]) only as a last resort when both fail. ' +
104
+ 'Prefer named-target actions (by a11y name) over pixel coordinates. ' +
105
+ 'For fully autonomous, low-cost execution, start the daemon (`clawdcursor agent`) ' +
106
+ 'and use the `task` tool — it runs a local cheap-model pipeline instead of your model. ' +
107
+ '`task` waits up to 45s; longer tasks return {status:"running"} and CONTINUE in the ' +
108
+ 'background — re-call with the same instruction to keep waiting, task {action:"status"} ' +
109
+ 'to poll, task {action:"abort"} to stop. A timeout on your side is NOT a task failure. ' +
110
+ 'Drive UI symbolically: compile_ui / find_button / find_field return a stable ' +
111
+ '{element_id, snapshot_id} you pass to invoke/set_value — it survives layout shifts, so ' +
112
+ 'prefer it over pixel coordinates. Pass `expect` on consequential actions so a failed one ' +
113
+ 'reports a DEVIATION instead of a hollow success. clawdcursor is a FALLBACK layer — prefer ' +
114
+ 'a native API, CLI, or direct file edit when one exists; reach for it when the only surface ' +
115
+ 'is a GUI. Full usage guide: the `clawdcursor` skill registered in your agent, or ' +
116
+ 'https://clawdcursor.com/llms.txt.';
117
+ const server = new McpServer({ name: 'clawdcursor', version: version_1.VERSION }, { instructions });
118
+ const tools = compact ? (0, registry_1.getCompactSurface)() : (0, registry_1.getAllTools)();
119
+ for (const tool of tools) {
120
+ // Convert parameter defs to a Zod schema map. The MCP SDK uses zod
121
+ // shape objects (Record<string, ZodType>) — not full ZodObjects.
122
+ const zodParams = {};
123
+ for (const [key, def] of Object.entries(tool.parameters)) {
124
+ let schema;
125
+ if (def.type === 'number')
126
+ schema = z.number();
127
+ else if (def.type === 'boolean')
128
+ schema = z.boolean();
129
+ // 'array' params accept a real array (preferred) OR a JSON-encoded string,
130
+ // matching dual-accept handlers (e.g. batch.steps). Without this branch the
131
+ // default below coerced arrays to z.string() and rejected the array form
132
+ // the README/inputSchema advertise ("Expected string, received array").
133
+ else if (def.type === 'array')
134
+ schema = z.union([z.array(z.any()), z.string()]);
135
+ else
136
+ schema = z.string();
137
+ if (def.enum)
138
+ schema = z.enum(def.enum);
139
+ schema = schema.describe(def.description);
140
+ if (def.required === false)
141
+ schema = schema.optional();
142
+ zodParams[key] = schema;
143
+ }
144
+ // MCP SDK 1.29 arg parsing breaks if schema is undefined (shifts callback
145
+ // position). Always pass a schema — use empty object for parameterless tools.
146
+ const hasParams = Object.keys(zodParams).length > 0;
147
+ // Phase A: surface the token-cost class to the tool-picking LLM. The
148
+ // high-level SDK `server.tool()` API has no slot for a vendor metadata
149
+ // field, so a `[costClass]` description prefix is the reliable
150
+ // LLM-readable channel in tools/list. `costClass` in source stays the
151
+ // single source of truth; the prefix is rendered only at this projection.
152
+ const description = tool.costClass
153
+ ? `[${tool.costClass}] ${tool.description}`
154
+ : tool.description;
155
+ server.tool(tool.name, description, hasParams ? zodParams : {}, async (params) => {
156
+ // Pass the holder so el_NN refs resolve to their element label for
157
+ // the destructive-label rule (Send/Delete/Pay) on the MCP route too.
158
+ const safetyError = (0, safety_gate_1.evaluateToolCall)(tool, params ?? {}, { uiMaps: ctx.uiMaps });
159
+ if (safetyError) {
160
+ return { content: [{ type: 'text', text: safetyError.text }], isError: true };
161
+ }
162
+ // Transparency: any consequential (mutating) tool call from an
163
+ // EXTERNAL agent pokes the on-screen control banner — it shows on the
164
+ // first poke and auto-hides after ~30s of inactivity. Read-only
165
+ // perception (tier 0) stays silent.
166
+ if ((tool.safetyTier ?? 0) >= 1)
167
+ banner_1.controlBanner.touch();
168
+ let result;
169
+ try {
170
+ result = await tool.handler(params, ctx);
171
+ }
172
+ catch (err) {
173
+ // A handler throw (e.g. projected tools' toolContextToAgent when the
174
+ // platform adapter failed to init) must NOT propagate to the MCP SDK
175
+ // — in stdio mode an unhandled rejection can corrupt the JSON-RPC
176
+ // stream. Convert to a clean isError result.
177
+ const msg = err instanceof Error ? err.message : String(err);
178
+ return { content: [{ type: 'text', text: `${tool.name}: ${msg}` }], isError: true };
179
+ }
180
+ const content = [];
181
+ if (result.image) {
182
+ content.push({ type: 'image', data: result.image.data, mimeType: result.image.mimeType });
183
+ }
184
+ content.push({ type: 'text', text: result.text });
185
+ return { content, isError: result.isError };
186
+ });
187
+ }
188
+ return { server, toolCount: tools.length, tools };
189
+ }
190
+ /**
191
+ * Start the stdio MCP transport. Used by `clawdcursor mcp` for editor
192
+ * integrations (Claude Code, Cursor, Windsurf, Zed). Stdout becomes the
193
+ * protocol channel; logs must already be redirected to stderr by the
194
+ * caller.
195
+ */
196
+ async function startMcpStdio(server) {
197
+ const sdkStdio = await Promise.resolve(`${'@modelcontextprotocol/sdk/server/stdio.js'}`).then(s => __importStar(require(s)));
198
+ const transport = new sdkStdio.StdioServerTransport();
199
+ await server.connect(transport);
200
+ }
201
+ /**
202
+ * Mount the streamable HTTP MCP transport on an Express app at /mcp.
203
+ *
204
+ * Mounts both POST (JSON-RPC requests) and GET (SSE notifications), plus
205
+ * DELETE for session termination. Returns the underlying transport so the
206
+ * caller can close it on shutdown.
207
+ *
208
+ * Auth — the caller must apply Bearer-token middleware before this route
209
+ * (mirrors the REST surface's requireAuth). We don't apply auth here so
210
+ * tests and agent-mode can share the same mount with their own gate.
211
+ */
212
+ async function startMcpHttp(server, app, mountPath = '/mcp') {
213
+ const sdkHttp = await Promise.resolve(`${'@modelcontextprotocol/sdk/server/streamableHttp.js'}`).then(s => __importStar(require(s)));
214
+ const { StreamableHTTPServerTransport } = sdkHttp;
215
+ // Stateless mode: each POST is independent — no session init handshake
216
+ // required. This makes the dashboard, `clawdcursor task` CLI, and
217
+ // delegate_to_agent tool work as one-shot JSON-RPC clients without
218
+ // needing to initialize and track an Mcp-Session-Id per call.
219
+ //
220
+ // CRITICAL: in stateless mode the SDK requires a FRESH transport per
221
+ // HTTP request — a single shared transport accumulates per-request
222
+ // state (response writers, in-flight message correlation) and
223
+ // returns 500 on every call after the first. The pattern we use
224
+ // here matches the MCP SDK's stateless example:
225
+ // for each request:
226
+ // 1) construct a new transport
227
+ // 2) server.connect(transport)
228
+ // 3) transport.handleRequest(req, res, req.body)
229
+ // 4) on response close → transport.close()
230
+ //
231
+ // This is per-request boilerplate, not per-connection — there's
232
+ // still one McpServer (and one tool registry) for the whole daemon.
233
+ // `enableJsonResponse: true` makes the SDK serialize tools/call results as
234
+ // plain JSON-RPC instead of SSE (`event: message\ndata: {...}`). Without
235
+ // this, MCP clients that expect a single JSON body (Claude Code's MCP
236
+ // client among them) blow up with `Unexpected token 'e', "event: mes"...`
237
+ // because the SDK defaults to text/event-stream for everything. We don't
238
+ // need streaming progress here — `submit_task` is the only long-running
239
+ // call, and even there a single final JSON response is the cleaner
240
+ // contract for callers. Editor hosts that DO want streaming use stdio
241
+ // MCP which has its own framing.
242
+ const newTransport = () => new StreamableHTTPServerTransport({
243
+ sessionIdGenerator: undefined,
244
+ enableJsonResponse: true,
245
+ });
246
+ const handle = async (req, res, body) => {
247
+ const transport = newTransport();
248
+ res.on('close', () => {
249
+ // Best-effort cleanup whenever the response ends, errors out, or the
250
+ // client disconnects mid-stream.
251
+ try {
252
+ void transport.close?.();
253
+ }
254
+ catch { /* swallow */ }
255
+ });
256
+ try {
257
+ await server.connect(transport);
258
+ await transport.handleRequest?.(req, res, body);
259
+ }
260
+ catch (err) {
261
+ if (!res.headersSent) {
262
+ res.status(500).json({ error: `MCP transport error: ${err.message}` });
263
+ }
264
+ }
265
+ };
266
+ // POST /mcp — JSON-RPC requests. Express has already parsed the body
267
+ // via express.json(); pass it through so the SDK doesn't re-read req.
268
+ app.post(mountPath, (req, res) => { void handle(req, res, req.body); });
269
+ // GET /mcp — SSE channel for server-initiated notifications.
270
+ app.get(mountPath, (req, res) => { void handle(req, res); });
271
+ // DELETE /mcp — explicit session termination (no-op in stateless).
272
+ app.delete(mountPath, (req, res) => { void handle(req, res); });
273
+ return {
274
+ close: async () => {
275
+ // Per-request transports clean themselves up on response close;
276
+ // nothing global to tear down.
277
+ },
278
+ };
279
+ }
280
+ //# sourceMappingURL=mcp-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../../src/surface/mcp-server.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EH,0CA4HC;AAQD,sCAMC;AAaD,oCAgFC;AAlTD,uCAAoC;AAEpC,gDAAmE;AACnE,sDAAwD;AACxD,2CAA+C;AAiE/C;;;;;GAKG;AACI,KAAK,UAAU,eAAe,CAAC,OAA+B;IACnE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IACjC,6EAA6E;IAC7E,4EAA4E;IAC5E,sDAAsD;IACtD,MAAM,MAAM,GAAG,yBAAa,yCAAmD,uCAE9E,CAAC;IACF,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;IAC7B,MAAM,EAAE,CAAC,EAAE,GAAG,wDAAa,KAAK,GAAC,CAAC;IAElC,0EAA0E;IAC1E,2EAA2E;IAC3E,0EAA0E;IAC1E,2EAA2E;IAC3E,wEAAwE;IACxE,yEAAyE;IACzE,gEAAgE;IAChE,MAAM,YAAY,GAAG,GAAG,CAAC,KAAK;QAC5B,CAAC,CAAC,6DAA6D;YAC7D,wEAAwE;gBACxE,sEAAsE;gBACtE,uEAAuE;gBACvE,2EAA2E;gBAC3E,kEAAkE;gBAClE,qEAAqE;gBACrE,sFAAsF;gBACtF,0EAA0E;gBAC1E,wEAAwE;gBACxE,uEAAuE;QACzE,CAAC,CAAC,qEAAqE;YACrE,4EAA4E;gBAC5E,4EAA4E;gBAC5E,0DAA0D;gBAC1D,gDAAgD;gBAChD,4EAA4E;gBAC5E,kEAAkE;gBAClE,oFAAoF;gBACpF,qEAAqE;gBACrE,mFAAmF;gBACnF,wFAAwF;gBACxF,qFAAqF;gBACrF,yFAAyF;gBACzF,wFAAwF;gBACxF,+EAA+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AS,CAAC,CAAC;YAChC,MAAM,SAAS,CAAC,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QAClD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;gBACrB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,wBAAyB,GAAa,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;YACpF,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IAEF,qEAAqE;IACrE,sEAAsE;IACtE,GAAG,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,GAAG,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAExE,6DAA6D;IAC7D,GAAG,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,GAAG,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE7D,mEAAmE;IACnE,GAAG,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,GAAG,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEhE,OAAO;QACL,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,gEAAgE;YAChE,+BAA+B;QACjC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Onboarding — first-run consent flow for desktop control.
3
+ *
4
+ * On first run, warns the user about desktop control capabilities
5
+ * and requires explicit consent before tools become active.
6
+ * Consent is stored in ~/.clawdcursor/consent.
7
+ */
8
+ /** Check if the user has already given consent */
9
+ export declare function hasConsent(): boolean;
10
+ /** Write consent file directly (for --accept flag / CI / scripted use) */
11
+ export declare function writeConsentFile(): void;
12
+ /** Run the onboarding consent flow (interactive terminal) */
13
+ export declare function runOnboarding(context?: 'start' | 'consent', startPort?: number): Promise<boolean>;
14
+ /** Revoke consent (for uninstall) */
15
+ export declare function revokeConsent(): void;
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ /**
3
+ * Onboarding — first-run consent flow for desktop control.
4
+ *
5
+ * On first run, warns the user about desktop control capabilities
6
+ * and requires explicit consent before tools become active.
7
+ * Consent is stored in ~/.clawdcursor/consent.
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
43
+ return (mod && mod.__esModule) ? mod : { "default": mod };
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.hasConsent = hasConsent;
47
+ exports.writeConsentFile = writeConsentFile;
48
+ exports.runOnboarding = runOnboarding;
49
+ exports.revokeConsent = revokeConsent;
50
+ const fs = __importStar(require("fs"));
51
+ const path = __importStar(require("path"));
52
+ const os = __importStar(require("os"));
53
+ const readline = __importStar(require("readline"));
54
+ const picocolors_1 = __importDefault(require("picocolors"));
55
+ const version_1 = require("./version");
56
+ const CONSENT_DIR = path.join(os.homedir(), '.clawdcursor');
57
+ const CONSENT_FILE = path.join(CONSENT_DIR, 'consent');
58
+ /** Check if the user has already given consent */
59
+ function hasConsent() {
60
+ return fs.existsSync(CONSENT_FILE);
61
+ }
62
+ /** Save consent to disk */
63
+ function saveConsent() {
64
+ if (!fs.existsSync(CONSENT_DIR)) {
65
+ fs.mkdirSync(CONSENT_DIR, { recursive: true });
66
+ }
67
+ fs.writeFileSync(CONSENT_FILE, JSON.stringify({
68
+ accepted: true,
69
+ timestamp: new Date().toISOString(),
70
+ platform: process.platform,
71
+ version: version_1.VERSION,
72
+ }, null, 2));
73
+ }
74
+ /** Write consent file directly (for --accept flag / CI / scripted use) */
75
+ function writeConsentFile() {
76
+ saveConsent();
77
+ }
78
+ /** Print the big ASCII banner — only called during first-run onboarding */
79
+ function printBanner() {
80
+ const cat = ` /\\___/\\\n` +
81
+ ` ( >^.^< ) claw\n` +
82
+ ` ) ( claw\n` +
83
+ ` (_)_(_)_)`;
84
+ const clawBlock = ` ██████╗██╗ █████╗ ██╗ ██╗██████╗\n` +
85
+ ` ██╔════╝██║ ██╔══██╗██║ ██║██╔══██╗\n` +
86
+ ` ██║ ██║ ███████║██║ █╗ ██║██║ ██║\n` +
87
+ ` ██║ ██║ ██╔══██║██║███╗██║██║ ██║\n` +
88
+ ` ╚██████╗███████╗██║ ██║╚███╔███╔╝██████╔╝\n` +
89
+ ` ╚═════╝╚══════╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═════╝`;
90
+ const cursorBlock = ` ██████╗██╗ ██╗██████╗ ███████╗ ██████╗ ██████╗\n` +
91
+ ` ██╔════╝██║ ██║██╔══██╗██╔════╝██╔═══██╗██╔══██╗\n` +
92
+ ` ██║ ██║ ██║██████╔╝█████╗ ██║ ██║██████╔╝\n` +
93
+ ` ██║ ██║ ██║██╔══██╗╚════██╗██║ ██║██╔══██╗\n` +
94
+ ` ╚██████╗╚██████╔╝██║ ██║███████║╚██████╔╝██║ ██║\n` +
95
+ ` ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝`;
96
+ const footer = ` OS-level Desktop Automation Server\n` +
97
+ ` ─────────────────────────────────────────────`;
98
+ process.stdout.write(`\n${picocolors_1.default.green(cat)}\n\n` +
99
+ `${picocolors_1.default.bold(picocolors_1.default.green(clawBlock))}\n` +
100
+ `${picocolors_1.default.green(cursorBlock)}\n\n` +
101
+ `${picocolors_1.default.gray(footer)}\n\n`);
102
+ }
103
+ /** Run the onboarding consent flow (interactive terminal) */
104
+ async function runOnboarding(context = 'start', startPort = 3847) {
105
+ // Non-interactive mode (piped stdin, CI, MCP stdio) — skip consent
106
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
107
+ return true;
108
+ }
109
+ // Show the big banner — this is the one moment every user sees it
110
+ printBanner();
111
+ const contextNote = context === 'start'
112
+ ? picocolors_1.default.gray(' You are starting:') + '\n' +
113
+ `${picocolors_1.default.gray(' → AI Agent + MCP HTTP transport on ')}${picocolors_1.default.cyan(`localhost:${startPort}`)}\n` +
114
+ picocolors_1.default.gray(' → Any local process with the bearer token can call tools') + '\n'
115
+ : picocolors_1.default.gray(' This one-time consent covers both transports of clawdcursor:') + '\n' +
116
+ `${picocolors_1.default.gray(' → stdio MCP ')}${picocolors_1.default.gray('(Claude Code, Cursor, Windsurf, Zed — your editor spawns it)')}\n` +
117
+ `${picocolors_1.default.gray(' → HTTP MCP ')}${picocolors_1.default.gray('(')}${picocolors_1.default.cyan('clawdcursor agent')}${picocolors_1.default.gray(' — daemon for the autonomous agent)')}\n`;
118
+ const warningBox = picocolors_1.default.yellow(` ╔${'═'.repeat(63)}╗\n` +
119
+ ` ║ ║\n` +
120
+ ` ║ ⚠ DESKTOP CONTROL WARNING ⚠ ║\n` +
121
+ ` ║ ║\n` +
122
+ ` ╚${'═'.repeat(63)}╝`);
123
+ const capabilities = [
124
+ 'Mouse clicks and keyboard input anywhere on screen',
125
+ 'Screenshot capture of your entire display',
126
+ 'Read and write OS clipboard',
127
+ 'Open, close, and switch between applications',
128
+ 'Browser DOM interaction via Chrome DevTools Protocol',
129
+ 'Read accessibility tree (window contents, UI elements)',
130
+ ].map(line => `${picocolors_1.default.red(' ●')} ${line}`).join('\n');
131
+ const safetyNotes = [
132
+ ' ● Only run on a machine you control',
133
+ ' ● Only connect AI models you trust',
134
+ ' ● Server binds to localhost only (127.0.0.1)',
135
+ ' ● Dangerous key combos (Alt+F4, Ctrl+Alt+Del) are blocked',
136
+ ].map(line => picocolors_1.default.gray(line)).join('\n');
137
+ const divider = ' ' + '─'.repeat(58);
138
+ console.log(`\n${warningBox}\n\n` +
139
+ `${picocolors_1.default.gray(' clawdcursor gives AI models full control of your desktop:')}\n\n` +
140
+ `${capabilities}\n\n` +
141
+ `${contextNote}` +
142
+ `${picocolors_1.default.green(' SAFETY NOTES:')}\n` +
143
+ `${safetyNotes}\n` +
144
+ `${picocolors_1.default.gray(' ● Run ')}${picocolors_1.default.cyan('clawdcursor stop')}${picocolors_1.default.gray(' to shut down when not in use')}\n\n` +
145
+ `${picocolors_1.default.gray(divider)}\n`);
146
+ const rl = readline.createInterface({
147
+ input: process.stdin,
148
+ output: process.stdout,
149
+ });
150
+ const answer = await new Promise((resolve) => {
151
+ rl.question(' Accept and continue? (y/N) ', resolve);
152
+ });
153
+ rl.close();
154
+ if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
155
+ saveConsent();
156
+ console.log('\n ✅ Consent saved. You won\'t be asked again.\n');
157
+ // Two paths, two setups — most users need NO further commands. Telling
158
+ // everyone to run `doctor` here made agents/users believe it was required
159
+ // for MCP operation (it never was; doctor only configures the autonomous
160
+ // daemon's built-in LLM).
161
+ console.log(' Next steps — pick your path:');
162
+ console.log('');
163
+ console.log(' ▸ Your own AI drives clawdcursor (Claude Code, Cursor, Windsurf, …):');
164
+ if (process.platform === 'darwin') {
165
+ console.log(' clawdcursor grant # approve Accessibility + Screen Recording');
166
+ }
167
+ console.log(' …then add the MCP entry to your editor — that\'s ALL the setup:');
168
+ console.log(' { "mcpServers": { "clawdcursor": { "command": "clawdcursor", "args": ["mcp", "--compact"] } } }');
169
+ console.log('');
170
+ console.log(' ▸ Autonomous daemon (clawdcursor brings its OWN LLM):');
171
+ console.log(' clawdcursor doctor # pick + validate an AI provider (only needed for this mode)');
172
+ console.log(' clawdcursor agent\n');
173
+ return true;
174
+ }
175
+ console.log('\n Declined. clawdcursor will not start.\n');
176
+ return false;
177
+ }
178
+ /** Revoke consent (for uninstall) */
179
+ function revokeConsent() {
180
+ if (fs.existsSync(CONSENT_FILE)) {
181
+ fs.unlinkSync(CONSENT_FILE);
182
+ }
183
+ }
184
+ //# sourceMappingURL=onboarding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onboarding.js","sourceRoot":"","sources":["../../src/surface/onboarding.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaH,gCAEC;AAgBD,4CAEC;AAuCD,sCAwFC;AAGD,sCAIC;AArKD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AACzB,mDAAqC;AACrC,4DAA4B;AAC5B,uCAAoC;AAEpC,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,cAAc,CAAC,CAAC;AAC5D,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,E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