@agenticmail/enterprise 0.5.325 → 0.5.327

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 (457) hide show
  1. package/dist/{agent-heartbeat-77N4OOQL.js → agent-heartbeat-ZFKA6GMI.js} +2 -2
  2. package/dist/{agent-tools-BNSTIK4P.js → agent-tools-R6RSBDJQ.js} +25 -25
  3. package/dist/{agenticmail-EDO5XOTP.js → agenticmail-QMWQNUY2.js} +1 -1
  4. package/dist/{browser-tool-JF3LNRGX.js → browser-tool-4KWE37RL.js} +4 -4
  5. package/dist/{chunk-JEGYVXYC.js → chunk-CQV7GGHT.js} +1 -1
  6. package/dist/{chunk-VBTHTPZ6.js → chunk-DWHJYAV6.js} +27 -27
  7. package/dist/{chunk-HKCKMCPY.js → chunk-G4YSECQ4.js} +2 -2
  8. package/dist/{chunk-7HBGXW7Z.js → chunk-GNABVGDZ.js} +31 -32
  9. package/dist/{chunk-DMD24UFZ.js → chunk-HTT6LUPP.js} +19 -19
  10. package/dist/{chunk-3FMK32KQ.js → chunk-LHQP7QRX.js} +9 -9
  11. package/dist/{chunk-6C5PKREN.js → chunk-NOAQG5CY.js} +1 -1
  12. package/dist/{chunk-4EKXYIJF.js → chunk-PAHT4ABL.js} +4 -4
  13. package/dist/{chunk-JNMDD7JY.js → chunk-RHO7WRVJ.js} +5 -5
  14. package/dist/{chunk-BQM7MBPS.js → chunk-WYDVMFGJ.js} +5 -5
  15. package/dist/{chunk-TPLVQFXM.js → chunk-X2YL6KSY.js} +13 -13
  16. package/dist/{cli-agent-ZIIFI77N.js → cli-agent-2NBPF3GN.js} +11 -11
  17. package/dist/{cli-recover-XEZ2SKPU.js → cli-recover-TTOR7CJR.js} +2 -2
  18. package/dist/{cli-serve-BDGOOOKQ.js → cli-serve-5VFU4GR4.js} +3 -3
  19. package/dist/{cli-verify-CZIITRED.js → cli-verify-WICBVLAM.js} +2 -2
  20. package/dist/cli.js +5 -5
  21. package/dist/{connection-manager-KAWEUWUR.js → connection-manager-Y7CCQK4X.js} +1 -1
  22. package/dist/dashboard/pages/cluster.js +1 -1
  23. package/dist/{deployer-3YK4RPUL.js → deployer-7NG7LCJW.js} +1 -1
  24. package/dist/{factory-JFWXTAWK.js → factory-4V2W4BSV.js} +1 -1
  25. package/dist/index.js +9 -9
  26. package/dist/{integrations-TF4EBCJ7.js → integrations-V2WXFDIV.js} +13 -13
  27. package/dist/{local-6MLIZDKO.js → local-OXFH4V7E.js} +2 -2
  28. package/dist/{meeting-voice-intelligence-CJLR52YV.js → meeting-voice-intelligence-RZZCAD6G.js} +2 -2
  29. package/dist/{meetings-FJ453ENF.js → meetings-SQNTB6GD.js} +1 -1
  30. package/dist/{microsoft-2IIHDLJB.js → microsoft-2PDVV6HX.js} +3 -3
  31. package/dist/{postgres-WGUVC2S7.js → postgres-USXBPTHX.js} +2 -2
  32. package/dist/{pw-ai-IBEF6HBF.js → pw-ai-NK5GKBDG.js} +1 -1
  33. package/dist/{routes-XYR2RNEC.js → routes-T3CDAQTD.js} +4 -4
  34. package/dist/{runtime-6BULDBR3.js → runtime-X4BTVICL.js} +1 -1
  35. package/dist/{server-7NT4LMSQ.js → server-WQ6LLYGB.js} +5 -5
  36. package/dist/{setup-2JBXMUDS.js → setup-6DRKSOMH.js} +2 -2
  37. package/dist/{skills-FR7I5V7H.js → skills-EL4RTJKK.js} +1 -1
  38. package/logs/cloudflared-error.log +12 -0
  39. package/logs/enterprise-out.log +2 -0
  40. package/package.json +1 -1
  41. package/src/admin/routes.ts +1 -1
  42. package/src/agent-tools/tool-resolver.ts +1 -1
  43. package/src/agent-tools/tools/agenticmail.ts +2 -2
  44. package/src/agent-tools/tools/browser.ts +1 -1
  45. package/src/agent-tools/tools/enterprise-code-sandbox.ts +1 -1
  46. package/src/agent-tools/tools/enterprise-diff.ts +1 -1
  47. package/src/agent-tools/tools/enterprise-http.ts +1 -3
  48. package/src/agent-tools/tools/enterprise-security-scan.ts +1 -1
  49. package/src/agent-tools/tools/google/forms.ts +2 -2
  50. package/src/agent-tools/tools/google/gmail.ts +1 -1
  51. package/src/agent-tools/tools/google/maps.ts +2 -2
  52. package/src/agent-tools/tools/google/meeting-voice.ts +1 -1
  53. package/src/agent-tools/tools/google/meetings.ts +1 -1
  54. package/src/agent-tools/tools/google/slides.ts +2 -2
  55. package/src/agent-tools/tools/grep.ts +1 -1
  56. package/src/agent-tools/tools/knowledge-search.ts +1 -1
  57. package/src/agent-tools/tools/local/coding.ts +5 -5
  58. package/src/agent-tools/tools/microsoft/excel-vba.ts +1 -1
  59. package/src/agent-tools/tools/microsoft/excel.ts +1 -1
  60. package/src/agent-tools/tools/microsoft/powerpoint.ts +1 -1
  61. package/src/agent-tools/tools/visual-memory/index.ts +11 -11
  62. package/src/agent-tools/tools/visual-memory/similarity.ts +2 -2
  63. package/src/agent-tools/tools/visual-memory/storage.ts +1 -1
  64. package/src/agenticmail/providers/imap.ts +2 -2
  65. package/src/browser/enterprise-compat.ts +1 -1
  66. package/src/cli-agent.ts +3 -3
  67. package/src/cli-serve.ts +1 -1
  68. package/src/dashboard/pages/cluster.js +1 -1
  69. package/src/database-access/connection-manager.ts +6 -6
  70. package/src/database-access/routes.ts +0 -1
  71. package/src/db/dynamodb.ts +1 -1
  72. package/src/db/postgres.ts +2 -2
  73. package/src/deploy/fly.ts +4 -4
  74. package/src/deploy/managed.ts +0 -1
  75. package/src/engine/agent-config.ts +1 -1
  76. package/src/engine/agent-heartbeat.ts +1 -1
  77. package/src/engine/agent-hierarchy.ts +1 -1
  78. package/src/engine/agent-memory.ts +1 -1
  79. package/src/engine/agent-routes.ts +2 -2
  80. package/src/engine/chat-poller.ts +1 -1
  81. package/src/engine/community-registry.ts +2 -2
  82. package/src/engine/db-adapter.ts +0 -1
  83. package/src/engine/deployer.ts +8 -8
  84. package/src/engine/email-poller.ts +1 -1
  85. package/src/engine/knowledge-contribution.ts +1 -1
  86. package/src/engine/knowledge-import/import-manager.ts +2 -3
  87. package/src/engine/knowledge-import/processors/extract-github.ts +1 -1
  88. package/src/engine/knowledge-import/processors/extract-sharepoint.ts +1 -1
  89. package/src/engine/knowledge-import/processors/validate.ts +1 -1
  90. package/src/engine/lifecycle.ts +1 -1
  91. package/src/engine/meeting-monitor.ts +2 -2
  92. package/src/engine/meeting-voice-intelligence.ts +3 -3
  93. package/src/engine/messaging-poller.ts +2 -2
  94. package/src/engine/org-integration-routes.ts +2 -2
  95. package/src/engine/org-integrations.ts +1 -1
  96. package/src/engine/routes.ts +2 -2
  97. package/src/engine/skills.ts +1 -1
  98. package/src/engine/tool-catalog.ts +1 -1
  99. package/src/engine/vault-routes.ts +1 -1
  100. package/src/engine/vault.ts +1 -1
  101. package/src/mcp/adapters/adp.adapter.ts +1 -1
  102. package/src/mcp/adapters/auth0.adapter.ts +1 -1
  103. package/src/mcp/adapters/clickup.adapter.ts +1 -1
  104. package/src/mcp/adapters/close.adapter.ts +1 -1
  105. package/src/mcp/adapters/firebase.adapter.ts +1 -1
  106. package/src/mcp/adapters/google-ads.adapter.ts +1 -1
  107. package/src/mcp/adapters/kubernetes.adapter.ts +1 -1
  108. package/src/mcp/adapters/mixpanel.adapter.ts +1 -1
  109. package/src/mcp/adapters/recurly.adapter.ts +1 -1
  110. package/src/mcp/adapters/sap.adapter.ts +2 -2
  111. package/src/mcp/adapters/shortcut.adapter.ts +1 -1
  112. package/src/mcp/adapters/snowflake.adapter.ts +1 -1
  113. package/src/mcp/adapters/stripe.adapter.ts +1 -1
  114. package/src/mcp/adapters/supabase.adapter.ts +1 -1
  115. package/src/mcp/adapters/zuora.adapter.ts +1 -1
  116. package/src/middleware/request-limits.ts +1 -1
  117. package/src/runtime/agent-loop.ts +3 -3
  118. package/src/runtime/compaction.ts +2 -2
  119. package/src/runtime/followup.ts +1 -1
  120. package/src/runtime/hooks.ts +3 -3
  121. package/src/runtime/index.ts +5 -6
  122. package/src/runtime/llm-client.ts +1 -1
  123. package/src/runtime/subagent.ts +0 -1
  124. package/src/runtime/types.ts +2 -0
  125. package/src/security/brute-force.ts +1 -1
  126. package/src/security/csp.ts +1 -1
  127. package/src/security/index.ts +3 -3
  128. package/src/security/input-sanitizer.ts +1 -1
  129. package/src/security/threat-logger.ts +2 -2
  130. package/src/server.ts +2 -2
  131. package/src/setup/database.ts +1 -1
  132. package/src/setup/index.ts +1 -2
  133. package/src/setup/provision.ts +1 -1
  134. package/dist/_seed-data-FQR5PY2W.js +0 -4554
  135. package/dist/agent-heartbeat-3FWNHZFX.js +0 -510
  136. package/dist/agent-heartbeat-4RWHZR7H.js +0 -510
  137. package/dist/agent-heartbeat-6ZGB5ILY.js +0 -510
  138. package/dist/agent-heartbeat-BBINFNL4.js +0 -510
  139. package/dist/agent-heartbeat-BIVHLKFM.js +0 -510
  140. package/dist/agent-heartbeat-HGVIAHS5.js +0 -510
  141. package/dist/agent-heartbeat-HRKVFK2T.js +0 -510
  142. package/dist/agent-heartbeat-JC5GWVXD.js +0 -510
  143. package/dist/agent-heartbeat-K6A4HMHB.js +0 -510
  144. package/dist/agent-heartbeat-LCDXWFVB.js +0 -510
  145. package/dist/agent-heartbeat-P7HZCZAQ.js +0 -510
  146. package/dist/agent-heartbeat-PUIRSNIO.js +0 -510
  147. package/dist/agent-heartbeat-SN5ILQ6Y.js +0 -510
  148. package/dist/agent-heartbeat-TW5YTDYC.js +0 -510
  149. package/dist/agent-heartbeat-UF2RKKS2.js +0 -510
  150. package/dist/agent-heartbeat-YCSWP54H.js +0 -510
  151. package/dist/agent-heartbeat-Z2QQXROL.js +0 -510
  152. package/dist/agent-tools-3W7XLUYA.js +0 -13949
  153. package/dist/agent-tools-54VZGT6L.js +0 -9
  154. package/dist/agent-tools-AYYDPO27.js +0 -13949
  155. package/dist/agent-tools-F2X47FKF.js +0 -13949
  156. package/dist/agent-tools-O6W3QAZL.js +0 -13949
  157. package/dist/agent-tools-OAWVZBMW.js +0 -9
  158. package/dist/agent-tools-QCCU74PN.js +0 -13949
  159. package/dist/agent-tools-QGE26U6R.js +0 -9
  160. package/dist/chunk-2LHUARN6.js +0 -4929
  161. package/dist/chunk-2WVCNCYC.js +0 -5087
  162. package/dist/chunk-3FM6YQUK.js +0 -5087
  163. package/dist/chunk-46GOWZT4.js +0 -5087
  164. package/dist/chunk-4DBWU3P5.js +0 -4929
  165. package/dist/chunk-5KYJAUZV.js +0 -1519
  166. package/dist/chunk-6ZMLNEHB.js +0 -1519
  167. package/dist/chunk-7UCKD25B.js +0 -551
  168. package/dist/chunk-BDCFOP7O.js +0 -537
  169. package/dist/chunk-BPZQT5N5.js +0 -25652
  170. package/dist/chunk-C52OQNNY.js +0 -5087
  171. package/dist/chunk-C7HGQF4Y.js +0 -25652
  172. package/dist/chunk-CAHNZGGK.js +0 -25656
  173. package/dist/chunk-CK7R6UHE.js +0 -4945
  174. package/dist/chunk-CQYLRIQ3.js +0 -25938
  175. package/dist/chunk-D36RPWB7.js +0 -25652
  176. package/dist/chunk-DJK2UPFH.js +0 -4891
  177. package/dist/chunk-DM7FTF7W.js +0 -4929
  178. package/dist/chunk-DXZGPUAF.js +0 -5087
  179. package/dist/chunk-F46WB5IL.js +0 -5087
  180. package/dist/chunk-F5QG5SQH.js +0 -5087
  181. package/dist/chunk-GYB2WHMN.js +0 -5101
  182. package/dist/chunk-H7GP733U.js +0 -5087
  183. package/dist/chunk-HHBXWB5U.js +0 -25640
  184. package/dist/chunk-HS5YWSGM.js +0 -3206
  185. package/dist/chunk-IMXS4N6W.js +0 -1519
  186. package/dist/chunk-JTV5LA47.js +0 -1519
  187. package/dist/chunk-KN3T3CTD.js +0 -4929
  188. package/dist/chunk-KV6G7NZX.js +0 -1519
  189. package/dist/chunk-M6ZIC5H3.js +0 -1370
  190. package/dist/chunk-MU5MEBIK.js +0 -1519
  191. package/dist/chunk-NLT5MC7X.js +0 -465
  192. package/dist/chunk-NVLYIM4J.js +0 -4945
  193. package/dist/chunk-NZY2BIZH.js +0 -4891
  194. package/dist/chunk-O42L6G67.js +0 -1519
  195. package/dist/chunk-OCNERGGM.js +0 -4891
  196. package/dist/chunk-OJSNHONE.js +0 -1519
  197. package/dist/chunk-OWTLNV4Q.js +0 -25623
  198. package/dist/chunk-PCNYEP6T.js +0 -4891
  199. package/dist/chunk-PI4AQ4Z6.js +0 -25652
  200. package/dist/chunk-PN3EGTCA.js +0 -194
  201. package/dist/chunk-PWWV2U5P.js +0 -195
  202. package/dist/chunk-Q37UKNRC.js +0 -1519
  203. package/dist/chunk-QXTC6J7H.js +0 -5087
  204. package/dist/chunk-RF2LGX3E.js +0 -1519
  205. package/dist/chunk-RH7KPWRQ.js +0 -465
  206. package/dist/chunk-RKERL5LZ.js +0 -4925
  207. package/dist/chunk-RVBK2IOX.js +0 -25652
  208. package/dist/chunk-SAKODCZ5.js +0 -4891
  209. package/dist/chunk-SALGFC5L.js +0 -4945
  210. package/dist/chunk-STGWZ2MS.js +0 -1519
  211. package/dist/chunk-SVSLIQYN.js +0 -1519
  212. package/dist/chunk-UY3ZVQDP.js +0 -25652
  213. package/dist/chunk-V6OSD62M.js +0 -5087
  214. package/dist/chunk-VP6YAHX4.js +0 -1519
  215. package/dist/chunk-WD72IOF2.js +0 -5101
  216. package/dist/chunk-WDYJOEAI.js +0 -5087
  217. package/dist/chunk-WEAFQNOS.js +0 -195
  218. package/dist/chunk-XKUSAZGP.js +0 -5087
  219. package/dist/chunk-YCWOCIPH.js +0 -5101
  220. package/dist/chunk-ZGE3XAXY.js +0 -1519
  221. package/dist/chunk-ZGFDTW4H.js +0 -1519
  222. package/dist/cli-agent-33GWIF2D.js +0 -2300
  223. package/dist/cli-agent-4XK6LVQQ.js +0 -2357
  224. package/dist/cli-agent-64EOV3ST.js +0 -2300
  225. package/dist/cli-agent-67WP6KKO.js +0 -2300
  226. package/dist/cli-agent-7RW5Y7C4.js +0 -2294
  227. package/dist/cli-agent-7TB2BWS6.js +0 -2370
  228. package/dist/cli-agent-AKXFFST2.js +0 -2370
  229. package/dist/cli-agent-C3YSECO4.js +0 -2344
  230. package/dist/cli-agent-DZTKLITB.js +0 -2357
  231. package/dist/cli-agent-FNMDJN7T.js +0 -2357
  232. package/dist/cli-agent-FOF7PFEP.js +0 -2357
  233. package/dist/cli-agent-FXZ6DJKP.js +0 -2357
  234. package/dist/cli-agent-H74M2ZYN.js +0 -2357
  235. package/dist/cli-agent-HG4Y657I.js +0 -2300
  236. package/dist/cli-agent-HORWVPHB.js +0 -2370
  237. package/dist/cli-agent-HSZT6SKF.js +0 -2423
  238. package/dist/cli-agent-ION2W5JF.js +0 -2441
  239. package/dist/cli-agent-JLUQ4ZU6.js +0 -2424
  240. package/dist/cli-agent-KBPWY3CB.js +0 -2302
  241. package/dist/cli-agent-MVCDH4HV.js +0 -2370
  242. package/dist/cli-agent-NZXOEPJ2.js +0 -2357
  243. package/dist/cli-agent-OO6H57UQ.js +0 -2300
  244. package/dist/cli-agent-PADN3QRC.js +0 -2357
  245. package/dist/cli-agent-QAYEX3BE.js +0 -2441
  246. package/dist/cli-agent-QT64DT5J.js +0 -2370
  247. package/dist/cli-agent-TCTRKCHN.js +0 -2300
  248. package/dist/cli-agent-TFL2M6UK.js +0 -2424
  249. package/dist/cli-agent-TSOJG7EX.js +0 -2357
  250. package/dist/cli-agent-UIKXATTD.js +0 -2357
  251. package/dist/cli-agent-UJN6FYTO.js +0 -2370
  252. package/dist/cli-agent-USMKX7WN.js +0 -2473
  253. package/dist/cli-agent-VIQAYVY4.js +0 -2357
  254. package/dist/cli-agent-WNWFVOFM.js +0 -2370
  255. package/dist/cli-agent-XBQX67VJ.js +0 -2423
  256. package/dist/cli-agent-ZLSC6FF4.js +0 -2357
  257. package/dist/cli-agent-ZSHUPBBN.js +0 -2357
  258. package/dist/cli-recover-T32NABFA.js +0 -487
  259. package/dist/cli-serve-2IL5DTEY.js +0 -153
  260. package/dist/cli-serve-3NGBX5ER.js +0 -140
  261. package/dist/cli-serve-47N5UKKW.js +0 -153
  262. package/dist/cli-serve-4RS4UDHC.js +0 -140
  263. package/dist/cli-serve-4XGZFUV2.js +0 -140
  264. package/dist/cli-serve-53FVANQK.js +0 -260
  265. package/dist/cli-serve-57225XWV.js +0 -140
  266. package/dist/cli-serve-63BDPSOP.js +0 -140
  267. package/dist/cli-serve-657NRUOX.js +0 -140
  268. package/dist/cli-serve-6ER7QMLR.js +0 -140
  269. package/dist/cli-serve-6OT3UEAN.js +0 -140
  270. package/dist/cli-serve-7JQ4FVUQ.js +0 -260
  271. package/dist/cli-serve-7L6EY5UH.js +0 -153
  272. package/dist/cli-serve-BFNIW2LF.js +0 -153
  273. package/dist/cli-serve-C7MN6U5Q.js +0 -153
  274. package/dist/cli-serve-CQFI3LMK.js +0 -140
  275. package/dist/cli-serve-CR3OY3IM.js +0 -153
  276. package/dist/cli-serve-DAJFRWQ7.js +0 -153
  277. package/dist/cli-serve-DTQLN5UI.js +0 -140
  278. package/dist/cli-serve-EQS2SGT3.js +0 -140
  279. package/dist/cli-serve-FW6FHFW4.js +0 -153
  280. package/dist/cli-serve-GEEOQS77.js +0 -153
  281. package/dist/cli-serve-H562I3ZK.js +0 -153
  282. package/dist/cli-serve-HDQZF4C4.js +0 -153
  283. package/dist/cli-serve-KBJNXWYJ.js +0 -140
  284. package/dist/cli-serve-LICAOMEB.js +0 -140
  285. package/dist/cli-serve-LLGYLWFS.js +0 -153
  286. package/dist/cli-serve-LMZKQ5GX.js +0 -140
  287. package/dist/cli-serve-LNTT73P2.js +0 -140
  288. package/dist/cli-serve-MLR4KAE2.js +0 -260
  289. package/dist/cli-serve-MQKBUZ7X.js +0 -140
  290. package/dist/cli-serve-N3OISDNB.js +0 -153
  291. package/dist/cli-serve-NBFT7B42.js +0 -140
  292. package/dist/cli-serve-RTWO3AWY.js +0 -140
  293. package/dist/cli-serve-SIHTSW5P.js +0 -140
  294. package/dist/cli-serve-SP6TEURE.js +0 -140
  295. package/dist/cli-serve-TDKZA6I5.js +0 -140
  296. package/dist/cli-serve-TF5ZVVXF.js +0 -140
  297. package/dist/cli-serve-TIZ27EVR.js +0 -153
  298. package/dist/cli-serve-TUNI2RCN.js +0 -153
  299. package/dist/cli-serve-WCU66CHX.js +0 -140
  300. package/dist/cli-serve-WNOZMAWD.js +0 -153
  301. package/dist/cli-serve-YCCKRRUY.js +0 -140
  302. package/dist/cli-serve-ZD5V7I6G.js +0 -140
  303. package/dist/cli-validate-6XDDLVVQ.js +0 -150
  304. package/dist/cli-verify-I4WGRQNT.js +0 -149
  305. package/dist/connection-manager-4ZA4XAFA.js +0 -9
  306. package/dist/db-adapter-IK2EDK2N.js +0 -7
  307. package/dist/db-adapter-IRHOUMVC.js +0 -7
  308. package/dist/dependency-manager-G6D2XXNY.js +0 -11
  309. package/dist/dependency-manager-OCUKF72T.js +0 -543
  310. package/dist/dependency-manager-YULUXN34.js +0 -511
  311. package/dist/factory-MQASIPEB.js +0 -11
  312. package/dist/google-W5AYGNUJ.js +0 -33
  313. package/dist/integrations-VWANOHQ4.js +0 -43830
  314. package/dist/local-O2FN57UN.js +0 -1128
  315. package/dist/local-S7SDOQHN.js +0 -1128
  316. package/dist/microsoft-HPLA5ZL5.js +0 -2414
  317. package/dist/microsoft-UFLZBEAC.js +0 -1619
  318. package/dist/microsoft-VREAZ7M2.js +0 -3955
  319. package/dist/microsoft-YUT6EIGP.js +0 -3400
  320. package/dist/postgres-BOTHOPDW.js +0 -875
  321. package/dist/routes-3MMLQTB6.js +0 -90
  322. package/dist/routes-4ZUIJ4HE.js +0 -90
  323. package/dist/routes-5MXHKKH4.js +0 -90
  324. package/dist/routes-64NJFK3B.js +0 -90
  325. package/dist/routes-6AKQ2LBV.js +0 -90
  326. package/dist/routes-CRRBUDO4.js +0 -90
  327. package/dist/routes-D7SMYOLT.js +0 -90
  328. package/dist/routes-DIAF3MC3.js +0 -90
  329. package/dist/routes-IGR6PZCA.js +0 -92
  330. package/dist/routes-KMUNU6CY.js +0 -90
  331. package/dist/routes-LRRLXIZR.js +0 -90
  332. package/dist/routes-N647AJYG.js +0 -90
  333. package/dist/routes-SSSELAAR.js +0 -90
  334. package/dist/routes-STERVGKJ.js +0 -90
  335. package/dist/routes-TZMPYLHJ.js +0 -90
  336. package/dist/routes-XNK2MAVO.js +0 -90
  337. package/dist/routes-ZEZZACZP.js +0 -90
  338. package/dist/runtime-4UVCTFNQ.js +0 -45
  339. package/dist/runtime-5EQN4GFM.js +0 -45
  340. package/dist/runtime-5LP7PUD4.js +0 -45
  341. package/dist/runtime-6YEENDN3.js +0 -45
  342. package/dist/runtime-7LQFRG3B.js +0 -45
  343. package/dist/runtime-AMXJU2MB.js +0 -45
  344. package/dist/runtime-D6WSE7FG.js +0 -45
  345. package/dist/runtime-EAWOE6JZ.js +0 -45
  346. package/dist/runtime-EYVN7NFJ.js +0 -45
  347. package/dist/runtime-F6RPWQVW.js +0 -45
  348. package/dist/runtime-FYMJURFC.js +0 -45
  349. package/dist/runtime-GGF4P55M.js +0 -45
  350. package/dist/runtime-H3SAMWWF.js +0 -45
  351. package/dist/runtime-H7T4I7I7.js +0 -45
  352. package/dist/runtime-HTIM7GZR.js +0 -45
  353. package/dist/runtime-JRNBL4O4.js +0 -45
  354. package/dist/runtime-K4C7NQLW.js +0 -45
  355. package/dist/runtime-MWWZCPC2.js +0 -45
  356. package/dist/runtime-N7CM2DYA.js +0 -45
  357. package/dist/runtime-OM2NIBMI.js +0 -45
  358. package/dist/runtime-OVGSOTAH.js +0 -45
  359. package/dist/runtime-QQ6LAY4U.js +0 -45
  360. package/dist/runtime-QWPVD7CY.js +0 -45
  361. package/dist/runtime-SX3B5MG3.js +0 -45
  362. package/dist/runtime-YLIIPTE4.js +0 -45
  363. package/dist/runtime-YU6P22CG.js +0 -45
  364. package/dist/runtime-ZOC337DD.js +0 -45
  365. package/dist/server-3AVWBRIF.js +0 -28
  366. package/dist/server-5BKJI5OW.js +0 -28
  367. package/dist/server-6NDO2S52.js +0 -28
  368. package/dist/server-7TD3M2BW.js +0 -28
  369. package/dist/server-AMCSXINC.js +0 -28
  370. package/dist/server-B3VJ6MSA.js +0 -28
  371. package/dist/server-BEJ6RAGL.js +0 -28
  372. package/dist/server-BFPYDHBG.js +0 -28
  373. package/dist/server-BKEWXGVX.js +0 -28
  374. package/dist/server-BMEJZGFG.js +0 -28
  375. package/dist/server-CU6LVQS4.js +0 -28
  376. package/dist/server-DFR7FI3Q.js +0 -28
  377. package/dist/server-DFYGH2CV.js +0 -28
  378. package/dist/server-DURRN3GJ.js +0 -28
  379. package/dist/server-EELWOC3X.js +0 -28
  380. package/dist/server-EN5E2OWQ.js +0 -28
  381. package/dist/server-EXZC3OJO.js +0 -28
  382. package/dist/server-GW2HYJYI.js +0 -28
  383. package/dist/server-J25NCRWJ.js +0 -28
  384. package/dist/server-JDGNOTFV.js +0 -28
  385. package/dist/server-KA6U3YNP.js +0 -28
  386. package/dist/server-L52A2ME4.js +0 -28
  387. package/dist/server-NE5HD5DJ.js +0 -28
  388. package/dist/server-NLQAXPOG.js +0 -28
  389. package/dist/server-NQOT7W77.js +0 -28
  390. package/dist/server-OHHAA34U.js +0 -28
  391. package/dist/server-PWE5PQTR.js +0 -28
  392. package/dist/server-Q2Q32H2B.js +0 -28
  393. package/dist/server-Q77ME7TL.js +0 -28
  394. package/dist/server-QDKO6OVO.js +0 -28
  395. package/dist/server-RR6QJIXM.js +0 -28
  396. package/dist/server-T3R6BO6A.js +0 -28
  397. package/dist/server-TRIBAHDV.js +0 -28
  398. package/dist/server-TXV3ZVVR.js +0 -28
  399. package/dist/server-VHSFJP3I.js +0 -28
  400. package/dist/server-VOJF2XGU.js +0 -28
  401. package/dist/server-W76YHPEC.js +0 -28
  402. package/dist/server-WLLH4WST.js +0 -28
  403. package/dist/server-WTUJ2O3F.js +0 -28
  404. package/dist/server-X4CJTHHF.js +0 -28
  405. package/dist/server-XK3ILCJC.js +0 -28
  406. package/dist/server-ZRD3NDJE.js +0 -28
  407. package/dist/setup-2JYXGTW6.js +0 -20
  408. package/dist/setup-3XOSZEW5.js +0 -20
  409. package/dist/setup-44VBAO4J.js +0 -20
  410. package/dist/setup-4OA7QNJW.js +0 -20
  411. package/dist/setup-4ONNQBWB.js +0 -20
  412. package/dist/setup-4OSBXSCL.js +0 -20
  413. package/dist/setup-4QFGRBLZ.js +0 -20
  414. package/dist/setup-52US54Z4.js +0 -20
  415. package/dist/setup-5CY3CKKT.js +0 -20
  416. package/dist/setup-5YRQUOW2.js +0 -20
  417. package/dist/setup-6766SGAR.js +0 -20
  418. package/dist/setup-6NUSB4XO.js +0 -20
  419. package/dist/setup-7FZJEOD4.js +0 -20
  420. package/dist/setup-7LYYXBUL.js +0 -20
  421. package/dist/setup-ADSKKBGV.js +0 -20
  422. package/dist/setup-AMV2WKVH.js +0 -20
  423. package/dist/setup-AYY24DKM.js +0 -20
  424. package/dist/setup-B34N4HPU.js +0 -20
  425. package/dist/setup-CEF4QY4L.js +0 -20
  426. package/dist/setup-E2YLC2EY.js +0 -20
  427. package/dist/setup-ER6NXTY5.js +0 -20
  428. package/dist/setup-FIOAQJ6C.js +0 -20
  429. package/dist/setup-G76S7X44.js +0 -20
  430. package/dist/setup-H2AGCBW5.js +0 -20
  431. package/dist/setup-H4JZUHH5.js +0 -20
  432. package/dist/setup-ICOZRKCX.js +0 -20
  433. package/dist/setup-JFTJH7UF.js +0 -20
  434. package/dist/setup-JJHOT2ZU.js +0 -20
  435. package/dist/setup-KEAM2BCL.js +0 -20
  436. package/dist/setup-LW4MLU2N.js +0 -20
  437. package/dist/setup-NHAZABW4.js +0 -20
  438. package/dist/setup-PRFNI6YW.js +0 -20
  439. package/dist/setup-RAHBMYHE.js +0 -20
  440. package/dist/setup-T6KYFR7O.js +0 -20
  441. package/dist/setup-TGM6L362.js +0 -20
  442. package/dist/setup-TNANAH7C.js +0 -20
  443. package/dist/setup-TXPR5UQX.js +0 -20
  444. package/dist/setup-UJSNSCLM.js +0 -20
  445. package/dist/setup-XCJMELVU.js +0 -20
  446. package/dist/setup-XIYEIFVK.js +0 -20
  447. package/dist/setup-XP2VGBEU.js +0 -20
  448. package/dist/setup-Z4PZSHBI.js +0 -20
  449. package/dist/skills-HCVBA6PK.js +0 -16
  450. package/dist/skills-HFSW74KZ.js +0 -16
  451. package/dist/system-prompts-6OUTAMH6.js +0 -41
  452. package/dist/task-queue-YP2I54IA.js +0 -9
  453. package/dist/transport-encryption-F2NQYACT.js +0 -25
  454. package/god_is_great.html +0 -35
  455. package/seed-data.mjs +0 -455
  456. package/src/agent-tools/tools/integrations/_seed-data.json +0 -4548
  457. package/src/agent-tools/tools/integrations/_seed-data.ts +0 -4563
@@ -1,1128 +0,0 @@
1
- import {
2
- createDependencyManagerTools
3
- } from "./chunk-OOU7JUYE.js";
4
- import "./chunk-KFQGP6VL.js";
5
-
6
- // src/agent-tools/tools/local/file-read.ts
7
- import { readFile } from "fs/promises";
8
-
9
- // src/agent-tools/tools/local/resolve-path.ts
10
- import { join, resolve } from "path";
11
- import { homedir } from "os";
12
- function resolvePath(inputPath, sandbox) {
13
- var expanded = inputPath.startsWith("~") ? join(homedir(), inputPath.slice(1)) : inputPath;
14
- var resolved = resolve(expanded);
15
- if (sandbox) {
16
- var sandboxResolved = resolve(sandbox);
17
- if (!resolved.startsWith(sandboxResolved)) {
18
- throw new Error("Access denied: path is outside the allowed directory (" + sandbox + ")");
19
- }
20
- }
21
- return resolved;
22
- }
23
-
24
- // src/agent-tools/tools/local/file-read.ts
25
- function createFileReadTool(sandbox) {
26
- return {
27
- name: "file_read",
28
- description: "Read file contents. Use offset/limit for large files.",
29
- input_schema: {
30
- type: "object",
31
- properties: {
32
- path: { type: "string" },
33
- offset: { type: "number", description: "Start line (1-indexed)" },
34
- limit: { type: "number", description: "Max lines" }
35
- },
36
- required: ["path"]
37
- },
38
- execute: async (input) => {
39
- var filePath = resolvePath(input.path, sandbox);
40
- var content = await readFile(filePath, "utf-8");
41
- if (input.offset || input.limit) {
42
- var lines = content.split("\n");
43
- var start = Math.max(0, (input.offset || 1) - 1);
44
- var end = input.limit ? start + input.limit : lines.length;
45
- content = lines.slice(start, end).join("\n");
46
- }
47
- if (content.length > 5e4) {
48
- content = content.slice(0, 5e4) + "\n\n[...truncated at 50KB]";
49
- }
50
- return { content, path: filePath, size: content.length };
51
- }
52
- };
53
- }
54
-
55
- // src/agent-tools/tools/local/file-write.ts
56
- import { writeFile, mkdir } from "fs/promises";
57
- import { dirname } from "path";
58
- function createFileWriteTool(sandbox) {
59
- return {
60
- name: "file_write",
61
- description: "Write content to a file. Creates parent directories. Overwrites if exists.",
62
- input_schema: {
63
- type: "object",
64
- properties: {
65
- path: { type: "string" },
66
- content: { type: "string" }
67
- },
68
- required: ["path", "content"]
69
- },
70
- execute: async (input) => {
71
- var filePath = resolvePath(input.path, sandbox);
72
- await mkdir(dirname(filePath), { recursive: true });
73
- await writeFile(filePath, input.content, "utf-8");
74
- return { ok: true, path: filePath, bytesWritten: Buffer.byteLength(input.content, "utf-8") };
75
- }
76
- };
77
- }
78
-
79
- // src/agent-tools/tools/local/file-edit.ts
80
- import { readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
81
- function createFileEditTool(sandbox) {
82
- return {
83
- name: "file_edit",
84
- description: "Edit a file by replacing exact text match.",
85
- input_schema: {
86
- type: "object",
87
- properties: {
88
- path: { type: "string" },
89
- old_text: { type: "string", description: "Exact text to find" },
90
- new_text: { type: "string", description: "Replacement text" }
91
- },
92
- required: ["path", "old_text", "new_text"]
93
- },
94
- execute: async (input) => {
95
- var filePath = resolvePath(input.path, sandbox);
96
- var content = await readFile2(filePath, "utf-8");
97
- if (!content.includes(input.old_text)) {
98
- return { error: "old_text not found in file. Must match exactly including whitespace." };
99
- }
100
- await writeFile2(filePath, content.replace(input.old_text, input.new_text), "utf-8");
101
- return { ok: true, path: filePath };
102
- }
103
- };
104
- }
105
-
106
- // src/agent-tools/tools/local/file-list.ts
107
- import { readdir, stat } from "fs/promises";
108
- import { join as join2 } from "path";
109
- function createFileListTool(sandbox) {
110
- return {
111
- name: "file_list",
112
- description: "List files and directories at a path.",
113
- input_schema: {
114
- type: "object",
115
- properties: {
116
- path: { type: "string" }
117
- },
118
- required: ["path"]
119
- },
120
- execute: async (input) => {
121
- var dirPath = resolvePath(input.path, sandbox);
122
- var entries = await readdir(dirPath, { withFileTypes: true });
123
- var results = [];
124
- for (var entry of entries) {
125
- var info = { name: entry.name, type: entry.isDirectory() ? "directory" : "file" };
126
- try {
127
- var s = await stat(join2(dirPath, entry.name));
128
- info.size = s.size;
129
- info.modified = s.mtime.toISOString();
130
- } catch {
131
- }
132
- results.push(info);
133
- if (results.length >= 500) break;
134
- }
135
- return { path: dirPath, entries: results, count: results.length };
136
- }
137
- };
138
- }
139
-
140
- // src/agent-tools/tools/local/file-search.ts
141
- import { readdir as readdir2 } from "fs/promises";
142
- import { join as join3, relative } from "path";
143
- function createFileSearchTool(sandbox) {
144
- return {
145
- name: "file_search",
146
- description: "Search for files by name pattern (* wildcard supported).",
147
- input_schema: {
148
- type: "object",
149
- properties: {
150
- path: { type: "string" },
151
- pattern: { type: "string", description: "Filename pattern (e.g. *.ts)" },
152
- maxResults: { type: "number" }
153
- },
154
- required: ["path", "pattern"]
155
- },
156
- execute: async (input) => {
157
- var dirPath = resolvePath(input.path, sandbox);
158
- var max = input.maxResults || 50;
159
- var regex = new RegExp("^" + input.pattern.replace(/\*/g, ".*").replace(/\?/g, ".") + "$", "i");
160
- var results = [];
161
- async function walk(dir, depth) {
162
- if (depth > 10 || results.length >= max) return;
163
- try {
164
- var entries = await readdir2(dir, { withFileTypes: true });
165
- for (var entry of entries) {
166
- if (results.length >= max) break;
167
- if (regex.test(entry.name)) results.push(relative(dirPath, join3(dir, entry.name)));
168
- if (entry.isDirectory() && !entry.name.startsWith(".") && entry.name !== "node_modules") {
169
- await walk(join3(dir, entry.name), depth + 1);
170
- }
171
- }
172
- } catch {
173
- }
174
- }
175
- await walk(dirPath, 0);
176
- return { path: dirPath, matches: results, count: results.length };
177
- }
178
- };
179
- }
180
-
181
- // src/agent-tools/tools/local/file-ops.ts
182
- import { rename, unlink, mkdir as mkdir2 } from "fs/promises";
183
- import { dirname as dirname2 } from "path";
184
- function createFileMoveTool(sandbox) {
185
- return {
186
- name: "file_move",
187
- description: "Move or rename a file.",
188
- input_schema: {
189
- type: "object",
190
- properties: {
191
- from: { type: "string" },
192
- to: { type: "string" }
193
- },
194
- required: ["from", "to"]
195
- },
196
- execute: async (input) => {
197
- var fromPath = resolvePath(input.from, sandbox);
198
- var toPath = resolvePath(input.to, sandbox);
199
- await mkdir2(dirname2(toPath), { recursive: true });
200
- await rename(fromPath, toPath);
201
- return { ok: true, from: fromPath, to: toPath };
202
- }
203
- };
204
- }
205
- function createFileDeleteTool(sandbox) {
206
- return {
207
- name: "file_delete",
208
- description: "Delete a file. Use with caution.",
209
- input_schema: {
210
- type: "object",
211
- properties: {
212
- path: { type: "string" }
213
- },
214
- required: ["path"]
215
- },
216
- execute: async (input) => {
217
- var filePath = resolvePath(input.path, sandbox);
218
- await unlink(filePath);
219
- return { ok: true, deleted: filePath };
220
- }
221
- };
222
- }
223
-
224
- // src/agent-tools/tools/local/shell.ts
225
- import { exec as cpExec, spawn } from "child_process";
226
- import { promisify } from "util";
227
- import { platform } from "os";
228
- var execAsync = promisify(cpExec);
229
- var activeSessions = /* @__PURE__ */ new Map();
230
- setInterval(() => {
231
- var now = Date.now();
232
- for (var [id, s] of activeSessions) {
233
- if (now - s.startedAt > 30 * 60 * 1e3) {
234
- try {
235
- s.proc?.kill();
236
- } catch {
237
- }
238
- activeSessions.delete(id);
239
- }
240
- }
241
- }, 6e4);
242
- function createShellTools(opts) {
243
- return [
244
- {
245
- name: "shell_exec",
246
- description: "Execute a shell command. For interactive commands (sudo, installers), use shell_interactive instead.",
247
- input_schema: {
248
- type: "object",
249
- properties: {
250
- command: { type: "string" },
251
- cwd: { type: "string" },
252
- timeout: { type: "number", description: "Seconds (default 30)" }
253
- },
254
- required: ["command"]
255
- },
256
- execute: async (input) => {
257
- var timeoutMs = (input.timeout || opts?.timeout || 30) * 1e3;
258
- var cwd = input.cwd || opts?.cwd || process.cwd();
259
- try {
260
- var r = await execAsync(input.command, {
261
- cwd,
262
- timeout: timeoutMs,
263
- maxBuffer: 1024 * 1024,
264
- env: { ...process.env, TERM: "dumb", DEBIAN_FRONTEND: "noninteractive" }
265
- });
266
- var stdout = r.stdout || "";
267
- var stderr = r.stderr || "";
268
- if (stdout.length > 5e4) stdout = stdout.slice(0, 5e4) + "\n[...truncated]";
269
- if (stderr.length > 1e4) stderr = stderr.slice(0, 1e4) + "\n[...truncated]";
270
- return { stdout, stderr, exitCode: 0 };
271
- } catch (err) {
272
- return { stdout: (err.stdout || "").slice(0, 5e4), stderr: (err.stderr || err.message || "").slice(0, 1e4), exitCode: err.code || 1 };
273
- }
274
- }
275
- },
276
- {
277
- name: "shell_interactive",
278
- description: "Run an interactive command with PTY (sudo, apt install, ssh, etc.). Can send input like passwords. Returns session ID for follow-up.",
279
- input_schema: {
280
- type: "object",
281
- properties: {
282
- command: { type: "string", description: 'Command to run (e.g. "sudo apt install nginx")' },
283
- input: { type: "string", description: "Text to send to stdin (e.g. password). Sent after command starts." },
284
- inputDelay: { type: "number", description: "ms to wait before sending input (default 500)" },
285
- cwd: { type: "string" },
286
- timeout: { type: "number", description: "Seconds to wait for output (default 30)" },
287
- sessionId: { type: "string", description: "Resume existing session instead of starting new command" }
288
- },
289
- required: []
290
- },
291
- execute: async (input) => {
292
- if (input.sessionId) {
293
- var session = activeSessions.get(input.sessionId);
294
- if (!session) return { error: "Session not found or expired" };
295
- if (input.input) {
296
- try {
297
- session.proc.stdin.write(input.input + "\n");
298
- } catch {
299
- }
300
- }
301
- await new Promise((r) => setTimeout(r, (input.timeout || 3) * 1e3));
302
- var output = session.output;
303
- session.output = "";
304
- if (output.length > 5e4) output = output.slice(-5e4);
305
- return { sessionId: input.sessionId, output, exitCode: session.exitCode, done: session.exitCode !== null };
306
- }
307
- var sessionId = "sh_" + Date.now().toString(36) + Math.random().toString(36).slice(2, 6);
308
- var shell = platform() === "win32" ? "powershell.exe" : "/bin/bash";
309
- var args = platform() === "win32" ? ["-Command", input.command || "echo ready"] : ["-c", input.command || "echo ready"];
310
- var cwd = input.cwd || opts?.cwd || process.cwd();
311
- var proc = spawn(shell, args, {
312
- cwd,
313
- env: { ...process.env, TERM: "xterm-256color" },
314
- stdio: ["pipe", "pipe", "pipe"]
315
- });
316
- var entry = { proc, output: "", exitCode: null, startedAt: Date.now() };
317
- activeSessions.set(sessionId, entry);
318
- proc.stdout?.on("data", (d) => {
319
- entry.output += d.toString();
320
- });
321
- proc.stderr?.on("data", (d) => {
322
- entry.output += d.toString();
323
- });
324
- proc.on("close", (code) => {
325
- entry.exitCode = code ?? 0;
326
- });
327
- proc.on("error", (err) => {
328
- entry.output += "\n[ERROR] " + err.message;
329
- entry.exitCode = 1;
330
- });
331
- if (input.input) {
332
- var delay = input.inputDelay || 500;
333
- setTimeout(() => {
334
- try {
335
- proc.stdin.write(input.input + "\n");
336
- } catch {
337
- }
338
- }, delay);
339
- }
340
- var waitMs = Math.min((input.timeout || 30) * 1e3, 6e4);
341
- await new Promise((resolve2) => {
342
- var timer = setTimeout(resolve2, waitMs);
343
- proc.on("close", () => {
344
- clearTimeout(timer);
345
- setTimeout(resolve2, 200);
346
- });
347
- });
348
- var output = entry.output;
349
- entry.output = "";
350
- if (output.length > 5e4) output = output.slice(-5e4);
351
- return { sessionId, output, exitCode: entry.exitCode, done: entry.exitCode !== null };
352
- }
353
- },
354
- {
355
- name: "shell_sudo",
356
- description: "Run a command with sudo. Handles password prompt automatically.",
357
- input_schema: {
358
- type: "object",
359
- properties: {
360
- command: { type: "string", description: "Command to run (without sudo prefix)" },
361
- password: { type: "string", description: "User password for sudo" },
362
- cwd: { type: "string" },
363
- timeout: { type: "number", description: "Seconds (default 60)" }
364
- },
365
- required: ["command", "password"]
366
- },
367
- execute: async (input) => {
368
- if (platform() === "win32") {
369
- return { error: 'Use shell_interactive with "Start-Process ... -Verb RunAs" for Windows elevation' };
370
- }
371
- var timeoutMs = (input.timeout || 60) * 1e3;
372
- var cwd = input.cwd || opts?.cwd || process.cwd();
373
- var cmd = `echo '${input.password.replace(/'/g, "'\\''")}' | sudo -S ${input.command}`;
374
- try {
375
- var r = await execAsync(cmd, {
376
- cwd,
377
- timeout: timeoutMs,
378
- maxBuffer: 2 * 1024 * 1024,
379
- env: { ...process.env, TERM: "dumb", DEBIAN_FRONTEND: "noninteractive" }
380
- });
381
- var stdout = r.stdout || "";
382
- var stderr = (r.stderr || "").replace(/\[sudo\].*\n?/g, "");
383
- if (stdout.length > 5e4) stdout = stdout.slice(0, 5e4) + "\n[...truncated]";
384
- return { stdout, stderr, exitCode: 0 };
385
- } catch (err) {
386
- var stderrMsg = (err.stderr || err.message || "").replace(/\[sudo\].*\n?/g, "");
387
- return { stdout: (err.stdout || "").slice(0, 5e4), stderr: stderrMsg.slice(0, 1e4), exitCode: err.code || 1 };
388
- }
389
- }
390
- },
391
- {
392
- name: "shell_install",
393
- description: "Install a package using the system package manager. Auto-detects apt/yum/dnf/pacman/brew/choco/winget.",
394
- input_schema: {
395
- type: "object",
396
- properties: {
397
- package: { type: "string", description: "Package name(s) to install" },
398
- password: { type: "string", description: "Sudo password (not needed for brew/choco/winget)" }
399
- },
400
- required: ["package"]
401
- },
402
- execute: async (input) => {
403
- var os = platform();
404
- var pkg = input.package;
405
- var cmd;
406
- var needsSudo = true;
407
- if (os === "darwin") {
408
- cmd = `brew install ${pkg}`;
409
- needsSudo = false;
410
- } else if (os === "win32") {
411
- cmd = `winget install ${pkg}`;
412
- needsSudo = false;
413
- } else {
414
- try {
415
- await execAsync("which apt-get");
416
- cmd = `apt-get install -y ${pkg}`;
417
- } catch {
418
- try {
419
- await execAsync("which dnf");
420
- cmd = `dnf install -y ${pkg}`;
421
- } catch {
422
- try {
423
- await execAsync("which yum");
424
- cmd = `yum install -y ${pkg}`;
425
- } catch {
426
- try {
427
- await execAsync("which pacman");
428
- cmd = `pacman -S --noconfirm ${pkg}`;
429
- } catch {
430
- try {
431
- await execAsync("which apk");
432
- cmd = `apk add ${pkg}`;
433
- } catch {
434
- return { error: "No supported package manager found (apt/dnf/yum/pacman/apk)" };
435
- }
436
- }
437
- }
438
- }
439
- }
440
- }
441
- if (needsSudo && input.password) {
442
- cmd = `echo '${input.password.replace(/'/g, "'\\''")}' | sudo -S ${cmd}`;
443
- } else if (needsSudo) {
444
- cmd = `sudo ${cmd}`;
445
- }
446
- try {
447
- var r = await execAsync(cmd, {
448
- timeout: 3e5,
449
- maxBuffer: 2 * 1024 * 1024,
450
- env: { ...process.env, DEBIAN_FRONTEND: "noninteractive", TERM: "dumb" }
451
- });
452
- return { ok: true, stdout: (r.stdout || "").slice(-5e3), stderr: (r.stderr || "").slice(-2e3) };
453
- } catch (err) {
454
- return { error: (err.stderr || err.message || "").slice(0, 1e4), exitCode: err.code || 1 };
455
- }
456
- }
457
- },
458
- {
459
- name: "shell_session_list",
460
- description: "List active interactive shell sessions.",
461
- input_schema: { type: "object", properties: {}, required: [] },
462
- execute: async () => ({
463
- sessions: Array.from(activeSessions.entries()).map(([id, s]) => ({
464
- id,
465
- done: s.exitCode !== null,
466
- exitCode: s.exitCode,
467
- age: Math.round((Date.now() - s.startedAt) / 1e3) + "s",
468
- buffered: s.output.length + " chars"
469
- }))
470
- })
471
- },
472
- {
473
- name: "shell_session_kill",
474
- description: "Kill an interactive shell session.",
475
- input_schema: {
476
- type: "object",
477
- properties: { sessionId: { type: "string" } },
478
- required: ["sessionId"]
479
- },
480
- execute: async (input) => {
481
- var s = activeSessions.get(input.sessionId);
482
- if (!s) return { error: "Not found" };
483
- try {
484
- s.proc.kill("SIGKILL");
485
- } catch {
486
- }
487
- activeSessions.delete(input.sessionId);
488
- return { ok: true };
489
- }
490
- }
491
- ];
492
- }
493
- function createShellExecTool(opts) {
494
- return createShellTools(opts)[0];
495
- }
496
-
497
- // src/agent-tools/tools/local/system-info.ts
498
- import { hostname, platform as platform2, arch, cpus, totalmem, freemem, uptime, homedir as homedir2, userInfo } from "os";
499
- function createSystemInfoTool() {
500
- return {
501
- name: "system_info",
502
- description: "Get host system info (OS, CPU, memory, uptime).",
503
- input_schema: { type: "object", properties: {} },
504
- execute: async () => {
505
- return {
506
- hostname: hostname(),
507
- platform: platform2(),
508
- arch: arch(),
509
- cpuCount: cpus().length,
510
- cpuModel: cpus()[0]?.model || "unknown",
511
- totalMemoryGB: +(totalmem() / 1073741824).toFixed(1),
512
- freeMemoryGB: +(freemem() / 1073741824).toFixed(1),
513
- uptimeHours: +(uptime() / 3600).toFixed(1),
514
- homeDir: homedir2(),
515
- user: userInfo().username,
516
- cwd: process.cwd(),
517
- nodeVersion: process.version
518
- };
519
- }
520
- };
521
- }
522
-
523
- // src/agent-tools/tools/local/coding.ts
524
- import { readFile as readFile3, writeFile as writeFile3, readdir as readdir3, access } from "fs/promises";
525
- import { exec as cpExec2 } from "child_process";
526
- import { promisify as promisify2 } from "util";
527
- import { join as join4, relative as relative2, extname, dirname as dirname3 } from "path";
528
- var execAsync2 = promisify2(cpExec2);
529
- async function exists(p) {
530
- try {
531
- await access(p);
532
- return true;
533
- } catch {
534
- return false;
535
- }
536
- }
537
- async function detectProjectRoot(startDir) {
538
- var dir = startDir;
539
- for (var i = 0; i < 10; i++) {
540
- for (var marker of ["package.json", "Cargo.toml", "go.mod", "pyproject.toml", "pom.xml", ".git"]) {
541
- if (await exists(join4(dir, marker))) return dir;
542
- }
543
- var parent = dirname3(dir);
544
- if (parent === dir) break;
545
- dir = parent;
546
- }
547
- return startDir;
548
- }
549
- async function getProjectType(root) {
550
- if (await exists(join4(root, "package.json"))) {
551
- try {
552
- var pkg = JSON.parse(await readFile3(join4(root, "package.json"), "utf-8"));
553
- return {
554
- type: "node",
555
- buildCmd: pkg.scripts?.build ? "npm run build" : void 0,
556
- testCmd: pkg.scripts?.test ? "npm test" : void 0,
557
- lintCmd: pkg.scripts?.lint ? "npm run lint" : void 0
558
- };
559
- } catch {
560
- }
561
- }
562
- if (await exists(join4(root, "Cargo.toml"))) return { type: "rust", buildCmd: "cargo build", testCmd: "cargo test" };
563
- if (await exists(join4(root, "go.mod"))) return { type: "go", buildCmd: "go build ./...", testCmd: "go test ./..." };
564
- if (await exists(join4(root, "pyproject.toml"))) return { type: "python", testCmd: "pytest" };
565
- return { type: "unknown" };
566
- }
567
- function parseBuildErrors(output) {
568
- var errors = [];
569
- var tsPattern = /([^\s]+\.[tj]sx?)[:(](\d+)[,:](\d+)[):]?\s*[-–]?\s*(error\s+\w+:\s*.+)/gi;
570
- var m;
571
- while (m = tsPattern.exec(output)) {
572
- errors.push({ file: m[1], line: parseInt(m[2]), message: m[4] });
573
- }
574
- var genericPattern = /(?:error|Error)[:\s]+(.+)/g;
575
- if (errors.length === 0) {
576
- while (m = genericPattern.exec(output)) {
577
- if (!m[1].includes("node_modules")) errors.push({ message: m[1].trim() });
578
- }
579
- }
580
- var rustPattern = /error\[(\w+)\]:\s*(.+)\n\s*-->\s*([^:]+):(\d+)/g;
581
- while (m = rustPattern.exec(output)) {
582
- errors.push({ file: m[3], line: parseInt(m[4]), message: `${m[1]}: ${m[2]}` });
583
- }
584
- return errors.slice(0, 20);
585
- }
586
- function createCodingTools(opts) {
587
- var defaultCwd = opts?.cwd || process.cwd();
588
- var sandbox = opts?.sandbox;
589
- return [
590
- // ─── 1. Code Plan ─────────────────────────────────
591
- {
592
- name: "code_plan",
593
- description: "Create a structured implementation plan before writing code. Analyzes the codebase, identifies files to change, and outputs a step-by-step plan. ALWAYS use this before multi-file changes.",
594
- input_schema: {
595
- type: "object",
596
- properties: {
597
- task: { type: "string", description: "What you need to implement" },
598
- cwd: { type: "string", description: "Project root directory" },
599
- context_files: {
600
- type: "array",
601
- items: { type: "string" },
602
- description: "Key files to read for context before planning"
603
- }
604
- },
605
- required: ["task"]
606
- },
607
- execute: async (input) => {
608
- var cwd = input.cwd || defaultCwd;
609
- var root = await detectProjectRoot(cwd);
610
- var project = await getProjectType(root);
611
- var contexts = [];
612
- if (input.context_files) {
613
- for (var f of input.context_files.slice(0, 10)) {
614
- try {
615
- var fp = resolvePath(f, sandbox);
616
- var content = await readFile3(fp, "utf-8");
617
- var lines = content.split("\n");
618
- contexts.push({
619
- path: relative2(root, fp),
620
- snippet: lines.slice(0, 200).join("\n") + (lines.length > 200 ? `
621
- [...${lines.length - 200} more lines]` : "")
622
- });
623
- } catch {
624
- }
625
- }
626
- }
627
- var tree = [];
628
- async function walk(dir, depth, prefix) {
629
- if (depth > 2) return;
630
- try {
631
- var entries = await readdir3(dir, { withFileTypes: true });
632
- var filtered = entries.filter(
633
- (e2) => !["node_modules", ".git", "dist", "build", ".next", "__pycache__", "target", ".cache", "coverage"].includes(e2.name) && !e2.name.startsWith(".")
634
- ).sort((a, b) => {
635
- if (a.isDirectory() !== b.isDirectory()) return a.isDirectory() ? -1 : 1;
636
- return a.name.localeCompare(b.name);
637
- });
638
- for (var e of filtered.slice(0, 50)) {
639
- tree.push(`${prefix}${e.isDirectory() ? "\u{1F4C1} " : " "}${e.name}`);
640
- if (e.isDirectory()) await walk(join4(dir, e.name), depth + 1, prefix + " ");
641
- }
642
- } catch {
643
- }
644
- }
645
- await walk(root, 0, "");
646
- return {
647
- projectRoot: root,
648
- projectType: project.type,
649
- buildCommand: project.buildCmd || "unknown",
650
- testCommand: project.testCmd || "unknown",
651
- structure: tree.join("\n"),
652
- contextFiles: contexts,
653
- instructions: [
654
- "Based on the project info above, create your plan:",
655
- "1. List ALL files you need to create or modify",
656
- "2. For each file, describe the specific changes",
657
- "3. Identify the order of changes (dependencies first)",
658
- "4. Note any imports/exports that need updating",
659
- "5. Plan your build + test verification step",
660
- `6. Build command: ${project.buildCmd || "determine from project"}`
661
- ].join("\n")
662
- };
663
- }
664
- },
665
- // ─── 2. Code Search (ripgrep-powered) ─────────────
666
- {
667
- name: "code_search",
668
- description: "Search codebase for pattern matches. Uses ripgrep if available, falls back to grep. Returns matches with file, line number, and context.",
669
- input_schema: {
670
- type: "object",
671
- properties: {
672
- pattern: { type: "string", description: "Search pattern (regex supported)" },
673
- path: { type: "string", description: "Directory or file to search (default: project root)" },
674
- file_pattern: { type: "string", description: 'File glob filter (e.g. "*.ts", "*.py")' },
675
- context_lines: { type: "number", description: "Lines of context around matches (default 2)" },
676
- max_results: { type: "number", description: "Max matches (default 30)" },
677
- case_sensitive: { type: "boolean", description: "Case sensitive (default false)" },
678
- whole_word: { type: "boolean", description: "Match whole words only" },
679
- fixed_string: { type: "boolean", description: "Treat pattern as literal string, not regex" }
680
- },
681
- required: ["pattern"]
682
- },
683
- execute: async (input) => {
684
- var searchPath = resolvePath(input.path || defaultCwd, sandbox);
685
- var ctx = input.context_lines ?? 2;
686
- var max = input.max_results || 30;
687
- var flags = [];
688
- if (!input.case_sensitive) flags.push("-i");
689
- if (input.whole_word) flags.push("-w");
690
- if (input.fixed_string) flags.push("-F");
691
- var useRg = false;
692
- try {
693
- await execAsync2("which rg");
694
- useRg = true;
695
- } catch {
696
- }
697
- var cmd;
698
- if (useRg) {
699
- cmd = `rg --json -C ${ctx} -m ${max} ${flags.join(" ")}`;
700
- if (input.file_pattern) cmd += ` -g '${input.file_pattern}'`;
701
- cmd += ` -- '${input.pattern.replace(/'/g, "'\\''")}' '${searchPath}'`;
702
- } else {
703
- cmd = `grep -rn ${flags.join(" ")} -C ${ctx}`;
704
- if (input.file_pattern) cmd += ` --include='${input.file_pattern}'`;
705
- cmd += ` -- '${input.pattern.replace(/'/g, "'\\''")}' '${searchPath}'`;
706
- cmd += ` | head -${max * (ctx * 2 + 3)}`;
707
- }
708
- try {
709
- var { stdout, stderr } = await execAsync2(cmd, {
710
- timeout: 15e3,
711
- maxBuffer: 512 * 1024,
712
- cwd: searchPath
713
- });
714
- if (useRg && stdout) {
715
- var matches = [];
716
- var currentFile = "";
717
- var contextBuf = [];
718
- for (var line of stdout.split("\n").filter(Boolean)) {
719
- try {
720
- var j = JSON.parse(line);
721
- if (j.type === "match") {
722
- matches.push({
723
- file: relative2(searchPath, j.data.path.text),
724
- line: j.data.line_number,
725
- text: j.data.lines.text.trimEnd()
726
- });
727
- }
728
- } catch {
729
- }
730
- }
731
- return { matches: matches.slice(0, max), total: matches.length, engine: "ripgrep" };
732
- }
733
- return { output: stdout.slice(0, 5e4), engine: "grep" };
734
- } catch (err) {
735
- if (err.code === 1) return { matches: [], message: "No matches found" };
736
- return { error: (err.stderr || err.message).slice(0, 5e3) };
737
- }
738
- }
739
- },
740
- // ─── 3. Code Read (with line numbers + ranges) ────
741
- {
742
- name: "code_read",
743
- description: "Read a file with line numbers. Supports reading specific line ranges. Better than file_read for code \u2014 always shows line numbers.",
744
- input_schema: {
745
- type: "object",
746
- properties: {
747
- path: { type: "string" },
748
- from_line: { type: "number", description: "Start line (1-indexed, default 1)" },
749
- to_line: { type: "number", description: "End line (default: from_line + 200 or EOF)" },
750
- symbols: { type: "boolean", description: "Show only function/class/type definitions (outline mode)" }
751
- },
752
- required: ["path"]
753
- },
754
- execute: async (input) => {
755
- var fp = resolvePath(input.path, sandbox);
756
- var content = await readFile3(fp, "utf-8");
757
- var lines = content.split("\n");
758
- var totalLines = lines.length;
759
- if (input.symbols) {
760
- var ext = extname(fp).toLowerCase();
761
- var symbolPattern;
762
- if ([".ts", ".tsx", ".js", ".jsx"].includes(ext)) {
763
- symbolPattern = /^(?:export\s+)?(?:async\s+)?(?:function|class|type|interface|enum|const|var|let)\s+\w+|^\s*(?:static\s+)?(?:async\s+)?(?:get\s+|set\s+)?\w+\s*\(/;
764
- } else if ([".py"].includes(ext)) {
765
- symbolPattern = /^(?:class|def|async def)\s+\w+/;
766
- } else if ([".rs"].includes(ext)) {
767
- symbolPattern = /^(?:pub\s+)?(?:fn|struct|enum|trait|impl|type|const|static)\s+/;
768
- } else if ([".go"].includes(ext)) {
769
- symbolPattern = /^(?:func|type|var|const)\s+/;
770
- } else {
771
- symbolPattern = /^(?:function|class|def|fn|type|interface|struct|enum)\s+/;
772
- }
773
- var symbols = [];
774
- for (var i = 0; i < lines.length; i++) {
775
- if (symbolPattern.test(lines[i])) {
776
- symbols.push(`${String(i + 1).padStart(4)}\u2502 ${lines[i]}`);
777
- }
778
- }
779
- return { path: fp, totalLines, symbols: symbols.join("\n") || "No symbols found" };
780
- }
781
- var from = Math.max(1, input.from_line || 1);
782
- var to = Math.min(totalLines, input.to_line || from + 199);
783
- var slice = lines.slice(from - 1, to);
784
- var numbered = slice.map((l, i2) => `${String(from + i2).padStart(4)}\u2502 ${l}`).join("\n");
785
- return {
786
- path: fp,
787
- totalLines,
788
- range: `${from}-${to}`,
789
- content: numbered,
790
- hasMore: to < totalLines
791
- };
792
- }
793
- },
794
- // ─── 4. Code Multi-Edit (batch edits in one call) ─
795
- {
796
- name: "code_multi_edit",
797
- description: "Apply multiple edits to one or more files in a single call. More efficient than repeated file_edit calls. Edits are applied in order.",
798
- input_schema: {
799
- type: "object",
800
- properties: {
801
- edits: {
802
- type: "array",
803
- items: {
804
- type: "object",
805
- properties: {
806
- path: { type: "string" },
807
- old_text: { type: "string" },
808
- new_text: { type: "string" }
809
- },
810
- required: ["path", "old_text", "new_text"]
811
- },
812
- description: "Array of {path, old_text, new_text} edits"
813
- }
814
- },
815
- required: ["edits"]
816
- },
817
- execute: async (input) => {
818
- var results = [];
819
- var byFile = /* @__PURE__ */ new Map();
820
- for (var edit of input.edits) {
821
- var fp = resolvePath(edit.path, sandbox);
822
- if (!byFile.has(fp)) byFile.set(fp, []);
823
- byFile.get(fp).push({ old_text: edit.old_text, new_text: edit.new_text });
824
- }
825
- for (var [filePath, edits] of byFile) {
826
- try {
827
- var content = await readFile3(filePath, "utf-8");
828
- for (var e of edits) {
829
- if (!content.includes(e.old_text)) {
830
- results.push({ path: filePath, ok: false, error: `old_text not found: "${e.old_text.slice(0, 60)}..."` });
831
- continue;
832
- }
833
- content = content.replace(e.old_text, e.new_text);
834
- results.push({ path: filePath, ok: true });
835
- }
836
- await writeFile3(filePath, content, "utf-8");
837
- } catch (err) {
838
- results.push({ path: filePath, ok: false, error: err.message });
839
- }
840
- }
841
- var success = results.filter((r) => r.ok).length;
842
- var failed = results.filter((r) => !r.ok);
843
- return { total: results.length, success, failed: failed.length > 0 ? failed : void 0 };
844
- }
845
- },
846
- // ─── 5. Code Build (with error parsing) ───────────
847
- {
848
- name: "code_build",
849
- description: "Build the project and parse errors. Auto-detects build command from package.json/Cargo.toml/etc. Returns structured error list with file + line.",
850
- input_schema: {
851
- type: "object",
852
- properties: {
853
- cwd: { type: "string", description: "Project root (auto-detected if omitted)" },
854
- command: { type: "string", description: "Custom build command (overrides auto-detect)" },
855
- clean: { type: "boolean", description: "Clean dist/build before building" }
856
- },
857
- required: []
858
- },
859
- execute: async (input) => {
860
- var cwd = input.cwd || defaultCwd;
861
- var root = await detectProjectRoot(cwd);
862
- var project = await getProjectType(root);
863
- var buildCmd = input.command || project.buildCmd;
864
- if (!buildCmd) return { error: `Cannot auto-detect build command for ${project.type} project. Specify command manually.` };
865
- if (input.clean) {
866
- try {
867
- if (project.type === "node") await execAsync2("rm -rf dist build .next", { cwd: root });
868
- else if (project.type === "rust") await execAsync2("cargo clean", { cwd: root });
869
- } catch {
870
- }
871
- }
872
- var startTime = Date.now();
873
- try {
874
- var { stdout, stderr } = await execAsync2(buildCmd, {
875
- cwd: root,
876
- timeout: 12e4,
877
- maxBuffer: 2 * 1024 * 1024,
878
- env: { ...process.env, FORCE_COLOR: "0", NO_COLOR: "1" }
879
- });
880
- var duration = Date.now() - startTime;
881
- return {
882
- ok: true,
883
- duration: `${duration}ms`,
884
- output: (stdout + "\n" + stderr).trim().slice(-5e3)
885
- };
886
- } catch (err) {
887
- var duration = Date.now() - startTime;
888
- var output = ((err.stdout || "") + "\n" + (err.stderr || "")).trim();
889
- var errors = parseBuildErrors(output);
890
- return {
891
- ok: false,
892
- duration: `${duration}ms`,
893
- exitCode: err.code,
894
- errors: errors.length > 0 ? errors : void 0,
895
- output: output.slice(-1e4)
896
- };
897
- }
898
- }
899
- },
900
- // ─── 6. Code Test ─────────────────────────────────
901
- {
902
- name: "code_test",
903
- description: "Run project tests and parse results. Auto-detects test framework.",
904
- input_schema: {
905
- type: "object",
906
- properties: {
907
- cwd: { type: "string" },
908
- command: { type: "string", description: "Custom test command" },
909
- filter: { type: "string", description: "Test name/file filter pattern" },
910
- coverage: { type: "boolean", description: "Run with coverage" }
911
- },
912
- required: []
913
- },
914
- execute: async (input) => {
915
- var cwd = input.cwd || defaultCwd;
916
- var root = await detectProjectRoot(cwd);
917
- var project = await getProjectType(root);
918
- var testCmd = input.command || project.testCmd;
919
- if (!testCmd) return { error: "No test command found. Specify one manually." };
920
- if (input.filter) {
921
- if (project.type === "node") testCmd += ` -- --grep "${input.filter}"`;
922
- else if (project.type === "rust") testCmd += ` ${input.filter}`;
923
- else if (project.type === "python") testCmd += ` -k "${input.filter}"`;
924
- }
925
- if (input.coverage && project.type === "node") testCmd += " -- --coverage";
926
- try {
927
- var { stdout, stderr } = await execAsync2(testCmd, {
928
- cwd: root,
929
- timeout: 3e5,
930
- maxBuffer: 2 * 1024 * 1024,
931
- env: { ...process.env, FORCE_COLOR: "0", NO_COLOR: "1", CI: "1" }
932
- });
933
- return { ok: true, output: (stdout + "\n" + stderr).trim().slice(-1e4) };
934
- } catch (err) {
935
- return {
936
- ok: false,
937
- exitCode: err.code,
938
- output: ((err.stdout || "") + "\n" + (err.stderr || "")).trim().slice(-1e4)
939
- };
940
- }
941
- }
942
- },
943
- // ─── 7. Code Git ──────────────────────────────────
944
- {
945
- name: "code_git",
946
- description: "Git operations: status, diff, log, commit, push, branch, stash, blame.",
947
- input_schema: {
948
- type: "object",
949
- properties: {
950
- action: { type: "string", description: "status|diff|log|commit|push|pull|branch|checkout|stash|blame|add" },
951
- args: { type: "string", description: "Additional arguments (e.g. file path for diff/blame, message for commit)" },
952
- cwd: { type: "string" }
953
- },
954
- required: ["action"]
955
- },
956
- execute: async (input) => {
957
- var cwd = input.cwd || defaultCwd;
958
- var root = await detectProjectRoot(cwd);
959
- var args = input.args || "";
960
- var cmdMap = {
961
- status: "git status --short",
962
- diff: `git diff ${args}`,
963
- log: `git log --oneline -20 ${args}`,
964
- commit: `git commit ${args.startsWith("-") ? args : `-m "${args.replace(/"/g, '\\"')}"`}`,
965
- push: `git push ${args}`,
966
- pull: `git pull ${args}`,
967
- branch: args ? `git checkout -b ${args}` : "git branch -a",
968
- checkout: `git checkout ${args}`,
969
- stash: `git stash ${args || "push"}`,
970
- blame: `git blame ${args}`,
971
- add: `git add ${args || "."}`
972
- };
973
- var cmd = cmdMap[input.action];
974
- if (!cmd) return { error: `Unknown action: ${input.action}. Use: ${Object.keys(cmdMap).join(", ")}` };
975
- try {
976
- var { stdout, stderr } = await execAsync2(cmd, { cwd: root, timeout: 3e4 });
977
- return { output: (stdout || stderr || "").trim().slice(0, 5e4) };
978
- } catch (err) {
979
- return { error: (err.stderr || err.message).slice(0, 5e3), exitCode: err.code };
980
- }
981
- }
982
- },
983
- // ─── 8. Code Create File (with directory creation) ─
984
- {
985
- name: "code_create",
986
- description: "Create a new file with content. Automatically creates parent directories. Better for new files than file_write.",
987
- input_schema: {
988
- type: "object",
989
- properties: {
990
- path: { type: "string" },
991
- content: { type: "string" },
992
- overwrite: { type: "boolean", description: "Overwrite if exists (default false)" }
993
- },
994
- required: ["path", "content"]
995
- },
996
- execute: async (input) => {
997
- var fp = resolvePath(input.path, sandbox);
998
- if (!input.overwrite && await exists(fp)) {
999
- return { error: `File already exists: ${fp}. Set overwrite: true to replace.` };
1000
- }
1001
- var { mkdir: mkdir3 } = await import("fs/promises");
1002
- await mkdir3(dirname3(fp), { recursive: true });
1003
- await writeFile3(fp, input.content, "utf-8");
1004
- var lines = input.content.split("\n").length;
1005
- return { ok: true, path: fp, lines };
1006
- }
1007
- },
1008
- // ─── 9. Code Diff Preview ─────────────────────────
1009
- {
1010
- name: "code_diff",
1011
- description: "Preview what a file edit would look like as a unified diff, without applying it. Use to verify changes before committing.",
1012
- input_schema: {
1013
- type: "object",
1014
- properties: {
1015
- path: { type: "string" },
1016
- old_text: { type: "string" },
1017
- new_text: { type: "string" }
1018
- },
1019
- required: ["path", "old_text", "new_text"]
1020
- },
1021
- execute: async (input) => {
1022
- var fp = resolvePath(input.path, sandbox);
1023
- var content = await readFile3(fp, "utf-8");
1024
- if (!content.includes(input.old_text)) {
1025
- return { error: "old_text not found in file" };
1026
- }
1027
- var newContent = content.replace(input.old_text, input.new_text);
1028
- var oldLines = content.split("\n");
1029
- var newLines = newContent.split("\n");
1030
- var diff = [`--- ${input.path}`, `+++ ${input.path}`];
1031
- var start = 0;
1032
- while (start < oldLines.length && start < newLines.length && oldLines[start] === newLines[start]) start++;
1033
- var endOld = oldLines.length - 1;
1034
- var endNew = newLines.length - 1;
1035
- while (endOld > start && endNew > start && oldLines[endOld] === newLines[endNew]) {
1036
- endOld--;
1037
- endNew--;
1038
- }
1039
- diff.push(`@@ -${start + 1},${endOld - start + 1} +${start + 1},${endNew - start + 1} @@`);
1040
- for (var i = start; i <= endOld; i++) diff.push(`-${oldLines[i]}`);
1041
- for (var i = start; i <= endNew; i++) diff.push(`+${newLines[i]}`);
1042
- return { diff: diff.join("\n") };
1043
- }
1044
- },
1045
- // ─── 10. Process Manager ──────────────────────────
1046
- {
1047
- name: "code_pm2",
1048
- description: "Manage pm2 processes: list, restart, logs, stop, start.",
1049
- input_schema: {
1050
- type: "object",
1051
- properties: {
1052
- action: { type: "string", description: "list|restart|logs|stop|start|status" },
1053
- name: { type: "string", description: "Process name (for restart/logs/stop)" },
1054
- lines: { type: "number", description: "Number of log lines (default 30)" }
1055
- },
1056
- required: ["action"]
1057
- },
1058
- execute: async (input) => {
1059
- var cmdMap = {
1060
- list: "pm2 jlist",
1061
- restart: `pm2 restart ${input.name || "all"}`,
1062
- logs: `pm2 logs ${input.name || ""} --nostream --lines ${input.lines || 30}`,
1063
- stop: `pm2 stop ${input.name}`,
1064
- start: `pm2 start ${input.name}`,
1065
- status: "pm2 jlist"
1066
- };
1067
- var cmd = cmdMap[input.action];
1068
- if (!cmd) return { error: `Unknown action. Use: ${Object.keys(cmdMap).join(", ")}` };
1069
- try {
1070
- var { stdout, stderr } = await execAsync2(cmd, { timeout: 15e3 });
1071
- if (input.action === "list" || input.action === "status") {
1072
- try {
1073
- var procs = JSON.parse(stdout);
1074
- return {
1075
- processes: procs.map((p) => ({
1076
- name: p.name,
1077
- id: p.pm_id,
1078
- status: p.pm2_env?.status,
1079
- cpu: p.monit?.cpu,
1080
- memory: Math.round((p.monit?.memory || 0) / 1024 / 1024) + "MB",
1081
- restarts: p.pm2_env?.restart_time,
1082
- uptime: p.pm2_env?.pm_uptime
1083
- }))
1084
- };
1085
- } catch {
1086
- }
1087
- }
1088
- return { output: (stdout + "\n" + stderr).trim().slice(-1e4) };
1089
- } catch (err) {
1090
- return { error: (err.stderr || err.message).slice(0, 5e3) };
1091
- }
1092
- }
1093
- }
1094
- ];
1095
- }
1096
-
1097
- // src/agent-tools/tools/local/index.ts
1098
- function createLocalSystemTools(config) {
1099
- var sandbox = config?.sandboxRoot;
1100
- return [
1101
- createFileReadTool(sandbox),
1102
- createFileWriteTool(sandbox),
1103
- createFileEditTool(sandbox),
1104
- createFileListTool(sandbox),
1105
- createFileSearchTool(sandbox),
1106
- createFileMoveTool(sandbox),
1107
- createFileDeleteTool(sandbox),
1108
- ...createShellTools({ cwd: config?.shellCwd, timeout: config?.shellTimeout }),
1109
- ...createDependencyManagerTools(),
1110
- createSystemInfoTool(),
1111
- ...createCodingTools({ cwd: config?.shellCwd, sandbox })
1112
- ];
1113
- }
1114
- export {
1115
- createCodingTools,
1116
- createDependencyManagerTools,
1117
- createFileDeleteTool,
1118
- createFileEditTool,
1119
- createFileListTool,
1120
- createFileMoveTool,
1121
- createFileReadTool,
1122
- createFileSearchTool,
1123
- createFileWriteTool,
1124
- createLocalSystemTools,
1125
- createShellExecTool,
1126
- createShellTools,
1127
- createSystemInfoTool
1128
- };