@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,315 @@
1
+ /**
2
+ * Split-Tool Todo Executors — TodoCreate, TodoUpdate, TodoList
3
+ *
4
+ * Three targeted tools matching the TaskCreate/TaskUpdate/TaskList.
5
+ * Key design decisions:
6
+ * - TodoCreate/TodoUpdate return ONLY the affected task (compact output)
7
+ * - TodoList returns the full list (use it when you need the overview)
8
+ * - TodoUpdate accepts multiple taskIds for batch status changes
9
+ * - Shared in-memory state via module-level Map
10
+ */
11
+ import { BaseTool } from '../../base/index.js';
12
+ // ── Shared State ─────────────────────────────────────────────────────────────
13
+ const todos = new Map();
14
+ let nextId = 1;
15
+ /** Reset state (for testing) */
16
+ export function resetTodoState() {
17
+ todos.clear();
18
+ nextId = 1;
19
+ }
20
+ /** Get current todos (for SystemReminderInjector) */
21
+ export function getCurrentTodos() {
22
+ return Array.from(todos.values()).sort((a, b) => parseInt(a.id) - parseInt(b.id));
23
+ }
24
+ // ── Helpers ──────────────────────────────────────────────────────────────────
25
+ const STATUS_ICON = {
26
+ pending: '○',
27
+ in_progress: '▶',
28
+ completed: '✓',
29
+ };
30
+ function formatTask(t) {
31
+ const icon = STATUS_ICON[t.status] ?? '?';
32
+ let line = `${icon} #${t.id} [${t.status}] ${t.content}`;
33
+ if (t.description)
34
+ line += `\n ${t.description}`;
35
+ return line;
36
+ }
37
+ function formatSummary() {
38
+ const sorted = getCurrentTodos();
39
+ const pending = sorted.filter((t) => t.status === 'pending').length;
40
+ const inProgress = sorted.filter((t) => t.status === 'in_progress').length;
41
+ const completed = sorted.filter((t) => t.status === 'completed').length;
42
+ return `${completed}/${todos.size} completed, ${inProgress} in progress, ${pending} pending`;
43
+ }
44
+ function formatTodoList() {
45
+ if (todos.size === 0)
46
+ return 'No tasks.';
47
+ const sorted = getCurrentTodos();
48
+ const lines = sorted.map(formatTask);
49
+ lines.push('');
50
+ lines.push(`Summary: ${formatSummary()}`);
51
+ return lines.join('\n');
52
+ }
53
+ function cleanTaskId(raw) {
54
+ // Strip prefixes models commonly add: "#1" → "1"
55
+ return raw.replace(/^#/, '');
56
+ }
57
+ export class TodoCreateTool extends BaseTool {
58
+ constructor(config) {
59
+ super('TodoCreate', 'TodoCreate', `Create a task for tracking multi-step work. Call once per task. All start as pending.
60
+
61
+ For each task you create, follow this lifecycle:
62
+ TodoUpdate(taskId, status="in_progress") -> do the work -> TodoUpdate(taskId, status="completed")
63
+
64
+ WHEN TO USE: Tasks with 3+ steps. SKIP FOR: trivial single-step tasks.`, {
65
+ type: 'object',
66
+ properties: {
67
+ content: {
68
+ type: 'string',
69
+ description: 'Brief task title in imperative form (e.g., "Fix authentication bug")',
70
+ },
71
+ description: {
72
+ type: 'string',
73
+ description: 'Detailed description of what needs to be done',
74
+ },
75
+ activeForm: {
76
+ type: 'string',
77
+ description: 'Present continuous form shown while in progress (e.g., "Fixing authentication bug")',
78
+ },
79
+ },
80
+ required: ['content'],
81
+ });
82
+ }
83
+ validateToolParams(params) {
84
+ if (!params.content || !params.content.trim()) {
85
+ return 'content is required';
86
+ }
87
+ return null;
88
+ }
89
+ getDescription(params) {
90
+ return `Creating task: ${params.content}`;
91
+ }
92
+ async execute(params, signal) {
93
+ const startTime = Date.now();
94
+ if (signal.aborted) {
95
+ return {
96
+ ...this.createErrorResult('Cancelled'),
97
+ metadata: { executionTime: Date.now() - startTime },
98
+ };
99
+ }
100
+ const validationError = this.validateToolParams(params);
101
+ if (validationError) {
102
+ return {
103
+ ...this.createErrorResult(validationError),
104
+ metadata: { executionTime: Date.now() - startTime },
105
+ };
106
+ }
107
+ const id = String(nextId++);
108
+ const now = Date.now();
109
+ const item = {
110
+ id,
111
+ content: params.content.trim(),
112
+ description: params.description?.trim() ?? '',
113
+ activeForm: params.activeForm?.trim() ?? params.content.trim(),
114
+ status: 'pending',
115
+ createdAt: now,
116
+ updatedAt: now,
117
+ };
118
+ todos.set(id, item);
119
+ // Compact output: just the created task + summary line
120
+ const output = `Created task #${id}: ${item.content} [pending]\n${formatSummary()}`;
121
+ return {
122
+ ...this.createSuccessResult(output),
123
+ metadata: {
124
+ executionTime: Date.now() - startTime,
125
+ taskId: id,
126
+ todoCount: todos.size,
127
+ },
128
+ };
129
+ }
130
+ }
131
+ export class TodoUpdateTool extends BaseTool {
132
+ constructor(config) {
133
+ super('TodoUpdate', 'TodoUpdate', `Update task status or details by ID.
134
+
135
+ LIFECYCLE — follow for every task:
136
+ TodoUpdate(taskId, status="in_progress") <- before starting work
137
+ TodoUpdate(taskId, status="completed") <- after finishing work
138
+
139
+ Supports batch: pass comma-separated IDs (e.g., taskId="1,2,3") to update multiple tasks at once.
140
+ Task IDs are plain numbers (e.g., "1", "2"). Do not include "#".`, {
141
+ type: 'object',
142
+ properties: {
143
+ taskId: {
144
+ type: 'string',
145
+ description: 'Task ID(s) to update. Single: "1". Batch: "1,2,3".',
146
+ },
147
+ status: {
148
+ type: 'string',
149
+ enum: ['pending', 'in_progress', 'completed'],
150
+ description: 'New status for the task(s)',
151
+ },
152
+ content: {
153
+ type: 'string',
154
+ description: 'New task title (single task only)',
155
+ },
156
+ description: {
157
+ type: 'string',
158
+ description: 'New description (single task only)',
159
+ },
160
+ activeForm: {
161
+ type: 'string',
162
+ description: 'New active form (single task only)',
163
+ },
164
+ },
165
+ required: ['taskId'],
166
+ });
167
+ }
168
+ validateToolParams(params) {
169
+ if (!params.taskId) {
170
+ return 'taskId is required';
171
+ }
172
+ if (params.status &&
173
+ !['pending', 'in_progress', 'completed'].includes(params.status)) {
174
+ return `Invalid status: ${params.status}. Must be pending, in_progress, or completed.`;
175
+ }
176
+ return null;
177
+ }
178
+ getDescription(params) {
179
+ if (params.status) {
180
+ return `Updating task #${params.taskId} -> ${params.status}`;
181
+ }
182
+ return `Updating task #${params.taskId}`;
183
+ }
184
+ async execute(params, signal) {
185
+ const startTime = Date.now();
186
+ if (signal.aborted) {
187
+ return {
188
+ ...this.createErrorResult('Cancelled'),
189
+ metadata: { executionTime: Date.now() - startTime },
190
+ };
191
+ }
192
+ const validationError = this.validateToolParams(params);
193
+ if (validationError) {
194
+ return {
195
+ ...this.createErrorResult(validationError),
196
+ metadata: { executionTime: Date.now() - startTime },
197
+ };
198
+ }
199
+ // Parse batch IDs: "1,2,3" or "#1, #2" or just "1"
200
+ const rawIds = params.taskId.split(',').map((s) => cleanTaskId(s.trim()));
201
+ const ids = rawIds.filter((id) => id.length > 0);
202
+ if (ids.length === 0) {
203
+ return {
204
+ ...this.createErrorResult('No valid task IDs provided.'),
205
+ metadata: { executionTime: Date.now() - startTime },
206
+ };
207
+ }
208
+ // Batch mode: only status updates
209
+ if (ids.length > 1) {
210
+ if (!params.status) {
211
+ return {
212
+ ...this.createErrorResult('Batch update requires a status. Provide status to update multiple tasks.'),
213
+ metadata: { executionTime: Date.now() - startTime },
214
+ };
215
+ }
216
+ const results = [];
217
+ const notFound = [];
218
+ for (const id of ids) {
219
+ const item = todos.get(id);
220
+ if (!item) {
221
+ notFound.push(id);
222
+ continue;
223
+ }
224
+ item.status = params.status;
225
+ item.updatedAt = Date.now();
226
+ results.push(`#${id}: ${item.content} -> ${params.status}`);
227
+ }
228
+ let output = `Updated ${results.length} task(s): ${params.status}`;
229
+ if (notFound.length > 0) {
230
+ output += `\nNot found: ${notFound.map((id) => '#' + id).join(', ')}`;
231
+ }
232
+ output += `\n${formatSummary()}`;
233
+ return {
234
+ ...this.createSuccessResult(output),
235
+ metadata: {
236
+ executionTime: Date.now() - startTime,
237
+ updatedCount: results.length,
238
+ todoCount: todos.size,
239
+ },
240
+ };
241
+ }
242
+ // Single task update
243
+ const taskId = ids[0];
244
+ const item = todos.get(taskId);
245
+ if (!item) {
246
+ return {
247
+ ...this.createErrorResult(`Task #${taskId} not found. Use TodoList to see all tasks.`),
248
+ metadata: { executionTime: Date.now() - startTime },
249
+ };
250
+ }
251
+ // Warn (don't reject) if setting multiple in_progress
252
+ let warning = '';
253
+ if (params.status === 'in_progress') {
254
+ const currentInProgress = Array.from(todos.values()).filter((t) => t.status === 'in_progress' && t.id !== taskId);
255
+ if (currentInProgress.length > 0) {
256
+ warning = ` (note: #${currentInProgress[0].id} also in_progress)`;
257
+ }
258
+ }
259
+ // Apply updates
260
+ if (params.status)
261
+ item.status = params.status;
262
+ if (params.content)
263
+ item.content = params.content.trim();
264
+ if (params.description !== undefined)
265
+ item.description = params.description.trim();
266
+ if (params.activeForm)
267
+ item.activeForm = params.activeForm.trim();
268
+ item.updatedAt = Date.now();
269
+ // Compact output: just the affected task + summary
270
+ const output = `${formatTask(item)}${warning}\n${formatSummary()}`;
271
+ return {
272
+ ...this.createSuccessResult(output),
273
+ metadata: {
274
+ executionTime: Date.now() - startTime,
275
+ taskId: item.id,
276
+ todoCount: todos.size,
277
+ },
278
+ };
279
+ }
280
+ }
281
+ export class TodoListTool extends BaseTool {
282
+ constructor(config) {
283
+ super('TodoList', 'TodoList', `List all tasks with their current status, IDs, and progress summary.`, {
284
+ type: 'object',
285
+ properties: {},
286
+ required: [],
287
+ });
288
+ }
289
+ validateToolParams(_params) {
290
+ return null;
291
+ }
292
+ getDescription(_params) {
293
+ return 'Listing tasks';
294
+ }
295
+ async execute(_params, signal) {
296
+ const startTime = Date.now();
297
+ if (signal.aborted) {
298
+ return {
299
+ ...this.createErrorResult('Cancelled'),
300
+ metadata: { executionTime: Date.now() - startTime },
301
+ };
302
+ }
303
+ return {
304
+ ...this.createSuccessResult(formatTodoList()),
305
+ metadata: {
306
+ executionTime: Date.now() - startTime,
307
+ todoCount: todos.size,
308
+ pendingCount: Array.from(todos.values()).filter((t) => t.status === 'pending').length,
309
+ inProgressCount: Array.from(todos.values()).filter((t) => t.status === 'in_progress').length,
310
+ completedCount: Array.from(todos.values()).filter((t) => t.status === 'completed').length,
311
+ },
312
+ };
313
+ }
314
+ }
315
+ //# sourceMappingURL=TodoWriteTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TodoWriteTool.js","sourceRoot":"","sources":["../../../src/implementations/ui/TodoWriteTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAmB,MAAM,qBAAqB,CAAC;AAiBhE,gFAAgF;AAEhF,MAAM,KAAK,GAAG,IAAI,GAAG,EAAoB,CAAC;AAC1C,IAAI,MAAM,GAAG,CAAC,CAAC;AAEf,gCAAgC;AAChC,MAAM,UAAU,cAAc;IAC5B,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,MAAM,GAAG,CAAC,CAAC;AACb,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CACpC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAC1C,CAAC;AACJ,CAAC;AAED,gFAAgF;AAEhF,MAAM,WAAW,GAA2B;IAC1C,OAAO,EAAE,GAAG;IACZ,WAAW,EAAE,GAAG;IAChB,SAAS,EAAE,GAAG;CACf,CAAC;AAEF,SAAS,UAAU,CAAC,CAAW;IAC7B,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,CAAC;IAC1C,IAAI,IAAI,GAAG,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IACzD,IAAI,CAAC,CAAC,WAAW;QAAE,IAAI,IAAI,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;IACpD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,aAAa;IACpB,MAAM,MAAM,GAAG,e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CAAC,MAAM,CAC/C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,WAAW,CAChC,CAAC,MAAM;aACT;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * UI/Planning Tool Implementations
3
+ *
4
+ * Tools for user interaction and task management
5
+ */
6
+ export * from './TodoWriteTool.js';
7
+ export * from './AskUserQuestionTool.js';
8
+ export * from './ExitPlanModeTool.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/implementations/ui/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * UI/Planning Tool Implementations
3
+ *
4
+ * Tools for user interaction and task management
5
+ */
6
+ export * from './TodoWriteTool.js'; // Now exports TodoCreateTool, TodoUpdateTool, TodoListTool
7
+ export * from './AskUserQuestionTool.js';
8
+ export * from './ExitPlanModeTool.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/implementations/ui/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,oBAAoB,CAAC,CAAE,2DAA2D;AAChG,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Browse Tool — dispatches a nexus-browser subagent.
3
+ *
4
+ * Rationale: nexus-browser exposes 43 MCP tools (~12.5K input tokens). Injecting
5
+ * them into every request bloats the parent's context for sessions that never
6
+ * browse. Instead, `Browse` is a single small entry tool on the parent. When
7
+ * invoked, it spawns a subagent that — and only that — gets MCP_AUTO_INJECT
8
+ * enabled, picks up the full nexus-browser surface, completes the task, and
9
+ * returns a concise result to the parent.
10
+ *
11
+ * The parent's tool/context surface never grows. The subagent runs in its own
12
+ * forked process and its context window doesn't share with the parent.
13
+ *
14
+ * OSS boundary: nexus-browser is still reached only via MCP protocol with
15
+ * auth gating. The subagent uses the same MCP client + API key validation as
16
+ * any other MCP consumer; this tool just controls _when_ those tools are
17
+ * exposed (subagent-scoped, not parent-scoped).
18
+ */
19
+ import { BaseTool } from '../../base/BaseTool.js';
20
+ import type { ToolResult } from '../../base/ToolResult.js';
21
+ /**
22
+ * Build a ToolResult that hands off to the orchestrator's subagent
23
+ * dispatcher, configured for the browse-agent + nexus-browser MCP.
24
+ *
25
+ * Exported so WebSearchTool/WebFetchTool can reuse it for `mode: 'interactive'`
26
+ * without duplicating the dispatch contract.
27
+ */
28
+ export declare function buildBrowseSubagentDispatch(taskPrompt: string, startingUrl: string | undefined, llmDisplay: string, startTime?: number): ToolResult;
29
+ export interface BrowseParams {
30
+ /** What the subagent should accomplish (e.g. "extract the top-5 stories from HN front page"). */
31
+ task: string;
32
+ /** Optional starting URL the subagent should browse to first. */
33
+ url?: string;
34
+ /** Optional model override (e.g. "sonnet"). Defaults to parent's current model. */
35
+ model?: string;
36
+ }
37
+ export declare class BrowseTool extends BaseTool<BrowseParams, ToolResult> {
38
+ constructor();
39
+ validateToolParams(params: BrowseParams): string | null;
40
+ getDescription(params: BrowseParams): string;
41
+ execute(params: BrowseParams): Promise<ToolResult>;
42
+ }
43
+ //# sourceMappingURL=BrowseTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrowseTool.d.ts","sourceRoot":"","sources":["../../../src/implementations/web/BrowseTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,GACjB,UAAU,CAgBZ;AAED,MAAM,WAAW,YAAY;IAC3B,iGAAiG;IACjG,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAgED,qBAAa,UAAW,SAAQ,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;;IAuChE,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI;IAwBvD,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM;IAKtC,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC;CAwBzD"}
@@ -0,0 +1,181 @@
1
+ /**
2
+ * Browse Tool — dispatches a nexus-browser subagent.
3
+ *
4
+ * Rationale: nexus-browser exposes 43 MCP tools (~12.5K input tokens). Injecting
5
+ * them into every request bloats the parent's context for sessions that never
6
+ * browse. Instead, `Browse` is a single small entry tool on the parent. When
7
+ * invoked, it spawns a subagent that — and only that — gets MCP_AUTO_INJECT
8
+ * enabled, picks up the full nexus-browser surface, completes the task, and
9
+ * returns a concise result to the parent.
10
+ *
11
+ * The parent's tool/context surface never grows. The subagent runs in its own
12
+ * forked process and its context window doesn't share with the parent.
13
+ *
14
+ * OSS boundary: nexus-browser is still reached only via MCP protocol with
15
+ * auth gating. The subagent uses the same MCP client + API key validation as
16
+ * any other MCP consumer; this tool just controls _when_ those tools are
17
+ * exposed (subagent-scoped, not parent-scoped).
18
+ */
19
+ import { BaseTool } from '../../base/BaseTool.js';
20
+ /**
21
+ * Build a ToolResult that hands off to the orchestrator's subagent
22
+ * dispatcher, configured for the browse-agent + nexus-browser MCP.
23
+ *
24
+ * Exported so WebSearchTool/WebFetchTool can reuse it for `mode: 'interactive'`
25
+ * without duplicating the dispatch contract.
26
+ */
27
+ export function buildBrowseSubagentDispatch(taskPrompt, startingUrl, llmDisplay, startTime) {
28
+ const fullPrompt = startingUrl ? `Start at: ${startingUrl}\n\n${taskPrompt}` : taskPrompt;
29
+ return {
30
+ llmContent: llmDisplay,
31
+ returnDisplay: llmDisplay,
32
+ success: true,
33
+ metadata: {
34
+ agentDefinition: INLINE_BROWSE_AGENT,
35
+ agentName: INLINE_BROWSE_AGENT.name,
36
+ taskPrompt: fullPrompt,
37
+ shouldSpawnSubAgent: true,
38
+ envOverrides: { MCP_AUTO_INJECT: 'true' },
39
+ description: llmDisplay.slice(0, 200),
40
+ ...(startTime !== undefined ? { executionTime: Date.now() - startTime } : {}),
41
+ },
42
+ };
43
+ }
44
+ /**
45
+ * Inline agent definition used when no `.cortex/agents/browse-agent.md`
46
+ * override is present on disk. Users can drop a file with the same name to
47
+ * customize the system prompt or tool whitelist; the lookup happens through
48
+ * AgentStore at dispatch time.
49
+ *
50
+ * Tool whitelist intentionally omits filesystem writers so the subagent can't
51
+ * be coerced into writing to the parent's workspace. Read tools stay so the
52
+ * subagent can save scraped content as artifacts via CreateArtifactTool.
53
+ */
54
+ const INLINE_BROWSE_AGENT = {
55
+ name: 'browse-agent',
56
+ description: 'Headless-browser subagent — drives nexus-browser MCP tools to complete a web task.',
57
+ systemPrompt: `You are a browser automation subagent. You have access to the nexus-browser MCP server,
58
+ which provides a full headless Chrome controlled through ~43 tools (browse, scan, click, type,
59
+ fill_form, extract_table, screenshot, etc.).
60
+
61
+ ## How to work
62
+
63
+ 1. Read the task carefully. Identify the success criterion — what result the parent agent needs back.
64
+ 2. Open the starting URL (if provided) with \`nexus-browser__browse\`. Otherwise pick a starting page yourself.
65
+ 3. Use the Scan → Act → Scan loop:
66
+ - \`nexus-browser__scan({ filter: { isInteractive: true } })\` to find elements with CSS selectors
67
+ - \`nexus-browser__click\` / \`nexus-browser__type\` / \`nexus-browser__select\` using the returned cssSelector
68
+ - \`nexus-browser__scan\` again to verify
69
+ 4. To read text from the page prefer \`nexus-browser__grab\` (cheap) over \`nexus-browser__screenshot\` (expensive).
70
+ 5. For lists / structured data use \`nexus-browser__extract_table\`, \`nexus-browser__extract_links\`,
71
+ or \`nexus-browser__scroll_and_collect\`.
72
+ 6. If you hit a CAPTCHA or interstitial, \`nexus-browser__detect_challenge\` then \`nexus-browser__solve_challenge\`.
73
+ 7. Always \`nexus-browser__close_session\` when done so the headless tab is released.
74
+
75
+ ## Output discipline
76
+
77
+ Return ONE concise text reply to the parent containing exactly the information requested. Do not
78
+ narrate the steps you took. Do not include screenshots unless they are the requested output. If the
79
+ task asked for structured data, return it as a small JSON object or markdown table — not prose
80
+ describing the data.
81
+
82
+ ## Failure modes
83
+
84
+ - If the page never loads, or stays blocked behind a challenge you cannot solve, return a one-line
85
+ failure summary so the parent can decide whether to retry with a different approach.
86
+ - Don't browse off-task. If the page links somewhere irrelevant, don't follow it.
87
+ - Don't loop. If three consecutive scan/act cycles produce no new information, you're done.
88
+ `,
89
+ // Whitelist: only browser tools + read/grep/glob for searching captured content. No write/edit/bash.
90
+ tools: [
91
+ 'Read',
92
+ 'Grep',
93
+ 'Glob',
94
+ 'TodoCreate',
95
+ 'TodoUpdate',
96
+ 'TodoList',
97
+ // nexus-browser tools are auto-injected by the subagent's MCP_AUTO_INJECT=true override;
98
+ // the agent definition's tool list is a soft preference, the actual exposure is governed
99
+ // by which MCP server is connected at fork time.
100
+ ],
101
+ model: 'inherit',
102
+ location: 'project',
103
+ filePath: '<inline:browse-agent>',
104
+ };
105
+ export class BrowseTool extends BaseTool {
106
+ constructor() {
107
+ super('Browse', 'Browse', `Drives a headless browser via a subagent. Use when you need to:
108
+ - interact with a page (click, fill forms, log in)
109
+ - scrape JS-rendered SPA content that plain HTTP fetch can't see
110
+ - bypass simple bot-protection or CAPTCHA
111
+ - collect data across multiple pages
112
+
113
+ The subagent runs in its own forked process with the full nexus-browser MCP toolset
114
+ (~43 tools). The parent's context stays clean — only this single tool definition is
115
+ visible here, not the 43-tool browser surface.
116
+
117
+ For static text search use WebSearch (faster, cheaper). For simple URL reads use WebFetch.
118
+ Reach for Browse only when those two won't work.`, {
119
+ type: 'object',
120
+ properties: {
121
+ task: {
122
+ type: 'string',
123
+ description: 'What the browser subagent should accomplish. Be specific about the success criterion — what data or outcome should it return?',
124
+ },
125
+ url: {
126
+ type: 'string',
127
+ description: 'Optional starting URL. If omitted, the subagent picks a starting page based on the task.',
128
+ },
129
+ model: {
130
+ type: 'string',
131
+ description: 'Optional model override (sonnet, opus, haiku). Defaults to parent\'s current model.',
132
+ },
133
+ },
134
+ required: ['task'],
135
+ });
136
+ }
137
+ validateToolParams(params) {
138
+ if (typeof params.task !== 'string' || params.task.trim().length === 0) {
139
+ return 'task must be a non-empty string';
140
+ }
141
+ if (params.task.length > 4000) {
142
+ return 'task must be 4000 characters or less';
143
+ }
144
+ if (params.url !== undefined) {
145
+ if (typeof params.url !== 'string' || params.url.trim().length === 0) {
146
+ return 'url, if provided, must be a non-empty string';
147
+ }
148
+ // Light validation — let the subagent handle proto-less URLs etc.
149
+ if (params.url.length > 2048) {
150
+ return 'url must be 2048 characters or less';
151
+ }
152
+ }
153
+ if (params.model !== undefined) {
154
+ if (!['sonnet', 'opus', 'haiku', 'inherit'].includes(params.model)) {
155
+ return 'model must be one of: sonnet, opus, haiku, inherit';
156
+ }
157
+ }
158
+ return null;
159
+ }
160
+ getDescription(params) {
161
+ const target = params.url ? ` at ${params.url}` : '';
162
+ return `Dispatching browser subagent: ${params.task.slice(0, 80)}${target}`;
163
+ }
164
+ async execute(params) {
165
+ const validationError = this.validateToolParams(params);
166
+ if (validationError) {
167
+ return this.createErrorResult(validationError);
168
+ }
169
+ // Recursion guard: subagents must never spawn a child Browse subagent.
170
+ // Without this, the browse-agent gets the parent's Browse tool definition,
171
+ // calls it, spawns another browse-agent, and burns time + tokens. The
172
+ // subagent already has the full nexus-browser MCP toolset via the fork's
173
+ // env override — it should use those directly.
174
+ if ((process.env.CORTEX_AGENT_MODE) === 'true') {
175
+ return this.createErrorResult('Browse is a parent-only tool. You are already running inside a subagent with direct access to nexus-browser__* tools. ' +
176
+ 'Use `nexus-browser__browse({ url })` to open a page, then `nexus-browser__scan` / `nexus-browser__grab` etc. to interact with it.');
177
+ }
178
+ return buildBrowseSubagentDispatch(params.task, params.url, `Dispatching Browse subagent: ${params.task.slice(0, 160)}`);
179
+ }
180
+ }
181
+ //# sourceMappingURL=BrowseTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BrowseTool.js","sourceRoot":"","sources":["../../../src/implementations/web/BrowseTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,UAAkB,EAClB,WAA+B,EAC/B,UAAkB,EAClB,SAAkB;IAElB,MAAM,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,aAAa,WAAW,OAAO,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;IAC1F,OAAO;QACL,UAAU,EAAE,UAAU;QACtB,aAAa,EAAE,UAAU;QACzB,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE;YACR,eAAe,EAAE,mBAAmB;YACpC,SAAS,EAAE,mBAAmB,CAAC,IAAI;YACnC,UAAU,EAAE,UAAU;YACtB,mBAAmB,EAAE,IAAI;YACzB,YAAY,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE;YACzC,WAAW,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;YACrC,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC9E;KACF,CAAC;AACJ,CAAC;AAWD;;;;;;;;;GASG;AACH,MAAM,mBAAmB,GAAG;IAC1B,IAAI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I,EACX,MAAM,CAAC,GAAG,EACV,gCAAgC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAC5D,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * SandboxTransfer Tool Executor
3
+ *
4
+ * Runs a command in a remote sandbox (via MCP run_command), captures its
5
+ * stdout, and writes the output to the local filesystem. Closes the loop
6
+ * between sandbox-generated artifacts (PDFs, images, data) and local files.
7
+ *
8
+ * Uses late-bound mcpManagerGetter injected into ExecutorConfig by
9
+ * OrchestratorFactory after MCP initialisation.
10
+ */
11
+ import { BaseTool, type ToolResult } from '../../base/index.js';
12
+ import type { ExecutorConfig } from '../../base/ToolRegistry.js';
13
+ export interface SandboxTransferParams {
14
+ command: string;
15
+ local_path: string;
16
+ encoding?: 'base64' | 'utf8';
17
+ mime_type?: string;
18
+ timeout?: number;
19
+ server?: string;
20
+ }
21
+ export declare class SandboxTransferTool extends BaseTool<SandboxTransferParams, ToolResult> {
22
+ private config;
23
+ constructor(config: ExecutorConfig);
24
+ validateToolParams(params: SandboxTransferParams): string | null;
25
+ getDescription(params: SandboxTransferParams): string;
26
+ execute(params: SandboxTransferParams, signal: AbortSignal, updateOutput?: (output: string) => void): Promise<ToolResult>;
27
+ private extractStdout;
28
+ private extractField;
29
+ }
30
+ //# sourceMappingURL=SandboxTransferTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SandboxTransferTool.d.ts","sourceRoot":"","sources":["../../../src/implementations/web/SandboxTransferTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAOhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAsBjE,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,mBAAoB,SAAQ,QAAQ,CAAC,qBAAqB,EAAE,UAAU,CAAC;IACtE,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IA6C1C,kBAAkB,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,GAAG,IAAI;IAqBhE,cAAc,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM;IAQ/C,OAAO,CACX,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,WAAW,EACnB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GACtC,OAAO,CAAC,UAAU,CAAC;IAkJtB,OAAO,CAAC,aAAa;IA2BrB,OAAO,CAAC,YAAY;CAiBrB"}