@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,98 @@
1
+ import { existsSync, readFileSync, statSync } from 'node:fs';
2
+ import { resolveForRead } from './_jail.js';
3
+ import { READ_OUTPUT_MAX_CHARS } from './_output.js';
4
+ import { findSymbols, qualifiedName, scanSymbols, symbolDocStart } from './_symbols.js';
5
+ // ─── Outline and symbol reads ───────────────
6
+ //
7
+ // An agent that needs one function of a 900-line file used to read the file
8
+ // whole (20k chars, carried on every later round) or grep for the name and
9
+ // read a guessed range. runner_outline names the symbols with their lines;
10
+ // runner_read_file's `symbol` reads exactly one of them.
11
+ /** Most symbols an outline lists before it says how many more there are. */
12
+ const OUTLINE_MAX_SYMBOLS = 400;
13
+ /** One outline row: the line range, then the kind and the name, indented by nesting. */
14
+ function outlineRow(s, width) {
15
+ const range = `${s.start}-${s.end}`.padEnd(width * 2 + 1);
16
+ return `${' '.repeat(s.level)}${range} ${s.kind} ${s.name}`;
17
+ }
18
+ /**
19
+ * The model-facing outline of a file: a header, then one line per symbol.
20
+ * Exported for tests.
21
+ */
22
+ export function renderOutline(path, content) {
23
+ const symbols = scanSymbols(path, content);
24
+ // Counted like a file read: a final newline does not start another line.
25
+ const totalLines = content.split('\n').length - (content.endsWith('\n') ? 1 : 0);
26
+ if (symbols === null) {
27
+ return `${path} (${totalLines} lines): no outline for this file type. Read it by offset/limit, or find the lines with runner_grep.`;
28
+ }
29
+ if (symbols.length === 0)
30
+ return `${path} (${totalLines} lines): no symbols found.`;
31
+ const width = String(totalLines).length;
32
+ const rows = [];
33
+ let used = 0;
34
+ for (const s of symbols.slice(0, OUTLINE_MAX_SYMBOLS)) {
35
+ const row = outlineRow(s, width);
36
+ if (used + row.length + 1 > READ_OUTPUT_MAX_CHARS - 300)
37
+ break;
38
+ rows.push(row);
39
+ used += row.length + 1;
40
+ }
41
+ const left = symbols.length - rows.length;
42
+ const more = left > 0 ? `\n[... ${left} more symbol(s) not shown]` : '';
43
+ return `${path} (${totalLines} lines, ${symbols.length} symbols). Read one with runner_read_file { path, symbol }:\n${rows.join('\n')}${more}`;
44
+ }
45
+ /**
46
+ * The lines of one symbol, with its doc comment, rendered like any file read
47
+ * (so the line numbers and the paging are the same). Returns an error string
48
+ * the model can act on when the symbol is not there. Exported for the read
49
+ * tool and for tests.
50
+ */
51
+ export function readSymbol(path, content, query, render) {
52
+ const symbols = scanSymbols(path, content);
53
+ if (symbols === null) {
54
+ return `Error: no symbol scanner for "${path}". Read it by offset/limit, or find the lines with runner_grep.`;
55
+ }
56
+ const hits = findSymbols(symbols, query);
57
+ if (hits.length === 0) {
58
+ const names = symbols.slice(0, 60).map(qualifiedName).join(', ');
59
+ return `Error: no symbol "${query}" in ${path}.${names ? ` Symbols here: ${names}${symbols.length > 60 ? ', ...' : ''}.` : ' No symbols found.'}`;
60
+ }
61
+ const s = hits[0];
62
+ const from = symbolDocStart(content, s);
63
+ const body = render(from - 1, s.end - from + 1);
64
+ const others = hits.slice(1, 6).map(h => `${qualifiedName(h)} at line ${h.start}`);
65
+ const note = others.length > 0 ? `\n[also named "${query}": ${others.join(', ')}. Name the one you want as Parent.name.]` : '';
66
+ return `${s.kind} ${qualifiedName(s)}\n${body}${note}`;
67
+ }
68
+ // ─── runner_outline ─────────────────────────
69
+ const outlineDefinition = {
70
+ name: 'runner_outline',
71
+ description: 'List the symbols of a file (classes, functions, methods, types; headings in Markdown) with their line ranges, in one short answer. Use it before reading a big file, then read just the symbol you need with runner_read_file { path, symbol }.',
72
+ parameters: {
73
+ type: 'object',
74
+ properties: {
75
+ path: { type: 'string', description: 'File path. Relative paths resolve against the project root.' },
76
+ },
77
+ required: ['path'],
78
+ },
79
+ };
80
+ async function executeOutline(params, context) {
81
+ const path = params.path;
82
+ if (typeof path !== 'string' || !path)
83
+ return 'Error: path is required.';
84
+ try {
85
+ const resolved = resolveForRead(path, context);
86
+ if (!existsSync(resolved))
87
+ return `Error: File not found: ${path}`;
88
+ if (statSync(resolved).isDirectory())
89
+ return `Error: "${path}" is a directory. Outline one file; list a folder with runner_glob.`;
90
+ return renderOutline(path, readFileSync(resolved, 'utf-8'));
91
+ }
92
+ catch (err) {
93
+ return `Error: ${err.message}`;
94
+ }
95
+ }
96
+ export const outlineTools = [
97
+ { definition: outlineDefinition, execute: executeOutline },
98
+ ];
@@ -0,0 +1,17 @@
1
+ import type { ToolDefinition } from '@nordhavnhq/runner-runtime';
2
+ import type { ToolContext } from './index.js';
3
+ /** Small on purpose: a search is to find WHERE, and every result line stays in
4
+ * the conversation. Narrow the pattern rather than raising the limit. */
5
+ export declare const DEFAULT_RESULT_LIMIT = 50;
6
+ /**
7
+ * A glob as a RegExp over a relative path with `/` separators. Supports `**`,
8
+ * `*`, `?`, `{a,b}` and `[...]`. A pattern without a slash matches the file
9
+ * name anywhere (`*.ts`), like .gitignore and ripgrep's `-g`. Exported for tests.
10
+ */
11
+ export declare function globToRegExp(pattern: string): RegExp;
12
+ declare function executeGrep(params: Record<string, unknown>, context?: ToolContext): Promise<string>;
13
+ export declare const searchTools: {
14
+ definition: ToolDefinition;
15
+ execute: typeof executeGrep;
16
+ }[];
17
+ export {};
@@ -0,0 +1,391 @@
1
+ import { execFileSync } from 'node:child_process';
2
+ import { readdirSync, readFileSync, statSync } from 'node:fs';
3
+ import { basename, dirname, join, relative, sep } from 'node:path';
4
+ import { resolveForRead, writeScopeRel } from './_jail.js';
5
+ import { clipLine, READ_OUTPUT_MAX_CHARS } from './_output.js';
6
+ import { runRipgrep, SKIPPED_DIRS as SKIPPED_DIR_LIST } from './_ripgrep.js';
7
+ import { sonarGlobHint, sonarGrepAnswer, withHint } from './_sonar/hints.js';
8
+ // ─── Search tools ───────────────────────────
9
+ //
10
+ // Finding something in a project used to mean `grep -rn` or `cat` through the
11
+ // shell, with the shell's large output budget and no structure, so an agent
12
+ // looking for one function paid for a page of matches in node_modules. These
13
+ // two answer the question directly and small: which files, which lines.
14
+ // runner_grep runs the bundled ripgrep when this install has it (see
15
+ // _ripgrep.ts) and searches in Node otherwise; both give the same answer.
16
+ /** Directories never worth searching when there is no .gitignore to say so. */
17
+ const SKIPPED_DIRS = new Set(SKIPPED_DIR_LIST);
18
+ /** Files above this size are skipped by grep (bundles, dumps, lockfiles). */
19
+ const GREP_MAX_FILE_BYTES = 2 * 1024 * 1024;
20
+ /** Upper bound on files listed for one search, so a huge tree stays bounded. */
21
+ const MAX_FILES_SCANNED = 50_000;
22
+ /** Small on purpose: a search is to find WHERE, and every result line stays in
23
+ * the conversation. Narrow the pattern rather than raising the limit. */
24
+ export const DEFAULT_RESULT_LIMIT = 50;
25
+ /** Most ripgrep records read for one search: past it the "more" count is a
26
+ * lower bound. */
27
+ const RG_MAX_RECORDS = 20_000;
28
+ /**
29
+ * The files below `dir`, relative to it. In a git checkout that is what git
30
+ * tracks plus untracked files it does not ignore (one fast call that honours
31
+ * .gitignore); anywhere else a walk that skips {@link SKIPPED_DIRS}.
32
+ */
33
+ function listFiles(dir) {
34
+ try {
35
+ const out = execFileSync('git', ['ls-files', '--cached', '--others', '--exclude-standard', '-z'], {
36
+ cwd: dir,
37
+ maxBuffer: 64 * 1024 * 1024,
38
+ stdio: ['ignore', 'pipe', 'ignore'],
39
+ }).toString();
40
+ // A deleted-but-tracked file is still listed by --cached; the callers stat
41
+ // every path and skip what is gone. Nothing listed means the folder itself
42
+ // is ignored (somebody searching node_modules on purpose): walk it instead.
43
+ const files = out.split('\0').filter(Boolean);
44
+ if (files.length > 0)
45
+ return files.slice(0, MAX_FILES_SCANNED);
46
+ }
47
+ catch {
48
+ // Not a git checkout, or no git: walk the tree.
49
+ }
50
+ const files = [];
51
+ const walk = (abs) => {
52
+ if (files.length >= MAX_FILES_SCANNED)
53
+ return;
54
+ let entries;
55
+ try {
56
+ entries = readdirSync(abs, { withFileTypes: true });
57
+ }
58
+ catch {
59
+ return;
60
+ }
61
+ for (const e of entries) {
62
+ if (e.isDirectory()) {
63
+ if (!SKIPPED_DIRS.has(e.name))
64
+ walk(join(abs, e.name));
65
+ }
66
+ else if (e.isFile()) {
67
+ files.push(relative(dir, join(abs, e.name)));
68
+ }
69
+ }
70
+ };
71
+ walk(dir);
72
+ return files;
73
+ }
74
+ /**
75
+ * A glob as a RegExp over a relative path with `/` separators. Supports `**`,
76
+ * `*`, `?`, `{a,b}` and `[...]`. A pattern without a slash matches the file
77
+ * name anywhere (`*.ts`), like .gitignore and ripgrep's `-g`. Exported for tests.
78
+ */
79
+ export function globToRegExp(pattern) {
80
+ const glob = pattern.replace(/^\.\//, '');
81
+ const anywhere = !glob.includes('/');
82
+ let re = '';
83
+ let inGroup = 0;
84
+ for (let i = 0; i < glob.length; i++) {
85
+ const c = glob[i];
86
+ if (c === '*') {
87
+ if (glob[i + 1] === '*') {
88
+ const slashAfter = glob[i + 2] === '/';
89
+ re += slashAfter ? '(?:.*/)?' : '.*';
90
+ i += slashAfter ? 2 : 1;
91
+ }
92
+ else {
93
+ re += '[^/]*';
94
+ }
95
+ }
96
+ else if (c === '?') {
97
+ re += '[^/]';
98
+ }
99
+ else if (c === '{') {
100
+ inGroup++;
101
+ re += '(?:';
102
+ }
103
+ else if (c === '}' && inGroup > 0) {
104
+ inGroup--;
105
+ re += ')';
106
+ }
107
+ else if (c === ',' && inGroup > 0) {
108
+ re += '|';
109
+ }
110
+ else if (c === '[') {
111
+ const close = glob.indexOf(']', i + 1);
112
+ if (close === -1) {
113
+ re += '\\[';
114
+ }
115
+ else {
116
+ re += `[${glob.slice(i + 1, close).replace(/^!/, '^').replace(/\\/g, '\\\\')}]`;
117
+ i = close;
118
+ }
119
+ }
120
+ else {
121
+ re += c.replace(/[.+^$()|\\]/g, '\\$&');
122
+ }
123
+ }
124
+ return new RegExp(anywhere ? `(?:^|/)${re}$` : `^${re}$`);
125
+ }
126
+ function toPosix(p) {
127
+ return sep === '/' ? p : p.split(sep).join('/');
128
+ }
129
+ /** Where a search looks: its `path`, else the session's scope (else the
130
+ * checkout root). `prefix` is put before every result path found under a
131
+ * defaulted scope, so results stay relative to the checkout root. */
132
+ function resolveSearchRoot(params, context) {
133
+ const scope = typeof params.path === 'string' && params.path ? null : writeScopeRel(context);
134
+ const path = typeof params.path === 'string' && params.path ? params.path : scope ?? '.';
135
+ try {
136
+ const root = resolveForRead(path, context);
137
+ const stat = statSync(root);
138
+ return { root, single: stat.isFile(), prefix: scope ? `${scope}/` : '', scope };
139
+ }
140
+ catch (err) {
141
+ return `Error: ${err.message}`;
142
+ }
143
+ }
144
+ function limitOf(params) {
145
+ return typeof params.limit === 'number' && params.limit > 0 ? Math.min(Math.floor(params.limit), 1_000) : DEFAULT_RESULT_LIMIT;
146
+ }
147
+ /** Join result lines under the read budget, saying how much was left out. */
148
+ function capLines(lines, more, what, max = READ_OUTPUT_MAX_CHARS) {
149
+ const out = [];
150
+ let used = 0;
151
+ for (const l of lines) {
152
+ if (used + l.length + 1 > max)
153
+ break;
154
+ out.push(l);
155
+ used += l.length + 1;
156
+ }
157
+ const left = lines.length - out.length + more;
158
+ return left > 0 ? `${out.join('\n')}\n[... ${left} more ${what} not shown: narrow the pattern, the path or the glob]` : out.join('\n');
159
+ }
160
+ // ─── runner_grep ───────────────────────────
161
+ const grepDefinition = {
162
+ name: 'runner_grep',
163
+ description: 'Search file contents with a regular expression (JavaScript syntax). Honours .gitignore. Default output: the matching files; output="content" gives path:line: text, output="count" counts per file. Use this instead of grep/cat in the shell. For where a symbol is defined or used, runner_sonar find/refs is one call and exact.',
164
+ parameters: {
165
+ type: 'object',
166
+ properties: {
167
+ pattern: { type: 'string', description: 'Regular expression, JavaScript syntax (escape literal braces: `interface\\{`).' },
168
+ path: { type: 'string', description: 'File or directory to search. Default: the session\'s scope folder, else the project root ("." searches the whole checkout).' },
169
+ glob: { type: 'string', description: 'Only files matching this glob, e.g. "*.ts", "server/**/*.vue", "*.{ts,vue}".' },
170
+ output: { type: 'string', enum: ['files', 'content', 'count'], description: 'files (default): matching paths. content: matching lines with line numbers. count: matches per file.' },
171
+ context: { type: 'number', description: 'With output="content": lines of context before and after each match (max 10). Default: 0.' },
172
+ ignore_case: { type: 'boolean', description: 'Case-insensitive. Default: false.' },
173
+ limit: { type: 'number', description: `Max results (files, lines or counts). Default: ${DEFAULT_RESULT_LIMIT}.` },
174
+ },
175
+ required: ['pattern'],
176
+ },
177
+ };
178
+ /** The Node search: every listed file read and matched here. */
179
+ function grepInNode(re, base, files, mode, ctxLines, globRe) {
180
+ const found = [];
181
+ const counts = [];
182
+ const lines = [];
183
+ for (const rel of files) {
184
+ const posix = toPosix(rel);
185
+ if (globRe && !globRe.test(posix))
186
+ continue;
187
+ let text;
188
+ try {
189
+ const abs = join(base, rel);
190
+ if (statSync(abs).size > GREP_MAX_FILE_BYTES)
191
+ continue;
192
+ text = readFileSync(abs, 'utf-8');
193
+ }
194
+ catch {
195
+ continue;
196
+ }
197
+ if (text.includes('\0'))
198
+ continue; // binary
199
+ if (!re.test(text))
200
+ continue;
201
+ if (mode === 'files') {
202
+ found.push(posix);
203
+ continue;
204
+ }
205
+ const split = text.split('\n');
206
+ if (split.length > 1 && split[split.length - 1] === '')
207
+ split.pop(); // a final newline starts no line
208
+ if (mode === 'count') {
209
+ counts.push({ path: posix, count: split.filter(l => re.test(l)).length });
210
+ continue;
211
+ }
212
+ let lastPrinted = -1;
213
+ for (let i = 0; i < split.length; i++) {
214
+ if (!re.test(split[i]))
215
+ continue;
216
+ const from = Math.max(0, i - ctxLines, lastPrinted + 1);
217
+ const to = Math.min(split.length - 1, i + ctxLines);
218
+ for (let j = from; j <= to; j++)
219
+ lines.push({ path: posix, line: j + 1, text: split[j], match: j === i || re.test(split[j]) });
220
+ lastPrinted = to;
221
+ }
222
+ }
223
+ if (mode === 'files')
224
+ return { kind: 'files', files: found };
225
+ if (mode === 'count')
226
+ return { kind: 'count', counts };
227
+ return { kind: 'content', lines, truncated: false };
228
+ }
229
+ /**
230
+ * The model-facing answer: at most `limit` results (files, counts or matching
231
+ * lines with their context), a `--` between separate hunks of one file, and
232
+ * how many were left out. Exported for tests.
233
+ */
234
+ function renderGrep(found, limit, globRe, label, ctxLines, max, prefix = '') {
235
+ const keep = (p) => !globRe || globRe.test(p);
236
+ const show = (p) => prefix + p;
237
+ const results = [];
238
+ let more = 0;
239
+ let matchedFiles;
240
+ if (found.kind === 'files' || found.kind === 'count') {
241
+ const rows = found.kind === 'files'
242
+ ? found.files.filter(keep).map(show)
243
+ : found.counts.filter(c => keep(c.path)).map(c => `${show(c.path)}: ${c.count}`);
244
+ matchedFiles = rows.length;
245
+ results.push(...rows.slice(0, limit));
246
+ more = rows.length - results.length;
247
+ }
248
+ else {
249
+ let shown = 0;
250
+ let lastPath = '';
251
+ let lastLine = -1;
252
+ let lastMatchLine = -1;
253
+ const files = new Set();
254
+ for (const l of found.lines) {
255
+ if (!keep(l.path))
256
+ continue;
257
+ if (l.match)
258
+ files.add(l.path);
259
+ if (shown >= limit) {
260
+ if (l.match)
261
+ more++;
262
+ // The context after the last match shown still belongs with it.
263
+ const trailing = !l.match && l.path === lastPath && l.line === lastLine + 1 && l.line - lastMatchLine <= ctxLines;
264
+ if (!trailing || more > 0)
265
+ continue;
266
+ }
267
+ if (l.path === lastPath && lastLine >= 0 && l.line > lastLine + 1)
268
+ results.push('--');
269
+ results.push(`${show(l.path)}:${l.line}${l.match ? ':' : '-'} ${clipLine(l.text, 300)}`);
270
+ if (l.match) {
271
+ shown++;
272
+ lastMatchLine = l.line;
273
+ }
274
+ lastPath = l.path;
275
+ lastLine = l.line;
276
+ }
277
+ matchedFiles = files.size;
278
+ }
279
+ if (results.length === 0)
280
+ return `No matches for ${label}.`;
281
+ const header = found.kind === 'content' ? `matches in ${matchedFiles} file(s)` : `${matchedFiles} file(s) match`;
282
+ const what = found.kind === 'content' ? 'matching lines' : 'files';
283
+ const lowerBound = found.kind === 'content' && found.truncated ? '+' : '';
284
+ return `${header}:\n${capLines(results, more, `${what}${lowerBound}`, max)}`;
285
+ }
286
+ /** The output options of a runner_grep call. */
287
+ function grepOptionsOf(params, pattern) {
288
+ const mode = params.output === 'content' || params.output === 'count' ? params.output : 'files';
289
+ const glob = typeof params.glob === 'string' && params.glob ? params.glob : undefined;
290
+ return {
291
+ mode,
292
+ ctxLines: mode === 'content' && typeof params.context === 'number' ? Math.min(Math.max(0, Math.floor(params.context)), 10) : 0,
293
+ limit: limitOf(params),
294
+ glob,
295
+ globRe: glob ? globToRegExp(glob) : null,
296
+ label: `/${pattern}/${glob ? ` in ${glob}` : ''}`,
297
+ };
298
+ }
299
+ /** Said under a search that defaulted to the session's scope. */
300
+ function scopeNote(scope) {
301
+ return scope ? `\n(searched the session's scope ${scope}; pass path "." for the whole checkout)` : '';
302
+ }
303
+ /** The grep result under what sonar puts on top (a definition's code, or a hint): both within the read budget. */
304
+ function withSonarAnswer(pattern, context, root, render) {
305
+ const sonar = sonarGrepAnswer(pattern, context, { path: root });
306
+ return withHint(sonar, render(READ_OUTPUT_MAX_CHARS - (sonar ? sonar.length + 1 : 0)));
307
+ }
308
+ async function executeGrep(params, context) {
309
+ const pattern = params.pattern;
310
+ if (typeof pattern !== 'string' || !pattern)
311
+ return 'Error: pattern is required.';
312
+ const ignoreCase = params.ignore_case === true;
313
+ let re;
314
+ try {
315
+ re = new RegExp(pattern, ignoreCase ? 'i' : '');
316
+ }
317
+ catch (err) {
318
+ return `Error: invalid regular expression: ${err.message}`;
319
+ }
320
+ const target = resolveSearchRoot(params, context);
321
+ if (typeof target === 'string')
322
+ return target;
323
+ const { mode, ctxLines, limit, glob, globRe, label } = grepOptionsOf(params, pattern);
324
+ const base = target.single ? dirname(target.root) : target.root;
325
+ const viaRg = await runRipgrep({
326
+ pattern,
327
+ cwd: base,
328
+ file: target.single ? basename(target.root) : undefined,
329
+ ignoreCase,
330
+ glob,
331
+ mode,
332
+ context: ctxLines,
333
+ maxFileBytes: GREP_MAX_FILE_BYTES,
334
+ maxRecords: RG_MAX_RECORDS,
335
+ });
336
+ const found = viaRg ?? grepInNode(re, base, target.single ? [relative(base, target.root)] : listFiles(target.root), mode, ctxLines, globRe);
337
+ return withSonarAnswer(pattern, context, target.root, max => renderGrep(found, limit, globRe, label, ctxLines, max, target.prefix)) + scopeNote(target.scope);
338
+ }
339
+ // ─── runner_glob ───────────────────────────
340
+ const globDefinition = {
341
+ name: 'runner_glob',
342
+ description: 'Find files by name pattern, newest first. Honours .gitignore. Use this instead of find/ls -R in the shell.',
343
+ parameters: {
344
+ type: 'object',
345
+ properties: {
346
+ pattern: { type: 'string', description: 'Glob, e.g. "**/*.vue", "server/api/**/index.get.ts", "*.{md,txt}". A pattern without "/" matches the file name in any folder.' },
347
+ path: { type: 'string', description: 'Directory to search in. Default: the session\'s scope folder, else the project root ("." searches the whole checkout).' },
348
+ limit: { type: 'number', description: `Max files. Default: ${DEFAULT_RESULT_LIMIT}.` },
349
+ },
350
+ required: ['pattern'],
351
+ },
352
+ };
353
+ async function executeGlob(params, context) {
354
+ const pattern = params.pattern;
355
+ if (typeof pattern !== 'string' || !pattern)
356
+ return 'Error: pattern is required.';
357
+ const target = resolveSearchRoot(params, context);
358
+ if (typeof target === 'string')
359
+ return target;
360
+ if (target.single)
361
+ return `Error: "${String(params.path)}" is a file, not a directory.`;
362
+ const re = globToRegExp(pattern);
363
+ const limit = limitOf(params);
364
+ const hits = [];
365
+ for (const rel of listFiles(target.root)) {
366
+ const posix = toPosix(rel);
367
+ // Under a defaulted scope a pattern may name the path from the scope or
368
+ // from the checkout root; the answer always gives the latter.
369
+ if (!re.test(posix) && !(target.prefix && re.test(target.prefix + posix)))
370
+ continue;
371
+ let mtime;
372
+ try {
373
+ mtime = statSync(join(target.root, rel)).mtimeMs;
374
+ }
375
+ catch {
376
+ continue;
377
+ }
378
+ hits.push({ path: target.prefix + posix, mtime });
379
+ }
380
+ const hint = sonarGlobHint(pattern, context);
381
+ const note = scopeNote(target.scope);
382
+ if (hits.length === 0)
383
+ return withHint(hint, `No files match ${pattern}.${note}`);
384
+ hits.sort((a, b) => b.mtime - a.mtime);
385
+ const shown = hits.slice(0, limit).map(h => h.path);
386
+ return withHint(hint, `${hits.length} file(s) match ${pattern}:\n${capLines(shown, hits.length - shown.length, 'files')}${note}`);
387
+ }
388
+ export const searchTools = [
389
+ { definition: grepDefinition, execute: executeGrep },
390
+ { definition: globDefinition, execute: executeGlob },
391
+ ];
@@ -0,0 +1,17 @@
1
+ import type { ToolDefinition } from '@nordhavnhq/runner-runtime';
2
+ import type { ToolContext } from './index.js';
3
+ import { type LoadSonarOptions } from './_sonar/index.js';
4
+ /** What the tool says while the index of the checkout is still being built: the agent goes on without it for now. */
5
+ export declare const SONAR_BUILDING_ANSWER = "Error: sonar has no usable index for this checkout yet; a build runs in the background, ask again in a minute. Meanwhile go on with runner_grep and runner_outline.";
6
+ /** What the tool says when the index could not be built (the Sonar view shows why). */
7
+ export declare const SONAR_BUILD_FAILED_ANSWER = "Error: sonar could not build an index for this checkout (the Sonar view in the code app shows why). Go on with runner_grep and runner_outline.";
8
+ /** The tool with a configurable index load (tests pass a temp cacheDir, and how long to wait for a build). */
9
+ export declare function runSonar(params: Record<string, unknown>, context: ToolContext | undefined, load?: LoadSonarOptions & {
10
+ rebuildWaitMs?: number;
11
+ }): Promise<string>;
12
+ declare function executeSonar(params: Record<string, unknown>, context?: ToolContext): Promise<string>;
13
+ export declare const sonarTools: {
14
+ definition: ToolDefinition;
15
+ execute: typeof executeSonar;
16
+ }[];
17
+ export {};