@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,166 @@
1
+ /**
2
+ * GitPolicy — single source of truth for git/PR access control + safe subprocess wiring.
3
+ *
4
+ * Used by PRAgentTool, WorkspaceManagerTool, and the server's /v1/pr/* routes so that
5
+ * repo/action allow-listing, input validation, and token handling are consistent and
6
+ * defined in exactly one place.
7
+ *
8
+ * Security posture:
9
+ * - Validation (repo/branch/prNumber regexes) is ALWAYS enforced — there is no opt-out.
10
+ * Combined with execFile (no shell), this closes the shell/argument-injection class.
11
+ * - The repo/action allow-list is opt-in defense-in-depth. Unset GIT_ALLOWED_REPOS means
12
+ * "allow all" so existing single-user setups keep working after an upgrade;
13
+ * multi-tenant/shared deployments set it to restrict. (No startup warning — the
14
+ * trade-off is documented in .env.example so the TUI/CLI don't print noise on launch.)
15
+ * - The auth token is exposed to gh/git ONLY through the subprocess environment
16
+ * (GH_TOKEN / GITHUB_TOKEN). It is never interpolated into argv or a clone URL.
17
+ *
18
+ * Env vars (see SettingsSchema.ts / .env.example):
19
+ * - GIT_ALLOWED_REPOS comma list of owner/repo, supports `owner/*` and `*`. Default `*`.
20
+ * - GIT_ALLOWED_ACTIONS comma list of actions. Default: all actions allowed.
21
+ * - GIT_AUTH_TOKEN token for gh/git, injected into the subprocess env only.
22
+ * - GIT_HOST GitHub (Enterprise) host, default `github.com`.
23
+ */
24
+ export const ALL_GIT_ACTIONS = [
25
+ 'review',
26
+ 'list',
27
+ 'create',
28
+ 'post-review',
29
+ 'clone',
30
+ 'worktree',
31
+ 'diff',
32
+ 'cleanup',
33
+ 'status',
34
+ ];
35
+ // First char must be alphanumeric (blocks leading `-` argument injection on both halves);
36
+ // remainder limited to word chars, dot, dash. No slashes beyond the single owner/repo one,
37
+ // no shell metacharacters, no whitespace.
38
+ const REPO_RE = /^[A-Za-z0-9][\w.-]*\/[A-Za-z0-9][\w.-]*$/;
39
+ // Conservative git ref-name rule: no leading dash, no `..`, no whitespace or shell/ref
40
+ // metacharacters. Allows nested refs like `feature/foo-bar`.
41
+ const BRANCH_RE = /^[A-Za-z0-9][A-Za-z0-9._/-]*$/;
42
+ export class GitPolicy {
43
+ /** Parsed allow-list patterns: `*`, `owner/*`, or exact `owner/repo`. */
44
+ repoPatterns;
45
+ /** Allowed actions, or null when all actions are permitted. */
46
+ actions;
47
+ token;
48
+ host;
49
+ constructor(cfg = {}) {
50
+ const reposRaw = (cfg.allowedRepos ?? '').trim();
51
+ if (reposRaw === '' || reposRaw === '*') {
52
+ // Unset / `*` = all repos permitted. The trade-off (and how to restrict it) is
53
+ // documented in `.env.example` under GIT_ALLOWED_REPOS — no startup warning so the
54
+ // TUI/CLI don't print noise on every launch.
55
+ this.repoPatterns = ['*'];
56
+ }
57
+ else {
58
+ this.repoPatterns = reposRaw
59
+ .split(',')
60
+ .map((p) => p.trim().toLowerCase())
61
+ .filter(Boolean);
62
+ }
63
+ const actionsRaw = (cfg.allowedActions ?? '').trim();
64
+ this.actions =
65
+ actionsRaw === '' || actionsRaw === '*'
66
+ ? null
67
+ : new Set(actionsRaw
68
+ .split(',')
69
+ .map((a) => a.trim().toLowerCase())
70
+ .filter(Boolean));
71
+ this.token = cfg.token && cfg.token.trim() !== '' ? cfg.token.trim() : undefined;
72
+ this.host = (cfg.host && cfg.host.trim() !== '' ? cfg.host.trim() : 'github.com').toLowerCase();
73
+ }
74
+ /** Build a policy from environment variables (defaults to process.env). */
75
+ static fromEnv(env = process.env) {
76
+ return new GitPolicy({
77
+ allowedRepos: env.GIT_ALLOWED_REPOS,
78
+ allowedActions: env.GIT_ALLOWED_ACTIONS,
79
+ token: env.GIT_AUTH_TOKEN,
80
+ host: env.GIT_HOST,
81
+ });
82
+ }
83
+ /**
84
+ * Validate a repo string: format first (blocks injection), then the allow-list.
85
+ * Returns an error message, or null when the repo is acceptable.
86
+ */
87
+ validateRepo(repo) {
88
+ if (typeof repo !== 'string' || repo.trim() === '') {
89
+ return 'repo is required and must be a string in "owner/repo" format';
90
+ }
91
+ const value = repo.trim();
92
+ if (!REPO_RE.test(value)) {
93
+ return `repo "${value}" is not a valid "owner/repo" identifier (only letters, digits, ., _, - allowed; no shell metacharacters)`;
94
+ }
95
+ if (!this.isRepoAllowed(value)) {
96
+ return `repo "${value}" is not in the GIT_ALLOWED_REPOS allow-list`;
97
+ }
98
+ return null;
99
+ }
100
+ /** True if the (already format-valid) repo matches the allow-list. */
101
+ isRepoAllowed(repo) {
102
+ const value = repo.trim().toLowerCase();
103
+ for (const pattern of this.repoPatterns) {
104
+ if (pattern === '*')
105
+ return true;
106
+ if (pattern === value)
107
+ return true;
108
+ if (pattern.endsWith('/*')) {
109
+ const owner = pattern.slice(0, -2);
110
+ if (value.startsWith(owner + '/'))
111
+ return true;
112
+ }
113
+ }
114
+ return false;
115
+ }
116
+ /** Validate a branch / ref name. Returns an error message or null. */
117
+ validateBranch(name) {
118
+ if (name === undefined || name === null || name === '')
119
+ return null; // optional
120
+ if (typeof name !== 'string' || !BRANCH_RE.test(name) || name.includes('..')) {
121
+ return `branch "${String(name)}" is not a valid git ref name`;
122
+ }
123
+ return null;
124
+ }
125
+ /** Validate a PR number (must be a positive integer). Returns an error message or null. */
126
+ validatePrNumber(n) {
127
+ const num = typeof n === 'string' && /^\d+$/.test(n) ? Number(n) : n;
128
+ if (!Number.isInteger(num) || num <= 0) {
129
+ return `prNumber "${String(n)}" must be a positive integer`;
130
+ }
131
+ return null;
132
+ }
133
+ /** Coerce a validated PR number to an integer (call only after validatePrNumber passes). */
134
+ prNumber(n) {
135
+ return typeof n === 'string' ? Number(n) : n;
136
+ }
137
+ isActionAllowed(action) {
138
+ return this.actions === null || this.actions.has(action);
139
+ }
140
+ /** Returns an error message if the action is blocked, else null. */
141
+ assertAction(action) {
142
+ return this.isActionAllowed(action)
143
+ ? null
144
+ : `action "${action}" is not in the GIT_ALLOWED_ACTIONS allow-list`;
145
+ }
146
+ /**
147
+ * Subprocess environment with the auth token + host injected for gh/git.
148
+ * The token rides in env only — never on argv or in a URL.
149
+ */
150
+ subprocessEnv(base = process.env) {
151
+ const env = { ...base };
152
+ if (this.token) {
153
+ env.GH_TOKEN = this.token;
154
+ env.GITHUB_TOKEN = this.token;
155
+ }
156
+ if (this.host && this.host !== 'github.com') {
157
+ env.GH_HOST = this.host;
158
+ }
159
+ return env;
160
+ }
161
+ /** HTTPS clone URL for an `owner/repo`, host-aware. No token embedded. */
162
+ cloneUrl(repo) {
163
+ return `https://${this.host}/${repo}.git`;
164
+ }
165
+ }
166
+ //# sourceMappingURL=GitPolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitPolicy.js","sourceRoot":"","sources":["../../src/utils/GitPolicy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAaH,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,aAAa;IACb,OAAO;IACP,UAAU;IACV,MAAM;IACN,SAAS;IACT,QAAQ;CACT,CAAC;AAaF,0FAA0F;AAC1F,2FAA2F;AAC3F,0CAA0C;AAC1C,MAAM,OAAO,GAAG,0CAA0C,CAAC;AAC3D,uFAAuF;AACvF,6DAA6D;AAC7D,MAAM,SAAS,GAAG,+BAA+B,CAAC;AAElD,MAAM,OAAO,SAAS;IACpB,yEAAyE;IACxD,YAAY,CAAW;IACxC,+DAA+D;IAC9C,OAAO,CAAqB;IACpC,KAAK,CAAU;IACf,IAAI,CAAS;IAEtB,YAAY,MAAuB,EAAE;QACnC,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACjD,IAAI,QAAQ,KAAK,EAAE,IAAI,QAAQ,KAAK,GAAG,EAAE,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IAAI;YACN,CAAC,CAAC,WAAW,MAAM,gDAAgD,CAAC;IACxE,CAAC;IAED;;;OAGG;IACH,aAAa,CAAC,OAA0B,OAAO,CAAC,GAAG;QACjD,MAAM,GAAG,GAAsB,EAAE,GAAG,IAAI,EAAE,CAAC;QAC3C,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC;YAC1B,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC;QAChC,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;YAC5C,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC;QAC1B,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,0EAA0E;IAC1E,QAAQ,CAAC,IAAY;QACnB,OAAO,WAAW,IAAI,CAAC,IAAI,IAAI,IAAI,MAAM,CAAC;IAC5C,CAAC;CACF"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Git Utility Functions
3
+ *
4
+ * Helpers for detecting git repositories and working with git commands.
5
+ */
6
+ /**
7
+ * Checks if a directory is within a git repository
8
+ * @param directory The directory to check
9
+ * @returns true if the directory is in a git repository, false otherwise
10
+ */
11
+ export declare function isGitRepository(directory: string): boolean;
12
+ /**
13
+ * Finds the root directory of a git repository
14
+ * @param directory Starting directory to search from
15
+ * @returns The git repository root path, or null if not in a git repository
16
+ */
17
+ export declare function findGitRoot(directory: string): string | null;
18
+ //# sourceMappingURL=GitUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitUtils.d.ts","sourceRoot":"","sources":["../../src/utils/GitUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CA2B1D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAyB5D"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Git Utility Functions
3
+ *
4
+ * Helpers for detecting git repositories and working with git commands.
5
+ */
6
+ import fs from 'fs';
7
+ import path from 'path';
8
+ /**
9
+ * Checks if a directory is within a git repository
10
+ * @param directory The directory to check
11
+ * @returns true if the directory is in a git repository, false otherwise
12
+ */
13
+ export function isGitRepository(directory) {
14
+ try {
15
+ let currentDir = path.resolve(directory);
16
+ while (true) {
17
+ const gitDir = path.join(currentDir, '.git');
18
+ // Check if .git exists (either as directory or file for worktrees)
19
+ if (fs.existsSync(gitDir)) {
20
+ return true;
21
+ }
22
+ const parentDir = path.dirname(currentDir);
23
+ // If we've reached the root directory, stop searching
24
+ if (parentDir === currentDir) {
25
+ break;
26
+ }
27
+ currentDir = parentDir;
28
+ }
29
+ return false;
30
+ }
31
+ catch (_error) {
32
+ // If any filesystem error occurs, assume not a git repo
33
+ return false;
34
+ }
35
+ }
36
+ /**
37
+ * Finds the root directory of a git repository
38
+ * @param directory Starting directory to search from
39
+ * @returns The git repository root path, or null if not in a git repository
40
+ */
41
+ export function findGitRoot(directory) {
42
+ try {
43
+ let currentDir = path.resolve(directory);
44
+ while (true) {
45
+ const gitDir = path.join(currentDir, '.git');
46
+ if (fs.existsSync(gitDir)) {
47
+ return currentDir;
48
+ }
49
+ const parentDir = path.dirname(currentDir);
50
+ // If we've reached the root directory, stop searching
51
+ if (parentDir === currentDir) {
52
+ break;
53
+ }
54
+ currentDir = parentDir;
55
+ }
56
+ return null;
57
+ }
58
+ catch (_error) {
59
+ return null;
60
+ }
61
+ }
62
+ //# sourceMappingURL=GitUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitUtils.js","sourceRoot":"","sources":["../../src/utils/GitUtils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC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,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * SandboxRegistry - File-based persistent sandbox tracking
3
+ *
4
+ * Maintains a registry of all active sandboxes with file persistence.
5
+ * Survives server restarts and enables stateless mode to discover existing sandboxes.
6
+ *
7
+ * Architecture:
8
+ * - Single source of truth: .addon-tools/registry.json
9
+ * - Atomic writes with temp file + rename
10
+ * - Auto-recovery: validates PIDs and ports on load
11
+ * - Thread-safe: file locking for concurrent access
12
+ */
13
+ export interface SandboxRegistryEntry {
14
+ id: string;
15
+ name: string;
16
+ port: number;
17
+ url: string;
18
+ pid?: number;
19
+ mode: 'oneshot' | 'dev' | 'persistent';
20
+ startTime: string;
21
+ lastActivity: string;
22
+ path: string;
23
+ metadata?: Record<string, any>;
24
+ }
25
+ export interface SandboxRegistryData {
26
+ version: string;
27
+ sandboxes: Record<string, SandboxRegistryEntry>;
28
+ }
29
+ export declare class SandboxRegistry {
30
+ private static instance;
31
+ private registryPath;
32
+ private registryDir;
33
+ private data;
34
+ private saveDebounceTimer;
35
+ private constructor();
36
+ /**
37
+ * Get singleton instance
38
+ */
39
+ static getInstance(baseDir?: string): SandboxRegistry;
40
+ /**
41
+ * Initialize registry (load from disk or create new)
42
+ */
43
+ initialize(): Promise<void>;
44
+ /**
45
+ * Load registry from disk
46
+ */
47
+ private load;
48
+ /**
49
+ * Save registry to disk (atomic write)
50
+ */
51
+ private save;
52
+ /**
53
+ * Save with debouncing (prevents excessive disk writes)
54
+ */
55
+ private debouncedSave;
56
+ /**
57
+ * Register a new sandbox
58
+ */
59
+ register(entry: SandboxRegistryEntry): Promise<void>;
60
+ /**
61
+ * Update an existing sandbox
62
+ */
63
+ update(id: string, updates: Partial<SandboxRegistryEntry>): Promise<void>;
64
+ /**
65
+ * Remove a sandbox from registry
66
+ */
67
+ unregister(id: string): Promise<void>;
68
+ /**
69
+ * Get a sandbox by ID
70
+ */
71
+ get(id: string): SandboxRegistryEntry | undefined;
72
+ /**
73
+ * Get sandbox by name (returns first match)
74
+ */
75
+ getByName(name: string): SandboxRegistryEntry | undefined;
76
+ /**
77
+ * Get all sandboxes
78
+ */
79
+ getAll(): SandboxRegistryEntry[];
80
+ /**
81
+ * Check if a sandbox exists
82
+ */
83
+ has(id: string): boolean;
84
+ /**
85
+ * Clean stale entries (processes that no longer exist)
86
+ */
87
+ private cleanStaleEntries;
88
+ /**
89
+ * Check if a process is alive
90
+ */
91
+ private isProcessAlive;
92
+ /**
93
+ * Get registry statistics
94
+ */
95
+ getStats(): {
96
+ total: number;
97
+ byMode: Record<string, number>;
98
+ oldestSandbox?: SandboxRegistryEntry;
99
+ newestSandbox?: SandboxRegistryEntry;
100
+ };
101
+ /**
102
+ * Export registry for debugging
103
+ */
104
+ export(): SandboxRegistryData;
105
+ /**
106
+ * Clear all sandboxes (dangerous - use with caution!)
107
+ */
108
+ clear(): Promise<void>;
109
+ }
110
+ //# sourceMappingURL=SandboxRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SandboxRegistry.d.ts","sourceRoot":"","sources":["../../src/utils/SandboxRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,GAAG,KAAK,GAAG,YAAY,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;I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a,CAAC,EAAE,oBAAoB,CAAC;QACrC,aAAa,CAAC,EAAE,oBAAoB,CAAC;KACtC;IAoBD;;OAEG;IACH,MAAM,IAAI,mBAAmB;IAI7B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAI7B"}
@@ -0,0 +1,220 @@
1
+ /**
2
+ * SandboxRegistry - File-based persistent sandbox tracking
3
+ *
4
+ * Maintains a registry of all active sandboxes with file persistence.
5
+ * Survives server restarts and enables stateless mode to discover existing sandboxes.
6
+ *
7
+ * Architecture:
8
+ * - Single source of truth: .addon-tools/registry.json
9
+ * - Atomic writes with temp file + rename
10
+ * - Auto-recovery: validates PIDs and ports on load
11
+ * - Thread-safe: file locking for concurrent access
12
+ */
13
+ import { promises as fs } from 'fs';
14
+ import { join } from 'path';
15
+ import { existsSync } from 'fs';
16
+ export class SandboxRegistry {
17
+ static instance;
18
+ registryPath;
19
+ registryDir;
20
+ data;
21
+ saveDebounceTimer = null;
22
+ constructor(baseDir) {
23
+ this.registryDir = join(baseDir, '.addon-tools');
24
+ this.registryPath = join(this.registryDir, 'registry.json');
25
+ this.data = {
26
+ version: '1.0.0',
27
+ sandboxes: {}
28
+ };
29
+ }
30
+ /**
31
+ * Get singleton instance
32
+ */
33
+ static getInstance(baseDir) {
34
+ if (!SandboxRegistry.instance) {
35
+ if (!baseDir) {
36
+ throw new Error('SandboxRegistry: baseDir required for first initialization');
37
+ }
38
+ SandboxRegistry.instance = new SandboxRegistry(baseDir);
39
+ }
40
+ return SandboxRegistry.instance;
41
+ }
42
+ /**
43
+ * Initialize registry (load from disk or create new)
44
+ */
45
+ async initialize() {
46
+ // Ensure directory exists
47
+ await fs.mkdir(this.registryDir, { recursive: true });
48
+ // Load existing registry or create new
49
+ if (existsSync(this.registryPath)) {
50
+ await this.load();
51
+ await this.cleanStaleEntries();
52
+ }
53
+ else {
54
+ await this.save();
55
+ }
56
+ }
57
+ /**
58
+ * Load registry from disk
59
+ */
60
+ async load() {
61
+ try {
62
+ const content = await fs.readFile(this.registryPath, 'utf-8');
63
+ const loaded = JSON.parse(content);
64
+ // Validate version compatibility
65
+ if (loaded.version !== this.data.version) {
66
+ console.warn(`⚠ SandboxRegistry: Version mismatch (expected ${this.data.version}, got ${loaded.version})`);
67
+ }
68
+ this.data = loaded;
69
+ }
70
+ catch (error) {
71
+ console.error(`[ERROR] Failed to load sandbox registry: ${error.message}`);
72
+ // Keep empty registry
73
+ }
74
+ }
75
+ /**
76
+ * Save registry to disk (atomic write)
77
+ */
78
+ async save() {
79
+ try {
80
+ const tempPath = `${this.registryPath}.tmp`;
81
+ const content = JSON.stringify(this.data, null, 2);
82
+ // Write to temp file
83
+ await fs.writeFile(tempPath, content, 'utf-8');
84
+ // Atomic rename
85
+ await fs.rename(tempPath, this.registryPath);
86
+ }
87
+ catch (error) {
88
+ console.error(`[ERROR] Failed to save sandbox registry: ${error.message}`);
89
+ }
90
+ }
91
+ /**
92
+ * Save with debouncing (prevents excessive disk writes)
93
+ */
94
+ debouncedSave() {
95
+ if (this.saveDebounceTimer) {
96
+ clearTimeout(this.saveDebounceTimer);
97
+ }
98
+ this.saveDebounceTimer = setTimeout(() => {
99
+ this.save();
100
+ this.saveDebounceTimer = null;
101
+ }, 1000); // Save after 1s of inactivity
102
+ }
103
+ /**
104
+ * Register a new sandbox
105
+ */
106
+ async register(entry) {
107
+ this.data.sandboxes[entry.id] = entry;
108
+ await this.save();
109
+ }
110
+ /**
111
+ * Update an existing sandbox
112
+ */
113
+ async update(id, updates) {
114
+ const existing = this.data.sandboxes[id];
115
+ if (!existing) {
116
+ throw new Error(`Sandbox ${id} not found in registry`);
117
+ }
118
+ this.data.sandboxes[id] = {
119
+ ...existing,
120
+ ...updates,
121
+ lastActivity: new Date().toISOString()
122
+ };
123
+ this.debouncedSave();
124
+ }
125
+ /**
126
+ * Remove a sandbox from registry
127
+ */
128
+ async unregister(id) {
129
+ delete this.data.sandboxes[id];
130
+ await this.save();
131
+ }
132
+ /**
133
+ * Get a sandbox by ID
134
+ */
135
+ get(id) {
136
+ return this.data.sandboxes[id];
137
+ }
138
+ /**
139
+ * Get sandbox by name (returns first match)
140
+ */
141
+ getByName(name) {
142
+ return Object.values(this.data.sandboxes).find(s => s.name === name);
143
+ }
144
+ /**
145
+ * Get all sandboxes
146
+ */
147
+ getAll() {
148
+ return Object.values(this.data.sandboxes);
149
+ }
150
+ /**
151
+ * Check if a sandbox exists
152
+ */
153
+ has(id) {
154
+ return id in this.data.sandboxes;
155
+ }
156
+ /**
157
+ * Clean stale entries (processes that no longer exist)
158
+ */
159
+ async cleanStaleEntries() {
160
+ const staleIds = [];
161
+ for (const [id, entry] of Object.entries(this.data.sandboxes)) {
162
+ // Check if process still exists
163
+ if (entry.pid && !this.isProcessAlive(entry.pid)) {
164
+ console.log(` Cleaning stale sandbox: ${entry.name} (PID ${entry.pid} not found)`);
165
+ staleIds.push(id);
166
+ }
167
+ }
168
+ // Remove stale entries
169
+ for (const id of staleIds) {
170
+ delete this.data.sandboxes[id];
171
+ }
172
+ if (staleIds.length > 0) {
173
+ await this.save();
174
+ }
175
+ }
176
+ /**
177
+ * Check if a process is alive
178
+ */
179
+ isProcessAlive(pid) {
180
+ try {
181
+ // Send signal 0 to check if process exists
182
+ process.kill(pid, 0);
183
+ return true;
184
+ }
185
+ catch (error) {
186
+ return false;
187
+ }
188
+ }
189
+ /**
190
+ * Get registry statistics
191
+ */
192
+ getStats() {
193
+ const sandboxes = this.getAll();
194
+ const byMode = {};
195
+ for (const sandbox of sandboxes) {
196
+ byMode[sandbox.mode] = (byMode[sandbox.mode] || 0) + 1;
197
+ }
198
+ const sorted = sandboxes.sort((a, b) => new Date(a.startTime).getTime() - new Date(b.startTime).getTime());
199
+ return {
200
+ total: sandboxes.length,
201
+ byMode,
202
+ oldestSandbox: sorted[0],
203
+ newestSandbox: sorted[sorted.length - 1]
204
+ };
205
+ }
206
+ /**
207
+ * Export registry for debugging
208
+ */
209
+ export() {
210
+ return JSON.parse(JSON.stringify(this.data));
211
+ }
212
+ /**
213
+ * Clear all sandboxes (dangerous - use with caution!)
214
+ */
215
+ async clear() {
216
+ this.data.sandboxes = {};
217
+ await this.save();
218
+ }
219
+ }
220
+ //# sourceMappingURL=SandboxRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SandboxRegistry.js","sourceRoot":"","sources":["../../src/utils/SandboxRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAoBhC,MAAM,OAAO,eAAe;IAClB,MAAM,CAAC,QAAQ,CAAkB;IACjC,YAAY,CAAS;IACrB,WAAW,CAAS;IACpB,IAAI,CAAsB;IAC1B,iBAAiB,GAA0B,IAAI,CAAC;IAExD,YAAoB,OAAe;QACjC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QACjD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG;YACV,OAAO,EAAE,OAAO;YAChB,SAAS,EAAE,EAAE;SACd,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,OAAgB;QACjC,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC;YAC9B,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;YAChF,CAAC;YACD,eAAe,CAAC,QAAQ,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,eAAe,CAAC,QAAQ,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,0BAA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J,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACzB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;CACF"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * JSON Schema Validator
3
+ *
4
+ * Simple validator for tool parameters using JSON Schema
5
+ */
6
+ import type { ToolSchema } from '@nexus-cortex/types';
7
+ /**
8
+ * Validate parameters against JSON Schema
9
+ *
10
+ * @param schema JSON Schema definition
11
+ * @param params Parameters to validate (mutated in-place for type coercion)
12
+ * @returns Error message if invalid, null if valid
13
+ */
14
+ export declare function validateSchema(schema: ToolSchema, params: any): string | null;
15
+ /**
16
+ * Schema Validator class (Gemini-CLI-compatible validation patterns)
17
+ */
18
+ export declare class SchemaValidator {
19
+ static validate(schema: ToolSchema, params: any): string | null;
20
+ }
21
+ //# sourceMappingURL=SchemaValidator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaValidator.d.ts","sourceRoot":"","sources":["../../src/utils/SchemaValidator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI,CAiD7E;AAED;;GAEG;AACH,qBAAa,eAAe;IAC1B,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,GAAG,MAAM,GAAG,IAAI;CAGhE"}