@defai.digital/ax-cli 3.8.22 → 3.8.23
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/README.md +7 -1
- package/dist/agent/core/index.d.ts +8 -0
- package/dist/agent/core/index.js +9 -0
- package/dist/agent/core/index.js.map +1 -0
- package/dist/agent/core/types.d.ts +92 -0
- package/dist/agent/core/types.js +11 -0
- package/dist/agent/core/types.js.map +1 -0
- package/dist/agent/execution/index.d.ts +9 -0
- package/dist/agent/execution/index.js +9 -0
- package/dist/agent/execution/index.js.map +1 -0
- package/dist/agent/execution/tool-executor.d.ts +79 -0
- package/dist/agent/execution/tool-executor.js +281 -0
- package/dist/agent/execution/tool-executor.js.map +1 -0
- package/dist/agent/llm-agent.d.ts +22 -98
- package/dist/agent/llm-agent.js +169 -712
- package/dist/agent/llm-agent.js.map +1 -1
- package/dist/agent/planning/index.d.ts +9 -0
- package/dist/agent/planning/index.js +9 -0
- package/dist/agent/planning/index.js.map +1 -0
- package/dist/agent/planning/plan-executor.d.ts +84 -0
- package/dist/agent/planning/plan-executor.js +223 -0
- package/dist/agent/planning/plan-executor.js.map +1 -0
- package/dist/agent/streaming/index.d.ts +9 -0
- package/dist/agent/streaming/index.js +9 -0
- package/dist/agent/streaming/index.js.map +1 -0
- package/dist/agent/streaming/stream-handler.d.ts +62 -0
- package/dist/agent/streaming/stream-handler.js +193 -0
- package/dist/agent/streaming/stream-handler.js.map +1 -0
- package/dist/agent/subagent-orchestrator.d.ts +3 -3
- package/dist/agent/subagent-orchestrator.js +1 -0
- package/dist/agent/subagent-orchestrator.js.map +1 -1
- package/dist/agent/subagent-types.d.ts +10 -22
- package/dist/agent/subagent-types.js +19 -0
- package/dist/agent/subagent-types.js.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/llm/client.d.ts +33 -1
- package/dist/llm/client.js +15 -11
- package/dist/llm/client.js.map +1 -1
- package/dist/llm/types.d.ts +7 -1
- package/dist/llm/types.js +5 -4
- package/dist/llm/types.js.map +1 -1
- package/dist/mcp/index.d.ts +31 -0
- package/dist/mcp/index.js +36 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/planner/types.d.ts +8 -8
- package/dist/schemas/index.d.ts +4 -4
- package/dist/schemas/tool-schemas.d.ts +12 -12
- package/dist/tools/bash.js +1 -1
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/text-editor.js +57 -63
- package/dist/tools/text-editor.js.map +1 -1
- package/dist/ui/hooks/use-enhanced-input.js +66 -81
- package/dist/ui/hooks/use-enhanced-input.js.map +1 -1
- package/dist/utils/background-task-manager.js +10 -2
- package/dist/utils/background-task-manager.js.map +1 -1
- package/dist/utils/confirmation-service.js +8 -5
- package/dist/utils/confirmation-service.js.map +1 -1
- package/dist/utils/index.d.ts +85 -6
- package/dist/utils/index.js +103 -15
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/retry-helper.d.ts +7 -6
- package/dist/utils/retry-helper.js +8 -6
- package/dist/utils/retry-helper.js.map +1 -1
- package/dist/utils/settings-manager.d.ts +6 -0
- package/dist/utils/settings-manager.js +51 -64
- package/dist/utils/settings-manager.js.map +1 -1
- package/node_modules/@ax-cli/schemas/dist/index.d.ts +1 -0
- package/node_modules/@ax-cli/schemas/dist/index.d.ts.map +1 -1
- package/node_modules/@ax-cli/schemas/dist/index.js.map +1 -1
- package/node_modules/@ax-cli/schemas/dist/public/agent/chat-types.d.ts +164 -0
- package/node_modules/@ax-cli/schemas/dist/public/agent/chat-types.d.ts.map +1 -0
- package/node_modules/@ax-cli/schemas/dist/public/agent/chat-types.js +10 -0
- package/node_modules/@ax-cli/schemas/dist/public/agent/chat-types.js.map +1 -0
- package/node_modules/@ax-cli/schemas/dist/public/agent/index.d.ts +9 -0
- package/node_modules/@ax-cli/schemas/dist/public/agent/index.d.ts.map +1 -0
- package/node_modules/@ax-cli/schemas/dist/public/agent/index.js +9 -0
- package/node_modules/@ax-cli/schemas/dist/public/agent/index.js.map +1 -0
- package/package.json +1 -1
- package/packages/schemas/dist/index.d.ts +1 -0
- package/packages/schemas/dist/index.d.ts.map +1 -1
- package/packages/schemas/dist/index.js.map +1 -1
- package/packages/schemas/dist/public/agent/chat-types.d.ts +164 -0
- package/packages/schemas/dist/public/agent/chat-types.d.ts.map +1 -0
- package/packages/schemas/dist/public/agent/chat-types.js +10 -0
- package/packages/schemas/dist/public/agent/chat-types.js.map +1 -0
- package/packages/schemas/dist/public/agent/index.d.ts +9 -0
- package/packages/schemas/dist/public/agent/index.d.ts.map +1 -0
- package/packages/schemas/dist/public/agent/index.js +9 -0
- package/packages/schemas/dist/public/agent/index.js.map +1 -0
- package/dist/mcp/config-detector-v2.d.ts +0 -83
- package/dist/mcp/config-detector-v2.js +0 -328
- package/dist/mcp/config-detector-v2.js.map +0 -1
- package/dist/mcp/config-migrator-v2.d.ts +0 -89
- package/dist/mcp/config-migrator-v2.js +0 -288
- package/dist/mcp/config-migrator-v2.js.map +0 -1
- package/dist/mcp/config-v2.d.ts +0 -111
- package/dist/mcp/config-v2.js +0 -443
- package/dist/mcp/config-v2.js.map +0 -1
- package/dist/mcp/transports-v2.d.ts +0 -152
- package/dist/mcp/transports-v2.js +0 -481
- package/dist/mcp/transports-v2.js.map +0 -1
- package/dist/utils/error-sanitizer.d.ts +0 -119
- package/dist/utils/error-sanitizer.js +0 -253
- package/dist/utils/error-sanitizer.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -74
- package/dist/utils/errors.js +0 -139
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/incremental-analyzer.d.ts +0 -134
- package/dist/utils/incremental-analyzer.js +0 -377
- package/dist/utils/incremental-analyzer.js.map +0 -1
- package/dist/utils/settings.d.ts +0 -1
- package/dist/utils/settings.js +0 -4
- package/dist/utils/settings.js.map +0 -1
- package/dist/utils/streaming-analyzer.d.ts +0 -160
- package/dist/utils/streaming-analyzer.js +0 -214
- package/dist/utils/streaming-analyzer.js.map +0 -1
package/README.md
CHANGED
|
@@ -381,7 +381,13 @@ Email: **security@defai.digital** (private disclosure)
|
|
|
381
381
|
|
|
382
382
|
## Changelog
|
|
383
383
|
|
|
384
|
-
### v3.8.
|
|
384
|
+
### v3.8.23 (Latest)
|
|
385
|
+
|
|
386
|
+
- **Bug fix: Background task status** - Killed tasks now correctly show 'killed' instead of 'failed'
|
|
387
|
+
- **Bug fix: Project settings corruption** - Now throws error instead of silent data loss
|
|
388
|
+
- **Bug fix: Destructive operation confirmation** - `alwaysConfirm` flag now properly forces confirmation
|
|
389
|
+
|
|
390
|
+
### v3.8.21
|
|
385
391
|
|
|
386
392
|
- **Configurable confirmation timeout** - Now uses `TIMEOUT_CONFIG.CONFIRMATION_TIMEOUT`
|
|
387
393
|
- **Dynamic timeout message** - Displays actual configured value
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Core Module
|
|
3
|
+
*
|
|
4
|
+
* Core type definitions and utilities for the LLM Agent system.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export type { ChatEntry, StreamingChunk, AccumulatedMessage, AgentConfig, AgentEventType, StreamResult, ToolParseResult, } from './types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agent/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Core Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the LLM Agent system.
|
|
5
|
+
* These types extend @ax-cli/schemas with concrete implementations
|
|
6
|
+
* for OpenAI SDK compatibility.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
import type { LLMToolCall } from "../../llm/client.js";
|
|
11
|
+
import type { ToolResult } from "../../types/index.js";
|
|
12
|
+
import type { ChatEntry as SchemaChatEntry, StreamingChunk as SchemaStreamingChunk, AccumulatedMessage as SchemaAccumulatedMessage } from "@ax-cli/schemas";
|
|
13
|
+
/**
|
|
14
|
+
* Chat Entry - extends schema type with LLMToolCall for OpenAI SDK compatibility
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* The canonical type definition is in @ax-cli/schemas.
|
|
18
|
+
* This interface extends it to use the concrete LLMToolCall type from the LLM client.
|
|
19
|
+
*
|
|
20
|
+
* @see {@link SchemaChatEntry} for the canonical type definition
|
|
21
|
+
*/
|
|
22
|
+
export interface ChatEntry extends Omit<SchemaChatEntry, 'toolCalls' | 'toolCall'> {
|
|
23
|
+
/** Tool calls made by assistant (uses LLMToolCall for OpenAI SDK compatibility) */
|
|
24
|
+
toolCalls?: LLMToolCall[];
|
|
25
|
+
/** Single tool call (uses LLMToolCall for OpenAI SDK compatibility) */
|
|
26
|
+
toolCall?: LLMToolCall;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Streaming Chunk - extends schema type with LLMToolCall for OpenAI SDK compatibility
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* The canonical type definition is in @ax-cli/schemas.
|
|
33
|
+
* This interface extends it to use concrete types from the LLM client and tools.
|
|
34
|
+
*
|
|
35
|
+
* @see {@link SchemaStreamingChunk} for the canonical type definition
|
|
36
|
+
*/
|
|
37
|
+
export interface StreamingChunk extends Omit<SchemaStreamingChunk, 'toolCalls' | 'toolCall' | 'toolResult'> {
|
|
38
|
+
/** Tool calls from LLM (uses LLMToolCall for OpenAI SDK compatibility) */
|
|
39
|
+
toolCalls?: LLMToolCall[];
|
|
40
|
+
/** Single tool call (uses LLMToolCall for OpenAI SDK compatibility) */
|
|
41
|
+
toolCall?: LLMToolCall;
|
|
42
|
+
/** Tool execution result (uses ToolResult from types) */
|
|
43
|
+
toolResult?: ToolResult;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Accumulated message from streaming response - extends schema type
|
|
47
|
+
*
|
|
48
|
+
* @remarks
|
|
49
|
+
* The canonical type definition is in @ax-cli/schemas.
|
|
50
|
+
* This interface extends it to use the concrete LLMToolCall type.
|
|
51
|
+
*
|
|
52
|
+
* @see {@link SchemaAccumulatedMessage} for the canonical type definition
|
|
53
|
+
*/
|
|
54
|
+
export interface AccumulatedMessage extends Omit<SchemaAccumulatedMessage, 'tool_calls'> {
|
|
55
|
+
/** Tool calls accumulated from the response */
|
|
56
|
+
tool_calls?: LLMToolCall[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Agent configuration options
|
|
60
|
+
*/
|
|
61
|
+
export interface AgentConfig {
|
|
62
|
+
/** API key for LLM provider */
|
|
63
|
+
apiKey: string;
|
|
64
|
+
/** Base URL for API (optional) */
|
|
65
|
+
baseURL?: string;
|
|
66
|
+
/** Model to use */
|
|
67
|
+
model?: string;
|
|
68
|
+
/** Maximum tool execution rounds */
|
|
69
|
+
maxToolRounds?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Agent events that can be emitted
|
|
73
|
+
*/
|
|
74
|
+
export type AgentEventType = 'system' | 'error' | 'context:summary' | 'tool:approval_required' | 'tool:approved' | 'tool:rejected' | 'phase:started' | 'phase:completed' | 'phase:failed' | 'plan:created' | 'plan:completed' | 'plan:failed' | 'plan:report';
|
|
75
|
+
/**
|
|
76
|
+
* Streaming result from processing chunks
|
|
77
|
+
*/
|
|
78
|
+
export interface StreamResult {
|
|
79
|
+
accumulated: AccumulatedMessage;
|
|
80
|
+
content: string;
|
|
81
|
+
yielded: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Tool parse result
|
|
85
|
+
*/
|
|
86
|
+
export type ToolParseResult = {
|
|
87
|
+
success: true;
|
|
88
|
+
args: Record<string, unknown>;
|
|
89
|
+
} | {
|
|
90
|
+
success: false;
|
|
91
|
+
error: string;
|
|
92
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Core Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for the LLM Agent system.
|
|
5
|
+
* These types extend @ax-cli/schemas with concrete implementations
|
|
6
|
+
* for OpenAI SDK compatibility.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/agent/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agent/execution/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* Handles execution of tool calls from the LLM.
|
|
5
|
+
* Extracted from llm-agent.ts for better separation of concerns.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import type { LLMToolCall } from "../../llm/client.js";
|
|
10
|
+
import type { ToolResult } from "../../types/index.js";
|
|
11
|
+
import { TextEditorTool, BashTool, TodoTool } from "../../tools/index.js";
|
|
12
|
+
import type { ToolParseResult } from "../core/types.js";
|
|
13
|
+
/**
|
|
14
|
+
* Tool executor configuration
|
|
15
|
+
*/
|
|
16
|
+
export interface ToolExecutorConfig {
|
|
17
|
+
/** Callback for checkpoint creation on file edits */
|
|
18
|
+
checkpointCallback?: (files: Array<{
|
|
19
|
+
path: string;
|
|
20
|
+
content: string;
|
|
21
|
+
}>, description: string) => Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Tool Executor
|
|
25
|
+
*
|
|
26
|
+
* Manages tool instances and executes tool calls from the LLM.
|
|
27
|
+
* Supports built-in tools and MCP (Model Context Protocol) tools.
|
|
28
|
+
*/
|
|
29
|
+
export declare class ToolExecutor {
|
|
30
|
+
private textEditor;
|
|
31
|
+
private bash;
|
|
32
|
+
private bashOutput;
|
|
33
|
+
private todoTool;
|
|
34
|
+
private search;
|
|
35
|
+
private _architectureTool?;
|
|
36
|
+
private _validationTool?;
|
|
37
|
+
constructor(config?: ToolExecutorConfig);
|
|
38
|
+
/**
|
|
39
|
+
* Lazy-loaded getter for ArchitectureTool
|
|
40
|
+
* Only instantiates when first accessed to reduce startup time
|
|
41
|
+
*/
|
|
42
|
+
private get architectureTool();
|
|
43
|
+
/**
|
|
44
|
+
* Lazy-loaded getter for ValidationTool
|
|
45
|
+
* Only instantiates when first accessed to reduce startup time
|
|
46
|
+
*/
|
|
47
|
+
private get validationTool();
|
|
48
|
+
/**
|
|
49
|
+
* Parse and validate tool call arguments
|
|
50
|
+
* @param toolCall The tool call to parse arguments from
|
|
51
|
+
* @param toolType Type of tool (for error messages)
|
|
52
|
+
* @returns Parsed arguments or error result
|
|
53
|
+
*/
|
|
54
|
+
parseToolArguments(toolCall: LLMToolCall, toolType?: string): ToolParseResult;
|
|
55
|
+
/**
|
|
56
|
+
* Execute a tool call
|
|
57
|
+
*/
|
|
58
|
+
execute(toolCall: LLMToolCall): Promise<ToolResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Execute an MCP tool
|
|
61
|
+
*/
|
|
62
|
+
private executeMCPTool;
|
|
63
|
+
/**
|
|
64
|
+
* Get the bash tool instance (for direct access)
|
|
65
|
+
*/
|
|
66
|
+
getBashTool(): BashTool;
|
|
67
|
+
/**
|
|
68
|
+
* Get the todo tool instance (for planning integration)
|
|
69
|
+
*/
|
|
70
|
+
getTodoTool(): TodoTool;
|
|
71
|
+
/**
|
|
72
|
+
* Get the text editor tool instance
|
|
73
|
+
*/
|
|
74
|
+
getTextEditorTool(): TextEditorTool;
|
|
75
|
+
/**
|
|
76
|
+
* Dispose of resources
|
|
77
|
+
*/
|
|
78
|
+
dispose(): void;
|
|
79
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Executor
|
|
3
|
+
*
|
|
4
|
+
* Handles execution of tool calls from the LLM.
|
|
5
|
+
* Extracted from llm-agent.ts for better separation of concerns.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
import { getMCPManager } from "../../llm/tools.js";
|
|
10
|
+
import { TextEditorTool, BashTool, TodoTool, SearchTool, } from "../../tools/index.js";
|
|
11
|
+
import { BashOutputTool } from "../../tools/bash-output.js";
|
|
12
|
+
import { ArchitectureTool } from "../../tools/analysis-tools/architecture-tool.js";
|
|
13
|
+
import { ValidationTool } from "../../tools/analysis-tools/validation-tool.js";
|
|
14
|
+
import { extractErrorMessage } from "../../utils/error-handler.js";
|
|
15
|
+
/**
|
|
16
|
+
* Tool Executor
|
|
17
|
+
*
|
|
18
|
+
* Manages tool instances and executes tool calls from the LLM.
|
|
19
|
+
* Supports built-in tools and MCP (Model Context Protocol) tools.
|
|
20
|
+
*/
|
|
21
|
+
export class ToolExecutor {
|
|
22
|
+
textEditor;
|
|
23
|
+
bash;
|
|
24
|
+
bashOutput;
|
|
25
|
+
todoTool;
|
|
26
|
+
search;
|
|
27
|
+
// Lazy-loaded tools (rarely used)
|
|
28
|
+
_architectureTool;
|
|
29
|
+
_validationTool;
|
|
30
|
+
constructor(config) {
|
|
31
|
+
this.textEditor = new TextEditorTool();
|
|
32
|
+
this.bash = new BashTool();
|
|
33
|
+
this.bashOutput = new BashOutputTool();
|
|
34
|
+
this.todoTool = new TodoTool();
|
|
35
|
+
this.search = new SearchTool();
|
|
36
|
+
// Set checkpoint callback if provided
|
|
37
|
+
if (config?.checkpointCallback) {
|
|
38
|
+
this.textEditor.setCheckpointCallback(config.checkpointCallback);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Lazy-loaded getter for ArchitectureTool
|
|
43
|
+
* Only instantiates when first accessed to reduce startup time
|
|
44
|
+
*/
|
|
45
|
+
get architectureTool() {
|
|
46
|
+
if (!this._architectureTool) {
|
|
47
|
+
this._architectureTool = new ArchitectureTool();
|
|
48
|
+
}
|
|
49
|
+
return this._architectureTool;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Lazy-loaded getter for ValidationTool
|
|
53
|
+
* Only instantiates when first accessed to reduce startup time
|
|
54
|
+
*/
|
|
55
|
+
get validationTool() {
|
|
56
|
+
if (!this._validationTool) {
|
|
57
|
+
this._validationTool = new ValidationTool();
|
|
58
|
+
}
|
|
59
|
+
return this._validationTool;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Parse and validate tool call arguments
|
|
63
|
+
* @param toolCall The tool call to parse arguments from
|
|
64
|
+
* @param toolType Type of tool (for error messages)
|
|
65
|
+
* @returns Parsed arguments or error result
|
|
66
|
+
*/
|
|
67
|
+
parseToolArguments(toolCall, toolType = 'Tool') {
|
|
68
|
+
const argsString = toolCall.function.arguments;
|
|
69
|
+
if (!argsString || typeof argsString !== 'string' || argsString.trim() === '') {
|
|
70
|
+
return {
|
|
71
|
+
success: false,
|
|
72
|
+
error: `${toolType} ${toolCall.function.name} called with empty arguments`,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
const args = JSON.parse(argsString);
|
|
77
|
+
// Validate that args is an object (not null, array, or primitive)
|
|
78
|
+
if (typeof args !== 'object' || args === null || Array.isArray(args)) {
|
|
79
|
+
return {
|
|
80
|
+
success: false,
|
|
81
|
+
error: `${toolType} ${toolCall.function.name} arguments must be a JSON object, got ${Array.isArray(args) ? 'array' : typeof args}`,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return { success: true, args };
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
return {
|
|
88
|
+
success: false,
|
|
89
|
+
error: `Failed to parse ${toolType} arguments: ${error instanceof Error ? error.message : 'Invalid JSON'}`,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Execute a tool call
|
|
95
|
+
*/
|
|
96
|
+
async execute(toolCall) {
|
|
97
|
+
try {
|
|
98
|
+
const parseResult = this.parseToolArguments(toolCall, 'Tool');
|
|
99
|
+
if (!parseResult.success) {
|
|
100
|
+
return { success: false, error: parseResult.error };
|
|
101
|
+
}
|
|
102
|
+
const args = parseResult.args;
|
|
103
|
+
// Helper to safely get string argument with validation
|
|
104
|
+
const getString = (key, required = true) => {
|
|
105
|
+
const value = args[key];
|
|
106
|
+
if (typeof value !== 'string') {
|
|
107
|
+
if (required)
|
|
108
|
+
throw new Error(`Tool argument '${key}' must be a string, got ${typeof value}`);
|
|
109
|
+
return '';
|
|
110
|
+
}
|
|
111
|
+
return value;
|
|
112
|
+
};
|
|
113
|
+
// Helper to safely get number argument
|
|
114
|
+
const getNumber = (key) => {
|
|
115
|
+
const value = args[key];
|
|
116
|
+
if (value === undefined || value === null)
|
|
117
|
+
return undefined;
|
|
118
|
+
if (typeof value !== 'number')
|
|
119
|
+
return undefined;
|
|
120
|
+
return value;
|
|
121
|
+
};
|
|
122
|
+
// Helper to safely get boolean argument
|
|
123
|
+
const getBoolean = (key) => {
|
|
124
|
+
const value = args[key];
|
|
125
|
+
if (value === undefined || value === null)
|
|
126
|
+
return undefined;
|
|
127
|
+
if (typeof value !== 'boolean')
|
|
128
|
+
return undefined;
|
|
129
|
+
return value;
|
|
130
|
+
};
|
|
131
|
+
switch (toolCall.function.name) {
|
|
132
|
+
case "view_file": {
|
|
133
|
+
const startLine = getNumber('start_line');
|
|
134
|
+
const endLine = getNumber('end_line');
|
|
135
|
+
const range = startLine !== undefined && endLine !== undefined
|
|
136
|
+
? [startLine, endLine]
|
|
137
|
+
: undefined;
|
|
138
|
+
return await this.textEditor.view(getString('path'), range);
|
|
139
|
+
}
|
|
140
|
+
case "create_file":
|
|
141
|
+
return await this.textEditor.create(getString('path'), getString('content'));
|
|
142
|
+
case "str_replace_editor":
|
|
143
|
+
return await this.textEditor.strReplace(getString('path'), getString('old_str'), getString('new_str'), getBoolean('replace_all') ?? false);
|
|
144
|
+
case "multi_edit":
|
|
145
|
+
return await this.textEditor.multiEdit(getString('path'), Array.isArray(args.edits) ? args.edits : []);
|
|
146
|
+
case "bash":
|
|
147
|
+
return await this.bash.execute(getString('command'), {
|
|
148
|
+
background: getBoolean('background'),
|
|
149
|
+
timeout: getNumber('timeout'),
|
|
150
|
+
});
|
|
151
|
+
case "bash_output":
|
|
152
|
+
return await this.bashOutput.execute(getString('task_id'), getBoolean('wait'), getNumber('timeout'));
|
|
153
|
+
case "create_todo_list":
|
|
154
|
+
return await this.todoTool.createTodoList(Array.isArray(args.todos) ? args.todos : []);
|
|
155
|
+
case "update_todo_list":
|
|
156
|
+
return await this.todoTool.updateTodoList(Array.isArray(args.updates) ? args.updates : []);
|
|
157
|
+
case "search": {
|
|
158
|
+
const searchTypeValue = args.search_type;
|
|
159
|
+
const validSearchType = (searchTypeValue === 'text' || searchTypeValue === 'files' || searchTypeValue === 'both') ? searchTypeValue : undefined;
|
|
160
|
+
return await this.search.search(getString('query'), {
|
|
161
|
+
searchType: validSearchType,
|
|
162
|
+
includePattern: typeof args.include_pattern === 'string' ? args.include_pattern : undefined,
|
|
163
|
+
excludePattern: typeof args.exclude_pattern === 'string' ? args.exclude_pattern : undefined,
|
|
164
|
+
caseSensitive: getBoolean('case_sensitive'),
|
|
165
|
+
wholeWord: getBoolean('whole_word'),
|
|
166
|
+
regex: getBoolean('regex'),
|
|
167
|
+
maxResults: getNumber('max_results'),
|
|
168
|
+
fileTypes: Array.isArray(args.file_types) ? args.file_types : undefined,
|
|
169
|
+
includeHidden: getBoolean('include_hidden'),
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
case "analyze_architecture": {
|
|
173
|
+
const projectPath = typeof args.projectPath === 'string' ? args.projectPath : undefined;
|
|
174
|
+
const depth = typeof args.depth === 'string' ? args.depth : undefined;
|
|
175
|
+
return await this.architectureTool.execute({ projectPath, depth });
|
|
176
|
+
}
|
|
177
|
+
case "validate_best_practices": {
|
|
178
|
+
const path = typeof args.path === 'string' ? args.path : undefined;
|
|
179
|
+
const pattern = typeof args.pattern === 'string' ? args.pattern : undefined;
|
|
180
|
+
const rules = typeof args.rules === 'object' && args.rules !== null ? args.rules : undefined;
|
|
181
|
+
return await this.validationTool.execute({ path, pattern, rules });
|
|
182
|
+
}
|
|
183
|
+
default:
|
|
184
|
+
// Check if this is an MCP tool
|
|
185
|
+
if (toolCall.function.name.startsWith("mcp__")) {
|
|
186
|
+
return await this.executeMCPTool(toolCall);
|
|
187
|
+
}
|
|
188
|
+
return {
|
|
189
|
+
success: false,
|
|
190
|
+
error: `Unknown tool: ${toolCall.function.name}`,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
const errorMsg = extractErrorMessage(error);
|
|
196
|
+
return {
|
|
197
|
+
success: false,
|
|
198
|
+
error: `Tool execution error: ${errorMsg}`,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Execute an MCP tool
|
|
204
|
+
*/
|
|
205
|
+
async executeMCPTool(toolCall) {
|
|
206
|
+
try {
|
|
207
|
+
const parseResult = this.parseToolArguments(toolCall, 'MCP tool');
|
|
208
|
+
if (!parseResult.success) {
|
|
209
|
+
return { success: false, error: parseResult.error };
|
|
210
|
+
}
|
|
211
|
+
const args = parseResult.args;
|
|
212
|
+
const mcpManager = getMCPManager();
|
|
213
|
+
const result = await mcpManager.callTool(toolCall.function.name, args);
|
|
214
|
+
if (result.isError) {
|
|
215
|
+
// Extract error message from MCP result content
|
|
216
|
+
let errorMsg = "MCP tool error";
|
|
217
|
+
if (result.content && Array.isArray(result.content) && result.content.length > 0) {
|
|
218
|
+
const firstContent = result.content[0];
|
|
219
|
+
if (typeof firstContent === 'object' && firstContent !== null && 'text' in firstContent) {
|
|
220
|
+
const textValue = firstContent.text;
|
|
221
|
+
errorMsg = typeof textValue === 'string' ? textValue : String(textValue || errorMsg);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
success: false,
|
|
226
|
+
error: errorMsg,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
// Extract content from result
|
|
230
|
+
const output = result.content && Array.isArray(result.content)
|
|
231
|
+
? result.content
|
|
232
|
+
.map((item) => {
|
|
233
|
+
if (item.type === "text") {
|
|
234
|
+
return item.text || "";
|
|
235
|
+
}
|
|
236
|
+
else if (item.type === "resource") {
|
|
237
|
+
return `Resource: ${item.resource?.uri || "Unknown"}`;
|
|
238
|
+
}
|
|
239
|
+
return String(item);
|
|
240
|
+
})
|
|
241
|
+
.join("\n")
|
|
242
|
+
: "";
|
|
243
|
+
return {
|
|
244
|
+
success: true,
|
|
245
|
+
output: output || "Success",
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
catch (error) {
|
|
249
|
+
const errorMsg = extractErrorMessage(error);
|
|
250
|
+
return {
|
|
251
|
+
success: false,
|
|
252
|
+
error: `MCP tool execution error: ${errorMsg}`,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Get the bash tool instance (for direct access)
|
|
258
|
+
*/
|
|
259
|
+
getBashTool() {
|
|
260
|
+
return this.bash;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Get the todo tool instance (for planning integration)
|
|
264
|
+
*/
|
|
265
|
+
getTodoTool() {
|
|
266
|
+
return this.todoTool;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Get the text editor tool instance
|
|
270
|
+
*/
|
|
271
|
+
getTextEditorTool() {
|
|
272
|
+
return this.textEditor;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Dispose of resources
|
|
276
|
+
*/
|
|
277
|
+
dispose() {
|
|
278
|
+
this.bash.dispose();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
//# sourceMappingURL=tool-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-executor.js","sourceRoot":"","sources":["../../../src/agent/execution/tool-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,UAAU,GACX,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAWnE;;;;;GAKG;AACH,MAAM,OAAO,YAAY;IACf,UAAU,CAAiB;IAC3B,IAAI,CAAW;IACf,UAAU,CAAiB;IAC3B,QAAQ,CAAW;IACnB,MAAM,CAAa;IAE3B,kCAAkC;IAC1B,iBAAiB,CAAoB;IACrC,eAAe,CAAkB;IAEzC,YAAY,MAA2B;QACrC,IAAI,CAAC,UAAU,GAAG,IAAI,cAAc,EAAE,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,IAAI,cAAc,EAAE,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAE/B,sCAAsC;QACtC,IAAI,MAAM,EAAE,kBAAkB,EAAE,CAAC;YAC/B,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED;;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