@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,213 @@
1
+ /**
2
+ * Glob Tool Executor
3
+ *
4
+ * Finds files matching glob patterns with modification time sorting.
5
+ * Fast pattern-based file discovery for large codebases.
6
+ *
7
+ * Adapted and simplified from Gemini CLI patterns
8
+ * - Removed: FileDiscovery service, git-ignore filtering
9
+ * - Kept: Core glob matching, modification time sorting, security
10
+ */
11
+ import fs from 'fs';
12
+ import path from 'path';
13
+ import { glob } from 'glob';
14
+ import { BaseTool } from '../../base/index.js';
15
+ import { SchemaValidator } from '../../utils/SchemaValidator.js';
16
+ import { makeRelative, shortenPath, } from '../../utils/FileUtils.js';
17
+ /**
18
+ * Glob Tool Executor
19
+ *
20
+ * Features:
21
+ * - Fast pattern matching (e.g., star-star-slash-star.ts, src-star-star-slash-star.js)
22
+ * - Sorts results by modification time (newest first)
23
+ * - Then alphabetically for older files
24
+ * - Excludes node_modules and .git by default
25
+ * - Path normalization and security
26
+ */
27
+ export class GlobTool extends BaseTool {
28
+ config;
29
+ // Recency threshold: 24 hours
30
+ RECENCY_THRESHOLD_MS = 24 * 60 * 60 * 1000;
31
+ // Default max results to prevent context overflow
32
+ static DEFAULT_MAX_RESULTS = 100;
33
+ constructor(config) {
34
+ super('Glob', 'FindFiles', `Efficiently finds files matching specific glob patterns (e.g., \`src/**/*.ts\`, \`**/*.md\`), returning absolute paths sorted by modification time (newest first). Ideal for quickly locating files based on their name or path structure, especially in large codebases.`, {
35
+ type: 'object',
36
+ properties: {
37
+ pattern: {
38
+ type: 'string',
39
+ description: "The glob pattern to match against (e.g., '**/*.py', 'docs/*.md'). Supports wildcards: * (matches any chars), ** (matches directories recursively), ? (matches single char), [...] (character ranges).",
40
+ },
41
+ path: {
42
+ type: 'string',
43
+ description: 'Optional: The directory to search within. Can be absolute or relative to working directory. If omitted, searches the working directory.',
44
+ },
45
+ case_sensitive: {
46
+ type: 'boolean',
47
+ description: 'Optional: Whether the search should be case-sensitive. Defaults to false (case-insensitive).',
48
+ },
49
+ },
50
+ required: ['pattern'],
51
+ });
52
+ this.config = config;
53
+ }
54
+ validateToolParams(params) {
55
+ // Schema validation
56
+ const schemaError = SchemaValidator.validate(this.parameterSchema, params);
57
+ if (schemaError) {
58
+ return schemaError;
59
+ }
60
+ // Validate pattern
61
+ if (!params.pattern || typeof params.pattern !== 'string' || params.pattern.trim() === '') {
62
+ return "The 'pattern' parameter cannot be empty.";
63
+ }
64
+ // Resolve search directory
65
+ const searchDirAbsolute = path.resolve(this.config.workingDirectory, params.path || '.');
66
+ // Path validation: allow any absolute path (matching standard absolute-path behavior),
67
+ // but reject root "/" to prevent full-filesystem scans that hang tool execution.
68
+ if (!path.isAbsolute(searchDirAbsolute)) {
69
+ return `Search path must resolve to an absolute path: ${searchDirAbsolute}`;
70
+ }
71
+ if (searchDirAbsolute === '/') {
72
+ return `Searching from "/" would scan the entire filesystem. Use "." for the project directory or provide a specific path.`;
73
+ }
74
+ // Check directory exists
75
+ try {
76
+ if (!fs.existsSync(searchDirAbsolute)) {
77
+ return `Search path does not exist: ${searchDirAbsolute}`;
78
+ }
79
+ if (!fs.statSync(searchDirAbsolute).isDirectory()) {
80
+ return `Search path is not a directory: ${searchDirAbsolute}`;
81
+ }
82
+ }
83
+ catch (error) {
84
+ return `Error accessing search path: ${error.message}`;
85
+ }
86
+ return null;
87
+ }
88
+ getDescription(params) {
89
+ if (!params || !params.pattern) {
90
+ return 'Find files';
91
+ }
92
+ let description = `'${params.pattern}'`;
93
+ if (params.path) {
94
+ const searchDir = path.resolve(this.config.workingDirectory, params.path || '.');
95
+ const relativePath = makeRelative(searchDir, this.config.workingDirectory);
96
+ description += ` in ${shortenPath(relativePath)}`;
97
+ }
98
+ return description;
99
+ }
100
+ async execute(params, signal, updateOutput) {
101
+ const startTime = Date.now();
102
+ // Validate parameters
103
+ const validationError = this.validateToolParams(params);
104
+ if (validationError) {
105
+ return this.createErrorResult(validationError);
106
+ }
107
+ try {
108
+ const searchDirAbsolute = path.resolve(this.config.workingDirectory, params.path || '.');
109
+ // Execute glob search
110
+ const entries = (await glob(params.pattern, {
111
+ cwd: searchDirAbsolute,
112
+ withFileTypes: true,
113
+ nodir: true, // Only files, no directories
114
+ stat: true, // Include file stats (for mtime)
115
+ nocase: !(params.case_sensitive ?? true),
116
+ dot: true, // Include dotfiles
117
+ ignore: ['**/node_modules/**', '**/.git/**'], // Exclude common directories
118
+ follow: false, // Don't follow symlinks
119
+ signal,
120
+ }));
121
+ // Check if any files found
122
+ if (!entries || entries.length === 0) {
123
+ const message = `No files found matching pattern "${params.pattern}" within ${searchDirAbsolute}.`;
124
+ return this.createSuccessResult(message, {
125
+ executionTime: Date.now() - startTime,
126
+ fileCount: 0,
127
+ });
128
+ }
129
+ // Sort files by modification time
130
+ const sortedEntries = this.sortFilesByRecency(entries);
131
+ // Apply offset and limit for pagination
132
+ const offset = params.offset || 0;
133
+ const maxResults = params.limit === -1 ? Infinity : (params.limit || GlobTool.DEFAULT_MAX_RESULTS);
134
+ const totalCount = sortedEntries.length;
135
+ // Apply offset first, then limit
136
+ const afterOffset = sortedEntries.slice(offset);
137
+ const limitedEntries = afterOffset.slice(0, maxResults);
138
+ const hasMore = offset + limitedEntries.length < totalCount;
139
+ const remainingCount = totalCount - offset - limitedEntries.length;
140
+ // Get absolute paths
141
+ const sortedAbsolutePaths = limitedEntries.map((entry) => entry.fullpath());
142
+ const fileListDescription = sortedAbsolutePaths.join('\n');
143
+ const fileCount = sortedAbsolutePaths.length;
144
+ // Format result message with clear pagination guidance for the model
145
+ let resultMessage;
146
+ if (offset > 0 || hasMore) {
147
+ const rangeStart = offset + 1;
148
+ const rangeEnd = offset + fileCount;
149
+ resultMessage = `Found ${totalCount} file(s) matching "${params.pattern}" (showing ${rangeStart}-${rangeEnd}):\n${fileListDescription}`;
150
+ if (hasMore) {
151
+ const nextOffset = offset + fileCount;
152
+ resultMessage += `\n\n[TRUNCATED] ${remainingCount} more files available. To see next page, call Glob again with offset=${nextOffset}`;
153
+ }
154
+ }
155
+ else {
156
+ resultMessage = `Found ${fileCount} file(s) matching "${params.pattern}" within ${searchDirAbsolute}, sorted by modification time (newest first):\n${fileListDescription}`;
157
+ }
158
+ // Stream output if callback provided
159
+ if (updateOutput) {
160
+ updateOutput(`Found ${fileCount} matching file(s)`);
161
+ }
162
+ return this.createSuccessResult(resultMessage, {
163
+ executionTime: Date.now() - startTime,
164
+ fileCount,
165
+ totalCount,
166
+ offset,
167
+ hasMore,
168
+ nextOffset: hasMore ? offset + fileCount : undefined,
169
+ searchPath: searchDirAbsolute,
170
+ pattern: params.pattern,
171
+ });
172
+ }
173
+ catch (error) {
174
+ // Handle glob errors
175
+ if (error.name === 'AbortError') {
176
+ return this.createErrorResult('Glob search was aborted');
177
+ }
178
+ return this.createErrorResult(`Failed to perform glob search: ${error.message}`);
179
+ }
180
+ }
181
+ /**
182
+ * Sorts file entries based on recency and then alphabetically.
183
+ * Recent files (modified within 24 hours) are listed first, newest to oldest.
184
+ * Older files are listed after recent ones, sorted alphabetically by path.
185
+ * @private
186
+ */
187
+ sortFilesByRecency(entries) {
188
+ const nowTimestamp = Date.now();
189
+ const sortedEntries = [...entries];
190
+ sortedEntries.sort((a, b) => {
191
+ const mtimeA = a.mtimeMs ?? 0;
192
+ const mtimeB = b.mtimeMs ?? 0;
193
+ const aIsRecent = nowTimestamp - mtimeA < this.RECENCY_THRESHOLD_MS;
194
+ const bIsRecent = nowTimestamp - mtimeB < this.RECENCY_THRESHOLD_MS;
195
+ // Both are recent: sort by mtime (newest first)
196
+ if (aIsRecent && bIsRecent) {
197
+ return mtimeB - mtimeA;
198
+ }
199
+ // Only A is recent: A comes first
200
+ if (aIsRecent) {
201
+ return -1;
202
+ }
203
+ // Only B is recent: B comes first
204
+ if (bIsRecent) {
205
+ return 1;
206
+ }
207
+ // Both are old: sort alphabetically
208
+ return a.fullpath().localeCompare(b.fullpath());
209
+ });
210
+ return sortedEntries;
211
+ }
212
+ }
213
+ //# sourceMappingURL=GlobTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlobTool.js","sourceRoot":"","sources":["../../../src/implementations/search/GlobTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAmB,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EACL,YAAY,EACZ,WAAW,GACZ,MAAM,0BAA0B,CAAC;AA2ClC;;;;;;;;;GASG;AACH,MAAM,OAAO,QAAS,SAAQ,QAAoC;IAM5C;IALpB,8BAA8B;IACb,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5D,kDAAkD;IAC1C,MAAM,CAAU,mBAAmB,GAAG,GAAG,CAAC;IAElD,YAAoB,MAAsB;QACxC,KAAK,CACH,MAAM,EACN,WAAW,EACX,2QAA2Q,EAC3Q;YACE,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,uMAAuM;iBAC1M;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,yIAAyI;iBAC5I;gBACD,cAAc,EAAE;oBACd,IAAI,EAAE,SAAS;oBACf,WAAW,EACT,8FAA8F;iBACjG;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB,CACF,CAAC;QA1BgB,WAAM,GAAN,MAAM,CAAgB;IA2B1C,CAAC;I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AAC;QAEH,OAAO,aAAa,CAAC;IACvB,CAAC"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Enhanced Grep Tool Executor with Native Command Support
3
+ *
4
+ * Implements a 4-tier fallback strategy for optimal performance:
5
+ * 1. ripgrep (rg) - Fastest (0.5-1s)
6
+ * 2. git grep - ⚡ Fast (1-2s, git repos only)
7
+ * 3. system grep - Good (2-5s)
8
+ * 4. JavaScript fallback - Portable (5-10s)
9
+ *
10
+ * Gracefully falls back if native commands are not available.
11
+ */
12
+ import { BaseTool, type ToolResult } from '../../base/index.js';
13
+ import type { ExecutorConfig } from '../../base/ToolRegistry.js';
14
+ /**
15
+ * Parameters for the Grep tool
16
+ * Matches the tool definition in toolDefinitions.ts
17
+ */
18
+ export interface GrepToolParams {
19
+ pattern: string;
20
+ path?: string;
21
+ glob?: string;
22
+ output_mode?: 'content' | 'files_with_matches' | 'count';
23
+ '-A'?: number;
24
+ '-B'?: number;
25
+ '-C'?: number;
26
+ '-n'?: boolean;
27
+ '-i'?: boolean;
28
+ type?: string;
29
+ head_limit?: number;
30
+ offset?: number;
31
+ multiline?: boolean;
32
+ include?: string;
33
+ case_sensitive?: boolean;
34
+ }
35
+ /**
36
+ * Enhanced Grep Tool with Native Command Support
37
+ */
38
+ export declare class GrepTool extends BaseTool<GrepToolParams, ToolResult> {
39
+ private config;
40
+ private static readonly DEFAULT_MAX_RESULTS;
41
+ private static readonly HARD_MAX_RESULTS;
42
+ private static readonly MAX_CONTENT_LENGTH;
43
+ private static readonly MAX_SEARCHABLE_FILE_BYTES;
44
+ constructor(config: ExecutorConfig);
45
+ validateToolParams(params: GrepToolParams): string | null;
46
+ getDescription(params: GrepToolParams): string;
47
+ execute(params: GrepToolParams, signal: AbortSignal, updateOutput?: (output: string) => void): Promise<ToolResult>;
48
+ /**
49
+ * Performs grep search using best available strategy
50
+ *
51
+ * @param pattern - Regex pattern to search for
52
+ * @param absolutePath - Directory to search in
53
+ * @param include - Glob pattern for file filtering
54
+ * @param caseSensitive - Whether search is case-sensitive
55
+ * @param signal - Abort signal for cancellation
56
+ * @param targetFile - Optional: specific filename to search (single-file mode)
57
+ * @param fileType - Optional: file type filter (rg --type)
58
+ * @param multiline - Optional: enable multiline matching
59
+ * @param contextAfter - Optional: lines after match (-A)
60
+ * @param contextBefore - Optional: lines before match (-B)
61
+ * @param contextBoth - Optional: lines of context (-C)
62
+ * @param maxResults - Optional: maximum results (enables -m flag for ripgrep)
63
+ */
64
+ private performGrepSearch;
65
+ /**
66
+ * Strategy 1: Search with ripgrep (rg)
67
+ */
68
+ private searchWithRipgrep;
69
+ /**
70
+ * Strategy 2: Search with git grep
71
+ */
72
+ private searchWithGitGrep;
73
+ /**
74
+ * Strategy 3: Search with system grep
75
+ */
76
+ private searchWithSystemGrep;
77
+ /**
78
+ * Strategy 4: Pure JavaScript fallback
79
+ */
80
+ private searchWithJavaScript;
81
+ /**
82
+ * Executes a command and returns stdout
83
+ * Supports abort signal for ESC key cancellation and timeout for runaway processes
84
+ */
85
+ private executeCommand;
86
+ /**
87
+ * Checks if a command is available
88
+ */
89
+ private isCommandAvailable;
90
+ /**
91
+ * Parses grep-style output including context lines from -A/-B/-C flags.
92
+ * Match lines use colons: file:line:content
93
+ * Context lines use dashes: file-line-content
94
+ * Group separators: --
95
+ */
96
+ private parseGrepOutput;
97
+ /**
98
+ * Groups matches by file and sorts by line number
99
+ */
100
+ private groupMatchesByFile;
101
+ }
102
+ //# sourceMappingURL=GrepTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GrepTool.d.ts","sourceRoot":"","sources":["../../../src/implementations/search/GrepTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAOhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAA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