@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,111 @@
|
|
|
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
|
+
/**
|
|
12
|
+
* Abstract base class for tool execution
|
|
13
|
+
*
|
|
14
|
+
* All tool executors must extend this class and implement:
|
|
15
|
+
* - validateToolParams(): Validate parameters before execution
|
|
16
|
+
* - execute(): Perform the actual tool operation
|
|
17
|
+
*
|
|
18
|
+
* Optionally override:
|
|
19
|
+
* - shouldConfirmExecute(): Determine if user confirmation is needed
|
|
20
|
+
* - getDescription(): Provide human-readable description of action
|
|
21
|
+
*/
|
|
22
|
+
export class BaseTool {
|
|
23
|
+
name;
|
|
24
|
+
displayName;
|
|
25
|
+
description;
|
|
26
|
+
parameterSchema;
|
|
27
|
+
isOutputMarkdown;
|
|
28
|
+
canUpdateOutput;
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new tool executor
|
|
31
|
+
*
|
|
32
|
+
* @param name Internal name of the tool (matches definition in core)
|
|
33
|
+
* @param displayName User-friendly display name
|
|
34
|
+
* @param description What the tool does
|
|
35
|
+
* @param parameterSchema JSON Schema for parameters
|
|
36
|
+
* @param isOutputMarkdown Whether output should be rendered as markdown
|
|
37
|
+
* @param canUpdateOutput Whether tool supports streaming output
|
|
38
|
+
*/
|
|
39
|
+
constructor(name, displayName, description, parameterSchema, isOutputMarkdown = true, canUpdateOutput = false) {
|
|
40
|
+
this.name = name;
|
|
41
|
+
this.displayName = displayName;
|
|
42
|
+
this.description = description;
|
|
43
|
+
this.parameterSchema = parameterSchema;
|
|
44
|
+
this.isOutputMarkdown = isOutputMarkdown;
|
|
45
|
+
this.canUpdateOutput = canUpdateOutput;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get human-readable description of what the tool will do
|
|
49
|
+
*
|
|
50
|
+
* Used for logging, debugging, and user confirmation prompts.
|
|
51
|
+
* Default implementation returns JSON stringified params.
|
|
52
|
+
* Override to provide better descriptions.
|
|
53
|
+
*
|
|
54
|
+
* @param params Tool parameters
|
|
55
|
+
* @returns Human-readable description
|
|
56
|
+
*/
|
|
57
|
+
getDescription(params) {
|
|
58
|
+
return `Executing ${this.displayName} with: ${JSON.stringify(params)}`;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Determine if tool execution should prompt for user confirmation
|
|
62
|
+
*
|
|
63
|
+
* Override this for tools that:
|
|
64
|
+
* - Modify files
|
|
65
|
+
* - Execute commands
|
|
66
|
+
* - Make network requests
|
|
67
|
+
* - Perform destructive operations
|
|
68
|
+
*
|
|
69
|
+
* Default: No confirmation required
|
|
70
|
+
*
|
|
71
|
+
* @param params Tool parameters
|
|
72
|
+
* @param signal AbortSignal
|
|
73
|
+
* @returns Confirmation details or false if no confirmation needed
|
|
74
|
+
*/
|
|
75
|
+
async shouldConfirmExecute(
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
77
|
+
params,
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
79
|
+
signal) {
|
|
80
|
+
return false; // Default: no confirmation
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Helper: Create success result
|
|
84
|
+
*
|
|
85
|
+
* Convenience method for creating successful tool results
|
|
86
|
+
*/
|
|
87
|
+
createSuccessResult(content, metadata) {
|
|
88
|
+
return {
|
|
89
|
+
llmContent: content,
|
|
90
|
+
returnDisplay: typeof content === 'string' ? content : JSON.stringify(content, null, 2),
|
|
91
|
+
success: true,
|
|
92
|
+
metadata,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Helper: Create error result
|
|
97
|
+
*
|
|
98
|
+
* Convenience method for creating error tool results
|
|
99
|
+
*/
|
|
100
|
+
createErrorResult(error, metadata) {
|
|
101
|
+
const errorMessage = error instanceof Error ? error.message : error;
|
|
102
|
+
return {
|
|
103
|
+
llmContent: `Error: ${errorMessage}`,
|
|
104
|
+
returnDisplay: `Error: ${errorMessage}`,
|
|
105
|
+
success: false,
|
|
106
|
+
error: errorMessage,
|
|
107
|
+
metadata,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=BaseTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseTool.js","sourceRoot":"","sources":["../../src/base/BaseTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH;;;;;;;;;;GAUG;AACH,MAAM,OAAgB,QAAQ;IAYV;IACA;IACA;IACA;IACA;IACA;IAhBlB;;;;;;;;;OASG;IACH,YACkB,IAAY,EACZ,WAAmB,EACnB,WAAmB,EACnB,eAA2B,EAC3B,mBAA4B,IAAI,EAChC,kBAA2B,KAAK;QALhC,SAAI,GAAJ,IAAI,CAAQ;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
|
5
|
+
* Central coordination point for all tool execution in Nexus Cortex
|
|
6
|
+
*/
|
|
7
|
+
import type { BaseTool } from './BaseTool.js';
|
|
8
|
+
import type { ToolResult } from './ToolResult.js';
|
|
9
|
+
import type { ExecutorConfig } from '@nexus-cortex/types';
|
|
10
|
+
export type { ExecutorConfig };
|
|
11
|
+
/**
|
|
12
|
+
* Tool execution statistics
|
|
13
|
+
*/
|
|
14
|
+
export interface ToolExecutionStats {
|
|
15
|
+
/** Tool name */
|
|
16
|
+
toolName: string;
|
|
17
|
+
/** Number of times executed */
|
|
18
|
+
executionCount: number;
|
|
19
|
+
/** Total execution time (milliseconds) */
|
|
20
|
+
totalExecutionTime: number;
|
|
21
|
+
/** Average execution time (milliseconds) */
|
|
22
|
+
averageExecutionTime: number;
|
|
23
|
+
/** Number of successful executions */
|
|
24
|
+
successCount: number;
|
|
25
|
+
/** Number of failed executions */
|
|
26
|
+
failureCount: number;
|
|
27
|
+
/** Last execution timestamp */
|
|
28
|
+
lastExecuted?: Date;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Tool Registry
|
|
32
|
+
*
|
|
33
|
+
* Manages tool executor instances and provides execution interface
|
|
34
|
+
*/
|
|
35
|
+
export declare class ToolRegistry {
|
|
36
|
+
private config;
|
|
37
|
+
/** Registered tool executors */
|
|
38
|
+
private tools;
|
|
39
|
+
/** Execution statistics */
|
|
40
|
+
private stats;
|
|
41
|
+
constructor(config: ExecutorConfig);
|
|
42
|
+
/**
|
|
43
|
+
* Register a tool executor
|
|
44
|
+
*
|
|
45
|
+
* @param tool Tool executor instance
|
|
46
|
+
* @throws Error if tool with same name already registered
|
|
47
|
+
*/
|
|
48
|
+
registerTool(tool: BaseTool<any, any>): void;
|
|
49
|
+
/**
|
|
50
|
+
* Update executor config (e.g., add sessionId after session creation)
|
|
51
|
+
*
|
|
52
|
+
* @param updates Partial config updates
|
|
53
|
+
*/
|
|
54
|
+
updateConfig(updates: Partial<ExecutorConfig>): void;
|
|
55
|
+
/**
|
|
56
|
+
* Get current config
|
|
57
|
+
*
|
|
58
|
+
* @returns Current executor config
|
|
59
|
+
*/
|
|
60
|
+
getConfig(): ExecutorConfig;
|
|
61
|
+
/**
|
|
62
|
+
* Unregister a tool executor
|
|
63
|
+
*
|
|
64
|
+
* @param name Tool name
|
|
65
|
+
* @returns true if tool was removed, false if not found
|
|
66
|
+
*/
|
|
67
|
+
unregisterTool(name: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Get a tool executor by name
|
|
70
|
+
*
|
|
71
|
+
* @param name Tool name
|
|
72
|
+
* @returns Tool executor or undefined if not found
|
|
73
|
+
*/
|
|
74
|
+
getTool(name: string): BaseTool<any, any> | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Check if a tool is registered
|
|
77
|
+
*
|
|
78
|
+
* @param name Tool name
|
|
79
|
+
* @returns true if registered, false otherwise
|
|
80
|
+
*/
|
|
81
|
+
hasTool(name: string): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Get all registered tool names
|
|
84
|
+
*
|
|
85
|
+
* @returns Array of tool names
|
|
86
|
+
*/
|
|
87
|
+
getToolNames(): string[];
|
|
88
|
+
/**
|
|
89
|
+
* Get count of registered tools
|
|
90
|
+
*
|
|
91
|
+
* @returns Number of registered tools
|
|
92
|
+
*/
|
|
93
|
+
getToolCount(): number;
|
|
94
|
+
/**
|
|
95
|
+
* Execute a tool by name
|
|
96
|
+
*
|
|
97
|
+
* Main execution method that:
|
|
98
|
+
* 1. Validates tool exists
|
|
99
|
+
* 2. Validates parameters
|
|
100
|
+
* 3. Executes tool
|
|
101
|
+
* 4. Handles errors
|
|
102
|
+
* 5. Updates statistics
|
|
103
|
+
*
|
|
104
|
+
* @param name Tool name
|
|
105
|
+
* @param params Tool parameters
|
|
106
|
+
* @param signal AbortSignal for cancellation
|
|
107
|
+
* @param updateOutput Optional callback for streaming output
|
|
108
|
+
* @returns Tool execution result
|
|
109
|
+
*/
|
|
110
|
+
executeTool(name: string, params: any, signal?: AbortSignal, updateOutput?: (output: string) => void): Promise<ToolResult>;
|
|
111
|
+
/**
|
|
112
|
+
* Get execution statistics for a tool
|
|
113
|
+
*
|
|
114
|
+
* @param name Tool name
|
|
115
|
+
* @returns Statistics or undefined if tool not found
|
|
116
|
+
*/
|
|
117
|
+
getToolStats(name: string): ToolExecutionStats | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* Get execution statistics for all tools
|
|
120
|
+
*
|
|
121
|
+
* @returns Map of tool name to statistics
|
|
122
|
+
*/
|
|
123
|
+
getAllStats(): Map<string, ToolExecutionStats>;
|
|
124
|
+
/**
|
|
125
|
+
* Reset statistics for a tool
|
|
126
|
+
*
|
|
127
|
+
* @param name Tool name
|
|
128
|
+
*/
|
|
129
|
+
resetToolStats(name: string): void;
|
|
130
|
+
/**
|
|
131
|
+
* Reset statistics for all tools
|
|
132
|
+
*/
|
|
133
|
+
resetAllStats(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Update execution statistics
|
|
136
|
+
*
|
|
137
|
+
* @private
|
|
138
|
+
*/
|
|
139
|
+
private updateStats;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=ToolRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolRegistry.d.ts","sourceRoot":"","sources":["../../src/base/ToolRegistry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IAEjB,+BAA+B;IAC/B,cAAc,EAAE,MAAM,CAAC;IAEvB,0CAA0C;IAC1C,kBA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D;;;;OAIG;IACH,WAAW,IAAI,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC;IAI9C;;;;OAIG;IACH,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAclC;;OAEG;IACH,aAAa,IAAI,IAAI;IAMrB;;;;OAIG;IACH,OAAO,CAAC,WAAW;CAepB"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Registry
|
|
3
|
+
*
|
|
4
|
+
* Manages registration and execution of tool executors
|
|
5
|
+
* Central coordination point for all tool execution in Nexus Cortex
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Tool Registry
|
|
9
|
+
*
|
|
10
|
+
* Manages tool executor instances and provides execution interface
|
|
11
|
+
*/
|
|
12
|
+
export class ToolRegistry {
|
|
13
|
+
config;
|
|
14
|
+
/** Registered tool executors */
|
|
15
|
+
tools = new Map();
|
|
16
|
+
/** Execution statistics */
|
|
17
|
+
stats = new Map();
|
|
18
|
+
constructor(config) {
|
|
19
|
+
this.config = config;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Register a tool executor
|
|
23
|
+
*
|
|
24
|
+
* @param tool Tool executor instance
|
|
25
|
+
* @throws Error if tool with same name already registered
|
|
26
|
+
*/
|
|
27
|
+
registerTool(tool) {
|
|
28
|
+
if (this.tools.has(tool.name)) {
|
|
29
|
+
throw new Error(`Tool '${tool.name}' is already registered`);
|
|
30
|
+
}
|
|
31
|
+
this.tools.set(tool.name, tool);
|
|
32
|
+
// Initialize stats
|
|
33
|
+
this.stats.set(tool.name, {
|
|
34
|
+
toolName: tool.name,
|
|
35
|
+
executionCount: 0,
|
|
36
|
+
totalExecutionTime: 0,
|
|
37
|
+
averageExecutionTime: 0,
|
|
38
|
+
successCount: 0,
|
|
39
|
+
failureCount: 0,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Update executor config (e.g., add sessionId after session creation)
|
|
44
|
+
*
|
|
45
|
+
* @param updates Partial config updates
|
|
46
|
+
*/
|
|
47
|
+
updateConfig(updates) {
|
|
48
|
+
this.config = { ...this.config, ...updates };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get current config
|
|
52
|
+
*
|
|
53
|
+
* @returns Current executor config
|
|
54
|
+
*/
|
|
55
|
+
getConfig() {
|
|
56
|
+
return { ...this.config };
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Unregister a tool executor
|
|
60
|
+
*
|
|
61
|
+
* @param name Tool name
|
|
62
|
+
* @returns true if tool was removed, false if not found
|
|
63
|
+
*/
|
|
64
|
+
unregisterTool(name) {
|
|
65
|
+
const removed = this.tools.delete(name);
|
|
66
|
+
if (removed) {
|
|
67
|
+
this.stats.delete(name);
|
|
68
|
+
}
|
|
69
|
+
return removed;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Get a tool executor by name
|
|
73
|
+
*
|
|
74
|
+
* @param name Tool name
|
|
75
|
+
* @returns Tool executor or undefined if not found
|
|
76
|
+
*/
|
|
77
|
+
getTool(name) {
|
|
78
|
+
return this.tools.get(name);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Check if a tool is registered
|
|
82
|
+
*
|
|
83
|
+
* @param name Tool name
|
|
84
|
+
* @returns true if registered, false otherwise
|
|
85
|
+
*/
|
|
86
|
+
hasTool(name) {
|
|
87
|
+
return this.tools.has(name);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get all registered tool names
|
|
91
|
+
*
|
|
92
|
+
* @returns Array of tool names
|
|
93
|
+
*/
|
|
94
|
+
getToolNames() {
|
|
95
|
+
return Array.from(this.tools.keys());
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get count of registered tools
|
|
99
|
+
*
|
|
100
|
+
* @returns Number of registered tools
|
|
101
|
+
*/
|
|
102
|
+
getToolCount() {
|
|
103
|
+
return this.tools.size;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Execute a tool by name
|
|
107
|
+
*
|
|
108
|
+
* Main execution method that:
|
|
109
|
+
* 1. Validates tool exists
|
|
110
|
+
* 2. Validates parameters
|
|
111
|
+
* 3. Executes tool
|
|
112
|
+
* 4. Handles errors
|
|
113
|
+
* 5. Updates statistics
|
|
114
|
+
*
|
|
115
|
+
* @param name Tool name
|
|
116
|
+
* @param params Tool parameters
|
|
117
|
+
* @param signal AbortSignal for cancellation
|
|
118
|
+
* @param updateOutput Optional callback for streaming output
|
|
119
|
+
* @returns Tool execution result
|
|
120
|
+
*/
|
|
121
|
+
async executeTool(name, params, signal, updateOutput) {
|
|
122
|
+
const startTime = Date.now();
|
|
123
|
+
// Get tool
|
|
124
|
+
const tool = this.tools.get(name);
|
|
125
|
+
if (!tool) {
|
|
126
|
+
return {
|
|
127
|
+
llmContent: `Tool "${name}" not found`,
|
|
128
|
+
returnDisplay: `Error: Tool "${name}" not found`,
|
|
129
|
+
success: false,
|
|
130
|
+
error: `Unknown tool: ${name}`,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
// Validate parameters
|
|
134
|
+
const validationError = tool.validateToolParams(params);
|
|
135
|
+
if (validationError) {
|
|
136
|
+
this.updateStats(name, false, Date.now() - startTime);
|
|
137
|
+
return {
|
|
138
|
+
llmContent: `Invalid parameters: ${validationError}`,
|
|
139
|
+
returnDisplay: `Parameter validation failed: ${validationError}`,
|
|
140
|
+
success: false,
|
|
141
|
+
error: validationError,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
// Create abort signal if not provided
|
|
145
|
+
const abortSignal = signal || new AbortController().signal;
|
|
146
|
+
// Execute tool
|
|
147
|
+
try {
|
|
148
|
+
const result = await tool.execute(params, abortSignal, updateOutput);
|
|
149
|
+
// Update stats
|
|
150
|
+
const executionTime = Date.now() - startTime;
|
|
151
|
+
this.updateStats(name, result.success, executionTime);
|
|
152
|
+
// Add execution time to metadata if not already present
|
|
153
|
+
if (!result.metadata?.executionTime) {
|
|
154
|
+
result.metadata = {
|
|
155
|
+
...result.metadata,
|
|
156
|
+
executionTime,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return result;
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
// Handle execution error
|
|
163
|
+
const executionTime = Date.now() - startTime;
|
|
164
|
+
this.updateStats(name, false, executionTime);
|
|
165
|
+
return {
|
|
166
|
+
llmContent: `Tool execution failed: ${error.message}`,
|
|
167
|
+
returnDisplay: `Execution error: ${error.message}`,
|
|
168
|
+
success: false,
|
|
169
|
+
error: error.message,
|
|
170
|
+
metadata: {
|
|
171
|
+
executionTime,
|
|
172
|
+
errorStack: error.stack,
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Get execution statistics for a tool
|
|
179
|
+
*
|
|
180
|
+
* @param name Tool name
|
|
181
|
+
* @returns Statistics or undefined if tool not found
|
|
182
|
+
*/
|
|
183
|
+
getToolStats(name) {
|
|
184
|
+
return this.stats.get(name);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Get execution statistics for all tools
|
|
188
|
+
*
|
|
189
|
+
* @returns Map of tool name to statistics
|
|
190
|
+
*/
|
|
191
|
+
getAllStats() {
|
|
192
|
+
return new Map(this.stats);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Reset statistics for a tool
|
|
196
|
+
*
|
|
197
|
+
* @param name Tool name
|
|
198
|
+
*/
|
|
199
|
+
resetToolStats(name) {
|
|
200
|
+
const tool = this.tools.get(name);
|
|
201
|
+
if (tool) {
|
|
202
|
+
this.stats.set(name, {
|
|
203
|
+
toolName: name,
|
|
204
|
+
executionCount: 0,
|
|
205
|
+
totalExecutionTime: 0,
|
|
206
|
+
averageExecutionTime: 0,
|
|
207
|
+
successCount: 0,
|
|
208
|
+
failureCount: 0,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Reset statistics for all tools
|
|
214
|
+
*/
|
|
215
|
+
resetAllStats() {
|
|
216
|
+
for (const name of this.tools.keys()) {
|
|
217
|
+
this.resetToolStats(name);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Update execution statistics
|
|
222
|
+
*
|
|
223
|
+
* @private
|
|
224
|
+
*/
|
|
225
|
+
updateStats(name, success, executionTime) {
|
|
226
|
+
const stats = this.stats.get(name);
|
|
227
|
+
if (!stats)
|
|
228
|
+
return;
|
|
229
|
+
stats.executionCount++;
|
|
230
|
+
stats.totalExecutionTime += executionTime;
|
|
231
|
+
stats.averageExecutionTime = stats.totalExecutionTime / stats.executionCount;
|
|
232
|
+
stats.lastExecuted = new Date();
|
|
233
|
+
if (success) {
|
|
234
|
+
stats.successCount++;
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
stats.failureCount++;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=ToolRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolRegistry.js","sourceRoot":"","sources":["../../src/base/ToolRegistry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmCH;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAOH;IANpB,gCAAgC;IACxB,KAAK,GAAoC,IAAI,GAAG,EAAE,CAAC;IAE3D,2BAA2B;IACnB,KAAK,GAAoC,IAAI,GAAG,EAAE,CAAC;IAE3D,YAAoB,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;IAAG,CAAC;IAE9C;;;;;OAKG;IACH,YAAY,CAAC,IAAwB;QACnC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,yBAAyB,CAAC,CAAC;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B,EAAE,CAAC;gBACvB,YAAY,EAAE,CAAC;gBACf,YAAY,EAAE,CAAC;aAChB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;OAEG;IACH,aAAa;QACX,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;YACrC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAED;;;;OAIG;IACK,WAAW,CAAC,IAAY,EAAE,OAAgB,EAAE,aAAqB;QACvE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK;YAAE,OAAO;QAEnB,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,KAAK,CAAC,kBAAkB,IAAI,aAAa,CAAC;QAC1C,KAAK,CAAC,oBAAoB,GAAG,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC,cAAc,CAAC;QAC7E,KAAK,CAAC,YAAY,GAAG,IAAI,IAAI,EAAE,CAAC;QAEhC,IAAI,OAAO,EAAE,CAAC;YACZ,KAAK,CAAC,YAAY,EAAE,CAAC;QACvB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,YAAY,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Execution Result
|
|
3
|
+
*
|
|
4
|
+
* Standardized result format for all tool executions
|
|
5
|
+
* Adapted from Gemini CLI patterns for V4
|
|
6
|
+
*/
|
|
7
|
+
import type { CanonicalContentBlock } from '@nexus-cortex/types';
|
|
8
|
+
/**
|
|
9
|
+
* Result from tool execution
|
|
10
|
+
*/
|
|
11
|
+
export interface ToolResult {
|
|
12
|
+
/**
|
|
13
|
+
* Content to send back to LLM
|
|
14
|
+
* Can be string or structured content blocks
|
|
15
|
+
*/
|
|
16
|
+
llmContent: string | CanonicalContentBlock[];
|
|
17
|
+
/**
|
|
18
|
+
* Content to display to user (optional)
|
|
19
|
+
* If not provided, llmContent is used
|
|
20
|
+
*/
|
|
21
|
+
returnDisplay?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether execution was successful
|
|
24
|
+
*/
|
|
25
|
+
success: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Error message if failed
|
|
28
|
+
*/
|
|
29
|
+
error?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Metadata about execution
|
|
32
|
+
*/
|
|
33
|
+
metadata?: {
|
|
34
|
+
/** Execution time in milliseconds */
|
|
35
|
+
executionTime?: number;
|
|
36
|
+
/** Resources accessed during execution */
|
|
37
|
+
resourcesUsed?: {
|
|
38
|
+
/** Files read or written */
|
|
39
|
+
files?: string[];
|
|
40
|
+
/** Network endpoints accessed */
|
|
41
|
+
network?: string[];
|
|
42
|
+
/** Shell commands executed */
|
|
43
|
+
commands?: string[];
|
|
44
|
+
};
|
|
45
|
+
/** Any additional tool-specific metadata */
|
|
46
|
+
[key: string]: any;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Tool call confirmation details
|
|
51
|
+
* Used for tools that require user confirmation before execution
|
|
52
|
+
*/
|
|
53
|
+
export interface ToolCallConfirmationDetails {
|
|
54
|
+
/** Human-readable description of what the tool will do */
|
|
55
|
+
description: string;
|
|
56
|
+
/** Whether confirmation is required */
|
|
57
|
+
requiresConfirmation: boolean;
|
|
58
|
+
/** Severity level for UI display */
|
|
59
|
+
severity?: 'info' | 'warning' | 'danger';
|
|
60
|
+
/** Additional context for confirmation prompt */
|
|
61
|
+
context?: string;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=ToolResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolResult.d.ts","sourceRoot":"","sources":["../../src/base/ToolResult.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,UAAU,EAAE,MAAM,GAAG,qBAAqB,EAAE,CAAC;IAE7C;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,CAAC,EAAE;QACT,qCAAqC;QACrC,aAAa,CAAC,EAAE,MAAM,CAAC;QAEvB,0CAA0C;QAC1C,aAAa,CAAC,EAAE;YACd,4BAA4B;YAC5B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;YAEjB,iCAAiC;YACjC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;YAEnB,8BAA8B;YAC9B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;SACrB,CAAC;QAEF,4CAA4C;QAC5C,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,0DAA0D;IAC1D,WAAW,EAAE,MAAM,CAAC;IAEpB,uCAAuC;IACvC,oBAAoB,EAAE,OAAO,CAAC;IAE9B,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IAEzC,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolResult.js","sourceRoot":"","sources":["../../src/base/ToolResult.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Executor Components
|
|
3
|
+
*
|
|
4
|
+
* Foundation classes and interfaces for tool execution
|
|
5
|
+
*/
|
|
6
|
+
export { BaseTool } from './BaseTool.js';
|
|
7
|
+
export { ToolRegistry, type ToolExecutionStats } from './ToolRegistry.js';
|
|
8
|
+
export { type ToolResult, type ToolCallConfirmationDetails } from './ToolResult.js';
|
|
9
|
+
export type { ExecutorConfig } from '@nexus-cortex/types';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AACpF,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/base/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,YAAY,EAA2B,MAAM,mBAAmB,CAAC"}
|