@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,480 @@
1
+ /**
2
+ * React introspection injectables for the sandbox feedback bridge.
3
+ *
4
+ * Browser-context scripts (serialized source strings) that give the sandbox tools
5
+ * the same scan/grab/detect contract as the nexus-browser MCP — element results
6
+ * carry a unique `cssSelector`, React elements are enriched with a
7
+ * `react: { componentName, componentStack, props, sourceLocation }` field, and
8
+ * `detect` returns the detect_framework schema. Original implementation from the
9
+ * public React fiber conventions (`__reactFiber$*` host keys, the DevTools global
10
+ * hook protocol) — no external code or dependencies.
11
+ *
12
+ * Injection model:
13
+ * - PRELOAD_SCRIPT runs via page.addInitScript BEFORE any page script, so the
14
+ * DevTools-hook shim exists before React loads (renderer/version registration)
15
+ * and `window.__cortexReact` is available to runtime scripts.
16
+ * - DETECT/SCAN/GRAB are evaluated on demand via page.evaluate and degrade
17
+ * gracefully on non-React pages (fiber fields simply absent).
18
+ */
19
+ /**
20
+ * Pre-load: minimal DevTools hook shim (only when absent) + fiber utilities.
21
+ * The shim lets us read renderer count/version on prod React builds; the fiber
22
+ * utilities resolve a DOM node to its React fiber via the `__reactFiber$` /
23
+ * `__reactContainer$` host-instance keys (works without the hook, prod included).
24
+ */
25
+ export const PRELOAD_SCRIPT = `
26
+ (() => {
27
+ if (!window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
28
+ let n = 0;
29
+ window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {
30
+ renderers: new Map(),
31
+ supportsFiber: true,
32
+ inject(renderer) { const id = ++n; this.renderers.set(id, renderer); return id; },
33
+ on() {}, off() {}, sub() { return () => {}; },
34
+ onCommitFiberRoot() {}, onCommitFiberUnmount() {}, onPostCommitFiberRoot() {},
35
+ checkDCE() {}
36
+ };
37
+ }
38
+
39
+ const getFiber = (el) => {
40
+ let node = el;
41
+ while (node) {
42
+ const key = Object.keys(node).find(
43
+ (k) => k.startsWith('__reactFiber$') || k.startsWith('__reactContainer$')
44
+ );
45
+ if (key) return node[key];
46
+ node = node.parentElement;
47
+ }
48
+ return null;
49
+ };
50
+
51
+ const INTERNAL = /^(Fragment|Suspense|Profiler|StrictMode|Provider|Consumer|ForwardRef|Memo)$/;
52
+
53
+ const displayName = (type) => {
54
+ if (!type) return null;
55
+ if (typeof type === 'string') return null; // host component (div, span...)
56
+ return (
57
+ type.displayName || type.name ||
58
+ (type.render && (type.render.displayName || type.render.name)) ||
59
+ (type.type && displayName(type.type)) || null
60
+ );
61
+ };
62
+
63
+ const componentName = (fiber) => {
64
+ let f = fiber;
65
+ while (f) {
66
+ const name = displayName(f.type);
67
+ if (name && !INTERNAL.test(name)) return name;
68
+ f = f.return;
69
+ }
70
+ return null;
71
+ };
72
+
73
+ const componentStack = (fiber, max = 10) => {
74
+ const stack = [];
75
+ let f = fiber;
76
+ while (f && stack.length < max) {
77
+ const name = displayName(f.type);
78
+ if (name && !INTERNAL.test(name) && stack[stack.length - 1] !== name) stack.push(name);
79
+ f = f.return;
80
+ }
81
+ return stack;
82
+ };
83
+
84
+ const serializeProps = (fiber) => {
85
+ let f = fiber;
86
+ while (f && typeof f.type === 'string') f = f.return; // climb to the component fiber
87
+ const props = f && f.memoizedProps;
88
+ if (!props || typeof props !== 'object') return null;
89
+ const out = {};
90
+ for (const k of Object.keys(props).slice(0, 20)) {
91
+ if (k === 'children') continue;
92
+ const v = props[k];
93
+ const t = typeof v;
94
+ if (v === null || t === 'string' || t === 'number' || t === 'boolean') out[k] = v;
95
+ else if (t === 'function') out[k] = '[function]';
96
+ else if (Array.isArray(v)) out[k] = '[array:' + v.length + ']';
97
+ else if (t === 'object') out[k] = '[object]';
98
+ }
99
+ return out;
100
+ };
101
+
102
+ const sourceLocation = (fiber) => {
103
+ let f = fiber;
104
+ while (f) {
105
+ const src = f._debugSource || (f._debugOwner && f._debugOwner._debugSource);
106
+ if (src && src.fileName) {
107
+ return src.fileName + ':' + (src.lineNumber || 0) + (src.columnNumber ? ':' + src.columnNumber : '');
108
+ }
109
+ f = f.return;
110
+ }
111
+ return null;
112
+ };
113
+
114
+ // Render trace (react-scan role): accumulate per-component render counts/timings across
115
+ // React commits. Backed by sessionStorage so an incidental same-origin reload (e.g.
116
+ // InteractWithSandbox capturing a snapshot between start and stop) doesn't wipe it.
117
+ const TRACE_KEY = '__cortexRenderTrace';
118
+ const loadTrace = () => {
119
+ try { const s = sessionStorage.getItem(TRACE_KEY); if (s) return JSON.parse(s); } catch (e) {}
120
+ return { enabled: false, counts: {}, totalCommits: 0, startedAt: 0 };
121
+ };
122
+ const saveTrace = (t) => { try { sessionStorage.setItem(TRACE_KEY, JSON.stringify(t)); } catch (e) {} };
123
+ window.__cortexRenderTrace = loadTrace();
124
+ window.__cortexSaveTrace = saveTrace;
125
+
126
+ // A component fiber "rendered" this commit if newly mounted, or its props/state identity
127
+ // changed vs its previous (alternate) fiber. Profiler actualDuration (dev build) gives
128
+ // timing when present but isn't required for the render signal.
129
+ const didRender = (f) => {
130
+ const alt = f.alternate;
131
+ if (!alt) return true; // mounted this commit
132
+ if (alt.memoizedProps !== f.memoizedProps) return true; // new props
133
+ if (alt.memoizedState !== f.memoizedState) return true; // new state/hooks
134
+ return (f.actualDuration != null && f.actualDuration > 0 && f.actualDuration !== alt.actualDuration);
135
+ };
136
+
137
+ const hook = window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
138
+ const prevCommit = hook.onCommitFiberRoot;
139
+ hook.onCommitFiberRoot = function (id, root, ...rest) {
140
+ try {
141
+ if (root && root.current && window.__cortexReact) {
142
+ // Always stash the LIVE root (root.current) — the container DOM key can point at a
143
+ // stale double-buffer fiber, so the tree walker must start from here.
144
+ window.__cortexReact.__lastRoot = root.current;
145
+ const trace = window.__cortexRenderTrace;
146
+ if (trace && trace.enabled) {
147
+ trace.totalCommits++;
148
+ const seen = new Set();
149
+ const visit = (f) => {
150
+ if (!f || seen.has(f)) return;
151
+ seen.add(f);
152
+ const name = (typeof f.type !== 'string') ? displayName(f.type) : null;
153
+ if (name && !INTERNAL.test(name) && didRender(f)) {
154
+ const e = trace.counts[name] || (trace.counts[name] = { renders: 0, totalDurationMs: 0 });
155
+ e.renders++;
156
+ if (f.actualDuration != null) e.totalDurationMs += f.actualDuration;
157
+ }
158
+ visit(f.child);
159
+ visit(f.sibling);
160
+ };
161
+ visit(root.current);
162
+ saveTrace(trace); // persist across same-origin reloads
163
+ }
164
+ }
165
+ } catch (e) { /* never break React's commit */ }
166
+ if (typeof prevCommit === 'function') return prevCommit.call(this, id, root, ...rest);
167
+ };
168
+
169
+ window.__cortexReact = {
170
+ getFiber,
171
+ info(el) {
172
+ const fiber = getFiber(el);
173
+ if (!fiber) return null;
174
+ const name = componentName(fiber);
175
+ if (!name) return null;
176
+ return {
177
+ componentName: name,
178
+ componentStack: componentStack(fiber),
179
+ props: serializeProps(fiber),
180
+ sourceLocation: sourceLocation(fiber)
181
+ };
182
+ },
183
+ // Component hierarchy (component-tree role): host fibers collapsed, components only.
184
+ tree(el, maxDepth) {
185
+ // The container DOM key can point at a stale double-buffer fiber whose .child is null,
186
+ // and __lastRoot may not be set yet on the very first commit. Walk from a LIVE
187
+ // descendant host fiber (React keeps those current) and climb to the root.
188
+ let fiber = window.__cortexReact.__lastRoot || getFiber(el);
189
+ if (!fiber) return null;
190
+ while (fiber.return) fiber = fiber.return; // climb to the host root
191
+ // If the resolved root has no child but its alternate does, use the live one.
192
+ if (!fiber.child && fiber.alternate && fiber.alternate.child) fiber = fiber.alternate;
193
+ const build = (f, depth) => {
194
+ const name = (typeof f.type !== 'string') ? displayName(f.type) : null;
195
+ const isComponent = !!name && !INTERNAL.test(name);
196
+ let kids = [];
197
+ if (depth < maxDepth) {
198
+ let c = f.child;
199
+ while (c) { kids = kids.concat(build(c, isComponent ? depth + 1 : depth)); c = c.sibling; }
200
+ }
201
+ if (isComponent) {
202
+ const node = { name };
203
+ const src = f._debugSource || (f._debugOwner && f._debugOwner._debugSource);
204
+ if (src && src.fileName) node.source = src.fileName + ':' + (src.lineNumber || 0);
205
+ if (kids.length) node.children = kids;
206
+ return [node];
207
+ }
208
+ return kids; // host fiber: lift its component descendants up
209
+ };
210
+ return build(fiber, 0);
211
+ }
212
+ };
213
+ })();
214
+ `;
215
+ /**
216
+ * Runtime: framework detection. Return schema matches nexus-browser
217
+ * detect_framework: react/reactVersion/next/remix/gatsby/vue/svelte/angular/
218
+ * compiler/hasDevTools/rendererCount/heavyLibraries.
219
+ */
220
+ export const DETECT_SCRIPT = `
221
+ (() => {
222
+ const w = window;
223
+ const hook = w.__REACT_DEVTOOLS_GLOBAL_HOOK__;
224
+ const rendererCount = hook && hook.renderers ? hook.renderers.size : 0;
225
+ let reactVersion = null;
226
+ try {
227
+ if (rendererCount > 0) reactVersion = hook.renderers.values().next().value.version || null;
228
+ if (!reactVersion && w.React) reactVersion = w.React.version || null;
229
+ } catch (e) { /* version unavailable */ }
230
+ const react = rendererCount > 0 || !!w.React ||
231
+ !!document.querySelector('[data-reactroot], #root [class], #app [class]') &&
232
+ !!Object.keys(document.querySelector('#root') || {}).find((k) => k.startsWith('__react'));
233
+ const heavy = [];
234
+ const libs = {
235
+ 'monaco-editor': () => !!w.monaco, 'chart.js': () => !!w.Chart, three: () => !!w.THREE,
236
+ d3: () => !!w.d3, leaflet: () => !!w.L && !!w.L.map, 'pdf.js': () => !!w.pdfjsLib
237
+ };
238
+ for (const [name, test] of Object.entries(libs)) { try { if (test()) heavy.push(name); } catch (e) {} }
239
+ return {
240
+ react: !!react,
241
+ reactVersion,
242
+ next: !!w.__NEXT_DATA__,
243
+ remix: !!w.__remixContext,
244
+ gatsby: !!w.___gatsby,
245
+ vue: !!w.__VUE__ || !!w.__VUE_DEVTOOLS_GLOBAL_HOOK__ || !!document.querySelector('[data-v-app],[data-v-]'),
246
+ svelte: !!document.querySelector('[class*="svelte-"]'),
247
+ angular: !!w.ng || !!document.querySelector('[ng-version]'),
248
+ compiler: !!w.__REACT_COMPILER_RUNTIME__,
249
+ hasDevTools: !!hook,
250
+ rendererCount,
251
+ heavyLibraries: heavy
252
+ };
253
+ })()
254
+ `;
255
+ /**
256
+ * Runtime: element discovery. Returns the nexus-browser scan element shape —
257
+ * tagName/textContent/rect/isInteractive/relevanceScore/cssSelector (+ optional
258
+ * componentName when React is present). Args passed via evaluate(script, args).
259
+ */
260
+ export const SCAN_SCRIPT = `
261
+ (args) => {
262
+ args = args || {};
263
+ const limit = Math.max(1, Math.min(args.limit || 30, 100));
264
+ const filter = args.filter || {};
265
+ const includeOffscreen = !!args.includeOffscreen;
266
+ const vw = window.innerWidth, vh = window.innerHeight;
267
+ const region = args.region || { x: 0, y: 0, width: vw, height: vh };
268
+
269
+ const cssSelector = (el) => {
270
+ if (el.id && document.querySelectorAll('#' + CSS.escape(el.id)).length === 1) {
271
+ return '#' + CSS.escape(el.id);
272
+ }
273
+ const parts = [];
274
+ let node = el;
275
+ while (node && node !== document.body && parts.length < 6) {
276
+ let part = node.tagName.toLowerCase();
277
+ if (node.id) { parts.unshift(part + '#' + CSS.escape(node.id)); break; }
278
+ const parent = node.parentElement;
279
+ if (parent) {
280
+ const same = Array.from(parent.children).filter((c) => c.tagName === node.tagName);
281
+ if (same.length > 1) part += ':nth-of-type(' + (same.indexOf(node) + 1) + ')';
282
+ }
283
+ parts.unshift(part);
284
+ node = parent;
285
+ }
286
+ const sel = parts.join(' > ');
287
+ try {
288
+ if (document.querySelectorAll(sel).length === 1) return sel;
289
+ } catch (e) {}
290
+ return sel; // best-effort fallback (still scoped enough for most pages)
291
+ };
292
+
293
+ const INTERACTIVE_TAGS = ['a', 'button', 'input', 'select', 'textarea', 'details', 'summary', 'option', 'label'];
294
+ const isInteractive = (el) => {
295
+ const tag = el.tagName.toLowerCase();
296
+ if (INTERACTIVE_TAGS.includes(tag)) return true;
297
+ const role = el.getAttribute('role');
298
+ if (role && ['button', 'link', 'checkbox', 'radio', 'tab', 'menuitem', 'switch', 'slider', 'combobox'].includes(role)) return true;
299
+ if (el.hasAttribute('onclick') || (el.tabIndex >= 0 && tag !== 'body')) return true;
300
+ try { if (getComputedStyle(el).cursor === 'pointer') return true; } catch (e) {}
301
+ return false;
302
+ };
303
+
304
+ const score = (el, rect, interactive, text) => {
305
+ let s = 0;
306
+ if (interactive) s += 40;
307
+ if (text) s += 20;
308
+ if (el.id) s += 15;
309
+ if (el.getAttribute('name') || el.getAttribute('placeholder')) s += 10;
310
+ if (el.getAttribute('role')) s += 5;
311
+ const area = rect.width * rect.height;
312
+ if (area > 5000) s += 5; else if (area > 1000) s += 2;
313
+ return s;
314
+ };
315
+
316
+ const results = [];
317
+ const all = document.body ? document.body.querySelectorAll('*') : [];
318
+ for (const el of all) {
319
+ const tag = el.tagName.toLowerCase();
320
+ if (['script', 'style', 'meta', 'link', 'head', 'noscript'].includes(tag)) continue;
321
+ const rect = el.getBoundingClientRect();
322
+ if (rect.width === 0 && rect.height === 0) continue;
323
+ const offscreen = rect.bottom < region.y || rect.top > region.y + region.height ||
324
+ rect.right < region.x || rect.left > region.x + region.width;
325
+ if (offscreen && !includeOffscreen) continue;
326
+ let style;
327
+ try { style = getComputedStyle(el); } catch (e) { continue; }
328
+ if (style.display === 'none' || style.visibility === 'hidden') continue;
329
+
330
+ const interactive = isInteractive(el);
331
+ const text = (el.textContent || '').trim().slice(0, 50);
332
+
333
+ if (filter.tagName && tag !== String(filter.tagName).toLowerCase()) continue;
334
+ if (filter.isInteractive !== undefined && interactive !== filter.isInteractive) continue;
335
+ if (filter.hasText && !text.toLowerCase().includes(String(filter.hasText).toLowerCase())) continue;
336
+ if (filter.id && el.id !== filter.id) continue;
337
+ if (filter.className && !el.classList.contains(filter.className)) continue;
338
+ if (filter.placeholder && !(el.getAttribute('placeholder') || '').toLowerCase().includes(String(filter.placeholder).toLowerCase())) continue;
339
+ if (filter.name && el.getAttribute('name') !== filter.name) continue;
340
+
341
+ let componentName;
342
+ if (window.__cortexReact) {
343
+ const info = window.__cortexReact.info(el);
344
+ if (info) componentName = info.componentName;
345
+ }
346
+ if (filter.componentName && componentName !== filter.componentName) continue;
347
+
348
+ const entry = {
349
+ tagName: tag,
350
+ textContent: text || undefined,
351
+ rect: { x: Math.round(rect.x), y: Math.round(rect.y), width: Math.round(rect.width), height: Math.round(rect.height) },
352
+ isInteractive: interactive,
353
+ relevanceScore: score(el, rect, interactive, text),
354
+ cssSelector: cssSelector(el)
355
+ };
356
+ if (el.id) entry.id = el.id;
357
+ if (componentName) entry.componentName = componentName;
358
+ const placeholder = el.getAttribute('placeholder');
359
+ if (placeholder) entry.placeholder = placeholder;
360
+ const type = el.getAttribute('type');
361
+ if (type) entry.type = type;
362
+ const name = el.getAttribute('name');
363
+ if (name) entry.name = name;
364
+ if (offscreen) entry.isOffscreen = true;
365
+ results.push(entry);
366
+ }
367
+
368
+ results.sort((a, b) => b.relevanceScore - a.relevanceScore);
369
+ const truncated = results.length > limit;
370
+ return { count: Math.min(results.length, limit), elements: results.slice(0, limit), truncated };
371
+ }
372
+ `;
373
+ /**
374
+ * Runtime: single-element content query by selector or coordinates. Returns DOM
375
+ * detail plus `react: { componentName, componentStack, props, sourceLocation }`
376
+ * when the element belongs to a React tree (the nexus-browser grab enrichment
377
+ * field shape).
378
+ */
379
+ export const GRAB_SCRIPT = `
380
+ (args) => {
381
+ args = args || {};
382
+ let el = null;
383
+ if (args.selector) {
384
+ try { el = document.querySelector(args.selector); } catch (e) { return { error: 'Invalid selector: ' + e.message }; }
385
+ if (!el) return { error: 'No element matches selector: ' + args.selector };
386
+ } else if (typeof args.x === 'number' && typeof args.y === 'number') {
387
+ el = document.elementFromPoint(args.x, args.y);
388
+ if (!el) return { error: 'No element at (' + args.x + ', ' + args.y + ')' };
389
+ } else {
390
+ return { error: 'Provide selector or x/y coordinates' };
391
+ }
392
+
393
+ const rect = el.getBoundingClientRect();
394
+ const attrs = {};
395
+ for (const a of el.attributes) attrs[a.name] = a.value.length > 120 ? a.value.slice(0, 120) + '…' : a.value;
396
+ let style = {};
397
+ try {
398
+ const cs = getComputedStyle(el);
399
+ style = { display: cs.display, visibility: cs.visibility, position: cs.position, color: cs.color, fontSize: cs.fontSize, cursor: cs.cursor };
400
+ } catch (e) {}
401
+
402
+ const parents = [];
403
+ let p = el.parentElement;
404
+ while (p && p !== document.body && parents.length < 4) {
405
+ parents.push(p.tagName.toLowerCase() + (p.id ? '#' + p.id : '') + (p.className && typeof p.className === 'string' ? '.' + p.className.split(/\\s+/).slice(0, 2).join('.') : ''));
406
+ p = p.parentElement;
407
+ }
408
+
409
+ const result = {
410
+ tagName: el.tagName.toLowerCase(),
411
+ textContent: (el.textContent || '').trim().slice(0, args.maxLength || 500),
412
+ attributes: attrs,
413
+ rect: { x: Math.round(rect.x), y: Math.round(rect.y), width: Math.round(rect.width), height: Math.round(rect.height) },
414
+ computedStyle: style,
415
+ parentChain: parents,
416
+ htmlPreview: el.outerHTML.slice(0, 300)
417
+ };
418
+
419
+ if (window.__cortexReact) {
420
+ const info = window.__cortexReact.info(el);
421
+ if (info) result.react = info;
422
+ }
423
+ return result;
424
+ }
425
+ `;
426
+ /**
427
+ * Runtime: component hierarchy (component-tree role). Walks the React fiber tree from
428
+ * the root, host elements collapsed, components only. Args: { rootSelector?, maxDepth? }.
429
+ */
430
+ export const TREE_SCRIPT = `
431
+ (args) => {
432
+ args = args || {};
433
+ if (!window.__cortexReact || !window.__cortexReact.tree) return { error: 'React introspection not available on this page' };
434
+ // Use a LIVE descendant host element (React keeps its fiber current) rather than the
435
+ // root container itself (whose fiber key can be a stale double-buffer fiber).
436
+ const el = args.rootSelector ? document.querySelector(args.rootSelector)
437
+ : (document.querySelector('#root *, #app *, [data-reactroot] *') ||
438
+ (document.body && document.body.firstElementChild) || document.body);
439
+ const tree = window.__cortexReact.tree(el, args.maxDepth || 8);
440
+ if (!tree) return { error: 'No React tree found (is this a React page?)' };
441
+ // component count + max depth summary
442
+ let count = 0, maxDepth = 0;
443
+ const walk = (nodes, d) => { for (const n of nodes) { count++; maxDepth = Math.max(maxDepth, d); if (n.children) walk(n.children, d + 1); } };
444
+ walk(tree, 1);
445
+ return { tree, componentCount: count, maxDepth };
446
+ }
447
+ `;
448
+ /** Runtime: begin a render trace (resets + enables the commit interceptor). */
449
+ export const TRACE_START_SCRIPT = `
450
+ (() => {
451
+ if (!window.__cortexRenderTrace) return { error: 'React introspection not available on this page' };
452
+ window.__cortexRenderTrace = { enabled: true, counts: {}, totalCommits: 0, startedAt: Date.now() };
453
+ if (window.__cortexSaveTrace) window.__cortexSaveTrace(window.__cortexRenderTrace);
454
+ return { started: true };
455
+ })()
456
+ `;
457
+ /**
458
+ * Runtime: stop (or peek) a render trace and return per-component render counts/timings,
459
+ * sorted by render count (react-scan's "what re-rendered and how often").
460
+ */
461
+ export const TRACE_REPORT_SCRIPT = `
462
+ (args) => {
463
+ args = args || {};
464
+ const t = window.__cortexRenderTrace;
465
+ if (!t) return { error: 'React introspection not available on this page' };
466
+ if (args.stop !== false) { t.enabled = false; if (window.__cortexSaveTrace) window.__cortexSaveTrace(t); }
467
+ const components = Object.keys(t.counts).map((name) => ({
468
+ name,
469
+ renders: t.counts[name].renders,
470
+ totalDurationMs: Math.round(t.counts[name].totalDurationMs * 100) / 100
471
+ })).sort((a, b) => b.renders - a.renders);
472
+ return {
473
+ durationMs: t.startedAt ? Date.now() - t.startedAt : 0,
474
+ totalCommits: t.totalCommits,
475
+ components,
476
+ stopped: args.stop !== false
477
+ };
478
+ }
479
+ `;
480
+ //# sourceMappingURL=reactIntrospection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reactIntrospection.js","sourceRoot":"","sources":["../../../../src/implementations/addon/injectables/reactIntrospection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6L7B,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkC5B,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgH1B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8C1B,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;CAiB1B,CAAC;AAEF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;CAOjC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;CAkBlC,CAAC"}