@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
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @nexus-cortex/executors
|
|
2
|
+
|
|
3
|
+
Tool execution layer for Nexus Cortex
|
|
4
|
+
|
|
5
|
+
Part of **[Nexus Cortex](https://github.com/Spitfire-Products/nexus-cortex)** — a multi-provider AI agent harness (direct library, optional HTTP server, terminal UIs).
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @nexus-cortex/executors
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
See the [main README](https://github.com/Spitfire-Products/nexus-cortex#readme) for usage, architecture, and the full package list.
|
|
12
|
+
|
|
13
|
+
Apache-2.0 © Spitfire-Products
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executor Registry
|
|
3
|
+
*
|
|
4
|
+
* Bridges tool definitions (in core) with tool executors (in @nexus-cortex/executors).
|
|
5
|
+
* This module provides runtime access to tool implementations for execution.
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* - Core package: Tool definitions (schema, metadata)
|
|
9
|
+
* - Executors package: Tool implementations (execute() methods)
|
|
10
|
+
* - This registry: Maps tool names to their executors
|
|
11
|
+
*/
|
|
12
|
+
import type { BaseTool, ToolResult } from './base/index.js';
|
|
13
|
+
import type { ExecutorConfig, ExecutorRegistry as IExecutorRegistry } from '@nexus-cortex/types';
|
|
14
|
+
/**
|
|
15
|
+
* Executor Registry
|
|
16
|
+
*
|
|
17
|
+
* Central registry that maps tool names to their executor instances.
|
|
18
|
+
* Provides singleton access to all tool executors.
|
|
19
|
+
*/
|
|
20
|
+
export declare class ExecutorRegistry implements IExecutorRegistry {
|
|
21
|
+
private executors;
|
|
22
|
+
private config;
|
|
23
|
+
constructor(config: ExecutorConfig);
|
|
24
|
+
/**
|
|
25
|
+
* Register all tool executors
|
|
26
|
+
*
|
|
27
|
+
* Creates instances of each executor and registers them by name.
|
|
28
|
+
* This is called automatically on construction.
|
|
29
|
+
*/
|
|
30
|
+
private registerAllExecutors;
|
|
31
|
+
/**
|
|
32
|
+
* Register a single executor
|
|
33
|
+
*/
|
|
34
|
+
private register;
|
|
35
|
+
/**
|
|
36
|
+
* Get an executor by tool name
|
|
37
|
+
*
|
|
38
|
+
* @param toolName Name of the tool (e.g., "Read", "Write", "Bash")
|
|
39
|
+
* @returns Executor instance or undefined if not found
|
|
40
|
+
*/
|
|
41
|
+
getExecutor(toolName: string): BaseTool<any, ToolResult> | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Check if an executor exists for a tool
|
|
44
|
+
*/
|
|
45
|
+
hasExecutor(toolName: string): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Get all registered executor names
|
|
48
|
+
*/
|
|
49
|
+
getExecutorNames(): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Get count of registered executors
|
|
52
|
+
*/
|
|
53
|
+
getExecutorCount(): number;
|
|
54
|
+
/**
|
|
55
|
+
* Update executor config (e.g., add sessionId after session creation)
|
|
56
|
+
*
|
|
57
|
+
* This updates the shared config object that all executors reference.
|
|
58
|
+
* Since executor tools receive the config object by reference in their constructor,
|
|
59
|
+
* updating properties directly will propagate to all tools.
|
|
60
|
+
*
|
|
61
|
+
* @param updates Partial config updates
|
|
62
|
+
*/
|
|
63
|
+
updateConfig(updates: Partial<ExecutorConfig>): void;
|
|
64
|
+
/**
|
|
65
|
+
* Get current config
|
|
66
|
+
*
|
|
67
|
+
* @returns Current executor config
|
|
68
|
+
*/
|
|
69
|
+
getConfig(): ExecutorConfig;
|
|
70
|
+
/**
|
|
71
|
+
* Execute a tool by name
|
|
72
|
+
*
|
|
73
|
+
* @param toolName Name of the tool to execute
|
|
74
|
+
* @param params Tool parameters
|
|
75
|
+
* @param signal AbortSignal for cancellation
|
|
76
|
+
* @param updateOutput Optional callback for streaming output
|
|
77
|
+
* @returns Tool execution result
|
|
78
|
+
* @throws Error if executor not found or validation fails
|
|
79
|
+
*/
|
|
80
|
+
execute(toolName: string, params: any, signal: AbortSignal, updateOutput?: (output: string) => void): Promise<ToolResult>;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Create executor registry with default config
|
|
84
|
+
*
|
|
85
|
+
* @param config Executor configuration
|
|
86
|
+
* @returns Configured executor registry instance
|
|
87
|
+
*/
|
|
88
|
+
export declare function createExecutorRegistry(config: ExecutorConfig): ExecutorRegistry;
|
|
89
|
+
//# sourceMappingURL=ExecutorRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutorRegistry.d.ts","sourceRoot":"","sources":["../src/ExecutorRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AA0FjG;;;;;GAKG;AACH,qBAAa,gBAAiB,YAAW,iBAAiB;IACxD,OAAO,CAAC,SAAS,CAAyC;IAC1D,OAAO,CAAC,MAAM,CAAiB;gBAEnB,MAAM,EAAE,cAAc;IAMlC;;;;;OAKG;IACH,OAAO,CAAC,oBAAoB;IAiF5B;;OAEG;IACH,OAAO,CAAC,QAAQ;IAIhB;;;;;OAKG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,SAAS;IAIpE;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAItC;;OAEG;IACH,gBAAgB,IAAI,MAAM,EAAE;IAI5B;;OAEG;IACH,gBAAgB,IAAI,MAAM;IAI1B;;;;;;;;OAQG;IACH,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI;IAMpD;;;;OAIG;IACH,SAAS,IAAI,cAAc;IAI3B;;;;;;;;;OASG;IACG,OAAO,CACX,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,WAAW,EACnB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GACtC,OAAO,CAAC,UAAU,CAAC;CAevB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAE/E"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executor Registry
|
|
3
|
+
*
|
|
4
|
+
* Bridges tool definitions (in core) with tool executors (in @nexus-cortex/executors).
|
|
5
|
+
* This module provides runtime access to tool implementations for execution.
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* - Core package: Tool definitions (schema, metadata)
|
|
9
|
+
* - Executors package: Tool implementations (execute() methods)
|
|
10
|
+
* - This registry: Maps tool names to their executors
|
|
11
|
+
*/
|
|
12
|
+
import {
|
|
13
|
+
// File operations
|
|
14
|
+
ReadFileTool, WriteFileTool, WriteBinaryTool, EditTool, } from './implementations/file/index.js';
|
|
15
|
+
import {
|
|
16
|
+
// Search operations
|
|
17
|
+
GlobTool, GrepTool, } from './implementations/search/index.js';
|
|
18
|
+
import {
|
|
19
|
+
// Execution operations
|
|
20
|
+
ShellTool, BashOutputTool, KillShellTool, WorkspaceManagerTool, CodeExecuteTool, SearchToolsTool, } from './implementations/execution/index.js';
|
|
21
|
+
import {
|
|
22
|
+
// Web operations
|
|
23
|
+
WebFetchTool, WebSearchTool, BrowseTool, SandboxTransferTool, } from './implementations/web/index.js';
|
|
24
|
+
import {
|
|
25
|
+
// UI/Planning operations
|
|
26
|
+
TodoCreateTool, TodoUpdateTool, TodoListTool, AskUserQuestionTool, ExitPlanModeTool, } from './implementations/ui/index.js';
|
|
27
|
+
import {
|
|
28
|
+
// Notebook operations
|
|
29
|
+
NotebookEditTool, } from './implementations/notebook/index.js';
|
|
30
|
+
import {
|
|
31
|
+
// Historical operations
|
|
32
|
+
RequestHistoricalContextToolExecutor, SearchConversationHistoryToolExecutor, GetConversationSegmentToolExecutor, ListCompactionBoundariesToolExecutor, ListSessionsToolExecutor, LoadSessionToolExecutor, } from './implementations/historical/index.js';
|
|
33
|
+
import {
|
|
34
|
+
// Extension operations
|
|
35
|
+
SlashCommandToolExecutor, SkillToolExecutor, ResearchBacklogToolExecutor, EndTurnToolExecutor, } from './implementations/extensions/index.js';
|
|
36
|
+
import {
|
|
37
|
+
// Agent operations
|
|
38
|
+
TaskToolExecutor, PRAgentToolExecutor, } from './implementations/agent/index.js';
|
|
39
|
+
import {
|
|
40
|
+
// Artifact operations (Visual Workspace)
|
|
41
|
+
CreateArtifactToolExecutor, InteractWithSandboxExecutor, ModifySandboxExecutor, InspectSandboxExecutor, SandboxScanExecutor, SandboxGrabExecutor, SandboxDetectFrameworkExecutor, SandboxComponentTreeExecutor, SandboxRenderTraceExecutor, StopSandboxExecutor, } from './implementations/addon/index.js';
|
|
42
|
+
import {
|
|
43
|
+
// Tmux operations
|
|
44
|
+
TmuxSessionTool, } from './implementations/tmux/index.js';
|
|
45
|
+
/**
|
|
46
|
+
* Executor Registry
|
|
47
|
+
*
|
|
48
|
+
* Central registry that maps tool names to their executor instances.
|
|
49
|
+
* Provides singleton access to all tool executors.
|
|
50
|
+
*/
|
|
51
|
+
export class ExecutorRegistry {
|
|
52
|
+
executors;
|
|
53
|
+
config;
|
|
54
|
+
constructor(config) {
|
|
55
|
+
this.config = config;
|
|
56
|
+
this.executors = new Map();
|
|
57
|
+
this.registerAllExecutors();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Register all tool executors
|
|
61
|
+
*
|
|
62
|
+
* Creates instances of each executor and registers them by name.
|
|
63
|
+
* This is called automatically on construction.
|
|
64
|
+
*/
|
|
65
|
+
registerAllExecutors() {
|
|
66
|
+
// File operations
|
|
67
|
+
this.register(new ReadFileTool(this.config));
|
|
68
|
+
this.register(new WriteFileTool(this.config));
|
|
69
|
+
this.register(new WriteBinaryTool(this.config));
|
|
70
|
+
this.register(new EditTool(this.config));
|
|
71
|
+
// Search operations
|
|
72
|
+
this.register(new GlobTool(this.config));
|
|
73
|
+
this.register(new GrepTool(this.config));
|
|
74
|
+
// Execution operations
|
|
75
|
+
this.register(new ShellTool(this.config));
|
|
76
|
+
this.register(new BashOutputTool(this.config));
|
|
77
|
+
this.register(new KillShellTool(this.config));
|
|
78
|
+
// Web operations
|
|
79
|
+
this.register(new WebFetchTool(this.config));
|
|
80
|
+
this.register(new WebSearchTool(this.config));
|
|
81
|
+
this.register(new BrowseTool());
|
|
82
|
+
this.register(new SandboxTransferTool(this.config));
|
|
83
|
+
// UI/Planning operations (split-tool todo pattern)
|
|
84
|
+
this.register(new TodoCreateTool(this.config));
|
|
85
|
+
this.register(new TodoUpdateTool(this.config));
|
|
86
|
+
this.register(new TodoListTool(this.config));
|
|
87
|
+
this.register(new AskUserQuestionTool(this.config));
|
|
88
|
+
this.register(new ExitPlanModeTool(this.config));
|
|
89
|
+
// Notebook operations
|
|
90
|
+
this.register(new NotebookEditTool(this.config));
|
|
91
|
+
// Historical operations
|
|
92
|
+
this.register(new RequestHistoricalContextToolExecutor(this.config));
|
|
93
|
+
this.register(new SearchConversationHistoryToolExecutor(this.config));
|
|
94
|
+
this.register(new GetConversationSegmentToolExecutor(this.config));
|
|
95
|
+
this.register(new ListCompactionBoundariesToolExecutor(this.config));
|
|
96
|
+
this.register(new ListSessionsToolExecutor(this.config));
|
|
97
|
+
this.register(new LoadSessionToolExecutor(this.config));
|
|
98
|
+
// MCP operations
|
|
99
|
+
// Note: DiscoveredMcpToolExecutor is created dynamically when MCP servers are discovered
|
|
100
|
+
// It's not pre-registered here
|
|
101
|
+
// Extension operations
|
|
102
|
+
this.register(new SlashCommandToolExecutor(this.config));
|
|
103
|
+
this.register(new SkillToolExecutor(this.config));
|
|
104
|
+
this.register(new ResearchBacklogToolExecutor({ workingDirectory: this.config.workingDirectory || process.cwd() }));
|
|
105
|
+
this.register(new EndTurnToolExecutor());
|
|
106
|
+
// Agent operations
|
|
107
|
+
this.register(new TaskToolExecutor(this.config));
|
|
108
|
+
this.register(new PRAgentToolExecutor(this.config));
|
|
109
|
+
// Workspace operations
|
|
110
|
+
this.register(new WorkspaceManagerTool(this.config));
|
|
111
|
+
// Artifact operations (Visual Workspace)
|
|
112
|
+
// These tools use workingDirectory from config or no args
|
|
113
|
+
// Renamed from CreateAddon to CreateArtifact (clearer semantics)
|
|
114
|
+
this.register(new CreateArtifactToolExecutor({ workingDirectory: this.config.workingDirectory || process.cwd() }));
|
|
115
|
+
this.register(new InteractWithSandboxExecutor());
|
|
116
|
+
this.register(new ModifySandboxExecutor({ workingDirectory: this.config.workingDirectory || process.cwd() }));
|
|
117
|
+
this.register(new InspectSandboxExecutor());
|
|
118
|
+
this.register(new SandboxScanExecutor());
|
|
119
|
+
this.register(new SandboxGrabExecutor());
|
|
120
|
+
this.register(new SandboxDetectFrameworkExecutor());
|
|
121
|
+
this.register(new SandboxComponentTreeExecutor());
|
|
122
|
+
this.register(new SandboxRenderTraceExecutor());
|
|
123
|
+
this.register(new StopSandboxExecutor({ workingDirectory: this.config.workingDirectory || process.cwd() }));
|
|
124
|
+
// Code execution (token-efficient tool chaining)
|
|
125
|
+
this.register(new CodeExecuteTool());
|
|
126
|
+
// Tool discovery (progressive loading)
|
|
127
|
+
this.register(new SearchToolsTool());
|
|
128
|
+
// Tmux operations
|
|
129
|
+
this.register(new TmuxSessionTool(this.config));
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Register a single executor
|
|
133
|
+
*/
|
|
134
|
+
register(executor) {
|
|
135
|
+
this.executors.set(executor.name, executor);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get an executor by tool name
|
|
139
|
+
*
|
|
140
|
+
* @param toolName Name of the tool (e.g., "Read", "Write", "Bash")
|
|
141
|
+
* @returns Executor instance or undefined if not found
|
|
142
|
+
*/
|
|
143
|
+
getExecutor(toolName) {
|
|
144
|
+
return this.executors.get(toolName);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Check if an executor exists for a tool
|
|
148
|
+
*/
|
|
149
|
+
hasExecutor(toolName) {
|
|
150
|
+
return this.executors.has(toolName);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Get all registered executor names
|
|
154
|
+
*/
|
|
155
|
+
getExecutorNames() {
|
|
156
|
+
return Array.from(this.executors.keys());
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Get count of registered executors
|
|
160
|
+
*/
|
|
161
|
+
getExecutorCount() {
|
|
162
|
+
return this.executors.size;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Update executor config (e.g., add sessionId after session creation)
|
|
166
|
+
*
|
|
167
|
+
* This updates the shared config object that all executors reference.
|
|
168
|
+
* Since executor tools receive the config object by reference in their constructor,
|
|
169
|
+
* updating properties directly will propagate to all tools.
|
|
170
|
+
*
|
|
171
|
+
* @param updates Partial config updates
|
|
172
|
+
*/
|
|
173
|
+
updateConfig(updates) {
|
|
174
|
+
// Mutate the existing config object instead of creating a new one
|
|
175
|
+
// so that all executor tool instances (which hold a reference) get the updates
|
|
176
|
+
Object.assign(this.config, updates);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Get current config
|
|
180
|
+
*
|
|
181
|
+
* @returns Current executor config
|
|
182
|
+
*/
|
|
183
|
+
getConfig() {
|
|
184
|
+
return { ...this.config };
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Execute a tool by name
|
|
188
|
+
*
|
|
189
|
+
* @param toolName Name of the tool to execute
|
|
190
|
+
* @param params Tool parameters
|
|
191
|
+
* @param signal AbortSignal for cancellation
|
|
192
|
+
* @param updateOutput Optional callback for streaming output
|
|
193
|
+
* @returns Tool execution result
|
|
194
|
+
* @throws Error if executor not found or validation fails
|
|
195
|
+
*/
|
|
196
|
+
async execute(toolName, params, signal, updateOutput) {
|
|
197
|
+
const executor = this.getExecutor(toolName);
|
|
198
|
+
if (!executor) {
|
|
199
|
+
throw new Error(`No executor found for tool: ${toolName}`);
|
|
200
|
+
}
|
|
201
|
+
// Validate parameters
|
|
202
|
+
const validationError = executor.validateToolParams(params);
|
|
203
|
+
if (validationError) {
|
|
204
|
+
throw new Error(`Parameter validation failed for ${toolName}: ${validationError}`);
|
|
205
|
+
}
|
|
206
|
+
// Execute the tool
|
|
207
|
+
return await executor.execute(params, signal, updateOutput);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Create executor registry with default config
|
|
212
|
+
*
|
|
213
|
+
* @param config Executor configuration
|
|
214
|
+
* @returns Configured executor registry instance
|
|
215
|
+
*/
|
|
216
|
+
export function createExecutorRegistry(config) {
|
|
217
|
+
return new ExecutorRegistry(config);
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=ExecutorRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutorRegistry.js","sourceRoot":"","sources":["../src/ExecutorRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO;AACL,kBAAkB;AAClB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,QAAQ,GACT,MAAM,iCAAiC,CAAC;AAEzC,OAAO;AACL,oBAAoB;AACpB,QAAQ,EACR,QAAQ,GACT,MAAM,mCAAmC,CAAC;AAE3C,OAAO;AACL,uBAAuB;AACvB,SAAS,EACT,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,eAAe,GAChB,MAAM,sCAAsC,CAAC;AAE9C,OAAO;AACL,iBAAiB;AACjB,YAAY,EACZ,aAAa,EACb,UAAU,EACV,mBAAmB,GACpB,MAAM,gCAAgC,CAAC;AAExC,OAAO;AACL,yBAAyB;AACzB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AAEvC,OAAO;AACL,sBAAsB;AACtB,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAE7C,OAAO;AACL,wBAAwB;AACxB,oCAAoC,EACpC,qCAAqC,EACrC,kCAAkC,EAClC,oCAAoC,EACpC,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,uCAAuC,CAAC;AAE/C,OAAO;AACL,uBAAuB;AACvB,wBAAwB,EACxB,iBAAiB,EACjB,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,uCAAuC,CAAC;AAE/C,OAAO;AACL,mBAAmB;AACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,kCAAk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O,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IAC9D,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,MAAsB;IAC3D,OAAO,IAAI,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Tool Abstract Class
|
|
3
|
+
*
|
|
4
|
+
* Foundation for all tool executors in Nexus Cortex
|
|
5
|
+
* Adapted from Gemini CLI patterns
|
|
6
|
+
*
|
|
7
|
+
* Key Principle: Definition ≠ Execution
|
|
8
|
+
* - Tool definitions live in @nexus-cortex/core
|
|
9
|
+
* - Tool executors live here in @nexus-cortex/executors
|
|
10
|
+
*/
|
|
11
|
+
import type { ToolSchema } from '@nexus-cortex/types';
|
|
12
|
+
import type { ToolResult, ToolCallConfirmationDetails } from './ToolResult.js';
|
|
13
|
+
/**
|
|
14
|
+
* Abstract base class for tool execution
|
|
15
|
+
*
|
|
16
|
+
* All tool executors must extend this class and implement:
|
|
17
|
+
* - validateToolParams(): Validate parameters before execution
|
|
18
|
+
* - execute(): Perform the actual tool operation
|
|
19
|
+
*
|
|
20
|
+
* Optionally override:
|
|
21
|
+
* - shouldConfirmExecute(): Determine if user confirmation is needed
|
|
22
|
+
* - getDescription(): Provide human-readable description of action
|
|
23
|
+
*/
|
|
24
|
+
export declare abstract class BaseTool<TParams = unknown, TResult extends ToolResult = ToolResult> {
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly displayName: string;
|
|
27
|
+
readonly description: string;
|
|
28
|
+
readonly parameterSchema: ToolSchema;
|
|
29
|
+
readonly isOutputMarkdown: boolean;
|
|
30
|
+
readonly canUpdateOutput: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new tool executor
|
|
33
|
+
*
|
|
34
|
+
* @param name Internal name of the tool (matches definition in core)
|
|
35
|
+
* @param displayName User-friendly display name
|
|
36
|
+
* @param description What the tool does
|
|
37
|
+
* @param parameterSchema JSON Schema for parameters
|
|
38
|
+
* @param isOutputMarkdown Whether output should be rendered as markdown
|
|
39
|
+
* @param canUpdateOutput Whether tool supports streaming output
|
|
40
|
+
*/
|
|
41
|
+
constructor(name: string, displayName: string, description: string, parameterSchema: ToolSchema, isOutputMarkdown?: boolean, canUpdateOutput?: boolean);
|
|
42
|
+
/**
|
|
43
|
+
* Validate parameters before execution
|
|
44
|
+
*
|
|
45
|
+
* MUST be implemented by all tool executors.
|
|
46
|
+
* Should check:
|
|
47
|
+
* - Required parameters are present
|
|
48
|
+
* - Parameter types are correct
|
|
49
|
+
* - Parameter values are valid
|
|
50
|
+
* - Any tool-specific constraints
|
|
51
|
+
*
|
|
52
|
+
* @param params Parameters to validate
|
|
53
|
+
* @returns Error message if invalid, null if valid
|
|
54
|
+
*/
|
|
55
|
+
abstract validateToolParams(params: TParams): string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Execute the tool with given parameters
|
|
58
|
+
*
|
|
59
|
+
* MUST be implemented by all tool executors.
|
|
60
|
+
* This is where the actual tool logic runs.
|
|
61
|
+
*
|
|
62
|
+
* @param params Tool parameters (already validated)
|
|
63
|
+
* @param signal AbortSignal for cancellation support
|
|
64
|
+
* @param updateOutput Optional callback for streaming output
|
|
65
|
+
* @returns Result of tool execution
|
|
66
|
+
*/
|
|
67
|
+
abstract execute(params: TParams, signal: AbortSignal, updateOutput?: (output: string) => void): Promise<TResult>;
|
|
68
|
+
/**
|
|
69
|
+
* Get human-readable description of what the tool will do
|
|
70
|
+
*
|
|
71
|
+
* Used for logging, debugging, and user confirmation prompts.
|
|
72
|
+
* Default implementation returns JSON stringified params.
|
|
73
|
+
* Override to provide better descriptions.
|
|
74
|
+
*
|
|
75
|
+
* @param params Tool parameters
|
|
76
|
+
* @returns Human-readable description
|
|
77
|
+
*/
|
|
78
|
+
getDescription(params: TParams): string;
|
|
79
|
+
/**
|
|
80
|
+
* Determine if tool execution should prompt for user confirmation
|
|
81
|
+
*
|
|
82
|
+
* Override this for tools that:
|
|
83
|
+
* - Modify files
|
|
84
|
+
* - Execute commands
|
|
85
|
+
* - Make network requests
|
|
86
|
+
* - Perform destructive operations
|
|
87
|
+
*
|
|
88
|
+
* Default: No confirmation required
|
|
89
|
+
*
|
|
90
|
+
* @param params Tool parameters
|
|
91
|
+
* @param signal AbortSignal
|
|
92
|
+
* @returns Confirmation details or false if no confirmation needed
|
|
93
|
+
*/
|
|
94
|
+
shouldConfirmExecute(params: TParams, signal: AbortSignal): Promise<ToolCallConfirmationDetails | false>;
|
|
95
|
+
/**
|
|
96
|
+
* Helper: Create success result
|
|
97
|
+
*
|
|
98
|
+
* Convenience method for creating successful tool results
|
|
99
|
+
*/
|
|
100
|
+
protected createSuccessResult(content: string | any[], metadata?: ToolResult['metadata']): ToolResult;
|
|
101
|
+
/**
|
|
102
|
+
* Helper: Create error result
|
|
103
|
+
*
|
|
104
|
+
* Convenience method for creating error tool results
|
|
105
|
+
*/
|
|
106
|
+
protected createErrorResult(error: string | Error, metadata?: ToolResult['metadata']): ToolResult;
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=BaseTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseTool.d.ts","sourceRoot":"","sources":["../../src/base/BaseTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE/E;;;;;;;;;;GAUG;AACH,8BAAsB,QAAQ,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,SAAS,UAAU,GAAG,UAAU;aAYrE,IAAI,EAAE,MAAM;aACZ,WAAW,EAAE,MAAM;aACnB,WAAW,EAAE,MAAM;aACnB,eAAe,EAAE,UAAU;aAC3B,gBAAgB,EAAE,OAAO;aACzB,eAAe,EAAE,O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