@defai.digital/ax-cli 3.14.5 → 3.14.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 (49) 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 +3 -0
  6. package/README.md +17 -4
  7. package/ax.config.json +303 -0
  8. package/dist/llm/client.d.ts +3 -2
  9. package/dist/llm/client.js +14 -12
  10. package/dist/llm/client.js.map +1 -1
  11. package/dist/mcp/config-detector-v2.d.ts +83 -0
  12. package/dist/mcp/config-detector-v2.js +328 -0
  13. package/dist/mcp/config-detector-v2.js.map +1 -0
  14. package/dist/mcp/config-migrator-v2.d.ts +89 -0
  15. package/dist/mcp/config-migrator-v2.js +288 -0
  16. package/dist/mcp/config-migrator-v2.js.map +1 -0
  17. package/dist/mcp/config-v2.d.ts +111 -0
  18. package/dist/mcp/config-v2.js +443 -0
  19. package/dist/mcp/config-v2.js.map +1 -0
  20. package/dist/mcp/transports-v2.d.ts +152 -0
  21. package/dist/mcp/transports-v2.js +481 -0
  22. package/dist/mcp/transports-v2.js.map +1 -0
  23. package/dist/ui/hooks/use-input-handler.js +4 -4
  24. package/dist/ui/hooks/use-input-handler.js.map +1 -1
  25. package/dist/ui/utils/image-handler.d.ts +1 -8
  26. package/dist/ui/utils/image-handler.js +64 -78
  27. package/dist/ui/utils/image-handler.js.map +1 -1
  28. package/dist/utils/error-sanitizer.d.ts +119 -0
  29. package/dist/utils/error-sanitizer.js +253 -0
  30. package/dist/utils/error-sanitizer.js.map +1 -0
  31. package/dist/utils/errors.d.ts +74 -0
  32. package/dist/utils/errors.js +139 -0
  33. package/dist/utils/errors.js.map +1 -0
  34. package/dist/utils/image-processor.d.ts +4 -10
  35. package/dist/utils/image-processor.js +12 -20
  36. package/dist/utils/image-processor.js.map +1 -1
  37. package/dist/utils/incremental-analyzer.d.ts +134 -0
  38. package/dist/utils/incremental-analyzer.js +377 -0
  39. package/dist/utils/incremental-analyzer.js.map +1 -0
  40. package/dist/utils/math.d.ts +1 -0
  41. package/dist/utils/math.js +4 -0
  42. package/dist/utils/math.js.map +1 -0
  43. package/dist/utils/settings.d.ts +1 -0
  44. package/dist/utils/settings.js +4 -0
  45. package/dist/utils/settings.js.map +1 -0
  46. package/dist/utils/streaming-analyzer.d.ts +160 -0
  47. package/dist/utils/streaming-analyzer.js +214 -0
  48. package/dist/utils/streaming-analyzer.js.map +1 -0
  49. 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-01T23:07:09.741Z",
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": 34520,
57
+ "last_prompt_tokens": 34606,
58
+ "total_tokens_saved": 1113233,
59
+ "usage_count": 57,
60
+ "last_used_at": "2025-12-01T23:07:09.741Z"
61
+ }
62
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "mcpServers": {}
3
+ }
package/README.md CHANGED
@@ -49,7 +49,7 @@ ax-cli
49
49
  - [Security](#security)
50
50
  - [Architecture](#architecture)
51
51
  - [Changelog](#changelog)
52
- - [Recent Changes (v3.14.4)](#recent-changes-v3144)
52
+ - [Recent Changes (v3.14.7)](#recent-changes-v3147)
53
53
  - [Documentation](#documentation)
54
54
 
55
55
  ---
@@ -60,7 +60,7 @@ ax-cli
60
60
 
61
61
  | Feature | Description |
62
62
  |---------|-------------|
63
- | **GLM-Optimized** | Primary support for Z.AI's GLM-4.6 with 200K context window |
63
+ | **GLM-Optimized** | Primary support for Z.AI's GLM-4.6 (200K context) and GLM-4.5v (vision) |
64
64
  | **Multi-Phase Planner** | Intelligent task decomposition for complex requests |
65
65
  | **Session Continuity** | Directory-specific conversation history with `--continue` |
66
66
  | **MCP Integration** | Model Context Protocol with 12+ production-ready templates |
@@ -70,7 +70,8 @@ ax-cli
70
70
 
71
71
  ### AI Provider Support
72
72
 
73
- - **Z.AI GLM-4.6** (default) - 32K max tokens, optimized for complex code generation
73
+ - **Z.AI GLM-4.6** (default) - 200K context, optimized for complex code generation
74
+ - **Z.AI GLM-4.5v** (vision) - 64K multimodal context, auto-switches for image analysis
74
75
  - **OpenAI** - GPT-4, GPT-3.5
75
76
  - **Anthropic** - Claude models
76
77
  - **Ollama** - Local models
@@ -403,7 +404,19 @@ Email: **security@defai.digital** (private disclosure)
403
404
 
404
405
  ---
405
406
 
406
- ## Recent Changes (v3.14.4)
407
+ ## Recent Changes (v3.14.7)
408
+
409
+ ### Code Refactoring
410
+
411
+ - **Image Handler Optimization**: Consolidated duplicate regex patterns, reducing from 6 to 3 patterns with `lastIndex` reset for quick checks
412
+ - **Simplified Message Builder**: Streamlined `buildMessageContent` function with direct `push()` calls for better readability
413
+ - **Path Security Cleanup**: Simplified path traversal security check with improved readability using `.catch()` pattern
414
+
415
+ ### Bug Fixes
416
+
417
+ - **Vision Model Max Tokens**: Fixed "Max tokens exceeds limit" error when auto-switching to glm-4.5v for image processing - now automatically clamps max tokens to model limit
418
+
419
+ ## Previous Changes (v3.14.4)
407
420
 
408
421
  ### Improvements
409
422
 
package/ax.config.json ADDED
@@ -0,0 +1,303 @@
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
+ "enableFreeTierPrioritization": true,
300
+ "enableWorkloadAwareRouting": true
301
+ },
302
+ "version": "10.3.3"
303
+ }
@@ -103,9 +103,10 @@ export declare class LLMClient {
103
103
  */
104
104
  private validateTemperature;
105
105
  /**
106
- * Validate max tokens for current model
106
+ * Validate and clamp max tokens for current model
107
+ * Returns the clamped value (clamps to model limit if exceeded)
107
108
  */
108
- private validateMaxTokens;
109
+ private validateAndClampMaxTokens;
109
110
  /**
110
111
  * Safely extract usage from unknown response payloads
111
112
  * Ensures we only rely on numeric token counts to avoid runtime errors
@@ -103,9 +103,10 @@ export class LLMClient {
103
103
  }
104
104
  }
105
105
  /**
106
- * Validate max tokens for current model
106
+ * Validate and clamp max tokens for current model
107
+ * Returns the clamped value (clamps to model limit if exceeded)
107
108
  */
108
- validateMaxTokens(maxTokens, model) {
109
+ validateAndClampMaxTokens(maxTokens, model) {
109
110
  const config = GLM_MODELS[model];
110
111
  if (maxTokens < 1) {
111
112
  throw new Error(`Max tokens must be at least 1, got ${maxTokens}`);
@@ -113,14 +114,15 @@ export class LLMClient {
113
114
  if (!config) {
114
115
  // Custom model - allow up to 128K tokens
115
116
  if (maxTokens > 128000) {
116
- throw new Error(`Max tokens ${maxTokens} exceeds reasonable limit. Maximum: 128000`);
117
+ return 128000; // Clamp to reasonable limit
117
118
  }
118
- return;
119
+ return maxTokens;
119
120
  }
121
+ // Clamp to model's max output tokens (e.g., when auto-switching to vision model)
120
122
  if (maxTokens > config.maxOutputTokens) {
121
- throw new Error(`Max tokens ${maxTokens} exceeds limit for model ${model}. ` +
122
- `Maximum: ${config.maxOutputTokens}`);
123
+ return config.maxOutputTokens;
123
124
  }
125
+ return maxTokens;
124
126
  }
125
127
  /**
126
128
  * Safely extract usage from unknown response payloads
@@ -352,14 +354,14 @@ export class LLMClient {
352
354
  // Merge options with defaults
353
355
  const model = this.validateModel(options?.model || this.currentModel);
354
356
  const temperature = options?.temperature ?? this.defaultTemperature;
355
- const maxTokens = options?.maxTokens ?? this.defaultMaxTokens;
357
+ const rawMaxTokens = options?.maxTokens ?? this.defaultMaxTokens;
356
358
  const thinking = options?.thinking;
357
359
  const searchOptions = options?.searchOptions;
358
360
  const responseFormat = options?.responseFormat;
359
361
  const sampling = options?.sampling;
360
- // Validate parameters
362
+ // Validate parameters (clamp maxTokens to model limit)
361
363
  this.validateTemperature(temperature, model);
362
- this.validateMaxTokens(maxTokens, model);
364
+ const maxTokens = this.validateAndClampMaxTokens(rawMaxTokens, model);
363
365
  this.validateThinking(thinking, model);
364
366
  validateSampling(sampling, temperature);
365
367
  // Build request payload using consolidated helper
@@ -525,14 +527,14 @@ export class LLMClient {
525
527
  // Merge options with defaults
526
528
  const model = this.validateModel(options?.model || this.currentModel);
527
529
  const temperature = options?.temperature ?? this.defaultTemperature;
528
- const maxTokens = options?.maxTokens ?? this.defaultMaxTokens;
530
+ const rawMaxTokens = options?.maxTokens ?? this.defaultMaxTokens;
529
531
  const thinking = options?.thinking;
530
532
  const searchOptions = options?.searchOptions;
531
533
  const responseFormat = options?.responseFormat;
532
534
  const sampling = options?.sampling;
533
- // Validate parameters
535
+ // Validate parameters (clamp maxTokens to model limit)
534
536
  this.validateTemperature(temperature, model);
535
- this.validateMaxTokens(maxTokens, model);
537
+ const maxTokens = this.validateAndClampMaxTokens(rawMaxTokens, model);
536
538
  this.validateThinking(thinking, model);
537
539
  validateSampling(sampling, temperature);
538
540
  // Build request payload using consolidated helper