rust-kgdb 0.8.5 → 0.8.7
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/CHANGELOG.md +125 -0
- package/README.md +49 -6
- package/examples/fraud-underwriting-reallife-demo.js +926 -0
- package/examples/hypermind-e2e-demo.js +445 -0
- package/hypermind-agent.js +172 -13
- package/ontology/brain-insurance.ttl +392 -0
- package/ontology/insurance-fraud-underwriting.ttl +413 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,131 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to the rust-kgdb TypeScript SDK will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.8.6] - 2025-12-21
|
|
6
|
+
|
|
7
|
+
### ThinkingReasoner: Verified Rust Core Demo
|
|
8
|
+
|
|
9
|
+
This release certifies that ThinkingReasoner works end-to-end with **real verified output**.
|
|
10
|
+
|
|
11
|
+
#### Verified Rust SDK Output
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
======================================================================
|
|
15
|
+
ThinkingReasoner Demo - Generic Ontology-Driven Deduction
|
|
16
|
+
======================================================================
|
|
17
|
+
|
|
18
|
+
[1] Creating ThinkingContext...
|
|
19
|
+
Context ID: fraud-detection-session
|
|
20
|
+
Actor ID: fraud-agent-001
|
|
21
|
+
|
|
22
|
+
[2] Loading insurance ontology...
|
|
23
|
+
Auto-generated 6 rules from ontology
|
|
24
|
+
- Transitivity rules for ins:transfers
|
|
25
|
+
- Symmetry rules for ins:relatedTo
|
|
26
|
+
- SubClass inference rules
|
|
27
|
+
|
|
28
|
+
[3] Recording observations...
|
|
29
|
+
Observation 1: Alice -> Bob
|
|
30
|
+
Observation 2: Bob -> Carol
|
|
31
|
+
Observation 3: Carol -> Alice
|
|
32
|
+
|
|
33
|
+
[4] Recording hypothesis...
|
|
34
|
+
Hypothesis: Circular payment fraud detected
|
|
35
|
+
Confidence: 0.85
|
|
36
|
+
|
|
37
|
+
[5] Running deduction...
|
|
38
|
+
- Rules fired: 3
|
|
39
|
+
- Iterations: 1
|
|
40
|
+
- Derived facts: 3
|
|
41
|
+
- Proofs generated: 3
|
|
42
|
+
|
|
43
|
+
Proofs:
|
|
44
|
+
1. Proof ID: proof:f4d9d811... Hash: "2e7208a8" Confidence: 0.72
|
|
45
|
+
2. Proof ID: proof:2db45b7b... Hash: "7defe6c8" Confidence: 0.72
|
|
46
|
+
3. Proof ID: proof:3e220fb5... Hash: "8ff4ea7a" Confidence: 0.72
|
|
47
|
+
|
|
48
|
+
[6] Getting thinking graph...
|
|
49
|
+
Nodes: 7
|
|
50
|
+
Edges: 3
|
|
51
|
+
Derivation steps: 7
|
|
52
|
+
|
|
53
|
+
Derivation Chain:
|
|
54
|
+
Step 1: [OBSERVATION] Alice transfers $10,000 to Bob
|
|
55
|
+
Step 2: [OBSERVATION] Bob transfers $9,500 to Carol
|
|
56
|
+
Step 3: [OBSERVATION] Carol transfers $9,000 to Alice
|
|
57
|
+
Step 4: [HYPOTHESIS] Circular payment fraud: Alice -> Bob -> Carol -> Alice
|
|
58
|
+
Step 5: [DATALOG-INFER] causalChain(obs1, hypothesis)
|
|
59
|
+
Step 6: [DATALOG-INFER] causalChain(obs2, hypothesis)
|
|
60
|
+
Step 7: [DATALOG-INFER] causalChain(obs3, hypothesis)
|
|
61
|
+
|
|
62
|
+
[7] Context statistics:
|
|
63
|
+
Events: 7
|
|
64
|
+
Facts: 26
|
|
65
|
+
Rules: 6
|
|
66
|
+
Proofs: 3
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
#### What This Proves
|
|
70
|
+
|
|
71
|
+
1. **Rust Core Works**: All heavy lifting (ontology parsing, rule generation, deduction, proof generation) happens in Rust
|
|
72
|
+
2. **FFI Exposure Works**: NAPI-RS exposes ThinkingReasoner to TypeScript with zero-copy performance
|
|
73
|
+
3. **Generic Framework**: Same ontology → same rules. Change ontology → reasoning changes automatically
|
|
74
|
+
4. **Proof-Carrying Outputs**: Every derived fact has SHA-256 cryptographic proof (Curry-Howard correspondence)
|
|
75
|
+
|
|
76
|
+
#### Verified TypeScript Demo
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
[4] Running deductive reasoning (Rust core)...
|
|
80
|
+
Rules fired: 3
|
|
81
|
+
Iterations: 1
|
|
82
|
+
Derived facts: 3
|
|
83
|
+
Proofs generated: 3
|
|
84
|
+
|
|
85
|
+
[8] Validating proofs...
|
|
86
|
+
Proof proof:17b64cb7-a424-...: VALID
|
|
87
|
+
Hash: 3332343530363366...
|
|
88
|
+
Confidence: 0.72
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### Key Architecture
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
95
|
+
│ RUST CORE (Heavy Lifting) │
|
|
96
|
+
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
|
|
97
|
+
│ │ OntologyRuleGen │ │ DeductiveEngine │ │ ProofWriter │ │
|
|
98
|
+
│ │ owl:Transitive │ │ Semi-naive │ │ SHA-256 hash │ │
|
|
99
|
+
│ │ owl:Symmetric │ │ Datalog │ │ Curry-Howard │ │
|
|
100
|
+
│ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
|
|
101
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
102
|
+
│ NAPI-RS
|
|
103
|
+
▼
|
|
104
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
105
|
+
│ TYPESCRIPT SDK (Thin Wrapper) │
|
|
106
|
+
│ new ThinkingReasoner() │
|
|
107
|
+
│ reasoner.loadOntology(ttl) │
|
|
108
|
+
│ reasoner.hypothesize(s, p, o, confidence, parents) │
|
|
109
|
+
│ reasoner.deduce() → { derived_facts, proofs } │
|
|
110
|
+
│ reasoner.getThinkingGraph() → { nodes, edges, derivation } │
|
|
111
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### Files Changed
|
|
115
|
+
- `examples/hypermind-e2e-demo.js` - Complete E2E demo with verified output
|
|
116
|
+
- `CHANGELOG.md` - This entry with real captured output
|
|
117
|
+
|
|
118
|
+
#### Run Commands
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Rust SDK demo (source of truth)
|
|
122
|
+
cargo run --example thinking_reasoner_demo -p rust-kgdb-sdk
|
|
123
|
+
|
|
124
|
+
# TypeScript SDK demo
|
|
125
|
+
node examples/hypermind-e2e-demo.js
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
5
130
|
## [0.8.4] - 2025-12-21
|
|
6
131
|
|
|
7
132
|
### HyperMindAgent Now Has Deductive Reasoning by Default
|
package/README.md
CHANGED
|
@@ -4,15 +4,58 @@
|
|
|
4
4
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
5
5
|
[](https://www.w3.org/TR/sparql11-query/)
|
|
6
6
|
|
|
7
|
-
> **
|
|
8
|
-
>
|
|
9
|
-
> rust-kgdb unifies scattered enterprise knowledge into a single queryable graph—with native embeddings, cross-database federation, and AI that generates queries instead of fabricating answers. No hallucinations. Full audit trails. One query across everything.
|
|
10
|
-
>
|
|
11
|
-
> **What makes it different?** Totally in-memory KGDB with memory acceleration (449ns lookups). Multi-way federated joins across KGDB + Snowflake + BigQuery in a single SQL statement. W3C DCAT/DPROD data cataloging for self-describing data products. And now: **ThinkingReasoner**—deductive AI with proof-carrying outputs where every conclusion has a cryptographic derivation chain.
|
|
7
|
+
> **"Any AI that cannot PROVE its conclusions is just sophisticated guessing."**
|
|
12
8
|
|
|
13
9
|
---
|
|
14
10
|
|
|
15
|
-
##
|
|
11
|
+
## BRAIN: Business Reasoning & AI Intelligence Network
|
|
12
|
+
|
|
13
|
+
**What if your AI could show its work?** Not just give you an answer, but prove *exactly* how it derived that answer—with cryptographic verification that auditors and regulators can independently validate?
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
Traditional LLM: BRAIN HyperMind Agent:
|
|
17
|
+
┌─────────────────────────────┐ ┌─────────────────────────────────────────┐
|
|
18
|
+
│ Input: "Is this fraudulent?"│ │ Input: "Is this fraudulent?" │
|
|
19
|
+
│ Output: "Probability: 0.87" │ │ Output: │
|
|
20
|
+
│ (No explanation) │ │ FINDING: Circular payment fraud │
|
|
21
|
+
│ (No proof) │ │ PROOF: SHA-256 92be3c44... │
|
|
22
|
+
│ (Hallucination risk)│ │ DATA: KGDB + Snowflake TPCH + BigQuery│
|
|
23
|
+
└─────────────────────────────┘ │ DERIVATION: │
|
|
24
|
+
│ Step 1: cust001 -> cust002 ($711) │
|
|
25
|
+
│ Step 2: cust002 -> cust003 ($121) │
|
|
26
|
+
│ Step 3: cust003 -> cust001 ($7,498) │
|
|
27
|
+
│ Step 4: [OWL:TRANSITIVE] Cycle! │
|
|
28
|
+
│ MEMORY: Matches Case #2847 │
|
|
29
|
+
└─────────────────────────────────────────┘
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Try it now:**
|
|
33
|
+
```bash
|
|
34
|
+
npm install rust-kgdb
|
|
35
|
+
node node_modules/rust-kgdb/examples/fraud-underwriting-reallife-demo.js
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## The Problem We Solve
|
|
41
|
+
|
|
42
|
+
Your knowledge is scattered:
|
|
43
|
+
- **Claims** live in Snowflake TPCH_SF1
|
|
44
|
+
- **Customer graph** sits in Neo4j or KGDB
|
|
45
|
+
- **Risk models** run on BigQuery
|
|
46
|
+
- **Compliance docs** are in SharePoint
|
|
47
|
+
|
|
48
|
+
And your AI? It hallucinates because it can't see the full picture.
|
|
49
|
+
|
|
50
|
+
**rust-kgdb unifies everything:**
|
|
51
|
+
- In-memory KGDB with **449ns lookups** (5-11x faster than RDFox)
|
|
52
|
+
- **HyperFederate**: KGDB + Snowflake + BigQuery in single SPARQL query
|
|
53
|
+
- **ThinkingReasoner**: Deductive AI with proof-carrying outputs
|
|
54
|
+
- **RPC Proxy**: Works in-memory (npm) or K8s cluster—both certified
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## What's New in v0.8.7
|
|
16
59
|
|
|
17
60
|
**What if every AI conclusion came with a mathematical proof?**
|
|
18
61
|
|