@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,252 @@
1
+ import { BaseTool } from '../../base/BaseTool.js';
2
+ import { CreateArtifactToolExecutor } from './CreateArtifactTool.js';
3
+ import { visualBridge } from './VisualFeedbackBridge.js';
4
+ import { promises as fs } from 'fs';
5
+ import { join } from 'path';
6
+ /**
7
+ * StopSandboxTool - Stop a running sandbox and optionally cleanup
8
+ *
9
+ * This tool stops the sandbox process and cleans up resources:
10
+ * - Kills the running Node.js/Python process
11
+ * - Closes file watchers (hot reload)
12
+ * - Optionally captures final snapshot
13
+ * - Optionally deletes sandbox directory
14
+ * - Closes Playwright browser if no other sandboxes need it
15
+ *
16
+ * Use Cases:
17
+ * 1. Finished development - Stop sandbox when done
18
+ * 2. Free resources - Stop unused sandboxes
19
+ * 3. Clean slate - Stop and cleanup for fresh start
20
+ * 4. Error recovery - Stop crashed sandbox
21
+ *
22
+ * Example:
23
+ * ```typescript
24
+ * // Model finishes work
25
+ * await stopSandbox({
26
+ * sandboxId: "abc-123",
27
+ * cleanup: true, // Delete sandbox directory
28
+ * captureFinalSnapshot: true // Save final state
29
+ * });
30
+ * ```
31
+ */
32
+ export class StopSandboxExecutor extends BaseTool {
33
+ sandboxDir;
34
+ constructor(config) {
35
+ const schema = {
36
+ type: 'object',
37
+ properties: {
38
+ sandboxId: {
39
+ type: 'string',
40
+ description: 'Unique ID of the sandbox to stop'
41
+ },
42
+ cleanup: {
43
+ type: 'boolean',
44
+ description: 'Delete sandbox directory after stopping (default: false)'
45
+ },
46
+ captureFinalSnapshot: {
47
+ type: 'boolean',
48
+ description: 'Capture final visual snapshot before stopping (default: false)'
49
+ }
50
+ },
51
+ required: ['sandboxId']
52
+ };
53
+ super('StopSandbox', 'StopSandbox', 'Stop a running sandbox and optionally cleanup resources', schema);
54
+ this.sandboxDir = join(config.workingDirectory, '.addon-tools');
55
+ }
56
+ validateToolParams(params) {
57
+ if (!params.sandboxId || params.sandboxId.trim().length === 0) {
58
+ return 'sandboxId is required';
59
+ }
60
+ if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(params.sandboxId)) {
61
+ return 'sandboxId must be a valid UUID';
62
+ }
63
+ return null;
64
+ }
65
+ async execute(params, signal) {
66
+ const startTime = Date.now();
67
+ const validationError = this.validateToolParams(params);
68
+ if (validationError) {
69
+ return this.createErrorResult(validationError);
70
+ }
71
+ try {
72
+ // Get sandbox session
73
+ const session = CreateArtifactToolExecutor.getActiveSandbox(params.sandboxId);
74
+ if (!session) {
75
+ return this.createErrorResult(`Sandbox not found: ${params.sandboxId}. It may already be stopped.`);
76
+ }
77
+ // Capture final snapshot if requested
78
+ let finalSnapshot = null;
79
+ if (params.captureFinalSnapshot && session.url) {
80
+ try {
81
+ await visualBridge.initialize();
82
+ finalSnapshot = await visualBridge.captureSnapshot(session.url);
83
+ }
84
+ catch (error) {
85
+ console.warn('Could not capture final snapshot:', error);
86
+ }
87
+ }
88
+ // Collect session info before stopping
89
+ const sessionInfo = {
90
+ id: session.id,
91
+ name: session.name,
92
+ url: session.url,
93
+ port: session.port,
94
+ mode: session.mode,
95
+ uptime: Date.now() - session.startTime.getTime(),
96
+ startTime: session.startTime,
97
+ lastActivity: session.lastActivity
98
+ };
99
+ // Stop the sandbox (kills process, closes watchers)
100
+ const stopped = CreateArtifactToolExecutor.stopSandbox(params.sandboxId);
101
+ if (!stopped) {
102
+ return this.createErrorResult('Failed to stop sandbox (unknown reason)');
103
+ }
104
+ // Cleanup sandbox directory if requested
105
+ let cleanedUp = false;
106
+ let bytesFreed = 0;
107
+ if (params.cleanup) {
108
+ const sandboxPath = join(this.sandboxDir, params.sandboxId);
109
+ try {
110
+ // Calculate size before deletion
111
+ const files = await this.getDirectorySize(sandboxPath);
112
+ bytesFreed = files.totalSize;
113
+ // Delete directory
114
+ await fs.rm(sandboxPath, { recursive: true, force: true });
115
+ cleanedUp = true;
116
+ }
117
+ catch (error) {
118
+ console.warn(`Could not cleanup sandbox directory: ${error}`);
119
+ // Don't fail the whole operation if cleanup fails
120
+ }
121
+ }
122
+ // Check if we should close Playwright browser
123
+ const activeSandboxes = CreateArtifactToolExecutor.listActiveSandboxes();
124
+ if (activeSandboxes.length === 0) {
125
+ // No more sandboxes, close browser to free memory
126
+ try {
127
+ await visualBridge.close();
128
+ }
129
+ catch (error) {
130
+ console.warn('Could not close browser:', error);
131
+ }
132
+ }
133
+ // Format output
134
+ const output = this.formatStopOutput(sessionInfo, finalSnapshot, cleanedUp, bytesFreed);
135
+ return {
136
+ ...this.createSuccessResult(output),
137
+ metadata: {
138
+ executionTime: Date.now() - startTime,
139
+ sandboxId: params.sandboxId,
140
+ sandboxName: sessionInfo.name,
141
+ uptime: sessionInfo.uptime,
142
+ stopped: true,
143
+ cleanedUp,
144
+ bytesFreed,
145
+ hasFinalSnapshot: !!finalSnapshot
146
+ }
147
+ };
148
+ }
149
+ catch (error) {
150
+ return this.createErrorResult(`Failed to stop sandbox: ${error.message}`);
151
+ }
152
+ }
153
+ /**
154
+ * Calculate directory size recursively
155
+ */
156
+ async getDirectorySize(dirPath) {
157
+ let totalSize = 0;
158
+ let fileCount = 0;
159
+ try {
160
+ const entries = await fs.readdir(dirPath, { withFileTypes: true });
161
+ for (const entry of entries) {
162
+ const fullPath = join(dirPath, entry.name);
163
+ if (entry.isDirectory()) {
164
+ const subDir = await this.getDirectorySize(fullPath);
165
+ totalSize += subDir.totalSize;
166
+ fileCount += subDir.fileCount;
167
+ }
168
+ else {
169
+ const stats = await fs.stat(fullPath);
170
+ totalSize += stats.size;
171
+ fileCount++;
172
+ }
173
+ }
174
+ }
175
+ catch (error) {
176
+ console.warn(`Error calculating directory size: ${error}`);
177
+ }
178
+ return { totalSize, fileCount };
179
+ }
180
+ /**
181
+ * Format human-readable file size
182
+ */
183
+ formatBytes(bytes) {
184
+ if (bytes === 0)
185
+ return '0 Bytes';
186
+ const k = 1024;
187
+ const sizes = ['Bytes', 'KB', 'MB', 'GB'];
188
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
189
+ return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + ' ' + sizes[i];
190
+ }
191
+ /**
192
+ * Format uptime in human-readable format
193
+ */
194
+ formatUptime(ms) {
195
+ const seconds = Math.floor(ms / 1000);
196
+ const minutes = Math.floor(seconds / 60);
197
+ const hours = Math.floor(minutes / 60);
198
+ if (hours > 0) {
199
+ return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
200
+ }
201
+ else if (minutes > 0) {
202
+ return `${minutes}m ${seconds % 60}s`;
203
+ }
204
+ else {
205
+ return `${seconds}s`;
206
+ }
207
+ }
208
+ /**
209
+ * Format stop output for model consumption
210
+ */
211
+ formatStopOutput(sessionInfo, finalSnapshot, cleanedUp, bytesFreed) {
212
+ const lines = [];
213
+ lines.push(`# Sandbox Stopped: ${sessionInfo.name}`);
214
+ lines.push('');
215
+ lines.push(`**Sandbox ID**: ${sessionInfo.id}`);
216
+ lines.push(`**Status**: Stopped`);
217
+ lines.push(`**Total Uptime**: ${this.formatUptime(sessionInfo.uptime)}`);
218
+ lines.push(`**Started**: ${sessionInfo.startTime.toISOString()}`);
219
+ lines.push(`**Last Activity**: ${sessionInfo.lastActivity.toISOString()}`);
220
+ lines.push('');
221
+ if (finalSnapshot) {
222
+ lines.push('---');
223
+ lines.push('');
224
+ lines.push('## Final Snapshot');
225
+ lines.push('');
226
+ lines.push(visualBridge.formatForModel(finalSnapshot));
227
+ lines.push('');
228
+ }
229
+ if (cleanedUp) {
230
+ lines.push('---');
231
+ lines.push('');
232
+ lines.push('## Cleanup');
233
+ lines.push('');
234
+ lines.push(`[OK] Sandbox directory deleted`);
235
+ lines.push(`[OK] Disk space freed: ${this.formatBytes(bytesFreed)}`);
236
+ lines.push('');
237
+ }
238
+ lines.push('---');
239
+ lines.push('');
240
+ lines.push('**Summary**:');
241
+ lines.push('- [OK] Process terminated');
242
+ lines.push('- [OK] File watchers closed');
243
+ lines.push('- [OK] Resources freed');
244
+ if (cleanedUp) {
245
+ lines.push('- [OK] Files cleaned up');
246
+ }
247
+ lines.push('');
248
+ lines.push('The sandbox is now fully stopped and removed from active sessions.');
249
+ return lines.join('\n');
250
+ }
251
+ }
252
+ //# sourceMappingURL=StopSandboxTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StopSandboxTool.js","sourceRoot":"","sources":["../../../src/implementations/addon/StopSandboxTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAW5B;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,mBAAoB,SAAQ,QAAuC;IACtE,UAAU,CAAS;IAE3B,YAAY,MAAoC;QAC9C,MAAM,MAAM,GAAG;YACb,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,SAAS,EAAE;oBACT,IAAI,EAAE,QAAiB;oBACvB,WAAW,EAAE,kCAAkC;iBAChD;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,SAAkB;oBACxB,WAAW,EAAE,0DAA0D;iBACxE;gBACD,oBAAoB,EAAE;oBACpB,IAAI,EAAE,SAAkB;oBACxB,WAAW,EAAE,gEAAgE;iBAC9E;aACF;YACD,QAAQ,EAAE,CAAC,WAAoB,CAAC;SACjC,CAAC;QAEF,KAAK,CACH,aAAa,EACb,aAAa,EACb,yDAAy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AC,CAAC;QACxC,KAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QACrC,IAAI,SAAS,EAAE,CAAC;YACd,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;QACxC,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEf,KAAK,CAAC,IAAI,CAAC,oEAAoE,CAAC,CAAC;QAEjF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Terminal Sandbox
3
+ *
4
+ * Provides visual terminal emulation using xterm.js
5
+ * Allows model to see and interact with shell sessions
6
+ *
7
+ * Features:
8
+ * - Visual terminal display (xterm.js in browser)
9
+ * - Full PTY support (bash, zsh, etc.)
10
+ * - Screenshot capture of terminal output
11
+ * - Direct typing/command execution
12
+ * - WebSocket communication
13
+ */
14
+ export interface TerminalConfig {
15
+ shell?: string;
16
+ cwd?: string;
17
+ env?: Record<string, string>;
18
+ headed?: boolean;
19
+ rows?: number;
20
+ cols?: number;
21
+ executablePath?: string;
22
+ }
23
+ export interface TerminalSnapshot {
24
+ screenshot: string;
25
+ output: string;
26
+ cwd: string;
27
+ timestamp: number;
28
+ }
29
+ /**
30
+ * TerminalSandbox - Visual terminal emulation
31
+ *
32
+ * Combines:
33
+ * - PTY process (actual shell)
34
+ * - xterm.js (visual display in browser)
35
+ * - Playwright (browser automation for screenshots)
36
+ * - WebSocket (real-time communication)
37
+ */
38
+ export declare class TerminalSandbox {
39
+ private shell;
40
+ private browser;
41
+ private page;
42
+ private server;
43
+ private wss;
44
+ private terminalUrl;
45
+ private output;
46
+ private config;
47
+ private wsPort;
48
+ constructor(config?: TerminalConfig);
49
+ /**
50
+ * Initialize terminal sandbox
51
+ * 1. Start shell process (PTY)
52
+ * 2. Start WebSocket server for communication
53
+ * 3. Launch browser with xterm.js client
54
+ */
55
+ initialize(): Promise<void>;
56
+ /**
57
+ * Start shell process (PTY emulation)
58
+ */
59
+ private startShell;
60
+ /**
61
+ * Start WebSocket server for terminal I/O
62
+ */
63
+ private startWebSocketServer;
64
+ /**
65
+ * Broadcast output to all connected WebSocket clients
66
+ */
67
+ private broadcastToClients;
68
+ /**
69
+ * Start browser to display terminal
70
+ */
71
+ private startBrowser;
72
+ /**
73
+ * Type command into terminal
74
+ * @param text Text to type
75
+ */
76
+ type(text: string): Promise<void>;
77
+ /**
78
+ * Execute command in terminal
79
+ * @param command Command to execute
80
+ */
81
+ executeCommand(command: string): Promise<void>;
82
+ /**
83
+ * Get screenshot of terminal
84
+ */
85
+ getScreenshot(): Promise<Buffer>;
86
+ /**
87
+ * Capture current terminal state
88
+ */
89
+ captureSnapshot(): Promise<TerminalSnapshot>;
90
+ /**
91
+ * Clear terminal output
92
+ */
93
+ clear(): Promise<void>;
94
+ /**
95
+ * Get current output
96
+ */
97
+ getOutput(): string;
98
+ /**
99
+ * Cleanup resources
100
+ */
101
+ close(): Promise<void>;
102
+ /**
103
+ * Get inline terminal HTML client (fallback if file doesn't exist)
104
+ */
105
+ private getInlineTerminalHTML;
106
+ }
107
+ /**
108
+ * Singleton instance for convenience
109
+ */
110
+ export declare const terminalSandbox: TerminalSandbox;
111
+ //# sourceMappingURL=TerminalSandbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TerminalSandbox.d.ts","sourceRoot":"","sources":["../../../src/implementations/addon/TerminalSandbox.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAeH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,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