arcane-os 0.1.2 → 0.2.1

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 (54) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/NOTICE +5 -3
  3. package/README.md +73 -24
  4. package/browser-runtime/ARCANE_SDK_BROWSER_RELEASE.json +67 -18
  5. package/browser-runtime/ai/ARCANE_AI_BROWSER_WASM_COMPONENTS.json +16 -5
  6. package/browser-runtime/ai/browser-kokoro-worker.mjs +3 -0
  7. package/browser-runtime/ai/browser-speech-artifacts.mjs +1108 -0
  8. package/browser-runtime/ai/browser-speech-providers.mjs +780 -0
  9. package/browser-runtime/ai/browser-speech.mjs +9 -0
  10. package/browser-runtime/ai/browser-wasm-llm-provider.mjs +1537 -167
  11. package/browser-runtime/ai/browser-wasm.mjs +46 -1
  12. package/browser-runtime/ai/browser-whisper-worker.mjs +3 -0
  13. package/browser-runtime/ai/browser-wllama-runtime.mjs +677 -132
  14. package/browser-runtime/ai/model-controller.mjs +138 -12
  15. package/browser-runtime/ai/speech-worker-client.mjs +207 -0
  16. package/browser-runtime/ai/speech-worker-runtime.mjs +516 -0
  17. package/browser-runtime/ai/wllama/index.mjs +389 -0
  18. package/docs/architecture.md +132 -22
  19. package/docs/reference/README.md +1 -1
  20. package/docs/reference/ai/browser-wasm.md +101 -42
  21. package/docs/reference/availability-and-normalization.md +19 -5
  22. package/docs/reference/behavioral-testing.md +18 -5
  23. package/docs/reference/cli.md +2 -2
  24. package/docs/reference/inventory/package-api.json +14 -14
  25. package/docs/reference/protocols.md +4 -4
  26. package/docs/reference/sdk-api.md +68 -38
  27. package/docs/work-amplification.md +8 -4
  28. package/package.json +7 -3
  29. package/runtime/ARCANE_RUNTIME_RELEASE.json +50 -20
  30. package/runtime/arcane/components/chat.html +551 -62
  31. package/runtime/arcane/components/speech.html +1113 -265
  32. package/runtime/arcane/entities/Chat.js +246 -43
  33. package/runtime/arcane/modules/AI.js +1394 -162
  34. package/runtime/arcane/modules/AIProviderRuntime.js +2289 -0
  35. package/runtime/arcane/modules/AIRuntimeState.js +872 -0
  36. package/runtime/arcane/modules/ConfiguredAIChatSession.js +382 -31
  37. package/runtime/arcane/modules/DBOPFSDocumentLibrary.js +1106 -0
  38. package/runtime/arcane/modules/DocumentLexicalSearch.js +292 -0
  39. package/runtime/arcane/modules/PersistentAIChatSession.js +268 -0
  40. package/runtime/arcane/modules/StaticDocumentCatalog.js +25 -206
  41. package/schemas/arcane-lock.schema.json +10 -6
  42. package/src/cli/main.mjs +14 -2
  43. package/src/constants.mjs +1 -1
  44. package/src/dev-server.mjs +273 -26
  45. package/src/doctor.mjs +1 -3
  46. package/src/import-map.mjs +193 -84
  47. package/src/packager/core.mjs +313 -41
  48. package/src/runtime.mjs +14 -4
  49. package/src/scaffold.mjs +45 -17
  50. package/src/sdk-browser-runtime.mjs +28 -75
  51. package/src/templates/workspace-template.mjs +27 -8
  52. package/src/toolchain.mjs +13 -2
  53. package/src/workspace-runtime.mjs +1 -1
  54. package/src/workspace.mjs +178 -25
@@ -9,7 +9,7 @@ page is the focused local-browser path beneath the normalized AI decision
9
9
  guide.
10
10
 
11
11
  The wiring example assumes a scaffolded or materialized Arcane application
12
- with SDK `0.1.1`'s authenticated runtime tree and 86-entry browser import map.
12
+ with SDK `0.1.2`'s authenticated runtime tree and 86-entry browser import map.
13
13
  `arcane/DBOPFS` is a managed browser-map specifier, not an npm package export.
14
14
  See [browser runtime delivery](../protocols.md#browser-runtime-delivery) before
15
15
  using the example in a custom host or bundler.
@@ -25,12 +25,9 @@ import {
25
25
 
26
26
  const MODEL = Object.freeze({
27
27
  id:'my-reviewed-model',
28
- name:'model-q4.gguf',
29
- immutableUrl:'https://models.example/revisions/4f7c/model-q4.gguf',
28
+ url:'https://models.example/revisions/4f7c/model-q4.gguf',
30
29
  bytes:123456789,
31
- sha256:'0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef',
32
- licenseSpdx:'Apache-2.0',
33
- sourceRevision:'4f7c'
30
+ sha256:'0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'
34
31
  });
35
32
 
36
33
  const dbopfs = globalThis.dbopfs || new DBOPFS({applicationId:'my-app'});
@@ -38,7 +35,11 @@ await dbopfs.readyPromise;
38
35
  const source = createBrowserModelSource(MODEL);
39
36
  const store = createDbopfsModelStore({dbopfs});
40
37
  const provider = createBrowserWasmLlmProvider({source, store});
41
- const ai = createArcaneAI({provider, loadPolicy:'manual'});
38
+ const ai = createArcaneAI({
39
+ provider,
40
+ loadPolicy:'manual',
41
+ security:{secure:true}
42
+ });
42
43
 
43
44
  // Put this behind an explicit user action: it can download MODEL.bytes bytes.
44
45
  async function loadReviewedModel() {
@@ -51,7 +52,7 @@ The browser-WASM runtime closure packages the authenticated
51
52
  llama.cpp MIT license texts. It
52
53
  packages no model weights, model catalog, CDN fallback, native provider, speech
53
54
  synthesis, or transcription. Callers supply the exact model authority. `bytes`
54
- is the expected positive byte length, not inline model data.
55
+ is an optional expected positive byte length, not inline model data.
55
56
 
56
57
  ## Lifecycle at a glance
57
58
 
@@ -66,7 +67,7 @@ is the expected positive byte length, not inline model data.
66
67
  | `ai.llm.chat(request)` / `ai.fetchRequest(request)` | Validated OpenAI-like completion. |
67
68
  | `ai.llm.stream(request)` | Frozen async-iterator handle with `result` and `cancel(reason)`. |
68
69
  | `ai.streamRequest(request)` | Consumes the stream and returns text or `{toolName: argumentJsonString}`. |
69
- | `ai.unload()` | Cancels active work, releases the Wllama session, and returns flat unloaded status; verified DBOPFS cache remains. |
70
+ | `ai.unload()` | Cancels active work, releases the Wllama session, and returns flat unloaded status; the DBOPFS cache remains. |
70
71
  | `ai.dispose()` | Permanently disposes the controller; explicit `store.remove(source)` is required to delete cached model bytes. |
71
72
 
72
73
  The controller emits `statechange` and `progress` through
@@ -74,25 +75,71 @@ The controller emits `statechange` and `progress` through
74
75
  current frozen status. Provider states are `unloaded`, `loading`, `ready`,
75
76
  `unloading`, and `error`.
76
77
 
77
- ## Model authority and cache admission
78
+ ## Model authority, security, and cache admission
79
+
80
+ The canonical model descriptor is `{id, url, bytes?, sha256?}`. `id` and `url`
81
+ are required. The URL must be absolute HTTPS without credentials or a fragment;
82
+ revision-floating `main`, `master`, and `latest` path segments are rejected.
83
+ When supplied, `bytes` is a positive safe integer and `sha256` is exactly 64
84
+ hexadecimal characters.
85
+
86
+ App, provider/model-binding, and load-operation options use the same
87
+ plain-JavaScript shape:
88
+
89
+ ```javascript
90
+ {
91
+ security:{
92
+ secure:true,
93
+ checks:{byteLength:true, sha256:true}
94
+ }
95
+ }
96
+ ```
78
97
 
79
- `createBrowserModelSource()` requires `id`, `name`, `immutableUrl`, `bytes`,
80
- `sha256`, `licenseSpdx`, and `sourceRevision`. The URL must be absolute HTTPS
81
- without credentials or a fragment. Revision-floating `main`, `master`, and
82
- `latest` path segments are rejected. `name` is one filename. `bytes` is a
83
- positive safe integer and `sha256` is exactly 64 hexadecimal characters.
98
+ The SDK default is `secure:false`. Security fields resolve independently from
99
+ the load operation, then provider/model binding, then app configuration, then
100
+ the SDK default. Omitted fields inherit; they do not become `false`. After
101
+ resolution, `secure:true` makes both checks enabled by default and
102
+ `secure:false` makes both checks disabled by default. An explicit inherited or
103
+ lower-scope `checks.byteLength` or `checks.sha256` boolean overrides that secure
104
+ default for its check.
105
+
106
+ An enabled byte-length check requires descriptor `bytes` and compares it with
107
+ the actual cached or downloaded byte count. A disabled byte-length check permits
108
+ `bytes` to be absent and never rejects a cached or downloaded model by comparing
109
+ it with an expected size. The store still counts and records the observed byte
110
+ length for storage and progress metadata on every install and cache reuse.
111
+
112
+ An enabled SHA-256 check requires descriptor `sha256` and hashes the actual
113
+ stored or cached file. A disabled SHA-256 check permits `sha256` to be absent
114
+ and does not hash or reread a multi-gigabyte model solely to produce a digest.
115
+ Only enabled checks fail closed. Regardless of optional integrity checks, a
116
+ load succeeds only after Wllama reports that the model is loaded.
117
+
118
+ The DBOPFS adapter commits an `arcane.ai.browser-wasm.model.v3` completion
119
+ manifest with the observed byte length. Status reports the effective
120
+ `security.secure`, both effective check booleans, and per-check integrity
121
+ outcomes. Overall integrity is `verified` when every enabled check succeeded,
122
+ `pending` while an enabled check is running, and `unchecked` when neither check
123
+ is enabled. Before completion an enabled check reports `pending`; after a
124
+ successful load each check independently reports `verified` or `unchecked`.
125
+ `load({offline:true})` never
126
+ performs a model request; it uses a compatible cached entry or rejects with
127
+ `ARCANE_AI_MODEL_OFFLINE_MISS`.
84
128
 
85
- `licenseSpdx` and `sourceRevision` are required provenance labels supplied by
86
- the caller; the SDK does not independently prove the license or derive the
87
- revision from the URL. Redirects are followed and the final URL must remain
88
- HTTPS. Byte length and SHA-256 remain the actual admission authority.
129
+ ```javascript
130
+ const {security, integrity} = ai.status().llm;
131
+ console.log(security.secure, security.checks.byteLength, security.checks.sha256);
132
+ console.log(integrity.state); // 'unchecked' or 'verified'
133
+ console.log(integrity.byteLength.observed); // actual cached/downloaded bytes
134
+ ```
89
135
 
90
- The DBOPFS adapter stores model bytes and then commits an
91
- `arcane.ai.browser-wasm.model.v2` completion manifest. It reopens and fully
92
- rehashes the bytes before returning an installed receipt and again before every
93
- verified cache reuse. Missing, malformed, stale, wrong-length, or wrong-digest
94
- entries are removed. `load({offline:true})` never performs a model request; it
95
- uses a fully rehashed cache or rejects with `ARCANE_AI_MODEL_OFFLINE_MISS`.
136
+ For compatibility, older descriptors can supply `immutableUrl` as the URL alias
137
+ and `name` as a cache-filename hint. If both `url` and `immutableUrl` are
138
+ present, they must match. Legacy `licenseSpdx` and `sourceRevision` properties
139
+ are not canonical descriptor fields or runtime admission checks; applications
140
+ remain responsible for model selection, provenance, and license compliance.
141
+ Version-2 cache manifests can be migrated to version 3 when their model identity
142
+ matches, without inventing an integrity result.
96
143
 
97
144
  `localOnly:true` describes inference after load. It does not mean a cache miss
98
145
  cannot download. Source downloads use CORS, omit credentials and referrer,
@@ -150,7 +197,7 @@ as unavailable.
150
197
  | --- | --- |
151
198
  | Source and download | `ARCANE_AI_MODEL_SOURCE_INVALID`, `ARCANE_AI_MODEL_SOURCE_UNAVAILABLE`, `ARCANE_AI_MODEL_DOWNLOAD_FAILED`, `ARCANE_AI_MODEL_REDIRECT_BLOCKED`, `ARCANE_AI_MODEL_SIZE_MISMATCH`, `ARCANE_AI_MODEL_DIGEST_MISMATCH` |
152
199
  | Cache and storage | `ARCANE_AI_MODEL_CACHE_REJECTED`, `ARCANE_AI_MODEL_OFFLINE_MISS`, `ARCANE_AI_STORAGE_UNAVAILABLE`, `ARCANE_AI_STORAGE_READ_FAILED`, `ARCANE_AI_STORAGE_DELETE_FAILED` |
153
- | Lifecycle | `ARCANE_AI_UNAVAILABLE`, `ARCANE_AI_NOT_READY`, `ARCANE_AI_LOAD_FAILED`, `ARCANE_AI_UNLOAD_FAILED`, `ARCANE_AI_DISPOSE_FAILED`, `ARCANE_AI_DISPOSED`, `ARCANE_AI_OPERATION_SUPERSEDED` |
200
+ | Lifecycle | `ARCANE_AI_UNAVAILABLE`, `ARCANE_AI_NOT_READY`, `ARCANE_AI_LOAD_FAILED`, `ARCANE_AI_UNLOAD_FAILED`, `ARCANE_AI_DISPOSE_FAILED`, `ARCANE_AI_DISPOSED`, `ARCANE_AI_OPERATION_SUPERSEDED`, `ARCANE_AI_SECURITY_RELOAD_REQUIRED` |
154
201
  | Requests | `ARCANE_AI_REQUEST_ABORTED`, `ARCANE_AI_REQUEST_FAILED`, `ARCANE_AI_INVALID_PROVIDER_RESULT`, `ARCANE_AI_LOCAL_ONLY_UNAVAILABLE`, `ARCANE_AI_ADAPTER_PROTOCOL_MISMATCH` |
155
202
  | Diagnostics | `ARCANE_AI_PROBE_FAILED` |
156
203
 
@@ -166,7 +213,7 @@ downloads a model.
166
213
  ### Overview
167
214
 
168
215
  Deep-frozen identity for the shipped browser runtime. Its protocol is
169
- `arcane-ai-browser-wasm/1`; the provider adapter uses
216
+ `arcane-ai-browser-wasm/2`; the provider adapter uses
170
217
  `arcane-ai-adapter/1`. It records Wllama `3.6.0`, the embedded llama.cpp
171
218
  revision, authenticated module/WASM byte lengths and SHA-256 values, licenses,
172
219
  and the disabled compatibility-runtime and remote-model-helper policy.
@@ -203,13 +250,16 @@ store, and Wllama provider beneath it.
203
250
  ### Signature and result
204
251
 
205
252
  ```text
206
- createArcaneAI({ llm=null, provider=null, loadPolicy='on-demand' }={})
253
+ createArcaneAI({ llm=null, provider=null, loadPolicy='on-demand', security }={})
207
254
  ```
208
255
 
209
256
  At least one `llm` or `provider` is required; when both are supplied, `llm`
210
257
  takes precedence. `loadPolicy` is `on-demand` or `manual`. The frozen result
211
258
  contains `llm`, `runtime`, `status`, `load`,
212
259
  `unload`, `probe`, `fetchRequest`, `streamRequest`, and `dispose`.
260
+ `security` is the app-level security configuration inherited by provider loads.
261
+ The SDK default is `secure:false`; `ai.load({security})` can override inherited
262
+ fields for that operation.
213
263
 
214
264
  ### Availability and normalization
215
265
 
@@ -230,8 +280,8 @@ off();
230
280
 
231
281
  ### Overview
232
282
 
233
- Validates caller-owned model provenance and creates the one cancellable HTTPS
234
- download source accepted by this provider.
283
+ Validates a caller-owned canonical `{id, url, bytes?, sha256?}` descriptor and
284
+ creates the one cancellable HTTPS download source accepted by this provider.
235
285
 
236
286
  ### Signature and result
237
287
 
@@ -239,14 +289,15 @@ download source accepted by this provider.
239
289
  createBrowserModelSource(descriptor, { fetchImpl=null }={})
240
290
  ```
241
291
 
242
- The frozen source includes `kind`, the seven canonical descriptor fields,
292
+ The frozen source includes `kind`, the canonical descriptor fields,
243
293
  `descriptor`, and `open({signal})`. `open()` returns a readable response body,
244
294
  requested/final URLs, and `cancel()`; it does not admit bytes to the cache.
245
295
 
246
296
  ### Availability and normalization
247
297
 
248
- **Browser Fetch with CORS.** URL and metadata syntax are normalized; exact
249
- length and SHA-256 are enforced when the store installs the stream.
298
+ **Browser Fetch with CORS.** URL and optional metadata syntax are normalized.
299
+ Expected length and SHA-256 are enforced only when their effective checks are
300
+ enabled for load.
250
301
 
251
302
  ### Example
252
303
 
@@ -265,19 +316,23 @@ created by this module. Structural lookalikes are rejected.
265
316
  ### Signature and result
266
317
 
267
318
  ```text
268
- createBrowserWasmLlmProvider({ source, store, loadDefaults={}, logger=console }={})
319
+ createBrowserWasmLlmProvider({ source, store, loadDefaults={}, security, logger=console }={})
269
320
  ```
270
321
 
271
322
  The frozen result exposes protocol and provider identity, model metadata,
272
323
  `capabilities`, `status`, `load`, `unload`, `chat`, `stream`, `streamChat`,
273
324
  `use`, `probe`, and `dispose`. Direct provider `load()` returns `{model,status}`;
274
325
  the facade `ai.load()` returns the flat controller status.
326
+ Provider `security` supplies the provider/model-binding scope. Direct
327
+ `provider.load({security})` and facade `ai.load({security})` supply the
328
+ operation scope.
275
329
 
276
330
  ### Availability and normalization
277
331
 
278
- **Browser with WebAssembly and verified DBOPFS model bytes.** Inference is local
279
- after load. WebGPU is optional and defaults to zero GPU layers unless the caller
280
- selects otherwise.
332
+ **Browser with WebAssembly and DBOPFS model bytes.** Inference is local after a
333
+ successful Wllama load. WebGPU is optional and defaults to zero GPU layers
334
+ unless the caller selects otherwise. Status discloses effective checks and
335
+ whether enabled integrity checks are pending, unchecked, or verified.
281
336
 
282
337
  ### Example
283
338
 
@@ -295,7 +350,8 @@ console.log(provider.status().state); // unloaded
295
350
  ### Overview
296
351
 
297
352
  Adapts an existing DBOPFS instance without renaming or replacing its public
298
- methods. The adapter owns verified model-file and completion-manifest behavior.
353
+ methods. The adapter owns model-file, observed-byte, optional-check, and
354
+ completion-manifest behavior.
299
355
 
300
356
  ### Signature and result
301
357
 
@@ -305,13 +361,16 @@ createDbopfsModelStore({ dbopfs, tableName='arcane_ai_browser_models' }={})
305
361
 
306
362
  The frozen result contains `kind`, `tableName`, the original `adapter`, and
307
363
  `ready`, `openVerified`, `install`, `ensure`, and `remove`. `ensure()` returns a
308
- file, completion manifest, and cache state `verified` or `installed`.
364
+ file, completion manifest, observed byte count, integrity detail, and cache state
365
+ `cached` or `installed`. `openVerified()` remains a compatibility helper that
366
+ requires both byte-length and SHA-256 verification.
309
367
 
310
368
  ### Availability and normalization
311
369
 
312
- **Browser with a ready DBOPFS instance and OPFS.** Cache receipts are local
313
- integrity evidence. They are not transferable capability tokens and do not
314
- prove model license rights.
370
+ **Browser with a ready DBOPFS instance and OPFS.** A cache receipt reports only
371
+ the checks actually performed. Unchecked cache metadata is not integrity
372
+ evidence, and no cache receipt is a transferable capability token or proof of
373
+ model license rights.
315
374
 
316
375
  ### Example
317
376
 
@@ -29,7 +29,7 @@ version; WebKitGTK availability must not be generalized to macOS.
29
29
  | Scaffold, inspect, test, package, bundle, build, verify, or run an app | `arcane` CLI or `arcane-os` package functions | **Node**; native targets invoke one explicit provider | CLI events and SDK errors/results are normalized by versioned SDK contracts. Native artifact receipts remain target-specific inside a common receipt lifecycle. |
30
30
  | Publish application events or review a bounded event history | `arcane-os/event-manager` | **Node** and **Browser**; optional DOM capture needs a browser DOM or compatible host | Live listeners receive original arguments. Recorded payloads and metadata become bounded, redacted, deeply frozen `arcane-event-stack/1` snapshots. The stack format is local diagnostic data, not a host transport. |
31
31
  | Build browser UI and app-local behavior | `/arcane/modules/*.js`, shared entities, and components | **Browser**; many modules also run inside every native renderer | Pure modules own their result contracts. Modules that call `Arcane` inherit the bridge boundary described below. |
32
- | Run a caller-selected local LLM entirely in a browser renderer | `arcane-os/ai/browser-wasm` through `createArcaneAI()` | **Browser** only; WebAssembly and OPFS/DBOPFS are required, WebGPU is optional, and a cache miss uses the caller's admitted HTTPS model URL unless `offline:true` | The facade normalizes lifecycle, status, streaming, cancellation, and structural tool-call visibility. Model URL, byte length, SHA-256, license identifier, and revision remain explicit caller authority. |
32
+ | Run a caller-selected local LLM entirely in a browser renderer | `arcane-os/ai/browser-wasm` through `createArcaneAI()` | **Browser** only; WebAssembly and OPFS/DBOPFS are required, WebGPU is optional, and a cache miss uses the caller's HTTPS model URL unless `offline:true` | The facade normalizes lifecycle, status, security precedence, effective-check disclosure, streaming, cancellation, and structural tool-call visibility. The canonical model descriptor is `{id, url, bytes?, sha256?}`; license is application provenance policy, not a runtime admission check. |
33
33
  | Read host identity, capabilities, storage, preferences, appearance, or platform state | `globalThis.Arcane` | **Cross-host** where the method is implemented and admitted | Promise behavior and `Arcane.Error` are normalized. Result fields are normalized unless the method explicitly documents a platform-dependent snapshot. |
34
34
  | Use local AI without coupling app code to Ollama HTTP | `Arcane.localAI`, `Arcane.ai`, or `/arcane/modules/Ollama.js` | Primarily **Native**; Android exposes a narrower admitted inference projection | Admission, errors, and managed-operation events are normalized. Direct Ollama response envelopes remain **Provider-native**. |
35
35
  | Use OpenAI from the renderer profile | `/arcane/modules/AI.js` | **Cloud** from an allowed browser/native renderer | High-level AI chat/text behavior is normalized by the module; raw provider diagnostics and some response detail remain provider-specific. No automatic cloud fallback is inferred from local failure. |
@@ -89,10 +89,24 @@ resource limits still apply.
89
89
 
90
90
  `localOnly:true` describes inference after load; it does not promise that load
91
91
  is offline. A normal cache miss downloads from the exact caller-supplied HTTPS
92
- URL. `load({offline:true})` permits only an existing cache entry whose model
93
- bytes are fully rehashed, otherwise it rejects with
94
- `ARCANE_AI_MODEL_OFFLINE_MISS`. Tool calls are result data for application
95
- review and dispatch; the SDK never executes them.
92
+ URL. App, provider/model-binding, and load-operation options use
93
+ `{security:{secure?:boolean, checks?:{byteLength?:boolean, sha256?:boolean}}}`.
94
+ Fields resolve independently from load operation to provider/model binding to
95
+ app configuration to the SDK default `secure:false`; omitted fields inherit.
96
+ The resolved `secure` value supplies the default for both checks, and an
97
+ explicit per-check boolean overrides that default.
98
+
99
+ An enabled check requires and verifies its matching descriptor field. A
100
+ disabled byte-length check permits `bytes` to be absent and never compares an
101
+ expected size, although the actual downloaded or cached byte count is always
102
+ recorded for storage and progress metadata. A disabled SHA-256 check permits
103
+ `sha256` to be absent and performs no hash or digest-only reread. Status reports
104
+ the effective checks and distinguishes unchecked integrity from successful
105
+ verification of the enabled checks. Only enabled checks fail closed, while
106
+ successful Wllama model loading remains mandatory. `load({offline:true})` permits only a compatible
107
+ cache entry and otherwise rejects with `ARCANE_AI_MODEL_OFFLINE_MISS`. Tool
108
+ calls are result data for application review and dispatch; the SDK never
109
+ executes them.
96
110
 
97
111
  ### Arcane bridge-normalized
98
112
 
@@ -37,7 +37,7 @@ release acceptance.
37
37
  | EventManager and event stacks | Live pub/sub ordering and payload identity, nested causation, immutable/redacted snapshots, strict import, bounded overflow, seek, all playback modes/lifecycle outcomes, cancellation, and DOM start/stop/privacy behavior. | Real user journeys and browser layout belong in a browser harness; event-stack review never proves that external side effects can be replayed. |
38
38
  | CLI | Commands parse, acknowledge, select one scope, produce normalized human/JSON/NDJSON output, propagate cancellation/failure, and reject invalid cardinality. | Native build/run requires the selected real provider and host. |
39
39
  | Browser runtime modules | Every shipped ESM module parses and its export inventory matches the catalog; pure helpers run focused success/error cases. | DOM, OPFS, media, and Web Component journeys use a browser harness. |
40
- | Browser-WASM local AI | The exact five-export namespace, runtime authority, model-source validation, DBOPFS adapter contract, provider/facade lifecycle, lazy/manual policy, abort normalization, and structural-only tool behavior run with bounded deterministic providers. | The publication gate installs the packed SDK into a real Chrome app, loads the authenticated Wllama 3.6.0 JS/WASM assets, performs a cold exact-length/SHA-256 model install, real inference, in-flight cancellation, unload, and a verified offline reload with zero model requests. It is an explicit heavyweight capability gate, not an implicit model download in every local `npm run check`. |
40
+ | Browser-WASM local AI | The exact exported namespace, canonical `{id, url, bytes?, sha256?}` descriptor, fieldwise app/provider/load security precedence, default-unchecked and secure-check paths, observed-byte persistence, honest status, provider/facade lifecycle, lazy/manual policy, successful Wllama-load requirement, abort normalization, and structural-only tool behavior run with bounded deterministic providers. | The publication gate installs the packed SDK into a real Chrome app, loads the authenticated Wllama 3.6.0 JS/WASM assets, configures `secure:true`, performs a cold exact-length/SHA-256 model install, real inference, in-flight cancellation, unload, and a verified offline reload with zero model requests. It is an explicit heavyweight capability gate, not an implicit model download in every local `npm run check`. |
41
41
  | Core bridge docs | Canonical namespace/method/event/entity inventories match their one-per-member guides and required sections. | Live Core conformance belongs in Arcane OS because Core implementation is not shipped as SDK source. |
42
42
  | Arcane Ollama wrapper | Missing-host error, method forwarding, text/readiness normalization, unload request, and stream-option forwarding run against a deterministic fake `Arcane.ollama`. | Real managed-service, model download/create, GPU/resource admission, and service restart require an admitted Arcane host. |
43
43
  | Native providers | Plan/provider protocol, explicit target, receipt authentication, artifact reader, and unavailable-path honesty are tested with bounded fixtures. | Exact Windows, Linux, or Android artifact verification and launch must run on that actual platform/architecture. |
@@ -56,10 +56,23 @@ native host, artifact, installation, or model-service evidence.
56
56
 
57
57
  The browser-WASM guide follows the same rule: it shows exact model authority
58
58
  and wiring, but leaves the download/load call behind an explicit user action.
59
- The authoritative browser contract separately proves that admitted bytes are
60
- hashed before DBOPFS completion metadata is committed, cached bytes are rehashed
61
- before offline reuse, `AbortSignal` settles as `ARCANE_AI_REQUEST_ABORTED`, and
62
- tool-call arguments are surfaced without invoking application handlers.
59
+ Focused contracts cover the plain security shape and fieldwise precedence from
60
+ load operation to provider/model binding to app configuration to SDK default
61
+ `secure:false`. They prove that omitted values inherit, the resolved `secure`
62
+ value defaults both checks, and explicit per-check booleans override that
63
+ default.
64
+
65
+ The default path proves actual bytes are counted and persisted and Wllama
66
+ confirms a loaded model without requiring descriptor `bytes` or `sha256`.
67
+ Disabled byte-length checks never compare an expected count; disabled SHA-256
68
+ checks never instantiate hashing or reread a multi-gigabyte file solely for a
69
+ digest. Enabled-check cases prove the matching descriptor field is required and
70
+ fail closed on mismatch. Status cases distinguish effective checks, per-check
71
+ outcomes, and unchecked versus enabled-check-verified integrity. The authoritative
72
+ browser contract separately proves the enabled secure path hashes stored and
73
+ cached bytes, `AbortSignal` settles as `ARCANE_AI_REQUEST_ABORTED`, and tool-call
74
+ arguments are surfaced without invoking application handlers. Model license
75
+ metadata is never treated as runtime admission evidence.
63
76
 
64
77
  ## Host and normalization cases
65
78
 
@@ -183,7 +183,7 @@ identical executable alias.
183
183
  The generated artifact is
184
184
  `apps/<id>/modules/arcane.importmap.json`. Its exact JSON is also installed in
185
185
  the app entry as `<script type="importmap" data-arcane-import-map>` before
186
- module loading. In SDK `0.1.1`, the authenticated physical-v1 runtime produces
186
+ module loading. In SDK `0.1.2`, the authenticated physical-v1 runtime produces
187
187
  86 entries and intentionally has no package-root mapping.
188
188
 
189
189
  ### Result and safety
@@ -555,7 +555,7 @@ Success returns:
555
555
  {
556
556
  packageName:'arcane-os',
557
557
  currentVersion:'0.1.0',
558
- registryVersion:'0.1.1',
558
+ registryVersion:'0.1.2',
559
559
  tag:'latest',
560
560
  status:'update-available', // or 'current' or 'ahead'
561
561
  updateAvailable:true,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "sdkVersion": "0.1.2",
3
+ "sdkVersion": "0.2.0",
4
4
  "environment": {
5
5
  "runtime": "Node.js for Node entrypoints; browser for browser-only entrypoints",
6
6
  "minimumVersion": "22.23.2 for Node entrypoints",
@@ -2641,7 +2641,7 @@
2641
2641
  "group": "Browser-WASM local AI",
2642
2642
  "summary": "Deep-frozen authority for the packaged Wllama and llama.cpp runtime, authenticated JS and WASM assets, licensing, and disabled compatibility-network policy.",
2643
2643
  "availability": "Browser metadata; import and inspection require neither DBOPFS nor a loaded model",
2644
- "protocol": "arcane-ai-browser-wasm/1 over the provider-neutral arcane-ai-adapter/1 boundary",
2644
+ "protocol": "arcane-ai-browser-wasm/2 over the provider-neutral arcane-ai-adapter/1 boundary",
2645
2645
  "normalization": "Exact immutable runtime and component identity; it contains no model weights or model catalog"
2646
2646
  },
2647
2647
  {
@@ -2649,7 +2649,7 @@
2649
2649
  "name": "createArcaneAI",
2650
2650
  "displayName": "createArcaneAI()",
2651
2651
  "kind": "function",
2652
- "signature": "createArcaneAI({ llm=null, provider=null, loadPolicy='on-demand' }={})",
2652
+ "signature": "createArcaneAI({ llm=null, provider=null, loadPolicy='on-demand', security }={})",
2653
2653
  "entrypoints": [
2654
2654
  "arcane-os/ai/browser-wasm"
2655
2655
  ],
@@ -2658,7 +2658,7 @@
2658
2658
  "summary": "Creates the provider-neutral browser AI facade and LLM lifecycle controller around one compatible provider or controller.",
2659
2659
  "availability": "Browser; the selected provider observes its own WebAssembly, storage, and model readiness",
2660
2660
  "protocol": "arcane-ai-adapter/1",
2661
- "normalization": "Normalizes lazy or manual load, lifecycle status, cancellation, streaming completion, and structural tool-call visibility without executing tools"
2661
+ "normalization": "Normalizes lazy or manual load, fieldwise app/provider/load security inheritance from SDK secure:false, lifecycle status, cancellation, streaming completion, and structural tool-call visibility without executing tools"
2662
2662
  },
2663
2663
  {
2664
2664
  "id": "browser-wasm:createBrowserModelSource",
@@ -2671,26 +2671,26 @@
2671
2671
  ],
2672
2672
  "primaryImport": "arcane-os/ai/browser-wasm",
2673
2673
  "group": "Browser-WASM local AI",
2674
- "summary": "Validates a caller-supplied immutable HTTPS model authority and creates its cancellable no-credentials download source.",
2674
+ "summary": "Validates a canonical caller-supplied {id, url, bytes?, sha256?} descriptor and creates its cancellable no-credentials HTTPS download source.",
2675
2675
  "availability": "Browser with Fetch and a readable response body; each direct open call performs its configured HTTPS fetch",
2676
- "protocol": "Caller-supplied exact model URL, expected byte length, SHA-256, license identifier, and source revision",
2677
- "normalization": "Canonical frozen descriptor and download handle; byte integrity is verified by the model store before admission"
2676
+ "protocol": "Caller-supplied immutable HTTPS model URL with optional expected byte length and SHA-256",
2677
+ "normalization": "Canonical frozen descriptor and download handle; expected fields are required and enforced only for their effective enabled checks, and model license is not runtime admission"
2678
2678
  },
2679
2679
  {
2680
2680
  "id": "browser-wasm:createBrowserWasmLlmProvider",
2681
2681
  "name": "createBrowserWasmLlmProvider",
2682
2682
  "displayName": "createBrowserWasmLlmProvider()",
2683
2683
  "kind": "function",
2684
- "signature": "createBrowserWasmLlmProvider({ source, store, loadDefaults={}, logger=console }={})",
2684
+ "signature": "createBrowserWasmLlmProvider({ source, store, loadDefaults={}, security, logger=console }={})",
2685
2685
  "entrypoints": [
2686
2686
  "arcane-os/ai/browser-wasm"
2687
2687
  ],
2688
2688
  "primaryImport": "arcane-os/ai/browser-wasm",
2689
2689
  "group": "Browser-WASM local AI",
2690
- "summary": "Creates the packaged Wllama browser provider with verified model admission, serialized inference, streaming, abort, unload, and probe operations.",
2691
- "availability": "Browser; WebAssembly required, WebGPU optional, and model loading requires verified DBOPFS bytes",
2690
+ "summary": "Creates the packaged Wllama browser provider with effective-check disclosure, honest integrity status, serialized inference, streaming, abort, unload, and probe operations.",
2691
+ "availability": "Browser; WebAssembly required, WebGPU optional, enabled checks fail closed, and successful Wllama loading is always required",
2692
2692
  "protocol": "arcane-ai-adapter/1 with OpenAI-like chat completion and streaming envelopes",
2693
- "normalization": "Frozen lifecycle/status/capability records and structured tool-call data; the SDK never invokes application tools"
2693
+ "normalization": "Frozen lifecycle/status/security/integrity records and structured tool-call data; security fields inherit by scope and the SDK never invokes application tools"
2694
2694
  },
2695
2695
  {
2696
2696
  "id": "browser-wasm:createDbopfsModelStore",
@@ -2703,10 +2703,10 @@
2703
2703
  ],
2704
2704
  "primaryImport": "arcane-os/ai/browser-wasm",
2705
2705
  "group": "Browser-WASM local AI",
2706
- "summary": "Adapts an existing DBOPFS instance into an authenticated model cache that commits metadata last and rehashes cached bytes before reuse.",
2706
+ "summary": "Adapts an existing DBOPFS instance into a model cache that records observed bytes, commits metadata last, and hashes only when SHA-256 checking is enabled.",
2707
2707
  "availability": "Browser with a ready DBOPFS instance and OPFS support",
2708
- "protocol": "arcane.ai.browser-wasm.model.v2 completion manifests over existing DBOPFS method semantics",
2709
- "normalization": "Returns verified or installed cache receipts, fail-closed offline misses, progress snapshots, and explicit removal without changing DBOPFS public names"
2708
+ "protocol": "arcane.ai.browser-wasm.model.v3 completion manifests over existing DBOPFS method semantics",
2709
+ "normalization": "Returns cached or installed receipts with observed byte count and per-check outcomes; disabled expected-length and SHA-256 checks do not compare or hash, while enabled checks fail closed"
2710
2710
  }
2711
2711
  ]
2712
2712
  }
@@ -114,7 +114,7 @@ app plus that authenticated tree. Packaging copies the same map, app entry, and
114
114
  physical bytes into `dist/<id>`; targets never resolve through the consumer
115
115
  workspace's root `node_modules/`.
116
116
 
117
- In SDK `0.1.1`, the generated map has exactly 86 entries: 73 named
117
+ In SDK `0.1.2`, the generated map has exactly 86 entries: 73 named
118
118
  `arcane/*` modules, nine `arcane/entities/*` modules, and these four focused or
119
119
  compatibility mappings:
120
120
 
@@ -168,14 +168,14 @@ heartbeat is event telemetry only and never regenerates browser state.
168
168
 
169
169
  `arcane.lock.json.sdkBrowserRuntime` persists the trusted manifest path,
170
170
  `manifestSha256`, `contentSha256`, `builder`, `sdkVersion`, and `source` record.
171
- For SDK `0.1.1` those identities are:
171
+ For SDK `0.1.2` those identities are:
172
172
 
173
173
  ```text
174
174
  manifest: node_modules/arcane-os/browser-runtime/ARCANE_SDK_BROWSER_RELEASE.json
175
- manifestSha256: 33396b3d35322b784929270e7ca0a2a8b31d899c6e77bcb227edc95b37d0ae7d
175
+ manifestSha256: 88395493b411fd5461fbb2bb065ae2b745f6d1672f796583fd248ec97f71f4f7
176
176
  contentSha256: 5e03f45a732db51cb5a2b2193cc79ecda34501d07a9b2e82e794e5fa37d55d00
177
177
  builder: arcane-sdk-browser-runtime-v1
178
- sdkVersion: 0.1.1
178
+ sdkVersion: 0.1.2
179
179
  source.protocol: arcane-sdk-browser-runtime/1
180
180
  source.browserEntry: arcane-os/event-manager
181
181
  ```