@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,430 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Tool Backends — Multi-provider implementations for WebSearch / WebFetch.
|
|
3
|
+
*
|
|
4
|
+
* Resolution order (per call):
|
|
5
|
+
* 1. Provider-native server-side web tool, selected by WEB_TOOLS_MODEL env var:
|
|
6
|
+
* - Anthropic Claude → Messages API + `web_search_20250305` server tool
|
|
7
|
+
* - XAI Grok → Responses API + `web_search` server tool
|
|
8
|
+
* - Google Gemini → GenerateContent + `googleSearch` grounding (default)
|
|
9
|
+
* 2. DuckDuckGo HTML fallback (no API key required) — last resort when:
|
|
10
|
+
* - WEB_TOOLS_MODEL is unset, OR
|
|
11
|
+
* - the configured provider's API key is missing.
|
|
12
|
+
*
|
|
13
|
+
* Provider is inferred from the model ID prefix; this matches the
|
|
14
|
+
* AdapterRegistry's pattern detection. nexus-browser is intentionally NOT a
|
|
15
|
+
* backend here — it is exposed via MCP only, with auth gating at the protocol
|
|
16
|
+
* layer (see nexus-cortex OSS / nexus-browser monetization boundary).
|
|
17
|
+
*/
|
|
18
|
+
import { convert as htmlToText } from 'html-to-text';
|
|
19
|
+
/** Resolve which provider serves a given model ID. */
|
|
20
|
+
export function resolveProvider(modelId) {
|
|
21
|
+
if (!modelId)
|
|
22
|
+
return 'fallback';
|
|
23
|
+
const id = modelId.toLowerCase();
|
|
24
|
+
if (id.startsWith('claude-') || id.startsWith('claude_'))
|
|
25
|
+
return 'anthropic';
|
|
26
|
+
if (id.startsWith('grok-') || id.startsWith('grok_'))
|
|
27
|
+
return 'xai';
|
|
28
|
+
if (id.startsWith('gemini-') || id.startsWith('gemma-'))
|
|
29
|
+
return 'google';
|
|
30
|
+
if (id.startsWith('gpt-') ||
|
|
31
|
+
id.startsWith('o1-') || id === 'o1' || id === 'o1-pro' ||
|
|
32
|
+
id.startsWith('o3-') || id === 'o3' || id === 'o3-pro' ||
|
|
33
|
+
id.startsWith('o4-') || id === 'o4-mini') {
|
|
34
|
+
return 'openai';
|
|
35
|
+
}
|
|
36
|
+
return 'fallback';
|
|
37
|
+
}
|
|
38
|
+
/** Resolve and return env API key for a provider; null if missing. */
|
|
39
|
+
function getApiKey(provider) {
|
|
40
|
+
switch (provider) {
|
|
41
|
+
case 'anthropic':
|
|
42
|
+
return process.env.ANTHROPIC_API_KEY ?? null;
|
|
43
|
+
case 'xai':
|
|
44
|
+
return process.env.XAI_API_KEY ?? null;
|
|
45
|
+
case 'openai':
|
|
46
|
+
return process.env.OPENAI_API_KEY ?? null;
|
|
47
|
+
case 'google':
|
|
48
|
+
return process.env.GEMINI_API_KEY ?? process.env.GOOGLE_API_KEY ?? null;
|
|
49
|
+
default:
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// ── Anthropic backend ─────────────────────────────────────────────────────────
|
|
54
|
+
async function anthropicCall(modelId, apiKey, userMessage, maxTokens) {
|
|
55
|
+
const res = await fetch('https://api.anthropic.com/v1/messages', {
|
|
56
|
+
method: 'POST',
|
|
57
|
+
headers: {
|
|
58
|
+
'content-type': 'application/json',
|
|
59
|
+
'x-api-key': apiKey,
|
|
60
|
+
'anthropic-version': '2023-06-01',
|
|
61
|
+
},
|
|
62
|
+
body: JSON.stringify({
|
|
63
|
+
model: modelId,
|
|
64
|
+
max_tokens: maxTokens,
|
|
65
|
+
tools: [{ type: 'web_search_20250305', name: 'web_search', max_uses: 5 }],
|
|
66
|
+
messages: [{ role: 'user', content: userMessage }],
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
if (!res.ok) {
|
|
70
|
+
const errBody = await res.text().catch(() => '');
|
|
71
|
+
throw new Error(`Anthropic ${res.status}: ${errBody.slice(0, 300)}`);
|
|
72
|
+
}
|
|
73
|
+
const data = await res.json();
|
|
74
|
+
const textParts = [];
|
|
75
|
+
const sources = [];
|
|
76
|
+
for (const block of data.content ?? []) {
|
|
77
|
+
if (block.type === 'text') {
|
|
78
|
+
textParts.push(block.text);
|
|
79
|
+
}
|
|
80
|
+
else if (block.type === 'web_search_tool_result' && Array.isArray(block.content)) {
|
|
81
|
+
for (const item of block.content) {
|
|
82
|
+
if (item.type === 'web_search_result' && item.url) {
|
|
83
|
+
sources.push({ title: item.title, url: item.url });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return { text: textParts.join('\n\n'), sources };
|
|
89
|
+
}
|
|
90
|
+
export async function anthropicSearch(query, modelId) {
|
|
91
|
+
const apiKey = getApiKey('anthropic');
|
|
92
|
+
if (!apiKey)
|
|
93
|
+
throw new Error('ANTHROPIC_API_KEY not set');
|
|
94
|
+
const { text, sources } = await anthropicCall(modelId, apiKey, `Search the web for: ${query}\n\nReturn a comprehensive, factual summary citing your sources.`, 16000);
|
|
95
|
+
return { text, sources, backend: 'anthropic-web_search' };
|
|
96
|
+
}
|
|
97
|
+
export async function anthropicFetch(prompt, modelId) {
|
|
98
|
+
const apiKey = getApiKey('anthropic');
|
|
99
|
+
if (!apiKey)
|
|
100
|
+
throw new Error('ANTHROPIC_API_KEY not set');
|
|
101
|
+
const { text, sources } = await anthropicCall(modelId, apiKey, `Fetch and process the URL(s) in the following prompt. Preserve structure (headings, lists, paragraphs).\n\n${prompt}`, 32000);
|
|
102
|
+
return { text, sources, backend: 'anthropic-web_search' };
|
|
103
|
+
}
|
|
104
|
+
// ── XAI backend (Responses API) ───────────────────────────────────────────────
|
|
105
|
+
async function xaiCall(modelId, apiKey, input, maxOutputTokens) {
|
|
106
|
+
const res = await fetch('https://api.x.ai/v1/responses', {
|
|
107
|
+
method: 'POST',
|
|
108
|
+
headers: {
|
|
109
|
+
'content-type': 'application/json',
|
|
110
|
+
authorization: `Bearer ${apiKey}`,
|
|
111
|
+
},
|
|
112
|
+
body: JSON.stringify({
|
|
113
|
+
model: modelId,
|
|
114
|
+
tools: [{ type: 'web_search' }],
|
|
115
|
+
input,
|
|
116
|
+
temperature: 0.3,
|
|
117
|
+
max_output_tokens: maxOutputTokens,
|
|
118
|
+
}),
|
|
119
|
+
});
|
|
120
|
+
if (!res.ok) {
|
|
121
|
+
const errBody = await res.text().catch(() => '');
|
|
122
|
+
throw new Error(`XAI ${res.status}: ${errBody.slice(0, 300)}`);
|
|
123
|
+
}
|
|
124
|
+
const data = await res.json();
|
|
125
|
+
const textParts = [];
|
|
126
|
+
const sources = [];
|
|
127
|
+
if (Array.isArray(data.output)) {
|
|
128
|
+
for (const item of data.output) {
|
|
129
|
+
if (item.type === 'message' && Array.isArray(item.content)) {
|
|
130
|
+
for (const part of item.content) {
|
|
131
|
+
if (part.type === 'output_text' || part.type === 'text') {
|
|
132
|
+
textParts.push(part.text);
|
|
133
|
+
for (const ann of part.annotations ?? []) {
|
|
134
|
+
if (ann.type === 'url_citation' && ann.url) {
|
|
135
|
+
sources.push({ title: ann.title, url: ann.url });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (textParts.length === 0 && typeof data.output_text === 'string') {
|
|
144
|
+
textParts.push(data.output_text);
|
|
145
|
+
}
|
|
146
|
+
// Deduplicate by URL — XAI repeats annotations per citation position.
|
|
147
|
+
const seen = new Set();
|
|
148
|
+
const uniqueSources = sources.filter((s) => {
|
|
149
|
+
if (seen.has(s.url))
|
|
150
|
+
return false;
|
|
151
|
+
seen.add(s.url);
|
|
152
|
+
return true;
|
|
153
|
+
});
|
|
154
|
+
return { text: textParts.join('\n\n'), sources: uniqueSources };
|
|
155
|
+
}
|
|
156
|
+
export async function xaiSearch(query, modelId) {
|
|
157
|
+
const apiKey = getApiKey('xai');
|
|
158
|
+
if (!apiKey)
|
|
159
|
+
throw new Error('XAI_API_KEY not set');
|
|
160
|
+
const { text, sources } = await xaiCall(modelId, apiKey, `Search the web comprehensively for: ${query}\n\nReturn detailed, factual results with sources.`, 16000);
|
|
161
|
+
return { text, sources, backend: 'xai-web_search' };
|
|
162
|
+
}
|
|
163
|
+
export async function xaiFetch(prompt, modelId) {
|
|
164
|
+
const apiKey = getApiKey('xai');
|
|
165
|
+
if (!apiKey)
|
|
166
|
+
throw new Error('XAI_API_KEY not set');
|
|
167
|
+
const { text, sources } = await xaiCall(modelId, apiKey, `Read and extract content from the URL(s) in the following prompt. Preserve structure.\n\n${prompt}`, 32000);
|
|
168
|
+
return { text, sources, backend: 'xai-web_search' };
|
|
169
|
+
}
|
|
170
|
+
// ── OpenAI backend (Responses API) ────────────────────────────────────────────
|
|
171
|
+
async function openaiCall(modelId, apiKey, input, maxOutputTokens) {
|
|
172
|
+
const res = await fetch('https://api.openai.com/v1/responses', {
|
|
173
|
+
method: 'POST',
|
|
174
|
+
headers: {
|
|
175
|
+
'content-type': 'application/json',
|
|
176
|
+
authorization: `Bearer ${apiKey}`,
|
|
177
|
+
},
|
|
178
|
+
body: JSON.stringify({
|
|
179
|
+
model: modelId,
|
|
180
|
+
tools: [{ type: 'web_search_preview' }],
|
|
181
|
+
input,
|
|
182
|
+
max_output_tokens: maxOutputTokens,
|
|
183
|
+
}),
|
|
184
|
+
});
|
|
185
|
+
if (!res.ok) {
|
|
186
|
+
const errBody = await res.text().catch(() => '');
|
|
187
|
+
throw new Error(`OpenAI ${res.status}: ${errBody.slice(0, 300)}`);
|
|
188
|
+
}
|
|
189
|
+
const data = await res.json();
|
|
190
|
+
const textParts = [];
|
|
191
|
+
const sources = [];
|
|
192
|
+
if (Array.isArray(data.output)) {
|
|
193
|
+
for (const item of data.output) {
|
|
194
|
+
if (item.type === 'message' && Array.isArray(item.content)) {
|
|
195
|
+
for (const part of item.content) {
|
|
196
|
+
if (part.type === 'output_text' || part.type === 'text') {
|
|
197
|
+
textParts.push(part.text);
|
|
198
|
+
// OpenAI inlines URL annotations within output_text parts.
|
|
199
|
+
for (const ann of part.annotations ?? []) {
|
|
200
|
+
if (ann.type === 'url_citation' && ann.url) {
|
|
201
|
+
sources.push({ title: ann.title, url: ann.url });
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (textParts.length === 0 && typeof data.output_text === 'string') {
|
|
210
|
+
textParts.push(data.output_text);
|
|
211
|
+
}
|
|
212
|
+
return { text: textParts.join('\n\n'), sources };
|
|
213
|
+
}
|
|
214
|
+
export async function openaiSearch(query, modelId) {
|
|
215
|
+
const apiKey = getApiKey('openai');
|
|
216
|
+
if (!apiKey)
|
|
217
|
+
throw new Error('OPENAI_API_KEY not set');
|
|
218
|
+
const { text, sources } = await openaiCall(modelId, apiKey, `Search the web comprehensively for: ${query}\n\nReturn detailed, factual results with sources.`, 16000);
|
|
219
|
+
return { text, sources, backend: 'openai-web_search' };
|
|
220
|
+
}
|
|
221
|
+
export async function openaiFetch(prompt, modelId) {
|
|
222
|
+
const apiKey = getApiKey('openai');
|
|
223
|
+
if (!apiKey)
|
|
224
|
+
throw new Error('OPENAI_API_KEY not set');
|
|
225
|
+
const { text, sources } = await openaiCall(modelId, apiKey, `Read and extract content from the URL(s) in the following prompt. Preserve structure.\n\n${prompt}`, 32000);
|
|
226
|
+
return { text, sources, backend: 'openai-web_search' };
|
|
227
|
+
}
|
|
228
|
+
// ── DuckDuckGo HTML fallback (no API key required) ────────────────────────────
|
|
229
|
+
const FALLBACK_TIMEOUT_MS = 10_000;
|
|
230
|
+
const FALLBACK_USER_AGENT = 'Mozilla/5.0 (compatible; CortexV4/4.0; +https://github.com/Spitfire-Products/nexus-cortex)';
|
|
231
|
+
async function fetchWithTimeout(url, init = {}) {
|
|
232
|
+
const ctl = new AbortController();
|
|
233
|
+
const timer = setTimeout(() => ctl.abort(), FALLBACK_TIMEOUT_MS);
|
|
234
|
+
try {
|
|
235
|
+
return await fetch(url, {
|
|
236
|
+
...init,
|
|
237
|
+
signal: ctl.signal,
|
|
238
|
+
headers: { 'user-agent': FALLBACK_USER_AGENT, ...(init.headers ?? {}) },
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
finally {
|
|
242
|
+
clearTimeout(timer);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
export async function duckDuckGoSearch(query) {
|
|
246
|
+
const url = `https://html.duckduckgo.com/html/?q=${encodeURIComponent(query)}`;
|
|
247
|
+
const res = await fetchWithTimeout(url);
|
|
248
|
+
if (!res.ok)
|
|
249
|
+
throw new Error(`DuckDuckGo ${res.status}`);
|
|
250
|
+
const html = await res.text();
|
|
251
|
+
const sources = [];
|
|
252
|
+
const resultRegex = /<a[^>]+class="[^"]*result__a[^"]*"[^>]+href="([^"]+)"[^>]*>([\s\S]*?)<\/a>[\s\S]*?<a[^>]+class="[^"]*result__snippet[^"]*"[^>]*>([\s\S]*?)<\/a>/g;
|
|
253
|
+
let match;
|
|
254
|
+
let count = 0;
|
|
255
|
+
const lines = [];
|
|
256
|
+
while ((match = resultRegex.exec(html)) !== null && count < 10) {
|
|
257
|
+
const rawUrl = match[1] ?? '';
|
|
258
|
+
const titleHtml = match[2] ?? '';
|
|
259
|
+
const snippetHtml = match[3] ?? '';
|
|
260
|
+
if (!rawUrl)
|
|
261
|
+
continue;
|
|
262
|
+
const title = htmlToText(titleHtml, { wordwrap: false }).trim();
|
|
263
|
+
const snippet = htmlToText(snippetHtml, { wordwrap: false }).trim();
|
|
264
|
+
// DDG wraps URLs as /l/?uddg=ENCODED&...
|
|
265
|
+
const decodedUrl = decodeDdgUrl(rawUrl);
|
|
266
|
+
sources.push({ title, url: decodedUrl });
|
|
267
|
+
lines.push(`[${count + 1}] ${title}\n ${decodedUrl}\n ${snippet}`);
|
|
268
|
+
count += 1;
|
|
269
|
+
}
|
|
270
|
+
if (count === 0) {
|
|
271
|
+
return {
|
|
272
|
+
text: `No results found for: "${query}"`,
|
|
273
|
+
sources: [],
|
|
274
|
+
backend: 'duckduckgo-html',
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
text: `Search results for "${query}" (${count} results):\n\n${lines.join('\n\n')}`,
|
|
279
|
+
sources,
|
|
280
|
+
backend: 'duckduckgo-html',
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function decodeDdgUrl(href) {
|
|
284
|
+
if (!href.startsWith('//') && !href.startsWith('/l/'))
|
|
285
|
+
return href;
|
|
286
|
+
try {
|
|
287
|
+
const u = new URL(href.startsWith('//') ? `https:${href}` : `https://duckduckgo.com${href}`);
|
|
288
|
+
const real = u.searchParams.get('uddg');
|
|
289
|
+
return real ? decodeURIComponent(real) : href;
|
|
290
|
+
}
|
|
291
|
+
catch {
|
|
292
|
+
return href;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
const MAX_DIRECT_FETCH_BYTES = 100_000;
|
|
296
|
+
/** Direct HTTP fetch + html-to-text. URL must be public. */
|
|
297
|
+
export async function directFetch(url) {
|
|
298
|
+
const res = await fetchWithTimeout(url);
|
|
299
|
+
if (!res.ok)
|
|
300
|
+
throw new Error(`Direct fetch ${res.status} for ${url}`);
|
|
301
|
+
const contentType = res.headers.get('content-type') ?? '';
|
|
302
|
+
let body = await res.text();
|
|
303
|
+
if (body.length > MAX_DIRECT_FETCH_BYTES) {
|
|
304
|
+
body = body.slice(0, MAX_DIRECT_FETCH_BYTES) + '\n\n[Content truncated]';
|
|
305
|
+
}
|
|
306
|
+
const isHtml = contentType.includes('html') || /<html[\s>]/i.test(body.slice(0, 500));
|
|
307
|
+
const text = isHtml
|
|
308
|
+
? htmlToText(body, {
|
|
309
|
+
wordwrap: false,
|
|
310
|
+
selectors: [
|
|
311
|
+
{ selector: 'script', format: 'skip' },
|
|
312
|
+
{ selector: 'style', format: 'skip' },
|
|
313
|
+
{ selector: 'nav', format: 'skip' },
|
|
314
|
+
{ selector: 'footer', format: 'skip' },
|
|
315
|
+
],
|
|
316
|
+
})
|
|
317
|
+
: body;
|
|
318
|
+
return {
|
|
319
|
+
text: `URL: ${url}\n\n${text}`,
|
|
320
|
+
sources: [{ url }],
|
|
321
|
+
backend: 'direct-fetch',
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
// ── Selector ──────────────────────────────────────────────────────────────────
|
|
325
|
+
/**
|
|
326
|
+
* Selected web tools model ID. Reads `WEB_TOOLS_MODEL` and, if unset,
|
|
327
|
+
* picks a sensible default based on which provider key is present:
|
|
328
|
+
* GEMINI/GOOGLE → gemini-2.5-flash (free tier-friendly)
|
|
329
|
+
* ANTHROPIC → claude-haiku-4-5
|
|
330
|
+
* XAI → grok-4-fast-non-reasoning
|
|
331
|
+
* none → '' (DuckDuckGo fallback for search, direct fetch for fetch)
|
|
332
|
+
*
|
|
333
|
+
* Verified Gemini models with googleSearch + urlContext (2026-05-27):
|
|
334
|
+
* gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.5-pro,
|
|
335
|
+
* gemini-3-flash-preview (= gemini-3.5-flash preview), gemini-3.5-flash, gemini-3.1-pro-preview
|
|
336
|
+
*/
|
|
337
|
+
export function getWebToolsModel() {
|
|
338
|
+
const explicit = process.env.WEB_TOOLS_MODEL?.trim();
|
|
339
|
+
if (explicit)
|
|
340
|
+
return explicit;
|
|
341
|
+
if (process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY)
|
|
342
|
+
return 'gemini-2.5-flash';
|
|
343
|
+
if (process.env.ANTHROPIC_API_KEY)
|
|
344
|
+
return 'claude-haiku-4-5';
|
|
345
|
+
if (process.env.XAI_API_KEY)
|
|
346
|
+
return 'grok-4-fast-non-reasoning';
|
|
347
|
+
if (process.env.OPENAI_API_KEY)
|
|
348
|
+
return 'gpt-4o';
|
|
349
|
+
return '';
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Run a web search with provider-native backends, falling back to DuckDuckGo
|
|
353
|
+
* when no provider is configured or its API key is missing.
|
|
354
|
+
*/
|
|
355
|
+
export async function runWebSearch(query) {
|
|
356
|
+
const modelId = getWebToolsModel();
|
|
357
|
+
const provider = resolveProvider(modelId);
|
|
358
|
+
if (provider !== 'fallback' && getApiKey(provider)) {
|
|
359
|
+
try {
|
|
360
|
+
switch (provider) {
|
|
361
|
+
case 'anthropic':
|
|
362
|
+
return await anthropicSearch(query, modelId);
|
|
363
|
+
case 'xai':
|
|
364
|
+
return await xaiSearch(query, modelId);
|
|
365
|
+
case 'openai':
|
|
366
|
+
return await openaiSearch(query, modelId);
|
|
367
|
+
case 'google':
|
|
368
|
+
// Gemini googleSearch is implemented in WebSearchTool itself
|
|
369
|
+
// because it uses the @google/genai SDK and citation-byte logic.
|
|
370
|
+
throw new Error('__USE_GEMINI_SDK__');
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
catch (err) {
|
|
374
|
+
if (err.message === '__USE_GEMINI_SDK__')
|
|
375
|
+
throw err;
|
|
376
|
+
console.warn(`[web-tools] ${provider} search failed: ${err.message}`);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return duckDuckGoSearch(query);
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Run a web fetch with provider-native backends, falling back to direct
|
|
383
|
+
* HTTP + html-to-text. The `prompt` parameter contains the URL(s) and
|
|
384
|
+
* processing instructions (matching the WebFetch tool schema).
|
|
385
|
+
*/
|
|
386
|
+
export async function runWebFetch(prompt, urls) {
|
|
387
|
+
const modelId = getWebToolsModel();
|
|
388
|
+
const provider = resolveProvider(modelId);
|
|
389
|
+
if (provider !== 'fallback' && getApiKey(provider)) {
|
|
390
|
+
try {
|
|
391
|
+
switch (provider) {
|
|
392
|
+
case 'anthropic':
|
|
393
|
+
return await anthropicFetch(prompt, modelId);
|
|
394
|
+
case 'xai':
|
|
395
|
+
return await xaiFetch(prompt, modelId);
|
|
396
|
+
case 'openai':
|
|
397
|
+
return await openaiFetch(prompt, modelId);
|
|
398
|
+
case 'google':
|
|
399
|
+
throw new Error('__USE_GEMINI_SDK__');
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
catch (err) {
|
|
403
|
+
if (err.message === '__USE_GEMINI_SDK__')
|
|
404
|
+
throw err;
|
|
405
|
+
console.warn(`[web-tools] ${provider} fetch failed: ${err.message}`);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
// Direct fetch each URL in the prompt; concatenate results.
|
|
409
|
+
if (urls.length === 0) {
|
|
410
|
+
throw new Error('No URLs supplied for direct fetch fallback');
|
|
411
|
+
}
|
|
412
|
+
const parts = [];
|
|
413
|
+
const sources = [];
|
|
414
|
+
for (const u of urls.slice(0, 5)) {
|
|
415
|
+
try {
|
|
416
|
+
const r = await directFetch(u);
|
|
417
|
+
parts.push(r.text);
|
|
418
|
+
sources.push(...r.sources);
|
|
419
|
+
}
|
|
420
|
+
catch (err) {
|
|
421
|
+
parts.push(`URL: ${u}\n[fetch failed: ${err.message}]`);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
text: parts.join('\n\n---\n\n'),
|
|
426
|
+
sources,
|
|
427
|
+
backend: 'direct-fetch',
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
//# sourceMappingURL=webBackends.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webBackends.js","s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,EAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC;QAC/B,OAAO;QACP,OAAO,EAAE,cAAc;KACxB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebFetch reliability: the local-fetch fallback was issued with NO request
|
|
3
|
+
* headers, so Node's default User-Agent got 403/blocked by virtually every
|
|
4
|
+
* real site behind a CDN/WAF (county records, gov, news) — the dominant
|
|
5
|
+
* cause of the observed ~1/20 success rate. A browser-like header set makes
|
|
6
|
+
* most "blocked" pages return real HTML.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildBrowserFetchInit(signal: AbortSignal): RequestInit;
|
|
9
|
+
//# sourceMappingURL=webFetchRequestInit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webFetchRequestInit.d.ts","sourceRoot":"","sources":["../../../src/implementations/web/webFetchRequestInit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CActE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebFetch reliability: the local-fetch fallback was issued with NO request
|
|
3
|
+
* headers, so Node's default User-Agent got 403/blocked by virtually every
|
|
4
|
+
* real site behind a CDN/WAF (county records, gov, news) — the dominant
|
|
5
|
+
* cause of the observed ~1/20 success rate. A browser-like header set makes
|
|
6
|
+
* most "blocked" pages return real HTML.
|
|
7
|
+
*/
|
|
8
|
+
export function buildBrowserFetchInit(signal) {
|
|
9
|
+
return {
|
|
10
|
+
signal,
|
|
11
|
+
redirect: 'follow',
|
|
12
|
+
headers: {
|
|
13
|
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 ' +
|
|
14
|
+
'(KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36',
|
|
15
|
+
Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,' +
|
|
16
|
+
'image/avif,image/webp,*/*;q=0.8',
|
|
17
|
+
'Accept-Language': 'en-US,en;q=0.9',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=webFetchRequestInit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webFetchRequestInit.js","sourceRoot":"","sources":["../../../src/implementations/web/webFetchRequestInit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAmB;IACvD,OAAO;QACL,MAAM;QACN,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE;YACP,YAAY,EACV,+DAA+D;gBAC/D,oDAAoD;YACtD,MAAM,EACJ,wDAAwD;gBACxD,iCAAiC;YACnC,iBAAiB,EAAE,gBAAgB;SACpC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nexus-cortex/executors
|
|
3
|
+
*
|
|
4
|
+
* Tool execution layer for Nexus Cortex
|
|
5
|
+
*
|
|
6
|
+
* Provides concrete implementations for all 25 base tools plus addon tools.
|
|
7
|
+
* Separate from @nexus-cortex/core following the principle:
|
|
8
|
+
* "Definition ≠ Execution"
|
|
9
|
+
*/
|
|
10
|
+
export * from './base/index.js';
|
|
11
|
+
export * from './implementations/index.js';
|
|
12
|
+
export * from './utils/index.js';
|
|
13
|
+
export * from './ExecutorRegistry.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,cAAc,iBAAiB,CAAC;AAGhC,cAAc,4BAA4B,CAAC;AAG3C,cAAc,kBAAkB,CAAC;AAGjC,cAAc,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @nexus-cortex/executors
|
|
3
|
+
*
|
|
4
|
+
* Tool execution layer for Nexus Cortex
|
|
5
|
+
*
|
|
6
|
+
* Provides concrete implementations for all 25 base tools plus addon tools.
|
|
7
|
+
* Separate from @nexus-cortex/core following the principle:
|
|
8
|
+
* "Definition ≠ Execution"
|
|
9
|
+
*/
|
|
10
|
+
// Base classes and interfaces
|
|
11
|
+
export * from './base/index.js';
|
|
12
|
+
// Tool implementations
|
|
13
|
+
export * from './implementations/index.js';
|
|
14
|
+
// Utilities
|
|
15
|
+
export * from './utils/index.js';
|
|
16
|
+
// ExecutorRegistry (Phase 2.5)
|
|
17
|
+
export * from './ExecutorRegistry.js';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,8BAA8B;AAC9B,cAAc,iBAAiB,CAAC;AAEhC,uBAAuB;AACvB,cAAc,4BAA4B,CAAC;AAE3C,YAAY;AACZ,cAAc,kBAAkB,CAAC;AAEjC,+BAA+B;AAC/B,cAAc,uBAAuB,CAAC"}
|