A "decide" Primitive: Browser On-Device AI as a Native JS Control Flow

cocktailpeanut · x · 2026-09-21

Developer cocktailpeanut proposes embedding a "Nano Jev" — small-output-space generative judgment — directly into the browser as a JS method, which would imply open weights by default.

The logic: Chrome already supports on-device LLMs via Gemini Nano and the LanguageModel API, but LLMs emit variable-length sequences, forcing streaming for acceptable UX. Small predetermined output spaces can generate in parallel with deterministic, predictable latency, so the entire inference fits in a single clause.

He introduces a new primitive, decide, that looks like a switch statement but with async closures you can call async methods inside — embedding on-device AI judgment directly into language control flow.

Related event: Developer Proposes 'decide' Primitive for Browser-side AI(2 posts)→

Original post →

More from coding & agent

coding & agent channel →