@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.
- package/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +13 -0
- package/dist/ExecutorRegistry.d.ts +89 -0
- package/dist/ExecutorRegistry.d.ts.map +1 -0
- package/dist/ExecutorRegistry.js +219 -0
- package/dist/ExecutorRegistry.js.map +1 -0
- package/dist/base/BaseTool.d.ts +108 -0
- package/dist/base/BaseTool.d.ts.map +1 -0
- package/dist/base/BaseTool.js +111 -0
- package/dist/base/BaseTool.js.map +1 -0
- package/dist/base/ToolRegistry.d.ts +141 -0
- package/dist/base/ToolRegistry.d.ts.map +1 -0
- package/dist/base/ToolRegistry.js +241 -0
- package/dist/base/ToolRegistry.js.map +1 -0
- package/dist/base/ToolResult.d.ts +63 -0
- package/dist/base/ToolResult.d.ts.map +1 -0
- package/dist/base/ToolResult.js +8 -0
- package/dist/base/ToolResult.js.map +1 -0
- package/dist/base/index.d.ts +10 -0
- package/dist/base/index.d.ts.map +1 -0
- package/dist/base/index.js +8 -0
- package/dist/base/index.js.map +1 -0
- package/dist/implementations/addon/CreateArtifactTool.d.ts +221 -0
- package/dist/implementations/addon/CreateArtifactTool.d.ts.map +1 -0
- package/dist/implementations/addon/CreateArtifactTool.js +1042 -0
- package/dist/implementations/addon/CreateArtifactTool.js.map +1 -0
- package/dist/implementations/addon/FrameDiffCache.d.ts +166 -0
- package/dist/implementations/addon/FrameDiffCache.d.ts.map +1 -0
- package/dist/implementations/addon/FrameDiffCache.js +395 -0
- package/dist/implementations/addon/FrameDiffCache.js.map +1 -0
- package/dist/implementations/addon/H264StreamEncoder.d.ts +84 -0
- package/dist/implementations/addon/H264StreamEncoder.d.ts.map +1 -0
- package/dist/implementations/addon/H264StreamEncoder.js +203 -0
- package/dist/implementations/addon/H264StreamEncoder.js.map +1 -0
- package/dist/implementations/addon/HybridScreenshotManager.d.ts +197 -0
- package/dist/implementations/addon/HybridScreenshotManager.d.ts.map +1 -0
- package/dist/implementations/addon/HybridScreenshotManager.js +415 -0
- package/dist/implementations/addon/HybridScreenshotManager.js.map +1 -0
- package/dist/implementations/addon/InspectSandboxTool.d.ts +54 -0
- package/dist/implementations/addon/InspectSandboxTool.d.ts.map +1 -0
- package/dist/implementations/addon/InspectSandboxTool.js +226 -0
- package/dist/implementations/addon/InspectSandboxTool.js.map +1 -0
- package/dist/implementations/addon/InteractWithSandboxTool.d.ts +90 -0
- package/dist/implementations/addon/InteractWithSandboxTool.d.ts.map +1 -0
- package/dist/implementations/addon/InteractWithSandboxTool.js +367 -0
- package/dist/implementations/addon/InteractWithSandboxTool.js.map +1 -0
- package/dist/implementations/addon/KeyframeDetector.d.ts +140 -0
- package/dist/implementations/addon/KeyframeDetector.d.ts.map +1 -0
- package/dist/implementations/addon/KeyframeDetector.js +390 -0
- package/dist/implementations/addon/KeyframeDetector.js.map +1 -0
- package/dist/implementations/addon/ModifySandboxTool.d.ts +62 -0
- package/dist/implementations/addon/ModifySandboxTool.d.ts.map +1 -0
- package/dist/implementations/addon/ModifySandboxTool.js +266 -0
- package/dist/implementations/addon/ModifySandboxTool.js.map +1 -0
- package/dist/implementations/addon/ReactArtifactBuilder.d.ts +27 -0
- package/dist/implementations/addon/ReactArtifactBuilder.d.ts.map +1 -0
- package/dist/implementations/addon/ReactArtifactBuilder.js +198 -0
- package/dist/implementations/addon/ReactArtifactBuilder.js.map +1 -0
- package/dist/implementations/addon/SandboxEventBroadcaster.d.ts +143 -0
- package/dist/implementations/addon/SandboxEventBroadcaster.d.ts.map +1 -0
- package/dist/implementations/addon/SandboxEventBroadcaster.js +258 -0
- package/dist/implementations/addon/SandboxEventBroadcaster.js.map +1 -0
- package/dist/implementations/addon/SandboxIntrospectionTools.d.ts +77 -0
- package/dist/implementations/addon/SandboxIntrospectionTools.d.ts.map +1 -0
- package/dist/implementations/addon/SandboxIntrospectionTools.js +292 -0
- package/dist/implementations/addon/SandboxIntrospectionTools.js.map +1 -0
- package/dist/implementations/addon/SandboxViewServer.d.ts +127 -0
- package/dist/implementations/addon/SandboxViewServer.d.ts.map +1 -0
- package/dist/implementations/addon/SandboxViewServer.js +775 -0
- package/dist/implementations/addon/SandboxViewServer.js.map +1 -0
- package/dist/implementations/addon/ScreenStream.d.ts +149 -0
- package/dist/implementations/addon/ScreenStream.d.ts.map +1 -0
- package/dist/implementations/addon/ScreenStream.js +306 -0
- package/dist/implementations/addon/ScreenStream.js.map +1 -0
- package/dist/implementations/addon/StopSandboxTool.d.ts +61 -0
- package/dist/implementations/addon/StopSandboxTool.d.ts.map +1 -0
- package/dist/implementations/addon/StopSandboxTool.js +252 -0
- package/dist/implementations/addon/StopSandboxTool.js.map +1 -0
- package/dist/implementations/addon/TerminalSandbox.d.ts +111 -0
- package/dist/implementations/addon/TerminalSandbox.d.ts.map +1 -0
- package/dist/implementations/addon/TerminalSandbox.js +345 -0
- package/dist/implementations/addon/TerminalSandbox.js.map +1 -0
- package/dist/implementations/addon/VisualFeedbackBridge.d.ts +367 -0
- package/dist/implementations/addon/VisualFeedbackBridge.d.ts.map +1 -0
- package/dist/implementations/addon/VisualFeedbackBridge.js +888 -0
- package/dist/implementations/addon/VisualFeedbackBridge.js.map +1 -0
- package/dist/implementations/addon/WindowManager.d.ts +138 -0
- package/dist/implementations/addon/WindowManager.d.ts.map +1 -0
- package/dist/implementations/addon/WindowManager.js +276 -0
- package/dist/implementations/addon/WindowManager.js.map +1 -0
- package/dist/implementations/addon/index.d.ts +29 -0
- package/dist/implementations/addon/index.d.ts.map +1 -0
- package/dist/implementations/addon/index.js +29 -0
- package/dist/implementations/addon/index.js.map +1 -0
- package/dist/implementations/addon/injectables/reactIntrospection.d.ts +57 -0
- package/dist/implementations/addon/injectables/reactIntrospection.d.ts.map +1 -0
- package/dist/implementations/addon/injectables/reactIntrospection.js +480 -0
- package/dist/implementations/addon/injectables/reactIntrospection.js.map +1 -0
- package/dist/implementations/addon/terminal-client.html +253 -0
- package/dist/implementations/agent/PRAgentTool.d.ts +37 -0
- package/dist/implementations/agent/PRAgentTool.d.ts.map +1 -0
- package/dist/implementations/agent/PRAgentTool.js +257 -0
- package/dist/implementations/agent/PRAgentTool.js.map +1 -0
- package/dist/implementations/agent/TaskTool.d.ts +76 -0
- package/dist/implementations/agent/TaskTool.d.ts.map +1 -0
- package/dist/implementations/agent/TaskTool.js +424 -0
- package/dist/implementations/agent/TaskTool.js.map +1 -0
- package/dist/implementations/agent/index.d.ts +5 -0
- package/dist/implementations/agent/index.d.ts.map +1 -0
- package/dist/implementations/agent/index.js +3 -0
- package/dist/implementations/agent/index.js.map +1 -0
- package/dist/implementations/execution/BackgroundProcessRegistry.d.ts +68 -0
- package/dist/implementations/execution/BackgroundProcessRegistry.d.ts.map +1 -0
- package/dist/implementations/execution/BackgroundProcessRegistry.js +146 -0
- package/dist/implementations/execution/BackgroundProcessRegistry.js.map +1 -0
- package/dist/implementations/execution/BashOutputTool.d.ts +42 -0
- package/dist/implementations/execution/BashOutputTool.d.ts.map +1 -0
- package/dist/implementations/execution/BashOutputTool.js +168 -0
- package/dist/implementations/execution/BashOutputTool.js.map +1 -0
- package/dist/implementations/execution/CodeExecuteTool.d.ts +31 -0
- package/dist/implementations/execution/CodeExecuteTool.d.ts.map +1 -0
- package/dist/implementations/execution/CodeExecuteTool.js +127 -0
- package/dist/implementations/execution/CodeExecuteTool.js.map +1 -0
- package/dist/implementations/execution/KillShellTool.d.ts +37 -0
- package/dist/implementations/execution/KillShellTool.d.ts.map +1 -0
- package/dist/implementations/execution/KillShellTool.js +144 -0
- package/dist/implementations/execution/KillShellTool.js.map +1 -0
- package/dist/implementations/execution/SearchToolsTool.d.ts +32 -0
- package/dist/implementations/execution/SearchToolsTool.d.ts.map +1 -0
- package/dist/implementations/execution/SearchToolsTool.js +109 -0
- package/dist/implementations/execution/SearchToolsTool.js.map +1 -0
- package/dist/implementations/execution/ShellTool.d.ts +108 -0
- package/dist/implementations/execution/ShellTool.d.ts.map +1 -0
- package/dist/implementations/execution/ShellTool.js +546 -0
- package/dist/implementations/execution/ShellTool.js.map +1 -0
- package/dist/implementations/execution/WorkspaceManagerTool.d.ts +40 -0
- package/dist/implementations/execution/WorkspaceManagerTool.d.ts.map +1 -0
- package/dist/implementations/execution/WorkspaceManagerTool.js +370 -0
- package/dist/implementations/execution/WorkspaceManagerTool.js.map +1 -0
- package/dist/implementations/execution/index.d.ts +13 -0
- package/dist/implementations/execution/index.d.ts.map +1 -0
- package/dist/implementations/execution/index.js +13 -0
- package/dist/implementations/execution/index.js.map +1 -0
- package/dist/implementations/extensions/EndTurnTool.d.ts +62 -0
- package/dist/implementations/extensions/EndTurnTool.d.ts.map +1 -0
- package/dist/implementations/extensions/EndTurnTool.js +172 -0
- package/dist/implementations/extensions/EndTurnTool.js.map +1 -0
- package/dist/implementations/extensions/ResearchBacklogTool.d.ts +37 -0
- package/dist/implementations/extensions/ResearchBacklogTool.d.ts.map +1 -0
- package/dist/implementations/extensions/ResearchBacklogTool.js +102 -0
- package/dist/implementations/extensions/ResearchBacklogTool.js.map +1 -0
- package/dist/implementations/extensions/SkillTool.d.ts +108 -0
- package/dist/implementations/extensions/SkillTool.d.ts.map +1 -0
- package/dist/implementations/extensions/SkillTool.js +351 -0
- package/dist/implementations/extensions/SkillTool.js.map +1 -0
- package/dist/implementations/extensions/SlashCommandTool.d.ts +112 -0
- package/dist/implementations/extensions/SlashCommandTool.d.ts.map +1 -0
- package/dist/implementations/extensions/SlashCommandTool.js +315 -0
- package/dist/implementations/extensions/SlashCommandTool.js.map +1 -0
- package/dist/implementations/extensions/index.d.ts +14 -0
- package/dist/implementations/extensions/index.d.ts.map +1 -0
- package/dist/implementations/extensions/index.js +10 -0
- package/dist/implementations/extensions/index.js.map +1 -0
- package/dist/implementations/file/EditTool.d.ts +232 -0
- package/dist/implementations/file/EditTool.d.ts.map +1 -0
- package/dist/implementations/file/EditTool.js +707 -0
- package/dist/implementations/file/EditTool.js.map +1 -0
- package/dist/implementations/file/ReadFileTool.d.ts +49 -0
- package/dist/implementations/file/ReadFileTool.d.ts.map +1 -0
- package/dist/implementations/file/ReadFileTool.js +225 -0
- package/dist/implementations/file/ReadFileTool.js.map +1 -0
- package/dist/implementations/file/WriteBinaryTool.d.ts +21 -0
- package/dist/implementations/file/WriteBinaryTool.d.ts.map +1 -0
- package/dist/implementations/file/WriteBinaryTool.js +153 -0
- package/dist/implementations/file/WriteBinaryTool.js.map +1 -0
- package/dist/implementations/file/WriteFileTool.d.ts +41 -0
- package/dist/implementations/file/WriteFileTool.d.ts.map +1 -0
- package/dist/implementations/file/WriteFileTool.js +220 -0
- package/dist/implementations/file/WriteFileTool.js.map +1 -0
- package/dist/implementations/file/index.d.ts +8 -0
- package/dist/implementations/file/index.d.ts.map +1 -0
- package/dist/implementations/file/index.js +8 -0
- package/dist/implementations/file/index.js.map +1 -0
- package/dist/implementations/historical/GetConversationSegmentTool.d.ts +44 -0
- package/dist/implementations/historical/GetConversationSegmentTool.d.ts.map +1 -0
- package/dist/implementations/historical/GetConversationSegmentTool.js +220 -0
- package/dist/implementations/historical/GetConversationSegmentTool.js.map +1 -0
- package/dist/implementations/historical/ListCompactionBoundariesTool.d.ts +36 -0
- package/dist/implementations/historical/ListCompactionBoundariesTool.d.ts.map +1 -0
- package/dist/implementations/historical/ListCompactionBoundariesTool.js +174 -0
- package/dist/implementations/historical/ListCompactionBoundariesTool.js.map +1 -0
- package/dist/implementations/historical/ListSessionsTool.d.ts +38 -0
- package/dist/implementations/historical/ListSessionsTool.d.ts.map +1 -0
- package/dist/implementations/historical/ListSessionsTool.js +140 -0
- package/dist/implementations/historical/ListSessionsTool.js.map +1 -0
- package/dist/implementations/historical/LoadSessionTool.d.ts +39 -0
- package/dist/implementations/historical/LoadSessionTool.d.ts.map +1 -0
- package/dist/implementations/historical/LoadSessionTool.js +171 -0
- package/dist/implementations/historical/LoadSessionTool.js.map +1 -0
- package/dist/implementations/historical/RequestHistoricalContextTool.d.ts +46 -0
- package/dist/implementations/historical/RequestHistoricalContextTool.d.ts.map +1 -0
- package/dist/implementations/historical/RequestHistoricalContextTool.js +224 -0
- package/dist/implementations/historical/RequestHistoricalContextTool.js.map +1 -0
- package/dist/implementations/historical/SearchConversationHistoryTool.d.ts +51 -0
- package/dist/implementations/historical/SearchConversationHistoryTool.d.ts.map +1 -0
- package/dist/implementations/historical/SearchConversationHistoryTool.js +306 -0
- package/dist/implementations/historical/SearchConversationHistoryTool.js.map +1 -0
- package/dist/implementations/historical/index.d.ts +12 -0
- package/dist/implementations/historical/index.d.ts.map +1 -0
- package/dist/implementations/historical/index.js +12 -0
- package/dist/implementations/historical/index.js.map +1 -0
- package/dist/implementations/index.d.ts +16 -0
- package/dist/implementations/index.d.ts.map +1 -0
- package/dist/implementations/index.js +28 -0
- package/dist/implementations/index.js.map +1 -0
- package/dist/implementations/mcp/DiscoveredMcpTool.d.ts +58 -0
- package/dist/implementations/mcp/DiscoveredMcpTool.d.ts.map +1 -0
- package/dist/implementations/mcp/DiscoveredMcpTool.js +269 -0
- package/dist/implementations/mcp/DiscoveredMcpTool.js.map +1 -0
- package/dist/implementations/mcp/index.d.ts +9 -0
- package/dist/implementations/mcp/index.d.ts.map +1 -0
- package/dist/implementations/mcp/index.js +8 -0
- package/dist/implementations/mcp/index.js.map +1 -0
- package/dist/implementations/notebook/NotebookEditTool.d.ts +96 -0
- package/dist/implementations/notebook/NotebookEditTool.d.ts.map +1 -0
- package/dist/implementations/notebook/NotebookEditTool.js +390 -0
- package/dist/implementations/notebook/NotebookEditTool.js.map +1 -0
- package/dist/implementations/notebook/index.d.ts +7 -0
- package/dist/implementations/notebook/index.d.ts.map +1 -0
- package/dist/implementations/notebook/index.js +7 -0
- package/dist/implementations/notebook/index.js.map +1 -0
- package/dist/implementations/search/GlobTool.d.ts +73 -0
- package/dist/implementations/search/GlobTool.d.ts.map +1 -0
- package/dist/implementations/search/GlobTool.js +213 -0
- package/dist/implementations/search/GlobTool.js.map +1 -0
- package/dist/implementations/search/GrepTool.d.ts +102 -0
- package/dist/implementations/search/GrepTool.d.ts.map +1 -0
- package/dist/implementations/search/GrepTool.js +754 -0
- package/dist/implementations/search/GrepTool.js.map +1 -0
- package/dist/implementations/search/index.d.ts +6 -0
- package/dist/implementations/search/index.d.ts.map +1 -0
- package/dist/implementations/search/index.js +6 -0
- package/dist/implementations/search/index.js.map +1 -0
- package/dist/implementations/tmux/TmuxSessionTool.d.ts +82 -0
- package/dist/implementations/tmux/TmuxSessionTool.d.ts.map +1 -0
- package/dist/implementations/tmux/TmuxSessionTool.js +371 -0
- package/dist/implementations/tmux/TmuxSessionTool.js.map +1 -0
- package/dist/implementations/tmux/TmuxViewServer.d.ts +86 -0
- package/dist/implementations/tmux/TmuxViewServer.d.ts.map +1 -0
- package/dist/implementations/tmux/TmuxViewServer.js +480 -0
- package/dist/implementations/tmux/TmuxViewServer.js.map +1 -0
- package/dist/implementations/tmux/index.d.ts +6 -0
- package/dist/implementations/tmux/index.d.ts.map +1 -0
- package/dist/implementations/tmux/index.js +6 -0
- package/dist/implementations/tmux/index.js.map +1 -0
- package/dist/implementations/ui/AskUserQuestionTool.d.ts +77 -0
- package/dist/implementations/ui/AskUserQuestionTool.d.ts.map +1 -0
- package/dist/implementations/ui/AskUserQuestionTool.js +241 -0
- package/dist/implementations/ui/AskUserQuestionTool.js.map +1 -0
- package/dist/implementations/ui/ExitPlanModeTool.d.ts +44 -0
- package/dist/implementations/ui/ExitPlanModeTool.d.ts.map +1 -0
- package/dist/implementations/ui/ExitPlanModeTool.js +150 -0
- package/dist/implementations/ui/ExitPlanModeTool.js.map +1 -0
- package/dist/implementations/ui/TodoWriteTool.d.ts +59 -0
- package/dist/implementations/ui/TodoWriteTool.d.ts.map +1 -0
- package/dist/implementations/ui/TodoWriteTool.js +315 -0
- package/dist/implementations/ui/TodoWriteTool.js.map +1 -0
- package/dist/implementations/ui/index.d.ts +9 -0
- package/dist/implementations/ui/index.d.ts.map +1 -0
- package/dist/implementations/ui/index.js +9 -0
- package/dist/implementations/ui/index.js.map +1 -0
- package/dist/implementations/web/BrowseTool.d.ts +43 -0
- package/dist/implementations/web/BrowseTool.d.ts.map +1 -0
- package/dist/implementations/web/BrowseTool.js +181 -0
- package/dist/implementations/web/BrowseTool.js.map +1 -0
- package/dist/implementations/web/SandboxTransferTool.d.ts +30 -0
- package/dist/implementations/web/SandboxTransferTool.d.ts.map +1 -0
- package/dist/implementations/web/SandboxTransferTool.js +261 -0
- package/dist/implementations/web/SandboxTransferTool.js.map +1 -0
- package/dist/implementations/web/WebFetchTool.d.ts +93 -0
- package/dist/implementations/web/WebFetchTool.d.ts.map +1 -0
- package/dist/implementations/web/WebFetchTool.js +484 -0
- package/dist/implementations/web/WebFetchTool.js.map +1 -0
- package/dist/implementations/web/WebSearchTool.d.ts +53 -0
- package/dist/implementations/web/WebSearchTool.d.ts.map +1 -0
- package/dist/implementations/web/WebSearchTool.js +227 -0
- package/dist/implementations/web/WebSearchTool.js.map +1 -0
- package/dist/implementations/web/escalateDirective.d.ts +11 -0
- package/dist/implementations/web/escalateDirective.d.ts.map +1 -0
- package/dist/implementations/web/escalateDirective.js +20 -0
- package/dist/implementations/web/escalateDirective.js.map +1 -0
- package/dist/implementations/web/index.d.ts +10 -0
- package/dist/implementations/web/index.d.ts.map +1 -0
- package/dist/implementations/web/index.js +10 -0
- package/dist/implementations/web/index.js.map +1 -0
- package/dist/implementations/web/webBackends.d.ts +65 -0
- package/dist/implementations/web/webBackends.d.ts.map +1 -0
- package/dist/implementations/web/webBackends.js +430 -0
- package/dist/implementations/web/webBackends.js.map +1 -0
- package/dist/implementations/web/webFetchRequestInit.d.ts +9 -0
- package/dist/implementations/web/webFetchRequestInit.d.ts.map +1 -0
- package/dist/implementations/web/webFetchRequestInit.js +21 -0
- package/dist/implementations/web/webFetchRequestInit.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/ArtifactRegistry.d.ts +138 -0
- package/dist/utils/ArtifactRegistry.d.ts.map +1 -0
- package/dist/utils/ArtifactRegistry.js +259 -0
- package/dist/utils/ArtifactRegistry.js.map +1 -0
- package/dist/utils/ChromiumBrowserManager.d.ts +56 -0
- package/dist/utils/ChromiumBrowserManager.d.ts.map +1 -0
- package/dist/utils/ChromiumBrowserManager.js +243 -0
- package/dist/utils/ChromiumBrowserManager.js.map +1 -0
- package/dist/utils/FileUtils.d.ts +81 -0
- package/dist/utils/FileUtils.d.ts.map +1 -0
- package/dist/utils/FileUtils.js +148 -0
- package/dist/utils/FileUtils.js.map +1 -0
- package/dist/utils/GitPolicy.d.ts +70 -0
- package/dist/utils/GitPolicy.d.ts.map +1 -0
- package/dist/utils/GitPolicy.js +166 -0
- package/dist/utils/GitPolicy.js.map +1 -0
- package/dist/utils/GitUtils.d.ts +18 -0
- package/dist/utils/GitUtils.d.ts.map +1 -0
- package/dist/utils/GitUtils.js +62 -0
- package/dist/utils/GitUtils.js.map +1 -0
- package/dist/utils/SandboxRegistry.d.ts +110 -0
- package/dist/utils/SandboxRegistry.d.ts.map +1 -0
- package/dist/utils/SandboxRegistry.js +220 -0
- package/dist/utils/SandboxRegistry.js.map +1 -0
- package/dist/utils/SchemaValidator.d.ts +21 -0
- package/dist/utils/SchemaValidator.d.ts.map +1 -0
- package/dist/utils/SchemaValidator.js +67 -0
- package/dist/utils/SchemaValidator.js.map +1 -0
- package/dist/utils/SessionLock.d.ts +96 -0
- package/dist/utils/SessionLock.d.ts.map +1 -0
- package/dist/utils/SessionLock.js +276 -0
- package/dist/utils/SessionLock.js.map +1 -0
- package/dist/utils/SessionPersistence.d.ts +89 -0
- package/dist/utils/SessionPersistence.d.ts.map +1 -0
- package/dist/utils/SessionPersistence.js +244 -0
- package/dist/utils/SessionPersistence.js.map +1 -0
- package/dist/utils/TextUtils.d.ts +77 -0
- package/dist/utils/TextUtils.d.ts.map +1 -0
- package/dist/utils/TextUtils.js +112 -0
- package/dist/utils/TextUtils.js.map +1 -0
- package/dist/utils/TmuxCapture.d.ts +94 -0
- package/dist/utils/TmuxCapture.d.ts.map +1 -0
- package/dist/utils/TmuxCapture.js +131 -0
- package/dist/utils/TmuxCapture.js.map +1 -0
- package/dist/utils/TmuxManager.d.ts +65 -0
- package/dist/utils/TmuxManager.d.ts.map +1 -0
- package/dist/utils/TmuxManager.js +304 -0
- package/dist/utils/TmuxManager.js.map +1 -0
- package/dist/utils/autoResearchPlanGate.d.ts +10 -0
- package/dist/utils/autoResearchPlanGate.d.ts.map +1 -0
- package/dist/utils/autoResearchPlanGate.js +57 -0
- package/dist/utils/autoResearchPlanGate.js.map +1 -0
- package/dist/utils/index.d.ts +19 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +13 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +83 -0
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { BaseTool } from '../../base/BaseTool.js';
|
|
2
|
+
import { CreateArtifactToolExecutor } from './CreateArtifactTool.js';
|
|
3
|
+
import { visualBridge } from './VisualFeedbackBridge.js';
|
|
4
|
+
import { broadcaster } from './SandboxEventBroadcaster.js';
|
|
5
|
+
/**
|
|
6
|
+
* InteractWithSandboxTool - Interact with sandbox UI via Playwright
|
|
7
|
+
*
|
|
8
|
+
* This tool allows the model to interact with the sandbox UI programmatically:
|
|
9
|
+
* - Click buttons, links, elements
|
|
10
|
+
* - Type into inputs, textareas
|
|
11
|
+
* - Navigate to different URLs
|
|
12
|
+
* - Scroll, hover, select
|
|
13
|
+
* - Wait for animations/updates
|
|
14
|
+
* - Press keyboard shortcuts (Ctrl+V, Ctrl+S, etc.)
|
|
15
|
+
* - Zoom in/out
|
|
16
|
+
*
|
|
17
|
+
* Use Cases:
|
|
18
|
+
* 1. Testing - Click buttons to verify functionality
|
|
19
|
+
* 2. Form filling - Type into inputs to test forms
|
|
20
|
+
* 3. Navigation - Test multi-page flows
|
|
21
|
+
* 4. Data entry - Populate UI with test data
|
|
22
|
+
* 5. Visual regression - Capture UI states during interactions
|
|
23
|
+
* 6. Code pasting - Paste code snippets with Ctrl+V
|
|
24
|
+
* 7. Visual inspection - Zoom to see details
|
|
25
|
+
*
|
|
26
|
+
* Example:
|
|
27
|
+
* ```typescript
|
|
28
|
+
* // Model tests a form
|
|
29
|
+
* await interactWithSandbox({
|
|
30
|
+
* sandboxId: "abc-123",
|
|
31
|
+
* actions: [
|
|
32
|
+
* { type: "type", selector: "#username", value: "testuser" },
|
|
33
|
+
* { type: "type", selector: "#password", value: "pass123" },
|
|
34
|
+
* { type: "click", selector: "#submit-btn" },
|
|
35
|
+
* { type: "wait", duration: 1000 }
|
|
36
|
+
* ],
|
|
37
|
+
* returnFinalSnapshot: true
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // Model pastes code into editor
|
|
41
|
+
* await interactWithSandbox({
|
|
42
|
+
* sandboxId: "abc-123",
|
|
43
|
+
* actions: [
|
|
44
|
+
* { type: "click", selector: "#code-editor" },
|
|
45
|
+
* { type: "keypress", key: "Ctrl+V" }, // Paste from clipboard
|
|
46
|
+
* { type: "keypress", key: "Ctrl+S" }, // Save
|
|
47
|
+
* { type: "zoom", zoomLevel: 1.5 } // Zoom 150%
|
|
48
|
+
* ]
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export class InteractWithSandboxExecutor extends BaseTool {
|
|
53
|
+
constructor() {
|
|
54
|
+
const schema = {
|
|
55
|
+
type: 'object',
|
|
56
|
+
properties: {
|
|
57
|
+
sandboxId: {
|
|
58
|
+
type: 'string',
|
|
59
|
+
description: 'Unique ID of the sandbox to interact with'
|
|
60
|
+
},
|
|
61
|
+
actions: {
|
|
62
|
+
type: 'array',
|
|
63
|
+
items: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
properties: {
|
|
66
|
+
type: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
enum: ['click', 'type', 'navigate', 'scroll', 'hover', 'select', 'wait', 'keypress', 'zoom'],
|
|
69
|
+
description: 'Type of interaction'
|
|
70
|
+
},
|
|
71
|
+
selector: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
description: 'CSS selector for the element (required for most actions)'
|
|
74
|
+
},
|
|
75
|
+
value: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
description: 'Value to type or select (for type/select actions)'
|
|
78
|
+
},
|
|
79
|
+
coordinates: {
|
|
80
|
+
type: 'object',
|
|
81
|
+
properties: {
|
|
82
|
+
x: { type: 'number' },
|
|
83
|
+
y: { type: 'number' }
|
|
84
|
+
},
|
|
85
|
+
description: 'Screen coordinates (for click without selector)'
|
|
86
|
+
},
|
|
87
|
+
duration: {
|
|
88
|
+
type: 'number',
|
|
89
|
+
description: 'Duration in milliseconds (for wait action)'
|
|
90
|
+
},
|
|
91
|
+
key: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
description: 'Key to press (for keypress action): Enter, Escape, Ctrl+V, etc.'
|
|
94
|
+
},
|
|
95
|
+
modifiers: {
|
|
96
|
+
type: 'array',
|
|
97
|
+
items: { type: 'string' },
|
|
98
|
+
description: 'Modifier keys (for keypress action): Control, Shift, Alt, Meta'
|
|
99
|
+
},
|
|
100
|
+
zoomLevel: {
|
|
101
|
+
type: 'number',
|
|
102
|
+
description: 'Zoom level (for zoom action): 1.0 = 100%, 1.5 = 150%, 0.5 = 50%'
|
|
103
|
+
},
|
|
104
|
+
deltaX: {
|
|
105
|
+
type: 'number',
|
|
106
|
+
description: 'Horizontal scroll delta (for scroll action)'
|
|
107
|
+
},
|
|
108
|
+
deltaY: {
|
|
109
|
+
type: 'number',
|
|
110
|
+
description: 'Vertical scroll delta (for scroll action)'
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
required: ['type']
|
|
114
|
+
},
|
|
115
|
+
description: 'Sequence of actions to perform'
|
|
116
|
+
},
|
|
117
|
+
captureAfterEachAction: {
|
|
118
|
+
type: 'boolean',
|
|
119
|
+
description: 'Capture screenshot after each action (default: false, useful for debugging)'
|
|
120
|
+
},
|
|
121
|
+
returnFinalSnapshot: {
|
|
122
|
+
type: 'boolean',
|
|
123
|
+
description: 'Return visual snapshot after all actions complete (default: true)'
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
required: ['sandboxId', 'actions']
|
|
127
|
+
};
|
|
128
|
+
super('InteractWithSandbox', 'InteractWithSandbox', 'Interact with sandbox UI (click, type, navigate, etc.) via browser automation', schema);
|
|
129
|
+
}
|
|
130
|
+
validateToolParams(params) {
|
|
131
|
+
if (!params.sandboxId || params.sandboxId.trim().length === 0) {
|
|
132
|
+
return 'sandboxId is required';
|
|
133
|
+
}
|
|
134
|
+
if (!params.actions || params.actions.length === 0) {
|
|
135
|
+
return 'actions array cannot be empty';
|
|
136
|
+
}
|
|
137
|
+
// Validate each action
|
|
138
|
+
for (let i = 0; i < params.actions.length; i++) {
|
|
139
|
+
const action = params.actions[i];
|
|
140
|
+
if (!action) {
|
|
141
|
+
return `Action ${i}: action is undefined`;
|
|
142
|
+
}
|
|
143
|
+
if (!action.type) {
|
|
144
|
+
return `Action ${i}: type is required`;
|
|
145
|
+
}
|
|
146
|
+
// Validate action-specific requirements
|
|
147
|
+
if (action.type === 'click' && !action.selector && !action.coordinates) {
|
|
148
|
+
return `Action ${i}: click requires either selector or coordinates`;
|
|
149
|
+
}
|
|
150
|
+
if (action.type === 'type' && !action.selector) {
|
|
151
|
+
return `Action ${i}: type requires selector`;
|
|
152
|
+
}
|
|
153
|
+
if (action.type === 'type' && !action.value) {
|
|
154
|
+
return `Action ${i}: type requires value`;
|
|
155
|
+
}
|
|
156
|
+
if (action.type === 'navigate' && !action.value) {
|
|
157
|
+
return `Action ${i}: navigate requires value (URL)`;
|
|
158
|
+
}
|
|
159
|
+
if (action.type === 'scroll' && !action.coordinates && !action.selector) {
|
|
160
|
+
return `Action ${i}: scroll requires coordinates or selector`;
|
|
161
|
+
}
|
|
162
|
+
if (action.type === 'select' && (!action.selector || !action.value)) {
|
|
163
|
+
return `Action ${i}: select requires selector and value`;
|
|
164
|
+
}
|
|
165
|
+
if (action.type === 'wait' && !action.duration) {
|
|
166
|
+
return `Action ${i}: wait requires duration in milliseconds`;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
async execute(params, signal) {
|
|
172
|
+
const startTime = Date.now();
|
|
173
|
+
const validationError = this.validateToolParams(params);
|
|
174
|
+
if (validationError) {
|
|
175
|
+
return this.createErrorResult(validationError);
|
|
176
|
+
}
|
|
177
|
+
try {
|
|
178
|
+
// Get sandbox session
|
|
179
|
+
const session = CreateArtifactToolExecutor.getActiveSandbox(params.sandboxId);
|
|
180
|
+
if (!session) {
|
|
181
|
+
return this.createErrorResult(`Sandbox not found: ${params.sandboxId}. It may have been stopped or never existed.`);
|
|
182
|
+
}
|
|
183
|
+
if (!session.url) {
|
|
184
|
+
return this.createErrorResult('Sandbox has no URL (not a web server)');
|
|
185
|
+
}
|
|
186
|
+
// Initialize visual bridge
|
|
187
|
+
await visualBridge.initialize();
|
|
188
|
+
// If a render trace is active, suppress the bracketing snapshots — captureSnapshot
|
|
189
|
+
// reloads the page (page.goto), which would add spurious mount-commits and could
|
|
190
|
+
// drown out the interaction's real re-render. Just drive the interaction on the live page.
|
|
191
|
+
const traceActive = await visualBridge.isTraceActive();
|
|
192
|
+
// Navigate to sandbox URL first (skip when tracing — page is already live)
|
|
193
|
+
const currentPage = visualBridge.page;
|
|
194
|
+
if (!traceActive && (!currentPage || currentPage.url() !== session.url)) {
|
|
195
|
+
await visualBridge.captureSnapshot(session.url);
|
|
196
|
+
}
|
|
197
|
+
// Execute actions
|
|
198
|
+
const actionResults = [];
|
|
199
|
+
const snapshots = [];
|
|
200
|
+
const captureAfterEach = params.captureAfterEachAction ?? false;
|
|
201
|
+
for (let i = 0; i < params.actions.length; i++) {
|
|
202
|
+
const action = params.actions[i];
|
|
203
|
+
if (!action)
|
|
204
|
+
continue;
|
|
205
|
+
try {
|
|
206
|
+
// Execute action
|
|
207
|
+
await this.executeAction(action, session.url);
|
|
208
|
+
actionResults.push(`[OK] Action ${i + 1}: ${action.type} ${action.selector || ''}`);
|
|
209
|
+
// Emit interaction executed event
|
|
210
|
+
broadcaster.emitInteraction(params.sandboxId, action.type, action.selector, true);
|
|
211
|
+
// Capture snapshot if requested (suppressed during an active trace)
|
|
212
|
+
if (captureAfterEach && !traceActive) {
|
|
213
|
+
const snapshot = await visualBridge.captureSnapshot(session.url);
|
|
214
|
+
snapshots.push({
|
|
215
|
+
actionIndex: i,
|
|
216
|
+
actionType: action.type,
|
|
217
|
+
snapshot
|
|
218
|
+
});
|
|
219
|
+
// Emit screenshot captured event
|
|
220
|
+
broadcaster.emitScreenshot(params.sandboxId, snapshot.screenshot, session.url);
|
|
221
|
+
}
|
|
222
|
+
// Check for abort signal
|
|
223
|
+
if (signal.aborted) {
|
|
224
|
+
throw new Error('Interaction aborted by user');
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
actionResults.push(`[ERROR] Action ${i + 1}: ${action.type} - ${error.message}`);
|
|
229
|
+
// Emit failed interaction event
|
|
230
|
+
broadcaster.emitInteraction(params.sandboxId, action.type, action.selector, false);
|
|
231
|
+
broadcaster.emitError(params.sandboxId, error);
|
|
232
|
+
// Continue or stop on error?
|
|
233
|
+
// For now, continue but report the error
|
|
234
|
+
console.error(`Action ${i} failed:`, error);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
// Capture final snapshot if requested
|
|
238
|
+
let finalSnapshot = null;
|
|
239
|
+
const returnFinalSnapshot = params.returnFinalSnapshot ?? true;
|
|
240
|
+
if (returnFinalSnapshot && !traceActive) {
|
|
241
|
+
finalSnapshot = await visualBridge.captureSnapshot(session.url);
|
|
242
|
+
session.visualSnapshot = finalSnapshot;
|
|
243
|
+
session.lastActivity = new Date();
|
|
244
|
+
// Emit screenshot captured event
|
|
245
|
+
broadcaster.emitScreenshot(params.sandboxId, finalSnapshot.screenshot, session.url);
|
|
246
|
+
}
|
|
247
|
+
// Format output
|
|
248
|
+
const output = this.formatInteractionOutput(session, params.actions, actionResults, snapshots, finalSnapshot);
|
|
249
|
+
return {
|
|
250
|
+
...this.createSuccessResult(output),
|
|
251
|
+
metadata: {
|
|
252
|
+
executionTime: Date.now() - startTime,
|
|
253
|
+
sandboxId: params.sandboxId,
|
|
254
|
+
actionsExecuted: params.actions.length,
|
|
255
|
+
actionsSucceeded: actionResults.filter(r => r.startsWith('[OK]')).length,
|
|
256
|
+
actionsFailed: actionResults.filter(r => r.startsWith('[ERROR]')).length,
|
|
257
|
+
snapshotsCaptured: snapshots.length + (finalSnapshot ? 1 : 0)
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
catch (error) {
|
|
262
|
+
return this.createErrorResult(`Failed to interact with sandbox: ${error.message}`);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Execute a single interaction action
|
|
267
|
+
*/
|
|
268
|
+
async executeAction(action, baseUrl) {
|
|
269
|
+
const interactionCommand = {
|
|
270
|
+
type: action.type,
|
|
271
|
+
selector: action.selector,
|
|
272
|
+
value: action.value,
|
|
273
|
+
coordinates: action.coordinates
|
|
274
|
+
};
|
|
275
|
+
switch (action.type) {
|
|
276
|
+
case 'click':
|
|
277
|
+
await visualBridge.interact(interactionCommand);
|
|
278
|
+
// Wait a bit for click effects
|
|
279
|
+
await this.wait(500);
|
|
280
|
+
break;
|
|
281
|
+
case 'type':
|
|
282
|
+
await visualBridge.interact(interactionCommand);
|
|
283
|
+
// Wait a bit for typing effects
|
|
284
|
+
await this.wait(300);
|
|
285
|
+
break;
|
|
286
|
+
case 'navigate':
|
|
287
|
+
// Navigate to URL (absolute or relative to baseUrl)
|
|
288
|
+
const targetUrl = action.value.startsWith('http')
|
|
289
|
+
? action.value
|
|
290
|
+
: new URL(action.value, baseUrl).toString();
|
|
291
|
+
await visualBridge.interact({ type: 'navigate', value: targetUrl });
|
|
292
|
+
await this.wait(1000);
|
|
293
|
+
break;
|
|
294
|
+
case 'scroll':
|
|
295
|
+
await visualBridge.interact(interactionCommand);
|
|
296
|
+
await this.wait(300);
|
|
297
|
+
break;
|
|
298
|
+
case 'hover':
|
|
299
|
+
await visualBridge.interact({ type: 'click', selector: action.selector });
|
|
300
|
+
await this.wait(200);
|
|
301
|
+
break;
|
|
302
|
+
case 'select':
|
|
303
|
+
await visualBridge.interact(interactionCommand);
|
|
304
|
+
await this.wait(300);
|
|
305
|
+
break;
|
|
306
|
+
case 'wait':
|
|
307
|
+
await this.wait(action.duration);
|
|
308
|
+
break;
|
|
309
|
+
default:
|
|
310
|
+
throw new Error(`Unknown action type: ${action.type}`);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Wait helper
|
|
315
|
+
*/
|
|
316
|
+
wait(ms) {
|
|
317
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Format interaction output for model consumption
|
|
321
|
+
*/
|
|
322
|
+
formatInteractionOutput(session, actions, actionResults, snapshots, finalSnapshot) {
|
|
323
|
+
const lines = [];
|
|
324
|
+
lines.push(`# Sandbox Interaction: ${session.name}`);
|
|
325
|
+
lines.push('');
|
|
326
|
+
lines.push(`**Sandbox ID**: ${session.id}`);
|
|
327
|
+
lines.push(`**URL**: ${session.url}`);
|
|
328
|
+
lines.push(`**Actions Executed**: ${actions.length}`);
|
|
329
|
+
lines.push('');
|
|
330
|
+
lines.push('## Action Results');
|
|
331
|
+
lines.push('');
|
|
332
|
+
actionResults.forEach(result => {
|
|
333
|
+
lines.push(result);
|
|
334
|
+
});
|
|
335
|
+
lines.push('');
|
|
336
|
+
// Show intermediate snapshots if captured
|
|
337
|
+
if (snapshots.length > 0) {
|
|
338
|
+
lines.push('---');
|
|
339
|
+
lines.push('');
|
|
340
|
+
lines.push('## Intermediate Snapshots');
|
|
341
|
+
lines.push('');
|
|
342
|
+
snapshots.forEach((snap, idx) => {
|
|
343
|
+
lines.push(`### After Action ${snap.actionIndex + 1} (${snap.actionType})`);
|
|
344
|
+
lines.push('');
|
|
345
|
+
lines.push(`**Screenshot**: [Base64 PNG ${snap.snapshot.screenshot.length} bytes]`);
|
|
346
|
+
lines.push('');
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
// Show final snapshot
|
|
350
|
+
if (finalSnapshot) {
|
|
351
|
+
lines.push('---');
|
|
352
|
+
lines.push('');
|
|
353
|
+
lines.push('## Final Visual State');
|
|
354
|
+
lines.push('');
|
|
355
|
+
lines.push(visualBridge.formatForModel(finalSnapshot));
|
|
356
|
+
lines.push('');
|
|
357
|
+
}
|
|
358
|
+
lines.push('---');
|
|
359
|
+
lines.push('');
|
|
360
|
+
lines.push('**Next Steps**:');
|
|
361
|
+
lines.push('- Inspect current state (Use inspect_sandbox)');
|
|
362
|
+
lines.push('- Continue interactions (Call interact_with_sandbox again)');
|
|
363
|
+
lines.push('- Edit code based on observations (Use write tool)');
|
|
364
|
+
return lines.join('\n');
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
//# sourceMappingURL=InteractWithSandboxTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InteractWithSandboxTool.js","sourceRoot":"","sources":["../../../src/implementations/addon/InteractWithSandboxTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,YAAY,EAAsB,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAuB3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,OAAO,2BAA4B,SAAQ,QAA+C;IAC9F;QACE,MAAM,MAAM,G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AI,CAAC,EAAE,CAAC,CAAC;YACjB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,sBAAsB;QACtB,IAAI,aAAa,EAAE,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAClB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;YACrC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC;YACvD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;QAC5D,KAAK,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAC;QACzE,KAAK,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;QAEjE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keyframe Detector
|
|
3
|
+
*
|
|
4
|
+
* Intelligently detects when screenshots should be sent to vision API
|
|
5
|
+
* Uses DOM analysis, perceptual hashing, and event monitoring
|
|
6
|
+
* to minimize unnecessary API calls while maintaining accuracy.
|
|
7
|
+
*
|
|
8
|
+
* Features:
|
|
9
|
+
* - Navigation change detection
|
|
10
|
+
* - DOM mutation monitoring
|
|
11
|
+
* - Modal/alert detection
|
|
12
|
+
* - Visual error detection
|
|
13
|
+
* - Perceptual hash-based change detection
|
|
14
|
+
* - Event-driven keyframe triggers
|
|
15
|
+
*/
|
|
16
|
+
import { EventEmitter } from 'events';
|
|
17
|
+
import { Page } from 'playwright';
|
|
18
|
+
export interface KeyframeConfig {
|
|
19
|
+
domMutationThreshold?: number;
|
|
20
|
+
visualHashThreshold?: number;
|
|
21
|
+
modalCheckInterval?: number;
|
|
22
|
+
detectNavigation?: boolean;
|
|
23
|
+
detectDOMMutations?: boolean;
|
|
24
|
+
detectModals?: boolean;
|
|
25
|
+
detectErrors?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface KeyframeTrigger {
|
|
28
|
+
type: 'navigation' | 'dom_mutation' | 'modal' | 'error' | 'user_request' | 'visual_change';
|
|
29
|
+
reason: string;
|
|
30
|
+
confidence: number;
|
|
31
|
+
metadata?: Record<string, any>;
|
|
32
|
+
timestamp: number;
|
|
33
|
+
}
|
|
34
|
+
export interface PageSnapshot {
|
|
35
|
+
url: string;
|
|
36
|
+
title: string;
|
|
37
|
+
domHash: string;
|
|
38
|
+
visualHash: string;
|
|
39
|
+
elementCount: number;
|
|
40
|
+
hasModal: boolean;
|
|
41
|
+
hasError: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* KeyframeDetector - Smart detection of when to send screenshots to vision API
|
|
45
|
+
*
|
|
46
|
+
* Monitors page state and triggers keyframe captures only when significant
|
|
47
|
+
* changes occur, dramatically reducing API costs while maintaining accuracy.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* const detector = new KeyframeDetector(page, {
|
|
51
|
+
* domMutationThreshold: 50,
|
|
52
|
+
* visualHashThreshold: 0.15
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* detector.on('keyframe', (trigger: KeyframeTrigger) => {
|
|
56
|
+
* console.log(`Keyframe needed: ${trigger.reason}`);
|
|
57
|
+
* // Send screenshot to vision API
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* await detector.start();
|
|
61
|
+
*/
|
|
62
|
+
export declare class KeyframeDetector extends EventEmitter {
|
|
63
|
+
private page;
|
|
64
|
+
private config;
|
|
65
|
+
private isRunning;
|
|
66
|
+
private lastSnapshot;
|
|
67
|
+
private mutationCount;
|
|
68
|
+
private modalCheckInterval;
|
|
69
|
+
constructor(page: Page, config?: KeyframeConfig);
|
|
70
|
+
/**
|
|
71
|
+
* Start monitoring for keyframe triggers
|
|
72
|
+
*/
|
|
73
|
+
start(): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Stop monitoring
|
|
76
|
+
*/
|
|
77
|
+
stop(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Manually trigger keyframe (for user requests)
|
|
80
|
+
*/
|
|
81
|
+
triggerKeyframe(reason: string, metadata?: Record<string, any>): void;
|
|
82
|
+
/**
|
|
83
|
+
* Capture current page snapshot
|
|
84
|
+
*/
|
|
85
|
+
private captureSnapshot;
|
|
86
|
+
/**
|
|
87
|
+
* Set up navigation change detector
|
|
88
|
+
*/
|
|
89
|
+
private setupNavigationDetector;
|
|
90
|
+
/**
|
|
91
|
+
* Set up DOM mutation detector
|
|
92
|
+
*/
|
|
93
|
+
private setupDOMMutationDetector;
|
|
94
|
+
/**
|
|
95
|
+
* Set up modal detector (periodic check)
|
|
96
|
+
*/
|
|
97
|
+
private setupModalDetector;
|
|
98
|
+
/**
|
|
99
|
+
* Set up error detector
|
|
100
|
+
*/
|
|
101
|
+
private setupErrorDetector;
|
|
102
|
+
/**
|
|
103
|
+
* Detect if modal/dialog is present
|
|
104
|
+
*/
|
|
105
|
+
private detectModal;
|
|
106
|
+
/**
|
|
107
|
+
* Detect if error is visible on page
|
|
108
|
+
*/
|
|
109
|
+
private detectError;
|
|
110
|
+
/**
|
|
111
|
+
* Compute simple hash of content
|
|
112
|
+
*/
|
|
113
|
+
private computeHash;
|
|
114
|
+
/**
|
|
115
|
+
* Compute perceptual hash difference between two snapshots
|
|
116
|
+
* Returns 0-1, where 0 is identical and 1 is completely different
|
|
117
|
+
*/
|
|
118
|
+
computeVisualDifference(): Promise<number>;
|
|
119
|
+
/**
|
|
120
|
+
* Check if visual change threshold is exceeded
|
|
121
|
+
*/
|
|
122
|
+
shouldSendToAPI(): Promise<{
|
|
123
|
+
should: boolean;
|
|
124
|
+
reason: string;
|
|
125
|
+
confidence: number;
|
|
126
|
+
}>;
|
|
127
|
+
/**
|
|
128
|
+
* Get current detector state
|
|
129
|
+
*/
|
|
130
|
+
getState(): {
|
|
131
|
+
isRunning: boolean;
|
|
132
|
+
lastSnapshot: PageSnapshot | null;
|
|
133
|
+
config: Required<KeyframeConfig>;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Cleanup resources
|
|
137
|
+
*/
|
|
138
|
+
destroy(): void;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=KeyframeDetector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeyframeDetector.d.ts","sourceRoot":"","sources":["../../../src/implementations/addon/KeyframeDetector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAGlC,MAAM,WAAW,cAAc;IAE7B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAG5B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,YAAY,GAAG,cAAc,GAAG,OAAO,GAAG,OAAO,GAAG,cAAc,GAAG,eAAe,CAAC;IAC3F,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAA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