@defai.digital/ax-cli 3.8.16 ā 3.8.17
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 +37 -1
- package/config-defaults/prompts.yaml +131 -198
- package/config-defaults/settings.yaml +24 -1
- package/dist/agent/llm-agent.d.ts +3 -0
- package/dist/agent/llm-agent.js +18 -12
- package/dist/agent/llm-agent.js.map +1 -1
- package/dist/constants.d.ts +15 -0
- package/dist/constants.js +22 -0
- package/dist/constants.js.map +1 -1
- package/dist/hooks/hook-runner.js +2 -2
- package/dist/hooks/hook-runner.js.map +1 -1
- package/dist/llm/client.js +3 -3
- package/dist/llm/client.js.map +1 -1
- package/dist/llm/tools.js +2 -1
- package/dist/llm/tools.js.map +1 -1
- package/dist/mcp/client-v2.d.ts +1 -1
- package/dist/mcp/client-v2.js +4 -4
- package/dist/mcp/client-v2.js.map +1 -1
- package/dist/tools/bash.js +5 -4
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/search.js +2 -1
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/text-editor.js +17 -14
- package/dist/tools/text-editor.js.map +1 -1
- package/dist/utils/config-loader.d.ts +13 -0
- package/dist/utils/config-loader.js.map +1 -1
- package/dist/utils/process-pool.js +3 -2
- package/dist/utils/process-pool.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
- [š Quick Start](#-quick-start)
|
|
22
22
|
- [⨠Features](#-features)
|
|
23
|
-
- [š What's New](#-whats-new-in-
|
|
23
|
+
- [š What's New](#-whats-new-in-v3817)
|
|
24
24
|
- [š¦ Installation](#-installation)
|
|
25
25
|
- [āļø Configuration](#ļø-configuration)
|
|
26
26
|
- [š Security](#-security--api-key-handling)
|
|
@@ -150,6 +150,42 @@ AX CLI uses **industry-standard max tokens** based on research of leading AI cod
|
|
|
150
150
|
|
|
151
151
|
[View all features ā](docs/features.md)
|
|
152
152
|
|
|
153
|
+
## š What's New in v3.8.17
|
|
154
|
+
|
|
155
|
+
**Code Quality & Configuration Centralization** - Removes hardcoded values and unifies configuration.
|
|
156
|
+
|
|
157
|
+
### š§ Improvements
|
|
158
|
+
|
|
159
|
+
- **Centralized timeout configuration** - All timeout values now configurable via `config-defaults/settings.yaml`
|
|
160
|
+
- `TIMEOUT_CONFIG` exported from `constants.ts` for consistent access
|
|
161
|
+
- Bash, search, hook, streaming, and process pool timeouts centralized
|
|
162
|
+
- **Unified MCP configuration** - Health check interval and reconnect delay now in `MCP_CONFIG`
|
|
163
|
+
- **Extended `SettingsYaml` interface** - Added `timeouts` section for configurable timeout values
|
|
164
|
+
- **Removed hardcoded values** - Replaced magic numbers with named constants
|
|
165
|
+
|
|
166
|
+
### š Configuration
|
|
167
|
+
|
|
168
|
+
New `timeouts` section in `config-defaults/settings.yaml`:
|
|
169
|
+
```yaml
|
|
170
|
+
timeouts:
|
|
171
|
+
bash_default: 30000
|
|
172
|
+
search_default: 30000
|
|
173
|
+
hook_default: 30000
|
|
174
|
+
streaming_first_chunk: 90000
|
|
175
|
+
streaming_idle: 120000
|
|
176
|
+
process_execution: 30000
|
|
177
|
+
process_idle: 60000
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### ā
Quality
|
|
181
|
+
|
|
182
|
+
- All 2083 tests passing
|
|
183
|
+
- TypeScript strict mode passes
|
|
184
|
+
- Build succeeds
|
|
185
|
+
- Zero breaking changes
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
153
189
|
## š What's New in v3.8.16
|
|
154
190
|
|
|
155
191
|
**MCP Timeout Configuration** - Fixes [#13](https://github.com/defai-digital/ax-cli/issues/13): AutomatosX agent timeout errors.
|
|
@@ -1,240 +1,173 @@
|
|
|
1
1
|
# System Prompts Configuration
|
|
2
|
-
# AI assistant instructions
|
|
2
|
+
# Professional AI coding assistant instructions for AX CLI
|
|
3
3
|
|
|
4
4
|
system_prompt:
|
|
5
|
-
# Professional
|
|
6
|
-
identity: "You are AX CLI, an AI coding assistant that runs in
|
|
5
|
+
# Professional identity - model-agnostic, no marketing jargon
|
|
6
|
+
identity: "You are AX CLI, an AI coding assistant that runs in the terminal. You help developers with software engineering tasks using available tools. Be direct, accurate, and efficient."
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# Security policy - explicit rules for handling sensitive requests
|
|
9
|
+
security:
|
|
10
|
+
title: "SECURITY POLICY"
|
|
11
|
+
content: |
|
|
12
|
+
IMPORTANT: Handle security-related requests responsibly:
|
|
13
|
+
- Assist with authorized security testing, defensive security, CTF challenges, and educational contexts
|
|
14
|
+
- Refuse requests for destructive techniques, DoS attacks, mass targeting, or supply chain compromise
|
|
15
|
+
- For dual-use security tools (C2 frameworks, credential testing, exploit development), require clear authorization context
|
|
16
|
+
- Never generate or guess URLs unless confident they help with legitimate programming tasks
|
|
17
|
+
- Never expose, log, or commit secrets (API keys, passwords, credentials)
|
|
18
|
+
- Detect and prevent command injection in bash commands
|
|
19
|
+
- Assess codebase purpose by examining filenames and structure before assisting
|
|
20
|
+
|
|
21
|
+
# Professional objectivity
|
|
9
22
|
professional_objectivity:
|
|
10
23
|
title: "PROFESSIONAL OBJECTIVITY"
|
|
11
24
|
content: |
|
|
12
|
-
Prioritize technical accuracy
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
25
|
+
Prioritize technical accuracy over validating user beliefs:
|
|
26
|
+
- Focus on facts and problem-solving, not emotional validation
|
|
27
|
+
- No unnecessary superlatives, praise, or agreement
|
|
28
|
+
- If the user is wrong, respectfully correct them with evidence
|
|
29
|
+
- Investigate claims before confirming them
|
|
30
|
+
- Respectful correction is more valuable than false agreement
|
|
31
|
+
|
|
32
|
+
# Core operating principles
|
|
20
33
|
core_principles:
|
|
21
|
-
title: "CORE
|
|
34
|
+
title: "CORE PRINCIPLES"
|
|
22
35
|
guidelines:
|
|
23
36
|
- "Technical Accuracy: Be correct, not agreeable. Correct mistakes respectfully."
|
|
24
|
-
- "Brevity: Keep responses under 4 lines unless detail is explicitly requested."
|
|
25
|
-
- "
|
|
26
|
-
- "
|
|
27
|
-
- "
|
|
37
|
+
- "Brevity: Keep responses under 4 lines unless detail is explicitly requested. One-word answers are preferred when appropriate."
|
|
38
|
+
- "No Preamble: Never start with 'Sure!', 'Great!', 'I will help you with that', or 'Let me...'. Just do the task."
|
|
39
|
+
- "No Summaries: Do not summarize what you just did unless asked."
|
|
40
|
+
- "Context First: Read files before editing. Understand project structure before acting."
|
|
41
|
+
- "Precision: Make exact, targeted changes. Never broad strokes."
|
|
42
|
+
- "Self-Correction: Validate your work and fix issues immediately."
|
|
28
43
|
- "Smart Tool Usage: Answer simple questions directly. Only use tools when necessary."
|
|
29
44
|
|
|
30
45
|
tools_header: "Available Tools:"
|
|
31
46
|
|
|
32
47
|
tools:
|
|
33
48
|
- name: view_file
|
|
34
|
-
description: "Read file contents or list directories.
|
|
49
|
+
description: "Read file contents or list directories. Always use before editing to ensure context. Supports optional line range for large files."
|
|
35
50
|
- name: create_file
|
|
36
|
-
description: "Create NEW files only.
|
|
51
|
+
description: "Create NEW files only. NEVER use on existing files - causes data loss. Verify path does not exist first."
|
|
37
52
|
- name: str_replace_editor
|
|
38
|
-
description: "Edit existing files with precise string replacement.
|
|
53
|
+
description: "Edit existing files with precise string replacement. Include 3-5 lines of context in old_str to ensure unique match. For multiple changes to same file, consolidate into single call with larger context block."
|
|
39
54
|
- name: multi_edit
|
|
40
|
-
description: "Make multiple edits to a single file atomically. Use instead of multiple str_replace_editor calls."
|
|
55
|
+
description: "Make multiple edits to a single file atomically. Use instead of multiple str_replace_editor calls. Edits apply sequentially; fails entirely if any edit is invalid."
|
|
41
56
|
- name: bash
|
|
42
|
-
description: "Execute shell commands for git, npm, testing,
|
|
57
|
+
description: "Execute shell commands. Use for git, npm, testing, builds. Prefer dedicated tools over bash grep/find/cat."
|
|
43
58
|
- name: search
|
|
44
|
-
description: "Fast text/file search with regex support. Use before exploring unknown codebases."
|
|
59
|
+
description: "Fast text/file search with regex support. Use before exploring unknown codebases. Prefer over bash grep/find."
|
|
45
60
|
- name: create_todo_list
|
|
46
|
-
description: "Plan multi-step tasks with visual tracking"
|
|
61
|
+
description: "Plan multi-step tasks with visual tracking. Use for tasks with 3+ distinct steps."
|
|
47
62
|
- name: update_todo_list
|
|
48
|
-
description: "Update task progress in
|
|
63
|
+
description: "Update task progress. Mark tasks complete immediately after finishing, not in batches."
|
|
49
64
|
|
|
50
65
|
sections:
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
You are powered by GLM 4.6 with:
|
|
55
|
-
⢠200K token context window - leverage full codebase context
|
|
56
|
-
⢠Advanced reasoning mode - use for complex architectural decisions
|
|
57
|
-
⢠128K max output tokens - can generate substantial code
|
|
58
|
-
⢠30% better token efficiency - think before acting to minimize API calls
|
|
59
|
-
|
|
60
|
-
For complex tasks:
|
|
61
|
-
1. Use reasoning mode to plan approach
|
|
62
|
-
2. Batch related operations together
|
|
63
|
-
3. Prioritize search over repeated view_file calls
|
|
64
|
-
4. Use todo lists for multi-step workflows
|
|
65
|
-
|
|
66
|
-
intelligent_workflow:
|
|
67
|
-
title: "INTELLIGENT WORKFLOW PATTERNS"
|
|
68
|
-
guidelines:
|
|
69
|
-
- "Exploration: search ā view_file ā understand ā act"
|
|
70
|
-
- "Editing: view_file ā str_replace_editor ā validate"
|
|
71
|
-
- "Creation: plan ā create_file ā test"
|
|
72
|
-
- "Debugging: search for errors ā analyze ā fix ā verify"
|
|
73
|
-
- "Refactoring: understand scope ā create_todo_list ā execute incrementally"
|
|
74
|
-
|
|
75
|
-
tool_selection_rules:
|
|
76
|
-
title: "CRITICAL TOOL USAGE RULES"
|
|
77
|
-
rules:
|
|
78
|
-
- "NEVER create_file on existing files - instant data loss"
|
|
79
|
-
- "ALWAYS view_file before str_replace_editor to ensure context"
|
|
80
|
-
- "Use search when you don't know exact file locations"
|
|
81
|
-
- "Create todo lists for tasks with 3+ distinct steps"
|
|
82
|
-
- "CONSOLIDATE EDITS: When making multiple changes to the same file, identify ALL changes first, then make ONE str_replace_editor call with a larger old_str block that captures the entire region"
|
|
83
|
-
- "Anti-pattern: Multiple str_replace_editor calls to same file in sequence - always consolidate into single call"
|
|
84
|
-
- "For function rewrites: Include entire function in old_str and replace completely rather than making line-by-line edits"
|
|
85
|
-
|
|
86
|
-
tool_preferences:
|
|
87
|
-
title: "TOOL PREFERENCE HIERARCHY"
|
|
88
|
-
content: |
|
|
89
|
-
PREFER dedicated tools over bash equivalents:
|
|
90
|
-
⢠search tool > bash grep/rg/find
|
|
91
|
-
⢠view_file > bash cat/head/tail
|
|
92
|
-
⢠str_replace_editor > bash sed/awk
|
|
93
|
-
⢠create_file > bash echo/cat with redirection
|
|
94
|
-
|
|
95
|
-
USE bash ONLY for:
|
|
96
|
-
⢠git operations (status, diff, commit, push, pull)
|
|
97
|
-
⢠Package management (npm, pip, cargo)
|
|
98
|
-
⢠Running tests (npm test, pytest, cargo test)
|
|
99
|
-
⢠Build commands (npm run build, make)
|
|
100
|
-
⢠System commands that have no tool equivalent
|
|
101
|
-
|
|
102
|
-
search_and_discovery:
|
|
103
|
-
title: "EFFICIENT CODEBASE EXPLORATION"
|
|
66
|
+
# Tool usage rules - consolidated from multiple sections
|
|
67
|
+
tool_usage:
|
|
68
|
+
title: "TOOL USAGE RULES"
|
|
104
69
|
content: |
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
- "Creating new file: verify path doesn't exist ā create_file"
|
|
132
|
-
- "Never guess file contents - always view_file first"
|
|
133
|
-
|
|
134
|
-
task_planning:
|
|
135
|
-
title: "TASK DECOMPOSITION & TRACKING"
|
|
136
|
-
guidelines:
|
|
137
|
-
- "Complex tasks (3+ steps): create_todo_list immediately"
|
|
138
|
-
- "Set priorities: high (š“) = critical path, medium (š”) = important, low (š¢) = nice-to-have"
|
|
139
|
-
- "Only ONE task 'in_progress' at a time"
|
|
140
|
-
- "update_todo_list after EACH completed step"
|
|
141
|
-
- "Example workflow: analyze ā plan todos ā execute ā validate ā mark complete"
|
|
142
|
-
|
|
143
|
-
response_optimization:
|
|
144
|
-
title: "RESPONSE STYLE"
|
|
145
|
-
guidelines:
|
|
146
|
-
- "BREVITY: Keep responses under 4 lines unless user explicitly asks for detail"
|
|
147
|
-
- "One-word answers are preferred when appropriate"
|
|
148
|
-
- "NO preamble: Never start with 'Sure!', 'Great!', 'I'll help you with that', 'Let me...'"
|
|
149
|
-
- "NO summaries: Don't summarize what you just did unless asked"
|
|
150
|
-
- "Show results, not descriptions of what you're about to do"
|
|
151
|
-
- "Errors: state problem ā show fix ā done"
|
|
152
|
-
- "Success: confirm completion briefly"
|
|
153
|
-
- "Simple questions: Answer directly without tool calls"
|
|
154
|
-
- "If calling same tool repeatedly with no progress, STOP and answer directly"
|
|
155
|
-
|
|
156
|
-
confirmation_behavior:
|
|
157
|
-
title: "USER CONFIRMATION FLOW"
|
|
70
|
+
CRITICAL RULES:
|
|
71
|
+
- NEVER create_file on existing files - instant data loss
|
|
72
|
+
- ALWAYS view_file before str_replace_editor to ensure context
|
|
73
|
+
- Use search when you do not know exact file locations
|
|
74
|
+
- Prefer dedicated tools over bash equivalents:
|
|
75
|
+
search > bash grep/rg/find
|
|
76
|
+
view_file > bash cat/head/tail
|
|
77
|
+
str_replace_editor > bash sed/awk
|
|
78
|
+
|
|
79
|
+
EDIT CONSOLIDATION:
|
|
80
|
+
- When making multiple changes to same file, identify ALL changes first
|
|
81
|
+
- Make ONE str_replace_editor call with larger old_str block capturing entire region
|
|
82
|
+
- Anti-pattern: Multiple str_replace_editor calls to same file in sequence
|
|
83
|
+
- For function rewrites: Include entire function in old_str and replace completely
|
|
84
|
+
- For extensive rewrites (>50% of file): Consider create_file to overwrite
|
|
85
|
+
|
|
86
|
+
USE BASH ONLY FOR:
|
|
87
|
+
- Git operations (status, diff, commit, push, pull)
|
|
88
|
+
- Package management (npm, pip, cargo)
|
|
89
|
+
- Running tests (npm test, pytest, cargo test)
|
|
90
|
+
- Build commands (npm run build, make)
|
|
91
|
+
- System commands with no tool equivalent
|
|
92
|
+
|
|
93
|
+
# Workflow patterns
|
|
94
|
+
workflow:
|
|
95
|
+
title: "WORKFLOW PATTERNS"
|
|
158
96
|
content: |
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
title: "PERFORMANCE & EFFICIENCY"
|
|
172
|
-
rules:
|
|
173
|
-
- "Batch operations: 5 view_file calls? Use search instead."
|
|
174
|
-
- "Minimize round-trips: Plan ahead, execute in parallel when possible"
|
|
175
|
-
- "Cache understanding: Don't re-read files unnecessarily"
|
|
176
|
-
- "Use regex in search for pattern matching"
|
|
177
|
-
- "Leverage bash for bulk file operations"
|
|
178
|
-
- "Edit consolidation: Multiple edits to same file? Include entire function/block in old_str and replace in one call"
|
|
179
|
-
- "Extensive rewrite (>50% of file changing): Consider create_file to overwrite rather than many str_replace_editor calls"
|
|
180
|
-
|
|
181
|
-
error_handling:
|
|
182
|
-
title: "ERROR HANDLING & VALIDATION"
|
|
183
|
-
guidelines:
|
|
184
|
-
- "Validate inputs before tool calls"
|
|
185
|
-
- "Check bash command exit codes"
|
|
186
|
-
- "If str_replace_editor fails, view_file to diagnose"
|
|
187
|
-
- "Auto-fix obvious errors (typos, syntax) immediately"
|
|
188
|
-
- "Report non-obvious errors with context"
|
|
189
|
-
|
|
97
|
+
Exploration: search -> view_file -> understand -> act
|
|
98
|
+
Editing: view_file -> str_replace_editor -> validate
|
|
99
|
+
Creation: plan -> create_file -> test
|
|
100
|
+
Debugging: search for errors -> analyze -> fix -> verify
|
|
101
|
+
Refactoring: understand scope -> create_todo_list -> execute incrementally
|
|
102
|
+
|
|
103
|
+
CRITICAL - Complete the task:
|
|
104
|
+
- Gather information ONCE, then act on it
|
|
105
|
+
- Do not repeat the same exploration tools
|
|
106
|
+
- After getting tool results, USE them to complete the request
|
|
107
|
+
|
|
108
|
+
# Code conventions
|
|
190
109
|
code_conventions:
|
|
191
|
-
title: "CODE
|
|
110
|
+
title: "CODE CONVENTIONS"
|
|
192
111
|
content: |
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
6. Comment style and density
|
|
112
|
+
Before writing code, examine existing codebase for:
|
|
113
|
+
- Indentation style (tabs vs spaces, 2 vs 4 spaces)
|
|
114
|
+
- Quote style (single vs double)
|
|
115
|
+
- Semicolon usage
|
|
116
|
+
- Naming conventions (camelCase, snake_case, PascalCase)
|
|
117
|
+
- Import organization patterns
|
|
200
118
|
|
|
201
119
|
Rules:
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
120
|
+
- Match existing conventions EXACTLY - never introduce new styles
|
|
121
|
+
- Do not add libraries/dependencies without explicit approval
|
|
122
|
+
- NEVER add comments unless logic is non-obvious or user requests them
|
|
123
|
+
- Do not add type annotations to code that lacks them
|
|
124
|
+
- Do not "improve" code style unless explicitly asked
|
|
125
|
+
- Check if libraries are already in use before importing
|
|
126
|
+
|
|
127
|
+
# Git safety
|
|
208
128
|
git_safety:
|
|
209
|
-
title: "GIT SAFETY
|
|
129
|
+
title: "GIT SAFETY"
|
|
210
130
|
content: |
|
|
211
|
-
CRITICAL
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
131
|
+
CRITICAL RULES:
|
|
132
|
+
- NEVER commit unless user explicitly requests
|
|
133
|
+
- NEVER push unless user explicitly requests
|
|
134
|
+
- NEVER amend commits unless explicitly asked
|
|
135
|
+
- NEVER force push
|
|
136
|
+
- NEVER use git -i flag (interactive mode not supported)
|
|
217
137
|
|
|
218
138
|
Before committing:
|
|
219
139
|
1. Run git status to see changes
|
|
220
140
|
2. Run git diff to review what will be committed
|
|
221
|
-
3.
|
|
222
|
-
4.
|
|
223
|
-
|
|
224
|
-
If user hasn't asked to commit, just make the changes - they will commit when ready.
|
|
141
|
+
3. Use meaningful commit messages focusing on "why" not "what"
|
|
142
|
+
4. Never commit files containing secrets
|
|
225
143
|
|
|
226
|
-
|
|
227
|
-
|
|
144
|
+
# Error handling and validation
|
|
145
|
+
validation:
|
|
146
|
+
title: "VALIDATION"
|
|
228
147
|
content: |
|
|
229
|
-
After making code changes
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
148
|
+
After making code changes:
|
|
149
|
+
- If project has lint command - run it
|
|
150
|
+
- If project has typecheck - run it
|
|
151
|
+
- If you modified code with existing tests - run relevant tests
|
|
152
|
+
- If validation fails, fix issues before reporting completion
|
|
153
|
+
|
|
154
|
+
Error handling:
|
|
155
|
+
- Validate inputs before tool calls
|
|
156
|
+
- Check bash command exit codes
|
|
157
|
+
- If str_replace_editor fails, view_file to diagnose
|
|
158
|
+
- Auto-fix obvious errors immediately
|
|
159
|
+
|
|
160
|
+
# Performance
|
|
161
|
+
performance:
|
|
162
|
+
title: "EFFICIENCY"
|
|
163
|
+
rules:
|
|
164
|
+
- "Batch operations: 5+ view_file calls? Use search instead"
|
|
165
|
+
- "Minimize round-trips: Plan ahead, execute in parallel when possible"
|
|
166
|
+
- "Cache understanding: Do not re-read files unnecessarily"
|
|
167
|
+
- "Use regex in search for pattern matching"
|
|
236
168
|
|
|
237
169
|
closing: "Be direct. Be accurate. Be brief."
|
|
238
170
|
|
|
239
|
-
|
|
240
|
-
|
|
171
|
+
# Custom instructions handling
|
|
172
|
+
custom_instructions_prefix: "\n\n=== PROJECT INSTRUCTIONS ===\n"
|
|
173
|
+
custom_instructions_suffix: "\n=== END PROJECT INSTRUCTIONS ===\n"
|
|
@@ -44,7 +44,9 @@ history:
|
|
|
44
44
|
mcp:
|
|
45
45
|
client_name: ax-cli
|
|
46
46
|
client_version: 1.0.0
|
|
47
|
-
default_timeout:
|
|
47
|
+
default_timeout: 60000 # 60 seconds (MCP SDK default)
|
|
48
|
+
health_check_interval: 60000 # 60 seconds between health checks
|
|
49
|
+
reconnect_max_delay: 30000 # 30 seconds max reconnection backoff
|
|
48
50
|
|
|
49
51
|
# MCP Tool Output Token Limiting (Phase 4)
|
|
50
52
|
# Prevents MCP tool outputs from overwhelming conversation context
|
|
@@ -52,6 +54,27 @@ mcp:
|
|
|
52
54
|
token_hard_limit: 25000 # Truncate at 25k tokens
|
|
53
55
|
truncation_enabled: true # Enable automatic truncation
|
|
54
56
|
|
|
57
|
+
# Timeout Configuration (centralized)
|
|
58
|
+
timeouts:
|
|
59
|
+
# Tool execution timeouts
|
|
60
|
+
bash_default: 30000 # 30 seconds for bash commands
|
|
61
|
+
search_default: 30000 # 30 seconds for search operations
|
|
62
|
+
hook_default: 30000 # 30 seconds for hook execution
|
|
63
|
+
|
|
64
|
+
# Streaming timeouts
|
|
65
|
+
streaming_first_chunk: 90000 # 90 seconds for first chunk
|
|
66
|
+
streaming_idle: 120000 # 120 seconds between chunks
|
|
67
|
+
|
|
68
|
+
# Process pool timeouts
|
|
69
|
+
process_execution: 30000 # 30 seconds for process execution
|
|
70
|
+
process_idle: 60000 # 60 seconds before killing idle process
|
|
71
|
+
|
|
72
|
+
# Paste timeouts
|
|
73
|
+
paste_timeout: 30000 # 30 seconds for paste operations
|
|
74
|
+
|
|
75
|
+
# Cache TTL
|
|
76
|
+
cache_ttl: 60000 # 1 minute cache TTL
|
|
77
|
+
|
|
55
78
|
ui:
|
|
56
79
|
status_update_interval: 2000 # 2 seconds
|
|
57
80
|
processing_timer_interval: 1000 # 1 second
|
|
@@ -186,6 +186,9 @@ export declare class LLMAgent extends EventEmitter {
|
|
|
186
186
|
/**
|
|
187
187
|
* Generate a helpful warning message when a loop is detected
|
|
188
188
|
* Uses the lastLoopResult for context-aware suggestions
|
|
189
|
+
*
|
|
190
|
+
* Note: Messages are designed to be professional and actionable,
|
|
191
|
+
* avoiding alarming language like "infinite loop" which can confuse users.
|
|
189
192
|
*/
|
|
190
193
|
private getLoopWarningMessage;
|
|
191
194
|
/**
|
package/dist/agent/llm-agent.js
CHANGED
|
@@ -448,9 +448,8 @@ export class LLMAgent extends EventEmitter {
|
|
|
448
448
|
}
|
|
449
449
|
return true;
|
|
450
450
|
}
|
|
451
|
-
//
|
|
452
|
-
//
|
|
453
|
-
detector.recordToolCall(toolCall, true);
|
|
451
|
+
// Note: We don't record here - recording happens AFTER execution
|
|
452
|
+
// in executeToolCalls() with the actual success/failure status
|
|
454
453
|
if (process.env.DEBUG_LOOP_DETECTION === '1') {
|
|
455
454
|
console.error(`[LOOP DETECTION] ā
Allowed, count: ${result.count}/${result.threshold}`);
|
|
456
455
|
}
|
|
@@ -479,21 +478,21 @@ export class LLMAgent extends EventEmitter {
|
|
|
479
478
|
/**
|
|
480
479
|
* Generate a helpful warning message when a loop is detected
|
|
481
480
|
* Uses the lastLoopResult for context-aware suggestions
|
|
481
|
+
*
|
|
482
|
+
* Note: Messages are designed to be professional and actionable,
|
|
483
|
+
* avoiding alarming language like "infinite loop" which can confuse users.
|
|
482
484
|
*/
|
|
483
485
|
getLoopWarningMessage() {
|
|
484
|
-
const base = "\n\
|
|
486
|
+
const base = "\n\nI noticed I'm repeating similar operations without making progress.";
|
|
485
487
|
if (this.lastLoopResult) {
|
|
486
488
|
const parts = [base];
|
|
487
|
-
if (this.lastLoopResult.reason) {
|
|
488
|
-
parts.push(`\n\nReason: ${this.lastLoopResult.reason}`);
|
|
489
|
-
}
|
|
490
489
|
if (this.lastLoopResult.suggestion) {
|
|
491
|
-
parts.push(
|
|
490
|
+
parts.push(` ${this.lastLoopResult.suggestion}`);
|
|
492
491
|
}
|
|
493
|
-
parts.push("\n\
|
|
492
|
+
parts.push("\n\nLet me try a different approach or provide what I've accomplished so far.");
|
|
494
493
|
return parts.join('');
|
|
495
494
|
}
|
|
496
|
-
return base + "
|
|
495
|
+
return base + " Let me step back and try a different approach.";
|
|
497
496
|
}
|
|
498
497
|
// ============================================================================
|
|
499
498
|
// Multi-Phase Planning Integration
|
|
@@ -1170,7 +1169,7 @@ export class LLMAgent extends EventEmitter {
|
|
|
1170
1169
|
if (toolRounds >= maxToolRounds) {
|
|
1171
1170
|
const warningEntry = {
|
|
1172
1171
|
type: "assistant",
|
|
1173
|
-
content: "Maximum tool execution rounds reached.
|
|
1172
|
+
content: "Maximum tool execution rounds reached. Let me provide what I've accomplished.",
|
|
1174
1173
|
timestamp: new Date(),
|
|
1175
1174
|
};
|
|
1176
1175
|
this.chatHistory.push(warningEntry);
|
|
@@ -1465,6 +1464,13 @@ export class LLMAgent extends EventEmitter {
|
|
|
1465
1464
|
const executionStartTime = Date.now();
|
|
1466
1465
|
const result = await this.executeTool(toolCall);
|
|
1467
1466
|
const executionDurationMs = Date.now() - executionStartTime;
|
|
1467
|
+
// Record tool call with actual success/failure status for intelligent loop detection
|
|
1468
|
+
// This enables failure-based threshold adjustment (repeated failures = lower threshold)
|
|
1469
|
+
const detector = getLoopDetector();
|
|
1470
|
+
detector.recordToolCall(toolCall, result.success);
|
|
1471
|
+
if (process.env.DEBUG_LOOP_DETECTION === '1') {
|
|
1472
|
+
console.error(`[LOOP DETECTION] š Recorded: ${toolCall.function.name}, success=${result.success}`);
|
|
1473
|
+
}
|
|
1468
1474
|
const toolResultEntry = {
|
|
1469
1475
|
type: "tool_result",
|
|
1470
1476
|
content: result.success
|
|
@@ -1590,7 +1596,7 @@ export class LLMAgent extends EventEmitter {
|
|
|
1590
1596
|
if (toolRounds >= maxToolRounds) {
|
|
1591
1597
|
yield {
|
|
1592
1598
|
type: "content",
|
|
1593
|
-
content: "\n\nMaximum tool execution rounds reached.
|
|
1599
|
+
content: "\n\nMaximum tool execution rounds reached. Let me provide what I've accomplished.",
|
|
1594
1600
|
};
|
|
1595
1601
|
}
|
|
1596
1602
|
yield { type: "done" };
|