@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,351 @@
1
+ /**
2
+ * Skill Tool - Invoke specialized skills from .agents/skills/ or .cortex/skills/
3
+ *
4
+ * Loads and invokes skills defined as directories containing SKILL.md files
5
+ * with YAML frontmatter. Skills are model-invoked capabilities that extend
6
+ * the agent's functionality.
7
+ *
8
+ * Search order: .agents/skills/ → .cortex/skills/ → ~/.cortex/skills/
9
+ */
10
+ import { BaseTool } from '../../base/index.js';
11
+ import { promises as fs } from 'node:fs';
12
+ import { join } from 'node:path';
13
+ import { glob } from 'glob';
14
+ import { homedir } from 'node:os';
15
+ /**
16
+ * Skill Tool Executor
17
+ *
18
+ * Invokes specialized skills from skill directories.
19
+ * Skills are model-invoked capabilities defined in SKILL.md files.
20
+ *
21
+ * Example skill directory structure:
22
+ * ```
23
+ * .agents/skills/pdf-documents/
24
+ * ├── SKILL.md # Required: skill definition
25
+ * ├── sections/ # Optional: spoke files referenced by hub
26
+ * ├── reference.md # Optional: reference docs
27
+ * └── scripts/ # Optional: helper scripts
28
+ * ```
29
+ *
30
+ * Search order (first match wins — cwd-specific overrides/extends central):
31
+ * 1. Project `.agents/skills/` (cwd-specific overlay — cross-harness convention)
32
+ * 2. Project `.cortex/skills/` (cwd-specific overlay — nexus-cortex native)
33
+ * 3. Central `~/.agents/skills/` (the universal master list, shared across cwds)
34
+ * 4. Personal `~/.cortex/skills/` (nexus-cortex personal skills)
35
+ *
36
+ * Skills are mostly universal, so they live centrally in `~/.agents/skills/`
37
+ * and are reachable from any cwd; a project may add cwd-specific skills (or
38
+ * override a central one) by name in its own `.agents/skills/`, searched first.
39
+ *
40
+ * Usage: Skill({ command: "pdf-documents" })
41
+ */
42
+ export class SkillToolExecutor extends BaseTool {
43
+ skillsCache = null;
44
+ skillsDirs;
45
+ constructor(config) {
46
+ super('Skill', 'Skill', 'Invoke specialized skills', {
47
+ type: 'object',
48
+ properties: {
49
+ command: {
50
+ type: 'string',
51
+ description: 'Use "list" to see all available skills, or a skill name to load it. E.g., "list", "pdf-documents", "spacetimedb-rust"',
52
+ },
53
+ },
54
+ required: ['command'],
55
+ });
56
+ this.skillsDirs = [
57
+ // cwd-specific overlay (searched first → overrides/extends the central list)
58
+ { path: join(config.workingDirectory, '.agents', 'skills'), location: 'project' },
59
+ { path: join(config.workingDirectory, '.cortex', 'skills'), location: 'project' },
60
+ // central universal master list (shared across all cwds) + nexus-cortex personal
61
+ { path: join(homedir(), '.agents', 'skills'), location: 'central' },
62
+ { path: join(homedir(), '.cortex', 'skills'), location: 'personal' },
63
+ // shipped/builtin tier (lowest priority) — $CORTEX_ROOT/.cortex/skills, the
64
+ // skills packed with the install (git clone root, or the npm package's vendored
65
+ // scaffold). Mirrors AgentStore's builtin agent tier. Absent when CORTEX_ROOT
66
+ // is unset; a missing dir is skipped harmlessly at load time.
67
+ ...(process.env.CORTEX_ROOT
68
+ ? [{ path: join(process.env.CORTEX_ROOT, '.cortex', 'skills'), location: 'builtin' }]
69
+ : []),
70
+ ];
71
+ }
72
+ validateToolParams(params) {
73
+ if (!params.command || typeof params.command !== 'string') {
74
+ return 'command must be a non-empty string';
75
+ }
76
+ // Trim and validate skill name
77
+ const trimmedCommand = params.command.trim();
78
+ if (!trimmedCommand) {
79
+ return 'command must be a non-empty string';
80
+ }
81
+ // Skill names should be simple (no slashes, no special chars except hyphens)
82
+ if (!/^[a-zA-Z0-9-]+$/.test(trimmedCommand)) {
83
+ return 'skill name must contain only letters, numbers, and hyphens';
84
+ }
85
+ return null;
86
+ }
87
+ getDescription(params) {
88
+ if (params.command?.trim() === 'list')
89
+ return 'Listing available skills';
90
+ return `Invoking skill: ${params.command}`;
91
+ }
92
+ async execute(params, signal, updateOutput) {
93
+ const startTime = Date.now();
94
+ try {
95
+ // Validate parameters
96
+ const validationError = this.validateToolParams(params);
97
+ if (validationError) {
98
+ return {
99
+ ...this.createErrorResult(validationError),
100
+ metadata: { executionTime: Date.now() - startTime },
101
+ };
102
+ }
103
+ // Parse skill name
104
+ const skillName = params.command.trim();
105
+ // Handle "list" command — enumerate all available skills
106
+ if (skillName === 'list') {
107
+ if (!this.skillsCache) {
108
+ await this.loadAllSkills(signal);
109
+ }
110
+ const listing = this.formatSkillListing();
111
+ return {
112
+ ...this.createSuccessResult(listing),
113
+ metadata: { executionTime: Date.now() - startTime },
114
+ };
115
+ }
116
+ // Load skill definition
117
+ const skillDef = await this.loadSkill(skillName, signal);
118
+ if (!skillDef) {
119
+ return {
120
+ ...this.createErrorResult(`Skill '${skillName}' not found.\n` +
121
+ `Searched: .agents/skills/, .cortex/skills/, ~/.agents/skills/, ~/.cortex/skills/\n\n` +
122
+ `Available skills: ${await this.getAvailableSkills()}`),
123
+ metadata: {
124
+ executionTime: Date.now() - startTime,
125
+ skillName,
126
+ },
127
+ };
128
+ }
129
+ // Return the skill's content
130
+ const output = this.formatSkillOutput(skillDef);
131
+ return {
132
+ ...this.createSuccessResult(output),
133
+ metadata: {
134
+ executionTime: Date.now() - startTime,
135
+ skillName: skillDef.name,
136
+ location: skillDef.location,
137
+ description: skillDef.description,
138
+ allowedTools: skillDef.allowedTools,
139
+ },
140
+ };
141
+ }
142
+ catch (error) {
143
+ if (signal.aborted) {
144
+ return {
145
+ ...this.createErrorResult('Skill invocation was cancelled'),
146
+ metadata: { executionTime: Date.now() - startTime },
147
+ };
148
+ }
149
+ return {
150
+ ...this.createErrorResult(`Error invoking skill: ${error.message || String(error)}`),
151
+ metadata: {
152
+ executionTime: Date.now() - startTime,
153
+ error: error.message || String(error),
154
+ },
155
+ };
156
+ }
157
+ }
158
+ /**
159
+ * Load skill definition from .cortex/skills/ directories
160
+ * Searches project skills first, then personal skills
161
+ */
162
+ async loadSkill(skillName, signal) {
163
+ // Load all skills if not cached
164
+ if (!this.skillsCache) {
165
+ await this.loadAllSkills(signal);
166
+ }
167
+ if (!this.skillsCache) {
168
+ return null;
169
+ }
170
+ return this.skillsCache.get(skillName) || null;
171
+ }
172
+ /**
173
+ * Load all skill definitions from project and personal directories.
174
+ * First match wins — earlier dirs in skillsDirs take precedence.
175
+ */
176
+ async loadAllSkills(signal) {
177
+ this.skillsCache = new Map();
178
+ for (const dir of this.skillsDirs) {
179
+ await this.loadSkillsFromDirectory(dir.path, dir.location, signal);
180
+ }
181
+ }
182
+ /**
183
+ * Load skills from a specific directory
184
+ */
185
+ async loadSkillsFromDirectory(baseDir, location, signal) {
186
+ try {
187
+ // Check if directory exists
188
+ try {
189
+ await fs.access(baseDir);
190
+ }
191
+ catch {
192
+ // Directory doesn't exist, skip
193
+ return;
194
+ }
195
+ // Find all SKILL.md files in skill directories
196
+ const skillFiles = await glob('*/SKILL.md', {
197
+ cwd: baseDir,
198
+ nodir: true,
199
+ dot: false,
200
+ signal,
201
+ });
202
+ // Load each skill
203
+ for (const file of skillFiles) {
204
+ const parts = file.split('/');
205
+ const skillDir = parts[0] || ''; // Get directory name
206
+ if (!skillDir)
207
+ continue; // Skip if no directory
208
+ const skillPath = join(baseDir, file);
209
+ const skillDef = await this.parseSkillFile(skillPath, skillDir, location);
210
+ if (skillDef && !this.skillsCache.has(skillDef.name)) {
211
+ // Only add if not already present (project skills take precedence)
212
+ this.skillsCache.set(skillDef.name, skillDef);
213
+ }
214
+ }
215
+ }
216
+ catch (error) {
217
+ // Silently fail if directory doesn't exist or can't be read
218
+ if (error.code !== 'ENOENT') {
219
+ console.error(`[Skill] Error loading skills from ${baseDir}: ${error.message}`);
220
+ }
221
+ }
222
+ }
223
+ /**
224
+ * Parse skill definition from SKILL.md file
225
+ *
226
+ * Format:
227
+ * ```markdown
228
+ * ---
229
+ * name: skill-name
230
+ * description: What this skill does
231
+ * allowed-tools: Read, Write, Grep # Optional
232
+ * ---
233
+ *
234
+ * # Skill Name
235
+ *
236
+ * ## Instructions
237
+ * Step-by-step guidance...
238
+ * ```
239
+ */
240
+ async parseSkillFile(filePath, skillDir, location) {
241
+ try {
242
+ const content = await fs.readFile(filePath, 'utf-8');
243
+ // Extract frontmatter and body
244
+ const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);
245
+ if (!frontmatterMatch) {
246
+ console.error(`[Skill] Invalid SKILL.md format: ${filePath} (missing frontmatter)`);
247
+ return null;
248
+ }
249
+ const frontmatterText = frontmatterMatch[1] || '';
250
+ const body = frontmatterMatch[2] || '';
251
+ // Parse frontmatter
252
+ const frontmatter = this.parseFrontmatter(frontmatterText);
253
+ // Get skill name (from frontmatter or fallback to directory name)
254
+ const skillName = frontmatter.name || skillDir;
255
+ // Parse allowed-tools if present
256
+ let allowedTools;
257
+ if (frontmatter['allowed-tools']) {
258
+ allowedTools = frontmatter['allowed-tools']
259
+ .split(',')
260
+ .map((tool) => tool.trim())
261
+ .filter(Boolean);
262
+ }
263
+ return {
264
+ name: skillName,
265
+ description: frontmatter.description || `Skill: ${skillName}`,
266
+ allowedTools,
267
+ content: body.trim(),
268
+ location,
269
+ path: filePath,
270
+ };
271
+ }
272
+ catch (error) {
273
+ console.error(`[Skill] Error parsing skill file ${filePath}: ${error.message}`);
274
+ return null;
275
+ }
276
+ }
277
+ /**
278
+ * Simple YAML frontmatter parser
279
+ * Handles basic key: value pairs
280
+ */
281
+ parseFrontmatter(text) {
282
+ const result = {};
283
+ const lines = text.split('\n');
284
+ for (const line of lines) {
285
+ const match = line.match(/^(\S+):\s*(.*)$/);
286
+ if (match && match[1] && match[2] !== undefined) {
287
+ const key = match[1].trim();
288
+ const value = match[2].trim();
289
+ result[key] = value;
290
+ }
291
+ }
292
+ return result;
293
+ }
294
+ /**
295
+ * Format skill output for display
296
+ */
297
+ formatSkillOutput(skillDef) {
298
+ const parts = [];
299
+ // Skill header
300
+ parts.push(`# Skill: ${skillDef.name}`);
301
+ parts.push('');
302
+ parts.push(`**Description**: ${skillDef.description}`);
303
+ parts.push(`**Location**: ${skillDef.path}`);
304
+ if (skillDef.allowedTools && skillDef.allowedTools.length > 0) {
305
+ parts.push(`**Allowed Tools**: ${skillDef.allowedTools.join(', ')}`);
306
+ }
307
+ parts.push('');
308
+ parts.push('---');
309
+ parts.push('');
310
+ // Skill content (instructions)
311
+ parts.push(skillDef.content);
312
+ return parts.join('\n');
313
+ }
314
+ /**
315
+ * Format a readable listing of all available skills
316
+ */
317
+ formatSkillListing() {
318
+ if (!this.skillsCache || this.skillsCache.size === 0) {
319
+ return 'No skills found.\n\nSkill directories searched:\n- .agents/skills/\n- .cortex/skills/\n- ~/.agents/skills/\n- ~/.cortex/skills/';
320
+ }
321
+ const parts = [];
322
+ parts.push(`# Available Skills (${this.skillsCache.size})\n`);
323
+ for (const skill of this.skillsCache.values()) {
324
+ parts.push(`- **${skill.name}** (${skill.location}): ${skill.description}`);
325
+ }
326
+ parts.push('');
327
+ parts.push('To load a skill: `Skill({ command: "skill-name" })`');
328
+ return parts.join('\n');
329
+ }
330
+ /**
331
+ * Get list of available skills (for error messages)
332
+ */
333
+ async getAvailableSkills() {
334
+ if (!this.skillsCache) {
335
+ await this.loadAllSkills(new AbortController().signal);
336
+ }
337
+ if (!this.skillsCache || this.skillsCache.size === 0) {
338
+ return '(none found)';
339
+ }
340
+ return Array.from(this.skillsCache.values())
341
+ .map((skill) => `${skill.name} (${skill.location})`)
342
+ .join(', ');
343
+ }
344
+ /**
345
+ * Clear the skills cache (useful for testing or reloading)
346
+ */
347
+ clearCache() {
348
+ this.skillsCache = null;
349
+ }
350
+ }
351
+ //# sourceMappingURL=SkillTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SkillTool.js","sourceRoot":"","sources":["../../../src/implementations/extensions/SkillTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAmB,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,QAAQ,IAAI,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AK,CAAC,kBAAkB;QAC9B,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,eAAe,EAAE,CAAC,MAAM,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACrD,OAAO,cAAc,CAAC;QACxB,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;aACzC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,QAAQ,GAAG,CAAC;aACnD,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,UAAU;QACR,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;CACF"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * SlashCommand Tool - Execute custom slash commands from .cortex/commands/
3
+ *
4
+ * Loads and executes custom commands defined in Markdown files with YAML frontmatter.
5
+ * Supports argument substitution using $1, $2, etc.
6
+ *
7
+ * Command Format (.md files):
8
+ * ```markdown
9
+ * ---
10
+ * description: Command description
11
+ * argument-hint: [arg1] [arg2]
12
+ * ---
13
+ *
14
+ * Command body with $1 and $2 placeholders
15
+ * ```
16
+ */
17
+ import { BaseTool, type ToolResult } from '../../base/index.js';
18
+ /**
19
+ * Parameters for the SlashCommand tool
20
+ */
21
+ export interface SlashCommandParams {
22
+ /** The slash command to execute with its arguments (e.g., "/review-pr 123") */
23
+ command: string;
24
+ }
25
+ /**
26
+ * SlashCommand Tool Executor
27
+ *
28
+ * Executes custom slash commands from .cortex/commands/ directory.
29
+ * Commands are defined in Markdown files with YAML frontmatter.
30
+ *
31
+ * Example command file (.cortex/commands/review-pr.md):
32
+ * ```markdown
33
+ * ---
34
+ * description: Review a pull request
35
+ * argument-hint: [pr-number]
36
+ * ---
37
+ *
38
+ * Review pull request #$1
39
+ *
40
+ * Instructions:
41
+ * 1. Fetch PR details from GitHub
42
+ * 2. Analyze the code changes
43
+ * 3. Provide feedback
44
+ * ```
45
+ *
46
+ * Usage: SlashCommand({ command: "/review-pr 123" })
47
+ */
48
+ export declare class SlashCommandToolExecutor extends BaseTool<SlashCommandParams, ToolResult> {
49
+ private commandsCache;
50
+ private commandsDir;
51
+ constructor(config: {
52
+ workingDirectory: string;
53
+ });
54
+ validateToolParams(params: SlashCommandParams): string | null;
55
+ getDescription(params: SlashCommandParams): string;
56
+ execute(params: SlashCommandParams, signal: AbortSignal, updateOutput?: (output: string) => void): Promise<ToolResult>;
57
+ /**
58
+ * Parse command string into name and arguments
59
+ * Example: "/review-pr 123 --verbose" → { commandName: "review-pr", args: ["123", "--verbose"] }
60
+ */
61
+ private parseCommand;
62
+ /**
63
+ * Parse just the command name (for display purposes)
64
+ */
65
+ private parseCommandName;
66
+ /**
67
+ * Load command definition from .cortex/commands/ directory
68
+ * Supports recursive directory structure
69
+ */
70
+ private loadCommand;
71
+ /**
72
+ * Load all command definitions from .cortex/commands/
73
+ */
74
+ private loadAllCommands;
75
+ /**
76
+ * Parse command definition from .md file
77
+ *
78
+ * Format:
79
+ * ```markdown
80
+ * ---
81
+ * description: Command description
82
+ * argument-hint: [arg1] [arg2]
83
+ * ---
84
+ *
85
+ * Command body with $1 and $2 placeholders
86
+ * ```
87
+ */
88
+ private parseCommandFile;
89
+ /**
90
+ * Simple YAML frontmatter parser
91
+ * Handles basic key: value pairs
92
+ */
93
+ private parseFrontmatter;
94
+ /**
95
+ * Substitute arguments in command body
96
+ * Replaces $1, $2, etc. with actual argument values
97
+ */
98
+ private substituteArguments;
99
+ /**
100
+ * Format command output for display
101
+ */
102
+ private formatCommandOutput;
103
+ /**
104
+ * Get list of available commands (for error messages)
105
+ */
106
+ private getAvailableCommands;
107
+ /**
108
+ * Clear the commands cache (useful for testing or reloading)
109
+ */
110
+ clearCache(): void;
111
+ }
112
+ //# sourceMappingURL=SlashCommandTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SlashCommandTool.d.ts","sourceRoot":"","sources":["../../../src/implementations/extensions/SlashCommandTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAKhE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,+EAA+E;IAC/E,OAAO,EAAE,MAAM,CAAC;CACjB;AAYD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,wBAAyB,SAAQ,QAAQ,CACpD,kBAAkB,EAClB,UAAU,CACX;IACC,OAAO,CAAC,aAAa,CAA+C;IACpE,OAAO,CAAC,WAAW,CAAS;gBAEhB,MAAM,EAAE;QAAE,gBAAgB,EAAE,MAAM,CAAA;KAAE;IAqBhD,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,GAAG,IAAI;IAgB7D,cAAc,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM;IAK5C,OAAO,CACX,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,WAAW,EACnB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GACtC,OAAO,CAAC,UAAU,CAAC;IAuEtB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAYpB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;OAGG;YACW,WAAW;IAgBzB;;OAEG;YACW,eAAe;IAqC7B;;;;;;;;;;;;OAYG;YACW,gBAAgB;IAqC9B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAgBxB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAgB3B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA+B3B;;OAEG;YACW,oBAAoB;IAclC;;OAEG;IACH,UAAU,IAAI,IAAI;CAGnB"}