@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,253 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Terminal Sandbox</title>
|
|
7
|
+
|
|
8
|
+
<!-- xterm.js CSS -->
|
|
9
|
+
<link rel="stylesheet" href="https://unpkg.com/xterm@5.0.0/css/xterm.css" />
|
|
10
|
+
|
|
11
|
+
<style>
|
|
12
|
+
* {
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
body {
|
|
19
|
+
background: #1e1e1e;
|
|
20
|
+
font-family: 'Courier New', Courier, monospace;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#terminal-container {
|
|
25
|
+
width: 100vw;
|
|
26
|
+
height: 100vh;
|
|
27
|
+
padding: 10px;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#terminal {
|
|
33
|
+
flex: 1;
|
|
34
|
+
background: #000000;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#status-bar {
|
|
38
|
+
height: 24px;
|
|
39
|
+
background: #2d2d2d;
|
|
40
|
+
color: #fff;
|
|
41
|
+
padding: 4px 10px;
|
|
42
|
+
font-size: 12px;
|
|
43
|
+
display: flex;
|
|
44
|
+
justify-content: space-between;
|
|
45
|
+
align-items: center;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.status-item {
|
|
49
|
+
display: flex;
|
|
50
|
+
gap: 10px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.indicator {
|
|
54
|
+
width: 8px;
|
|
55
|
+
height: 8px;
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
display: inline-block;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.indicator.connected {
|
|
61
|
+
background: #0f0;
|
|
62
|
+
box-shadow: 0 0 4px #0f0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.indicator.disconnected {
|
|
66
|
+
background: #f00;
|
|
67
|
+
box-shadow: 0 0 4px #f00;
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
70
|
+
</head>
|
|
71
|
+
<body>
|
|
72
|
+
<div id="terminal-container">
|
|
73
|
+
<div id="status-bar">
|
|
74
|
+
<div class="status-item">
|
|
75
|
+
<span class="indicator disconnected" id="connection-indicator"></span>
|
|
76
|
+
<span id="connection-status">Connecting...</span>
|
|
77
|
+
</div>
|
|
78
|
+
<div class="status-item">
|
|
79
|
+
<span id="terminal-info">Terminal Sandbox</span>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
<div id="terminal"></div>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<!-- xterm.js and addons -->
|
|
86
|
+
<script src="https://unpkg.com/xterm@5.0.0/lib/xterm.js"></script>
|
|
87
|
+
<script src="https://unpkg.com/xterm-addon-fit@0.6.0/lib/xterm-addon-fit.js"></script>
|
|
88
|
+
<script src="https://unpkg.com/xterm-addon-web-links@0.7.0/lib/xterm-addon-web-links.js"></script>
|
|
89
|
+
|
|
90
|
+
<script>
|
|
91
|
+
// Configuration
|
|
92
|
+
const WS_PORT = 3001;
|
|
93
|
+
const WS_URL = `ws://localhost:${WS_PORT}`;
|
|
94
|
+
|
|
95
|
+
// UI elements
|
|
96
|
+
const indicator = document.getElementById('connection-indicator');
|
|
97
|
+
const statusText = document.getElementById('connection-status');
|
|
98
|
+
|
|
99
|
+
// Create terminal with xterm.js
|
|
100
|
+
const term = new Terminal({
|
|
101
|
+
cursorBlink: true,
|
|
102
|
+
cursorStyle: 'block',
|
|
103
|
+
fontSize: 14,
|
|
104
|
+
fontFamily: 'Menlo, Monaco, "Courier New", monospace',
|
|
105
|
+
fontWeight: 'normal',
|
|
106
|
+
lineHeight: 1.2,
|
|
107
|
+
letterSpacing: 0,
|
|
108
|
+
theme: {
|
|
109
|
+
background: '#000000',
|
|
110
|
+
foreground: '#ffffff',
|
|
111
|
+
cursor: '#ffffff',
|
|
112
|
+
cursorAccent: '#000000',
|
|
113
|
+
selection: '#ffffff40',
|
|
114
|
+
black: '#000000',
|
|
115
|
+
red: '#e06c75',
|
|
116
|
+
green: '#98c379',
|
|
117
|
+
yellow: '#d19a66',
|
|
118
|
+
blue: '#61afef',
|
|
119
|
+
magenta: '#c678dd',
|
|
120
|
+
cyan: '#56b6c2',
|
|
121
|
+
white: '#abb2bf',
|
|
122
|
+
brightBlack: '#5c6370',
|
|
123
|
+
brightRed: '#e06c75',
|
|
124
|
+
brightGreen: '#98c379',
|
|
125
|
+
brightYellow: '#d19a66',
|
|
126
|
+
brightBlue: '#61afef',
|
|
127
|
+
brightMagenta: '#c678dd',
|
|
128
|
+
brightCyan: '#56b6c2',
|
|
129
|
+
brightWhite: '#ffffff'
|
|
130
|
+
},
|
|
131
|
+
allowProposedApi: true,
|
|
132
|
+
scrollback: 1000,
|
|
133
|
+
tabStopWidth: 4
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Load addons
|
|
137
|
+
const fitAddon = new FitAddon.FitAddon();
|
|
138
|
+
const webLinksAddon = new WebLinksAddon.WebLinksAddon();
|
|
139
|
+
|
|
140
|
+
term.loadAddon(fitAddon);
|
|
141
|
+
term.loadAddon(webLinksAddon);
|
|
142
|
+
|
|
143
|
+
// Open terminal in DOM
|
|
144
|
+
term.open(document.getElementById('terminal'));
|
|
145
|
+
|
|
146
|
+
// Fit to window
|
|
147
|
+
fitAddon.fit();
|
|
148
|
+
|
|
149
|
+
// WebSocket connection
|
|
150
|
+
let ws = null;
|
|
151
|
+
let reconnectAttempts = 0;
|
|
152
|
+
const MAX_RECONNECT_ATTEMPTS = 5;
|
|
153
|
+
|
|
154
|
+
function connect() {
|
|
155
|
+
ws = new WebSocket(WS_URL);
|
|
156
|
+
|
|
157
|
+
ws.onopen = () => {
|
|
158
|
+
console.log('Connected to terminal server');
|
|
159
|
+
updateStatus(true);
|
|
160
|
+
reconnectAttempts = 0;
|
|
161
|
+
|
|
162
|
+
// Terminal welcome message
|
|
163
|
+
term.writeln('\x1b[32m✓ Connected to terminal server\x1b[0m');
|
|
164
|
+
term.writeln('');
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
ws.onmessage = (event) => {
|
|
168
|
+
// Write server output to terminal
|
|
169
|
+
term.write(event.data);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
ws.onerror = (error) => {
|
|
173
|
+
console.error('WebSocket error:', error);
|
|
174
|
+
updateStatus(false, 'Connection error');
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
ws.onclose = () => {
|
|
178
|
+
console.log('Disconnected from terminal server');
|
|
179
|
+
updateStatus(false, 'Disconnected');
|
|
180
|
+
|
|
181
|
+
// Attempt to reconnect
|
|
182
|
+
if (reconnectAttempts < MAX_RECONNECT_ATTEMPTS) {
|
|
183
|
+
reconnectAttempts++;
|
|
184
|
+
setTimeout(() => {
|
|
185
|
+
console.log(`Reconnecting... (attempt ${reconnectAttempts})`);
|
|
186
|
+
connect();
|
|
187
|
+
}, 2000);
|
|
188
|
+
} else {
|
|
189
|
+
term.writeln('');
|
|
190
|
+
term.writeln('\x1b[31m✗ Connection lost. Max reconnect attempts reached.\x1b[0m');
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Update connection status
|
|
196
|
+
function updateStatus(connected, message) {
|
|
197
|
+
if (connected) {
|
|
198
|
+
indicator.className = 'indicator connected';
|
|
199
|
+
statusText.textContent = 'Connected';
|
|
200
|
+
} else {
|
|
201
|
+
indicator.className = 'indicator disconnected';
|
|
202
|
+
statusText.textContent = message || 'Disconnected';
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Send user input to server
|
|
207
|
+
term.onData((data) => {
|
|
208
|
+
if (ws && ws.readyState === WebSocket.OPEN) {
|
|
209
|
+
ws.send(data);
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
// Handle window resize
|
|
214
|
+
window.addEventListener('resize', () => {
|
|
215
|
+
fitAddon.fit();
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// Handle terminal paste
|
|
219
|
+
term.onKey((e) => {
|
|
220
|
+
if (e.domEvent.ctrlKey && e.domEvent.key === 'v') {
|
|
221
|
+
// Paste from clipboard
|
|
222
|
+
navigator.clipboard.readText().then((text) => {
|
|
223
|
+
if (ws && ws.readyState === WebSocket.OPEN) {
|
|
224
|
+
ws.send(text);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
// Focus terminal on load
|
|
231
|
+
term.focus();
|
|
232
|
+
|
|
233
|
+
// Connect to server
|
|
234
|
+
connect();
|
|
235
|
+
|
|
236
|
+
// Keyboard shortcuts
|
|
237
|
+
document.addEventListener('keydown', (e) => {
|
|
238
|
+
// Ctrl+C: Copy selection
|
|
239
|
+
if (e.ctrlKey && e.key === 'c' && term.hasSelection()) {
|
|
240
|
+
e.preventDefault();
|
|
241
|
+
const selection = term.getSelection();
|
|
242
|
+
navigator.clipboard.writeText(selection);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Ctrl+L: Clear terminal
|
|
246
|
+
if (e.ctrlKey && e.key === 'l') {
|
|
247
|
+
e.preventDefault();
|
|
248
|
+
term.clear();
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
</script>
|
|
252
|
+
</body>
|
|
253
|
+
</html>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRAgent Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* Manages GitHub pull request operations — review, create, list, and post reviews.
|
|
5
|
+
* Uses the gh CLI for all GitHub interactions.
|
|
6
|
+
* Returns structured context for the LLM to dispatch Task calls to specialized agents.
|
|
7
|
+
*
|
|
8
|
+
* Security: all gh invocations use execFile with an argument array (no shell), and every
|
|
9
|
+
* repo/prNumber/action is validated through GitPolicy before use. See GitPolicy.ts.
|
|
10
|
+
*/
|
|
11
|
+
import { BaseTool, type ToolResult } from '../../base/index.js';
|
|
12
|
+
import type { ExecutorConfig } from '../../base/ToolRegistry.js';
|
|
13
|
+
export interface PRAgentParams {
|
|
14
|
+
repo: string;
|
|
15
|
+
mode: 'review' | 'create' | 'list' | 'post-review';
|
|
16
|
+
prNumber?: number;
|
|
17
|
+
branch?: string;
|
|
18
|
+
action?: 'approve' | 'request-changes' | 'comment';
|
|
19
|
+
body?: string;
|
|
20
|
+
diffOptions?: {
|
|
21
|
+
pathFilter?: string;
|
|
22
|
+
maxLines?: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare class PRAgentToolExecutor extends BaseTool<PRAgentParams, ToolResult> {
|
|
26
|
+
private readonly policy;
|
|
27
|
+
constructor(_config: ExecutorConfig);
|
|
28
|
+
validateToolParams(params: PRAgentParams): string | null;
|
|
29
|
+
execute(params: PRAgentParams, signal: AbortSignal): Promise<ToolResult>;
|
|
30
|
+
/** Shared gh invocation: execFile (no shell), policy token/host env, large buffer. */
|
|
31
|
+
private gh;
|
|
32
|
+
private reviewPR;
|
|
33
|
+
private createPR;
|
|
34
|
+
private listPRs;
|
|
35
|
+
private postReview;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=PRAgentTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PRAgentTool.d.ts","sourceRoot":"","sources":["../../../src/implementations/agent/PRAgentTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAajE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,aAAa,CAAC;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,SAAS,GAAG,iBAAiB,GAAG,SAAS,CAAC;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE;QACZ,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,qBAAa,mBAAoB,SAAQ,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC;IAC1E,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;gBAEvB,OAAO,EAAE,cAAc;IAoCnC,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI;IAiClD,OAAO,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IA4B9E,sFAAsF;IACtF,OAAO,CAAC,EAAE;YASI,QAAQ;IAwEtB,OAAO,CAAC,QAAQ;YAeF,OAAO;YAqCP,UAAU;CAsCzB"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRAgent Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* Manages GitHub pull request operations — review, create, list, and post reviews.
|
|
5
|
+
* Uses the gh CLI for all GitHub interactions.
|
|
6
|
+
* Returns structured context for the LLM to dispatch Task calls to specialized agents.
|
|
7
|
+
*
|
|
8
|
+
* Security: all gh invocations use execFile with an argument array (no shell), and every
|
|
9
|
+
* repo/prNumber/action is validated through GitPolicy before use. See GitPolicy.ts.
|
|
10
|
+
*/
|
|
11
|
+
import { BaseTool } from '../../base/index.js';
|
|
12
|
+
import { execFile } from 'child_process';
|
|
13
|
+
import { promisify } from 'util';
|
|
14
|
+
import { GitPolicy } from '../../utils/GitPolicy.js';
|
|
15
|
+
const execFileAsync = promisify(execFile);
|
|
16
|
+
/** Pull the real failure reason out of an execFile rejection (stderr, then message). */
|
|
17
|
+
function subprocessError(error) {
|
|
18
|
+
const stderr = (error?.stderr || '').toString().trim();
|
|
19
|
+
return stderr || error?.message || 'unknown subprocess error';
|
|
20
|
+
}
|
|
21
|
+
export class PRAgentToolExecutor extends BaseTool {
|
|
22
|
+
policy;
|
|
23
|
+
constructor(_config) {
|
|
24
|
+
super('PRAgent', 'PRAgent', 'Manage GitHub pull requests — review, create, list, and post reviews', {
|
|
25
|
+
type: 'object',
|
|
26
|
+
properties: {
|
|
27
|
+
repo: { type: 'string', description: 'Repository in "owner/repo" format' },
|
|
28
|
+
mode: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
enum: ['review', 'create', 'list', 'post-review'],
|
|
31
|
+
description: 'Operation mode',
|
|
32
|
+
},
|
|
33
|
+
prNumber: { type: 'number', description: 'PR number' },
|
|
34
|
+
branch: { type: 'string', description: 'Branch name for create mode' },
|
|
35
|
+
action: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
enum: ['approve', 'request-changes', 'comment'],
|
|
38
|
+
description: 'Review action',
|
|
39
|
+
},
|
|
40
|
+
body: { type: 'string', description: 'Comment body' },
|
|
41
|
+
diffOptions: {
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
pathFilter: { type: 'string' },
|
|
45
|
+
maxLines: { type: 'number' },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
required: ['repo', 'mode'],
|
|
50
|
+
});
|
|
51
|
+
this.policy = GitPolicy.fromEnv();
|
|
52
|
+
}
|
|
53
|
+
validateToolParams(params) {
|
|
54
|
+
const repoErr = this.policy.validateRepo(params.repo);
|
|
55
|
+
if (repoErr)
|
|
56
|
+
return repoErr;
|
|
57
|
+
if (!['review', 'create', 'list', 'post-review'].includes(params.mode)) {
|
|
58
|
+
return 'mode must be one of: review, create, list, post-review';
|
|
59
|
+
}
|
|
60
|
+
// Map mode → policy action for the allow-list.
|
|
61
|
+
const actionForMode = params.mode === 'create' ? 'create' : params.mode;
|
|
62
|
+
const actionErr = this.policy.assertAction(actionForMode);
|
|
63
|
+
if (actionErr)
|
|
64
|
+
return actionErr;
|
|
65
|
+
if (params.mode === 'review' || params.mode === 'post-review') {
|
|
66
|
+
const prErr = this.policy.validatePrNumber(params.prNumber);
|
|
67
|
+
if (prErr)
|
|
68
|
+
return prErr;
|
|
69
|
+
}
|
|
70
|
+
if (params.mode === 'post-review') {
|
|
71
|
+
if (!params.action)
|
|
72
|
+
return 'action is required for post-review mode';
|
|
73
|
+
if ((params.action === 'request-changes' || params.action === 'comment') &&
|
|
74
|
+
(!params.body || params.body.trim() === '')) {
|
|
75
|
+
return `body is required for the "${params.action}" action`;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (params.branch !== undefined) {
|
|
79
|
+
const branchErr = this.policy.validateBranch(params.branch);
|
|
80
|
+
if (branchErr)
|
|
81
|
+
return branchErr;
|
|
82
|
+
}
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
async execute(params, signal) {
|
|
86
|
+
// Verify gh is available
|
|
87
|
+
try {
|
|
88
|
+
await execFileAsync('gh', ['--version'], { signal });
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return this.createErrorResult('GitHub CLI (gh) is not installed or not in PATH. Install it: https://cli.github.com/');
|
|
92
|
+
}
|
|
93
|
+
try {
|
|
94
|
+
switch (params.mode) {
|
|
95
|
+
case 'review':
|
|
96
|
+
return await this.reviewPR(params, signal);
|
|
97
|
+
case 'create':
|
|
98
|
+
return this.createPR(params);
|
|
99
|
+
case 'list':
|
|
100
|
+
return await this.listPRs(params, signal);
|
|
101
|
+
case 'post-review':
|
|
102
|
+
return await this.postReview(params, signal);
|
|
103
|
+
default:
|
|
104
|
+
return this.createErrorResult(`Unknown mode: ${params.mode}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
return this.createErrorResult(`PRAgent error: ${subprocessError(error)}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** Shared gh invocation: execFile (no shell), policy token/host env, large buffer. */
|
|
112
|
+
gh(args, signal) {
|
|
113
|
+
return execFileAsync('gh', args, {
|
|
114
|
+
encoding: 'utf-8',
|
|
115
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
116
|
+
signal,
|
|
117
|
+
env: this.policy.subprocessEnv(),
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
async reviewPR(params, signal) {
|
|
121
|
+
const { repo } = params;
|
|
122
|
+
const prNumber = this.policy.prNumber(params.prNumber);
|
|
123
|
+
const maxLines = params.diffOptions?.maxLines || 5000;
|
|
124
|
+
// Get PR metadata
|
|
125
|
+
const { stdout: metadataRaw } = await this.gh([
|
|
126
|
+
'pr',
|
|
127
|
+
'view',
|
|
128
|
+
String(prNumber),
|
|
129
|
+
'--repo',
|
|
130
|
+
repo,
|
|
131
|
+
'--json',
|
|
132
|
+
'number,title,author,body,baseRefName,headRefName,labels,reviewDecision,additions,deletions,changedFiles,commits,files',
|
|
133
|
+
], signal);
|
|
134
|
+
const metadata = JSON.parse(metadataRaw);
|
|
135
|
+
// Get PR diff
|
|
136
|
+
const { stdout: rawDiff } = await this.gh(['pr', 'diff', String(prNumber), '--repo', repo], signal);
|
|
137
|
+
let diff = rawDiff;
|
|
138
|
+
// Apply path filter if specified
|
|
139
|
+
if (params.diffOptions?.pathFilter) {
|
|
140
|
+
const filter = params.diffOptions.pathFilter;
|
|
141
|
+
const sections = diff.split(/^diff --git /m);
|
|
142
|
+
const filtered = sections.filter((s) => s.includes(filter));
|
|
143
|
+
diff = filtered.map((s) => 'diff --git ' + s).join('');
|
|
144
|
+
}
|
|
145
|
+
// Truncate if needed
|
|
146
|
+
const lines = diff.split('\n');
|
|
147
|
+
const truncated = lines.length > maxLines;
|
|
148
|
+
if (truncated) {
|
|
149
|
+
diff = lines.slice(0, maxLines).join('\n') + '\n... (truncated)';
|
|
150
|
+
}
|
|
151
|
+
const result = {
|
|
152
|
+
mode: 'review',
|
|
153
|
+
repo,
|
|
154
|
+
prNumber,
|
|
155
|
+
title: metadata.title,
|
|
156
|
+
author: metadata.author?.login || 'unknown',
|
|
157
|
+
baseBranch: metadata.baseRefName,
|
|
158
|
+
headBranch: metadata.headRefName,
|
|
159
|
+
labels: (metadata.labels || []).map((l) => l.name),
|
|
160
|
+
reviewDecision: metadata.reviewDecision,
|
|
161
|
+
stats: {
|
|
162
|
+
additions: metadata.additions,
|
|
163
|
+
deletions: metadata.deletions,
|
|
164
|
+
changedFiles: metadata.changedFiles,
|
|
165
|
+
commits: metadata.commits?.length || 0,
|
|
166
|
+
},
|
|
167
|
+
files: (metadata.files || []).map((f) => ({
|
|
168
|
+
path: f.path,
|
|
169
|
+
additions: f.additions,
|
|
170
|
+
deletions: f.deletions,
|
|
171
|
+
})),
|
|
172
|
+
body: metadata.body || '',
|
|
173
|
+
diff,
|
|
174
|
+
diffTruncated: truncated,
|
|
175
|
+
};
|
|
176
|
+
return this.createSuccessResult(JSON.stringify(result, null, 2), {
|
|
177
|
+
prNumber,
|
|
178
|
+
repo,
|
|
179
|
+
title: metadata.title,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
createPR(params) {
|
|
183
|
+
const { repo, branch } = params;
|
|
184
|
+
// Return context for orchestrator to set up workspace and assign agents
|
|
185
|
+
const result = {
|
|
186
|
+
mode: 'create',
|
|
187
|
+
repo,
|
|
188
|
+
branch: branch || null,
|
|
189
|
+
instructions: 'Use WorkspaceManager to create a worktree, then dispatch implementer and test-writer agents.',
|
|
190
|
+
};
|
|
191
|
+
return this.createSuccessResult(JSON.stringify(result, null, 2));
|
|
192
|
+
}
|
|
193
|
+
async listPRs(params, signal) {
|
|
194
|
+
const { repo } = params;
|
|
195
|
+
const { stdout } = await this.gh([
|
|
196
|
+
'pr',
|
|
197
|
+
'list',
|
|
198
|
+
'--repo',
|
|
199
|
+
repo,
|
|
200
|
+
'--json',
|
|
201
|
+
'number,title,author,labels,reviewDecision,headRefName,createdAt,isDraft',
|
|
202
|
+
'--limit',
|
|
203
|
+
'50',
|
|
204
|
+
], signal);
|
|
205
|
+
const prs = JSON.parse(stdout);
|
|
206
|
+
const result = {
|
|
207
|
+
mode: 'list',
|
|
208
|
+
repo,
|
|
209
|
+
count: prs.length,
|
|
210
|
+
pullRequests: prs.map((pr) => ({
|
|
211
|
+
number: pr.number,
|
|
212
|
+
title: pr.title,
|
|
213
|
+
author: pr.author?.login || 'unknown',
|
|
214
|
+
labels: (pr.labels || []).map((l) => l.name),
|
|
215
|
+
reviewDecision: pr.reviewDecision,
|
|
216
|
+
branch: pr.headRefName,
|
|
217
|
+
createdAt: pr.createdAt,
|
|
218
|
+
isDraft: pr.isDraft,
|
|
219
|
+
})),
|
|
220
|
+
};
|
|
221
|
+
return this.createSuccessResult(JSON.stringify(result, null, 2));
|
|
222
|
+
}
|
|
223
|
+
async postReview(params, signal) {
|
|
224
|
+
const { repo, action, body } = params;
|
|
225
|
+
const prNumber = this.policy.prNumber(params.prNumber);
|
|
226
|
+
// Map action to gh flag
|
|
227
|
+
const actionFlags = {
|
|
228
|
+
approve: '--approve',
|
|
229
|
+
'request-changes': '--request-changes',
|
|
230
|
+
comment: '--comment',
|
|
231
|
+
};
|
|
232
|
+
const flag = actionFlags[action];
|
|
233
|
+
if (!flag) {
|
|
234
|
+
return this.createErrorResult(`Invalid action: ${action}`);
|
|
235
|
+
}
|
|
236
|
+
// No shell escaping needed — body is a discrete argv element via execFile.
|
|
237
|
+
const args = ['pr', 'review', String(prNumber), '--repo', repo, flag];
|
|
238
|
+
if (body) {
|
|
239
|
+
args.push('--body', body);
|
|
240
|
+
}
|
|
241
|
+
try {
|
|
242
|
+
await this.gh(args, signal);
|
|
243
|
+
const result = {
|
|
244
|
+
mode: 'post-review',
|
|
245
|
+
repo,
|
|
246
|
+
prNumber,
|
|
247
|
+
action,
|
|
248
|
+
posted: true,
|
|
249
|
+
};
|
|
250
|
+
return this.createSuccessResult(JSON.stringify(result, null, 2));
|
|
251
|
+
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
return this.createErrorResult(`Failed to post review: ${subprocessError(error)}`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=PRAgentTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PRAgentTool.js","sourceRoot":"","sources":["../../../src/implementations/agent/PRAgentTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,QAAQ,EAAmB,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,C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AI,EAAE,CAAC;YACV,OAAO,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;QAC7D,CAAC;QAED,2EAA2E;QAC3E,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACtE,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC5B,CAAC;QAED,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAE5B,MAAM,MAAM,GAAG;gBACb,IAAI,EAAE,aAAa;gBACnB,IAAI;gBACJ,QAAQ;gBACR,MAAM;gBACN,MAAM,EAAE,IAAI;aACb,CAAC;YAEF,OAAO,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QACnE,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,IAAI,CAAC,iBAAiB,CAAC,0BAA0B,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACpF,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { BaseTool } from '../../base/BaseTool.js';
|
|
2
|
+
import type { ToolResult } from '../../base/ToolResult.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parameters for Task tool
|
|
5
|
+
*/
|
|
6
|
+
export interface TaskParams {
|
|
7
|
+
description: string;
|
|
8
|
+
prompt: string;
|
|
9
|
+
subagent_type: string;
|
|
10
|
+
model?: string;
|
|
11
|
+
temperature?: number;
|
|
12
|
+
strategy?: string;
|
|
13
|
+
resume?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* TaskTool - Launch specialized sub-agents to handle complex tasks
|
|
17
|
+
*
|
|
18
|
+
* Loads agent definitions from .cortex/agents/*.md files and returns
|
|
19
|
+
* the agent's system prompt and configuration for orchestrator to use.
|
|
20
|
+
*
|
|
21
|
+
* Agent files use YAML frontmatter:
|
|
22
|
+
* ---
|
|
23
|
+
* name: agent-name
|
|
24
|
+
* description: When to use this agent
|
|
25
|
+
* tools: Tool1, Tool2, Tool3
|
|
26
|
+
* model: sonnet | opus | haiku | inherit
|
|
27
|
+
* ---
|
|
28
|
+
*
|
|
29
|
+
* # Agent System Prompt
|
|
30
|
+
* ...instructions...
|
|
31
|
+
*/
|
|
32
|
+
export declare class TaskToolExecutor extends BaseTool<TaskParams, ToolResult> {
|
|
33
|
+
private agentsCache;
|
|
34
|
+
private projectAgentsDir;
|
|
35
|
+
private personalAgentsDir;
|
|
36
|
+
private builtinAgentsDir?;
|
|
37
|
+
constructor(config: {
|
|
38
|
+
workingDirectory: string;
|
|
39
|
+
});
|
|
40
|
+
validateToolParams(params: TaskParams): string | null;
|
|
41
|
+
getDescription(params: TaskParams): string;
|
|
42
|
+
execute(params: TaskParams, signal: AbortSignal): Promise<ToolResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Load an agent definition by name
|
|
45
|
+
*/
|
|
46
|
+
private loadAgent;
|
|
47
|
+
/**
|
|
48
|
+
* Load all agents from both project and personal directories
|
|
49
|
+
*/
|
|
50
|
+
private loadAgents;
|
|
51
|
+
/**
|
|
52
|
+
* Load agents from a specific directory
|
|
53
|
+
*/
|
|
54
|
+
private loadAgentsFromDirectory;
|
|
55
|
+
/**
|
|
56
|
+
* Parse an agent definition file
|
|
57
|
+
*/
|
|
58
|
+
private parseAgentFile;
|
|
59
|
+
/**
|
|
60
|
+
* Parse YAML frontmatter into key-value pairs
|
|
61
|
+
*/
|
|
62
|
+
private parseFrontmatter;
|
|
63
|
+
/**
|
|
64
|
+
* Format agent output for LLM consumption
|
|
65
|
+
*/
|
|
66
|
+
private formatAgentOutput;
|
|
67
|
+
/**
|
|
68
|
+
* Format a readable listing of all available agents
|
|
69
|
+
*/
|
|
70
|
+
private formatAgentListing;
|
|
71
|
+
/**
|
|
72
|
+
* Clear the agent cache (for testing or when agents are modified)
|
|
73
|
+
*/
|
|
74
|
+
clearCache(): void;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=TaskTool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskTool.d.ts","sourceRoot":"","sources":["../../../src/implementations/agent/TaskTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAQ3D;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAeD;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IACpE,OAAO,CAAC,WAAW,CAA6C;IAChE,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,iBAAiB,CAAS;IAClC,OAAO,CAAC,gBAAgB,CAAC,CAAS;gBAEtB,MAAM,EAAE;QAAE,gBAAgB,EAAE,MAAM,CAAA;KAAE;IAkDhD,kBAAkB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI;IAgDrD,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM;IAKpC,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAkF3E;;OAEG;YACW,SA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