@5ss/ai-tools 2.11.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 (342) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/LICENSE +21 -0
  3. package/README.md +221 -0
  4. package/dist/ai-sdk/index.d.ts +15 -0
  5. package/dist/ai-sdk/index.d.ts.map +1 -0
  6. package/dist/ai-sdk/index.js +24 -0
  7. package/dist/ai-sdk/index.js.map +1 -0
  8. package/dist/artifact-D064mHfK.js +44 -0
  9. package/dist/artifact-D064mHfK.js.map +1 -0
  10. package/dist/artifacts-O8g-40Pw.js +404 -0
  11. package/dist/artifacts-O8g-40Pw.js.map +1 -0
  12. package/dist/aws-json-CecFqzqX.js +23 -0
  13. package/dist/aws-json-CecFqzqX.js.map +1 -0
  14. package/dist/aws-service-msttbPrz.js +58 -0
  15. package/dist/aws-service-msttbPrz.js.map +1 -0
  16. package/dist/batch-BMM5dXqL.d.ts +22 -0
  17. package/dist/batch-BMM5dXqL.d.ts.map +1 -0
  18. package/dist/batch-Co1ujeAW.js +67 -0
  19. package/dist/batch-Co1ujeAW.js.map +1 -0
  20. package/dist/bedrock-agentcore-browser-a_qOs-NR.js +182 -0
  21. package/dist/bedrock-agentcore-browser-a_qOs-NR.js.map +1 -0
  22. package/dist/bedrock-agentcore-code-interpreter-MWK-8RhA.js +357 -0
  23. package/dist/bedrock-agentcore-code-interpreter-MWK-8RhA.js.map +1 -0
  24. package/dist/bytes-BxpimpQx.js +45 -0
  25. package/dist/bytes-BxpimpQx.js.map +1 -0
  26. package/dist/client-CCKGsTeI.js +743 -0
  27. package/dist/client-CCKGsTeI.js.map +1 -0
  28. package/dist/cloudflare/index.d.ts +37 -0
  29. package/dist/cloudflare/index.d.ts.map +1 -0
  30. package/dist/cloudflare/index.js +41 -0
  31. package/dist/cloudflare/index.js.map +1 -0
  32. package/dist/cloudflare-browser-B6Yolpin.js +428 -0
  33. package/dist/cloudflare-browser-B6Yolpin.js.map +1 -0
  34. package/dist/cloudflare-email-Dy0KHeDf.js +197 -0
  35. package/dist/cloudflare-email-Dy0KHeDf.js.map +1 -0
  36. package/dist/cloudflare-sandbox-Dp_uNaqW.js +982 -0
  37. package/dist/cloudflare-sandbox-Dp_uNaqW.js.map +1 -0
  38. package/dist/content-type-CORxaxcv.js +49 -0
  39. package/dist/content-type-CORxaxcv.js.map +1 -0
  40. package/dist/core/index.d.ts +4 -0
  41. package/dist/core/index.js +204 -0
  42. package/dist/core/index.js.map +1 -0
  43. package/dist/define-CvpJ_pNP.js +115 -0
  44. package/dist/define-CvpJ_pNP.js.map +1 -0
  45. package/dist/errors-DoSpNHvs.js +20 -0
  46. package/dist/errors-DoSpNHvs.js.map +1 -0
  47. package/dist/errors-aKhko9T1.d.ts +18 -0
  48. package/dist/errors-aKhko9T1.d.ts.map +1 -0
  49. package/dist/eventbridge-scheduler-Bh6GqZY2.js +349 -0
  50. package/dist/eventbridge-scheduler-Bh6GqZY2.js.map +1 -0
  51. package/dist/framework-context-DVIIY8ZO.js +24 -0
  52. package/dist/framework-context-DVIIY8ZO.js.map +1 -0
  53. package/dist/gotenberg-NuJjxyln.js +291 -0
  54. package/dist/gotenberg-NuJjxyln.js.map +1 -0
  55. package/dist/http/index.d.ts +47 -0
  56. package/dist/http/index.d.ts.map +1 -0
  57. package/dist/http/index.js +3 -0
  58. package/dist/http-service-DDNCO1s4.js +254 -0
  59. package/dist/http-service-DDNCO1s4.js.map +1 -0
  60. package/dist/http-service-T7E5UjP8.d.ts +80 -0
  61. package/dist/http-service-T7E5UjP8.d.ts.map +1 -0
  62. package/dist/imessage-BSAFOI8Z.js +154 -0
  63. package/dist/imessage-BSAFOI8Z.js.map +1 -0
  64. package/dist/index-BU4gmYO8.d.ts +254 -0
  65. package/dist/index-BU4gmYO8.d.ts.map +1 -0
  66. package/dist/index-CCivzmxO.d.ts +188 -0
  67. package/dist/index-CCivzmxO.d.ts.map +1 -0
  68. package/dist/index-CLmTrcu5.d.ts +22 -0
  69. package/dist/index-CLmTrcu5.d.ts.map +1 -0
  70. package/dist/index-CZX5OeOF.d.ts +235 -0
  71. package/dist/index-CZX5OeOF.d.ts.map +1 -0
  72. package/dist/index-CdFmEfZO.d.ts +359 -0
  73. package/dist/index-CdFmEfZO.d.ts.map +1 -0
  74. package/dist/index-Cuh6eMWc.d.ts +285 -0
  75. package/dist/index-Cuh6eMWc.d.ts.map +1 -0
  76. package/dist/index-DuOGj7vc.d.ts +107 -0
  77. package/dist/index-DuOGj7vc.d.ts.map +1 -0
  78. package/dist/index-ccZ1XOHw.d.ts +69 -0
  79. package/dist/index-ccZ1XOHw.d.ts.map +1 -0
  80. package/dist/index-n8JTpNf1.d.ts +247 -0
  81. package/dist/index-n8JTpNf1.d.ts.map +1 -0
  82. package/dist/index-pwW1OsOx.d.ts +134 -0
  83. package/dist/index-pwW1OsOx.d.ts.map +1 -0
  84. package/dist/index-zK1ZwS4m.d.ts +347 -0
  85. package/dist/index-zK1ZwS4m.d.ts.map +1 -0
  86. package/dist/limits-hjrO8zUG.js +80 -0
  87. package/dist/limits-hjrO8zUG.js.map +1 -0
  88. package/dist/mastra/index.d.ts +14 -0
  89. package/dist/mastra/index.d.ts.map +1 -0
  90. package/dist/mastra/index.js +26 -0
  91. package/dist/mastra/index.js.map +1 -0
  92. package/dist/mastra-vector-Dhc6XZ8l.js +234 -0
  93. package/dist/mastra-vector-Dhc6XZ8l.js.map +1 -0
  94. package/dist/mcp/index.d.ts +80 -0
  95. package/dist/mcp/index.d.ts.map +1 -0
  96. package/dist/mcp/index.js +97 -0
  97. package/dist/mcp/index.js.map +1 -0
  98. package/dist/modules/artifacts/index.d.ts +337 -0
  99. package/dist/modules/artifacts/index.d.ts.map +1 -0
  100. package/dist/modules/artifacts/index.js +348 -0
  101. package/dist/modules/artifacts/index.js.map +1 -0
  102. package/dist/modules/browser/index.d.ts +516 -0
  103. package/dist/modules/browser/index.d.ts.map +1 -0
  104. package/dist/modules/browser/index.js +475 -0
  105. package/dist/modules/browser/index.js.map +1 -0
  106. package/dist/modules/calendar/index.d.ts +93 -0
  107. package/dist/modules/calendar/index.d.ts.map +1 -0
  108. package/dist/modules/calendar/index.js +131 -0
  109. package/dist/modules/calendar/index.js.map +1 -0
  110. package/dist/modules/code-sandbox/index.d.ts +317 -0
  111. package/dist/modules/code-sandbox/index.d.ts.map +1 -0
  112. package/dist/modules/code-sandbox/index.js +537 -0
  113. package/dist/modules/code-sandbox/index.js.map +1 -0
  114. package/dist/modules/content-type/index.d.ts +22 -0
  115. package/dist/modules/content-type/index.d.ts.map +1 -0
  116. package/dist/modules/content-type/index.js +66 -0
  117. package/dist/modules/content-type/index.js.map +1 -0
  118. package/dist/modules/crypto/index.d.ts +115 -0
  119. package/dist/modules/crypto/index.d.ts.map +1 -0
  120. package/dist/modules/crypto/index.js +139 -0
  121. package/dist/modules/crypto/index.js.map +1 -0
  122. package/dist/modules/document/index.d.ts +575 -0
  123. package/dist/modules/document/index.d.ts.map +1 -0
  124. package/dist/modules/document/index.js +444 -0
  125. package/dist/modules/document/index.js.map +1 -0
  126. package/dist/modules/document-extract/index.d.ts +438 -0
  127. package/dist/modules/document-extract/index.d.ts.map +1 -0
  128. package/dist/modules/document-extract/index.js +127 -0
  129. package/dist/modules/document-extract/index.js.map +1 -0
  130. package/dist/modules/document-render/index.d.ts +336 -0
  131. package/dist/modules/document-render/index.d.ts.map +1 -0
  132. package/dist/modules/document-render/index.js +155 -0
  133. package/dist/modules/document-render/index.js.map +1 -0
  134. package/dist/modules/email/index.d.ts +311 -0
  135. package/dist/modules/email/index.d.ts.map +1 -0
  136. package/dist/modules/email/index.js +167 -0
  137. package/dist/modules/email/index.js.map +1 -0
  138. package/dist/modules/email-message/index.d.ts +95 -0
  139. package/dist/modules/email-message/index.d.ts.map +1 -0
  140. package/dist/modules/email-message/index.js +264 -0
  141. package/dist/modules/email-message/index.js.map +1 -0
  142. package/dist/modules/file-convert/index.d.ts +273 -0
  143. package/dist/modules/file-convert/index.d.ts.map +1 -0
  144. package/dist/modules/file-convert/index.js +103 -0
  145. package/dist/modules/file-convert/index.js.map +1 -0
  146. package/dist/modules/files/index.d.ts +452 -0
  147. package/dist/modules/files/index.d.ts.map +1 -0
  148. package/dist/modules/files/index.js +733 -0
  149. package/dist/modules/files/index.js.map +1 -0
  150. package/dist/modules/image/index.d.ts +342 -0
  151. package/dist/modules/image/index.d.ts.map +1 -0
  152. package/dist/modules/image/index.js +281 -0
  153. package/dist/modules/image/index.js.map +1 -0
  154. package/dist/modules/messaging/index.d.ts +608 -0
  155. package/dist/modules/messaging/index.d.ts.map +1 -0
  156. package/dist/modules/messaging/index.js +1067 -0
  157. package/dist/modules/messaging/index.js.map +1 -0
  158. package/dist/modules/pdf/index.d.ts +287 -0
  159. package/dist/modules/pdf/index.d.ts.map +1 -0
  160. package/dist/modules/pdf/index.js +259 -0
  161. package/dist/modules/pdf/index.js.map +1 -0
  162. package/dist/modules/presentation/index.d.ts +247 -0
  163. package/dist/modules/presentation/index.d.ts.map +1 -0
  164. package/dist/modules/presentation/index.js +12657 -0
  165. package/dist/modules/presentation/index.js.map +1 -0
  166. package/dist/modules/queue/index.d.ts +129 -0
  167. package/dist/modules/queue/index.d.ts.map +1 -0
  168. package/dist/modules/queue/index.js +131 -0
  169. package/dist/modules/queue/index.js.map +1 -0
  170. package/dist/modules/rag/index.d.ts +250 -0
  171. package/dist/modules/rag/index.d.ts.map +1 -0
  172. package/dist/modules/rag/index.js +366 -0
  173. package/dist/modules/rag/index.js.map +1 -0
  174. package/dist/modules/scheduler/index.d.ts +216 -0
  175. package/dist/modules/scheduler/index.d.ts.map +1 -0
  176. package/dist/modules/scheduler/index.js +153 -0
  177. package/dist/modules/scheduler/index.js.map +1 -0
  178. package/dist/modules/skills/index.d.ts +205 -0
  179. package/dist/modules/skills/index.d.ts.map +1 -0
  180. package/dist/modules/skills/index.js +203 -0
  181. package/dist/modules/skills/index.js.map +1 -0
  182. package/dist/modules/tasks/index.d.ts +287 -0
  183. package/dist/modules/tasks/index.d.ts.map +1 -0
  184. package/dist/modules/tasks/index.js +207 -0
  185. package/dist/modules/tasks/index.js.map +1 -0
  186. package/dist/modules/vector-store/index.d.ts +3 -0
  187. package/dist/modules/vector-store/index.js +3 -0
  188. package/dist/modules/web-fetch/index.d.ts +99 -0
  189. package/dist/modules/web-fetch/index.d.ts.map +1 -0
  190. package/dist/modules/web-fetch/index.js +242 -0
  191. package/dist/modules/web-fetch/index.js.map +1 -0
  192. package/dist/object-artifact-store-CMTzCm_G.d.ts +7 -0
  193. package/dist/object-artifact-store-CMTzCm_G.d.ts.map +1 -0
  194. package/dist/object-artifact-store-wZ2j9cto.js +28 -0
  195. package/dist/object-artifact-store-wZ2j9cto.js.map +1 -0
  196. package/dist/pinecone-umY4t6OF.js +190 -0
  197. package/dist/pinecone-umY4t6OF.js.map +1 -0
  198. package/dist/provider-CgDAlg6K.js +34 -0
  199. package/dist/provider-CgDAlg6K.js.map +1 -0
  200. package/dist/qdrant-DMp4NhKR.js +253 -0
  201. package/dist/qdrant-DMp4NhKR.js.map +1 -0
  202. package/dist/resend-BAC38_dA.js +155 -0
  203. package/dist/resend-BAC38_dA.js.map +1 -0
  204. package/dist/s3-CsOaPWMP.js +955 -0
  205. package/dist/s3-CsOaPWMP.js.map +1 -0
  206. package/dist/schemas-ChOAhdo9.js +192 -0
  207. package/dist/schemas-ChOAhdo9.js.map +1 -0
  208. package/dist/slack-Di5BBNpt.js +1455 -0
  209. package/dist/slack-Di5BBNpt.js.map +1 -0
  210. package/dist/sqs-DCwS1i2N.js +225 -0
  211. package/dist/sqs-DCwS1i2N.js.map +1 -0
  212. package/dist/supabase-vector-Dpp9mmJR.js +218 -0
  213. package/dist/supabase-vector-Dpp9mmJR.js.map +1 -0
  214. package/dist/tanstack/index.d.ts +15 -0
  215. package/dist/tanstack/index.d.ts.map +1 -0
  216. package/dist/tanstack/index.js +28 -0
  217. package/dist/tanstack/index.js.map +1 -0
  218. package/dist/teams-DYAHNb39.js +835 -0
  219. package/dist/teams-DYAHNb39.js.map +1 -0
  220. package/dist/telegram-DDXWzkfL.js +734 -0
  221. package/dist/telegram-DDXWzkfL.js.map +1 -0
  222. package/dist/textract-CPLiB22H.js +554 -0
  223. package/dist/textract-CPLiB22H.js.map +1 -0
  224. package/dist/transport-B4vn-XiQ.js +157 -0
  225. package/dist/transport-B4vn-XiQ.js.map +1 -0
  226. package/dist/transport-i96ACAI_.d.ts +46 -0
  227. package/dist/transport-i96ACAI_.d.ts.map +1 -0
  228. package/dist/types-Ccb0DXY9.d.ts +150 -0
  229. package/dist/types-Ccb0DXY9.d.ts.map +1 -0
  230. package/dist/unique-EwBH1JPB.js +19 -0
  231. package/dist/unique-EwBH1JPB.js.map +1 -0
  232. package/dist/vector-store-C3nEO80e.js +193 -0
  233. package/dist/vector-store-C3nEO80e.js.map +1 -0
  234. package/dist/vendors/amazon-sp-api/index.d.ts +526 -0
  235. package/dist/vendors/amazon-sp-api/index.d.ts.map +1 -0
  236. package/dist/vendors/amazon-sp-api/index.js +975 -0
  237. package/dist/vendors/amazon-sp-api/index.js.map +1 -0
  238. package/dist/vendors/bedrock-agentcore-browser/index.d.ts +2 -0
  239. package/dist/vendors/bedrock-agentcore-browser/index.js +2 -0
  240. package/dist/vendors/bedrock-agentcore-code-interpreter/index.d.ts +228 -0
  241. package/dist/vendors/bedrock-agentcore-code-interpreter/index.d.ts.map +1 -0
  242. package/dist/vendors/bedrock-agentcore-code-interpreter/index.js +2 -0
  243. package/dist/vendors/cloudflare-browser/index.d.ts +2 -0
  244. package/dist/vendors/cloudflare-browser/index.js +2 -0
  245. package/dist/vendors/cloudflare-email/index.d.ts +260 -0
  246. package/dist/vendors/cloudflare-email/index.d.ts.map +1 -0
  247. package/dist/vendors/cloudflare-email/index.js +3 -0
  248. package/dist/vendors/cloudflare-sandbox/index.d.ts +565 -0
  249. package/dist/vendors/cloudflare-sandbox/index.d.ts.map +1 -0
  250. package/dist/vendors/cloudflare-sandbox/index.js +2 -0
  251. package/dist/vendors/eventbridge-scheduler/index.d.ts +2 -0
  252. package/dist/vendors/eventbridge-scheduler/index.js +2 -0
  253. package/dist/vendors/gotenberg/index.d.ts +306 -0
  254. package/dist/vendors/gotenberg/index.d.ts.map +1 -0
  255. package/dist/vendors/gotenberg/index.js +2 -0
  256. package/dist/vendors/imessage/index.d.ts +420 -0
  257. package/dist/vendors/imessage/index.d.ts.map +1 -0
  258. package/dist/vendors/imessage/index.js +4 -0
  259. package/dist/vendors/katana/index.d.ts +1570 -0
  260. package/dist/vendors/katana/index.d.ts.map +1 -0
  261. package/dist/vendors/katana/index.js +1639 -0
  262. package/dist/vendors/katana/index.js.map +1 -0
  263. package/dist/vendors/mastra-vector/index.d.ts +120 -0
  264. package/dist/vendors/mastra-vector/index.d.ts.map +1 -0
  265. package/dist/vendors/mastra-vector/index.js +3 -0
  266. package/dist/vendors/pinecone/index.d.ts +75 -0
  267. package/dist/vendors/pinecone/index.d.ts.map +1 -0
  268. package/dist/vendors/pinecone/index.js +3 -0
  269. package/dist/vendors/qdrant/index.d.ts +75 -0
  270. package/dist/vendors/qdrant/index.d.ts.map +1 -0
  271. package/dist/vendors/qdrant/index.js +3 -0
  272. package/dist/vendors/resend/index.d.ts +3 -0
  273. package/dist/vendors/resend/index.js +3 -0
  274. package/dist/vendors/s3/index.d.ts +2 -0
  275. package/dist/vendors/s3/index.js +2 -0
  276. package/dist/vendors/slack/index.d.ts +576 -0
  277. package/dist/vendors/slack/index.d.ts.map +1 -0
  278. package/dist/vendors/slack/index.js +3 -0
  279. package/dist/vendors/sqs/index.d.ts +2 -0
  280. package/dist/vendors/sqs/index.js +2 -0
  281. package/dist/vendors/supabase-vector/index.d.ts +89 -0
  282. package/dist/vendors/supabase-vector/index.d.ts.map +1 -0
  283. package/dist/vendors/supabase-vector/index.js +3 -0
  284. package/dist/vendors/teams/index.d.ts +303 -0
  285. package/dist/vendors/teams/index.d.ts.map +1 -0
  286. package/dist/vendors/teams/index.js +3 -0
  287. package/dist/vendors/telegram/index.d.ts +319 -0
  288. package/dist/vendors/telegram/index.d.ts.map +1 -0
  289. package/dist/vendors/telegram/index.js +3 -0
  290. package/dist/vendors/textract/index.d.ts +2 -0
  291. package/dist/vendors/textract/index.js +2 -0
  292. package/dist/vendors/woocommerce/index.d.ts +1700 -0
  293. package/dist/vendors/woocommerce/index.d.ts.map +1 -0
  294. package/dist/vendors/woocommerce/index.js +1427 -0
  295. package/dist/vendors/woocommerce/index.js.map +1 -0
  296. package/dist/with-auth-CpKqTrGK.js +240 -0
  297. package/dist/with-auth-CpKqTrGK.js.map +1 -0
  298. package/logos/LUCIDE-ATTRIBUTION.txt +4 -0
  299. package/logos/README.md +89 -0
  300. package/logos/amazon.svg +6 -0
  301. package/logos/artifacts.svg +9 -0
  302. package/logos/browser.svg +9 -0
  303. package/logos/calendar.svg +15 -0
  304. package/logos/cloudflare-browser.svg +5 -0
  305. package/logos/cloudflare-email.svg +5 -0
  306. package/logos/cloudflare.svg +4 -0
  307. package/logos/code-sandbox.svg +8 -0
  308. package/logos/content-type.svg +10 -0
  309. package/logos/crypto.svg +7 -0
  310. package/logos/document-extract.svg +12 -0
  311. package/logos/document-render.svg +8 -0
  312. package/logos/document.svg +10 -0
  313. package/logos/email-message.svg +8 -0
  314. package/logos/email.svg +7 -0
  315. package/logos/file-convert.svg +9 -0
  316. package/logos/files.svg +6 -0
  317. package/logos/gotenberg.svg +340 -0
  318. package/logos/image.svg +8 -0
  319. package/logos/imessage.svg +7 -0
  320. package/logos/katana.svg +13 -0
  321. package/logos/mastra.svg +7 -0
  322. package/logos/messaging.svg +7 -0
  323. package/logos/pack-logos.json +48 -0
  324. package/logos/pdf.svg +10 -0
  325. package/logos/pinecone.svg +25 -0
  326. package/logos/presentation.svg +8 -0
  327. package/logos/qdrant.svg +4 -0
  328. package/logos/queue.svg +11 -0
  329. package/logos/rag.svg +18 -0
  330. package/logos/resend.svg +5 -0
  331. package/logos/scheduler.svg +7 -0
  332. package/logos/skills.svg +10 -0
  333. package/logos/slack.svg +14 -0
  334. package/logos/supabase.svg +4 -0
  335. package/logos/tasks.svg +10 -0
  336. package/logos/teams.svg +6 -0
  337. package/logos/telegram.svg +10 -0
  338. package/logos/textract.svg +5 -0
  339. package/logos/vector-store.svg +8 -0
  340. package/logos/web-fetch.svg +8 -0
  341. package/logos/woocommerce.svg +4 -0
  342. package/package.json +373 -0
@@ -0,0 +1,733 @@
1
+ import { t as ToolError } from "../../errors-DoSpNHvs.js";
2
+ import { n as defineModule, r as defineTool } from "../../define-CvpJ_pNP.js";
3
+ import { n as requireAuth } from "../../provider-CgDAlg6K.js";
4
+ import { t as artifactRefSchema } from "../../artifact-D064mHfK.js";
5
+ import { n as bytesToBase64, r as bytesToUtf8 } from "../../bytes-BxpimpQx.js";
6
+ import { m as s3AuthSchema, p as S3Client } from "../../s3-CsOaPWMP.js";
7
+ import { z } from "zod";
8
+ //#region src/modules/files/contracts.ts
9
+ /** Max bytes for a single range read through files tools. */
10
+ const MAX_FILES_RANGE_BYTES = 8 * 1024 * 1024;
11
+ /** Max lines for files-read-lines. */
12
+ const MAX_FILES_READ_LINES = 2e3;
13
+ /** Max UTF-8 bytes scanned for line reads. */
14
+ const MAX_FILES_LINES_SCAN_BYTES = 2 * 1024 * 1024;
15
+ const filesAuthSchema = z.object({
16
+ root_prefix: z.string().min(1).describe("Object key prefix for this workspace, for example orgs/acme/files/ (no leading slash)"),
17
+ storage: s3AuthSchema.describe("S3-compatible object storage credentials (AWS S3, R2 S3 endpoint, MinIO, …) for this workspace")
18
+ });
19
+ const fileItemSchema = z.object({
20
+ path: z.string().describe("Path relative to the bound root_prefix"),
21
+ kind: z.enum(["file", "folder"]).describe("Object file or common-prefix folder"),
22
+ size: z.number().optional().describe("Byte size when kind is file and known"),
23
+ last_modified: z.string().optional().describe("Last-modified timestamp when known"),
24
+ etag: z.string().optional().describe("ETag when known"),
25
+ media_type: z.string().optional().describe("Content-Type when known from head")
26
+ });
27
+ const filesListInputSchema = z.object({
28
+ path: z.string().optional().describe("Relative folder path under root (no leading slash). Omit for workspace root"),
29
+ cursor: z.string().min(1).optional().describe("Pagination cursor from a prior list call"),
30
+ limit: z.int().min(1).max(1e3).optional().describe("Maximum items to return (1-1000)")
31
+ });
32
+ const filesListOutputSchema = z.object({
33
+ items: z.array(fileItemSchema),
34
+ next_cursor: z.string().optional().describe("Pass as cursor for the next page"),
35
+ truncated: z.boolean()
36
+ });
37
+ const filesSearchInputSchema = z.object({
38
+ query: z.string().min(1).max(200).describe("Literal name fragment to match against the last path segment (not full-text content)"),
39
+ path: z.string().optional().describe("Optional relative folder to search under. Omit to search the whole root prefix"),
40
+ cursor: z.string().min(1).optional().describe("Pagination cursor from a prior search call"),
41
+ limit: z.int().min(1).max(1e3).optional().describe("Maximum items to scan/return (1-1000)")
42
+ });
43
+ const filesSearchOutputSchema = z.object({
44
+ items: z.array(fileItemSchema),
45
+ next_cursor: z.string().optional(),
46
+ truncated: z.boolean()
47
+ });
48
+ const filesStatInputSchema = z.object({ path: z.string().min(1).describe("Relative file path under root (no leading slash)") });
49
+ const filesStatOutputSchema = z.object({
50
+ exists: z.boolean(),
51
+ item: fileItemSchema.optional()
52
+ });
53
+ const filesGetInputSchema = z.object({
54
+ path: z.string().min(1).describe("Relative file path under root"),
55
+ encoding: z.enum(["base64", "utf8"]).optional().describe("Body encoding. Defaults to base64")
56
+ });
57
+ const filesGetOutputSchema = z.object({
58
+ path: z.string(),
59
+ body: z.string().describe("File body encoded per encoding"),
60
+ encoding: z.enum(["base64", "utf8"]),
61
+ content_type: z.string().optional(),
62
+ content_length: z.number().optional()
63
+ });
64
+ const filesGetRangeInputSchema = z.object({
65
+ path: z.string().min(1).describe("Relative file path under root"),
66
+ start_byte: z.int().min(0).describe("Inclusive start byte offset"),
67
+ end_byte: z.int().min(0).describe(`Inclusive end byte offset (range size max ${MAX_FILES_RANGE_BYTES} bytes)`),
68
+ encoding: z.enum(["base64", "utf8"]).optional().describe("Body encoding. Defaults to base64")
69
+ });
70
+ const filesGetRangeOutputSchema = z.object({
71
+ path: z.string(),
72
+ body: z.string().describe("Range body encoded per encoding"),
73
+ encoding: z.enum(["base64", "utf8"]),
74
+ start_byte: z.number().int().nonnegative(),
75
+ end_byte: z.number().int().nonnegative(),
76
+ total_bytes: z.number().int().nonnegative().optional().describe("Full object size when known"),
77
+ content_type: z.string().optional()
78
+ });
79
+ const filesReadLinesInputSchema = z.object({
80
+ path: z.string().min(1).describe("Relative file path under root (UTF-8 text)"),
81
+ start_line: z.int().min(1).optional().describe("1-based start line (default 1)"),
82
+ max_lines: z.int().min(1).max(MAX_FILES_READ_LINES).optional().describe(`Max lines to return (default 200, max ${MAX_FILES_READ_LINES})`)
83
+ });
84
+ const filesReadLinesOutputSchema = z.object({
85
+ path: z.string(),
86
+ start_line: z.number().int().positive(),
87
+ lines: z.array(z.string()),
88
+ truncated: z.boolean().describe("True when more lines may exist after this page"),
89
+ next_start_line: z.number().int().positive().optional().describe("Pass as start_line for the next page")
90
+ });
91
+ const filesCreateArtifactInputSchema = z.object({
92
+ path: z.string().min(1).describe("Relative file path under root to expose as ArtifactRef"),
93
+ filename: z.string().min(1).optional().describe("Display filename on the ArtifactRef"),
94
+ media_type: z.string().min(1).optional().describe("MIME type override (defaults from head when known)")
95
+ });
96
+ const filesCreateArtifactOutputSchema = z.object({
97
+ path: z.string(),
98
+ artifact: artifactRefSchema.describe("Object-store ArtifactRef for the same object (logical key under storage key_prefix + root_prefix)")
99
+ });
100
+ const filesPutInputSchema = z.object({
101
+ path: z.string().min(1).describe("Relative file path under root to write or replace"),
102
+ body: z.string().describe("File body as utf8 text or base64 (see body_encoding)"),
103
+ body_encoding: z.enum(["utf8", "base64"]).optional().describe("How to interpret body. Defaults to utf8"),
104
+ content_type: z.string().optional().describe("Content-Type to store")
105
+ });
106
+ const filesPutOutputSchema = z.object({
107
+ path: z.string(),
108
+ content_length: z.number(),
109
+ etag: z.string().optional()
110
+ });
111
+ const filesDeleteInputSchema = z.object({ path: z.string().min(1).describe("Relative file path under root to delete") });
112
+ const filesDeleteOutputSchema = z.object({
113
+ path: z.string(),
114
+ deleted: z.boolean()
115
+ });
116
+ const filesCopyInputSchema = z.object({
117
+ source_path: z.string().min(1).describe("Relative source path under root"),
118
+ destination_path: z.string().min(1).describe("Relative destination path under root")
119
+ });
120
+ const filesCopyOutputSchema = z.object({
121
+ source_path: z.string(),
122
+ destination_path: z.string(),
123
+ etag: z.string().optional()
124
+ });
125
+ const filesMkdirInputSchema = z.object({ path: z.string().min(1).describe("Relative folder path under root. Creates a marker object so the prefix is listable") });
126
+ const filesMkdirOutputSchema = z.object({
127
+ path: z.string(),
128
+ created: z.boolean()
129
+ });
130
+ const filesMoveInputSchema = z.object({
131
+ source_path: z.string().min(1).describe("Relative source path under root to move from"),
132
+ destination_path: z.string().min(1).describe("Relative destination path under root to move to")
133
+ });
134
+ const filesMoveOutputSchema = z.object({
135
+ source_path: z.string(),
136
+ destination_path: z.string(),
137
+ etag: z.string().optional().describe("ETag of the destination object after copy")
138
+ });
139
+ const filesMultipartStartInputSchema = z.object({
140
+ path: z.string().min(1).describe("Relative file path under root for the multipart upload"),
141
+ content_type: z.string().optional().describe("Content-Type stored on the completed object")
142
+ });
143
+ const filesMultipartStartOutputSchema = z.object({
144
+ path: z.string(),
145
+ upload_id: z.string().min(1).describe("Upload id for subsequent part/complete/abort calls")
146
+ });
147
+ const filesMultipartUploadPartInputSchema = z.object({
148
+ path: z.string().min(1).describe("Relative file path under root for the in-progress multipart upload"),
149
+ upload_id: z.string().min(1).describe("Upload id from files-multipart-start"),
150
+ part_number: z.int().min(1).max(1e4).describe("Part number (1-10000)"),
151
+ body: z.string().describe("Part body as utf8 text or base64 (see body_encoding)"),
152
+ body_encoding: z.enum(["utf8", "base64"]).optional().describe("How to interpret body. Defaults to utf8")
153
+ });
154
+ const filesMultipartUploadPartOutputSchema = z.object({
155
+ path: z.string(),
156
+ upload_id: z.string(),
157
+ part_number: z.int(),
158
+ etag: z.string().min(1).describe("Part ETag required when completing the multipart upload"),
159
+ content_length: z.number()
160
+ });
161
+ const filesMultipartPartSchema = z.object({
162
+ part_number: z.int().min(1).max(1e4).describe("Uploaded part number from files-multipart-upload-part"),
163
+ etag: z.string().min(1).describe("ETag returned by files-multipart-upload-part")
164
+ });
165
+ const filesMultipartCompleteInputSchema = z.object({
166
+ path: z.string().min(1).describe("Relative file path under root for the in-progress multipart upload"),
167
+ upload_id: z.string().min(1).describe("Upload id from files-multipart-start"),
168
+ parts: z.array(filesMultipartPartSchema).min(1).max(1e4).describe("Uploaded parts with part_number and etag (any order; sorted before complete)")
169
+ });
170
+ const filesMultipartCompleteOutputSchema = z.object({
171
+ path: z.string(),
172
+ upload_id: z.string(),
173
+ etag: z.string().optional()
174
+ });
175
+ const filesMultipartAbortInputSchema = z.object({
176
+ path: z.string().min(1).describe("Relative file path under root for the in-progress multipart upload"),
177
+ upload_id: z.string().min(1).describe("Upload id from files-multipart-start")
178
+ });
179
+ const filesMultipartAbortOutputSchema = z.object({
180
+ path: z.string(),
181
+ upload_id: z.string(),
182
+ aborted: z.boolean()
183
+ });
184
+ //#endregion
185
+ //#region src/modules/files/path.ts
186
+ /** Reject path segments that are parent references; allow names like `report..final.pdf`. */
187
+ function assertNoParentSegments(segments, code) {
188
+ for (const segment of segments) if (segment === "..") throw new ToolError(code === "bad_auth" ? "root_prefix must not contain parent-directory segments" : "Path must not contain parent-directory segments", { code });
189
+ }
190
+ /** Normalize root to a non-absolute prefix that always ends with `/`. */
191
+ function normalizeRootPrefix(rootPrefix) {
192
+ let root = rootPrefix.trim().replaceAll("\\", "/");
193
+ if (root.startsWith("/")) throw new ToolError("root_prefix must not be absolute (no leading /)", { code: "bad_auth" });
194
+ root = root.replace(/\/+/g, "/");
195
+ const segments = root.split("/").filter((segment) => segment.length > 0 && segment !== ".");
196
+ assertNoParentSegments(segments, "bad_auth");
197
+ if (segments.length === 0) throw new ToolError("root_prefix must not be empty", { code: "bad_auth" });
198
+ return `${segments.join("/")}/`;
199
+ }
200
+ /** Resolve a model-facing relative key under root. Rejects escapes. */
201
+ function resolveUnderRoot(root, relativePath) {
202
+ const rel = relativePath.trim().replaceAll("\\", "/").replace(/^\/+/, "");
203
+ if (rel.length === 0) throw new ToolError("Path must not be empty", { code: "bad_input" });
204
+ if (rel.startsWith("/")) throw new ToolError("Invalid path", { code: "bad_input" });
205
+ const segments = rel.split("/").filter((segment) => segment.length > 0 && segment !== ".");
206
+ assertNoParentSegments(segments, "bad_input");
207
+ if (segments.length === 0) throw new ToolError("Path must not be empty", { code: "bad_input" });
208
+ return `${root}${segments.join("/")}`;
209
+ }
210
+ /** Prefix for listing (relative folder path, may be empty for root). */
211
+ function resolveListPrefix(root, relativePath) {
212
+ if (!relativePath || !relativePath.trim()) return root;
213
+ const segments = relativePath.trim().replaceAll("\\", "/").replace(/^\/+/, "").replace(/\/+$/, "").split("/").filter((segment) => segment.length > 0 && segment !== ".");
214
+ assertNoParentSegments(segments, "bad_input");
215
+ if (segments.length === 0) return root;
216
+ return `${root}${segments.join("/")}/`;
217
+ }
218
+ /** Map absolute object key back to relative, or undefined if outside root. */
219
+ function toRelativeKey(root, absoluteKey) {
220
+ if (!absoluteKey.startsWith(root)) return void 0;
221
+ return absoluteKey.slice(root.length);
222
+ }
223
+ function basename(relativeKey) {
224
+ const parts = relativeKey.replace(/\/+$/, "").split("/");
225
+ return parts[parts.length - 1] ?? relativeKey;
226
+ }
227
+ //#endregion
228
+ //#region src/modules/files/client.ts
229
+ /**
230
+ * Files client — path-rooted workspace over S3Client.
231
+ * Host: withAuth + fromContext. Tools stay thin adapters.
232
+ */
233
+ function transportOptions(ctx) {
234
+ return {
235
+ ...ctx.fetch && { fetch: ctx.fetch },
236
+ ...ctx.signal && { signal: ctx.signal }
237
+ };
238
+ }
239
+ var FilesClient = class FilesClient {
240
+ #s3;
241
+ #root;
242
+ constructor(auth, ctx = {}) {
243
+ const parsed = filesAuthSchema.safeParse(auth);
244
+ if (!parsed.success) throw new ToolError("Invalid files auth credentials", {
245
+ code: "bad_auth",
246
+ details: { issues: parsed.error.issues.map((issue) => issue.message) }
247
+ });
248
+ this.#root = normalizeRootPrefix(parsed.data.root_prefix);
249
+ this.#s3 = new S3Client(parsed.data.storage, transportOptions(ctx));
250
+ }
251
+ static fromContext(ctx) {
252
+ const auth = requireAuth(ctx, filesAuthSchema);
253
+ return new FilesClient(auth, ctx);
254
+ }
255
+ static fromAuth(auth, ctx = {}) {
256
+ return new FilesClient(auth, ctx);
257
+ }
258
+ async list(input) {
259
+ const prefix = resolveListPrefix(this.#root, input.path);
260
+ const listed = await this.#s3.list({
261
+ prefix,
262
+ delimiter: "/",
263
+ ...input.cursor && { cursor: input.cursor },
264
+ ...input.limit !== void 0 && { limit: input.limit }
265
+ });
266
+ const items = [];
267
+ for (const obj of listed.items) {
268
+ const rel = toRelativeKey(this.#root, obj.key);
269
+ if (!rel) continue;
270
+ items.push({
271
+ path: rel,
272
+ kind: "file",
273
+ ...obj.size !== void 0 && { size: obj.size },
274
+ ...obj.last_modified && { last_modified: obj.last_modified },
275
+ ...obj.etag && { etag: obj.etag }
276
+ });
277
+ }
278
+ if (listed.common_prefixes) for (const folderAbs of listed.common_prefixes) {
279
+ const rel = toRelativeKey(this.#root, folderAbs.endsWith("/") ? folderAbs.slice(0, -1) : folderAbs);
280
+ if (!rel) continue;
281
+ const folderPath = folderAbs.endsWith("/") ? toRelativeKey(this.#root, folderAbs.slice(0, -1)) ?? rel : rel;
282
+ items.push({
283
+ path: folderPath.endsWith("/") ? folderPath.slice(0, -1) : folderPath,
284
+ kind: "folder"
285
+ });
286
+ }
287
+ return filesListOutputSchema.parse({
288
+ items,
289
+ truncated: listed.truncated,
290
+ ...listed.next_cursor && { next_cursor: listed.next_cursor }
291
+ });
292
+ }
293
+ async search(input) {
294
+ const prefix = resolveListPrefix(this.#root, input.path);
295
+ const listed = await this.#s3.list({
296
+ prefix,
297
+ ...input.cursor && { cursor: input.cursor },
298
+ ...input.limit !== void 0 && { limit: input.limit }
299
+ });
300
+ const needle = input.query.toLowerCase();
301
+ const items = [];
302
+ for (const obj of listed.items) {
303
+ const rel = toRelativeKey(this.#root, obj.key);
304
+ if (!rel) continue;
305
+ if (!basename(rel).toLowerCase().includes(needle)) continue;
306
+ items.push({
307
+ path: rel,
308
+ kind: "file",
309
+ ...obj.size !== void 0 && { size: obj.size },
310
+ ...obj.last_modified && { last_modified: obj.last_modified },
311
+ ...obj.etag && { etag: obj.etag }
312
+ });
313
+ }
314
+ return filesSearchOutputSchema.parse({
315
+ items,
316
+ truncated: listed.truncated,
317
+ ...listed.next_cursor && { next_cursor: listed.next_cursor }
318
+ });
319
+ }
320
+ async stat(input) {
321
+ const absolute = resolveUnderRoot(this.#root, input.path);
322
+ const head = await this.#s3.head({ key: absolute });
323
+ if (!head.exists) return filesStatOutputSchema.parse({ exists: false });
324
+ const rel = toRelativeKey(this.#root, head.key) ?? input.path;
325
+ return filesStatOutputSchema.parse({
326
+ exists: true,
327
+ item: {
328
+ path: rel,
329
+ kind: "file",
330
+ ...head.content_length !== void 0 && { size: head.content_length },
331
+ ...head.etag && { etag: head.etag },
332
+ ...head.content_type && { media_type: head.content_type }
333
+ }
334
+ });
335
+ }
336
+ async get(input) {
337
+ const absolute = resolveUnderRoot(this.#root, input.path);
338
+ const got = await this.#s3.get({
339
+ key: absolute,
340
+ ...input.encoding && { encoding: input.encoding }
341
+ });
342
+ return filesGetOutputSchema.parse({
343
+ path: input.path,
344
+ body: got.body,
345
+ encoding: got.encoding,
346
+ ...got.content_type && { content_type: got.content_type },
347
+ ...got.content_length !== void 0 && { content_length: got.content_length }
348
+ });
349
+ }
350
+ async getRange(input) {
351
+ if (input.end_byte < input.start_byte) throw new ToolError("end_byte must be >= start_byte", { code: "bad_input" });
352
+ const rangeSize = input.end_byte - input.start_byte + 1;
353
+ if (rangeSize > 8388608) throw new ToolError(`Byte range exceeds max of ${MAX_FILES_RANGE_BYTES} bytes`, {
354
+ code: "too_large",
355
+ details: {
356
+ max_bytes: MAX_FILES_RANGE_BYTES,
357
+ requested_bytes: rangeSize
358
+ }
359
+ });
360
+ const absolute = resolveUnderRoot(this.#root, input.path);
361
+ const range = await this.#s3.getBytesRange(absolute, {
362
+ start_byte: input.start_byte,
363
+ end_byte: input.end_byte
364
+ });
365
+ const encoding = input.encoding ?? "base64";
366
+ const body = encoding === "utf8" ? bytesToUtf8(range.bytes) : bytesToBase64(range.bytes);
367
+ return filesGetRangeOutputSchema.parse({
368
+ path: input.path,
369
+ body,
370
+ encoding,
371
+ start_byte: range.start_byte,
372
+ end_byte: range.end_byte,
373
+ ...range.total_bytes !== void 0 && { total_bytes: range.total_bytes },
374
+ ...range.content_type && { content_type: range.content_type }
375
+ });
376
+ }
377
+ async readLines(input) {
378
+ const startLine = input.start_line ?? 1;
379
+ const maxLines = input.max_lines ?? 200;
380
+ const absolute = resolveUnderRoot(this.#root, input.path);
381
+ const range = await this.#s3.getBytesRange(absolute, {
382
+ start_byte: 0,
383
+ end_byte: MAX_FILES_LINES_SCAN_BYTES - 1
384
+ });
385
+ const allLines = bytesToUtf8(range.bytes).split(/\r\n|\n|\r/);
386
+ if (allLines.length > 0 && allLines[allLines.length - 1] === "") allLines.pop();
387
+ const sliceStart = startLine - 1;
388
+ const page = allLines.slice(sliceStart, sliceStart + maxLines);
389
+ const scannedAll = range.total_bytes === void 0 || range.end_byte >= range.total_bytes - 1;
390
+ const truncated = sliceStart + page.length < allLines.length || !scannedAll;
391
+ return filesReadLinesOutputSchema.parse({
392
+ path: input.path,
393
+ start_line: startLine,
394
+ lines: page,
395
+ truncated,
396
+ ...truncated && { next_start_line: startLine + page.length }
397
+ });
398
+ }
399
+ async createArtifact(input) {
400
+ const absolute = resolveUnderRoot(this.#root, input.path);
401
+ const head = await this.#s3.head({ key: absolute });
402
+ if (!head.exists) throw new ToolError("File not found", {
403
+ code: "not_found",
404
+ details: { path: input.path }
405
+ });
406
+ const artifact = {
407
+ store: "object",
408
+ key: absolute,
409
+ ...input.filename && { filename: input.filename },
410
+ ...input.media_type ? { media_type: input.media_type } : head.content_type ? { media_type: head.content_type } : {},
411
+ ...head.content_length !== void 0 && { byte_length: head.content_length }
412
+ };
413
+ return filesCreateArtifactOutputSchema.parse({
414
+ path: input.path,
415
+ artifact
416
+ });
417
+ }
418
+ async put(input) {
419
+ const absolute = resolveUnderRoot(this.#root, input.path);
420
+ const put = await this.#s3.put({
421
+ key: absolute,
422
+ body: input.body,
423
+ ...input.body_encoding && { body_encoding: input.body_encoding },
424
+ ...input.content_type && { content_type: input.content_type }
425
+ });
426
+ return filesPutOutputSchema.parse({
427
+ path: input.path,
428
+ content_length: put.content_length,
429
+ ...put.etag && { etag: put.etag }
430
+ });
431
+ }
432
+ async delete(input) {
433
+ const absolute = resolveUnderRoot(this.#root, input.path);
434
+ const result = await this.#s3.delete({ key: absolute });
435
+ return filesDeleteOutputSchema.parse({
436
+ path: input.path,
437
+ deleted: result.deleted
438
+ });
439
+ }
440
+ async copy(input) {
441
+ const source = resolveUnderRoot(this.#root, input.source_path);
442
+ const destination = resolveUnderRoot(this.#root, input.destination_path);
443
+ const result = await this.#s3.copy({
444
+ source_key: source,
445
+ destination_key: destination
446
+ });
447
+ return filesCopyOutputSchema.parse({
448
+ source_path: input.source_path,
449
+ destination_path: input.destination_path,
450
+ ...result.etag && { etag: result.etag }
451
+ });
452
+ }
453
+ async mkdir(input) {
454
+ const folder = input.path.trim().replaceAll("\\", "/").replace(/^\/+/, "").replace(/\/+$/, "");
455
+ const keepRelative = `${folder}/.keep`;
456
+ const absolute = resolveUnderRoot(this.#root, keepRelative);
457
+ await this.#s3.put({
458
+ key: absolute,
459
+ body: "",
460
+ body_encoding: "utf8",
461
+ content_type: "application/x-directory"
462
+ });
463
+ return filesMkdirOutputSchema.parse({
464
+ path: folder,
465
+ created: true
466
+ });
467
+ }
468
+ async move(input) {
469
+ const source = resolveUnderRoot(this.#root, input.source_path);
470
+ const destination = resolveUnderRoot(this.#root, input.destination_path);
471
+ if (source === destination) throw new ToolError("source_path and destination_path must differ", { code: "bad_input" });
472
+ const copied = await this.#s3.copy({
473
+ source_key: source,
474
+ destination_key: destination
475
+ });
476
+ await this.#s3.delete({ key: source });
477
+ return filesMoveOutputSchema.parse({
478
+ source_path: input.source_path,
479
+ destination_path: input.destination_path,
480
+ ...copied.etag && { etag: copied.etag }
481
+ });
482
+ }
483
+ async multipartStart(input) {
484
+ const absolute = resolveUnderRoot(this.#root, input.path);
485
+ const started = await this.#s3.createMultipartUpload({
486
+ key: absolute,
487
+ ...input.content_type && { content_type: input.content_type }
488
+ });
489
+ return filesMultipartStartOutputSchema.parse({
490
+ path: input.path,
491
+ upload_id: started.upload_id
492
+ });
493
+ }
494
+ async multipartUploadPart(input) {
495
+ const absolute = resolveUnderRoot(this.#root, input.path);
496
+ const part = await this.#s3.uploadPart({
497
+ key: absolute,
498
+ upload_id: input.upload_id,
499
+ part_number: input.part_number,
500
+ body: input.body,
501
+ ...input.body_encoding && { body_encoding: input.body_encoding }
502
+ });
503
+ return filesMultipartUploadPartOutputSchema.parse({
504
+ path: input.path,
505
+ upload_id: input.upload_id,
506
+ part_number: part.part_number,
507
+ etag: part.etag,
508
+ content_length: part.content_length
509
+ });
510
+ }
511
+ async multipartComplete(input) {
512
+ const absolute = resolveUnderRoot(this.#root, input.path);
513
+ const completed = await this.#s3.completeMultipartUpload({
514
+ key: absolute,
515
+ upload_id: input.upload_id,
516
+ parts: input.parts
517
+ });
518
+ return filesMultipartCompleteOutputSchema.parse({
519
+ path: input.path,
520
+ upload_id: input.upload_id,
521
+ ...completed.etag && { etag: completed.etag }
522
+ });
523
+ }
524
+ async multipartAbort(input) {
525
+ const absolute = resolveUnderRoot(this.#root, input.path);
526
+ const aborted = await this.#s3.abortMultipartUpload({
527
+ key: absolute,
528
+ upload_id: input.upload_id
529
+ });
530
+ return filesMultipartAbortOutputSchema.parse({
531
+ path: input.path,
532
+ upload_id: input.upload_id,
533
+ aborted: aborted.aborted
534
+ });
535
+ }
536
+ };
537
+ //#endregion
538
+ //#region src/modules/files/module.ts
539
+ const filesListTool = defineTool({
540
+ id: "files-list",
541
+ name: "listFiles",
542
+ description: "List files and folders under a relative path in the bound workspace root. Returns names, kinds, sizes when known, and pagination fields. Does not return file body bytes.",
543
+ inputSchema: filesListInputSchema,
544
+ outputSchema: filesListOutputSchema,
545
+ sideEffect: "read",
546
+ runtime: "both",
547
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).list(input)
548
+ });
549
+ const filesSearchTool = defineTool({
550
+ id: "files-search",
551
+ name: "searchFiles",
552
+ description: "Search for files and folders by name fragment under the bound workspace root (optional relative folder). Matches the last path segment only; not full-text content search. Returns metadata without file body bytes.",
553
+ inputSchema: filesSearchInputSchema,
554
+ outputSchema: filesSearchOutputSchema,
555
+ sideEffect: "read",
556
+ runtime: "both",
557
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).search(input)
558
+ });
559
+ const filesStatTool = defineTool({
560
+ id: "files-stat",
561
+ name: "statFile",
562
+ description: "Get metadata for one relative file path under the bound workspace root (exists, size, content type, etag when known). Does not return file body bytes.",
563
+ inputSchema: filesStatInputSchema,
564
+ outputSchema: filesStatOutputSchema,
565
+ sideEffect: "read",
566
+ runtime: "both",
567
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).stat(input)
568
+ });
569
+ const filesGetTool = defineTool({
570
+ id: "files-get",
571
+ name: "getFile",
572
+ description: "Download one file by relative path under the bound workspace root. Bodies larger than the storage provider limit fail. Returns body as base64 by default or utf8 when requested.",
573
+ inputSchema: filesGetInputSchema,
574
+ outputSchema: filesGetOutputSchema,
575
+ sideEffect: "read",
576
+ runtime: "both",
577
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).get(input)
578
+ });
579
+ const filesGetRangeTool = defineTool({
580
+ id: "files-get-range",
581
+ name: "getFileRange",
582
+ description: "Download a byte range of one file under the bound workspace root (inclusive start_byte/end_byte). Max range size is 8 MiB. Prefer this over files-get for large objects.",
583
+ inputSchema: filesGetRangeInputSchema,
584
+ outputSchema: filesGetRangeOutputSchema,
585
+ sideEffect: "read",
586
+ runtime: "both",
587
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).getRange(input)
588
+ });
589
+ const filesReadLinesTool = defineTool({
590
+ id: "files-read-lines",
591
+ name: "readFileLines",
592
+ description: "Read a page of UTF-8 text lines from a file under the bound workspace root (1-based start_line, max_lines). Scans at most 2 MiB from the start of the object for line boundaries.",
593
+ inputSchema: filesReadLinesInputSchema,
594
+ outputSchema: filesReadLinesOutputSchema,
595
+ sideEffect: "read",
596
+ runtime: "both",
597
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).readLines(input)
598
+ });
599
+ const filesCreateArtifactTool = defineTool({
600
+ id: "files-create-artifact",
601
+ name: "createFileArtifact",
602
+ description: "Return an object-store ArtifactRef for an existing file under the bound workspace root (zero-copy; same storage key). Use when another tool needs an ArtifactRef without re-uploading bytes.",
603
+ inputSchema: filesCreateArtifactInputSchema,
604
+ outputSchema: filesCreateArtifactOutputSchema,
605
+ sideEffect: "read",
606
+ runtime: "both",
607
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).createArtifact(input)
608
+ });
609
+ const filesPutTool = defineTool({
610
+ id: "files-put",
611
+ name: "putFile",
612
+ description: "Upload or replace one file at a relative path under the bound workspace root. Provide utf8 text or base64 body. Paths cannot escape the root prefix.",
613
+ inputSchema: filesPutInputSchema,
614
+ outputSchema: filesPutOutputSchema,
615
+ sideEffect: "write",
616
+ runtime: "both",
617
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).put(input)
618
+ });
619
+ const filesDeleteTool = defineTool({
620
+ id: "files-delete",
621
+ name: "deleteFile",
622
+ description: "Delete one file by relative path under the bound workspace root. Idempotent when the object is already missing.",
623
+ inputSchema: filesDeleteInputSchema,
624
+ outputSchema: filesDeleteOutputSchema,
625
+ sideEffect: "delete",
626
+ runtime: "both",
627
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).delete(input)
628
+ });
629
+ const filesCopyTool = defineTool({
630
+ id: "files-copy",
631
+ name: "copyFile",
632
+ description: "Copy one file to a new relative path under the same bound workspace root. Both source and destination must stay inside the root prefix.",
633
+ inputSchema: filesCopyInputSchema,
634
+ outputSchema: filesCopyOutputSchema,
635
+ sideEffect: "write",
636
+ runtime: "both",
637
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).copy(input)
638
+ });
639
+ const filesMkdirTool = defineTool({
640
+ id: "files-mkdir",
641
+ name: "makeFileDirectory",
642
+ description: "Create a folder marker under the bound workspace root so the prefix is listable. Uses an empty .keep object inside the folder path.",
643
+ inputSchema: filesMkdirInputSchema,
644
+ outputSchema: filesMkdirOutputSchema,
645
+ sideEffect: "write",
646
+ runtime: "both",
647
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).mkdir(input)
648
+ });
649
+ const filesMoveTool = defineTool({
650
+ id: "files-move",
651
+ name: "moveFile",
652
+ description: "Move one file to a new relative path under the same bound workspace root (copy then delete source). Both paths must stay inside the root prefix. Destination is overwritten if it already exists when the store allows it.",
653
+ inputSchema: filesMoveInputSchema,
654
+ outputSchema: filesMoveOutputSchema,
655
+ sideEffect: "write",
656
+ runtime: "both",
657
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).move(input)
658
+ });
659
+ const filesMultipartStartTool = defineTool({
660
+ id: "files-multipart-start",
661
+ name: "startFileMultipartUpload",
662
+ description: "Start a multipart upload for a relative path under the bound workspace root. Returns upload_id for part/complete/abort. Use when the file exceeds the single put limit.",
663
+ inputSchema: filesMultipartStartInputSchema,
664
+ outputSchema: filesMultipartStartOutputSchema,
665
+ sideEffect: "write",
666
+ runtime: "both",
667
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).multipartStart(input)
668
+ });
669
+ const filesMultipartUploadPartTool = defineTool({
670
+ id: "files-multipart-upload-part",
671
+ name: "uploadFileMultipartPart",
672
+ description: "Upload one part of an in-progress multipart upload under the bound workspace root. Part bodies up to 25 MiB. Some object stores require each part except the last to be at least 5 MiB. Returns etag required for complete.",
673
+ inputSchema: filesMultipartUploadPartInputSchema,
674
+ outputSchema: filesMultipartUploadPartOutputSchema,
675
+ sideEffect: "write",
676
+ runtime: "both",
677
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).multipartUploadPart(input)
678
+ });
679
+ const filesMultipartCompleteTool = defineTool({
680
+ id: "files-multipart-complete",
681
+ name: "completeFileMultipartUpload",
682
+ description: "Complete a multipart upload under the bound workspace root by assembling uploaded parts (part_number + etag). Parts may be in any order.",
683
+ inputSchema: filesMultipartCompleteInputSchema,
684
+ outputSchema: filesMultipartCompleteOutputSchema,
685
+ sideEffect: "write",
686
+ runtime: "both",
687
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).multipartComplete(input)
688
+ });
689
+ const filesMultipartAbortTool = defineTool({
690
+ id: "files-multipart-abort",
691
+ name: "abortFileMultipartUpload",
692
+ description: "Abort an in-progress multipart upload under the bound workspace root and discard uploaded parts for that upload_id.",
693
+ inputSchema: filesMultipartAbortInputSchema,
694
+ outputSchema: filesMultipartAbortOutputSchema,
695
+ sideEffect: "delete",
696
+ runtime: "both",
697
+ execute: async (input, ctx) => FilesClient.fromContext(ctx).multipartAbort(input)
698
+ });
699
+ const filesModule = defineModule({
700
+ id: "files",
701
+ title: "Files",
702
+ description: "Manage durable workspace files by relative path: list, search by name, inspect metadata, read bounded content, create ArtifactRefs, write, copy, move, delete, create folders, and use multipart upload. This is distinct from temporary sandbox files.",
703
+ runtime: "both",
704
+ auth: {
705
+ type: "custom",
706
+ schema: filesAuthSchema
707
+ },
708
+ categories: ["storage", "files"],
709
+ classification: "pii",
710
+ tags: ["path-root", "s3"],
711
+ tools: [
712
+ filesListTool,
713
+ filesSearchTool,
714
+ filesStatTool,
715
+ filesGetTool,
716
+ filesGetRangeTool,
717
+ filesReadLinesTool,
718
+ filesCreateArtifactTool,
719
+ filesPutTool,
720
+ filesDeleteTool,
721
+ filesCopyTool,
722
+ filesMoveTool,
723
+ filesMkdirTool,
724
+ filesMultipartStartTool,
725
+ filesMultipartUploadPartTool,
726
+ filesMultipartCompleteTool,
727
+ filesMultipartAbortTool
728
+ ]
729
+ });
730
+ //#endregion
731
+ export { FilesClient, filesAuthSchema, filesCopyTool, filesCreateArtifactTool, filesDeleteTool, filesGetRangeTool, filesGetTool, filesListTool, filesMkdirTool, filesModule, filesMoveTool, filesMultipartAbortTool, filesMultipartCompleteTool, filesMultipartStartTool, filesMultipartUploadPartTool, filesPutTool, filesReadLinesTool, filesSearchTool, filesStatTool, normalizeRootPrefix, resolveUnderRoot, toRelativeKey };
732
+
733
+ //# sourceMappingURL=index.js.map