Skip to content

Releases: shayc/react-built-in-ai

v0.8.1

12 Jun 14:07
4fc3d4e

Choose a tag to compare

Patch Changes

  • aab7c13: Update @types/dom-chromium-ai to ^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 useSyncExternalStore call sites now provide a server snapshot (idle lifecycle, null download 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.

v0.8.0

10 Jun 11:35
68b6f11

Choose a tag to compare

Minor Changes

  • 844f0fd: Add a downloadable lifecycle status. The hook previously parked in idle when the model needed a download, indistinguishable from a probe still in flight — consumers had to re-call availability() themselves to know when to render a download affordance. checkAvailability now surfaces what it learns: idle is strictly "probing availability", and downloadable means the model awaits the user gesture Chrome requires before a fetch. prepare() (or any action method) called from a user activation moves it through downloading to ready, exactly as before.

    Breaking for exhaustive switches over Status (they'll get a compile error pointing at the new state) and for any code that treated a settled idle as "download required" — that state is now named.

v0.7.0

09 Jun 22:47
6980306

Choose a tag to compare

Minor Changes

  • f5e8554: useGlobalDownloadProgress now 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

29 May 21:41
95231dd

Choose a tag to compare

Minor Changes

  • 7dc4790: Restore the ergonomic prepare() and remove retry().

    Reverts the prepare/retry split from the previous release. prepare() once again recovers from error state — it tears down the failed instance, re-initializes from the current options, and warms up — so a single method drives the model to ready from any state. The separate retry() introduced last release is removed; call prepare() to recover instead.

    The MissingUserActivationError message is also sharpened: it now frames a click/keypress as examples of a transient user activation (not the rule), says to call prepare() or the action directly inside such a handler, and names the real traps — effects, timers, page load, and post-await activation expiry.

v0.5.0

29 May 21:26
6e78d02

Choose a tag to compare

Minor Changes

  • 2353923: Add retry() and make prepare() 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 of prepare().
    • prepare() is now warm-up only. From error state it rejects with NotReadyError instead of silently resetting and re-initializing. Call retry() to recover. From any non-error state, prepare() and retry() behave identically.
    • MissingUserActivationError now explains the fix — its message points at calling prepare() (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.

v0.4.0

29 May 20:18
40f54da

Choose a tag to compare

Minor Changes

  • 98aba7b: Rename the NoUserActivationError class to MissingUserActivationError. The new name keeps the "missing thing" meaning while aligning with its sibling adjective-style names (UnsupportedError, UnavailableError).

    Breaking: update any import, instanceof, or catch checks that reference NoUserActivationError.

v0.3.3

29 May 19:53
6bf822d

Choose a tag to compare

Patch Changes

  • 61fe010: Docs: clarify the idle lifecycle state (it also covers the availability probe and auto-advances to ready for an already-downloaded model), fix the Surface section that implied proofread streams, 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. useLifecycle now passes only the API name down and no longer reads globalThis during 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 start parameter, and a dead guard, and keeps namespace resolution out of the React layer.

v0.3.2

29 May 16:08
19d5273

Choose a tag to compare

Patch Changes

  • eb44dac: Fix acquire() rejecting with a raw, untyped Error ("Unexpected lifecycle state") when called after the hook unmounts mid-download. It now rejects with a typed AbortError, consistent with every other teardown/abort path.

    Internally, the lifecycle store is modeled as a discriminated-union state machine, so a ready state owns its instance by construction — eliminating the desync between status and the live instance that produced the raw throw.

v0.3.1

28 May 21:19
f632119

Choose a tag to compare

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 downloading state.

v0.3.0

28 May 19:36
390a178

Choose a tag to compare

Minor Changes

  • 7f28696: Add the remaining Built-in AI task APIs: useSummarizer/createSummarizer, useWriter/createWriter, and useLanguageDetector/createLanguageDetector. Summarizer and Writer expose the same summarize/write + streaming + measureInput/inputQuota surface as the existing hooks; useLanguageDetector.detect resolves with the browser's ranked LanguageDetectionResult[] and has no streaming variant. isSupported and useGlobalDownloadProgress now accept the three new namespace names.
  • 7f28696: useGlobalDownloadProgress now returns number | nullnull when nothing is downloading, instead of 0. This lets callers distinguish "no download in flight" from "download just started at 0%". Update guards from progress === 0 to progress === null.