nedb-engine 2.8.1 → 2.8.4
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 +91 -0
- package/nedb.darwin-arm64.node +0 -0
- package/nedb.darwin-x64.node +0 -0
- package/nedb.linux-x64-gnu.node +0 -0
- package/nedb.win32-x64-msvc.node +0 -0
- package/nedbd-v2-darwin-arm64 +0 -0
- package/nedbd-v2-darwin-x64 +0 -0
- package/nedbd-v2-linux-x64 +0 -0
- package/nedbd-v2-win-x64.exe +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -474,6 +474,48 @@ curl -X POST localhost:7070/v1/databases/shop/cast \
|
|
|
474
474
|
# → { …, "executed": true, "count": 2, "rows": [ … ] }
|
|
475
475
|
```
|
|
476
476
|
|
|
477
|
+
### The failure `valid` cannot catch
|
|
478
|
+
|
|
479
|
+
A literal the model **invented** rather than copied:
|
|
480
|
+
|
|
481
|
+
```
|
|
482
|
+
"memories about pricing" -> FROM memories SEARCH "handoff"
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
That query parses. It names a real collection. It returns real rows. Both
|
|
486
|
+
`valid` and `collection_known` are `true` — and it answers a question nobody
|
|
487
|
+
asked. Measured on the released checkpoint:
|
|
488
|
+
|
|
489
|
+
| terms | in vocabulary | copied correctly |
|
|
490
|
+
|---|---|---|
|
|
491
|
+
| `release flow` · `guardrail` · `handoff` | yes | **3/3** |
|
|
492
|
+
| `pricing` · `deadlines` · `kubernetes` | no | **0/3** — all became `"handoff"` |
|
|
493
|
+
|
|
494
|
+
So the response carries a `drift` field when a quoted literal is absent from the
|
|
495
|
+
prompt:
|
|
496
|
+
|
|
497
|
+
```json
|
|
498
|
+
{ "nql": "FROM memories SEARCH \"handoff\"",
|
|
499
|
+
"valid": true,
|
|
500
|
+
"collection_known": true,
|
|
501
|
+
"drift": "generated the literal \"handoff\", which does not appear in the prompt — likely outside the model's vocabulary and substituted. Verify before trusting these results." }
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
It is **advisory, never fatal** — the plan may still be what you wanted, and
|
|
505
|
+
discarding a valid query would be its own kind of lie. But an unattended caller
|
|
506
|
+
should treat it as a third gate:
|
|
507
|
+
|
|
508
|
+
```python
|
|
509
|
+
if plan["valid"] and plan["collection_known"] and not plan.get("drift"):
|
|
510
|
+
rows = await db.query(plan["nql"])
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
Same root cause as truncated digits (`height 400000` → `4000`): no copy
|
|
514
|
+
mechanism over prompt tokens. Verified at 24/24 on real model output — 3 true
|
|
515
|
+
positives, 21 true negatives, zero false alarms, including the case that matters
|
|
516
|
+
most (correctly inferred enum values like *"refunded orders"* → `status =
|
|
517
|
+
"refunded"` stay silent).
|
|
518
|
+
|
|
477
519
|
### Enabling it
|
|
478
520
|
|
|
479
521
|
Two gates, because most deployments want neither the model dependency nor the weights:
|
|
@@ -482,6 +524,9 @@ Two gates, because most deployments want neither the model dependency nor the we
|
|
|
482
524
|
# compile-time
|
|
483
525
|
cargo install nedb-engine --features cast
|
|
484
526
|
|
|
527
|
+
# or from a source checkout — builds the engine only, not the language bindings
|
|
528
|
+
cd rust && cargo build --release --features cast
|
|
529
|
+
|
|
485
530
|
# weights (~13 MB) — GitHub release asset, checksum-verified on load
|
|
486
531
|
curl -L -o ./data/model.cast \
|
|
487
532
|
https://github.com/aiassistsecure/nedb-cast-slm/releases/download/v10.30.90/model.cast
|
|
@@ -501,6 +546,52 @@ Built without the feature, the route returns **501** rather than 404 — clients
|
|
|
501
546
|
./scripts/test-cast.sh --boot # boots a daemon, seeds, casts, executes, checks failure modes
|
|
502
547
|
```
|
|
503
548
|
|
|
549
|
+
### Casting from a shell
|
|
550
|
+
|
|
551
|
+
```bash
|
|
552
|
+
./scripts/seed-shop.sh # a shop database the model already understands
|
|
553
|
+
. ./scripts/nedb.sh # bash / zsh / Git Bash
|
|
554
|
+
|
|
555
|
+
nedb-dbs # which databases exist
|
|
556
|
+
nedb-use shop # pick one
|
|
557
|
+
cast "orders over 100" # plan only — nothing runs
|
|
558
|
+
cast -x "orders over 100" # plan AND execute
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
**Seed the names it was trained on.** The model learned six synthetic domains, and `shop` is one of them — `orders(total, status, quantity, customer, placed_at, discounted)`, `products(price, stock, category, rating, title)`, `customers(age, city, tier, lifetime_value, name)`, plus the relations `purchased` / `reviewed` / `belongs_to`. Those names live in its 581-token vocabulary.
|
|
562
|
+
|
|
563
|
+
Call your collection `purchases` with a `cost` field and it will still emit `FROM orders WHERE total > …`, because that is what it knows. It is a 3.3M-parameter model, not a schema reader. On an unfamiliar schema you get `collection_known: false` — caught, not silently wrong, but caught.
|
|
564
|
+
|
|
565
|
+
```
|
|
566
|
+
nql FROM orders WHERE total > 100
|
|
567
|
+
valid yes collection orders known: yes
|
|
568
|
+
executed no (add -x to run it)
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
The summary leads with the NQL because **reading it is the job**. `valid: yes` means it parses, not that it's what you meant — `LIMIT 100` parses perfectly.
|
|
572
|
+
|
|
573
|
+
`NEDB=http://host:7070` points at a remote daemon. Prompts are JSON-escaped, so apostrophes and quotes are safe.
|
|
574
|
+
|
|
575
|
+
### Prompts it handles well
|
|
576
|
+
|
|
577
|
+
Accuracy varies by clause, so phrasing matters more than length:
|
|
578
|
+
|
|
579
|
+
| you want | say | eval |
|
|
580
|
+
|---|---|---|
|
|
581
|
+
| `TRACE caused_by` | *what caused these checkpoints* | 96.5% |
|
|
582
|
+
| `TRAVERSE` | *orders traverse placed_by* | 93.3% |
|
|
583
|
+
| one `WHERE` | *orders over 100* · *active drivers* | 91.2% |
|
|
584
|
+
| `LIMIT` | *top 5 orders* | 91.1% |
|
|
585
|
+
| `SEARCH` | *search orders for refund* | 90.5% |
|
|
586
|
+
| `ORDER BY` | *orders sorted by total descending* | 87.7% |
|
|
587
|
+
| two+ `WHERE` | *paid orders with total over 100* | 85.1% |
|
|
588
|
+
| `GROUP BY` + agg | *orders grouped by status with sum of total* | 77.0% |
|
|
589
|
+
|
|
590
|
+
Two habits that avoid most misses:
|
|
591
|
+
|
|
592
|
+
- **Name the field** when a number could be a limit. *"orders with total over 100"* beats *"orders over 100"* — bare *"over N"* is what produced the `LIMIT 100` miss above.
|
|
593
|
+
- **Check numbers over four digits.** Digits are tokenized one at a time, so `height 400000` can come back `4000`.
|
|
594
|
+
|
|
504
595
|
---
|
|
505
596
|
|
|
506
597
|
## Performance
|
package/nedb.darwin-arm64.node
CHANGED
|
Binary file
|
package/nedb.darwin-x64.node
CHANGED
|
Binary file
|
package/nedb.linux-x64-gnu.node
CHANGED
|
Binary file
|
package/nedb.win32-x64-msvc.node
CHANGED
|
Binary file
|
package/nedbd-v2-darwin-arm64
CHANGED
|
Binary file
|
package/nedbd-v2-darwin-x64
CHANGED
|
Binary file
|
package/nedbd-v2-linux-x64
CHANGED
|
Binary file
|
package/nedbd-v2-win-x64.exe
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nedb-engine",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.4",
|
|
4
4
|
"description": "NEDB — hash-chained, time-traveling, bi-temporal embedded database with Rust native core. SQL, Redis, MongoDB adapters. Causal Write Provenance. RESP2 wire protocol.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|