@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.
Files changed (2) hide show
  1. package/README.md +192 -101
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,147 +1,238 @@
1
- # @anh3d0nic/qwen-code-termux-ice v12.0.0
1
+ # Qwen Code ICE v20
2
2
 
3
- Unified Pipeline + Auto-Run Loop for Termux AI coding.
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@latest
8
+ npm install -g @anh3d0nic/qwen-code-termux-ice
9
9
  ```
10
10
 
11
- ## Pipeline Diagram
11
+ ## Quick Start
12
12
 
13
- ```
14
- userInput
15
- → IntentLadder.classify() — decode surface/real/deep intent
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
- ## Usage
17
+ # Single query
18
+ qwen-ice "fix sudo error"
27
19
 
28
- ### Run Unified Pipeline
20
+ # YOLO mode (auto-approve actions)
21
+ qwen-ice -y "npm install"
29
22
 
30
- ```bash
31
- ice-v12 "fix sudo error"
23
+ # Check version
24
+ qwen-ice --version
32
25
  ```
33
26
 
34
- **What happens:**
35
- 1. Analyzes intent (SURFACE/REAL/DEEP)
36
- 2. Assesses confidence level
37
- 3. Updates active context
38
- 4. Generates response
39
- 5. Self-critique (7 questions)
40
- 6. Code quality check (if code present)
41
- 7. Auto-run code (if code block present, 3 retries)
42
- 8. Saves pattern to domain memory
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
- **Failure behavior:**
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
- ### Parallel Task Splitter
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-v12 parallel "build login page"
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
- **What happens:** Detects 4 independent parts, executes via Promise.all()
79
+ ### 3. Session Memory
56
80
 
57
- **Failure behavior:** Returns atomic task if no parts detected
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
- ### Initialize Config
86
+ ### 4. Quality Scoring (`scoreResponse`)
60
87
 
61
- ```bash
62
- ice-v12 init
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
- **What happens:** Creates ~/.qwen/*.json config files
99
+ ### 5. Cold Start Welcome (`showColdStartWelcome`)
66
100
 
67
- **Failure behavior:** Creates directory if missing
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
- ## Self-Critique (7 Questions)
107
+ ### 6. Session Summary (`saveSessionSummary`)
70
108
 
71
- 1. What is wrong with this?
72
- 2. What did I miss?
73
- 3. Will this break on Termux?
74
- 4. Is this the shortest correct solution?
75
- 5. Am I answering what they actually want, not what they typed?
76
- 6. Does this have any hardcoded paths that break on mobile?
77
- 7. Would a senior dev approve this?
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
- ## Auto-Run Loop
119
+ ## Directory Structure
80
120
 
81
- When response contains code block:
82
- - Extracts code
83
- - Runs with `child_process.execSync()` (Termux paths)
84
- - If exit code != 0: Feeds error back, max 3 retries
85
- - Only sends response after code runs successfully
86
- - If all 3 retries fail: Adds explicit warning
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
- | File | Location | Created |
91
- |------|----------|---------|
92
- | Session | `~/.qwen/ice_session.json` | On first pipeline run |
93
- | Active Context | `~/.qwen/ice_active_context.json` | On first pipeline run |
94
- | Domain Memory | `~/.qwen/session_memory.json` | On first pipeline run |
95
- | Confidence History | `~/.qwen/confidence_history.json` | On first confidence gate |
96
- | Manifest | `~/.qwen/v12_manifest.json` | On `ice-v12 init` |
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
- ## Package Info
183
+ Built TypeScript version with ICE injection:
99
184
 
100
- - **Version:** 12.0.0
101
- - **License:** MIT
102
- - **Dependencies:** None
103
- - **Binaries:** qwen-code-ice, qwen-ice, ice-v12
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
- ## Changelog
192
+ ### ICE Injection Points
106
193
 
107
- ### v12.0.0 (2026-03-21)
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
- **STEP 1 — PIPELINE AUDIT**
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
- **STEP 2 WIRE THE PIPELINE**
115
- - Created `UnifiedPipeline` class
116
- - Connected: IntentLadder ConfidenceGating ActiveContext → Generate → SelfCritique → CodeQualityGate → AutoRunLoop → DomainMemory
117
- - All 10 core features now called in sequence
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
- **STEP 3 — REMOVE DEAD CODE**
120
- - Discarded: hexToRgb, applyTheme, formatDesktopResponse, demo* functions
121
- - Reason: Cosmetic only or replaced by pipeline
210
+ ## Scripts
122
211
 
123
- **STEP 4 STRENGTHEN SELF-CRITIQUE**
124
- - Expanded from 2 questions to 7 questions
125
- - Added: Termux compatibility, shortest solution, actual intent, hardcoded paths, senior dev approval
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
- **STEP 5 — ADD AUTO-RUN LOOP**
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
- **STEP 6 UPDATE MANIFEST**
134
- - Created v12_manifest.json
135
- - Removed dead code entries
136
- - Added pipeline diagram
137
- - Added auto-run loop entry
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
- ### v11.0.0 (2026-03-21)
227
+ ## Uninstall
140
228
 
141
- Complete audit - all 19 features preserved, no code changes from v10.0.0.
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
- ## Repository
236
+ ## License
144
237
 
145
- - **Source:** https://github.com/anh3d0nic/qwen-code-termux-ice
146
- - **npm:** https://www.npmjs.com/package/@anh3d0nic/qwen-code-termux-ice
147
- - **Manifest:** `~/.qwen/v12_manifest.json`
238
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anh3d0nic/qwen-code-termux-ice",
3
- "version": "16.0.8",
3
+ "version": "20.0.0",
4
4
  "description": "Qwen Code ICE v16.0.5 — Compounding Intelligence with proper npm install structure",
5
5
  "main": "core/ice-v16.js",
6
6
  "bin": {