orbitx 0.0.7 → 0.0.9

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 (398) hide show
  1. package/Readme.md +227 -67
  2. package/dist/core/agent-providers.d.ts +16 -0
  3. package/dist/core/agent-providers.d.ts.map +1 -0
  4. package/dist/core/agent-providers.js +21 -0
  5. package/dist/core/agent-providers.js.map +1 -0
  6. package/dist/core/ai-provider.d.ts +69 -1
  7. package/dist/core/ai-provider.d.ts.map +1 -1
  8. package/dist/core/ai-provider.js.map +1 -1
  9. package/dist/core/base-agent.d.ts +8 -4
  10. package/dist/core/base-agent.d.ts.map +1 -1
  11. package/dist/core/base-agent.js +220 -88
  12. package/dist/core/base-agent.js.map +1 -1
  13. package/dist/core/deepseek-provider.d.ts +10 -3
  14. package/dist/core/deepseek-provider.d.ts.map +1 -1
  15. package/dist/core/deepseek-provider.js +144 -39
  16. package/dist/core/deepseek-provider.js.map +1 -1
  17. package/dist/core/image-describer.d.ts +13 -0
  18. package/dist/core/image-describer.d.ts.map +1 -0
  19. package/dist/core/image-describer.js +33 -0
  20. package/dist/core/image-describer.js.map +1 -0
  21. package/dist/core/mcp-client.d.ts +17 -4
  22. package/dist/core/mcp-client.d.ts.map +1 -1
  23. package/dist/core/mcp-client.js +32 -16
  24. package/dist/core/mcp-client.js.map +1 -1
  25. package/dist/core/mcp-computer.d.ts +10 -2
  26. package/dist/core/mcp-computer.d.ts.map +1 -1
  27. package/dist/core/mcp-computer.js +108 -2
  28. package/dist/core/mcp-computer.js.map +1 -1
  29. package/dist/core/mcp-fs-storage.d.ts +8 -0
  30. package/dist/core/mcp-fs-storage.d.ts.map +1 -0
  31. package/dist/core/mcp-fs-storage.js +27 -0
  32. package/dist/core/mcp-fs-storage.js.map +1 -0
  33. package/dist/core/mcp-rng.d.ts +7 -0
  34. package/dist/core/mcp-rng.d.ts.map +1 -0
  35. package/dist/core/mcp-rng.js +14 -0
  36. package/dist/core/mcp-rng.js.map +1 -0
  37. package/dist/core/mcp-server.d.ts +8 -4
  38. package/dist/core/mcp-server.d.ts.map +1 -1
  39. package/dist/core/mcp-server.js +20 -3
  40. package/dist/core/mcp-server.js.map +1 -1
  41. package/dist/core/mcp-storage.d.ts +5 -0
  42. package/dist/core/mcp-storage.d.ts.map +1 -0
  43. package/dist/core/mcp-storage.js +3 -0
  44. package/dist/core/mcp-storage.js.map +1 -0
  45. package/dist/core/mcp.d.ts +37 -3
  46. package/dist/core/mcp.d.ts.map +1 -1
  47. package/dist/core/mcp.js +42 -1
  48. package/dist/core/mcp.js.map +1 -1
  49. package/dist/core/ollama-provider.d.ts +10 -3
  50. package/dist/core/ollama-provider.d.ts.map +1 -1
  51. package/dist/core/ollama-provider.js +122 -41
  52. package/dist/core/ollama-provider.js.map +1 -1
  53. package/dist/core/retry.d.ts +10 -0
  54. package/dist/core/retry.d.ts.map +1 -0
  55. package/dist/core/retry.js +39 -0
  56. package/dist/core/retry.js.map +1 -0
  57. package/dist/core/skill.d.ts +3 -0
  58. package/dist/core/skill.d.ts.map +1 -1
  59. package/dist/core/skill.js.map +1 -1
  60. package/dist/core/tool-schema-translator.d.ts +10 -0
  61. package/dist/core/tool-schema-translator.d.ts.map +1 -0
  62. package/dist/core/tool-schema-translator.js +29 -0
  63. package/dist/core/tool-schema-translator.js.map +1 -0
  64. package/dist/index.d.ts +34 -6
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +25 -5
  67. package/dist/index.js.map +1 -1
  68. package/dist/sandbox.d.ts +2 -0
  69. package/dist/sandbox.d.ts.map +1 -0
  70. package/dist/sandbox.js +27 -0
  71. package/dist/sandbox.js.map +1 -0
  72. package/dist/skills/backend-security.d.ts +4 -0
  73. package/dist/skills/backend-security.d.ts.map +1 -0
  74. package/dist/skills/backend-security.js +74 -0
  75. package/dist/skills/backend-security.js.map +1 -0
  76. package/dist/skills/big-task.d.ts +4 -0
  77. package/dist/skills/big-task.d.ts.map +1 -0
  78. package/dist/skills/big-task.js +66 -0
  79. package/dist/skills/big-task.js.map +1 -0
  80. package/dist/skills/code-verification.d.ts +4 -0
  81. package/dist/skills/code-verification.d.ts.map +1 -0
  82. package/dist/skills/code-verification.js +59 -0
  83. package/dist/skills/code-verification.js.map +1 -0
  84. package/dist/skills/long-task-efficiency.d.ts +4 -0
  85. package/dist/skills/long-task-efficiency.d.ts.map +1 -0
  86. package/dist/skills/long-task-efficiency.js +50 -0
  87. package/dist/skills/long-task-efficiency.js.map +1 -0
  88. package/dist/skills/node-backend.d.ts +4 -0
  89. package/dist/skills/node-backend.d.ts.map +1 -0
  90. package/dist/skills/node-backend.js +110 -0
  91. package/dist/skills/node-backend.js.map +1 -0
  92. package/dist/skills/planner.d.ts +4 -0
  93. package/dist/skills/planner.d.ts.map +1 -0
  94. package/dist/skills/planner.js +49 -0
  95. package/dist/skills/planner.js.map +1 -0
  96. package/dist/skills/present.d.ts +4 -0
  97. package/dist/skills/present.d.ts.map +1 -0
  98. package/dist/skills/present.js +56 -0
  99. package/dist/skills/present.js.map +1 -0
  100. package/dist/skills/question-answer.d.ts +4 -0
  101. package/dist/skills/question-answer.d.ts.map +1 -0
  102. package/dist/skills/question-answer.js +55 -0
  103. package/dist/skills/question-answer.js.map +1 -0
  104. package/dist/skills/react-frontend.d.ts +4 -0
  105. package/dist/skills/react-frontend.d.ts.map +1 -0
  106. package/dist/skills/react-frontend.js +111 -0
  107. package/dist/skills/react-frontend.js.map +1 -0
  108. package/dist/skills/research.d.ts +4 -0
  109. package/dist/skills/research.d.ts.map +1 -0
  110. package/dist/skills/research.js +81 -0
  111. package/dist/skills/research.js.map +1 -0
  112. package/dist/skills/shopping.d.ts +4 -0
  113. package/dist/skills/shopping.d.ts.map +1 -0
  114. package/dist/skills/shopping.js +71 -0
  115. package/dist/skills/shopping.js.map +1 -0
  116. package/dist/skills/ui-ux-design.d.ts +4 -0
  117. package/dist/skills/ui-ux-design.d.ts.map +1 -0
  118. package/dist/skills/ui-ux-design.js +70 -0
  119. package/dist/skills/ui-ux-design.js.map +1 -0
  120. package/dist/skills/web-end-to-end-test.d.ts +4 -0
  121. package/dist/skills/web-end-to-end-test.d.ts.map +1 -0
  122. package/dist/skills/web-end-to-end-test.js +76 -0
  123. package/dist/skills/web-end-to-end-test.js.map +1 -0
  124. package/dist/templates/simple.d.ts +1 -1
  125. package/dist/templates/simple.d.ts.map +1 -1
  126. package/dist/templates/simple.js +4 -0
  127. package/dist/templates/simple.js.map +1 -1
  128. package/dist/tests/mcp.test.js +2 -54
  129. package/dist/tests/mcp.test.js.map +1 -1
  130. package/dist/tools/bash/index.d.ts +10 -0
  131. package/dist/tools/bash/index.d.ts.map +1 -0
  132. package/dist/tools/bash/index.js +22 -0
  133. package/dist/tools/bash/index.js.map +1 -0
  134. package/dist/tools/bash/interaction.d.ts +29 -0
  135. package/dist/tools/bash/interaction.d.ts.map +1 -0
  136. package/dist/tools/bash/interaction.js +13 -0
  137. package/dist/tools/bash/interaction.js.map +1 -0
  138. package/dist/tools/bash/list.d.ts +4 -0
  139. package/dist/tools/bash/list.d.ts.map +1 -0
  140. package/dist/tools/bash/list.js +23 -0
  141. package/dist/tools/bash/list.js.map +1 -0
  142. package/dist/tools/bash/logs.d.ts +4 -0
  143. package/dist/tools/bash/logs.d.ts.map +1 -0
  144. package/dist/tools/bash/logs.js +47 -0
  145. package/dist/tools/bash/logs.js.map +1 -0
  146. package/dist/tools/bash/process-manager.d.ts +35 -0
  147. package/dist/tools/bash/process-manager.d.ts.map +1 -0
  148. package/dist/tools/bash/process-manager.js +137 -0
  149. package/dist/tools/bash/process-manager.js.map +1 -0
  150. package/dist/tools/bash/run.d.ts +5 -0
  151. package/dist/tools/bash/run.d.ts.map +1 -0
  152. package/dist/tools/bash/run.js +57 -0
  153. package/dist/tools/bash/run.js.map +1 -0
  154. package/dist/tools/bash/terminate.d.ts +5 -0
  155. package/dist/tools/bash/terminate.d.ts.map +1 -0
  156. package/dist/tools/bash/terminate.js +39 -0
  157. package/dist/tools/bash/terminate.js.map +1 -0
  158. package/dist/tools/bash/wait.d.ts +5 -0
  159. package/dist/tools/bash/wait.d.ts.map +1 -0
  160. package/dist/tools/bash/wait.js +50 -0
  161. package/dist/tools/bash/wait.js.map +1 -0
  162. package/dist/tools/bash/write-input.d.ts +5 -0
  163. package/dist/tools/bash/write-input.d.ts.map +1 -0
  164. package/dist/tools/bash/write-input.js +47 -0
  165. package/dist/tools/bash/write-input.js.map +1 -0
  166. package/dist/tools/browser/click.d.ts +5 -0
  167. package/dist/tools/browser/click.d.ts.map +1 -0
  168. package/dist/tools/browser/click.js +44 -0
  169. package/dist/tools/browser/click.js.map +1 -0
  170. package/dist/tools/browser/console.d.ts +4 -0
  171. package/dist/tools/browser/console.d.ts.map +1 -0
  172. package/dist/tools/browser/console.js +41 -0
  173. package/dist/tools/browser/console.js.map +1 -0
  174. package/dist/tools/browser/create-session.d.ts +5 -0
  175. package/dist/tools/browser/create-session.d.ts.map +1 -0
  176. package/dist/tools/browser/create-session.js +30 -0
  177. package/dist/tools/browser/create-session.js.map +1 -0
  178. package/dist/tools/browser/evaluate-safe.d.ts +10 -0
  179. package/dist/tools/browser/evaluate-safe.d.ts.map +1 -0
  180. package/dist/tools/browser/evaluate-safe.js +65 -0
  181. package/dist/tools/browser/evaluate-safe.js.map +1 -0
  182. package/dist/tools/browser/fill.d.ts +5 -0
  183. package/dist/tools/browser/fill.d.ts.map +1 -0
  184. package/dist/tools/browser/fill.js +78 -0
  185. package/dist/tools/browser/fill.js.map +1 -0
  186. package/dist/tools/browser/get-sessions.d.ts +4 -0
  187. package/dist/tools/browser/get-sessions.d.ts.map +1 -0
  188. package/dist/tools/browser/get-sessions.js +14 -0
  189. package/dist/tools/browser/get-sessions.js.map +1 -0
  190. package/dist/tools/browser/index.d.ts +19 -0
  191. package/dist/tools/browser/index.d.ts.map +1 -0
  192. package/dist/tools/browser/index.js +49 -0
  193. package/dist/tools/browser/index.js.map +1 -0
  194. package/dist/tools/browser/inject.d.ts +5 -0
  195. package/dist/tools/browser/inject.d.ts.map +1 -0
  196. package/dist/tools/browser/inject.js +51 -0
  197. package/dist/tools/browser/inject.js.map +1 -0
  198. package/dist/tools/browser/interaction.d.ts +49 -0
  199. package/dist/tools/browser/interaction.d.ts.map +1 -0
  200. package/dist/tools/browser/interaction.js +14 -0
  201. package/dist/tools/browser/interaction.js.map +1 -0
  202. package/dist/tools/browser/navigate.d.ts +5 -0
  203. package/dist/tools/browser/navigate.d.ts.map +1 -0
  204. package/dist/tools/browser/navigate.js +39 -0
  205. package/dist/tools/browser/navigate.js.map +1 -0
  206. package/dist/tools/browser/network-status.d.ts +4 -0
  207. package/dist/tools/browser/network-status.d.ts.map +1 -0
  208. package/dist/tools/browser/network-status.js +35 -0
  209. package/dist/tools/browser/network-status.js.map +1 -0
  210. package/dist/tools/browser/network.d.ts +4 -0
  211. package/dist/tools/browser/network.d.ts.map +1 -0
  212. package/dist/tools/browser/network.js +51 -0
  213. package/dist/tools/browser/network.js.map +1 -0
  214. package/dist/tools/browser/read-page.d.ts +45 -0
  215. package/dist/tools/browser/read-page.d.ts.map +1 -0
  216. package/dist/tools/browser/read-page.js +264 -0
  217. package/dist/tools/browser/read-page.js.map +1 -0
  218. package/dist/tools/browser/read.d.ts +5 -0
  219. package/dist/tools/browser/read.d.ts.map +1 -0
  220. package/dist/tools/browser/read.js +56 -0
  221. package/dist/tools/browser/read.js.map +1 -0
  222. package/dist/tools/browser/remove-session.d.ts +5 -0
  223. package/dist/tools/browser/remove-session.d.ts.map +1 -0
  224. package/dist/tools/browser/remove-session.js +29 -0
  225. package/dist/tools/browser/remove-session.js.map +1 -0
  226. package/dist/tools/browser/screenshot.d.ts +5 -0
  227. package/dist/tools/browser/screenshot.d.ts.map +1 -0
  228. package/dist/tools/browser/screenshot.js +50 -0
  229. package/dist/tools/browser/screenshot.js.map +1 -0
  230. package/dist/tools/browser/scroll-info.d.ts +4 -0
  231. package/dist/tools/browser/scroll-info.d.ts.map +1 -0
  232. package/dist/tools/browser/scroll-info.js +28 -0
  233. package/dist/tools/browser/scroll-info.js.map +1 -0
  234. package/dist/tools/browser/scroll.d.ts +5 -0
  235. package/dist/tools/browser/scroll.d.ts.map +1 -0
  236. package/dist/tools/browser/scroll.js +43 -0
  237. package/dist/tools/browser/scroll.js.map +1 -0
  238. package/dist/tools/browser/session-manager.d.ts +35 -0
  239. package/dist/tools/browser/session-manager.d.ts.map +1 -0
  240. package/dist/tools/browser/session-manager.js +101 -0
  241. package/dist/tools/browser/session-manager.js.map +1 -0
  242. package/dist/tools/browser/submit-form.d.ts +5 -0
  243. package/dist/tools/browser/submit-form.d.ts.map +1 -0
  244. package/dist/tools/browser/submit-form.js +45 -0
  245. package/dist/tools/browser/submit-form.js.map +1 -0
  246. package/dist/tools/fs/create-dir.d.ts +5 -0
  247. package/dist/tools/fs/create-dir.d.ts.map +1 -0
  248. package/dist/tools/fs/create-dir.js +28 -0
  249. package/dist/tools/fs/create-dir.js.map +1 -0
  250. package/dist/tools/fs/delete.d.ts +5 -0
  251. package/dist/tools/fs/delete.d.ts.map +1 -0
  252. package/dist/tools/fs/delete.js +45 -0
  253. package/dist/tools/fs/delete.js.map +1 -0
  254. package/dist/tools/fs/edit-file.d.ts +5 -0
  255. package/dist/tools/fs/edit-file.d.ts.map +1 -0
  256. package/dist/tools/fs/edit-file.js +74 -0
  257. package/dist/tools/fs/edit-file.js.map +1 -0
  258. package/dist/tools/fs/index.d.ts +11 -2
  259. package/dist/tools/fs/index.d.ts.map +1 -1
  260. package/dist/tools/fs/index.js +27 -2
  261. package/dist/tools/fs/index.js.map +1 -1
  262. package/dist/tools/fs/interaction.d.ts +37 -0
  263. package/dist/tools/fs/interaction.d.ts.map +1 -0
  264. package/dist/tools/fs/interaction.js +13 -0
  265. package/dist/tools/fs/interaction.js.map +1 -0
  266. package/dist/tools/fs/list-dir.d.ts +5 -0
  267. package/dist/tools/fs/list-dir.d.ts.map +1 -0
  268. package/dist/tools/fs/list-dir.js +87 -0
  269. package/dist/tools/fs/list-dir.js.map +1 -0
  270. package/dist/tools/fs/move.d.ts +5 -0
  271. package/dist/tools/fs/move.d.ts.map +1 -0
  272. package/dist/tools/fs/move.js +44 -0
  273. package/dist/tools/fs/move.js.map +1 -0
  274. package/dist/tools/fs/read-file.d.ts +4 -3
  275. package/dist/tools/fs/read-file.d.ts.map +1 -1
  276. package/dist/tools/fs/read-file.js +50 -42
  277. package/dist/tools/fs/read-file.js.map +1 -1
  278. package/dist/tools/fs/stat.d.ts +5 -0
  279. package/dist/tools/fs/stat.d.ts.map +1 -0
  280. package/dist/tools/fs/stat.js +40 -0
  281. package/dist/tools/fs/stat.js.map +1 -0
  282. package/dist/tools/fs/utils.d.ts +20 -0
  283. package/dist/tools/fs/utils.d.ts.map +1 -0
  284. package/dist/tools/fs/utils.js +33 -0
  285. package/dist/tools/fs/utils.js.map +1 -0
  286. package/dist/tools/fs/write-file.d.ts +4 -3
  287. package/dist/tools/fs/write-file.d.ts.map +1 -1
  288. package/dist/tools/fs/write-file.js +39 -58
  289. package/dist/tools/fs/write-file.js.map +1 -1
  290. package/dist/tools/present/add.d.ts +5 -0
  291. package/dist/tools/present/add.d.ts.map +1 -0
  292. package/dist/tools/present/add.js +54 -0
  293. package/dist/tools/present/add.js.map +1 -0
  294. package/dist/tools/present/clear.d.ts +5 -0
  295. package/dist/tools/present/clear.d.ts.map +1 -0
  296. package/dist/tools/present/clear.js +23 -0
  297. package/dist/tools/present/clear.js.map +1 -0
  298. package/dist/tools/present/get-list.d.ts +5 -0
  299. package/dist/tools/present/get-list.d.ts.map +1 -0
  300. package/dist/tools/present/get-list.js +24 -0
  301. package/dist/tools/present/get-list.js.map +1 -0
  302. package/dist/tools/present/index.d.ts +8 -0
  303. package/dist/tools/present/index.d.ts.map +1 -0
  304. package/dist/tools/present/index.js +14 -0
  305. package/dist/tools/present/index.js.map +1 -0
  306. package/dist/tools/present/interaction.d.ts +17 -0
  307. package/dist/tools/present/interaction.d.ts.map +1 -0
  308. package/dist/tools/present/interaction.js +15 -0
  309. package/dist/tools/present/interaction.js.map +1 -0
  310. package/dist/tools/present/utils.d.ts +12 -0
  311. package/dist/tools/present/utils.d.ts.map +1 -0
  312. package/dist/tools/present/utils.js +40 -0
  313. package/dist/tools/present/utils.js.map +1 -0
  314. package/dist/tools/question-answer/index.d.ts +5 -0
  315. package/dist/tools/question-answer/index.d.ts.map +1 -0
  316. package/dist/tools/question-answer/index.js +7 -0
  317. package/dist/tools/question-answer/index.js.map +1 -0
  318. package/dist/tools/question-answer/interaction.d.ts +14 -0
  319. package/dist/tools/question-answer/interaction.d.ts.map +1 -0
  320. package/dist/tools/question-answer/interaction.js +13 -0
  321. package/dist/tools/question-answer/interaction.js.map +1 -0
  322. package/dist/tools/question-answer/question-answer.d.ts +5 -0
  323. package/dist/tools/question-answer/question-answer.d.ts.map +1 -0
  324. package/dist/tools/question-answer/question-answer.js +24 -0
  325. package/dist/tools/question-answer/question-answer.js.map +1 -0
  326. package/dist/tools/todo/check-task.d.ts +5 -0
  327. package/dist/tools/todo/check-task.d.ts.map +1 -0
  328. package/dist/tools/todo/check-task.js +49 -0
  329. package/dist/tools/todo/check-task.js.map +1 -0
  330. package/dist/tools/todo/create-list.d.ts +5 -0
  331. package/dist/tools/todo/create-list.d.ts.map +1 -0
  332. package/dist/tools/todo/create-list.js +36 -0
  333. package/dist/tools/todo/create-list.js.map +1 -0
  334. package/dist/tools/todo/create-task.d.ts +5 -0
  335. package/dist/tools/todo/create-task.d.ts.map +1 -0
  336. package/dist/tools/todo/create-task.js +63 -0
  337. package/dist/tools/todo/create-task.js.map +1 -0
  338. package/dist/tools/todo/get-list.d.ts +4 -0
  339. package/dist/tools/todo/get-list.d.ts.map +1 -0
  340. package/dist/tools/todo/get-list.js +38 -0
  341. package/dist/tools/todo/get-list.js.map +1 -0
  342. package/dist/tools/todo/get-lists.d.ts +4 -0
  343. package/dist/tools/todo/get-lists.d.ts.map +1 -0
  344. package/dist/tools/todo/get-lists.js +18 -0
  345. package/dist/tools/todo/get-lists.js.map +1 -0
  346. package/dist/tools/todo/index.d.ts +12 -0
  347. package/dist/tools/todo/index.d.ts.map +1 -0
  348. package/dist/tools/todo/index.js +25 -0
  349. package/dist/tools/todo/index.js.map +1 -0
  350. package/dist/tools/todo/interaction.d.ts +30 -0
  351. package/dist/tools/todo/interaction.d.ts.map +1 -0
  352. package/dist/tools/todo/interaction.js +13 -0
  353. package/dist/tools/todo/interaction.js.map +1 -0
  354. package/dist/tools/todo/remove-list.d.ts +5 -0
  355. package/dist/tools/todo/remove-list.d.ts.map +1 -0
  356. package/dist/tools/todo/remove-list.js +42 -0
  357. package/dist/tools/todo/remove-list.js.map +1 -0
  358. package/dist/tools/todo/remove-task.d.ts +5 -0
  359. package/dist/tools/todo/remove-task.d.ts.map +1 -0
  360. package/dist/tools/todo/remove-task.js +45 -0
  361. package/dist/tools/todo/remove-task.js.map +1 -0
  362. package/dist/tools/todo/storage.d.ts +22 -0
  363. package/dist/tools/todo/storage.d.ts.map +1 -0
  364. package/dist/tools/todo/storage.js +44 -0
  365. package/dist/tools/todo/storage.js.map +1 -0
  366. package/dist/tools/utils/delay.d.ts +10 -0
  367. package/dist/tools/utils/delay.d.ts.map +1 -0
  368. package/dist/tools/utils/delay.js +33 -0
  369. package/dist/tools/utils/delay.js.map +1 -0
  370. package/dist/tools/utils/get-current-time.d.ts +7 -2
  371. package/dist/tools/utils/get-current-time.d.ts.map +1 -1
  372. package/dist/tools/utils/get-current-time.js +12 -31
  373. package/dist/tools/utils/get-current-time.js.map +1 -1
  374. package/dist/tools/utils/index.d.ts +2 -0
  375. package/dist/tools/utils/index.d.ts.map +1 -1
  376. package/dist/tools/utils/index.js +7 -0
  377. package/dist/tools/utils/index.js.map +1 -1
  378. package/package.json +54 -56
  379. package/dist/templates/researcher.d.ts +0 -27
  380. package/dist/templates/researcher.d.ts.map +0 -1
  381. package/dist/templates/researcher.js +0 -70
  382. package/dist/templates/researcher.js.map +0 -1
  383. package/dist/tools/www/fetch.d.ts +0 -4
  384. package/dist/tools/www/fetch.d.ts.map +0 -1
  385. package/dist/tools/www/fetch.js +0 -147
  386. package/dist/tools/www/fetch.js.map +0 -1
  387. package/dist/tools/www/index.d.ts +0 -4
  388. package/dist/tools/www/index.d.ts.map +0 -1
  389. package/dist/tools/www/index.js +0 -4
  390. package/dist/tools/www/index.js.map +0 -1
  391. package/dist/tools/www/read-web-page.d.ts +0 -4
  392. package/dist/tools/www/read-web-page.d.ts.map +0 -1
  393. package/dist/tools/www/read-web-page.js +0 -330
  394. package/dist/tools/www/read-web-page.js.map +0 -1
  395. package/dist/tools/www/web-search.d.ts +0 -4
  396. package/dist/tools/www/web-search.d.ts.map +0 -1
  397. package/dist/tools/www/web-search.js +0 -82
  398. package/dist/tools/www/web-search.js.map +0 -1
@@ -0,0 +1,5 @@
1
+ import { MCPTool } from "../../core/mcp.js";
2
+ import { FsInteraction } from "./interaction.js";
3
+ export declare const FsMoveTool: () => MCPTool<FsInteraction>;
4
+ export default FsMoveTool;
5
+ //# sourceMappingURL=move.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/move.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,eAAO,MAAM,UAAU,8BA4CrB,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -0,0 +1,44 @@
1
+ import { rename, mkdir } from "fs/promises";
2
+ import { dirname } from "path";
3
+ import { MCPTool } from "../../core/mcp.js";
4
+ import { FsInteraction } from "./interaction.js";
5
+ import { resolvePath } from "./utils.js";
6
+ export const FsMoveTool = () => new MCPTool({
7
+ name: "fs-move",
8
+ description: "move or rename a file or directory",
9
+ inputs: [
10
+ {
11
+ name: "from",
12
+ type: "string",
13
+ description: "absolute or cwd-relative source path",
14
+ required: true,
15
+ },
16
+ {
17
+ name: "to",
18
+ type: "string",
19
+ description: "absolute or cwd-relative destination path",
20
+ required: true,
21
+ },
22
+ ],
23
+ customClass: new FsInteraction(),
24
+ execute: async (_envID, inputs, _mcp, customClass) => {
25
+ const { from, to } = inputs;
26
+ const fullFrom = resolvePath(from);
27
+ const fullTo = resolvePath(to);
28
+ customClass?.emitFsEvent({ type: "moving", from: fullFrom, to: fullTo });
29
+ await mkdir(dirname(fullTo), { recursive: true });
30
+ try {
31
+ await rename(fullFrom, fullTo);
32
+ }
33
+ catch (err) {
34
+ if (err.code === "ENOENT")
35
+ throw new Error(`no file or directory found at "${from}"`);
36
+ throw err;
37
+ }
38
+ return {
39
+ message: "success",
40
+ };
41
+ },
42
+ });
43
+ export default FsMoveTool;
44
+ //# sourceMappingURL=move.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"move.js","sourceRoot":"","sources":["../../../src/tools/fs/move.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAgB;IACvD,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,oCAAoC;IACjD,MAAM,EAAE;QACJ;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,IAAI;SACjB;QACD;YACI,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,2CAA2C;YACxD,QAAQ,EAAE,IAAI;SACjB;KACJ;IACD,WAAW,EAAE,IAAI,aAAa,EAAE;IAChC,OAAO,EAAE,KAAK,EACV,MAAc,EACd,MAA2B,EAC3B,IAAU,EACV,WAA2B,EACf,EAAE;QACd,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;QAE5B,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,MAAM,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;QAE/B,WAAW,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;QAEzE,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAElD,IAAI,CAAC;YACD,MAAM,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAChB,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;gBAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,IAAI,GAAG,CAAC,CAAC;YACtF,MAAM,GAAG,CAAC;QACd,CAAC;QAED,OAAO;YACH,OAAO,EAAE,SAAS;SACrB,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -1,4 +1,5 @@
1
- import MCPTool from "../../core/mcp.js";
2
- export declare const ReadFileTool: MCPTool;
3
- export default ReadFileTool;
1
+ import { MCPTool } from "../../core/mcp.js";
2
+ import { FsInteraction } from "./interaction.js";
3
+ export declare const FsReadFileTool: () => MCPTool<FsInteraction>;
4
+ export default FsReadFileTool;
4
5
  //# sourceMappingURL=read-file.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/read-file.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAIxC,eAAO,MAAM,YAAY,SA+CvB,CAAC;AAEH,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/read-file.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,eAAO,MAAM,cAAc,8BA0DzB,CAAC;AAEH,eAAe,cAAc,CAAC"}
@@ -1,49 +1,57 @@
1
- import MCPTool from "../../core/mcp.js";
2
- import fs from "fs/promises";
3
- import path from "path";
4
- export const ReadFileTool = new MCPTool({
5
- name: "read-file",
6
- description: "Reads text content from a file at the specified path.",
7
- inputs: [{
8
- name: "filePath",
1
+ import { readFile } from "fs/promises";
2
+ import { MCPTool } from "../../core/mcp.js";
3
+ import { FsInteraction } from "./interaction.js";
4
+ import { resolvePath, toLines, paginateLines } from "./utils.js";
5
+ export const FsReadFileTool = () => new MCPTool({
6
+ name: "fs-read-file",
7
+ description: "read a text file from disk, optionally paging through it by line so large files never need to be read in one shot",
8
+ inputs: [
9
+ {
10
+ name: "path",
9
11
  type: "string",
10
- description: `Absolute or relative path to the file (e.g., "/home/user/doc.txt" or "./file.txt")`,
12
+ description: "absolute or cwd-relative path to the file",
11
13
  required: true,
12
- }],
13
- execute: async (_, inputs) => {
14
+ },
15
+ {
16
+ name: "offsetLine",
17
+ type: "number",
18
+ description: "line offset to start reading from",
19
+ required: false,
20
+ default: 0,
21
+ },
22
+ {
23
+ name: "limitLine",
24
+ type: "number",
25
+ description: "max number of lines to return",
26
+ required: false,
27
+ default: 2000,
28
+ },
29
+ ],
30
+ customClass: new FsInteraction(),
31
+ execute: async (_envID, inputs, _mcp, customClass) => {
32
+ const { path, offsetLine = 0, limitLine = 2000 } = inputs;
33
+ const fullPath = resolvePath(path);
34
+ customClass?.emitFsEvent({ type: "reading", path: fullPath });
35
+ let raw;
14
36
  try {
15
- const { filePath } = inputs;
16
- if (!filePath || typeof filePath !== "string") {
17
- throw new Error("filePath must be a non-empty string");
18
- }
19
- const normalizedPath = path.normalize(filePath);
20
- const data = await fs.readFile(normalizedPath, "utf-8");
21
- return {
22
- message: `File read successfully: ${normalizedPath}`,
23
- path: normalizedPath,
24
- content: data,
25
- size: data.length
26
- };
37
+ raw = await readFile(fullPath, { encoding: "utf-8" });
27
38
  }
28
- catch (error) {
29
- let errorMessage = error instanceof Error ? error.message : String(error);
30
- if (error instanceof Error && "code" in error) {
31
- const err = error;
32
- if (err.code === "ENOENT") {
33
- errorMessage = `File not found: ${inputs.filePath}`;
34
- }
35
- else if (err.code === "EACCES") {
36
- errorMessage = `Permission denied: ${inputs.filePath}`;
37
- }
38
- else if (err.code === "EISDIR") {
39
- errorMessage = `Path is a directory, not a file: ${inputs.filePath}`;
40
- }
41
- }
42
- return {
43
- error: errorMessage
44
- };
39
+ catch (err) {
40
+ if (err.code === "ENOENT")
41
+ throw new Error(`no file found at "${path}"`);
42
+ if (err.code === "EISDIR")
43
+ throw new Error(`"${path}" is a directory, not a file`);
44
+ throw err;
45
45
  }
46
- }
46
+ const lines = toLines(raw);
47
+ const { content, totalLines, startLine, endLine } = paginateLines(lines, offsetLine, limitLine);
48
+ return {
49
+ content,
50
+ totalLines,
51
+ startLine,
52
+ endLine,
53
+ };
54
+ },
47
55
  });
48
- export default ReadFileTool;
56
+ export default FsReadFileTool;
49
57
  //# sourceMappingURL=read-file.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"read-file.js","sourceRoot":"","sources":["../../../src/tools/fs/read-file.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC;IACpC,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,uDAAuD;IACpE,MAAM,EAAE,CAAC;YACL,IAAI,EAAE,UAAU;YACh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MAAM,CAAC;QAE1D,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAEnC,WAAW,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QAE9D,IAAI,GAAW,CAAC;QAChB,IAAI,CAAC;YACD,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QAC1D,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAChB,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;gBAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,GAAG,CAAC,CAAC;YACzE,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;gBAAE,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,8BAA8B,CAAC,CAAC;YACnF,MAAM,GAAG,CAAC;QACd,CAAC;QAED,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3B,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;QAEhG,OAAO;YACH,OAAO;YACP,UAAU;YACV,SAAS;YACT,OAAO;SACV,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { MCPTool } from "../../core/mcp.js";
2
+ import { FsInteraction } from "./interaction.js";
3
+ export declare const FsStatTool: () => MCPTool<FsInteraction>;
4
+ export default FsStatTool;
5
+ //# sourceMappingURL=stat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stat.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/stat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,eAAO,MAAM,UAAU,8BAwCrB,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { stat } from "fs/promises";
2
+ import { MCPTool } from "../../core/mcp.js";
3
+ import { FsInteraction } from "./interaction.js";
4
+ import { resolvePath } from "./utils.js";
5
+ export const FsStatTool = () => new MCPTool({
6
+ name: "fs-stat",
7
+ description: "check whether a path exists and get its metadata (type, size, modified time)",
8
+ inputs: [
9
+ {
10
+ name: "path",
11
+ type: "string",
12
+ description: "absolute or cwd-relative path to inspect",
13
+ required: true,
14
+ },
15
+ ],
16
+ customClass: new FsInteraction(),
17
+ execute: async (_envID, inputs, _mcp, customClass) => {
18
+ const { path } = inputs;
19
+ const fullPath = resolvePath(path);
20
+ customClass?.emitFsEvent({ type: "stat", path: fullPath });
21
+ try {
22
+ const s = await stat(fullPath);
23
+ return {
24
+ exists: true,
25
+ type: s.isDirectory() ? "directory" : s.isSymbolicLink() ? "symlink" : "file",
26
+ size: s.size,
27
+ modifiedAt: s.mtime.toISOString(),
28
+ createdAt: s.birthtime.toISOString(),
29
+ };
30
+ }
31
+ catch (err) {
32
+ if (err.code === "ENOENT") {
33
+ return { exists: false };
34
+ }
35
+ throw err;
36
+ }
37
+ },
38
+ });
39
+ export default FsStatTool;
40
+ //# sourceMappingURL=stat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stat.js","sourceRoot":"","sources":["../../../src/tools/fs/stat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAgB;IACvD,IAAI,EAAE,S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paths
3
+ * are resolved against process.cwd() so agent-provided paths behave the same
4
+ * regardless of where the host process was started from.
5
+ */
6
+ export declare function resolvePath(path: string): string;
7
+ /** Splits text into lines the same way across every fs tool (handles \r\n). */
8
+ export declare function toLines(content: string): string[];
9
+ /**
10
+ * Slices an array of lines by offset/limit, clamping to bounds, and returns
11
+ * both the slice and the total line count so callers can page through large
12
+ * files without ever loading the whole thing into a response.
13
+ */
14
+ export declare function paginateLines(lines: string[], offsetLine: number, limitLine: number): {
15
+ content: string;
16
+ totalLines: number;
17
+ startLine: number;
18
+ endLine: number;
19
+ };
20
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/utils.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKhD;AAED,+EAA+E;AAC/E,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;EAUnF"}
@@ -0,0 +1,33 @@
1
+ import { resolve } from "path";
2
+ /**
3
+ * Normalizes a user/agent supplied path to an absolute path. Relative paths
4
+ * are resolved against process.cwd() so agent-provided paths behave the same
5
+ * regardless of where the host process was started from.
6
+ */
7
+ export function resolvePath(path) {
8
+ if (!path || typeof path !== "string") {
9
+ throw new Error("path must be a non-empty string");
10
+ }
11
+ return resolve(process.cwd(), path);
12
+ }
13
+ /** Splits text into lines the same way across every fs tool (handles \r\n). */
14
+ export function toLines(content) {
15
+ return content.split(/\r\n|\r|\n/);
16
+ }
17
+ /**
18
+ * Slices an array of lines by offset/limit, clamping to bounds, and returns
19
+ * both the slice and the total line count so callers can page through large
20
+ * files without ever loading the whole thing into a response.
21
+ */
22
+ export function paginateLines(lines, offsetLine, limitLine) {
23
+ const totalLines = lines.length;
24
+ const start = Math.max(0, Math.min(offsetLine, totalLines));
25
+ const end = Math.max(start, Math.min(start + limitLine, totalLines));
26
+ return {
27
+ content: lines.slice(start, end).join("\n"),
28
+ totalLines,
29
+ startLine: start,
30
+ endLine: end,
31
+ };
32
+ }
33
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/tools/fs/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY;IACpC,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,OAAO,CAAC,OAAe;IACnC,OAAO,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;AACvC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAe,EAAE,UAAkB,EAAE,SAAiB;IAChF,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;IAC5D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACrE,OAAO;QACH,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC3C,UAAU;QACV,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,GAAG;KACf,CAAC;AACN,CAAC"}
@@ -1,4 +1,5 @@
1
- import MCPTool from "../../core/mcp.js";
2
- export declare const WriteFileTool: MCPTool;
3
- export default WriteFileTool;
1
+ import { MCPTool } from "../../core/mcp.js";
2
+ import { FsInteraction } from "./interaction.js";
3
+ export declare const FsWriteFileTool: () => MCPTool<FsInteraction>;
4
+ export default FsWriteFileTool;
4
5
  //# sourceMappingURL=write-file.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"write-file.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/write-file.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAIxC,eAAO,MAAM,aAAa,SAkExB,CAAC;AAEH,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"write-file.d.ts","sourceRoot":"","sources":["../../../src/tools/fs/write-file.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,eAAO,MAAM,eAAe,8BAqD1B,CAAC;AAEH,eAAe,eAAe,CAAC"}
@@ -1,68 +1,49 @@
1
- import MCPTool from "../../core/mcp.js";
2
- import fs from "fs/promises";
3
- import path from "path";
4
- export const WriteFileTool = new MCPTool({
5
- name: "write-file",
6
- description: "Writes text content to a file at the specified path. Creates new file or overwrites existing.",
7
- inputs: [{
8
- name: "filePath",
1
+ import { writeFile, mkdir } from "fs/promises";
2
+ import { dirname } from "path";
3
+ import { MCPTool } from "../../core/mcp.js";
4
+ import { FsInteraction } from "./interaction.js";
5
+ import { resolvePath } from "./utils.js";
6
+ export const FsWriteFileTool = () => new MCPTool({
7
+ name: "fs-write-file",
8
+ description: "write text content to a file, overwriting it if it already exists (or creating it, along with any missing parent directories, if it doesn't). USE WITH CAUTION: this permanently overwrites existing file content with no undo.",
9
+ inputs: [
10
+ {
11
+ name: "path",
9
12
  type: "string",
10
- description: `Absolute or relative path to the file (e.g., "/home/user/doc.txt" or "./file.txt")`,
13
+ description: "absolute or cwd-relative path to the file",
11
14
  required: true,
12
15
  },
13
16
  {
14
- name: "data",
17
+ name: "content",
15
18
  type: "string",
16
- description: "Text content to write (supports multi-line)",
19
+ description: "full text content to write",
17
20
  required: true,
18
- }],
19
- execute: async (_, inputs) => {
20
- try {
21
- const { filePath, data } = inputs;
22
- if (!filePath || typeof filePath !== "string") {
23
- throw new Error("filePath must be a non-empty string");
24
- }
25
- if (typeof data !== "string") {
26
- throw new Error("data must be a string");
27
- }
28
- const normalizedPath = path.normalize(filePath);
29
- const dir = path.dirname(normalizedPath);
30
- await fs.mkdir(dir, { recursive: true });
31
- await fs.writeFile(normalizedPath, data, "utf-8");
32
- return {
33
- message: `File written: ${normalizedPath}`,
34
- path: normalizedPath,
35
- size: data.length
36
- };
21
+ },
22
+ {
23
+ name: "createDirs",
24
+ type: "boolean",
25
+ description: "create missing parent directories if needed",
26
+ required: false,
27
+ default: true,
28
+ },
29
+ ],
30
+ customClass: new FsInteraction(),
31
+ execute: async (_envID, inputs, _mcp, customClass) => {
32
+ const { path, content, createDirs = true } = inputs;
33
+ if (typeof content !== "string") {
34
+ throw new Error("content must be a string");
37
35
  }
38
- catch (error) {
39
- let errorMessage = error instanceof Error ? error.message : String(error);
40
- if (error instanceof Error && "code" in error) {
41
- const err = error;
42
- if (err.code === "EACCES") {
43
- errorMessage = `Permission denied: Cannot write to ${inputs.filePath}`;
44
- }
45
- else if (err.code === "ENOENT") {
46
- errorMessage = `Directory does not exist or cannot be created: ${path.dirname(inputs.filePath)}`;
47
- }
48
- else if (err.code === "EISDIR") {
49
- errorMessage = `Path is a directory, cannot write file: ${inputs.filePath}`;
50
- }
51
- else if (err.code === "ENOSPC") {
52
- errorMessage = `No space left on device: Cannot write to ${inputs.filePath}`;
53
- }
54
- else if (err.code === "EROFS") {
55
- errorMessage = `Read-only file system: Cannot write to ${inputs.filePath}`;
56
- }
57
- else if (err.code === "ENAMETOOLONG") {
58
- errorMessage = `File path is too long: ${inputs.filePath}`;
59
- }
60
- }
61
- return {
62
- error: errorMessage
63
- };
36
+ const fullPath = resolvePath(path);
37
+ customClass?.emitFsEvent({ type: "writing", path: fullPath });
38
+ if (createDirs) {
39
+ await mkdir(dirname(fullPath), { recursive: true });
64
40
  }
65
- }
41
+ await writeFile(fullPath, content, { encoding: "utf-8" });
42
+ return {
43
+ message: "success",
44
+ bytesWritten: Buffer.byteLength(content, "utf-8"),
45
+ };
46
+ },
66
47
  });
67
- export default WriteFileTool;
48
+ export default FsWriteFileTool;
68
49
  //# sourceMappingURL=write-file.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"write-file.js","sourceRoot":"","sources":["../../../src/tools/fs/write-file.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC;IACrC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,+FAA+F;IAC5G,MAAM,EAAE,CAAC;YACL,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,oFAAoF;YACjG,QAAQ,EAAE,IAAI;SACjB;QACD;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,IAAI;SACjB,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,CAAS,EAAE,MAA2B,EAAgB,EAAE;QACpE,IAAI,CAAC;YACD,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;YAElC,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBAC5C,MAAM,IAAI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;YACzC,QAAQ,EAAE,IAAI;SACjB;QACD;YACI,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,SAAS;YACf,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,IAAI;SAChB;KACJ;IACD,WAAW,EAAE,IAAI,aAAa,EAAE;IAChC,OAAO,EAAE,KAAK,EACV,MAAc,EACd,MAA2B,EAC3B,IAAU,EACV,WAA2B,EACf,EAAE;QACd,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAEpD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAEnC,WAAW,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QAE9D,IAAI,UAAU,EAAE,CAAC;YACb,MAAM,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,CAAC;QAED,MAAM,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QAE1D,OAAO;YACH,OAAO,EAAE,SAAS;YAClB,YAAY,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC;SACpD,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH,eAAe,eAAe,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { MCPTool } from "../../core/mcp.js";
2
+ import { PresentInteraction } from "./interaction.js";
3
+ export declare const PresentAddTool: () => MCPTool<PresentInteraction>;
4
+ export default PresentAddTool;
5
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/tools/present/add.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,eAAO,MAAM,cAAc,mCA6DzB,CAAC;AAEH,eAAe,cAAc,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { copyFile, stat } from "fs/promises";
2
+ import { basename, join, resolve } from "path";
3
+ import { MCPTool } from "../../core/mcp.js";
4
+ import { PresentInteraction } from "./interaction.js";
5
+ import { ensurePresentFolder, listPresentFiles } from "./utils.js";
6
+ export const PresentAddTool = () => new MCPTool({
7
+ name: "present-add",
8
+ description: "present a file to the user by copying it into the present folder so the host application can surface it (e.g. as a download link or preview). " +
9
+ "the path MUST point to a single file, never a directory/folder — if you want to present a whole folder, zip it first (e.g. with the bash/shell tool) and pass the path to the resulting .zip file instead. " +
10
+ "call this once per file you want to present; presenting multiple files just means calling present-add multiple times.",
11
+ inputs: [
12
+ {
13
+ name: "path",
14
+ type: "string",
15
+ description: "absolute or cwd-relative path to the FILE to present (not a directory)",
16
+ required: true,
17
+ },
18
+ ],
19
+ customClass: new PresentInteraction(),
20
+ execute: async (_envID, inputs, _mcp, customClass) => {
21
+ const { path } = inputs;
22
+ if (!path || typeof path !== "string") {
23
+ throw new Error("path must be a non-empty string");
24
+ }
25
+ const sourcePath = resolve(process.cwd(), path);
26
+ let sourceStat;
27
+ try {
28
+ sourceStat = await stat(sourcePath);
29
+ }
30
+ catch (err) {
31
+ if (err.code === "ENOENT")
32
+ throw new Error(`no file found at "${path}"`);
33
+ throw err;
34
+ }
35
+ if (sourceStat.isDirectory()) {
36
+ throw new Error(`"${path}" is a directory — presents must be files. zip the folder first and present the .zip file instead.`);
37
+ }
38
+ const presentFolder = await ensurePresentFolder();
39
+ const destPath = join(presentFolder, basename(sourcePath));
40
+ // Copy via Node's fs API only — never shell out for this, so the
41
+ // present folder's contents are always exactly what was requested.
42
+ await copyFile(sourcePath, destPath);
43
+ const paths = await listPresentFiles();
44
+ // Emitted AFTER the copy completes, so anything listening always
45
+ // sees an up-to-date present folder the moment it's notified.
46
+ customClass?.emitPresentEvent({ type: "presents-updated", paths });
47
+ return {
48
+ message: "success",
49
+ path: destPath,
50
+ };
51
+ },
52
+ });
53
+ export default PresentAddTool;
54
+ //# sourceMappingURL=add.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/tools/present/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnE,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAqB;IAChE,IAAI,EAAE,aAAa;IACnB,WAAW,EACP,gJAAgJ;QAChJ,6MAA6M;QAC7M,uHAAuH;IAC3H,MAAM,EAAE;QACJ;YACI,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,wEAAwE;YACrF,QAAQ,EAAE,IAAI;SACjB;KACJ;IACD,WAAW,EAAE,IAAI,kBAAkB,EAAE;IACrC,OAAO,EAAE,KAAK,EACV,MAAc,EACd,MAA2B,EAC3B,IAAU,EACV,WAAgC,EACpB,EAAE;QACd,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;QAExB,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACvD,CAAC;QAED,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC;QAEhD,IAAI,UAAU,CAAC;QACf,IAAI,CAAC;YACD,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC;QACxC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAChB,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ;gBAAE,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,GAAG,CAAC,CAAC;YACzE,MAAM,GAAG,CAAC;QACd,CAAC;QAED,IAAI,UAAU,CAAC,WAAW,EAAE,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CACX,IAAI,IAAI,oGAAoG,CAC/G,CAAC;QACN,CAAC;QAED,MAAM,aAAa,GAAG,MAAM,mBAAmB,EAAE,CAAC;QAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;QAE3D,iEAAiE;QACjE,mEAAmE;QACnE,MAAM,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAErC,MAAM,KAAK,GAAG,MAAM,gBAAgB,EAAE,CAAC;QAEvC,iEAAiE;QACjE,8DAA8D;QAC9D,WAAW,EAAE,gBAAgB,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC,CAAC;QAEnE,OAAO;YACH,OAAO,EAAE,SAAS;YAClB,IAAI,EAAE,QAAQ;SACjB,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH,eAAe,cAAc,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { MCPTool } from "../../core/mcp.js";
2
+ import { PresentInteraction } from "./interaction.js";
3
+ export declare const PresentClearTool: () => MCPTool<PresentInteraction>;
4
+ export default PresentClearTool;
5
+ //# sourceMappingURL=clear.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../../src/tools/present/clear.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,mCAwB3B,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { rm } from "fs/promises";
2
+ import { MCPTool } from "../../core/mcp.js";
3
+ import { PresentInteraction } from "./interaction.js";
4
+ import { listPresentFiles } from "./utils.js";
5
+ export const PresentClearTool = () => new MCPTool({
6
+ name: "present-clear",
7
+ description: "remove every file currently presented to the user, emptying the present folder. use this to clear out stale presents before presenting a fresh set.",
8
+ inputs: [],
9
+ customClass: new PresentInteraction(),
10
+ execute: async (_envID, _inputs, _mcp, customClass) => {
11
+ const existing = await listPresentFiles();
12
+ await Promise.all(existing.map((path) => rm(path, { force: true })));
13
+ // Present folder is now empty; still emit so listeners can
14
+ // immediately reflect that nothing is presented anymore.
15
+ customClass?.emitPresentEvent({ type: "presents-updated", paths: [] });
16
+ return {
17
+ message: "success",
18
+ removed: existing.length,
19
+ };
20
+ },
21
+ });
22
+ export default PresentClearTool;
23
+ //# sourceMappingURL=clear.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clear.js","sourceRoot":"","sources":["../../../src/tools/present/clear.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAqB;IAClE,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,qJAAqJ;IAClK,MAAM,EAAE,EAAE;IACV,WAAW,EAAE,IAAI,kBAAkB,EAAE;IACrC,OAAO,EAAE,KAAK,EACV,MAAc,EACd,OAA4B,EAC5B,IAAU,EACV,WAAgC,EACpB,EAAE;QACd,MAAM,QAAQ,GAAG,MAAM,gBAAgB,EAAE,CAAC;QAE1C,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAErE,2DAA2D;QAC3D,yDAAyD;QACzD,WAAW,EAAE,gBAAgB,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;QAEvE,OAAO;YACH,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE,QAAQ,CAAC,MAAM;SAC3B,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { MCPTool } from "../../core/mcp.js";
2
+ import { PresentInteraction } from "./interaction.js";
3
+ export declare const PresentGetListTool: () => MCPTool<PresentInteraction>;
4
+ export default PresentGetListTool;
5
+ //# sourceMappingURL=get-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-list.d.ts","sourceRoot":"","sources":["../../../src/tools/present/get-list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,eAAO,MAAM,kBAAkB,mCAqB7B,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { basename } from "path";
2
+ import { MCPTool } from "../../core/mcp.js";
3
+ import { PresentInteraction } from "./interaction.js";
4
+ import { listPresentFiles, fileSize } from "./utils.js";
5
+ export const PresentGetListTool = () => new MCPTool({
6
+ name: "present-get-list",
7
+ description: "get the list of files currently presented to the user (their paths inside the present folder)",
8
+ inputs: [],
9
+ customClass: new PresentInteraction(),
10
+ execute: async () => {
11
+ const paths = await listPresentFiles();
12
+ const files = await Promise.all(paths.map(async (path) => ({
13
+ name: basename(path),
14
+ path,
15
+ size: await fileSize(path),
16
+ })));
17
+ return {
18
+ files,
19
+ total: files.length,
20
+ };
21
+ },
22
+ });
23
+ export default PresentGetListTool;
24
+ //# sourceMappingURL=get-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-list.js","sourceRoot":"","sources":["../../../src/tools/present/get-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE,CAAC,IAAI,OAAO,CAAqB;IACpE,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,+FAA+F;IAC5G,MAAM,EAAE,EAAE;IACV,WAAW,EAAE,IAAI,kBAAkB,EAAE;IACrC,OAAO,EAAE,KAAK,IAAkB,EAAE;QAC9B,MAAM,KAAK,GAAG,MAAM,gBAAgB,EAAE,CAAC;QAEvC,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,GAAG,CAC3B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;YACvB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;YACpB,IAAI;YACJ,IAAI,EAAE,MAAM,QAAQ,CAAC,IAAI,CAAC;SAC7B,CAAC,CAAC,CACN,CAAC;QAEF,OAAO;YACH,KAAK;YACL,KAAK,EAAE,KAAK,CAAC,MAAM;SACtB,CAAC;IACN,CAAC;CACJ,CAAC,CAAC;AAEH,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { PresentAddTool } from "./add.js";
2
+ export { PresentClearTool } from "./clear.js";
3
+ export { PresentGetListTool } from "./get-list.js";
4
+ export { PresentInteraction } from "./interaction.js";
5
+ export type { PresentEvent } from "./interaction.js";
6
+ export { getPresentFolder } from "./utils.js";
7
+ export declare const PresentTools: () => import("../../index.js").MCPTool<import("./interaction.js").PresentInteraction>[];
8
+ //# sourceMappingURL=index.d.ts.map