@nordhavnhq/runner 0.0.0-stage → 0.96.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 +39 -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 +20 -0
  13. package/dist/cli/link.js +312 -0
  14. package/dist/cli/logs.d.ts +2 -0
  15. package/dist/cli/logs.js +144 -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 +80 -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 +135 -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 +1324 -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,551 @@
1
+ import { existsSync, readFileSync, writeFileSync, mkdirSync, statSync } from 'node:fs';
2
+ import { extname, basename, dirname } from 'node:path';
3
+ import sharp from 'sharp';
4
+ import { uploadImage } from './_upload.js';
5
+ import { resolveInJail } from './_jail.js';
6
+ // ─── Helpers ────────────────────────────────
7
+ function resolveImagePath(path, ctx) {
8
+ return resolveInJail(path, ctx);
9
+ }
10
+ function normalizeFormat(fmt, fallbackExt) {
11
+ const f = (fmt ?? fallbackExt).toLowerCase().replace('.', '');
12
+ if (f === 'jpg' || f === 'jpeg')
13
+ return 'jpg';
14
+ if (f === 'png' || f === 'webp' || f === 'gif')
15
+ return f;
16
+ return 'png';
17
+ }
18
+ function applyFormat(pipeline, fmt) {
19
+ if (fmt === 'jpg')
20
+ return pipeline.jpeg({ quality: 90 });
21
+ if (fmt === 'webp')
22
+ return pipeline.webp({ quality: 90 });
23
+ if (fmt === 'gif')
24
+ return pipeline.gif();
25
+ return pipeline.png();
26
+ }
27
+ function detectFormat(buf) {
28
+ if (buf.length < 12)
29
+ return undefined;
30
+ if (buf[0] === 0xff && buf[1] === 0xd8 && buf[2] === 0xff)
31
+ return 'jpg';
32
+ if (buf[0] === 0x89 && buf[1] === 0x50 && buf[2] === 0x4e && buf[3] === 0x47)
33
+ return 'png';
34
+ if (buf[0] === 0x47 && buf[1] === 0x49 && buf[2] === 0x46)
35
+ return 'gif';
36
+ if (buf[0] === 0x52 && buf[1] === 0x49 && buf[2] === 0x46 && buf[3] === 0x46
37
+ && buf[8] === 0x57 && buf[9] === 0x45 && buf[10] === 0x42 && buf[11] === 0x50)
38
+ return 'webp';
39
+ return undefined;
40
+ }
41
+ function isUrl(s) {
42
+ return s.startsWith('http://') || s.startsWith('https://');
43
+ }
44
+ async function fetchUrlBuffer(url) {
45
+ const controller = new AbortController();
46
+ const timeout = setTimeout(() => controller.abort(), 30000);
47
+ try {
48
+ const res = await fetch(url, { signal: controller.signal });
49
+ if (!res.ok)
50
+ throw new Error(`Failed to fetch ${url} (${res.status}): ${res.statusText}`);
51
+ const buf = Buffer.from(await res.arrayBuffer());
52
+ if (buf.length === 0)
53
+ throw new Error(`Fetched 0 bytes from ${url}`);
54
+ return buf;
55
+ }
56
+ finally {
57
+ clearTimeout(timeout);
58
+ }
59
+ }
60
+ /** Resolve an image input string to something sharp can read. Returns a path
61
+ * string for project files and a Buffer for http(s) URLs. */
62
+ async function loadImageInput(input, ctx) {
63
+ if (isUrl(input))
64
+ return fetchUrlBuffer(input);
65
+ const resolved = resolveImagePath(input, ctx);
66
+ if (!existsSync(resolved))
67
+ throw new Error(`Input file not found: ${input}`);
68
+ return resolved;
69
+ }
70
+ /** Best-effort filename derivation for outputs / uploads. Works for both
71
+ * project paths and URLs. */
72
+ function inputBasename(input) {
73
+ try {
74
+ if (isUrl(input)) {
75
+ const p = new URL(input).pathname;
76
+ const b = basename(p);
77
+ return b || 'image';
78
+ }
79
+ }
80
+ catch { }
81
+ const stem = basename(input, extname(input));
82
+ return stem || 'image';
83
+ }
84
+ function inputExt(input) {
85
+ try {
86
+ if (isUrl(input)) {
87
+ return extname(new URL(input).pathname).replace('.', '');
88
+ }
89
+ }
90
+ catch { }
91
+ return extname(input).replace('.', '');
92
+ }
93
+ // ─── Edit Image ─────────────────────────────
94
+ const editImageDefinition = {
95
+ name: 'runner_edit_image',
96
+ description: 'Edit an image (resize, crop, rotate, flip, blur, sharpen, recolor, change format). Result is uploaded and returned as a URL, or saved to output_path if provided.',
97
+ parameters: {
98
+ type: 'object',
99
+ properties: {
100
+ input: { type: 'string', description: 'Input image: a project-relative path OR an http(s) URL.' },
101
+ resize: {
102
+ type: 'object',
103
+ description: 'Resize. Provide width and/or height.',
104
+ properties: {
105
+ width: { type: 'number' },
106
+ height: { type: 'number' },
107
+ fit: {
108
+ type: 'string',
109
+ enum: ['cover', 'contain', 'fill', 'inside', 'outside'],
110
+ description: 'How to fit when both width and height given. Default: inside (preserve aspect).',
111
+ },
112
+ },
113
+ },
114
+ crop: {
115
+ type: 'object',
116
+ description: 'Extract a rectangle (top-left origin, pixels).',
117
+ properties: {
118
+ left: { type: 'number' },
119
+ top: { type: 'number' },
120
+ width: { type: 'number' },
121
+ height: { type: 'number' },
122
+ },
123
+ required: ['left', 'top', 'width', 'height'],
124
+ },
125
+ rotate: { type: 'number', description: 'Degrees clockwise. 90/180/270 are lossless.' },
126
+ flip: { type: 'boolean', description: 'Mirror vertically (top<->bottom).' },
127
+ flop: { type: 'boolean', description: 'Mirror horizontally (left<->right).' },
128
+ blur: { type: 'number', description: 'Gaussian blur sigma (0.3-1000). Higher = more blur.' },
129
+ sharpen: { type: 'boolean', description: 'Apply moderate sharpening.' },
130
+ grayscale: { type: 'boolean' },
131
+ negate: { type: 'boolean' },
132
+ normalize: { type: 'boolean', description: 'Stretch contrast to full range.' },
133
+ gamma: { type: 'number', description: '1.0-3.0. Default 2.2.' },
134
+ modulate: {
135
+ type: 'object',
136
+ description: 'Adjust HSL.',
137
+ properties: {
138
+ brightness: { type: 'number', description: '1.0 = unchanged.' },
139
+ saturation: { type: 'number', description: '1.0 = unchanged.' },
140
+ hue: { type: 'number', description: 'Degrees rotation.' },
141
+ },
142
+ },
143
+ output_format: { type: 'string', enum: ['png', 'jpg', 'webp', 'gif'], description: 'Output format. Default: same as input (animated GIFs / WebPs keep their animation). Picking a non-animated format on an animated input collapses it to a single frame.' },
144
+ output_path: { type: 'string', description: 'Optional output path (project-relative). If omitted, result is uploaded.' },
145
+ },
146
+ required: ['input'],
147
+ },
148
+ };
149
+ async function executeEditImage(params, context) {
150
+ const input = params.input;
151
+ if (!input)
152
+ return 'Error: "input" is required.';
153
+ if (!context)
154
+ return 'Error: No tool context.';
155
+ try {
156
+ const inputData = await loadImageInput(input, context);
157
+ // Prefer sniffing the *actual* format (so a GIF defaults to GIF and keeps
158
+ // its animation) over the URL/file extension. Falls through to extension,
159
+ // then PNG.
160
+ const sniffed = typeof inputData === 'string'
161
+ ? undefined
162
+ : detectFormat(inputData);
163
+ const fallbackExt = sniffed || inputExt(input) || 'png';
164
+ const outFmt = normalizeFormat(params.output_format, fallbackExt);
165
+ // `animated: true` preserves every frame of GIFs / animated WebPs through
166
+ // transforms that don't change the strip orientation (rotate 180,
167
+ // flip/flop, crop, brightness, ...). For single-frame inputs it's a no-op.
168
+ let pipeline = sharp(inputData, { failOn: 'none', animated: true });
169
+ if (typeof params.rotate === 'number')
170
+ pipeline = pipeline.rotate(params.rotate);
171
+ if (params.flip === true)
172
+ pipeline = pipeline.flip();
173
+ if (params.flop === true)
174
+ pipeline = pipeline.flop();
175
+ const crop = params.crop;
176
+ if (crop)
177
+ pipeline = pipeline.extract({ left: crop.left, top: crop.top, width: crop.width, height: crop.height });
178
+ const resizeOpt = params.resize;
179
+ if (resizeOpt && (resizeOpt.width || resizeOpt.height)) {
180
+ pipeline = pipeline.resize({
181
+ width: resizeOpt.width,
182
+ height: resizeOpt.height,
183
+ fit: resizeOpt.fit ?? 'inside',
184
+ });
185
+ }
186
+ if (params.grayscale === true)
187
+ pipeline = pipeline.grayscale();
188
+ if (params.negate === true)
189
+ pipeline = pipeline.negate();
190
+ if (params.normalize === true)
191
+ pipeline = pipeline.normalize();
192
+ if (typeof params.gamma === 'number')
193
+ pipeline = pipeline.gamma(params.gamma);
194
+ const mod = params.modulate;
195
+ if (mod)
196
+ pipeline = pipeline.modulate(mod);
197
+ if (typeof params.blur === 'number')
198
+ pipeline = pipeline.blur(params.blur);
199
+ if (params.sharpen === true)
200
+ pipeline = pipeline.sharpen();
201
+ pipeline = applyFormat(pipeline, outFmt);
202
+ const buf = await pipeline.toBuffer();
203
+ const outputPath = params.output_path;
204
+ if (outputPath) {
205
+ const outResolved = resolveImagePath(outputPath, context);
206
+ mkdirSync(dirname(outResolved), { recursive: true });
207
+ writeFileSync(outResolved, buf);
208
+ return JSON.stringify({
209
+ success: true,
210
+ path: outputPath,
211
+ size: buf.length,
212
+ message: `Image saved to ${outputPath}`,
213
+ });
214
+ }
215
+ const outFilename = `${inputBasename(input)}-edited.${outFmt}`;
216
+ return uploadImage(buf, outFilename, 'agent-images', context);
217
+ }
218
+ catch (err) {
219
+ return `Error: ${err?.message ?? String(err)}`;
220
+ }
221
+ }
222
+ // ─── Image Info ─────────────────────────────
223
+ const imageInfoDefinition = {
224
+ name: 'runner_image_info',
225
+ description: 'Get image metadata: format, dimensions, color space, channels, density, depth, file size.',
226
+ parameters: {
227
+ type: 'object',
228
+ properties: {
229
+ input: { type: 'string', description: 'Image path relative to the project root.' },
230
+ },
231
+ required: ['input'],
232
+ },
233
+ };
234
+ async function executeImageInfo(params, context) {
235
+ const input = params.input;
236
+ try {
237
+ const inputResolved = resolveImagePath(input, context);
238
+ if (!existsSync(inputResolved))
239
+ return `Error: File not found: ${input}`;
240
+ const stat = statSync(inputResolved);
241
+ const meta = await sharp(inputResolved).metadata();
242
+ return JSON.stringify({
243
+ filename: basename(input),
244
+ format: meta.format,
245
+ width: meta.width,
246
+ height: meta.height,
247
+ geometry: meta.width && meta.height ? `${meta.width}x${meta.height}` : undefined,
248
+ channels: meta.channels,
249
+ depth: meta.depth,
250
+ colorspace: meta.space,
251
+ density: meta.density,
252
+ hasAlpha: meta.hasAlpha,
253
+ hasProfile: meta.hasProfile,
254
+ orientation: meta.orientation,
255
+ filesize: stat.size,
256
+ }, null, 2);
257
+ }
258
+ catch (err) {
259
+ return `Error: ${err?.message ?? String(err)}`;
260
+ }
261
+ }
262
+ // ─── Compose Images ─────────────────────────
263
+ const composeImagesDefinition = {
264
+ name: 'runner_compose_images',
265
+ description: 'Combine multiple images into one (append_horizontal, append_vertical, overlay, tile).',
266
+ parameters: {
267
+ type: 'object',
268
+ properties: {
269
+ inputs: { type: 'array', items: { type: 'string' }, description: 'Input images: each entry is a project-relative path OR an http(s) URL. Mix freely.' },
270
+ mode: { type: 'string', enum: ['append_horizontal', 'append_vertical', 'overlay', 'tile'], description: 'Combine mode.' },
271
+ tile_columns: { type: 'number', description: 'Columns for tile mode. Default: 2.' },
272
+ output_format: { type: 'string', enum: ['png', 'jpg', 'webp', 'gif'], description: 'Output format. Default: png.' },
273
+ output_path: { type: 'string', description: 'Output path. Omit to upload.' },
274
+ },
275
+ required: ['inputs', 'mode'],
276
+ },
277
+ };
278
+ async function executeComposeImages(params, context) {
279
+ const inputs = params.inputs;
280
+ const mode = params.mode;
281
+ const tileColumns = params.tile_columns || 2;
282
+ const outFmt = normalizeFormat(params.output_format, 'png');
283
+ const outputPath = params.output_path;
284
+ if (!inputs || inputs.length < 2)
285
+ return 'Error: At least 2 input images are required.';
286
+ if (inputs.length > 20)
287
+ return 'Error: Maximum 20 input images allowed.';
288
+ if (!context)
289
+ return 'Error: No tool context.';
290
+ try {
291
+ const items = await Promise.all(inputs.map(async (p) => {
292
+ const data = await loadImageInput(p, context);
293
+ const meta = await sharp(data).metadata();
294
+ if (!meta.width || !meta.height)
295
+ throw new Error(`Could not read dimensions of ${p}`);
296
+ return { data, width: meta.width, height: meta.height };
297
+ }));
298
+ let canvasW = 0;
299
+ let canvasH = 0;
300
+ let composites = [];
301
+ if (mode === 'append_horizontal') {
302
+ canvasH = Math.max(...items.map(i => i.height));
303
+ let x = 0;
304
+ for (const it of items) {
305
+ composites.push({ input: it.data, left: x, top: 0 });
306
+ x += it.width;
307
+ }
308
+ canvasW = x;
309
+ }
310
+ else if (mode === 'append_vertical') {
311
+ canvasW = Math.max(...items.map(i => i.width));
312
+ let y = 0;
313
+ for (const it of items) {
314
+ composites.push({ input: it.data, left: 0, top: y });
315
+ y += it.height;
316
+ }
317
+ canvasH = y;
318
+ }
319
+ else if (mode === 'overlay') {
320
+ const [base, top] = items;
321
+ if (!base || !top)
322
+ return 'Error: At least 2 input images are required.';
323
+ canvasW = base.width;
324
+ canvasH = base.height;
325
+ composites = [
326
+ { input: base.data, left: 0, top: 0 },
327
+ {
328
+ input: top.data,
329
+ left: Math.max(0, Math.floor((base.width - top.width) / 2)),
330
+ top: Math.max(0, Math.floor((base.height - top.height) / 2)),
331
+ },
332
+ ];
333
+ }
334
+ else if (mode === 'tile') {
335
+ const cols = Math.max(1, tileColumns);
336
+ const rows = Math.ceil(items.length / cols);
337
+ const cellW = Math.max(...items.map(i => i.width));
338
+ const cellH = Math.max(...items.map(i => i.height));
339
+ const pad = 2;
340
+ canvasW = cols * cellW + (cols + 1) * pad;
341
+ canvasH = rows * cellH + (rows + 1) * pad;
342
+ for (const [i, item] of items.entries()) {
343
+ const c = i % cols;
344
+ const r = Math.floor(i / cols);
345
+ composites.push({
346
+ input: item.data,
347
+ left: pad + c * (cellW + pad) + Math.floor((cellW - item.width) / 2),
348
+ top: pad + r * (cellH + pad) + Math.floor((cellH - item.height) / 2),
349
+ });
350
+ }
351
+ }
352
+ else {
353
+ return `Error: Unknown mode "${mode}". Use: append_horizontal, append_vertical, overlay, tile.`;
354
+ }
355
+ const canvas = sharp({
356
+ create: {
357
+ width: canvasW,
358
+ height: canvasH,
359
+ channels: 4,
360
+ background: { r: 255, g: 255, b: 255, alpha: outFmt === 'png' || outFmt === 'webp' ? 0 : 1 },
361
+ },
362
+ }).composite(composites);
363
+ const buf = await applyFormat(canvas, outFmt).toBuffer();
364
+ if (outputPath) {
365
+ const outResolved = resolveImagePath(outputPath, context);
366
+ mkdirSync(dirname(outResolved), { recursive: true });
367
+ writeFileSync(outResolved, buf);
368
+ return JSON.stringify({
369
+ success: true,
370
+ path: outputPath,
371
+ size: buf.length,
372
+ message: `Composed image saved to ${outputPath}`,
373
+ });
374
+ }
375
+ const outFilename = `composed-${Date.now()}.${outFmt}`;
376
+ return uploadImage(buf, outFilename, 'agent-images', context);
377
+ }
378
+ catch (err) {
379
+ return `Error: ${err?.message ?? String(err)}`;
380
+ }
381
+ }
382
+ // ─── View Image ─────────────────────────────
383
+ const viewImageDefinition = {
384
+ name: 'runner_view_image',
385
+ description: 'Look at an image (local file or remote URL) by inlining its bytes into your next message. After this call the image is visible to you - analyze it directly in your reply, no further tool needed.\n\n'
386
+ + 'Set keep:true ONLY when the user explicitly asks to save/share the image; then it is also uploaded and the result includes a URL.',
387
+ parameters: {
388
+ type: 'object',
389
+ properties: {
390
+ path: { type: 'string', description: 'Local image path relative to the project root.' },
391
+ url: { type: 'string', description: 'Remote image URL (http/https). Use path OR url.' },
392
+ keep: {
393
+ type: 'boolean',
394
+ description: 'Default false. When true, also upload the image and return a persistent URL alongside the inline view.',
395
+ },
396
+ },
397
+ },
398
+ };
399
+ // Inline images travel inside the next inference request body, which the
400
+ // studio caps at 1 MB. Base64 inflates payload by ~4/3, so the binary ceiling
401
+ // we can safely inline is ~750 KB. Anything bigger gets a clear error
402
+ // instructing the agent to resize (`runner_edit_image`) or upload-only
403
+ // (`keep: true` on the originating capture, or `keep: true` here to upload
404
+ // the file without inlining the bytes).
405
+ const MAX_INLINE_IMAGE_BYTES = 700 * 1024;
406
+ const MAX_UPLOAD_IMAGE_BYTES = 20 * 1024 * 1024;
407
+ function detectMediaTypeFromFilename(filename) {
408
+ const ext = filename.toLowerCase().split('.').pop() ?? '';
409
+ if (ext === 'png')
410
+ return 'image/png';
411
+ if (ext === 'webp')
412
+ return 'image/webp';
413
+ if (ext === 'gif')
414
+ return 'image/gif';
415
+ return 'image/jpeg';
416
+ }
417
+ /**
418
+ * The only media types the model accepts for an inline image. A wrong value
419
+ * here is fatal: Anthropic rejects the whole request with
420
+ * "media_type: Input should be 'image/jpeg', 'image/png', 'image/gif' or
421
+ * 'image/webp'". Content-Type headers and file extensions lie often enough
422
+ * (servers send `image/jpg`, `application/octet-stream`, generic types) that
423
+ * the bytes are the only trustworthy source, so we sniff magic numbers rather
424
+ * than trust the label. Returns the correct supported media type, or null when
425
+ * the bytes are not one of the four the model can read (svg, bmp, tiff, avif,
426
+ * heic, ...).
427
+ */
428
+ function sniffSupportedMediaType(buf) {
429
+ if (buf.length >= 4 && buf[0] === 0x89 && buf[1] === 0x50 && buf[2] === 0x4e && buf[3] === 0x47)
430
+ return 'image/png';
431
+ if (buf.length >= 3 && buf[0] === 0xff && buf[1] === 0xd8 && buf[2] === 0xff)
432
+ return 'image/jpeg';
433
+ if (buf.length >= 4 && buf[0] === 0x47 && buf[1] === 0x49 && buf[2] === 0x46 && buf[3] === 0x38)
434
+ return 'image/gif';
435
+ if (buf.length >= 12 && buf.toString('ascii', 0, 4) === 'RIFF' && buf.toString('ascii', 8, 12) === 'WEBP')
436
+ return 'image/webp';
437
+ return null;
438
+ }
439
+ async function executeViewImage(params, context) {
440
+ const path = params.path;
441
+ const url = params.url;
442
+ const keep = params.keep === true;
443
+ if (!path && !url)
444
+ return 'Error: Provide either "path" (local file) or "url" (remote image).';
445
+ if (path && url)
446
+ return 'Error: Provide either "path" or "url", not both.';
447
+ if (!context)
448
+ return 'Error: No tool context available.';
449
+ if (keep && (!context.studioUrl || !context.agentToken)) {
450
+ return 'Error: Upload configuration not available. Cannot keep the image.';
451
+ }
452
+ try {
453
+ let imageData;
454
+ let filename;
455
+ let mediaType;
456
+ if (path) {
457
+ const resolved = resolveImagePath(path, context);
458
+ if (!existsSync(resolved))
459
+ return `Error: File not found: ${path}`;
460
+ imageData = readFileSync(resolved);
461
+ filename = basename(path);
462
+ mediaType = detectMediaTypeFromFilename(filename);
463
+ }
464
+ else {
465
+ if (!url.startsWith('http://') && !url.startsWith('https://')) {
466
+ return 'Error: URL must start with http:// or https://';
467
+ }
468
+ const controller = new AbortController();
469
+ const timeout = setTimeout(() => controller.abort(), 30000);
470
+ let contentType = '';
471
+ try {
472
+ const res = await fetch(url, { signal: controller.signal });
473
+ if (!res.ok)
474
+ return `Error: Failed to fetch image (${res.status}): ${res.statusText}`;
475
+ contentType = (res.headers.get('content-type') || '').toLowerCase().split(';')[0].trim();
476
+ imageData = Buffer.from(await res.arrayBuffer());
477
+ }
478
+ finally {
479
+ clearTimeout(timeout);
480
+ }
481
+ const urlPath = new URL(url).pathname;
482
+ filename = basename(urlPath) || `image-${Date.now()}.png`;
483
+ mediaType = contentType.startsWith('image/')
484
+ ? contentType
485
+ : detectMediaTypeFromFilename(filename);
486
+ }
487
+ if (imageData.length === 0)
488
+ return 'Error: Image data is empty.';
489
+ if (imageData.length > MAX_UPLOAD_IMAGE_BYTES) {
490
+ return `Error: image is too large (${imageData.length} bytes, max ${MAX_UPLOAD_IMAGE_BYTES}).`;
491
+ }
492
+ // Two ceilings:
493
+ // - inline ceiling (~700 KB): bytes that go into the next inference
494
+ // request body. Past this the studio returns 413 Payload Too Large.
495
+ // - upload ceiling (20 MB): bytes we let through to the CDN.
496
+ // For images above the inline ceiling we still allow keep:true (upload
497
+ // only, no inline) and otherwise return a clear error instead of
498
+ // silently sending a request that will 413.
499
+ const tooBigToInline = imageData.length > MAX_INLINE_IMAGE_BYTES;
500
+ if (tooBigToInline && !keep) {
501
+ return `Error: image is ${Math.round(imageData.length / 1024)} KB which exceeds the inline limit of ${Math.round(MAX_INLINE_IMAGE_BYTES / 1024)} KB. Options: (a) resize the image first with runner_edit_image, (b) re-take the screenshot at lower resolution, or (c) call this tool again with keep:true to upload-only (skips inline, returns a CDN URL).`;
502
+ }
503
+ // The bytes are the source of truth for the media type: a mislabeled
504
+ // Content-Type (image/jpg, application/octet-stream, ...) would otherwise
505
+ // reach the model and make Anthropic reject the entire request. If the
506
+ // format is not one the model can read inline, refuse with actionable
507
+ // guidance instead of sending a request that will 400.
508
+ const inlineMediaType = sniffSupportedMediaType(imageData);
509
+ if (!tooBigToInline && !inlineMediaType && !keep) {
510
+ return `Error: this image is a ${mediaType} format, which the model cannot read inline. Supported inline formats are PNG, JPEG, GIF and WebP. Convert it first with runner_edit_image (re-encodes to PNG/JPEG) and view the result, or call this tool again with keep:true to upload it without inlining.`;
511
+ }
512
+ const canInline = !tooBigToInline && inlineMediaType !== null;
513
+ if (canInline) {
514
+ context.pendingToolImages?.push({ data: imageData, mediaType: inlineMediaType });
515
+ }
516
+ if (!keep) {
517
+ return JSON.stringify({
518
+ success: true,
519
+ inline: true,
520
+ mediaType: inlineMediaType,
521
+ size: imageData.length,
522
+ filename,
523
+ });
524
+ }
525
+ const uploadResult = await uploadImage(imageData, filename, 'agent-images', context);
526
+ try {
527
+ const parsed = JSON.parse(uploadResult);
528
+ const unsupportedInline = !tooBigToInline && !inlineMediaType;
529
+ return JSON.stringify({
530
+ ...parsed,
531
+ inline: canInline,
532
+ mediaType: inlineMediaType ?? mediaType,
533
+ ...(tooBigToInline ? { note: `Image was ${Math.round(imageData.length / 1024)} KB - too large to inline (limit ${Math.round(MAX_INLINE_IMAGE_BYTES / 1024)} KB). Uploaded only. To see it, resize first with runner_edit_image then view the resized output.` } : {}),
534
+ ...(unsupportedInline ? { note: `Image is a ${mediaType} format that the model cannot read inline (only PNG/JPEG/GIF/WebP). Uploaded only. To view it, convert it first with runner_edit_image.` } : {}),
535
+ });
536
+ }
537
+ catch {
538
+ return uploadResult;
539
+ }
540
+ }
541
+ catch (err) {
542
+ return `Error: ${err?.message ?? String(err)}`;
543
+ }
544
+ }
545
+ // ─── Export ─────────────────────────────────
546
+ export const imageTools = [
547
+ { definition: editImageDefinition, execute: executeEditImage },
548
+ { definition: imageInfoDefinition, execute: executeImageInfo },
549
+ { definition: composeImagesDefinition, execute: executeComposeImages },
550
+ { definition: viewImageDefinition, execute: executeViewImage },
551
+ ];
@@ -0,0 +1,13 @@
1
+ import { type ToolContext } from '@nordhavnhq/runner-runtime';
2
+ /** Re-exported so the host tool executors can keep importing `ToolContext`
3
+ * from `./index.js` - the type itself is owned by the core. */
4
+ export type { ToolContext };
5
+ /**
6
+ * The CLI's local tool set: the host-machine tools (`runner_*` - filesystem,
7
+ * console, webcam, computer, image, database) plus the core-provided
8
+ * cross-agent delegation tool. Wrapped in the core's {@link createToolProvider}
9
+ * and handed to `createHandleChat`/`createHandleTask`, which route every
10
+ * non-MCP tool call through it. A VS Code or browser edition builds its own
11
+ * provider from editor/page tools instead - the core never sees the difference.
12
+ */
13
+ export declare const hostToolProvider: import("@nordhavnhq/runner-runtime").ToolProvider;
@@ -0,0 +1,58 @@
1
+ import { createToolProvider, delegateTools } from '@nordhavnhq/runner-runtime';
2
+ import { filesystemTools } from './filesystem.js';
3
+ import { searchTools } from './search.js';
4
+ import { outlineTools } from './outline.js';
5
+ import { sonarTools } from './sonar.js';
6
+ import { testTools } from './testing.js';
7
+ import { uploadTools } from './upload.js';
8
+ import { consoleTools } from './console.js';
9
+ import { httpTools } from './http.js';
10
+ import { gitTools } from './git.js';
11
+ import { gitTagTools } from './git-tag.js';
12
+ import { webcamTools } from './webcam.js';
13
+ import { browserTools } from './browser.js';
14
+ import { computerTools } from './computer.js';
15
+ import { imageTools } from './image.js';
16
+ import { databaseTools } from './database.js';
17
+ import { takeLateDiagnostics } from './_sonar/diagnose/index.js';
18
+ /**
19
+ * The CLI's local tool set: the host-machine tools (`runner_*` - filesystem,
20
+ * console, webcam, computer, image, database) plus the core-provided
21
+ * cross-agent delegation tool. Wrapped in the core's {@link createToolProvider}
22
+ * and handed to `createHandleChat`/`createHandleTask`, which route every
23
+ * non-MCP tool call through it. A VS Code or browser edition builds its own
24
+ * provider from editor/page tools instead - the core never sees the difference.
25
+ */
26
+ export const hostToolProvider = createToolProvider(withLateDiagnostics([
27
+ ...filesystemTools,
28
+ ...searchTools,
29
+ ...outlineTools,
30
+ ...sonarTools,
31
+ ...testTools,
32
+ ...uploadTools,
33
+ ...consoleTools,
34
+ ...httpTools,
35
+ ...gitTools,
36
+ ...gitTagTools,
37
+ ...webcamTools,
38
+ ...browserTools,
39
+ ...computerTools,
40
+ ...imageTools,
41
+ ...databaseTools,
42
+ ...delegateTools,
43
+ ]));
44
+ /**
45
+ * Every tool's output gets the late lint reports of its run below it: a lint
46
+ * that missed the budget of the write that started it rides along with the
47
+ * next call of that run (see `_sonar/diagnose`).
48
+ */
49
+ function withLateDiagnostics(tools) {
50
+ return tools.map(tool => ({
51
+ ...tool,
52
+ async execute(params, context) {
53
+ const result = await tool.execute(params, context);
54
+ const lateReport = takeLateDiagnostics(context);
55
+ return lateReport ? `${result}\n${lateReport}` : result;
56
+ },
57
+ }));
58
+ }
@@ -0,0 +1,20 @@
1
+ import type { ToolDefinition } from '@nordhavnhq/runner-runtime';
2
+ import type { ToolContext } from './index.js';
3
+ /**
4
+ * The model-facing outline of a file: a header, then one line per symbol.
5
+ * Exported for tests.
6
+ */
7
+ export declare function renderOutline(path: string, content: string): string;
8
+ /**
9
+ * The lines of one symbol, with its doc comment, rendered like any file read
10
+ * (so the line numbers and the paging are the same). Returns an error string
11
+ * the model can act on when the symbol is not there. Exported for the read
12
+ * tool and for tests.
13
+ */
14
+ export declare function readSymbol(path: string, content: string, query: string, render: (offset: number, limit: number) => string): string;
15
+ declare function executeOutline(params: Record<string, unknown>, context?: ToolContext): Promise<string>;
16
+ export declare const outlineTools: {
17
+ definition: ToolDefinition;
18
+ execute: typeof executeOutline;
19
+ }[];
20
+ export {};