@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,84 @@
1
+ /**
2
+ * H.264 Stream Encoder
3
+ *
4
+ * Encodes screenshot frames into H.264 video stream using FFmpeg.
5
+ * Provides differential encoding where only changed pixels are transmitted.
6
+ *
7
+ * Features:
8
+ * - Real-time H.264 encoding at configurable FPS
9
+ * - Automatic keyframe insertion
10
+ * - Low latency streaming
11
+ * - Efficient bandwidth usage (95%+ reduction for static content)
12
+ */
13
+ import { EventEmitter } from 'events';
14
+ export interface H264EncoderConfig {
15
+ fps?: number;
16
+ width?: number;
17
+ height?: number;
18
+ preset?: string;
19
+ crf?: number;
20
+ keyframeInterval?: number;
21
+ tune?: string;
22
+ }
23
+ export interface EncodedSegment {
24
+ data: Buffer;
25
+ timestamp: number;
26
+ sequenceNumber: number;
27
+ isKeyframe: boolean;
28
+ size: number;
29
+ }
30
+ /**
31
+ * H264StreamEncoder
32
+ *
33
+ * Real-time H.264 encoding for browser screenshots
34
+ * Optimized for static content with occasional changes
35
+ */
36
+ export declare class H264StreamEncoder extends EventEmitter {
37
+ private ffmpeg;
38
+ private config;
39
+ private sequenceNumber;
40
+ private buffer;
41
+ private isRunning;
42
+ private startTime;
43
+ constructor(config?: H264EncoderConfig);
44
+ /**
45
+ * Start the encoder
46
+ */
47
+ start(): void;
48
+ /**
49
+ * Add a frame to the encoder
50
+ */
51
+ addFrame(screenshot: Buffer): Promise<void>;
52
+ /**
53
+ * Stop the encoder
54
+ */
55
+ stop(): void;
56
+ /**
57
+ * Get the complete encoded stream so far
58
+ */
59
+ getEncodedStream(): Buffer;
60
+ /**
61
+ * Get the latest segment
62
+ */
63
+ getLatestSegment(): Buffer | null;
64
+ /**
65
+ * Get encoder statistics
66
+ */
67
+ getStats(): {
68
+ isRunning: boolean;
69
+ framesEncoded: number;
70
+ totalSize: number;
71
+ duration: number;
72
+ averageBitrate: number;
73
+ };
74
+ /**
75
+ * Check if data contains a keyframe (I-frame)
76
+ * H.264 NAL unit type 5 indicates IDR (keyframe)
77
+ */
78
+ private isKeyframeData;
79
+ /**
80
+ * Cleanup resources
81
+ */
82
+ destroy(): void;
83
+ }
84
+ //# sourceMappingURL=H264StreamEncoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"H264StreamEncoder.d.ts","sourceRoot":"","sources":["../../../src/implementations/addon/H264StreamEncoder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,YAAY;IACjD,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,SAAS,CAAa;gBAElB,MAAM,GAAE,iBAAsB;IAc1C;;OAEG;IACH,KAAK,IAAI,IAAI;IAqEb;;OAEG;IACG,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBjD;;OAEG;IACH,IAAI,IAAI,IAAI;IAmBZ;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAI1B;;OAEG;IACH,gBAAgB,IAAI,MAAM,GAAG,IAAI;IAMjC;;OAEG;IACH,QAAQ,IAAI;QACV,SAAS,EAAE,OAAO,CAAC;QACnB,aAAa,EAAE,MAAM,CAAC;QACtB,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,MAAM,CAAC;KACxB;IAaD;;;OAGG;IACH,OAAO,CAAC,cAAc;IAmBtB;;OAEG;IACH,OAAO,IAAI,IAAI;CAKhB"}
@@ -0,0 +1,203 @@
1
+ /**
2
+ * H.264 Stream Encoder
3
+ *
4
+ * Encodes screenshot frames into H.264 video stream using FFmpeg.
5
+ * Provides differential encoding where only changed pixels are transmitted.
6
+ *
7
+ * Features:
8
+ * - Real-time H.264 encoding at configurable FPS
9
+ * - Automatic keyframe insertion
10
+ * - Low latency streaming
11
+ * - Efficient bandwidth usage (95%+ reduction for static content)
12
+ */
13
+ import { spawn } from 'child_process';
14
+ import { EventEmitter } from 'events';
15
+ /**
16
+ * H264StreamEncoder
17
+ *
18
+ * Real-time H.264 encoding for browser screenshots
19
+ * Optimized for static content with occasional changes
20
+ */
21
+ export class H264StreamEncoder extends EventEmitter {
22
+ ffmpeg = null;
23
+ config;
24
+ sequenceNumber = 0;
25
+ buffer = [];
26
+ isRunning = false;
27
+ startTime = 0;
28
+ constructor(config = {}) {
29
+ super();
30
+ this.config = {
31
+ fps: config.fps ?? 2,
32
+ width: config.width ?? 1920,
33
+ height: config.height ?? 1080,
34
+ preset: config.preset ?? 'ultrafast',
35
+ crf: config.crf ?? 23,
36
+ keyframeInterval: config.keyframeInterval ?? 30,
37
+ tune: config.tune ?? 'stillimage'
38
+ };
39
+ }
40
+ /**
41
+ * Start the encoder
42
+ */
43
+ start() {
44
+ if (this.isRunning) {
45
+ console.warn('H264StreamEncoder already running');
46
+ return;
47
+ }
48
+ this.startTime = Date.now();
49
+ this.sequenceNumber = 0;
50
+ this.buffer = [];
51
+ // Launch FFmpeg process
52
+ this.ffmpeg = spawn('ffmpeg', [
53
+ // Input configuration
54
+ '-f', 'image2pipe', // Input format: image stream
55
+ '-framerate', this.config.fps.toString(),
56
+ '-s', `${this.config.width}x${this.config.height}`,
57
+ '-pix_fmt', 'rgb24', // Pixel format
58
+ '-i', '-', // Input from stdin
59
+ // Encoding configuration
60
+ '-c:v', 'libx264', // H.264 codec
61
+ '-preset', this.config.preset, // Encoding speed/quality tradeoff
62
+ '-tune', this.config.tune, // Optimize for static images
63
+ '-crf', this.config.crf.toString(), // Quality level
64
+ '-g', this.config.keyframeInterval.toString(), // Keyframe interval
65
+ '-pix_fmt', 'yuv420p', // Output pixel format
66
+ '-movflags', '+frag_keyframe+empty_moov', // Streaming-friendly
67
+ // Output configuration
68
+ '-f', 'h264', // Output format: raw H.264
69
+ '-' // Output to stdout
70
+ ], {
71
+ stdio: ['pipe', 'pipe', 'pipe']
72
+ });
73
+ // Handle encoded output
74
+ this.ffmpeg.stdout?.on('data', (chunk) => {
75
+ this.buffer.push(chunk);
76
+ // Emit segment
77
+ const segment = {
78
+ data: chunk,
79
+ timestamp: Date.now(),
80
+ sequenceNumber: this.sequenceNumber++,
81
+ isKeyframe: this.isKeyframeData(chunk),
82
+ size: chunk.length
83
+ };
84
+ this.emit('segment', segment);
85
+ });
86
+ // Handle errors
87
+ this.ffmpeg.stderr?.on('data', (data) => {
88
+ const msg = data.toString();
89
+ // Only emit actual errors, not progress info
90
+ if (msg.includes('error') || msg.includes('Error')) {
91
+ this.emit('error', new Error(msg));
92
+ }
93
+ });
94
+ this.ffmpeg.on('close', (code) => {
95
+ this.isRunning = false;
96
+ this.emit('close', code);
97
+ });
98
+ this.isRunning = true;
99
+ this.emit('start', { config: this.config });
100
+ }
101
+ /**
102
+ * Add a frame to the encoder
103
+ */
104
+ async addFrame(screenshot) {
105
+ if (!this.isRunning || !this.ffmpeg?.stdin) {
106
+ throw new Error('Encoder not running');
107
+ }
108
+ try {
109
+ // FFmpeg expects raw RGB24 data
110
+ // If screenshot is PNG, we need to decode it first
111
+ // For now, assume it's already in the correct format or will be handled by FFmpeg
112
+ const written = this.ffmpeg.stdin.write(screenshot);
113
+ if (!written) {
114
+ // Back pressure - wait for drain
115
+ await new Promise((resolve) => {
116
+ this.ffmpeg.stdin.once('drain', resolve);
117
+ });
118
+ }
119
+ }
120
+ catch (error) {
121
+ this.emit('error', error);
122
+ throw error;
123
+ }
124
+ }
125
+ /**
126
+ * Stop the encoder
127
+ */
128
+ stop() {
129
+ if (!this.isRunning || !this.ffmpeg) {
130
+ return;
131
+ }
132
+ // Close stdin to signal end of input
133
+ this.ffmpeg.stdin?.end();
134
+ // Wait a bit for FFmpeg to flush
135
+ setTimeout(() => {
136
+ if (this.ffmpeg) {
137
+ this.ffmpeg.kill('SIGTERM');
138
+ this.ffmpeg = null;
139
+ }
140
+ }, 1000);
141
+ this.isRunning = false;
142
+ }
143
+ /**
144
+ * Get the complete encoded stream so far
145
+ */
146
+ getEncodedStream() {
147
+ return Buffer.concat(this.buffer);
148
+ }
149
+ /**
150
+ * Get the latest segment
151
+ */
152
+ getLatestSegment() {
153
+ if (this.buffer.length === 0)
154
+ return null;
155
+ const last = this.buffer[this.buffer.length - 1];
156
+ return last ?? null;
157
+ }
158
+ /**
159
+ * Get encoder statistics
160
+ */
161
+ getStats() {
162
+ const totalSize = this.buffer.reduce((sum, buf) => sum + buf.length, 0);
163
+ const duration = (Date.now() - this.startTime) / 1000; // seconds
164
+ return {
165
+ isRunning: this.isRunning,
166
+ framesEncoded: this.sequenceNumber,
167
+ totalSize,
168
+ duration,
169
+ averageBitrate: duration > 0 ? (totalSize * 8) / duration : 0 // bits per second
170
+ };
171
+ }
172
+ /**
173
+ * Check if data contains a keyframe (I-frame)
174
+ * H.264 NAL unit type 5 indicates IDR (keyframe)
175
+ */
176
+ isKeyframeData(data) {
177
+ // H.264 NAL unit header: 0x00 0x00 0x00 0x01 [NAL type]
178
+ for (let i = 0; i < data.length - 4; i++) {
179
+ if (data[i] === 0x00 &&
180
+ data[i + 1] === 0x00 &&
181
+ data[i + 2] === 0x00 &&
182
+ data[i + 3] === 0x01) {
183
+ const nalTypeByte = data[i + 4];
184
+ if (nalTypeByte !== undefined) {
185
+ const nalType = nalTypeByte & 0x1f;
186
+ if (nalType === 5) { // IDR frame (keyframe)
187
+ return true;
188
+ }
189
+ }
190
+ }
191
+ }
192
+ return false;
193
+ }
194
+ /**
195
+ * Cleanup resources
196
+ */
197
+ destroy() {
198
+ this.stop();
199
+ this.removeAllListeners();
200
+ this.buffer = [];
201
+ }
202
+ }
203
+ //# sourceMappingURL=H264StreamEncoder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"H264StreamEncoder.js","sourceRoot":"","sources":["../../../src/implementations/addon/H264StreamEncoder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAoBtC;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACzC,MAAM,GAAwB,IAAI,CAAC;IACnC,MAAM,CAA8B;IACpC,cAAc,GAAW,CAAC,CAAC;IAC3B,MAAM,GAAa,EAAE,CAAC;IACtB,SAAS,GAAY,KAAK,CAAC;IAC3B,SAAS,GAAW,CAAC,CAAC;IAE9B,YAAY,SAA4B,EAAE;QACxC,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,MAAM,GAAG;YACZ,GAAG,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;YACpB,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,IAAI;YAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,IAA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wD;QACxD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI;gBAChB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI;gBACpB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI;gBACpB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;gBACzB,MAAM,WAAW,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;gBAChC,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;oBAC9B,MAAM,OAAO,GAAG,WAAW,GAAG,IAAI,CAAC;oBACnC,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC,CAAC,uBAAuB;wBAC1C,OAAO,IAAI,CAAC;oBACd,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,197 @@
1
+ /**
2
+ * Hybrid Screenshot Manager
3
+ *
4
+ * Orchestrates intelligent screenshot streaming with massive cost optimization.
5
+ * Combines H.264 streaming for user dashboard with smart keyframe selection
6
+ * and caching for vision API calls.
7
+ *
8
+ * Cost Reduction Strategy:
9
+ * - H.264 streaming for user dashboard (95%+ bandwidth reduction)
10
+ * - Smart keyframe detection (send only when needed)
11
+ * - Frame deduplication cache (avoid duplicate API calls)
12
+ * - Result: 99%+ cost reduction vs continuous screenshot streaming
13
+ *
14
+ * Architecture:
15
+ * - H264StreamEncoder: Efficient video streaming to user
16
+ * - KeyframeDetector: Intelligent trigger detection
17
+ * - FrameDiffCache: Duplicate frame elimination
18
+ * - VisualFeedbackBridge: Browser automation
19
+ */
20
+ import { EventEmitter } from 'events';
21
+ import { Page } from 'playwright';
22
+ import { H264EncoderConfig } from './H264StreamEncoder.js';
23
+ import { KeyframeConfig, KeyframeTrigger } from './KeyframeDetector.js';
24
+ import { CacheConfig, CacheResult } from './FrameDiffCache.js';
25
+ export interface HybridManagerConfig {
26
+ h264?: H264EncoderConfig;
27
+ keyframe?: KeyframeConfig;
28
+ cache?: CacheConfig;
29
+ screenshotFormat?: 'png' | 'jpeg';
30
+ screenshotQuality?: number;
31
+ enableH264Streaming?: boolean;
32
+ enableKeyframeDetection?: boolean;
33
+ enableCaching?: boolean;
34
+ maxAPICallsPerMinute?: number;
35
+ forceKeyframeInterval?: number;
36
+ }
37
+ export interface APIFrameRequest {
38
+ screenshot: Buffer;
39
+ trigger: KeyframeTrigger;
40
+ cacheResult: CacheResult;
41
+ timestamp: number;
42
+ sequenceNumber: number;
43
+ }
44
+ export interface HybridStats {
45
+ h264FramesEncoded: number;
46
+ h264TotalSize: number;
47
+ h264AverageBitrate: number;
48
+ keyframesDetected: number;
49
+ keyframesSentToAPI: number;
50
+ keyframesCached: number;
51
+ screenshotsToUser: number;
52
+ screenshotsToAPI: number;
53
+ estimatedCostWithoutOptimization: number;
54
+ estimatedCostWithOptimization: number;
55
+ costSavings: number;
56
+ costSavingsPercentage: number;
57
+ duration: number;
58
+ averageFPS: number;
59
+ bandwidth: {
60
+ h264: number;
61
+ screenshots: number;
62
+ savings: number;
63
+ };
64
+ }
65
+ /**
66
+ * HybridScreenshotManager - Intelligent screenshot streaming with cost optimization
67
+ *
68
+ * The complete solution for visual workspace streaming:
69
+ * - User sees real-time H.264 video stream (efficient, smooth)
70
+ * - Model receives only smart keyframes (cost-effective, accurate)
71
+ * - Caching eliminates duplicate API calls (maximum savings)
72
+ *
73
+ * @example
74
+ * const manager = new HybridScreenshotManager(page, {
75
+ * h264: { fps: 2, quality: 80 },
76
+ * keyframe: { domMutationThreshold: 50 },
77
+ * cache: { maxSize: 100, similarityThreshold: 0.95 },
78
+ * maxAPICallsPerMinute: 10
79
+ * });
80
+ *
81
+ * // For user dashboard
82
+ * manager.on('h264-segment', (segment) => {
83
+ * sendToUserDashboard(segment);
84
+ * });
85
+ *
86
+ * // For vision API
87
+ * manager.on('api-frame', async (request: APIFrameRequest) => {
88
+ * const result = await sendToVisionAPI(request.screenshot);
89
+ * console.log(`API call: ${request.trigger.reason}`);
90
+ * });
91
+ *
92
+ * await manager.start();
93
+ */
94
+ export declare class HybridScreenshotManager extends EventEmitter {
95
+ private page;
96
+ private config;
97
+ private h264Encoder;
98
+ private keyframeDetector;
99
+ private frameCache;
100
+ private isRunning;
101
+ private startTime;
102
+ private captureInterval;
103
+ private stats;
104
+ private apiCallTimestamps;
105
+ private lastForcedKeyframeTime;
106
+ constructor(page: Page, config?: HybridManagerConfig);
107
+ /**
108
+ * Start the hybrid manager
109
+ */
110
+ start(): Promise<void>;
111
+ /**
112
+ * Stop the hybrid manager
113
+ */
114
+ stop(): void;
115
+ /**
116
+ * Capture frame and process
117
+ */
118
+ private captureFrame;
119
+ /**
120
+ * Handle keyframe trigger
121
+ */
122
+ private handleKeyframe;
123
+ /**
124
+ * Check if we should make an API call (rate limiting)
125
+ */
126
+ private shouldMakeAPICall;
127
+ /**
128
+ * Manually trigger keyframe (for user requests)
129
+ */
130
+ triggerKeyframe(reason: string, metadata?: Record<string, any>): Promise<void>;
131
+ /**
132
+ * Get comprehensive statistics
133
+ */
134
+ getStats(): HybridStats;
135
+ /**
136
+ * Get cache statistics
137
+ */
138
+ getCacheStats(): import("./FrameDiffCache.js").CacheStats | null;
139
+ /**
140
+ * Get keyframe detector state
141
+ */
142
+ getDetectorState(): {
143
+ isRunning: boolean;
144
+ lastSnapshot: import("./KeyframeDetector.js").PageSnapshot | null;
145
+ config: Required<KeyframeConfig>;
146
+ } | null;
147
+ /**
148
+ * Get H.264 encoder statistics
149
+ */
150
+ getEncoderStats(): {
151
+ isRunning: boolean;
152
+ framesEncoded: number;
153
+ totalSize: number;
154
+ duration: number;
155
+ averageBitrate: number;
156
+ } | null;
157
+ /**
158
+ * Clear cache
159
+ */
160
+ clearCache(): void;
161
+ /**
162
+ * Optimize cache
163
+ */
164
+ optimizeCache(): {
165
+ cleared: number;
166
+ optimized: boolean;
167
+ } | null;
168
+ /**
169
+ * Export cache for persistence
170
+ */
171
+ exportCache(): {
172
+ hash: string;
173
+ buffer: string;
174
+ timestamp: number;
175
+ metadata?: Record<string, any>;
176
+ accessCount: number;
177
+ lastAccessed: number;
178
+ }[] | null;
179
+ /**
180
+ * Import cache from persistence
181
+ */
182
+ importCache(data: any): void;
183
+ /**
184
+ * Get state
185
+ */
186
+ getState(): {
187
+ isRunning: boolean;
188
+ startTime: number;
189
+ stats: HybridStats;
190
+ config: Required<HybridManagerConfig>;
191
+ };
192
+ /**
193
+ * Cleanup resources
194
+ */
195
+ destroy(): void;
196
+ }
197
+ //# sourceMappingURL=HybridScreenshotManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HybridScreenshotManager.d.ts","sourceRoot":"","sources":["../../../src/implementations/addon/HybridScreenshotManager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAqB,iBAAiB,EAAkB,MAAM,wBAAwB,CAAC;AAC9F,OAAO,EAAoB,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC1F,OAAO,EAAkB,WAAW,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAE/E,MAAM,WAAW,mBAAmB;IAElC,IAAI,CAAC,EAAE,iBAAiB,CAAC;IAGzB,QAAQ,CAAC,EAAE,cAAc,CAAC;IAG1B,KAAK,CAAC,EAAE,WAAW,CAAC;IAGpB,gBA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