centaurus-cli 2.0.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/AUTH_FLOW.md +138 -0
- package/CONFIG_GUIDE.md +255 -0
- package/LICENSE +21 -0
- package/README.md +346 -0
- package/dist/ai/provider-factory.d.ts +6 -0
- package/dist/ai/provider-factory.d.ts.map +1 -0
- package/dist/ai/provider-factory.js +27 -0
- package/dist/ai/provider-factory.js.map +1 -0
- package/dist/ai/providers/base.d.ts +25 -0
- package/dist/ai/providers/base.d.ts.map +1 -0
- package/dist/ai/providers/base.js +9 -0
- package/dist/ai/providers/base.js.map +1 -0
- package/dist/ai/providers/gemini.d.ts +34 -0
- package/dist/ai/providers/gemini.d.ts.map +1 -0
- package/dist/ai/providers/gemini.js +146 -0
- package/dist/ai/providers/gemini.js.map +1 -0
- package/dist/ai/types.d.ts +20 -0
- package/dist/ai/types.d.ts.map +1 -0
- package/dist/ai/types.js +2 -0
- package/dist/ai/types.js.map +1 -0
- package/dist/cli-adapter.d.ts +78 -0
- package/dist/cli-adapter.d.ts.map +1 -0
- package/dist/cli-adapter.js +605 -0
- package/dist/cli-adapter.js.map +1 -0
- package/dist/commands/CommandParser.d.ts +27 -0
- package/dist/commands/CommandParser.d.ts.map +1 -0
- package/dist/commands/CommandParser.js +238 -0
- package/dist/commands/CommandParser.js.map +1 -0
- package/dist/config/ConfigManager.d.ts +59 -0
- package/dist/config/ConfigManager.d.ts.map +1 -0
- package/dist/config/ConfigManager.js +332 -0
- package/dist/config/ConfigManager.js.map +1 -0
- package/dist/config/defaultConfig.d.ts +82 -0
- package/dist/config/defaultConfig.d.ts.map +1 -0
- package/dist/config/defaultConfig.js +88 -0
- package/dist/config/defaultConfig.js.map +1 -0
- package/dist/config/manager.d.ts +60 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/manager.js +162 -0
- package/dist/config/manager.js.map +1 -0
- package/dist/config/types.d.ts +9 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +6 -0
- package/dist/config/types.js.map +1 -0
- package/dist/index-custom.d.ts +3 -0
- package/dist/index-custom.d.ts.map +1 -0
- package/dist/index-custom.js +65 -0
- package/dist/index-custom.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +102 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/system-prompt.d.ts +47 -0
- package/dist/prompts/system-prompt.d.ts.map +1 -0
- package/dist/prompts/system-prompt.js +378 -0
- package/dist/prompts/system-prompt.js.map +1 -0
- package/dist/providers/GoogleProvider.d.ts +26 -0
- package/dist/providers/GoogleProvider.d.ts.map +1 -0
- package/dist/providers/GoogleProvider.js +313 -0
- package/dist/providers/GoogleProvider.js.map +1 -0
- package/dist/providers/Provider.d.ts +114 -0
- package/dist/providers/Provider.d.ts.map +1 -0
- package/dist/providers/Provider.js +44 -0
- package/dist/providers/Provider.js.map +1 -0
- package/dist/services/api-client.d.ts +282 -0
- package/dist/services/api-client.d.ts.map +1 -0
- package/dist/services/api-client.js +339 -0
- package/dist/services/api-client.js.map +1 -0
- package/dist/services/auth-handler.d.ts +30 -0
- package/dist/services/auth-handler.d.ts.map +1 -0
- package/dist/services/auth-handler.js +210 -0
- package/dist/services/auth-handler.js.map +1 -0
- package/dist/services/conversation-manager.d.ts +73 -0
- package/dist/services/conversation-manager.d.ts.map +1 -0
- package/dist/services/conversation-manager.js +128 -0
- package/dist/services/conversation-manager.js.map +1 -0
- package/dist/tests/automated-verification.d.ts +27 -0
- package/dist/tests/automated-verification.d.ts.map +1 -0
- package/dist/tests/automated-verification.js +359 -0
- package/dist/tests/automated-verification.js.map +1 -0
- package/dist/tests/integration-tests.d.ts +50 -0
- package/dist/tests/integration-tests.d.ts.map +1 -0
- package/dist/tests/integration-tests.js +648 -0
- package/dist/tests/integration-tests.js.map +1 -0
- package/dist/tools/ToolRegistry.d.ts +44 -0
- package/dist/tools/ToolRegistry.d.ts.map +1 -0
- package/dist/tools/ToolRegistry.js +494 -0
- package/dist/tools/ToolRegistry.js.map +1 -0
- package/dist/tools/command.d.ts +4 -0
- package/dist/tools/command.d.ts.map +1 -0
- package/dist/tools/command.js +117 -0
- package/dist/tools/command.js.map +1 -0
- package/dist/tools/file-ops-test.d.ts +6 -0
- package/dist/tools/file-ops-test.d.ts.map +1 -0
- package/dist/tools/file-ops-test.js +197 -0
- package/dist/tools/file-ops-test.js.map +1 -0
- package/dist/tools/file-ops.d.ts +6 -0
- package/dist/tools/file-ops.d.ts.map +1 -0
- package/dist/tools/file-ops.js +189 -0
- package/dist/tools/file-ops.js.map +1 -0
- package/dist/tools/plan-mode.d.ts +53 -0
- package/dist/tools/plan-mode.d.ts.map +1 -0
- package/dist/tools/plan-mode.js +202 -0
- package/dist/tools/plan-mode.js.map +1 -0
- package/dist/tools/registry.d.ts +30 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +67 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +34 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/web-search.d.ts +24 -0
- package/dist/tools/web-search.d.ts.map +1 -0
- package/dist/tools/web-search.js +194 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/types/index.d.ts +32 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/ui/DisplayHistory.d.ts +53 -0
- package/dist/ui/DisplayHistory.d.ts.map +1 -0
- package/dist/ui/DisplayHistory.js +82 -0
- package/dist/ui/DisplayHistory.js.map +1 -0
- package/dist/ui/clack-ui.d.ts +83 -0
- package/dist/ui/clack-ui.d.ts.map +1 -0
- package/dist/ui/clack-ui.js +304 -0
- package/dist/ui/clack-ui.js.map +1 -0
- package/dist/ui/components/App.d.ts +47 -0
- package/dist/ui/components/App.d.ts.map +1 -0
- package/dist/ui/components/App.js +389 -0
- package/dist/ui/components/App.js.map +1 -0
- package/dist/ui/components/AuthScreen.d.ts +8 -0
- package/dist/ui/components/AuthScreen.d.ts.map +1 -0
- package/dist/ui/components/AuthScreen.js +37 -0
- package/dist/ui/components/AuthScreen.js.map +1 -0
- package/dist/ui/components/AuthWelcomeScreen.d.ts +8 -0
- package/dist/ui/components/AuthWelcomeScreen.d.ts.map +1 -0
- package/dist/ui/components/AuthWelcomeScreen.js +34 -0
- package/dist/ui/components/AuthWelcomeScreen.js.map +1 -0
- package/dist/ui/components/CodeBlock.d.ts +9 -0
- package/dist/ui/components/CodeBlock.d.ts.map +1 -0
- package/dist/ui/components/CodeBlock.js +22 -0
- package/dist/ui/components/CodeBlock.js.map +1 -0
- package/dist/ui/components/ConfigViewer.d.ts +11 -0
- package/dist/ui/components/ConfigViewer.d.ts.map +1 -0
- package/dist/ui/components/ConfigViewer.js +27 -0
- package/dist/ui/components/ConfigViewer.js.map +1 -0
- package/dist/ui/components/ConfirmPrompt.d.ts +11 -0
- package/dist/ui/components/ConfirmPrompt.d.ts.map +1 -0
- package/dist/ui/components/ConfirmPrompt.js +55 -0
- package/dist/ui/components/ConfirmPrompt.js.map +1 -0
- package/dist/ui/components/DiffViewer.d.ts +8 -0
- package/dist/ui/components/DiffViewer.d.ts.map +1 -0
- package/dist/ui/components/DiffViewer.js +63 -0
- package/dist/ui/components/DiffViewer.js.map +1 -0
- package/dist/ui/components/DisplayItemRenderer.d.ts +18 -0
- package/dist/ui/components/DisplayItemRenderer.d.ts.map +1 -0
- package/dist/ui/components/DisplayItemRenderer.js +53 -0
- package/dist/ui/components/DisplayItemRenderer.js.map +1 -0
- package/dist/ui/components/DynamicMessage.d.ts +13 -0
- package/dist/ui/components/DynamicMessage.d.ts.map +1 -0
- package/dist/ui/components/DynamicMessage.js +27 -0
- package/dist/ui/components/DynamicMessage.js.map +1 -0
- package/dist/ui/components/ErrorBoundary.d.ts +16 -0
- package/dist/ui/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/ui/components/ErrorBoundary.js +25 -0
- package/dist/ui/components/ErrorBoundary.js.map +1 -0
- package/dist/ui/components/FileOperation.d.ts +10 -0
- package/dist/ui/components/FileOperation.d.ts.map +1 -0
- package/dist/ui/components/FileOperation.js +31 -0
- package/dist/ui/components/FileOperation.js.map +1 -0
- package/dist/ui/components/InputBox.d.ts +12 -0
- package/dist/ui/components/InputBox.d.ts.map +1 -0
- package/dist/ui/components/InputBox.js +50 -0
- package/dist/ui/components/InputBox.js.map +1 -0
- package/dist/ui/components/KeyboardHelp.d.ts +7 -0
- package/dist/ui/components/KeyboardHelp.d.ts.map +1 -0
- package/dist/ui/components/KeyboardHelp.js +25 -0
- package/dist/ui/components/KeyboardHelp.js.map +1 -0
- package/dist/ui/components/LoadingIndicator.d.ts +3 -0
- package/dist/ui/components/LoadingIndicator.d.ts.map +1 -0
- package/dist/ui/components/LoadingIndicator.js +25 -0
- package/dist/ui/components/LoadingIndicator.js.map +1 -0
- package/dist/ui/components/MarkdownRenderer.d.ts +8 -0
- package/dist/ui/components/MarkdownRenderer.d.ts.map +1 -0
- package/dist/ui/components/MarkdownRenderer.js +96 -0
- package/dist/ui/components/MarkdownRenderer.js.map +1 -0
- package/dist/ui/components/MessageBox.d.ts +10 -0
- package/dist/ui/components/MessageBox.d.ts.map +1 -0
- package/dist/ui/components/MessageBox.js +50 -0
- package/dist/ui/components/MessageBox.js.map +1 -0
- package/dist/ui/components/MessageDisplay.d.ts +8 -0
- package/dist/ui/components/MessageDisplay.d.ts.map +1 -0
- package/dist/ui/components/MessageDisplay.js +43 -0
- package/dist/ui/components/MessageDisplay.js.map +1 -0
- package/dist/ui/components/ScrollableContent.d.ts +7 -0
- package/dist/ui/components/ScrollableContent.d.ts.map +1 -0
- package/dist/ui/components/ScrollableContent.js +6 -0
- package/dist/ui/components/ScrollableContent.js.map +1 -0
- package/dist/ui/components/ScrollableMessageList.d.ts +10 -0
- package/dist/ui/components/ScrollableMessageList.d.ts.map +1 -0
- package/dist/ui/components/ScrollableMessageList.js +133 -0
- package/dist/ui/components/ScrollableMessageList.js.map +1 -0
- package/dist/ui/components/ScrollableScreen.d.ts +9 -0
- package/dist/ui/components/ScrollableScreen.d.ts.map +1 -0
- package/dist/ui/components/ScrollableScreen.js +22 -0
- package/dist/ui/components/ScrollableScreen.js.map +1 -0
- package/dist/ui/components/SelectPrompt.d.ts +12 -0
- package/dist/ui/components/SelectPrompt.d.ts.map +1 -0
- package/dist/ui/components/SelectPrompt.js +10 -0
- package/dist/ui/components/SelectPrompt.js.map +1 -0
- package/dist/ui/components/StaticMessageHistory.d.ts +14 -0
- package/dist/ui/components/StaticMessageHistory.d.ts.map +1 -0
- package/dist/ui/components/StaticMessageHistory.js +19 -0
- package/dist/ui/components/StaticMessageHistory.js.map +1 -0
- package/dist/ui/components/StatusBar.d.ts +10 -0
- package/dist/ui/components/StatusBar.d.ts.map +1 -0
- package/dist/ui/components/StatusBar.js +20 -0
- package/dist/ui/components/StatusBar.js.map +1 -0
- package/dist/ui/components/StreamingMessageDisplay.d.ts +13 -0
- package/dist/ui/components/StreamingMessageDisplay.d.ts.map +1 -0
- package/dist/ui/components/StreamingMessageDisplay.js +26 -0
- package/dist/ui/components/StreamingMessageDisplay.js.map +1 -0
- package/dist/ui/components/ToolExecutionMessage.d.ts +8 -0
- package/dist/ui/components/ToolExecutionMessage.d.ts.map +1 -0
- package/dist/ui/components/ToolExecutionMessage.js +189 -0
- package/dist/ui/components/ToolExecutionMessage.js.map +1 -0
- package/dist/ui/components/ToolExecutionStatus.d.ts +10 -0
- package/dist/ui/components/ToolExecutionStatus.d.ts.map +1 -0
- package/dist/ui/components/ToolExecutionStatus.js +65 -0
- package/dist/ui/components/ToolExecutionStatus.js.map +1 -0
- package/dist/ui/components/ToolResult.d.ts +10 -0
- package/dist/ui/components/ToolResult.d.ts.map +1 -0
- package/dist/ui/components/ToolResult.js +17 -0
- package/dist/ui/components/ToolResult.js.map +1 -0
- package/dist/ui/components/WelcomeBanner.d.ts +3 -0
- package/dist/ui/components/WelcomeBanner.d.ts.map +1 -0
- package/dist/ui/components/WelcomeBanner.js +28 -0
- package/dist/ui/components/WelcomeBanner.js.map +1 -0
- package/dist/ui/components/code-block.d.ts +10 -0
- package/dist/ui/components/code-block.d.ts.map +1 -0
- package/dist/ui/components/code-block.js +74 -0
- package/dist/ui/components/code-block.js.map +1 -0
- package/dist/ui/components/confirm-prompt.d.ts +12 -0
- package/dist/ui/components/confirm-prompt.d.ts.map +1 -0
- package/dist/ui/components/confirm-prompt.js +104 -0
- package/dist/ui/components/confirm-prompt.js.map +1 -0
- package/dist/ui/components/diff-viewer.d.ts +9 -0
- package/dist/ui/components/diff-viewer.d.ts.map +1 -0
- package/dist/ui/components/diff-viewer.js +57 -0
- package/dist/ui/components/diff-viewer.js.map +1 -0
- package/dist/ui/components/input-box.d.ts +18 -0
- package/dist/ui/components/input-box.d.ts.map +1 -0
- package/dist/ui/components/input-box.js +157 -0
- package/dist/ui/components/input-box.js.map +1 -0
- package/dist/ui/components/keyboard-help.d.ts +7 -0
- package/dist/ui/components/keyboard-help.d.ts.map +1 -0
- package/dist/ui/components/keyboard-help.js +43 -0
- package/dist/ui/components/keyboard-help.js.map +1 -0
- package/dist/ui/components/loading-indicator.d.ts +3 -0
- package/dist/ui/components/loading-indicator.d.ts.map +1 -0
- package/dist/ui/components/loading-indicator.js +42 -0
- package/dist/ui/components/loading-indicator.js.map +1 -0
- package/dist/ui/components/message-display.d.ts +7 -0
- package/dist/ui/components/message-display.d.ts.map +1 -0
- package/dist/ui/components/message-display.js +104 -0
- package/dist/ui/components/message-display.js.map +1 -0
- package/dist/ui/components/misc.d.ts +28 -0
- package/dist/ui/components/misc.d.ts.map +1 -0
- package/dist/ui/components/misc.js +128 -0
- package/dist/ui/components/misc.js.map +1 -0
- package/dist/ui/components/select-prompt.d.ts +13 -0
- package/dist/ui/components/select-prompt.d.ts.map +1 -0
- package/dist/ui/components/select-prompt.js +42 -0
- package/dist/ui/components/select-prompt.js.map +1 -0
- package/dist/ui/components/status-bar.d.ts +11 -0
- package/dist/ui/components/status-bar.d.ts.map +1 -0
- package/dist/ui/components/status-bar.js +47 -0
- package/dist/ui/components/status-bar.js.map +1 -0
- package/dist/ui/components/tool-execution.d.ts +3 -0
- package/dist/ui/components/tool-execution.d.ts.map +1 -0
- package/dist/ui/components/tool-execution.js +374 -0
- package/dist/ui/components/tool-execution.js.map +1 -0
- package/dist/ui/components/tool-result.d.ts +11 -0
- package/dist/ui/components/tool-result.d.ts.map +1 -0
- package/dist/ui/components/tool-result.js +58 -0
- package/dist/ui/components/tool-result.js.map +1 -0
- package/dist/ui/components/welcome-banner.d.ts +3 -0
- package/dist/ui/components/welcome-banner.d.ts.map +1 -0
- package/dist/ui/components/welcome-banner.js +46 -0
- package/dist/ui/components/welcome-banner.js.map +1 -0
- package/dist/ui/hooks/useDisplayHistory.d.ts +13 -0
- package/dist/ui/hooks/useDisplayHistory.d.ts.map +1 -0
- package/dist/ui/hooks/useDisplayHistory.js +45 -0
- package/dist/ui/hooks/useDisplayHistory.js.map +1 -0
- package/dist/ui/render-engine.d.ts +69 -0
- package/dist/ui/render-engine.d.ts.map +1 -0
- package/dist/ui/render-engine.js +197 -0
- package/dist/ui/render-engine.js.map +1 -0
- package/dist/ui/terminal/TerminalRenderer.d.ts +84 -0
- package/dist/ui/terminal/TerminalRenderer.d.ts.map +1 -0
- package/dist/ui/terminal/TerminalRenderer.js +154 -0
- package/dist/ui/terminal/TerminalRenderer.js.map +1 -0
- package/dist/ui/terminal/TerminalUI.d.ts +139 -0
- package/dist/ui/terminal/TerminalUI.d.ts.map +1 -0
- package/dist/ui/terminal/TerminalUI.js +430 -0
- package/dist/ui/terminal/TerminalUI.js.map +1 -0
- package/dist/ui/terminal/VirtualChatBuffer.d.ts +32 -0
- package/dist/ui/terminal/VirtualChatBuffer.d.ts.map +1 -0
- package/dist/ui/terminal/VirtualChatBuffer.js +37 -0
- package/dist/ui/terminal/VirtualChatBuffer.js.map +1 -0
- package/dist/ui/terminal-kit-base.d.ts +117 -0
- package/dist/ui/terminal-kit-base.d.ts.map +1 -0
- package/dist/ui/terminal-kit-base.js +188 -0
- package/dist/ui/terminal-kit-base.js.map +1 -0
- package/dist/utils/file.d.ts +21 -0
- package/dist/utils/file.d.ts.map +1 -0
- package/dist/utils/file.js +68 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/logger.d.ts +17 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +57 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/markdown-parser.d.ts +56 -0
- package/dist/utils/markdown-parser.d.ts.map +1 -0
- package/dist/utils/markdown-parser.js +307 -0
- package/dist/utils/markdown-parser.js.map +1 -0
- package/dist/utils/shell.d.ts +7 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +62 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/state.d.ts +13 -0
- package/dist/utils/state.d.ts.map +1 -0
- package/dist/utils/state.js +25 -0
- package/dist/utils/state.js.map +1 -0
- package/package.json +81 -0
- package/postinstall.js +46 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan Mode Tool
|
|
3
|
+
* Helps users plan and approve implementation steps for complex tasks
|
|
4
|
+
*/
|
|
5
|
+
let currentPlan = null;
|
|
6
|
+
/**
|
|
7
|
+
* Exit Plan Mode tool
|
|
8
|
+
* Similar to Claude Code's ExitPlanMode - prompts user to approve the plan before proceeding
|
|
9
|
+
*/
|
|
10
|
+
export const exitPlanModeTool = {
|
|
11
|
+
schema: {
|
|
12
|
+
name: 'exit_plan_mode',
|
|
13
|
+
description: `Use this tool when you are in plan mode and have finished presenting your plan and are ready to code.
|
|
14
|
+
This will prompt the user to exit plan mode.
|
|
15
|
+
|
|
16
|
+
IMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code.
|
|
17
|
+
For research tasks where you're gathering information, searching files, reading files or in general trying to understand the codebase - do NOT use this tool.
|
|
18
|
+
|
|
19
|
+
Examples:
|
|
20
|
+
1. Initial task: "Search for and understand the implementation of vim mode in the codebase" - Do not use the exit plan mode tool because you are not planning the implementation steps of a task.
|
|
21
|
+
2. Initial task: "Help me implement yank mode for vim" - Use the exit plan mode tool after you have finished planning the implementation steps of the task.`,
|
|
22
|
+
parameters: {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {
|
|
25
|
+
plan: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
description: 'The plan you came up with, that you want to run by the user for approval. Supports markdown. The plan should be pretty concise.'
|
|
28
|
+
},
|
|
29
|
+
steps: {
|
|
30
|
+
type: 'array',
|
|
31
|
+
items: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: {
|
|
34
|
+
description: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
description: 'Description of the step'
|
|
37
|
+
},
|
|
38
|
+
complexity: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
enum: ['low', 'medium', 'high'],
|
|
41
|
+
description: 'Estimated complexity of the step'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
required: ['description']
|
|
45
|
+
},
|
|
46
|
+
description: 'List of implementation steps (optional, for structured planning)'
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
required: ['plan']
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
async execute(args, context) {
|
|
53
|
+
const planText = args.plan;
|
|
54
|
+
const steps = args.steps;
|
|
55
|
+
if (!planText || planText.trim().length === 0) {
|
|
56
|
+
throw new Error('Plan cannot be empty');
|
|
57
|
+
}
|
|
58
|
+
// Create the plan object
|
|
59
|
+
const plan = {
|
|
60
|
+
title: 'Implementation Plan',
|
|
61
|
+
summary: planText,
|
|
62
|
+
steps: steps ? steps.map((step, index) => ({
|
|
63
|
+
id: `step_${index + 1}`,
|
|
64
|
+
description: step.description,
|
|
65
|
+
status: 'pending',
|
|
66
|
+
estimatedComplexity: step.complexity
|
|
67
|
+
})) : [],
|
|
68
|
+
createdAt: new Date(),
|
|
69
|
+
approved: false
|
|
70
|
+
};
|
|
71
|
+
currentPlan = plan;
|
|
72
|
+
// Format the plan for display
|
|
73
|
+
let formattedPlan = '## 📋 Implementation Plan\n\n';
|
|
74
|
+
formattedPlan += planText + '\n\n';
|
|
75
|
+
if (steps && steps.length > 0) {
|
|
76
|
+
formattedPlan += '### Steps:\n\n';
|
|
77
|
+
steps.forEach((step, index) => {
|
|
78
|
+
const complexity = step.complexity ? ` [${step.complexity}]` : '';
|
|
79
|
+
formattedPlan += `${index + 1}. ${step.description}${complexity}\n`;
|
|
80
|
+
});
|
|
81
|
+
formattedPlan += '\n';
|
|
82
|
+
}
|
|
83
|
+
formattedPlan += '---\n\n';
|
|
84
|
+
formattedPlan += '**Ready to proceed with this plan?**\n';
|
|
85
|
+
formattedPlan += 'Type "yes" to approve and start implementation, or provide feedback to adjust the plan.\n';
|
|
86
|
+
return formattedPlan;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Get current plan status
|
|
91
|
+
*/
|
|
92
|
+
export const getPlanStatusTool = {
|
|
93
|
+
schema: {
|
|
94
|
+
name: 'get_plan_status',
|
|
95
|
+
description: 'Get the current plan status and progress',
|
|
96
|
+
parameters: {
|
|
97
|
+
type: 'object',
|
|
98
|
+
properties: {},
|
|
99
|
+
required: []
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
async execute(args, context) {
|
|
103
|
+
if (!currentPlan) {
|
|
104
|
+
return 'No active plan';
|
|
105
|
+
}
|
|
106
|
+
const completedSteps = currentPlan.steps.filter(s => s.status === 'completed').length;
|
|
107
|
+
const totalSteps = currentPlan.steps.length;
|
|
108
|
+
const progress = totalSteps > 0 ? Math.round((completedSteps / totalSteps) * 100) : 0;
|
|
109
|
+
let status = `## Plan Status\n\n`;
|
|
110
|
+
status += `**Title:** ${currentPlan.title}\n`;
|
|
111
|
+
status += `**Progress:** ${completedSteps}/${totalSteps} (${progress}%)\n`;
|
|
112
|
+
status += `**Approved:** ${currentPlan.approved ? 'Yes' : 'No'}\n\n`;
|
|
113
|
+
if (currentPlan.steps.length > 0) {
|
|
114
|
+
status += '### Steps:\n\n';
|
|
115
|
+
currentPlan.steps.forEach((step, index) => {
|
|
116
|
+
const statusIcon = step.status === 'completed' ? '✅' :
|
|
117
|
+
step.status === 'in_progress' ? '🔄' :
|
|
118
|
+
step.status === 'skipped' ? '⏭️' : '⏳';
|
|
119
|
+
const complexity = step.estimatedComplexity ? ` [${step.estimatedComplexity}]` : '';
|
|
120
|
+
status += `${index + 1}. ${statusIcon} ${step.description}${complexity}\n`;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return status;
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Update plan step status
|
|
128
|
+
*/
|
|
129
|
+
export const updatePlanStepTool = {
|
|
130
|
+
schema: {
|
|
131
|
+
name: 'update_plan_step',
|
|
132
|
+
description: 'Update the status of a plan step',
|
|
133
|
+
parameters: {
|
|
134
|
+
type: 'object',
|
|
135
|
+
properties: {
|
|
136
|
+
step_id: {
|
|
137
|
+
type: 'string',
|
|
138
|
+
description: 'The ID of the step to update (e.g., "step_1")'
|
|
139
|
+
},
|
|
140
|
+
step_number: {
|
|
141
|
+
type: 'number',
|
|
142
|
+
description: 'The step number (alternative to step_id)'
|
|
143
|
+
},
|
|
144
|
+
status: {
|
|
145
|
+
type: 'string',
|
|
146
|
+
enum: ['pending', 'in_progress', 'completed', 'skipped'],
|
|
147
|
+
description: 'The new status of the step'
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
required: ['status']
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
async execute(args, context) {
|
|
154
|
+
if (!currentPlan) {
|
|
155
|
+
throw new Error('No active plan to update');
|
|
156
|
+
}
|
|
157
|
+
const stepId = args.step_id;
|
|
158
|
+
const stepNumber = args.step_number;
|
|
159
|
+
const newStatus = args.status;
|
|
160
|
+
let step;
|
|
161
|
+
if (stepId) {
|
|
162
|
+
step = currentPlan.steps.find(s => s.id === stepId);
|
|
163
|
+
}
|
|
164
|
+
else if (stepNumber !== undefined) {
|
|
165
|
+
step = currentPlan.steps[stepNumber - 1];
|
|
166
|
+
}
|
|
167
|
+
if (!step) {
|
|
168
|
+
throw new Error('Step not found');
|
|
169
|
+
}
|
|
170
|
+
step.status = newStatus;
|
|
171
|
+
return `Step "${step.description}" marked as ${newStatus}`;
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Approve the current plan
|
|
176
|
+
*/
|
|
177
|
+
export function approvePlan() {
|
|
178
|
+
if (currentPlan) {
|
|
179
|
+
currentPlan.approved = true;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Clear the current plan
|
|
184
|
+
*/
|
|
185
|
+
export function clearPlan() {
|
|
186
|
+
currentPlan = null;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Get the current plan
|
|
190
|
+
*/
|
|
191
|
+
export function getCurrentPlan() {
|
|
192
|
+
return currentPlan;
|
|
193
|
+
}
|
|
194
|
+
export default {
|
|
195
|
+
exitPlanModeTool,
|
|
196
|
+
getPlanStatusTool,
|
|
197
|
+
updatePlanStepTool,
|
|
198
|
+
approvePlan,
|
|
199
|
+
clearPlan,
|
|
200
|
+
getCurrentPlan
|
|
201
|
+
};
|
|
202
|
+
//# sourceMappingURL=plan-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-mode.js","sourceRoot":"","sources":["../../src/tools/plan-mode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmBH,IAAI,WAAW,GAAgB,IAAI,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAS;IACpC,MAAM,EAAE;QACN,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE;;;;;;;;4JAQ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,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;QAC3C,CAAC;QAED,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACpC,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QAExB,OAAO,SAAS,IAAI,CAAC,WAAW,eAAe,SAAS,EAAE,CAAC;IAC7D,CAAC;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,IAAI,WAAW,EAAE,CAAC;QAChB,WAAW,CAAC,QAAQ,GAAG,IAAI,CAAC;IAC9B,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS;IACvB,WAAW,GAAG,IAAI,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,eAAe;IACb,gBAAgB;IAChB,iBAAiB;IACjB,kBAAkB;IAClB,WAAW;IACX,SAAS;IACT,cAAc;CACf,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Tool, ToolSchema, ToolExecutionContext } from './types.js';
|
|
2
|
+
export declare class ToolRegistry {
|
|
3
|
+
private tools;
|
|
4
|
+
/**
|
|
5
|
+
* Register a new tool
|
|
6
|
+
*/
|
|
7
|
+
register(tool: Tool): void;
|
|
8
|
+
/**
|
|
9
|
+
* Get a tool by name
|
|
10
|
+
*/
|
|
11
|
+
get(name: string): Tool | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Get all registered tool schemas (for AI provider)
|
|
14
|
+
*/
|
|
15
|
+
getSchemas(): ToolSchema[];
|
|
16
|
+
/**
|
|
17
|
+
* Execute a tool
|
|
18
|
+
*/
|
|
19
|
+
execute(name: string, args: Record<string, any>, context: ToolExecutionContext): Promise<{
|
|
20
|
+
success: boolean;
|
|
21
|
+
result: string;
|
|
22
|
+
error?: string;
|
|
23
|
+
feedback?: string;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Get list of all tool names
|
|
27
|
+
*/
|
|
28
|
+
listTools(): string[];
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEpE,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAgC;IAE7C;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAI1B;;OAEG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS;IAInC;;OAEG;IACH,UAAU,IAAI,UAAU,EAAE;IAI1B;;OAEG;IACG,OAAO,CACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAwCnF;;OAEG;IACH,SAAS,IAAI,MAAM,EAAE;CAGtB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export class ToolRegistry {
|
|
2
|
+
tools = new Map();
|
|
3
|
+
/**
|
|
4
|
+
* Register a new tool
|
|
5
|
+
*/
|
|
6
|
+
register(tool) {
|
|
7
|
+
this.tools.set(tool.schema.name, tool);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get a tool by name
|
|
11
|
+
*/
|
|
12
|
+
get(name) {
|
|
13
|
+
return this.tools.get(name);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get all registered tool schemas (for AI provider)
|
|
17
|
+
*/
|
|
18
|
+
getSchemas() {
|
|
19
|
+
return Array.from(this.tools.values()).map(tool => tool.schema);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Execute a tool
|
|
23
|
+
*/
|
|
24
|
+
async execute(name, args, context) {
|
|
25
|
+
const tool = this.tools.get(name);
|
|
26
|
+
if (!tool) {
|
|
27
|
+
return {
|
|
28
|
+
success: false,
|
|
29
|
+
result: '',
|
|
30
|
+
error: `Tool '${name}' not found`,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
// Validate required parameters
|
|
35
|
+
const required = tool.schema.parameters.required || [];
|
|
36
|
+
for (const param of required) {
|
|
37
|
+
if (!(param in args)) {
|
|
38
|
+
return {
|
|
39
|
+
success: false,
|
|
40
|
+
result: '',
|
|
41
|
+
error: `Missing required parameter: ${param}`,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// Execute the tool
|
|
46
|
+
const result = await tool.execute(args, context);
|
|
47
|
+
return {
|
|
48
|
+
success: true,
|
|
49
|
+
result,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return {
|
|
54
|
+
success: false,
|
|
55
|
+
result: '',
|
|
56
|
+
error: error.message || String(error),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Get list of all tool names
|
|
62
|
+
*/
|
|
63
|
+
listTools() {
|
|
64
|
+
return Array.from(this.tools.keys());
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,YAAY;IACf,KAAK,GAAsB,IAAI,GAAG,EAAE,CAAC;IAE7C;;OAEG;I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IAAI;gBACb,MAAM;aACP,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,EAAE;gBACV,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC;aACtC,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface ToolParameter {
|
|
2
|
+
type: string;
|
|
3
|
+
description: string;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
enum?: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface ToolSchema {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
parameters: {
|
|
11
|
+
type: 'object';
|
|
12
|
+
properties: Record<string, any>;
|
|
13
|
+
required?: string[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface ToolExecutionContext {
|
|
17
|
+
cwd: string;
|
|
18
|
+
requireApproval: (message: string, risky: boolean, preview?: {
|
|
19
|
+
type: 'code' | 'diff';
|
|
20
|
+
content: string;
|
|
21
|
+
language?: string;
|
|
22
|
+
}, operationType?: 'write_file' | 'edit_file' | 'execute_command', operationDetails?: Record<string, any>) => Promise<boolean | {
|
|
23
|
+
approved: false;
|
|
24
|
+
feedback: string;
|
|
25
|
+
}>;
|
|
26
|
+
onStreamingOutput?: (chunk: string, type: 'stdout' | 'stderr') => void;
|
|
27
|
+
renderer?: any;
|
|
28
|
+
}
|
|
29
|
+
export type ToolFunction = (args: Record<string, any>, context: ToolExecutionContext) => Promise<string>;
|
|
30
|
+
export interface Tool {
|
|
31
|
+
schema: ToolSchema;
|
|
32
|
+
execute: ToolFunction;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingUR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MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAEzG,MAAM,WAAW,IAAI;IACnB,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,YAAY,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Search Tool
|
|
3
|
+
* Provides web search capabilities via backend API
|
|
4
|
+
* Backend handles Serper API calls server-side
|
|
5
|
+
*/
|
|
6
|
+
import { Tool } from './types.js';
|
|
7
|
+
export interface WebSearchResult {
|
|
8
|
+
title: string;
|
|
9
|
+
url: string;
|
|
10
|
+
snippet: string;
|
|
11
|
+
}
|
|
12
|
+
export interface WebSearchResponse {
|
|
13
|
+
query: string;
|
|
14
|
+
results: WebSearchResult[];
|
|
15
|
+
timestamp: Date;
|
|
16
|
+
}
|
|
17
|
+
export declare const webSearchTool: Tool;
|
|
18
|
+
export declare const fetchUrlTool: Tool;
|
|
19
|
+
declare const _default: {
|
|
20
|
+
webSearchTool: Tool;
|
|
21
|
+
fetchUrlTool: Tool;
|
|
22
|
+
};
|
|
23
|
+
export default _default;
|
|
24
|
+
//# sourceMappingURL=web-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-search.d.ts","sourceRoot":"","sources":["../../src/tools/web-search.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAwB,MAAM,YAAY,CAAC;AAExD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,SAAS,EAAE,IAAI,CAAC;CACjB;AAgHD,eAAO,MAAM,aAAa,EAAE,IA2E3B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,IA4C1B,CAAC;;;;;AAEF,wBAGE"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Web Search Tool
|
|
3
|
+
* Provides web search capabilities via backend API
|
|
4
|
+
* Backend handles Serper API calls server-side
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Perform web search via backend API
|
|
8
|
+
* Backend handles Serper API calls server-side
|
|
9
|
+
*/
|
|
10
|
+
async function performBackendSearch(query, limit = 10, allowedDomains, blockedDomains) {
|
|
11
|
+
// Import axios and apiClient dynamically to avoid circular dependencies
|
|
12
|
+
const axios = (await import('axios')).default;
|
|
13
|
+
const { apiClient } = await import('../services/api-client.js');
|
|
14
|
+
// Check if authenticated
|
|
15
|
+
if (!apiClient.isAuthenticated()) {
|
|
16
|
+
throw new Error('Authentication required. Please sign in to use web search.\n' +
|
|
17
|
+
'Web search is a backend feature that requires authentication.');
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const baseURL = process.env.BACKEND_API_URL || 'https://centaurus-backend.onrender.com/api';
|
|
21
|
+
const response = await axios.post(`${baseURL}/web-search/search`, {
|
|
22
|
+
query,
|
|
23
|
+
limit,
|
|
24
|
+
allowed_domains: allowedDomains,
|
|
25
|
+
blocked_domains: blockedDomains,
|
|
26
|
+
}, {
|
|
27
|
+
headers: {
|
|
28
|
+
'Content-Type': 'application/json',
|
|
29
|
+
'Authorization': `Bearer ${apiClient.sessionToken}`,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
if (!response.data || !response.data.success) {
|
|
33
|
+
throw new Error(response.data?.error?.message || 'Search failed');
|
|
34
|
+
}
|
|
35
|
+
return response.data.data;
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
if (error.response?.status === 401) {
|
|
39
|
+
throw new Error('Authentication required. Please sign in to use web search.\n' +
|
|
40
|
+
'Web search is a backend feature that requires authentication.');
|
|
41
|
+
}
|
|
42
|
+
throw new Error(error.response?.data?.error?.message ||
|
|
43
|
+
error.message ||
|
|
44
|
+
'Web search request failed');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Fetch URL content via backend API
|
|
49
|
+
* Backend handles URL fetching and parsing server-side
|
|
50
|
+
*/
|
|
51
|
+
async function fetchUrlViaBackend(url) {
|
|
52
|
+
// Import axios and apiClient dynamically to avoid circular dependencies
|
|
53
|
+
const axios = (await import('axios')).default;
|
|
54
|
+
const { apiClient } = await import('../services/api-client.js');
|
|
55
|
+
// Check if authenticated
|
|
56
|
+
if (!apiClient.isAuthenticated()) {
|
|
57
|
+
throw new Error('Authentication required. Please sign in to fetch URLs.\n' +
|
|
58
|
+
'URL fetching is a backend feature that requires authentication.');
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
const baseURL = process.env.BACKEND_API_URL || 'https://centaurus-backend.onrender.com/api';
|
|
62
|
+
const response = await axios.post(`${baseURL}/web-search/fetch-url`, { url }, {
|
|
63
|
+
headers: {
|
|
64
|
+
'Content-Type': 'application/json',
|
|
65
|
+
'Authorization': `Bearer ${apiClient.sessionToken}`,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
if (!response.data || !response.data.success) {
|
|
69
|
+
throw new Error(response.data?.error?.message || 'Failed to fetch URL');
|
|
70
|
+
}
|
|
71
|
+
return response.data.data.content;
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
if (error.response?.status === 401) {
|
|
75
|
+
throw new Error('Authentication required. Please sign in to fetch URLs.\n' +
|
|
76
|
+
'URL fetching is a backend feature that requires authentication.');
|
|
77
|
+
}
|
|
78
|
+
throw new Error(error.response?.data?.error?.message ||
|
|
79
|
+
error.message ||
|
|
80
|
+
'Failed to fetch URL');
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export const webSearchTool = {
|
|
84
|
+
schema: {
|
|
85
|
+
name: 'web_search',
|
|
86
|
+
description: `Search the web using backend API (real Google search results via Serper).
|
|
87
|
+
- Provides actual Google search results with organic listings
|
|
88
|
+
- Returns search results with titles, URLs, and snippets
|
|
89
|
+
- Works for all types of queries including "best X", "top Y", etc.
|
|
90
|
+
- Use for finding current information, documentation, tutorials, and lists
|
|
91
|
+
- Can filter by allowed or blocked domains
|
|
92
|
+
- Requires authentication to use`,
|
|
93
|
+
parameters: {
|
|
94
|
+
type: 'object',
|
|
95
|
+
properties: {
|
|
96
|
+
query: {
|
|
97
|
+
type: 'string',
|
|
98
|
+
description: 'The search query to use (2-200 characters)'
|
|
99
|
+
},
|
|
100
|
+
limit: {
|
|
101
|
+
type: 'number',
|
|
102
|
+
description: 'Maximum number of results to return (1-10)',
|
|
103
|
+
default: 10
|
|
104
|
+
},
|
|
105
|
+
allowed_domains: {
|
|
106
|
+
type: 'array',
|
|
107
|
+
items: { type: 'string' },
|
|
108
|
+
description: 'Only include results from these domains'
|
|
109
|
+
},
|
|
110
|
+
blocked_domains: {
|
|
111
|
+
type: 'array',
|
|
112
|
+
items: { type: 'string' },
|
|
113
|
+
description: 'Never include results from these domains'
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
required: ['query']
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
async execute(args, context) {
|
|
120
|
+
const query = args.query;
|
|
121
|
+
const limit = Math.min(Math.max(args.limit || 10, 1), 10);
|
|
122
|
+
const allowedDomains = args.allowed_domains;
|
|
123
|
+
const blockedDomains = args.blocked_domains;
|
|
124
|
+
if (!query || query.length < 2) {
|
|
125
|
+
throw new Error('Search query must be at least 2 characters');
|
|
126
|
+
}
|
|
127
|
+
if (query.length > 200) {
|
|
128
|
+
throw new Error('Search query must not exceed 200 characters');
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
// Perform the search via backend API
|
|
132
|
+
const searchResponse = await performBackendSearch(query, limit, allowedDomains, blockedDomains);
|
|
133
|
+
// Format results
|
|
134
|
+
if (searchResponse.results.length === 0) {
|
|
135
|
+
return `No results found for query: "${query}"`;
|
|
136
|
+
}
|
|
137
|
+
const formattedResults = searchResponse.results.map((result, index) => {
|
|
138
|
+
return `${index + 1}. **${result.title}**\n URL: ${result.url}\n ${result.snippet}\n`;
|
|
139
|
+
}).join('\n');
|
|
140
|
+
return `Search results for "${query}" (${searchResponse.results.length} results):\n\n${formattedResults}`;
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
throw new Error(`Web search failed: ${error.message}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
export const fetchUrlTool = {
|
|
148
|
+
schema: {
|
|
149
|
+
name: 'fetch_url',
|
|
150
|
+
description: `Fetch and extract content from a URL for in-depth research via backend API.
|
|
151
|
+
- Fetches HTML content and converts it to readable text
|
|
152
|
+
- Handles redirects automatically
|
|
153
|
+
- Returns up to 15,000 characters of content
|
|
154
|
+
- Use after web_search to get full content from promising URLs
|
|
155
|
+
- Ideal for documentation, articles, tutorials, and blog posts
|
|
156
|
+
- Works best with text-heavy pages (not ideal for complex web apps)
|
|
157
|
+
- Requires authentication to use`,
|
|
158
|
+
parameters: {
|
|
159
|
+
type: 'object',
|
|
160
|
+
properties: {
|
|
161
|
+
url: {
|
|
162
|
+
type: 'string',
|
|
163
|
+
description: 'The URL to fetch content from'
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
required: ['url']
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
async execute(args, context) {
|
|
170
|
+
const url = args.url;
|
|
171
|
+
if (!url) {
|
|
172
|
+
throw new Error('URL is required');
|
|
173
|
+
}
|
|
174
|
+
// Validate URL
|
|
175
|
+
try {
|
|
176
|
+
new URL(url);
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
throw new Error('Invalid URL format');
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
const content = await fetchUrlViaBackend(url);
|
|
183
|
+
return `Content from ${url}:\n\n${content}`;
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
throw new Error(`Failed to fetch URL: ${error.message}`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
export default {
|
|
191
|
+
webSearchTool,
|
|
192
|
+
fetchUrlTool
|
|
193
|
+
};
|
|
194
|
+
//# sourceMappingURL=web-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-search.js","sourceRoot":"","sources":["../../src/tools/web-search.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH;;;GAGG;AACH,KAAK,UAAU,oBAAoB,CACjC,KAAa,EACb,QAAgB,EAAE,EAClB,cAAyB,EACzB,cAAyB;IAEzB,wEAAwE;IACxE,MAAM,KAAK,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9C,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;IAEhE,yBAAyB;IACzB,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CACb,8DAA8D;YAC9D,+DAA+D,CAChE,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,4CAA4C,CAAC;QAC5F,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAC/B,GAAG,OAAO,oBAAoB,EAC9B;YACE,KAAK;YACL,KAAK;YACL,eAAe,EAAE,cAAc;YAC/B,eAAe,EAAE,cAAc;SAChC,EACD;YACE,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,eAAe,EAAE,UAAW,SAAiB,CAAC,YAAY,EAAE;aAC7D;SACF,CACF,CAAC;QAEF,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|
+
export interface ToolExecution {
|
|
2
|
+
toolName: string;
|
|
3
|
+
status: 'executing' | 'completed' | 'error';
|
|
4
|
+
result?: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
arguments?: Record<string, any>;
|
|
7
|
+
timestamp?: Date;
|
|
8
|
+
streamingOutput?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface Message {
|
|
11
|
+
id: string;
|
|
12
|
+
role: 'user' | 'assistant' | 'system' | 'tool';
|
|
13
|
+
content: string;
|
|
14
|
+
timestamp?: Date;
|
|
15
|
+
toolExecution?: ToolExecution;
|
|
16
|
+
}
|
|
17
|
+
export interface ToolCall {
|
|
18
|
+
name: string;
|
|
19
|
+
arguments: Record<string, any>;
|
|
20
|
+
}
|
|
21
|
+
export interface ToolResult {
|
|
22
|
+
success: boolean;
|
|
23
|
+
output: string;
|
|
24
|
+
duration?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface AppState {
|
|
27
|
+
messages: Message[];
|
|
28
|
+
autoAcceptMode: boolean;
|
|
29
|
+
isLoading: boolean;
|
|
30
|
+
currentModel: string;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,GAAG,WAAW,GAAG,OAAO,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":""}
|