{"_id":"@ruvector/edge-full","name":"@ruvector/edge-full","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@ruvector/edge-full","version":"0.1.0","type":"module","description":"Complete WASM toolkit for edge AI: vector search, graph DB, neural networks, DAG workflows, SQL/SPARQL/Cypher, and ONNX inference - all running in browser","main":"index.js","module":"index.js","types":"index.d.ts","keywords":["wasm","rust","ai","edge","browser","vector-search","hnsw","graph-database","cypher","sparql","sql","neural-network","onnx","embeddings","dag","workflow","post-quantum","cryptography","consensus","raft","p2p","swarm"],"author":{"name":"RuVector Team"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ruvnet/ruvector.git"},"homepage":"https://github.com/ruvnet/ruvector/tree/main/examples/edge-full","bugs":{"url":"https://github.com/ruvnet/ruvector/issues"},"exports":{".":{"import":"./index.js","types":"./index.d.ts"},"./edge":{"import":"./edge/ruvector_edge.js","types":"./edge/ruvector_edge.d.ts"},"./graph":{"import":"./graph/ruvector_graph_wasm.js","types":"./graph/ruvector_graph_wasm.d.ts"},"./rvlite":{"import":"./rvlite/rvlite.js","types":"./rvlite/rvlite.d.ts"},"./sona":{"import":"./sona/ruvector_sona.js","types":"./sona/ruvector_sona.d.ts"},"./dag":{"import":"./dag/ruvector_dag_wasm.js","types":"./dag/ruvector_dag_wasm.d.ts"},"./onnx":{"import":"./onnx/ruvector_onnx_embeddings_wasm.js","types":"./onnx/ruvector_onnx_embeddings_wasm.d.ts"}},"sideEffects":false,"_id":"@ruvector/edge-full@0.1.0","gitHead":"53c9f57e13afbb886dbccb65a65382ae2b95c30a","_nodeVersion":"22.21.1","_npmVersion":"9.8.1","dist":{"integrity":"sha512-GSvq2bB+aTNXpISTqccdZwOroRLSdQhi33L7569QUVi9P7a03hEtdZSX/Gk5aWtDufp230T57uLXQUA1Q0uBeQ==","shasum":"dc35446ab54be6c58804b38cc1fc8c68fc21c66a","tarball":"https://registry.npmjs.org/@ruvector/edge-full/-/edge-full-0.1.0.tgz","fileCount":31,"unpackedSize":9189250,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHVPCTd6i4UIxbyfCw8Bcx3cy3RGn0WIYDYzBdYWg1hmAiEA3Zn/hGigK1aGFiW53lTEPfEpjOLlZrBFBstblt+WI94="}]},"_npmUser":{"name":"ruvnet","email":"ruv@ruv.net"},"directories":{},"maintainers":[{"name":"ruvnet","email":"ruv@ruv.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/edge-full_0.1.0_1767214789609_0.010530193603744076"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-31T20:59:49.514Z","0.1.0":"2025-12-31T20:59:49.873Z","modified":"2025-12-31T20:59:50.220Z"},"maintainers":[{"name":"ruvnet","email":"ruv@ruv.net"}],"description":"Complete WASM toolkit for edge AI: vector search, graph DB, neural networks, DAG workflows, SQL/SPARQL/Cypher, and ONNX inference - all running in browser","homepage":"https://github.com/ruvnet/ruvector/tree/main/examples/edge-full","keywords":["wasm","rust","ai","edge","browser","vector-search","hnsw","graph-database","cypher","sparql","sql","neural-network","onnx","embeddings","dag","workflow","post-quantum","cryptography","consensus","raft","p2p","swarm"],"repository":{"type":"git","url":"git+https://github.com/ruvnet/ruvector.git"},"author":{"name":"RuVector Team"},"bugs":{"url":"https://github.com/ruvnet/ruvector/issues"},"license":"MIT","readme":"# @ruvector/edge-full\n\n[![npm](https://img.shields.io/npm/v/@ruvector/edge-full.svg)](https://www.npmjs.com/package/@ruvector/edge-full)\n[![Rust](https://img.shields.io/badge/rust-1.75%2B-orange.svg)](https://www.rust-lang.org/)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![WASM](https://img.shields.io/badge/wasm-8.4MB-purple.svg)]()\n\n## The Complete Edge AI Toolkit\n\n**Run AI agent swarms, graph databases, neural networks, workflow engines, and ONNX inference - all in the browser, all for free.**\n\n@ruvector/edge-full is the batteries-included version of the RuVector edge computing platform. It bundles six powerful WASM modules into a single package, giving you everything you need to build sophisticated distributed AI systems that run entirely on user devices.\n\n### What's Inside\n\n| Module | Size | What It Does |\n|--------|------|--------------|\n| **Edge Core** | 364KB | Cryptographic identity (Ed25519), AES-256-GCM encryption, HNSW vector search, Raft consensus, spiking neural networks, post-quantum signatures |\n| **Graph DB** | 288KB | Neo4j-style graph database with Cypher query language, relationship modeling, traversal algorithms |\n| **RVLite** | 260KB | Multi-query vector database supporting SQL, SPARQL, and Cypher - semantic search with familiar syntax |\n| **SONA** | 238KB | Self-Optimizing Neural Architecture - LoRA fine-tuning, EWC++, ReasoningBank for adaptive learning |\n| **DAG** | 132KB | Directed acyclic graph engine for workflow orchestration, dependency resolution, topological execution |\n| **ONNX** | 7.1MB | Full ONNX inference engine with 6 pre-trained HuggingFace embedding models, parallel worker support |\n\n**Total: 1.28MB core + 7.1MB optional ONNX = 8.4MB complete**\n\n### Why Use This?\n\n- **Zero Infrastructure Cost**: Everything runs in the browser. No servers, no API keys, no monthly bills.\n- **Complete Feature Set**: Vector search + graph database + neural networks + workflow engine + embeddings. All in one package.\n- **True P2P**: Agents communicate directly via WebRTC, GUN.js, libp2p, or Nostr. No central server required.\n- **Self-Learning**: SONA provides continuous improvement through LoRA fine-tuning and experience replay.\n- **Production-Ready**: Post-quantum cryptography, Byzantine fault tolerance, encrypted communication.\n\n## Quick Start\n\n```bash\nnpm install @ruvector/edge-full\n```\n\n### Initialize All Modules\n\n```javascript\nimport { initAll } from '@ruvector/edge-full';\n\n// Initialize all core modules (excludes ONNX for faster startup)\nconst { edge, graph, rvlite, sona, dag } = await initAll();\n\n// Create agent identity\nconst identity = new edge.WasmIdentity.generate();\nconsole.log(`Agent: ${identity.agent_id()}`);\n\n// Build a knowledge graph\nconst graphStore = new graph.WasmGraphStore();\ngraphStore.run_cypher(\"CREATE (a:Agent {id: 'agent-1', type: 'researcher'})\");\n\n// Vector search with SQL\nconst db = new rvlite.Database();\ndb.execute(\"CREATE TABLE memories (id TEXT, embedding BLOB)\");\n\n// Self-learning neural routing\nconst sonaEngine = new sona.SonaEngine();\nsonaEngine.route_request({ task: \"analyze code\", context: \"rust\" });\n\n// Workflow orchestration\nconst workflow = new dag.Dag();\nworkflow.add_node(\"fetch\");\nworkflow.add_node(\"process\");\nworkflow.add_edge(\"fetch\", \"process\");\n```\n\n### Selective Module Loading\n\n```javascript\nimport { initModules } from '@ruvector/edge-full';\n\n// Only load what you need\nconst { edge, graph } = await initModules(['edge', 'graph']);\n\n// Or import modules directly\nimport init from '@ruvector/edge-full/edge';\nimport graphInit, { WasmGraphStore } from '@ruvector/edge-full/graph';\n\nawait init();\nawait graphInit();\n```\n\n### Add ONNX Embeddings\n\n```javascript\nimport onnxInit, { WasmEmbedder } from '@ruvector/edge-full/onnx';\n\nawait onnxInit();\n\nconst embedder = new WasmEmbedder();\nawait embedder.load_model('all-MiniLM-L6-v2'); // 384-dimensional embeddings\n\nconst embedding = await embedder.embed(\"The quick brown fox\");\nconsole.log(`Dimensions: ${embedding.length}`); // 384\n```\n\n## Module Deep Dive\n\n### Edge Core - Cryptographic Foundation\n\n```javascript\nimport init, {\n  WasmIdentity,      // Ed25519 key pairs\n  WasmCrypto,        // AES-256-GCM encryption\n  WasmHnswIndex,     // 150x faster vector search\n  WasmRaftNode,      // Distributed consensus\n  WasmHybridKeyPair, // Post-quantum signatures\n  WasmSpikingNetwork // Bio-inspired neural nets\n} from '@ruvector/edge-full/edge';\n\nawait init();\n\n// Create cryptographic identity\nconst identity = WasmIdentity.generate();\nconst signature = identity.sign(new TextEncoder().encode(\"hello\"));\nconst verified = identity.verify(new TextEncoder().encode(\"hello\"), signature);\n\n// Encrypted communication\nconst crypto = new WasmCrypto();\nconst encrypted = crypto.encrypt(data, key, nonce);\n\n// HNSW vector index (150x faster than brute force)\nconst index = new WasmHnswIndex(384, 16, 200); // dimensions, M, ef_construction\nindex.add(0, embedding1);\nindex.add(1, embedding2);\nconst neighbors = index.search(queryVector, 10); // top 10 results\n\n// Raft consensus for distributed state\nconst node = new WasmRaftNode('node-1', ['node-1', 'node-2', 'node-3']);\nnode.start_election();\n```\n\n### Graph DB - Neo4j in the Browser\n\n```javascript\nimport graphInit, { WasmGraphStore } from '@ruvector/edge-full/graph';\n\nawait graphInit();\n\nconst store = new WasmGraphStore();\n\n// Create nodes and relationships\nstore.run_cypher(`\n  CREATE (alice:Person {name: 'Alice', role: 'researcher'})\n  CREATE (bob:Person {name: 'Bob', role: 'developer'})\n  CREATE (alice)-[:COLLABORATES_WITH]->(bob)\n`);\n\n// Query the graph\nconst results = store.run_cypher(`\n  MATCH (p:Person)-[:COLLABORATES_WITH]->(colleague)\n  RETURN p.name, colleague.name\n`);\n\n// Complex traversals\nconst paths = store.run_cypher(`\n  MATCH path = (start:Person)-[:KNOWS*1..3]->(end:Person)\n  WHERE start.name = 'Alice'\n  RETURN path\n`);\n```\n\n### RVLite - SQL + SPARQL + Cypher Vector DB\n\n```javascript\nimport rvliteInit, { Database } from '@ruvector/edge-full/rvlite';\n\nawait rvliteInit();\n\nconst db = new Database();\n\n// SQL for familiar operations\ndb.execute(`\n  CREATE TABLE documents (\n    id TEXT PRIMARY KEY,\n    content TEXT,\n    embedding BLOB\n  )\n`);\n\ndb.execute(`INSERT INTO documents VALUES (?, ?, ?)`,\n  ['doc-1', 'Machine learning basics', embedding1]);\n\n// Semantic search\nconst similar = db.execute(`\n  SELECT * FROM documents\n  ORDER BY vector_distance(embedding, ?)\n  LIMIT 5\n`, [queryEmbedding]);\n\n// SPARQL for knowledge graphs\nconst sparqlResults = db.sparql(`\n  PREFIX ex: <http://example.org/>\n  SELECT ?name ?type\n  WHERE {\n    ?entity ex:type ?type .\n    ?entity ex:name ?name .\n    FILTER (?type = \"Agent\")\n  }\n`);\n```\n\n### SONA - Self-Learning Neural Router\n\n```javascript\nimport sonaInit, { SonaEngine, ReasoningBank } from '@ruvector/edge-full/sona';\n\nawait sonaInit();\n\nconst engine = new SonaEngine();\nconst reasoningBank = new ReasoningBank();\n\n// Route tasks to best agent\nconst decision = await engine.route_request({\n  task: \"review pull request\",\n  context: { language: \"rust\", complexity: \"high\" },\n  available_agents: [\n    { id: \"agent-1\", capabilities: [\"rust\", \"code-review\"] },\n    { id: \"agent-2\", capabilities: [\"testing\", \"qa\"] }\n  ]\n});\n\nconsole.log(`Routed to: ${decision.selected_agent}`);\nconsole.log(`Confidence: ${decision.confidence}`);\n\n// Learn from outcomes\nreasoningBank.record_trajectory({\n  state: \"review pull request\",\n  action: decision.selected_agent,\n  reward: 0.95, // positive outcome\n  timestamp: Date.now()\n});\n\n// Apply LoRA fine-tuning\nawait engine.apply_lora_update({\n  positive_examples: [\"rust expert handled rust code well\"],\n  negative_examples: []\n});\n```\n\n### DAG - Workflow Orchestration\n\n```javascript\nimport dagInit, { Dag } from '@ruvector/edge-full/dag';\n\nawait dagInit();\n\nconst workflow = new Dag();\n\n// Define workflow steps\nworkflow.add_node(\"fetch_data\");\nworkflow.add_node(\"validate\");\nworkflow.add_node(\"transform\");\nworkflow.add_node(\"store\");\n\n// Define dependencies\nworkflow.add_edge(\"fetch_data\", \"validate\");\nworkflow.add_edge(\"validate\", \"transform\");\nworkflow.add_edge(\"transform\", \"store\");\n\n// Get execution order\nconst order = workflow.topological_sort();\nconsole.log(order); // [\"fetch_data\", \"validate\", \"transform\", \"store\"]\n\n// Check for cycles\nif (workflow.has_cycle()) {\n  console.error(\"Invalid workflow!\");\n}\n\n// Get dependencies for a node\nconst deps = workflow.get_dependencies(\"transform\");\nconsole.log(deps); // [\"validate\"]\n```\n\n### ONNX - HuggingFace Embeddings\n\n```javascript\nimport onnxInit, { WasmEmbedder } from '@ruvector/edge-full/onnx';\n\nawait onnxInit();\n\nconst embedder = new WasmEmbedder();\n\n// Available models:\n// - all-MiniLM-L6-v2    (384D, fastest)\n// - all-MiniLM-L12-v2   (384D, better quality)\n// - bge-small-en-v1.5   (384D, SOTA)\n// - bge-base-en-v1.5    (768D, highest quality)\n// - e5-small-v2         (384D, search/retrieval)\n// - gte-small           (384D, multilingual)\n\nawait embedder.load_model('bge-small-en-v1.5');\n\n// Single embedding\nconst embedding = await embedder.embed(\"What is machine learning?\");\n\n// Batch processing (3.8x faster with parallel workers)\nconst embeddings = await embedder.embed_batch([\n  \"First document about AI\",\n  \"Second document about ML\",\n  \"Third document about neural networks\"\n]);\n\n// Compute similarity\nfunction cosineSimilarity(a, b) {\n  let dot = 0, normA = 0, normB = 0;\n  for (let i = 0; i < a.length; i++) {\n    dot += a[i] * b[i];\n    normA += a[i] * a[i];\n    normB += b[i] * b[i];\n  }\n  return dot / (Math.sqrt(normA) * Math.sqrt(normB));\n}\n\nconst similarity = cosineSimilarity(embeddings[0], embeddings[1]);\n```\n\n## Interactive Generator\n\nThe package includes an interactive HTML generator that creates ready-to-use code for any combination of:\n\n- **6 Network Topologies**: Mesh, Star, Hierarchical, Ring, Gossip, Sharded\n- **4 P2P Transports**: GUN.js, WebRTC, libp2p, Nostr\n- **6 Use Cases**: AI Assistants, Data Pipeline, Gaming, IoT, Marketplace, Research\n- **6 WASM Modules**: Edge, Graph, RVLite, SONA, DAG, ONNX\n- **8 Core Features**: Identity, Encryption, HNSW, Semantic Match, Raft, Post-Quantum, Spiking NN, Compression\n- **7 Exotic Patterns**: MCP Tools, Byzantine Fault, Quantum Resistant, Neural Consensus, Swarm Intelligence, Self-Healing, Emergent Behavior\n\nOpen `generator.html` in your browser to start generating code.\n\n## Bundle Size Comparison\n\n| Configuration | Size | Use Case |\n|--------------|------|----------|\n| Edge only | 364KB | Minimal crypto + vectors |\n| Edge + Graph | 652KB | Agent relationships |\n| Edge + RVLite | 624KB | SQL-style queries |\n| Edge + SONA | 602KB | Self-learning routing |\n| All Core | 1.28MB | Full capabilities |\n| With ONNX | 8.4MB | ML embeddings |\n\n## Free Infrastructure\n\nAll components use free public infrastructure:\n\n| Service | Free Providers |\n|---------|----------------|\n| P2P Relay | GUN.js (gun-manhattan, gun-us-west) |\n| STUN | Google, Twilio, Cloudflare |\n| Signaling | PeerJS Cloud (free tier) |\n| Nostr Relays | nostr.wine, relay.damus.io, nos.lol |\n\n## Performance\n\n| Module | Operation | Performance |\n|--------|-----------|-------------|\n| Edge | Ed25519 sign/verify | 50,000 ops/sec |\n| Edge | AES-256-GCM | 1 GB/sec |\n| Edge | HNSW search | 150x faster than brute force |\n| Graph | Cypher query | <1ms for simple queries |\n| RVLite | Vector search | Sub-millisecond |\n| SONA | Route decision | <5ms |\n| ONNX | Single embed | ~20ms (MiniLM-L6) |\n| ONNX | Batch embed | 3.8x speedup with workers |\n\n## Examples\n\nSee the `/examples` directory for:\n\n- Multi-agent chat with shared memory\n- Distributed RAG pipeline\n- Real-time multiplayer coordination\n- IoT sensor swarm\n- Knowledge graph construction\n- Workflow automation\n\n## License\n\nMIT License - Use freely for any purpose.\n\n## Links\n\n- [npm](https://www.npmjs.com/package/@ruvector/edge-full)\n- [GitHub](https://github.com/ruvnet/ruvector)\n- [@ruvector/edge](https://www.npmjs.com/package/@ruvector/edge) (lightweight version)\n","readmeFilename":"README.md","_rev":"1-981f997cf9bd2d5e5ecb65a6756729c0"}