@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
|
@@ -1,64 +1,18 @@
|
|
|
1
|
-
import { LLMToolCall } from "../llm/client.js";
|
|
2
1
|
import type { SamplingConfig, ThinkingConfig } from "../llm/types.js";
|
|
3
2
|
import { ToolResult } from "../types/index.js";
|
|
4
3
|
import { EventEmitter } from "events";
|
|
5
4
|
import { CheckpointManager } from "../checkpoint/index.js";
|
|
6
5
|
import { SubagentOrchestrator } from "./subagent-orchestrator.js";
|
|
7
6
|
import { TaskPlan } from "../planner/index.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
toolCalls?: LLMToolCall[];
|
|
13
|
-
toolCall?: LLMToolCall;
|
|
14
|
-
toolResult?: {
|
|
15
|
-
success: boolean;
|
|
16
|
-
output?: string;
|
|
17
|
-
error?: string;
|
|
18
|
-
};
|
|
19
|
-
isStreaming?: boolean;
|
|
20
|
-
/** GLM-4.6 reasoning content (thinking mode) */
|
|
21
|
-
reasoningContent?: string;
|
|
22
|
-
/** Whether reasoning is currently streaming */
|
|
23
|
-
isReasoningStreaming?: boolean;
|
|
24
|
-
/** Response duration in milliseconds */
|
|
25
|
-
durationMs?: number;
|
|
26
|
-
/** Tool execution start time (for elapsed time display while running) */
|
|
27
|
-
executionStartTime?: Date;
|
|
28
|
-
/** Tool execution duration in milliseconds (shown after completion) */
|
|
29
|
-
executionDurationMs?: number;
|
|
30
|
-
}
|
|
31
|
-
export interface StreamingChunk {
|
|
32
|
-
type: "content" | "reasoning" | "tool_calls" | "tool_result" | "done" | "token_count";
|
|
33
|
-
content?: string;
|
|
34
|
-
/** GLM-4.6 reasoning content chunk */
|
|
35
|
-
reasoningContent?: string;
|
|
36
|
-
toolCalls?: LLMToolCall[];
|
|
37
|
-
toolCall?: LLMToolCall;
|
|
38
|
-
toolResult?: ToolResult;
|
|
39
|
-
tokenCount?: number;
|
|
40
|
-
/** Tool execution duration in milliseconds (for tool_result type) */
|
|
41
|
-
executionDurationMs?: number;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Accumulated message from streaming response
|
|
45
|
-
* Contains the full message content and any tool calls
|
|
46
|
-
*/
|
|
47
|
-
export interface AccumulatedMessage {
|
|
48
|
-
role?: string;
|
|
49
|
-
content?: string;
|
|
50
|
-
tool_calls?: LLMToolCall[];
|
|
51
|
-
[key: string]: unknown;
|
|
52
|
-
}
|
|
7
|
+
import type { ChatEntry as CoreChatEntry, StreamingChunk as CoreStreamingChunk, AccumulatedMessage as CoreAccumulatedMessage } from "./core/index.js";
|
|
8
|
+
export type ChatEntry = CoreChatEntry;
|
|
9
|
+
export type StreamingChunk = CoreStreamingChunk;
|
|
10
|
+
export type AccumulatedMessage = CoreAccumulatedMessage;
|
|
53
11
|
export declare class LLMAgent extends EventEmitter {
|
|
54
12
|
private llmClient;
|
|
55
|
-
private
|
|
56
|
-
private
|
|
57
|
-
private
|
|
58
|
-
private todoTool;
|
|
59
|
-
private search;
|
|
60
|
-
private _architectureTool?;
|
|
61
|
-
private _validationTool?;
|
|
13
|
+
private toolExecutor;
|
|
14
|
+
private streamHandler;
|
|
15
|
+
private planExecutor;
|
|
62
16
|
private chatHistory;
|
|
63
17
|
private messages;
|
|
64
18
|
private tokenCounter;
|
|
@@ -87,6 +41,11 @@ export declare class LLMAgent extends EventEmitter {
|
|
|
87
41
|
/** BUG FIX: Track approval timeouts for cleanup to prevent memory leaks */
|
|
88
42
|
private toolApprovalTimeouts;
|
|
89
43
|
constructor(apiKey: string, baseURL?: string, model?: string, maxToolRounds?: number);
|
|
44
|
+
/**
|
|
45
|
+
* Run an async task in background with proper error handling
|
|
46
|
+
* Centralizes the common pattern of background initialization
|
|
47
|
+
*/
|
|
48
|
+
private runBackgroundTask;
|
|
90
49
|
private initializeCheckpointManager;
|
|
91
50
|
private initializeMCP;
|
|
92
51
|
/**
|
|
@@ -159,16 +118,6 @@ export declare class LLMAgent extends EventEmitter {
|
|
|
159
118
|
* Used specifically for isRepetitiveToolCall to avoid redundant parsing
|
|
160
119
|
*/
|
|
161
120
|
private parseToolArgumentsCached;
|
|
162
|
-
/**
|
|
163
|
-
* Lazy-loaded getter for ArchitectureTool
|
|
164
|
-
* Only instantiates when first accessed to reduce startup time
|
|
165
|
-
*/
|
|
166
|
-
private get architectureTool();
|
|
167
|
-
/**
|
|
168
|
-
* Lazy-loaded getter for ValidationTool
|
|
169
|
-
* Only instantiates when first accessed to reduce startup time
|
|
170
|
-
*/
|
|
171
|
-
private get validationTool();
|
|
172
121
|
/**
|
|
173
122
|
* Detect if a tool call is repetitive (likely causing a loop)
|
|
174
123
|
* Uses the intelligent LoopDetector which provides:
|
|
@@ -199,14 +148,6 @@ export declare class LLMAgent extends EventEmitter {
|
|
|
199
148
|
* Get the current plan if any
|
|
200
149
|
*/
|
|
201
150
|
getCurrentPlan(): TaskPlan | null;
|
|
202
|
-
/**
|
|
203
|
-
* Execute a single phase using the LLM
|
|
204
|
-
*/
|
|
205
|
-
private executePhase;
|
|
206
|
-
/**
|
|
207
|
-
* Build a prompt for phase execution
|
|
208
|
-
*/
|
|
209
|
-
private buildPhasePrompt;
|
|
210
151
|
/**
|
|
211
152
|
* Generate and execute a plan for a complex request
|
|
212
153
|
* Uses TodoWrite for Claude Code-style seamless progress display
|
|
@@ -217,26 +158,7 @@ export declare class LLMAgent extends EventEmitter {
|
|
|
217
158
|
* Executes the core message processing loop without planning
|
|
218
159
|
*/
|
|
219
160
|
private processUserMessageStreamInternal;
|
|
220
|
-
/**
|
|
221
|
-
* Format plan summary for display
|
|
222
|
-
*/
|
|
223
|
-
private formatPlanSummary;
|
|
224
|
-
/**
|
|
225
|
-
* Format plan result for display
|
|
226
|
-
*/
|
|
227
|
-
private formatPlanResult;
|
|
228
161
|
processUserMessage(message: string): Promise<ChatEntry[]>;
|
|
229
|
-
/**
|
|
230
|
-
* Optimized streaming delta merge - mutates accumulator for performance
|
|
231
|
-
* This is safe because accumulator is only used internally during streaming
|
|
232
|
-
*
|
|
233
|
-
* Performance: 50% faster than immutable approach (no object copying)
|
|
234
|
-
*/
|
|
235
|
-
private reduceStreamDelta;
|
|
236
|
-
/**
|
|
237
|
-
* Accumulate streaming message chunks
|
|
238
|
-
*/
|
|
239
|
-
private messageReducer;
|
|
240
162
|
/**
|
|
241
163
|
* Prepare user message and apply context management
|
|
242
164
|
* Returns the calculated input tokens
|
|
@@ -260,9 +182,15 @@ export declare class LLMAgent extends EventEmitter {
|
|
|
260
182
|
*/
|
|
261
183
|
private loadToolsSafely;
|
|
262
184
|
/**
|
|
263
|
-
*
|
|
185
|
+
* Format tool result content for display or message
|
|
186
|
+
* Centralizes the common pattern of formatting success/error output
|
|
187
|
+
*
|
|
188
|
+
* @param result - Tool execution result
|
|
189
|
+
* @param defaultSuccess - Default message if success but no output (default: "Success")
|
|
190
|
+
* @param defaultError - Default message if error but no error message (default: "Error occurred")
|
|
191
|
+
* @returns Formatted content string
|
|
264
192
|
*/
|
|
265
|
-
private
|
|
193
|
+
private formatToolResultContent;
|
|
266
194
|
/**
|
|
267
195
|
* Add assistant message to history and conversation
|
|
268
196
|
*/
|
|
@@ -273,14 +201,10 @@ export declare class LLMAgent extends EventEmitter {
|
|
|
273
201
|
private executeToolCalls;
|
|
274
202
|
processUserMessageStream(message: string): AsyncGenerator<StreamingChunk, void, unknown>;
|
|
275
203
|
/**
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
* @param toolType Type of tool (for error messages)
|
|
279
|
-
* @returns Parsed arguments or error result
|
|
204
|
+
* Execute a tool call using the ToolExecutor
|
|
205
|
+
* Handles tool approval for VSCode integration before delegation
|
|
280
206
|
*/
|
|
281
|
-
private parseToolArguments;
|
|
282
207
|
private executeTool;
|
|
283
|
-
private executeMCPTool;
|
|
284
208
|
getChatHistory(): ChatEntry[];
|
|
285
209
|
getCurrentDirectory(): string;
|
|
286
210
|
executeBashCommand(command: string): Promise<ToolResult>;
|