Repository navigation
v0.2.2
[0.2.2] - 2026-05-19
Moves the on-device LanguageModel session out of the content script and into a hidden offscreen document, so the model loads once and is shared across tabs/pages instead of reloading WebGPU on every navigation. Per-URL chat history continues to live in chrome.storage.local; the polyfill session is the shared resource.
Adds explicit recovery for WebGPU device loss. When the offscreen doc loses its GPU device — typical after a tab/window switch — the polyfill swallows the underlying ONNX Runtime Web error and closes the stream with zero chunks. The offscreen layer now treats zero-chunk results as failure and tears the session down; the chat layer catches the failure, re-seeds a fresh session with the persisted conversation, and retries the prompt once. The user sees "GPU device lost — restoring session…" instead of an empty bubble and the conversation resumes in place.
Added
offscreen.html/offscreen.ts— hidden offscreen document that hosts the polyfill session and streams tokens over achrome.runtime.Port.src/offscreen/protocol.ts— wire types forENSURE_OFFSCREEN_*,STREAM_*, andREBUILD_SESSION_*messages.src/offscreen/client.tsandsrc/offscreen/stream-client.ts— content-script-facing client and the context-agnostic port-streaming helper it shares with the service worker.src/background/offscreen.ts— service-worker side of the offscreen lifecycle (idempotentensureOffscreen, dedupe of concurrent calls).- One-shot device-loss retry path in
src/session.ts, including a transient "restoring session" hint.
Changed
manifest.json— adds theoffscreenpermission and acontent_security_policyallowingwasm-unsafe-eval(required for ONNX Runtime Web's WebAssembly).manifest.jsonversion bumped 0.1.1 → 0.2.2 to catch up withpackage.json(the 0.2.1 revert bumped one but not the other).src/session.ts— drops its direct polyfill imports; streams through the offscreen client.
Notes
- Same model, same UX surface as 0.2.1; the change is architectural. No new commands, no new menus.
- Cross-URL conversation continuity is still scoped to the offscreen session's lifetime — the polyfill session is shared, but UI history switches per URL.