@caldrix-ai/caldrix 0.0.0-stage → 0.2.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,45 @@
1
+ # Changelog
2
+
3
+ Format after [Keep a Changelog](https://keepachangelog.com/); versions are independent semver, tagged
4
+ `caldrix-js-v<version>`.
5
+
6
+ ## 0.2.0 — 2026-10-29
7
+
8
+ ### Added
9
+
10
+ - The `constraint` generation option: `{ json: <schema> }` restricts the text to a JSON value matching a
11
+ schema from a documented subset, `{ oneOf: [<string>, ...] }` to exactly one of the strings. Both
12
+ tiers. A refusal (an unsupported schema keyword, an empty `oneOf`) is a `CaldrixError` of kind
13
+ `request`. See "Constrained decoding" in the README.
14
+ - Prefix reuse: a generation starts from the context the previous one on the same engine left when the
15
+ new prompt begins with the same tokens, and `usage.cachedTokens` on the last delta reports how many
16
+ prompt tokens were reused.
17
+ - The `logprobs` generation option (at most 20) and `Delta.logprobs`: the top candidates, as
18
+ `{ token, logprob }`, for each token.
19
+ - `doctor().aliases`: every alias this build loads, each with its `format` (`safetensors` or `gguf`).
20
+
21
+ ### Changed
22
+
23
+ - The quantized aliases `smollm2-instruct:q4_K_M` and `smollm2-instruct:q8_0` are recognized and the wasm tier has their kernels: a load reads the GGUF header with a range request, verifies the file against the alias's pinned sha256 before parsing it, and runs the quantized kernels on the wasm tier; what has actually run is recorded under the README's "What has run, and where". The WebGPU tier has no quantized kernels in this version: `backend: "auto"` runs a quantized alias on the wasm tier and an explicit `backend: "webgpu"` is refused by name.
24
+ - A GGUF alias's file download is capped at the alias's pinned size: a longer body is refused by name before the sha256 check and nothing is cached. Offline, a cached copy that fails the pin is refused naming the pin.
25
+
26
+ ## 0.1.0 — 2026-10-27
27
+
28
+ ### Added
29
+
30
+ - The first release, published to npm as `@caldrix-ai/caldrix` (the product is caldrix.js).
31
+ - `Caldrix.load(alias, options)`: loads a model by alias into a dedicated worker and returns an engine
32
+ with `chat`, `complete` (both async iterables of deltas), `doctor` and `dispose`; `probe()` reports
33
+ what the browser offers.
34
+ - Two tiers behind one API: the wasm tier (plan dtypes f32 and bf16) and the WebGPU tier (f32 plan, f32
35
+ or f16 weight storage; f16 has not run in a browser), chosen by `backend: "auto"` from the probe, with the reason in `doctor().why`.
36
+ - Model files from the Hugging Face Hub, digest-checked where the Hub exposes one, cached in the
37
+ browser; `hubBaseUrl` and `offline` options.
38
+ - `assets` option for where the package's worker and `.wasm` come from, and a jsdelivr fallback for the
39
+ package's own files at the installed version (on by default; reported in `doctor().assets` and on
40
+ the console; `assets.fallback: false` turns it off).
41
+ - A same-origin shim so the worker can be served from another origin.
42
+ - Built and driven under Vite 8.3.5 and Next.js 16.4.3 (Turbopack and webpack, `output: "export"`) on the wasm tier, with no bundler configuration.
43
+ - A default context clamp on WebGPU, reported by `doctor()`.
44
+ - Apache-2.0 license for the package, including the compiled browser host it ships, and
45
+ `THIRD_PARTY_NOTICES.md` for the crates compiled into it.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,2 @@
1
+ caldrix.js (the npm package @caldrix-ai/caldrix)
2
+ Copyright 2026 Jyothsna Muttineni, for Caldrix GmbH (in formation)
package/README.md CHANGED
@@ -1,3 +1,231 @@
1
- # Temporary Holding Version
1
+ # caldrix.js
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Run a language model in the browser, in a worker, on WebGPU or WebAssembly. One package: the engine's
4
+ compiled browser host (WebAssembly), the worker that drives it, and the typed API around them. On npm it
5
+ is [`@caldrix-ai/caldrix`](https://www.npmjs.com/package/@caldrix-ai/caldrix).
6
+
7
+ This page states only what `inferno/WEB-VERIFICATION.md` records (in
8
+ the Caldrix repository, which is private, so you cannot open it), what the package's own tests run in
9
+ CI, and what the source does.
10
+
11
+ <!-- host-commit: b22cc6f84423684354e4d7eabaea3a8f339ed4ea -->
12
+
13
+ The compiled host in `host/` is built from the `caldrix-web` crate at the commit in the marker above.
14
+ The release workflow overwrites that marker with the commit it builds; the value in a source checkout
15
+ is a placeholder.
16
+
17
+ ## Install and quick start
18
+
19
+ ```sh
20
+ npm install @caldrix-ai/caldrix
21
+ ```
22
+
23
+ ```ts
24
+ import { Caldrix } from "@caldrix-ai/caldrix";
25
+
26
+ const engine = await Caldrix.load("smollm2-instruct", {
27
+ onProgress: ({ file, loaded, total }) => console.log(file, loaded, total),
28
+ });
29
+
30
+ for await (const delta of engine.chat([{ role: "user", content: "Say hello." }], { maxTokens: 32 })) {
31
+ if (!delta.done) document.body.append(delta.text);
32
+ }
33
+
34
+ console.log(engine.doctor());
35
+ engine.dispose();
36
+ ```
37
+
38
+ The API, as the package's declarations have it:
39
+
40
+ ```ts
41
+ class Caldrix {
42
+ static load(alias: string, opts?: LoadOptions): Promise<Engine>;
43
+ }
44
+ class Engine {
45
+ chat(messages: ChatMessage[], opts?: GenerateOptions): AsyncIterable<Delta>;
46
+ complete(input: string | { ids: number[] }, opts?: GenerateOptions): AsyncIterable<Delta>;
47
+ doctor(): DoctorReport;
48
+ /** Release the worker and everything in it. Every later call throws `request`. */
49
+ dispose(): void;
50
+ }
51
+ declare function probe(): Promise<Capabilities>;
52
+ ```
53
+
54
+ A `Delta` is `{ text, token?, done, finishReason?: "stop" | "length" | "abort", usage?, logprobs? }`. Generation
55
+ options are `temperature`, `topK`, `topP`, `minP`, `repetitionPenalty`, `seed`, `maxTokens` and
56
+ `constraint` (see "Constrained decoding"), `logprobs`, plus a `signal` (an `AbortSignal`). Errors are `CaldrixError` with a `kind` of `probe`, `fit`, `architecture`,
57
+ `fetch`, `digest`, `validate`, `lowering`, `backend` or `request`.
58
+
59
+ Prefix reuse: a generation starts from the context the previous one on the same engine left whenever
60
+ the new prompt begins with the same tokens, so only the rest is prefilled (a chat that appends a turn,
61
+ when its rendered prompt begins with the same tokens). The last delta's `usage.cachedTokens` is the number of prompt tokens
62
+ that were reused, 0 when none were.
63
+
64
+ `logprobs: n` (an integer, at most 20; more is a `request` error) adds `logprobs: { token, logprob }[]`
65
+ to each token's delta: up to `n` candidates for that step (fewer under a constraint).
66
+
67
+ ## Options
68
+
69
+ ```ts
70
+ interface LoadOptions {
71
+ backend?: "auto" | "webgpu" | "wasm" | "webgl";
72
+ offline?: boolean;
73
+ onProgress?: (p: { file: string; loaded: number; total: number | null }) => void;
74
+ hubBaseUrl?: string;
75
+ dtype?: "f32" | "bf16";
76
+ maxContext?: number;
77
+ storage?: "auto" | "f32";
78
+ signal?: AbortSignal;
79
+ assets?: { worker?: string | URL; hostWasm?: string | URL; fallback?: boolean; cdn?: string | URL };
80
+ }
81
+ ```
82
+
83
+ - **`backend`**: `"auto"` (the default) probes the browser and picks WebGPU when an adapter is present
84
+ and `requestDevice` succeeds, wasm otherwise; a bf16 plan goes to wasm on the page, before the worker starts. `"webgpu"` and `"wasm"` force a tier. `"webgl"` is declared and refused: the backend is
85
+ not built. Under `"auto"`, a load WebGPU then refuses (a larger explicit context, a limit, a
86
+ device that fails to open) is served by the wasm tier, and `doctor().why` says so.
87
+ - **Quantized aliases**: `smollm2-instruct:q4_K_M` and `smollm2-instruct:q8_0` are one GGUF file each.
88
+ A load reads the file's header with a range request first, then verifies the whole file against the
89
+ alias's pinned sha256 before parsing it. The wasm tier has their kernels (see "What has run, and where");
90
+ the WebGPU tier refuses them by name in this version. `"auto"` runs them on wasm (and `doctor().why`
91
+ says so); an explicit `backend: "webgpu"` is refused by name, a `lowering` error.
92
+ - **`storage`**: the WebGPU tier's weight storage. `"auto"` stores the block GEMM weights as f16 when the
93
+ adapter has `shader-f16`; `"f32"` keeps them f32 on any adapter. `doctor().storage` reports it (`null`
94
+ on wasm). `storage: "f32"` with `backend: "wasm"` is refused.
95
+ - **`hubBaseUrl`**: where model files are fetched from (default `https://huggingface.co`). `offline`
96
+ uses only the browser's cache and fails with `fetch` for a file it lacks.
97
+ - **`assets`**: where the package's own files come from; see "Network" below.
98
+ - **`doctor()`** reports the tier that runs, `device`, `dtype`, `storage`, `adapter`, on WebGPU only `maxContext` and `contextClamp`, where each model file came from and whether its digest was checked, `assets` (the
99
+ source and URL of the worker and the `.wasm`: `bundle`, `cdn` or `page`), `aliases` (every alias
100
+ this build loads, each with its `format`, `safetensors` or `gguf`), and `why`.
101
+
102
+ ## Constrained decoding
103
+
104
+ ```ts
105
+ interface GenerationOptions {
106
+ // temperature, topK, topP, minP, repetitionPenalty, seed, maxTokens as above
107
+ constraint?: { json: Record<string, unknown> } | { oneOf: string[] };
108
+ logprobs?: number;
109
+ }
110
+ ```
111
+
112
+ `constraint` limits what the model may write, on both tiers. `{ oneOf: ["yes", "no"] }` yields exactly
113
+ one of the strings and stops. `{ json: <schema> }` yields a JSON value matching the schema.
114
+
115
+ - **Reachable options.** A `oneOf` option is guaranteed reachable only when it is ASCII.
116
+ - **The schema subset.** `type` is `object` (with `properties`, `required`, and `additionalProperties:
117
+ false`), `array` (`items`), `string` (`maxLength`), `number`, `integer`, `boolean` or `null`; `enum`
118
+ works on any type; `oneOf` and `anyOf` of those mean "any branch may match". The annotation keywords
119
+ `description`, `title`, `default`, `$schema`, `$comment` and `examples` are accepted and ignored. `$ref`
120
+ and every other keyword are refused by name, as is a schema with no `type`, `enum`, `oneOf` or
121
+ `anyOf`, and a schema that is not an object (a bare `true` or `false`). When `additionalProperties` is
122
+ absent, any other key is allowed and its value may be any JSON value; an array with no `items` holds
123
+ any JSON values. `integer` refuses a `.` or an exponent. Keys and `enum` members are matched by their
124
+ JSON text, so an escaped spelling of a key is not that key.
125
+ - **A refusal** (an unsupported keyword, an empty `oneOf`) is a `CaldrixError` of kind `request`
126
+ whose message starts `constraint: `.
127
+ - **The vocabulary** the masks read is built on the first constrained generation per loaded model, so
128
+ that request pays for it.
129
+ - **Stopping.** A JSON value stops when it is complete. Nothing forces a model to finish one: a
130
+ generation can end at `maxTokens` with `finishReason: "length"` and an incomplete value.
131
+ - There is no grammar constraint.
132
+ - What has run: the package's own tests, on a tiny character-vocabulary test model whose output is
133
+ noise, so they check the mask (`oneOf`, an `enum`, a small object schema, a refusal) and not the quality
134
+ of any model's text. `oneOf` also runs in the e2e's `chromium-webgpu` project (SwiftShader in CI).
135
+
136
+ ## What has run, and where
137
+
138
+ Only these model runs are recorded (`inferno/WEB-VERIFICATION.md`, entries 5, 8 and 9, and entry 10 for
139
+ the quantized aliases); nothing else is claimed.
140
+
141
+ - **Model:** SmolLM2-135M-Instruct, one prompt, 8 greedy tokens. No other model or prompt.
142
+ - **Browser:** Chromium driven by Playwright, headless only: the headless shell 153.0.8010.12 on Linux and on
143
+ the operator's Apple M1 Max, and on that Mac Playwright's full Chromium (new headless mode, userAgent
144
+ `HeadlessChrome/153.0.0.0`) for the WebGPU tier. No other browser.
145
+ - **wasm tier:** both plan dtypes, f32 and bf16, on Linux and on the Mac with the same lines. The tokens
146
+ equal the references' tokens. The f32 logits stayed inside the 1e-2 bound on every row, worst 7.796401e-4.
147
+ The bf16 result rests on token equality alone; the logits were recorded, not gated.
148
+ - **WebGPU tier on a real adapter:** the Mac's own, vendor `apple`, architecture `metal-3` (its own
149
+ strings; `device` and `description` empty), with `shader-f16`. The f32 plan at f32 weight storage,
150
+ token-exact, logits worst 6.6792103e-4 against the same 1e-2 bound; at f16 weight storage, a diagnostic
151
+ gated by no bound, every row finite, worst 5.0272985e-4, token-exact. The product path's tokens equal the
152
+ test worker's at both storage forms.
153
+ - **WebGPU tier on SwiftShader:** Dawn on SwiftShader, Google's CPU Vulkan implementation, which is a CPU and
154
+ not a GPU. The f32 plan at f32 weight storage, token-exact, logits worst 5.874168e-4 against the same bound.
155
+ - **Phase 2's exit is closed on the gates** (entry 9), with the run's two process deviations recorded there:
156
+ the browser stages ran outside the sandbox, and the build's first attempt failed at its install step.
157
+ - quantized aliases: off-browser at the desk (`inferno/WEB-VERIFICATION.md` entry 10); in headless Chromium the host's `loadGguf` on the tiny test fixture only — no browser run has loaded the pinned files; nothing on a real adapter.
158
+ - **Not run:** any other adapter or GPU; a headed browser; the browser stages inside a sandbox; the scalar
159
+ (non-SIMD) wasm spelling in a browser; real-Hub digest behaviour (the runs used a loopback Hub stand-in);
160
+ any browser other than Playwright's headless Chromium; any other model. No performance figure is recorded
161
+ or claimed.
162
+
163
+ ## The WebGPU default context
164
+
165
+ Without `maxContext`, the WebGPU tier clamps the context so the attention kernel's grid stays within
166
+ `maxComputeWorkgroupsPerDimension`. At the standard 65535 workgroups per dimension, SmolLM2's 8192
167
+ default context loads at 7282; `doctor()` reports the clamp in `contextClamp` and the value in
168
+ `maxContext`. A larger `maxContext` that the adapter's limits cannot hold is refused by WebGPU, and
169
+ `"auto"` then serves the load on wasm.
170
+
171
+ ## Network
172
+
173
+ No telemetry. The network is the Hub, for the model files you asked for, and jsdelivr, for the
174
+ package's own assets when the bundle's copy fails.
175
+
176
+ - **When the fallback fires:** the worker falls back if it fails before it is ready (its script, a chunk
177
+ or the host glue did not load, or the page refused to construct it); the `.wasm` falls back, inside
178
+ the worker, if its fetch fails. Each asset is tried locally first and falls back independently.
179
+ - **What it fetches:** `https://cdn.jsdelivr.net/npm/@caldrix-ai/caldrix@<installed version>/dist/worker.js` and
180
+ `.../host/caldrix_web_bg.wasm`, at the version you installed, so the `.wasm` matches the glue.
181
+ - **It is never silent:** it is warned once per load on the console, and `doctor().assets` reports the
182
+ source and URL of each asset.
183
+ - **Opt out:** `assets: { fallback: false }`. An explicit `assets.worker` or `assets.hostWasm` is used as
184
+ given, with no fallback for that asset. `assets.cdn` points the fallback at your own mirror.
185
+ - **What it trusts:** the fallback runs jsdelivr's copy of that version with your page's origin (the
186
+ worker can fetch your origin with its credentials and read its IndexedDB and caches), and no integrity
187
+ check is possible for a worker's module import, so a page that cannot accept that sets
188
+ `assets.fallback: false`.
189
+ - **What has been checked:** jsdelivr serves the published package's worker, glue and WebAssembly files
190
+ byte-identical to the npm tarball, with CORS open to any origin. After the first release was published,
191
+ the browser fallback ran once against jsdelivr itself in headless Chromium, with the default `cdn`: a
192
+ page whose bundle lacked the worker, and one whose bundle lacked the `.wasm`, each chatted to done
193
+ with `doctor()` naming the jsdelivr URLs and one warning on the console. That was a one-off check at
194
+ the desk; the committed tests point `assets.cdn` at a loopback origin and never reach jsdelivr.
195
+ - **Content-Security-Policy:** a page that uses the fallback needs `worker-src blob:` (a cross-origin
196
+ worker starts through a same-origin module shim), `script-src` and `connect-src` for the CDN origin,
197
+ and `'wasm-unsafe-eval'` for any WebAssembly.
198
+
199
+ ## Bundlers
200
+
201
+ What ran: Vite 8.3.5 and Next.js 16.4.3 (Turbopack and webpack) with `output: "export"`, a minimal app
202
+ each, on the wasm tier with a tiny Llama fixture served from a loopback Hub, in headless Chromium. The
203
+ package's own bundler test (`tests/bundlers/`) installs the packed tarball into those apps and runs in
204
+ CI. Those apps needed no bundler configuration. Nothing else is claimed: other versions, other bundlers
205
+ and the WebGPU tier under a bundler have not been run. Production builds only (`vite build`, `next build`);
206
+ `vite dev` and `next dev` were not run. Notes:
207
+
208
+ - Each app ships an unused copy of the worker, about 16 kB, and (Next only) an unused copy of the host
209
+ glue, about 13.5 kB. The worker copy comes from the package's `new URL("./worker.js", import.meta.url)`
210
+ literal, which it keeps so bundlers find the worker; the glue copy comes from wasm-bindgen's own
211
+ `.wasm` URL literal inside the glue, which the package does not control.
212
+ - By the package's design, not run: with assets on another origin (Vite `base`, Next `assetPrefix`) the
213
+ bundle try is cross-origin, the shim imports the raw copy of the worker whose `../host/` is not beside
214
+ it, and every load falls back to jsdelivr. Set `assets.worker` and `assets.hostWasm` instead, serving
215
+ `dist/` and `host/` together on that origin.
216
+ - Next pages that import the package are client components.
217
+
218
+ ## Releases and provenance
219
+
220
+ Versions are independent semver; releases are tagged `caldrix-js-v0.x.y` and the tag must equal the
221
+ version in `package.json`. There is no npm provenance: the source repository is private, and npm does not
222
+ generate provenance for a private repository. Publishes are staged by a limited token and released by
223
+ hand with 2FA: the release workflow's token can only stage a version (npm's "stage only" access), and
224
+ a staged version goes live only when the owner approves it on npmjs.com with two-factor
225
+ authentication. The tarball carries no sourcemaps.
226
+
227
+ ## License
228
+
229
+ The npm package `@caldrix-ai/caldrix` (caldrix.js) is under Apache-2.0 (`LICENSE`, `NOTICE`). The compiler itself is not open source; this package ships its compiled
230
+ browser host (`host/`) under this license. Third-party components compiled into the host remain under
231
+ their own licenses; see `THIRD_PARTY_NOTICES.md`.