rust-kgdb 0.6.29 → 0.6.30
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 +73 -79
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -84,79 +84,79 @@ console.log(result.hash);
|
|
|
84
84
|
## Our Approach vs Traditional (Why This Works)
|
|
85
85
|
|
|
86
86
|
```
|
|
87
|
-
|
|
88
|
-
│
|
|
89
|
-
|
|
90
|
-
│
|
|
91
|
-
│
|
|
92
|
-
│
|
|
93
|
-
│
|
|
94
|
-
│
|
|
95
|
-
│
|
|
96
|
-
│
|
|
97
|
-
│
|
|
98
|
-
│
|
|
99
|
-
│
|
|
100
|
-
|
|
101
|
-
│
|
|
102
|
-
│
|
|
103
|
-
│
|
|
104
|
-
│
|
|
105
|
-
│
|
|
106
|
-
│
|
|
107
|
-
│
|
|
108
|
-
│
|
|
109
|
-
│
|
|
110
|
-
│
|
|
111
|
-
│
|
|
112
|
-
|
|
113
|
-
│
|
|
114
|
-
│
|
|
115
|
-
│
|
|
116
|
-
│
|
|
117
|
-
│
|
|
118
|
-
│
|
|
119
|
-
│
|
|
120
|
-
│
|
|
121
|
-
│
|
|
122
|
-
│
|
|
123
|
-
│
|
|
124
|
-
│
|
|
125
|
-
│
|
|
126
|
-
│
|
|
127
|
-
│
|
|
128
|
-
│
|
|
129
|
-
│
|
|
130
|
-
│
|
|
131
|
-
│
|
|
132
|
-
│
|
|
133
|
-
│
|
|
134
|
-
│
|
|
135
|
-
│
|
|
136
|
-
|
|
137
|
-
│
|
|
138
|
-
│
|
|
139
|
-
│
|
|
140
|
-
│
|
|
141
|
-
│
|
|
142
|
-
│
|
|
143
|
-
│
|
|
144
|
-
│
|
|
145
|
-
│
|
|
146
|
-
|
|
147
|
-
│
|
|
148
|
-
│
|
|
149
|
-
│
|
|
150
|
-
│
|
|
151
|
-
│
|
|
152
|
-
│
|
|
153
|
-
│
|
|
154
|
-
│
|
|
155
|
-
│
|
|
156
|
-
│
|
|
157
|
-
│
|
|
158
|
-
│
|
|
159
|
-
|
|
87
|
+
┌───────────────────────────────────────────────────────────────────────────┐
|
|
88
|
+
│ APPROACH COMPARISON │
|
|
89
|
+
├───────────────────────────────────────────────────────────────────────────┤
|
|
90
|
+
│ │
|
|
91
|
+
│ TRADITIONAL: CODE GENERATION OUR APPROACH: NO CODE GENERATION │
|
|
92
|
+
│ ──────────────────────────── ──────────────────────────────── │
|
|
93
|
+
│ │
|
|
94
|
+
│ User → LLM → Generate Code User → Domain-Enriched Proxy │
|
|
95
|
+
│ │
|
|
96
|
+
│ ❌ SLOW: LLM generates text ✅ FAST: Pre-built typed tools │
|
|
97
|
+
│ ❌ ERROR-PRONE: Syntax errors ✅ RELIABLE: Schema-validated │
|
|
98
|
+
│ ❌ UNPREDICTABLE: Different ✅ DETERMINISTIC: Same every time │
|
|
99
|
+
│ │
|
|
100
|
+
├───────────────────────────────────────────────────────────────────────────┤
|
|
101
|
+
│ TRADITIONAL FLOW OUR FLOW │
|
|
102
|
+
│ ──────────────── ──────── │
|
|
103
|
+
│ │
|
|
104
|
+
│ 1. User asks question 1. User asks question │
|
|
105
|
+
│ 2. LLM generates code (SLOW) 2. Intent matched (INSTANT) │
|
|
106
|
+
│ 3. Code has syntax error? 3. Schema object consulted │
|
|
107
|
+
│ 4. Retry with LLM (SLOW) 4. Typed tool selected │
|
|
108
|
+
│ 5. Code runs, wrong result? 5. Query built from schema │
|
|
109
|
+
│ 6. Retry with LLM (SLOW) 6. Validated & executed │
|
|
110
|
+
│ 7. Maybe works after 3-5 tries 7. Works first time │
|
|
111
|
+
│ │
|
|
112
|
+
├───────────────────────────────────────────────────────────────────────────┤
|
|
113
|
+
│ OUR DOMAIN-ENRICHED PROXY LAYER │
|
|
114
|
+
│ ─────────────────────────────── │
|
|
115
|
+
│ │
|
|
116
|
+
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
|
117
|
+
│ │ CONTEXT THEORY (Spivak's Ologs) │ │
|
|
118
|
+
│ │ SchemaContext = { classes: Set, properties: Map, domains, ranges } │ │
|
|
119
|
+
│ │ → Defines WHAT can be queried (schema as category) │ │
|
|
120
|
+
│ └─────────────────────────────────────────────────────────────────────┘ │
|
|
121
|
+
│ │ │
|
|
122
|
+
│ ▼ │
|
|
123
|
+
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
|
124
|
+
│ │ TYPE THEORY (Hindley-Milner) │ │
|
|
125
|
+
│ │ TOOL_REGISTRY = { 'kg.sparql.query': Query → BindingSet, ... } │ │
|
|
126
|
+
│ │ → Defines HOW tools compose (typed morphisms) │ │
|
|
127
|
+
│ └─────────────────────────────────────────────────────────────────────┘ │
|
|
128
|
+
│ │ │
|
|
129
|
+
│ ▼ │
|
|
130
|
+
│ ┌─────────────────────────────────────────────────────────────────────┐ │
|
|
131
|
+
│ │ PROOF THEORY (Curry-Howard) │ │
|
|
132
|
+
│ │ ProofDAG = { derivations: [...], hash: "sha256:..." } │ │
|
|
133
|
+
│ │ → Proves HOW answer was derived (audit trail) │ │
|
|
134
|
+
│ └─────────────────────────────────────────────────────────────────────┘ │
|
|
135
|
+
│ │
|
|
136
|
+
├───────────────────────────────────────────────────────────────────────────┤
|
|
137
|
+
│ RESULTS: SPEED + ACCURACY │
|
|
138
|
+
│ ───────────────────────── │
|
|
139
|
+
│ │
|
|
140
|
+
│ TRADITIONAL (Code Gen) OUR APPROACH (Proxy Layer) │
|
|
141
|
+
│ • 2-5 seconds per query • <100ms per query (20-50x FASTER) │
|
|
142
|
+
│ • 20-40% accuracy • 86.4% accuracy │
|
|
143
|
+
│ • Retry loops on errors • No retries needed │
|
|
144
|
+
│ • $0.01-0.05 per query • <$0.001 per query (no LLM) │
|
|
145
|
+
│ │
|
|
146
|
+
├───────────────────────────────────────────────────────────────────────────┤
|
|
147
|
+
│ WHY NO CODE GENERATION: │
|
|
148
|
+
│ ─────────────────────── │
|
|
149
|
+
│ 1. CODE GEN IS SLOW: LLM takes 1-3 seconds per query │
|
|
150
|
+
│ 2. CODE GEN IS ERROR-PRONE: Syntax errors, hallucination │
|
|
151
|
+
│ 3. CODE GEN IS EXPENSIVE: Every query costs LLM tokens │
|
|
152
|
+
│ 4. CODE GEN IS NON-DETERMINISTIC: Same question → different code │
|
|
153
|
+
│ │
|
|
154
|
+
│ OUR PROXY LAYER PROVIDES: │
|
|
155
|
+
│ 1. SPEED: Deterministic planner runs in milliseconds │
|
|
156
|
+
│ 2. ACCURACY: Schema object ensures only valid predicates │
|
|
157
|
+
│ 3. COST: No LLM needed for query generation │
|
|
158
|
+
│ 4. DETERMINISM: Same input → same query → same result → same hash │
|
|
159
|
+
└───────────────────────────────────────────────────────────────────────────┘
|
|
160
160
|
```
|
|
161
161
|
|
|
162
162
|
**Architecture Comparison**:
|
|
@@ -205,12 +205,6 @@ OUR APPROACH: User → Proxied Objects → WASM Sandbox → RPC → Real S
|
|
|
205
205
|
- **RPC to Real Systems**: Queries execute on rust-kgdb (2.78µs native performance)
|
|
206
206
|
- **WASM Sandbox**: Capability-based security, fuel metering, full audit trail
|
|
207
207
|
|
|
208
|
-
**Code verification** (see `hypermind-agent.js`):
|
|
209
|
-
- `SchemaContext` class (line 699): Object with `classes: Set`, `properties: Map`
|
|
210
|
-
- `TOOL_REGISTRY` (line 1687): Typed morphisms `Query → BindingSet`
|
|
211
|
-
- `ProofDAG` class (line 2411): Derivation chain with hash
|
|
212
|
-
- `WasmSandbox` class (line 2612): Capability-based execution with audit log
|
|
213
|
-
|
|
214
208
|
---
|
|
215
209
|
|
|
216
210
|
## Quick Start
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rust-kgdb",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.30",
|
|
4
4
|
"description": "Production-grade Neuro-Symbolic AI Framework with Schema-Aware GraphDB, Context Theory, and Memory Hypergraph: +86.4% accuracy over vanilla LLMs. Features Schema-Aware GraphDB (auto schema extraction), BYOO (Bring Your Own Ontology) for enterprise, cross-agent schema caching, LLM Planner for natural language to typed SPARQL, ProofDAG with Curry-Howard witnesses. High-performance (2.78µs lookups, 35x faster than RDFox). W3C SPARQL 1.1 compliant.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|