@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,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ListCompactionBoundaries Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* Lists all compaction boundaries (conversation summaries) with metadata.
|
|
5
|
+
* Provides an overview of the compaction history for the session.
|
|
6
|
+
*/
|
|
7
|
+
import { BaseTool } from '../../base/index.js';
|
|
8
|
+
import { SchemaValidator } from '../../utils/SchemaValidator.js';
|
|
9
|
+
import { ListCompactionBoundariesTool as CoreListBoundariesTool, } from '@nexus-cortex/core';
|
|
10
|
+
/**
|
|
11
|
+
* ListCompactionBoundaries Tool Executor
|
|
12
|
+
*
|
|
13
|
+
* Features:
|
|
14
|
+
* - Lists all compaction boundaries chronologically
|
|
15
|
+
* - Shows token savings and compression ratios
|
|
16
|
+
* - Optional detailed metadata (topics, decisions, tools used)
|
|
17
|
+
*/
|
|
18
|
+
export class ListCompactionBoundariesToolExecutor extends BaseTool {
|
|
19
|
+
config;
|
|
20
|
+
workspaceRoot;
|
|
21
|
+
constructor(config) {
|
|
22
|
+
super('ListCompactionBoundaries', 'ListCompactionBoundaries', `List compaction boundaries within the CURRENT session only.
|
|
23
|
+
|
|
24
|
+
Shows where the current conversation has been compressed/summarized to save tokens.
|
|
25
|
+
This is NOT for finding previous sessions - use SearchConversationHistory for that.`, {
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
includeMetadata: {
|
|
29
|
+
type: 'boolean',
|
|
30
|
+
description: 'Include detailed metadata in response',
|
|
31
|
+
default: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
this.config = config;
|
|
36
|
+
this.workspaceRoot = config.workspaceRoot || config.workingDirectory;
|
|
37
|
+
}
|
|
38
|
+
validateToolParams(params) {
|
|
39
|
+
// Schema validation
|
|
40
|
+
const schemaError = SchemaValidator.validate(this.parameterSchema, params);
|
|
41
|
+
if (schemaError) {
|
|
42
|
+
return schemaError;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
getDescription(params) {
|
|
47
|
+
return `Listing compaction boundaries${params.includeMetadata !== false ? ' with metadata' : ''}`;
|
|
48
|
+
}
|
|
49
|
+
async execute(params, signal, updateOutput) {
|
|
50
|
+
const startTime = Date.now();
|
|
51
|
+
try {
|
|
52
|
+
// Check for abort
|
|
53
|
+
if (signal.aborted) {
|
|
54
|
+
return {
|
|
55
|
+
...this.createErrorResult('Listing was cancelled'),
|
|
56
|
+
metadata: {
|
|
57
|
+
executionTime: Date.now() - startTime,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
// Validate parameters
|
|
62
|
+
const validationError = this.validateToolParams(params);
|
|
63
|
+
if (validationError) {
|
|
64
|
+
return {
|
|
65
|
+
...this.createErrorResult(validationError),
|
|
66
|
+
metadata: {
|
|
67
|
+
executionTime: Date.now() - startTime,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
// Get session ID from config
|
|
72
|
+
const sessionId = this.config.sessionId;
|
|
73
|
+
if (!sessionId) {
|
|
74
|
+
return {
|
|
75
|
+
...this.createErrorResult('Session ID not provided in executor config. Historical tools require active session context.'),
|
|
76
|
+
metadata: {
|
|
77
|
+
executionTime: Date.now() - startTime,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
// Create core tool and execute
|
|
82
|
+
const coreTool = new CoreListBoundariesTool(this.workspaceRoot);
|
|
83
|
+
const input = {
|
|
84
|
+
includeMetadata: params.includeMetadata,
|
|
85
|
+
};
|
|
86
|
+
const boundaries = await coreTool.execute(input, sessionId);
|
|
87
|
+
// Check for abort
|
|
88
|
+
if (signal.aborted) {
|
|
89
|
+
return {
|
|
90
|
+
...this.createErrorResult('Listing was cancelled'),
|
|
91
|
+
metadata: {
|
|
92
|
+
executionTime: Date.now() - startTime,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
// Format output
|
|
97
|
+
const formattedOutput = this.formatBoundaries(boundaries, params.includeMetadata !== false);
|
|
98
|
+
return {
|
|
99
|
+
...this.createSuccessResult(formattedOutput),
|
|
100
|
+
metadata: {
|
|
101
|
+
executionTime: Date.now() - startTime,
|
|
102
|
+
sessionId,
|
|
103
|
+
boundaryCount: boundaries.length,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
// Check for abort
|
|
109
|
+
if (signal.aborted) {
|
|
110
|
+
return {
|
|
111
|
+
...this.createErrorResult('Listing was cancelled'),
|
|
112
|
+
metadata: {
|
|
113
|
+
executionTime: Date.now() - startTime,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
const errorMessage = error.message || String(error);
|
|
118
|
+
return {
|
|
119
|
+
...this.createErrorResult(`Error listing compaction boundaries: ${errorMessage}`),
|
|
120
|
+
metadata: {
|
|
121
|
+
executionTime: Date.now() - startTime,
|
|
122
|
+
error: errorMessage,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Format compaction boundaries for display
|
|
129
|
+
*/
|
|
130
|
+
formatBoundaries(boundaries, includeMetadata) {
|
|
131
|
+
if (boundaries.length === 0) {
|
|
132
|
+
return 'No compaction boundaries found in this session.';
|
|
133
|
+
}
|
|
134
|
+
const lines = [];
|
|
135
|
+
lines.push('=== Compaction Boundaries ===\n\n');
|
|
136
|
+
lines.push(`Total: ${boundaries.length} compaction${boundaries.length > 1 ? 's' : ''}\n\n`);
|
|
137
|
+
// Calculate totals
|
|
138
|
+
const totalSaved = boundaries.reduce((sum, b) => sum + b.tokens.saved, 0);
|
|
139
|
+
const totalOriginal = boundaries.reduce((sum, b) => sum + b.tokens.original, 0);
|
|
140
|
+
const totalCompressed = boundaries.reduce((sum, b) => sum + b.tokens.compressed, 0);
|
|
141
|
+
const avgCompressionRatio = totalOriginal > 0
|
|
142
|
+
? ((totalCompressed / totalOriginal) * 100).toFixed(1)
|
|
143
|
+
: '0.0';
|
|
144
|
+
lines.push(`Total tokens saved: ${totalSaved}\n`);
|
|
145
|
+
lines.push(`Total original tokens: ${totalOriginal}\n`);
|
|
146
|
+
lines.push(`Total compressed tokens: ${totalCompressed}\n`);
|
|
147
|
+
lines.push(`Average compression ratio: ${avgCompressionRatio}%\n\n`);
|
|
148
|
+
lines.push('---\n\n');
|
|
149
|
+
// List each boundary
|
|
150
|
+
boundaries.forEach((boundary, index) => {
|
|
151
|
+
lines.push(`${index + 1}. Compaction ID: ${boundary.id}\n`);
|
|
152
|
+
lines.push(` Type: ${boundary.type}\n`);
|
|
153
|
+
lines.push(` Turns: ${boundary.turnRange.start} - ${boundary.turnRange.end}\n`);
|
|
154
|
+
lines.push(` Timestamp: ${boundary.timestamp.toLocaleString()}\n`);
|
|
155
|
+
lines.push(` Tokens: ${boundary.tokens.original} → ${boundary.tokens.compressed} (saved ${boundary.tokens.saved})\n`);
|
|
156
|
+
if (includeMetadata && boundary.metadata) {
|
|
157
|
+
lines.push(` Helper model: ${boundary.metadata.helperModel}\n`);
|
|
158
|
+
lines.push(` Cost: $${boundary.metadata.cost.toFixed(6)}\n`);
|
|
159
|
+
if (boundary.metadata.topics.length > 0) {
|
|
160
|
+
lines.push(` Topics: ${boundary.metadata.topics.slice(0, 3).join(', ')}\n`);
|
|
161
|
+
}
|
|
162
|
+
if (boundary.metadata.toolsUsed.length > 0) {
|
|
163
|
+
lines.push(` Tools used: ${boundary.metadata.toolsUsed.join(', ')}\n`);
|
|
164
|
+
}
|
|
165
|
+
if (boundary.metadata.summary) {
|
|
166
|
+
lines.push(` Summary: ${boundary.metadata.summary.substring(0, 100)}...\n`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
lines.push('\n');
|
|
170
|
+
});
|
|
171
|
+
return lines.join('');
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=ListCompactionBoundariesTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListCompactionBoundariesTool.js","sourceRoot":"","sources":["../../../src/implementations/historical/ListCompactionBoundariesTool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAmB,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAGjE,OAAO,EACL,4BAA4B,IAAI,sBAAsB,GACvD,MAAM,oBAAoB,CAAC;AAU5B;;;;;;;GAOG;AACH,MAAM,OAAO,oCAAqC,SAAQ,QAGzD;IAGqB;IAFZ,aAAa,CAAS;IAE9B,YAAoB,MAAsB;QACxC,KAAK,CACH,0BAA0B,EAC1B,0BAA0B,EAC1B;;;oFAG8E,EAC9E;YACE,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,eAAe,EAAE;oBACf,IAAI,EAAE,SAAS;oBACf,WAAW,EAAE,uCAAuC;oBACpD,OAAO,EAAE,IAAI;iBACd;aACF;SACF,CACF,CAAC;QAlBgB,WAAM,GAAN,MAAM,CAAgB;Q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,CAAC,IAAI,CAAC,WAAW,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAE7D,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACxC,KAAK,CAAC,IAAI,CAAC,YAAY,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC9E,CAAC;gBAED,IAAI,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAC3C,KAAK,CAAC,IAAI,CAAC,gBAAgB,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzE,CAAC;gBAED,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;oBAC9B,KAAK,CAAC,IAAI,CAAC,aAAa,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;gBAC9E,CAAC;YACH,CAAC;YAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ListSessions Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* Lists all available sessions with metadata for discovery and navigation.
|
|
5
|
+
*/
|
|
6
|
+
import { BaseTool, type ToolResult } from '../../base/index.js';
|
|
7
|
+
import type { ExecutorConfig } from '../../base/ToolRegistry.js';
|
|
8
|
+
/**
|
|
9
|
+
* Parameters for the ListSessions tool
|
|
10
|
+
*/
|
|
11
|
+
export interface ListSessionsToolParams {
|
|
12
|
+
/** Maximum number of sessions to return */
|
|
13
|
+
limit?: number;
|
|
14
|
+
/** Filter by minimum age in days */
|
|
15
|
+
minAgeDays?: number;
|
|
16
|
+
/** Filter by maximum age in days */
|
|
17
|
+
maxAgeDays?: number;
|
|
18
|
+
/** Sort order: 'newest' or 'oldest' */
|
|
19
|
+
sortBy?: 'newest' | 'oldest';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* ListSessions Tool Executor
|
|
23
|
+
*/
|
|
24
|
+
export declare class ListSessionsToolExecutor extends BaseTool<ListSessionsToolParams, ToolResult> {
|
|
25
|
+
private config;
|
|
26
|
+
constructor(config: ExecutorConfig);
|
|
27
|
+
validateToolParams(params: ListSessionsToolParams): string | null;
|
|
28
|
+
execute(params: ListSessionsToolParams, signal: AbortSignal): Promise<ToolResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Format sessions for display
|
|
31
|
+
*/
|
|
32
|
+
private formatSessions;
|
|
33
|
+
/**
|
|
34
|
+
* Format file size
|
|
35
|
+
*/
|
|
36
|
+
private formatFileSize;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=ListSessionsTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListSessionsTool.d.ts","sourceRoot":"","sources":["../../../src/implementations/historical/ListSessionsTool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIjE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,oCAAoC;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,uCAAuC;IACvC,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC9B;AAED;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,QAAQ,CACpD,sBAAsB,EACtB,UAAU,CACX;IACa,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAwC1C,kBAAkB,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,GAAG,IAAI;IAK3D,OAAO,CACX,MAAM,EAAE,sBAAsB,EAC9B,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,UAAU,CAAC;IAyDtB;;OAEG;IACH,OAAO,CAAC,cAAc;IA8BtB;;OAEG;IACH,OAAO,CAAC,cAAc;CAKvB"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ListSessions Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* Lists all available sessions with metadata for discovery and navigation.
|
|
5
|
+
*/
|
|
6
|
+
import { BaseTool } from '../../base/index.js';
|
|
7
|
+
import { ListSessionsTool as CoreListSessionsTool } from '@nexus-cortex/core';
|
|
8
|
+
/**
|
|
9
|
+
* ListSessions Tool Executor
|
|
10
|
+
*/
|
|
11
|
+
export class ListSessionsToolExecutor extends BaseTool {
|
|
12
|
+
config;
|
|
13
|
+
constructor(config) {
|
|
14
|
+
super('ListSessions', 'ListSessions', `List all available conversation sessions to discover and browse past conversations.
|
|
15
|
+
|
|
16
|
+
Use this tool to:
|
|
17
|
+
- Browse all previous conversation sessions
|
|
18
|
+
- Find sessions by age (recent or old)
|
|
19
|
+
- See session metadata (message count, creation date, last activity)
|
|
20
|
+
- Get session IDs for use with LoadSession tool
|
|
21
|
+
|
|
22
|
+
Returns sessions sorted by most recent activity by default.`, {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {
|
|
25
|
+
limit: {
|
|
26
|
+
type: 'number',
|
|
27
|
+
description: 'Maximum number of sessions to return',
|
|
28
|
+
default: 50,
|
|
29
|
+
},
|
|
30
|
+
minAgeDays: {
|
|
31
|
+
type: 'number',
|
|
32
|
+
description: 'Filter sessions older than N days',
|
|
33
|
+
},
|
|
34
|
+
maxAgeDays: {
|
|
35
|
+
type: 'number',
|
|
36
|
+
description: 'Filter sessions newer than N days',
|
|
37
|
+
},
|
|
38
|
+
sortBy: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
enum: ['newest', 'oldest'],
|
|
41
|
+
description: 'Sort order by last activity',
|
|
42
|
+
default: 'newest',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
this.config = config;
|
|
47
|
+
}
|
|
48
|
+
validateToolParams(params) {
|
|
49
|
+
// All parameters are optional, nothing to validate
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
async execute(params, signal) {
|
|
53
|
+
const startTime = Date.now();
|
|
54
|
+
try {
|
|
55
|
+
const storageDir = this.config.storageDir || '.cortex/sessions';
|
|
56
|
+
const coreTool = new CoreListSessionsTool(storageDir);
|
|
57
|
+
const input = {
|
|
58
|
+
limit: params.limit,
|
|
59
|
+
minAgeDays: params.minAgeDays,
|
|
60
|
+
maxAgeDays: params.maxAgeDays,
|
|
61
|
+
sortBy: params.sortBy,
|
|
62
|
+
};
|
|
63
|
+
const sessions = await coreTool.execute(input);
|
|
64
|
+
// Check for abort
|
|
65
|
+
if (signal.aborted) {
|
|
66
|
+
return {
|
|
67
|
+
...this.createErrorResult('List sessions was cancelled'),
|
|
68
|
+
metadata: {
|
|
69
|
+
executionTime: Date.now() - startTime,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
// Format output
|
|
74
|
+
const formattedOutput = this.formatSessions(sessions);
|
|
75
|
+
return {
|
|
76
|
+
...this.createSuccessResult(formattedOutput),
|
|
77
|
+
metadata: {
|
|
78
|
+
executionTime: Date.now() - startTime,
|
|
79
|
+
sessionCount: sessions.length,
|
|
80
|
+
storageDir,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
if (signal.aborted) {
|
|
86
|
+
return {
|
|
87
|
+
...this.createErrorResult('List sessions was cancelled'),
|
|
88
|
+
metadata: {
|
|
89
|
+
executionTime: Date.now() - startTime,
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
...this.createErrorResult(`Failed to list sessions: ${error.message}`),
|
|
95
|
+
metadata: {
|
|
96
|
+
executionTime: Date.now() - startTime,
|
|
97
|
+
error: error.message,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Format sessions for display
|
|
104
|
+
*/
|
|
105
|
+
formatSessions(sessions) {
|
|
106
|
+
if (sessions.length === 0) {
|
|
107
|
+
return 'No sessions found.';
|
|
108
|
+
}
|
|
109
|
+
const lines = [];
|
|
110
|
+
lines.push(`=== Available Sessions ===\n\n`);
|
|
111
|
+
lines.push(`Found ${sessions.length} session${sessions.length > 1 ? 's' : ''}:\n\n`);
|
|
112
|
+
sessions.forEach((session, index) => {
|
|
113
|
+
const createdDate = new Date(session.createdAt).toLocaleDateString();
|
|
114
|
+
const lastModDate = new Date(session.lastModified).toLocaleDateString();
|
|
115
|
+
const size = this.formatFileSize(session.fileSize);
|
|
116
|
+
lines.push(`${index + 1}. Session: ${session.sessionId}\n`);
|
|
117
|
+
if (session.title) {
|
|
118
|
+
lines.push(` Title: ${session.title}\n`);
|
|
119
|
+
}
|
|
120
|
+
lines.push(` Created: ${createdDate}\n`);
|
|
121
|
+
lines.push(` Last Activity: ${lastModDate} (${session.ageDays} days ago)\n`);
|
|
122
|
+
lines.push(` Messages: ${session.messageCount}\n`);
|
|
123
|
+
lines.push(` Size: ${size}\n`);
|
|
124
|
+
lines.push(` Compactions: ${session.compactionCount}\n\n`);
|
|
125
|
+
});
|
|
126
|
+
lines.push(`\nUse LoadSession with a sessionId to load full conversation history.`);
|
|
127
|
+
return lines.join('');
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Format file size
|
|
131
|
+
*/
|
|
132
|
+
formatFileSize(bytes) {
|
|
133
|
+
if (bytes < 1024)
|
|
134
|
+
return `${bytes} B`;
|
|
135
|
+
if (bytes < 1024 * 1024)
|
|
136
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
137
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=ListSessionsTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListSessionsTool.js","sourceRoot":"","sources":["../../../src/implementations/historical/ListSessionsTool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAmB,MAAM,qBAAqB,CAAC;AAGhE,OAAO,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAmB9E;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,QAG7C;IACqB;IAApB,YAAoB,MAAsB;QACxC,KAAK,CACH,cAAc,EACd,cAAc,EACd;;;;;;;;4DAQsD,EACtD;YACE,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,sCAAsC;oBACnD,OAAO,EAAE,EAAE;iBACZ;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,mCAAmC;iBACjD;gBACD,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,mCAAmC;iBACjD;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;oBAC1B,WAAW,EAAE,6BAA6B;oBAC1C,OAAO,EAAE,QAAQ;iBAClB;aACF;SACF,CACF,CAAC;QArCgB,WAAM,GAAN,MAAM,CAAgB;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CAAC,KAAK,EAAE,CAAC;gBAClB,KAAK,CAAC,IAAI,CAAC,WAAW,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;YAC3C,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,aAAa,WAAW,IAAI,CAAC,CAAC;YACzC,KAAK,CAAC,IAAI,CAAC,mBAAmB,WAAW,KAAK,OAAO,CAAC,OAAO,cAAc,CAAC,CAAC;YAC7E,KAAK,CAAC,IAAI,CAAC,cAAc,OAAO,CAAC,YAAY,IAAI,CAAC,CAAC;YACnD,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC;YAC/B,KAAK,CAAC,IAAI,CAAC,iBAAiB,OAAO,CAAC,eAAe,MAAM,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,KAAK,CAAC,IAAI,CAAC,uEAAuE,CAAC,CAAC;QAEpF,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxB,CAAC;IAED;;OAEG;IACK,cAAc,CAAC,KAAa;QAClC,IAAI,KAAK,GAAG,IAAI;YAAE,OAAO,GAAG,KAAK,IAAI,CAAC;QACtC,IAAI,KAAK,GAAG,IAAI,GAAG,IAAI;YAAE,OAAO,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;QAClE,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IACpD,CAAC;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LoadSession Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* Loads messages from a specific session to bring past conversation context
|
|
5
|
+
* into the current conversation.
|
|
6
|
+
*/
|
|
7
|
+
import { BaseTool, type ToolResult } from '../../base/index.js';
|
|
8
|
+
import type { ExecutorConfig } from '../../base/ToolRegistry.js';
|
|
9
|
+
/**
|
|
10
|
+
* Parameters for the LoadSession tool
|
|
11
|
+
*/
|
|
12
|
+
export interface LoadSessionToolParams {
|
|
13
|
+
/** Session ID to load */
|
|
14
|
+
sessionId: string;
|
|
15
|
+
/** Maximum number of messages to return */
|
|
16
|
+
limit?: number;
|
|
17
|
+
/** Start from message offset (for pagination) */
|
|
18
|
+
offset?: number;
|
|
19
|
+
/** Include system messages */
|
|
20
|
+
includeSystemMessages?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* LoadSession Tool Executor
|
|
24
|
+
*/
|
|
25
|
+
export declare class LoadSessionToolExecutor extends BaseTool<LoadSessionToolParams, ToolResult> {
|
|
26
|
+
private config;
|
|
27
|
+
constructor(config: ExecutorConfig);
|
|
28
|
+
validateToolParams(params: LoadSessionToolParams): string | null;
|
|
29
|
+
execute(params: LoadSessionToolParams, signal: AbortSignal): Promise<ToolResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Format session messages for display
|
|
32
|
+
*/
|
|
33
|
+
private formatSession;
|
|
34
|
+
/**
|
|
35
|
+
* Extract readable content from message
|
|
36
|
+
*/
|
|
37
|
+
private extractMessageContent;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=LoadSessionTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadSessionTool.d.ts","sourceRoot":"","sources":["../../../src/implementations/historical/LoadSessionTool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAIjE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAElB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,8BAA8B;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,QAAQ,CACnD,qBAAqB,EACrB,UAAU,CACX;IACa,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAyC1C,kBAAkB,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,GAAG,IAAI;IAO1D,OAAO,CACX,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC,UAAU,CAAC;IA4DtB;;OAEG;IACH,OAAO,CAAC,aAAa;IAkCrB;;OAEG;IACH,OAAO,CAAC,qBAAqB;CA2B9B"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LoadSession Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* Loads messages from a specific session to bring past conversation context
|
|
5
|
+
* into the current conversation.
|
|
6
|
+
*/
|
|
7
|
+
import { BaseTool } from '../../base/index.js';
|
|
8
|
+
import { LoadSessionTool as CoreLoadSessionTool } from '@nexus-cortex/core';
|
|
9
|
+
/**
|
|
10
|
+
* LoadSession Tool Executor
|
|
11
|
+
*/
|
|
12
|
+
export class LoadSessionToolExecutor extends BaseTool {
|
|
13
|
+
config;
|
|
14
|
+
constructor(config) {
|
|
15
|
+
super('LoadSession', 'LoadSession', `Load full message history from a specific previous session.
|
|
16
|
+
|
|
17
|
+
Use this tool to:
|
|
18
|
+
- Load complete conversation context from a past session
|
|
19
|
+
- Access detailed message history beyond search results
|
|
20
|
+
- Continue analysis from a previous conversation
|
|
21
|
+
- Bring full context from identified sessions (via ListSessions or SearchConversationHistory)
|
|
22
|
+
|
|
23
|
+
Returns actual messages with full content. Use pagination (limit/offset) for large sessions.`, {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
sessionId: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: 'Session ID to load (from ListSessions or SearchConversationHistory results)',
|
|
29
|
+
},
|
|
30
|
+
limit: {
|
|
31
|
+
type: 'number',
|
|
32
|
+
description: 'Maximum number of messages to return',
|
|
33
|
+
default: 100,
|
|
34
|
+
},
|
|
35
|
+
offset: {
|
|
36
|
+
type: 'number',
|
|
37
|
+
description: 'Start from message offset (for pagination)',
|
|
38
|
+
default: 0,
|
|
39
|
+
},
|
|
40
|
+
includeSystemMessages: {
|
|
41
|
+
type: 'boolean',
|
|
42
|
+
description: 'Include system messages in results',
|
|
43
|
+
default: false,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
required: ['sessionId'],
|
|
47
|
+
});
|
|
48
|
+
this.config = config;
|
|
49
|
+
}
|
|
50
|
+
validateToolParams(params) {
|
|
51
|
+
if (!params.sessionId || typeof params.sessionId !== 'string') {
|
|
52
|
+
return 'sessionId is required and must be a string';
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
async execute(params, signal) {
|
|
57
|
+
const startTime = Date.now();
|
|
58
|
+
try {
|
|
59
|
+
const storageDir = this.config.storageDir || '.cortex/sessions';
|
|
60
|
+
const coreTool = new CoreLoadSessionTool(storageDir);
|
|
61
|
+
const input = {
|
|
62
|
+
sessionId: params.sessionId,
|
|
63
|
+
limit: params.limit,
|
|
64
|
+
offset: params.offset,
|
|
65
|
+
includeSystemMessages: params.includeSystemMessages,
|
|
66
|
+
};
|
|
67
|
+
const result = await coreTool.execute(input);
|
|
68
|
+
// Check for abort
|
|
69
|
+
if (signal.aborted) {
|
|
70
|
+
return {
|
|
71
|
+
...this.createErrorResult('Load session was cancelled'),
|
|
72
|
+
metadata: {
|
|
73
|
+
executionTime: Date.now() - startTime,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
// Format output
|
|
78
|
+
const formattedOutput = this.formatSession(result);
|
|
79
|
+
return {
|
|
80
|
+
...this.createSuccessResult(formattedOutput),
|
|
81
|
+
metadata: {
|
|
82
|
+
executionTime: Date.now() - startTime,
|
|
83
|
+
sessionId: result.sessionId,
|
|
84
|
+
totalMessages: result.totalMessageCount,
|
|
85
|
+
returnedMessages: result.returnedMessageCount,
|
|
86
|
+
hasMore: result.hasMore,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
if (signal.aborted) {
|
|
92
|
+
return {
|
|
93
|
+
...this.createErrorResult('Load session was cancelled'),
|
|
94
|
+
metadata: {
|
|
95
|
+
executionTime: Date.now() - startTime,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
...this.createErrorResult(`Failed to load session: ${error.message}`),
|
|
101
|
+
metadata: {
|
|
102
|
+
executionTime: Date.now() - startTime,
|
|
103
|
+
sessionId: params.sessionId,
|
|
104
|
+
error: error.message,
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Format session messages for display
|
|
111
|
+
*/
|
|
112
|
+
formatSession(result) {
|
|
113
|
+
const lines = [];
|
|
114
|
+
lines.push(`=== Session: ${result.sessionId} ===\n\n`);
|
|
115
|
+
lines.push(`Created: ${new Date(result.metadata.createdAt).toLocaleString()}\n`);
|
|
116
|
+
lines.push(`Last Modified: ${new Date(result.metadata.lastModified).toLocaleString()}\n`);
|
|
117
|
+
lines.push(`Total Messages: ${result.totalMessageCount}\n`);
|
|
118
|
+
lines.push(`Compactions: ${result.metadata.compactionCount}\n`);
|
|
119
|
+
lines.push(`Showing: ${result.returnedMessageCount} messages\n`);
|
|
120
|
+
if (result.hasMore) {
|
|
121
|
+
lines.push(`(More messages available - use offset parameter for pagination)\n`);
|
|
122
|
+
}
|
|
123
|
+
lines.push(`\n--- Messages ---\n\n`);
|
|
124
|
+
result.messages.forEach((msg, index) => {
|
|
125
|
+
const msgNum = result.metadata.offset ? result.metadata.offset + index + 1 : index + 1;
|
|
126
|
+
const timestamp = new Date(msg.timestamp).toLocaleString();
|
|
127
|
+
const role = msg.type || msg.role || 'unknown';
|
|
128
|
+
lines.push(`Message ${msgNum} [${role}] - ${timestamp}\n`);
|
|
129
|
+
// Extract content
|
|
130
|
+
const content = this.extractMessageContent(msg);
|
|
131
|
+
if (content) {
|
|
132
|
+
const preview = content.length > 200 ? content.substring(0, 200) + '...' : content;
|
|
133
|
+
lines.push(`${preview}\n\n`);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
lines.push(`(No text content)\n\n`);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return lines.join('');
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Extract readable content from message
|
|
143
|
+
*/
|
|
144
|
+
extractMessageContent(msg) {
|
|
145
|
+
// Handle different message formats
|
|
146
|
+
if (typeof msg.content === 'string') {
|
|
147
|
+
return msg.content;
|
|
148
|
+
}
|
|
149
|
+
if (Array.isArray(msg.content)) {
|
|
150
|
+
return msg.content
|
|
151
|
+
.map((block) => {
|
|
152
|
+
if (block.type === 'text')
|
|
153
|
+
return block.text;
|
|
154
|
+
if (block.type === 'tool_use') {
|
|
155
|
+
const toolName = block.toolUse?.name || block.name || 'Unknown';
|
|
156
|
+
return `[Tool: ${toolName}]`;
|
|
157
|
+
}
|
|
158
|
+
if (block.type === 'tool_result')
|
|
159
|
+
return `[Tool Result]`;
|
|
160
|
+
return '';
|
|
161
|
+
})
|
|
162
|
+
.filter(Boolean)
|
|
163
|
+
.join(' ');
|
|
164
|
+
}
|
|
165
|
+
if (msg.message?.content) {
|
|
166
|
+
return this.extractMessageContent(msg.message);
|
|
167
|
+
}
|
|
168
|
+
return '';
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=LoadSessionTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadSessionTool.js","sourceRoot":"","sources":["../../../src/implementations/historical/LoadSessionTool.ts"],"names":[],"mappings":"A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K,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;oBAC9B,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,EAAE,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,SAAS,CAAC;oBAChE,OAAO,UAAU,QAAQ,GAAG,CAAC;gBAC/B,CAAC;gBACD,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa;oBAAE,OAAO,eAAe,CAAC;gBACzD,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC;iBACD,MAAM,CAAC,OAAO,CAAC;iBACf,IAAI,CAAC,GAAG,CAAC,CAAC;QACf,CAAC;QAED,IAAI,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACjD,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RequestHistoricalContext Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* Requests historical context using a cheap helper model (e.g., FREE Gemma).
|
|
5
|
+
* Cost-effective way to access archived context outside the main model's window.
|
|
6
|
+
*/
|
|
7
|
+
import { BaseTool, type ToolResult } from '../../base/index.js';
|
|
8
|
+
import type { ExecutorConfig } from '../../base/ToolRegistry.js';
|
|
9
|
+
/**
|
|
10
|
+
* Parameters for the RequestHistoricalContext tool
|
|
11
|
+
*/
|
|
12
|
+
export interface RequestHistoricalContextToolParams {
|
|
13
|
+
/** Query describing what historical context is needed */
|
|
14
|
+
query: string;
|
|
15
|
+
/** Detail level for the response */
|
|
16
|
+
detailLevel?: 'brief' | 'standard' | 'detailed';
|
|
17
|
+
/** Maximum tokens for the response */
|
|
18
|
+
maxTokens?: number;
|
|
19
|
+
/** Whether to use helper model (vs main model) */
|
|
20
|
+
useHelperModel?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* RequestHistoricalContext Tool Executor
|
|
24
|
+
*
|
|
25
|
+
* Features:
|
|
26
|
+
* - Uses FREE Gemma models for cost-effective context retrieval
|
|
27
|
+
* - Searches both recent and compacted history
|
|
28
|
+
* - Configurable detail level
|
|
29
|
+
* - Returns sources and cost information
|
|
30
|
+
*/
|
|
31
|
+
export declare class RequestHistoricalContextToolExecutor extends BaseTool<RequestHistoricalContextToolParams, ToolResult> {
|
|
32
|
+
private config;
|
|
33
|
+
constructor(config: ExecutorConfig);
|
|
34
|
+
/**
|
|
35
|
+
* Get workspace root from config (dynamically resolved)
|
|
36
|
+
*/
|
|
37
|
+
private getWorkspaceRoot;
|
|
38
|
+
validateToolParams(params: RequestHistoricalContextToolParams): string | null;
|
|
39
|
+
getDescription(params: RequestHistoricalContextToolParams): string;
|
|
40
|
+
execute(params: RequestHistoricalContextToolParams, signal: AbortSignal, updateOutput?: (output: string) => void): Promise<ToolResult>;
|
|
41
|
+
/**
|
|
42
|
+
* Format historical context result for display
|
|
43
|
+
*/
|
|
44
|
+
private formatContext;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=RequestHistoricalContextTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RequestHistoricalContextTool.d.ts","sourceRoot":"","sources":["../../../src/implementations/historical/RequestHistoricalContextTool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAOjE;;GAEG;AACH,MAAM,WAAW,kCAAkC;IACjD,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IAEd,oCAAoC;IACpC,WAAW,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,UAAU,CAAC;IAEhD,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,kDAAkD;IAClD,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,qBAAa,oCAAqC,SAAQ,QAAQ,CAChE,kCAAkC,EAClC,UAAU,CACX;IACa,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,cAAc;IAoC1C;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAIxB,kBAAkB,CAAC,MAAM,EAAE,kCAAkC,GAAG,MAAM,GAAG,IAAI;IAkC7E,cAAc,CAAC,MAAM,EAAE,kCAAkC,GAAG,MAAM;IAK5D,OAAO,CACX,MAAM,EAAE,kCAAkC,EAC1C,MAAM,EAAE,WAAW,EACnB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GACtC,OAAO,CAAC,UAAU,CAAC;IAwHtB;;OAEG;IACH,OAAO,CAAC,aAAa;CA8BtB"}
|