@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 @@
|
|
|
1
|
+
{"version":3,"file":"TmuxCapture.js","sourceRoot":"","sources":["../../src/utils/TmuxCapture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,aAAa,EAAgB,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAsD/C;;;;;;;;GAQG;AACH,MAAM,OAAO,WAAW;IACd,MAAM,CAAC,aAAa,GAAyB,IAAI,CAAC;IAClD,MAAM,CAAC,WAAW,GAAyB,IAAI,CAAC;IAExD;;OAEG;IACK,MAAM,CAAC,KAAK,CAAC,mBAAmB;QACtC,IAAI,WAAW,CAAC,aAAa,EAAE,CAAC;YAC9B,OAAO,WAAW,CAAC,aAAa,CAAC;QACnC,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC;YAC7B,WAAW,CAAC,WAAW,GAAG,CAAC,KAAK,IAAI,EAAE;gBACpC,WAAW,CAAC,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC;gBAChD,MAAM,WAAW,CAAC,aAAa,CA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,UAAU,CAAC,CAAC;IAClD,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,OAAO;QACzB,IAAI,WAAW,CAAC,aAAa,EAAE,CAAC;YAC9B,MAAM,WAAW,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;YACxC,WAAW,CAAC,aAAa,GAAG,IAAI,CAAC;YACjC,WAAW,CAAC,WAAW,GAAG,IAAI,CAAC;QACjC,CAAC;IACH,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface TmuxSessionMetadata {
|
|
2
|
+
sessionId: string;
|
|
3
|
+
created: Date;
|
|
4
|
+
lastUsed: Date;
|
|
5
|
+
cwd?: string;
|
|
6
|
+
env?: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
export declare class TmuxManager {
|
|
9
|
+
private static instance;
|
|
10
|
+
private tmuxAvailable;
|
|
11
|
+
private constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Get singleton instance
|
|
14
|
+
*/
|
|
15
|
+
static getInstance(): TmuxManager;
|
|
16
|
+
/**
|
|
17
|
+
* Check if tmux is installed and available
|
|
18
|
+
*/
|
|
19
|
+
isAvailable(): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Create a new tmux session
|
|
22
|
+
* @param id Session identifier (defaults to generated UUID)
|
|
23
|
+
* @param cwd Working directory for the session
|
|
24
|
+
* @param env Environment variables for the session
|
|
25
|
+
* @returns Session ID
|
|
26
|
+
*/
|
|
27
|
+
createSession(id?: string, cwd?: string, env?: Record<string, string>): Promise<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Send keys (command) to a tmux session
|
|
30
|
+
* @param sessionId Session identifier
|
|
31
|
+
* @param command Command to send
|
|
32
|
+
*/
|
|
33
|
+
sendKeys(sessionId: string, command: string): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Capture output from a tmux pane
|
|
36
|
+
* @param sessionId Session identifier
|
|
37
|
+
* @param startLine Starting line (negative for scrollback)
|
|
38
|
+
* @param endLine Ending line
|
|
39
|
+
* @returns Captured output as string
|
|
40
|
+
*/
|
|
41
|
+
capturePane(sessionId: string, startLine?: number, endLine?: number): Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* List all active tmux sessions
|
|
44
|
+
* @returns Array of session IDs
|
|
45
|
+
*/
|
|
46
|
+
listSessions(): Promise<string[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Kill (terminate) a tmux session
|
|
49
|
+
* @param sessionId Session identifier
|
|
50
|
+
*/
|
|
51
|
+
killSession(sessionId: string): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Check if a specific session exists
|
|
54
|
+
* @param sessionId Session identifier
|
|
55
|
+
* @returns True if session exists
|
|
56
|
+
*/
|
|
57
|
+
sessionExists(sessionId: string): Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Get the current working directory of a session
|
|
60
|
+
* @param sessionId Session identifier
|
|
61
|
+
* @returns Current working directory
|
|
62
|
+
*/
|
|
63
|
+
getSessionCwd(sessionId: string): Promise<string>;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=TmuxManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TmuxManager.d.ts","sourceRoot":"","sources":["../../src/utils/TmuxManager.ts"],"names":[],"mappings":"AAwIA,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,IAAI,CAAC;IACd,QAAQ,EAAE,IAAI,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAc;IACrC,OAAO,CAAC,aAAa,CAAwB;IAE7C,OAAO;IAEP;;OAEG;WACW,WAAW,IAAI,WAAW;IAOxC;;OAEG;IACU,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAe5C;;;;;;OAMG;IACU,aAAa,CACxB,EAAE,CAAC,EAAE,MAAM,EACX,GAAG,CAAC,EAAE,MAAM,EACZ,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,OAAO,CAAC,MAAM,CAAC;IAyClB;;;;OAIG;IACU,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAaxE;;;;;;OAMG;IACU,WAAW,CACtB,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC;IAuBlB;;;OAGG;IACU,YAAY,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAoB9C;;;OAGG;IACU,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY1D;;;;OAIG;IACU,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAa/D;;;;OAIG;IACU,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAc/D"}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TmuxManager - Singleton for managing tmux sessions
|
|
3
|
+
* Handles persistent terminal session lifecycle and operations
|
|
4
|
+
*/
|
|
5
|
+
import { exec } from 'child_process';
|
|
6
|
+
import { promisify } from 'util';
|
|
7
|
+
import { existsSync, statSync } from 'fs';
|
|
8
|
+
import { join } from 'path';
|
|
9
|
+
import * as crypto from 'crypto';
|
|
10
|
+
const execAsync = promisify(exec);
|
|
11
|
+
/**
|
|
12
|
+
* TmuxBinaryLocator - Robust tmux binary discovery
|
|
13
|
+
* Searches multiple locations with priority order and validation
|
|
14
|
+
*/
|
|
15
|
+
class TmuxBinaryLocator {
|
|
16
|
+
cachedPath = undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Find tmux binary with comprehensive search
|
|
19
|
+
*/
|
|
20
|
+
findBinary() {
|
|
21
|
+
// 1. Environment variable (highest priority - user override)
|
|
22
|
+
if (process.env.TMUX_BIN) {
|
|
23
|
+
if (this.isExecutable(process.env.TMUX_BIN)) {
|
|
24
|
+
console.log(`[TmuxManager] Using TMUX_BIN: ${process.env.TMUX_BIN}`);
|
|
25
|
+
return process.env.TMUX_BIN;
|
|
26
|
+
}
|
|
27
|
+
console.warn(`[TmuxManager] TMUX_BIN set but not executable: ${process.env.TMUX_BIN}`);
|
|
28
|
+
}
|
|
29
|
+
// 2. Nix profile locations (common on Replit, NixOS)
|
|
30
|
+
const homeDir = process.env.HOME;
|
|
31
|
+
if (homeDir) {
|
|
32
|
+
const nixPaths = [
|
|
33
|
+
join(homeDir, '.nix-profile/bin/tmux'),
|
|
34
|
+
join(homeDir, '.local/state/nix/profiles/profile/bin/tmux'),
|
|
35
|
+
];
|
|
36
|
+
for (const path of nixPaths) {
|
|
37
|
+
if (this.isExecutable(path)) {
|
|
38
|
+
console.log(`[TmuxManager] Found tmux (nix profile): ${path}`);
|
|
39
|
+
return path;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// 3. System-wide nix locations
|
|
44
|
+
const systemNixPaths = [
|
|
45
|
+
'/nix/var/nix/profiles/default/bin/tmux',
|
|
46
|
+
'/run/current-system/sw/bin/tmux',
|
|
47
|
+
];
|
|
48
|
+
for (const path of systemNixPaths) {
|
|
49
|
+
if (this.isExecutable(path)) {
|
|
50
|
+
console.log(`[TmuxManager] Found tmux (system nix): ${path}`);
|
|
51
|
+
return path;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
// 4. Standard system paths
|
|
55
|
+
const systemPaths = [
|
|
56
|
+
'/usr/bin/tmux',
|
|
57
|
+
'/usr/local/bin/tmux',
|
|
58
|
+
'/opt/homebrew/bin/tmux', // macOS Apple Silicon
|
|
59
|
+
'/home/linuxbrew/.linuxbrew/bin/tmux', // Linux Homebrew
|
|
60
|
+
];
|
|
61
|
+
for (const path of systemPaths) {
|
|
62
|
+
if (this.isExecutable(path)) {
|
|
63
|
+
console.log(`[TmuxManager] Found tmux (system): ${path}`);
|
|
64
|
+
return path;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// 5. Fallback to PATH (let shell resolve)
|
|
68
|
+
console.log(`[TmuxManager] Using 'tmux' from PATH (last resort)`);
|
|
69
|
+
return 'tmux';
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Check if path is an executable file
|
|
73
|
+
*/
|
|
74
|
+
isExecutable(path) {
|
|
75
|
+
try {
|
|
76
|
+
if (!existsSync(path))
|
|
77
|
+
return false;
|
|
78
|
+
const stats = statSync(path);
|
|
79
|
+
// Check if file and has execute permission
|
|
80
|
+
return stats.isFile() && !!(stats.mode & 0o111);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get tmux binary path (cached)
|
|
88
|
+
*/
|
|
89
|
+
getBinary() {
|
|
90
|
+
if (this.cachedPath === undefined) {
|
|
91
|
+
this.cachedPath = this.findBinary();
|
|
92
|
+
}
|
|
93
|
+
if (!this.cachedPath) {
|
|
94
|
+
throw new Error('tmux binary not found. Please install tmux or set TMUX_BIN environment variable.\n\n' +
|
|
95
|
+
'Install commands:\n' +
|
|
96
|
+
' - Ubuntu/Debian: sudo apt-get install tmux\n' +
|
|
97
|
+
' - macOS: brew install tmux\n' +
|
|
98
|
+
' - NixOS/Nix: nix-env -iA nixpkgs.tmux\n' +
|
|
99
|
+
' - Replit: Add tmux in the Packages tab\n' +
|
|
100
|
+
' - Docker: RUN apt-get update && apt-get install -y tmux\n\n' +
|
|
101
|
+
'Or set environment variable:\n' +
|
|
102
|
+
' export TMUX_BIN=/path/to/tmux');
|
|
103
|
+
}
|
|
104
|
+
return this.cachedPath;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Clear cache (for testing or when binary location changes)
|
|
108
|
+
*/
|
|
109
|
+
clearCache() {
|
|
110
|
+
this.cachedPath = undefined;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Singleton instance
|
|
114
|
+
const tmuxLocator = new TmuxBinaryLocator();
|
|
115
|
+
// Export function for backward compatibility
|
|
116
|
+
function getTmuxBin() {
|
|
117
|
+
return tmuxLocator.getBinary();
|
|
118
|
+
}
|
|
119
|
+
export class TmuxManager {
|
|
120
|
+
static instance;
|
|
121
|
+
tmuxAvailable = null;
|
|
122
|
+
constructor() { }
|
|
123
|
+
/**
|
|
124
|
+
* Get singleton instance
|
|
125
|
+
*/
|
|
126
|
+
static getInstance() {
|
|
127
|
+
if (!TmuxManager.instance) {
|
|
128
|
+
TmuxManager.instance = new TmuxManager();
|
|
129
|
+
}
|
|
130
|
+
return TmuxManager.instance;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Check if tmux is installed and available
|
|
134
|
+
*/
|
|
135
|
+
async isAvailable() {
|
|
136
|
+
if (this.tmuxAvailable !== null) {
|
|
137
|
+
return this.tmuxAvailable;
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
await execAsync(`${getTmuxBin()} -V`);
|
|
141
|
+
this.tmuxAvailable = true;
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
this.tmuxAvailable = false;
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Create a new tmux session
|
|
151
|
+
* @param id Session identifier (defaults to generated UUID)
|
|
152
|
+
* @param cwd Working directory for the session
|
|
153
|
+
* @param env Environment variables for the session
|
|
154
|
+
* @returns Session ID
|
|
155
|
+
*/
|
|
156
|
+
async createSession(id, cwd, env) {
|
|
157
|
+
if (!(await this.isAvailable())) {
|
|
158
|
+
throw new Error('tmux is not installed');
|
|
159
|
+
}
|
|
160
|
+
const sessionId = id || crypto.randomUUID();
|
|
161
|
+
// Validate session ID format (alphanumeric + hyphens only)
|
|
162
|
+
if (!/^[a-zA-Z0-9-]+$/.test(sessionId)) {
|
|
163
|
+
throw new Error('Invalid session ID format. Only alphanumeric characters and hyphens allowed.');
|
|
164
|
+
}
|
|
165
|
+
// Build tmux command
|
|
166
|
+
let command = `${getTmuxBin()} new-session -d -s ${sessionId}`;
|
|
167
|
+
// Set working directory if provided
|
|
168
|
+
if (cwd) {
|
|
169
|
+
command += ` -c "${cwd}"`;
|
|
170
|
+
}
|
|
171
|
+
// Set environment variables if provided
|
|
172
|
+
if (env) {
|
|
173
|
+
const envVars = Object.entries(env)
|
|
174
|
+
.map(([key, value]) => `${getTmuxBin()} set-environment -t ${sessionId} ${key} "${value}"`)
|
|
175
|
+
.join(' && ');
|
|
176
|
+
if (envVars) {
|
|
177
|
+
command = `${command} && ${envVars}`;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
try {
|
|
181
|
+
await execAsync(command);
|
|
182
|
+
return sessionId;
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
throw new Error(`Failed to create tmux session: ${error.message}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Send keys (command) to a tmux session
|
|
190
|
+
* @param sessionId Session identifier
|
|
191
|
+
* @param command Command to send
|
|
192
|
+
*/
|
|
193
|
+
async sendKeys(sessionId, command) {
|
|
194
|
+
if (!(await this.isAvailable())) {
|
|
195
|
+
throw new Error('tmux is not installed');
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
// Send command followed by Enter key
|
|
199
|
+
await execAsync(`${getTmuxBin()} send-keys -t ${sessionId} "${command.replace(/"/g, '\\"')}" Enter`);
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
throw new Error(`Failed to send keys to session: ${error.message}`);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Capture output from a tmux pane
|
|
207
|
+
* @param sessionId Session identifier
|
|
208
|
+
* @param startLine Starting line (negative for scrollback)
|
|
209
|
+
* @param endLine Ending line
|
|
210
|
+
* @returns Captured output as string
|
|
211
|
+
*/
|
|
212
|
+
async capturePane(sessionId, startLine, endLine) {
|
|
213
|
+
if (!(await this.isAvailable())) {
|
|
214
|
+
throw new Error('tmux is not installed');
|
|
215
|
+
}
|
|
216
|
+
try {
|
|
217
|
+
let command = `${getTmuxBin()} capture-pane -t ${sessionId} -p`;
|
|
218
|
+
if (startLine !== undefined) {
|
|
219
|
+
command += ` -S ${startLine}`;
|
|
220
|
+
}
|
|
221
|
+
if (endLine !== undefined) {
|
|
222
|
+
command += ` -E ${endLine}`;
|
|
223
|
+
}
|
|
224
|
+
const { stdout } = await execAsync(command);
|
|
225
|
+
return stdout;
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
throw new Error(`Failed to capture pane: ${error.message}`);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* List all active tmux sessions
|
|
233
|
+
* @returns Array of session IDs
|
|
234
|
+
*/
|
|
235
|
+
async listSessions() {
|
|
236
|
+
if (!(await this.isAvailable())) {
|
|
237
|
+
throw new Error('tmux is not installed');
|
|
238
|
+
}
|
|
239
|
+
try {
|
|
240
|
+
const { stdout } = await execAsync(`${getTmuxBin()} list-sessions -F "#{session_name}"`);
|
|
241
|
+
return stdout
|
|
242
|
+
.trim()
|
|
243
|
+
.split('\n')
|
|
244
|
+
.filter(line => line.length > 0);
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
// If no sessions exist, tmux returns error - return empty array
|
|
248
|
+
if (error.message.includes('no server running')) {
|
|
249
|
+
return [];
|
|
250
|
+
}
|
|
251
|
+
throw new Error(`Failed to list sessions: ${error.message}`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Kill (terminate) a tmux session
|
|
256
|
+
* @param sessionId Session identifier
|
|
257
|
+
*/
|
|
258
|
+
async killSession(sessionId) {
|
|
259
|
+
if (!(await this.isAvailable())) {
|
|
260
|
+
throw new Error('tmux is not installed');
|
|
261
|
+
}
|
|
262
|
+
try {
|
|
263
|
+
await execAsync(`${getTmuxBin()} kill-session -t ${sessionId}`);
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
throw new Error(`Failed to kill session: ${error.message}`);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Check if a specific session exists
|
|
271
|
+
* @param sessionId Session identifier
|
|
272
|
+
* @returns True if session exists
|
|
273
|
+
*/
|
|
274
|
+
async sessionExists(sessionId) {
|
|
275
|
+
if (!(await this.isAvailable())) {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
try {
|
|
279
|
+
await execAsync(`${getTmuxBin()} has-session -t ${sessionId}`);
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
282
|
+
catch {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Get the current working directory of a session
|
|
288
|
+
* @param sessionId Session identifier
|
|
289
|
+
* @returns Current working directory
|
|
290
|
+
*/
|
|
291
|
+
async getSessionCwd(sessionId) {
|
|
292
|
+
if (!(await this.isAvailable())) {
|
|
293
|
+
throw new Error('tmux is not installed');
|
|
294
|
+
}
|
|
295
|
+
try {
|
|
296
|
+
const { stdout } = await execAsync(`${getTmuxBin()} display-message -t ${sessionId} -p "#{pane_current_path}"`);
|
|
297
|
+
return stdout.trim();
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
throw new Error(`Failed to get session cwd: ${error.message}`);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
//# sourceMappingURL=TmuxManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TmuxManager.js","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C;QAC9D,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,aAAa,CAAC,SAAiB;QAC1C,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YAChC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,CAAC;YACH,MAAM,SAAS,CAAC,GAAG,UAAU,EAAE,mBAAmB,SAAS,EAAE,CAAC,CAAC;YAC/D,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,aAAa,CAAC,SAAiB;QAC1C,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAChC,GAAG,UAAU,EAAE,uBAAuB,SAAS,4BAA4B,CAC5E,CAAC;YACF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;QACvB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,8BAA8B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Called by ExitPlanModeTool when the PM presents a plan — satisfies the interactive gate. */
|
|
2
|
+
export declare function markAutoResearchPlanMode(): void;
|
|
3
|
+
/** Reset hook (tests / new session). */
|
|
4
|
+
export declare function resetAutoResearchPlanGate(): void;
|
|
5
|
+
/**
|
|
6
|
+
* Returns a rejection message when an `autoresearch-agent` launch must be blocked for lack
|
|
7
|
+
* of a plan, or null when the launch is allowed (or the feature is off / not this agent).
|
|
8
|
+
*/
|
|
9
|
+
export declare function checkAutoResearchPlanGate(subagentType: string): string | null;
|
|
10
|
+
//# sourceMappingURL=autoResearchPlanGate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoResearchPlanGate.d.ts","sourceRoot":"","sources":["../../src/utils/autoResearchPlanGate.ts"],"names":[],"mappings":"AAmBA,+FAA+F;AAC/F,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C;AAED,wCAAwC;AACxC,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD;AAOD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAmB7E"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hard plan-gate for launching `autoresearch-agent` subagents. The PM MUST produce an
|
|
3
|
+
* experiment plan BEFORE any auto-research subagent is spawned — the live run that flailed
|
|
4
|
+
* (5 agents, 0 fixes, 2 timeouts) proved the soft hint alone isn't enough. Enforced inside
|
|
5
|
+
* TaskTool so the launch is rejected before a subagent is ever forked.
|
|
6
|
+
*
|
|
7
|
+
* Context-switched by how the harness is being accessed:
|
|
8
|
+
* - Interactive TUI (a TTY): require the plan was drafted + presented in PLAN MODE
|
|
9
|
+
* (EnterPlanMode → ExitPlanMode marks the signal here; the user approves it via the UI).
|
|
10
|
+
* - Headless CLI / server (no TTY): require a TODO planning checklist exists (TodoCreate).
|
|
11
|
+
*
|
|
12
|
+
* Scope: this enforces that a plan EXISTS, not that its metric is valid — the semantic
|
|
13
|
+
* quality (is the metric measurable/sound?) stays with the steering hint + the agent's
|
|
14
|
+
* fail-fast rule.
|
|
15
|
+
*/
|
|
16
|
+
import { getCurrentTodos } from '../implementations/ui/TodoWriteTool.js';
|
|
17
|
+
let planModeUsedAt = 0;
|
|
18
|
+
/** Called by ExitPlanModeTool when the PM presents a plan — satisfies the interactive gate. */
|
|
19
|
+
export function markAutoResearchPlanMode() {
|
|
20
|
+
planModeUsedAt = Date.now();
|
|
21
|
+
}
|
|
22
|
+
/** Reset hook (tests / new session). */
|
|
23
|
+
export function resetAutoResearchPlanGate() {
|
|
24
|
+
planModeUsedAt = 0;
|
|
25
|
+
}
|
|
26
|
+
/** Interactive terminal (TUI) vs headless (CLI/server). */
|
|
27
|
+
function isInteractive() {
|
|
28
|
+
return !!(process.stdin.isTTY && process.stdout.isTTY);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Returns a rejection message when an `autoresearch-agent` launch must be blocked for lack
|
|
32
|
+
* of a plan, or null when the launch is allowed (or the feature is off / not this agent).
|
|
33
|
+
*/
|
|
34
|
+
export function checkAutoResearchPlanGate(subagentType) {
|
|
35
|
+
if (subagentType !== 'autoresearch-agent')
|
|
36
|
+
return null;
|
|
37
|
+
const mode = (process.env.AUTORESEARCH_AGENTS ?? 'off').trim().toLowerCase();
|
|
38
|
+
if (mode !== 'native' && mode !== 'mcp')
|
|
39
|
+
return null; // feature off — not gated
|
|
40
|
+
if (isInteractive()) {
|
|
41
|
+
if (planModeUsedAt > 0)
|
|
42
|
+
return null;
|
|
43
|
+
return 'BLOCKED — plan required before launching autoresearch-agent subagents. You are the PM: in this ' +
|
|
44
|
+
'interactive session, FIRST draft the experiment plan in PLAN MODE and present it for approval ' +
|
|
45
|
+
'(EnterPlanMode → ExitPlanMode) — the metric + how it is measured, the pass/fail criterion, the ' +
|
|
46
|
+
'base-vs-candidate control (train + holdout), the per-subagent variation, and the continue/fail rules. ' +
|
|
47
|
+
'Once the plan is approved, launch the agents.';
|
|
48
|
+
}
|
|
49
|
+
const todos = getCurrentTodos();
|
|
50
|
+
if (todos.length > 0)
|
|
51
|
+
return null;
|
|
52
|
+
return 'BLOCKED — plan required before launching autoresearch-agent subagents. You are the PM: headless, ' +
|
|
53
|
+
'FIRST create an experiment-plan TODO checklist (TodoCreate) covering the metric + how it is measured, ' +
|
|
54
|
+
'the pass/fail criterion, the base-vs-candidate control (train + holdout), the per-subagent variation, ' +
|
|
55
|
+
'and the continue/fail rules. Then launch the agents.';
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=autoResearchPlanGate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoResearchPlanGate.js","sourceRoot":"","sources":["../../src/utils/autoResearchPlanGate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAEzE,IAAI,cAAc,GAAG,CAAC,CAAC;AAEvB,+FAA+F;AAC/F,MAAM,UAAU,wBAAwB;IACtC,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AAC9B,CAAC;AAED,wCAAwC;AACxC,MAAM,UAAU,yBAAyB;IACvC,cAAc,GAAG,CAAC,CAAC;AACrB,CAAC;AAED,2DAA2D;AAC3D,SAAS,aAAa;IACpB,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,YAAoB;IAC5D,IAAI,YAAY,KAAK,oBAAoB;QAAE,OAAO,IAAI,CAAC;IACvD,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC7E,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,KAAK;QAAE,OAAO,IAAI,CAAC,CAAC,0BAA0B;IAEhF,IAAI,aAAa,EAAE,EAAE,CAAC;QACpB,IAAI,cAAc,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACpC,OAAO,iGAAiG;YACtG,gGAAgG;YAChG,iGAAiG;YACjG,wGAAwG;YACxG,+CAA+C,CAAC;IACpD,CAAC;IACD,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAChC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAClC,OAAO,mGAAmG;QACxG,wGAAwG;QACxG,wGAAwG;QACxG,sDAAsD,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility Functions
|
|
3
|
+
*/
|
|
4
|
+
export * from './SchemaValidator.js';
|
|
5
|
+
export * from './FileUtils.js';
|
|
6
|
+
export { TmuxManager } from './TmuxManager.js';
|
|
7
|
+
export type { TmuxSessionMetadata } from './TmuxManager.js';
|
|
8
|
+
export { SessionPersistence } from './SessionPersistence.js';
|
|
9
|
+
export { SessionLock } from './SessionLock.js';
|
|
10
|
+
export type { LockInfo, LockOptions } from './SessionLock.js';
|
|
11
|
+
export { TmuxCapture } from './TmuxCapture.js';
|
|
12
|
+
export type { CaptureOptions, CaptureResult } from './TmuxCapture.js';
|
|
13
|
+
export { SandboxRegistry } from './SandboxRegistry.js';
|
|
14
|
+
export type { SandboxRegistryEntry, SandboxRegistryData } from './SandboxRegistry.js';
|
|
15
|
+
export { ArtifactRegistry } from './ArtifactRegistry.js';
|
|
16
|
+
export type { ArtifactMetadata, ArtifactRegistrySchema, ArtifactType, ArtifactRuntime, ArtifactMode } from './ArtifactRegistry.js';
|
|
17
|
+
export { GitPolicy, ALL_GIT_ACTIONS } from './GitPolicy.js';
|
|
18
|
+
export type { GitAction, GitPolicyConfig } from './GitPolicy.js';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,YAAY,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACnI,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5D,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility Functions
|
|
3
|
+
*/
|
|
4
|
+
export * from './SchemaValidator.js';
|
|
5
|
+
export * from './FileUtils.js';
|
|
6
|
+
export { TmuxManager } from './TmuxManager.js';
|
|
7
|
+
export { SessionPersistence } from './SessionPersistence.js';
|
|
8
|
+
export { SessionLock } from './SessionLock.js';
|
|
9
|
+
export { TmuxCapture } from './TmuxCapture.js';
|
|
10
|
+
export { SandboxRegistry } from './SandboxRegistry.js';
|
|
11
|
+
export { ArtifactRegistry } from './ArtifactRegistry.js';
|
|
12
|
+
export { GitPolicy, ALL_GIT_ACTIONS } from './GitPolicy.js';
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nexus-cortex/executors",
|
|
3
|
+
"version": "4.26.0",
|
|
4
|
+
"description": "Tool execution layer for Nexus Cortex",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./base": {
|
|
14
|
+
"import": "./dist/base/index.js",
|
|
15
|
+
"types": "./dist/base/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./implementations": {
|
|
18
|
+
"import": "./dist/implementations/index.js",
|
|
19
|
+
"types": "./dist/implementations/index.d.ts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc && npm run copy-assets",
|
|
24
|
+
"copy-assets": "mkdir -p dist/implementations/addon && cp src/implementations/addon/terminal-client.html dist/implementations/addon/terminal-client.html",
|
|
25
|
+
"test": "vitest",
|
|
26
|
+
"test:run": "vitest run",
|
|
27
|
+
"test:ci": "vitest run --coverage",
|
|
28
|
+
"typecheck": "tsc --noEmit"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@google/genai": "^1.27.0",
|
|
32
|
+
"@modelcontextprotocol/sdk": "^1.20.2",
|
|
33
|
+
"@nexus-cortex/core": "^4.26.0",
|
|
34
|
+
"@nexus-cortex/types": "^4.26.0",
|
|
35
|
+
"@types/diff": "^7.0.2",
|
|
36
|
+
"ajv": "^8.12.0",
|
|
37
|
+
"diff": "^8.0.2",
|
|
38
|
+
"express": "^4.18.2",
|
|
39
|
+
"glob": "^10.3.10",
|
|
40
|
+
"html-to-text": "^9.0.5",
|
|
41
|
+
"playwright": "^1.56.1",
|
|
42
|
+
"socket.io": "^4.6.1"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/express": "^4.17.21",
|
|
46
|
+
"@types/html-to-text": "^9.0.4",
|
|
47
|
+
"@types/node": "^20.0.0",
|
|
48
|
+
"@types/ws": "^8.18.1",
|
|
49
|
+
"@vitest/coverage-v8": "^1.0.0",
|
|
50
|
+
"typescript": "^5.3.0",
|
|
51
|
+
"vitest": "^1.0.0"
|
|
52
|
+
},
|
|
53
|
+
"keywords": [
|
|
54
|
+
"cortex",
|
|
55
|
+
"tool-execution",
|
|
56
|
+
"ai-tools"
|
|
57
|
+
],
|
|
58
|
+
"author": "Cortex Team",
|
|
59
|
+
"license": "Apache-2.0",
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
},
|
|
63
|
+
"files": [
|
|
64
|
+
"dist",
|
|
65
|
+
"README.md",
|
|
66
|
+
"LICENSE",
|
|
67
|
+
"NOTICE"
|
|
68
|
+
],
|
|
69
|
+
"repository": {
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "git+https://github.com/Spitfire-Products/nexus-cortex.git",
|
|
72
|
+
"directory": "packages/executors"
|
|
73
|
+
},
|
|
74
|
+
"homepage": "https://github.com/Spitfire-Products/nexus-cortex#readme",
|
|
75
|
+
"bugs": {
|
|
76
|
+
"url": "https://github.com/Spitfire-Products/nexus-cortex/issues"
|
|
77
|
+
},
|
|
78
|
+
"optionalDependencies": {
|
|
79
|
+
"esbuild": "^0.24.0",
|
|
80
|
+
"react": "^18.3.1",
|
|
81
|
+
"react-dom": "^18.3.1"
|
|
82
|
+
}
|
|
83
|
+
}
|