@n1k1t/pipelain 0.1.0 → 0.1.1

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 (301) hide show
  1. package/lib/src/env.d.ts +20 -0
  2. package/lib/src/env.d.ts.map +1 -0
  3. package/lib/src/env.js +36 -0
  4. package/lib/src/env.js.map +1 -0
  5. package/lib/src/index.d.ts +22 -0
  6. package/lib/src/index.d.ts.map +1 -0
  7. package/lib/src/index.js +61 -0
  8. package/lib/src/index.js.map +1 -0
  9. package/lib/src/models/bash.d.ts +27 -0
  10. package/lib/src/models/bash.d.ts.map +1 -0
  11. package/lib/src/models/bash.js +59 -0
  12. package/lib/src/models/bash.js.map +1 -0
  13. package/lib/src/models/content/factory.d.ts +36 -0
  14. package/lib/src/models/content/factory.d.ts.map +1 -0
  15. package/lib/src/models/content/factory.js +104 -0
  16. package/lib/src/models/content/factory.js.map +1 -0
  17. package/lib/src/models/content/index.d.ts +4 -0
  18. package/lib/src/models/content/index.d.ts.map +1 -0
  19. package/lib/src/models/content/index.js +20 -0
  20. package/lib/src/models/content/index.js.map +1 -0
  21. package/lib/src/models/content/kinds/article.d.ts +12 -0
  22. package/lib/src/models/content/kinds/article.d.ts.map +1 -0
  23. package/lib/src/models/content/kinds/article.js +20 -0
  24. package/lib/src/models/content/kinds/article.js.map +1 -0
  25. package/lib/src/models/content/kinds/attachment.d.ts +14 -0
  26. package/lib/src/models/content/kinds/attachment.d.ts.map +1 -0
  27. package/lib/src/models/content/kinds/attachment.js +30 -0
  28. package/lib/src/models/content/kinds/attachment.js.map +1 -0
  29. package/lib/src/models/content/kinds/group.d.ts +7 -0
  30. package/lib/src/models/content/kinds/group.d.ts.map +1 -0
  31. package/lib/src/models/content/kinds/group.js +23 -0
  32. package/lib/src/models/content/kinds/group.js.map +1 -0
  33. package/lib/src/models/content/kinds/index.d.ts +8 -0
  34. package/lib/src/models/content/kinds/index.d.ts.map +1 -0
  35. package/lib/src/models/content/kinds/index.js +24 -0
  36. package/lib/src/models/content/kinds/index.js.map +1 -0
  37. package/lib/src/models/content/kinds/model.d.ts +10 -0
  38. package/lib/src/models/content/kinds/model.d.ts.map +1 -0
  39. package/lib/src/models/content/kinds/model.js +11 -0
  40. package/lib/src/models/content/kinds/model.js.map +1 -0
  41. package/lib/src/models/content/kinds/plain.d.ts +6 -0
  42. package/lib/src/models/content/kinds/plain.d.ts.map +1 -0
  43. package/lib/src/models/content/kinds/plain.js +18 -0
  44. package/lib/src/models/content/kinds/plain.js.map +1 -0
  45. package/lib/src/models/content/kinds/rules.d.ts +6 -0
  46. package/lib/src/models/content/kinds/rules.d.ts.map +1 -0
  47. package/lib/src/models/content/kinds/rules.js +19 -0
  48. package/lib/src/models/content/kinds/rules.js.map +1 -0
  49. package/lib/src/models/content/kinds/sources.d.ts +10 -0
  50. package/lib/src/models/content/kinds/sources.d.ts.map +1 -0
  51. package/lib/src/models/content/kinds/sources.js +22 -0
  52. package/lib/src/models/content/kinds/sources.js.map +1 -0
  53. package/lib/src/models/content/kinds/tasks.d.ts +6 -0
  54. package/lib/src/models/content/kinds/tasks.d.ts.map +1 -0
  55. package/lib/src/models/content/kinds/tasks.js +19 -0
  56. package/lib/src/models/content/kinds/tasks.js.map +1 -0
  57. package/lib/src/models/file.d.ts +34 -0
  58. package/lib/src/models/file.d.ts.map +1 -0
  59. package/lib/src/models/file.js +101 -0
  60. package/lib/src/models/file.js.map +1 -0
  61. package/lib/src/models/index.d.ts +9 -0
  62. package/lib/src/models/index.d.ts.map +1 -0
  63. package/lib/src/models/index.js +25 -0
  64. package/lib/src/models/index.js.map +1 -0
  65. package/lib/src/models/llm/factory.d.ts +43 -0
  66. package/lib/src/models/llm/factory.d.ts.map +1 -0
  67. package/lib/src/models/llm/factory.js +134 -0
  68. package/lib/src/models/llm/factory.js.map +1 -0
  69. package/lib/src/models/llm/index.d.ts +9 -0
  70. package/lib/src/models/llm/index.d.ts.map +1 -0
  71. package/lib/src/models/llm/index.js +25 -0
  72. package/lib/src/models/llm/index.js.map +1 -0
  73. package/lib/src/models/llm/mcp.d.ts +30 -0
  74. package/lib/src/models/llm/mcp.d.ts.map +1 -0
  75. package/lib/src/models/llm/mcp.js +53 -0
  76. package/lib/src/models/llm/mcp.js.map +1 -0
  77. package/lib/src/models/llm/providers/anthropic.d.ts +15 -0
  78. package/lib/src/models/llm/providers/anthropic.d.ts.map +1 -0
  79. package/lib/src/models/llm/providers/anthropic.js +39 -0
  80. package/lib/src/models/llm/providers/anthropic.js.map +1 -0
  81. package/lib/src/models/llm/providers/google.d.ts +11 -0
  82. package/lib/src/models/llm/providers/google.d.ts.map +1 -0
  83. package/lib/src/models/llm/providers/google.js +39 -0
  84. package/lib/src/models/llm/providers/google.js.map +1 -0
  85. package/lib/src/models/llm/providers/index.d.ts +6 -0
  86. package/lib/src/models/llm/providers/index.d.ts.map +1 -0
  87. package/lib/src/models/llm/providers/index.js +22 -0
  88. package/lib/src/models/llm/providers/index.js.map +1 -0
  89. package/lib/src/models/llm/providers/mistral.d.ts +10 -0
  90. package/lib/src/models/llm/providers/mistral.d.ts.map +1 -0
  91. package/lib/src/models/llm/providers/mistral.js +31 -0
  92. package/lib/src/models/llm/providers/mistral.js.map +1 -0
  93. package/lib/src/models/llm/providers/model.d.ts +37 -0
  94. package/lib/src/models/llm/providers/model.d.ts.map +1 -0
  95. package/lib/src/models/llm/providers/model.js +47 -0
  96. package/lib/src/models/llm/providers/model.js.map +1 -0
  97. package/lib/src/models/llm/providers/openai.d.ts +12 -0
  98. package/lib/src/models/llm/providers/openai.d.ts.map +1 -0
  99. package/lib/src/models/llm/providers/openai.js +36 -0
  100. package/lib/src/models/llm/providers/openai.js.map +1 -0
  101. package/lib/src/models/llm/providers/proxy.d.ts +10 -0
  102. package/lib/src/models/llm/providers/proxy.d.ts.map +1 -0
  103. package/lib/src/models/llm/providers/proxy.js +31 -0
  104. package/lib/src/models/llm/providers/proxy.js.map +1 -0
  105. package/lib/src/models/llm/router.d.ts +15 -0
  106. package/lib/src/models/llm/router.d.ts.map +1 -0
  107. package/lib/src/models/llm/router.js +86 -0
  108. package/lib/src/models/llm/router.js.map +1 -0
  109. package/lib/src/models/llm/tools/edit.d.ts +17 -0
  110. package/lib/src/models/llm/tools/edit.d.ts.map +1 -0
  111. package/lib/src/models/llm/tools/edit.js +59 -0
  112. package/lib/src/models/llm/tools/edit.js.map +1 -0
  113. package/lib/src/models/llm/tools/fetch.d.ts +12 -0
  114. package/lib/src/models/llm/tools/fetch.d.ts.map +1 -0
  115. package/lib/src/models/llm/tools/fetch.js +131 -0
  116. package/lib/src/models/llm/tools/fetch.js.map +1 -0
  117. package/lib/src/models/llm/tools/glob.d.ts +10 -0
  118. package/lib/src/models/llm/tools/glob.d.ts.map +1 -0
  119. package/lib/src/models/llm/tools/glob.js +36 -0
  120. package/lib/src/models/llm/tools/glob.js.map +1 -0
  121. package/lib/src/models/llm/tools/grep.d.ts +12 -0
  122. package/lib/src/models/llm/tools/grep.d.ts.map +1 -0
  123. package/lib/src/models/llm/tools/grep.js +69 -0
  124. package/lib/src/models/llm/tools/grep.js.map +1 -0
  125. package/lib/src/models/llm/tools/index.d.ts +14 -0
  126. package/lib/src/models/llm/tools/index.d.ts.map +1 -0
  127. package/lib/src/models/llm/tools/index.js +33 -0
  128. package/lib/src/models/llm/tools/index.js.map +1 -0
  129. package/lib/src/models/llm/tools/ls.d.ts +10 -0
  130. package/lib/src/models/llm/tools/ls.d.ts.map +1 -0
  131. package/lib/src/models/llm/tools/ls.js +45 -0
  132. package/lib/src/models/llm/tools/ls.js.map +1 -0
  133. package/lib/src/models/llm/tools/mkdir.d.ts +10 -0
  134. package/lib/src/models/llm/tools/mkdir.d.ts.map +1 -0
  135. package/lib/src/models/llm/tools/mkdir.js +29 -0
  136. package/lib/src/models/llm/tools/mkdir.js.map +1 -0
  137. package/lib/src/models/llm/tools/model.d.ts +55 -0
  138. package/lib/src/models/llm/tools/model.d.ts.map +1 -0
  139. package/lib/src/models/llm/tools/model.js +76 -0
  140. package/lib/src/models/llm/tools/model.js.map +1 -0
  141. package/lib/src/models/llm/tools/npm.d.ts +10 -0
  142. package/lib/src/models/llm/tools/npm.d.ts.map +1 -0
  143. package/lib/src/models/llm/tools/npm.js +25 -0
  144. package/lib/src/models/llm/tools/npm.js.map +1 -0
  145. package/lib/src/models/llm/tools/npx.d.ts +10 -0
  146. package/lib/src/models/llm/tools/npx.d.ts.map +1 -0
  147. package/lib/src/models/llm/tools/npx.js +25 -0
  148. package/lib/src/models/llm/tools/npx.js.map +1 -0
  149. package/lib/src/models/llm/tools/read.d.ts +12 -0
  150. package/lib/src/models/llm/tools/read.d.ts.map +1 -0
  151. package/lib/src/models/llm/tools/read.js +68 -0
  152. package/lib/src/models/llm/tools/read.js.map +1 -0
  153. package/lib/src/models/llm/tools/rm.d.ts +13 -0
  154. package/lib/src/models/llm/tools/rm.d.ts.map +1 -0
  155. package/lib/src/models/llm/tools/rm.js +40 -0
  156. package/lib/src/models/llm/tools/rm.js.map +1 -0
  157. package/lib/src/models/llm/tools/search.d.ts +14 -0
  158. package/lib/src/models/llm/tools/search.d.ts.map +1 -0
  159. package/lib/src/models/llm/tools/search.js +95 -0
  160. package/lib/src/models/llm/tools/search.js.map +1 -0
  161. package/lib/src/models/llm/tools/skill.d.ts +10 -0
  162. package/lib/src/models/llm/tools/skill.d.ts.map +1 -0
  163. package/lib/src/models/llm/tools/skill.js +31 -0
  164. package/lib/src/models/llm/tools/skill.js.map +1 -0
  165. package/lib/src/models/llm/tools/utils.d.ts +3 -0
  166. package/lib/src/models/llm/tools/utils.d.ts.map +1 -0
  167. package/lib/src/models/llm/tools/utils.js +28 -0
  168. package/lib/src/models/llm/tools/utils.js.map +1 -0
  169. package/lib/src/models/llm/tools/write.d.ts +14 -0
  170. package/lib/src/models/llm/tools/write.d.ts.map +1 -0
  171. package/lib/src/models/llm/tools/write.js +39 -0
  172. package/lib/src/models/llm/tools/write.js.map +1 -0
  173. package/lib/src/models/llm/types.d.ts +9 -0
  174. package/lib/src/models/llm/types.d.ts.map +1 -0
  175. package/lib/src/models/llm/types.js +5 -0
  176. package/lib/src/models/llm/types.js.map +1 -0
  177. package/lib/src/models/pipeline/context.d.ts +23 -0
  178. package/lib/src/models/pipeline/context.d.ts.map +1 -0
  179. package/lib/src/models/pipeline/context.js +49 -0
  180. package/lib/src/models/pipeline/context.js.map +1 -0
  181. package/lib/src/models/pipeline/factory.d.ts +22 -0
  182. package/lib/src/models/pipeline/factory.d.ts.map +1 -0
  183. package/lib/src/models/pipeline/factory.js +39 -0
  184. package/lib/src/models/pipeline/factory.js.map +1 -0
  185. package/lib/src/models/pipeline/index.d.ts +8 -0
  186. package/lib/src/models/pipeline/index.d.ts.map +1 -0
  187. package/lib/src/models/pipeline/index.js +24 -0
  188. package/lib/src/models/pipeline/index.js.map +1 -0
  189. package/lib/src/models/pipeline/model.d.ts +72 -0
  190. package/lib/src/models/pipeline/model.d.ts.map +1 -0
  191. package/lib/src/models/pipeline/model.js +138 -0
  192. package/lib/src/models/pipeline/model.js.map +1 -0
  193. package/lib/src/models/pipeline/parameters.d.ts +26 -0
  194. package/lib/src/models/pipeline/parameters.d.ts.map +1 -0
  195. package/lib/src/models/pipeline/parameters.js +31 -0
  196. package/lib/src/models/pipeline/parameters.js.map +1 -0
  197. package/lib/src/models/pipeline/session.d.ts +61 -0
  198. package/lib/src/models/pipeline/session.d.ts.map +1 -0
  199. package/lib/src/models/pipeline/session.js +26 -0
  200. package/lib/src/models/pipeline/session.js.map +1 -0
  201. package/lib/src/models/pipeline/stdout/compiled/console.d.ts +4 -0
  202. package/lib/src/models/pipeline/stdout/compiled/console.d.ts.map +1 -0
  203. package/lib/src/models/pipeline/stdout/compiled/console.js +71 -0
  204. package/lib/src/models/pipeline/stdout/compiled/console.js.map +1 -0
  205. package/lib/src/models/pipeline/stdout/compiled/index.d.ts +2 -0
  206. package/lib/src/models/pipeline/stdout/compiled/index.d.ts.map +1 -0
  207. package/lib/src/models/pipeline/stdout/compiled/index.js +9 -0
  208. package/lib/src/models/pipeline/stdout/compiled/index.js.map +1 -0
  209. package/lib/src/models/pipeline/stdout/index.d.ts +2 -0
  210. package/lib/src/models/pipeline/stdout/index.d.ts.map +1 -0
  211. package/lib/src/models/pipeline/stdout/index.js +18 -0
  212. package/lib/src/models/pipeline/stdout/index.js.map +1 -0
  213. package/lib/src/models/pipeline/stdout/model.d.ts +16 -0
  214. package/lib/src/models/pipeline/stdout/model.d.ts.map +1 -0
  215. package/lib/src/models/pipeline/stdout/model.js +32 -0
  216. package/lib/src/models/pipeline/stdout/model.js.map +1 -0
  217. package/lib/src/models/pipeline/steps/ai.d.ts +40 -0
  218. package/lib/src/models/pipeline/steps/ai.d.ts.map +1 -0
  219. package/lib/src/models/pipeline/steps/ai.js +538 -0
  220. package/lib/src/models/pipeline/steps/ai.js.map +1 -0
  221. package/lib/src/models/pipeline/steps/errors.d.ts +5 -0
  222. package/lib/src/models/pipeline/steps/errors.d.ts.map +1 -0
  223. package/lib/src/models/pipeline/steps/errors.js +10 -0
  224. package/lib/src/models/pipeline/steps/errors.js.map +1 -0
  225. package/lib/src/models/pipeline/steps/index.d.ts +7 -0
  226. package/lib/src/models/pipeline/steps/index.d.ts.map +1 -0
  227. package/lib/src/models/pipeline/steps/index.js +23 -0
  228. package/lib/src/models/pipeline/steps/index.js.map +1 -0
  229. package/lib/src/models/pipeline/steps/loop.d.ts +68 -0
  230. package/lib/src/models/pipeline/steps/loop.d.ts.map +1 -0
  231. package/lib/src/models/pipeline/steps/loop.js +96 -0
  232. package/lib/src/models/pipeline/steps/loop.js.map +1 -0
  233. package/lib/src/models/pipeline/steps/model.d.ts +28 -0
  234. package/lib/src/models/pipeline/steps/model.d.ts.map +1 -0
  235. package/lib/src/models/pipeline/steps/model.js +25 -0
  236. package/lib/src/models/pipeline/steps/model.js.map +1 -0
  237. package/lib/src/models/pipeline/steps/self.d.ts +25 -0
  238. package/lib/src/models/pipeline/steps/self.d.ts.map +1 -0
  239. package/lib/src/models/pipeline/steps/self.js +62 -0
  240. package/lib/src/models/pipeline/steps/self.js.map +1 -0
  241. package/lib/src/models/pipeline/steps/swarm.d.ts +25 -0
  242. package/lib/src/models/pipeline/steps/swarm.d.ts.map +1 -0
  243. package/lib/src/models/pipeline/steps/swarm.js +68 -0
  244. package/lib/src/models/pipeline/steps/swarm.js.map +1 -0
  245. package/lib/src/models/pipeline/steps/types.d.ts +6 -0
  246. package/lib/src/models/pipeline/steps/types.d.ts.map +1 -0
  247. package/lib/src/models/pipeline/steps/types.js +3 -0
  248. package/lib/src/models/pipeline/steps/types.js.map +1 -0
  249. package/lib/src/models/pipeline/types.d.ts +22 -0
  250. package/lib/src/models/pipeline/types.d.ts.map +1 -0
  251. package/lib/src/models/pipeline/types.js +3 -0
  252. package/lib/src/models/pipeline/types.js.map +1 -0
  253. package/lib/src/models/project.d.ts +29 -0
  254. package/lib/src/models/project.d.ts.map +1 -0
  255. package/lib/src/models/project.js +117 -0
  256. package/lib/src/models/project.js.map +1 -0
  257. package/lib/src/models/rg.d.ts +268 -0
  258. package/lib/src/models/rg.d.ts.map +1 -0
  259. package/lib/src/models/rg.js +154 -0
  260. package/lib/src/models/rg.js.map +1 -0
  261. package/lib/src/models/vfs.d.ts +11 -0
  262. package/lib/src/models/vfs.d.ts.map +1 -0
  263. package/lib/src/models/vfs.js +23 -0
  264. package/lib/src/models/vfs.js.map +1 -0
  265. package/lib/src/opentelemetry.d.ts +2 -0
  266. package/lib/src/opentelemetry.d.ts.map +1 -0
  267. package/lib/src/opentelemetry.js +19 -0
  268. package/lib/src/opentelemetry.js.map +1 -0
  269. package/lib/src/setup.d.ts +2 -0
  270. package/lib/src/setup.d.ts.map +1 -0
  271. package/lib/src/setup.js +25 -0
  272. package/lib/src/setup.js.map +1 -0
  273. package/lib/src/utils/common.d.ts +81 -0
  274. package/lib/src/utils/common.d.ts.map +1 -0
  275. package/lib/src/utils/common.js +133 -0
  276. package/lib/src/utils/common.js.map +1 -0
  277. package/lib/src/utils/index.d.ts +3 -0
  278. package/lib/src/utils/index.d.ts.map +1 -0
  279. package/lib/src/utils/index.js +19 -0
  280. package/lib/src/utils/index.js.map +1 -0
  281. package/lib/src/utils/meta.d.ts +9 -0
  282. package/lib/src/utils/meta.d.ts.map +1 -0
  283. package/lib/src/utils/meta.js +15 -0
  284. package/lib/src/utils/meta.js.map +1 -0
  285. package/lib/types/common.d.ts +73 -0
  286. package/lib/types/common.d.ts.map +1 -0
  287. package/lib/types/common.js +3 -0
  288. package/lib/types/common.js.map +1 -0
  289. package/lib/types/html-to-markdown.global.d.ts +6 -0
  290. package/lib/types/html-to-markdown.global.d.ts.map +1 -0
  291. package/lib/types/html-to-markdown.global.js +2 -0
  292. package/lib/types/html-to-markdown.global.js.map +1 -0
  293. package/lib/types/index.d.ts +2 -0
  294. package/lib/types/index.d.ts.map +1 -0
  295. package/lib/types/index.js +18 -0
  296. package/lib/types/index.js.map +1 -0
  297. package/lib/types/json2md.global.d.ts +14 -0
  298. package/lib/types/json2md.global.d.ts.map +1 -0
  299. package/lib/types/json2md.global.js +4 -0
  300. package/lib/types/json2md.global.js.map +1 -0
  301. package/package.json +1 -1
@@ -0,0 +1,17 @@
1
+ import { LlmToolCompiler } from './model';
2
+ declare const _default: LlmToolCompiler<{
3
+ input: {
4
+ path: string;
5
+ replacements: {
6
+ source: string;
7
+ target: string;
8
+ }[];
9
+ };
10
+ output: string;
11
+ options: {
12
+ /** Allowed paths/minimatch patterns to edit file */
13
+ allowed?: string[];
14
+ };
15
+ }>;
16
+ export default _default;
17
+ //# sourceMappingURL=edit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.d.ts","sourceRoot":"","sources":["../../../../../src/models/llm/tools/edit.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAyB,MAAM,SAAS,CAAC;;;;;;;;;;;QAQ7D,oDAAoD;kBAC1C,MAAM,EAAE;;;AAHtB,wBA4DK"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const minimatch_1 = __importDefault(require("minimatch"));
7
+ const path_1 = __importDefault(require("path"));
8
+ const proper_lockfile_1 = require("proper-lockfile");
9
+ const v3_1 = require("zod/v3");
10
+ const model_1 = require("./model");
11
+ const utils_1 = require("./utils");
12
+ const file_1 = require("../../file");
13
+ const utils_2 = require("../../../utils");
14
+ exports.default = model_1.LlmToolCompiler
15
+ .build('Edit a file by replacing lines fragment with another string')
16
+ .input(v3_1.z.object({
17
+ path: v3_1.z.string().describe('The path to the file to edit'),
18
+ replacements: v3_1.z.array(v3_1.z.object({
19
+ source: v3_1.z.string().describe('The source lines fragment to replace'),
20
+ target: v3_1.z.string().describe('The string to replace it with'),
21
+ }).describe('File replacement details')).describe('List of file replacements'),
22
+ }))
23
+ .output(v3_1.z.string().describe('Success message'))
24
+ .execute(({ context, vfs, options }) => async ({ path: location, replacements }) => {
25
+ const mutex = {
26
+ release: (0, utils_2.cast)(null),
27
+ };
28
+ try {
29
+ if (location.startsWith('__vfs__/')) {
30
+ throw model_1.LlmToolExecutionError.build('edit', 'Cannot edit virtual file. Only `read` tool is allowed to work with this file');
31
+ }
32
+ if (!(0, utils_1.checkPatternIsRestricted)(location)) {
33
+ throw model_1.LlmToolExecutionError.build('edit', `Path "${location}" is going to out of scope the project`);
34
+ }
35
+ if (options.allowed && !options.allowed.some((pattern) => (0, minimatch_1.default)(location, pattern, { matchBase: true }))) {
36
+ throw model_1.LlmToolExecutionError.build('edit', `Path "${location}" is not to be allowed to edit. Examinate the task again`);
37
+ }
38
+ mutex.release = await (0, proper_lockfile_1.lock)(path_1.default.join(context.project.cwd, location), {
39
+ stale: 10000,
40
+ update: 1000,
41
+ retries: 10,
42
+ });
43
+ const file = await file_1.File.build(location, {
44
+ cwd: context.project.cwd,
45
+ state: 'existent',
46
+ strict: true,
47
+ });
48
+ replacements.forEach(({ source, target }) => file.replace(source, target));
49
+ await file.write();
50
+ return `File "${location}" edited successfully`;
51
+ }
52
+ catch (error) {
53
+ throw model_1.LlmToolExecutionError.build('edit', error);
54
+ }
55
+ finally {
56
+ await mutex.release?.();
57
+ }
58
+ });
59
+ //# sourceMappingURL=edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit.js","sourceRoot":"","sources":["../../../../../src/models/llm/tools/edit.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAClC,gDAAwB;AAExB,qDAAuC;AACvC,+BAA2B;AAE3B,mCAAiE;AACjE,mCAAmD;AAEnD,qCAAkC;AAClC,0CAAsC;AAEtC,kBAAe,uBAAe;KAC3B,KAAK,CAGH,6DAA6D,CAAC;KAChE,KAAK,CACJ,MAAC,CAAC,MAAM,CAAC;IACP,IAAI,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAEzD,YAAY,EAAE,MAAC,CAAC,KAAK,CACnB,MAAC,CAAC,MAAM,CAAC;QACP,MAAM,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;QACnE,MAAM,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;KAC7D,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CACxC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;CACxC,CAAC,CACH;KACA,MAAM,CAAC,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;KAC9C,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE;IACjF,MAAM,KAAK,GAAG;QACZ,OAAO,EAAE,IAAA,YAAI,EAAkC,IAAI,CAAC;KACrD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AAO,SAAS,QAAQ,uBAAuB,CAAC;IAClD,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,6BAAqB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;YAAS,CAAC;QACT,MAAM,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;IAC1B,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { LlmToolCompiler } from './model';
2
+ declare const _default: LlmToolCompiler<{
3
+ input: {
4
+ url: string;
5
+ format: "text" | "markdown" | "html";
6
+ timeout?: number | undefined;
7
+ };
8
+ output: string;
9
+ options: {};
10
+ }>;
11
+ export default _default;
12
+ //# sourceMappingURL=fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../../src/models/llm/tools/fetch.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAyB,MAAM,SAAS,CAAC;;;;;;;;;;AAqBjE,wBA6HK"}
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const turndown_1 = __importDefault(require("turndown"));
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const v3_1 = require("zod/v3");
9
+ const model_1 = require("./model");
10
+ const content_1 = require("../../content");
11
+ const MAX_RESPONSE_SIZE = 5 * 1024 * 1024; // 5MB
12
+ const DEFAULT_TIMEOUT = 30 * 1000; // 30 seconds
13
+ const MAX_TIMEOUT = 120 * 1000; // 2 minutes
14
+ const convertHTMLToMarkdown = (html) => {
15
+ const turndownService = new turndown_1.default({
16
+ headingStyle: 'atx',
17
+ hr: '---',
18
+ bulletListMarker: '-',
19
+ codeBlockStyle: 'fenced',
20
+ emDelimiter: '*',
21
+ });
22
+ return turndownService
23
+ .remove(['script', 'style', 'meta', 'link'])
24
+ .turndown(html);
25
+ };
26
+ exports.default = model_1.LlmToolCompiler
27
+ .build(content_1.ArticleContent
28
+ .build({
29
+ title: 'Fetch web resource by URL',
30
+ content: [
31
+ { p: `**Features:**` },
32
+ {
33
+ ul: [
34
+ 'Fetches content from a specified URL',
35
+ 'Takes a URL and optional format as input',
36
+ 'Fetches the URL content, converts to requested format (markdown by default)',
37
+ 'Returns the content in the specified format',
38
+ 'Use this tool when you need to retrieve and analyze web content',
39
+ ],
40
+ },
41
+ { p: `**Usage:**` },
42
+ {
43
+ ul: [
44
+ 'IMPORTANT: if another tool is present that offers better web fetching capabilities, is more targeted to the task, or has fewer restrictions, prefer using that tool instead of this one',
45
+ 'The URL must be a fully-formed valid URL',
46
+ 'HTTP URLs will be automatically upgraded to HTTPS',
47
+ 'Format options: `markdown` (default), `text`, or `html`',
48
+ 'This tool is read-only and does not modify any files',
49
+ 'Results may be summarized if the content is very large',
50
+ ],
51
+ },
52
+ ],
53
+ })
54
+ .render())
55
+ .input(v3_1.z.object({
56
+ url: v3_1.z.string().url().describe('The URL to fetch content from'),
57
+ format: v3_1.z
58
+ .enum(['text', 'markdown', 'html'])
59
+ .default('markdown')
60
+ .describe('The format to return the content in (text, markdown, or html). Defaults to markdown.'),
61
+ timeout: v3_1.z.number().optional().describe('Optional timeout in seconds (max 120)'),
62
+ }))
63
+ .output(v3_1.z.string().describe('Fetched content'))
64
+ .execute(() => async (parameters) => {
65
+ try {
66
+ const timeout = Math.min((parameters.timeout ?? DEFAULT_TIMEOUT / 1000) * 1000, MAX_TIMEOUT);
67
+ const controller = new AbortController();
68
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
69
+ let acceptHeader = '*/*';
70
+ switch (parameters.format) {
71
+ case 'markdown':
72
+ acceptHeader = 'text/markdown;q=1.0, text/x-markdown;q=0.9, text/plain;q=0.8, text/html;q=0.7, */*;q=0.1';
73
+ break;
74
+ case 'text':
75
+ acceptHeader = 'text/plain;q=1.0, text/markdown;q=0.9, text/html;q=0.8, */*;q=0.1';
76
+ break;
77
+ case 'html':
78
+ acceptHeader = 'text/html;q=1.0, application/xhtml+xml;q=0.9, text/plain;q=0.8, text/markdown;q=0.7, */*;q=0.1';
79
+ break;
80
+ }
81
+ const response = await fetch(parameters.url, {
82
+ signal: controller.signal,
83
+ headers: {
84
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36',
85
+ Accept: acceptHeader,
86
+ 'Accept-Language': 'en-US,en;q=0.9',
87
+ },
88
+ });
89
+ clearTimeout(timeoutId);
90
+ if (!response.ok) {
91
+ throw model_1.LlmToolExecutionError.build('fetch', `Request failed with status code: ${response.status}`);
92
+ }
93
+ const contentLength = response.headers.get('content-length');
94
+ if (contentLength && parseInt(contentLength) > MAX_RESPONSE_SIZE) {
95
+ throw model_1.LlmToolExecutionError.build('fetch', 'Response too large (exceeds 5MB limit)');
96
+ }
97
+ const arrayBuffer = await response.arrayBuffer();
98
+ if (arrayBuffer.byteLength > MAX_RESPONSE_SIZE) {
99
+ throw model_1.LlmToolExecutionError.build('fetch', 'Response too large (exceeds 5MB limit)');
100
+ }
101
+ const contentType = response.headers.get('content-type') || '';
102
+ const content = new TextDecoder().decode(arrayBuffer);
103
+ let output = content;
104
+ if (parameters.format === 'markdown' && contentType.includes('text/html')) {
105
+ output = convertHTMLToMarkdown(content);
106
+ }
107
+ else if (parameters.format === 'text' && contentType.includes('text/html')) {
108
+ // Simple text extraction if HTMLRewriter is not available
109
+ output = content.replace(/<script\b[^>]*>([\s\S]*?)<\/script>/gim, '')
110
+ .replace(/<style\b[^>]*>([\s\S]*?)<\/style>/gim, '')
111
+ .replace(/<[^>]+>/g, ' ')
112
+ .replace(/\s+/g, ' ')
113
+ .trim();
114
+ }
115
+ const tokens = output.split(/\s+/);
116
+ const isTruncated = tokens.length > 12000;
117
+ const truncated = tokens.slice(0, 12000).join(' ');
118
+ return isTruncated ? `${truncated}\n\n[Content truncated to 12000 tokens]` : truncated;
119
+ }
120
+ catch (error) {
121
+ const formatted = lodash_1.default.isObject(error) && 'name' in error
122
+ ? error.name === 'AbortError'
123
+ ? new Error('Request timed out')
124
+ : error instanceof Error
125
+ ? error
126
+ : new Error(JSON.stringify(error))
127
+ : new Error(String(error));
128
+ throw model_1.LlmToolExecutionError.build('fetch', formatted);
129
+ }
130
+ });
131
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../../src/models/llm/tools/fetch.ts"],"names":[],"mappings":";;;;;AAAA,wDAAuC;AACvC,oDAAuB;AAEvB,+BAA2B;AAE3B,mCAAiE;AACjE,2CAA+C;AAE/C,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,MAAM;AACjD,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAChD,MAAM,WAAW,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,YAAY;AAE5C,MAAM,qBAAqB,GAAG,CAAC,IAAY,EAAU,EAAE;IACrD,MAAM,eAAe,GAAG,IAAI,kBAAe,CAAC;QAC1C,YAAY,EAAE,KAAK;QACnB,EAAE,EAAE,KAAK;QACT,gBAAgB,EAAE,GAAG;QACrB,cAAc,EAAE,QAAQ;QACxB,WAAW,EAAE,GAAG;KACjB,CAAC,CAAC;IAEH,OAAO,eAAe;SACnB,MAAM,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;SAC3C,QAAQ,CAAC,IAAI,CAAC,CAAC;AACpB,CAAC,CAAC;AAEF,kBAAe,uBAAe;KAC3B,KAAK,CACJ,wBAAc;KACX,KAAK,CAAC;IACL,KAAK,EAAE,2BAA2B;IAElC,OAAO,EAAE;QACP,EAAE,CAAC,EAAE,eAAe,EAAE;QACtB;YACE,EAAE,EAAE;gBACF,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C,CAAC;YACtC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAE7B,MAAM,6BAAqB,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { LlmToolCompiler } from './model';
2
+ declare const _default: LlmToolCompiler<{
3
+ input: {
4
+ pattern: string;
5
+ };
6
+ output: string;
7
+ options: {};
8
+ }>;
9
+ export default _default;
10
+ //# sourceMappingURL=glob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../../../src/models/llm/tools/glob.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;;;;;;;;AAG1C,wBAqCK"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const v3_1 = require("zod/v3");
4
+ const model_1 = require("./model");
5
+ const content_1 = require("../../content");
6
+ exports.default = model_1.LlmToolCompiler
7
+ .build(content_1.ArticleContent
8
+ .build({
9
+ title: 'Find files by glob patterns',
10
+ content: [
11
+ { p: `**Features:**` },
12
+ {
13
+ ul: [
14
+ 'Supports standard glob patterns (e.g., `**/*.ts`, `src/*.js`)',
15
+ 'Returns a newline-separated list of matching file paths',
16
+ 'Fast file discovery across the entire project',
17
+ ],
18
+ },
19
+ { p: `**Usage:**` },
20
+ {
21
+ ul: [
22
+ 'Use this to locate files when you know the naming pattern but not the exact path',
23
+ 'Combine with `grep` to process the discovered files',
24
+ ],
25
+ },
26
+ ],
27
+ })
28
+ .render())
29
+ .input(v3_1.z.object({
30
+ pattern: v3_1.z.string().describe('The glob pattern to match files against'),
31
+ }))
32
+ .output(v3_1.z.string().describe('The paths to the matching files separated by newline'))
33
+ .execute(({ context }) => async ({ pattern }) => {
34
+ return context.project.files.glob([pattern]).join('\n');
35
+ });
36
+ //# sourceMappingURL=glob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../../../src/models/llm/tools/glob.ts"],"names":[],"mappings":";;AAAA,+BAA2B;AAE3B,mCAA0C;AAC1C,2CAA+C;AAE/C,kBAAe,uBAAe;KAC3B,KAAK,CACJ,wBAAc;KACX,KAAK,CAAC;IACL,KAAK,EAAE,6BAA6B;IAEpC,OAAO,EAAE;QACP,EAAE,CAAC,EAAE,eAAe,EAAE;QACtB;YACE,EAAE,EAAE;gBACF,+DAA+D;gBAC/D,yDAAyD;gBACzD,+CAA+C;aAChD;SACF;QAED,EAAE,CAAC,EAAE,YAAY,EAAE;QACnB;YACE,EAAE,EAAE;gBACF,kFAAkF;gBAClF,qDAAqD;aACtD;SACF;KACF;CACF,CAAC;KACD,MAAM,EAAE,CACZ;KACA,KAAK,CACJ,MAAC,CAAC,MAAM,CAAC;IACP,OAAO,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;CACxE,CAAC,CACH;KACA,MAAM,CACL,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC,CAC5E;KACA,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAC9C,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1D,CAAC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { LlmToolCompiler } from './model';
2
+ declare const _default: LlmToolCompiler<{
3
+ input: {
4
+ pattern: string;
5
+ path?: string | undefined;
6
+ include?: string | undefined;
7
+ };
8
+ output: string;
9
+ options: {};
10
+ }>;
11
+ export default _default;
12
+ //# sourceMappingURL=grep.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../../../../src/models/llm/tools/grep.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAyB,MAAM,SAAS,CAAC;;;;;;;;;;AAKjE,wBAsEK"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const v3_1 = require("zod/v3");
7
+ const lodash_1 = __importDefault(require("lodash"));
8
+ const model_1 = require("./model");
9
+ const utils_1 = require("./utils");
10
+ const content_1 = require("../../content");
11
+ const rg_1 = require("../../rg");
12
+ exports.default = model_1.LlmToolCompiler
13
+ .build(content_1.ArticleContent
14
+ .build({
15
+ title: 'Fast content search tool that works with any codebase size',
16
+ content: [
17
+ { p: `**Features:**` },
18
+ {
19
+ ul: [
20
+ 'Searches file contents using regular expressions',
21
+ 'Supports full regex syntax (eg. "log.*Error", "function\\s+\\w+", etc.)',
22
+ 'Filter files by pattern with the include parameter (eg. "*.js", "*.{ts,tsx}")',
23
+ 'Returns file paths and line numbers with at least one match sorted by modification time',
24
+ ],
25
+ },
26
+ { p: `**Usage:**` },
27
+ {
28
+ ul: [
29
+ 'Use this tool when you need to find files containing specific patterns',
30
+ ],
31
+ },
32
+ ],
33
+ })
34
+ .render())
35
+ .input(v3_1.z.object({
36
+ pattern: v3_1.z.string().describe('The regex pattern to search for in file contents'),
37
+ path: v3_1.z.string().optional().describe('The directory to search in. Defaults to the current working directory.'),
38
+ include: v3_1.z.string().optional().describe('File pattern to include in the search (e.g. "*.js", "*.{ts,tsx}")'),
39
+ }))
40
+ .output(v3_1.z.string().describe('Search results'))
41
+ .execute(({ context }) => async ({ pattern, path: location, include }) => {
42
+ try {
43
+ if (location) {
44
+ if (!(0, utils_1.checkPatternIsRestricted)(location)) {
45
+ throw model_1.LlmToolExecutionError.build('grep', 'Pattern or path is going to out of scope the project');
46
+ }
47
+ if (location.startsWith('__vfs__/')) {
48
+ throw model_1.LlmToolExecutionError.build('grep', 'Cannot grep virtual file. Only `read` tool is allowed to work with this file');
49
+ }
50
+ }
51
+ const rg = rg_1.Rg.build();
52
+ const results = await rg.exec(pattern, {
53
+ path: location,
54
+ limit: 50,
55
+ include: include ? [include] : undefined,
56
+ exclude: context.project.sources.ignore,
57
+ });
58
+ if (results.length === 0) {
59
+ return 'No matches found.';
60
+ }
61
+ return results
62
+ .map((match) => `${match.path.text}:${match.line_number}: ${lodash_1.default.truncate(match.lines.text.trim(), { length: 100 })}`)
63
+ .join('\n');
64
+ }
65
+ catch (error) {
66
+ throw model_1.LlmToolExecutionError.build('grep', error);
67
+ }
68
+ });
69
+ //# sourceMappingURL=grep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grep.js","sourceRoot":"","sources":["../../../../../src/models/llm/tools/grep.ts"],"names":[],"mappings":";;;;;AAAA,+BAA2B;AAC3B,oDAAuB;AAEvB,mCAAiE;AACjE,mCAAmD;AACnD,2CAA+C;AAC/C,iCAA8B;AAE9B,kBAAe,uBAAe;KAC3B,KAAK,CACJ,wBAAc;KACX,KAAK,CAAC;IACL,KAAK,EAAE,4DAA4D;IAEnE,OAAO,EAAE;QACP,EAAE,CAAC,EAAE,eAAe,EAAE;QACtB;YACE,EAAE,EAAE;gBACF,kDAAkD;gBAClD,yEAAyE;gBACzE,+EAA+E;gBAC/E,yFAAyF;aAC1F;SACF;QAED,EAAE,CAAC,EAAE,YAAY,EAAE;QACnB;YACE,EAAE,EAAE;gBACF,wEAAwE;aACzE;SACF;KACF;CACF,CAAC;KACD,MAAM,EAAE,CACZ;KACA,KAAK,CACJ,MAAC,CAAC,MAAM,CAAC;IACP,OAAO,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kDAAkD,CAAC;IAEhF,IAAI,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wEAA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AAC,WAAW,KAAK,gBAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;aAClH,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,6BAAqB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export { default as search } from './search';
2
+ export { default as fetch } from './fetch';
3
+ export { default as mkdir } from './mkdir';
4
+ export { default as write } from './write';
5
+ export { default as glob } from './glob';
6
+ export { default as edit } from './edit';
7
+ export { default as read } from './read';
8
+ export { default as grep } from './grep';
9
+ export { default as rm } from './rm';
10
+ export { default as ls } from './ls';
11
+ export { default as skill } from './skill';
12
+ export { default as npx } from './npx';
13
+ export { default as npm } from './npm';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/models/llm/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,EAAE,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.npm = exports.npx = exports.skill = exports.ls = exports.rm = exports.grep = exports.read = exports.edit = exports.glob = exports.write = exports.mkdir = exports.fetch = exports.search = void 0;
7
+ var search_1 = require("./search");
8
+ Object.defineProperty(exports, "search", { enumerable: true, get: function () { return __importDefault(search_1).default; } });
9
+ var fetch_1 = require("./fetch");
10
+ Object.defineProperty(exports, "fetch", { enumerable: true, get: function () { return __importDefault(fetch_1).default; } });
11
+ var mkdir_1 = require("./mkdir");
12
+ Object.defineProperty(exports, "mkdir", { enumerable: true, get: function () { return __importDefault(mkdir_1).default; } });
13
+ var write_1 = require("./write");
14
+ Object.defineProperty(exports, "write", { enumerable: true, get: function () { return __importDefault(write_1).default; } });
15
+ var glob_1 = require("./glob");
16
+ Object.defineProperty(exports, "glob", { enumerable: true, get: function () { return __importDefault(glob_1).default; } });
17
+ var edit_1 = require("./edit");
18
+ Object.defineProperty(exports, "edit", { enumerable: true, get: function () { return __importDefault(edit_1).default; } });
19
+ var read_1 = require("./read");
20
+ Object.defineProperty(exports, "read", { enumerable: true, get: function () { return __importDefault(read_1).default; } });
21
+ var grep_1 = require("./grep");
22
+ Object.defineProperty(exports, "grep", { enumerable: true, get: function () { return __importDefault(grep_1).default; } });
23
+ var rm_1 = require("./rm");
24
+ Object.defineProperty(exports, "rm", { enumerable: true, get: function () { return __importDefault(rm_1).default; } });
25
+ var ls_1 = require("./ls");
26
+ Object.defineProperty(exports, "ls", { enumerable: true, get: function () { return __importDefault(ls_1).default; } });
27
+ var skill_1 = require("./skill");
28
+ Object.defineProperty(exports, "skill", { enumerable: true, get: function () { return __importDefault(skill_1).default; } });
29
+ var npx_1 = require("./npx");
30
+ Object.defineProperty(exports, "npx", { enumerable: true, get: function () { return __importDefault(npx_1).default; } });
31
+ var npm_1 = require("./npm");
32
+ Object.defineProperty(exports, "npm", { enumerable: true, get: function () { return __importDefault(npm_1).default; } });
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/models/llm/tools/index.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA6C;AAApC,iHAAA,OAAO,OAAU;AAC1B,iCAA2C;AAAlC,+GAAA,OAAO,OAAS;AAEzB,iCAA2C;AAAlC,+GAAA,OAAO,OAAS;AACzB,iCAA2C;AAAlC,+GAAA,OAAO,OAAS;AACzB,+BAAyC;AAAhC,6GAAA,OAAO,OAAQ;AACxB,+BAAyC;AAAhC,6GAAA,OAAO,OAAQ;AACxB,+BAAyC;AAAhC,6GAAA,OAAO,OAAQ;AACxB,+BAAyC;AAAhC,6GAAA,OAAO,OAAQ;AACxB,2BAAqC;AAA5B,yGAAA,OAAO,OAAM;AACtB,2BAAqC;AAA5B,yGAAA,OAAO,OAAM;AAEtB,iCAA2C;AAAlC,+GAAA,OAAO,OAAS;AACzB,6BAAuC;AAA9B,2GAAA,OAAO,OAAO;AACvB,6BAAuC;AAA9B,2GAAA,OAAO,OAAO"}
@@ -0,0 +1,10 @@
1
+ import { LlmToolCompiler } from './model';
2
+ declare const _default: LlmToolCompiler<{
3
+ input: {
4
+ path: string;
5
+ };
6
+ output: string;
7
+ options: {};
8
+ }>;
9
+ export default _default;
10
+ //# sourceMappingURL=ls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ls.d.ts","sourceRoot":"","sources":["../../../../../src/models/llm/tools/ls.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAyB,MAAM,SAAS,CAAC;;;;;;;;AAIjE,wBAyCK"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const promises_1 = __importDefault(require("fs/promises"));
8
+ const v3_1 = require("zod/v3");
9
+ const model_1 = require("./model");
10
+ const utils_1 = require("./utils");
11
+ const content_1 = require("../../content");
12
+ exports.default = model_1.LlmToolCompiler
13
+ .build(content_1.ArticleContent
14
+ .build({
15
+ title: 'List files and directories in a specified location',
16
+ content: [
17
+ { p: `**Usage:**` },
18
+ {
19
+ ul: [
20
+ 'You should generally prefer the Glob and Grep tools, if you know which directories to search',
21
+ ],
22
+ },
23
+ ],
24
+ })
25
+ .render())
26
+ .input(v3_1.z.object({
27
+ path: v3_1.z.string().describe('The path to the directory to list'),
28
+ }))
29
+ .output(v3_1.z.string().describe('List of entries in the directory separated by newline'))
30
+ .execute(({ context }) => async ({ path: location }) => {
31
+ try {
32
+ if (!(0, utils_1.checkPatternIsRestricted)(location)) {
33
+ throw model_1.LlmToolExecutionError.build('ls', `Path "${location}" is going to out of scope the project`);
34
+ }
35
+ if (location.startsWith('__vfs__/')) {
36
+ throw model_1.LlmToolExecutionError.build('ls', 'Cannot ls virtual file. Only `read` tool is allowed to work with this file');
37
+ }
38
+ const entries = await promises_1.default.readdir(path_1.default.join(context.project.cwd, location), { withFileTypes: true });
39
+ return entries.map((entry) => `${entry.name}${entry.isDirectory() ? '/' : ''}`).join('\n');
40
+ }
41
+ catch (error) {
42
+ throw model_1.LlmToolExecutionError.build('ls', error);
43
+ }
44
+ });
45
+ //# sourceMappingURL=ls.js.map
@@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E,CAAC,CAAC;QACpG,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7F,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,6BAAqB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { LlmToolCompiler } from './model';
2
+ declare const _default: LlmToolCompiler<{
3
+ input: {
4
+ path: string;
5
+ };
6
+ output: string;
7
+ options: {};
8
+ }>;
9
+ export default _default;
10
+ //# sourceMappingURL=mkdir.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mkdir.d.ts","sourceRoot":"","sources":["../../../../../src/models/llm/tools/mkdir.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAyB,MAAM,SAAS,CAAC;;;;;;;;AAGjE,wBAmBK"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const promises_1 = __importDefault(require("fs/promises"));
8
+ const v3_1 = require("zod/v3");
9
+ const model_1 = require("./model");
10
+ const utils_1 = require("./utils");
11
+ exports.default = model_1.LlmToolCompiler
12
+ .build('Create directory')
13
+ .input(v3_1.z.object({
14
+ path: v3_1.z.string().describe('The path to the directory to create'),
15
+ }))
16
+ .output(v3_1.z.string().describe('Success message'))
17
+ .execute(({ context }) => async ({ path: location }) => {
18
+ try {
19
+ if (!(0, utils_1.checkPatternIsRestricted)(location)) {
20
+ throw model_1.LlmToolExecutionError.build('mkdir', `Path "${location}" is going to out of scope the project`);
21
+ }
22
+ await promises_1.default.mkdir(path_1.default.join(context.project.cwd, location), { recursive: true });
23
+ return `Directory "${location}" created successfully`;
24
+ }
25
+ catch (error) {
26
+ throw model_1.LlmToolExecutionError.build('mkdir', error);
27
+ }
28
+ });
29
+ //# sourceMappingURL=mkdir.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mkdir.js","sourceRoot":"","sources":["../../../../../src/models/llm/tools/mkdir.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,2DAA6B;AAE7B,+BAA2B;AAE3B,mCAAiE;AACjE,mCAAmD;AAEnD,kBAAe,uBAAe;KAC3B,KAAK,CAAC,kBAAkB,CAAC;KACzB,KAAK,CACJ,MAAC,CAAC,MAAM,CAAC;IACP,IAAI,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;CACjE,CAAC,CACH;KACA,MAAM,CAAC,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;KAC9C,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;IACrD,IAAI,CAAC;QACH,IAAI,CAAC,IAAA,gCAAwB,EAAC,QAAQ,CAAC,EAAE,CAAC;YACxC,MAAM,6BAAqB,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,QAAQ,wCAAwC,CAAC,CAAC;QACxG,CAAC;QAED,MAAM,kBAAE,CAAC,KAAK,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9E,OAAO,cAAc,QAAQ,wBAAwB,CAAC;IACxD,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,MAAM,6BAAqB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACpD,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { FlexibleSchema, Tool, ToolExecuteFunction } from 'ai';
2
+ import type { PipelineParameters, PipelineStep } from '../../pipeline';
3
+ import type { VirtualFileSystem } from '../../vfs';
4
+ export interface ILlmToolParameters<TOptions extends object> extends PipelineParameters {
5
+ options: TOptions;
6
+ step: PipelineStep;
7
+ vfs: VirtualFileSystem;
8
+ }
9
+ export declare class LlmToolCompilationError extends Error {
10
+ property: string;
11
+ constructor(property: string);
12
+ }
13
+ export declare class LlmToolExecutionError extends Error {
14
+ name: string;
15
+ constructor(name: string, reason: string);
16
+ static build(name: string, source: unknown): LlmToolExecutionError;
17
+ }
18
+ export declare class LlmToolCompiler<TSchema extends {
19
+ input: unknown;
20
+ output: unknown;
21
+ options: {};
22
+ } = any> {
23
+ description: string;
24
+ private provided;
25
+ TOptions: TSchema['options'];
26
+ TExecutor: (parameters: ILlmToolParameters<TSchema['options']>) => ToolExecuteFunction<TSchema['input'], TSchema['output']>;
27
+ constructor(description: string, provided: {
28
+ executor?: LlmToolCompiler<TSchema>['TExecutor'];
29
+ options?: TSchema['options'];
30
+ schema: {
31
+ input?: FlexibleSchema<TSchema['input']>;
32
+ output?: FlexibleSchema<TSchema['output']>;
33
+ };
34
+ });
35
+ input<T, U extends LlmToolCompiler<{
36
+ input: T;
37
+ output: TSchema['output'];
38
+ options: TSchema['options'];
39
+ }>>(schema: FlexibleSchema<T>): U;
40
+ output<T, U extends LlmToolCompiler<{
41
+ input: TSchema['input'];
42
+ output: T;
43
+ options: TSchema['options'];
44
+ }>>(schema: FlexibleSchema<T>): U;
45
+ /** Provides options to tool (makes clone of this instance) */
46
+ options(payload: TSchema['options']): this;
47
+ execute(executor: NonNullable<LlmToolCompiler<TSchema>['TExecutor']>): this;
48
+ compile(parameters: Omit<ILlmToolParameters<any>, 'options'>): Tool<TSchema['input'], TSchema['output']>;
49
+ static build<TOptions extends object = {}, TOutput = any>(description: string): LlmToolCompiler<{
50
+ input: unknown;
51
+ output: TOutput;
52
+ options: TOptions;
53
+ }>;
54
+ }
55
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../../../src/models/llm/tools/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAQ,IAAI,EAAE,mBAAmB,EAAE,MAAM,IAAI,CAAC;AAErE,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAInD,MAAM,WAAW,kBAAkB,CAAC,QAAQ,SAAS,MAAM,CAAE,SAAQ,kBAAkB;IACrF,OAAO,EAAE,QAAQ,CAAC;IAElB,IAAI,EAAE,YAAY,CAAC;IACnB,GAAG,EAAE,iBAAiB,CAAC;CACxB;AAED,qBAAa,uBAAwB,SAAQ,KAAK;IAC7B,QAAQ,EAAE,MAAM;gBAAhB,QAAQ,EAAE,MAAM;CAGpC;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC3B,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAI/C,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,qBAAqB;CAWnE;AAED,qBAAa,eAAe,CAAC,OAAO,SAAS;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,EAAE,CAAC;CACb,GAAG,GAAG;IAOc,WAAW,EAAE,MAAM;IAAE,OAAO,CAAC,QAAQ;IANjD,QAAQ,EAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9B,SAAS,EAAG,CAAC,UAAU,EAAE,kBAAkB,CAAC,OAAO,CAAC,SAAS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