ASK YOUR
DATA
ANYTHING.
Natural language queries. Charts. Stats. Rankings.
Zero server. Zero API keys. Zero latency.
Qwen2.5-Coder runs entirely on your GPU.
// LIVE PROJECT STATS
// WHAT'S NEW IN v1.2.2
DEVICE-LOST HOT SWAP
When the OS reclaims GPU memory — sleep cycle, VRAM spike, driver crash, tab freeze — the worker detects the context loss via GPUDevice.lost and seamlessly reinitialises on WASM. No UI errors. No user action required.
isProcessing LOCK
AIState now exports isProcessing: boolean — true while any worker request is in-flight. All three dispatchers set and clear it atomically, including every error, timeout, and hotswap path. Race conditions eliminated.
CONCURRENCY DROP
Rapid-fire queries no longer destabilise the tensor pipeline. If a ref slot is already occupied, the new request is rejected immediately with a clear message — no stale promises left dangling.
HOTSWAP UI FLOW
On device loss the context transitions to loading, logs [LG_HARDENING] WebGPU context lost. Hot-swapping to WASM..., and resolves back to AI Ready — WASM once the fallback pipeline is live.
BUILD INVARIANTS
turbo run build --force: 3/3 tasks clean. Zero console.log or debugger in production bundle. All 7 .d.ts files present. Sourcemaps confirmed. The one eval() grep hit is the literal string inside the security blacklist.
RUNTIME MODE REPORT
After a hot-swap the READY message carries device: "wasm" and the context reads it correctly — mode no longer incorrectly reports "webgpu" after a WASM fallback reinitialisation.
// WHAT'S NEW IN v1.1.0
analyzeData()
Ask any question in plain English. AI decides whether to return a stat, ranked table, chart, or filtered rows — then the engine executes it deterministically on your data.
RULE-BASED FALLBACK
15+ regex patterns handle common queries ("who earns most", "top 5", "average X by Y") without LLM inference — instant results even if the model is loading.
SCATTER CHARTS
Plot any two numeric fields against each other. "scatter age vs salary" — AI picks the axes, frontend renders a live XY scatter with labelled axes.
VRAM MANAGER
Idle for 5 minutes? The model disposes its GPU bindings automatically. Re-enable with one click. Your battery and memory thank you.
QUERY ERRORS
Inference failures no longer permanently kill AI status. QUERY_ERROR, JSON_ERROR, and ANALYSIS_ERROR keep the model ready — only the failed request is rejected.
SANDBOX HARDENED
Generated code now runs inside a closure that null-shadows window, document, fetch, localStorage, sessionStorage, XMLHttpRequest, and WebSocket.
// COMPONENTS
SMART DATA GRID
Natural language filter and sort for any array of objects. "show only engineers sorted by salary desc" — AI generates a sandboxed JS filter, frontend executes it.
SMART FORM
Paste any unstructured text — email, bio, notes — and the AI extracts structured JSON to fill your form fields. Confidence badges show extraction quality per field.
SMART ANALYTICS
Ask anything. AI classifies your query into chart / stat / table / filter and the engine computes results deterministically. Bar, line, pie, scatter all supported.
// ANALYTICS ACTION TYPES
- ❯ who earns the most?
- ❯ average salary
- ❯ total payroll
- ❯ how many employees?
- ❯ youngest person
- ❯ top 5 earners
- ❯ rank by salary
- ❯ sort by age desc
- ❯ bottom 3 salaries
- ❯ average salary by role
- ❯ count by city
- ❯ scatter age vs salary
- ❯ salary pie by role
- ❯ show engineers
- ❯ salary over 100k
- ❯ employees in New York
- ❯ age > 35
// INSTALL
$ npm install @dhruvil0210/local-ghost
# peer deps: react ^18, recharts ^2import { WebGPUAIProvider, SmartDataGrid,
SmartForm, SmartAnalytics }
from '@dhruvil0210/local-ghost';
export default function App() {
return (
<WebGPUAIProvider>
/* natural language → filtered table */
<SmartDataGrid data={myData} />
/* paste text → auto-filled form */
<SmartForm fields={fields} onSubmit={save} />
/* ask anything → chart, stat, table, filter */
<SmartAnalytics data={myData} />
</WebGPUAIProvider>
);
}import { useWebGPUAI } from '@dhruvil0210/local-ghost';
function MyComponent() {
const { analyzeData, status } = useWebGPUAI();
const result = await analyzeData(
'id, name, age, role, salary',
'who earns the most?'
);
// result.action → "stat"
// result.metric → "max"
// result.field → "salary"
}// ARCHITECTURE
WEBGPU ACCELERATION
Qwen2.5-Coder-0.5B runs directly on device GPU via WebGPU API. Automatic WASM fallback for unsupported browsers. 0ms server round-trip.
DEVICE-LOST RECOVERY
A separate GPUDevice handle monitors the OS-level context. On sleep, VRAM spike, or driver crash — GPUDevice.lost fires, the old pipeline is disposed, and WASM reinitialises automatically.
SECURITY SANDBOX
Generated JS runs in a closure that null-shadows window, document, fetch, localStorage, sessionStorage, XMLHttpRequest, and WebSocket. Token blacklist blocks eval, prototype, and constructor.
CONCURRENCY LATCHES
isProcessing lock on AIState prevents race conditions from rapid-fire input. Every resolve, reject, error, hotswap, and dispose path resets the lock — it can never get permanently stuck.
VRAM MANAGEMENT
After 5 minutes of inactivity the model disposes its GPU bindings automatically. Re-enables on demand with a single click. Battery and memory preserved.
WEB WORKER ISOLATION
All model inference runs in a dedicated Web Worker thread. The main thread stays at 60fps while the AI processes your query. LOG messages stream progress in real time.