nex-code 0.3.7 โ†’ 0.3.9

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 (3) hide show
  1. package/README.md +37 -7
  2. package/dist/nex-code.js +276 -271
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
  <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License: MIT"></a>
19
19
  <img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg" alt="Node >= 18">
20
20
  <img src="https://img.shields.io/badge/dependencies-2-green.svg" alt="Dependencies: 2">
21
- <img src="https://img.shields.io/badge/tests-1783-blue.svg" alt="Tests: 1783">
21
+ <img src="https://img.shields.io/badge/tests-1752-blue.svg" alt="Tests: 1752">
22
22
  </p>
23
23
 
24
24
  ---
@@ -52,7 +52,7 @@ That's it. You'll see the banner, your project context, and the `>` prompt. Star
52
52
  Nex Code automatically checks for new versions when you start it. If a newer version is available, you'll see a notification with instructions on how to update:
53
53
 
54
54
  ```
55
- ๐Ÿ’ก New version available! Run npm update -g nex-code to upgrade from 0.3.4 to 0.3.5
55
+ ๐Ÿ’ก New version available! Run npm update -g nex-code to upgrade from x.x.x to x.x.x
56
56
  ```
57
57
 
58
58
  To update to the latest version:
@@ -70,7 +70,7 @@ npm update -g nex-code
70
70
  | **Multi-provider** | 5 providers, swap at runtime | Multi-provider | Multi-provider |
71
71
  | **Free local models** | Ollama (no API key) | Ollama | โ€” |
72
72
  | **Runtime dependencies** | 2 (axios, dotenv) | Heavy | Electron |
73
- | **Test coverage** | 1783 tests, 90% coverage | โ€” | โ€” |
73
+ | **Test coverage** | 1752 tests, 85% coverage | โ€” | โ€” |
74
74
  | **Tool tiers** | Auto-adapts tools per model | Fixed | Fixed |
75
75
  | **No lock-in** | `/model openai:gpt-4o` โ†” `/model local:llama3` | Config change | Config change |
76
76
 
@@ -112,7 +112,7 @@ Create a `.env` file in your project directory (or set environment variables):
112
112
 
113
113
  ```bash
114
114
  # Pick any โ€” only one is required
115
- OLLAMA_API_KEY=your-key # Ollama Cloud (Qwen3 Coder, DeepSeek R1, Devstral, Kimi K2.5, Llama 4, MiniMax M2.5, GLM 4.7)
115
+ OLLAMA_API_KEY=your-key # Ollama Cloud (Qwen3 Coder, Qwen3.5, DeepSeek R1, Devstral, Kimi K2.5, Llama 4, MiniMax M2.5, GLM 4.7)
116
116
  OPENAI_API_KEY=your-key # OpenAI (GPT-4o, GPT-4.1, o1, o3, o4-mini)
117
117
  ANTHROPIC_API_KEY=your-key # Anthropic (Claude Sonnet 4.6, Opus 4.6, Haiku 4.5)
118
118
  GEMINI_API_KEY=your-key # Google Gemini (3.1 Pro Preview, 2.5 Pro/Flash, 2.0 Flash)
@@ -209,7 +209,7 @@ Switch providers and models at runtime:
209
209
 
210
210
  | Provider | Models | Env Variable |
211
211
  |----------|--------|-------------|
212
- | **ollama** | Qwen3 Coder, DeepSeek R1, Devstral, Kimi K2.5, MiniMax M2.5, GLM 4.7, Llama 4 | `OLLAMA_API_KEY` |
212
+ | **ollama** | Qwen3 Coder, Qwen3.5 (397B, 122B-A10B, 35B-A3B, 27B, 9B, 4B, 2B, 0.8B), DeepSeek R1, Devstral, Kimi K2.5, MiniMax M2.5, GLM 4.7, Llama 4 | `OLLAMA_API_KEY` |
213
213
  | **openai** | GPT-4o, GPT-4.1, o1, o3, o4-mini | `OPENAI_API_KEY` |
214
214
  | **anthropic** | Claude Sonnet 4.6, Opus 4.6, Haiku 4.5, Sonnet 4.5, Sonnet 4 | `ANTHROPIC_API_KEY` |
215
215
  | **gemini** | Gemini 3.1 Pro Preview, 2.5 Pro/Flash, 1.5 Pro/Flash | `GEMINI_API_KEY` |
@@ -331,7 +331,8 @@ Pressing Ctrl+C during a running request immediately cancels the active HTTP str
331
331
  - An `AbortController` signal flows from the SIGINT handler through the agent loop to the provider's HTTP request
332
332
  - All providers (Ollama, OpenAI, Anthropic, Gemini, local) destroy the response stream on abort
333
333
  - No EPIPE errors after cancellation (stdout writes are EPIPE-guarded)
334
- - 3x rapid Ctrl+C force-exits the process
334
+ - 2x Ctrl+C during processing force-exits the process
335
+ - At the idle prompt: first Ctrl+C shows `(Press Ctrl+C again to exit)`, second Ctrl+C exits (hint resets after 2 s)
335
336
 
336
337
  ### Diff Preview
337
338
  Every file change is shown in a diff-style format before being applied:
@@ -496,6 +497,12 @@ Four features that make Nex Code significantly more reliable with open-source mo
496
497
  - **Edit auto-fix**: Close match (โ‰ค5% Levenshtein distance) in `edit_file`/`patch_file` is auto-applied instead of erroring. Stacks with fuzzy whitespace matching.
497
498
  - **Bash error hints**: Enriches error output with actionable hints โ€” "command not found" โ†’ install suggestion, `MODULE_NOT_FOUND` โ†’ `npm install <pkg>`, port in use, syntax errors, TypeScript errors, test failures, and more.
498
499
 
500
+ **Stale Stream Recovery** โ€” Progressive retry strategy when streams stall (common with large Ollama models after many agent steps):
501
+ - 1st retry: 3s backoff delay, resend same context (handles transient stalls)
502
+ - 2nd retry: force-compress conversation (~80k tokens freed), 5s delay, retry with smaller context
503
+ - Last resort: if retries exhausted, one final force-compress + reset for fresh attempts
504
+ - Broader context-too-long detection catches Ollama-specific error formats (`num_ctx`, `prompt`, `size`, `exceeds`)
505
+
499
506
  **Tool Tiers** โ€” Dynamically reduces the tool set based on model capability:
500
507
  - **essential** (5 tools): bash, read_file, write_file, edit_file, list_directory
501
508
  - **standard** (13 tools): + search_files, glob, grep, ask_user, git_status, git_diff, git_log, task_list
@@ -704,6 +711,29 @@ Project-local configuration and state (gitignored):
704
711
 
705
712
  ---
706
713
 
714
+ ## Performance
715
+
716
+ Nex Code v0.3.7+ includes comprehensive performance optimizations:
717
+
718
+ | Optimization | Improvement | Impact |
719
+ |--------------|-------------|--------|
720
+ | **System Prompt Caching** | 4.3ร— faster | 77ยตs โ†’ 18ยตs |
721
+ | **Token Estimation Caching** | 3.5ร— faster | Cached after first call |
722
+ | **Context File Caching** | 10-20ร— faster | 50-200ms โ†’ 5-10ms |
723
+ | **Debounced Auto-Save** | 0ms in hot path | Saves after 5s inactivity |
724
+ | **Tool Filter Caching** | 1.7ร— faster | Cached per model |
725
+ | **Schema Cache** | 3.4ร— faster | 2.51ยตs โ†’ 0.73ยตs |
726
+
727
+ **Average speedup:** 2.7ร— (micro-benchmarks)
728
+ **Real-world improvement:** ~10ร— faster per turn
729
+
730
+ Run benchmarks yourself:
731
+ ```bash
732
+ node benchmark.js
733
+ ```
734
+
735
+ ---
736
+
707
737
  ## Testing
708
738
 
709
739
  ```bash
@@ -711,7 +741,7 @@ npm test # Run all tests with coverage
711
741
  npm run test:watch # Watch mode
712
742
  ```
713
743
 
714
- 43 test suites, 1783 tests, 90% statement / 83% branch coverage.
744
+ 44 test suites, 1752 tests, 85% statement / 79% branch coverage.
715
745
 
716
746
  CI runs on GitHub Actions (Node 18/20/22).
717
747