@nexus-cortex/executors 4.26.0

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 (365) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +2 -0
  3. package/README.md +13 -0
  4. package/dist/ExecutorRegistry.d.ts +89 -0
  5. package/dist/ExecutorRegistry.d.ts.map +1 -0
  6. package/dist/ExecutorRegistry.js +219 -0
  7. package/dist/ExecutorRegistry.js.map +1 -0
  8. package/dist/base/BaseTool.d.ts +108 -0
  9. package/dist/base/BaseTool.d.ts.map +1 -0
  10. package/dist/base/BaseTool.js +111 -0
  11. package/dist/base/BaseTool.js.map +1 -0
  12. package/dist/base/ToolRegistry.d.ts +141 -0
  13. package/dist/base/ToolRegistry.d.ts.map +1 -0
  14. package/dist/base/ToolRegistry.js +241 -0
  15. package/dist/base/ToolRegistry.js.map +1 -0
  16. package/dist/base/ToolResult.d.ts +63 -0
  17. package/dist/base/ToolResult.d.ts.map +1 -0
  18. package/dist/base/ToolResult.js +8 -0
  19. package/dist/base/ToolResult.js.map +1 -0
  20. package/dist/base/index.d.ts +10 -0
  21. package/dist/base/index.d.ts.map +1 -0
  22. package/dist/base/index.js +8 -0
  23. package/dist/base/index.js.map +1 -0
  24. package/dist/implementations/addon/CreateArtifactTool.d.ts +221 -0
  25. package/dist/implementations/addon/CreateArtifactTool.d.ts.map +1 -0
  26. package/dist/implementations/addon/CreateArtifactTool.js +1042 -0
  27. package/dist/implementations/addon/CreateArtifactTool.js.map +1 -0
  28. package/dist/implementations/addon/FrameDiffCache.d.ts +166 -0
  29. package/dist/implementations/addon/FrameDiffCache.d.ts.map +1 -0
  30. package/dist/implementations/addon/FrameDiffCache.js +395 -0
  31. package/dist/implementations/addon/FrameDiffCache.js.map +1 -0
  32. package/dist/implementations/addon/H264StreamEncoder.d.ts +84 -0
  33. package/dist/implementations/addon/H264StreamEncoder.d.ts.map +1 -0
  34. package/dist/implementations/addon/H264StreamEncoder.js +203 -0
  35. package/dist/implementations/addon/H264StreamEncoder.js.map +1 -0
  36. package/dist/implementations/addon/HybridScreenshotManager.d.ts +197 -0
  37. package/dist/implementations/addon/HybridScreenshotManager.d.ts.map +1 -0
  38. package/dist/implementations/addon/HybridScreenshotManager.js +415 -0
  39. package/dist/implementations/addon/HybridScreenshotManager.js.map +1 -0
  40. package/dist/implementations/addon/InspectSandboxTool.d.ts +54 -0
  41. package/dist/implementations/addon/InspectSandboxTool.d.ts.map +1 -0
  42. package/dist/implementations/addon/InspectSandboxTool.js +226 -0
  43. package/dist/implementations/addon/InspectSandboxTool.js.map +1 -0
  44. package/dist/implementations/addon/InteractWithSandboxTool.d.ts +90 -0
  45. package/dist/implementations/addon/InteractWithSandboxTool.d.ts.map +1 -0
  46. package/dist/implementations/addon/InteractWithSandboxTool.js +367 -0
  47. package/dist/implementations/addon/InteractWithSandboxTool.js.map +1 -0
  48. package/dist/implementations/addon/KeyframeDetector.d.ts +140 -0
  49. package/dist/implementations/addon/KeyframeDetector.d.ts.map +1 -0
  50. package/dist/implementations/addon/KeyframeDetector.js +390 -0
  51. package/dist/implementations/addon/KeyframeDetector.js.map +1 -0
  52. package/dist/implementations/addon/ModifySandboxTool.d.ts +62 -0
  53. package/dist/implementations/addon/ModifySandboxTool.d.ts.map +1 -0
  54. package/dist/implementations/addon/ModifySandboxTool.js +266 -0
  55. package/dist/implementations/addon/ModifySandboxTool.js.map +1 -0
  56. package/dist/implementations/addon/ReactArtifactBuilder.d.ts +27 -0
  57. package/dist/implementations/addon/ReactArtifactBuilder.d.ts.map +1 -0
  58. package/dist/implementations/addon/ReactArtifactBuilder.js +198 -0
  59. package/dist/implementations/addon/ReactArtifactBuilder.js.map +1 -0
  60. package/dist/implementations/addon/SandboxEventBroadcaster.d.ts +143 -0
  61. package/dist/implementations/addon/SandboxEventBroadcaster.d.ts.map +1 -0
  62. package/dist/implementations/addon/SandboxEventBroadcaster.js +258 -0
  63. package/dist/implementations/addon/SandboxEventBroadcaster.js.map +1 -0
  64. package/dist/implementations/addon/SandboxIntrospectionTools.d.ts +77 -0
  65. package/dist/implementations/addon/SandboxIntrospectionTools.d.ts.map +1 -0
  66. package/dist/implementations/addon/SandboxIntrospectionTools.js +292 -0
  67. package/dist/implementations/addon/SandboxIntrospectionTools.js.map +1 -0
  68. package/dist/implementations/addon/SandboxViewServer.d.ts +127 -0
  69. package/dist/implementations/addon/SandboxViewServer.d.ts.map +1 -0
  70. package/dist/implementations/addon/SandboxViewServer.js +775 -0
  71. package/dist/implementations/addon/SandboxViewServer.js.map +1 -0
  72. package/dist/implementations/addon/ScreenStream.d.ts +149 -0
  73. package/dist/implementations/addon/ScreenStream.d.ts.map +1 -0
  74. package/dist/implementations/addon/ScreenStream.js +306 -0
  75. package/dist/implementations/addon/ScreenStream.js.map +1 -0
  76. package/dist/implementations/addon/StopSandboxTool.d.ts +61 -0
  77. package/dist/implementations/addon/StopSandboxTool.d.ts.map +1 -0
  78. package/dist/implementations/addon/StopSandboxTool.js +252 -0
  79. package/dist/implementations/addon/StopSandboxTool.js.map +1 -0
  80. package/dist/implementations/addon/TerminalSandbox.d.ts +111 -0
  81. package/dist/implementations/addon/TerminalSandbox.d.ts.map +1 -0
  82. package/dist/implementations/addon/TerminalSandbox.js +345 -0
  83. package/dist/implementations/addon/TerminalSandbox.js.map +1 -0
  84. package/dist/implementations/addon/VisualFeedbackBridge.d.ts +367 -0
  85. package/dist/implementations/addon/VisualFeedbackBridge.d.ts.map +1 -0
  86. package/dist/implementations/addon/VisualFeedbackBridge.js +888 -0
  87. package/dist/implementations/addon/VisualFeedbackBridge.js.map +1 -0
  88. package/dist/implementations/addon/WindowManager.d.ts +138 -0
  89. package/dist/implementations/addon/WindowManager.d.ts.map +1 -0
  90. package/dist/implementations/addon/WindowManager.js +276 -0
  91. package/dist/implementations/addon/WindowManager.js.map +1 -0
  92. package/dist/implementations/addon/index.d.ts +29 -0
  93. package/dist/implementations/addon/index.d.ts.map +1 -0
  94. package/dist/implementations/addon/index.js +29 -0
  95. package/dist/implementations/addon/index.js.map +1 -0
  96. package/dist/implementations/addon/injectables/reactIntrospection.d.ts +57 -0
  97. package/dist/implementations/addon/injectables/reactIntrospection.d.ts.map +1 -0
  98. package/dist/implementations/addon/injectables/reactIntrospection.js +480 -0
  99. package/dist/implementations/addon/injectables/reactIntrospection.js.map +1 -0
  100. package/dist/implementations/addon/terminal-client.html +253 -0
  101. package/dist/implementations/agent/PRAgentTool.d.ts +37 -0
  102. package/dist/implementations/agent/PRAgentTool.d.ts.map +1 -0
  103. package/dist/implementations/agent/PRAgentTool.js +257 -0
  104. package/dist/implementations/agent/PRAgentTool.js.map +1 -0
  105. package/dist/implementations/agent/TaskTool.d.ts +76 -0
  106. package/dist/implementations/agent/TaskTool.d.ts.map +1 -0
  107. package/dist/implementations/agent/TaskTool.js +424 -0
  108. package/dist/implementations/agent/TaskTool.js.map +1 -0
  109. package/dist/implementations/agent/index.d.ts +5 -0
  110. package/dist/implementations/agent/index.d.ts.map +1 -0
  111. package/dist/implementations/agent/index.js +3 -0
  112. package/dist/implementations/agent/index.js.map +1 -0
  113. package/dist/implementations/execution/BackgroundProcessRegistry.d.ts +68 -0
  114. package/dist/implementations/execution/BackgroundProcessRegistry.d.ts.map +1 -0
  115. package/dist/implementations/execution/BackgroundProcessRegistry.js +146 -0
  116. package/dist/implementations/execution/BackgroundProcessRegistry.js.map +1 -0
  117. package/dist/implementations/execution/BashOutputTool.d.ts +42 -0
  118. package/dist/implementations/execution/BashOutputTool.d.ts.map +1 -0
  119. package/dist/implementations/execution/BashOutputTool.js +168 -0
  120. package/dist/implementations/execution/BashOutputTool.js.map +1 -0
  121. package/dist/implementations/execution/CodeExecuteTool.d.ts +31 -0
  122. package/dist/implementations/execution/CodeExecuteTool.d.ts.map +1 -0
  123. package/dist/implementations/execution/CodeExecuteTool.js +127 -0
  124. package/dist/implementations/execution/CodeExecuteTool.js.map +1 -0
  125. package/dist/implementations/execution/KillShellTool.d.ts +37 -0
  126. package/dist/implementations/execution/KillShellTool.d.ts.map +1 -0
  127. package/dist/implementations/execution/KillShellTool.js +144 -0
  128. package/dist/implementations/execution/KillShellTool.js.map +1 -0
  129. package/dist/implementations/execution/SearchToolsTool.d.ts +32 -0
  130. package/dist/implementations/execution/SearchToolsTool.d.ts.map +1 -0
  131. package/dist/implementations/execution/SearchToolsTool.js +109 -0
  132. package/dist/implementations/execution/SearchToolsTool.js.map +1 -0
  133. package/dist/implementations/execution/ShellTool.d.ts +108 -0
  134. package/dist/implementations/execution/ShellTool.d.ts.map +1 -0
  135. package/dist/implementations/execution/ShellTool.js +546 -0
  136. package/dist/implementations/execution/ShellTool.js.map +1 -0
  137. package/dist/implementations/execution/WorkspaceManagerTool.d.ts +40 -0
  138. package/dist/implementations/execution/WorkspaceManagerTool.d.ts.map +1 -0
  139. package/dist/implementations/execution/WorkspaceManagerTool.js +370 -0
  140. package/dist/implementations/execution/WorkspaceManagerTool.js.map +1 -0
  141. package/dist/implementations/execution/index.d.ts +13 -0
  142. package/dist/implementations/execution/index.d.ts.map +1 -0
  143. package/dist/implementations/execution/index.js +13 -0
  144. package/dist/implementations/execution/index.js.map +1 -0
  145. package/dist/implementations/extensions/EndTurnTool.d.ts +62 -0
  146. package/dist/implementations/extensions/EndTurnTool.d.ts.map +1 -0
  147. package/dist/implementations/extensions/EndTurnTool.js +172 -0
  148. package/dist/implementations/extensions/EndTurnTool.js.map +1 -0
  149. package/dist/implementations/extensions/ResearchBacklogTool.d.ts +37 -0
  150. package/dist/implementations/extensions/ResearchBacklogTool.d.ts.map +1 -0
  151. package/dist/implementations/extensions/ResearchBacklogTool.js +102 -0
  152. package/dist/implementations/extensions/ResearchBacklogTool.js.map +1 -0
  153. package/dist/implementations/extensions/SkillTool.d.ts +108 -0
  154. package/dist/implementations/extensions/SkillTool.d.ts.map +1 -0
  155. package/dist/implementations/extensions/SkillTool.js +351 -0
  156. package/dist/implementations/extensions/SkillTool.js.map +1 -0
  157. package/dist/implementations/extensions/SlashCommandTool.d.ts +112 -0
  158. package/dist/implementations/extensions/SlashCommandTool.d.ts.map +1 -0
  159. package/dist/implementations/extensions/SlashCommandTool.js +315 -0
  160. package/dist/implementations/extensions/SlashCommandTool.js.map +1 -0
  161. package/dist/implementations/extensions/index.d.ts +14 -0
  162. package/dist/implementations/extensions/index.d.ts.map +1 -0
  163. package/dist/implementations/extensions/index.js +10 -0
  164. package/dist/implementations/extensions/index.js.map +1 -0
  165. package/dist/implementations/file/EditTool.d.ts +232 -0
  166. package/dist/implementations/file/EditTool.d.ts.map +1 -0
  167. package/dist/implementations/file/EditTool.js +707 -0
  168. package/dist/implementations/file/EditTool.js.map +1 -0
  169. package/dist/implementations/file/ReadFileTool.d.ts +49 -0
  170. package/dist/implementations/file/ReadFileTool.d.ts.map +1 -0
  171. package/dist/implementations/file/ReadFileTool.js +225 -0
  172. package/dist/implementations/file/ReadFileTool.js.map +1 -0
  173. package/dist/implementations/file/WriteBinaryTool.d.ts +21 -0
  174. package/dist/implementations/file/WriteBinaryTool.d.ts.map +1 -0
  175. package/dist/implementations/file/WriteBinaryTool.js +153 -0
  176. package/dist/implementations/file/WriteBinaryTool.js.map +1 -0
  177. package/dist/implementations/file/WriteFileTool.d.ts +41 -0
  178. package/dist/implementations/file/WriteFileTool.d.ts.map +1 -0
  179. package/dist/implementations/file/WriteFileTool.js +220 -0
  180. package/dist/implementations/file/WriteFileTool.js.map +1 -0
  181. package/dist/implementations/file/index.d.ts +8 -0
  182. package/dist/implementations/file/index.d.ts.map +1 -0
  183. package/dist/implementations/file/index.js +8 -0
  184. package/dist/implementations/file/index.js.map +1 -0
  185. package/dist/implementations/historical/GetConversationSegmentTool.d.ts +44 -0
  186. package/dist/implementations/historical/GetConversationSegmentTool.d.ts.map +1 -0
  187. package/dist/implementations/historical/GetConversationSegmentTool.js +220 -0
  188. package/dist/implementations/historical/GetConversationSegmentTool.js.map +1 -0
  189. package/dist/implementations/historical/ListCompactionBoundariesTool.d.ts +36 -0
  190. package/dist/implementations/historical/ListCompactionBoundariesTool.d.ts.map +1 -0
  191. package/dist/implementations/historical/ListCompactionBoundariesTool.js +174 -0
  192. package/dist/implementations/historical/ListCompactionBoundariesTool.js.map +1 -0
  193. package/dist/implementations/historical/ListSessionsTool.d.ts +38 -0
  194. package/dist/implementations/historical/ListSessionsTool.d.ts.map +1 -0
  195. package/dist/implementations/historical/ListSessionsTool.js +140 -0
  196. package/dist/implementations/historical/ListSessionsTool.js.map +1 -0
  197. package/dist/implementations/historical/LoadSessionTool.d.ts +39 -0
  198. package/dist/implementations/historical/LoadSessionTool.d.ts.map +1 -0
  199. package/dist/implementations/historical/LoadSessionTool.js +171 -0
  200. package/dist/implementations/historical/LoadSessionTool.js.map +1 -0
  201. package/dist/implementations/historical/RequestHistoricalContextTool.d.ts +46 -0
  202. package/dist/implementations/historical/RequestHistoricalContextTool.d.ts.map +1 -0
  203. package/dist/implementations/historical/RequestHistoricalContextTool.js +224 -0
  204. package/dist/implementations/historical/RequestHistoricalContextTool.js.map +1 -0
  205. package/dist/implementations/historical/SearchConversationHistoryTool.d.ts +51 -0
  206. package/dist/implementations/historical/SearchConversationHistoryTool.d.ts.map +1 -0
  207. package/dist/implementations/historical/SearchConversationHistoryTool.js +306 -0
  208. package/dist/implementations/historical/SearchConversationHistoryTool.js.map +1 -0
  209. package/dist/implementations/historical/index.d.ts +12 -0
  210. package/dist/implementations/historical/index.d.ts.map +1 -0
  211. package/dist/implementations/historical/index.js +12 -0
  212. package/dist/implementations/historical/index.js.map +1 -0
  213. package/dist/implementations/index.d.ts +16 -0
  214. package/dist/implementations/index.d.ts.map +1 -0
  215. package/dist/implementations/index.js +28 -0
  216. package/dist/implementations/index.js.map +1 -0
  217. package/dist/implementations/mcp/DiscoveredMcpTool.d.ts +58 -0
  218. package/dist/implementations/mcp/DiscoveredMcpTool.d.ts.map +1 -0
  219. package/dist/implementations/mcp/DiscoveredMcpTool.js +269 -0
  220. package/dist/implementations/mcp/DiscoveredMcpTool.js.map +1 -0
  221. package/dist/implementations/mcp/index.d.ts +9 -0
  222. package/dist/implementations/mcp/index.d.ts.map +1 -0
  223. package/dist/implementations/mcp/index.js +8 -0
  224. package/dist/implementations/mcp/index.js.map +1 -0
  225. package/dist/implementations/notebook/NotebookEditTool.d.ts +96 -0
  226. package/dist/implementations/notebook/NotebookEditTool.d.ts.map +1 -0
  227. package/dist/implementations/notebook/NotebookEditTool.js +390 -0
  228. package/dist/implementations/notebook/NotebookEditTool.js.map +1 -0
  229. package/dist/implementations/notebook/index.d.ts +7 -0
  230. package/dist/implementations/notebook/index.d.ts.map +1 -0
  231. package/dist/implementations/notebook/index.js +7 -0
  232. package/dist/implementations/notebook/index.js.map +1 -0
  233. package/dist/implementations/search/GlobTool.d.ts +73 -0
  234. package/dist/implementations/search/GlobTool.d.ts.map +1 -0
  235. package/dist/implementations/search/GlobTool.js +213 -0
  236. package/dist/implementations/search/GlobTool.js.map +1 -0
  237. package/dist/implementations/search/GrepTool.d.ts +102 -0
  238. package/dist/implementations/search/GrepTool.d.ts.map +1 -0
  239. package/dist/implementations/search/GrepTool.js +754 -0
  240. package/dist/implementations/search/GrepTool.js.map +1 -0
  241. package/dist/implementations/search/index.d.ts +6 -0
  242. package/dist/implementations/search/index.d.ts.map +1 -0
  243. package/dist/implementations/search/index.js +6 -0
  244. package/dist/implementations/search/index.js.map +1 -0
  245. package/dist/implementations/tmux/TmuxSessionTool.d.ts +82 -0
  246. package/dist/implementations/tmux/TmuxSessionTool.d.ts.map +1 -0
  247. package/dist/implementations/tmux/TmuxSessionTool.js +371 -0
  248. package/dist/implementations/tmux/TmuxSessionTool.js.map +1 -0
  249. package/dist/implementations/tmux/TmuxViewServer.d.ts +86 -0
  250. package/dist/implementations/tmux/TmuxViewServer.d.ts.map +1 -0
  251. package/dist/implementations/tmux/TmuxViewServer.js +480 -0
  252. package/dist/implementations/tmux/TmuxViewServer.js.map +1 -0
  253. package/dist/implementations/tmux/index.d.ts +6 -0
  254. package/dist/implementations/tmux/index.d.ts.map +1 -0
  255. package/dist/implementations/tmux/index.js +6 -0
  256. package/dist/implementations/tmux/index.js.map +1 -0
  257. package/dist/implementations/ui/AskUserQuestionTool.d.ts +77 -0
  258. package/dist/implementations/ui/AskUserQuestionTool.d.ts.map +1 -0
  259. package/dist/implementations/ui/AskUserQuestionTool.js +241 -0
  260. package/dist/implementations/ui/AskUserQuestionTool.js.map +1 -0
  261. package/dist/implementations/ui/ExitPlanModeTool.d.ts +44 -0
  262. package/dist/implementations/ui/ExitPlanModeTool.d.ts.map +1 -0
  263. package/dist/implementations/ui/ExitPlanModeTool.js +150 -0
  264. package/dist/implementations/ui/ExitPlanModeTool.js.map +1 -0
  265. package/dist/implementations/ui/TodoWriteTool.d.ts +59 -0
  266. package/dist/implementations/ui/TodoWriteTool.d.ts.map +1 -0
  267. package/dist/implementations/ui/TodoWriteTool.js +315 -0
  268. package/dist/implementations/ui/TodoWriteTool.js.map +1 -0
  269. package/dist/implementations/ui/index.d.ts +9 -0
  270. package/dist/implementations/ui/index.d.ts.map +1 -0
  271. package/dist/implementations/ui/index.js +9 -0
  272. package/dist/implementations/ui/index.js.map +1 -0
  273. package/dist/implementations/web/BrowseTool.d.ts +43 -0
  274. package/dist/implementations/web/BrowseTool.d.ts.map +1 -0
  275. package/dist/implementations/web/BrowseTool.js +181 -0
  276. package/dist/implementations/web/BrowseTool.js.map +1 -0
  277. package/dist/implementations/web/SandboxTransferTool.d.ts +30 -0
  278. package/dist/implementations/web/SandboxTransferTool.d.ts.map +1 -0
  279. package/dist/implementations/web/SandboxTransferTool.js +261 -0
  280. package/dist/implementations/web/SandboxTransferTool.js.map +1 -0
  281. package/dist/implementations/web/WebFetchTool.d.ts +93 -0
  282. package/dist/implementations/web/WebFetchTool.d.ts.map +1 -0
  283. package/dist/implementations/web/WebFetchTool.js +484 -0
  284. package/dist/implementations/web/WebFetchTool.js.map +1 -0
  285. package/dist/implementations/web/WebSearchTool.d.ts +53 -0
  286. package/dist/implementations/web/WebSearchTool.d.ts.map +1 -0
  287. package/dist/implementations/web/WebSearchTool.js +227 -0
  288. package/dist/implementations/web/WebSearchTool.js.map +1 -0
  289. package/dist/implementations/web/escalateDirective.d.ts +11 -0
  290. package/dist/implementations/web/escalateDirective.d.ts.map +1 -0
  291. package/dist/implementations/web/escalateDirective.js +20 -0
  292. package/dist/implementations/web/escalateDirective.js.map +1 -0
  293. package/dist/implementations/web/index.d.ts +10 -0
  294. package/dist/implementations/web/index.d.ts.map +1 -0
  295. package/dist/implementations/web/index.js +10 -0
  296. package/dist/implementations/web/index.js.map +1 -0
  297. package/dist/implementations/web/webBackends.d.ts +65 -0
  298. package/dist/implementations/web/webBackends.d.ts.map +1 -0
  299. package/dist/implementations/web/webBackends.js +430 -0
  300. package/dist/implementations/web/webBackends.js.map +1 -0
  301. package/dist/implementations/web/webFetchRequestInit.d.ts +9 -0
  302. package/dist/implementations/web/webFetchRequestInit.d.ts.map +1 -0
  303. package/dist/implementations/web/webFetchRequestInit.js +21 -0
  304. package/dist/implementations/web/webFetchRequestInit.js.map +1 -0
  305. package/dist/index.d.ts +14 -0
  306. package/dist/index.d.ts.map +1 -0
  307. package/dist/index.js +18 -0
  308. package/dist/index.js.map +1 -0
  309. package/dist/utils/ArtifactRegistry.d.ts +138 -0
  310. package/dist/utils/ArtifactRegistry.d.ts.map +1 -0
  311. package/dist/utils/ArtifactRegistry.js +259 -0
  312. package/dist/utils/ArtifactRegistry.js.map +1 -0
  313. package/dist/utils/ChromiumBrowserManager.d.ts +56 -0
  314. package/dist/utils/ChromiumBrowserManager.d.ts.map +1 -0
  315. package/dist/utils/ChromiumBrowserManager.js +243 -0
  316. package/dist/utils/ChromiumBrowserManager.js.map +1 -0
  317. package/dist/utils/FileUtils.d.ts +81 -0
  318. package/dist/utils/FileUtils.d.ts.map +1 -0
  319. package/dist/utils/FileUtils.js +148 -0
  320. package/dist/utils/FileUtils.js.map +1 -0
  321. package/dist/utils/GitPolicy.d.ts +70 -0
  322. package/dist/utils/GitPolicy.d.ts.map +1 -0
  323. package/dist/utils/GitPolicy.js +166 -0
  324. package/dist/utils/GitPolicy.js.map +1 -0
  325. package/dist/utils/GitUtils.d.ts +18 -0
  326. package/dist/utils/GitUtils.d.ts.map +1 -0
  327. package/dist/utils/GitUtils.js +62 -0
  328. package/dist/utils/GitUtils.js.map +1 -0
  329. package/dist/utils/SandboxRegistry.d.ts +110 -0
  330. package/dist/utils/SandboxRegistry.d.ts.map +1 -0
  331. package/dist/utils/SandboxRegistry.js +220 -0
  332. package/dist/utils/SandboxRegistry.js.map +1 -0
  333. package/dist/utils/SchemaValidator.d.ts +21 -0
  334. package/dist/utils/SchemaValidator.d.ts.map +1 -0
  335. package/dist/utils/SchemaValidator.js +67 -0
  336. package/dist/utils/SchemaValidator.js.map +1 -0
  337. package/dist/utils/SessionLock.d.ts +96 -0
  338. package/dist/utils/SessionLock.d.ts.map +1 -0
  339. package/dist/utils/SessionLock.js +276 -0
  340. package/dist/utils/SessionLock.js.map +1 -0
  341. package/dist/utils/SessionPersistence.d.ts +89 -0
  342. package/dist/utils/SessionPersistence.d.ts.map +1 -0
  343. package/dist/utils/SessionPersistence.js +244 -0
  344. package/dist/utils/SessionPersistence.js.map +1 -0
  345. package/dist/utils/TextUtils.d.ts +77 -0
  346. package/dist/utils/TextUtils.d.ts.map +1 -0
  347. package/dist/utils/TextUtils.js +112 -0
  348. package/dist/utils/TextUtils.js.map +1 -0
  349. package/dist/utils/TmuxCapture.d.ts +94 -0
  350. package/dist/utils/TmuxCapture.d.ts.map +1 -0
  351. package/dist/utils/TmuxCapture.js +131 -0
  352. package/dist/utils/TmuxCapture.js.map +1 -0
  353. package/dist/utils/TmuxManager.d.ts +65 -0
  354. package/dist/utils/TmuxManager.d.ts.map +1 -0
  355. package/dist/utils/TmuxManager.js +304 -0
  356. package/dist/utils/TmuxManager.js.map +1 -0
  357. package/dist/utils/autoResearchPlanGate.d.ts +10 -0
  358. package/dist/utils/autoResearchPlanGate.d.ts.map +1 -0
  359. package/dist/utils/autoResearchPlanGate.js +57 -0
  360. package/dist/utils/autoResearchPlanGate.js.map +1 -0
  361. package/dist/utils/index.d.ts +19 -0
  362. package/dist/utils/index.d.ts.map +1 -0
  363. package/dist/utils/index.js +13 -0
  364. package/dist/utils/index.js.map +1 -0
  365. package/package.json +83 -0
@@ -0,0 +1,546 @@
1
+ /**
2
+ * Shell Tool Executor
3
+ *
4
+ * Executes shell commands via bash/cmd and captures output.
5
+ * Supports background processes, timeouts, and abort handling.
6
+ *
7
+ * Adapted and simplified from Gemini CLI patterns
8
+ * - Removed: Complex allow/block lists, summarization
9
+ * - Kept: Core execution, background process detection, timeout enforcement
10
+ * - Simplified: Security model (path-based only)
11
+ */
12
+ import os from 'os';
13
+ import path from 'path';
14
+ import fs from 'fs';
15
+ import crypto from 'crypto';
16
+ import { spawn } from 'child_process';
17
+ import { BaseTool } from '../../base/index.js';
18
+ import { SchemaValidator } from '../../utils/SchemaValidator.js';
19
+ import { TmuxManager, SessionPersistence } from '../../utils/index.js';
20
+ import { BackgroundProcessRegistry } from './BackgroundProcessRegistry.js';
21
+ /**
22
+ * Shell Tool Executor
23
+ *
24
+ * Features:
25
+ * - Executes commands via bash -c (or cmd.exe on Windows)
26
+ * - Captures stdout, stderr, exit code
27
+ * - Background process detection (Unix only)
28
+ * - Timeout enforcement
29
+ * - Abort signal support
30
+ * - Streaming output updates
31
+ *
32
+ * Security:
33
+ * - Commands run in specified working directory
34
+ * - Path traversal prevention for directory parameter
35
+ * - Blocks command substitution with $()
36
+ */
37
+ export class ShellTool extends BaseTool {
38
+ config;
39
+ static DEFAULT_TIMEOUT_MS = 120000; // 2 minutes
40
+ static OUTPUT_UPDATE_INTERVAL_MS = 1000; // 1 second
41
+ static MAX_OUTPUT_LENGTH = 30000; // ~30KB max to prevent context overflow
42
+ tmux;
43
+ persistence;
44
+ constructor(config) {
45
+ super('Bash', 'Execute', `Executes a shell command via bash (or cmd.exe on Windows). Returns stdout, stderr, exit code, and background process IDs. Commands run in a subprocess that leads its own process group. CRITICAL: Always use literal characters in commands - never HTML-encode special characters (use && not &amp;&amp;, < not &lt;, > not &gt;).`, {
46
+ type: 'object',
47
+ properties: {
48
+ command: {
49
+ type: 'string',
50
+ description: 'The shell command to execute. Can use && to chain commands, & for background processes. IMPORTANT: Use literal characters (&& not &amp;&amp;, < not &lt;, > not &gt;). Never use HTML entities in commands.',
51
+ },
52
+ directory: {
53
+ type: 'string',
54
+ description: 'Optional: Directory to run command in (relative to working directory).',
55
+ },
56
+ timeout: {
57
+ type: 'number',
58
+ description: 'Optional: Timeout in milliseconds (default: 120000ms = 2 minutes).',
59
+ },
60
+ },
61
+ required: ['command'],
62
+ });
63
+ this.config = config;
64
+ this.tmux = TmuxManager.getInstance();
65
+ this.persistence = new SessionPersistence(config.workingDirectory || process.cwd());
66
+ }
67
+ validateToolParams(params) {
68
+ // Schema validation
69
+ const schemaError = SchemaValidator.validate(this.parameterSchema, params);
70
+ if (schemaError) {
71
+ return schemaError;
72
+ }
73
+ // Validate command is not empty
74
+ if (!params.command || !params.command.trim()) {
75
+ return 'Command cannot be empty.';
76
+ }
77
+ // Security: block command substitution with $()
78
+ if (params.command.includes('$(')) {
79
+ return 'Command substitution using $() is not allowed for security reasons.';
80
+ }
81
+ // Validate directory if provided
82
+ if (params.directory) {
83
+ if (path.isAbsolute(params.directory)) {
84
+ return 'Directory must be relative to working directory, not absolute.';
85
+ }
86
+ // Resolve and check directory exists
87
+ const resolvedDir = path.resolve(this.config.workingDirectory, params.directory);
88
+ // Security: ensure directory is within working directory
89
+ if (!resolvedDir.startsWith(this.config.workingDirectory)) {
90
+ return `Directory must be within working directory.`;
91
+ }
92
+ // Check directory exists
93
+ try {
94
+ if (!fs.existsSync(resolvedDir)) {
95
+ return `Directory does not exist: ${params.directory}`;
96
+ }
97
+ const stats = fs.statSync(resolvedDir);
98
+ if (!stats.isDirectory()) {
99
+ return `Path is not a directory: ${params.directory}`;
100
+ }
101
+ }
102
+ catch (error) {
103
+ return `Error accessing directory: ${error.message}`;
104
+ }
105
+ }
106
+ // Validate timeout if provided
107
+ if (params.timeout !== undefined) {
108
+ if (typeof params.timeout !== 'number' || params.timeout <= 0) {
109
+ return 'Timeout must be a positive number.';
110
+ }
111
+ }
112
+ return null;
113
+ }
114
+ getDescription(params) {
115
+ if (!params || !params.command) {
116
+ return 'Execute shell command';
117
+ }
118
+ let description = params.command;
119
+ if (params.directory) {
120
+ description += ` [in ${params.directory}]`;
121
+ }
122
+ return description;
123
+ }
124
+ async execute(params, signal, updateOutput) {
125
+ const startTime = Date.now();
126
+ // Validate parameters
127
+ const validationError = this.validateToolParams(params);
128
+ if (validationError) {
129
+ return this.createErrorResult(validationError);
130
+ }
131
+ if (signal.aborted) {
132
+ return this.createErrorResult('Command was cancelled before it could start.');
133
+ }
134
+ // Guard: redirect commands that should use dedicated tools
135
+ const redirectMessage = this.checkToolRedirect(params.command);
136
+ if (redirectMessage) {
137
+ return this.createErrorResult(redirectMessage);
138
+ }
139
+ // Check if background execution requested
140
+ if (params.run_in_background) {
141
+ return this.executeInBackground(params, signal);
142
+ }
143
+ // Check if persistent session requested
144
+ if (params.persistentSession) {
145
+ return this.executeInPersistentSession(params, signal, updateOutput);
146
+ }
147
+ try {
148
+ const result = await this.executeCommand(params, signal, updateOutput);
149
+ // Check if command was aborted during execution
150
+ if (signal.aborted) {
151
+ return this.createErrorResult('Command was cancelled by user.');
152
+ }
153
+ return this.createSuccessResult(result.llmContent, {
154
+ executionTime: Date.now() - startTime,
155
+ exitCode: result.exitCode,
156
+ signal: result.processSignal,
157
+ backgroundPIDs: result.backgroundPIDs,
158
+ processGroupPGID: result.pgid,
159
+ truncated: result.truncated,
160
+ });
161
+ }
162
+ catch (error) {
163
+ if (error.name === 'AbortError' || signal.aborted) {
164
+ return this.createErrorResult('Command was cancelled by user.');
165
+ }
166
+ return this.createErrorResult(`Failed to execute command: ${error.message}`);
167
+ }
168
+ }
169
+ /**
170
+ * Executes the shell command and captures output
171
+ * @private
172
+ */
173
+ async executeCommand(params, signal, updateOutput) {
174
+ const isWindows = os.platform() === 'win32';
175
+ const timeout = params.timeout || ShellTool.DEFAULT_TIMEOUT_MS;
176
+ // Create temp file for background PID detection (Unix only)
177
+ const tempFileName = `shell_pgrep_${crypto.randomBytes(6).toString('hex')}.tmp`;
178
+ const tempFilePath = path.join(os.tmpdir(), tempFileName);
179
+ // Wrap command to capture background PIDs (Unix only)
180
+ const command = isWindows
181
+ ? params.command
182
+ : (() => {
183
+ let cmd = params.command.trim();
184
+ if (!cmd.endsWith('&'))
185
+ cmd += ';';
186
+ return `{ ${cmd} }; __code=$?; pgrep -g 0 >${tempFilePath} 2>&1; exit $__code;`;
187
+ })();
188
+ // Determine working directory
189
+ const cwd = params.directory
190
+ ? path.resolve(this.config.workingDirectory, params.directory)
191
+ : this.config.workingDirectory;
192
+ // Spawn process
193
+ const shell = isWindows
194
+ ? spawn('cmd.exe', ['/c', params.command], {
195
+ stdio: ['ignore', 'pipe', 'pipe'],
196
+ cwd,
197
+ })
198
+ : spawn('bash', ['-c', command], {
199
+ stdio: ['ignore', 'pipe', 'pipe'],
200
+ detached: true, // Create process group
201
+ cwd,
202
+ });
203
+ // Output tracking
204
+ let exited = false;
205
+ let stdout = '';
206
+ let stderr = '';
207
+ let output = '';
208
+ let lastUpdateTime = Date.now();
209
+ const appendOutput = (str) => {
210
+ output += str;
211
+ if (updateOutput &&
212
+ Date.now() - lastUpdateTime > ShellTool.OUTPUT_UPDATE_INTERVAL_MS) {
213
+ updateOutput(output);
214
+ lastUpdateTime = Date.now();
215
+ }
216
+ };
217
+ // Capture stdout
218
+ shell.stdout?.on('data', (data) => {
219
+ if (!exited) {
220
+ const str = this.stripAnsi(data.toString());
221
+ stdout += str;
222
+ appendOutput(str);
223
+ }
224
+ });
225
+ // Capture stderr
226
+ shell.stderr?.on('data', (data) => {
227
+ if (!exited) {
228
+ const str = this.stripAnsi(data.toString());
229
+ stderr += str;
230
+ appendOutput(str);
231
+ }
232
+ });
233
+ // Error handling
234
+ let errorMessage = null;
235
+ shell.on('error', (err) => {
236
+ // Remove wrapper from error message
237
+ errorMessage = err.message.replace(command, params.command);
238
+ });
239
+ // Exit handling
240
+ let exitCode = null;
241
+ let processSignal = null;
242
+ shell.on('exit', (code, sig) => {
243
+ exited = true;
244
+ exitCode = code;
245
+ processSignal = sig;
246
+ });
247
+ // Abort handler
248
+ const abortHandler = async () => {
249
+ if (shell.pid && !exited) {
250
+ await this.killProcess(shell.pid, isWindows);
251
+ }
252
+ };
253
+ signal.addEventListener('abort', abortHandler);
254
+ // Timeout handler
255
+ const timeoutId = setTimeout(async () => {
256
+ if (!exited && shell.pid) {
257
+ await this.killProcess(shell.pid, isWindows);
258
+ }
259
+ }, timeout);
260
+ try {
261
+ // Wait for process to exit
262
+ await new Promise((resolve) => {
263
+ shell.on('exit', () => resolve());
264
+ });
265
+ }
266
+ finally {
267
+ clearTimeout(timeoutId);
268
+ signal.removeEventListener('abort', abortHandler);
269
+ }
270
+ // Parse background PIDs (Unix only)
271
+ const backgroundPIDs = [];
272
+ if (!isWindows && fs.existsSync(tempFilePath)) {
273
+ try {
274
+ const pgrepLines = fs
275
+ .readFileSync(tempFilePath, 'utf8')
276
+ .split('\n')
277
+ .filter(Boolean);
278
+ for (const line of pgrepLines) {
279
+ if (/^\d+$/.test(line)) {
280
+ const pid = Number(line);
281
+ if (pid !== shell.pid) {
282
+ backgroundPIDs.push(pid);
283
+ }
284
+ }
285
+ }
286
+ fs.unlinkSync(tempFilePath);
287
+ }
288
+ catch (err) {
289
+ // Ignore errors reading pgrep output
290
+ }
291
+ }
292
+ // Format output with truncation to prevent context overflow
293
+ let llmContent = '';
294
+ let truncated = false;
295
+ const truncateIfNeeded = (content) => {
296
+ if (content.length > ShellTool.MAX_OUTPUT_LENGTH) {
297
+ truncated = true;
298
+ // Keep first part and last part for context
299
+ const halfLimit = Math.floor(ShellTool.MAX_OUTPUT_LENGTH / 2) - 50;
300
+ const firstPart = content.substring(0, halfLimit);
301
+ const lastPart = content.substring(content.length - halfLimit);
302
+ return `${firstPart}\n\n... [${content.length - ShellTool.MAX_OUTPUT_LENGTH} characters truncated for context efficiency] ...\n\n${lastPart}`;
303
+ }
304
+ return content;
305
+ };
306
+ if (signal.aborted) {
307
+ llmContent = 'Command was cancelled by user before it could complete.';
308
+ if (output.trim()) {
309
+ llmContent += `\n\nOutput before cancellation:\n${truncateIfNeeded(output)}`;
310
+ }
311
+ else {
312
+ llmContent += ' No output was produced before cancellation.';
313
+ }
314
+ }
315
+ else {
316
+ // Concise output format
317
+ if (exitCode === 0) {
318
+ // Success: Just show stdout if present, otherwise confirmation
319
+ llmContent = truncateIfNeeded(stdout) || '(command completed successfully)';
320
+ }
321
+ else {
322
+ // Failure: Show error and stderr
323
+ const parts = [];
324
+ if (errorMessage) {
325
+ parts.push(`Error: ${errorMessage}`);
326
+ }
327
+ if (stderr) {
328
+ parts.push(`Stderr: ${truncateIfNeeded(stderr)}`);
329
+ }
330
+ if (parts.length === 0) {
331
+ parts.push(`Command failed with exit code ${exitCode}`);
332
+ }
333
+ llmContent = parts.join('\n');
334
+ }
335
+ }
336
+ return {
337
+ llmContent,
338
+ exitCode,
339
+ processSignal,
340
+ backgroundPIDs,
341
+ pgid: shell.pid ?? null,
342
+ truncated,
343
+ };
344
+ }
345
+ /**
346
+ * Kills a process and its children
347
+ * @private
348
+ */
349
+ async killProcess(pid, isWindows) {
350
+ if (isWindows) {
351
+ // Windows: use taskkill to kill process tree
352
+ spawn('taskkill', ['/pid', pid.toString(), '/f', '/t']);
353
+ }
354
+ else {
355
+ // Unix: kill process group
356
+ try {
357
+ // Try SIGTERM first
358
+ process.kill(-pid, 'SIGTERM');
359
+ await new Promise((resolve) => setTimeout(resolve, 200));
360
+ // Fall back to SIGKILL if still running
361
+ try {
362
+ process.kill(-pid, 'SIGKILL');
363
+ }
364
+ catch {
365
+ // Process already exited
366
+ }
367
+ }
368
+ catch {
369
+ // If group kill fails, try killing just the process
370
+ try {
371
+ process.kill(pid, 'SIGKILL');
372
+ }
373
+ catch {
374
+ // Process already exited
375
+ }
376
+ }
377
+ }
378
+ }
379
+ /**
380
+ * Execute command in persistent tmux session
381
+ * @private
382
+ */
383
+ async executeInPersistentSession(params, signal, updateOutput) {
384
+ const startTime = Date.now();
385
+ // Check tmux availability
386
+ if (!(await this.tmux.isAvailable())) {
387
+ return this.createErrorResult('tmux is not available. Persistent sessions require tmux to be installed.\n\n' +
388
+ 'Installation:\n' +
389
+ ' - Ubuntu/Debian: apt-get install tmux\n' +
390
+ ' - macOS: brew install tmux\n' +
391
+ ' - Replit: Add tmux in the Packages tab\n\n' +
392
+ 'Falling back to standard execution is not automatic. Please either:\n' +
393
+ '1. Install tmux and retry\n' +
394
+ '2. Remove persistentSession=true to use standard execution');
395
+ }
396
+ try {
397
+ // Generate or use provided session ID
398
+ const sessionId = params.sessionId || `bash-${crypto.randomBytes(4).toString('hex')}`;
399
+ updateOutput?.(`Using persistent session: ${sessionId}\n`);
400
+ // Determine working directory
401
+ const cwd = params.directory
402
+ ? path.resolve(this.config.workingDirectory, params.directory)
403
+ : this.config.workingDirectory;
404
+ // Create session if doesn't exist
405
+ if (!(await this.tmux.sessionExists(sessionId))) {
406
+ updateOutput?.(`Creating new tmux session...\n`);
407
+ await this.tmux.createSession(sessionId, cwd);
408
+ // Save session metadata
409
+ await this.persistence.saveSession({
410
+ sessionId,
411
+ created: new Date(),
412
+ lastUsed: new Date(),
413
+ cwd
414
+ });
415
+ }
416
+ else {
417
+ // Touch existing session
418
+ await this.persistence.touchSession(sessionId);
419
+ }
420
+ // Send command to session
421
+ updateOutput?.(`Sending command: ${params.command}\n`);
422
+ await this.tmux.sendKeys(sessionId, params.command);
423
+ // Wait for command to complete (simple delay-based approach)
424
+ const timeout = params.timeout || ShellTool.DEFAULT_TIMEOUT_MS;
425
+ await new Promise((resolve) => setTimeout(resolve, Math.min(timeout, 5000)));
426
+ // Capture output
427
+ updateOutput?.(`Capturing output...\n`);
428
+ const startLine = params.captureHistory ? -3000 : undefined;
429
+ const output = await this.tmux.capturePane(sessionId, startLine);
430
+ const result = `Command executed in persistent tmux session '${sessionId}'.\n\n` +
431
+ `Output:\n${'='.repeat(60)}\n${output}\n${'='.repeat(60)}\n\n` +
432
+ `Session persists after this command completes. You can:\n` +
433
+ `- Send more commands: persistentSession=true, sessionId='${sessionId}'\n` +
434
+ `- Inspect session: TmuxSession tool with action='capture', sessionId='${sessionId}'\n` +
435
+ `- Kill session: TmuxSession tool with action='kill', sessionId='${sessionId}'`;
436
+ return this.createSuccessResult(result, {
437
+ executionTime: Date.now() - startTime,
438
+ sessionId,
439
+ persistent: true,
440
+ sessionCwd: cwd
441
+ });
442
+ }
443
+ catch (error) {
444
+ if (signal.aborted) {
445
+ return this.createErrorResult('Command was cancelled by user.');
446
+ }
447
+ return this.createErrorResult(`Failed to execute in persistent session: ${error.message}`);
448
+ }
449
+ }
450
+ /**
451
+ * Checks if a command should be routed to a dedicated tool instead of Bash.
452
+ * Returns an error message with guidance if redirected, or null if allowed.
453
+ * @private
454
+ */
455
+ checkToolRedirect(command) {
456
+ const trimmed = command.trim();
457
+ // File reading: cat, head, tail → Read tool
458
+ if (/^(cat|head|tail)\s+/.test(trimmed) && !trimmed.includes('|') && !trimmed.includes('>')) {
459
+ return `Use the Read tool instead of \`${trimmed.split(/\s+/)[0]}\` for reading files. ` +
460
+ `Example: Read({ file_path: "${trimmed.split(/\s+/).slice(1).join(' ').replace(/["']/g, '')}" })`;
461
+ }
462
+ // File editing: sed -i, awk -i → Edit tool
463
+ if (/^sed\s+(-i|--in-place)\b/.test(trimmed) || /^perl\s+-[pn]?i\b/.test(trimmed)) {
464
+ return `Use the Edit tool instead of \`${trimmed.split(/\s+/)[0]}\` for editing files. ` +
465
+ `Read the file first, then use Edit({ file_path, old_string, new_string }).`;
466
+ }
467
+ // File writing: echo > file, cat > file, tee file → Write tool
468
+ if (/^(echo|printf|cat)\s+.*\s+>\s+\S/.test(trimmed) || /^tee\s+\S/.test(trimmed)) {
469
+ return `Use the Write tool instead of shell redirection for creating/writing files. ` +
470
+ `Example: Write({ file_path: "path", content: "content" })`;
471
+ }
472
+ // File searching: grep, rg, ag → Grep tool
473
+ if (/^(grep|rg|ag|ack)\s+/.test(trimmed) && !trimmed.includes('|')) {
474
+ return `Use the Grep tool instead of \`${trimmed.split(/\s+/)[0]}\` for searching file contents. ` +
475
+ `Example: Grep({ pattern: "search term", path: "directory" })`;
476
+ }
477
+ // File finding: find → Glob tool
478
+ if (/^find\s+/.test(trimmed) && /-name\b/.test(trimmed)) {
479
+ return `Use the Glob tool instead of \`find\` for finding files. ` +
480
+ `Example: Glob({ pattern: "**/*.ts", path: "directory" })`;
481
+ }
482
+ return null;
483
+ }
484
+ /**
485
+ * Execute command in background — returns immediately with bash_id.
486
+ * The process is registered in BackgroundProcessRegistry for polling via BashOutput.
487
+ * @private
488
+ */
489
+ executeInBackground(params, signal) {
490
+ const startTime = Date.now();
491
+ const isWindows = os.platform() === 'win32';
492
+ // Determine working directory
493
+ const cwd = params.directory
494
+ ? path.resolve(this.config.workingDirectory, params.directory)
495
+ : this.config.workingDirectory;
496
+ // Generate a unique shell ID
497
+ const shellId = `bg-${crypto.randomBytes(4).toString('hex')}`;
498
+ try {
499
+ // Spawn process — do NOT wait for completion
500
+ const shell = isWindows
501
+ ? spawn('cmd.exe', ['/c', params.command], {
502
+ stdio: ['ignore', 'pipe', 'pipe'],
503
+ cwd,
504
+ })
505
+ : spawn('bash', ['-c', params.command], {
506
+ stdio: ['ignore', 'pipe', 'pipe'],
507
+ detached: true,
508
+ cwd,
509
+ });
510
+ if (!shell.pid) {
511
+ return this.createErrorResult('Failed to spawn background process.');
512
+ }
513
+ // Register in BackgroundProcessRegistry — this sets up output capture and exit monitoring
514
+ const registry = BackgroundProcessRegistry.getInstance();
515
+ registry.registerProcess(shellId, shell.pid, params.command, shell);
516
+ // Unref the process so it doesn't prevent Node.js from exiting
517
+ shell.unref();
518
+ const result = `Background process started with ID: ${shellId}\n` +
519
+ `PID: ${shell.pid}\n` +
520
+ `Command: ${params.command}\n\n` +
521
+ `Use BashOutput({ bash_id: "${shellId}" }) to check output.\n` +
522
+ `Use KillShell({ shell_id: "${shellId}" }) to stop.`;
523
+ return {
524
+ ...this.createSuccessResult(result),
525
+ metadata: {
526
+ executionTime: Date.now() - startTime,
527
+ bash_id: shellId,
528
+ pid: shell.pid,
529
+ backgroundProcess: true,
530
+ },
531
+ };
532
+ }
533
+ catch (error) {
534
+ return this.createErrorResult(`Failed to start background process: ${error.message}`);
535
+ }
536
+ }
537
+ /**
538
+ * Removes ANSI escape codes from string
539
+ * @private
540
+ */
541
+ stripAnsi(str) {
542
+ // eslint-disable-next-line no-control-regex
543
+ return str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
544
+ }
545
+ }
546
+ //# sourceMappingURL=ShellTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ShellTool.js","sourceRoot":"","sources":["../../../src/implementations/execution/ShellTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAmB,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AA4C3E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,SAAU,SAAQ,QAAqC;IAQ9C;IAPZ,MAAM,CAAU,kBAAkB,GAA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,yBAAyB,CAAC,WAAW,EAAE,CAAC;YACzD,QAAQ,CAAC,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAEpE,+DAA+D;YAC/D,KAAK,CAAC,KAAK,EAAE,CAAC;YAEd,MAAM,MAAM,GAAG,uCAAuC,OAAO,IAAI;gBAC/D,QAAQ,KAAK,CAAC,GAAG,IAAI;gBACrB,YAAY,MAAM,CAAC,OAAO,MAAM;gBAChC,8BAA8B,OAAO,yBAAyB;gBAC9D,8BAA8B,OAAO,eAAe,CAAC;YAEvD,OAAO;gBACL,GAAG,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC;gBACnC,QAAQ,EAAE;oBACR,aAAa,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS;oBACrC,OAAO,EAAE,OAAO;oBAChB,GAAG,EAAE,KAAK,CAAC,GAAG;oBACd,iBAAiB,EAAE,IAAI;iBACxB;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC,iBAAiB,CAAC,uCAAuC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACxF,CAAC;IACH,CAAC;IAED;;;OAGG;IACK,SAAS,CAAC,GAAW;QAC3B,4CAA4C;QAC5C,OAAO,GAAG,CAAC,OAAO,CAChB,6EAA6E,EAC7E,EAAE,CACH,CAAC;IACJ,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * WorkspaceManager Tool Executor
3
+ *
4
+ * Manages git worktrees for isolated multi-agent parallel development.
5
+ * Supports creating worktrees from local repos, cloning external repos,
6
+ * diffing changes, and cleanup.
7
+ *
8
+ * Security: all git/gh invocations use execFile with an argument array (no shell).
9
+ * Repo/branch inputs are validated through GitPolicy; the auth token rides only in the
10
+ * subprocess environment, never in a clone URL or on argv. See GitPolicy.ts.
11
+ */
12
+ import { BaseTool, type ToolResult } from '../../base/index.js';
13
+ import type { ExecutorConfig } from '../../base/ToolRegistry.js';
14
+ export interface WorkspaceManagerParams {
15
+ mode: 'create' | 'clone' | 'status' | 'diff' | 'cleanup';
16
+ repo?: string;
17
+ branch?: string;
18
+ baseBranch?: string;
19
+ worktreePath?: string;
20
+ /** For cleanup: also remove this clone directory (returned by clone mode). */
21
+ cloneDir?: string;
22
+ maxDiffLines?: number;
23
+ }
24
+ export declare class WorkspaceManagerTool extends BaseTool<WorkspaceManagerParams, ToolResult> {
25
+ private workingDirectory;
26
+ private readonly policy;
27
+ constructor(config: ExecutorConfig);
28
+ validateToolParams(params: WorkspaceManagerParams): string | null;
29
+ execute(params: WorkspaceManagerParams, signal: AbortSignal): Promise<ToolResult>;
30
+ /** git invocation: execFile (no shell), policy token/host env, AbortSignal. */
31
+ private git;
32
+ private createWorktree;
33
+ private cloneAndWorktree;
34
+ private listWorktrees;
35
+ private diffWorktree;
36
+ private cleanupWorktree;
37
+ /** Best-effort gh availability probe (used to pick the clone path). */
38
+ private ghAvailable;
39
+ }
40
+ //# sourceMappingURL=WorkspaceManagerTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkspaceManagerTool.d.ts","sourceRoot":"","sources":["../../../src/implementations/execution/WorkspaceManagerTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAgBjE,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,oBAAqB,SAAQ,QAAQ,CAAC,sBAAsB,EAAE,UAAU,CAAC;IACpF,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;gBAEvB,MAAM,EAAE,cAAc;IA8BlC,kBAAkB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,GAAG,IAAI;IA2C3D,OAAO,CAAC,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAqBvF,+EAA+E;IAC/E,OAAO,CAAC,GAAG;YAWG,cAAc;YA6Cd,gBAAgB;YA2DhB,aAAa;YAyCb,YAAY;YA+CZ,eAAe;IAkF7B,uEAAuE;YACzD,WAAW;CAQ1B"}