akarisp 0.1.0-alpha.0 → 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.
- package/README.md +64 -4
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -15,8 +15,10 @@ Zero runtime dependencies. No framework, no agent abstraction.
|
|
|
15
15
|
npm install akarisp@alpha
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
`npm install akarisp`
|
|
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
|
+
version. This does not define a permanent dist-tag policy. Each release records its intended and
|
|
21
|
+
verified tags under [`releases/`](releases/).
|
|
20
22
|
|
|
21
23
|
## Usage
|
|
22
24
|
|
|
@@ -158,6 +160,48 @@ The returned runtime is the same `Runtime`: `run`, `stream`, `snapshot`, `shutdo
|
|
|
158
160
|
a cast. This is verified with TypeScript `moduleResolution: "bundler"`. WebLLM 0.2.85's own
|
|
159
161
|
declarations do not resolve under `node16`/`nodenext`, where its types become `any`.
|
|
160
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
|
+
|
|
161
205
|
## Package
|
|
162
206
|
|
|
163
207
|
- Entry points: `akarisp` (`createRuntime`, `TaskError`, and the types `Runtime`,
|
|
@@ -178,6 +222,8 @@ requirement only; the package itself runs in browsers.
|
|
|
178
222
|
npm test # node:test: core, browser and WebLLM adapters, boundary, packed-tarball consumer
|
|
179
223
|
npm run build # tsc → dist/
|
|
180
224
|
npm run test:browser # Playwright: compatibility page on Chromium / Firefox / WebKit engines
|
|
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
|
|
181
227
|
```
|
|
182
228
|
|
|
183
229
|
### Browser compatibility
|
|
@@ -200,5 +246,19 @@ the diff.
|
|
|
200
246
|
|
|
201
247
|
### Release
|
|
202
248
|
|
|
203
|
-
|
|
204
|
-
|
|
249
|
+
Each release states its intent before publishing and verifies the registry afterwards. Nothing
|
|
250
|
+
relies on a configured default tag: with npm 10.9.2, a configured `publishConfig.tag` was
|
|
251
|
+
observed not to be applied, so the tag is always named on the command line.
|
|
252
|
+
|
|
253
|
+
1. Bump `version`, and write and commit `releases/<version>.json`, which names every intended
|
|
254
|
+
dist-tag target.
|
|
255
|
+
2. Publish: `npm publish --tag <tag>` (`prepack` rebuilds `dist/` first).
|
|
256
|
+
3. For every other tag in the intent: `npm dist-tag add akarisp@<version> <tag>`.
|
|
257
|
+
4. Verify: `RELEASE=<version> npm run test:registry`. It re-reads the registry for up to 10
|
|
258
|
+
minutes while metadata propagates, then installs from the registry into clean consumers.
|
|
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`.
|
|
263
|
+
5. On a mismatch, fix forward: correct a tag with `npm dist-tag add` and re-run the check, or
|
|
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.
|
|
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": {
|
|
@@ -25,10 +25,9 @@
|
|
|
25
25
|
"build": "tsc",
|
|
26
26
|
"test": "node --test test/*.test.ts",
|
|
27
27
|
"test:browser": "playwright test",
|
|
28
|
-
"prepack": "npm run build"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"tag": "alpha"
|
|
28
|
+
"prepack": "npm run build",
|
|
29
|
+
"test:registry": "node --test test/registry/registry.test.ts",
|
|
30
|
+
"test:frameworks": "playwright test -c playwright.frameworks.config.ts"
|
|
32
31
|
},
|
|
33
32
|
"devDependencies": {
|
|
34
33
|
"@playwright/test": "^1.63.0",
|