@defai.digital/ax-cli 3.15.5 → 3.15.7

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.
Files changed (46) hide show
  1. package/.ax-cli/CUSTOM.md +97 -0
  2. package/.ax-cli/auto-accept-audit.json +1302 -0
  3. package/.ax-cli/index.json +43 -0
  4. package/.ax-cli/memory.json +62 -0
  5. package/.ax-cli/settings.json +41 -0
  6. package/README.md +15 -2
  7. package/ax.config.json +304 -0
  8. package/dist/agent/llm-agent.d.ts +5 -0
  9. package/dist/agent/llm-agent.js +34 -0
  10. package/dist/agent/llm-agent.js.map +1 -1
  11. package/dist/analyzers/ast/tree-sitter-parser.d.ts +134 -0
  12. package/dist/analyzers/ast/tree-sitter-parser.js +730 -0
  13. package/dist/analyzers/ast/tree-sitter-parser.js.map +1 -0
  14. package/dist/mcp/config-detector-v2.d.ts +83 -0
  15. package/dist/mcp/config-detector-v2.js +328 -0
  16. package/dist/mcp/config-detector-v2.js.map +1 -0
  17. package/dist/mcp/config-migrator-v2.d.ts +89 -0
  18. package/dist/mcp/config-migrator-v2.js +288 -0
  19. package/dist/mcp/config-migrator-v2.js.map +1 -0
  20. package/dist/mcp/config-v2.d.ts +111 -0
  21. package/dist/mcp/config-v2.js +443 -0
  22. package/dist/mcp/config-v2.js.map +1 -0
  23. package/dist/mcp/transports-v2.d.ts +152 -0
  24. package/dist/mcp/transports-v2.js +481 -0
  25. package/dist/mcp/transports-v2.js.map +1 -0
  26. package/dist/utils/error-sanitizer.d.ts +119 -0
  27. package/dist/utils/error-sanitizer.js +253 -0
  28. package/dist/utils/error-sanitizer.js.map +1 -0
  29. package/dist/utils/errors.d.ts +74 -0
  30. package/dist/utils/errors.js +139 -0
  31. package/dist/utils/errors.js.map +1 -0
  32. package/dist/utils/incremental-analyzer.d.ts +134 -0
  33. package/dist/utils/incremental-analyzer.js +377 -0
  34. package/dist/utils/incremental-analyzer.js.map +1 -0
  35. package/dist/utils/math.d.ts +1 -0
  36. package/dist/utils/math.js +4 -0
  37. package/dist/utils/math.js.map +1 -0
  38. package/dist/utils/prompt-builder.js +18 -1
  39. package/dist/utils/prompt-builder.js.map +1 -1
  40. package/dist/utils/settings.d.ts +1 -0
  41. package/dist/utils/settings.js +4 -0
  42. package/dist/utils/settings.js.map +1 -0
  43. package/dist/utils/streaming-analyzer.d.ts +160 -0
  44. package/dist/utils/streaming-analyzer.js +214 -0
  45. package/dist/utils/streaming-analyzer.js.map +1 -0
  46. package/package.json +1 -1
@@ -0,0 +1,43 @@
1
+ {
2
+ "projectName": "@defai.digital/ax-cli",
3
+ "version": "3.12.8",
4
+ "primaryLanguage": "TypeScript",
5
+ "techStack": [
6
+ "React",
7
+ "Vitest",
8
+ "Zod",
9
+ "Commander",
10
+ "Ink",
11
+ "ESM",
12
+ "TypeScript"
13
+ ],
14
+ "projectType": "cli",
15
+ "entryPoint": "dist/index.js",
16
+ "directories": {
17
+ "source": "src",
18
+ "tests": "tests",
19
+ "tools": "src/tools"
20
+ },
21
+ "keyFiles": [
22
+ "package.json",
23
+ "tsconfig.json",
24
+ "vitest.config.ts",
25
+ ".eslintrc.js",
26
+ "README.md",
27
+ "CLAUDE.md"
28
+ ],
29
+ "conventions": {
30
+ "moduleSystem": "esm",
31
+ "importExtension": ".js",
32
+ "testFramework": "vitest",
33
+ "validation": "zod"
34
+ },
35
+ "scripts": {
36
+ "build": "npm run build:schemas && tsc && chmod +x dist/index.js",
37
+ "test": "vitest run",
38
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
39
+ "dev": "tsx src/index.ts"
40
+ },
41
+ "packageManager": "pnpm",
42
+ "lastAnalyzed": "2025-12-01T01:45:19.761Z"
43
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "version": 1,
3
+ "created_at": "2025-12-01T01:45:24.387Z",
4
+ "updated_at": "2025-12-03T05:01:27.658Z",
5
+ "project_root": "/Users/akiralam/code/ax-cli",
6
+ "content_hash": "sha256:c309a5ca5fc17910fd524d6cebbfa2d299ceb2c102be7407386dbdaa015c58e5",
7
+ "source": {
8
+ "directories": [
9
+ {
10
+ "path": "src",
11
+ "max_depth": 3
12
+ },
13
+ {
14
+ "path": "packages",
15
+ "max_depth": 2
16
+ }
17
+ ],
18
+ "files": [
19
+ "README.md",
20
+ "readme.md",
21
+ "package.json",
22
+ "tsconfig.json",
23
+ ".ax-cli/CUSTOM.md"
24
+ ],
25
+ "ignore": [
26
+ "node_modules",
27
+ "dist",
28
+ "build",
29
+ ".git",
30
+ ".next",
31
+ ".nuxt",
32
+ "coverage",
33
+ ".cache",
34
+ ".turbo",
35
+ ".vercel",
36
+ "__pycache__",
37
+ ".pytest_cache",
38
+ "target",
39
+ "vendor",
40
+ "*.log",
41
+ "*.lock",
42
+ ".DS_Store"
43
+ ]
44
+ },
45
+ "context": {
46
+ "formatted": "# Project Context\n\n\n## Architecture Patterns\n- **Project Type**: cli\n- **Primary Language**: TypeScript\n- **Tech Stack**: React, Vitest, Zod, Commander, Ink, ESM, TypeScript\n- **Package Manager**: pnpm\n- **Entry Point**: dist/index.js\n- **Module System**: ESM\n- **Test Framework**: vitest\n- **Validation**: zod\n- **Linter**: eslint\n- **Key Directories**: source: src, tests: tests\n\n\n## Directory Structure\n```\nsrc/\n├── agent/\n│ ├── core/\n│ │ ├── index.ts\n│ │ └── types.ts\n│ ├── execution/\n│ │ ├── index.ts\n│ │ └── tool-executor.ts\n│ ├── planning/\n│ │ ├── index.ts\n│ │ └── plan-executor.ts\n│ ├── specialized/\n│ │ ├── analysis-agent.ts\n│ │ ├── debug-agent.ts\n│ │ ├── documentation-agent.ts\n│ │ ├── index.ts\n│ │ ├── performance-agent.ts\n│ │ ├── refactoring-agent.ts\n│ │ └── testing-agent.ts\n│ ├── streaming/\n│ │ ├── index.ts\n│ │ └── stream-handler.ts\n│ ├── context-manager.ts\n│ ├── dependency-resolver.ts\n│ ├── index.ts\n│ ├── llm-agent.ts\n│ ├── loop-detector.ts\n│ ├── progress-tracker.ts\n│ ├── status-reporter.ts\n│ ├── subagent-orchestrator.ts\n│ ├── subagent-types.ts\n│ └── subagent.ts\n├── analyzers/\n│ ├── architecture/\n│ │ ├── anti-pattern-detectors/\n│ │ ├── pattern-detectors/\n│ │ ├── architecture-analyzer.ts\n│ │ ├── index.ts\n│ │ └── project-structure-scanner.ts\n│ ├── ast/\n│ │ ├── index.ts\n│ │ ├── language-parser.ts\n│ │ ├── multi-language-parser.ts\n│ │ ├── node-helpers.ts\n│ │ ├── parser.ts\n│ │ ├── traverser.ts\n│ │ ├── tree-sitter-parser.ts\n│ │ └── types.ts\n│ ├── best-practices/\n│ │ ├── rules/\n│ │ ├── base-rule.ts\n│ │ ├── best-practice-validator.ts\n│ │ ├── index.ts\n│ │ └── types.ts\n│ ├── cache/\n│ │ └── analysis-cache.ts\n│ ├── code-smells/\n│ │ ├── detectors/\n│ │ ├── base-smell-detector.ts\n│ │ ├── code-smell-analyzer.ts\n│ │ ├── index.ts\n│ │ └── types.ts\n│ ├── dependency/\n│ │ ├── circular-detector.ts\n│ │ ├── coupling-calculator.ts\n│ │ ├── dependency-analyzer.ts\n│ │ ├── dependency-graph.ts\n│ │ ├── index.ts\n│ │ └── types.ts\n│ ├── git/\n│ │ ├── churn-calculator.ts\n│ │ ├── git-analyzer.ts\n│ │ ├── hotspot-detector.ts\n│ │ ├── index.ts\n│ │ └── types.ts\n│ ├── metrics/\n│ │ ├── halstead-calculator.ts\n│ │ ├── index.ts\n│ │ ├── maintainability-calculator.ts\n│ │ ├── metrics-analyzer.ts\n│ │ └── types.ts\n│ ├── security/\n│ │ ├── detectors/\n│ │ ├── base-detector.ts\n│ │ ├── index.ts\n│ │ ├── security-analyzer.ts\n│ │ └── types.ts\n│ └── errors.ts\n├── checkpoint/\n│ ├── index.ts\n│ ├── manager.ts\n│ ├── storage.ts\n│ └── types.ts\n├── commands/\n│ ├── init/\n│ │ └── wizard.ts\n│ ├── cache.ts\n│ ├── custom-commands.ts\n│ ├── doctor.ts\n│ ├── frontend.ts\n│ ├── init.ts\n│ ├── mcp-migrate.ts\n│ ├── mcp.ts\n│ ├── memory.ts\n│ ├── models.ts\n│ ├── plan.ts\n│ ├── rewind.ts\n│ ├── setup.ts\n│ ├── status.ts\n│ ├── templates.ts\n│ ├── update.ts\n│ ├── usage.ts\n│ └── vscode.ts\n├── hooks/\n│ ├── hook-runner.ts\n│ ├── index.ts\n│ ├── manager.ts\n│ └── types.ts\n├── ipc/\n│ ├── index.ts\n│ └── vscode-client.ts\n├── llm/\n│ ├── client.ts\n│ ├── tools.ts\n│ └── types.ts\n├── mcp/\n│ ├── automatosx-loader.ts\n│ ├── client-mutex-patch.ts\n│ ├── client-v2.ts\n│ ├── client.ts\n│ ├── config-detector.ts\n│ ├── config-migrator.ts\n│ ├── config.ts\n│ ├── content-length-transport.ts\n│ ├── error-formatter.ts\n│ ├── health.ts\n│ ├── index.ts\n│ ├── invariants.ts\n│ ├── mutex-safe.ts\n│ ├── mutex.ts\n│ ├── reconnection.ts\n│ ├── registry.ts\n│ ├── resources.ts\n│ ├── ssrf-protection.ts\n│ ├── templates.ts\n│ ├── transports.ts\n│ ├── type-safety.ts\n│ └── validation.ts\n├── memory/\n│ ├── context-generator.ts\n│ ├── context-injector.ts\n│ ├── context-store.ts\n│ ├── index.ts\n│ ├── schemas.ts\n│ ├── stats-collector.ts\n│ └── types.ts\n├── permissions/\n│ ├── index.ts\n│ └── permission-manager.ts\n├── planner/\n│ ├── prompts/\n│ │ └── planning-prompt.ts\n│ ├── dependency-resolver.ts\n│ ├── index.ts\n│ ├── plan-generator.ts\n│ ├── plan-storage.ts\n│ ├── task-planner.ts\n│ ├── token-estimator.ts\n│ └── types.ts\n├── schemas/\n│ ├── api-schemas.ts\n│ ├── confirmation-schemas.ts\n│ ├── index-unified.ts\n│ ├── index.ts\n│ ├── README.md\n│ ├── settings-schemas.ts\n│ ├── tool-schemas.ts\n│ └── yaml-schemas.ts\n├── sdk/\n│ ├── errors.ts\n│ ├── index.ts\n│ ├── progress-reporter.ts\n│ ├── README.md\n│ ├── testing.ts\n│ ├── tool-registry.ts\n│ ├── types.ts\n│ ├── unified-logger.ts\n│ └── version.ts\n├── tools/\n│ ├── analysis-tools/\n│ │ ├── architecture-tool.ts\n│ │ └── validation-tool.ts\n│ ├── analysis-tools.ts\n│ ├── ask-user.ts\n│ ├── bash-output.ts\n│ ├── bash.ts\n│ ├── confirmation-tool.ts\n│ ├── index.ts\n│ ├── registry.ts\n│ ├── search.ts\n│ ├── text-editor.ts\n│ └── todo-tool.ts\n├── types/\n│ ├── analysis.ts\n│ ├── index.ts\n│ ├── project-analysis.ts\n│ └── template.ts\n├── ui/\n│ ├── components/\n│ │ ├── api-key-input.tsx\n│ │ ├── chat-history.tsx\n│ │ ├── chat-input.tsx\n│ │ ├── chat-interface.tsx\n│ │ ├── collapsible-tool-result.tsx\n│ │ ├── command-suggestions.tsx\n│ │ ├── confirmation-dialog.tsx\n│ │ ├── context-breakdown.tsx\n│ │ ├── diff-renderer.tsx\n│ │ ├── index.ts\n│ │ ├── keyboard-help.tsx\n│ │ ├── keyboard-hints.tsx\n│ │ ├── loading-spinner.tsx\n│ │ ├── mcp-status.tsx\n│ │ ├── model-selection.tsx\n│ │ ├── phase-progress.tsx\n│ │ ├── question-dialog.tsx\n│ │ ├── quick-actions.tsx\n│ │ ├── reasoning-display.tsx\n│ │ ├── status-bar.tsx\n│ │ ├── subagent-monitor.tsx\n│ │ ├── toast-notification.tsx\n│ │ ├── tool-group-display.tsx\n│ │ ├── virtualized-chat-history.tsx\n│ │ └── welcome-panel.tsx\n│ ├── hooks/\n│ │ ├── use-chat-reducer.ts\n│ │ ├── use-enhanced-input.ts\n│ │ ├── use-input-handler.ts\n│ │ └── use-input-history.ts\n│ ├── shared/\n│ │ └── max-sized-box.tsx\n│ ├── utils/\n│ │ ├── bracketed-paste-handler.ts\n│ │ ├── change-summarizer.ts\n│ │ ├── code-colorizer.tsx\n│ │ ├── colors.ts\n│ │ ├── markdown-renderer.tsx\n│ │ ├── semantic-action-detector.ts\n│ │ └── tool-grouper.ts\n│ └── app.tsx\n├── utils/\n│ ├── analysis-logger.ts\n│ ├── api-error.ts\n│ ├── audit-logger.ts\n│ ├── auto-accept-logger.ts\n│ ├── automatosx-detector.ts\n│ ├── background-task-manager.ts\n│ ├── cache.ts\n│ ├── command-security.ts\n│ ├── config-loader.ts\n│ ├── confirmation-service.ts\n│ ├── console-messenger.ts\n│ ├── custom-instructions.ts\n│ ├── encryption.ts\n│ ├── enhanced-error-messages.ts\n│ ├── error-handler.ts\n│ ├── error-translator.ts\n│ ├── external-editor.ts\n│ ├── file-cache.ts\n│ ├── file-mentions.ts\n│ ├── history-manager.ts\n│ ├── history-migration.ts\n│ ├── index.ts\n│ ├── init-previewer.ts\n│ ├── init-validator.ts\n│ ├── input-sanitizer.ts\n│ ├── instruction-generator.ts\n│ ├── json-utils.ts\n│ ├── llm-optimized-instruction-generator.ts\n│ ├── message-optimizer.ts\n│ ├── onboarding-manager.ts\n│ └── ... (22 more)\n├── constants.ts\n└── index.ts\npackages/\n└── schemas/\n ├── src/\n ├── tests/\n ├── .eslintrc.js\n ├── package-lock.json\n ├── package.json\n ├── README.md\n ├── tsconfig.json\n └── vitest.config.ts\n```\n\n\n## Key Configuration\n\n### README.md\n\n```\n# AX CLI - Enterprise-Class CLI for Vibe Coding\n\n[![npm](https://img.shields.io/npm/dt/@defai.digital/ax-cli?style=flat-square&logo=npm&label=downloads)](https://npm-stat.com/charts.html?package=%40defai.digital%2Fax-cli)\n[![Tests](https://img.shields.io/badge/tests-2024%20passing-brightgreen?style=flat-square)](https://github.com/defai-digital/ax-cli/actions/workflows/test.yml)\n[![Coverage](https://img.shields.io/badge/coverage-98%2B%25-brightgreen?style=flat-square)](https://github.com/defai-d\n...\n```\n\n### readme.md\n\n```\n# AX CLI - Enterprise-Class CLI for Vibe Coding\n\n[![npm](https://img.shields.io/npm/dt/@defai.digital/ax-cli?style=flat-square&logo=npm&label=downloads)](https://npm-stat.com/charts.html?package=%40defai.digital%2Fax-cli)\n[![Tests](https://img.shields.io/badge/tests-2024%20passing-brightgreen?style=flat-square)](https://github.com/defai-digital/ax-cli/actions/workflows/test.yml)\n[![Coverage](https://img.shields.io/badge/coverage-98%2B%25-brightgreen?style=flat-square)](https://github.com/defai-d\n...\n```\n\n### package.json\n\n- **Name**: @defai.digital/ax-cli\n- **Version**: 3.12.8\n- **Description**: Enterprise-Class AI Command Line Interface - Primary support for GLM (General Language Model) with multi-provider AI orchestration powered by AutomatosX.\n- **Type**: module\n- **CLI**: Yes\n- **Dependencies**: @ax-cli/schemas, @clack/prompts, @modelcontextprotocol/sdk, @types/ws, axios, chalk, clipboardy, commander, dotenv, enquirer (+18 more)\n- **Dev Dependencies**: @types/fs-extra, @types/glob, @types/js-yaml, @types/marked-terminal, @types/node, @types/react, @typescript-eslint/eslint-plugin, @typescript-eslint/parser (+6 more)\n- **Scripts**: build, build:schemas, dev, start, pretest, lint\n\n### tsconfig.json\n\n- **Target**: ES2022\n- **Module**: ESNext\n- **Module Resolution**: Bundler\n- **Strict**: true\n- **Output**: ./dist\n\n### .ax-cli/CUSTOM.md\n\n# Custom Instructions for AX CLI\n\n**Project**: @defai.digital/ax-cli v3.12.8\n**Type**: cli\n**Language**: TypeScript\n**Stack**: React, Vitest, Zod, Commander, Ink, ESM, TypeScript\n\nGenerated: 11/30/2025, 8:45:19 PM\n\n## Project Context\n\n- **Entry Point**: `dist/index.js`\n- **Package Manager**: pnpm\n- **Module System**: ESM\n- **CLI Tool**: This is a command-line interface application\n\n## Code Conventions\n\n### TypeScript\n- Use explicit type annotations for function parameters and returns\n- Prefer `const` and `let` over `var`\n- Use strict mode (strict type checking enabled)\n- **CRITICAL**: Always use `.js` extension in import statements (ESM requirement)\n - Example: `import { foo } from \"./bar.js\"` (NOT \"./bar\" or \"./bar.ts\")\n\n### ES Modules\n- Use `import/export` syntax (not `require/module.exports`)\n- Top-level await is supported\n\n### Validation\n- Use **zod** for runtime validation\n- Validate all external inputs (API requests, file reads, user input)\n- Use `.safeParse()` for error handlin\n[...truncated]\n\n\n## README Summary\n\n# AX CLI - Enterprise-Class CLI for Vibe Coding\n\n[![npm](https://img.shields.io/npm/dt/@defai.digital/ax-cli?style=flat-square&logo=npm&label=downloads)](https://npm-stat.com/charts.html?package=%40defai.digital%2Fax-cli)\n[![Tests](https://img.shields.io/badge/tests-2024%20passing-brightgreen?style=flat-square)](https://github.com/defai-digital/ax-cli/actions/workflows/test.yml)\n[![Coverage](https://img.shields.io/badge/coverage-98%2B%25-brightgreen?style=flat-square)](https://github.com/defai-digital/ax-cli)\n[![Node.js](https://img.shields.io/badge/node-%3E%3D24.0.0-blue?style=flat-square&logo=node.js)](https://nodejs.org/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)\n\n<p align=\"center\">\n <img src=\".github/assets/screenshot1.png\" alt=\"AX CLI Screenshot\" width=\"800\"/>\n</p>\n\n<p align=\"center\">\n <strong>GLM-Optimized CLI • Enterprise Architecture • 98%+ Test Coverage</strong>\n</p>\n\n---\n\n## Quick Start\n\n```bash\n# Install globally\nnpm install -g @defai.digital/ax-cli\n\n# Configure (secure API key setup)\nax-cli setup\n\n# Initialize your project\nax-cli init\n\n# Start coding!\nax-cli\n```\n\n**That's it!** AX CLI is now ready to help you build, debug, and ship code faster.\n\n---\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Usage](#usage)\n- [MCP Integration](#mcp-integration)\n- [Project Memory](#project-memory)\n- [Multi-Phase Planner](#multi-phase-task-planner)\n- [Security](#security)\n- [Architecture](#architecture)\n- [Changelog](#changelog)\n- [Recent Changes (v3.12.8)](#recent-changes-v3128)\n- [Documentation](#documentation)\n\n---\n\n## Features\n\n### Core Capabilities\n\n| Feature | Description |\n|---------|-------------|\n| **GLM-Optimized** | Primary support for Z.AI's GLM-4.6 with 200K context window |\n| **Multi-Phase Planner** | Intelligent task decomposition for complex requests |\n| **Session Continuity** | Directory-specific conversation history with `--continue` |\n| **MCP Integration** | Model Context Protocol with 12+ production-ready templates |\n| **Project Memory** | Intelligent context caching with 50% token savings |\n| **Smart Verbosity** | Three-level output control (Quiet → Concise → Verbose) |\n| **Auto-Update** | Automatic update check on startup with user confirmation |\n\n### AI Provider Support\n\n- **Z.AI GLM-4.6** (default) - 32K max tokens, optimized for complex code generation\n- **OpenAI** - GPT-4, GPT-3.5\n- **Anthropic** - Claude models\n- **Ollama** - Local models\n- **Custom endpoints** - Any OpenAI-compatible API\n\n> **Note**: For xAI Grok, use [grok-cli](https://github.com/superagent-ai/grok-cli). For Anthropic Claude, use [claude-code](https://claude.ai/code).\n\n### Security (Enterprise-Grade, FREE)\n\n| Protection | Severity | Description |\n|------------|----------|-------------|\n| API Key Encryption | - | AES-256-GCM encryption at rest |\n| Command Injection | CVSS 9.8 | Safe command execution with whitelisting |\n| Path Traversal | CVSS 8.6 | Prevent unauthorized file system access |\n| SSRF Prevention | CVSS 7.5 | Validate MCP transport URLs |\n| Input Sanitization | CVSS 7.0 | Comprehensive input validation |\n| Rate Limiting | - | Token bucket algorithm (100 req/min) |\n\n### Code Analysis Tools\n\n- **Dependency Analyzer** - Circular dependencies, coupling metrics\n- **Code Smell Detector** - 10+ anti-patterns detection\n- **Hotspot Analyzer** - Git history-based complexity analysis\n- **Security Scanner** - SQL injection, XSS, hardcoded secrets\n- **Multi-Language Support** - TypeScript, JavaScript, Python, Rust, Go, C, C++, Swift, HTML, CSS\n\n---\n\n## Installation\n\n### Supported Platforms\n\n| Platform | Versions | Architecture |\n|----------|----------|--------------|\n| **macOS** | 26+ | x64, ARM64 (Apple Silicon) |\n| **Windows** | 11+ | x64, ARM64 |\n| **Ubuntu** | 24.04+ | x64, ARM64 |\n\n### Prerequisites\n\n- Node.js 24.0.0 or higher\n- npm package manager\n\n### Install\n\n```bash\nnpm install -g @defai.digital/ax-cli\n```\n\n---\n\n## Configuration\n\n### Quick Setup (Recommended)\n\n```bash\nax\n\n[...truncated]",
47
+ "token_estimate": 4385,
48
+ "sections": {
49
+ "structure": 2321,
50
+ "readme": 1124,
51
+ "config": 834,
52
+ "patterns": 100
53
+ }
54
+ },
55
+ "stats": {
56
+ "last_cached_tokens": 43,
57
+ "last_prompt_tokens": 15848,
58
+ "total_tokens_saved": 1113524,
59
+ "usage_count": 59,
60
+ "last_used_at": "2025-12-03T05:01:27.658Z"
61
+ }
62
+ }
@@ -0,0 +1,41 @@
1
+ {
2
+ "mcpServers": {
3
+ "zai-web-search": {
4
+ "name": "zai-web-search",
5
+ "transport": {
6
+ "type": "http",
7
+ "url": "https://api.z.ai/api/mcp/web_search_prime/mcp",
8
+ "headers": {
9
+ "Authorization": "Bearer 3c073fcc04b44399a40c3c0adedd761d.lWHkwRjTNtZ1FevX"
10
+ }
11
+ }
12
+ },
13
+ "zai-web-reader": {
14
+ "name": "zai-web-reader",
15
+ "transport": {
16
+ "type": "http",
17
+ "url": "https://api.z.ai/api/mcp/web_reader/mcp",
18
+ "headers": {
19
+ "Authorization": "Bearer 3c073fcc04b44399a40c3c0adedd761d.lWHkwRjTNtZ1FevX"
20
+ }
21
+ }
22
+ },
23
+ "zai-vision": {
24
+ "name": "zai-vision",
25
+ "transport": {
26
+ "type": "stdio",
27
+ "command": "npx",
28
+ "args": [
29
+ "-y",
30
+ "@z_ai/mcp-server"
31
+ ],
32
+ "env": {
33
+ "Z_AI_API_KEY": "3c073fcc04b44399a40c3c0adedd761d.lWHkwRjTNtZ1FevX",
34
+ "Z_AI_MODE": "ZAI"
35
+ }
36
+ },
37
+ "initTimeout": 30000,
38
+ "quiet": true
39
+ }
40
+ }
41
+ }
package/README.md CHANGED
@@ -50,7 +50,7 @@ ax-cli
50
50
  - [Security](#security)
51
51
  - [Architecture](#architecture)
52
52
  - [Changelog](#changelog)
53
- - [Recent Changes (v3.15.5)](#recent-changes-v3155)
53
+ - [Recent Changes (v3.15.7)](#recent-changes-v3157)
54
54
  - [Documentation](#documentation)
55
55
 
56
56
  ---
@@ -442,7 +442,20 @@ Email: **security@defai.digital** (private disclosure)
442
442
 
443
443
  ---
444
444
 
445
- ## Recent Changes (v3.15.5)
445
+ ## Recent Changes (v3.15.7)
446
+
447
+ ### Bug Fixes
448
+
449
+ - **MCP Tools Timing Fix**: Fixed critical timing issue where MCP tools weren't included in the system prompt because the prompt was built before MCP servers finished initializing. Now the system prompt is updated after MCP initialization completes, ensuring the LLM knows about web search and other MCP capabilities.
450
+
451
+ ## Previous Changes (v3.15.6)
452
+
453
+ ### Improvements
454
+
455
+ - **MCP Tools in System Prompt**: The LLM now knows about available MCP tools (webSearchPrime, webReader) through the system prompt. This enables agents to use web search and URL fetching capabilities when configured.
456
+ - **Flaky Test Fix**: Fixed timing-sensitive test that occasionally failed due to timer precision.
457
+
458
+ ## Previous Changes (v3.15.5)
446
459
 
447
460
  ### Bug Fixes
448
461
 
package/ax.config.json ADDED
@@ -0,0 +1,304 @@
1
+ {
2
+ "providers": {
3
+ "claude-code": {
4
+ "enabled": true,
5
+ "priority": 3,
6
+ "timeout": 2700000,
7
+ "command": "claude",
8
+ "healthCheck": {
9
+ "enabled": true,
10
+ "interval": 300000,
11
+ "timeout": 5000
12
+ },
13
+ "circuitBreaker": {
14
+ "enabled": true,
15
+ "failureThreshold": 3,
16
+ "recoveryTimeout": 60000
17
+ },
18
+ "processManagement": {
19
+ "gracefulShutdownTimeout": 5000,
20
+ "forceKillDelay": 1000
21
+ },
22
+ "versionDetection": {
23
+ "timeout": 5000,
24
+ "forceKillDelay": 1000,
25
+ "cacheEnabled": true
26
+ },
27
+ "limitTracking": {
28
+ "enabled": true,
29
+ "window": "weekly",
30
+ "resetHourUtc": 0
31
+ }
32
+ },
33
+ "gemini-cli": {
34
+ "enabled": true,
35
+ "priority": 2,
36
+ "timeout": 2700000,
37
+ "command": "gemini",
38
+ "healthCheck": {
39
+ "enabled": true,
40
+ "interval": 300000,
41
+ "timeout": 5000
42
+ },
43
+ "circuitBreaker": {
44
+ "enabled": true,
45
+ "failureThreshold": 3,
46
+ "recoveryTimeout": 60000
47
+ },
48
+ "processManagement": {
49
+ "gracefulShutdownTimeout": 5000,
50
+ "forceKillDelay": 1000
51
+ },
52
+ "versionDetection": {
53
+ "timeout": 5000,
54
+ "forceKillDelay": 1000,
55
+ "cacheEnabled": true
56
+ },
57
+ "limitTracking": {
58
+ "enabled": true,
59
+ "window": "daily",
60
+ "resetHourUtc": 0
61
+ }
62
+ },
63
+ "openai": {
64
+ "enabled": true,
65
+ "priority": 1,
66
+ "timeout": 2700000,
67
+ "command": "codex",
68
+ "healthCheck": {
69
+ "enabled": true,
70
+ "interval": 300000,
71
+ "timeout": 5000
72
+ },
73
+ "circuitBreaker": {
74
+ "enabled": true,
75
+ "failureThreshold": 3,
76
+ "recoveryTimeout": 60000
77
+ },
78
+ "processManagement": {
79
+ "gracefulShutdownTimeout": 5000,
80
+ "forceKillDelay": 1000
81
+ },
82
+ "versionDetection": {
83
+ "timeout": 5000,
84
+ "forceKillDelay": 1000,
85
+ "cacheEnabled": true
86
+ },
87
+ "limitTracking": {
88
+ "enabled": true,
89
+ "window": "daily",
90
+ "resetHourUtc": 0
91
+ }
92
+ }
93
+ },
94
+ "execution": {
95
+ "defaultTimeout": 2700000,
96
+ "concurrency": {
97
+ "maxConcurrentAgents": 4,
98
+ "autoDetect": false,
99
+ "cpuMultiplier": 1,
100
+ "minConcurrency": 2,
101
+ "maxConcurrency": 16
102
+ },
103
+ "retry": {
104
+ "maxAttempts": 3,
105
+ "initialDelay": 1000,
106
+ "maxDelay": 10000,
107
+ "backoffFactor": 2,
108
+ "retryableErrors": [
109
+ "ECONNREFUSED",
110
+ "ETIMEDOUT",
111
+ "ENOTFOUND",
112
+ "rate_limit",
113
+ "overloaded",
114
+ "timeout"
115
+ ]
116
+ },
117
+ "provider": {
118
+ "maxWaitMs": 60000,
119
+ "fallbackDelay": 5000
120
+ },
121
+ "stages": {
122
+ "enabled": true,
123
+ "defaultTimeout": 1800000,
124
+ "checkpointPath": ".automatosx/checkpoints",
125
+ "autoSaveCheckpoint": true,
126
+ "cleanupAfterDays": 7,
127
+ "retry": {
128
+ "defaultMaxRetries": 1,
129
+ "defaultRetryDelay": 2000
130
+ },
131
+ "prompts": {
132
+ "timeout": 600000,
133
+ "autoConfirm": false,
134
+ "locale": "en"
135
+ },
136
+ "progress": {
137
+ "updateInterval": 2000,
138
+ "syntheticProgress": true
139
+ }
140
+ }
141
+ },
142
+ "orchestration": {
143
+ "session": {
144
+ "maxSessions": 100,
145
+ "maxMetadataSize": 10240,
146
+ "saveDebounce": 1000,
147
+ "cleanupAfterDays": 7,
148
+ "maxUuidAttempts": 100,
149
+ "persistPath": ".automatosx/sessions"
150
+ },
151
+ "delegation": {
152
+ "maxDepth": 2,
153
+ "timeout": 2700000,
154
+ "enableCycleDetection": true
155
+ }
156
+ },
157
+ "memory": {
158
+ "maxEntries": 10000,
159
+ "persistPath": ".automatosx/memory",
160
+ "autoCleanup": true,
161
+ "cleanupDays": 30,
162
+ "busyTimeout": 5000,
163
+ "search": {
164
+ "defaultLimit": 10,
165
+ "maxLimit": 100,
166
+ "timeout": 5000
167
+ }
168
+ },
169
+ "abilities": {
170
+ "basePath": ".automatosx/abilities",
171
+ "fallbackPath": "examples/abilities",
172
+ "cache": {
173
+ "enabled": true,
174
+ "maxEntries": 50,
175
+ "ttl": 600000,
176
+ "maxSize": 5242880,
177
+ "cleanupInterval": 120000
178
+ },
179
+ "limits": {
180
+ "maxFileSize": 524288
181
+ }
182
+ },
183
+ "workspace": {
184
+ "prdPath": "automatosx/PRD",
185
+ "tmpPath": "automatosx/tmp",
186
+ "autoCleanupTmp": true,
187
+ "tmpCleanupDays": 7
188
+ },
189
+ "logging": {
190
+ "level": "info",
191
+ "path": ".automatosx/logs",
192
+ "console": true,
193
+ "retention": {
194
+ "maxSizeBytes": 104857600,
195
+ "maxAgeDays": 30,
196
+ "compress": true
197
+ }
198
+ },
199
+ "performance": {
200
+ "profileCache": {
201
+ "enabled": true,
202
+ "maxEntries": 20,
203
+ "ttl": 600000,
204
+ "cleanupInterval": 120000
205
+ },
206
+ "teamCache": {
207
+ "enabled": true,
208
+ "maxEntries": 10,
209
+ "ttl": 600000,
210
+ "cleanupInterval": 120000
211
+ },
212
+ "providerCache": {
213
+ "enabled": true,
214
+ "maxEntries": 100,
215
+ "ttl": 600000,
216
+ "cleanupInterval": 120000
217
+ },
218
+ "adaptiveCache": {
219
+ "maxEntries": 1000,
220
+ "baseTTL": 300000,
221
+ "minTTL": 60000,
222
+ "maxTTL": 3600000,
223
+ "adaptiveMultiplier": 2,
224
+ "lowFreqDivisor": 2,
225
+ "frequencyThreshold": 5,
226
+ "cleanupInterval": 60000
227
+ },
228
+ "responseCache": {
229
+ "enabled": false,
230
+ "ttl": 86400,
231
+ "maxSize": 1000,
232
+ "maxMemorySize": 100,
233
+ "dbPath": ".automatosx/cache/responses.db"
234
+ },
235
+ "rateLimit": {
236
+ "enabled": false,
237
+ "requestsPerMinute": 60,
238
+ "burstSize": 10
239
+ }
240
+ },
241
+ "advanced": {
242
+ "embedding": {
243
+ "timeout": 30000,
244
+ "retryDelay": 1000,
245
+ "dimensions": 1536,
246
+ "maxRetries": 3
247
+ },
248
+ "security": {
249
+ "enablePathValidation": true,
250
+ "allowedExtensions": [
251
+ ".ts",
252
+ ".js",
253
+ ".tsx",
254
+ ".jsx",
255
+ ".py",
256
+ ".go",
257
+ ".rs",
258
+ ".java",
259
+ ".yaml",
260
+ ".yml",
261
+ ".json",
262
+ ".toml",
263
+ ".md",
264
+ ".txt",
265
+ ".csv"
266
+ ]
267
+ },
268
+ "development": {
269
+ "mockProviders": false,
270
+ "profileMode": false
271
+ }
272
+ },
273
+ "integration": {
274
+ "vscode": {
275
+ "enabled": false,
276
+ "apiPort": 3000,
277
+ "autoStart": true,
278
+ "outputPanel": true,
279
+ "notifications": true
280
+ }
281
+ },
282
+ "cli": {
283
+ "run": {
284
+ "defaultMemory": true,
285
+ "defaultSaveMemory": true,
286
+ "defaultFormat": "text",
287
+ "defaultVerbose": false
288
+ },
289
+ "session": {
290
+ "defaultShowAgents": true
291
+ },
292
+ "memory": {
293
+ "defaultLimit": 10
294
+ }
295
+ },
296
+ "router": {
297
+ "healthCheckInterval": 60000,
298
+ "providerCooldownMs": 30000,
299
+ "circuitBreakerWindowMs": 300000,
300
+ "enableFreeTierPrioritization": true,
301
+ "enableWorkloadAwareRouting": true
302
+ },
303
+ "version": "11.2.4"
304
+ }
@@ -54,6 +54,11 @@ export declare class LLMAgent extends EventEmitter {
54
54
  private runBackgroundTask;
55
55
  private initializeCheckpointManager;
56
56
  private initializeMCP;
57
+ /**
58
+ * Update the system prompt to include MCP tools after they're initialized
59
+ * This ensures the LLM knows about available MCP capabilities (web search, etc.)
60
+ */
61
+ private updateSystemPromptWithMCPTools;
57
62
  /**
58
63
  * Build chat options with sampling and thinking configuration included
59
64
  * Merges provided options with the agent's configurations
@@ -207,8 +207,42 @@ export class LLMAgent extends EventEmitter {
207
207
  return; // Skip if no servers configured
208
208
  this.runBackgroundTask('MCP initialization', async () => {
209
209
  await initializeMCPServers();
210
+ // After MCP servers are initialized, update system prompt to include MCP tools
211
+ this.updateSystemPromptWithMCPTools();
210
212
  }, { emitSuccess: 'MCP servers initialized successfully', warnOnError: true });
211
213
  }
214
+ /**
215
+ * Update the system prompt to include MCP tools after they're initialized
216
+ * This ensures the LLM knows about available MCP capabilities (web search, etc.)
217
+ */
218
+ updateSystemPromptWithMCPTools() {
219
+ const mcpManager = getMCPManager();
220
+ const mcpTools = mcpManager?.getTools() || [];
221
+ if (mcpTools.length === 0)
222
+ return; // No MCP tools to add
223
+ // Find the system message
224
+ const systemMessage = this.messages.find(m => m.role === 'system');
225
+ if (!systemMessage || typeof systemMessage.content !== 'string')
226
+ return;
227
+ // Check if MCP tools are already in the prompt (avoid duplicate updates)
228
+ if (systemMessage.content.includes('MCP Tools (External Capabilities)'))
229
+ return;
230
+ // Build MCP tools section
231
+ const mcpToolsList = mcpTools
232
+ .map(tool => {
233
+ const friendlyName = tool.name.replace(/^mcp__[^_]+__/, '');
234
+ const description = tool.description?.split('\n')[0] || 'External tool';
235
+ return `- ${friendlyName}: ${description}`;
236
+ })
237
+ .join('\n');
238
+ const mcpSection = [
239
+ '\n\nMCP Tools (External Capabilities):',
240
+ mcpToolsList,
241
+ '\nIMPORTANT: Use MCP tools for web search, fetching URLs, and external data access. You HAVE network access through these tools.',
242
+ ].join('\n');
243
+ // Append MCP tools section to system prompt
244
+ systemMessage.content += mcpSection;
245
+ }
212
246
  /**
213
247
  * Build chat options with sampling and thinking configuration included
214
248
  * Merges provided options with the agent's configurations