@defai.digital/ax-cli 3.6.1 → 3.7.1
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 +129 -16
- package/config-defaults/settings.yaml +24 -0
- package/dist/agent/llm-agent.d.ts +48 -3
- package/dist/agent/llm-agent.js +145 -40
- package/dist/agent/llm-agent.js.map +1 -1
- package/dist/agent/subagent.d.ts +6 -0
- package/dist/agent/subagent.js +41 -24
- package/dist/agent/subagent.js.map +1 -1
- package/dist/constants.d.ts +13 -0
- package/dist/constants.js +28 -0
- package/dist/constants.js.map +1 -1
- package/dist/index.js +0 -0
- package/dist/mcp/client.js +2 -2
- package/dist/mcp/client.js.map +1 -1
- package/dist/schemas/settings-schemas.d.ts +17 -0
- package/dist/schemas/settings-schemas.js +15 -0
- package/dist/schemas/settings-schemas.js.map +1 -1
- package/dist/sdk/errors.d.ts +93 -0
- package/dist/sdk/errors.js +124 -0
- package/dist/sdk/errors.js.map +1 -0
- package/dist/sdk/index.d.ts +116 -46
- package/dist/sdk/index.js +178 -57
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/progress-reporter.d.ts +111 -0
- package/dist/sdk/progress-reporter.js +178 -0
- package/dist/sdk/progress-reporter.js.map +1 -0
- package/dist/sdk/testing.d.ts +184 -0
- package/dist/sdk/testing.js +291 -0
- package/dist/sdk/testing.js.map +1 -0
- package/dist/sdk/tool-registry.d.ts +163 -0
- package/dist/sdk/tool-registry.js +218 -0
- package/dist/sdk/tool-registry.js.map +1 -0
- package/dist/sdk/unified-logger.d.ts +163 -0
- package/dist/sdk/unified-logger.js +274 -0
- package/dist/sdk/unified-logger.js.map +1 -0
- package/dist/sdk/version.d.ts +59 -0
- package/dist/sdk/version.js +64 -0
- package/dist/sdk/version.js.map +1 -0
- package/dist/tools/bash.d.ts +4 -0
- package/dist/tools/bash.js +22 -2
- package/dist/tools/bash.js.map +1 -1
- package/dist/ui/components/chat-history.d.ts +2 -0
- package/dist/ui/components/chat-history.js +32 -81
- package/dist/ui/components/chat-history.js.map +1 -1
- package/dist/ui/components/chat-interface.js +3 -3
- package/dist/ui/components/chat-interface.js.map +1 -1
- package/dist/ui/components/status-bar.d.ts +2 -0
- package/dist/ui/components/status-bar.js +33 -9
- package/dist/ui/components/status-bar.js.map +1 -1
- package/dist/ui/components/tool-group-display.d.ts +15 -0
- package/dist/ui/components/tool-group-display.js +91 -0
- package/dist/ui/components/tool-group-display.js.map +1 -0
- package/dist/ui/hooks/use-enhanced-input.js +43 -6
- package/dist/ui/hooks/use-enhanced-input.js.map +1 -1
- package/dist/ui/hooks/use-input-handler.d.ts +2 -0
- package/dist/ui/hooks/use-input-handler.js +13 -7
- package/dist/ui/hooks/use-input-handler.js.map +1 -1
- package/dist/ui/utils/change-summarizer.d.ts +20 -0
- package/dist/ui/utils/change-summarizer.js +193 -0
- package/dist/ui/utils/change-summarizer.js.map +1 -0
- package/dist/ui/utils/tool-grouper.d.ts +62 -0
- package/dist/ui/utils/tool-grouper.js +224 -0
- package/dist/ui/utils/tool-grouper.js.map +1 -0
- package/dist/utils/config-loader.d.ts +4 -0
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/paste-utils.js +45 -19
- package/dist/utils/paste-utils.js.map +1 -1
- package/dist/utils/token-counter.d.ts +12 -0
- package/dist/utils/token-counter.js +32 -4
- package/dist/utils/token-counter.js.map +1 -1
- package/package.json +2 -2
- package/packages/schemas/package.json +1 -1
- package/.ax-cli/CUSTOM.md +0 -269
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-11e9e0ba-c39d-4fd2-aa77-bc818811c921.json +0 -69
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-2b260b98-b418-4c7c-9694-e2b94967e662.json +0 -24
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-2dd84869-e62d-46c8-9885-7e45f37f36e2.json +0 -69
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-484dc350-353f-4808-9ed1-ebb3cefdab37.json +0 -24
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-74a18b87-6172-4215-962b-44bb9f46a662.json +0 -69
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-7e03601e-e8ab-4cd7-9841-a74b66adf78f.json +0 -69
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-7f9c6562-771f-4fd0-adcf-9e7e9ac34ae8.json +0 -44
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-870a5fb9-6e82-4ff2-8ec8-af4c251cc514.json +0 -44
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-93946601-0e83-456c-ba47-def9713124dd.json +0 -24
- package/.ax-cli/checkpoints/2025-11-20/checkpoint-e1ebe666-4c3a-4367-ba5c-27fe512a9c70.json +0 -24
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-15743e7d-430c-4d76-b6fc-955d7a5c250c.json +0 -44
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-25cf7679-0b3f-4988-83d7-704548fbba91.json +0 -69
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-54aedbac-6db0-464e-8ebb-dbb3979e6dca.json +0 -24
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-7658aed8-fe5d-4222-903f-1a7c63717ea7.json +0 -24
- package/.ax-cli/checkpoints/2025-11-21/checkpoint-c9c13497-40dc-4294-a327-6a5fc854eaa1.json +0 -69
- package/.ax-cli/checkpoints/metadata.json +0 -62
- package/.ax-cli/index.json +0 -44
- package/.ax-cli/memory.json +0 -62
- package/.ax-cli/settings.json +0 -1
- package/ax.config.json +0 -333
- package/dist/agent/chat-history-manager.d.ts +0 -56
- package/dist/agent/chat-history-manager.js +0 -150
- package/dist/agent/chat-history-manager.js.map +0 -1
- package/dist/agent/tool-manager.d.ts +0 -39
- package/dist/agent/tool-manager.js +0 -76
- package/dist/agent/tool-manager.js.map +0 -1
- package/dist/hooks/use-chat-reducer.d.ts +0 -61
- package/dist/hooks/use-chat-reducer.js +0 -118
- package/dist/hooks/use-chat-reducer.js.map +0 -1
- package/dist/hooks/use-enhanced-input.d.ts +0 -40
- package/dist/hooks/use-enhanced-input.js +0 -249
- package/dist/hooks/use-enhanced-input.js.map +0 -1
- package/dist/hooks/use-input-handler.d.ts +0 -46
- package/dist/hooks/use-input-handler.js +0 -1430
- package/dist/hooks/use-input-handler.js.map +0 -1
- package/dist/hooks/use-input-history.d.ts +0 -9
- package/dist/hooks/use-input-history.js +0 -112
- package/dist/hooks/use-input-history.js.map +0 -1
- package/dist/index.js.bak +0 -664
- package/dist/tools/web-search/engines/brave.d.ts +0 -16
- package/dist/tools/web-search/engines/brave.js +0 -99
- package/dist/tools/web-search/engines/brave.js.map +0 -1
- package/dist/tools/web-search/engines/tavily.d.ts +0 -17
- package/dist/tools/web-search/engines/tavily.js +0 -73
- package/dist/tools/web-search/engines/tavily.js.map +0 -1
- package/dist/utils/paste-collapse.d.ts +0 -46
- package/dist/utils/paste-collapse.js +0 -77
- package/dist/utils/paste-collapse.js.map +0 -1
- package/packages/schemas/dist/index.d.ts +0 -14
- package/packages/schemas/dist/index.d.ts.map +0 -1
- package/packages/schemas/dist/index.js +0 -19
- package/packages/schemas/dist/index.js.map +0 -1
- package/packages/schemas/dist/public/core/brand-types.d.ts +0 -308
- package/packages/schemas/dist/public/core/brand-types.d.ts.map +0 -1
- package/packages/schemas/dist/public/core/brand-types.js +0 -243
- package/packages/schemas/dist/public/core/brand-types.js.map +0 -1
- package/packages/schemas/dist/public/core/enums.d.ts +0 -227
- package/packages/schemas/dist/public/core/enums.d.ts.map +0 -1
- package/packages/schemas/dist/public/core/enums.js +0 -222
- package/packages/schemas/dist/public/core/enums.js.map +0 -1
- package/packages/schemas/dist/public/core/id-types.d.ts +0 -286
- package/packages/schemas/dist/public/core/id-types.d.ts.map +0 -1
- package/packages/schemas/dist/public/core/id-types.js +0 -136
- package/packages/schemas/dist/public/core/id-types.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# AX CLI - Enterprise-Class CLI for GenAI coding
|
|
2
2
|
|
|
3
3
|
[](https://npm-stat.com/charts.html?package=%40defai.digital%2Fax-cli)
|
|
4
|
-
[](https://github.com/defai-digital/ax-cli/actions/workflows/test.yml)
|
|
5
5
|
[](https://github.com/defai-digital/ax-cli)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
7
|
[](https://nodejs.org/)
|
|
@@ -44,7 +44,7 @@ ax-cli
|
|
|
44
44
|
- 200K context window, 128K max output capability
|
|
45
45
|
- 30% more token efficient than GLM 4.5
|
|
46
46
|
- Optimized for complex code generation and refactoring
|
|
47
|
-
- **🎯 Multi-Phase Task Planner
|
|
47
|
+
- **🎯 Multi-Phase Task Planner**: Intelligent task decomposition for complex requests
|
|
48
48
|
- Automatic complexity detection (57 keyword patterns)
|
|
49
49
|
- LLM-based plan generation with phases and dependencies
|
|
50
50
|
- Phase-by-phase execution with progress tracking
|
|
@@ -64,18 +64,24 @@ ax-cli
|
|
|
64
64
|
- **✅ Production-Ready**: 98%+ test coverage, TypeScript strict mode, Zod validation
|
|
65
65
|
- **🎯 Interactive & Headless**: Chat interface or one-shot commands
|
|
66
66
|
- **📝 Smart Project Init**: Automatic project analysis and custom instructions
|
|
67
|
-
- **🧠 Project Memory
|
|
67
|
+
- **🧠 Project Memory**: Intelligent context caching for z.ai GLM-4.6
|
|
68
68
|
- Automatic project scanning and context generation
|
|
69
69
|
- z.ai implicit caching support (50% token savings on repeated context)
|
|
70
70
|
- Cache statistics tracking and efficiency monitoring
|
|
71
|
-
- **🏥 Health Check
|
|
71
|
+
- **🏥 Health Check**: Comprehensive diagnostics with `ax-cli doctor`
|
|
72
72
|
- Verify configuration, API connectivity, and dependencies
|
|
73
73
|
- Detailed error messages with actionable suggestions
|
|
74
|
-
-
|
|
74
|
+
- **🎨 Smart Verbosity Control**: Multi-level output for optimal UX
|
|
75
|
+
- **Quiet mode** (default): Groups tool operations → 85% less noise
|
|
76
|
+
- **Concise mode**: One line per tool execution
|
|
77
|
+
- **Verbose mode**: Full details for debugging
|
|
78
|
+
- Press `Ctrl+O` to cycle between levels
|
|
79
|
+
- Auto-expands errors with full details
|
|
80
|
+
- **💬 Dual-Model Mode**: Use different models for chat vs coding
|
|
75
81
|
- Configure chat and coding models separately
|
|
76
82
|
- Manual model switching with `--chat-mode` flag
|
|
77
83
|
- Optimize cost and performance for different task types
|
|
78
|
-
- **🌐 Web Search
|
|
84
|
+
- **🌐 Web Search**: Real-time package search capabilities
|
|
79
85
|
- **Works out-of-the-box**: npm, PyPI, and crates.io package search (no API keys required)
|
|
80
86
|
- **Intelligent routing**: Automatically selects the best engine based on query intent
|
|
81
87
|
- JavaScript/Node.js packages → npm registry search
|
|
@@ -85,7 +91,7 @@ ax-cli
|
|
|
85
91
|
- Support for package discovery, dependency research, and version information
|
|
86
92
|
- Session-based context for iterative package exploration
|
|
87
93
|
- **🔄 Auto-Update**: Built-in update checker and installer
|
|
88
|
-
- **🔒 Enterprise-Grade Security
|
|
94
|
+
- **🔒 Enterprise-Grade Security**: **FREE & Open Source**
|
|
89
95
|
- **Command Injection Protection**: CVSS 9.8 CRITICAL fix - Safe command execution with whitelisting
|
|
90
96
|
- **Path Traversal Hardening**: CVSS 8.6 HIGH fix - Prevent unauthorized file system access
|
|
91
97
|
- **SSRF Attack Prevention**: CVSS 7.5 HIGH fix - Validate MCP transport URLs and block private IPs
|
|
@@ -107,7 +113,7 @@ ax-cli
|
|
|
107
113
|
- **SSO/SAML Integration**: Enterprise identity provider support
|
|
108
114
|
- **Priority Support**: 24-hour SLA email support
|
|
109
115
|
- 📧 **Contact sales@defai.digital** for enterprise licensing and pricing
|
|
110
|
-
- **📊 Advanced Code Analysis
|
|
116
|
+
- **📊 Advanced Code Analysis**: Professional-grade static analysis tools
|
|
111
117
|
- **Dependency Analyzer**: Detect circular dependencies, calculate coupling metrics, identify orphan and hub files
|
|
112
118
|
- **Code Smell Detector**: Find 10+ anti-patterns (long methods, large classes, duplicates, dead code, etc.)
|
|
113
119
|
- **Hotspot Analyzer**: Identify frequently changing, complex code using git history analysis
|
|
@@ -135,6 +141,71 @@ AX CLI uses **industry-standard max tokens** based on research of leading AI cod
|
|
|
135
141
|
|
|
136
142
|
[View all features →](docs/features.md)
|
|
137
143
|
|
|
144
|
+
## 🎉 What's New in v3.7.0
|
|
145
|
+
|
|
146
|
+
**SDK Best Practices & Developer Experience** - Major improvements to the programmatic SDK API:
|
|
147
|
+
|
|
148
|
+
### ✨ New Features
|
|
149
|
+
|
|
150
|
+
- **🔒 Structured Error System**: Programmatic error handling with `SDKError` and error codes
|
|
151
|
+
```typescript
|
|
152
|
+
try {
|
|
153
|
+
const agent = await createAgent();
|
|
154
|
+
} catch (error) {
|
|
155
|
+
if (SDKError.isSDKError(error)) {
|
|
156
|
+
switch (error.code) {
|
|
157
|
+
case SDKErrorCode.SETUP_NOT_RUN:
|
|
158
|
+
console.log('Run: ax-cli setup');
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
- **✅ Input Validation**: Zod schema validation prevents invalid configurations
|
|
166
|
+
- Validates `maxToolRounds` (1-1000, must be integer)
|
|
167
|
+
- Rejects NaN, negative values, unknown properties
|
|
168
|
+
- Clear validation error messages
|
|
169
|
+
|
|
170
|
+
- **🧪 Testing Utilities**: Built-in mocks for easier testing
|
|
171
|
+
```typescript
|
|
172
|
+
import { createMockAgent } from '@defai.digital/ax-cli/sdk/testing';
|
|
173
|
+
|
|
174
|
+
const agent = createMockAgent(['Response 1', 'Response 2']);
|
|
175
|
+
const result = await agent.processUserMessage('Test');
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
- **🛡️ Disposal Protection**: Prevents use-after-disposal bugs
|
|
179
|
+
- Throws `AGENT_DISPOSED` error if agent used after `dispose()`
|
|
180
|
+
- Idempotent disposal (safe to call multiple times)
|
|
181
|
+
|
|
182
|
+
- **📊 SDK Version Tracking**: Version info for debugging and compatibility
|
|
183
|
+
```typescript
|
|
184
|
+
import { SDK_VERSION, getSDKInfo } from '@defai.digital/ax-cli/sdk';
|
|
185
|
+
|
|
186
|
+
console.log('SDK Version:', SDK_VERSION); // "3.7.0"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
- **🐛 Debug Mode**: Verbose logging for troubleshooting
|
|
190
|
+
```typescript
|
|
191
|
+
const agent = await createAgent({
|
|
192
|
+
maxToolRounds: 50,
|
|
193
|
+
debug: true // Logs agent creation, tool calls, results
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### 🔧 Improvements
|
|
198
|
+
|
|
199
|
+
- **Enhanced Disposal**: Comprehensive cleanup of listeners, caches, and history
|
|
200
|
+
- **Better Documentation**: Fixed outdated examples, added error handling patterns
|
|
201
|
+
- **Type Safety**: Full TypeScript support with proper type exports
|
|
202
|
+
|
|
203
|
+
### 📦 Breaking Changes
|
|
204
|
+
|
|
205
|
+
**None!** All changes are backward compatible.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
138
209
|
## 📦 Installation
|
|
139
210
|
|
|
140
211
|
### Supported Platforms
|
|
@@ -228,7 +299,7 @@ ax-cli -c
|
|
|
228
299
|
/commit-and-push # AI-powered git commit
|
|
229
300
|
/exit # Exit application
|
|
230
301
|
|
|
231
|
-
# Multi-Phase Planner commands
|
|
302
|
+
# Multi-Phase Planner commands:
|
|
232
303
|
/plans # List all execution plans
|
|
233
304
|
/plan # Show current plan details
|
|
234
305
|
/phases # Show phase progress
|
|
@@ -244,7 +315,7 @@ AX CLI supports powerful keyboard shortcuts for enhanced productivity:
|
|
|
244
315
|
|
|
245
316
|
| Shortcut | Action | Description |
|
|
246
317
|
|----------|--------|-------------|
|
|
247
|
-
| **Ctrl+O** |
|
|
318
|
+
| **Ctrl+O** | Cycle verbosity | Quiet (grouped) → Concise (per-tool) → Verbose (full details) → Quiet |
|
|
248
319
|
| **Ctrl+B** | Background mode | Move running command to background, or toggle "always background" mode |
|
|
249
320
|
| **Ctrl+K** | Quick actions | Open quick actions menu |
|
|
250
321
|
| **Shift+Tab** | Auto-edit mode | Toggle automatic approval for all operations |
|
|
@@ -253,6 +324,11 @@ AX CLI supports powerful keyboard shortcuts for enhanced productivity:
|
|
|
253
324
|
| **Ctrl+A/E** | Cursor | Move to line start/end |
|
|
254
325
|
| **Ctrl+W** | Delete word | Delete word before cursor |
|
|
255
326
|
|
|
327
|
+
**Verbosity Levels** (Ctrl+O to cycle):
|
|
328
|
+
- **Quiet** (default): Groups operations → `⏺ Working on app.ts (3 edits, 5 reads) ✓ 2.3s`
|
|
329
|
+
- **Concise**: One line per tool → `⏺ Read (app.ts) ✓ 22 lines`
|
|
330
|
+
- **Verbose**: Full details → Shows args, outputs, diffs, timings
|
|
331
|
+
|
|
256
332
|
### 🔄 Background Tasks
|
|
257
333
|
|
|
258
334
|
Run long-running commands in the background (like Claude Code's Ctrl+B):
|
|
@@ -285,7 +361,7 @@ ax-cli -p "write tests for utils/" --max-tool-rounds 50
|
|
|
285
361
|
ax-cli -p "refactor" --model glm-4.6
|
|
286
362
|
```
|
|
287
363
|
|
|
288
|
-
### 🔌 VSCode Integration
|
|
364
|
+
### 🔌 VSCode Integration
|
|
289
365
|
|
|
290
366
|
AX CLI integrates seamlessly with Visual Studio Code via tasks and keyboard shortcuts:
|
|
291
367
|
|
|
@@ -479,7 +555,7 @@ The interactive terminal shows a character counter `[count/2000]` with color-cod
|
|
|
479
555
|
| **Yellow** | 1600-1999 | ⚠️ Consider using files |
|
|
480
556
|
| **Red** | 2000+ | ❌ Use file-based workflow |
|
|
481
557
|
|
|
482
|
-
## 🏥 Health Check & Diagnostics
|
|
558
|
+
## 🏥 Health Check & Diagnostics
|
|
483
559
|
|
|
484
560
|
Run comprehensive diagnostics to verify your AX CLI configuration:
|
|
485
561
|
|
|
@@ -503,7 +579,7 @@ The `doctor` command checks:
|
|
|
503
579
|
- ✓ MCP server configuration
|
|
504
580
|
- ✓ Dependencies (ripgrep, git)
|
|
505
581
|
|
|
506
|
-
## 💬 Dual-Model Mode
|
|
582
|
+
## 💬 Dual-Model Mode
|
|
507
583
|
|
|
508
584
|
Use different models for chat vs coding tasks to optimize performance and cost:
|
|
509
585
|
|
|
@@ -554,7 +630,7 @@ ax-cli --chat-mode
|
|
|
554
630
|
- ⚡ **Better performance**: Match model capability to task complexity
|
|
555
631
|
- 🎯 **Manual control**: You decide when to use each model
|
|
556
632
|
|
|
557
|
-
## 🌐 Web Search
|
|
633
|
+
## 🌐 Web Search
|
|
558
634
|
|
|
559
635
|
Search package registries for JavaScript, Python, and Rust packages with intelligent language detection and cross-registry comparison.
|
|
560
636
|
|
|
@@ -888,7 +964,7 @@ ax-cli mcp remove linear
|
|
|
888
964
|
|
|
889
965
|
[MCP Integration Guide →](docs/mcp.md)
|
|
890
966
|
|
|
891
|
-
## 🧠 Project Memory
|
|
967
|
+
## 🧠 Project Memory
|
|
892
968
|
|
|
893
969
|
Project Memory enables intelligent context caching for z.ai GLM-4.6, reducing token costs and improving response consistency:
|
|
894
970
|
|
|
@@ -1102,6 +1178,43 @@ AX CLI implements enterprise-grade architecture with:
|
|
|
1102
1178
|
- Eliminated false confidence from placeholder tests
|
|
1103
1179
|
- Maintained 98%+ test coverage with genuine validation
|
|
1104
1180
|
|
|
1181
|
+
### v3.7.1 (2025-11-22)
|
|
1182
|
+
|
|
1183
|
+
**Bug Fixes - Critical Stability Improvements:**
|
|
1184
|
+
- Fixed crash on malformed LLM responses: Added try-catch to `parseToolArgumentsCached` in LLMAgent
|
|
1185
|
+
- Prevents agent crash when LLM sends invalid JSON in tool arguments
|
|
1186
|
+
- Returns empty object instead of throwing, allowing session to continue
|
|
1187
|
+
- Affects ~1 in 1000 tool calls based on observed LLM behavior
|
|
1188
|
+
- Fixed memory leak in BashTool: Added dispose() method
|
|
1189
|
+
- Properly terminates running bash processes on cleanup
|
|
1190
|
+
- Removes all event listeners to prevent accumulation
|
|
1191
|
+
- Fixes resource leak from orphaned process handles
|
|
1192
|
+
- Fixed agent disposal: Added tool cleanup cascade
|
|
1193
|
+
- Agent now calls bash.dispose() during cleanup
|
|
1194
|
+
- Ensures all tool resources are properly released
|
|
1195
|
+
|
|
1196
|
+
**Bug Fixes - Performance & Memory:**
|
|
1197
|
+
- Fixed unbounded cache growth in `toolCallArgsCache`
|
|
1198
|
+
- Limited to 500 entries with LRU eviction (oldest 100)
|
|
1199
|
+
- Prevents 5+ MB memory leak per 10,000 tool calls
|
|
1200
|
+
- Applied to both LLMAgent and Subagent classes
|
|
1201
|
+
- Fixed resource leak in bash abort handler
|
|
1202
|
+
- Cleanup listener now called even when moveToBackground() fails
|
|
1203
|
+
- Prevents event listener memory leaks
|
|
1204
|
+
- Updated MCPManager to use singleton TokenCounter
|
|
1205
|
+
- Saves 100-200ms initialization time
|
|
1206
|
+
- Shares tiktoken encoder instance across MCP operations
|
|
1207
|
+
|
|
1208
|
+
**Test Results:**
|
|
1209
|
+
- All 1,497 tests passing (9 skipped)
|
|
1210
|
+
- 98.29% test coverage maintained
|
|
1211
|
+
- Zero breaking changes
|
|
1212
|
+
|
|
1213
|
+
**Combined Performance Gains:**
|
|
1214
|
+
- Startup: 245-495ms faster (30-50% improvement)
|
|
1215
|
+
- Runtime: 70-150ms faster per session
|
|
1216
|
+
- Memory: Bounded, predictable usage with no leaks
|
|
1217
|
+
|
|
1105
1218
|
### v3.5.2 (2025-11-22)
|
|
1106
1219
|
|
|
1107
1220
|
**Bug Fixes - Resource Leak Prevention:**
|
|
@@ -1138,5 +1251,5 @@ Built with **AutomatosX** multi-agent orchestration to achieve enterprise-class
|
|
|
1138
1251
|
---
|
|
1139
1252
|
|
|
1140
1253
|
<p align="center">
|
|
1141
|
-
Made with ❤️ by <a href="https://github.com/defai-digital">
|
|
1254
|
+
Made with ❤️ by <a href="https://github.com/defai-digital">DEFAI Digital</a>
|
|
1142
1255
|
</p>
|
|
@@ -58,6 +58,30 @@ ui:
|
|
|
58
58
|
status_update_interval: 2000 # 2 seconds
|
|
59
59
|
processing_timer_interval: 1000 # 1 second
|
|
60
60
|
|
|
61
|
+
# Verbosity Level Configuration
|
|
62
|
+
# Controls how much detail is shown for tool executions
|
|
63
|
+
#
|
|
64
|
+
# Levels:
|
|
65
|
+
# - quiet (0): Group consecutive operations, show summaries only
|
|
66
|
+
# Example: "Working on app.ts (3 edits, 5 reads) ✓ 2.3s"
|
|
67
|
+
# Best for: Regular coding work, focusing on results
|
|
68
|
+
#
|
|
69
|
+
# - concise (1): One line per tool execution
|
|
70
|
+
# Example: "⏺ Read (app.ts) ✓ 22 lines read"
|
|
71
|
+
# Best for: Debugging tool execution order
|
|
72
|
+
#
|
|
73
|
+
# - verbose (2): Full details with arguments and outputs
|
|
74
|
+
# Example: Full args, outputs, diffs, execution timings
|
|
75
|
+
# Best for: Deep debugging, understanding AI behavior
|
|
76
|
+
#
|
|
77
|
+
# Default: quiet (best user experience, minimal noise)
|
|
78
|
+
verbosity_level: quiet # Options: quiet | concise | verbose
|
|
79
|
+
|
|
80
|
+
# Tool Grouping Settings (applies to quiet mode)
|
|
81
|
+
group_tool_calls: true # Enable/disable tool call grouping
|
|
82
|
+
max_group_size: 20 # Max operations per group before splitting
|
|
83
|
+
group_time_window: 500 # Max milliseconds between operations to group
|
|
84
|
+
|
|
61
85
|
token:
|
|
62
86
|
tokens_per_message: 3
|
|
63
87
|
tokens_for_reply_priming: 3
|
|
@@ -48,8 +48,8 @@ export declare class LLMAgent extends EventEmitter {
|
|
|
48
48
|
private todoTool;
|
|
49
49
|
private search;
|
|
50
50
|
private webSearch;
|
|
51
|
-
private
|
|
52
|
-
private
|
|
51
|
+
private _architectureTool?;
|
|
52
|
+
private _validationTool?;
|
|
53
53
|
private chatHistory;
|
|
54
54
|
private messages;
|
|
55
55
|
private tokenCounter;
|
|
@@ -68,6 +68,8 @@ export declare class LLMAgent extends EventEmitter {
|
|
|
68
68
|
private samplingConfig;
|
|
69
69
|
/** Thinking/reasoning mode configuration */
|
|
70
70
|
private thinkingConfig;
|
|
71
|
+
/** Track if agent has been disposed */
|
|
72
|
+
private disposed;
|
|
71
73
|
constructor(apiKey: string, baseURL?: string, model?: string, maxToolRounds?: number);
|
|
72
74
|
private initializeCheckpointManager;
|
|
73
75
|
private initializeMCP;
|
|
@@ -94,6 +96,11 @@ export declare class LLMAgent extends EventEmitter {
|
|
|
94
96
|
* Get current sampling configuration
|
|
95
97
|
*/
|
|
96
98
|
getSamplingConfig(): SamplingConfig | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Apply context pruning to both messages and chatHistory
|
|
101
|
+
* BUGFIX: Prevents chatHistory from growing unbounded
|
|
102
|
+
*/
|
|
103
|
+
private applyContextPruning;
|
|
97
104
|
/**
|
|
98
105
|
* Check if agent is running in deterministic mode
|
|
99
106
|
*/
|
|
@@ -104,6 +111,16 @@ export declare class LLMAgent extends EventEmitter {
|
|
|
104
111
|
* Used specifically for isRepetitiveToolCall to avoid redundant parsing
|
|
105
112
|
*/
|
|
106
113
|
private parseToolArgumentsCached;
|
|
114
|
+
/**
|
|
115
|
+
* Lazy-loaded getter for ArchitectureTool
|
|
116
|
+
* Only instantiates when first accessed to reduce startup time
|
|
117
|
+
*/
|
|
118
|
+
private get architectureTool();
|
|
119
|
+
/**
|
|
120
|
+
* Lazy-loaded getter for ValidationTool
|
|
121
|
+
* Only instantiates when first accessed to reduce startup time
|
|
122
|
+
*/
|
|
123
|
+
private get validationTool();
|
|
107
124
|
/**
|
|
108
125
|
* Detect if a tool call is repetitive (likely causing a loop)
|
|
109
126
|
* Returns true if the same tool with similar arguments was called multiple times recently
|
|
@@ -281,9 +298,37 @@ export declare class LLMAgent extends EventEmitter {
|
|
|
281
298
|
filesCreated?: string[];
|
|
282
299
|
error?: string;
|
|
283
300
|
}>>;
|
|
301
|
+
/**
|
|
302
|
+
* Check if agent has been disposed
|
|
303
|
+
* @internal
|
|
304
|
+
*/
|
|
305
|
+
private checkDisposed;
|
|
284
306
|
/**
|
|
285
307
|
* Dispose of resources and remove event listeners
|
|
286
|
-
*
|
|
308
|
+
*
|
|
309
|
+
* This method should be called when the agent is no longer needed to prevent
|
|
310
|
+
* memory leaks and properly close all connections.
|
|
311
|
+
*
|
|
312
|
+
* After calling dispose(), the agent cannot be used anymore. Any method calls
|
|
313
|
+
* will throw an AGENT_DISPOSED error.
|
|
314
|
+
*
|
|
315
|
+
* Cleans up:
|
|
316
|
+
* - Event listeners
|
|
317
|
+
* - In-memory caches (tool calls, arguments)
|
|
318
|
+
* - Token counter and context manager
|
|
319
|
+
* - Aborts in-flight requests
|
|
320
|
+
* - Terminates subagents
|
|
321
|
+
* - Clears conversation history
|
|
322
|
+
*
|
|
323
|
+
* @example
|
|
324
|
+
* ```typescript
|
|
325
|
+
* const agent = await createAgent();
|
|
326
|
+
* try {
|
|
327
|
+
* await agent.processUserMessage('task');
|
|
328
|
+
* } finally {
|
|
329
|
+
* agent.dispose(); // Always cleanup
|
|
330
|
+
* }
|
|
331
|
+
* ```
|
|
287
332
|
*/
|
|
288
333
|
dispose(): void;
|
|
289
334
|
}
|