@nordhavnhq/runner 0.0.0-stage → 0.95.0

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 (338) hide show
  1. package/bin/cliclick +0 -0
  2. package/dist/brand.d.ts +5 -0
  3. package/dist/brand.js +18 -0
  4. package/dist/cli/agent.d.ts +9 -0
  5. package/dist/cli/agent.js +80 -0
  6. package/dist/cli/folder.d.ts +2 -0
  7. package/dist/cli/folder.js +103 -0
  8. package/dist/cli/init.d.ts +2 -0
  9. package/dist/cli/init.js +67 -0
  10. package/dist/cli/lifecycle.d.ts +3 -0
  11. package/dist/cli/lifecycle.js +149 -0
  12. package/dist/cli/link.d.ts +42 -0
  13. package/dist/cli/link.js +314 -0
  14. package/dist/cli/logs.d.ts +2 -0
  15. package/dist/cli/logs.js +147 -0
  16. package/dist/cli/prompts.d.ts +7 -0
  17. package/dist/cli/prompts.js +13 -0
  18. package/dist/cli/ps.d.ts +2 -0
  19. package/dist/cli/ps.js +81 -0
  20. package/dist/cli/relay.d.ts +4 -0
  21. package/dist/cli/relay.js +29 -0
  22. package/dist/cli/update.d.ts +6 -0
  23. package/dist/cli/update.js +131 -0
  24. package/dist/config.d.ts +166 -0
  25. package/dist/config.js +383 -0
  26. package/dist/index.d.ts +2 -0
  27. package/dist/index.js +145 -0
  28. package/dist/legacy-env.d.ts +4 -0
  29. package/dist/legacy-env.js +32 -0
  30. package/dist/paths.d.ts +37 -0
  31. package/dist/paths.js +92 -0
  32. package/dist/runtime/daemon.d.ts +57 -0
  33. package/dist/runtime/daemon.js +159 -0
  34. package/dist/runtime/dev-start.d.ts +31 -0
  35. package/dist/runtime/dev-start.js +110 -0
  36. package/dist/runtime/file-claims.d.ts +58 -0
  37. package/dist/runtime/file-claims.js +174 -0
  38. package/dist/runtime/fs-browse.d.ts +18 -0
  39. package/dist/runtime/fs-browse.js +104 -0
  40. package/dist/runtime/fs-checkout.d.ts +154 -0
  41. package/dist/runtime/fs-checkout.js +1049 -0
  42. package/dist/runtime/fs-git-index.d.ts +22 -0
  43. package/dist/runtime/fs-git-index.js +133 -0
  44. package/dist/runtime/fs-git.d.ts +16 -0
  45. package/dist/runtime/fs-git.js +424 -0
  46. package/dist/runtime/git-relay.d.ts +46 -0
  47. package/dist/runtime/git-relay.js +259 -0
  48. package/dist/runtime/git-unpushed.d.ts +36 -0
  49. package/dist/runtime/git-unpushed.js +93 -0
  50. package/dist/runtime/node-version.d.ts +12 -0
  51. package/dist/runtime/node-version.js +39 -0
  52. package/dist/runtime/preview-tunnel.d.ts +16 -0
  53. package/dist/runtime/preview-tunnel.js +135 -0
  54. package/dist/runtime/processes.d.ts +61 -0
  55. package/dist/runtime/processes.js +408 -0
  56. package/dist/runtime/project-node-download.d.ts +17 -0
  57. package/dist/runtime/project-node-download.js +137 -0
  58. package/dist/runtime/project-node.d.ts +65 -0
  59. package/dist/runtime/project-node.js +223 -0
  60. package/dist/runtime/reap-scratch.d.ts +22 -0
  61. package/dist/runtime/reap-scratch.js +112 -0
  62. package/dist/runtime/spill-tool-output.d.ts +14 -0
  63. package/dist/runtime/spill-tool-output.js +84 -0
  64. package/dist/runtime/up.d.ts +6 -0
  65. package/dist/runtime/up.js +1325 -0
  66. package/dist/tools/_coerce.d.ts +2 -0
  67. package/dist/tools/_coerce.js +26 -0
  68. package/dist/tools/_commit-scope.d.ts +14 -0
  69. package/dist/tools/_commit-scope.js +70 -0
  70. package/dist/tools/_jail.d.ts +68 -0
  71. package/dist/tools/_jail.js +209 -0
  72. package/dist/tools/_output.d.ts +24 -0
  73. package/dist/tools/_output.js +48 -0
  74. package/dist/tools/_ripgrep.d.ts +46 -0
  75. package/dist/tools/_ripgrep.js +148 -0
  76. package/dist/tools/_run-worktree.d.ts +10 -0
  77. package/dist/tools/_run-worktree.js +27 -0
  78. package/dist/tools/_shell-words.d.ts +15 -0
  79. package/dist/tools/_shell-words.js +43 -0
  80. package/dist/tools/_sonar/astro.d.ts +6 -0
  81. package/dist/tools/_sonar/astro.js +45 -0
  82. package/dist/tools/_sonar/blade.d.ts +3 -0
  83. package/dist/tools/_sonar/blade.js +53 -0
  84. package/dist/tools/_sonar/build.d.ts +44 -0
  85. package/dist/tools/_sonar/build.js +147 -0
  86. package/dist/tools/_sonar/changed.d.ts +21 -0
  87. package/dist/tools/_sonar/changed.js +230 -0
  88. package/dist/tools/_sonar/diagnose/delta.d.ts +27 -0
  89. package/dist/tools/_sonar/diagnose/delta.js +64 -0
  90. package/dist/tools/_sonar/diagnose/detect.d.ts +39 -0
  91. package/dist/tools/_sonar/diagnose/detect.js +117 -0
  92. package/dist/tools/_sonar/diagnose/index.d.ts +13 -0
  93. package/dist/tools/_sonar/diagnose/index.js +217 -0
  94. package/dist/tools/_sonar/diagnose/lint-worker.d.ts +1 -0
  95. package/dist/tools/_sonar/diagnose/lint-worker.js +48 -0
  96. package/dist/tools/_sonar/diagnose/pool.d.ts +22 -0
  97. package/dist/tools/_sonar/diagnose/pool.js +149 -0
  98. package/dist/tools/_sonar/diagnose/rules.d.ts +23 -0
  99. package/dist/tools/_sonar/diagnose/rules.js +131 -0
  100. package/dist/tools/_sonar/diagnose/types-worker.d.ts +1 -0
  101. package/dist/tools/_sonar/diagnose/types-worker.js +183 -0
  102. package/dist/tools/_sonar/files.d.ts +14 -0
  103. package/dist/tools/_sonar/files.js +121 -0
  104. package/dist/tools/_sonar/graph.d.ts +34 -0
  105. package/dist/tools/_sonar/graph.js +164 -0
  106. package/dist/tools/_sonar/hints.d.ts +116 -0
  107. package/dist/tools/_sonar/hints.js +545 -0
  108. package/dist/tools/_sonar/imports.d.ts +38 -0
  109. package/dist/tools/_sonar/imports.js +275 -0
  110. package/dist/tools/_sonar/index.d.ts +79 -0
  111. package/dist/tools/_sonar/index.js +462 -0
  112. package/dist/tools/_sonar/keys.d.ts +5 -0
  113. package/dist/tools/_sonar/keys.js +248 -0
  114. package/dist/tools/_sonar/laravel-routes.d.ts +15 -0
  115. package/dist/tools/_sonar/laravel-routes.js +263 -0
  116. package/dist/tools/_sonar/laravel.d.ts +64 -0
  117. package/dist/tools/_sonar/laravel.js +326 -0
  118. package/dist/tools/_sonar/location.d.ts +33 -0
  119. package/dist/tools/_sonar/location.js +137 -0
  120. package/dist/tools/_sonar/map.d.ts +43 -0
  121. package/dist/tools/_sonar/map.js +212 -0
  122. package/dist/tools/_sonar/parse.d.ts +3 -0
  123. package/dist/tools/_sonar/parse.js +76 -0
  124. package/dist/tools/_sonar/prewarm.d.ts +9 -0
  125. package/dist/tools/_sonar/prewarm.js +96 -0
  126. package/dist/tools/_sonar/prisma.d.ts +9 -0
  127. package/dist/tools/_sonar/prisma.js +51 -0
  128. package/dist/tools/_sonar/refs.d.ts +7 -0
  129. package/dist/tools/_sonar/refs.js +273 -0
  130. package/dist/tools/_sonar/render.d.ts +66 -0
  131. package/dist/tools/_sonar/render.js +498 -0
  132. package/dist/tools/_sonar/resolve.d.ts +63 -0
  133. package/dist/tools/_sonar/resolve.js +402 -0
  134. package/dist/tools/_sonar/roots.d.ts +4 -0
  135. package/dist/tools/_sonar/roots.js +42 -0
  136. package/dist/tools/_sonar/routes.d.ts +5 -0
  137. package/dist/tools/_sonar/routes.js +247 -0
  138. package/dist/tools/_sonar/serve.d.ts +12 -0
  139. package/dist/tools/_sonar/serve.js +104 -0
  140. package/dist/tools/_sonar/suggest.d.ts +23 -0
  141. package/dist/tools/_sonar/suggest.js +114 -0
  142. package/dist/tools/_sonar/tests.d.ts +21 -0
  143. package/dist/tools/_sonar/tests.js +134 -0
  144. package/dist/tools/_sonar/tsconfig.d.ts +34 -0
  145. package/dist/tools/_sonar/tsconfig.js +188 -0
  146. package/dist/tools/_sonar/types.d.ts +81 -0
  147. package/dist/tools/_sonar/types.js +6 -0
  148. package/dist/tools/_symbols.d.ts +27 -0
  149. package/dist/tools/_symbols.js +461 -0
  150. package/dist/tools/_test-report.d.ts +47 -0
  151. package/dist/tools/_test-report.js +203 -0
  152. package/dist/tools/_touched.d.ts +44 -0
  153. package/dist/tools/_touched.js +195 -0
  154. package/dist/tools/_upload.d.ts +26 -0
  155. package/dist/tools/_upload.js +132 -0
  156. package/dist/tools/_worktree-setup.d.ts +29 -0
  157. package/dist/tools/_worktree-setup.js +204 -0
  158. package/dist/tools/browser.d.ts +2 -0
  159. package/dist/tools/browser.js +8 -0
  160. package/dist/tools/commit-guard.d.ts +44 -0
  161. package/dist/tools/commit-guard.js +165 -0
  162. package/dist/tools/computer.d.ts +13 -0
  163. package/dist/tools/computer.js +952 -0
  164. package/dist/tools/console.d.ts +44 -0
  165. package/dist/tools/console.js +739 -0
  166. package/dist/tools/database.d.ts +28 -0
  167. package/dist/tools/database.js +152 -0
  168. package/dist/tools/filesystem.d.ts +36 -0
  169. package/dist/tools/filesystem.js +506 -0
  170. package/dist/tools/git-tag.d.ts +10 -0
  171. package/dist/tools/git-tag.js +164 -0
  172. package/dist/tools/git.d.ts +52 -0
  173. package/dist/tools/git.js +1272 -0
  174. package/dist/tools/http.d.ts +12 -0
  175. package/dist/tools/http.js +119 -0
  176. package/dist/tools/image.d.ts +8 -0
  177. package/dist/tools/image.js +551 -0
  178. package/dist/tools/index.d.ts +13 -0
  179. package/dist/tools/index.js +58 -0
  180. package/dist/tools/outline.d.ts +20 -0
  181. package/dist/tools/outline.js +98 -0
  182. package/dist/tools/search.d.ts +17 -0
  183. package/dist/tools/search.js +391 -0
  184. package/dist/tools/sonar.d.ts +17 -0
  185. package/dist/tools/sonar.js +231 -0
  186. package/dist/tools/testing.d.ts +36 -0
  187. package/dist/tools/testing.js +273 -0
  188. package/dist/tools/upload.d.ts +8 -0
  189. package/dist/tools/upload.js +106 -0
  190. package/dist/tools/webcam.d.ts +28 -0
  191. package/dist/tools/webcam.js +967 -0
  192. package/dist/update/install-kind.d.ts +35 -0
  193. package/dist/update/install-kind.js +109 -0
  194. package/dist/update/install.d.ts +32 -0
  195. package/dist/update/install.js +187 -0
  196. package/dist/update/manifest.d.ts +18 -0
  197. package/dist/update/manifest.js +73 -0
  198. package/dist/update/peers.d.ts +18 -0
  199. package/dist/update/peers.js +43 -0
  200. package/dist/update/policy.d.ts +20 -0
  201. package/dist/update/policy.js +49 -0
  202. package/dist/update/supervisor.d.ts +25 -0
  203. package/dist/update/supervisor.js +83 -0
  204. package/dist/update/updater.d.ts +44 -0
  205. package/dist/update/updater.js +116 -0
  206. package/dist/utils/format.d.ts +50 -0
  207. package/dist/utils/format.js +190 -0
  208. package/dist/version.d.ts +17 -0
  209. package/dist/version.js +63 -0
  210. package/dist/version.json +5 -0
  211. package/node_modules/@nordhavnhq/runner-browser/dist/act-tools.d.ts +15 -0
  212. package/node_modules/@nordhavnhq/runner-browser/dist/act-tools.js +541 -0
  213. package/node_modules/@nordhavnhq/runner-browser/dist/cast-hub.d.ts +25 -0
  214. package/node_modules/@nordhavnhq/runner-browser/dist/cast-hub.js +137 -0
  215. package/node_modules/@nordhavnhq/runner-browser/dist/guard.d.ts +21 -0
  216. package/node_modules/@nordhavnhq/runner-browser/dist/guard.js +104 -0
  217. package/node_modules/@nordhavnhq/runner-browser/dist/host-protocol.d.ts +47 -0
  218. package/node_modules/@nordhavnhq/runner-browser/dist/host-protocol.js +41 -0
  219. package/node_modules/@nordhavnhq/runner-browser/dist/host.d.ts +18 -0
  220. package/node_modules/@nordhavnhq/runner-browser/dist/host.js +15 -0
  221. package/node_modules/@nordhavnhq/runner-browser/dist/index.d.ts +13 -0
  222. package/node_modules/@nordhavnhq/runner-browser/dist/index.js +28 -0
  223. package/node_modules/@nordhavnhq/runner-browser/dist/live-input.d.ts +74 -0
  224. package/node_modules/@nordhavnhq/runner-browser/dist/live-input.js +93 -0
  225. package/node_modules/@nordhavnhq/runner-browser/dist/live-open.d.ts +4 -0
  226. package/node_modules/@nordhavnhq/runner-browser/dist/live-open.js +57 -0
  227. package/node_modules/@nordhavnhq/runner-browser/dist/live.d.ts +148 -0
  228. package/node_modules/@nordhavnhq/runner-browser/dist/live.js +179 -0
  229. package/node_modules/@nordhavnhq/runner-browser/dist/local-live.d.ts +31 -0
  230. package/node_modules/@nordhavnhq/runner-browser/dist/local-live.js +262 -0
  231. package/node_modules/@nordhavnhq/runner-browser/dist/marks.d.ts +36 -0
  232. package/node_modules/@nordhavnhq/runner-browser/dist/marks.js +173 -0
  233. package/node_modules/@nordhavnhq/runner-browser/dist/page-events.d.ts +27 -0
  234. package/node_modules/@nordhavnhq/runner-browser/dist/page-events.js +82 -0
  235. package/node_modules/@nordhavnhq/runner-browser/dist/page-tools.d.ts +13 -0
  236. package/node_modules/@nordhavnhq/runner-browser/dist/page-tools.js +526 -0
  237. package/node_modules/@nordhavnhq/runner-browser/dist/params.d.ts +12 -0
  238. package/node_modules/@nordhavnhq/runner-browser/dist/params.js +32 -0
  239. package/node_modules/@nordhavnhq/runner-browser/dist/pick.d.ts +24 -0
  240. package/node_modules/@nordhavnhq/runner-browser/dist/pick.js +76 -0
  241. package/node_modules/@nordhavnhq/runner-browser/dist/session.d.ts +225 -0
  242. package/node_modules/@nordhavnhq/runner-browser/dist/session.js +507 -0
  243. package/node_modules/@nordhavnhq/runner-browser/dist/shots.d.ts +11 -0
  244. package/node_modules/@nordhavnhq/runner-browser/dist/shots.js +103 -0
  245. package/node_modules/@nordhavnhq/runner-browser/dist/show.d.ts +10 -0
  246. package/node_modules/@nordhavnhq/runner-browser/dist/show.js +190 -0
  247. package/node_modules/@nordhavnhq/runner-browser/dist/target.d.ts +37 -0
  248. package/node_modules/@nordhavnhq/runner-browser/dist/target.js +82 -0
  249. package/node_modules/@nordhavnhq/runner-browser/dist/tour.d.ts +19 -0
  250. package/node_modules/@nordhavnhq/runner-browser/dist/tour.js +178 -0
  251. package/node_modules/@nordhavnhq/runner-browser/package.json +18 -0
  252. package/node_modules/@nordhavnhq/runner-runtime/dist/config.d.ts +96 -0
  253. package/node_modules/@nordhavnhq/runner-runtime/dist/config.js +25 -0
  254. package/node_modules/@nordhavnhq/runner-runtime/dist/connection.d.ts +276 -0
  255. package/node_modules/@nordhavnhq/runner-runtime/dist/connection.js +507 -0
  256. package/node_modules/@nordhavnhq/runner-runtime/dist/constants.d.ts +48 -0
  257. package/node_modules/@nordhavnhq/runner-runtime/dist/constants.js +95 -0
  258. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/batch.d.ts +94 -0
  259. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/batch.js +219 -0
  260. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/calls.d.ts +136 -0
  261. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/calls.js +214 -0
  262. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/fs.d.ts +735 -0
  263. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/fs.js +40 -0
  264. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/loop.d.ts +362 -0
  265. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/loop.js +703 -0
  266. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/own-files.d.ts +105 -0
  267. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/own-files.js +202 -0
  268. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/phases.d.ts +204 -0
  269. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/phases.js +497 -0
  270. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/pins.d.ts +45 -0
  271. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/pins.js +176 -0
  272. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/processes.d.ts +74 -0
  273. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/processes.js +72 -0
  274. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/release-tag.d.ts +59 -0
  275. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/release-tag.js +117 -0
  276. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/replay.d.ts +62 -0
  277. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/replay.js +84 -0
  278. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/tool-names.d.ts +27 -0
  279. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/tool-names.js +80 -0
  280. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/version.d.ts +22 -0
  281. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/version.js +22 -0
  282. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/wire.d.ts +595 -0
  283. package/node_modules/@nordhavnhq/runner-runtime/dist/contract/wire.js +85 -0
  284. package/node_modules/@nordhavnhq/runner-runtime/dist/index.d.ts +43 -0
  285. package/node_modules/@nordhavnhq/runner-runtime/dist/index.js +50 -0
  286. package/node_modules/@nordhavnhq/runner-runtime/dist/inference.d.ts +135 -0
  287. package/node_modules/@nordhavnhq/runner-runtime/dist/inference.js +945 -0
  288. package/node_modules/@nordhavnhq/runner-runtime/dist/mcp.d.ts +67 -0
  289. package/node_modules/@nordhavnhq/runner-runtime/dist/mcp.js +47 -0
  290. package/node_modules/@nordhavnhq/runner-runtime/dist/platform.d.ts +21 -0
  291. package/node_modules/@nordhavnhq/runner-runtime/dist/platform.js +25 -0
  292. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/auto-load.d.ts +39 -0
  293. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/auto-load.js +67 -0
  294. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/background-commands.d.ts +61 -0
  295. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/background-commands.js +58 -0
  296. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/chat-run-ends.d.ts +23 -0
  297. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/chat-run-ends.js +42 -0
  298. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/duration.d.ts +6 -0
  299. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/duration.js +12 -0
  300. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/events.d.ts +150 -0
  301. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/events.js +36 -0
  302. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/extract-json.d.ts +14 -0
  303. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/extract-json.js +49 -0
  304. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/handle-chat.d.ts +109 -0
  305. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/handle-chat.js +894 -0
  306. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/handle-task.d.ts +73 -0
  307. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/handle-task.js +765 -0
  308. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/loop.d.ts +246 -0
  309. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/loop.js +621 -0
  310. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/messages.d.ts +88 -0
  311. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/messages.js +188 -0
  312. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/pending-steers.d.ts +15 -0
  313. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/pending-steers.js +10 -0
  314. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/phased-loop.d.ts +16 -0
  315. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/phased-loop.js +97 -0
  316. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/project-instructions.d.ts +22 -0
  317. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/project-instructions.js +47 -0
  318. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/run-tools.d.ts +26 -0
  319. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/run-tools.js +48 -0
  320. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/scratch-prompt.d.ts +8 -0
  321. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/scratch-prompt.js +19 -0
  322. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/side-question.d.ts +76 -0
  323. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/side-question.js +155 -0
  324. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/task-validation.d.ts +43 -0
  325. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/task-validation.js +37 -0
  326. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/unload-toolset.d.ts +49 -0
  327. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/unload-toolset.js +104 -0
  328. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/write-scope.d.ts +16 -0
  329. package/node_modules/@nordhavnhq/runner-runtime/dist/runtime/write-scope.js +6 -0
  330. package/node_modules/@nordhavnhq/runner-runtime/dist/tools/delegate.d.ts +86 -0
  331. package/node_modules/@nordhavnhq/runner-runtime/dist/tools/delegate.js +141 -0
  332. package/node_modules/@nordhavnhq/runner-runtime/dist/tools/index.d.ts +179 -0
  333. package/node_modules/@nordhavnhq/runner-runtime/dist/tools/index.js +35 -0
  334. package/node_modules/@nordhavnhq/runner-runtime/dist/tools/mcp.d.ts +21 -0
  335. package/node_modules/@nordhavnhq/runner-runtime/dist/tools/mcp.js +179 -0
  336. package/node_modules/@nordhavnhq/runner-runtime/package.json +18 -0
  337. package/package.json +33 -4
  338. package/README.md +0 -3
@@ -0,0 +1,462 @@
1
+ import { mkdirSync, readFileSync, realpathSync, renameSync, statSync, unlinkSync, writeFileSync } from 'node:fs';
2
+ import { dirname, join, resolve, sep } from 'node:path';
3
+ import { FS_SONAR_NOT_BUILT } from '@nordhavnhq/runner-runtime';
4
+ import { log } from '../../utils/format.js';
5
+ import { listSonarFiles, SONAR_MAX_FILE_BYTES } from './files.js';
6
+ import { ensureSonarExcluded, findSonarRootOnDisk, isSonarFilePath, migrateLegacySonarCache, sonarCachePath, sonarTmpPath } from './location.js';
7
+ import { parseSonarFile } from './parse.js';
8
+ import { SonarResolver } from './resolve.js';
9
+ export { sonarCachePath } from './location.js';
10
+ /**
11
+ * Bumped whenever SonarFile changes shape or a parse gives other results
12
+ * (a cached parse is reused by mtime + size): an older cache is rebuilt.
13
+ * 2: `.blade.php` parsed as 'blade', Laravel by-name specifiers in PHP.
14
+ * 3: a type-only import no longer hides a Vue template tag of the same name.
15
+ */
16
+ const SCHEMA_VERSION = 3;
17
+ const MEMO_MS = 2000;
18
+ /** The most changed files a load that is not a build reads again; past it the index answers as built. */
19
+ export const SONAR_REFRESH_MAX = 300;
20
+ /** The longest a load keeps the event loop before it lets the rest of the runner run. */
21
+ const SLICE_MS = 15;
22
+ /** A load without `build` of a checkout that has no index; `reason` says why. */
23
+ export class SonarNotBuiltError extends Error {
24
+ reason;
25
+ constructor(reason = 'missing') {
26
+ super(FS_SONAR_NOT_BUILT);
27
+ this.reason = reason;
28
+ this.name = 'SonarNotBuiltError';
29
+ }
30
+ }
31
+ /** The last index per root and cache dir in this process, and when it was checked. */
32
+ const memo = new Map();
33
+ /** Builds running now, per root and cache dir: an overlapping load waits on the same one. */
34
+ const inflight = new Map();
35
+ /** Roots a build runs for now: a load beside it does not write the `.sonar`. */
36
+ const building = new Set();
37
+ /** What went wrong with the `.sonar` while an index was loaded. */
38
+ const problemsOf = new WeakMap();
39
+ /** Indexes `peekSonarIndex` read off disk, per root and cache dir, with the file's stamp. */
40
+ const peeked = new Map();
41
+ const memoKeyOf = (root, cacheDir) => `${root}\0${cacheDir ?? ''}`;
42
+ const reasonOf = (err) => err?.message ?? String(err);
43
+ /** The `.sonar` of a root, or why it could not be used (no problem when it is missing; `outdated` for an older schema). */
44
+ function readCache(path) {
45
+ let text;
46
+ try {
47
+ text = readFileSync(path, 'utf-8');
48
+ }
49
+ catch (err) {
50
+ const code = err.code;
51
+ // Missing: a first build. ENOTDIR: a parent is a file, the write says why.
52
+ if (code === 'ENOENT' || code === 'ENOTDIR')
53
+ return { cached: null };
54
+ return { cached: null, problem: `cache not read: ${reasonOf(err)}` };
55
+ }
56
+ let data;
57
+ try {
58
+ data = JSON.parse(text);
59
+ }
60
+ catch (err) {
61
+ return { cached: null, problem: `cache not read: ${reasonOf(err)}` };
62
+ }
63
+ if (data?.schema !== SCHEMA_VERSION)
64
+ return { cached: null, outdated: true };
65
+ const valid = Array.isArray(data.files) && Array.isArray(data.workspaces)
66
+ && data.files.every(f => typeof f?.path === 'string' && Array.isArray(f.edges) && Array.isArray(f.imports));
67
+ if (!valid)
68
+ return { cached: null, problem: 'cache not read: unexpected content' };
69
+ // The root is not compared: paths are relative, so a moved checkout keeps its index.
70
+ return { cached: { files: new Map(data.files.map(f => [f.path, f])), workspaces: data.workspaces, builtAt: typeof data.builtAt === 'string' ? data.builtAt : null } };
71
+ }
72
+ /** Write the `.sonar` atomically (a temp file renamed onto it); the problem when it fails. */
73
+ function writeCache(path, root, index, inCheckout) {
74
+ const tmp = sonarTmpPath(path);
75
+ try {
76
+ if (inCheckout)
77
+ ensureSonarExcluded(root);
78
+ mkdirSync(dirname(path), { recursive: true });
79
+ const data = { schema: SCHEMA_VERSION, root, ...(index.builtAt ? { builtAt: index.builtAt } : {}), files: [...index.files.values()], workspaces: index.workspaces };
80
+ writeFileSync(tmp, JSON.stringify(data));
81
+ renameSync(tmp, path);
82
+ return null;
83
+ }
84
+ catch (err) {
85
+ try {
86
+ unlinkSync(tmp);
87
+ }
88
+ catch { /* never written */ }
89
+ return `cache not saved: ${reasonOf(err)}`;
90
+ }
91
+ }
92
+ /** Let the rest of the runner (its socket, the agents) run before going on. */
93
+ const yieldToLoop = () => new Promise(resolve => setImmediate(resolve));
94
+ /** Runs `step` over `items`, yielding to the event loop every SLICE_MS; `tick` hears how far it is. */
95
+ async function inSlices(items, step, tick) {
96
+ let slice = performance.now();
97
+ for (let i = 0; i < items.length; i++) {
98
+ if (performance.now() - slice > SLICE_MS) {
99
+ tick?.(i);
100
+ await yieldToLoop();
101
+ slice = performance.now();
102
+ }
103
+ step(items[i]);
104
+ }
105
+ tick?.(items.length);
106
+ }
107
+ /** Per listed path, in order: its cached file when unchanged, else what to parse. */
108
+ async function planRefresh(root, paths, cached = new Map()) {
109
+ const slots = [];
110
+ await inSlices(paths, (rel) => {
111
+ let st;
112
+ try {
113
+ st = statSync(join(root, rel));
114
+ }
115
+ catch {
116
+ return;
117
+ }
118
+ if (!st.isFile() || st.size > SONAR_MAX_FILE_BYTES)
119
+ return;
120
+ const prev = cached.get(rel);
121
+ slots.push(prev && prev.mtimeMs === st.mtimeMs && prev.size === st.size ? prev : { rel, size: st.size, mtimeMs: st.mtimeMs });
122
+ });
123
+ return slots;
124
+ }
125
+ const isToParse = (slot) => 'rel' in slot;
126
+ /** Files of the previous index missing from `kept` (deleted, renamed away, too big or binary now); a changed file is re-read, not gone. */
127
+ function goneOf(previous, kept) {
128
+ const listed = new Set(kept);
129
+ let gone = 0;
130
+ for (const path of previous.keys())
131
+ if (!listed.has(path))
132
+ gone++;
133
+ return gone;
134
+ }
135
+ /** Parse what the plan says changed, in slices; the files in listing order. */
136
+ async function parsePlanned(root, slots, todo, onProgress) {
137
+ const files = [];
138
+ let read = 0;
139
+ let parsed = 0;
140
+ let reused = 0;
141
+ await inSlices(slots, (slot) => {
142
+ if (!isToParse(slot)) {
143
+ files.push(slot);
144
+ reused++;
145
+ return;
146
+ }
147
+ read++;
148
+ let content;
149
+ try {
150
+ content = readFileSync(join(root, slot.rel), 'utf-8');
151
+ }
152
+ catch {
153
+ return;
154
+ }
155
+ if (content.slice(0, 8000).includes('\0'))
156
+ return;
157
+ files.push(parseSonarFile(slot.rel, content, slot.size, slot.mtimeMs));
158
+ parsed++;
159
+ }, onProgress && (() => onProgress({ phase: 'parsing', done: read, total: todo })));
160
+ return { files, parsed, reused };
161
+ }
162
+ function addImporter(importers, target, from) {
163
+ const list = importers.get(target);
164
+ if (!list)
165
+ importers.set(target, [from]);
166
+ else if (list[list.length - 1] !== from)
167
+ list.push(from);
168
+ }
169
+ function linkFile(f, resolver) {
170
+ const edges = new Set();
171
+ const unresolved = new Set();
172
+ const external = new Set();
173
+ const outside = new Set();
174
+ for (const imp of f.imports) {
175
+ const r = resolver.resolve(f, imp);
176
+ if (r.kind === 'files')
177
+ for (const p of r.paths) {
178
+ if (p !== f.path)
179
+ edges.add(p);
180
+ }
181
+ else if (r.kind === 'external')
182
+ external.add(r.name);
183
+ else if (r.kind === 'outside')
184
+ outside.add(r.path);
185
+ else if (r.kind === 'unresolved' && !imp.weak)
186
+ unresolved.add(imp.spec);
187
+ }
188
+ const componentEdges = new Set();
189
+ for (const tag of f.components) {
190
+ const hit = resolver.resolveComponent(tag);
191
+ if (hit && hit !== f.path && !edges.has(hit))
192
+ componentEdges.add(hit);
193
+ }
194
+ return { ...f, edges: [...edges], componentEdges: [...componentEdges], unresolved: [...unresolved], external: [...external], outside: [...outside] };
195
+ }
196
+ function importersOf(files) {
197
+ const importers = new Map();
198
+ for (const f of files.values()) {
199
+ for (const t of f.edges)
200
+ addImporter(importers, t, f.path);
201
+ for (const t of f.componentEdges)
202
+ addImporter(importers, t, f.path);
203
+ }
204
+ return importers;
205
+ }
206
+ /** Resolve every file's imports and build the reverse edges. */
207
+ function linkSonarFiles(root, parsed) {
208
+ const resolver = new SonarResolver(root, parsed);
209
+ const files = new Map();
210
+ for (const p of parsed)
211
+ files.set(p.path, linkFile(p, resolver));
212
+ return { files, importers: importersOf(files), workspaces: resolver.workspaces.map(w => ({ name: w.name, dir: w.dir })) };
213
+ }
214
+ function toParsed(f) {
215
+ if (!('edges' in f))
216
+ return f;
217
+ const { edges: _e, componentEdges: _c, unresolved: _u, external: _x, outside: _o, ...parsed } = f;
218
+ return parsed;
219
+ }
220
+ /** The previous links as they are: the memo's reverse edges, else rebuilt from the cache. */
221
+ function relinkedOf(cached, hit) {
222
+ return { files: cached.files, importers: hit?.index.importers ?? importersOf(cached.files), workspaces: cached.workspaces };
223
+ }
224
+ /**
225
+ * What the last load left: the in-process memo first, else the `.sonar`
226
+ * (moved from its old place first); nothing on a build. Throws
227
+ * SonarNotBuiltError when a load that is not a build finds no index.
228
+ */
229
+ function previousOf(hit, cachePath, root, opts, problems) {
230
+ if (opts.build)
231
+ return { cached: null, source: 'cold' };
232
+ if (hit)
233
+ return { cached: { files: hit.index.files, workspaces: hit.index.workspaces, builtAt: hit.index.builtAt }, source: 'memory' };
234
+ if (!opts.cacheDir) {
235
+ try {
236
+ migrateLegacySonarCache(root, cachePath);
237
+ }
238
+ catch (err) {
239
+ problems.push(`cache not moved: ${reasonOf(err)}`);
240
+ }
241
+ }
242
+ const read = readCache(cachePath);
243
+ if (read.problem)
244
+ problems.push(read.problem);
245
+ if (!read.cached) {
246
+ for (const p of problems)
247
+ log('✗', 'sonar', `${root}: ${p}`);
248
+ throw new SonarNotBuiltError(read.outdated ? 'outdated' : read.problem ? 'unreadable' : 'missing');
249
+ }
250
+ return { cached: read.cached, source: 'disk' };
251
+ }
252
+ /** A `cache not saved` problem of an earlier load: the `.sonar` on disk is behind until a write succeeds. */
253
+ const unsavedOf = (index) => (problemsOf.get(index) ?? []).filter(p => p.startsWith('cache not saved'));
254
+ /** A memo hit as the caller sees it: nothing was read again, an unsaved cache still says so. */
255
+ function fromMemory(index) {
256
+ const hit = { ...index, stats: { ms: 0, parsed: 0, reused: index.files.size, removed: 0, cold: false, source: 'memory' } };
257
+ const unsaved = unsavedOf(index);
258
+ if (unsaved.length > 0)
259
+ problemsOf.set(hit, unsaved);
260
+ return hit;
261
+ }
262
+ /** Keep the index in the memo, with what went wrong (logged). */
263
+ function settle(state, index) {
264
+ if (state.problems.length > 0) {
265
+ problemsOf.set(index, state.problems);
266
+ for (const p of state.problems)
267
+ log('✗', 'sonar', `${state.realRoot}: ${p}`);
268
+ }
269
+ memo.set(state.memoKey, { at: (state.opts.now ?? Date.now)(), index });
270
+ peeked.delete(state.memoKey);
271
+ return index;
272
+ }
273
+ /** More changed than a load reads again: the index as built, saying how many files it is behind. */
274
+ function behindIndex(state, prev, listing, behind) {
275
+ return settle(state, {
276
+ root: state.realRoot,
277
+ ...relinkedOf(prev.cached, state.hit),
278
+ capped: listing.capped,
279
+ listed: listing.listed,
280
+ builtAt: prev.cached.builtAt,
281
+ behind,
282
+ stats: { ms: Math.round(performance.now() - state.started), parsed: 0, reused: prev.cached.files.size, removed: 0, cold: false, source: prev.source },
283
+ });
284
+ }
285
+ /** The `.sonar` written when the index changed (or an earlier write failed); a load beside a build leaves it to the build. */
286
+ function saveIfChanged(state, cachePath, index, changed) {
287
+ const { opts, hit } = state;
288
+ const mayWrite = opts.build || !building.has(state.memoKey);
289
+ const retry = !!hit && unsavedOf(hit.index).length > 0;
290
+ if (!mayWrite || !(changed || retry))
291
+ return;
292
+ opts.onProgress?.({ phase: 'saving', done: 0, total: 0 });
293
+ const problem = writeCache(cachePath, state.realRoot, index, !opts.cacheDir);
294
+ if (problem)
295
+ state.problems.push(problem);
296
+ }
297
+ /** A build's time is now; any other load keeps the one of the index it starts from. */
298
+ const builtAtOf = (opts, cached) => opts.build ? new Date((opts.now ?? Date.now)()).toISOString() : cached?.builtAt ?? null;
299
+ async function loadIndex(state) {
300
+ const { realRoot, hit, opts } = state;
301
+ const cachePath = sonarCachePath(realRoot, opts.cacheDir);
302
+ const { cached, source } = previousOf(hit, cachePath, realRoot, opts, state.problems);
303
+ opts.onProgress?.({ phase: 'listing', done: 0, total: 0 });
304
+ const listing = await listSonarFiles(realRoot);
305
+ const slots = await planRefresh(realRoot, listing.files.filter(p => !isSonarFilePath(p)), cached?.files);
306
+ const todo = slots.filter(isToParse).length;
307
+ if (cached && todo > SONAR_REFRESH_MAX)
308
+ return behindIndex(state, { cached, source }, listing, todo);
309
+ const fresh = await parsePlanned(realRoot, slots, todo, opts.onProgress);
310
+ const removed = cached ? goneOf(cached.files, fresh.files.map(f => f.path)) : 0;
311
+ // Nothing changed: the cached links still hold, no resolution needed.
312
+ const linked = cached && fresh.parsed === 0 && removed === 0 ? relinkedOf(cached, hit) : null;
313
+ if (!linked)
314
+ opts.onProgress?.({ phase: 'linking', done: 0, total: fresh.files.length });
315
+ const index = {
316
+ root: realRoot,
317
+ ...(linked ?? linkSonarFiles(realRoot, fresh.files.map(toParsed))),
318
+ capped: listing.capped,
319
+ listed: listing.listed,
320
+ builtAt: builtAtOf(opts, cached),
321
+ behind: 0,
322
+ stats: { ms: Math.round(performance.now() - state.started), parsed: fresh.parsed, reused: fresh.reused, removed, cold: !cached, source },
323
+ };
324
+ saveIfChanged(state, cachePath, index, !linked);
325
+ return settle(state, index);
326
+ }
327
+ /**
328
+ * The index of a checkout, brought up to date: unchanged files come from the
329
+ * memo or the `.sonar`, changed and new ones are parsed (at most
330
+ * SONAR_REFRESH_MAX, else `behind` says how many), removed ones are gone.
331
+ * Throws SonarNotBuiltError when there is no index and this is no build.
332
+ * `stats.source` says where the previous state came from. A build
333
+ * (`build: true`) reads every file; build.ts runs one per root at a time.
334
+ */
335
+ export async function loadSonarIndex(root, opts = {}) {
336
+ const realRoot = realpathSync(root);
337
+ const now = opts.now ?? Date.now;
338
+ const memoKey = memoKeyOf(realRoot, opts.cacheDir);
339
+ const hit = memo.get(memoKey);
340
+ const state = { realRoot, memoKey, hit, opts, started: performance.now(), problems: [] };
341
+ if (opts.build) {
342
+ building.add(memoKey);
343
+ try {
344
+ return await loadIndex(state);
345
+ }
346
+ finally {
347
+ building.delete(memoKey);
348
+ }
349
+ }
350
+ if (hit && now() - hit.at < MEMO_MS)
351
+ return fromMemory(hit.index);
352
+ const running = inflight.get(memoKey);
353
+ if (running)
354
+ return running;
355
+ const job = loadIndex(state).finally(() => {
356
+ if (inflight.get(memoKey) === job)
357
+ inflight.delete(memoKey);
358
+ });
359
+ inflight.set(memoKey, job);
360
+ return job;
361
+ }
362
+ /** What went wrong with the `.sonar` while this index was loaded: one line each (`cache not saved: ...`). */
363
+ export function sonarCacheProblems(index) {
364
+ return problemsOf.get(index) ?? [];
365
+ }
366
+ /**
367
+ * The index of a checkout as it is, for a hint in another tool: the one this
368
+ * process holds (of any age), else the checkout's `.sonar` read once (kept
369
+ * while the file does not change). Never lists, parses or builds anything,
370
+ * so it may be stale or null (no index yet). Never throws. `cacheDir` as in
371
+ * `loadSonarIndex` (tests).
372
+ */
373
+ export function peekSonarIndex(root, opts = {}) {
374
+ try {
375
+ const realRoot = realpathSync(root);
376
+ const key = memoKeyOf(realRoot, opts.cacheDir);
377
+ const hit = memo.get(key);
378
+ if (hit)
379
+ return hit.index;
380
+ const path = sonarCachePath(realRoot, opts.cacheDir);
381
+ const st = statSync(path);
382
+ const prev = peeked.get(key);
383
+ if (prev && prev.mtimeMs === st.mtimeMs && prev.size === st.size)
384
+ return prev.index;
385
+ const started = performance.now();
386
+ const { cached } = readCache(path);
387
+ if (!cached)
388
+ return null;
389
+ const index = {
390
+ root: realRoot,
391
+ files: cached.files,
392
+ importers: importersOf(cached.files),
393
+ workspaces: cached.workspaces,
394
+ capped: false,
395
+ listed: cached.files.size,
396
+ builtAt: cached.builtAt,
397
+ behind: 0,
398
+ stats: { ms: Math.round(performance.now() - started), parsed: 0, reused: cached.files.size, removed: 0, cold: false, source: 'disk' },
399
+ };
400
+ peeked.set(key, { mtimeMs: st.mtimeMs, size: st.size, index });
401
+ return index;
402
+ }
403
+ catch {
404
+ return null;
405
+ }
406
+ }
407
+ /**
408
+ * Whether the `.sonar` of `root` (a real path) gives an index, and why not:
409
+ * reads the file (no listing, no parse). For the status of a checkout the
410
+ * process holds no index of. Never throws.
411
+ */
412
+ export function sonarCacheState(root, opts = {}) {
413
+ const read = readCache(sonarCachePath(root, opts.cacheDir));
414
+ if (read.cached)
415
+ return 'ready';
416
+ return read.outdated ? 'outdated' : read.problem ? 'unreadable' : 'missing';
417
+ }
418
+ /**
419
+ * How far the checkout's files moved from the index this process holds or the
420
+ * `.sonar` (peekSonarIndex): lists and stats them, never parses, links or
421
+ * writes. Null without an index. For the Sonar view's status, so a person
422
+ * sees an index that lags before an agent trusts it.
423
+ */
424
+ export async function sonarDrift(root, opts = {}) {
425
+ const index = peekSonarIndex(root, opts);
426
+ if (!index)
427
+ return null;
428
+ const listing = await listSonarFiles(index.root);
429
+ const slots = await planRefresh(index.root, listing.files.filter(p => !isSonarFilePath(p)), index.files);
430
+ const changed = slots.filter(isToParse).length;
431
+ return { changed, removed: goneOf(index.files, slots.map(slot => isToParse(slot) ? slot.rel : slot.path)) };
432
+ }
433
+ /**
434
+ * The checkout root whose index covers `path` (a file or folder, absolute or
435
+ * relative to the process): the deepest root this process holds an index of
436
+ * that contains it, else the first folder up from it with a `.sonar`, never
437
+ * past the top of the git work tree. Null when there is none. Never throws.
438
+ */
439
+ export function findSonarRoot(path) {
440
+ try {
441
+ let abs = resolve(path);
442
+ try {
443
+ abs = realpathSync(abs);
444
+ }
445
+ catch { /* a file about to be made */ }
446
+ let best = null;
447
+ for (const { index } of memo.values()) {
448
+ const r = index.root;
449
+ if ((abs === r || abs.startsWith(r.endsWith(sep) ? r : `${r}${sep}`)) && (!best || r.length > best.length))
450
+ best = r;
451
+ }
452
+ return best ?? findSonarRootOnDisk(abs);
453
+ }
454
+ catch {
455
+ return null;
456
+ }
457
+ }
458
+ /** Forget the in-process memo (tests, or after a known bulk change). */
459
+ export function clearSonarMemo() {
460
+ memo.clear();
461
+ peeked.clear();
462
+ }
@@ -0,0 +1,5 @@
1
+ import type { SonarIndex } from './types.js';
2
+ /** `NUXT_PUBLIC_API_BASE` -> `public.apiBase`; null for a key Nuxt does not map. */
3
+ export declare function nuxtKeyOf(env: string): string | null;
4
+ /** `refs` of `env:NAME` or `config:a.b`. */
5
+ export declare function renderKeyRefs(index: SonarIndex, query: string, within: string): Promise<string>;