uneven-ai 0.0.1 → 0.11.1

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 (210) hide show
  1. package/CHANGELOG.md +415 -0
  2. package/LICENSE +40 -0
  3. package/README.md +474 -0
  4. package/dist/cli/commands/analyze.d.ts +19 -0
  5. package/dist/cli/commands/analyze.d.ts.map +1 -0
  6. package/dist/cli/commands/analyze.js +441 -0
  7. package/dist/cli/commands/ask.d.ts +8 -0
  8. package/dist/cli/commands/ask.d.ts.map +1 -0
  9. package/dist/cli/commands/ask.js +53 -0
  10. package/dist/cli/commands/askf.d.ts +16 -0
  11. package/dist/cli/commands/askf.d.ts.map +1 -0
  12. package/dist/cli/commands/askf.js +212 -0
  13. package/dist/cli/commands/ci.d.ts +24 -0
  14. package/dist/cli/commands/ci.d.ts.map +1 -0
  15. package/dist/cli/commands/ci.js +280 -0
  16. package/dist/cli/commands/index.d.ts +12 -0
  17. package/dist/cli/commands/index.d.ts.map +1 -0
  18. package/dist/cli/commands/index.js +165 -0
  19. package/dist/cli/commands/info.d.ts +2 -0
  20. package/dist/cli/commands/info.d.ts.map +1 -0
  21. package/dist/cli/commands/info.js +32 -0
  22. package/dist/cli/commands/init.d.ts +5 -0
  23. package/dist/cli/commands/init.d.ts.map +1 -0
  24. package/dist/cli/commands/init.js +317 -0
  25. package/dist/cli/commands/license.d.ts +11 -0
  26. package/dist/cli/commands/license.d.ts.map +1 -0
  27. package/dist/cli/commands/license.js +62 -0
  28. package/dist/cli/commands/log.d.ts +5 -0
  29. package/dist/cli/commands/log.d.ts.map +1 -0
  30. package/dist/cli/commands/log.js +22 -0
  31. package/dist/cli/commands/pentest.d.ts +8 -0
  32. package/dist/cli/commands/pentest.d.ts.map +1 -0
  33. package/dist/cli/commands/pentest.js +227 -0
  34. package/dist/cli/commands/reset.d.ts +5 -0
  35. package/dist/cli/commands/reset.d.ts.map +1 -0
  36. package/dist/cli/commands/reset.js +49 -0
  37. package/dist/cli/commands/restore.d.ts +12 -0
  38. package/dist/cli/commands/restore.d.ts.map +1 -0
  39. package/dist/cli/commands/restore.js +82 -0
  40. package/dist/cli/commands/scan.d.ts +11 -0
  41. package/dist/cli/commands/scan.d.ts.map +1 -0
  42. package/dist/cli/commands/scan.js +155 -0
  43. package/dist/cli/commands/start.d.ts +7 -0
  44. package/dist/cli/commands/start.d.ts.map +1 -0
  45. package/dist/cli/commands/start.js +56 -0
  46. package/dist/cli/commands/test-cmd.d.ts +10 -0
  47. package/dist/cli/commands/test-cmd.d.ts.map +1 -0
  48. package/dist/cli/commands/test-cmd.js +50 -0
  49. package/dist/cli/commands/undo.d.ts +11 -0
  50. package/dist/cli/commands/undo.d.ts.map +1 -0
  51. package/dist/cli/commands/undo.js +67 -0
  52. package/dist/cli/commands/watch.d.ts +11 -0
  53. package/dist/cli/commands/watch.d.ts.map +1 -0
  54. package/dist/cli/commands/watch.js +69 -0
  55. package/dist/cli/index.d.ts +6 -0
  56. package/dist/cli/index.d.ts.map +1 -0
  57. package/dist/cli/index.js +313 -0
  58. package/dist/cli/theme.d.ts +43 -0
  59. package/dist/cli/theme.d.ts.map +1 -0
  60. package/dist/cli/theme.js +85 -0
  61. package/dist/core/active-scanner.d.ts +34 -0
  62. package/dist/core/active-scanner.d.ts.map +1 -0
  63. package/dist/core/active-scanner.js +454 -0
  64. package/dist/core/analyst-job-manager.d.ts +47 -0
  65. package/dist/core/analyst-job-manager.d.ts.map +1 -0
  66. package/dist/core/analyst-job-manager.js +96 -0
  67. package/dist/core/bridge.d.ts +52 -0
  68. package/dist/core/bridge.d.ts.map +1 -0
  69. package/dist/core/bridge.js +172 -0
  70. package/dist/core/chunker.d.ts +30 -0
  71. package/dist/core/chunker.d.ts.map +1 -0
  72. package/dist/core/chunker.js +172 -0
  73. package/dist/core/config-loader.d.ts +27 -0
  74. package/dist/core/config-loader.d.ts.map +1 -0
  75. package/dist/core/config-loader.js +75 -0
  76. package/dist/core/dashboard-generator.d.ts +30 -0
  77. package/dist/core/dashboard-generator.d.ts.map +1 -0
  78. package/dist/core/dashboard-generator.js +293 -0
  79. package/dist/core/data-analyst.d.ts +86 -0
  80. package/dist/core/data-analyst.d.ts.map +1 -0
  81. package/dist/core/data-analyst.js +464 -0
  82. package/dist/core/data-security-context.d.ts +94 -0
  83. package/dist/core/data-security-context.d.ts.map +1 -0
  84. package/dist/core/data-security-context.js +253 -0
  85. package/dist/core/db-loader.d.ts +34 -0
  86. package/dist/core/db-loader.d.ts.map +1 -0
  87. package/dist/core/db-loader.js +191 -0
  88. package/dist/core/engine.d.ts +141 -0
  89. package/dist/core/engine.d.ts.map +1 -0
  90. package/dist/core/engine.js +1122 -0
  91. package/dist/core/error-parser.d.ts +42 -0
  92. package/dist/core/error-parser.d.ts.map +1 -0
  93. package/dist/core/error-parser.js +477 -0
  94. package/dist/core/excel-exporter.d.ts +35 -0
  95. package/dist/core/excel-exporter.d.ts.map +1 -0
  96. package/dist/core/excel-exporter.js +124 -0
  97. package/dist/core/external-providers.d.ts +34 -0
  98. package/dist/core/external-providers.d.ts.map +1 -0
  99. package/dist/core/external-providers.js +344 -0
  100. package/dist/core/file-watcher.d.ts +47 -0
  101. package/dist/core/file-watcher.d.ts.map +1 -0
  102. package/dist/core/file-watcher.js +125 -0
  103. package/dist/core/fix-engine.d.ts +112 -0
  104. package/dist/core/fix-engine.d.ts.map +1 -0
  105. package/dist/core/fix-engine.js +767 -0
  106. package/dist/core/git-manager.d.ts +83 -0
  107. package/dist/core/git-manager.d.ts.map +1 -0
  108. package/dist/core/git-manager.js +211 -0
  109. package/dist/core/hardware-detector.d.ts +23 -0
  110. package/dist/core/hardware-detector.d.ts.map +1 -0
  111. package/dist/core/hardware-detector.js +54 -0
  112. package/dist/core/incremental-index.d.ts +79 -0
  113. package/dist/core/incremental-index.d.ts.map +1 -0
  114. package/dist/core/incremental-index.js +173 -0
  115. package/dist/core/index-planner.d.ts +55 -0
  116. package/dist/core/index-planner.d.ts.map +1 -0
  117. package/dist/core/index-planner.js +148 -0
  118. package/dist/core/knowledge-retriever.d.ts +56 -0
  119. package/dist/core/knowledge-retriever.d.ts.map +1 -0
  120. package/dist/core/knowledge-retriever.js +146 -0
  121. package/dist/core/license/fingerprint.d.ts +8 -0
  122. package/dist/core/license/fingerprint.d.ts.map +1 -0
  123. package/dist/core/license/fingerprint.js +18 -0
  124. package/dist/core/license/gate.d.ts +6 -0
  125. package/dist/core/license/gate.d.ts.map +1 -0
  126. package/dist/core/license/gate.js +18 -0
  127. package/dist/core/license/index.d.ts +5 -0
  128. package/dist/core/license/index.d.ts.map +1 -0
  129. package/dist/core/license/index.js +4 -0
  130. package/dist/core/license/manager.d.ts +36 -0
  131. package/dist/core/license/manager.d.ts.map +1 -0
  132. package/dist/core/license/manager.js +151 -0
  133. package/dist/core/license/storage.d.ts +17 -0
  134. package/dist/core/license/storage.d.ts.map +1 -0
  135. package/dist/core/license/storage.js +30 -0
  136. package/dist/core/license/verifier.d.ts +25 -0
  137. package/dist/core/license/verifier.d.ts.map +1 -0
  138. package/dist/core/license/verifier.js +33 -0
  139. package/dist/core/llm-security-reviewer.d.ts +37 -0
  140. package/dist/core/llm-security-reviewer.d.ts.map +1 -0
  141. package/dist/core/llm-security-reviewer.js +150 -0
  142. package/dist/core/logger/index.d.ts +56 -0
  143. package/dist/core/logger/index.d.ts.map +1 -0
  144. package/dist/core/logger/index.js +134 -0
  145. package/dist/core/malware-scanner.d.ts +64 -0
  146. package/dist/core/malware-scanner.d.ts.map +1 -0
  147. package/dist/core/malware-scanner.js +526 -0
  148. package/dist/core/pentest-security-context.d.ts +109 -0
  149. package/dist/core/pentest-security-context.d.ts.map +1 -0
  150. package/dist/core/pentest-security-context.js +334 -0
  151. package/dist/core/process-lock.d.ts +56 -0
  152. package/dist/core/process-lock.d.ts.map +1 -0
  153. package/dist/core/process-lock.js +123 -0
  154. package/dist/core/process-watcher.d.ts +57 -0
  155. package/dist/core/process-watcher.d.ts.map +1 -0
  156. package/dist/core/process-watcher.js +158 -0
  157. package/dist/core/report-packager.d.ts +54 -0
  158. package/dist/core/report-packager.d.ts.map +1 -0
  159. package/dist/core/report-packager.js +230 -0
  160. package/dist/core/safety-guard.d.ts +29 -0
  161. package/dist/core/safety-guard.d.ts.map +1 -0
  162. package/dist/core/safety-guard.js +79 -0
  163. package/dist/core/sbom-generator.d.ts +26 -0
  164. package/dist/core/sbom-generator.d.ts.map +1 -0
  165. package/dist/core/sbom-generator.js +211 -0
  166. package/dist/core/security-analyzer.d.ts +37 -0
  167. package/dist/core/security-analyzer.d.ts.map +1 -0
  168. package/dist/core/security-analyzer.js +1048 -0
  169. package/dist/core/security-reporter.d.ts +25 -0
  170. package/dist/core/security-reporter.d.ts.map +1 -0
  171. package/dist/core/security-reporter.js +266 -0
  172. package/dist/core/session.d.ts +150 -0
  173. package/dist/core/session.d.ts.map +1 -0
  174. package/dist/core/session.js +364 -0
  175. package/dist/core/snapshot.d.ts +65 -0
  176. package/dist/core/snapshot.d.ts.map +1 -0
  177. package/dist/core/snapshot.js +188 -0
  178. package/dist/core/supply-chain-auditor.d.ts +21 -0
  179. package/dist/core/supply-chain-auditor.d.ts.map +1 -0
  180. package/dist/core/supply-chain-auditor.js +213 -0
  181. package/dist/core/test-runner.d.ts +61 -0
  182. package/dist/core/test-runner.d.ts.map +1 -0
  183. package/dist/core/test-runner.js +333 -0
  184. package/dist/core/timeout.d.ts +19 -0
  185. package/dist/core/timeout.d.ts.map +1 -0
  186. package/dist/core/timeout.js +28 -0
  187. package/dist/core/web-scraper.d.ts +36 -0
  188. package/dist/core/web-scraper.d.ts.map +1 -0
  189. package/dist/core/web-scraper.js +201 -0
  190. package/dist/index.d.ts +12 -0
  191. package/dist/index.d.ts.map +1 -0
  192. package/dist/index.js +10 -0
  193. package/examples/demo.sh +83 -0
  194. package/examples/demo.ts +166 -0
  195. package/examples/knowledge/auth-service.ts +104 -0
  196. package/examples/knowledge/bugs.md +74 -0
  197. package/examples/knowledge/project.md +48 -0
  198. package/package.json +88 -6
  199. package/prebuilds/darwin-arm64/uneven_core.node +0 -0
  200. package/prebuilds/darwin-x64/.gitkeep +0 -0
  201. package/prebuilds/darwin-x64/uneven_core.node +0 -0
  202. package/prebuilds/linux-arm64/.gitkeep +0 -0
  203. package/prebuilds/linux-arm64/uneven_core.node +0 -0
  204. package/prebuilds/linux-x64/.gitkeep +0 -0
  205. package/prebuilds/linux-x64/uneven_core.node +0 -0
  206. package/prebuilds/win32-x64/.gitkeep +0 -0
  207. package/prebuilds/win32-x64/uneven_core.node +0 -0
  208. package/scripts/postinstall.cjs +66 -0
  209. package/types/index.d.ts +259 -0
  210. /package/{index.js → prebuilds/darwin-arm64/.gitkeep} +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,415 @@
1
+ # Changelog
2
+
3
+ All notable changes to Uneven AI will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.7.3] - 2026-04-09
9
+
10
+ ### Fixed — complete audit of unreviewed modules
11
+
12
+ - `external-providers.ts`: all four provider fetch calls (OpenAI, Claude, Gemini, Ollama)
13
+ now carry `AbortSignal.timeout(60_000)` — previously a slow or unresponsive API would
14
+ hang indefinitely and hold the process lock
15
+ - `git-manager.ts`: `execAsync` now passes `{ timeout: 30_000 }` — local git operations
16
+ should never take more than 30 s; previously a credential prompt or locked index could
17
+ freeze the auto-fix pipeline
18
+ - `pentest-security-context.ts`: `durationSecs` default was `8` (eight seconds) instead
19
+ of `8 * 3600` (eight hours) — a direct programmatic call to `declareScope()` without
20
+ an explicit duration would expire the scope almost instantly
21
+ - `test-runner.ts`: SIGTERM is now followed by a 5 s SIGKILL fallback — Node.js or JVM
22
+ processes that install signal handlers can ignore SIGTERM; without SIGKILL the spawned
23
+ test process would outlive Uneven AI and block the terminal
24
+
25
+ ## [0.7.2] - 2026-04-09
26
+
27
+ ### Added — timeout kill switch for all blocking operations
28
+
29
+ - New `src/core/timeout.ts`: `withTimeout<T>(promise, ms, label)` + `TimeoutError`
30
+ — races any promise against a deadline; clears the timer in both success and failure
31
+ paths to prevent event-loop retention
32
+ - `bridge.ts`: `llmEmbed` (2 min), `llmInfer` (3 min), `externalInfer` (1 min) — every
33
+ LLM consumer inherits timeouts automatically without any per-call change
34
+ - `data-analyst.ts`: DB connect (10 s), schema introspection (20 s), query execution
35
+ (30 s) — `TimeoutError` on query surfaces a user-facing hint to add a `LIMIT` clause
36
+ - `web-scraper.ts`: added `headersTimeout: 15 s` + `bodyTimeout: 30 s` to the undici
37
+ `Agent` — `connectTimeout` already existed but body timeout was missing, allowing
38
+ slow-loris-style hangs
39
+
40
+ ## [0.7.1] - 2026-04-09
41
+
42
+ ### Added — process lock, atomic writes, throttled scanners
43
+
44
+ - New `src/core/process-lock.ts`: exclusive `.uneven-ai/uneven-ai.lock` with stale PID
45
+ detection via `process.kill(pid, 0)` — prevents two Uneven AI instances from corrupting
46
+ the vector store or index state concurrently; all five heavy commands acquire the lock
47
+ (`watch`, `index`, `pentest`, `analyze`, `ci`) and release it in `finally`
48
+ - `incremental-index.ts`: `save()` now writes to `.uneven-ai/index-state.tmp` then
49
+ renames atomically — a crash during save no longer corrupts the previous state
50
+ - `logger/index.ts`: replaced unused `buffer: string[]` with a `writeQueue: Promise<void>`
51
+ — all `appendFile` calls are serialized through a promise chain, eliminating concurrent
52
+ write races within the same process
53
+ - `engine.ts`: replaced two `Promise.all([8 scan tasks])` in `pentest()` with a throttled
54
+ worker queue (`SCAN_CONCURRENCY = 3`) — previously 8 filesystem walkers ran simultaneously
55
+ and could saturate I/O on slower machines
56
+
57
+ ## [0.7.0] - 2026-04-08
58
+
59
+ ### Added — license system and Pro feature gates
60
+
61
+ - `src/core/license/` module: machine fingerprinting (SHA256 of platform+arch+hostname+homedir), encrypted local cache (`~/.config/uneven-ai/license.json`), offline grace period (7-day extension, max 30 days cumulative)
62
+ - License key format: `TMR-{TIER}-{payload_b64}-{hmac}` — payload parsed locally, HMAC verified server-side
63
+ - `uneven-ai license activate <key>` — activates key against `api.uneven-ai.dev`, caches result locally
64
+ - `uneven-ai license status` — shows tier, seats, expiry, machine ID
65
+ - `uneven-ai license deactivate` — removes machine from seat count
66
+ - Pro feature gate (`src/core/license/gate.ts`): commands blocked on free tier show upgrade message and exit cleanly
67
+
68
+ ### Changed — Pro-only commands now require license
69
+
70
+ - `uneven-ai analyze` — requires Pro
71
+ - `uneven-ai ci` — requires Pro
72
+ - `uneven-ai askf` — requires Pro
73
+ - `uneven-ai pentest -m active` — requires Pro (static mode remains free)
74
+
75
+ ## [0.6.0] - 2026-04-08
76
+
77
+ ### Fixed — local model stays loaded after switching to API provider
78
+
79
+ - `llm/mod.rs`: `init()` now accepts the `provider` string — local LLaMA model is only loaded when `provider == "local"`; API providers (claude, openai, gemini, ollama) skip model loading entirely
80
+ - `llm/inference.rs`: added `unload_model()` to drop the LLaMA state from the `LLAMA` mutex and free RAM immediately
81
+ - `lib.rs`: `init_llm_engine(provider)` passes provider to the Rust init chain; new `unload_local_model()` NAPI binding exposed for TypeScript
82
+ - `bridge.ts`: `initLlmEngine(provider)` and `unloadLocalModel()` updated/added
83
+ - `engine.ts`: provider resolved before `initLlmEngine()` call so it is never passed as `undefined`
84
+
85
+ ### Added — runtime config loader and provider-aware CLI
86
+
87
+ - `src/core/config-loader.ts`: new module reads `.uneven-ai/config.json` (written by `uneven-ai init`) so all commands use the provider actually configured by the user — no more hardcoded `provider: 'local'` across commands
88
+ - `init.ts`: writes `.uneven-ai/config.json` at the end of init so the selected provider is persisted for future commands
89
+ - All commands (`start`, `watch`, `ask`, `askf`, `index`, `pentest`, `ci`) now call `loadConfig()` instead of hardcoding the brain
90
+ - CLI displays the active brain after startup: `brain: claude (claude-sonnet-4-6) — API` or `brain: local (llama-3.2-1b-q8) — offline`
91
+ - `EventType` includes new `brain-ready` event emitted after engine init
92
+
93
+ ### Fixed — clarified RAM requirements in README
94
+
95
+ - Requirements section now split into three tables: API providers (~256 MB), Ollama (~512 MB), local brain (4-8 GB)
96
+ - New section "Running Uneven AI via API with minimal memory" with optimized config example and tips (`chunkSize`, `maxChunks`, smaller models)
97
+
98
+ ## [0.5.9] - 2026-04-08
99
+
100
+ ### Added — `uneven-ai askf` command
101
+
102
+ - New `askf <question>` command: same as `ask` but instructs the LLM to declare files using `FILE:/END_FILE` markers and writes them to the current directory
103
+ - Parser handles 3 formats: explicit `FILE:/END_FILE` blocks, plain markers, and markdown code blocks with filename hint in first-line comment
104
+ - Creates parent directories automatically (`mkdir -p`)
105
+ - Prints each created file with size in KB
106
+ - Falls back to plain answer with a hint if LLM produces no file blocks
107
+
108
+ ## [0.5.8] - 2026-04-08
109
+
110
+ ### Fixed — LLaMA inference argmax crash
111
+
112
+ - `inference.rs`: candle's `quantized_llama::forward` returns `[1, vocab]` (not `[1, seq, vocab]`) — code now handles both shapes before calling argmax, preventing "dimension index -1 out of range for shape []" panic
113
+
114
+ ## [0.5.7] - 2026-04-08
115
+
116
+ ### Fixed — LLaMA tokenizer download
117
+
118
+ - Changed tokenizer.json source from `meta-llama` (gated, requires HuggingFace login) to `unsloth/Llama-3.2-1B-Instruct` (public, no auth required)
119
+ - `inference.rs`: EOS token now read from GGUF metadata (`tokenizer.ggml.eos_token_id`) before falling back to vocab lookup — correct default for LLaMA 3 is `128009` (`<|eot_id|>`)
120
+
121
+ ## [0.5.6] - 2026-04-08
122
+
123
+ ### Fixed — Release pipeline
124
+
125
+ - `continue-on-error: true` on GitHub Release step — asset deletion error on re-run was blocking `npm publish`
126
+ - `fail_on_unmatched_files: false` added to prevent false failures on asset upload
127
+
128
+ ## [0.5.5] - 2026-04-08
129
+
130
+ ### Fixed — linux-arm64 cross-compilation
131
+
132
+ - Install `g++-aarch64-linux-gnu` in CI alongside `gcc-aarch64-linux-gnu` — `esaxx-rs` (C++ dependency of tokenizers) requires the C++ cross-compiler
133
+
134
+ ## [0.5.4] - 2026-04-08
135
+
136
+ ### Fixed — Windows CI
137
+
138
+ - `npm test` script changed from `node_modules/.bin/jest` (bash shebang, breaks PowerShell) to `node_modules/jest/bin/jest.js` (cross-platform Node.js entry point)
139
+
140
+ ## [0.5.3] - 2026-04-08
141
+
142
+ ### Fixed — Clippy
143
+
144
+ - `embeddings.rs`: removed unnecessary `m as u32` cast (already `u32`)
145
+ - `error.rs`: removed `to_string()` method that shadowed `Display` implementation (provided by `thiserror`)
146
+
147
+ ## [0.5.2] - 2026-04-08
148
+
149
+ ### Fixed — CI/CD Pipeline
150
+
151
+ - `package-lock.json` removed from `.gitignore` and committed — `npm ci` was failing on macOS/Windows runners with "lock file not found"
152
+ - GitHub Actions updated to Node.js 24 (avoids Node.js 20 deprecation warnings)
153
+ - `npm ci` → `npm install` in release workflow for compatibility
154
+
155
+ ## [0.5.1] - 2026-04-08
156
+
157
+ ### Added — Real LLM Engine
158
+
159
+ - **Candle BERT embeddings**: real 384-dim sentence vectors via `all-MiniLM-L6-v2` (safetensors + tokenizer.json). Replaces hash-based fallback for semantic search.
160
+ - **Candle GGUF inference**: real LLaMA 3.2 1B Q8 local inference via `candle-transformers`. Greedy decoding, configurable max-tokens.
161
+ - **Real terminal watcher**: `tokio::process::Command` spawns dev server, `tokio::sync::mpsc` channel streams stdout + stderr concurrently to TypeScript layer.
162
+ - **Real external providers**: `OpenAI`, `Anthropic Claude`, `Google Gemini`, `Ollama` — all use native Node.js `fetch` (no extra SDK packages required).
163
+ - **Interactive `uneven-ai init`**: prompts provider choice (1–5), downloads embedding model (~90 MB) and optionally LLaMA 3.2 1B Q8 (~1.4 GB) from HuggingFace with progress bars.
164
+ - **`uneven-ai watch <cmd>`**: command now fully wired to Uneven AI engine (was a no-op stub).
165
+ - `FileWatcher` class exported from public API for programmatic use.
166
+
167
+ ### Fixed
168
+
169
+ - `retrieval/mod.rs`: removed hardcoded 1024-dim assertion — now compatible with 384-dim BERT vectors.
170
+ - `port_scanner.rs`: removed unused `ToSocketAddrs` import.
171
+ - `error_parser.rs`: removed unused `Uneven AIError` import.
172
+ - Brain providers table in docs: removed incorrect `openai`/`@anthropic-ai/sdk`/`@google/generative-ai` package requirements.
173
+
174
+ ### Changed
175
+
176
+ - Embedding dimension: 1024 → **384** (all-MiniLM-L6-v2 output size).
177
+ - Local model name: `llama3.2` → `llama-3.2-1b-q8` (matches GGUF filename).
178
+ - Rust `llm` feature enabled by default (`default = ["llm"]`).
179
+ - `crate-type = ["cdylib", "rlib"]` — enables both Node.js addon and Rust library builds.
180
+
181
+ ## [0.5.0] - 2026-04-08
182
+
183
+ ### Breaking — Full ESM Migration
184
+
185
+ - Package is now native ESM (`"type": "module"` in `package.json`)
186
+ - Module resolution upgraded to `NodeNext` (TypeScript `module + moduleResolution: NodeNext`)
187
+ - All relative imports now carry explicit `.js` extensions as required by Node.js ESM
188
+ - `dist/` output is now ES module format — drop-in CommonJS compatibility removed
189
+ - Consumers must use `import` syntax (or dynamic `import()` for CJS interop)
190
+
191
+ ### Changed — Module Resolution
192
+
193
+ - `tsconfig.json`: `module` and `moduleResolution` upgraded from `"node"` (deprecated) to `"NodeNext"` — the most modern TypeScript setting available as of 2026
194
+ - `src/core/bridge.ts`: uses `createRequire(import.meta.url)` to load `.node` native addon (native addons are inherently CommonJS and cannot be dynamically imported)
195
+ - `src/cli/index.ts`: replaced `__dirname` with `dirname(fileURLToPath(import.meta.url))` for ESM compatibility
196
+
197
+ ### Changed — Scripts and Config
198
+
199
+ - `scripts/postinstall.js` → `scripts/postinstall.cjs` (stays CJS; runs before `"type": "module"` kicks in)
200
+ - `scripts/copy-prebuild.js` → `scripts/copy-prebuild.cjs` (same reason)
201
+ - `jest.config.js` → `jest.config.cjs` with `ts-jest/presets/default-esm` preset
202
+ - Test runner: `node --experimental-vm-modules node_modules/.bin/jest`
203
+
204
+ ### Changed — File Watcher
205
+
206
+ - Replaced `inotify` (Linux-only, unmaintained, broken on Node 25+) with `chokidar` v5
207
+ - `src/core/file-watcher.ts`: new `FileWatcher` class — cross-platform, pure TypeScript, no native addons
208
+ - New event types added to `EventType`: `file-changed`, `file-added`, `file-removed`
209
+
210
+ ### Changed — Rust Dependencies (all latest as of 2026)
211
+
212
+ - `napi` 2 → 3, `napi-derive` 2 → 3 (breaking: `Object` lifetime, `create_object()` removed, use `#[napi(object)]` struct)
213
+ - `thiserror` 1 → 2
214
+ - `similar` 2 → 3
215
+ - `candle-core`, `candle-transformers` → 0.10
216
+ - `tokenizers` → 0.22
217
+ - `reqwest` 0.12 → 0.13
218
+ - Rust watcher: cross-platform `shell_command()` helper (`sh -c` on Unix, `cmd /C` on Windows)
219
+
220
+ ### Added — GitHub Actions Release Pipeline
221
+
222
+ - `.github/workflows/release.yml`: 3-gate pipeline
223
+ - **Gate 1 — test**: runs on ubuntu, macos, windows in parallel
224
+ - **Gate 2 — build-native**: compiles `.node` binaries for 5 targets (linux-x64, linux-arm64, darwin-x64, darwin-arm64, win32-x64) via cross-compilation
225
+ - **Gate 3 — publish**: creates GitHub Release + uploads all binaries + publishes to npm
226
+ - `.github/workflows/build.yml`: simplified to `workflow_dispatch` only with artifact verification
227
+
228
+ ### Fixed — Tests
229
+
230
+ - `data-security-context.test.ts`: bcrypt regex `.{53}` → `.{20,}` (test hash was 45 chars, not exactly 53)
231
+ - `pentest-security-context.test.ts`: scope duration unit changed from hours to seconds (`durationSecs`), so `0.0001` = 0.1ms (expires in test window) and `8` = 8s (safe during test run)
232
+ - `data-analyst-safe-query.test.ts`: `PRAGMA` now allowed in safe-query regex; lookahead fixed (was lowercase, normalized string is uppercase)
233
+
234
+ ### Documentation
235
+
236
+ - `llms.txt` + `llms-full.txt`: added dependency policy — always use latest library versions, no legacy packages
237
+ - Version tables for both npm and Rust crates pinned to 2026 latest
238
+
239
+ ## [0.4.0] - 2026-04-11
240
+
241
+ ### Added — Data Analyst
242
+
243
+ - `uneven-ai analyze --db <url>` — interactive REPL for AI-powered data analysis
244
+ - Natural language → SQL generation via local LLM (grounded in real schema)
245
+ - Human approval gate: `[A]pprove / [E]dit / [S]kip` before every query executes
246
+ - Schema introspection for PostgreSQL, MySQL, SQLite, MongoDB
247
+ - Excel export (`.xlsx`) with dark blue headers, alternating rows, auto-filter, auto-fit columns
248
+ - HTML dashboard generation with Chart.js — auto-detects chart type (line, bar, doughnut, scatter, table)
249
+ - Combined workbook: all session queries merged into a single Excel file at session end
250
+ - `--package-exe` flag: packages HTML dashboard as a self-contained Windows `.exe` via `pkg`
251
+ - Fully offline — Chart.js inlined from local cache
252
+ - HTTP server on `127.0.0.1` only (not network-accessible)
253
+ - Security headers: `Content-Security-Policy: connect-src 'none'`, `X-Frame-Options: DENY`
254
+ - Targets: win-x64, win-arm64, macos-x64, macos-arm64, linux-x64
255
+
256
+ ### Added — Data Security Context (3-layer defense)
257
+
258
+ - **Layer 1 — Schema Filter**: removes blocked tables and columns before LLM generates SQL
259
+ - **Layer 2 — SQL Audit**: blocks DML/DDL (`INSERT`, `UPDATE`, `DELETE`, `DROP`, `GRANT`, `EXEC`) and references to sensitive tables/columns
260
+ - **Layer 3 — Result Masking**: redacts sensitive values by column name patterns and value regex (bcrypt, argon2, JWT, AWS keys, CPF, private keys)
261
+ - Default policy blocks 42 column patterns (passwords, tokens, API keys, CPF, CVV, etc.) and 11 table patterns (sessions, oauth_tokens, audit_logs, etc.)
262
+ - `SECURITY_BLOCKED` escape hatch — LLM signals when requested data falls outside security policy
263
+ - `buildPromptRules()` — injects security constraints into every LLM prompt
264
+ - Custom policy extension: `new DataSecurityContext({ blockedColumns: [...], blockedTables: [...] })`
265
+ - Exported `isSafeQuery(sql)` — pure function, safe to use anywhere
266
+
267
+ ### Added — Malware Scanner
268
+
269
+ - `uneven-ai scan` — scans project files and dependencies for malicious code
270
+ - Static rule engine: 8 categories with confidence scores
271
+ - `remote-shell` (critical) — `/dev/tcp`, `nc -e`, `bash -i >&`
272
+ - `data-exfiltration` (high) — credential harvesting + network upload patterns
273
+ - `obfuscation` (high) — `eval(atob())`, `eval(Buffer.from(..., 'base64'))`, large `String.fromCharCode` arrays
274
+ - `supply-chain` (critical) — network download in postinstall scripts
275
+ - `credential-theft` (high) — reading SSH keys, `/etc/passwd`, `~/.aws/credentials`
276
+ - `persistence` (high) — writing crontab, systemd units, shell profile modification
277
+ - `crypto-mining` (high) — stratum+tcp URLs, xmrig/cryptonight references
278
+ - `typosquatting` (medium) — Levenshtein distance ≤2 against 50 popular packages
279
+ - Dependency audit: scans `package.json` dependencies and `node_modules` postinstall hooks
280
+ - LLM evaluation for ambiguous patterns (local model, no cloud)
281
+ - Risk level: `none | low | medium | high | critical`
282
+ - `--report` flag: HTML + Markdown report via SecurityReporter
283
+ - `--json` flag: raw JSON output for CI integration
284
+ - Exit code 1 on critical/high findings
285
+
286
+ ### Added — Pentest Security Context
287
+
288
+ - `PentestSecurityContext` — authorization scope enforcement for active testing
289
+ - `declareScope(authorizedBy, targets, allowedModes, durationHours)` — creates signed scope file
290
+ - SHA-256 integrity check on scope file — tampering detected on next load
291
+ - Scope expiry — automatically invalidated after declared duration
292
+ - `checkTarget(ip | hostname | cidr)` — CIDR matching, blocks public internet IPs without authorization
293
+ - `checkCommand(cmd)` — blocks DoS tools (`hping3 --flood`, `slowloris`, `loic`, `hoic`, `slowhttptest`), mass scans (`/16`+), destructive flags (`--dump-all`), exfiltration
294
+ - `buildPromptConstraints(mode)` — injects scope + FORBIDDEN rules into LLM system prompt
295
+ - Interactive `--declare-scope` in CLI with `I AUTHORIZE` confirmation prompt
296
+ - Scope status shown before any active test run
297
+
298
+ ### Added — CI/CD Command
299
+
300
+ - `uneven-ai ci` — headless pipeline (TypeScript typecheck → security scan → test suite)
301
+ - Exit code 0 = pass, 1 = fail (CI-compatible)
302
+ - Flags: `--skip-security`, `--skip-tests`, `--strict-security`, `--github`, `--output <path>`
303
+ - Writes `ci-summary.json` to `.uneven-ai/` with step results and timestamps
304
+ - GitHub Actions integration: writes to `$GITHUB_STEP_SUMMARY` when `--github` flag is set
305
+
306
+ ### Added — Retrieval-Augmented Fix (RAF)
307
+
308
+ - Error fixes are now grounded in the indexed knowledge base before pattern-match fallback
309
+ - `KnowledgeRetriever` — semantic vector search with similarity threshold 0.60
310
+ - `buildErrorQuery()` — constructs optimized search query from error code, message, language, and context
311
+ - `suggestRAFFix()` — structured LLM prompt with KB context, returns `null` on `INSUFFICIENT_CONTEXT`
312
+ - `buildContextOnlySuggestion()` — KB-grounded suggestion without LLM inference (confidence ≤ 0.70)
313
+ - Fix suggestions extended with `groundedInKB` and `kbSources` fields
314
+ - Anti-hallucination: LLM only sees schema/chunks that were actually retrieved; out-of-scope requests return `INSUFFICIENT_CONTEXT`
315
+
316
+ ### Added — Multi-Language Error Parsing
317
+
318
+ - Go error parser: `file.go:line:col: message` — codes GO_UNDEF, GO_SYNTAX, GO_TYPE
319
+ - Java error parser: javac compile errors + `Exception in thread` runtime stack traces
320
+ - PHP error parser: Fatal/Parse errors, Warnings, Notices from PHP CLI output
321
+ - Ruby error parser: `file.rb:line:in 'method': message (ExceptionClass)` + syntax errors
322
+ - Language-specific fix suggestions: `suggestGoFix`, `suggestJavaFix`, `suggestPHPFix`, `suggestRubyFix`
323
+ - All parsers return `ParsedError[]` with consistent schema
324
+
325
+ ### Added — Security Report Generator
326
+
327
+ - `SecurityReporter` — generates HTML and Markdown reports from `SecurityFinding[]`
328
+ - HTML: severity-colored badges (red/orange/yellow/blue), summary cards, remediation section
329
+ - `uneven-ai pentest --report [md|html|both]`
330
+ - Findings collection via `pentest-finding` events during test run
331
+
332
+ ### Added — Test Suite
333
+
334
+ - Jest + ts-jest configuration with native bridge mocked (bridge unavailable → graceful degradation)
335
+ - `__tests__/__mocks__/bridge.ts` — all napi exports stubbed
336
+ - `__tests__/error-parser.test.ts` — 20 tests (TS, Go, Java, PHP, Ruby, Python)
337
+ - `__tests__/data-security-context.test.ts` — 25 tests (schema filter, SQL audit, result masking, custom policy)
338
+ - `__tests__/pentest-security-context.test.ts` — 22 tests (scope lifecycle, target validation, command safety, prompt constraints)
339
+ - `__tests__/data-analyst-safe-query.test.ts` — 20 tests (`isSafeQuery` allowed/blocked SQL patterns)
340
+ - `__tests__/knowledge-retriever.test.ts` — 12 tests (query builder, graceful degradation)
341
+ - `__tests__/malware-scanner.test.ts` — 15 tests (clean files, obfuscation, reverse shell, mining, persistence, typosquatting, supply chain, risk levels)
342
+
343
+ ---
344
+
345
+ ## [0.3.0] - 2026-03-15
346
+
347
+ ### Added — Knowledge Indexing
348
+
349
+ - File/directory recursive indexing with text extraction
350
+ - Document chunking (500 tokens per chunk, 100-token overlap)
351
+ - Database connectors: PostgreSQL, MySQL, SQLite, MongoDB
352
+ - URL fetching and HTML scraping via undici + cheerio
353
+ - PDF and DOCX parsing via pdf-parse, mammoth
354
+ - Incremental indexing — only re-indexes changed files
355
+ - `FileLoader`, `DatabaseLoader`, `WebScraper` classes
356
+ - `uneven-ai index --incremental` flag
357
+
358
+ ### Added — Snapshot & Git Manager
359
+
360
+ - `.uneven-ai/snapshots/` — file snapshots before each auto-fix
361
+ - Git integration: creates commit after each applied fix (optional)
362
+ - Rollback: `uneven-ai reset --snapshot <id>`
363
+
364
+ ### Added — Test Runner Integration
365
+
366
+ - `uneven-ai watch --run-tests` — runs test suite after each auto-fix
367
+ - Fix reverted automatically if tests fail after application
368
+
369
+ ---
370
+
371
+ ## [0.2.0] - 2026-02-15
372
+
373
+ ### Added — LLM Inference + Vector Store
374
+
375
+ - Local LLM inference via Candle (LLaMA 3.2 1B Q8)
376
+ - Embedding generation (1024-dimensional, L2 normalized)
377
+ - Vector store via usearch HNSW index — persists to `.uneven-ai/vectors.usearch`
378
+ - napi-rs exports: `llmEmbed`, `llmInfer`, `retrievalSearch`, `initLlmEngine`
379
+ - TypeScript bridge: `llmEmbed()`, `llmInfer()`, `retrievalSearch()` functions
380
+ - `uneven-ai ask` — semantic knowledge base query via CLI
381
+
382
+ ### Added — Terminal Watcher + Auto-Fix
383
+
384
+ - Process spawning via tokio with stdout/stderr capture
385
+ - Error parser: TypeScript/JavaScript, Python, Rust compiler errors
386
+ - Auto-fix engine with surgical diff application
387
+ - `FixSuggestion` with confidence score, explanation, before/after code
388
+ - Structured logging to `.uneven-ai/log.md`
389
+
390
+ ---
391
+
392
+ ## [0.1.0] - 2026-01-15
393
+
394
+ ### Added — Project Scaffold
395
+
396
+ - Rust workspace with napi-rs bridge structure
397
+ - TypeScript public API (`Uneven AI` class)
398
+ - CLI framework with `init`, `start`, `watch`, `index`, `ask`, `pentest`, `log`, `reset` commands
399
+ - Configuration system (`uneven-ai.config.ts`) with cosmiconfig loader
400
+ - Logger with Markdown output
401
+ - Type definitions for all interfaces (`BrainConfig`, `PentesterConfig`, etc.)
402
+ - Error handling foundation
403
+ - Module structure for all features
404
+ - Documentation: README, CONTRIBUTING, LICENSE (BSL 1.1), llms.txt, llms-full.txt
405
+ - Postinstall script for model downloading
406
+
407
+ ---
408
+
409
+ ## Contributing
410
+
411
+ See [CONTRIBUTING.md](./CONTRIBUTING.md)
412
+
413
+ ## License
414
+
415
+ Business Source License 1.1 — See [LICENSE](./LICENSE)
package/LICENSE ADDED
@@ -0,0 +1,40 @@
1
+ Business Source License 1.1
2
+
3
+ Licensor: KR Riley Soluções
4
+ Licensed Work: Uneven AI
5
+ Additional Use Grant: Personal, educational and non-commercial use is free.
6
+ Change Date: 2029-01-01
7
+ Change License: Apache License 2.0
8
+
9
+ Use Limitation: Production commercial use — including SaaS products,
10
+ paid services, internal company use and client projects — requires
11
+ a commercial license from KR Riley Soluções.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16
+
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ For questions about commercial licensing, please contact:
23
+ contato@rileysolucoes.com.br
24
+
25
+ ---
26
+
27
+ BUSINESS SOURCE LICENSE 1.1 SUMMARY:
28
+
29
+ What's free?
30
+ ✅ Personal projects
31
+ ✅ Learning and studying the code
32
+ ✅ Non-commercial forks
33
+ ✅ Contributing to the project
34
+
35
+ What requires a license?
36
+ ❌ Commercial production use (SaaS, paid services, internal company use)
37
+
38
+ Automatic conversion:
39
+ - On 2029-01-01, this license converts to Apache 2.0
40
+ - At that point, all commercial uses become freely allowed