@equinor/fusion-framework-cli-plugin-copilot 2.0.2 → 2.0.3

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 (263) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/esm/commands/app/{session-logger.js → attach-session-logger.js} +16 -2
  3. package/dist/esm/commands/app/attach-session-logger.js.map +1 -0
  4. package/dist/esm/commands/app/{command.js → copilot-command.js} +22 -11
  5. package/dist/esm/commands/app/copilot-command.js.map +1 -0
  6. package/dist/esm/commands/app/{eval.js → create-session.js} +7 -5
  7. package/dist/esm/commands/app/create-session.js.map +1 -0
  8. package/dist/esm/commands/app/format-plan.js +24 -0
  9. package/dist/esm/commands/app/format-plan.js.map +1 -0
  10. package/dist/esm/commands/app/format-step-result.js +14 -0
  11. package/dist/esm/commands/app/format-step-result.js.map +1 -0
  12. package/dist/esm/commands/app/format-verdict.js +38 -0
  13. package/dist/esm/commands/app/format-verdict.js.map +1 -0
  14. package/dist/esm/commands/app/prompts/{system.dev-server.prompt.js → create-dev-server-context.js} +1 -1
  15. package/dist/esm/commands/app/prompts/create-dev-server-context.js.map +1 -0
  16. package/dist/esm/commands/app/prompts/{execute-step.prompt.js → create-execute-step-prompt.js} +1 -1
  17. package/dist/esm/commands/app/prompts/create-execute-step-prompt.js.map +1 -0
  18. package/dist/esm/commands/app/prompts/{judge.prompt.js → create-judge-prompt.js} +5 -1
  19. package/dist/esm/commands/app/prompts/create-judge-prompt.js.map +1 -0
  20. package/dist/esm/commands/app/prompts/{plan.prompt.js → create-plan-prompt.js} +1 -1
  21. package/dist/esm/commands/app/prompts/create-plan-prompt.js.map +1 -0
  22. package/dist/esm/commands/app/prompts/{step.prompt.js → create-step-prompt.js} +3 -2
  23. package/dist/esm/commands/app/prompts/create-step-prompt.js.map +1 -0
  24. package/dist/esm/commands/app/prompts/{system.prompt.js → create-system-prompt.js} +1 -1
  25. package/dist/esm/commands/app/prompts/create-system-prompt.js.map +1 -0
  26. package/dist/esm/commands/app/{login.js → run-login.js} +5 -1
  27. package/dist/esm/commands/app/run-login.js.map +1 -0
  28. package/dist/esm/commands/app/{server.js → start-app-server.js} +7 -1
  29. package/dist/esm/commands/app/start-app-server.js.map +1 -0
  30. package/dist/esm/commands/app/status-icon.js +18 -0
  31. package/dist/esm/commands/app/status-icon.js.map +1 -0
  32. package/dist/esm/commands/app/tools/{registry.js → AgentBrowserToolRegistry.js} +1 -1
  33. package/dist/esm/commands/app/tools/AgentBrowserToolRegistry.js.map +1 -0
  34. package/dist/esm/commands/app/tools/{write-file.js → create-append-file-tool.js} +5 -38
  35. package/dist/esm/commands/app/tools/create-append-file-tool.js.map +1 -0
  36. package/dist/esm/commands/app/tools/{click.js → create-click-tool.js} +1 -1
  37. package/dist/esm/commands/app/tools/create-click-tool.js.map +1 -0
  38. package/dist/esm/commands/app/tools/{errors.js → create-errors-tool.js} +1 -1
  39. package/dist/esm/commands/app/tools/create-errors-tool.js.map +1 -0
  40. package/dist/esm/commands/app/tools/{eval-js.js → create-eval-js-tool.js} +1 -1
  41. package/dist/esm/commands/app/tools/create-eval-js-tool.js.map +1 -0
  42. package/dist/esm/commands/app/tools/{fill.js → create-fill-tool.js} +1 -1
  43. package/dist/esm/commands/app/tools/create-fill-tool.js.map +1 -0
  44. package/dist/esm/commands/app/tools/{find.js → create-find-tool.js} +4 -1
  45. package/dist/esm/commands/app/tools/create-find-tool.js.map +1 -0
  46. package/dist/esm/commands/app/tools/{get-styles.js → create-get-styles-tool.js} +1 -1
  47. package/dist/esm/commands/app/tools/create-get-styles-tool.js.map +1 -0
  48. package/dist/esm/commands/app/tools/{get-url.js → create-get-url-tool.js} +1 -1
  49. package/dist/esm/commands/app/tools/create-get-url-tool.js.map +1 -0
  50. package/dist/esm/commands/app/tools/{go-back.js → create-go-back-tool.js} +1 -1
  51. package/dist/esm/commands/app/tools/create-go-back-tool.js.map +1 -0
  52. package/dist/esm/commands/app/tools/{hover.js → create-hover-tool.js} +1 -1
  53. package/dist/esm/commands/app/tools/create-hover-tool.js.map +1 -0
  54. package/dist/esm/commands/app/tools/{navigate.js → create-navigate-tool.js} +1 -1
  55. package/dist/esm/commands/app/tools/create-navigate-tool.js.map +1 -0
  56. package/dist/esm/commands/app/tools/{press-key.js → create-press-key-tool.js} +1 -1
  57. package/dist/esm/commands/app/tools/create-press-key-tool.js.map +1 -0
  58. package/dist/esm/commands/app/tools/{read-file.js → create-read-file-tool.js} +4 -2
  59. package/dist/esm/commands/app/tools/create-read-file-tool.js.map +1 -0
  60. package/dist/esm/commands/app/tools/{reload.js → create-reload-tool.js} +1 -1
  61. package/dist/esm/commands/app/tools/create-reload-tool.js.map +1 -0
  62. package/dist/esm/commands/app/tools/{screenshot.js → create-screenshot-tool.js} +7 -1
  63. package/dist/esm/commands/app/tools/create-screenshot-tool.js.map +1 -0
  64. package/dist/esm/commands/app/tools/{scroll.js → create-scroll-tool.js} +3 -1
  65. package/dist/esm/commands/app/tools/create-scroll-tool.js.map +1 -0
  66. package/dist/esm/commands/app/tools/{select.js → create-select-tool.js} +1 -1
  67. package/dist/esm/commands/app/tools/create-select-tool.js.map +1 -0
  68. package/dist/esm/commands/app/tools/{snapshot.js → create-snapshot-tool.js} +1 -1
  69. package/dist/esm/commands/app/tools/create-snapshot-tool.js.map +1 -0
  70. package/dist/esm/commands/app/tools/{type-text.js → create-type-text-tool.js} +1 -1
  71. package/dist/esm/commands/app/tools/create-type-text-tool.js.map +1 -0
  72. package/dist/esm/commands/app/tools/{wait.js → create-wait-tool.js} +5 -1
  73. package/dist/esm/commands/app/tools/create-wait-tool.js.map +1 -0
  74. package/dist/esm/commands/app/tools/create-write-file-tool.js +65 -0
  75. package/dist/esm/commands/app/tools/create-write-file-tool.js.map +1 -0
  76. package/dist/esm/commands/app/tools/index.js +19 -19
  77. package/dist/esm/commands/app/tools/index.js.map +1 -1
  78. package/dist/esm/commands/app/truncate.js +11 -0
  79. package/dist/esm/commands/app/truncate.js.map +1 -0
  80. package/dist/esm/commands/app/try-format-message.js +39 -0
  81. package/dist/esm/commands/app/try-format-message.js.map +1 -0
  82. package/dist/esm/exit-with-resolution-error.js +16 -0
  83. package/dist/esm/exit-with-resolution-error.js.map +1 -0
  84. package/dist/esm/index.js +1 -1
  85. package/dist/esm/index.js.map +1 -1
  86. package/dist/esm/resolve-eval-command-input.js +37 -0
  87. package/dist/esm/resolve-eval-command-input.js.map +1 -0
  88. package/dist/esm/resolve-eval-files.js +49 -0
  89. package/dist/esm/resolve-eval-files.js.map +1 -0
  90. package/dist/esm/utils/ab-error-message.js +34 -0
  91. package/dist/esm/utils/ab-error-message.js.map +1 -0
  92. package/dist/esm/utils/{agent-browser.js → ab.js} +3 -32
  93. package/dist/esm/utils/ab.js.map +1 -0
  94. package/dist/esm/utils/create-run-dir.js +24 -0
  95. package/dist/esm/utils/create-run-dir.js.map +1 -0
  96. package/dist/esm/utils/{process.js → helpers.js} +28 -11
  97. package/dist/esm/utils/helpers.js.map +1 -0
  98. package/dist/esm/utils/index.js +8 -5
  99. package/dist/esm/utils/index.js.map +1 -1
  100. package/dist/esm/utils/{browser-poll.js → poll-console.js} +5 -3
  101. package/dist/esm/utils/poll-console.js.map +1 -0
  102. package/dist/esm/utils/{daemon.js → reset-daemon.js} +5 -14
  103. package/dist/esm/utils/reset-daemon.js.map +1 -0
  104. package/dist/esm/utils/resolve-app-key.js +20 -0
  105. package/dist/esm/utils/resolve-app-key.js.map +1 -0
  106. package/dist/esm/utils/wait-for-server.js +26 -0
  107. package/dist/esm/utils/wait-for-server.js.map +1 -0
  108. package/dist/esm/version.js +1 -1
  109. package/dist/tsconfig.tsbuildinfo +1 -1
  110. package/dist/types/commands/app/format-plan.d.ts +8 -0
  111. package/dist/types/commands/app/format-step-result.d.ts +8 -0
  112. package/dist/types/commands/app/format-verdict.d.ts +8 -0
  113. package/dist/types/commands/app/prompts/{step.prompt.d.ts → create-step-prompt.d.ts} +1 -1
  114. package/dist/types/commands/app/status-icon.d.ts +8 -0
  115. package/dist/types/commands/app/tools/create-append-file-tool.d.ts +10 -0
  116. package/dist/types/commands/app/tools/{write-file.d.ts → create-write-file-tool.d.ts} +0 -9
  117. package/dist/types/commands/app/truncate.d.ts +8 -0
  118. package/dist/types/commands/app/try-format-message.d.ts +10 -0
  119. package/dist/types/exit-with-resolution-error.d.ts +8 -0
  120. package/dist/types/{eval-resolve.d.ts → resolve-eval-command-input.d.ts} +0 -8
  121. package/dist/types/resolve-eval-files.d.ts +8 -0
  122. package/dist/types/utils/ab-error-message.d.ts +11 -0
  123. package/dist/types/utils/{agent-browser.d.ts → ab.d.ts} +0 -13
  124. package/dist/types/utils/create-run-dir.d.ts +8 -0
  125. package/dist/types/utils/{process.d.ts → helpers.d.ts} +13 -6
  126. package/dist/types/utils/index.d.ts +8 -5
  127. package/dist/types/utils/{daemon.d.ts → reset-daemon.d.ts} +0 -5
  128. package/dist/types/utils/resolve-app-key.d.ts +9 -0
  129. package/dist/types/utils/wait-for-server.d.ts +9 -0
  130. package/dist/types/version.d.ts +1 -1
  131. package/package.json +4 -4
  132. package/src/commands/app/{session-logger.ts → attach-session-logger.ts} +15 -1
  133. package/src/commands/app/{command.ts → copilot-command.ts} +21 -12
  134. package/src/commands/app/{eval.ts → create-session.ts} +6 -4
  135. package/src/commands/app/format-plan.ts +26 -0
  136. package/src/commands/app/format-step-result.ts +16 -0
  137. package/src/commands/app/format-verdict.ts +43 -0
  138. package/src/commands/app/prompts/{judge.prompt.ts → create-judge-prompt.ts} +4 -0
  139. package/src/commands/app/prompts/{step.prompt.ts → create-step-prompt.ts} +2 -1
  140. package/src/commands/app/{login.ts → run-login.ts} +4 -0
  141. package/src/commands/app/{server.ts → start-app-server.ts} +6 -0
  142. package/src/commands/app/status-icon.ts +16 -0
  143. package/src/commands/app/tools/{write-file.ts → create-append-file-tool.ts} +4 -39
  144. package/src/commands/app/tools/{find.ts → create-find-tool.ts} +3 -0
  145. package/src/commands/app/tools/{read-file.ts → create-read-file-tool.ts} +3 -1
  146. package/src/commands/app/tools/{screenshot.ts → create-screenshot-tool.ts} +6 -0
  147. package/src/commands/app/tools/{scroll.ts → create-scroll-tool.ts} +2 -0
  148. package/src/commands/app/tools/{wait.ts → create-wait-tool.ts} +4 -0
  149. package/src/commands/app/tools/create-write-file-tool.ts +69 -0
  150. package/src/commands/app/tools/index.ts +19 -19
  151. package/src/commands/app/truncate.ts +10 -0
  152. package/src/commands/app/try-format-message.ts +42 -0
  153. package/src/exit-with-resolution-error.ts +15 -0
  154. package/src/index.ts +1 -1
  155. package/src/resolve-eval-command-input.ts +59 -0
  156. package/src/resolve-eval-files.ts +57 -0
  157. package/src/utils/ab-error-message.ts +31 -0
  158. package/src/utils/{agent-browser.ts → ab.ts} +2 -30
  159. package/src/utils/create-run-dir.ts +24 -0
  160. package/src/utils/{process.ts → helpers.ts} +28 -10
  161. package/src/utils/index.ts +8 -5
  162. package/src/utils/{browser-poll.ts → poll-console.ts} +4 -2
  163. package/src/utils/{daemon.ts → reset-daemon.ts} +4 -13
  164. package/src/utils/resolve-app-key.ts +20 -0
  165. package/src/utils/wait-for-server.ts +24 -0
  166. package/src/version.ts +1 -1
  167. package/dist/esm/commands/app/command.js.map +0 -1
  168. package/dist/esm/commands/app/eval.js.map +0 -1
  169. package/dist/esm/commands/app/format.js +0 -93
  170. package/dist/esm/commands/app/format.js.map +0 -1
  171. package/dist/esm/commands/app/login.js.map +0 -1
  172. package/dist/esm/commands/app/prompts/execute-step.prompt.js.map +0 -1
  173. package/dist/esm/commands/app/prompts/judge.prompt.js.map +0 -1
  174. package/dist/esm/commands/app/prompts/plan.prompt.js.map +0 -1
  175. package/dist/esm/commands/app/prompts/step.prompt.js.map +0 -1
  176. package/dist/esm/commands/app/prompts/system.dev-server.prompt.js.map +0 -1
  177. package/dist/esm/commands/app/prompts/system.prompt.js.map +0 -1
  178. package/dist/esm/commands/app/server.js.map +0 -1
  179. package/dist/esm/commands/app/session-logger.js.map +0 -1
  180. package/dist/esm/commands/app/tools/click.js.map +0 -1
  181. package/dist/esm/commands/app/tools/errors.js.map +0 -1
  182. package/dist/esm/commands/app/tools/eval-js.js.map +0 -1
  183. package/dist/esm/commands/app/tools/fill.js.map +0 -1
  184. package/dist/esm/commands/app/tools/find.js.map +0 -1
  185. package/dist/esm/commands/app/tools/get-styles.js.map +0 -1
  186. package/dist/esm/commands/app/tools/get-url.js.map +0 -1
  187. package/dist/esm/commands/app/tools/go-back.js.map +0 -1
  188. package/dist/esm/commands/app/tools/hover.js.map +0 -1
  189. package/dist/esm/commands/app/tools/navigate.js.map +0 -1
  190. package/dist/esm/commands/app/tools/press-key.js.map +0 -1
  191. package/dist/esm/commands/app/tools/read-file.js.map +0 -1
  192. package/dist/esm/commands/app/tools/registry.js.map +0 -1
  193. package/dist/esm/commands/app/tools/reload.js.map +0 -1
  194. package/dist/esm/commands/app/tools/screenshot.js.map +0 -1
  195. package/dist/esm/commands/app/tools/scroll.js.map +0 -1
  196. package/dist/esm/commands/app/tools/select.js.map +0 -1
  197. package/dist/esm/commands/app/tools/snapshot.js.map +0 -1
  198. package/dist/esm/commands/app/tools/type-text.js.map +0 -1
  199. package/dist/esm/commands/app/tools/wait.js.map +0 -1
  200. package/dist/esm/commands/app/tools/write-file.js.map +0 -1
  201. package/dist/esm/eval-resolve.js +0 -83
  202. package/dist/esm/eval-resolve.js.map +0 -1
  203. package/dist/esm/utils/agent-browser.js.map +0 -1
  204. package/dist/esm/utils/browser-poll.js.map +0 -1
  205. package/dist/esm/utils/daemon.js.map +0 -1
  206. package/dist/esm/utils/process.js.map +0 -1
  207. package/dist/esm/utils/server.js +0 -65
  208. package/dist/esm/utils/server.js.map +0 -1
  209. package/dist/types/commands/app/format.d.ts +0 -14
  210. package/dist/types/utils/server.d.ts +0 -26
  211. package/src/commands/app/format.ts +0 -110
  212. package/src/eval-resolve.ts +0 -113
  213. package/src/utils/server.ts +0 -66
  214. /package/dist/types/commands/app/{session-logger.d.ts → attach-session-logger.d.ts} +0 -0
  215. /package/dist/types/commands/app/{command.d.ts → copilot-command.d.ts} +0 -0
  216. /package/dist/types/commands/app/{eval.d.ts → create-session.d.ts} +0 -0
  217. /package/dist/types/commands/app/prompts/{system.dev-server.prompt.d.ts → create-dev-server-context.d.ts} +0 -0
  218. /package/dist/types/commands/app/prompts/{execute-step.prompt.d.ts → create-execute-step-prompt.d.ts} +0 -0
  219. /package/dist/types/commands/app/prompts/{judge.prompt.d.ts → create-judge-prompt.d.ts} +0 -0
  220. /package/dist/types/commands/app/prompts/{plan.prompt.d.ts → create-plan-prompt.d.ts} +0 -0
  221. /package/dist/types/commands/app/prompts/{system.prompt.d.ts → create-system-prompt.d.ts} +0 -0
  222. /package/dist/types/commands/app/{login.d.ts → run-login.d.ts} +0 -0
  223. /package/dist/types/commands/app/{server.d.ts → start-app-server.d.ts} +0 -0
  224. /package/dist/types/commands/app/tools/{registry.d.ts → AgentBrowserToolRegistry.d.ts} +0 -0
  225. /package/dist/types/commands/app/tools/{click.d.ts → create-click-tool.d.ts} +0 -0
  226. /package/dist/types/commands/app/tools/{errors.d.ts → create-errors-tool.d.ts} +0 -0
  227. /package/dist/types/commands/app/tools/{eval-js.d.ts → create-eval-js-tool.d.ts} +0 -0
  228. /package/dist/types/commands/app/tools/{fill.d.ts → create-fill-tool.d.ts} +0 -0
  229. /package/dist/types/commands/app/tools/{find.d.ts → create-find-tool.d.ts} +0 -0
  230. /package/dist/types/commands/app/tools/{get-styles.d.ts → create-get-styles-tool.d.ts} +0 -0
  231. /package/dist/types/commands/app/tools/{get-url.d.ts → create-get-url-tool.d.ts} +0 -0
  232. /package/dist/types/commands/app/tools/{go-back.d.ts → create-go-back-tool.d.ts} +0 -0
  233. /package/dist/types/commands/app/tools/{hover.d.ts → create-hover-tool.d.ts} +0 -0
  234. /package/dist/types/commands/app/tools/{navigate.d.ts → create-navigate-tool.d.ts} +0 -0
  235. /package/dist/types/commands/app/tools/{press-key.d.ts → create-press-key-tool.d.ts} +0 -0
  236. /package/dist/types/commands/app/tools/{read-file.d.ts → create-read-file-tool.d.ts} +0 -0
  237. /package/dist/types/commands/app/tools/{reload.d.ts → create-reload-tool.d.ts} +0 -0
  238. /package/dist/types/commands/app/tools/{screenshot.d.ts → create-screenshot-tool.d.ts} +0 -0
  239. /package/dist/types/commands/app/tools/{scroll.d.ts → create-scroll-tool.d.ts} +0 -0
  240. /package/dist/types/commands/app/tools/{select.d.ts → create-select-tool.d.ts} +0 -0
  241. /package/dist/types/commands/app/tools/{snapshot.d.ts → create-snapshot-tool.d.ts} +0 -0
  242. /package/dist/types/commands/app/tools/{type-text.d.ts → create-type-text-tool.d.ts} +0 -0
  243. /package/dist/types/commands/app/tools/{wait.d.ts → create-wait-tool.d.ts} +0 -0
  244. /package/dist/types/utils/{browser-poll.d.ts → poll-console.d.ts} +0 -0
  245. /package/src/commands/app/prompts/{system.dev-server.prompt.ts → create-dev-server-context.ts} +0 -0
  246. /package/src/commands/app/prompts/{execute-step.prompt.ts → create-execute-step-prompt.ts} +0 -0
  247. /package/src/commands/app/prompts/{plan.prompt.ts → create-plan-prompt.ts} +0 -0
  248. /package/src/commands/app/prompts/{system.prompt.ts → create-system-prompt.ts} +0 -0
  249. /package/src/commands/app/tools/{registry.ts → AgentBrowserToolRegistry.ts} +0 -0
  250. /package/src/commands/app/tools/{click.ts → create-click-tool.ts} +0 -0
  251. /package/src/commands/app/tools/{errors.ts → create-errors-tool.ts} +0 -0
  252. /package/src/commands/app/tools/{eval-js.ts → create-eval-js-tool.ts} +0 -0
  253. /package/src/commands/app/tools/{fill.ts → create-fill-tool.ts} +0 -0
  254. /package/src/commands/app/tools/{get-styles.ts → create-get-styles-tool.ts} +0 -0
  255. /package/src/commands/app/tools/{get-url.ts → create-get-url-tool.ts} +0 -0
  256. /package/src/commands/app/tools/{go-back.ts → create-go-back-tool.ts} +0 -0
  257. /package/src/commands/app/tools/{hover.ts → create-hover-tool.ts} +0 -0
  258. /package/src/commands/app/tools/{navigate.ts → create-navigate-tool.ts} +0 -0
  259. /package/src/commands/app/tools/{press-key.ts → create-press-key-tool.ts} +0 -0
  260. /package/src/commands/app/tools/{reload.ts → create-reload-tool.ts} +0 -0
  261. /package/src/commands/app/tools/{select.ts → create-select-tool.ts} +0 -0
  262. /package/src/commands/app/tools/{snapshot.ts → create-snapshot-tool.ts} +0 -0
  263. /package/src/commands/app/tools/{type-text.ts → create-type-text-tool.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentBrowserToolRegistry.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/AgentBrowserToolRegistry.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,wBAAwB;IAClB,KAAK,GAAyB,EAAE,CAAC;IAElD;;;;OAIG;IACH,OAAO,CAAC,IAAkC;QACxC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,GAAG,KAA2B;QACrC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,QAAQ;QACN,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;CACF"}
@@ -1,4 +1,4 @@
1
- import { appendFileSync, mkdirSync, writeFileSync } from 'node:fs';
1
+ import { appendFileSync, mkdirSync } from 'node:fs';
2
2
  import { dirname, isAbsolute, join } from 'node:path';
3
3
  /**
4
4
  * Resolves a path within a base directory, rejecting escapes.
@@ -15,52 +15,19 @@ import { dirname, isAbsolute, join } from 'node:path';
15
15
  function resolveSafe(baseDir, input) {
16
16
  // If the model echoed the full absolute path from the prompt, strip the base prefix.
17
17
  const relative = isAbsolute(input)
18
- ? input.startsWith(baseDir + '/') || input.startsWith(baseDir + '\\')
18
+ ? input.startsWith(`${baseDir}/`) || input.startsWith(`${baseDir}\\`)
19
19
  ? input.slice(baseDir.length + 1)
20
20
  : (() => {
21
21
  throw new Error(`Absolute path outside output directory: ${input}`);
22
22
  })()
23
23
  : input;
24
24
  const resolved = join(baseDir, relative);
25
+ // Reject any resolved path that escapes the allowed base directory
25
26
  if (!resolved.startsWith(baseDir)) {
26
27
  throw new Error(`Path escapes the output directory: ${input}`);
27
28
  }
28
29
  return resolved;
29
30
  }
30
- /**
31
- * Creates the write-file tool so the agent can save artifacts
32
- * (plan.json, verdict.json, etc.) to the run output directory.
33
- *
34
- * @param baseDir - The run output directory that scopes all writes
35
- * @param defineTool - Copilot SDK helper used to declare tools
36
- * @returns Copilot tool definition for writing a file
37
- */
38
- export function createWriteFileTool(baseDir, defineTool) {
39
- return defineTool('write_file', {
40
- description: 'Write content to a file in the output directory. Creates parent directories as needed.',
41
- parameters: {
42
- type: 'object',
43
- properties: {
44
- path: {
45
- type: 'string',
46
- description: 'File path relative to the output directory (e.g. "plan.json")',
47
- },
48
- content: {
49
- type: 'string',
50
- description: 'The full file content to write',
51
- },
52
- },
53
- required: ['path', 'content'],
54
- },
55
- handler: async (args) => {
56
- const { path, content } = args;
57
- const resolved = resolveSafe(baseDir, path);
58
- mkdirSync(dirname(resolved), { recursive: true });
59
- writeFileSync(resolved, content);
60
- return `Wrote ${content.length} bytes to ${path}`;
61
- },
62
- });
63
- }
64
31
  /**
65
32
  * Creates the append-file tool so the agent can append lines
66
33
  * to artifacts like executions.jsonl.
@@ -90,9 +57,9 @@ export function createAppendFileTool(baseDir, defineTool) {
90
57
  const { path, content } = args;
91
58
  const resolved = resolveSafe(baseDir, path);
92
59
  mkdirSync(dirname(resolved), { recursive: true });
93
- appendFileSync(resolved, content.endsWith('\n') ? content : content + '\n');
60
+ appendFileSync(resolved, content.endsWith('\n') ? content : `${content}\n`);
94
61
  return `Appended to ${path}`;
95
62
  },
96
63
  });
97
64
  }
98
- //# sourceMappingURL=write-file.js.map
65
+ //# sourceMappingURL=create-append-file-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-append-file-tool.js","sourceRoot":"","sources":["../../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oBACd,WAAW,EAAE,+DAA+D;iBAC7E;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;SAC9B;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAyC,CAAC;YACpE,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC5C,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAClD,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;YAC5E,OAAO,eAAe,IAAI,EAAE,CAAC;QAC/B,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -24,4 +24,4 @@ export function createClickTool(context, defineTool) {
24
24
  },
25
25
  });
26
26
  }
27
- //# sourceMappingURL=click.js.map
27
+ //# sourceMappingURL=create-click-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-click-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-click-tool.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,OAAgC,EAAE,UAAsB;IACtF,OAAO,UAAU,CAAC,eAAe,EAAE;QACjC,WAAW,EAAE,6EAA6E;QAC1F,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,wDAAwD;iBACtE;aACF;YACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;SACrB;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,EAAE,MAAM,EAAE,GAAG,IAA0B,CAAC;YAC9C,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;QAC3C,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -21,4 +21,4 @@ export function createErrorsTool(context, defineTool) {
21
21
  },
22
22
  });
23
23
  }
24
- //# sourceMappingURL=errors.js.map
24
+ //# sourceMappingURL=create-errors-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-errors-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-errors-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgC,EAAE,UAAsB;IACvF,OAAO,UAAU,CAAC,gBAAgB,EAAE;QAClC,WAAW,EAAE,qDAAqD;QAClE,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE,EAAE;SACf;QACD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC1C,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YACnE,OAAO,MAAM,IAAI,WAAW,CAAC;QAC/B,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -33,4 +33,4 @@ export function createEvalJsTool(context, defineTool) {
33
33
  },
34
34
  });
35
35
  }
36
- //# sourceMappingURL=eval-js.js.map
36
+ //# sourceMappingURL=create-eval-js-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-eval-js-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-eval-js-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgC,EAAE,UAAsB;IACvF,OAAO,UAAU,CAAC,cAAc,EAAE;QAChC,WAAW,EACT,uOAAuO;QACzO,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,qGAAqG;iBACxG;aACF;YACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;SACrB;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,EAAE,MAAM,EAAE,GAAG,IAA0B,CAAC;YAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC1D,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;YAC7B,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,SAAS,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YAC/E,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -25,4 +25,4 @@ export function createFillTool(context, defineTool) {
25
25
  },
26
26
  });
27
27
  }
28
- //# sourceMappingURL=fill.js.map
28
+ //# sourceMappingURL=create-fill-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-fill-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-fill-tool.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,OAAgC,EAAE,UAAsB;IACrF,OAAO,UAAU,CAAC,cAAc,EAAE;QAChC,WAAW,EAAE,6DAA6D;QAC1E,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,iDAAiD;iBAC/D;gBACD,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;aACtE;YACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;SAC9B;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAyC,CAAC;YACpE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QACjD,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -31,14 +31,17 @@ export function createFindTool(context, defineTool) {
31
31
  handler: async (args) => {
32
32
  const { by, value, action, name, fillValue } = args;
33
33
  const command = ['find', by, value];
34
+ // Append optional refinements only when the caller actually provided them
34
35
  if (action)
35
36
  command.push(action);
37
+ // Attach the accessible-name filter when the caller supplied one
36
38
  if (name)
37
39
  command.push('--name', name);
40
+ // Attach the fill value when the action is 'fill'
38
41
  if (fillValue)
39
42
  command.push(fillValue);
40
43
  return context.invoke(command);
41
44
  },
42
45
  });
43
46
  }
44
- //# sourceMappingURL=find.js.map
47
+ //# sourceMappingURL=create-find-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-find-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-find-tool.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,OAAgC,EAAE,UAAsB;IACrF,OAAO,UAAU,CAAC,cAAc,EAAE;QAChC,WAAW,EACT,qGAAqG;QACvG,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,EAAE,EAAE;oBACF,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,0CAA0C;iBACxD;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,yDAAyD;iBACvE;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,sCAAsC;iBACpD;gBACD,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4CAA4C,EAAE;gBACnF,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sCAAsC,EAAE;aACnF;YACD,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC;SAC1B;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAM9C,CAAC;YACF,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;YACpC,0EAA0E;YAC1E,IAAI,MAAM;gBAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACjC,iEAAiE;YACjE,IAAI,IAAI;gBAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACvC,kDAAkD;YAClD,IAAI,SAAS;gBAAE,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACvC,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -33,4 +33,4 @@ export function createGetStylesTool(context, defineTool) {
33
33
  },
34
34
  });
35
35
  }
36
- //# sourceMappingURL=get-styles.js.map
36
+ //# sourceMappingURL=create-get-styles-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-get-styles-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-get-styles-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAgC,EAAE,UAAsB;IAC1F,OAAO,UAAU,CAAC,oBAAoB,EAAE;QACtC,WAAW,EACT,8NAA8N;QAChO,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,0FAA0F;iBAC7F;aACF;YACD,QAAQ,EAAE,CAAC,UAAU,CAAC;SACvB;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,EAAE,QAAQ,EAAE,GAAG,IAA4B,CAAC;YAClD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;YAC3D,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvE,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,YAAY,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YACnF,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -21,4 +21,4 @@ export function createGetUrlTool(context, defineTool) {
21
21
  },
22
22
  });
23
23
  }
24
- //# sourceMappingURL=get-url.js.map
24
+ //# sourceMappingURL=create-get-url-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-get-url-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-get-url-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgC,EAAE,UAAsB;IACvF,OAAO,UAAU,CAAC,iBAAiB,EAAE;QACnC,WAAW,EAAE,2BAA2B;QACxC,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE,EAAE;SACf;QACD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;YAC9C,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YAChE,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -12,4 +12,4 @@ export function createGoBackTool(context, defineTool) {
12
12
  handler: async () => context.invoke(['back']),
13
13
  });
14
14
  }
15
- //# sourceMappingURL=go-back.js.map
15
+ //# sourceMappingURL=create-go-back-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-go-back-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-go-back-tool.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgC,EAAE,UAAsB;IACvF,OAAO,UAAU,CAAC,iBAAiB,EAAE;QACnC,WAAW,EAAE,mCAAmC;QAChD,UAAU,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE,UAAU,EAAE,EAAE,EAAE;QACvD,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;KAC9C,CAAC,CAAC;AACL,CAAC"}
@@ -21,4 +21,4 @@ export function createHoverTool(context, defineTool) {
21
21
  },
22
22
  });
23
23
  }
24
- //# sourceMappingURL=hover.js.map
24
+ //# sourceMappingURL=create-hover-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-hover-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-hover-tool.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,OAAgC,EAAE,UAAsB;IACtF,OAAO,UAAU,CAAC,eAAe,EAAE;QACjC,WAAW,EAAE,wBAAwB;QACrC,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6BAA6B,EAAE;aACvE;YACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;SACrB;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,EAAE,MAAM,EAAE,GAAG,IAA0B,CAAC;YAC9C,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;QAC3C,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -28,4 +28,4 @@ export function createNavigateTool(context, defineTool) {
28
28
  },
29
29
  });
30
30
  }
31
- //# sourceMappingURL=navigate.js.map
31
+ //# sourceMappingURL=create-navigate-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-navigate-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-navigate-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAI/D;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAgC,EAAE,UAAsB;IACzF,OAAO,UAAU,CAAC,kBAAkB,EAAE;QACpC,WAAW,EAAE,kFAAkF;QAC/F,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;aAC/D;YACD,QAAQ,EAAE,CAAC,KAAK,CAAC;SAClB;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,EAAE,GAAG,EAAE,GAAG,IAAuB,CAAC;YACxC,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;gBACtD,OAAO,MAAM,IAAI,qBAAqB,CAAC;YACzC,CAAC;oBAAS,CAAC;gBACT,oBAAoB,EAAE,CAAC;YACzB,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -21,4 +21,4 @@ export function createPressKeyTool(context, defineTool) {
21
21
  },
22
22
  });
23
23
  }
24
- //# sourceMappingURL=press-key.js.map
24
+ //# sourceMappingURL=create-press-key-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-press-key-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-press-key-tool.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAgC,EAAE,UAAsB;IACzF,OAAO,UAAU,CAAC,mBAAmB,EAAE;QACrC,WAAW,EAAE,6DAA6D;QAC1E,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oCAAoC,EAAE;aAC3E;YACD,QAAQ,EAAE,CAAC,KAAK,CAAC;SAClB;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,EAAE,GAAG,EAAE,GAAG,IAAuB,CAAC;YACxC,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;QACxC,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -20,13 +20,14 @@ const IMAGE_MIME = {
20
20
  */
21
21
  function resolveSafe(baseDir, input) {
22
22
  const relative = isAbsolute(input)
23
- ? input.startsWith(baseDir + '/') || input.startsWith(baseDir + '\\')
23
+ ? input.startsWith(`${baseDir}/`) || input.startsWith(`${baseDir}\\`)
24
24
  ? input.slice(baseDir.length + 1)
25
25
  : (() => {
26
26
  throw new Error(`Absolute path outside output directory: ${input}`);
27
27
  })()
28
28
  : input;
29
29
  const resolved = join(baseDir, relative);
30
+ // Reject any resolved path that escapes the allowed base directory
30
31
  if (!resolved.startsWith(baseDir)) {
31
32
  throw new Error(`Path escapes the output directory: ${input}`);
32
33
  }
@@ -61,6 +62,7 @@ export function createReadFileTool(baseDir, defineTool) {
61
62
  handler: async (args) => {
62
63
  const { path } = args;
63
64
  const resolved = resolveSafe(baseDir, path);
65
+ // Report a friendly message instead of throwing when the path doesn't exist
64
66
  if (!existsSync(resolved)) {
65
67
  return `File not found: ${path}`;
66
68
  }
@@ -95,4 +97,4 @@ export function createReadFileTool(baseDir, defineTool) {
95
97
  },
96
98
  });
97
99
  }
98
- //# sourceMappingURL=read-file.js.map
100
+ //# sourceMappingURL=create-read-file-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-read-file-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-read-file-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAMhE,iFAAiF;AACjF,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE7E,8CAA8C;AAC9C,MAAM,UAAU,GAA2B;IACzC,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,YAAY;CACtB,CAAC;AAEF;;;;;;;GAOG;AACH,SA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12
  handler: async () => context.invoke(['reload']),
13
13
  });
14
14
  }
15
- //# sourceMappingURL=reload.js.map
15
+ //# sourceMappingURL=create-reload-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-reload-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-reload-tool.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgC,EAAE,UAAsB;IACvF,OAAO,UAAU,CAAC,gBAAgB,EAAE;QAClC,WAAW,EAAE,0BAA0B;QACvC,UAAU,EAAE,EAAE,IAAI,EAAE,QAAiB,EAAE,UAAU,EAAE,EAAE,EAAE;QACvD,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC;KAChD,CAAC,CAAC;AACL,CAAC"}
@@ -17,14 +17,17 @@ function resolveScreenshotFormat(format) {
17
17
  * @returns Safe filename with the correct extension, or `undefined` when no path was provided
18
18
  */
19
19
  function resolveScreenshotArtifactName(requestedPath, format) {
20
+ // No requested path means the caller doesn't need a specific artifact name
20
21
  if (!requestedPath)
21
22
  return undefined;
22
23
  const fileName = basename(requestedPath);
23
24
  const currentExtension = extname(fileName).toLowerCase();
24
25
  const expectedExtension = format === 'jpeg' ? '.jpg' : '.png';
26
+ // The extension already matches the selected format; reuse it verbatim
25
27
  if (currentExtension === expectedExtension) {
26
28
  return fileName;
27
29
  }
30
+ // Swap a mismatched extension for the one that matches the selected format
28
31
  if (currentExtension.length > 0) {
29
32
  return `${fileName.slice(0, -currentExtension.length)}${expectedExtension}`;
30
33
  }
@@ -38,6 +41,7 @@ function resolveScreenshotArtifactName(requestedPath, format) {
38
41
  * @returns Absolute screenshot directory constrained to the evidence directory tree
39
42
  */
40
43
  function resolveScreenshotDirectory(evidenceDir, requestedDirectory) {
44
+ // No requested directory means the default evidence directory is used
41
45
  if (!requestedDirectory) {
42
46
  return evidenceDir;
43
47
  }
@@ -117,9 +121,11 @@ export function createScreenshotTool(context, defineTool) {
117
121
  '--screenshot-dir',
118
122
  screenshotDirectory,
119
123
  ];
124
+ // Overlay numbered element labels only when the model explicitly asked for it
120
125
  if (annotate) {
121
126
  command.push('--annotate');
122
127
  }
128
+ // JPEG quality only applies when the selected format is actually JPEG
123
129
  if (screenshotFormat === 'jpeg') {
124
130
  const screenshotQuality = Math.min(100, Math.max(0, quality ?? 60));
125
131
  command.push('--screenshot-quality', String(screenshotQuality));
@@ -130,4 +136,4 @@ export function createScreenshotTool(context, defineTool) {
130
136
  },
131
137
  });
132
138
  }
133
- //# sourceMappingURL=screenshot.js.map
139
+ //# sourceMappingURL=create-screenshot-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-screenshot-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-screenshot-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAM5E;;;;;GAKG;AACH,SAAS,uBAAuB,CAAC,MAA0B;IACzD,OAAO,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AAC3C,CAAC;AAED;;;;;;GAMG;AACH,SAAS,6BAA6B,CACpC,aAAiC,EACjC,MAAsB;IAEtB,2EAA2E;IAC3E,IAAI,CAAC,aAAa;QAAE,OAAO,SAAS,CAAC;IACrC,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;IACzC,MAAM,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;IACzD,MAAM,iBAAiB,GAAG,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IAE9D,uEAA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AK,CAAC,CAAC,CAAC,KAAK,EAAE,CAC1F,CAAC;YACF,MAAM,OAAO,GAAG;gBACd,YAAY;gBACZ,qBAAqB;gBACrB,gBAAgB;gBAChB,kBAAkB;gBAClB,mBAAmB;aACpB,CAAC;YAEF,8EAA8E;YAC9E,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC7B,CAAC;YAED,sEAAsE;YACtE,IAAI,gBAAgB,KAAK,MAAM,EAAE,CAAC;gBAChC,MAAM,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;gBACpE,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;YAClE,CAAC;YAED,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;YAC7B,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAEhC,OAAO,qBAAqB,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;QACjE,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -27,15 +27,17 @@ export function createScrollTool(context, defineTool) {
27
27
  },
28
28
  handler: async (args) => {
29
29
  const { direction, amount, target } = args;
30
+ // A target ref overrides plain direction/amount scrolling
30
31
  if (target) {
31
32
  return context.invoke(['scrollintoview', target]);
32
33
  }
33
34
  const scrollDirection = direction ?? 'down';
34
35
  const command = ['scroll', scrollDirection];
36
+ // Only pass an explicit pixel amount when the caller provided one
35
37
  if (amount)
36
38
  command.push(String(amount));
37
39
  return context.invoke(command);
38
40
  },
39
41
  });
40
42
  }
41
- //# sourceMappingURL=scroll.js.map
43
+ //# sourceMappingURL=create-scroll-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-scroll-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-scroll-tool.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgC,EAAE,UAAsB;IACvF,OAAO,UAAU,CAAC,gBAAgB,EAAE;QAClC,WAAW,EAAE,iDAAiD;QAC9D,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kCAAkC;iBAChD;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,iDAAiD;iBAC/D;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,8DAA8D;iBAC5E;aACF;SACF;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAIrC,CAAC;YACF,0DAA0D;YAC1D,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;YACpD,CAAC;YACD,MAAM,eAAe,GAAG,SAAS,IAAI,MAAM,CAAC;YAC5C,MAAM,OAAO,GAAG,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;YAC5C,kEAAkE;YAClE,IAAI,MAAM;gBAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;YACzC,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -22,4 +22,4 @@ export function createSelectTool(context, defineTool) {
22
22
  },
23
23
  });
24
24
  }
25
- //# sourceMappingURL=select.js.map
25
+ //# sourceMappingURL=create-select-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-select-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-select-tool.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgC,EAAE,UAAsB;IACvF,OAAO,UAAU,CAAC,gBAAgB,EAAE;QAClC,WAAW,EAAE,kDAAkD;QAC/D,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4CAA4C,EAAE;gBACrF,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wCAAwC,EAAE;aACjF;YACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;SAC9B;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAyC,CAAC;YACpE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QACnD,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -21,4 +21,4 @@ export function createSnapshotTool(context, defineTool) {
21
21
  },
22
22
  });
23
23
  }
24
- //# sourceMappingURL=snapshot.js.map
24
+ //# sourceMappingURL=create-snapshot-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-snapshot-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-snapshot-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAgC,EAAE,UAAsB;IACzF,OAAO,UAAU,CAAC,kBAAkB,EAAE;QACpC,WAAW,EACT,uLAAuL;QACzL,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE,EAAE;SACf;QACD,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;YACnD,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YACrE,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -26,4 +26,4 @@ export function createTypeTextTool(context, defineTool) {
26
26
  },
27
27
  });
28
28
  }
29
- //# sourceMappingURL=type-text.js.map
29
+ //# sourceMappingURL=create-type-text-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-type-text-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-type-text-tool.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,OAAgC,EAAE,UAAsB;IACzF,OAAO,UAAU,CAAC,cAAc,EAAE;QAChC,WAAW,EAAE,kFAAkF;QAC/F,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,iEAAiE;iBAC/E;gBACD,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE;aACtD;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAyC,CAAC;YACnE,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;YAC7E,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -22,12 +22,16 @@ export function createWaitTool(context, defineTool) {
22
22
  },
23
23
  handler: async (args) => {
24
24
  const { text, selector, load, timeout } = args;
25
+ // Prefer whichever single wait condition the caller specified, in priority order
25
26
  if (text)
26
27
  return context.invoke(['wait', '--text', text], 60_000);
28
+ // Fall back to waiting on a page load state
27
29
  if (load)
28
30
  return context.invoke(['wait', '--load', load], 60_000);
31
+ // Fall back to waiting on a specific element/selector
29
32
  if (selector)
30
33
  return context.invoke(['wait', selector], 60_000);
34
+ // A plain timeout falls back to a bare delay instead of an invoke command
31
35
  if (timeout) {
32
36
  await new Promise((resolve) => setTimeout(resolve, timeout));
33
37
  return `Waited ${timeout}ms`;
@@ -36,4 +40,4 @@ export function createWaitTool(context, defineTool) {
36
40
  },
37
41
  });
38
42
  }
39
- //# sourceMappingURL=wait.js.map
43
+ //# sourceMappingURL=create-wait-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-wait-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-wait-tool.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,OAAgC,EAAE,UAAsB;IACrF,OAAO,UAAU,CAAC,cAAc,EAAE;QAChC,WAAW,EACT,gGAAgG;QAClG,UAAU,EAAE;YACV,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0CAA0C,EAAE;gBACjF,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2CAA2C,EAAE;gBACtF,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,wEAAwE;iBACtF;gBACD,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iCAAiC,EAAE;aAC5E;SACF;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;YACtB,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAKzC,CAAC;YACF,iFAAiF;YACjF,IAAI,IAAI;gBAAE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;YAClE,4CAA4C;YAC5C,IAAI,IAAI;gBAAE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;YAClE,sDAAsD;YACtD,IAAI,QAAQ;gBAAE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;YAChE,0EAA0E;YAC1E,IAAI,OAAO,EAAE,CAAC;gBACZ,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC7D,OAAO,UAAU,OAAO,IAAI,CAAC;YAC/B,CAAC;YACD,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE,MAAM,CAAC,CAAC;QACnE,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { mkdirSync, writeFileSync } from 'node:fs';
2
+ import { dirname, isAbsolute, join } from 'node:path';
3
+ /**
4
+ * Resolves a path within a base directory, rejecting escapes.
5
+ *
6
+ * Accepts both relative paths and absolute paths that fall within
7
+ * the base directory. Strips the base prefix from absolute paths
8
+ * before resolving to handle models that echo full paths from prompts.
9
+ *
10
+ * @param baseDir - The allowed root directory
11
+ * @param input - The user-provided path (relative or absolute within baseDir)
12
+ * @returns The resolved absolute path
13
+ * @throws {Error} When the path escapes the base directory
14
+ */
15
+ function resolveSafe(baseDir, input) {
16
+ // If the model echoed the full absolute path from the prompt, strip the base prefix.
17
+ const relative = isAbsolute(input)
18
+ ? input.startsWith(`${baseDir}/`) || input.startsWith(`${baseDir}\\`)
19
+ ? input.slice(baseDir.length + 1)
20
+ : (() => {
21
+ throw new Error(`Absolute path outside output directory: ${input}`);
22
+ })()
23
+ : input;
24
+ const resolved = join(baseDir, relative);
25
+ // Reject any resolved path that escapes the allowed base directory
26
+ if (!resolved.startsWith(baseDir)) {
27
+ throw new Error(`Path escapes the output directory: ${input}`);
28
+ }
29
+ return resolved;
30
+ }
31
+ /**
32
+ * Creates the write-file tool so the agent can save artifacts
33
+ * (plan.json, verdict.json, etc.) to the run output directory.
34
+ *
35
+ * @param baseDir - The run output directory that scopes all writes
36
+ * @param defineTool - Copilot SDK helper used to declare tools
37
+ * @returns Copilot tool definition for writing a file
38
+ */
39
+ export function createWriteFileTool(baseDir, defineTool) {
40
+ return defineTool('write_file', {
41
+ description: 'Write content to a file in the output directory. Creates parent directories as needed.',
42
+ parameters: {
43
+ type: 'object',
44
+ properties: {
45
+ path: {
46
+ type: 'string',
47
+ description: 'File path relative to the output directory (e.g. "plan.json")',
48
+ },
49
+ content: {
50
+ type: 'string',
51
+ description: 'The full file content to write',
52
+ },
53
+ },
54
+ required: ['path', 'content'],
55
+ },
56
+ handler: async (args) => {
57
+ const { path, content } = args;
58
+ const resolved = resolveSafe(baseDir, path);
59
+ mkdirSync(dirname(resolved), { recursive: true });
60
+ writeFileSync(resolved, content);
61
+ return `Wrote ${content.length} bytes to ${path}`;
62
+ },
63
+ });
64
+ }
65
+ //# sourceMappingURL=create-write-file-tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-write-file-tool.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/create-write-file-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI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M,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAyC,CAAC;YACpE,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC5C,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAClD,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACjC,OAAO,SAAS,OAAO,CAAC,MAAM,aAAa,IAAI,EAAE,CAAC;QACpD,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -1,22 +1,22 @@
1
- import { createClickTool } from './click.js';
2
- import { createErrorsTool } from './errors.js';
3
- import { createFillTool } from './fill.js';
4
- import { createFindTool } from './find.js';
5
- import { createGetUrlTool } from './get-url.js';
6
- import { createGoBackTool } from './go-back.js';
7
- import { createHoverTool } from './hover.js';
8
- import { createNavigateTool } from './navigate.js';
9
- import { createPressKeyTool } from './press-key.js';
10
- import { createReloadTool } from './reload.js';
11
- import { createEvalJsTool } from './eval-js.js';
12
- import { createGetStylesTool } from './get-styles.js';
13
- import { AgentBrowserToolRegistry } from './registry.js';
14
- import { createScreenshotTool } from './screenshot.js';
15
- import { createScrollTool } from './scroll.js';
16
- import { createSelectTool } from './select.js';
17
- import { createSnapshotTool } from './snapshot.js';
18
- import { createTypeTextTool } from './type-text.js';
19
- import { createWaitTool } from './wait.js';
1
+ import { createClickTool } from './create-click-tool.js';
2
+ import { createErrorsTool } from './create-errors-tool.js';
3
+ import { createFillTool } from './create-fill-tool.js';
4
+ import { createFindTool } from './create-find-tool.js';
5
+ import { createGetUrlTool } from './create-get-url-tool.js';
6
+ import { createGoBackTool } from './create-go-back-tool.js';
7
+ import { createHoverTool } from './create-hover-tool.js';
8
+ import { createNavigateTool } from './create-navigate-tool.js';
9
+ import { createPressKeyTool } from './create-press-key-tool.js';
10
+ import { createReloadTool } from './create-reload-tool.js';
11
+ import { createEvalJsTool } from './create-eval-js-tool.js';
12
+ import { createGetStylesTool } from './create-get-styles-tool.js';
13
+ import { AgentBrowserToolRegistry } from './AgentBrowserToolRegistry.js';
14
+ import { createScreenshotTool } from './create-screenshot-tool.js';
15
+ import { createScrollTool } from './create-scroll-tool.js';
16
+ import { createSelectTool } from './create-select-tool.js';
17
+ import { createSnapshotTool } from './create-snapshot-tool.js';
18
+ import { createTypeTextTool } from './create-type-text-tool.js';
19
+ import { createWaitTool } from './create-wait-tool.js';
20
20
  /**
21
21
  * Creates the full set of Copilot browser tools for an eval session.
22
22
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/commands/app/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aA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AC,OAAO,EAAE,UAAU,CAAC,EACvC,oBAAoB,CAAC,OAAO,EAAE,UAAU,CAAC,EACzC,mBAAmB,CAAC,OAAO,EAAE,UAAU,CAAC,EACxC,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,EACrC,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC,EACpC,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,EACnC,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC,EACvC,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC,EACvC,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC,EACpC,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,EACrC,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,EACrC,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,EACnC,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,EACnC,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,EACrC,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,EACrC,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,EACrC,gBAAgB,CAAC,OAAO,EAAE,UAAU,CAAC,CACtC,CAAC;IAEF,OAAO,YAAY,CAAC,QAAQ,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Truncates a string to a maximum length, appending an ellipsis when cut.
3
+ *
4
+ * @param str - The string to truncate.
5
+ * @param max - Maximum length of the returned string, including the ellipsis.
6
+ * @returns The original string, or a shortened version ending in `…`.
7
+ */
8
+ export function truncate(str, max) {
9
+ return str.length > max ? `${str.slice(0, max - 1)}…` : str;
10
+ }
11
+ //# sourceMappingURL=truncate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"truncate.js","sourceRoot":"","sources":["../../../../src/commands/app/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW,EAAE,GAAW;IAC/C,OAAO,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { formatPlan } from './format-plan.js';
2
+ import { formatStepResult } from './format-step-result.js';
3
+ import { formatVerdict } from './format-verdict.js';
4
+ /**
5
+ * Attempts to detect the JSON shape of an assistant message and format it.
6
+ *
7
+ * Returns `null` when the content is not a recognised structure, so the
8
+ * caller can fall back to plain-text rendering.
9
+ *
10
+ * @param content - Raw assistant message content, expected to be a JSON string.
11
+ * @returns A formatted string for a recognised plan, step result, or verdict, or `null` otherwise.
12
+ */
13
+ export function tryFormatMessage(content) {
14
+ let parsed;
15
+ try {
16
+ parsed = JSON.parse(content.trim());
17
+ }
18
+ catch {
19
+ return null;
20
+ }
21
+ // Only object shapes can be matched against the recognised message formats
22
+ if (!parsed || typeof parsed !== 'object')
23
+ return null;
24
+ // Verdict: { pass, reasoning, steps[] }
25
+ if ('pass' in parsed && 'steps' in parsed && Array.isArray(parsed.steps)) {
26
+ return formatVerdict(parsed);
27
+ }
28
+ // Plan: { summary, steps[] }
29
+ if ('summary' in parsed && 'steps' in parsed && Array.isArray(parsed.steps)) {
30
+ return formatPlan(parsed);
31
+ }
32
+ // Step result: { criterion, ok, note }
33
+ if ('criterion' in parsed && 'ok' in parsed && 'note' in parsed) {
34
+ return formatStepResult(parsed);
35
+ }
36
+ // No recognised shape matched; caller should fall back to plain-text rendering
37
+ return null;
38
+ }
39
+ //# sourceMappingURL=try-format-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"try-format-message.js","sourceRoot":"","sources":["../../../../src/commands/app/try-format-message.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,2EAA2E;IAC3E,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAEvD,wCAAwC;IACxC,IAAI,MAAM,IAAI,MAAM,IAAI,OAAO,IAAI,MAAM,IAAI,KAAK,CAAC,OAAO,CAAE,MAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;QACtF,OAAO,aAAa,CAAC,MAAiB,CAAC,CAAC;IAC1C,CAAC;IAED,6BAA6B;IAC7B,IAAI,SAAS,IAAI,MAAM,IAAI,OAAO,IAAI,MAAM,IAAI,KAAK,CAAC,OAAO,CAAE,MAAe,CAAC,KAAK,CAAC,EAAE,CAAC;QACtF,OAAO,UAAU,CAAC,MAAc,CAAC,CAAC;IACpC,CAAC;IAED,uCAAuC;IACvC,IAAI,WAAW,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;QAChE,OAAO,gBAAgB,CAAC,MAAoB,CAAC,CAAC;IAChD,CAAC;IAED,+EAA+E;IAC/E,OAAO,IAAI,CAAC;AACd,CAAC"}