@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,227 @@
1
+ /**
2
+ * WebSearch Tool Executor — multi-provider.
3
+ *
4
+ * Backends (selected by WEB_TOOLS_MODEL env var):
5
+ * - Anthropic Claude → web_search_20250305 server tool
6
+ * - XAI Grok → Responses API web_search server tool
7
+ * - Google Gemini → googleSearch grounding (UTF-8 byte-accurate citations)
8
+ * - DuckDuckGo HTML → fallback when no provider key is available
9
+ *
10
+ * nexus-browser is intentionally not a backend here. It is exposed as a
11
+ * gated MCP server and reached only via the MCP transport.
12
+ */
13
+ import { GoogleGenAI } from '@google/genai';
14
+ import { BaseTool } from '../../base/index.js';
15
+ import { SchemaValidator } from '../../utils/SchemaValidator.js';
16
+ import { getWebToolsModel, resolveProvider, runWebSearch, } from './webBackends.js';
17
+ import { buildBrowseSubagentDispatch } from './BrowseTool.js';
18
+ export class WebSearchTool extends BaseTool {
19
+ config;
20
+ genAI = null;
21
+ constructor(config) {
22
+ super('WebSearch', 'WebSearch', `Performs a web search and returns results with citations.
23
+
24
+ Backend is selected automatically based on the WEB_TOOLS_MODEL setting and available API keys:
25
+ - Anthropic Claude models use the Claude web_search server tool
26
+ - XAI Grok models use the XAI Responses API web_search server tool
27
+ - OpenAI GPT/o-series models use the Responses API web_search_preview server tool
28
+ - Google Gemini models use Google Search grounding via the Gemini API
29
+ - A DuckDuckGo HTML fallback is used when no provider is configured
30
+
31
+ Use this tool to find current information, facts, news, and data from the internet. Results include source attribution.`, {
32
+ type: 'object',
33
+ properties: {
34
+ query: {
35
+ type: 'string',
36
+ description: 'The search query to find information on the web. Can be a question or keywords.',
37
+ },
38
+ mode: {
39
+ type: 'string',
40
+ enum: ['fast', 'interactive'],
41
+ description: "Default 'fast' uses the provider's native search. Set to 'interactive' to dispatch a nexus-browser subagent for JS-rendered SPAs, auth-gated pages, or anything that needs interaction.",
42
+ },
43
+ },
44
+ required: ['query'],
45
+ });
46
+ this.config = config;
47
+ }
48
+ getGeminiClient() {
49
+ if (!this.genAI) {
50
+ const apiKey = process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY;
51
+ if (!apiKey) {
52
+ throw new Error('Google API key not found. Please set GEMINI_API_KEY or GOOGLE_API_KEY environment variable.');
53
+ }
54
+ this.genAI = new GoogleGenAI({ apiKey });
55
+ }
56
+ return this.genAI;
57
+ }
58
+ validateToolParams(params) {
59
+ const schemaError = SchemaValidator.validate(this.parameterSchema, params);
60
+ if (schemaError)
61
+ return schemaError;
62
+ if (!params.query || params.query.trim() === '') {
63
+ return "The 'query' parameter cannot be empty.";
64
+ }
65
+ return null;
66
+ }
67
+ getDescription(params) {
68
+ return `Searching the web for: "${params.query}"`;
69
+ }
70
+ async execute(params, signal) {
71
+ const startTime = Date.now();
72
+ try {
73
+ const validationError = this.validateToolParams(params);
74
+ if (validationError) {
75
+ return {
76
+ ...this.createErrorResult(validationError),
77
+ metadata: { executionTime: Date.now() - startTime },
78
+ };
79
+ }
80
+ // Interactive mode: hand off to nexus-browser subagent. Same dispatch
81
+ // contract as the Browse tool — orchestrator handles the rest.
82
+ if (params.mode === 'interactive') {
83
+ // Recursion guard: inside a subagent, fall through to the fast path
84
+ // instead of trying to spawn another subagent.
85
+ if ((process.env.CORTEX_AGENT_MODE) === 'true') {
86
+ console.warn('[WebSearch] mode=interactive ignored inside subagent (recursion guard) — using fast path');
87
+ }
88
+ else {
89
+ return buildBrowseSubagentDispatch(`Search the web for: ${params.query}\n\n` +
90
+ `Use the nexus-browser tools to navigate search engines if needed, click into results, ` +
91
+ `and extract the most relevant content. Return a concise summary with sources.`, undefined, `Web search (interactive): ${params.query.slice(0, 80)}`, startTime);
92
+ }
93
+ }
94
+ const modelId = getWebToolsModel();
95
+ const provider = resolveProvider(modelId);
96
+ // Gemini path uses the @google/genai SDK directly for byte-accurate citation insertion.
97
+ const useGeminiSdk = provider === 'google' &&
98
+ !!(process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY);
99
+ if (useGeminiSdk) {
100
+ return await this.runGeminiSearch(params.query, modelId, startTime);
101
+ }
102
+ // Anthropic / XAI / DuckDuckGo fallback.
103
+ const result = await runWebSearch(params.query);
104
+ const formatted = this.formatBackendOutput(result.text, result.sources);
105
+ return {
106
+ ...this.createSuccessResult(formatted),
107
+ sources: result.sources.map((s) => ({ web: { title: s.title, uri: s.url } })),
108
+ metadata: {
109
+ executionTime: Date.now() - startTime,
110
+ query: params.query,
111
+ sourceCount: result.sources.length,
112
+ backend: result.backend,
113
+ },
114
+ };
115
+ }
116
+ catch (error) {
117
+ if (signal.aborted) {
118
+ return {
119
+ ...this.createErrorResult('Search operation was cancelled'),
120
+ metadata: { executionTime: Date.now() - startTime },
121
+ };
122
+ }
123
+ const errorMessage = error?.message ?? String(error);
124
+ return {
125
+ ...this.createErrorResult(`Error performing web search: ${errorMessage}`),
126
+ metadata: { executionTime: Date.now() - startTime, error: errorMessage },
127
+ };
128
+ }
129
+ }
130
+ formatBackendOutput(text, sources) {
131
+ if (sources.length === 0)
132
+ return text;
133
+ const list = sources
134
+ .map((s, i) => `[${i + 1}] ${s.title ?? 'Untitled'} (${s.url})`)
135
+ .join('\n');
136
+ return `${text}\n\nSources:\n${list}`;
137
+ }
138
+ async runGeminiSearch(query, modelId, startTime) {
139
+ const genAI = this.getGeminiClient();
140
+ const result = await genAI.models.generateContent({
141
+ model: modelId,
142
+ contents: query,
143
+ config: {
144
+ tools: [{ googleSearch: {} }],
145
+ },
146
+ });
147
+ let responseText = result.text || '';
148
+ const candidate = result.candidates?.[0];
149
+ const groundingMetadata = candidate?.groundingMetadata;
150
+ const sources = groundingMetadata?.groundingChunks;
151
+ const groundingSupports = groundingMetadata?.groundingSupports;
152
+ if (!responseText || !responseText.trim()) {
153
+ return {
154
+ ...this.createSuccessResult(`No search results or information found for query: "${query}"`),
155
+ sources: [],
156
+ metadata: {
157
+ executionTime: Date.now() - startTime,
158
+ query,
159
+ sourceCount: 0,
160
+ backend: 'gemini-googleSearch',
161
+ },
162
+ };
163
+ }
164
+ if (groundingSupports && groundingSupports.length > 0) {
165
+ responseText = this.insertCitationsUTF8(responseText, groundingSupports);
166
+ }
167
+ if (sources && sources.length > 0) {
168
+ const sourceList = sources
169
+ .map((source, index) => {
170
+ const title = source.web?.title || 'Untitled';
171
+ const uri = source.web?.uri || 'No URI';
172
+ return `[${index + 1}] ${title} (${uri})`;
173
+ })
174
+ .join('\n');
175
+ responseText += `\n\nSources:\n${sourceList}`;
176
+ }
177
+ return {
178
+ ...this.createSuccessResult(responseText),
179
+ sources,
180
+ metadata: {
181
+ executionTime: Date.now() - startTime,
182
+ query,
183
+ sourceCount: sources?.length ?? 0,
184
+ backend: 'gemini-googleSearch',
185
+ },
186
+ };
187
+ }
188
+ /**
189
+ * Insert citations at UTF-8 byte-accurate positions. Gemini grounding
190
+ * metadata uses byte offsets (not character indices), so multi-byte UTF-8
191
+ * characters must be handled via TextEncoder/TextDecoder.
192
+ */
193
+ insertCitationsUTF8(responseText, groundingSupports) {
194
+ if (!groundingSupports || groundingSupports.length === 0)
195
+ return responseText;
196
+ const insertions = [];
197
+ for (const support of groundingSupports) {
198
+ if (support.segment && support.groundingChunkIndices) {
199
+ const marker = support.groundingChunkIndices
200
+ .map((i) => `[${i + 1}]`)
201
+ .join('');
202
+ insertions.push({ index: support.segment.endIndex, marker });
203
+ }
204
+ }
205
+ insertions.sort((a, b) => b.index - a.index);
206
+ const encoder = new TextEncoder();
207
+ const responseBytes = encoder.encode(responseText);
208
+ const parts = [];
209
+ let lastIndex = responseBytes.length;
210
+ for (const ins of insertions) {
211
+ const pos = Math.min(ins.index, lastIndex);
212
+ parts.unshift(responseBytes.subarray(pos, lastIndex));
213
+ parts.unshift(encoder.encode(ins.marker));
214
+ lastIndex = pos;
215
+ }
216
+ parts.unshift(responseBytes.subarray(0, lastIndex));
217
+ const totalLength = parts.reduce((sum, p) => sum + p.length, 0);
218
+ const finalBytes = new Uint8Array(totalLength);
219
+ let offset = 0;
220
+ for (const part of parts) {
221
+ finalBytes.set(part, offset);
222
+ offset += part.length;
223
+ }
224
+ return new TextDecoder().decode(finalBytes);
225
+ }
226
+ }
227
+ //# sourceMappingURL=WebSearchTool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebSearchTool.js","sourceRoot":"","sources":["../../../src/implementations/web/WebSearchTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAmB,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAiC9D,MAAM,OAAO,aAAc,SAAQ,QAAkD;IAG/D;IAFZ,KAAK,GAAuB,IAAI,CAAC;IAEzC,YAAoB,MAAsB;QACxC,KAAK,CACH,WAAW,EACX,WAAW,EACX;;;;;;;;;wHASkH,EAClH;YACE,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,iFAAiF;iBACpF;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC;oBAC7B,WAAW,EACT,yLAAyL;iBAC5L;aACF;YACD,QAAQ,EAAE,CAAC,OAAO,CAAC;SACpB,CACF,CAAC;QA/BgB,WAAM,GAAN,MAAM,CAAgB;IAgC1C,CAAC;IAEO,eAAe;QACrB,IAAI,CAAC,IAAI,CAAC,KAAK,EA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,MAAM,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * In-band escalation directive appended to every WebFetch failure result.
3
+ *
4
+ * WebFetch routes through Gemini urlContext with a 10s plain-fetch fallback;
5
+ * both fail on blocked / JS-heavy / dynamic pages (county record sites, etc.).
6
+ * Weaker models then retry WebFetch in a loop instead of switching tools.
7
+ * This tells the model — at the moment of failure, where it cannot be missed
8
+ * — to stop retrying WebFetch and use the browser instead.
9
+ */
10
+ export declare function browseEscalationDirective(url?: string): string;
11
+ //# sourceMappingURL=escalateDirective.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escalateDirective.d.ts","sourceRoot":"","sources":["../../../src/implementations/web/escalateDirective.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAW9D"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * In-band escalation directive appended to every WebFetch failure result.
3
+ *
4
+ * WebFetch routes through Gemini urlContext with a 10s plain-fetch fallback;
5
+ * both fail on blocked / JS-heavy / dynamic pages (county record sites, etc.).
6
+ * Weaker models then retry WebFetch in a loop instead of switching tools.
7
+ * This tells the model — at the moment of failure, where it cannot be missed
8
+ * — to stop retrying WebFetch and use the browser instead.
9
+ */
10
+ export function browseEscalationDirective(url) {
11
+ const target = url ? ` "${url}"` : ' the same URL';
12
+ return (`<system-reminder>WebFetch could not retrieve${target} — the page is ` +
13
+ `blocked, dynamic, or JS-rendered. Do NOT retry WebFetch on this URL; it ` +
14
+ `will keep failing. Call the \`browse\` tool instead:\n` +
15
+ ` browse({ task: "Navigate to${target} and extract the page content", url: ${url ? `"${url}"` : 'the URL'} })\n` +
16
+ `The browse subagent renders JavaScript, handles CAPTCHAs/challenges ` +
17
+ `(detect_challenge + solve_challenge), and returns the result. Do not ` +
18
+ `attempt WebFetch again for this page.</system-reminder>`);
19
+ }
20
+ //# sourceMappingURL=escalateDirective.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escalateDirective.js","sourceRoot":"","sources":["../../../src/implementations/web/escalateDirective.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,UAAU,yBAAyB,CAAC,GAAY;IACpD,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,eAAe,CAAC;IACnD,OAAO,CACL,+CAA+C,MAAM,iBAAiB;QACtE,0EAA0E;QAC1E,wDAAwD;QACxD,+BAA+B,MAAM,wCAAwC,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC,CAAC,SAAS,OAAO;QAChH,sEAAsE;QACtE,uEAAuE;QACvE,yDAAyD,CAC1D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Web Tool Implementations
3
+ *
4
+ * Provides web search and fetch capabilities using Gemini API built-in tools
5
+ */
6
+ export * from './WebSearchTool.js';
7
+ export * from './WebFetchTool.js';
8
+ export * from './BrowseTool.js';
9
+ export * from './SandboxTransferTool.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/implementations/web/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Web Tool Implementations
3
+ *
4
+ * Provides web search and fetch capabilities using Gemini API built-in tools
5
+ */
6
+ export * from './WebSearchTool.js';
7
+ export * from './WebFetchTool.js';
8
+ export * from './BrowseTool.js';
9
+ export * from './SandboxTransferTool.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/implementations/web/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Web Tool Backends — Multi-provider implementations for WebSearch / WebFetch.
3
+ *
4
+ * Resolution order (per call):
5
+ * 1. Provider-native server-side web tool, selected by WEB_TOOLS_MODEL env var:
6
+ * - Anthropic Claude → Messages API + `web_search_20250305` server tool
7
+ * - XAI Grok → Responses API + `web_search` server tool
8
+ * - Google Gemini → GenerateContent + `googleSearch` grounding (default)
9
+ * 2. DuckDuckGo HTML fallback (no API key required) — last resort when:
10
+ * - WEB_TOOLS_MODEL is unset, OR
11
+ * - the configured provider's API key is missing.
12
+ *
13
+ * Provider is inferred from the model ID prefix; this matches the
14
+ * AdapterRegistry's pattern detection. nexus-browser is intentionally NOT a
15
+ * backend here — it is exposed via MCP only, with auth gating at the protocol
16
+ * layer (see nexus-cortex OSS / nexus-browser monetization boundary).
17
+ */
18
+ export type WebProvider = 'anthropic' | 'xai' | 'openai' | 'google' | 'fallback';
19
+ export interface BackendResult {
20
+ /** Combined text body */
21
+ text: string;
22
+ /** Source links for citation */
23
+ sources: Array<{
24
+ title?: string;
25
+ url: string;
26
+ }>;
27
+ /** Which backend produced this */
28
+ backend: string;
29
+ }
30
+ /** Resolve which provider serves a given model ID. */
31
+ export declare function resolveProvider(modelId: string | undefined): WebProvider;
32
+ export declare function anthropicSearch(query: string, modelId: string): Promise<BackendResult>;
33
+ export declare function anthropicFetch(prompt: string, modelId: string): Promise<BackendResult>;
34
+ export declare function xaiSearch(query: string, modelId: string): Promise<BackendResult>;
35
+ export declare function xaiFetch(prompt: string, modelId: string): Promise<BackendResult>;
36
+ export declare function openaiSearch(query: string, modelId: string): Promise<BackendResult>;
37
+ export declare function openaiFetch(prompt: string, modelId: string): Promise<BackendResult>;
38
+ export declare function duckDuckGoSearch(query: string): Promise<BackendResult>;
39
+ /** Direct HTTP fetch + html-to-text. URL must be public. */
40
+ export declare function directFetch(url: string): Promise<BackendResult>;
41
+ /**
42
+ * Selected web tools model ID. Reads `WEB_TOOLS_MODEL` and, if unset,
43
+ * picks a sensible default based on which provider key is present:
44
+ * GEMINI/GOOGLE → gemini-2.5-flash (free tier-friendly)
45
+ * ANTHROPIC → claude-haiku-4-5
46
+ * XAI → grok-4-fast-non-reasoning
47
+ * none → '' (DuckDuckGo fallback for search, direct fetch for fetch)
48
+ *
49
+ * Verified Gemini models with googleSearch + urlContext (2026-05-27):
50
+ * gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.5-pro,
51
+ * gemini-3-flash-preview (= gemini-3.5-flash preview), gemini-3.5-flash, gemini-3.1-pro-preview
52
+ */
53
+ export declare function getWebToolsModel(): string;
54
+ /**
55
+ * Run a web search with provider-native backends, falling back to DuckDuckGo
56
+ * when no provider is configured or its API key is missing.
57
+ */
58
+ export declare function runWebSearch(query: string): Promise<BackendResult>;
59
+ /**
60
+ * Run a web fetch with provider-native backends, falling back to direct
61
+ * HTTP + html-to-text. The `prompt` parameter contains the URL(s) and
62
+ * processing instructions (matching the WebFetch tool schema).
63
+ */
64
+ export declare function runWebFetch(prompt: string, urls: string[]): Promise<BackendResult>;
65
+ //# sourceMappingURL=webBackends.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webBackends.d.ts","sourceRoot":"","sources":["../../../src/implementations/web/webBackends.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEjF,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE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