akarisp 0.1.0-alpha.1 → 0.1.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +49 -3
  2. package/package.json +3 -2
package/README.md CHANGED
@@ -15,8 +15,8 @@ Zero runtime dependencies. No framework, no agent abstraction.
15
15
  npm install akarisp@alpha
16
16
  ```
17
17
 
18
- For the `0.1.0-alpha.1` release, both `alpha` and `latest` are intended to point to
19
- `0.1.0-alpha.1`, so `npm install akarisp` and `npm install akarisp@alpha` install the same
18
+ For the `0.1.0-alpha.2` release, both `alpha` and `latest` are intended to point to
19
+ `0.1.0-alpha.2`, so `npm install akarisp` and `npm install akarisp@alpha` install the same
20
20
  version. This does not define a permanent dist-tag policy. Each release records its intended and
21
21
  verified tags under [`releases/`](releases/).
22
22
 
@@ -160,6 +160,48 @@ The returned runtime is the same `Runtime`: `run`, `stream`, `snapshot`, `shutdo
160
160
  a cast. This is verified with TypeScript `moduleResolution: "bundler"`. WebLLM 0.2.85's own
161
161
  declarations do not resolve under `node16`/`nodenext`, where its types become `any`.
162
162
 
163
+ ## Using with frameworks
164
+
165
+ AkariSP needs no framework-specific package. The component (or page) that creates a runtime
166
+ owns it and calls `shutdown()` when it goes away. One rule matters in every framework:
167
+ **`createRuntime()` is asynchronous, so the owner can be unmounted before it resolves.** A runtime
168
+ that resolves after unmount must still be shut down. Otherwise it is never cleaned up. This
169
+ happens in production on a fast unmount, and on every mount under React's development
170
+ StrictMode.
171
+
172
+ React (`useEffect`; the same pattern works for a Next.js client component):
173
+
174
+ ```jsx
175
+ useEffect(() => {
176
+ let rt;
177
+ let cancelled = false; // set by cleanup; a runtime resolving afterwards is shut down at once
178
+ createRuntime().then((r) => {
179
+ if (cancelled) {
180
+ r.shutdown();
181
+ return;
182
+ }
183
+ rt = r;
184
+ setRuntime(r);
185
+ });
186
+ return () => {
187
+ cancelled = true;
188
+ rt?.shutdown();
189
+ };
190
+ }, []);
191
+ ```
192
+
193
+ - **Vue**: create in `onMounted`, and in `onBeforeUnmount` set `cancelled = true` and shut down.
194
+ Then check `cancelled` after `await createRuntime()`.
195
+ - **Svelte**: the same pattern as React, inside `onMount` and the cleanup function it returns.
196
+ - **Next.js (App Router)**: importing `akarisp` from server components is safe. **Create the
197
+ runtime only in client code**: a component marked `"use client"`, inside an effect. Creating
198
+ it in server-evaluated code fails with `ReferenceError: LanguageModel is not defined`.
199
+
200
+ Development module replacement (HMR) caused no leaks in the tested versions. Validated with
201
+ React 19.3, Vue 3.5, Svelte 5.57, Vite 8.3, and Next.js 16.3. The full applications are in
202
+ [`fixtures/`](fixtures/), and the evidence is in
203
+ [`specs/010-framework-compatibility-validation`](specs/010-framework-compatibility-validation/research.md).
204
+
163
205
  ## Package
164
206
 
165
207
  - Entry points: `akarisp` (`createRuntime`, `TaskError`, and the types `Runtime`,
@@ -181,6 +223,7 @@ npm test # node:test: core, browser and WebLLM adapters, boundary, packed-
181
223
  npm run build # tsc → dist/
182
224
  npm run test:browser # Playwright: compatibility page on Chromium / Firefox / WebKit engines
183
225
  RELEASE=<version> npm run test:registry # on demand, needs the network: the published package vs releases/<version>.json
226
+ npm run test:frameworks # on demand, needs the network: React/Vue/Svelte + Vite and Next.js fixtures, installed from npm
184
227
  ```
185
228
 
186
229
  ### Browser compatibility
@@ -213,6 +256,9 @@ observed not to be applied, so the tag is always named on the command line.
213
256
  3. For every other tag in the intent: `npm dist-tag add akarisp@<version> <tag>`.
214
257
  4. Verify: `RELEASE=<version> npm run test:registry`. It re-reads the registry for up to 10
215
258
  minutes while metadata propagates, then installs from the registry into clean consumers.
216
- Commit the resulting `releases/<version>.verified.json`.
259
+ Commit the resulting `releases/<version>.verified.json`. It records one verification moment
260
+ and is not a golden file. Re-running the check for an older release after the tags have moved
261
+ overwrites it with a (correct) mismatch record. The committed release-time file is the
262
+ evidence, so discard such a rewrite with `git checkout -- releases/<version>.verified.json`.
217
263
  5. On a mismatch, fix forward: correct a tag with `npm dist-tag add` and re-run the check, or
218
264
  publish the next version for a content defect. Never unpublish.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akarisp",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.2",
4
4
  "description": "Lightweight lifecycle runtime for browser LLM sessions: bounded queue, cancellation, and deterministic cleanup for the Chrome Prompt API and WebLLM",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -26,7 +26,8 @@
26
26
  "test": "node --test test/*.test.ts",
27
27
  "test:browser": "playwright test",
28
28
  "prepack": "npm run build",
29
- "test:registry": "node --test test/registry/registry.test.ts"
29
+ "test:registry": "node --test test/registry/registry.test.ts",
30
+ "test:frameworks": "playwright test -c playwright.frameworks.config.ts"
30
31
  },
31
32
  "devDependencies": {
32
33
  "@playwright/test": "^1.63.0",