nex-code 0.4.21 → 0.4.22

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 CHANGED
@@ -22,7 +22,7 @@
22
22
  <img src="https://img.shields.io/badge/Ollama_Cloud-supported-brightgreen.svg" alt="Ollama Cloud: supported">
23
23
  <img src="https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg" alt="Node >= 18">
24
24
  <img src="https://img.shields.io/badge/dependencies-2-green.svg" alt="Dependencies: 2">
25
- <img src="https://img.shields.io/badge/tests-3453-blue.svg" alt="Tests: 3453">
25
+ <img src="https://img.shields.io/badge/tests-3719-blue.svg" alt="Tests: 3719">
26
26
  <img src="https://img.shields.io/badge/VS_Code-extension-007ACC.svg" alt="VS Code extension">
27
27
  </p>
28
28
 
@@ -123,6 +123,10 @@ The verify phase catches incomplete work before reporting "done" — if tests fa
123
123
 
124
124
  **Lightweight.** 2 runtime dependencies (`axios`, `dotenv`). Starts in ~100ms. No Python, no heavy runtime, no daemon process.
125
125
 
126
+ **Server-aware from the first message.** When your prompt contains a URL whose domain matches a configured SSH profile (e.g. `jarvis.example.com` → profile `jarvis`), nex-code probes the server before responding — listing ports, running processes, and data directories. The model receives this topology before its first token, so it goes straight to `ssh_exec` instead of reading local files.
127
+
128
+ **Few-shot behavior injection.** On each session start, nex-code injects a short example of the correct tool sequence for the detected task type (sysadmin → check remote logs first; coding → read file before editing; data → explain before rewriting). Works across all models without fine-tuning. Customize with your own high-scoring sessions via `npm run extract-examples`.
129
+
126
130
  **Infrastructure tools built in:**
127
131
 
128
132
  - SSH server management (AlmaLinux, macOS, any Linux)
@@ -143,7 +147,7 @@ The verify phase catches incomplete work before reporting "done" — if tests fa
143
147
 
144
148
  **Extensible.** Plugin API (`registerTool` + lifecycle hooks), skill system (install from any git URL), MCP server support.
145
149
 
146
- **Tested.** 3453 tests, 79% coverage, CI on every push.
150
+ **Tested.** 3719 tests, 83% coverage, CI on every push.
147
151
 
148
152
  ---
149
153
 
@@ -469,6 +473,8 @@ Fallback chains let you auto-switch when a provider fails:
469
473
  /fallback anthropic,openai,local
470
474
  ```
471
475
 
476
+ **Wire Protocol Layer:** All 5 providers share 3 wire protocol implementations (OpenAI-compatible SSE, Anthropic Messages SSE, Ollama NDJSON). Stream parsing, tool call accumulation, and response normalization are handled by reusable `StreamParser` classes — eliminating duplicated protocol code across providers.
477
+
472
478
  ---
473
479
 
474
480
  ## Commands
@@ -491,6 +497,12 @@ Type `/` to see inline suggestions as you type. Tab completion is supported for
491
497
  | `/load <name>` | Load a saved session |
492
498
  | `/sessions` | List saved sessions |
493
499
  | `/resume` | Resume last session |
500
+ | `/branches` | Show session tree (all conversation branches) |
501
+ | `/timeline [n]` | Show message timeline of current branch |
502
+ | `/goto <index>` | Jump to a message index (truncates later messages) |
503
+ | `/fork [index] [name]` | Create a new branch at the given message index |
504
+ | `/switch-branch <name>` | Switch to a different conversation branch |
505
+ | `/delete-branch <name>` | Delete a conversation branch |
494
506
  | `/remember <text>` | Save a memory (persists across sessions) |
495
507
  | `/forget <key>` | Delete a memory |
496
508
  | `/memory` | Show all memories |
@@ -878,6 +890,37 @@ Only sessions from the last 24 hours are offered for auto-resume. Older autosave
878
890
 
879
891
  Sessions are stored in `.nex/sessions/` as JSON files. Auto-saves always write to `_autosave` (overwritten each turn). Writes are atomic — a temp file is written and renamed, so a crash mid-write never corrupts the saved state.
880
892
 
893
+ ### Session Trees
894
+
895
+ Navigate your conversation history like git branches. Fork at any point, explore alternative approaches, and switch between branches:
896
+
897
+ ```
898
+ /timeline # see message indices
899
+ /fork 5 experiment # branch from message 5
900
+ /branches # see all branches
901
+ /switch-branch main # go back to main
902
+ /goto 3 # jump to message 3 (truncates later messages)
903
+ /delete-branch experiment
904
+ ```
905
+
906
+ This enables non-linear conversations: try an approach, and if it doesn't work, fork from an earlier point and try something different — without losing the original attempt.
907
+
908
+ ### Autoresearch
909
+
910
+ Autonomous optimization loops inspired by Karpathy's autoresearch pattern. The agent edits code, runs experiments, logs results, and automatically keeps improvements or reverts failures:
911
+
912
+ ```
913
+ /autoresearch reduce test runtime while maintaining correctness
914
+ /autoresearch optimize bundle size under 500kb
915
+ ```
916
+
917
+ The agent follows a repeating cycle: **checkpoint** (git) -> **edit** -> **run experiment** -> **log result** -> **keep or revert**. All experiments are logged to `.nex/autoresearch/experiments.json` with metrics and trend tracking.
918
+
919
+ ```
920
+ /ar-status # show experiment history with trends
921
+ /ar-clear # reset experiment history
922
+ ```
923
+
881
924
  ### Memory
882
925
 
883
926
  Persistent project memory that survives across sessions:
@@ -1607,10 +1650,12 @@ npm test # Run all tests with coverage
1607
1650
  npm run test:watch # Watch mode
1608
1651
  ```
1609
1652
 
1610
- 83 test suites, 3453 tests, 79% statement / 71% branch coverage.
1653
+ 91 test suites, 3719 tests, 83% statement / 74% branch coverage.
1611
1654
 
1612
1655
  CI runs on GitHub Actions (Node 20 LTS).
1613
1656
 
1657
+ **Type checking:** `npm run typecheck` runs TypeScript in `noEmit` mode with `allowJs`. Core type definitions live in `types/index.d.ts` (Message, ToolCall, IProvider, IWireProtocol, Session, Skill, etc.). The codebase uses incremental TypeScript adoption — new modules can be written in `.ts` while existing `.js` files are gradually migrated.
1658
+
1614
1659
  ---
1615
1660
 
1616
1661
  ## Dependencies