@anh3d0nic/qwen-code-termux-ice 16.0.8 → 20.0.0
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 +192 -101
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,147 +1,238 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Qwen Code ICE v20
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Termux-optimized Qwen Code CLI with ICE (Intelligent Compounding Environment) — pattern learning, quality scoring, and session persistence.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install -g @anh3d0nic/qwen-code-termux-ice
|
|
8
|
+
npm install -g @anh3d0nic/qwen-code-termux-ice
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Quick Start
|
|
12
12
|
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
→ ConfidenceGating.assess() — decide response mode
|
|
17
|
-
→ ActiveContextEngine.update() — add context block
|
|
18
|
-
→ [generate response based on intent]
|
|
19
|
-
→ SelfCritiqueLoop.process() — 7 questions, attack, fix
|
|
20
|
-
→ CodeQualityGate.check() — if code in response
|
|
21
|
-
→ AutoRunLoop.exec() — if code block found, run it (3 retries)
|
|
22
|
-
→ DomainMemory.addPattern() — learn from this interaction
|
|
23
|
-
→ send final response
|
|
24
|
-
```
|
|
13
|
+
```bash
|
|
14
|
+
# Interactive mode
|
|
15
|
+
qwen-ice
|
|
25
16
|
|
|
26
|
-
|
|
17
|
+
# Single query
|
|
18
|
+
qwen-ice "fix sudo error"
|
|
27
19
|
|
|
28
|
-
|
|
20
|
+
# YOLO mode (auto-approve actions)
|
|
21
|
+
qwen-ice -y "npm install"
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
ice
|
|
23
|
+
# Check version
|
|
24
|
+
qwen-ice --version
|
|
32
25
|
```
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
## CLI Commands
|
|
28
|
+
|
|
29
|
+
### bin/qwen-ice
|
|
30
|
+
|
|
31
|
+
| Command | Description |
|
|
32
|
+
|---------|-------------|
|
|
33
|
+
| `qwen-ice` | Interactive mode |
|
|
34
|
+
| `qwen-ice "query"` | Single query |
|
|
35
|
+
| `qwen-ice --version` | Show version |
|
|
36
|
+
| `qwen-ice --help` | Show help |
|
|
37
|
+
| `qwen-ice --status` | Show pipeline status |
|
|
38
|
+
| `qwen-ice -y "query"` | YOLO mode (auto-approve) |
|
|
39
|
+
| `qwen-ice --model groq` | Use specific model |
|
|
40
|
+
| `qwen-ice api-setup` | Configure API keys |
|
|
41
|
+
| `qwen-ice reset` | Clear memory (keep API keys) |
|
|
42
|
+
| `qwen-ice uninstall` | Clean uninstall |
|
|
43
|
+
|
|
44
|
+
### bin/qwen-ice-api-setup
|
|
45
|
+
|
|
46
|
+
Interactive API key manager:
|
|
47
|
+
- Add/view/remove API keys
|
|
48
|
+
- Test API connectivity
|
|
49
|
+
- Configure fallback order
|
|
43
50
|
|
|
44
|
-
|
|
45
|
-
- If auto-run fails 3 times: Adds warning to response
|
|
46
|
-
- If confidence <60%: Shows UNCERTAIN level
|
|
47
|
-
- If no pattern match: Returns generic intent
|
|
51
|
+
## ICE Features (Implemented)
|
|
48
52
|
|
|
49
|
-
###
|
|
53
|
+
### 1. Pattern Prevention (`preventPatterns`)
|
|
50
54
|
|
|
55
|
+
Automatically fixes Termux-incompatible commands before execution:
|
|
56
|
+
|
|
57
|
+
- Strips `sudo` (not available in Termux)
|
|
58
|
+
- Replaces `/usr/bin/` → `$PREFIX/bin/`
|
|
59
|
+
- Replaces `apt-get` → `pkg`
|
|
60
|
+
|
|
61
|
+
**Example:**
|
|
51
62
|
```bash
|
|
52
|
-
ice
|
|
63
|
+
qwen-ice "sudo apt-get install python"
|
|
64
|
+
# Auto-converts to: "pkg install python"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 2. Intent Analysis (`analyzeIntent`)
|
|
68
|
+
|
|
69
|
+
Decodes user intent at three levels:
|
|
70
|
+
- **Surface**: What was typed
|
|
71
|
+
- **Real**: What user needs
|
|
72
|
+
- **Deep**: Underlying goal
|
|
73
|
+
|
|
74
|
+
**Output:**
|
|
75
|
+
```
|
|
76
|
+
🎯 Intent: "fix error" → working solution → stable production code
|
|
53
77
|
```
|
|
54
78
|
|
|
55
|
-
|
|
79
|
+
### 3. Session Memory
|
|
56
80
|
|
|
57
|
-
|
|
81
|
+
Persists across sessions:
|
|
82
|
+
- `~/.qwen-ice/memory/session_memory.json` — Learned patterns
|
|
83
|
+
- `~/.qwen-ice/memory/quality_history.json` — Quality scores
|
|
84
|
+
- `~/.qwen-ice/memory/session_summary.json` — Session stats
|
|
58
85
|
|
|
59
|
-
###
|
|
86
|
+
### 4. Quality Scoring (`scoreResponse`)
|
|
60
87
|
|
|
61
|
-
|
|
62
|
-
|
|
88
|
+
Scores each response 1-10 based on:
|
|
89
|
+
- Code execution success (+3)
|
|
90
|
+
- Brevity under 200 tokens (+1)
|
|
91
|
+
- Termux compatibility (+1)
|
|
92
|
+
- Self-critique passed (+1)
|
|
93
|
+
|
|
94
|
+
**Output:**
|
|
95
|
+
```
|
|
96
|
+
📊 Quality Score: 9/10
|
|
63
97
|
```
|
|
64
98
|
|
|
65
|
-
|
|
99
|
+
### 5. Cold Start Welcome (`showColdStartWelcome`)
|
|
66
100
|
|
|
67
|
-
|
|
101
|
+
Shows session stats on startup:
|
|
102
|
+
```
|
|
103
|
+
❄️ Qwen Code ICE v20
|
|
104
|
+
📊 Last: 42 queries, 8.5/10 | 🧠 15 patterns
|
|
105
|
+
```
|
|
68
106
|
|
|
69
|
-
|
|
107
|
+
### 6. Session Summary (`saveSessionSummary`)
|
|
70
108
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
109
|
+
On exit, displays:
|
|
110
|
+
```
|
|
111
|
+
📊 SESSION SUMMARY
|
|
112
|
+
Total queries: 42
|
|
113
|
+
Avg quality: 8.5/10
|
|
114
|
+
Patterns learned: 15
|
|
115
|
+
Errors fixed: 8
|
|
116
|
+
Top intent: stable production code
|
|
117
|
+
```
|
|
78
118
|
|
|
79
|
-
##
|
|
119
|
+
## Directory Structure
|
|
80
120
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
121
|
+
After installation:
|
|
122
|
+
```
|
|
123
|
+
~/.qwen-ice/
|
|
124
|
+
├── bin/
|
|
125
|
+
│ ├── qwen-ice
|
|
126
|
+
│ └── qwen-ice-api-setup
|
|
127
|
+
├── core/
|
|
128
|
+
│ ├── ice-v13.js
|
|
129
|
+
│ ├── ice-v14.js
|
|
130
|
+
│ ├── ice-v15.js
|
|
131
|
+
│ ├── ice-v16.js
|
|
132
|
+
│ ├── install.js
|
|
133
|
+
│ └── uninstall.js
|
|
134
|
+
├── config/
|
|
135
|
+
│ ├── api-keys.json
|
|
136
|
+
│ └── settings.json
|
|
137
|
+
├── memory/
|
|
138
|
+
│ ├── session_memory.json
|
|
139
|
+
│ ├── quality_history.json
|
|
140
|
+
│ ├── confidence_history.json
|
|
141
|
+
│ └── session_summary.json
|
|
142
|
+
├── sessions/
|
|
143
|
+
└── logs/
|
|
144
|
+
├── errors.log
|
|
145
|
+
└── yolo.log
|
|
146
|
+
```
|
|
87
147
|
|
|
88
148
|
## Configuration Files
|
|
89
149
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
150
|
+
### ~/.qwen-ice/config/api-keys.json
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"keys": [
|
|
155
|
+
{
|
|
156
|
+
"id": "qwen-oauth",
|
|
157
|
+
"provider": "qwen",
|
|
158
|
+
"type": "oauth",
|
|
159
|
+
"model": "qwen3-coder-plus",
|
|
160
|
+
"active": true
|
|
161
|
+
}
|
|
162
|
+
],
|
|
163
|
+
"default_provider": "qwen",
|
|
164
|
+
"fallback_order": ["qwen", "gemini", "groq", "openai", "dashscope"]
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### ~/.qwen-ice/config/settings.json
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"version": "20.0.0",
|
|
173
|
+
"theme": "default",
|
|
174
|
+
"yolo_mode": false,
|
|
175
|
+
"auto_approve_commands": [],
|
|
176
|
+
"max_context_length": 8192,
|
|
177
|
+
"quality_threshold": 5
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## TypeScript CLI (packages/cli)
|
|
97
182
|
|
|
98
|
-
|
|
183
|
+
Built TypeScript version with ICE injection:
|
|
99
184
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
185
|
+
```bash
|
|
186
|
+
cd packages/cli
|
|
187
|
+
npm run build
|
|
188
|
+
node dist/index.js --version
|
|
189
|
+
# 17.0.0-ice
|
|
190
|
+
```
|
|
104
191
|
|
|
105
|
-
|
|
192
|
+
### ICE Injection Points
|
|
106
193
|
|
|
107
|
-
|
|
194
|
+
1. **Startup** — `showColdStartWelcome()`
|
|
195
|
+
2. **Pre-API** — `preventPatterns(input)`
|
|
196
|
+
3. **Pre-API** — `analyzeIntent(enhancedQuery)`
|
|
197
|
+
4. **Post-response** — ICE logging
|
|
198
|
+
5. **Exit** — `saveSessionSummary()`
|
|
108
199
|
|
|
109
|
-
|
|
110
|
-
- Found all 19 features from v11 were DISCONNECTED
|
|
111
|
-
- Each CLI case called ONE feature independently
|
|
112
|
-
- 7 features marked as DISCONNECTED (never in response flow)
|
|
200
|
+
## API Providers
|
|
113
201
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
202
|
+
| Provider | Default Model | Key Prefix |
|
|
203
|
+
|----------|---------------|------------|
|
|
204
|
+
| qwen (OAuth) | qwen3-coder-plus | N/A |
|
|
205
|
+
| groq | llama-3.1-70b-versatile | gsk_ |
|
|
206
|
+
| gemini | gemini-2.0-flash | AIza |
|
|
207
|
+
| openai | gpt-4o | sk- |
|
|
208
|
+
| dashscope | qwen-turbo | sk- |
|
|
118
209
|
|
|
119
|
-
|
|
120
|
-
- Discarded: hexToRgb, applyTheme, formatDesktopResponse, demo* functions
|
|
121
|
-
- Reason: Cosmetic only or replaced by pipeline
|
|
210
|
+
## Scripts
|
|
122
211
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
212
|
+
| Script | Purpose |
|
|
213
|
+
|--------|---------|
|
|
214
|
+
| `scripts/postinstall.cjs` | Auto-installs to ~/.qwen-ice |
|
|
215
|
+
| `scripts/api-caller.js` | Qwen/Gemini/Groq API client |
|
|
216
|
+
| `core/install.js` | Postinstall script |
|
|
217
|
+
| `core/uninstall.js` | Preuninstall script |
|
|
126
218
|
|
|
127
|
-
|
|
128
|
-
- New `AutoRunLoop` class
|
|
129
|
-
- Extracts code blocks, runs with execSync()
|
|
130
|
-
- 3 retries on failure
|
|
131
|
-
- Adds warning if all retries fail
|
|
219
|
+
## Termux Compatibility
|
|
132
220
|
|
|
133
|
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
137
|
-
-
|
|
221
|
+
All commands are Termux-aware:
|
|
222
|
+
- No sudo/root required
|
|
223
|
+
- Uses `pkg` instead of `apt-get`
|
|
224
|
+
- Paths use `$PREFIX` (`/data/data/com.termux/files/usr`)
|
|
225
|
+
- ARM64 architecture only
|
|
138
226
|
|
|
139
|
-
|
|
227
|
+
## Uninstall
|
|
140
228
|
|
|
141
|
-
|
|
229
|
+
```bash
|
|
230
|
+
qwen-ice uninstall
|
|
231
|
+
# Or manually:
|
|
232
|
+
npm uninstall -g @anh3d0nic/qwen-code-termux-ice
|
|
233
|
+
rm -rf ~/.qwen-ice
|
|
234
|
+
```
|
|
142
235
|
|
|
143
|
-
##
|
|
236
|
+
## License
|
|
144
237
|
|
|
145
|
-
|
|
146
|
-
- **npm:** https://www.npmjs.com/package/@anh3d0nic/qwen-code-termux-ice
|
|
147
|
-
- **Manifest:** `~/.qwen/v12_manifest.json`
|
|
238
|
+
MIT
|