nex-code 0.4.21 → 0.4.23

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
 
@@ -38,7 +38,9 @@
38
38
 
39
39
  ## Demo
40
40
 
41
- https://github.com/user-attachments/assets/6a70525c-a1a4-4c6f-9784-176cb1becc15
41
+
42
+
43
+ https://github.com/user-attachments/assets/68a6c134-2d13-4d66-bc5e-befea3acb794
42
44
 
43
45
  ---
44
46
 
@@ -123,6 +125,10 @@ The verify phase catches incomplete work before reporting "done" — if tests fa
123
125
 
124
126
  **Lightweight.** 2 runtime dependencies (`axios`, `dotenv`). Starts in ~100ms. No Python, no heavy runtime, no daemon process.
125
127
 
128
+ **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.
129
+
130
+ **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`.
131
+
126
132
  **Infrastructure tools built in:**
127
133
 
128
134
  - SSH server management (AlmaLinux, macOS, any Linux)
@@ -143,7 +149,7 @@ The verify phase catches incomplete work before reporting "done" — if tests fa
143
149
 
144
150
  **Extensible.** Plugin API (`registerTool` + lifecycle hooks), skill system (install from any git URL), MCP server support.
145
151
 
146
- **Tested.** 3453 tests, 79% coverage, CI on every push.
152
+ **Tested.** 3719 tests, 83% coverage, CI on every push.
147
153
 
148
154
  ---
149
155
 
@@ -469,6 +475,8 @@ Fallback chains let you auto-switch when a provider fails:
469
475
  /fallback anthropic,openai,local
470
476
  ```
471
477
 
478
+ **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.
479
+
472
480
  ---
473
481
 
474
482
  ## Commands
@@ -491,6 +499,12 @@ Type `/` to see inline suggestions as you type. Tab completion is supported for
491
499
  | `/load <name>` | Load a saved session |
492
500
  | `/sessions` | List saved sessions |
493
501
  | `/resume` | Resume last session |
502
+ | `/branches` | Show session tree (all conversation branches) |
503
+ | `/timeline [n]` | Show message timeline of current branch |
504
+ | `/goto <index>` | Jump to a message index (truncates later messages) |
505
+ | `/fork [index] [name]` | Create a new branch at the given message index |
506
+ | `/switch-branch <name>` | Switch to a different conversation branch |
507
+ | `/delete-branch <name>` | Delete a conversation branch |
494
508
  | `/remember <text>` | Save a memory (persists across sessions) |
495
509
  | `/forget <key>` | Delete a memory |
496
510
  | `/memory` | Show all memories |
@@ -878,6 +892,37 @@ Only sessions from the last 24 hours are offered for auto-resume. Older autosave
878
892
 
879
893
  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
894
 
895
+ ### Session Trees
896
+
897
+ Navigate your conversation history like git branches. Fork at any point, explore alternative approaches, and switch between branches:
898
+
899
+ ```
900
+ /timeline # see message indices
901
+ /fork 5 experiment # branch from message 5
902
+ /branches # see all branches
903
+ /switch-branch main # go back to main
904
+ /goto 3 # jump to message 3 (truncates later messages)
905
+ /delete-branch experiment
906
+ ```
907
+
908
+ 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.
909
+
910
+ ### Autoresearch
911
+
912
+ Autonomous optimization loops inspired by Karpathy's autoresearch pattern. The agent edits code, runs experiments, logs results, and automatically keeps improvements or reverts failures:
913
+
914
+ ```
915
+ /autoresearch reduce test runtime while maintaining correctness
916
+ /autoresearch optimize bundle size under 500kb
917
+ ```
918
+
919
+ 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.
920
+
921
+ ```
922
+ /ar-status # show experiment history with trends
923
+ /ar-clear # reset experiment history
924
+ ```
925
+
881
926
  ### Memory
882
927
 
883
928
  Persistent project memory that survives across sessions:
@@ -1607,10 +1652,12 @@ npm test # Run all tests with coverage
1607
1652
  npm run test:watch # Watch mode
1608
1653
  ```
1609
1654
 
1610
- 83 test suites, 3453 tests, 79% statement / 71% branch coverage.
1655
+ 91 test suites, 3719 tests, 83% statement / 74% branch coverage.
1611
1656
 
1612
1657
  CI runs on GitHub Actions (Node 20 LTS).
1613
1658
 
1659
+ **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.
1660
+
1614
1661
  ---
1615
1662
 
1616
1663
  ## Dependencies