reflex layer for every input · on-device · zero latency

Address autofill

Type a city — state, country, timezone, and currency fill in live, under 5 ms, no network.

<smart-field task="city-to-state">

Contextual spellcheck

"I'll see you their" → "there" — catches homophones in context, not just dictionary misses.

new SmartText(textareaEl)

Smart paste

Paste a business card blob — name, email, phone, company, website split into the right fields, synchronously.

attachSmartPaste(form)

Formula editor (erp.ai-style)

A tiny spreadsheet. Select a cell, type "add a 10% discount" or "round to 2 decimals", watch the formula rewrite live. No server, no model call, just pattern rewrites.

Transform.formula(input, instruction)

Install

npm install dhamaka

The package ships with the WASM runtime bundled — one install, nothing else to configure. Available on npm and GitHub Packages.

import { SmartField } from "dhamaka";

new SmartField(document.querySelector("#city"), {
  task: "city-to-state",
  onResult: (r) => console.log(r.fields),
});

The architecture

  every <input> and <textarea>
            │
            ▼
     [ SmartField ]   ←   rules-first (<1 ms, always runs)
            │
            ▼
       [ reflex ]     ←   resident engine (warm, KV-cached)
            │
            ▼
        [ engine ]    ←   window.ai → WASM → MockEngine
                          (task-specific models, ~50 ms cold)
        

Every task layers rules → fuzzy → model. Most real inputs never touch the model at all — they're answered by a lookup table or a regex in microseconds. The model only runs when the fast path is uncertain, and when it does, it's resident in the page, not on a server.

Looking for the old chat demo?

It's here →. That's the low-level Dhamaka.load() API (direct access to the runtime). It still works, but for most use cases the SmartField primitives above are what you want.