Same primitives. From the canon. Drop into any page.
import {
Substrate, Cell, LocalEmbedder,
fnv1a64, FLEET_CANARY_HEX
} from './substrate-sdk.js';
const s = new Substrate();
// Add cells
s.add('hello', 'canon', { text: 'hello world' });
s.add('foo', 'canon', { text: 'foo bar' });
s.add('witness', 'canon', { text: 'witness as prediction' });
// BIND: connect two cells
s.BIND('hello', 'foo');
// Find top-5 by similarity
console.log(s.findTopK('hello'));
// Wavefunction JEV
console.log(s.wavefunction('hello'));
// Local embedder
const emb = new LocalEmbedder(32).embed('hello world');
// Save to IndexedDB
await s.saveToIndexedDB();
// Distributed
await s.registerWithCoordinator('https://quilt-distributed.example.workers.dev');
const r = await s.submitToCoordinator(coordinator, 'linreg', { w: 2.9, b: 2.1, loss: 0.01 });
console.log('Submitted:', r);