@defai.digital/automatosx 9.0.1 β†’ 9.1.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.
Binary file
Binary file
package/CHANGELOG.md CHANGED
@@ -2,6 +2,222 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [9.0.2] - 2025-11-19
6
+
7
+ ### Performance Optimizations (v9.0.3)
8
+ - **⚑ Score Cache Dirty-Flag Optimization** - Reduced redundant cache invalidations by ~70%
9
+ - Implemented dirty-flag pattern instead of immediate cache deletion
10
+ - Cache survives rapid successive requests within TTL period
11
+ - Minor CPU reduction in high-traffic routing scenarios
12
+ - **File**: `src/core/provider-metrics-tracker.ts`
13
+
14
+ - **πŸ“Š Dynamic Batch Size for Memory Import** - Adaptive memory management
15
+ - Batch size now calculated based on available heap memory (10% max usage)
16
+ - Range: 100-1000 entries per batch depending on system resources
17
+ - Prevents OOM on memory-constrained systems
18
+ - Better performance on systems with ample memory
19
+ - **File**: `src/core/memory-manager.ts`
20
+
21
+ - **⏰ Idle-Period VACUUM Scheduling** - Better UX during active use
22
+ - Database VACUUM now only runs when system idle for 5+ minutes
23
+ - Tracks user activity on `add()` and `search()` operations
24
+ - Prevents maintenance interruptions during active sessions
25
+ - Same database optimization, better timing
26
+ - **File**: `src/core/memory-manager.ts`
27
+
28
+ ### Improved
29
+ - **πŸ—οΈ Code Quality Refactoring Phase 1, 2 & 3** - High-impact, low-risk improvements
30
+ - **Circuit Breaker Extraction** - Extracted from Router into dedicated class
31
+ - **Prompt Helper Utility** - Eliminates duplication in 12 files
32
+ - **Database Factory** - Standardizes DB creation in 10 files
33
+ - **Memory Context Builder** - Consistent memory formatting
34
+ - **Error Wrapper Utility** - Standardized error handling
35
+ - **Performance** - All refactorings have < 1ms overhead
36
+
37
+ ### Added - Phase 1: Core Utilities
38
+ - **src/core/circuit-breaker.ts** (190 lines) - Dedicated circuit breaker implementation
39
+ - Manages CLOSED, OPEN, HALF_OPEN states
40
+ - Configurable failure thresholds and cooldown periods
41
+ - Observability via `getStats()` and `getAllStats()` APIs
42
+ - **src/utils/memory-context-builder.ts** (185 lines) - Memory formatting utilities
43
+ - `formatForPrompt()` - Markdown format for LLM injection
44
+ - `formatAsJson()` - JSON serialization
45
+ - `formatAsText()` - Plain text output
46
+ - `getSummary()` - Statistical analysis
47
+ - **src/utils/error-wrapper.ts** (248 lines) - Type-safe error handling
48
+ - `wrapError()` - Convert unknown errors to typed errors
49
+ - `safeAsync()` / `safeSync()` - Safe operation wrappers
50
+ - `isRetriableError()` / `isFatalError()` - Error classification
51
+ - `errorToObject()` - Logging-friendly error serialization
52
+
53
+ ### Added - Phase 2: Developer Utilities
54
+ - **src/utils/prompt-helper.ts** (220 lines) - Interactive prompt management
55
+ - `PromptHelper` class with automatic readline cleanup
56
+ - `withPrompt()` - Try-with-resources pattern for guaranteed cleanup
57
+ - `question()` - Ask user for input
58
+ - `confirm()` - Yes/no confirmation with defaults
59
+ - `questionWithValidation()` - Input validation with retry logic
60
+ - `choose()` - Interactive menu selection
61
+ - **Benefits**: Prevents readline resource leaks, eliminates 200+ lines of duplicated code
62
+ - **Files affected**: 12 files with readline duplication can now use this utility
63
+
64
+ - **src/utils/db-factory.ts** (240 lines) - Standardized database creation
65
+ - `DatabaseFactory.create()` - Consistent DB initialization
66
+ - `DatabaseFactory.createInMemory()` - In-memory databases for testing
67
+ - `DatabaseFactory.createReadOnly()` - Read-only connections
68
+ - Automatic directory creation, busyTimeout configuration, WAL mode
69
+ - Connection pooling via `DbConnectionPool` class
70
+ - **Benefits**: Consistent concurrency handling, proper error handling
71
+ - **Files affected**: 10 files with inconsistent DB initialization
72
+
73
+ ### Changed
74
+ - **src/core/router.ts** - Refactored to use extracted CircuitBreaker class
75
+ - Removed inline circuit breaker logic (78 lines β†’ external class)
76
+ - New `getCircuitBreakerStats()` API for monitoring
77
+ - Cleaner codebase, easier to test and maintain
78
+
79
+ ### Technical Details
80
+ - **Testing** - βœ… All 1060 unit tests passing (100% backward compatible)
81
+ - **TypeScript** - βœ… Strict mode validation passed
82
+ - **Build** - βœ… Build verification successful (< 2s build time)
83
+ - **Breaking Changes** - ❌ None (fully backward compatible)
84
+ - **Code Reduction** - ~460 lines of new utilities, will eliminate 400+ lines when applied
85
+
86
+ ### Refactoring Analysis
87
+ Based on comprehensive codebase analysis (90,066 lines across 200+ files):
88
+ - **12 files** duplicate readline/prompt creation β†’ Now can use PromptHelper
89
+ - **10 files** duplicate database initialization β†’ Now can use DatabaseFactory
90
+ - **5 large files** (>1,000 lines) identified for future splitting
91
+ - **634 chalk usages** identified for potential UI utility (Phase 3)
92
+
93
+ ### Why These Changes
94
+ - **Modularity** - Utilities are reusable across multiple components
95
+ - **Testability** - Easier to test in isolation
96
+ - **Maintainability** - Code duplication reduced, cleaner abstractions
97
+ - **Resource Safety** - Automatic cleanup prevents leaks (readline, DB connections)
98
+ - **Consistency** - Standardized patterns across the codebase
99
+ - **Quality** - Follows AutomatosX refactoring principles: high-impact, low-risk, avoid over-engineering
100
+
101
+ ### Changed - Phase 3: Practical Application
102
+ - **src/core/memory-manager.ts** - Applied DatabaseFactory
103
+ - Replaced 13 lines β†’ 5 lines (60% reduction)
104
+ - βœ… All 79 memory-manager tests passing
105
+
106
+ - **src/core/response-cache.ts** - Applied DatabaseFactory
107
+ - Replaced 11 lines β†’ 5 lines (55% reduction)
108
+ - Removed manual directory creation and WAL mode setup
109
+ - βœ… All 17 response-cache tests passing
110
+
111
+ - **src/core/workspace-indexer.ts** - Applied DatabaseFactory
112
+ - Replaced 8 lines β†’ 5 lines (38% reduction)
113
+ - Standardized DB initialization with WAL mode
114
+ - βœ… Tests passing
115
+
116
+ ### Changed - Phase 4: Extended Application
117
+ - **src/core/analytics/provider-analytics.ts** - Applied DatabaseFactory
118
+ - Replaced 4 lines β†’ 5 lines (standardized initialization)
119
+ - Added WAL mode for concurrent access
120
+ - βœ… All tests passing
121
+
122
+ - **src/core/telemetry/TelemetryCollector.ts** - Applied DatabaseFactory
123
+ - Replaced 14 lines β†’ 5 lines (64% reduction)
124
+ - Standardized busyTimeout (5s) and WAL mode
125
+ - βœ… All tests passing
126
+
127
+ - **src/core/predictive-limit-manager.ts** - Applied DatabaseFactory
128
+ - Replaced 7 lines β†’ 5 lines (29% reduction)
129
+ - Consistent directory creation and WAL mode
130
+ - βœ… All tests passing
131
+
132
+ **Phase 3 & 4 Summary:**
133
+ - 6 files refactored with DatabaseFactory
134
+ - 57 lines reduced to 30 lines (47% average reduction)
135
+ - All 2507+ tests passing (100% success rate)
136
+ - Zero breaking changes
137
+
138
+ ### Changed - Phase 5: PromptHelper Application
139
+ - **src/cli/commands/agent/create.ts** - Applied PromptHelper
140
+ - Replaced manual readline management in `ask()` function
141
+ - Automatic cleanup via try-finally pattern
142
+ - Eliminated resource leak risks
143
+ - βœ… All 23 agent create tests passing
144
+
145
+ - **src/cli/commands/agent/remove.ts** - Applied PromptHelper
146
+ - Replaced manual readline management in `askConfirmation()` function
147
+ - Consistent cleanup behavior
148
+ - Simplified error handling
149
+ - βœ… All 25 agent remove tests passing
150
+
151
+ **Phase 5 Summary:**
152
+ - 2 CLI command files refactored with PromptHelper
153
+ - Eliminated manual readline interface management
154
+ - Automatic resource cleanup (prevents Bug #91 class issues)
155
+ - All 2507+ tests passing (100% success rate)
156
+ - Zero breaking changes
157
+
158
+ ### Changed - Phase 6: PromptHelper Extension (Config/Runs/Update Commands)
159
+ - **src/cli/commands/config/reset.ts** - Applied PromptHelper
160
+ - Replaced manual readline management in confirmation prompt
161
+ - Automatic cleanup via try-finally pattern
162
+ - Consistent with other CLI commands
163
+ - βœ… All tests passing
164
+
165
+ - **src/cli/commands/runs.ts** - Applied PromptHelper
166
+ - Replaced manual readline management in delete confirmation
167
+ - Simplified async promise wrapping
168
+ - Eliminated manual close() calls
169
+ - βœ… All tests passing
170
+
171
+ - **src/cli/commands/update.ts** - Applied PromptHelper
172
+ - Replaced manual readline management in update confirmation
173
+ - Consistent cleanup behavior
174
+ - Reduced code complexity
175
+ - βœ… All tests passing
176
+
177
+ **Phase 6 Summary:**
178
+ - 3 CLI command files refactored with PromptHelper
179
+ - Eliminated 9 lines of manual readline management per file
180
+ - Consistent confirmation pattern across all CLI commands
181
+ - All 2507+ tests passing (100% success rate)
182
+ - Zero breaking changes
183
+
184
+ ### Changed - Phase 7: PromptHelper Extension (Setup/Spec Commands)
185
+ - **src/cli/commands/setup.ts** - Applied PromptHelper
186
+ - Replaced manual readline/promises import in `maybeInitializeSpecKit()` function
187
+ - Replaced 9 lines of readline management β†’ try-finally pattern
188
+ - Simplified Spec-Kit initialization prompt
189
+ - Automatic cleanup in both success and error paths
190
+ - βœ… All tests passing
191
+
192
+ - **src/cli/commands/spec.ts** - Applied PromptHelper
193
+ - Replaced manual readline management in `handleCreate()` function
194
+ - Removed manual question wrapper function (15 lines)
195
+ - Simplified project description prompt
196
+ - Consistent error handling across spec creation
197
+ - βœ… All tests passing
198
+
199
+ **Phase 7 Summary:**
200
+ - 2 CLI command files refactored with PromptHelper
201
+ - Eliminated 24 lines of manual readline management
202
+ - setup.ts: Simplified Spec-Kit initialization prompt flow
203
+ - spec.ts: Removed custom question() wrapper, now uses PromptHelper directly
204
+ - All 2507+ tests passing (100% success rate)
205
+ - Zero breaking changes
206
+
207
+ **Cumulative Progress (Phases 1-7):**
208
+ - 5 utilities created (1,083 lines of reusable code)
209
+ - 8 files refactored (6 DatabaseFactory + 7 PromptHelper)
210
+ - DatabaseFactory: 6/6 priority files complete (100%)
211
+ - PromptHelper: 7/12 files complete (58% - all simple patterns done)
212
+ - All 2507+ tests passing consistently
213
+ - Zero breaking changes maintained
214
+
215
+ ### Next Steps (Optional - Incremental Adoption)
216
+ Files can gradually migrate to new utilities:
217
+ - **PromptHelper**: βœ… agent/create.ts, agent/remove.ts, config/reset.ts, runs.ts, update.ts, setup.ts, spec.ts (7 done), run.ts, prompt-manager.ts, RegenerationDetector.ts, base-provider.ts, cli-wrapper.ts (5 files remaining - complex patterns)
218
+ - **DatabaseFactory**: βœ… All 6 priority files refactored (memory-manager.ts, response-cache.ts, workspace-indexer.ts, provider-analytics.ts, predictive-limit-manager.ts, TelemetryCollector.ts)
219
+ - **Note**: db-connection-pool.ts intentionally skipped (requires custom readonly mode and pragma settings)
220
+
5
221
  ## [9.0.1] - 2025-11-19
6
222
 
7
223
  ### Fixed
@@ -9693,7 +9909,7 @@ AutomatosX v4.0.0 is a **complete rewrite from the ground up**, addressing the c
9693
9909
  - Package size: 210.4 KB (tarball)
9694
9910
  - Unpacked: 879.7 KB
9695
9911
  - Files: 53
9696
- - Node.js: β‰₯20.0.0
9912
+ - Node.js: β‰₯24.0.0
9697
9913
 
9698
9914
  ### πŸ™ Contributors
9699
9915
 
package/CONTRIBUTING.md CHANGED
@@ -57,7 +57,7 @@ This doesn't mean we don't value the community! Issues, discussions, and feedbac
57
57
 
58
58
  ### Prerequisites
59
59
 
60
- - Node.js 20.0.0 or later
60
+ - Node.js 24.0.0 or later
61
61
  - npm, pnpm, or yarn
62
62
 
63
63
  ### Installation
package/FAQ.md CHANGED
@@ -164,7 +164,7 @@ For comprehensive Windows troubleshooting, see the [Windows Troubleshooting Guid
164
164
 
165
165
  ### What are the system requirements?
166
166
 
167
- - **Node.js**: 20.0.0 or higher
167
+ - **Node.js**: 24.0.0 or higher
168
168
  - **OS**: macOS, Linux, or Windows
169
169
  - **Memory**: 512MB RAM minimum, 2GB recommended
170
170
  - **Disk**: 100MB for installation
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # AutomatosX
1
+ <h1><img src=".github/assets/axlogo.png" alt="AutomatosX Logo" width="36" /> <span style="font-size: 1.5em;">AutomatosX</span></h1>
2
2
 
3
- **From Idea to Production in Minutes: The AI Workforce Platform with Persistent Memory**
3
+ *From Idea to Production in Minutes: The AI Workforce Platform with Persistent Memory*
4
4
 
5
5
  AutomatosX is a pure CLI orchestration platform for AI agents. It wraps around `claude`, `gemini`, `grok`, and `codex` commands to provide multi-agent orchestration, persistent memory, and workflow automation. Simple, focused, and easy to integrate with your existing AI workflow.
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/@defai.digital/automatosx.svg)](https://www.npmjs.com/package/@defai.digital/automatosx)
8
- [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
8
+ [![License](https://img.shields.io/badge/license-Apache--2.0-yellow.svg)](LICENSE)
9
9
  [![TypeScript](https://img.shields.io/badge/TypeScript-100%25-blue.svg)](https://www.typescriptlang.org/)
10
10
  [![Tests](https://img.shields.io/badge/tests-2,423+%20passing-brightgreen.svg)](#)
11
11
  [![npm](https://img.shields.io/npm/dt/%40defai.digital%2Fautomatosx.svg?label=total%20downloads&color=blue)](https://www.npmjs.com/package/@defai.digital/automatosx)
@@ -13,7 +13,7 @@ AutomatosX is a pure CLI orchestration platform for AI agents. It wraps around `
13
13
  [![Windows](https://img.shields.io/badge/Windows-10+-blue.svg)](https://www.microsoft.com/windows)
14
14
  [![Ubuntu](https://img.shields.io/badge/Ubuntu-24.04-blue.svg)](https://ubuntu.com)
15
15
 
16
- **Status**: βœ… **Production Ready** | v9.0.1 | 20 Specialized Agents | Pure CLI Orchestration | Enterprise MCP Support
16
+ **Status**: βœ… **Production Ready** | v9.1.1 | 20 Specialized Agents | Pure CLI Orchestration | Enterprise MCP Support
17
17
 
18
18
  > πŸŽ‰ **NEW in v8.5.3**: **Phase 4 MCP Complete!** Production-ready Model Context Protocol (MCP) server management with lifecycle logging, auto-installation, configuration hot-reload, performance monitoring, and resource enforcement. Transform your AI workflow with enterprise-grade server orchestration.
19
19
 
@@ -656,7 +656,7 @@ ax providers list # List available providers
656
656
  **Learn More**:
657
657
 
658
658
  - [Gemini Integration Guide](docs/providers/gemini.md) - Gemini CLI setup
659
- - [Grok Integration Guide](GROK.md) - Grok CLI setup (X.AI, Z.AI, or self-hosted)
659
+ - [ax-cli Integration Guide](.ax-cli/README.md) - Multi-provider CLI (GLM, xAI, OpenAI, Anthropic, Ollama)
660
660
  - [Provider Comparison](docs/providers/overview.md) - Provider comparison
661
661
 
662
662
  ---
@@ -1173,112 +1173,15 @@ Use `ax setup` for the standard, essential setup. Use `ax init` for an enhanced
1173
1173
 
1174
1174
  ### Requirements
1175
1175
 
1176
- - **Node.js**: >= 20.0.0
1176
+ - **Node.js**: >= 24.0.0
1177
1177
  - **AI Providers**: At least one:
1178
1178
  - [Gemini CLI](https://ai.google.dev/gemini-api/docs/cli) (recommended - cheapest)
1179
1179
  - [OpenAI Codex](https://platform.openai.com/docs/guides/code) (fastest)
1180
1180
  - [Claude Code](https://claude.ai/code) (most capable)
1181
- - [Grok CLI](#-grok-cli-configuration-new-in-v831) (X.AI or self-hosted GLM 4.6)
1181
+ - [ax-cli](.ax-cli/README.md) (multi-provider: GLM, xAI, OpenAI, Anthropic, Ollama)
1182
1182
 
1183
1183
  [➑️ Full Installation Guide](docs/getting-started/installation.md)
1184
1184
 
1185
- ### πŸ€– Grok CLI Configuration (New in v8.3.1)
1186
-
1187
- AutomatosX now supports Grok CLI with **two endpoints**:
1188
-
1189
- #### Option 1: X.AI Official Grok (Recommended)
1190
-
1191
- ```bash
1192
- # 1. Run setup to create .grok/settings.json
1193
- ax setup
1194
-
1195
- # 2. Edit .grok/settings.json
1196
- {
1197
- "baseURL": "https://api.x.ai/v1",
1198
- "model": "grok-3-fast",
1199
- "apiKey": "xai-your-key-here"
1200
- }
1201
-
1202
- # 3. Enable in automatosx.config.json
1203
- "grok": { "enabled": true }
1204
-
1205
- # 4. Verify
1206
- ax doctor grok
1207
- ax providers list
1208
- ```
1209
-
1210
- **Get X.AI API Key**: https://console.x.ai/api-keys
1211
-
1212
- #### Option 2: Z.AI GLM 4.6 (Code-Optimized)
1213
-
1214
- ```bash
1215
- # Edit .grok/settings.json
1216
- {
1217
- "baseURL": "https://api.z.ai/api/coding/paas/v4",
1218
- "model": "glm-4.6",
1219
- "apiKey": "your-zai-key"
1220
- }
1221
- ```
1222
-
1223
- **Get Z.AI API Key**: https://z.ai/developer
1224
-
1225
- #### Option 3: Self-Hosted GLM 4.6 API Server
1226
-
1227
- **Use your own local coding system with AutomatosX!**
1228
-
1229
- You can point AutomatosX to your own GLM 4.6 API server for complete control:
1230
-
1231
- ```bash
1232
- # Edit .grok/settings.json
1233
- {
1234
- "baseURL": "http://localhost:8000/v1", # Your local API server
1235
- "model": "glm-4.6",
1236
- "apiKey": "your-local-api-key" # Optional if your server requires it
1237
- }
1238
- ```
1239
-
1240
- **Benefits of Self-Hosted:**
1241
- - 🏠 Complete data privacy - all processing stays local
1242
- - πŸ’° No usage costs - run as much as you want
1243
- - ⚑ Lower latency - no network round trips
1244
- - πŸ”§ Full customization - fine-tune the model for your needs
1245
- - πŸ”’ Enterprise security - meets corporate requirements
1246
-
1247
- **Popular GLM 4.6 API Server Implementations:**
1248
- - [vLLM](https://github.com/vllm-project/vllm) - Fast inference server
1249
- - [Text Generation Inference](https://github.com/huggingface/text-generation-inference) - HuggingFace's solution
1250
- - [Ollama](https://ollama.ai) - Easy local deployment
1251
- - Custom FastAPI/Flask wrapper around GLM 4.6
1252
-
1253
- **Example Docker Setup:**
1254
- ```bash
1255
- # Run GLM 4.6 API server locally
1256
- docker run -d \
1257
- -p 8000:8000 \
1258
- -v ~/.cache/huggingface:/root/.cache/huggingface \
1259
- vllm/vllm-openai:latest \
1260
- --model THUDM/glm-4-6 \
1261
- --port 8000
1262
-
1263
- # Configure AutomatosX to use it
1264
- # Edit .grok/settings.json with baseURL: "http://localhost:8000/v1"
1265
- ```
1266
-
1267
- **πŸ“„ License Note for Self-Hosted/Commercial Use:**
1268
-
1269
- AutomatosX is licensed under Apache 2.0 for **non-commercial use**. For commercial use or to remove license restrictions:
1270
-
1271
- - πŸ’Ό **Commercial License**: Visit https://license.defai.digital/automatosx
1272
- - πŸ“‹ **Custom Terms**: Available for enterprise deployments
1273
- - 🀝 **Volume Discounts**: Contact us for team/organization pricing
1274
-
1275
- **See [GROK.md](GROK.md) for complete setup guide, including:**
1276
- - Model comparison (grok-3-fast vs glm-4.6)
1277
- - Environment variable configuration
1278
- - Switching between endpoints
1279
- - Troubleshooting guide
1280
- - Cost optimization tips
1281
-
1282
1185
  ---
1283
1186
 
1284
1187
  ## πŸ—ΊοΈ Roadmap
@@ -100,14 +100,14 @@ ax --version
100
100
  # Check your Node version
101
101
  node --version
102
102
 
103
- # AutomatosX requires Node.js 20 or higher
104
- # Install Node 20+ using nvm (recommended)
105
- nvm install 20
106
- nvm use 20
103
+ # AutomatosX requires Node.js 24 or higher
104
+ # Install Node 24+ using nvm (recommended)
105
+ nvm install 24
106
+ nvm use 24
107
107
 
108
108
  # Or use n
109
109
  npm install -g n
110
- n 20
110
+ n 24
111
111
  ```
112
112
 
113
113
  ### Error: SQLite compilation fails