@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,101 @@
1
+ "use strict";
2
+ /**
3
+ * Offline task decomposer — regex + quote-aware compound split.
4
+ *
5
+ * Ported from src/local-parser.ts. Zero LLM calls, zero dependencies. Returns
6
+ * the task split into subtask strings, or null when the task is too ambiguous
7
+ * to split safely (caller falls back to the LLM decomposer).
8
+ *
9
+ * v0.6.3 product knowledge preserved:
10
+ * - The `actionVerb` validator is the guard against dangerous splits like
11
+ * "scroll through and read" where one half lacks a terminal condition and
12
+ * would infinite-loop the text-agent.
13
+ * - Quote-aware splitter so "send 'hello, world' to Bob" isn't broken.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.splitCompound = splitCompound;
17
+ exports.decompose = decompose;
18
+ const ACTION_VERB = /^(open|close|click|tap|type|press|save|go|navigate|visit|search|find|create|delete|write|send|copy|paste|select|drag|scroll(\s+up|\s+down)?(\s+and)?|download|upload|install|run|set|change|turn|enable|disable|check|uncheck|fill|submit|compose|reply|forward|focus|switch|minimize|maximize|summarize|read|extract|draw|paint|sketch|resize|compute|calculate|add|subtract|multiply|divide|highlight|describe|enter|show|display|play|pause|stop|start|restart|refresh|reload|zoom|expand|collapse|rename|move|sort|filter|attach|insert|remove|undo|redo|cut)\b/i;
19
+ /**
20
+ * Split a compound task on ` and `, ` then `, or `,` — quote-aware.
21
+ */
22
+ function splitCompound(task) {
23
+ const parts = [];
24
+ let current = '';
25
+ let inQuotes = false;
26
+ let quoteChar = '';
27
+ const len = task.length;
28
+ for (let i = 0; i < len;) {
29
+ const ch = task[i];
30
+ if ((ch === '"' || ch === "'") && !inQuotes) {
31
+ inQuotes = true;
32
+ quoteChar = ch;
33
+ current += ch;
34
+ i++;
35
+ continue;
36
+ }
37
+ if (ch === quoteChar && inQuotes) {
38
+ inQuotes = false;
39
+ quoteChar = '';
40
+ current += ch;
41
+ i++;
42
+ continue;
43
+ }
44
+ if (inQuotes) {
45
+ current += ch;
46
+ i++;
47
+ continue;
48
+ }
49
+ const rest = task.slice(i).toLowerCase();
50
+ if (rest.startsWith(' and ')) {
51
+ if (current.trim())
52
+ parts.push(current.trim());
53
+ current = '';
54
+ i += 5;
55
+ continue;
56
+ }
57
+ if (rest.startsWith(' then ')) {
58
+ if (current.trim())
59
+ parts.push(current.trim());
60
+ current = '';
61
+ i += 6;
62
+ continue;
63
+ }
64
+ if (ch === ',') {
65
+ if (current.trim())
66
+ parts.push(current.trim());
67
+ current = '';
68
+ i++;
69
+ continue;
70
+ }
71
+ current += ch;
72
+ i++;
73
+ }
74
+ if (current.trim())
75
+ parts.push(current.trim());
76
+ return parts;
77
+ }
78
+ /**
79
+ * Decompose a task. Null → ambiguous, caller escalates to LLM decomposer.
80
+ */
81
+ function decompose(task) {
82
+ if (!task || typeof task !== 'string')
83
+ return null;
84
+ const trimmed = task.trim();
85
+ if (trimmed.length === 0)
86
+ return null;
87
+ const parts = splitCompound(trimmed);
88
+ if (parts.length > 1) {
89
+ const filtered = parts.map(p => p.trim()).filter(p => p.length > 0);
90
+ // Guard: every subtask must start with a real action verb — otherwise
91
+ // keep as one task. This prevents the "scroll through" infinite-loop bug.
92
+ const allHaveVerbs = filtered.every(p => ACTION_VERB.test(p));
93
+ if (allHaveVerbs)
94
+ return { subtasks: filtered, keptAsOne: false };
95
+ // Deliberately kept as one unit — caller should run the whole thing
96
+ // through the text-agent as-is, not escalate to LLM decomposer.
97
+ return { subtasks: [trimmed], keptAsOne: true };
98
+ }
99
+ return { subtasks: [trimmed], keptAsOne: false };
100
+ }
101
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/core/decompose/parser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AAcH,sCAuDC;AAKD,8BAmBC;AApFD,MAAM,WAAW,GAAG,siBAAsiB,CAAC;AAE3jB;;GAEG;AACH,SAAgB,aAAa,CAAC,IAAY;IACxC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,SAAS,GAAmB,EAAE,CAAC;IACnC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC;IAExB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,GAAI,CAAC;QAC1B,MAAM,EA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AAC;IAClD,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACnD,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Correlation IDs — each /task or CLI invocation generates a UUID, and every
3
+ * log line / trace event from that task carries it. Surface in /status so
4
+ * users can grep logs by ID for debugging.
5
+ *
6
+ * Uses Node's built-in AsyncLocalStorage so a correlation ID set at the top of
7
+ * Pipeline.run() flows to every awaited call inside, without threading it
8
+ * through every function signature.
9
+ */
10
+ interface Context {
11
+ correlationId: string;
12
+ taskText?: string;
13
+ startedAt: number;
14
+ }
15
+ export declare function newCorrelationId(): string;
16
+ export declare function runWithCorrelation<T>(ctx: Pick<Context, 'correlationId' | 'taskText'>, fn: () => Promise<T> | T): Promise<T> | T;
17
+ export declare function getCorrelationId(): string | undefined;
18
+ export declare function getContext(): Context | undefined;
19
+ export {};
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * Correlation IDs — each /task or CLI invocation generates a UUID, and every
4
+ * log line / trace event from that task carries it. Surface in /status so
5
+ * users can grep logs by ID for debugging.
6
+ *
7
+ * Uses Node's built-in AsyncLocalStorage so a correlation ID set at the top of
8
+ * Pipeline.run() flows to every awaited call inside, without threading it
9
+ * through every function signature.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.newCorrelationId = newCorrelationId;
13
+ exports.runWithCorrelation = runWithCorrelation;
14
+ exports.getCorrelationId = getCorrelationId;
15
+ exports.getContext = getContext;
16
+ const node_async_hooks_1 = require("node:async_hooks");
17
+ const node_crypto_1 = require("node:crypto");
18
+ const storage = new node_async_hooks_1.AsyncLocalStorage();
19
+ function newCorrelationId() {
20
+ return (0, node_crypto_1.randomUUID)();
21
+ }
22
+ function runWithCorrelation(ctx, fn) {
23
+ const full = {
24
+ correlationId: ctx.correlationId,
25
+ taskText: ctx.taskText,
26
+ startedAt: Date.now(),
27
+ };
28
+ return storage.run(full, fn);
29
+ }
30
+ function getCorrelationId() {
31
+ return storage.getStore()?.correlationId;
32
+ }
33
+ function getContext() {
34
+ return storage.getStore();
35
+ }
36
+ //# sourceMappingURL=correlation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"correlation.js","sourceRoot":"","sources":["../../../src/core/observability/correlation.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAaH,4CAEC;AAED,gDAUC;AAED,4CAEC;AAED,gCAEC;AAjCD,uDAAqD;AACrD,6CAAyC;AAQzC,MAAM,OAAO,GAAG,IAAI,oCAAiB,EAAW,CAAC;AAEjD,SAAgB,gBAAgB;IAC9B,OAAO,IAAA,wBAAU,GAAE,CAAC;AACtB,CAAC;AAED,SAAgB,kBAAkB,CAChC,GAAgD,EAChD,EAAwB;IAExB,MAAM,IAAI,GAAY;QACpB,aAAa,EAAE,GAAG,CAAC,aAAa;QAChC,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;KACtB,CAAC;IACF,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAC/B,CAAC;AAED,SAAgB,gBAAgB;IAC9B,OAAO,OAAO,CAAC,QAAQ,EAAE,EAAE,aAAa,CAAC;AAC3C,CAAC;AAED,SAAgB,UAAU;IACxB,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Per-task cost meter — model-agnostic.
3
+ *
4
+ * Tracks tokens in/out per model, plus non-LLM costs (OCR calls, screenshot
5
+ * bytes) if we want to surface those later. Converts to USD via a static
6
+ * price table that is overrideable at runtime.
7
+ *
8
+ * Why this exists: the product claim is "cost-aware — picks the cheapest path
9
+ * that works." The audit showed we had no way to prove it. The cost meter
10
+ * makes blind-first savings visible in /task responses and in a new
11
+ * `clawdcursor cost` CLI.
12
+ *
13
+ * Price table is loaded from:
14
+ * 1. ~/.clawdcursor/pricing.json (user override; precedence)
15
+ * 2. src/core/observability/pricing.default.json (bundled defaults)
16
+ *
17
+ * Unknown models fall back to { inputPerM: 1.0, outputPerM: 5.0 } — a safe
18
+ * ballpark that won't silently report $0 for unmapped models.
19
+ */
20
+ export interface ModelPrice {
21
+ /** USD per 1M input tokens. */
22
+ inputPerM: number;
23
+ /** USD per 1M output tokens. */
24
+ outputPerM: number;
25
+ }
26
+ export declare function priceFor(model: string): ModelPrice;
27
+ export interface CostEvent {
28
+ model: string;
29
+ /** Where in the pipeline this cost was incurred. Kept wide enough to cover
30
+ * router-free stages (classify / decompose) and every unified-agent mode. */
31
+ stage: 'classify' | 'decompose' | 'decomposer-fallback' | 'text-agent' | 'vision-agent' | 'blind' | 'hybrid' | 'vision';
32
+ inputTokens: number;
33
+ outputTokens: number;
34
+ }
35
+ export interface CostSnapshot {
36
+ totalUsd: number;
37
+ byModel: Record<string, {
38
+ inputTokens: number;
39
+ outputTokens: number;
40
+ usd: number;
41
+ }>;
42
+ byStage: Record<string, {
43
+ usd: number;
44
+ calls: number;
45
+ }>;
46
+ }
47
+ export declare class CostMeter {
48
+ private events;
49
+ record(e: CostEvent): void;
50
+ snapshot(): CostSnapshot;
51
+ }
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ /**
3
+ * Per-task cost meter — model-agnostic.
4
+ *
5
+ * Tracks tokens in/out per model, plus non-LLM costs (OCR calls, screenshot
6
+ * bytes) if we want to surface those later. Converts to USD via a static
7
+ * price table that is overrideable at runtime.
8
+ *
9
+ * Why this exists: the product claim is "cost-aware — picks the cheapest path
10
+ * that works." The audit showed we had no way to prove it. The cost meter
11
+ * makes blind-first savings visible in /task responses and in a new
12
+ * `clawdcursor cost` CLI.
13
+ *
14
+ * Price table is loaded from:
15
+ * 1. ~/.clawdcursor/pricing.json (user override; precedence)
16
+ * 2. src/core/observability/pricing.default.json (bundled defaults)
17
+ *
18
+ * Unknown models fall back to { inputPerM: 1.0, outputPerM: 5.0 } — a safe
19
+ * ballpark that won't silently report $0 for unmapped models.
20
+ */
21
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ var desc = Object.getOwnPropertyDescriptor(m, k);
24
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
25
+ desc = { enumerable: true, get: function() { return m[k]; } };
26
+ }
27
+ Object.defineProperty(o, k2, desc);
28
+ }) : (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ o[k2] = m[k];
31
+ }));
32
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
33
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
34
+ }) : function(o, v) {
35
+ o["default"] = v;
36
+ });
37
+ var __importStar = (this && this.__importStar) || (function () {
38
+ var ownKeys = function(o) {
39
+ ownKeys = Object.getOwnPropertyNames || function (o) {
40
+ var ar = [];
41
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
42
+ return ar;
43
+ };
44
+ return ownKeys(o);
45
+ };
46
+ return function (mod) {
47
+ if (mod && mod.__esModule) return mod;
48
+ var result = {};
49
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
50
+ __setModuleDefault(result, mod);
51
+ return result;
52
+ };
53
+ })();
54
+ Object.defineProperty(exports, "__esModule", { value: true });
55
+ exports.CostMeter = void 0;
56
+ exports.priceFor = priceFor;
57
+ const fs = __importStar(require("fs"));
58
+ const path = __importStar(require("path"));
59
+ const os = __importStar(require("os"));
60
+ const FALLBACK_PRICE = { inputPerM: 1.0, outputPerM: 5.0 };
61
+ // Published list prices as of plan-time. User can override per provider/model
62
+ // via ~/.clawdcursor/pricing.json without code changes.
63
+ const DEFAULT_PRICES = {
64
+ // Anthropic (approximate public list prices)
65
+ 'claude-haiku-4-5': { inputPerM: 1.0, outputPerM: 5.0 },
66
+ 'claude-sonnet-4-20250514': { inputPerM: 3.0, outputPerM: 15.0 },
67
+ 'claude-opus-4': { inputPerM: 15.0, outputPerM: 75.0 },
68
+ 'claude-opus-4-6': { inputPerM: 15.0, outputPerM: 75.0 },
69
+ // OpenAI
70
+ 'gpt-4o-mini': { inputPerM: 0.15, outputPerM: 0.60 },
71
+ 'gpt-4o': { inputPerM: 2.5, outputPerM: 10.0 },
72
+ // Ollama / local — zero by construction
73
+ 'llama3.2': { inputPerM: 0.0, outputPerM: 0.0 },
74
+ 'qwen2.5:7b': { inputPerM: 0.0, outputPerM: 0.0 },
75
+ // Groq
76
+ 'llama-3.3-70b-versatile': { inputPerM: 0.59, outputPerM: 0.79 },
77
+ // Kimi / Moonshot
78
+ 'moonshot-v1-8k': { inputPerM: 0.15, outputPerM: 2.0 },
79
+ };
80
+ let loadedPrices = null;
81
+ function loadPrices() {
82
+ if (loadedPrices)
83
+ return loadedPrices;
84
+ const override = path.join(os.homedir(), '.clawdcursor', 'pricing.json');
85
+ let merged = { ...DEFAULT_PRICES };
86
+ try {
87
+ if (fs.existsSync(override)) {
88
+ const parsed = JSON.parse(fs.readFileSync(override, 'utf8'));
89
+ merged = { ...merged, ...parsed };
90
+ }
91
+ }
92
+ catch {
93
+ // Bad override file — log would be nice, but cost-meter must stay silent.
94
+ }
95
+ loadedPrices = merged;
96
+ return loadedPrices;
97
+ }
98
+ function priceFor(model) {
99
+ const table = loadPrices();
100
+ // Exact match first, then provider-prefix match (e.g. "claude-sonnet-4-*").
101
+ if (table[model])
102
+ return table[model];
103
+ for (const key of Object.keys(table)) {
104
+ if (model.startsWith(key))
105
+ return table[key];
106
+ }
107
+ return FALLBACK_PRICE;
108
+ }
109
+ class CostMeter {
110
+ events = [];
111
+ record(e) {
112
+ this.events.push(e);
113
+ }
114
+ snapshot() {
115
+ const byModel = {};
116
+ const byStage = {};
117
+ let total = 0;
118
+ for (const e of this.events) {
119
+ const p = priceFor(e.model);
120
+ const usd = (e.inputTokens / 1_000_000) * p.inputPerM + (e.outputTokens / 1_000_000) * p.outputPerM;
121
+ total += usd;
122
+ const m = byModel[e.model] ??= { inputTokens: 0, outputTokens: 0, usd: 0 };
123
+ m.inputTokens += e.inputTokens;
124
+ m.outputTokens += e.outputTokens;
125
+ m.usd += usd;
126
+ const s = byStage[e.stage] ??= { usd: 0, calls: 0 };
127
+ s.usd += usd;
128
+ s.calls += 1;
129
+ }
130
+ return { totalUsd: total, byModel, byStage };
131
+ }
132
+ }
133
+ exports.CostMeter = CostMeter;
134
+ //# sourceMappingURL=cost-meter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cost-meter.js","sourceRoot":"","sources":["../../../src/core/observability/cost-meter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDH,4BAQC;AA3DD,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AASzB,MAAM,cAAc,GAAe,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;AAEvE,8EAA8E;AAC9E,wDAAwD;AACxD,MAAM,cAAc,GAA+B;IACjD,6CAA6C;IAC7C,kBAAkB,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE;IACvD,0BAA0B,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE;IAChE,eAAe,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;IACtD,iBAAiB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;IACxD,SAAS;IACT,aAAa,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;IACpD,QAAQ,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE;IAC9C,wCAAwC;IACxC,UAAU,EAAE,EAAE,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;QACD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC/C,CAAC;CACF;AAzBD,8BAyBC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Leveled logger with TTY pretty-print + JSON file log.
3
+ *
4
+ * Two output surfaces:
5
+ *
6
+ * 1. JSON file log (stable machine-readable contract) — one
7
+ * `{ts, level, msg, meta}` line per event, rotated at 10 MB, 5 backups,
8
+ * never changes format between releases. Greppable, tailable.
9
+ *
10
+ * 2. TTY pretty-print (the default when stderr is a TTY) — layer-tagged,
11
+ * color-coded, one visual block per meaningful event. Redundant events
12
+ * (`safety.decision=allow`, `agent.turn.end`) are suppressed. Correlation
13
+ * ID + task + model lineup are printed ONCE in a header, not repeated on
14
+ * every line.
15
+ *
16
+ * The format is designed so the reader sees "router doing X", "blind
17
+ * agent turn 3 thinking Y, calling tool Z", "vision fallback turn 5"
18
+ * at a glance — every line carries its LAYER, so there is never
19
+ * ambiguity about which part of the pipeline is running.
20
+ *
21
+ * `CLAWD_LOG=json` disables pretty-print (useful for piping to a file
22
+ * or CI). `CLAWD_NO_COLOR=1` / `NO_COLOR=1` keeps pretty-print but
23
+ * without ANSI colors.
24
+ */
25
+ export declare const EVENTS: {
26
+ readonly PIPELINE_START: "pipeline.start";
27
+ readonly PIPELINE_PREPROCESS: "pipeline.preprocess";
28
+ readonly PIPELINE_SUBTASK: "pipeline.subtask";
29
+ readonly PIPELINE_RUNG: "pipeline.rung";
30
+ readonly PIPELINE_DONE: "pipeline.done";
31
+ readonly AGENT_TURN_START: "agent.turn.start";
32
+ readonly AGENT_THINK: "agent.think";
33
+ readonly AGENT_TOOL_CALL: "agent.tool.call";
34
+ readonly AGENT_TOOL_RESULT: "agent.tool.result";
35
+ readonly AGENT_TURN_END: "agent.turn.end";
36
+ readonly AGENT_STAGNATION: "agent.stagnation";
37
+ readonly ADAPTER_CALL: "adapter.call";
38
+ };
39
+ /**
40
+ * Begin a nested span. Currently a no-op on pretty format (indentation is
41
+ * baked into per-event rendering); kept for API compatibility with callers
42
+ * that wrap turns / playbook steps in spans.
43
+ */
44
+ export declare function beginSpan(): {
45
+ end: () => void;
46
+ };
47
+ export declare const logger: {
48
+ debug: (msg: string, meta?: Record<string, unknown>) => void;
49
+ info: (msg: string, meta?: Record<string, unknown>) => void;
50
+ warn: (msg: string, meta?: Record<string, unknown>) => void;
51
+ error: (msg: string, meta?: Record<string, unknown>) => void;
52
+ /** Child logger bound to a correlation ID — inlined into every JSON record's meta. */
53
+ with: (extra: Record<string, unknown>) => {
54
+ debug: (msg: string, meta?: Record<string, unknown>) => void;
55
+ info: (msg: string, meta?: Record<string, unknown>) => void;
56
+ warn: (msg: string, meta?: Record<string, unknown>) => void;
57
+ error: (msg: string, meta?: Record<string, unknown>) => void;
58
+ };
59
+ span: typeof beginSpan;
60
+ };
61
+ export type Logger = typeof logger;