@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,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SandboxTransfer Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* Runs a command in a remote sandbox (via MCP run_command), captures its
|
|
5
|
+
* stdout, and writes the output to the local filesystem. Closes the loop
|
|
6
|
+
* between sandbox-generated artifacts (PDFs, images, data) and local files.
|
|
7
|
+
*
|
|
8
|
+
* Uses late-bound mcpManagerGetter injected into ExecutorConfig by
|
|
9
|
+
* OrchestratorFactory after MCP initialisation.
|
|
10
|
+
*/
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
import crypto from 'crypto';
|
|
14
|
+
import { BaseTool } from '../../base/index.js';
|
|
15
|
+
import { SchemaValidator } from '../../utils/SchemaValidator.js';
|
|
16
|
+
import { makeRelative, shortenPath, resolveFilePath, } from '../../utils/FileUtils.js';
|
|
17
|
+
const MIME_FROM_EXT = {
|
|
18
|
+
'.png': 'image/png',
|
|
19
|
+
'.jpg': 'image/jpeg',
|
|
20
|
+
'.jpeg': 'image/jpeg',
|
|
21
|
+
'.gif': 'image/gif',
|
|
22
|
+
'.webp': 'image/webp',
|
|
23
|
+
'.svg': 'image/svg+xml',
|
|
24
|
+
'.pdf': 'application/pdf',
|
|
25
|
+
'.zip': 'application/zip',
|
|
26
|
+
'.wasm': 'application/wasm',
|
|
27
|
+
'.mp3': 'audio/mpeg',
|
|
28
|
+
'.wav': 'audio/wav',
|
|
29
|
+
'.mp4': 'video/mp4',
|
|
30
|
+
'.webm': 'video/webm',
|
|
31
|
+
'.json': 'application/json',
|
|
32
|
+
'.csv': 'text/csv',
|
|
33
|
+
'.txt': 'text/plain',
|
|
34
|
+
'.html': 'text/html',
|
|
35
|
+
};
|
|
36
|
+
export class SandboxTransferTool extends BaseTool {
|
|
37
|
+
config;
|
|
38
|
+
constructor(config) {
|
|
39
|
+
super('SandboxTransfer', 'SandboxTransfer', 'Run a command in the sandbox and save its stdout to a local file.', {
|
|
40
|
+
type: 'object',
|
|
41
|
+
properties: {
|
|
42
|
+
command: {
|
|
43
|
+
type: 'string',
|
|
44
|
+
description: 'Shell command to execute in the sandbox. Stdout is captured and written to local_path.',
|
|
45
|
+
},
|
|
46
|
+
local_path: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
description: 'Local file path to write the captured output to. Parent directories are created automatically.',
|
|
49
|
+
},
|
|
50
|
+
encoding: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
enum: ['base64', 'utf8'],
|
|
53
|
+
description: 'How to interpret stdout. "base64" (default) decodes to binary. "utf8" writes raw text.',
|
|
54
|
+
},
|
|
55
|
+
mime_type: {
|
|
56
|
+
type: 'string',
|
|
57
|
+
description: 'MIME type for the output file. Auto-detected from extension if omitted.',
|
|
58
|
+
},
|
|
59
|
+
timeout: {
|
|
60
|
+
type: 'number',
|
|
61
|
+
description: 'Command timeout in milliseconds (default: 60000). Use higher values for PDF generation.',
|
|
62
|
+
},
|
|
63
|
+
server: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
description: 'MCP server name to use (default: "nexus-browser"). Must expose a run_command tool.',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
required: ['command', 'local_path'],
|
|
69
|
+
});
|
|
70
|
+
this.config = config;
|
|
71
|
+
}
|
|
72
|
+
validateToolParams(params) {
|
|
73
|
+
const schemaError = SchemaValidator.validate(this.parameterSchema, params);
|
|
74
|
+
if (schemaError)
|
|
75
|
+
return schemaError;
|
|
76
|
+
if (!params.command.trim()) {
|
|
77
|
+
return 'command must not be empty';
|
|
78
|
+
}
|
|
79
|
+
const filePath = resolveFilePath(params.local_path, this.config.workingDirectory);
|
|
80
|
+
if (!path.isAbsolute(filePath)) {
|
|
81
|
+
return `local_path must resolve to an absolute path: ${filePath}`;
|
|
82
|
+
}
|
|
83
|
+
params.local_path = filePath;
|
|
84
|
+
if (params.encoding && !['base64', 'utf8'].includes(params.encoding)) {
|
|
85
|
+
return `encoding must be "base64" or "utf8", got "${params.encoding}"`;
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
getDescription(params) {
|
|
90
|
+
if (!params?.local_path)
|
|
91
|
+
return 'Transfer file from sandbox';
|
|
92
|
+
const shortened = shortenPath(makeRelative(params.local_path, this.config.workingDirectory));
|
|
93
|
+
return `SandboxTransfer → ${shortened}`;
|
|
94
|
+
}
|
|
95
|
+
async execute(params, signal, updateOutput) {
|
|
96
|
+
const startTime = Date.now();
|
|
97
|
+
const serverName = params.server || 'nexus-browser';
|
|
98
|
+
const encoding = params.encoding || 'base64';
|
|
99
|
+
const timeout = params.timeout || 60000;
|
|
100
|
+
const validationError = this.validateToolParams(params);
|
|
101
|
+
if (validationError) {
|
|
102
|
+
return this.createErrorResult(validationError);
|
|
103
|
+
}
|
|
104
|
+
// Late-bound MCP manager access
|
|
105
|
+
const mcpManagerGetter = this.config.mcpManagerGetter;
|
|
106
|
+
if (!mcpManagerGetter || typeof mcpManagerGetter !== 'function') {
|
|
107
|
+
return this.createErrorResult('MCP manager not available. SandboxTransfer requires an active MCP connection. ' +
|
|
108
|
+
'Ensure MCP is enabled and a sandbox server (e.g., nexus-browser) is configured.');
|
|
109
|
+
}
|
|
110
|
+
const mcpManager = mcpManagerGetter();
|
|
111
|
+
if (!mcpManager) {
|
|
112
|
+
return this.createErrorResult('MCP manager not initialised. SandboxTransfer requires MCP to be enabled.');
|
|
113
|
+
}
|
|
114
|
+
if (!mcpManager.isServerConnected(serverName)) {
|
|
115
|
+
return this.createErrorResult(`MCP server "${serverName}" is not connected. ` +
|
|
116
|
+
`Available servers can be checked with /mcp list. ` +
|
|
117
|
+
`If using a different server, pass server: "your-server-name".`);
|
|
118
|
+
}
|
|
119
|
+
if (signal.aborted) {
|
|
120
|
+
return this.createErrorResult('Cancelled before execution');
|
|
121
|
+
}
|
|
122
|
+
// Run command in sandbox
|
|
123
|
+
let sandboxResult;
|
|
124
|
+
try {
|
|
125
|
+
if (updateOutput) {
|
|
126
|
+
updateOutput(`Running in ${serverName} sandbox: ${params.command.slice(0, 80)}...`);
|
|
127
|
+
}
|
|
128
|
+
sandboxResult = await Promise.race([
|
|
129
|
+
mcpManager.callTool(serverName, 'run_command', {
|
|
130
|
+
command: params.command,
|
|
131
|
+
timeout,
|
|
132
|
+
}),
|
|
133
|
+
new Promise((_, reject) => {
|
|
134
|
+
const onAbort = () => reject(new Error('Cancelled'));
|
|
135
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
136
|
+
}),
|
|
137
|
+
]);
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
if (signal.aborted || error.message === 'Cancelled') {
|
|
141
|
+
return this.createErrorResult('Cancelled during sandbox execution');
|
|
142
|
+
}
|
|
143
|
+
return this.createErrorResult(`Sandbox command failed: ${error.message}`);
|
|
144
|
+
}
|
|
145
|
+
// Extract stdout from MCP result
|
|
146
|
+
const stdout = this.extractStdout(sandboxResult);
|
|
147
|
+
if (stdout === null || stdout.length === 0) {
|
|
148
|
+
const stderr = this.extractField(sandboxResult, 'stderr');
|
|
149
|
+
const exitCode = this.extractField(sandboxResult, 'exitCode');
|
|
150
|
+
let msg = 'Sandbox command produced no stdout.';
|
|
151
|
+
if (stderr)
|
|
152
|
+
msg += ` stderr: ${stderr.slice(0, 200)}`;
|
|
153
|
+
if (exitCode !== null)
|
|
154
|
+
msg += ` (exit code ${exitCode})`;
|
|
155
|
+
return this.createErrorResult(msg);
|
|
156
|
+
}
|
|
157
|
+
// Write to local filesystem
|
|
158
|
+
try {
|
|
159
|
+
const dirPath = path.dirname(params.local_path);
|
|
160
|
+
if (!fs.existsSync(dirPath)) {
|
|
161
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
162
|
+
}
|
|
163
|
+
let buffer;
|
|
164
|
+
if (encoding === 'base64') {
|
|
165
|
+
const raw = stdout.replace(/\s/g, '');
|
|
166
|
+
buffer = Buffer.from(raw, 'base64');
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
buffer = Buffer.from(stdout, 'utf8');
|
|
170
|
+
}
|
|
171
|
+
await fs.promises.writeFile(params.local_path, buffer);
|
|
172
|
+
const fileSize = buffer.length;
|
|
173
|
+
const ext = path.extname(params.local_path).toLowerCase();
|
|
174
|
+
const mimeType = params.mime_type || MIME_FROM_EXT[ext] || 'application/octet-stream';
|
|
175
|
+
const sha256 = crypto
|
|
176
|
+
.createHash('sha256')
|
|
177
|
+
.update(buffer)
|
|
178
|
+
.digest('hex')
|
|
179
|
+
.slice(0, 16);
|
|
180
|
+
const relativePath = makeRelative(params.local_path, this.config.workingDirectory);
|
|
181
|
+
const sizeLabel = fileSize < 1024
|
|
182
|
+
? `${fileSize} B`
|
|
183
|
+
: fileSize < 1024 * 1024
|
|
184
|
+
? `${(fileSize / 1024).toFixed(1)} KB`
|
|
185
|
+
: `${(fileSize / (1024 * 1024)).toFixed(1)} MB`;
|
|
186
|
+
const displayContent = `Transferred ${relativePath} (${sizeLabel}, ${mimeType}, sha256:${sha256})`;
|
|
187
|
+
if (updateOutput) {
|
|
188
|
+
updateOutput(displayContent);
|
|
189
|
+
}
|
|
190
|
+
return this.createSuccessResult(displayContent, {
|
|
191
|
+
executionTime: Date.now() - startTime,
|
|
192
|
+
resourcesUsed: { files: [params.local_path] },
|
|
193
|
+
sandboxServer: serverName,
|
|
194
|
+
encoding,
|
|
195
|
+
fileStats: {
|
|
196
|
+
path: relativePath,
|
|
197
|
+
size: fileSize,
|
|
198
|
+
mimeType,
|
|
199
|
+
sha256,
|
|
200
|
+
operation: 'create',
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
if (error.code === 'EACCES') {
|
|
206
|
+
return this.createErrorResult(`Permission denied: ${params.local_path}`);
|
|
207
|
+
}
|
|
208
|
+
if (error.code === 'ENOSPC') {
|
|
209
|
+
return this.createErrorResult('No space left on device');
|
|
210
|
+
}
|
|
211
|
+
return this.createErrorResult(`Failed to write local file: ${error.message}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
extractStdout(result) {
|
|
215
|
+
if (!result)
|
|
216
|
+
return null;
|
|
217
|
+
// MCP content blocks format
|
|
218
|
+
if (Array.isArray(result.content)) {
|
|
219
|
+
for (const block of result.content) {
|
|
220
|
+
if (block?.type === 'text' && block.text) {
|
|
221
|
+
try {
|
|
222
|
+
const parsed = JSON.parse(block.text);
|
|
223
|
+
if (typeof parsed.stdout === 'string')
|
|
224
|
+
return parsed.stdout;
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
// Not JSON — might be raw stdout
|
|
228
|
+
}
|
|
229
|
+
return block.text;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// Direct object with stdout
|
|
234
|
+
if (typeof result.stdout === 'string')
|
|
235
|
+
return result.stdout;
|
|
236
|
+
// Direct string
|
|
237
|
+
if (typeof result === 'string')
|
|
238
|
+
return result;
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
extractField(result, field) {
|
|
242
|
+
if (!result)
|
|
243
|
+
return null;
|
|
244
|
+
if (Array.isArray(result.content)) {
|
|
245
|
+
for (const block of result.content) {
|
|
246
|
+
if (block?.type === 'text' && block.text) {
|
|
247
|
+
try {
|
|
248
|
+
const parsed = JSON.parse(block.text);
|
|
249
|
+
if (parsed[field] !== undefined)
|
|
250
|
+
return String(parsed[field]);
|
|
251
|
+
}
|
|
252
|
+
catch { }
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (result[field] !== undefined)
|
|
257
|
+
return String(result[field]);
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=SandboxTransferTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SandboxTransferTool.js","sourceRoot":"","sources":["../../../src/implementations/web/SandboxTransferTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAmB,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAGlC,MAAM,aAAa,GAA2B;IAC5C,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,YAAY;IACpB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,YAAY;IACrB,MAAM,EAAE,eAAe;IACvB,MAAM,EAAE,iBAAiB;IACzB,MAAM,EAAE,iBAAiB;IACzB,OAAO,EAAE,kBAAkB;IAC3B,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,kBAAkB;IAC3B,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,Y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CAAC,KAAK,CAAC,CAAC,CAAC;QAC9D,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebFetch Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* Processes content from URLs embedded in a prompt using Gemini API's built-in urlContext tool.
|
|
5
|
+
* Includes fallback to local fetch + html-to-text for private IPs and failed requests.
|
|
6
|
+
*
|
|
7
|
+
* Based on Gemini CLI web-fetch.ts implementation
|
|
8
|
+
* Uses FREE Gemini API built-in tools with automatic fallback
|
|
9
|
+
*/
|
|
10
|
+
import { BaseTool, type ToolResult } from '../../base/index.js';
|
|
11
|
+
import type { ExecutorConfig } from '../../base/ToolRegistry.js';
|
|
12
|
+
/**
|
|
13
|
+
* Grounding metadata structures from Gemini API
|
|
14
|
+
*/
|
|
15
|
+
interface GroundingChunkItem {
|
|
16
|
+
web?: {
|
|
17
|
+
uri?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Parameters for the WebFetch tool
|
|
23
|
+
*/
|
|
24
|
+
export interface WebFetchToolParams {
|
|
25
|
+
/**
|
|
26
|
+
* Comprehensive prompt with URL(s) and processing instructions
|
|
27
|
+
*/
|
|
28
|
+
prompt: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Extended result with grounding metadata
|
|
32
|
+
*/
|
|
33
|
+
export interface WebFetchToolResult extends ToolResult {
|
|
34
|
+
sources?: GroundingChunkItem[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* WebFetch Tool Executor
|
|
38
|
+
*
|
|
39
|
+
* Features:
|
|
40
|
+
* - Uses Gemini API urlContext built-in tool (FREE)
|
|
41
|
+
* - Automatic grounding metadata with source attribution
|
|
42
|
+
* - UTF-8 byte-accurate citation insertion
|
|
43
|
+
* - Fallback to local fetch + html-to-text for:
|
|
44
|
+
* - Private IPs (localhost, 192.168.x.x, etc.)
|
|
45
|
+
* - Failed URL retrievals
|
|
46
|
+
* - GitHub blob URL → raw URL conversion
|
|
47
|
+
* - HTML to text conversion
|
|
48
|
+
*/
|
|
49
|
+
export declare class WebFetchTool extends BaseTool<WebFetchToolParams, WebFetchToolResult> {
|
|
50
|
+
private config;
|
|
51
|
+
private genAI;
|
|
52
|
+
constructor(config: ExecutorConfig);
|
|
53
|
+
/**
|
|
54
|
+
* Initialize Gemini API client
|
|
55
|
+
*/
|
|
56
|
+
private getGeminiClient;
|
|
57
|
+
validateToolParams(params: WebFetchToolParams): string | null;
|
|
58
|
+
getDescription(params: WebFetchToolParams): string;
|
|
59
|
+
execute(params: WebFetchToolParams, signal: AbortSignal, updateOutput?: (output: string) => void): Promise<WebFetchToolResult>;
|
|
60
|
+
/**
|
|
61
|
+
* Format a provider-native backend result into the WebFetch tool result shape.
|
|
62
|
+
*/
|
|
63
|
+
private formatBackendResult;
|
|
64
|
+
/**
|
|
65
|
+
* Primary execution using Gemini API urlContext
|
|
66
|
+
*/
|
|
67
|
+
private executePrimary;
|
|
68
|
+
/**
|
|
69
|
+
* Fallback execution using local fetch + html-to-text
|
|
70
|
+
*/
|
|
71
|
+
private executeFallback;
|
|
72
|
+
/**
|
|
73
|
+
* Parse URLs from prompt text
|
|
74
|
+
*/
|
|
75
|
+
private parsePrompt;
|
|
76
|
+
/**
|
|
77
|
+
* Check if URL points to a private IP address
|
|
78
|
+
*/
|
|
79
|
+
private isPrivateIp;
|
|
80
|
+
/**
|
|
81
|
+
* Insert citations at UTF-8 byte-accurate positions
|
|
82
|
+
*
|
|
83
|
+
* Gemini API returns byte positions (not character positions) for grounding metadata.
|
|
84
|
+
* This method handles multi-byte UTF-8 characters correctly.
|
|
85
|
+
*
|
|
86
|
+
* @param responseText The response text to insert citations into
|
|
87
|
+
* @param groundingSupports Array of grounding support items with byte positions
|
|
88
|
+
* @returns Text with citations inserted
|
|
89
|
+
*/
|
|
90
|
+
private insertCitationsUTF8;
|
|
91
|
+
}
|
|
92
|
+
export {};
|
|
93
|
+
//# sourceMappingURL=WebFetchTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebFetchTool.d.ts","sourceRoot":"","sources":["../../../src/implementations/web/WebFetchTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAmBjE;;GAEG;AACH,UAAU,kBAAkB;IAC1B,GAAG,CAAC,EAAE;QACJ,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AA0BD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAChC;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAa,SAAQ,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAGpE,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,KAAK,CAA4B;gBAErB,MAAM,EAAE,cAAc;IAqB1C;;OAEG;IACH,OAAO,CAAC,eAAe;IAavB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,GAAG,IAAI;IAqC7D,cAAc,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM;IAM5C,OAAO,CACX,MAAM,EAAE,kBAAkB,EAC1B,MAAM,EAAE,WAAW,EACnB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GACtC,OAAO,CAAC,kBAAkB,CAAC;IA4H9B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAyB3B;;OAEG;YACW,cAAc;I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