@ruso-0/nreki 8.0.1 → 8.3.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 (3) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +44 -3
  3. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
  All notable changes to NREKI will be documented in this file.
4
4
 
5
+ ## 8.0.2 (2026-04-09) — Firewall Verification Test
6
+
7
+ ### Fixed (Test Coverage Gap)
8
+ - **Numerical Sanity Firewall regression test:** v8.0.1 introduced an 8-layer
9
+ defense in depth against IEEE 754 NaN/Infinity propagation in the spectral
10
+ solver, but the firewall itself had no dedicated regression test — none of
11
+ the 712 existing tests constructed a graph that triggered real overflow in
12
+ the power iteration. This release adds a single test that builds a star
13
+ graph with extreme weights (1e150 × 1000 nodes), demonstrably overflows the
14
+ `norm` accumulator (`val² ≈ 1e306` × 1000 = `1e309 > Number.MAX_VALUE`),
15
+ and verifies that the Hot-Loop Thermal Guard catches `Infinity` in `norm`,
16
+ the λ₂ short-circuit catches the resulting `NaN`, and the function falls
17
+ back to the degenerate variant of the discriminated union (no `v2`,
18
+ `lambda3`, or `v3`). Defense without verification was half a defense; this
19
+ closes that gap.
20
+
21
+ ### Notes
22
+ - **Tests:** 712 → 713 (the new firewall regression test).
23
+ - **Behavioral change:** none. This is purely a coverage addition.
24
+ - **No breaking changes.** No API surface modified.
25
+ - The 3 deferred items from v8.0.1 remain deferred:
26
+ - **Kahan summation:** rejected (precision obliterated by `toFixed(4)`)
27
+ - **PageRank FP audit:** rejected (mathematically immune via L1 simplex)
28
+ - **God Object kernel refactor:** deferred to v8.1 (SRE rule: never mix
29
+ architectural refactors with critical patches)
30
+
31
+ ---
32
+
5
33
  ## 8.0.1 (2026-04-08) — IEEE 754 Hardening: NaN Sink Eradication
6
34
 
7
35
  ### Fixed (Critical — Mathematical Soundness)
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  <p align="center">
4
4
  <img src="https://img.shields.io/npm/v/@ruso-0/nreki?style=for-the-badge&color=blue" alt="npm version">
5
- <img src="https://img.shields.io/badge/Tests-712-brightgreen?style=for-the-badge" alt="712 Tests">
5
+ <img src="https://img.shields.io/badge/Tests-713-brightgreen?style=for-the-badge" alt="713 Tests">
6
6
  <img src="https://img.shields.io/badge/AHI-9.7%2F10-brightgreen?style=for-the-badge" alt="AHI 9.7/10">
7
7
  <img src="https://img.shields.io/badge/Languages-TS%20%7C%20JS%20%7C%20Go%20%7C%20Python-blue?style=for-the-badge" alt="Multi-language">
8
8
  <img src="https://img.shields.io/badge/Cloud-Zero-orange?style=for-the-badge" alt="Zero Cloud">
@@ -24,7 +24,7 @@ AI proposes edit -> NREKI intercepts in RAM -> Compiler/LSP validates
24
24
  | Some remain? ------> Full rollback. Disk untouched. Errors returned to agent.
25
25
  ```
26
26
 
27
- 3 tools. 712 tests. 4 languages. Works with any MCP-compatible agent. Apache 2.0.
27
+ 3 tools. 713 tests. 4 languages. Works with any MCP-compatible agent. Apache 2.0.
28
28
 
29
29
  ---
30
30
 
@@ -147,6 +147,47 @@ True topological circuit rank via Union-Find on the type constraint graph. `beta
147
147
 
148
148
  ---
149
149
 
150
+ ## What's New in v8.3
151
+
152
+ ### Kernel Decomposition (v8.1)
153
+
154
+ The 2,080-line God Object `nreki-kernel.ts` was decomposed into 4 focused modules:
155
+
156
+ - `mutex.ts` — AsyncMutex FIFO with timeout protection
157
+ - `types.ts` — All interfaces + IoC contracts (`TsHealingContext`, `LspHealingContext`)
158
+ - `ttrd.ts` — Pure functions: `extractRawSignatures`, `detectSignatureRegression`, `isToxicType`
159
+ - `healer.ts` — Both healers rewritten with Inversion of Control — healers no longer touch VFS, vfsClock, or tsBackend directly. Testable in isolation.
160
+
161
+ ### Production Hardening (v8.2)
162
+
163
+ - **Token Drift Heartbeat** — Replaced call-count heuristic (15 calls) with token-physics (15,000 tokens default). ENV override: `NREKI_DRIFT_THRESHOLD`. Telemetry injected into header: `(Drift: X tokens | Limit: Y)`.
164
+ - **Search Engine Segregation** — `VectorIndex` and `KeywordIndex` extracted to `src/search/`. Pure JavaScript, zero SQLite coupling. Ready for `node:sqlite` migration in v9.0.
165
+ - **Handler Barrel Pattern** — 1,119-line `handlers/code.ts` split into `code/kernel-bridge.ts`, `code/read.ts`, `code/edit.ts`, `code/utils.ts`. Rate limiter stays in router (correct layer separation).
166
+ - **WASM Deps Frozen** — `sql.js` and `tree-sitter-wasms` pinned to exact versions. No silent breakage from upstream updates.
167
+
168
+ ### Rayleigh Residual Guard (v8.3)
169
+
170
+ Added a 4th defense layer to the spectral power iteration. Post-convergence, the solver computes `||Mv - μv||∞` and dies with `NaN` if the residual exceeds `1e-3`. This traps silent IEEE 754 drift that slips past the 3 existing guards (thermal, divergence, numerical sanity firewall).
171
+
172
+ ### interceptAtomicBatch Phase Extraction (v8.3)
173
+
174
+ The 520-line ACID orchestrator was flattened into 3 private methods within `NrekiKernel`:
175
+
176
+ - `phase1_injectVfs` — Path jail + VFS injection
177
+ - `phase2_validateSidecars` — Go/Python LSP validation
178
+ - `phase4_healingCascade` — Dual healer cascade (TS CodeFix API + LSP codeAction)
179
+
180
+ Catch path untouched. ACID rollback semantics intact. The orchestrator now reads like a document.
181
+
182
+ ### engine.ts Flattening (v8.3)
183
+
184
+ - **SessionTracker class** — Session state (`sessionSavings`) encapsulated. Saves one `Embedder.estimateTokens(content)` call per compression.
185
+ - **`indexFile` split** — 124-line method → 28-line orchestrator + `indexPlaintextFallback` + `indexAstChunks`.
186
+ - **`search` split** — 93-line method → 27-line orchestrator + `applyTectonicRelevanceScoring`.
187
+ - **DB Facade grouping** — Delegation wrappers visually grouped under explicit `Facade` section headers.
188
+
189
+ ---
190
+
150
191
  ## The Architecture
151
192
 
152
193
  NREKI has 3 validation layers with multi-language support:
@@ -324,7 +365,7 @@ Re-injects 4-layer session state every ~15 tool calls to survive context compact
324
365
 
325
366
  | Metric | Value |
326
367
  |--------|-------|
327
- | Tests | 712 (44 suites) |
368
+ | Tests | 713 (44 suites) |
328
369
  | Architecture Health Index | 9.7/10 (self-scored) |
329
370
  | Languages | 4 (TypeScript, JavaScript, Go, Python) |
330
371
  | Failure modes sealed | 32 (P1-P32) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruso-0/nreki",
3
- "version": "8.0.1",
3
+ "version": "8.3.0",
4
4
  "description": "MCP plugin that validates AI agent edits in RAM before they touch disk. Spectral clustering, architecture diffs, bridge detection, dead code oracle, and cross-file semantic checks for TypeScript, Go (gopls), and Python (pyright). Zero cloud dependencies.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -60,8 +60,8 @@
60
60
  "@modelcontextprotocol/sdk": "^1.12.1",
61
61
  "chokidar": "^4.0.3",
62
62
  "picomatch": "^4.0.3",
63
- "sql.js": "^1.12.0",
64
- "tree-sitter-wasms": "^0.1.13",
63
+ "sql.js": "1.14.1",
64
+ "tree-sitter-wasms": "0.1.13",
65
65
  "web-tree-sitter": "^0.24.7",
66
66
  "zod": "^3.24.2"
67
67
  },