@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,315 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SlashCommand Tool - Execute custom slash commands from .cortex/commands/
|
|
3
|
+
*
|
|
4
|
+
* Loads and executes custom commands defined in Markdown files with YAML frontmatter.
|
|
5
|
+
* Supports argument substitution using $1, $2, etc.
|
|
6
|
+
*
|
|
7
|
+
* Command Format (.md files):
|
|
8
|
+
* ```markdown
|
|
9
|
+
* ---
|
|
10
|
+
* description: Command description
|
|
11
|
+
* argument-hint: [arg1] [arg2]
|
|
12
|
+
* ---
|
|
13
|
+
*
|
|
14
|
+
* Command body with $1 and $2 placeholders
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import { BaseTool } from '../../base/index.js';
|
|
18
|
+
import { promises as fs } from 'node:fs';
|
|
19
|
+
import { join, basename, extname } from 'node:path';
|
|
20
|
+
import { glob } from 'glob';
|
|
21
|
+
/**
|
|
22
|
+
* SlashCommand Tool Executor
|
|
23
|
+
*
|
|
24
|
+
* Executes custom slash commands from .cortex/commands/ directory.
|
|
25
|
+
* Commands are defined in Markdown files with YAML frontmatter.
|
|
26
|
+
*
|
|
27
|
+
* Example command file (.cortex/commands/review-pr.md):
|
|
28
|
+
* ```markdown
|
|
29
|
+
* ---
|
|
30
|
+
* description: Review a pull request
|
|
31
|
+
* argument-hint: [pr-number]
|
|
32
|
+
* ---
|
|
33
|
+
*
|
|
34
|
+
* Review pull request #$1
|
|
35
|
+
*
|
|
36
|
+
* Instructions:
|
|
37
|
+
* 1. Fetch PR details from GitHub
|
|
38
|
+
* 2. Analyze the code changes
|
|
39
|
+
* 3. Provide feedback
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* Usage: SlashCommand({ command: "/review-pr 123" })
|
|
43
|
+
*/
|
|
44
|
+
export class SlashCommandToolExecutor extends BaseTool {
|
|
45
|
+
commandsCache = null;
|
|
46
|
+
commandsDir;
|
|
47
|
+
constructor(config) {
|
|
48
|
+
super('SlashCommand', 'SlashCommand', 'Execute custom slash commands from .cortex/commands/', {
|
|
49
|
+
type: 'object',
|
|
50
|
+
properties: {
|
|
51
|
+
command: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
description: 'The slash command to execute with its arguments (e.g., "/review-pr 123")',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
required: ['command'],
|
|
57
|
+
});
|
|
58
|
+
this.commandsDir = join(config.workingDirectory, '.cortex', 'commands');
|
|
59
|
+
}
|
|
60
|
+
validateToolParams(params) {
|
|
61
|
+
if (!params.command || typeof params.command !== 'string') {
|
|
62
|
+
return 'command must be a non-empty string';
|
|
63
|
+
}
|
|
64
|
+
if (!params.command.startsWith('/')) {
|
|
65
|
+
return 'command must start with a forward slash (/)';
|
|
66
|
+
}
|
|
67
|
+
if (params.command.trim() === '/') {
|
|
68
|
+
return 'command name cannot be empty';
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
getDescription(params) {
|
|
73
|
+
const commandName = this.parseCommandName(params.command);
|
|
74
|
+
return `Executing slash command: ${commandName}`;
|
|
75
|
+
}
|
|
76
|
+
async execute(params, signal, updateOutput) {
|
|
77
|
+
const startTime = Date.now();
|
|
78
|
+
try {
|
|
79
|
+
// Validate parameters
|
|
80
|
+
const validationError = this.validateToolParams(params);
|
|
81
|
+
if (validationError) {
|
|
82
|
+
return {
|
|
83
|
+
...this.createErrorResult(validationError),
|
|
84
|
+
metadata: { executionTime: Date.now() - startTime },
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
// Parse command and arguments
|
|
88
|
+
const { commandName, args } = this.parseCommand(params.command);
|
|
89
|
+
// Load command definition
|
|
90
|
+
const commandDef = await this.loadCommand(commandName, signal);
|
|
91
|
+
if (!commandDef) {
|
|
92
|
+
return {
|
|
93
|
+
...this.createErrorResult(`Command '${commandName}' not found in ${this.commandsDir}\n\n` +
|
|
94
|
+
`Available commands: ${await this.getAvailableCommands()}`),
|
|
95
|
+
metadata: {
|
|
96
|
+
executionTime: Date.now() - startTime,
|
|
97
|
+
commandName,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
// Substitute arguments in command body
|
|
102
|
+
const expandedCommand = this.substituteArguments(commandDef.body, args);
|
|
103
|
+
// Return the expanded command as output
|
|
104
|
+
const output = this.formatCommandOutput(commandName, commandDef, expandedCommand, args);
|
|
105
|
+
return {
|
|
106
|
+
...this.createSuccessResult(output),
|
|
107
|
+
metadata: {
|
|
108
|
+
executionTime: Date.now() - startTime,
|
|
109
|
+
commandName,
|
|
110
|
+
argumentCount: args.length,
|
|
111
|
+
description: commandDef.description,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
if (signal.aborted) {
|
|
117
|
+
return {
|
|
118
|
+
...this.createErrorResult('Command execution was cancelled'),
|
|
119
|
+
metadata: { executionTime: Date.now() - startTime },
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
...this.createErrorResult(`Error executing slash command: ${error.message || String(error)}`),
|
|
124
|
+
metadata: {
|
|
125
|
+
executionTime: Date.now() - startTime,
|
|
126
|
+
error: error.message || String(error),
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Parse command string into name and arguments
|
|
133
|
+
* Example: "/review-pr 123 --verbose" → { commandName: "review-pr", args: ["123", "--verbose"] }
|
|
134
|
+
*/
|
|
135
|
+
parseCommand(command) {
|
|
136
|
+
const trimmed = command.trim();
|
|
137
|
+
const parts = trimmed.split(/\s+/).filter(Boolean);
|
|
138
|
+
const commandName = parts[0] ? parts[0].slice(1) : ''; // Remove leading /
|
|
139
|
+
const args = parts.slice(1);
|
|
140
|
+
return { commandName, args };
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Parse just the command name (for display purposes)
|
|
144
|
+
*/
|
|
145
|
+
parseCommandName(command) {
|
|
146
|
+
return this.parseCommand(command).commandName;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Load command definition from .cortex/commands/ directory
|
|
150
|
+
* Supports recursive directory structure
|
|
151
|
+
*/
|
|
152
|
+
async loadCommand(commandName, signal) {
|
|
153
|
+
// Load all commands if not cached
|
|
154
|
+
if (!this.commandsCache) {
|
|
155
|
+
await this.loadAllCommands(signal);
|
|
156
|
+
}
|
|
157
|
+
if (!this.commandsCache) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
return this.commandsCache.get(commandName) || null;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Load all command definitions from .cortex/commands/
|
|
164
|
+
*/
|
|
165
|
+
async loadAllCommands(signal) {
|
|
166
|
+
this.commandsCache = new Map();
|
|
167
|
+
try {
|
|
168
|
+
// Check if commands directory exists
|
|
169
|
+
try {
|
|
170
|
+
await fs.access(this.commandsDir);
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
// Directory doesn't exist, return empty cache
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
// Find all .md files recursively
|
|
177
|
+
const files = await glob('**/*.md', {
|
|
178
|
+
cwd: this.commandsDir,
|
|
179
|
+
nodir: true,
|
|
180
|
+
dot: false,
|
|
181
|
+
signal,
|
|
182
|
+
});
|
|
183
|
+
// Load each command file
|
|
184
|
+
for (const file of files) {
|
|
185
|
+
const filePath = join(this.commandsDir, file);
|
|
186
|
+
const commandDef = await this.parseCommandFile(filePath);
|
|
187
|
+
if (commandDef) {
|
|
188
|
+
this.commandsCache.set(commandDef.name, commandDef);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
// Silently fail if directory doesn't exist or can't be read
|
|
194
|
+
if (error.code !== 'ENOENT') {
|
|
195
|
+
console.error(`[SlashCommand] Error loading commands: ${error.message}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Parse command definition from .md file
|
|
201
|
+
*
|
|
202
|
+
* Format:
|
|
203
|
+
* ```markdown
|
|
204
|
+
* ---
|
|
205
|
+
* description: Command description
|
|
206
|
+
* argument-hint: [arg1] [arg2]
|
|
207
|
+
* ---
|
|
208
|
+
*
|
|
209
|
+
* Command body with $1 and $2 placeholders
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
async parseCommandFile(filePath) {
|
|
213
|
+
try {
|
|
214
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
215
|
+
// Extract frontmatter and body
|
|
216
|
+
const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---\s*\n([\s\S]*)$/);
|
|
217
|
+
if (!frontmatterMatch) {
|
|
218
|
+
console.error(`[SlashCommand] Invalid command file format: ${filePath} (missing frontmatter)`);
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
const frontmatterText = frontmatterMatch[1] || '';
|
|
222
|
+
const body = frontmatterMatch[2] || '';
|
|
223
|
+
// Parse frontmatter (simple YAML parser for our use case)
|
|
224
|
+
const frontmatter = this.parseFrontmatter(frontmatterText);
|
|
225
|
+
// Get command name from filename (without extension)
|
|
226
|
+
const fileName = basename(filePath, extname(filePath));
|
|
227
|
+
return {
|
|
228
|
+
name: fileName,
|
|
229
|
+
description: frontmatter.description || `Execute ${fileName} command`,
|
|
230
|
+
argumentHint: frontmatter['argument-hint'] || undefined,
|
|
231
|
+
body: body.trim(),
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
catch (error) {
|
|
235
|
+
console.error(`[SlashCommand] Error parsing command file ${filePath}: ${error.message}`);
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Simple YAML frontmatter parser
|
|
241
|
+
* Handles basic key: value pairs
|
|
242
|
+
*/
|
|
243
|
+
parseFrontmatter(text) {
|
|
244
|
+
const result = {};
|
|
245
|
+
const lines = text.split('\n');
|
|
246
|
+
for (const line of lines) {
|
|
247
|
+
const match = line.match(/^(\S+):\s*(.*)$/);
|
|
248
|
+
if (match && match[1] && match[2] !== undefined) {
|
|
249
|
+
const key = match[1].trim();
|
|
250
|
+
const value = match[2].trim();
|
|
251
|
+
result[key] = value;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return result;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Substitute arguments in command body
|
|
258
|
+
* Replaces $1, $2, etc. with actual argument values
|
|
259
|
+
*/
|
|
260
|
+
substituteArguments(body, args) {
|
|
261
|
+
let result = body;
|
|
262
|
+
// Replace $1, $2, etc. with actual arguments
|
|
263
|
+
for (let i = 0; i < args.length; i++) {
|
|
264
|
+
const placeholder = `$${i + 1}`;
|
|
265
|
+
const arg = args[i];
|
|
266
|
+
result = result.split(placeholder).join(arg);
|
|
267
|
+
}
|
|
268
|
+
// Replace any remaining placeholders with empty string
|
|
269
|
+
result = result.replace(/\$\d+/g, '');
|
|
270
|
+
return result;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Format command output for display
|
|
274
|
+
*/
|
|
275
|
+
formatCommandOutput(commandName, commandDef, expandedCommand, args) {
|
|
276
|
+
const parts = [];
|
|
277
|
+
// Command header
|
|
278
|
+
parts.push(`# Slash Command: /${commandName}`);
|
|
279
|
+
parts.push('');
|
|
280
|
+
parts.push(`**Description**: ${commandDef.description}`);
|
|
281
|
+
if (commandDef.argumentHint) {
|
|
282
|
+
parts.push(`**Arguments**: ${commandDef.argumentHint}`);
|
|
283
|
+
}
|
|
284
|
+
if (args.length > 0) {
|
|
285
|
+
parts.push(`**Provided Arguments**: ${args.join(', ')}`);
|
|
286
|
+
}
|
|
287
|
+
parts.push('');
|
|
288
|
+
parts.push('---');
|
|
289
|
+
parts.push('');
|
|
290
|
+
// Expanded command body
|
|
291
|
+
parts.push(expandedCommand);
|
|
292
|
+
return parts.join('\n');
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Get list of available commands (for error messages)
|
|
296
|
+
*/
|
|
297
|
+
async getAvailableCommands() {
|
|
298
|
+
if (!this.commandsCache) {
|
|
299
|
+
await this.loadAllCommands(new AbortController().signal);
|
|
300
|
+
}
|
|
301
|
+
if (!this.commandsCache || this.commandsCache.size === 0) {
|
|
302
|
+
return '(none found)';
|
|
303
|
+
}
|
|
304
|
+
return Array.from(this.commandsCache.keys())
|
|
305
|
+
.map((name) => `/${name}`)
|
|
306
|
+
.join(', ');
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Clear the commands cache (useful for testing or reloading)
|
|
310
|
+
*/
|
|
311
|
+
clearCache() {
|
|
312
|
+
this.commandsCache = null;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
//# sourceMappingURL=SlashCommandTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SlashCommandTool.js","sourceRoot":"","sources":["../../../src/implementations/extensions/SlashCommandTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,QAAQ,EAAmB,MA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Aa,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YACzD,OAAO,cAAc,CAAC;QACxB,CAAC;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;aACzC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;aACzB,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,UAAU;QACR,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension Tools
|
|
3
|
+
*
|
|
4
|
+
* Tools for extension integration (commands, skills, etc.)
|
|
5
|
+
*/
|
|
6
|
+
export { SlashCommandToolExecutor } from './SlashCommandTool.js';
|
|
7
|
+
export type { SlashCommandParams } from './SlashCommandTool.js';
|
|
8
|
+
export { SkillToolExecutor } from './SkillTool.js';
|
|
9
|
+
export type { SkillParams } from './SkillTool.js';
|
|
10
|
+
export { ResearchBacklogToolExecutor } from './ResearchBacklogTool.js';
|
|
11
|
+
export type { ResearchBacklogParams } from './ResearchBacklogTool.js';
|
|
12
|
+
export { EndTurnToolExecutor } from './EndTurnTool.js';
|
|
13
|
+
export type { EndTurnParams } from './EndTurnTool.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/implementations/extensions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACjE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension Tools
|
|
3
|
+
*
|
|
4
|
+
* Tools for extension integration (commands, skills, etc.)
|
|
5
|
+
*/
|
|
6
|
+
export { SlashCommandToolExecutor } from './SlashCommandTool.js';
|
|
7
|
+
export { SkillToolExecutor } from './SkillTool.js';
|
|
8
|
+
export { ResearchBacklogToolExecutor } from './ResearchBacklogTool.js';
|
|
9
|
+
export { EndTurnToolExecutor } from './EndTurnTool.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/implementations/extensions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAGjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGnD,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAGvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EditFile Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* Performs exact string replacements within a file.
|
|
5
|
+
* Requires precise matching of old_string for safety.
|
|
6
|
+
*
|
|
7
|
+
* Adapted and simplified from Gemini CLI patterns
|
|
8
|
+
* - Removed: ModifiableTool interface, user approval, LLM-based correction
|
|
9
|
+
* - Kept: Core string replacement, occurrence validation, diff generation
|
|
10
|
+
*
|
|
11
|
+
* IMPORTANT: Following the read-before-edit protocol, this tool requires a prior Read
|
|
12
|
+
* operation in the same session before allowing edits. This ensures the LLM
|
|
13
|
+
* has current file content and prevents edits based on stale context.
|
|
14
|
+
*/
|
|
15
|
+
import { BaseTool, type ToolResult } from '../../base/index.js';
|
|
16
|
+
import type { ExecutorConfig } from '../../base/ToolRegistry.js';
|
|
17
|
+
/**
|
|
18
|
+
* Fingerprint of a file section - used for content-based freshness detection
|
|
19
|
+
* Instead of just checking timestamps, we can verify if the actual content has changed
|
|
20
|
+
*/
|
|
21
|
+
export interface SectionFingerprint {
|
|
22
|
+
startLine: number;
|
|
23
|
+
endLine: number;
|
|
24
|
+
contentHash: string;
|
|
25
|
+
timestamp: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Session-level tracking of files that have been read/edited.
|
|
29
|
+
* This enforces the read-before-edit protocol with timestamp-based staleness detection
|
|
30
|
+
* and content-based fingerprinting for smarter freshness checks.
|
|
31
|
+
*
|
|
32
|
+
* Key behavior (read-before-edit):
|
|
33
|
+
* - Files must be read before editing
|
|
34
|
+
* - After each edit, the file becomes "stale" and must be re-read
|
|
35
|
+
* - Content fingerprinting allows detecting if unrelated edits affect your target section
|
|
36
|
+
* - This ensures LLM always has current file state in evolving codebases
|
|
37
|
+
*/
|
|
38
|
+
export declare class FileReadTracker {
|
|
39
|
+
private static fileReadTimestamps;
|
|
40
|
+
private static fileEditTimestamps;
|
|
41
|
+
private static editedSections;
|
|
42
|
+
private static sectionFingerprints;
|
|
43
|
+
private static readonly MAX_CONSECUTIVE_EDITS;
|
|
44
|
+
private static consecutiveEditCount;
|
|
45
|
+
private static lastEditRegion;
|
|
46
|
+
/**
|
|
47
|
+
* Calculate SHA-256 hash of content, truncated to 16 characters
|
|
48
|
+
* This is efficient and provides sufficient uniqueness for content comparison
|
|
49
|
+
*/
|
|
50
|
+
static calculateSectionHash(content: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Store a fingerprint for a read section
|
|
53
|
+
* Called by ReadFileTool after successfully reading a section
|
|
54
|
+
*/
|
|
55
|
+
static storeSectionFingerprint(filePath: string, startLine: number, endLine: number, content: string): void;
|
|
56
|
+
/**
|
|
57
|
+
* Update fingerprint after a successful edit
|
|
58
|
+
* This keeps the fingerprint in sync with our known changes, enabling consecutive edits.
|
|
59
|
+
* The key insight: after WE edit the file, we know the new content is correct.
|
|
60
|
+
* We update the fingerprint so subsequent edits can verify no EXTERNAL changes occurred.
|
|
61
|
+
*/
|
|
62
|
+
static updateFingerprintAfterEdit(filePath: string, startLine: number, endLine: number, newContent: string): void;
|
|
63
|
+
/**
|
|
64
|
+
* Check if a previously read section still has the same content
|
|
65
|
+
* Returns true if the section's current content matches the stored fingerprint
|
|
66
|
+
*/
|
|
67
|
+
static isSectionFresh(filePath: string, startLine: number, endLine: number): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Check if a line range overlaps or is adjacent to another range
|
|
70
|
+
* Used for brief read mode to allow consecutive edits in same region
|
|
71
|
+
*/
|
|
72
|
+
static isRegionAdjacent(range1: {
|
|
73
|
+
startLine: number;
|
|
74
|
+
endLine: number;
|
|
75
|
+
}, range2: {
|
|
76
|
+
startLine: number;
|
|
77
|
+
endLine: number;
|
|
78
|
+
}, tolerance?: number): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Mark a file as read at current timestamp
|
|
81
|
+
* Optionally store content fingerprint for section-based freshness detection
|
|
82
|
+
*/
|
|
83
|
+
static markAsRead(filePath: string, startLine?: number, endLine?: number, content?: string): void;
|
|
84
|
+
/**
|
|
85
|
+
* Mark a file as edited at current timestamp
|
|
86
|
+
* Tracks the edit region for consecutive edit allowance in brief read mode
|
|
87
|
+
*
|
|
88
|
+
* @param filePath Path to the file being edited
|
|
89
|
+
* @param startLine Optional start line of the edit (for region tracking)
|
|
90
|
+
* @param endLine Optional end line of the edit (for region tracking)
|
|
91
|
+
*/
|
|
92
|
+
static markAsEdited(filePath: string, startLine?: number, endLine?: number): void;
|
|
93
|
+
/**
|
|
94
|
+
* Check if an edit should be allowed under brief read mode
|
|
95
|
+
* Returns true if:
|
|
96
|
+
* 1. We're under MAX_CONSECUTIVE_EDITS
|
|
97
|
+
* 2. The edit is in the same or adjacent region as previous edits
|
|
98
|
+
* 3. The section's content hash still matches (no external changes)
|
|
99
|
+
*/
|
|
100
|
+
static canSkipReRead(filePath: string, editStartLine?: number, editEndLine?: number): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Check if file has been read AND is still fresh (not edited since last read)
|
|
103
|
+
* Matches a standard coding CLI behavior: require re-read after each edit
|
|
104
|
+
*/
|
|
105
|
+
static hasBeenRead(filePath: string): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Get suggested read parameters for re-reading after edit
|
|
108
|
+
* Returns the section around the last edit for efficient re-reading
|
|
109
|
+
*/
|
|
110
|
+
static getSuggestedReadParams(filePath: string): {
|
|
111
|
+
offset: number;
|
|
112
|
+
limit: number;
|
|
113
|
+
} | null;
|
|
114
|
+
/**
|
|
115
|
+
* Find where a string appears in a file and return suggested read parameters
|
|
116
|
+
* This enables smart error messages that tell the model exactly where to read
|
|
117
|
+
*
|
|
118
|
+
* @param filePath Path to the file
|
|
119
|
+
* @param searchString The string to find (typically old_string from failed edit)
|
|
120
|
+
* @param contextLines Number of lines of context above/below (default: 10)
|
|
121
|
+
* @returns Suggested offset/limit, or null if string not found or file can't be read
|
|
122
|
+
*/
|
|
123
|
+
static findStringInFile(filePath: string, searchString: string, contextLines?: number): {
|
|
124
|
+
offset: number;
|
|
125
|
+
limit: number;
|
|
126
|
+
lineNumber: number;
|
|
127
|
+
} | null;
|
|
128
|
+
/**
|
|
129
|
+
* Clear all session state
|
|
130
|
+
*/
|
|
131
|
+
static clearSession(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Get list of files read in this session
|
|
134
|
+
*/
|
|
135
|
+
static getReadFiles(): string[];
|
|
136
|
+
/**
|
|
137
|
+
* Check if file is stale (edited after last read)
|
|
138
|
+
*/
|
|
139
|
+
static isStale(filePath: string): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Cross-agent staleness: of the files THIS session has read, which have
|
|
142
|
+
* changed on disk since they were read — by ANY writer (the user, another
|
|
143
|
+
* agent, or an external process)? Unlike `isStale` (which only sees this
|
|
144
|
+
* agent's own EditTool edits via `markAsEdited`), this compares each read
|
|
145
|
+
* file's CURRENT disk mtime against the read timestamp. mtime is bumped by
|
|
146
|
+
* every writer, so this catches uncommitted changes made outside this agent.
|
|
147
|
+
*
|
|
148
|
+
* Used by the harness to warn the model to re-read before editing when two
|
|
149
|
+
* agents (or a human + agent) share one working tree.
|
|
150
|
+
*
|
|
151
|
+
* @returns Files read this session that are now modified or deleted on disk.
|
|
152
|
+
*/
|
|
153
|
+
static getExternallyChangedFiles(): {
|
|
154
|
+
path: string;
|
|
155
|
+
deleted: boolean;
|
|
156
|
+
}[];
|
|
157
|
+
/**
|
|
158
|
+
* Phase 3: Suggest optimal read parameters for multiple edit targets
|
|
159
|
+
* When the model plans multiple edits, this calculates a single read that covers all targets
|
|
160
|
+
*
|
|
161
|
+
* @param filePath Path to the file
|
|
162
|
+
* @param editTargets Array of strings to search for (old_string values for planned edits)
|
|
163
|
+
* @param contextLines Number of context lines above/below (default: 10)
|
|
164
|
+
* @returns Suggested offset/limit that covers all targets, or null if not all targets found
|
|
165
|
+
*/
|
|
166
|
+
static suggestBatchRead(filePath: string, editTargets: string[], contextLines?: number): {
|
|
167
|
+
offset: number;
|
|
168
|
+
limit: number;
|
|
169
|
+
coverage: {
|
|
170
|
+
target: string;
|
|
171
|
+
lineNumber: number;
|
|
172
|
+
}[];
|
|
173
|
+
} | null;
|
|
174
|
+
/**
|
|
175
|
+
* Get the consecutive edit count for a file
|
|
176
|
+
* Useful for displaying in error messages
|
|
177
|
+
*/
|
|
178
|
+
static getConsecutiveEditCount(filePath: string): number;
|
|
179
|
+
/**
|
|
180
|
+
* Get the max allowed consecutive edits
|
|
181
|
+
*/
|
|
182
|
+
static getMaxConsecutiveEdits(): number;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Parameters for the Edit tool
|
|
186
|
+
*/
|
|
187
|
+
export interface EditToolParams {
|
|
188
|
+
/**
|
|
189
|
+
* The absolute path to the file to modify
|
|
190
|
+
*/
|
|
191
|
+
file_path: string;
|
|
192
|
+
/**
|
|
193
|
+
* The exact literal text to replace
|
|
194
|
+
*/
|
|
195
|
+
old_string: string;
|
|
196
|
+
/**
|
|
197
|
+
* The exact literal text to replace it with
|
|
198
|
+
*/
|
|
199
|
+
new_string: string;
|
|
200
|
+
/**
|
|
201
|
+
* Whether to replace all occurrences (default: false, only replaces one)
|
|
202
|
+
*/
|
|
203
|
+
replace_all?: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Number of replacements expected (default: 1 if not replace_all, otherwise actual count).
|
|
206
|
+
* Used for validation - edit will fail if actual count doesn't match expected.
|
|
207
|
+
*/
|
|
208
|
+
expected_replacements?: number;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* EditFile Tool Executor
|
|
212
|
+
*
|
|
213
|
+
* Features:
|
|
214
|
+
* - Exact string replacement (no fuzzy matching)
|
|
215
|
+
* - Single or multiple occurrence replacement
|
|
216
|
+
* - Validates unique match (unless replace_all is true)
|
|
217
|
+
* - Generates diff for display
|
|
218
|
+
* - Security: prevents path traversal
|
|
219
|
+
*/
|
|
220
|
+
export declare class EditTool extends BaseTool<EditToolParams, ToolResult> {
|
|
221
|
+
private config;
|
|
222
|
+
constructor(config: ExecutorConfig);
|
|
223
|
+
validateToolParams(params: EditToolParams): string | null;
|
|
224
|
+
getDescription(params: EditToolParams): string;
|
|
225
|
+
execute(params: EditToolParams, signal: AbortSignal, updateOutput?: (output: string) => void): Promise<ToolResult>;
|
|
226
|
+
/**
|
|
227
|
+
* Creates a new file (when old_string is empty)
|
|
228
|
+
* @private
|
|
229
|
+
*/
|
|
230
|
+
private createNewFile;
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=EditTool.d.ts.map
|
|
@@ -0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