Releases: shayc/react-built-in-ai
v0.8.1
Patch Changes
-
aab7c13: Update
@types/dom-chromium-aito^0.0.17. -
e96e9bd: Lifecycle and streaming fixes:
- Inline array-valued options (e.g.
expectedInputLanguages: ["en"]) no longer crash with "Too many re-renders" — option arrays are compared element-wise. - Hooks no longer throw during SSR: both
useSyncExternalStorecall sites now provide a server snapshot (idle lifecycle,nulldownload progress), with clean hydration. - Exiting a streaming loop early (
break/throw) now cancels the underlying stream instead of leaving the model generating into an abandoned reader. - Per-call options are forwarded to the browser APIs wholesale (
{ ...opts, signal }), so future upstream option fields flow through instead of being dropped.
- Inline array-valued options (e.g.
v0.8.0
Minor Changes
-
844f0fd: Add a
downloadablelifecycle status. The hook previously parked inidlewhen the model needed a download, indistinguishable from a probe still in flight — consumers had to re-callavailability()themselves to know when to render a download affordance.checkAvailabilitynow surfaces what it learns:idleis strictly "probing availability", anddownloadablemeans the model awaits the user gesture Chrome requires before a fetch.prepare()(or any action method) called from a user activation moves it throughdownloadingtoready, exactly as before.Breaking for exhaustive
switches overStatus(they'll get a compile error pointing at the new state) and for any code that treated a settledidleas "download required" — that state is now named.
v0.7.0
Minor Changes
- f5e8554:
useGlobalDownloadProgressnow aggregates with min instead of max: it reports the least-complete in-flight download, so the value never moves backwards when one of several concurrent downloads finishes. It also accepts an array to scope aggregation to multiple namespaces:useGlobalDownloadProgress(["Proofreader", "Rewriter"]). Single-namespace, explicit-undefined, and no-argument calls keep working unchanged; only the aggregated value differs when more than one download is in flight.
v0.6.0
Minor Changes
-
7dc4790: Restore the ergonomic
prepare()and removeretry().Reverts the prepare/retry split from the previous release.
prepare()once again recovers fromerrorstate — it tears down the failed instance, re-initializes from the current options, and warms up — so a single method drives the model toreadyfrom any state. The separateretry()introduced last release is removed; callprepare()to recover instead.The
MissingUserActivationErrormessage is also sharpened: it now frames a click/keypress as examples of a transient user activation (not the rule), says to callprepare()or the action directly inside such a handler, and names the real traps — effects, timers, page load, and post-awaitactivation expiry.
v0.5.0
Minor Changes
- 2353923: Add
retry()and makeprepare()warm-up-only; sharpen the user-activation error.- New
retry()on every hook. Recovers from a failed lifecycle by tearing down the errored instance, re-initializing from the current options, and warming up. This is the explicit recovery path that used to be a side effect ofprepare(). prepare()is now warm-up only. Fromerrorstate it rejects withNotReadyErrorinstead of silently resetting and re-initializing. Callretry()to recover. From any non-errorstate,prepare()andretry()behave identically.MissingUserActivationErrornow explains the fix — its message points at callingprepare()(or the action) from a click/keypress handler, so the failure is self-explaining when it surfaces from an effect or timer on a first-time (uncached) user.
- New
v0.4.0
Minor Changes
-
98aba7b: Rename the
NoUserActivationErrorclass toMissingUserActivationError. The new name keeps the "missing thing" meaning while aligning with its sibling adjective-style names (UnsupportedError,UnavailableError).Breaking: update any
import,instanceof, orcatchchecks that referenceNoUserActivationError.
v0.3.3
Patch Changes
-
61fe010: Docs: clarify the
idlelifecycle state (it also covers the availability probe and auto-advances toreadyfor an already-downloaded model), fix the Surface section that impliedproofreadstreams, and tighten README wording. No code changes — this republishes the npm registry README. -
9be61e2: Resolve the built-in AI namespace inside the lifecycle store instead of the React hook.
useLifecyclenow passes only the API name down and no longer readsglobalThisduring render; the store resolves the namespace itself (live, per epoch) for the availability probe.No public API or behavior change — an internal cleanup that removes the cached namespace, a
startparameter, and a dead guard, and keeps namespace resolution out of the React layer.
v0.3.2
Patch Changes
-
eb44dac: Fix
acquire()rejecting with a raw, untypedError("Unexpected lifecycle state") when called after the hook unmounts mid-download. It now rejects with a typedAbortError, consistent with every other teardown/abort path.Internally, the lifecycle store is modeled as a discriminated-union state machine, so a
readystate owns its instance by construction — eliminating the desync betweenstatusand the live instance that produced the raw throw.
v0.3.1
Patch Changes
- 4529325: Docs: polish the README — collapse the redundant Surface table column into a single linked "Browser API" column, tighten the Requirements table, normalize "Built-in AI" capitalization, rename the "Options" section to "Option changes", and simplify the Usage example's button label to key off the
downloadingstate.
v0.3.0
Minor Changes
- 7f28696: Add the remaining Built-in AI task APIs:
useSummarizer/createSummarizer,useWriter/createWriter, anduseLanguageDetector/createLanguageDetector. Summarizer and Writer expose the samesummarize/write+ streaming +measureInput/inputQuotasurface as the existing hooks;useLanguageDetector.detectresolves with the browser's rankedLanguageDetectionResult[]and has no streaming variant.isSupportedanduseGlobalDownloadProgressnow accept the three new namespace names. - 7f28696:
useGlobalDownloadProgressnow returnsnumber | null—nullwhen nothing is downloading, instead of0. This lets callers distinguish "no download in flight" from "download just started at 0%". Update guards fromprogress === 0toprogress === null.