[Crash Test] Simulate WebGPU context loss (Silent fallback)
LOCAL
Live Observability Stream (.on('route') & .on('fallback'))
[INIT] Initializing localfirst hybrid engine...
System Architecture & Hybrid Dataflow
Zero-dependency hybrid orchestration topology: capability probing, confidence scoring, hardware-accelerated local execution, and silent cloud fallback.
SIMULATE ROUTE:
ACTIVE TOPOLOGY: Complete system overview. Capability detection informs hybrid router; tasks balance between local WebGPU and cloud endpoints with silent fallback.ON-DEVICE PATH: High-confidence query (P ≥ 0.70) routed directly to In-Browser WebGPU LLM / Web Speech. Zero cloud data egress, sub-100ms latency.CLOUD ESCALATION: Complex multi-step reasoning or incapable hardware escalated to remote endpoints (Gemini / OpenAI / Ollama daemon via SSE).SILENT FALLBACK CIRCUIT: Local WebGPU OOM or context loss automatically caught by Resilience Guard and re-routed to Cloud without throwing exceptions.
Node Module SpecificationsProduction Ready · 24/24 Unit Tests Passing
Package Name
@ondevice/localfirst
Runtime Dependencies
0 Dependencies
Distribution Footprint
5.1 KB (ESM) · 6.2 KB (IIFE)
Environments
Node.js (>= 18) & Browsers
Hardware Acceleration
WebGPU, Wasm SIMD, Speech APIs
Failure Model
Zero-Throw Silent Fallback
Designed in hemanth-module-style: lightweight, functional default factory, dual ESM/CJS exports, no runtime dependencies, and seamless capability parity across server and client environments.
Installation & Usage GuideESM & CJS Compatible
1. Install via npm:
npm install @ondevice/localfirst
2. Three-Line Quickstart:
import localfirst from'@ondevice/localfirst';
const ai = awaitlocalfirst();
const res = await ai.ask('Turn on the living room lights');
console.log(res.text, res.source); // [local] ... in 28ms